Leeland's picture

I grew up using vi. Never got into emacs. Then along came vim. I ignored it of course. Then suddenly vi was gone and vim was quietly mapped to vi. Oh well, had to learn sometime.

== .vimrc ==
Almost all of my vim magic is embodied in my ~/.vimrc file.

au FileType * set tabstop=4|set shiftwidth=4|set noexpandtab
au FileType python set tabstop=4|set shiftwidth=4|set softtabstop=4|set expandtab
au FileType make setlocal noexpandtab|set softtabstop=4

" Make backspace a tad more friendly
set backspace=indent,eol,start

" "highlight" any tabs and all trailing spaces
map \l <Esc>:set list listchars=tab:»·,trail:·<CR>
map \L <Esc>:set nolist<CR>

" Programming "highlight" any tabs and all trailing spaces
map \p <Esc>:set number list listchars=tab:\\|_,trail:.<CR>
map \P <Esc>:set nonumber nolist<CR>

" That awful mixed mode with the half-tabs-are-spaces:
map \M <Esc>:set expandtab tabstop=8 softtabstop=4 shiftwidth=4<CR>

" Mini tabs, small "m":
map \m <Esc>:set noexpandtab tabstop=2 shiftwidth=2<CR>

" Think "little tabs" and "big tabs":
map \t <Esc>:set noexpandtab tabstop=4 shiftwidth=4<CR>
map \T <Esc>:set noexpandtab tabstop=8 shiftwidth=8<CR>

" Turn on and off line numbering
map \n <Esc>:set number<CR>
map \N <Esc>:set nonumber<CR>

" Working with split files ( :sp name-of-another-file-to-edit )
" move to the file in the split above my current window,
" I was typing Ctrl-W, Up (move up a window) Ctrl-W, _ (maximize the menu).
" That's four keystrokes (more if you count Ctrl and Shift), and they are
" all over the keyboard. To help avoid this problem, I created this mapping:
map <C-J> <C-W>j<C-W>_
map <C-K> <C-W>k<C-W>_

" By default, Vim displays the current line of each minimized file, which
" (to me) isn't much help and takes up too much screen real estate. So I use
" this line to change that to no lines:
set wmh=0

" One may also do the dual thing for vertical splits/window changes:
set wmw=0
nmap <c-h> <c-w>h<c-w><bar>
nmap <c-l> <c-w>l<c-w><bar>

" remap the color scheme by hitting f4 and wrapping
nnoremap <f4> :exec "colorscheme ".substitute(substitute(expand($VIMRUNTIME."/colors/*.vim"),'.*[/\\]'.colors_name.'\.vim\c[[:cntrl:]]*[^[:cntrl:]]*[/\\]\([^.]*\).*','\1', 'g'),'[^[:cntrl:]]*[/\\]\([^.]*\).vim\c.*','\1','')<CR><CR>
nnoremap <F5> :echo g:colors_name<CR>
colorscheme desert

Comments

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Allowed HTML tags: <em> <strong> <b> <i> <big> <small> <sub> <sup> <cite> <code> <ul> <ol> <li> <dl> <lh> <dt> <dd> <br> <p> <table> <th> <td> <tr> <pre> <blockquote> <h1> <h2> <h3> <h4> <h5> <h6> <hr>
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.

More information about formatting options

By submitting this form, you accept the Mollom privacy policy.