Total Pageviews

Showing posts with label vim. Show all posts
Showing posts with label vim. Show all posts

Wednesday, 15 August 2018

使用 vimblog 来写 wordpress 文章



在台式机上有配过,用过几次,后来写博客少了,用 vim 来写就更少了。现在再在笔记本上配一次,备忘一下。
在 vim 中写(或者说管理)wordpress 的插件应该不少,至少随便找到的有 Vimpress 和 vimblog ,这里用的是后者。
使用方法很简单:
  • 下载 vimblog.vim 文件,并放到 vim 的根目录下,如:~/.vim/ 。
  • 修改 vimblog.vim 文件,在里面的 get_personal_data 函数中填上博客的信息,如:login(用户名)、passwd(密码)和 site(博客地址,不带 http://),别的参数一般不用修改。
  • 修改 vim 配置文件(.vimrc 或 gvimrc 等),在里面添加以下代码:
if !exists('*Wordpress_vim')
    runtime vimblog.vim
endif
  • 测试:vim 里运行 :Blog rp 来获取最近的 10 篇文章,有输出就 OK 了,没的话重新看下是否写错了如博客信息等。
包含的功能有:
Usage is :Blog option [arg]
 switches:
  - rp [x]   => show recent [x] posts
  - gp id    => get post with identification id
  - np       => create a new post
  - publish  => publish an edited/new post
  - draft    => save edited/new post as draft
  - gc       => get the list of categories
  - del id   => delete post with identification id

Tuesday, 14 August 2018

集中管理vim的插件


vim 是个优秀工具,其自由强大的插件是一个很重要的因素。不过一直插件都是手动管理的,搜索下载插件,然后放到指定的目录。如果要升级的话,重新走一边流程(其实很少升级,一般没什么问题,都不会留意是否有新版本,不会去升级)。迁移到别的系统中则是把 vimrc 和 .vim 目录一起复制过去。
但手动的管理插件总感觉有些什么问题,更希望能有一个地方来集中管理,包括安装、升级和移除。把分散的维护工具放在一个统一的入口来做感觉会更好。
Vbundle 是出于这个目的的一个工具,我没有直接用这个工具,而是使用其一个衍生版本 NeoBundle ,基本思路是在 vimrc 中写上相应插件的列表即可做到自动安装、可选升级和移除等。
具体使用参照 文档 ,这里简单记录一下。

  1. Install
 $ curl https://raw.githubusercontent.com/Shougo/neobundle.vim/master/bin/install.sh | sh
  1. Configure in vimrc(Sample)
if has('vim_starting')
   set nocompatible               " Be iMproved

   " Required:
   set runtimepath+=~/.vim/bundle/neobundle.vim/
 endif

 " Required:
 call neobundle#begin(expand('~/.vim/bundle/'))

 " Let NeoBundle manage NeoBundle
 " Required:
 NeoBundleFetch 'Shougo/neobundle.vim'

 " My Bundles here:
 " Refer to |:NeoBundle-examples|.
 " Note: You don't set neobundle setting in .gvimrc!

 call neobundle#end()

 " Required:
 filetype plugin indent on

 " If there are uninstalled bundles found on startup,
 " this will conveniently prompt you to install them.
NeoBundleCheck