-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathvimrc
391 lines (360 loc) · 8.73 KB
/
vimrc
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
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
set t_Co=256
set ambiwidth=single
set autoindent
set backupcopy=auto
set backupext=~
set backupskip=~/.vim.tmp/*
set backspace=2
set bufhidden=
set buflisted
set buftype=
set cdpath=,,
set cedit=^F
set charconvert=
set cinoptions=
set cscopepathcomp=0
set cscopeprg=cscope
set cscopequickfix=
set cscopetagorder=0
set debug=
set dictionary=
set diffexpr=
set diffopt=filler
set display=
set eadirection=both
set endofline
set equalalways
set equalprg=
set esckeys
set eventignore=
set fileencoding=
set fileformat=unix
set filetype=
set formatoptions=cq
set formatprg=
set helplang=
set history=50
set iconstring=
set iminsert=0
set imsearch=0
set includeexpr=
set indentexpr=
set isprint=@,161-255
set nojoinspaces
set key=
set keymap=
set keymodel=
set keywordprg=man
set langmap=
set langmenu=
set laststatus=1
set listchars=eol:$
set loadplugins
set magic
set makeef=
set makeprg=make
set matchtime=5
set maxfuncdepth=100
set maxmapdepth=1000
set maxmem=72824
set maxmemtot=72824
set menuitems=25
set modeline
set modelines=5
set modifiable
set modified
set more
set mouse=
set mousemodel=extend
set mousetime=500
set noallowrevins
set noaltkeymap
set noarabic
set noautoread
set noautowrite
set noautowriteall
set nobackup
set nobinary
set nobomb
set nocindent
set nocompatible
set noconfirm
set nocopyindent
set nocscopetag
set nocscopeverbose
set nodelcombine
set nodiff
set nodigraph
set noedcompatible
set noerrorbells
set expandtab
set noexrc
set nofkmap
set nogdefault
set nohidden
set nohkmap
set nohkmapp
set nohlsearch
set noicon
set noignorecase
set noincsearch
set noinfercase
set noinsertmode
set nolazyredraw
set nolinebreak
set nolisp
set nolist
set nonumber
set nopaste
set nopreserveindent
set nopreviewwindow
set noreadonly
set norevins
set norightleft
set noscrollbind
set nosecure
set noshiftround
set noshortname
set noshowcmd
set noshowfulltag
set noshowmatch
set nosmartcase
set nosmartindent
set nosmarttab
set nosplitbelow
set nosplitright
set notermbidi
set noterse
set notextmode
set notildeop
set notitle
set nottimeout
set novisualbell
set noweirdinvert
set nowildmenu
set nowriteany
set pastetoggle=
set patchexpr=
set patchmode=
set printdevice=
set printencoding=
set printfont=courier
set printoptions=
set remap
set report=2
set ruler
set rulerformat=
set scrolljump=1
set scrolloff=0
set selectmode=
set shellcmdflag=-c
set shellquote=
set shellxquote=
set shiftwidth=2
set showbreak=
set showmode
set sidescroll=0
set sidescrolloff=0
set softtabstop=0
set startofline
set statusline=
set suffixesadd=
set swapfile
set swapsync=fsync
set switchbuf=
set syntax=
set tabstop=4
set tagbsearch
set taglength=0
set tagrelative
set tagstack
set termencoding=
set textauto
set textwidth=0
set thesaurus=
set notimeout " affects leader key timeout
set timeoutlen=1000
set titlelen=85
set titlestring=
set ttimeoutlen=-1
set ttybuiltin
set ttyfast
set ttymouse=
set ttyscroll=999
set ttytype=ansi
set undolevels=1000
set updatecount=200
set updatetime=4000
set verbose=0
set virtualedit=
set warn
set whichwrap=b,s
set wildchar=<Tab>
set wildcharm=0
set wildignore=
set wildmode=full
set winminwidth=1
set winwidth=20
set wrap
set wrapmargin=0
set wrapscan
set write
set writebackup
set writedelay=0
" --------------------------------------------------------
" functions
" --------------------------------------------------------
function! ToggleSyntax()
if exists("g:syntax_on")
silent syntax off
else
silent syntax enable
endif
endfunction
function! NiceWrap()
if &l:textwidth == 0
let b:clear_wrap = 1
set textwidth=78
else
let b:clear_wrap = 0
endif
:normal gq}
if b:clear_wrap
set textwidth=0
endif
unlet b:clear_wrap
endfunction
" --------------------------------------------------------
" favourite aliases
" --------------------------------------------------------
let mapleader=" "
nmap <leader>- :set noai<CR>
nmap <leader>= :set ai<CR>
"
" Once you have a vsplit, you can switch between sides
" using these shortcuts.
nmap <leader>[ :wincmd h<CR>
nmap <leader>] :wincmd l<CR>
nmap <leader><BS> :bdelete<CR>
nmap <leader>' :call NiceWrap()<CR>
nmap <leader>j gj
nmap <leader>k gk
nmap <leader>h :bp<CR>
nmap <leader>l :bn<CR>
" make and run
nmap <leader>m :make<CR>
nmap <leader>? :put =strftime('@%Y%m%d %H%M')<CR>
nmap <leader>. :put =strftime('%Y%m%d')<CR>
nmap <leader>/ :put =strftime('@%H%M')<CR>
" tmux
nmap <leader>, :execute 'silent !tmux send-keys -t left "vexec ./app" Enter'<CR>
nmap <leader>\ :execute 'silent !tmux send-keys -t left C-c'<CR>
nmap <leader><CR> :execute 'silent !tmux send-keys -t left C-m'<CR>
" plan
nmap <leader>f /^:plan<CR>
nmap <leader>d /^:head<CR>
nmap <leader>c /^:tail<CR>
nmap <leader>b :buffer<SPACE>
nmap <leader>B :buffers<CR>
nmap <leader>e :e<SPACE>
nmap <leader>r :r<SPACE>
nmap <leader>w :w<CR>
nmap <leader>W :!sudo tee % > /dev/null
vmap <leader>p :!pwspace<CR>
nmap <leader>P :%!pwspace<CR>
nmap <leader>p :!pwd<CR>
nmap <leader>p :!pwd -P<CR>
nmap <leader>q :q<CR>
nmap <leader>s :call ToggleSyntax()<CR>
nmap <leader>` :silent !retag<CR>
"nmap <leader>n :silent !nano<CR><C-F><C-B>
nmap <leader>t :set textwidth=78<CR>
nmap <leader>y :set textwidth=0<CR>
nmap <leader>; :
map <leader>1 :!
nmap <leader>2 :retab<CR>
nmap <leader>@ :set expandtab!<CR>:set expandtab?<CR>:set sw=2<CR>
nmap <leader>3 O#<ESC>O#<ESC>o# <ESC>a
nmap <leader># O--<CR><ESC>O--<CR><ESC>kO-- <ESC>a
nmap <leader>4 O--------------------------------------------------------<ESC>O--------------------------------------------------------<ESC>o<SPACE><SPACE><SPACE><SPACE>
nmap <leader>5 :set ai<CR>O<ESC>a =========================================<ESC>O<ESC>a =========================================<ESC>o
nmap <leader>% :set ai<CR>O<ESC>a =========================================<ESC>O<ESC>a^ =========================================<ESC>O
nmap <leader>6 O# --------------------------------------------------------<ESC>O# --------------------------------------------------------<ESC>o# <ESC>a
nmap <leader>& O// --------------------------------------------------------<ESC>O// --------------------------------------------------------<ESC>o// <ESC>a
nmap <leader>7 O-------------------------------------------------------- */<ESC>O/* --------------------------------------------------------<ESC>o <ESC>a
nmap <leader>8 O------------------------------------------------------ --]]<ESC>O--[[ ------------------------------------------------------<ESC>o <ESC>a
nmap <leader>9 O// ------------------------------------------------------------------------<ESC>O// ------------------------------------------------------------------------<ESC>o// <ESC>a
" This is useful for backing out in autoindent
map <C-o> <BS><BS><BS><BS>
" --------------------------------------------------------
" config niceties
" --------------------------------------------------------
"
" syntax highlighting
set background=dark
if has("gui_running")
set background=light
endif
"
" http://www.linusakesson.net/programming/syntaxhighlighting/
sy on
"
" danger is my middle name
set backupcopy=auto
"
" abolish 'this file has changed since you last..' msg
set autoread
"
" allow multiple buffers to be open at once
set hidden
"
" trim message sizes
set shortmess=atIT
"
" no beeping please
set visualbell
"
" to do with the way files are loaded
set wildmode=longest,list
set wildmenu
" --------------------------------------------------------
" makefiles
" --------------------------------------------------------
" in makefiles, don't expand tabs to spaces, since actual tab characters are
" needed, and have indentation at 8 chars to be sure that all indents are tabs
" (despite the mappings later):
autocmd FileType make set noexpandtab shiftwidth=8 softtabstop=0
" --------------------------------------------------------
" ctags
" --------------------------------------------------------
" http://blog.vinceliu.com/2007/08/vim-tips-for-java-2-using-exuberant.html
autocmd FileType java set tags=~/.java_tags
"set tags=./tags;~/Projects
set tags=./tags
" --------------------------------------------------------
" hacks to get around annoyances
" --------------------------------------------------------
"
" disable the title bar in gvim
set guioptions-=T
"
" turns off some rubbish in a linux distribution
" somewhere that annoyed the hell out of me at some time.
filetype indent off
filetype plugin off
filetype plugin indent off
"
" terra syntax highlighting
au BufRead,BufNewFile *.terra setfiletype terra
" --------------------------------------------------------
" unicode
" --------------------------------------------------------
if has("multi_byte")
if &termencoding == ""
let &termencoding = &encoding
endif
set encoding=utf-8
setglobal fileencoding=utf-8
"setglobal bomb
set fileencodings=ucs-bom,utf-8,latin1
endif