Vim

Misc

不同平台下的运行时路径查询:help runtimepath

X11支持

Ubuntu里面的vim包没有X11的支持,所以不支持X11 Selection,也不支持clipboard选项:

$ /usr/bin/vim.basic --version|grep ' .x'

-X11 -xfontset -xim -xsmp -xterm_clipboard -xterm_save

      用户 exrc 文件: "$HOME/.exrc"

要安装vim-gnome之类的支持X11的才行:

$ /usr/bin/vim.gnome --version|grep ' .x'

+X11 -xfontset +xim +xsmp_interact +xterm_clipboard -xterm_save

      用户 exrc 文件: "$HOME/.exrc"

这样在X下的vim虽然也是字符界面的,但是支持X11的选择了。具体用法见help x11-selection(7.2版):

Examples: (assuming the default option values)

- Select an URL in Visual mode in Vim.  Go to your browser and click the

  middle mouse button in the URL text field.  The selected text will be

  inserted (hopefully!).  Note: in Firefox you can set the

  middlemouse.contentLoadURL preference to true in about:config, then the

  selected URL will be used when pressing middle mouse button in most places

  in the window.

- Select some text in your browser by dragging with the mouse.  Go to Vim and

  press the middle mouse button: The selected text is inserted.

- Select some text in Vim and do "+y.  Go to your browser, select some text in

  a textfield by dragging with the mouse.  Now use the right mouse button and

  select "Paste" from the popup menu.  The selected text is overwritten by the

  text from Vim.

一些偶然发现的快捷键

在插入模式下: