Leadership in VIM productivity with Space key

vim_spacebarThe productivity as a vimmer can be greatly increased by mapping the space key to do common tasks since space is easily accessible and it’s the largest key on the keyboard. The credit for the idea goes to Sheerun’s blog.

I’ve added some handy space key bindings to .vimrc, the vim’s configuration file found hidden in the logged in user’s home directory.

First declare space as the Leader key.

let mapleader="\<Space>"

Write, Write & Quit and Quit
With the following bindings I can keyboard
<Space>w to write,
<Space>ww to write and quit, and
<Space>q to quit without saving the file.

nnoremap <Leader>w :w<CR>
nnoremap <Leader>ww :wq<CR>
nnoremap <Leader>q :q!<CR>

Copy and paste to system clipboard with <Space>p and <Space>y

vmap y "+y
vmap d "+d
nmap p "+p
nmap P "+P
vmap p "+p
vmap P "+P

Enter visual mode with <Space> <Space>v

nmap <Leader><Leader> V

About Deepak Devanand

Seeker of knowledge
This entry was posted in vi and tagged , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s