Compile Vim In Ubuntu with multi-byte and xterm_clipboard Feature

tag: vim ubuntu make multi-byte encoding xterm clipboard

Reference:

http://vim.wikia.com/wiki/Building_Vim
http://vim.wikia.com/wiki/Clipboard
http://www.linuxforums.org/forum/newbie/144575-problems-copying-pasting-vim.html


Preface:

I'm a Linux starter who like pure command line interface. So I just installed Ubuntu 10.04 without GUI. And later I installed fluxbox environment under the instructions here. This article describes how to compile a multi-byte and xterm_clipboard (system clipboard) supported vim.

Why multi-byte?
I need to work with Chinese files
Why xterm_clipboard?
It will be easy for you copy and paste around in X system. And it is faster than build-in registers when the content is bigger.

Get latest Vim source code:

Pls follow the instructions on Vim's main page

To quickly build a vim:
cd /usr/local/src/vim/src
./configure
# you'd better remove original vim package on you machine before this step
sudo make install


Add multi-byte support:
#replace ./configure with following
./configure --with-features=big


Add xterm_clipboard Support:

Check if your vim supports xterm_clipboard:
  • ":version" vim command
  • "vim --version"

There will be a string "-xterm_clipboard or +xterm_clipboard"

Install build dependencies:
"sudo apt-get install" or "sudo aptitude install":
  • libncurses5-dev
  • libgtk2.0-dev
  • libatk1.0-dev
  • libx11-dev
  • libxt-dev

.configure --with-features=big --enable-gui=gtk2
.make
sudo make install


Clipboard Operation:

When you have a +xterm_clipboard version of vim, you can use following commands to operate system clipboard.
  • "+yy or "*yy to copy to clipboard
  • "+p or "*p to paste from clipboard

Notes:
  • With a multi-byte supported Vim, you also need a correctly configed x-term emulator (encoding). Or the Chinese characters will still be a mess.
  • I did not get a gvim through this process. And I don't know how to do that. But I'm happy because what I need is just s light weight, fast vim in terminal.
  • If you need a vim-gnome, please refer to the first reference link
  • System clipboard will be associated with different vim register on different platforms. It will always be "*" in windows version. And "+" in the build discussed here.

你可能感兴趣的:(windows,linux,ubuntu,vim,bash)