1
2
"-----------------------------------------------------------------------
3
"Hunner's vimrc based on BaSS & ciaran
4
"-----------------------------------------------------------------------
5
6
"-----------------------------------------------------------------------
7
" terminal setup
8
"-----------------------------------------------------------------------
9
" {{{1
10
11
" This may contain utf-8 script
12
scriptencoding utf-8
13
14
" Want utf8 at all times
15
set termencoding=utf-8
16
set encoding=utf-8
17
set fileencoding=utf-8
18
19
" change cursor colour depending upon mode
20
if exists('&t_SI')
21
  let &t_SI = "\<Esc>]12;lightgoldenrod\x7"
22
  let &t_EI = "\<Esc>]12;greenyellow\x7"
23
elseif has("gui")
24
  set guicursor=n-v-c:block-Cursor/lCursor,ve:ver35-Cursor,o:hor50-Cursor,i-ci:ver25-Cursor/lCursor,r-cr:hor20-Cursor/lCursor,sm:block-Cursor-blinkwait175-blinkoff150-blinkon175
25
endif
26
27
" Clear autocommands for re-sourceing
28
autocmd!
29
30
31
" }}}1
32
33
"-----------------------------------------------------------------------
34
" settings
35
"-----------------------------------------------------------------------
36
" {{{1
37
38
" Don't be compatible with vi {{{2
39
set nocompatible
40
41
" Enable a nice big viminfo file {{{2
42
set viminfo='1000,f1,:1000,/1000
43
set history=500
44
45
" Return to last line on reopening file {{{2
46
if has("autocmd")
47
  autocmd BufReadPost *
