codito / configs

Config files

This URL has Read+Write access

codito (author)
Sun Sep 27 00:12:54 -0700 2009
commit  ccbc2793d023b40f5677bcbcb0b7940015f187a6
tree    ca85074a7c9e4d4cf8204776894cc6ff8a0cfa55
parent  cf353531c0828dda18547f210e6eebec02bd2f80
configs / .vimrc
100644 215 lines (180 sloc) 7.54 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
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
" VIM config file
" Created: Aug 2005
" Last Modified: Sun 27 Sep 2009 12:42:37 PM IST Standard Time
 
" Platform related {{{1
"
" Local settings file, default to linux
let s:localFile = "~/.local.vim"
 
" Know the platform we're running on
function GetPlatform()
    if has("win32") || has("win64")
        return "win"
    else
        return "nix"
    endif
endfunction
 
" Get ready for life w/o walls
if GetPlatform() == "win"
    let s:localFile = "~/local.vim"
    source $VIMRUNTIME/mswin.vim
    behave mswin
endif
 
" Pure vim {{{1
"
" Autocomplete {{{2
set complete+=k " scan the files given with the 'dictionary' option
set wildmenu " command-line completion operates in an enhanced mode
set wildignore=*.bak,*.o,*.e,*~ " ignore these
 
" Buffers {{{2
set autoread " read open files again when changed outside Vim
set autowrite " write a modified buffer on each :next , ...
set backspace=indent,eol,start " define backspace behavior
set bufhidden=delete " delete hidden buffers, changes will be lost!
set switchbuf=split,usetab " split/open new tab while switching buffers, for quickfix
 
" Directories {{{2
set autochdir " automatically chdir to the current directory
if GetPlatform() == "win"
    set backupdir=d:\backups
    set directory=d:\backups
else
    set backupdir=~/.vim/tmp " isolate the swap files to some corner
    set directory=~/.vim/tmp " directories for swap files
endif
set browsedir=current " use current directory for file browser
 
" Editor appearance {{{2
set foldmethod=syntax " default fold by syntax
set number " enable line number
set nocp " don't be vi compatible
set ruler " show the line,col info at bottom
set showcmd " show partial cmd in the last line
set showmatch " jump to the other end of a curly brace
set showmode " show the mode INSERT/REPLACE/...
syntax enable " enable syntax highlighting
set textwidth=100 " break a line after 100 characters
set noequalalways " for :split don't split space equally
set winheight=99999 winminheight=0 " rolodex look for vim
set visualbell " oh no beeps please!
 
" Key mappings in general {{{2
nmap <silent><S-Tab> :tabnext<CR>
 
" Search {{{2
set incsearch " use incremental search
set whichwrap=<,>,h,l,[,]] " set wrapping at the end of line
set wrapscan " wrap the search
 
" Tabs and Indentation {{{2
set cindent " support c indenting style
set expandtab " use spaces for indentation
set softtabstop=4 " replace tabs with 4 spaces
set shiftwidth=4 " for inserting spaces with S-<< and S->>
set tabstop=8 " defacto tab standard
 
" Tags {{{2
set sft " show full tags while autocompleting
set tags=tags,../..
 
" Misc {{{2
filetype plugin on " enable plugin support
 
 
" Language and file types {{{1
"
" Generic {{{2
" Filetype plugin
filetype plugin indent on
" Quickfix mode shortcuts
nmap <silent><F9> :make<cr>
nmap <silent><F10> :cl<cr>
nmap <silent><F11> :cp<cr>
nmap <silent><F12> :cn<cr>
 
" C/C++ {{{2
au FileType cc,cpp setlocal tags+=~/.vim/tags/cpptags
au FileType cc,cpp map <F8> :!ctags -R --c++-kinds=+p --fields=+iaS --extra=+q .<CR>
" Quickfix mode: command line msbuild error format
if GetPlatform() == "win"
    au FileType c,cpp set errorformat=%f(%l)\ :\ error\ C%n:\ %m
endif
 
" C# {{{2
" Folding : http://vim.wikia.com/wiki/Syntax-based_folding, see comment by Ostrygen
au FileType cs set omnifunc=syntaxcomplete#Complete
au FileType cs set foldmethod=indent
au FileType cs set foldmarker={,}
au FileType cs set foldtext=substitute(getline(v:foldstart+1),'{.*','{...}',)
au FileType cs set foldlevelstart=3
" Quickfix mode: command line msbuild error format
if GetPlatform() == "win"
    au FileType cs set errorformat=\ %#%f(%l\\\,%c):\ error\ CS%n:\ %m
endif
" C# tags
au FileType cs map <F8> :!ctags --recurse --extra=+fq --fields=+ianmzS --c\#-kinds=cimnp .<CR>
 
