public
Description: My setup, partially
Homepage:
Clone URL: git://github.com/sjbach/env.git
env / dotfiles / vimrc
100644 164 lines (131 sloc) 3.759 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
set nocompatible
syntax on
filetype on
filetype plugin on
filetype indent on
 
set history=1000
set showmatch
set matchtime=0
set shortmess=atI
set ruler
set showcmd
 
set sidescroll=1
set sidescrolloff=3
 
" Set xterm title
set title
 
" Search options
set hlsearch
set incsearch
set ignorecase
set smartcase
 
set visualbell
set noerrorbells
set printoptions=paper:letter
 
" Keep more lines of context
set scrolloff=3
 
" Make backspace delete lots of things
set backspace=indent,eol,start
 
" Auto-backup files and .swp files don't go to pwd
set backupdir=~/.vim-tmp,~/.tmp,~/tmp,/var/tmp,/tmp
set directory=~/.vim-tmp,~/.tmp,~/tmp,/var/tmp,/tmp
 
" Allow switching edited buffers without saving
set hidden
 
" Look for the file in the current directory, then south until you reach home.
set tags=tags;~/
 
" Who needs .gvimrc?
if has('gui_running')
  set encoding=utf-8
  "set guifont=Monospace\ Bold\ 9
  set guifont=Bitstream\ Vera\ Sans\ Mono\ 9
  " Turn off toolbar and menu
  set guioptions-=T
  set guioptions-=m
  colorscheme inkpot
else
  colorscheme desert
end
 
" Change <Leader>
let mapleader = ","
 
" Quick timeouts on key combinations.
set timeoutlen=300
 
" Alternatives to ESC:
"imap jkl <ESC>
"imap jlk <ESC>
"imap kjl <ESC>
"imap klj <ESC>
"imap lkj <ESC>
"imap ljk <ESC>
"imap ;l <ESC>
 
" "Very magic" regexes in searches
"nnoremap / /\v
"nnoremap ? ?\v
 
" Vi-style editing in the command-line
"nnoremap : q:a
"nnoremap / q/a
"nnoremap ? q?a
 
" Lusty
"let g:LustyJugglerShowKeys = 2
let g:LustyExplorerSuppressRubyWarning = 1
"let g:LustyExplorerAlwaysShowDotFiles = 1
nmap <silent> <Leader>f :FilesystemExplorer<CR>
nmap <silent> <Leader>b :BufferExplorer<CR>
nmap <silent> <Leader>r :FilesystemExplorerFromHere<CR>
nmap <silent> <Leader>g :LustyJuggler<CR>
nmap <silent> <Leader>j :so ~/.vim/plugin/lusty-explorer.vim<CR>
nmap <silent> <TAB> :JugglePrevious<CR>
 
" Window management
"nmap <silent> <Leader>xo :wincmd j<CR>
 
" Catch trailing whitespace
set listchars=tab:>-,trail:ยท,eol:$
nmap <silent> <leader>s :set nolist!<CR>
 
" Fix command typos (stolen from Adam Katz)
nmap ; :
 
" ` is more useful than ' but less accessible.
nnoremap ' `
nnoremap ` '
 
" Buffer management
nmap <C-h> :bp<CR>
nmap <C-l> :bn<CR>
"nmap <TAB> :b#<CR>
"nmap <C-q> :bd<CR>
nmap <C-d> :bw<CR>
vmap <C-d> :bw<CR>
 
" Toggle highlighting
" nmap <silent> <C-n> :silent :set nohls!<CR>:silent :set nohls?<CR>
nmap <silent> <C-n> :silent :nohlsearch<CR>
 
" Scroll faster
nnoremap <C-e> 3<C-e>
nnoremap <C-y> 3<C-y>
vnoremap <C-e> 3<C-e>
vnoremap <C-y> 3<C-y>
 
" % matches on if/else, html tags, etc.
runtime macros/matchit.vim
 
" Bash-like filename completion
set wildmenu
set wildmode=list:longest
set wildignore=*.o,*.fasl
 
autocmd BufRead *.qcf set filetype=lisp
autocmd BufRead qpx.inc set filetype=make
autocmd BufRead letter* set filetype=mail
autocmd Filetype mail set fo -=l autoindent spell
 
" ITA indenting style
autocmd Filetype c,cpp,h set tabstop=4 softtabstop=4 shiftwidth=4 expandtab
" JSH indenting style
"autocmd Filetype c,cpp,h set tabstop=8 softtabstop=4 shiftwidth=4 noexpandtab
" Wimba indenting style, sort-of
"autocmd Filetype c,cpp,h set tabstop=2 softtabstop=2 shiftwidth=2 expandtab
" Viewglob
"autocmd Filetype c,cpp,h,sh set cindent autoindent
 
autocmd Filetype sh set ts=4 shiftwidth=2 expandtab
autocmd Filetype lisp,ruby,xml,html set ts=8 shiftwidth=2 expandtab
autocmd Filetype python set ts=4 shiftwidth=4 expandtab
autocmd Filetype xml,xslt,diff,ruby color desert
autocmd Filetype xml,xslt,diff,ruby set expandtab
autocmd BufReadPre viper,.viper set filetype=lisp
 
" a.vim
nmap <silent> <Leader>h :A<CR>
 
" Indent XML readably
function! DoPrettyXML()
1,$!xmllint --format --recover -
endfunction
command! PrettyXML call DoPrettyXML()