Borys Bradel's Blog
My vim initialization file
Tags: vim October 6, 2008
The following is my vim initialization file, the ".vimrc" in my home directory:
set nocompatible " use Vim settings instead of vi
set backspace=indent,eol,start " allow backspacing over all
" following 8 lines from vimrc example (note, autocmd cannot have empty lines)
" filetype plugin indent on " autoindent files
" augroup vimrcEx " put in autocmd group for easy removal
" au!
" " jump to last known position at start
autocmd BufReadPost *
\ if line("'\"") > 0 && line("'\"") <= line("$") |
\ exe "normal g`\"" |
\ endif
colorscheme torte " this is a nice black-background scheme
syntax enable " syntax highlighting
set showmatch " paren matching when inserting
set autoindent " autoindent only works after plugin
set shiftwidth=4
set softtabstop=4
set hlsearch " highlight last search
set history=50 " keep 50 lines of history
set ruler " show cursor position all the time
" swap ; and : in command mode to avoid pressing shift too much
nnoremap ; :
nnoremap : ;
imap <TAB> <C-H>
source ~/keyboard.qwerty2colemakb
That's the entire file. The commands are commented and relatively self explanatory, except for the last two: "imap <TAB> <C-H>" and "source ~/keyboard.qwerty2colemakb".
The first of these commands maps the tab key to the erase-previous-character command, which is control-h. The second loads in a file with commands that map the qwerty keyboard to a modified Colemak layout. The layout is nice in that it avoids excessive hand movements. The best place to practice is at this site, which also shows a different good layout called Asset. For me, both Colemak and Asset are better than Qwerty and Dvorak. My modifications change the position of the non-alphanumeric keys to suit my typing habits. The modified layout has the following keys on the keyboard (from left to right):
1234567890'=
qwfpgjluy;,/\
arstdhneio-
zxcvbkm().
And the following when shift is held:
!@#$%^&*[]"+
QWFPGJLUV:{}|
ARSTDHNEIO_
ZXCYBKM<>?
Each key can be modified using the inoremap command, which indicates a mapping in interactive mode with no recursion. For example, "inoremap e f" changes an "e" to an "f".
Copyright © 2008 Borys Bradel. All rights reserved. This post is only my possibly incorrect opinion.