" Mail {{{2
autocmd BufNewFile,BufRead /tmp/mutt-* set filetype=mail
au FileType mail setlocal spell spelllang=en_us
au FileType mail set tw=66 autoindent expandtab formatoptions=tcqna
au FileType mail set list listchars=tab:»·,trail:·
au FileType mail set comments=nb:>
au FileType mail vmap D dO[...]^[
" go to a good starting point
au FileType mail silent normal /--\s*$^MO^[gg/^$^Mj
 
" PHP {{{2
let php_sql_query=1 " highlight all sql queries
let php_htmlInStrings=1 " highlight html syntax within strings
let php_noShortTags=1 " disable short tags
let php_folding=1 " enable folding for classes and functions
 
" php pear coding guidelines
" http://wiki.geeklog.net/wiki/index.php/Coding_Guidelines#Indenting_and_Line_Length
au FileType php setlocal expandtab shiftwidth=4 softtabstop=4 tabstop=4
 
" Powershell {{{2
au BufRead,BufNewFile *.ps1 set ft=ps1
 
" Python {{{2
au FileType python source ~/.vim/utils/python.vim
au FileType python setlocal et sw=4 sts=4 ts=4 ai
 
" Viki {{{2
au BufRead,BufNewFile $HOME/docs/thuts/* set ft=viki
 
" Text {{{2
au BufRead,BufNewFile *.txt set filetype=txt
au FileType txt setlocal spell spelllang=en_us
au FileType txt set tw=100 autoindent expandtab formatoptions=taqn
 
" Misc {{{2
" Change the working directory to the directory containing the current file
if has("autocmd")
  autocmd BufEnter,BufRead,BufNewFile,BufFilePost * :lcd %:p:h
endif " has("autocmd")
 
" Plugins {{{1
"
" Calendar {{{2
let g:calendar_diary = "~/docs/thuts/diary"
" lets set the template for new diary entries only (uses templates.vim)
au BufNewFile *.cal set ft=calendar
 
" NERD Commenter {{{2
let g:NERDShutUp = 1
nmap <silent><F7> :NERDTreeToggle<cr>
 
" Netrw plugin {{{2
let g:netrw_browse_split=3 " all edits in new tab
 
" TagList {{{2
" Settings for taglist.vim
let Tlist_Auto_Open=0
let Tlist_Compact_Format=1
let Tlist_Enable_Fold_Column=0
let Tlist_Exit_OnlyWindow=1
let Tlist_File_Fold_Auto_Close = 1
let Tlist_Show_One_File = 1 " show tags only for the current file
let Tlist_WinWidth=30
nmap <Leader>tt :TlistToggle<cr>
 
" Timestamp {{{2
if GetPlatform() == "win"
    let timestamp_regexp = '\v\C%(<Last %([cC]hanged?|[Mm]odified):\s+)@<=.*$'
endif
let g:timestamp_modelines = 20
 
" Viki {{{2
au BufNewFile *.idea set ft=idea
 
" Extensions and utils {{{1
"
" Enable camelCase text navigation {{{2
" Key Mappings for camelCase
":let g:camelchar = "A-Z" " stop on capital letters
":let g:camelchar = "A-Z0-9" " stop on numbers
:let g:camelchar = "A-Z0-9.,;:{([`'\"" " catch-all. class member, separator, end of statement, brackets and quotes
 
nnoremap <silent><C-Left> :<C-u>cal search('\<\<Bar>\%(^\<Bar>[^'.g:camelchar.']\@<=\)['.g:camelchar.']\<Bar>['.g:camelchar.']\ze\%([^'.g:camelchar.']\&\>\@!\)\<Bar>\%^','bW')<CR>
nnoremap <silent><C-Right> :<C-u>cal search('\<\<Bar>\%(^\<Bar>[^'.g:camelchar.']\@<=\)['.g:camelchar.']\<Bar>['.g:camelchar.']\ze\%([^'.g:camelchar.']\&\>\@!\)\<Bar>\%$','W')<CR>
inoremap <silent><C-Left> <C-o>:cal search('\<\<Bar>\%(^\<Bar>[^'.g:camelchar.']\@<=\)['.g:camelchar.']\<Bar>['.g:camelchar.']\ze\%([^'.g:camelchar.']\&\>\@!\)\<Bar>\%^','bW')<CR>
inoremap <silent><C-Right> <C-o>:cal search('\<\<Bar>\%(^\<Bar>[^'.g:camelchar.']\@<=\)['.g:camelchar.']\<Bar>['.g:camelchar.']\ze\%([^'.g:camelchar.']\&\>\@!\)\<Bar>\%$','W')<CR>
 
" Local machine dependent mods {{{1
"
exe "source " . s:localFile
 
" vim: foldmethod=marker
" EOF