host info updates
[distro-setup] / .vim / misc / sasvimrc
1 " vim: set ff=unix ai si noet ts=4 sw=4 fdls=1 fdm=marker wrap tw=0 sm mat=3 spell tags=$HOME/.vim/vimrc.tags :
2 "
3 " Terry M P<SNIP>, personal vimrc file
4 "
5 " $Id: .vimrc,v 1.11 2008/11/14 07:42:37 Terry Exp $:
6 "
7 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
8 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
9 " WARNING !!!
10 " This file must have UNIX end of lines to avoid errors when starting
11 " under unix. Use the pdos2unix and punix2dos sh scripts to convert or
12 "
13 " perl -p -e 's/\n/\r\n/' inputfile > outputfile # UNIX to DOS
14 " perl -p -e 's/\r\n/\n/' inputfile > outputfile # DOS to UNIX
15 "
16 " on the command line or vim it self.
17 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
18 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
19 " Table of Contents
20 " |SETTINGS| --- Settings
21 " |GENERAL| --- General options
22 " |FORMATS| --- Configuration for various file formats
23 " |AUTOCMDS| --- Auto commands for calling format handler functions
24 " |HANDLERS| --- Handler functions for various file formats
25 " |INTERFACE| --- Interface specific settings
26 " |BINDS| --- Common Bindings
27 " |FUNCTIONS| --- Global helper functions
28 " |COMMANDS| --- Normal mode commands
29 " |MAPS| --- Key mappings
30 " |PLUGINS| --- Plugin specific configuration
31 " |Taglist|
32 " |NERDTree|
33 " |play| --- Misc stuff, usually notes / code snippets
34 "
35 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
36 " Preferences
37 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
38
39
40 " *SETTINGS* {{{
41
42 " *GENERAL* {{{
43
44 " Don't be VI compatible - Keep this at top of file !
45 " Also skip loading .exrc and friend sin the CWD.
46 set nocompatible
47 set noexrc
48
49 " highlight matched text when searching
50 "if has('extra_search')
51 " set hlsearch
52 "endif
53
54 " Ignore case when searching unless it starts with a Capitol
55 set ignorecase
56 set smartcase
57
58 " Use the system clipboard as the default register, '*'
59 if has("clipboard")
60 set clipboard=unnamed,exclude:cons\|linux
61 endif
62
63 " Make join commands smarter
64 set joinspaces
65
66 " Kill visual bell
67 set visualbell t_vb=
68
69 " Allow names with some spaces in path, like when using gf
70 set isfname+=32
71
72 " Show matching symbols Vi style
73 set showmatch
74 set matchtime=3
75 set matchpairs=(:),{:},[:],<:>
76
77 " How to display tabs when list is on and expand tab is off
78 set listchars=tab:\|\
79 set nolist
80
81 " Physical word wrapping
82 set textwidth=78
83
84 " Allow backspacing over everything in insert mode
85 set backspace=indent,eol,start
86
87 " Allow keys to move to next logical line marker at EOL
88 set whichwrap=b,s,h,l,<,>,[,],~
89
90 " Set folding
91 if has("folding")
92 set foldlevelstart=99
93 set foldmethod=indent
94 endif
95
96 " Indentation settings (explictly)
97 set tabstop=8
98 set shiftwidth=8
99 set noexpandtab
100
101 " Set minimal length of line numbering
102 set numberwidth=2
103
104 " Set tab menu 0=never, 1=when more then one, 2=always
105 set showtabline=1
106
107 " Preferred file formats, ffs
108 set fileformat=unix
109 set fileformats=unix,dos,mac
110
111
112 " Show status bar with file name e.t.c.
113 " 0 = never, 1 = if >= 2 window, 2 = always
114 set laststatus=2
115
116 " Show % of file in status bar
117 if has("cmdline_info")
118 set ruler
119 endif
120
121 " Vim command line completion lists possible matches
122 set wildmode=list:full
123
124 " Start with mouse support in all modes
125 set mouse=a
126 " Hide mouse pointer when typing in text
127 set mousehide
128
129 " Allow split windows to shrink to this size
130 set winminheight=0
131
132 " Set spell checker language
133 if exists("+spell")
134 set spelllang=en_us,en_gb,de
135 set spell
136 " disable highlighting
137 " XXX see |MAPS| for a mapping to toggle this highlighting
138 set hl+=B:none,P:none,R:none,L:none
139 endif
140
141 " Show function prototypes when doing ins-completion
142 set showfulltag
143
144 " Settings for omni completion
145 if exists("+omnifunc")
146 set completeopt=menu
147 set infercase
148 "Enable syntax file based omni completion when no other method is set
149 if has("autocmd")
150 autocmd Filetype *
151 \ if &omnifunc == "" |
152 \ setlocal omnifunc=syntaxcomplete#Complete |
153 \ endif
154 endif
155 endif
156
157 " Allow cursor to move virtually in =mode or =onemore past the EOL
158 "set virtualedit=onemore
159
160 " UNIX: Include system tags file
161 if has("unix")
162 set tags+=~/.vim/systags
163 endif
164
165 " Enable filetypes and plugins
166 filetype plugin indent on
167
168 "Enable syntax related features
169 if has("syntax")
170 syntax on
171 endif
172
173 " Automatically change to directories if possible.
174 if has("netbeans_intg") || has("sun_workshop")
175 set autochdir
176 elseif has("autocmd")
177 " Mimic the autochdir option with a function and an autocmd
178 function! My_Autochdir()
179 exec "cd %:p:h"
180 endfunction
181 autocmd BufEnter * call My_Autochdir()
182 endif
183
184 " !GENERAL }}}
185
186 " *FORMATS* {{{
187
188 " *AUTOCMDS* {{{
189
190
191 if has("autocmd")
192 " XXX Document based formats
193 " make *.txt dos/win friendly
194 autocmd BufNewFile *.txt set ff=dos
195 autocmd BufNewFile,BufRead *.txt call TextFileHandler()
196 autocmd BufNewFile *.rtf call RtfFileHandler()
197 autocmd BufRead *.rtf call RtfFileHandler()
198 autocmd BufRead *.doc call DocFileHandler()
199 autocmd BufRead *.pdf call PdfFileHandler()
200 autocmd BufRead *.ps call PsFileHandler()
201 autocmd BufRead *.dvi call DviFileHandler()
202 autocmd BufNewFile,BufRead *.outline call My_OutlineMode()
203 " XXX Image file based formats
204 autocmd BufRead *.jpg,*.jpeg,*.png,*.tiff,*.bmp,*.gif call ImgFileHandler()
205 autocmd BufRead *.xpm call XImgFileHandler()
206 " XXX Code based formats
207 autocmd filetype ada call AdaFileHandler()
208 autocmd filetype asm call AsmFileHandler()
209 autocmd BufNewFile,BufRead *.c,*.h call CFileHandler()
210 autocmd filetype css call CSSFileHandler()
211 autocmd BufNewFile,BufRead *.cc,*.cxx,*.cpp,*.hh,*.hpp,*.hxx call CXXFileHandler()
212 autocmd BufNewFile,BufRead *.d call DFileHandler()
213 autocmd BufNewFile,BufRead *.el call ELispFileHandler()
214 autocmd BufNewFile,BufRead *.html,*.xhtml call HtmlFileHandler()
215 autocmd filetype java call JavaFileHandler()
216 autocmd filetype javascript call JavaScriptFileHandler()
217 autocmd BufNewFile,BufRead *.lua call LuaFileHandler()
218 autocmd filetype make call MakefileFileHandler()
219 autocmd filetype perl call PerlFileHandler()
220 autocmd filetype php call PhpFileHandler()
221 autocmd filetype python call PythonFileHandler()
222 autocmd filetype ruby call RubyFileHandler()
223 autocmd filetype scheme call SchemeFileHandler()
224 autocmd filetype sh call ShellFileHandler()
225 autocmd filetype sql call SqlFileHandler()
226 autocmd filetype tex call TexFileHanlder()
227 autocmd filetype nroff call TroffFileHandler()
228 autocmd filetype vim call VimFileHanlder()
229 autocmd filetype vb call VisualBasicFileHandler()
230 " XXX for use with other programs
231 autocmd BufNewFIle,BUfRead *.tmp call My_KNodeConfig()
232 endif
233
234 " !AUTOCMDS }}}
235
236 " *HANDLERS* {{{
237
238 function! PreHandlerHook()
239 setl autoindent
240 if exists("+spell")
241 setl spell
242 endif
243 endfunction
244 function! PostHandlerHook()
245 endfunction
246
247 " XXX Document based formats
248 function! TextFileHandler()
249 call PreHandlerHook()
250
251 " turn off some stuff when viewing Vim help files
252 if &ft == "help"
253 if exists("+spell")
254 setl nospell
255 endif
256 endif
257 setl fdm=expr
258 set fo+=tqn
259 set ai
260 " fixes gq from using c-keyword based indentation
261 set cinwords=""
262
263 call PostHandlerHook()
264 endfunction
265
266 function! RtfFileHandler()
267 call PreHandlerHook()
268
269 let l:prompt = input("View or edit % [yes|no]?: ")
270 if l:prompt=="y" || l:prompt=="yes" || l:prompt=="Y" || l:prompt=="YES"
271 !{abiword "%" || wordpad.exe "%" || kword "%" || swriter "%"} &
272 q
273 endif
274
275 call PostHandlerHook()
276 endfunction
277
278 function! DocFileHandler()
279 call PreHandlerHook()
280
281 if has("gui_running") || has("win32")
282 !{abiword "%" || kword "%" || swriter "%"} &
283 q
284 else
285 r!antiword -tf "%s"
286 endif
287 call PostHandlerHook()
288 endfunction
289
290 function! PdfFileHandler()
291 call PreHandlerHook()
292
293 if has("x11")
294 !{evince "%" || kpdf "%" || xpdf "%"} &
295 q
296 elseif has("win32")
297 !"Foxit Reader.exe" "%" &
298 q
299 else
300 echo "No text dump program setup available...."
301 endif
302
303 call PostHandlerHook()
304 endfunction
305
306 function! PsFileHandler()
307 call PreHandlerHook()
308
309 let l:prompt = input("View or edit % [yes|no]?: ")
310 if l:prompt=="y" || l:prompt=="yes" || l:prompt=="Y" || l:prompt=="YES"
311 if has("x11")
312 !{evince "%" || kpdf "%" || xpdf "%"} &
313 q
314 elseif has("win32")
315 echo "Whats the ps viewer?"
316 else
317 echo "No text dump program installed...."
318 endif
319 endif
320
321 call PostHandlerHook()
322 endfunction
323
324 function! DviFileHandler()
325 call PreHandlerHook()
326
327 let l:prompt = input("View % in Vim [yes|no]?: ")
328 if l:prompt=="y" || l:prompt=="yes" || l:prompt=="Y" || l:prompt=="YES"
329 " depends on the dvi2tty program
330 !dvi2tty -F'vim -c "setl ro fdl=99" -' "%"
331 q
332 else
333 if has("x11")
334 !{xdvi "%" || kdvi "%" || "%"} &
335 q
336 elseif has("win32")
337 !echo "Go look up how to open DVI on TexLive Win"
338 endif
339 endif
340
341 call PostHandlerHook()
342 endfunction
343
344 " XXX Image file based formats
345 function! ImgFileHandler()
346 call PreHandlerHook()
347
348 if has("x11")
349 !xv "%" &
350 q
351 elseif has("win32")
352 !\%systemroot\%\system32\rundll32.exe \%systemroot\%\system32\shimgvw.dll,imageview_fullscreen "%" || \%systemroot\%\system32\mspaint.exe "%"
353 q
354 else
355 echo "no external viewer for text mode set...."
356 endif
357
358 call PostHandlerHook()
359 endfunction
360
361 function! XImgFileHandler()
362 call PreHandlerHook()
363
364 let l:prompt = input("View or edit % [yes|no]?: ")
365 if l:prompt=="y" || l:prompt=="yes" || l:prompt=="Y" || l:prompt=="YES"
366 if has("x11")
367 !xv "%" &
368 q
369 endif
370 endif
371
372 call PostHandlerHook()
373 endfunction
374
375 " XXX Code based formats
376 function! AdaFileHandler()
377 call PreHandlerHook()
378
379 call PostHandlerHook()
380 endfunction
381
382 function! AsmFileHandler()
383 call PreHandlerHook()
384
385 if exists("+spell")
386 setl nospell
387 endif
388 call PostHandlerHook()
389 endfunction
390
391 function! CFileHandler()
392 call PreHandlerHook()
393
394 setl tabstop=8 shiftwidth=8 noexpandtab
395 if has("folding")
396 setl foldmethod=syntax foldcolumn=1
397 endif
398 setl matchpairs-=<:>
399
400 if has("cindent")
401 " modify cindent to understand my switch...case and paren style
402 setl cinoptions+=:2,=2,g2,(0
403 setl cinkeys-=0#
404 endif
405
406 " highlight GNU Compiler stuff
407 let c_gnu=1
408 " highlight preceding spaces before a tab as an error
409 let c_space_errors=1
410 let c_no_trail_space_error=1
411 " use C syntax in *.h rather then C++ syntax
412 if has("syntax")
413 let c_syntax_for_h=1
414
415 " allow doxygen highlighting
416 set syntax=c.doxygen
417 endif
418
419 call PostHandlerHook()
420 endfunction
421
422 function! CSSFileHandler()
423 call PreHandlerHook()
424
425 setl tabstop=5 shiftwidth=5 expandtab
426 if has("folding")
427 setl foldmethod=indent
428 endif
429
430 call PostHandlerHook()
431 endfunction
432
433 function! CXXFileHandler()
434 call PreHandlerHook()
435
436 setl tabstop=4 shiftwidth=4 expandtab
437 if has("folding")
438 setl foldmethod=syntax foldcolumn=1
439 endif
440 setl matchpairs-=<:>
441
442 if has("cindent")
443 " modify cindent to understand my switch...case / class member
444 " access specifier / paren styles and not force #directives into
445 " col 1
446 setl cinoptions+=:2,=2,g2,h2,(0,#1
447 setl cinkeys-=0#
448 endif
449
450 if has("syntax")
451 " allow doxygen highlighting
452 set syntax=cpp.doxygen
453 endif
454
455 call PostHandlerHook()
456 endfunction
457
458 function! DFileHandler()
459 call PreHandlerHook()
460 call PostHandlerHook()
461 endfunction
462
463 function! ELispFileHandler()
464 call PreHandlerHook()
465 call PostHandlerHook()
466 endfunction
467
468 function! HtmlFileHandler()
469 call PreHandlerHook()
470
471 if has("syntax") && &t_Co > 2
472 syntax on
473 colo elflord
474 endif
475 setl tabstop=2 shiftwidth=2 expandtab
476 if has("folding")
477 setl foldmethod=indent
478 endif
479 filetype indent on
480 if exists("+omnifunc") " think twice about using this with other langs
481 imap </ </<c-x><c-o>
482 endif
483
484 call PostHandlerHook()
485 endfunction
486
487 function! JavaFileHandler()
488 call PreHandlerHook()
489
490 setl tabstop=4 shiftwidth=4 expandtab
491 if has("folding")
492 setl foldmethod=indent
493 endif
494 setl matchpairs-=<:>
495 if exists("+spell")
496 setl nospell " FUBAR in Java
497 endif
498 " Highlight all identifiers in java.lang.*
499 let java_highlight_java_lang_ids=1
500
501 call PostHandlerHook()
502 endfunction
503
504 function! JavaScriptFileHandler()
505 call PreHandlerHook()
506
507 call PostHandlerHook()
508 endfunction
509
510 function! LuaFileHandler()
511 call PreHandlerHook()
512 call PostHandlerHook()
513 endfunction
514
515 function! MakefileFileHandler()
516 call PreHandlerHook()
517
518 setl tabstop=4 shiftwidth=4 noexpandtab
519 if has("folding")
520 setl foldmethod=indent
521 endif
522
523 call PostHandlerHook()
524 endfunction
525
526 function! PerlFileHandler()
527 call PreHandlerHook()
528
529 setl tabstop=4 shiftwidth=4 noexpandtab
530 if has("folding")
531 setl foldmethod=indent
532 let perl_fold=1
533 let perl_fold_blocks=1
534 endif
535 setl matchpairs-=<:>
536
537 call PostHandlerHook()
538 endfunction
539
540 function! PhpFileHandler()
541 call PreHandlerHook()
542
543 setl tabstop=4 shiftwidth=4 expandtab
544 if has("folding")
545 setl foldmethod=indent
546 " allow code folding for classes and functions!
547 let php_folding=1
548 endif
549 setl matchpairs-=<:>
550 " highlight HTML tags within strings
551 let php_htmlInStrings=1
552 " disable short tags
553 let php_noShortTags=1
554
555 call PostHandlerHook()
556 endfunction
557
558 function! PythonFileHandler()
559 call PreHandlerHook()
560
561 setl tabstop=4 shiftwidth=4 expandtab
562 if has("folding")
563 setl foldmethod=marker
564 endif
565 setl matchpairs-=<:>
566 setl keywordprg=pydoc
567
568 let python_highlight_all=1
569 " slightly smarter indenting for (code\n morecode) situations
570 let g:pyindent_open_paren = '&sw + 1'
571
572 call PostHandlerHook()
573 endfunction
574
575 function! RubyFileHandler()
576 call PreHandlerHook()
577
578 setl tabstop=2 shiftwidth=2 expandtab
579 if has("folding")
580 setl foldmethod=syntax
581 let ruby_fold=1
582 endif
583 setl matchpairs-=<:>
584 filetype indent on
585 setl keywordprg=ri
586
587 call PostHandlerHook()
588 endfunction
589
590 function! SchemeFileHandler()
591 call PreHandlerHook()
592
593 setl tabstop=4 shiftwidth=4 expandtab
594 if has("folding")
595 setl foldmethod=syntax
596 endif
597 setl matchpairs-=<:>
598 if exists("+spell")
599 setl nospell " FUBAR in Scheme
600 endif
601 call PostHandlerHook()
602 endfunction
603
604 function! ShellFileHandler()
605 call PreHandlerHook()
606
607 setl tabstop=4 shiftwidth=4 expandtab
608 if has("folding")
609 setl foldmethod=indent
610 let g:sh_fold_enabled=8
611 endif
612 setl matchpairs-=<:>
613
614 call PostHandlerHook()
615 endfunction
616
617 function! SqlFileHandler()
618 call PreHandlerHook()
619 " We almost always work with MySQL, so default to it.
620 SQLSetType mysql
621 setl tabstop=2 shiftwidth=2 expandtab
622 setl matchpairs-=<:>
623
624 call PostHandlerHook()
625 endfunction
626
627 function! TexFileHanlder()
628 call PreHandlerHook()
629 if has("syntax") && &t_Co > 2
630 syntax on
631 colo elflord
632 endif
633 setl fileformat=dos
634 setl tabstop=4 shiftwidth=4 softtabstop=4 noexpandtab
635 if has("folding")
636 setl foldmethod=indent
637 " syntax-based folding of parts, chapters, sections, etc
638 let g:tex_fold_enabled=1
639 endif
640 setl matchpairs-=<:>
641 " fixes gq from using c-keyword based indentation
642 set cinwords=""
643
644 call PostHandlerHook()
645 endfunction
646
647 function! TroffFileHandler()
648 call PreHandlerHook()
649
650 setl matchpairs-=<:>
651 if exists("+spell")
652 setl nospell " FUBAR in Java
653 endif
654
655 call PostHandlerHook()
656 endfunction
657
658 function! VimFileHanlder()
659 call PreHandlerHook()
660
661 if has("syntax") && &t_Co > 2
662 syntax on
663 colo elflord
664 endif
665 setl fileformat=unix
666 setl tabstop=4 shiftwidth=4 noexpandtab
667 if has("folding")
668 setl foldmethod=marker
669 endif
670 setl matchpairs-=<:>
671
672 call PostHandlerHook()
673 endfunction
674
675 function! VisualBasicFileHandler()
676 call PreHandlerHook()
677
678 "setl fileformat=unix
679 setl matchpairs-=<:>
680
681 call PostHandlerHook()
682 endfunction
683
684 " XXX for use with other programs
685 " Settings for outlining ideas
686 function! My_OutlineMode()
687 call PreHandlerHook()
688
689 setl tabstop=8 shiftwidth=8 noexpandtab
690 setl listchars =tab:\|\ " Mark \t's with |'s
691 setl list
692 if exists("+spell")
693 setl spell
694 endif
695 setl autoindent
696 if has("smartindent")
697 setl smartindent
698 endif
699 setl showmatch matchtime=3
700 setl matchpairs+=(:),{:},[:],<:>
701 if has("folding")
702 " Fold by tabs
703 "setl foldmethod=expr
704 "setl foldexpr=getline(v:lnum)[0]==\"\\t\"
705 " Fold by braces
706 setl foldmethod=marker
707 setl foldmarker={,}
708 endif
709
710 call PostHandlerHook()
711 endfunction
712
713 " For the .tmp files created by knode
714 function! My_KNodeConfig()
715 call PreHandlerHook()
716
717 setl textwidth=0 wrap
718 if exists("+spell")
719 setl spell
720 endif
721 setl autoindent
722 if has('smartindent')
723 smartindent
724 endif
725 if has("folding")
726 setl foldmethod=indent
727 endif
728 set ft=mail
729
730 call PostHandlerHook()
731 endfunction
732
733 " !HANDLERS }}}
734
735 " !FORMATS }}}
736
737 " *INTERFACE* {{{
738
739
740 "set :command line height in lines
741 if has("gui_running")
742 set cmdheight=2
743 else
744 set cmdheight=1
745 endif
746
747
748 " GUI: Set options mainly used for for GVim
749
750 " autoselect, console dialogs, tabpages, icon, menubar, show grey menu
751 " items, tearoff menu items, Toolbar, always right scrollbar.
752 set guioptions=aceimgtTr
753
754 " Right click menu lists correction options when spell is set
755 set mousemodel=popup_setpos
756
757 " Make mouse pointer an I-Beam in insert mode like most other programs
758 set mouseshape=i:beam
759
760
761 " X11: Specifics for GVim
762 if has("x11")
763 "I love this font!!
764 set guifont=Terminus\ 14
765 "set lines=40
766 "set columns=80
767
768 " WINDOWS: Specifics for GVim
769 elseif has("win32")
770 set guifont=Fixedsys:h11:cANSI
771 set lines=25
772 set columns=80
773
774 endif
775
776 function! SetGuiColo() " {{{ XXX DEPRECIATED
777
778 if exists("*strftime")
779 let s:random = strftime("%S")
780 else " fall through to the else
781 let s:random = 61
782 endif
783
784 if s:random < 2
785 colo ron
786
787 elseif s:random < 4
788 colo candycode
789
790 elseif s:random < 6
791 colo silent
792
793 elseif s:random < 8
794 colo default
795
796 elseif s:random < 12
797 colo denim
798
799 elseif s:random < 14
800 colo midnight2
801
802 elseif s:random < 16
803 colo hhazure
804
805 elseif s:random < 18
806 colo rootwater
807
808 elseif s:random < 20
809 colo nightshimmer
810
811 elseif s:random < 22
812 colo murphy
813
814 elseif s:random < 24
815 colo coffee
816
817 elseif s:random < 26
818 colo professional
819
820 elseif s:random < 28
821 colo sf
822
823 elseif s:random < 30
824 colo my
825
826 elseif s:random < 32
827 colo vcbc
828
829 elseif s:random < 34
830 colo gobo
831
832 elseif s:random < 36
833 colo metacosm
834
835 elseif s:random < 38
836 colo blackboard
837
838 elseif s:random < 40
839 colo billw
840
841 elseif s:random < 42
842 colo dusk
843
844 elseif s:random < 44
845 colo desert
846
847 elseif s:random < 46
848 colo evening
849
850 elseif s:random < 48
851 colo golden
852
853 elseif s:random < 50
854 colo chela_light
855
856 elseif s:random < 52
857 colo camo
858
859 elseif s:random < 54
860 colo developer
861
862 elseif s:random < 56
863 colo neon
864
865 elseif s:random < 58
866 colo chlordane
867
868 elseif s:random < 60
869 colo shine
870
871 else
872 colo default
873
874 endif
875 endfunction " }}}
876
877 function! SetConsoleColo() "{{{ XXX DEPRECIATED
878
879
880 " XXX override this for now
881 colo none
882
883 return
884 if exists("*strftime")
885 let s:random = strftime("%S")
886 else " fall through to the else
887 let s:random = 61
888 endif
889
890 if s:random < 2
891 colo astronaut
892
893 elseif s:random < 4
894 colo redblack
895
896 elseif s:random < 6
897 colo default
898
899 elseif s:random < 8
900 colo golden
901
902 elseif s:random < 12
903 colo candycode
904
905 elseif s:random < 14
906 colo murphy
907
908 elseif s:random < 16
909 colo my
910
911 elseif s:random < 18
912 colo c
913
914 elseif s:random < 20
915 colo elflord
916
917 elseif s:random < 22
918 colo relaxedgreen
919
920 elseif s:random < 24
921 colo astronaut
922
923 elseif s:random < 26
924 colo redblack
925
926 elseif s:random < 28
927 colo default
928
929 elseif s:random < 30
930 colo golden
931
932 elseif s:random < 32
933 colo candycode
934
935 elseif s:random < 34
936 colo elflord
937
938 elseif s:random < 36
939 colo c
940
941 elseif s:random < 38
942 elseif s:random < 40
943 elseif s:random < 42
944 colo relaxedgreen
945
946 elseif s:random < 44
947 colo redblack
948
949 elseif s:random < 46
950 colo default
951
952 elseif s:random < 48
953 colo candycode
954
955 elseif s:random < 50
956 colo golden
957
958 elseif s:random < 52
959 colo relaxedgreen
960
961 elseif s:random < 54
962 colo astronaut
963
964 elseif s:random < 56
965 colo my
966
967 elseif s:random < 58
968 colo astronaut
969
970 elseif s:random < 60
971 colo murphy
972
973 else
974 colo default
975
976 endif
977
978 endfunction " }}}
979
980 if !has("gui_running")
981 call SetConsoleColo()
982 endif
983
984
985 " !INTERFACE }}}
986
987 " !SETTINGS }}}
988
989 " |BINDS| {{{
990
991 " *FUNCTIONS* {{{
992
993 " XXX: Be sure to add ! to functions and commands in order to overwrite
994 " the definitions if this file is resourced after startup.
995
996
997 " Make current file executable
998 function! ChmodScript()
999 silent! execute ":!chmod +x %"
1000 endfunction
1001 command! Chmod call ChmodScript()
1002
1003 " ROT13 encode/decode the current file
1004 function! ROT13()
1005 <esc>ggvGg?
1006 endfunction
1007
1008 " !FUNCTIONS }}}
1009
1010 " *MAPS* {{{
1011
1012 """" WARNING !!!
1013 """" NEVER MAP THE BACKSPACE KEY OR A MODIFIER
1014
1015 " Use ";" as an alias for ":" -> it makes life so much easier
1016 nnoremap ; :
1017
1018 " show more data when we ask for a line count
1019 nnoremap <C-g> <C-g>2<C-g>
1020
1021 " clear search highlighting when redrawing the screen
1022 nnoremap <silent> <C-l> :nohl<CR><C-l>
1023
1024 " Make Escape toggle normal/insert mode -> I don't like this!
1025 "nnoremap <silent> <esc> :startinsert<CR>
1026
1027 " Combine [s and ]s with z=
1028 " (e.g. move to miss spelled word in direction and get suggestions)
1029 nnoremap [z [sz=
1030 nnoremap ]z ]sz=
1031
1032 " toggle spelling highlights on/off
1033 nnoremap <leader>Z :set hl&<cr>
1034 nnoremap <leader>z :set hl+=B:none,P:none,R:none,L:none<cr>
1035
1036 " swap words under cursor with \xp or \gw (where \ = <leader>
1037 noremap <silent> <leader>xp "_yiw:s/\(\%#\w\+\)\(\W\+\)\(\w\+\)/\3\2\1/<cr><c-o><c-l>
1038 noremap <silent> <leader>gw <leader>xp
1039
1040 " Use emacs style movement commands in insert mode
1041 " XXX: these redine Vim maps, ctrl-a => useless, ctrl-e => useful
1042 "inoremap <c-a> <esc>I
1043 "inoremap <c-e> <esc>A
1044
1045 " F1 toggles spell checking for this buffer
1046 if exists("+spell")
1047 inoremap <F1> <esc>:set spell! <bar> set spell?<CR>i
1048 nnoremap <F1> <esc>:set spell! <bar> set spell?<CR>
1049 endif
1050
1051 " F2 toggles line numbers
1052 nnoremap <F2> :set number! <bar> set number?<CR>
1053 inoremap <F2> <esc>:set number! <bar> set number?<CR>i
1054
1055 " F3 turns on auto indentations
1056 nnoremap <F3> :set smartindent autoindent<CR>
1057 inoremap <F3> <esc>:set smartindent autoindent<CR>i
1058
1059 " XXX make this toggle the nerd tree plugin
1060 " F5 launches file manager in the current directory
1061 nnoremap <F5> :OPEN %:p:h<CR>
1062 inoremap <F5> <esc>:OPEN %:p:h<CR>i
1063
1064 " !KEYS }}}
1065
1066 " !BINDS }}}
1067
1068 " *PLUGINS* {{{
1069
1070 " *Taglist* {{{
1071
1072 map <silent><leader>tl :TlistToggle<CR>
1073 let g:Tlist_Auto_Open=0
1074 let g:Tlist_GainFocus_On_ToggleOpen=1
1075 let g:Tlist_Enable_Fold_Column=0
1076 let g:Tlist_Exit_OnlyWindow=1
1077 let g:Tlist_Display_Prototype=1
1078 let g:Tlist_Show_Menu=1
1079
1080 " !Taglist }}}
1081
1082 " *NERDTree* {{{
1083
1084 " !NERDTree }}}
1085
1086 " !PLUGINS }}}
1087
1088
1089
1090 """"" *play* {{{
1091 " Beautify omnicompletion popup
1092 "highlight Pmenu guifg=white guibg=blue ctermfg=white ctermbg=blue
1093
1094 " Fold paragraphs
1095 "if has("folding")
1096 " set foldexpr=getline(v:lnum)=~'^\\s*$'&&getline(v:lnum+1)=~'\\S'?'<1':1
1097 "endif
1098
1099 if exists("*strftime")
1100 iabbrev insert_date <c-r>=strftime("%Y-%m-%d %H:%M:%S")<cr>
1101 endif
1102
1103 iabbrev teh the
1104 iabbrev swtich switch
1105
1106 """"" !play }}}