-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathvimrc.symlink
More file actions
277 lines (231 loc) · 9.14 KB
/
vimrc.symlink
File metadata and controls
277 lines (231 loc) · 9.14 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
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
set nocompatible
set langmenu=none
set tw=78
let $LANG = 'en'
set tabstop=4
set shiftwidth=4
set incsearch
set hlsearch
set ignorecase
set smartcase
set tildeop
set mouse=a
syntax enable
set wildignore=*.swp,*.bak,*.pyc,*.class
set wildmode=longest,list,full
set wildmenu
set scrolloff=1
set guioptions=egLt
" Remove menu, toolbar and scrollbar mrT
" On Windows, also use '.vim' instead of 'vimfiles'; this makes synchronization
" across (heterogeneous) systems easier.
if has('win32') || has('win64')
" I have to add this because on this machine $HOME is a network folder
let $HOME = $USERPROFILE
set runtimepath=$HOME/.vim,$VIM/vimfiles,$VIMRUNTIME,$VIM/vimfiles/after,$HOME/.vim/after
set guifont=Consolas:h12:cDEFAULT
" Yes, it says that Windows is totally bullshit! :[
set bs=2
set clipboard=unnamed
map <C-c> y
map <C-v> p
let g:outlook_use_tabs = 1
let g:outlook_servername = 'OUTLOOK'
elseif has("mac")
set clipboard+=unnamed
set guifont=Menlo\ Regular:h11
" Maybe I should correct the followings
let g:main_font = "Menlo\\ Regular:h11"
let g:small_font = "Menlo\\ Regular:h2"
else
set guifont=Inconsolata\ Medium\ 10.5,Droid\ Sans\ Mono\ 9,DejaVu\ Sans\ Mono\ 9
set clipboard=unnamedplus
endif
" Try to save backup and swap files in private directory, fallback to $TMP
" otherwhise.
let BACKUP_DIR = '~/.vim-tmp'
silent execute '!mkdir -p ' . BACKUP_DIR
execute "set backupdir=" . BACKUP_DIR . ",/$TMP/"
execute "set directory=" . BACKUP_DIR . ",/$TMP/"
set backup
set number
call pathogen#infect()
call pathogen#helptags()
if &term =~ '^screen'
" Page keys http://sourceforge.net/p/tmux/tmux-code/ci/master/tree/FAQ
execute "set t_kP=\e[5;*~"
execute "set t_kN=\e[6;*~"
endif
" Stop asking to realod file when changed, just do it
set autoread
" no beeping
set vb
" If I wanna read the errors
" set debug=msg
let filetype_m="objc"
set completeopt=longest,menu,preview
setlocal omnifunc=syntaxcomplete#Complete
" autocmd FileType python set omnifunc=pythoncomplete#Complete
" autocmd FileType javascript set omnifunc=javascriptcomplete#CompleteJS
" autocmd FileType html set omnifunc=htmlcomplete#CompleteTags
" autocmd FileType css set omnifunc=csscomplete#CompleteCSS
source ~/.vim/vimrc-python
let g:AutoComplPop_IgnoreCaseOption = 1
if has("gui_running")
set lines=60 columns=100
endif
" let xml_jump_string = "`"
filetype plugin indent on
set autoindent
set laststatus=2
if version >= 700 && &term != 'cygwin' && !has('gui_running')
" In the color terminal, try to use CSApprox.vim plugin or
" guicolorscheme.vim plugin if possible in order to have consistent
" colors on different terminals.
"
" Uncomment one of the following line to force 256 or 88 colors if
" your terminal supports it. Or comment both of them if your terminal
" supports neither 256 nor 88 colors. Unfortunately, querying the
" number of supported colors does not work on all terminals.
"set t_Co=256
if &t_Co == 256 || &t_Co == 88
" Check whether to use CSApprox.vim plugin or guicolorscheme.vim plugin.
if has('gui') &&
\ (filereadable(expand("$HOME/.vim/bundle/CSApprox/plugin/CSApprox.vim")) ||
\ filereadable(expand("$HOME/vimfiles/plugin/CSApprox.vim")))
let s:use_CSApprox = 1
elseif filereadable(expand("$HOME/.vim/plugin/guicolorscheme.vim")) ||
\ filereadable(expand("$HOME/vimfiles/plugin/guicolorscheme.vim"))
let s:use_guicolorscheme = 1
endif
endif
endif
"if exists('s:use_CSApprox')
" " Can use the CSApprox.vim plugin.
" let g:CSApprox_attr_map = { 'bold' : 'bold', 'italic' : '', 'sp' : '' }
" colorscheme my_desert
"elseif exists('s:use_guicolorscheme')
" " Can use the guicolorscheme plugin. It needs to be loaded before
" " running GuiColorScheme (hence the :runtime! command).
" runtime! plugin/guicolorscheme.vim
" GuiColorScheme my_desert
"else
colorscheme my_desert
"endif
set statusline=%F%m%r%h%w\ [FMT=%{&ff}]\[TYPE=%Y]\ [ASCII=\%03.3b]\[HEX=\%02.2B]\ [POS=%04l/%L,%04v][%p%%]
"hi StatusLine term=bold,reverse cterm=bold ctermfg=yellow ctermbg=DarkGray gui=bold guifg=#6C6C6C guibg=#FCE94F
"hi StatusLineNC term=reverse cterm=reverse ctermfg=yellow ctermbg=black gui=reverse guifg=#6C6C6C guibg=#FCE94F
hi Visual gui=none guifg=#000000 guibg=#c4c4c4
" some custom colors
" hi statusline term=bold,reverse cterm=bold ctermfg=240 ctermbg=221 gui=bold guifg=#6C6C6C guibg=#FCE94F
" hi StatusLineNC term=bold,reverse cterm=reverse ctermfg=240 ctermbg=221 gui=bold guifg=#6C6C6C guibg=#FCE94F
" hi LineNr ctermfg=221
" hi DiffAdd ctermbg=222 ctermfg=240
" hi DiffDelete ctermbg=203 ctermfg=white
" hi DiffChange ctermbg=242 ctermfg=white
" hi DiffText ctermbg=242 ctermfg=222
" Custom colors for the csv plugin
hi CSVColumnEven term=bold ctermbg=238 guibg=grey30
"hi CSVColumnOdd term=bold ctermbg=244 guibg=#b2b2b2
hi CSVColumnOdd term=bold cterm=bold ctermfg=242 ctermbg=221 gui=bold guifg=#6c6c6c guibg=#ffd75f
let Tlist_Ctags_Cmd='/opt/local/bin/ctags'
" set diffexpr=MyDiff()
" function MyDiff()
" let opt = '-a --binary '
" if &diffopt =~ 'icase' | let opt = opt . '-i ' | endif
" if &diffopt =~ 'iwhite' | let opt = opt . '-b ' | endif
" let arg1 = v:fname_in
" if arg1 =~ ' ' | let arg1 = '"' . arg1 . '"' | endif
" let arg2 = v:fname_new
" if arg2 =~ ' ' | let arg2 = '"' . arg2 . '"' | endif
" let arg3 = v:fname_out
" if arg3 =~ ' ' | let arg3 = '"' . arg3 . '"' | endif
" let eq = ''
" if $VIMRUNTIME =~ ' '
" if &sh =~ '\<cmd'
" let cmd = '""' . $VIMRUNTIME . '\diff"'
" let eq = '"'
" else
" let cmd = substitute($VIMRUNTIME, ' ', '" ', '') . '\diff"'
" endif
" else
" let cmd = $VIMRUNTIME . '\diff'
" endif
" silent execute '!' . cmd . ' ' . opt . arg1 . ' ' . arg2 . ' > ' . arg3 . eq
" endfunction
if has("autocmd")
autocmd FileType html,htm set tabstop=2 formatoptions+=tl sw=2 tw=0
autocmd FileType erlang set tabstop=4 sw=4 tw=80 expandtab formatoptions-=ro
" no trailing spaces
autocmd FileType c,cpp,java,php,erlang,python autocmd BufWritePre <buffer> :%s/\s\+$//e
"autocmd FileType *.py set smarttab expandtab softtabstop=4
"autocmd BufWritePre *.py normal m`:%s/\s\+$//e ``
autocmd FileType xml,xsl set tw=0
autocmd FileType sh set tw=0
autocmd FileType c,cpp set cindent
autocmd FileType objc set tw=120
autocmd FileType markdown set expandtab tabstop=4 sw=4 tw=80
autocmd FileType yaml set expandtab tabstop=2 sw=2
autocmd FileType * let g:AutoComplPop_CompleteOption = '.,w,b,u,t,i'
autocmd FileType perl let g:AutoComplPop_CompleteOption = '.,w,b,u,t,k~/.vim/dict/perl.dict'
autocmd FileType ruby let g:AutoComplPop_CompleteOption = '.,w,b,u,t,i,k~/.vim/dict/ruby.dict'
autocmd FileType javascript let g:AutoComplPop_CompleteOption = '.,w,b,u,t,i,k~/.vim/dict/javascript.dict'
autocmd FileType erlang let g:AutoComplPop_CompleteOption = '.,w,b,u,t,i,k~/.vim/dict/erlang.dict'
autocmd FileType objc let g:AutoComplPop_CompleteOption = '.,w,b,u,t,i,k~/.vim/dict/objc.dict'
autocmd Filetype erlang setlocal dict=~/.vim/dict/erlang.dict
autocmd Filetype javascript setlocal dict=~/.vim/dict/javascript.dict
autocmd Filetype html setlocal dict=~/.vim/dict/javascript.dict
autocmd Filetype java setlocal dict=~/.vim/dict/java.dict
autocmd Filetype objc setlocal dict=~/.vim/dict/objc.dict
" make the jump based on ctags with mod:fun
autocmd FileType erlang setlocal iskeyword+=:
autocmd FileType mail setlocal fo+=aw
autocmd BufRead,BufNewFile *.impex set filetype=csv
" before setting this I have to know the default format of impex files fileencoding=utf-8
autocmd BufReadCmd *.jar,*.xpi call zip#Browse(expand("<amatch>"))
autocmd BufReadPre,BufNewFile rebar.config,sys.config set filetype=erlang
endif
" Disable syntastic for erlang files, it signals errors that actually aren't.
let g:syntastic_mode_map={ 'mode': 'active',
\ 'active_filetypes': [],
\ 'passive_filetypes': ['erlang'] }
" Quickly edit/reload the vimrc file
nmap <silent> <leader>ev :e $MYVIMRC<CR>
nmap <silent> <leader>sv :so $MYVIMRC<CR>
" Quickly switch off hlsearch
nmap <silent> ./ :nohlsearch<CR>
nnoremap <F1> :tabprev <CR>
nnoremap <F2> :tabnext <CR>
" nnoremap <F3> :set invpaste paste?<CR>
" set pastetoggle=<Leader>p
set pastetoggle=<F3>
set showmode
nnoremap <F4> :set expandtab tabstop=4 sw=4 tw=80<CR>
" If you need to use vim on a keyboard with an insanely positioned default ESC key.
inoremap kj <ESC>
" Use TAB to complete when typing words, else inserts TABs as usual.
" Uses dictionary and source files to find matching words to complete.
" See help completion for source,
" Note: usual completion is on <C-n> but more trouble to press all the time.
" Never type the same word twice and maybe learn a new spellings!
" Use the Linux dictionary when spelling is in doubt.
" Window users can copy the file to their machine.
function! Tab_Or_Complete()
if col('.')>1 && strpart( getline('.'), col('.')-2, 3 ) =~ '^\w'
return "\<C-N>"
else
return "\<Tab>"
endif
endfunction
inoremap <Tab> <C-R>=Tab_Or_Complete()<CR>
" remap increase number
nnoremap <M-C-i> <C-a>
nnoremap <M-i> <C-a>
" highlight current line
nnoremap <Leader>c :set cursorline!<CR>
map Q :qa<CR>
" switch to last opened buffer
nmap <C-e> :e#<CR>
if &diff
map <C-R> :diffupdate<CR>
endif