Fancier Vim

From 0xWIKI
Jump to: navigation, search

Below are some ways to make vim fancier/easier to use.

System Clipboard

Making vim work with the system clipboard is simple. First you must compile it with the 'vim-with-x' use flag. After that, simply insert/append the following into the '/etc/vim/vimrc.local'(system wide) configuration file:

" Make standard copy/cut/paste functionality work with the system clipboard
vmap <C-c> "+y
vmap <C-x> "+d
imap <C-v> <Esc>"+pi

Now you should be able to select text (ie. visual mode) and hit ctrl-c to copy it, or ctrl-x to cut it to the system clipboard. To paste, use ctrl-v from insert mode.

Man Pages With Vim

To view man pages using vim, you must compile vim with the 'vim-pager' use flag. Then just add a line to set your pager in a file such as '/etc/profile.d/custom.sh' or something that is used when starting a shell (eg. '.bashrc', et. al.). Example:

# /etc/profile.d/custom.sh
export PAGER=/usr/bin/vimmanpager

It should just be as simple as that.

Personal tools