Tuesday, January 24, 2012

Easing vim use

The following is a vim script that makes it easier to use vim for those who are familiar with graphical editors:

:map  :q!
:map <C-c> :w !xclip
:map <C-v> :r!xclip -o
:map <C-w> :wq!
:map <C-z> :u 


To use the above, just save the above contents to a file (say, easyedit.vim, in the home directory ~/easyedit.vim) and include the following into the ~/.vimrc file as follows:

so ~/easyedit.vim


Then start up vim, and you can see that you can use ctrl-c, ctrl-v, ctrl-z, ctrl-w and esc buttons and see behavior as expected in a graphical editor

2 comments:

  1. shell says:

    :r!xclip -o
    shell returned 127

    Press ENTER or type command to continue

    ReplyDelete
  2. Looks like xclip is not there

    Install it using:

    # Opensuse

    zypper install xclip

    # Ubuntu

    aptitude install xclip

    ReplyDelete