VIM - zzzz~~~'s Blog

VIM MetaWeblog 插件

VIM MetaWeblog 插件

基本功能已经完结,以后就是加入新功能和修复 BUG 的问题了。

下载地址: https://github.com/liuyug/vim-metaweblog

安装请看 README.RST

上一篇 VIM MetaWeblog 也是同样的

VIM MetaWeblog

VIM MetaWeblog

Author: Yugang LIU <liuyug@gmail.com>
Github:https://github.com/liuyug/vim-metaweblog
VIM:http://www.vim.org/scripts/script.php?script_id=4411

Submit your RST article in VIM to Blog with metaweblog interface.

Feature:

  • direct submit RST article to Blog.
  • support HTML article
  • automatic upload image resource and fix link for RST when new post
  • browse recent blogs
  • delete blog
  • upload file manually

Install

  1. Please install Docutils as RST tools, and Pygments for syntax highlight
  1. install VIM plugin
cp plugin/metaweblog.vim  ~/.vim/plugin/metaweblog.vim
  1. Create new configuration file in ~/.vim/password.vim
1 # password.vim
2 let g:MetaWeblog_api_url='http://www.is-programmer.com/xmlrpc'
3 let g:MetaWeblog_username='username'
4 let g:MetaWeblog_password='password'
  1. Install CSS to support style:
1 # RST CSS style
2 cat /usr/lib/python2.6/site-packages/docutils/writers/html4css1/html4css1.css > blog.css
3 # code with scrolled bar
4 echo "pre.code { overflow: auto; }" >> bslog.css
5 # syntax highlight
6 pygmentize -S default -f html -a pre.code >> blog.css
  1. Upload blog.css to Blog site.

Note

Please set UTF-8 encoding in VIM

Guide

VIM shortcut keys:

<leader>bl      toggle recent blog view
<leader>bp      post article
<leader>bu      upload file under cursor in html
<leader>bb      preview for local
<leader>bs      preview for server

TODO

  • How to locate original RST file by the article in Blog?

Vim Rst Post

Vim Rst Post

Date:2013-01-19
Tags:test, vim, code

Hello, post in vim.

中文测试!

Syntax hightlight

echo "hello"
echo "this is a test"
#include <stdio.h>
int main()
{
    printf("hello, test...\n");
}

Image

linux logo

Image: same above

linux logo

html modified, version 2

RST with Pygments

RST with Pygments

Pygments 为 RST 提供语法高亮度功能,但 docutils 中的 rst2html.py 不支持 Pygments 的 style 功能,下面是一种不修改程序的解决办法。

# 创建独立的 pygments css 文件
echo "pre.code { overflow: auto; }" > ~/.pygments.css
pygmentize -S monokai -f html >> ~/.pygments.css

# --syntax-highlight 使用 short 格式
# --stylesheet-path css 文件路径,多个 css 文件中间用 , 分隔
# html4css1.css docutils 默认的 css 文件
rst2html.py --syntax-highlight=short --stylesheet-path=/usr/lib/python2.6/site-packages/docutils/writers/html4css1/html4css1.css,/home/${USER}/.pygments.css input.rst




Host by is-Programmer.com | Power by Chito 1.3.3 beta | © 2007 LinuxGem | Design by Matthew "Agent Spork" McGee