48
        \ if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g`\"" | endif
49
endif
50
51
" Abbreviate output of commands {{{2
52
set shortmess=a
53
54
" Make backspace delete lots of things {{{2
55
set backspace=indent,eol,start
56
57
" Don't create backups {{{2
58
"set nobackup
59
60
" Show us the command we're typing {{{2
61
set showcmd
62
63
" Highlight matching parens {{{2
64
set showmatch
65
66
" Search options: incremental search, highlight search {{{2
67
set hlsearch
68
set incsearch
69
70
" Case insensitivity for searching {{{2
71
set ignorecase
72
set infercase
73
74
" Show full tags when doing search completion {{{2
75
set showfulltag
76
77
" Speed up macros with lazyredraw {{{2
78
set lazyredraw
79
80
" No annoying error noises {{{2
81
set noerrorbells
82
set visualbell t_vb=
83
if has("autocmd")
84
  autocmd GUIEnter * set visualbell t_vb=
85
endif
86
87
" Scroll buffers of 3x2 {{{2
88
set scrolloff=3
89
set sidescrolloff=2
90
91
" Wrap on < > [ ] too {{{2
92
set whichwrap+=<,>,[,]
93
94
" Use the cool tab complete wildmenu {{{2
95
set wildmenu
96
set wildignore+=*.o,*~,.lo
97
set suffixes+=.in,.a,.1
98
99
" Allow edit buffers to be hidden {{{2
100
set hidden
101
102
" Enable syntax highlighting {{{2
103
if has("syntax")
104
  syntax on
105
endif
106
107
" enable virtual edit in vblock mode, and one past the end {{{2
108
set virtualedit=block
109
110
" Set our fonts {{{2
111
"if has("gui_kde")
112
"  set guifont=Terminus/12/-1/5/50/0/0/0/0/0
113
"elseif has("gui_gtk")
114
"  set guifont=Terminus\ 12
115
"elseif has("gui_running")
116
"  set guifont=-xos4-terminus-medium-r-normal--12-140-72-72-c-80-iso8859-1
117
"endif
118
119
" Try to load a nice colourscheme {{{2
120
if ! has("gui_running")
121
  set t_Co=256
122
  colors inkpot
123
else
124
  colors ir_black
125
  " Turn off the menubar so we don't get key accelerators with Meta.
126
  " Don't include the toolbar
127
  set guioptions=aegit
128
endif
129
" set background=light gives a different style, feel free to choose between them.
130
set background=dark
131
"colors peaksea
132
133
" No icky toolbar, menu or scrollbars in the GUI {{{2
134
"if has('gui')
135
"    set guioptions-=m
136
"    set guioptions-=T
137
"    set guioptions-=l
138
"    set guioptions-=L
139
"    set guioptions-=r
140
"    set guioptions-=R
141
"end
142
143
" By default, go for an indent of 4 and use spaces {{{2
144
set expandtab
145
set shiftwidth=4
146
set tabstop=4
147
148
" Do clever indent things. Don't make a # force column zero. {{{2
149
set autoindent
150
set smartindent
151
inoremap # X<BS>#
152
153
" Disable folds by default; toggle with zi {{{2
154
if has("folding")
155
  fun! ToggleFoldmethod()
156
    if &foldmethod == "marker"
157
      set foldmethod=syntax
158
    else
159
      set foldmethod=marker
160
    endif
161
  endfun
162
  command! Tfdm call ToggleFoldmethod()
163
  set nofoldenable
164
  set foldmethod=syntax
165
  set foldlevelstart=0 " Start with all folds closed
166
  "set foldclose=all " Close folds when cursor leaves them
167
endif
168
169
" Syntax when printing {{{2
170
set popt+=syntax:y
171
172
" Enable filetype settings {{{2
173
if has("eval")
174
  filetype on
175
  filetype plugin on
176
  filetype indent on
177
endif
178
179
" Enable modelines only on secure vim versions {{{2
180
if (v:version >= 604)
181
  set modeline
182
else
183
  set nomodeline
184
endif
185
186
" Nice statusbar {{{2
187
set laststatus=2
188
set statusline=
189
set statusline+=%2*%-3.3n%0*\                " buffer number
190
set statusline+=%f\                          " file name
191
if has("eval")
192
  let g:scm_cache = {}
193
  fun! ScmInfo()
194
    let l:key = getcwd()
195
    if ! has_key(g:scm_cache, l:key)
196
      if (isdirectory(getcwd() . "/.git"))
197
        let g:scm_cache[l:key] = "[" . substitute(readfile(getcwd() . "/.git/HEAD", "", 1)[0],
198
              \ "^.*/", "", "") . "] "
199
      else
200
        let g:scm_cache[l:key] = ""
201
      endif
202
    endif
203
    return g:scm_cache[l:key]
204
  endfun
205
  set statusline+=%{ScmInfo()}             " scm info
206
endif
207
set statusline+=%h%1*%m%r%w%0*               " flags
208
set statusline+=\[%{strlen(&ft)?&ft:'none'}, " filetype
209
set statusline+=%{&encoding},                " encoding
210
set statusline+=%{&fileformat}]              " file format
211
if filereadable(expand("$VIM/vimfiles/plugin/vimbuddy.vim"))
212
  set statusline+=\ %{VimBuddy()}          " vim buddy
213
endif
214
set statusline+=%=                           " right align
215
set statusline+=%2*0x%-8B\                   " current char
216
set statusline+=%-14.(%l,%c%V%)\ %<%P        " offset
217
218
" special statusbar for special windows
219
"if has("autocmd")
220
"    au FileType qf
221
"                \ if &buftype == "quickfix" |
222
"                \     setlocal statusline=%2*%-3.3n%0* |
223
"                \     setlocal statusline+=\ \[Compiler\ Messages\] |
224
"                \     setlocal statusline+=%=%2*\ %<%P |
225
"                \ endif
226
"
227
"    fun! <SID>FixMiniBufExplorerTitle()
228
"        if "-MiniBufExplorer-" == bufname("%")
229
"            setlocal statusline=%2*%-3.3n%0*
230
"            setlocal statusline+=\[Buffers\]
231
"            setlocal statusline+=%=%2*\ %<%P
232
"        endif
233
"    endfun
234
"
235
"    au BufWinEnter *
236
"                \ let oldwinnr=winnr() |
237
"                \ windo call <SID>FixMiniBufExplorerTitle() |
238
"                \ exec oldwinnr . " wincmd w"
239
"endif
240
241
" Nice window title {{{2
242
if has('title') && (has('gui_running') || &title)
243
  set titlestring=
244
  set titlestring+=%f\                                              " file name
245
  set titlestring+=%h%m%r%w                                         " flags
246
  "set titlestring+=\ -\ %{v:progname}                               " program name
247
  set titlestring+=\ -\ %{substitute(getcwd(),\ $HOME,\ '~',\ '')}  " working directory
248
endif
249
250
" Backups and undos across edits {{{2
251
if v:version >= 702
252
  set backupdir=~/.vim/backups
253
endif
254
" NB: :help usr_32.txt or undo-branches
255
if v:version >= 703
256
  set undodir=~/.vim/backups
257
  set undofile
258
endif
259
260
" Use blowfish for :X encryption {{{2
261
if v:version >= 703
262
  set cryptmethod=blowfish
263
endif
264
265
" If possible, try to use a narrow number column. {{{2
266
if v:version >= 700
267
  try
268
    setlocal numberwidth=3
269
  catch
270
  endtry
271
endif
272
273
" Include $HOME in cdpath {{{2
274
if has("file_in_path")
275
  let &cdpath=','.expand("$HOME").','.expand("$HOME").'/work'
276
endif
277
278
" Better include path {{{2
279
set path+=src/,include/
280
let &inc.=' ["<]'
281
282
" Show tabs and trailing whitespace visually {{{2
283
if (&termencoding == "utf-8") || has("gui_running")
284
  if v:version >= 700
285
    set list listchars=tab:»·,trail:·,extends:…,nbsp:‗
286
  else
287
    set list listchars=tab:»·,trail:·,extends:…
288
  endif
289
else
290
  if v:version >= 700
291
    set list listchars=tab:>-,trail:.,extends:>,nbsp:_
292
  else
293
    set list listchars=tab:>-,trail:.,extends:>
294
  endif
295
endif
296
map <silent> <F9> :set noet<CR>:set sw=8<CR>:set ts=8<CR>
297
map <silent> <S-F9> :set list! listchars<CR>
298
299
" Show lines longer than 80 characters {{{2
300
"au BufWinEnter * let w:m1=matchadd('Search', '\%<81v.\%>77v', -1)
301
"au BufWinEnter * let w:m2=matchadd('ErrorMsg', '\%>80v.\+', -1)
302
303
" Fill folds with ' ' {{{2
304
set fillchars=fold:\ 
305
306
307
" }}}1
308
309
"-----------------------------------------------------------------------
310
" completion
311
"-----------------------------------------------------------------------
312
" {{{1
313
314
set dictionary=/usr/share/dict/words
315
316
317
" }}}1
318
319
"-----------------------------------------------------------------------
320
" miniBufExpl
321
"-----------------------------------------------------------------------
322
" {{{1
323
324
"let g:miniBufExplMapWindowNavVim = 1
325
"let g:miniBufExplMapWindowNavArrows = 1
326
"let g:miniBufExplMapCTabSwitchBufs = 1
327
"let g:miniBufExplModSelTarget = 1 
328
329
330
" }}}1
331
332
"-----------------------------------------------------------------------
333
" autocmds
334
"-----------------------------------------------------------------------
335
" {{{1
336
337
" Show the column and/or line of the cursor {{{2
338
"au VimEnter,BufEnter,WinEnter * set cursorcolumn " cursorline
339
"au WinLeave * set nocursorcolumn " nocursorline
340
341
" content creation {{{2
342
if has("autocmd")
343
  augroup puppet " {{{3
344
    autocmd BufRead,BufNewFile *.pp
345
          \ set tabstop=2 shiftwidth=2 softtabstop=2
346
  augroup END
347
  augroup text " {{{3
348
    autocmd BufRead,BufNewFile *.txt
349
          \ set nonumber tw=80
350
  augroup END
351
  augroup gnupg " {{{3
352
    autocmd BufRead,BufNewFile *.gpg
353
          \ set nobackup
354
  augroup END
355
  augroup helphelp " {{{3
356
    " For help files, move them to the top window and make <Return>
357
    " behave like <C-]> (jump to tag)
358
    "autocmd FileType help :call <SID>WindowToTop()
359
    autocmd FileType help nmap <buffer> <Return> <C-]>
360
  augroup END
361
  augroup interplangs " {{{3
362
    autocmd BufNewFile *.rb 0put ='# vim: set sw=2 sts=2 et tw=80 :' |
363
          \ 0put ='#!/usr/bin/env ruby' | set sw=2 sts=2 et tw=80 |
364
          \ norm G
365
366
    autocmd BufNewFile,BufRead *.rb,*rhtml,*haml
367
          \ set tabstop=2 shiftwidth=2 softtabstop=2 |
368
          \ setf eruby
369
370
    autocmd BufNewFile,BufRead *.php
371
          \ set ai
372
  augroup END
373
  augroup tex " {{{3
374
    autocmd BufNewFile *.tex
375
          \ 0put ='% vim:set ft=tex spell:'
376
  augroup END
377
  augroup html " {{{3
378
    autocmd BufNewFile *.htm,*.html
379
          \ 0put ='<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.1//EN\" \"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd\">' |
380
          \ $put ='<html xml:lang=\"en\" xmlns=\"http://www.w3.org/1999/xhtml\">' |
381
          \ $put ='  <head>' |
382
          \ $put ='    <title></title>' |
383
          \ $put ='    <meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />' |
384
          \ $put ='    <link href=\"\" rel=\"stylesheet\" type=\"text/css\" />' |
385
          \ $put ='    <style type=\"text/css\">' |
386
          \ $put ='    </style>' |
387
          \ $put ='  </head>' |
388
          \ $put ='  <body>' |
389
          \ $put ='  </body>' |
390
          \ $put ='</html>' |
391
          \ $put ='<!-- vim: set sw=2 sts=2 et tw=80 : -->' |
392
          \ set sw=2 sts=2 et tw=80 | norm G
393
  augroup END
394
  augroup autotools " {{{3
395
    autocmd BufNewFile *.hh 0put ='/* vim: set sw=4 sts=4 et foldmethod=syntax : */' |
396
          \ 1put ='' | call MakeIncludeGuards() |
397
          \ 5put ='#include \"config.h\"' |
398
          \ set sw=4 sts=4 et tw=80 | norm G
399
400
    autocmd BufNewFile *.c 0put ='/* vim: set sw=4 sts=4 et foldmethod=syntax : */' |
401
          \ 1put ='' | 2put ='' | call setline(3, '#include "' .
402
          \ substitute(expand("%:t"), ".c$", ".h", "") . '"') |
403
          \ set sw=4 sts=4 et tw=80 | norm G
404
405
    autocmd BufNewFile *.cc 0put ='/* vim: set sw=4 sts=4 et foldmethod=syntax : */' |
406
          \ 1put ='' | 2put ='' | call setline(3, '#include "' .
407
          \ substitute(expand("%:t"), ".cc$", ".hh", "") . '"') |
408
          \ set sw=4 sts=4 et tw=80 | norm G
409
410
    autocmd BufNewFile configure.ac
411
          \ 0put ='dnl vim: set sw=8 sts=8 noet :' |
412
          \ $put ='' |
413
          \ call setline(line('$'), 'AC_INIT([' . substitute(expand('%:p:h'),
414
          \     '^.\{-}/\([^/]\+\)\(/trunk\)\?$', '\1', '') . '], [0.1], [h.haugen@gmail.com])') |
415
          \ $put ='AC_PREREQ(2.63)' |
416
          \ $put ='AC_CONFIG_SRCDIR([])' |
417
          \ $put ='AC_CONFIG_AUX_DIR(config)' |
418
          \ $put ='AM_INIT_AUTOMAKE([foreign -Wall -Werror 1.10])' |
419
          \ $put ='' |
420
          \ $put ='dnl check for required programs' |
421
          \ $put ='AC_PROG_CC dnl CXX' |
422
          \ $put ='AC_PROG_INSTALL' |
423
          \ $put ='AC_PROG_LN_S' |
424
          \ $put ='AC_PROG_RANLIB' |
425
          \ $put ='AC_PROG_MAKE_SET' |
426
          \ $put ='' |
427
          \ $put ='dnl output' |
428
          \ $put ='AC_CONFIG_HEADERS([config.h])' |
429
          \ $put ='AC_CONFIG_FILES([' |
430
          \ $put ='	Makefile' |
431
          \ $put ='	src/Makefile' |
432
          \ $put ='])' |
433
          \ $put ='AC_OUTPUT' |
434
          \ set sw=8 sts=8 noet |
435
          \ norm ggjjjjf]
436
437
    autocmd BufNewFile autogen.bash
438
          \ 0put ='#!/usr/bin/env bash' |
439
          \ 1put ='# vim: set sw=4 sts=4 et tw=80 :' |
440
          \ $put ='run() {' |
441
          \ $put ='echo \">>> $@\"' |
442
          \ $put ='    if ! $@ ; then' |
443
          \ $put ='        echo \"oops!\" 1>&2' |
444
          \ $put ='        exit 127' |
445
          \ $put ='    fi' |
446
          \ $put ='}' |
447
          \ $put ='' |
448
          \ $put ='get() {' |
449
          \ $put ='    type ${1}-${2}    &>/dev/null && echo ${1}-${2}    && return' |
450
          \ $put ='    type ${1}${2//.}  &>/dev/null && echo ${1}${2//.}  && return' |
451
          \ $put ='    type ${1}         &>/dev/null && echo ${1}         && return' |
452
          \ $put ='    echo \"Could not find ${1} ${2}\" 1>&2' |
453
          \ $put ='    exit 127' |
454
          \ $put ='}' |
455
          \ $put ='' |
456
          \ $put ='run mkdir -p config' |
457
          \ $put ='run $(get libtoolize 2.2 ) --copy --force --automake' |
458
          \ $put ='rm -f config.cache' |
459
          \ $put ='run $(get aclocal 1.10 )' |
460
          \ $put ='run $(get autoheader 2.63 )' |
461
          \ $put ='run $(get autoconf 2.63 )' |
462
          \ $put ='run $(get automake 1.10 ) -a --copy' |
463
          \ set sw=4 sts=4 et tw=80 |
464
          \ norm gg=Ggg
465
    autocmd BufWritePost autogen.bash !chmod 744 %
466
467
    autocmd BufNewFile Makefile.am
468
          \ 0put ='CLEANFILES = *~' |
469
          \ if (! filereadable(expand("%:p:h:h") . '/Makefile.am')) |
470
          \     $put ='MAINTAINERCLEANFILES = Makefile.in configure config/* aclocal.m4 \' |
471
          \     $put ='' |
472
          \     call setline(line('$'), "\t\t\tconfig.h config.h.in") |
473
          \     $put ='SUBDIRS = src' |
474
          \     $put ='AUTOMAKE_OPTIONS = foreign dist-bzip2' |
475
          \     $put ='EXTRA_DIST = autogen.bash' |
476
          \     $put ='' |
477
          \     $put ='maintainer-clean-local:' |
478
          \     $put ='	-rmdir config' |
479
          \ else |
480
          \     $put ='MAINTAINERCLEANFILES = Makefile.in' |
481
          \     $put ='bin_PROGRAMS = ' . substitute(expand('%:p:h'),'^.\{-}/\([^/]\+\)\(/src\)\?$', '\1', '') |
482
          \     $put = substitute(expand('%:p:h'), '^.\{-}/\([^/]\+\)\(/src\)\?$','\1', '') . '_SOURCES = main.c' |
483
          \ endif
484
485
  augroup END
486
  augroup making " {{{3
487
    try
488
      " if we have a vim which supports QuickFixCmdPost (vim7),
489
      " give us an error window after running make, grep etc, but
490
      " only if results are available.
491
      autocmd QuickFixCmdPost * botright cwindow 6
492
493
      autocmd QuickFixCmdPre make
494
            \ let g:make_start_time=localtime()
495
496
      let g:paludis_configure_command = "! ./configure --prefix=/usr --sysconfdir=/etc" .
497
            \ " --localstatedir=/var/lib --enable-qa " .
498
            \ " --enable-ruby --enable-python --enable-vim --enable-bash-completion" .
499
            \ " --enable-zsh-completion --with-repositories=all --with-clients=all --with-environments=all" .
500
            \ " --enable-visibility --enable-gnu-ldconfig --enable-htmltidy" .
501
            \ " --enable-ruby-doc --enable-python-doc --enable-xml"
502
503
      " Similarly, try to automatically run ./configure and / or
504
      " autogen if necessary.
505
      autocmd QuickFixCmdPre make
506
            \ if ! filereadable('Makefile') |
507
            \     if ! filereadable("configure") |
508
            \         if filereadable("autogen.bash") |
509
            \             exec "! ./autogen.bash" |
510
            \         elseif filereadable("quagify.sh") |
511
            \             exec "! ./quagify.sh" |
512
            \         endif |
513
            \     endif |
514
            \     if filereadable("configure") |
515
            \         if (isdirectory(getcwd() . "/paludis/util")) |
516
            \             exec g:paludis_configure_command |
517
            \         elseif (match(getcwd(), "libwrapiter") >= 0) |
518
            \             exec "! ./configure --prefix=/usr --sysconfdir=/etc" |
519
            \         else |
520
            \             exec "! ./configure" |
521
            \         endif |
522
            \     endif |
523
            \ endif
524
525
      autocmd QuickFixCmdPost make
526
            \ let g:make_total_time=localtime() - g:make_start_time |
527
            \ echo printf("Time taken: %dm%2.2ds", g:make_total_time / 60,
528
            \     g:make_total_time % 60)
529
530
      autocmd QuickFixCmdPre *
531
            \ let g:old_titlestring=&titlestring |
532
            \ let &titlestring="[ " . expand("<amatch>") . " ] " . &titlestring |
533
            \ redraw
534
535
      autocmd QuickFixCmdPost *
536
            \ let &titlestring=g:old_titlestring
537
538
      if hostname() == "snowmobile"
539
        autocmd QuickFixCmdPre make
540
              \ let g:active_line=getpid() . " vim:" . substitute(getcwd(), "^.*/", "", "") |
541
              \ exec "silent !echo '" . g:active_line . "' >> ~/.config/awesome/active"
542
543
        autocmd QuickFixCmdPost make
544
              \ exec "silent !sed -i -e '/^" . getpid() . " /d' ~/.config/awesome/active"
545
      endif
546
547
    catch
548
    endtry
549
  augroup END
550
endif
551
552
553
" Preview window for :help CursorHold-example after updatetime {{{2
554
au CursorHold *.[ch] nested call PreviewWord()
555
au CursorMoved *.[ch] nested call UnPreviewWord()
556
fun! UnPreviewWord()
557
  if &previewwindow
558
    return
559
  endif
560
  pclose
561
endfun
562
fun! PreviewWord()
563
  if &previewwindow                  " don't do this in the preview window
564
    return
565
  endif
566
  if &lines < 40                     " not for small terminals
567
    return
568
  endif
569
  let w = expand("<cword>")          " get the word under cursor
570
  if w =~ '\a'                       " if the word contains a letter
571
    " Delete any existing highlight before showing another tag
572
    silent! wincmd P                 " jump to preview window
573
    if &previewwindow                " if we really get there...
574
      match none                     " delete existing highlight
575
      wincmd p                       " back to old window
576
    endif
577
578
    " Try displaying a matching tag for the word under the cursor
579
    try
580
      exe "ptag " . w
581
    catch
582
      return
583
    endtry
584
585
    silent! wincmd P                 " jump to preview window
586
    if &previewwindow                " if we really get there...
587
"     exe "wincmd J"                 " make the window appear below
588
      if has("folding")
589
        silent! .foldopen            " don't want a closed fold
590
      endif
591
      call search("$", "b")          " to end of previous line
592
      let w = substitute(w, '\\', '\\\\', "")
593
      call search('\<\V' . w . '\>') " position cursor on match
594
      " Add a match highlight to the word at this position
595
      hi previewWord term=bold cterm=underline gui=underline
596
      exe 'match previewWord "\%' . line(".") . 'l\%' . col(".") . 'c\k*"'
597
"     exe "normal " . &previewheight / 2 . "j"
598
      wincmd p                       " back to old window
599
    endif
600
  endif
601
endfun
602
603
604
" }}}1
605
606
"-----------------------------------------------------------------------
607
" mappings
608
"-----------------------------------------------------------------------
609
" {{{1
610
611
" Go to buffers with S-left/right and ^w ,. {{{2
612
nmap <silent> <S-Left>  :bprev<CR>
613
nmap <silent> <S-Right> :bnext<CR>
614
nmap <C-w>, :bprev<CR>
615
nmap <C-w>. :bnext<CR>
616
617
" Movement between windows with ^hjkl {{{2
618
nmap <C-h> <C-w>h
619
nmap <C-j> <C-w>j
620
nmap <C-k> <C-w>k
621
nmap <C-l> <C-w>l
622
623
" Move through buffers instead of tabs with gt/gT {{{2
624
"nmap gT :bprev<CR>
625
"nmap gt :bnext<CR>
626
627
" v_K is really really annoying; disable {{{2
628
vmap K k
629
630
" Puppet pkg sort with <L>sp {{{2
631
nmap <Leader>sp vi[:sort<CR>
632
633
" Delete a buffer but keep layout with ^w! {{{2
634
if has("eval")
635
  command! Kwbd enew|bw #
636
  nmap     <C-w>!   :Kwbd<CR>
637
endif
638
639
" quickfix things like '-' {{{2
640
"nmap <Leader>cwc :cclose<CR>
641
"nmap <Leader>cwo :botright copen 5<CR><C-w>p
642
"nmap <Leader>cn  :cnext<CR>
643
"nmap <Leader>cp  :cprevious<CR>
644
nmap -  :cnext<CR>
645
nmap _  :cprev<CR>
646
nmap <C--> :colder<CR>
647
nmap <C-_> :cnewer<CR>
648
649
" Make S-up/down do gk/gj {{{2
650
inoremap <S-Up>   <C-o>gk
651
inoremap <S-Down> <C-o>gj
652
noremap  <S-Up>   gk
653
noremap  <S-Down> gj
654
655
" Better Bépo movement {{{2
656
noremap © h
657
noremap þ j
658
noremap ß k
659
noremap ® l
660
661
" Make <space>/<backspace> page up/down {{{2
662
noremap <space> <C-f>
663
noremap <backspace> <C-b>
664
665
" Scrolling with arrows controls the window {{{2
666
noremap <Up>   <C-y>
667
noremap <Down> <C-e>
668
669
" Useful things from inside imode {{{2
670
inoremap <C-z>w <C-o>:w<CR>
671
inoremap <C-z>q <C-o>gq}<C-o>k<C-o>$
672
673
" Commonly used commands {{{2
674
"nmap <silent> <F3> :silent nohlsearch<CR>
675
"imap <silent> <F3> <C-o>:silent nohlsearch<CR>
676
"nmap <F4> :Kwbd<CR>
677
"nmap <F5> <C-w>c
678
"nmap <F6> :exec "make check TESTS_ENVIRONMENT=true LOG_COMPILER=true XFAIL_TESTS="<CR>
679
"nmap <Leader><F6> :exec "make -C " . expand("%:p:h") . " check TESTS_ENVIRONMENT=true LOG_COMPILER=true XFAIL_TESTS="<CR>
680
"nmap <F7> :make all-then-check<CR>
681
map <F7> :Tfdm<CR>
682
"nmap <Leader><F7> :exec "make -C " . expand("%:p:h") . " check"<CR>
683
nmap <F8> :make<CR>
684
nmap <Leader><F8> :exec "make -C " . expand("%:p:h")<CR>
685
"nmap <F9> :exec "make -C " . expand("%:p:h") . " check SUBDIRS= check_PROGRAMS=" . GetCurrentTest()
686
"            \ . " TESTS=" . GetCurrentTest() <CR>
687
688
" Insert a single char {{{2
689
noremap <Leader>i i<Space><Esc>r
690
691
" Split the line into a (n)ew line or an (o)pen line {{{2
692
nmap <Leader>n \i<CR>
693
nmap <Leader>o \i<CR>k$
694
695
" Pull the following line to the cursor position {{{2
696
noremap <Leader>J :s/\%#\(.*\)\n\(.*\)/\2\1<CR>
697
698
" In normal mode, jj or jl escapes {{{2
699
inoremap jj <Esc>
700
inoremap jl <Esc>
701
702
" Kill line like emacs {{{2
703
"noremap <C-k> "_dd
704
705
" Select everything {{{2
706
noremap <Leader>gg ggVG
707
708
" Reformat everything {{{2
709
noremap <Leader>gq gggqG
710
711
" Reformat paragraph {{{2
712
noremap <Leader>gp gqap
713
714
" Clear lines {{{2
715
"noremap <Leader>clr :s/^.*$//<CR>:nohls<CR>
716
717
" Delete blank lines {{{2
718
noremap <Leader>dbl :g/^$/d<CR>:nohls<CR>
719
720
" Enclose each selected line with markers {{{2
721
noremap <Leader>enc :<C-w>execute
722
      \ substitute(":'<,'>s/^.*/#&#/ \| :nohls", "#", input(">"), "g")<CR>
723
724
" Edit something in the current directory {{{2
725
noremap <Leader>ed :e <C-r>=expand("%:p:h")<CR>/<C-d>
726
727
" Enable fancy % matching {{{2
728
if has("eval")
729
  runtime! macros/matchit.vim
730
endif
731
732
" q: sucks {{{2
733
"nmap q: :q
734
735
" set up some more useful digraphs {{{2
736
if has("digraphs")
737
  digraph ., 8230    " ellipsis (…)
738
endif
739
740
" What does this do? {{{2
741
if has("eval")
742
  " Work out include guard text
743
  fun! IncludeGuardText()
744
    let l:p = substitute(substitute(getcwd(), "/trunk", "", ""), '^.*/', "", "")
745
    let l:t = substitute(expand("%"), "[./]", "_", "g")
746
    return substitute(toupper(l:p . "_GUARD_" . l:t), "-", "_", "g")
747
  endfun
748
749
  " Make include guards
750
  fun! MakeIncludeGuards()
751
    norm gg
752
    /^$/
753
    norm 2O
754
    call setline(line("."), "#ifndef " . IncludeGuardText())
755
    norm o
756
    call setline(line("."), "#define " . IncludeGuardText() . " 1")
757
    norm G
758
    norm o
759
    call setline(line("."), "#endif")
760
  endfun
761
  noremap <Leader>ig :call MakeIncludeGuards()<CR>
762
endif
763
764
" javascript folding {{{2
765
if has("eval")
766
  function! JavaScriptFold()
767
    setl foldmethod=syntax
768
    setl foldlevelstart=1
769
    syn region foldBraces start=/{/ end=/}/ transparent fold keepend extend
770
771
    function! FoldText()
772
      return substitute(getline(v:foldstart), '{.*', '{...}', '')
773
    endfunction
774
    setl foldtext=FoldText()
775
  endfunction
776
  au FileType javascript call JavaScriptFold()
777
  au FileType javascript setl fen
778
endif
779
780
" fast buffer switching {{{2
781
if v:version >= 700 && has("eval")
782
  let g:switch_header_map = {
783
        \ 'cc':    'hh',
784
        \ 'hh':    'cc',
785
        \ 'c':     'h',
786
        \ 'h':     'c',
787
        \ 'cpp':   'hpp',
788
        \ 'hpp':   'cpp' }
789
790
  fun! SwitchTo(f, split) abort
791
    if ! filereadable(a:f)
792
      echoerr "File '" . a:f . "' does not exist"
793
    else
794
      if a:split
795
        new
796
      endif
797
      if 0 != bufexists(a:f)
798
        exec ':buffer ' . bufnr(a:f)
799
      else
800
        exec ':edit ' . a:f
801
      endif
802
    endif
803
  endfun
804
805
  fun! SwitchHeader(split) abort
806
    let filename = expand("%:p:r")
807
    let suffix = expand("%:p:e")
808
    if suffix == ''
809
      echoerr "Cannot determine header file (no suffix)"
810
      return
811
    endif
812
813
    let new_suffix = g:switch_header_map[suffix]
814
    if new_suffix == ''
815
      echoerr "Don't know how to find the header (suffix is " . suffix . ")"
816
      return
817
    end
818
819
    call SwitchTo(filename . '.' . new_suffix, a:split)
820
  endfun
821
822
  fun! SwitchTest(split) abort
823
    let filename = expand("%:p:r")
824
    let suffix = expand("%:p:e")
825
    if -1 != match(filename, '_TEST$')
826
      let new_filename = substitute(filename, '_TEST$', '.' . suffix, '')
827
    else
828
      let new_filename = filename . '_TEST.' . suffix
829
    end
830
    call SwitchTo(new_filename, a:split)
831
  endfun
832
833
  fun! SwitchMakefile(split) abort
834
    let dirname = expand("%:p:h")
835
    if filereadable(dirname . "/Makefile.am.m4")
836
      call SwitchTo(dirname . "/Makefile.am.m4", a:split)
837
    elseif filereadable(dirname . "/Makefile.am")
838
      call SwitchTo(dirname . "/Makefile.am", a:split)
839
    else
840
      call SwitchTo(dirname . "/Makefile", a:split)
841
    endif
842
  endfun
843
844
  noremap <Leader>sh :call SwitchHeader(0)<CR>
845
  noremap <Leader>st :call SwitchTest(0)<CR>
846
  noremap <Leader>sk :call SwitchMakefile(0)<CR>
847
  noremap <Leader>ssh :call SwitchHeader(1)<CR>
848
  noremap <Leader>sst :call SwitchTest(1)<CR>
849
  noremap <Leader>ssk :call SwitchMakefile(1)<CR>
850
endif
851
852
" super i_c-y / i_c-e {{{2
853
if v:version >= 700 && has("eval")
854
  fun! SuperYank(offset)
855
    let l:cursor_pos = col(".")
856
    let l:this_line = line(".")
857
    let l:source_line = l:this_line + a:offset
858
    let l:this_line_text = getline(l:this_line)
859
    let l:source_line_text = getline(l:source_line)
860
    let l:add_text = ""
861
862
    let l:motion = "" . nr2char(getchar())
863
    if -1 != match(l:motion, '\d')
864
      let l:count = 0
865
      while -1 != match(l:motion, '\d')
866
        let l:count = l:count * 10 + l:motion
867
        let l:motion = "" . nr2char(getchar())
868
      endwhile
869
    else
870
      let l:count = 1
871
    endif
872
873
    if l:motion == "$"
874
      let l:add_text = strpart(l:source_line_text, l:cursor_pos - 1)
875
    elseif l:motion == "w"
876
      let l:add_text = strpart(l:source_line_text, l:cursor_pos - 1)
877
      let l:add_text = substitute(l:add_text,
878
            \ '^\(\s*\%(\S\+\s*\)\{,' . l:count . '}\)\?.*', '\1', '')
879
    elseif l:motion == "f" || l:motion == "t"
880
      let l:add_text = strpart(l:source_line_text, l:cursor_pos - 1)
881
      let l:char = nr2char(getchar())
882
      let l:pos = matchend(l:add_text,
883
            \ '^\%([^' . l:char . ']\{-}' . l:char . '\)\{' . l:count . '}')
884
      if -1 != l:pos
885
        let l:add_text = strpart(l:add_text, 0, l:motion == "f" ? l:pos : l:pos - 1)
886
      else
887
        let l:add_text = ''
888
      endif
889
    else
890
      echo "Unknown motion: " . l:motion
891
    endif
892
893
    if l:add_text != ""
894
      let l:new_text = strpart(l:this_line_text, 0, l:cursor_pos - 1) .
895
            \ l:add_text . strpart(l:this_line_text, l:cursor_pos - 1)
896
      call setline(l:this_line, l:new_text)
897
      call cursor(l:this_line, l:cursor_pos + strlen(l:add_text))
898
    endif
899
  endfun
900
901
  inoremap <C-g>y <C-\><C-o>:call SuperYank(-1)<CR>
902
  inoremap <C-g>e <C-\><C-o>:call SuperYank(1)<CR>
903
endif
904
905
" tab completion {{{2
906
if has("eval")
907
  function! CleverTab()
908
    if strpart(getline('.'), 0, col('.') - 1) =~ '^\s*$'
909
      return "\<Tab>"
910
    else
911
      return "\<C-N>"
912
    endif
913
  endfun
914
  inoremap <Tab> <C-R>=CleverTab()<CR>
915
  inoremap <S-Tab> <C-P>
916
endif
917
918
" ^n Show number and fold columns in windows {{{2
919
if has("eval")
920
  function! <SID>FoldNumbers()
921
    " If we're in a wide window, enable line numbers.
922
    if winwidth(0) >= 76 " 72 + 4, or should I use tw?
923
      " Add folds, or cycle through number schemes
924
      if &foldlevel < 99 && &foldenable && &foldcolumn == 0
925
        setlocal foldcolumn=1
926
      elseif (&foldlevel == 99 || ! &foldenable) && &foldcolumn != 0
927
        setlocal foldcolumn=0
928
      elseif ! &rnu && ! &nu
929
        setlocal relativenumber
930
      elseif &rnu
931
        setlocal number
932
      elseif &nu
933
        setlocal nonumber
934
      endif
935
    else
936
      setlocal norelativenumber
937
      setlocal nonumber
938
      setlocal foldcolumn=0
939
    endif
940
  endfun
941
  "autocmd WinEnter,BufWinEnter,BufNew * :call <SID>FoldNumbers()
942
  noremap <silent> <C-n> :call <SID>FoldNumbers()<CR>
943
endif
944
945
" }}}1
946
947
"-----------------------------------------------------------------------
948
" abbreviations
949
"-----------------------------------------------------------------------
950
" {{{1
951
952
if has("eval") && has("autocmd")
953
  fun! <SID>abbrev_cpp()
954
    iabbrev <buffer> raise throw
955
    iabbrev <buffer> jci const_iterator
956
    iabbrev <buffer> jcl class
957
    iabbrev <buffer> jco const
958
    iabbrev <buffer> jdb \bug
959
    iabbrev <buffer> jde \throws
960
    iabbrev <buffer> jdf /** \file<CR><CR>/<Up>
961
    iabbrev <buffer> jdg \ingroup
962
    iabbrev <buffer> jdn /** \namespace<CR><CR>/<Up>
963
    iabbrev <buffer> jdp \param
964
    iabbrev <buffer> jdt \test
965
    iabbrev <buffer> jdx /**<CR><CR>/<Up>
966
    iabbrev <buffer> jit iterator
967
    iabbrev <buffer> jns namespace
968
    iabbrev <buffer> jpr protected
969
    iabbrev <buffer> jpu public
970
    iabbrev <buffer> jpv private
971
    iabbrev <buffer> jsl std::list
972
    iabbrev <buffer> jsm std::map
973
    iabbrev <buffer> jss std::string
974
    iabbrev <buffer> jsv std::vector
975
    iabbrev <buffer> jty typedef
976
    iabbrev <buffer> jun using namespace
977
    iabbrev <buffer> jvi virtual
978
  endfun
979
980
  augroup abbreviations
981
    autocmd!
982
    autocmd FileType cpp :call <SID>abbrev_cpp()
983
  augroup END
984
endif
985
" NB: Need more of these for more than cpp
986
987
" }}}1
988
989
"-----------------------------------------------------------------------
990
" special less.sh and man modes
991
"-----------------------------------------------------------------------
992
" {{{1
993
994
if has("eval") && has("autocmd")
995
  fun! <SID>check_pager_mode()
996
    if exists("g:loaded_less") && g:loaded_less
997
      " we're in vimpager / less.sh / man mode
998
      set laststatus=0
999
      set ruler
1000
      set foldmethod=manual
1001
      set foldlevel=99
1002
      set nolist
1003
    endif
1004
  endfun
1005
  autocmd VimEnter * :call <SID>check_pager_mode()
1006
endif
1007
1008
" }}}1
1009
1010
"-----------------------------------------------------------------------
1011
" plugin / script / app settings
1012
"-----------------------------------------------------------------------
1013
" {{{1
1014
1015
if has("eval")
1016
  " Perl specific options
1017
  let perl_include_pod=1
1018
  let perl_fold=1
1019
  let perl_fold_blocks=1
1020
1021
  " Vim specific options
1022
  let g:vimsyntax_noerror=1
1023
  let g:vimembedscript=0
1024
1025
  " c specific options
1026
  let g:c_gnu=1
1027
  let g:c_no_curly_error=1
1028
1029
  " eruby options
1030
  au Syntax * hi link erubyRubyDelim Directory
1031
1032
  " ruby options
1033
  let ruby_operators=1
1034
  let ruby_space_errors=1
1035
1036
  " php specific options
1037
  let php_sql_query=1
1038
  let php_htmlInStrings=1
1039
1040
  " Settings for taglist.vim
1041
  let Tlist_Use_Right_Window=1
1042
  let Tlist_Auto_Open=0
1043
  let Tlist_Enable_Fold_Column=0
1044
  let Tlist_Compact_Format=1
1045
  let Tlist_WinWidth=28
1046
  let Tlist_Exit_OnlyWindow=1
1047
  let Tlist_File_Fold_Auto_Close=1
1048
  let Tlist_Inc_Winwidth=0
1049
  "nnoremap <silent> <F9> :Tlist<CR>
1050
1051
  " Settings minibufexpl.vim
1052
  "let g:miniBufExplModSelTarget = 1
1053
  "let g:miniBufExplWinFixHeight = 1
1054
  "let g:miniBufExplWinMaxSize = 1
1055
  " let g:miniBufExplForceSyntaxEnable = 1
1056
1057
  " Settings for showmarks.vim
1058
  if has("gui_running")
1059
    let g:showmarks_enable=1
1060
  else
1061
    let g:showmarks_enable=0
1062
    let loaded_showmarks=1
1063
  endif
1064
1065
  let g:showmarks_include="abcdefghijklmnopqrstuvwxyz"
1066
1067
  if has("autocmd")
1068
    fun! <SID>FixShowmarksColours()
1069
      if has('gui') 
1070
        hi ShowMarksHLl gui=bold guifg=#a0a0e0 guibg=#2e2e2e 
1071
        hi ShowMarksHLu gui=none guifg=#a0a0e0 guibg=#2e2e2e 
1072
        hi ShowMarksHLo gui=none guifg=#a0a0e0 guibg=#2e2e2e 
1073
        hi ShowMarksHLm gui=none guifg=#a0a0e0 guibg=#2e2e2e 
1074
        hi SignColumn   gui=none guifg=#f0f0f8 guibg=#2e2e2e 
1075
      endif
1076
    endfun
1077
    if v:version >= 700
1078
      autocmd VimEnter,Syntax,ColorScheme * call <SID>FixShowmarksColours()
1079
    else
1080
      autocmd VimEnter,Syntax * call <SID>FixShowmarksColours()
1081
    endif
1082
  endif
1083
1084
  " Settings for explorer.vim
1085
  let g:explHideFiles='^\.'
1086
1087
  " Settings for netrw
1088
  let g:netrw_list_hide='^\.,\~$'
1089
1090
  " Settings for :TOhtml
1091
  let html_number_lines=1
1092
  let html_use_css=1
1093
  let use_xhtml=1
1094
1095
  " cscope settings
1096
  if has('cscope') && filereadable("/usr/bin/cscope")
1097
    set csto=0
1098
    set cscopetag
1099
    set nocsverb
1100
    if filereadable("cscope.out")
1101
      cs add cscope.out
1102
    endif
1103
    set csverb
1104
1105
    let x = "sgctefd"
1106
    while x != ""
1107
      let y = strpart(x, 0, 1) | let x = strpart(x, 1)
1108
      exec "nmap <C-j>" . y . " :cscope find " . y .
1109
            \ " <C-R>=expand(\"\<cword\>\")<CR><CR>"
1110
      exec "nmap <C-j><C-j>" . y . " :scscope find " . y .
1111
            \ " <C-R>=expand(\"\<cword\>\")<CR><CR>"
1112
    endwhile
1113
    nnoremap <C-j>i      :cscope find i ^<C-R>=expand("<cword>")<CR><CR>
1114
    nnoremap <C-j><C-j>i :scscope find i ^<C-R>=expand("<cword>")<CR><CR>
1115
  endif
1116
endif
1117
1118
" }}}1
1119
1120
"-----------------------------------------------------------------------
1121
" Default Fuf shortcuts Dvorakized from :help fuf-vimrc-example
1122
"-----------------------------------------------------------------------
1123
" {{{1
1124
"let g:fuf_modesDisable = []
1125
let g:fuf_modesDisable = ['mrucmd']
1126
"let g:fuf_mrufile_maxItem = 400
1127
"let g:fuf_mrucmd_maxItem = 400
1128
"nmap <silent> sh     :FufBuffer<CR>
1129
nmap <silent> st     :FufFileWithCurrentBufferDir<CR>
1130
nmap <silent> sT     :FufFileWithFullCwd<CR>
1131
nmap <silent> s<C-t> :FufFile<CR>
1132
nmap <silent> sn     :FufCoverageFileChange<CR>
1133
nmap <silent> sN     :FufCoverageFileChange<CR>
1134
"nmap <silent> s<C-n> :FufCoverageFileRegister<CR>
1135
 nmap <silent> sd     :FufDirWithCurrentBufferDir<CR>
1136
 nmap <silent> sD     :FufDirWithFullCwd<CR>
1137
 nmap <silent> s<C-d> :FufDir<CR>
1138
nmap <silent> sb     :FufMruFile<CR>
1139
nmap <silent> sB     :FufMruFileInCwd<CR>
1140
" nmap <silent> sm     :FufMruCmd<CR>
1141
" nmap <silent> su     :FufBookmarkFile<CR>
1142
" nmap <silent> s<C-u> :FufBookmarkFileAdd<CR>
1143
" vmap <silent> s<C-u> :FufBookmarkFileAddAsSelectedText<CR>
1144
" nmap <silent> si     :FufBookmarkDir<CR>
1145
" nmap <silent> s<C-i> :FufBookmarkDirAdd<CR>
1146
"nmap <silent> sy     :FufTag<CR>
1147
"nmap <silent> sY     :FufTag!<CR>
1148
" nmap <silent> s<C-]> :FufTagWithCursorWord!<CR>
1149
" nmap <silent> s,     :FufBufferTag<CR>
1150
" nmap <silent> s<     :FufBufferTag!<CR>
1151
" vmap <silent> s,     :FufBufferTagWithSelectedText!<CR>
1152
" vmap <silent> s<     :FufBufferTagWithSelectedText<CR>
1153
" nmap <silent> s}     :FufBufferTagWithCursorWord!<CR>
1154
" nmap <silent> s.     :FufBufferTagAll<CR>
1155
" nmap <silent> s>     :FufBufferTagAll!<CR>
1156
" vmap <silent> s.     :FufBufferTagAllWithSelectedText!<CR>
1157
" vmap <silent> s>     :FufBufferTagAllWithSelectedText<CR>
1158
" nmap <silent> s]     :FufBufferTagAllWithCursorWord!<CR>
1159
" nmap <silent> sg     :FufTaggedFile<CR>
1160
" nmap <silent> sG     :FufTaggedFile!<CR>
1161
" nmap <silent> so     :FufJumpList<CR>
1162
" nmap <silent> sp     :FufChangeList<CR>
1163
" nmap <silent> sq     :FufQuickfix<CR>
1164
"nmap <silent> sf     :FufLine<CR>
1165
"nmap <silent> sx     :FufHelp<CR>
1166
" nmap <silent> se     :FufEditDataFile<CR>
1167
" nmap <silent> sr     :FufRenewCache<CR>
1168
1169
" }}}1
1170
1171
"-----------------------------------------------------------------------
1172
" final commands (clean this cruft up -- don't add more here)
1173
"-----------------------------------------------------------------------
1174
" {{{1
1175
1176
" mio
1177
"let Tlist_Ctags_Cmd="/usr/bin/exuberant-ctags"
1178
" plegado ident para python
1179
au FileType python set foldmethod=indent
1180
" plegado syntax para sgml,htmls,xml y xsl
1181
au Filetype html,xml,xsl,sgml ",docbook
1182
" explorador vertical
1183
let g:explVertical=1
1184
" define leader como =
1185
"let mapleader = "="
1186
1187
" Terminal companability
1188
map <F15> <S-F3>
1189
nmap <Esc>[14~ <S-F4>
1190
nmap <Esc>[23~ <S-F1>
1191
nmap <Esc>[24~ <S-F2>
1192
nmap <Esc>[25~ <S-F3>
1193
nmap <Esc>[26~ <S-F4>
1194
nmap <Esc>[28~ <S-F5>
1195
nmap <Esc>[29~ <S-F6>
1196
nmap <Esc>[31~ <S-F7>
1197
nmap <Esc>[32~ <S-F8>
1198
nmap <Esc>[33~ <S-F9>
1199
nmap <Esc>[34~ <S-F10>
1200
1201
map <F17> <S-F5>
1202
map <F18> <S-F6>
1203
map <F19> <S-F7>
1204
map <F20> <S-F8>
1205
map <F21> <S-F9>
1206
map <F22> <S-F10>
1207
map <F23> <S-F11>
1208
map <F24> <S-F12>
1209
map <S-F2> :vsplit ~/.vim/ref_full.vim<CR>
1210
map <F2> :11vsplit ~/.vim/ref.vim<CR>
1211
"map <F3> :Sexplore $HOME<CR>
1212
map <S-F3> :2split ~/.vim/fun_ref.vim<CR>
1213
noremap <F4> :set rnu!<CR>
1214
noremap <S-F4> :set nu!<CR>
1215
noremap <F5> ggVGg?
1216
noremap <F6> :set encoding=utf-8<CR>:set fenc=utf-8<CR>
1217
noremap <S-F6> :set encoding=iso8859-15<CR>:set fenc=iso8859-15<CR>
1218
"map <F7> :SpellProposeAlternatives<CR>
1219
"map <S-F7> :SpellCheck<CR>
1220
"map <C-F7> :let spell_language_list = "english,spanish"
1221
"nnoremap <silent> <F8> :Tlist<CR>
1222
"nnoremap <silent> <S-F8> :TlistSync<CR>
1223
nnoremap <Esc> :noh<CR><Esc>
1224
map <F11> !!date<CR>
1225
map <F12> :TC<CR>
1226
nnoremap  :X        :x
1227
nnoremap  :W        :w
1228
nnoremap  :Q        :q
1229
nnoremap  :B        :b
1230
noremap <Leader>rg :color relaxedgreen<CR>
1231
noremap <Leader>ip :color inkpot<CR>
1232
noremap <Leader>ir :color ir_black<CR>
1233
noremap <Leader>mv :color macvim<CR>:set background=light<CR>
1234
noremap <Leader>f :FufFileWithCurrentBufferDir<CR>
1235
noremap <Leader>F :FufFile<CR>
1236
noremap <Leader>v :FufCoverageFile<CR>
1237
noremap <Leader>b :FufBuffer<CR>
1238
noremap <Leader>c :FufDirWithFullCwd<CR>
1239
noremap <Leader>w :bdelete<CR>
1240
noremap <F1> :FufHelp<CR>
1241
noremap <F12> <Esc>:syntax sync fromstart<CR>
1242
inoremap <F12> <C-o>:syntax sync fromstart<CR>
1243
syntax sync minlines=200
1244
1245
" NERD tree. Yay!
1246
nnoremap <silent> <C-G> :NERDTreeToggle<CR>
1247
1248
" Javac
1249
"set makeprg=javac\ %
1250
"set errorformat=%A%f:%l:\ %m,%-Z%p^,%-C%.%#
1251
1252
" Spell
1253
"let spell_executable = "aspell"
1254
"let spell_language_list = "spanish,english"
1255
set spelllang=en_us,eo
1256
1257
" Comentiffy
1258
let g:EnhCommentifyMultiPartBlocks = 'yes'
1259
let g:EnhCommentifyAlignRight = 'yes'
1260
" let g:EnhCommentifyRespectIndent = 'Yes'
1261
let g:EnhCommentifyPretty = 'Yes'
1262
" let g:EnhCommentifyUserBindings = 'yes'
1263
1264
" turn off any existing search
1265
if has("autocmd")
1266
  au VimEnter * nohls
1267
endif
1268
1269
" }}}1
1270
1271
"-----------------------------------------------------------------------
1272
"ii irc stuff
1273
"-----------------------------------------------------------------------
1274
" {{{1
1275
" map c1 :.w! >> ~/irc/irc.cat.pdx.edu/in<cr>dd
1276
" map c2 :.w! >> ~/irc/irc.cat.pdx.edu/\#hack/in<cr>dd
1277
" map c3 :.w! >> ~/irc/irc.cat.pdx.edu/\#meow/in<cr>dd
1278
" map c4 :.w! >> ~/irc/irc.cat.pdx.edu/\#rtttoee/in<cr>dd
1279
" map c5 :.w! >> ~/irc/irc.cat.pdx.edu/\#robots/in<cr>dd
1280
" map c17 :.w! >> ~/irc/irc.cat.pdx.edu/\#cschat/in<cr>dd
1281
" imap /me <C-V><C-A>ACTION
1282
1283
" }}}1
1284
1285
"-----------------------------------------------------------------------
1286
" vim: set sw=2 sts=2 et tw=72 fdm=marker: