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
|
" Author: Florian "Bluewind" Pritz <flo@xssn.at>
set nocompatible
set encoding=utf-8 " unicode encoding
if &term =~# '^\(screen\|rxvt*\)$' "tty blinks otherwise
set t_Co=256
endif
set nobackup
set noexpandtab
set smarttab
set tabstop=4
set shiftwidth=4
set softtabstop=4
set ruler " show me where the cursor is
set rulerformat=%l/%L(%p%%),%c " a better ruler
set showmatch " show matching brackets
"set cindent
set number " show line numbers
set showmode " show mode at bottom of screen
set hlsearch " highlight all search results
set incsearch " increment search
set ignorecase " case-insensitive search
set smartcase " upper-case sensitive search
set nowrapscan " stop searching at EOF
set laststatus=2
set mouse=a
set nopaste
set foldmethod=marker
"set smartindent
set scrolloff=3
set showcmd
set display=uhex
"set list
"set listchars=tab:>\ ,eol:$
set listchars=trail:·,precedes:«,extends:»,tab:▸\ ,eol:↲
set hidden
set display+=lastline
if exists("+undofile")
set undofile
if isdirectory($HOME . '/.vim/undo') == 0
:silent !mkdir -p ~/.vim/undo > /dev/null 2>&1
endif
set undodir=~/.vim/undo//
set undodir+=.
endif
set splitbelow
set splitright
set wildmenu
set wildmode=full
set wildignore=*.o,*.a,*.class,*.mo,*.la,*.swp,*.jpg,*.png,*.xpm,*.gif,*.pyc,*~,.git,.svn,.hg,
set completeopt-=preview
set complete+=k " enable dictionary completion
set completeopt=menuone,menu,longest
let mapleader = ","
let g:sudo_no_gui = 1
let g:ycm_extra_conf_globlist = ['~/.ycm_extra_conf.py']
filetype off
set runtimepath+=~/.vim/bundle/neobundle.vim/
call neobundle#rc(expand('~/.vim/bundle/'))
NeoBundleFetch 'Shougo/neobundle.vim'
NeoBundle 'scrooloose/syntastic'
"NeoBundle 'Rip-Rip/clang_complete'
"NeoBundle 'Shougo/neocomplete.vim'
"NeoBundle 'Shougo/neosnippet.vim'
"NeoBundle 'Shougo/neosnippet-snippets'
"NeoBundle 'Shougo/vimproc.vim', {
"\ 'build' : {
"\ 'windows' : 'make -f make_mingw32.mak',
"\ 'cygwin' : 'make -f make_cygwin.mak',
"\ 'mac' : 'make -f make_mac.mak',
"\ 'unix' : 'make -f make_unix.mak',
"\ },
"\ }
"NeoBundle 'osyo-manga/vim-reunions'
"NeoBundle 'osyo-manga/vim-marching'
"
NeoBundle 'Valloric/YouCompleteMe'
NeoBundle 'SirVer/ultisnips'
"
NeoBundle 'tpope/vim-unimpaired'
NeoBundle 'tpope/vim-fugitive'
NeoBundle 'tpope/vim-repeat'
NeoBundle 'SudoEdit'
NeoBundle 'rking/ag.vim'
NeoBundle 'scrooloose/nerdtree'
NeoBundle 'majutsushi/tagbar'
NeoBundleCheck
"aliases
cnorea w!! w !sudo tee "%" > /dev/null
cnorea qpd %!perl -pe 's/\=([0-9A-Fa-f]{2})/chr(hex($1))/ge; s/\=\n//;'
function Filebin(start, end)
let range = expand(a:start) . "," . expand(a:end)
silent exe expand(range) . "w !fb -n " . expand("%:t") . " -e " . expand(&ft)
redraw!
endfunction
com! -nargs=0 -range=% Fb :call Filebin(<line1>, <line2>)
syntax on
filetype plugin indent on
autocmd FileType text setlocal textwidth=78
autocmd BufReadPost *
\ if line("'\"") > 1 && line("'\"") <= line("$") |
\ exe "normal! g`\"" |
\ endif
command! DiffOrig vert new | set bt=nofile | r # | 0d_ | diffthis
\ | wincmd p | diffthis
set runtimepath+=/usr/share/vim
let python_highlight_all = 1
" common save shortcuts
inoremap <C-s> <esc>:w<cr>a
nnoremap <C-s> :w<cr>
inoremap <C-c> <esc>:q<cr>
nnoremap <C-c> :q<cr>
inoremap <C-x> <esc>:bd<cr>
nnoremap <C-x> :bd<cr>
" movement mappings
nnoremap <silent> <C-Right> <c-w>l
nnoremap <silent> <C-Left> <c-w>h
nnoremap <silent> <C-Up> <c-w>k
nnoremap <silent> <C-Down> <c-w>j
set <C-Right>=[C
set <C-Left>=[D
" unsupported options
"set <C-Up>=[A
"set <C-Down>=[B
nnoremap <silent> <C-W>[A <c-w>K
nnoremap <silent> <C-W>[B <c-w>J
nnoremap <silent> <C-W><C-Right> <c-w>L
nnoremap <silent> <C-W><C-Left> <c-w>H
nnoremap <silent> <C-W><C-Up> <c-w>K
nnoremap <silent> <C-W><C-Down> <c-w>J
nnoremap <Up> gk
nnoremap <Down> gj
nnoremap j gj
nnoremap k gk
"au VimEnter * :NERDTreeToggle
nmap <F1> :TagbarToggle<CR>
noremap <F2> :NERDTreeToggle<CR>
inoremap <F2> <ESC>:NERDTreeToggle<CR>
noremap <C-f> :FufFile<CR>
inoremap <C-f> <ESC>:FufFile<CR>
"noremap <C-b> :FuzzyFinderBuffer<CR>
"inoremap <C-b> <ESC>:FuzzyFinderBuffer<CR>
noremap <C-h> :nohl<CR>
inoremap <C-h> <ESC>:nohl<CR>a
let g:UltiSnipsJumpForwardTrigger="<tab>"
let g:UltiSnipsExpandTrigger="<c-j>"
" #### Neocomplete config ####
let g:acp_enableAtStartup = 0
let g:neocomplete#enable_at_startup = 1
let g:neocomplete#force_overwrite_completefunc = 1
let g:neocomplete#enable_smart_case = 1
let g:neocomplete#sources#syntax#min_keyword_length = 2
let g:neocomplete#disable_auto_complete = 0
let g:neocomplete#enable_auto_close_preview = 0
imap <expr><TAB> pumvisible() ? "\<C-n>" : "\<TAB>"
"imap <expr><TAB> neosnippet#expandable_or_jumpable() ?
"\ "\<Plug>(neosnippet_expand_or_jump)"
"\: pumvisible() ? "\<C-n>" : "\<TAB>"
"smap <expr><TAB> neosnippet#expandable_or_jumpable() ?
"\ "\<Plug>(neosnippet_expand_or_jump)"
"\: pumvisible() ? "\<C-n>" : "\<TAB>"
""\: "\<TAB>"
"inoremap <silent> <CR> <C-r>=<SID>my_cr_function()<CR>
"function! s:my_cr_function()
""return neocomplete#close_popup() . "\<CR>"
"" For no inserting <CR> key.
"return pumvisible() ? neocomplete#close_popup() : "\<CR>"
"endfunction
" For snippet_complete marker.
if has('conceal')
set conceallevel=2 concealcursor=vin
endif
" Enable heavy omni completion.
if !exists('g:neocomplete_omni_patterns')
let g:neocomplete_omni_patterns = {}
endif
let g:neocomplete_omni_patterns.php = '[^. \t]->\h\w*\|\h\w*::'
let g:neocomplete_omni_patterns.c = '[^.[:digit:] *\t]\%(\.\|->\)'
let g:neocomplete_omni_patterns.cpp = '[^.[:digit:] *\t]\%(\.\|->\)\|\h\w*::'
" clang_complete support
if !exists('g:neocomplete#force_omni_input_patterns')
let g:neocomplete#force_omni_input_patterns = {}
endif
let g:neocomplete#force_overwrite_completefunc = 1
let g:neocomplete#force_omni_input_patterns.c = '[^.[:digit:] *\t]\%(\.\|->\)\w*'
let g:neocomplete#force_omni_input_patterns.cpp = '[^.[:digit:] *\t]\%(\.\|->\)\w*\|\h\w*::\w*'
let g:neocomplete#force_omni_input_patterns.objc = '[^.[:digit:] *\t]\%(\.\|->\)\w*'
let g:neocomplete#force_omni_input_patterns.objcpp = '[^.[:digit:] *\t]\%(\.\|->\)\w*\|\h\w*::\w*'
let g:clang_complete_auto = 0
let g:clang_auto_select = 0
let g:clang_complete_macros = 1
let g:clang_complete_patterns = 1
let g:clang_snippets=1
let g:clang_conceal_snippets=1
let g:clang_snippets_engine='clang_complete'
let g:tagbar_left=1
let g:tagbar_autofocus=1
let g:tagbar_autoclose=1
" For perlomni.vim setting.
" https://github.com/c9s/perlomni.vim
let g:neocomplete_omni_patterns.perl = '\h\w*->\h\w*\|\h\w*::'
autocmd FileType css setlocal omnifunc=csscomplete#CompleteCSS
autocmd FileType html,markdown setlocal omnifunc=htmlcomplete#CompleteTags
autocmd FileType javascript setlocal omnifunc=javascriptcomplete#CompleteJS
autocmd FileType python setlocal omnifunc=pythoncomplete#Complete
autocmd FileType xml setlocal omnifunc=xmlcomplete#CompleteTags
autocmd FileType php set foldmethod=syntax
autocmd FileType php set foldlevelstart=2 foldnestmax=2
autocmd FileType php let g:php_folding=1
autocmd FileType python set foldmethod=indent
autocmd FileType python set foldlevelstart=2 foldnestmax=2
autocmd FileType make setlocal noexpandtab
au FileType python set ts=4 sw=4 softtabstop=4 et
autocmd BufRead,BufNewFile PKGBUILD let is_bash=1 | set ft=sh
"colorscheme gardener
"colorscheme desert256
"colorscheme candycode
let g:jellybeans_background_color_256 = 'none'
let g:jellybeans_overrides = {
\ 'SpecialKey': { 'guifg': 'b0b0b0', 'guibg': '000000'}
\}
colorscheme jellybeans
"colorscheme inkpot
"colorscheme mustang
"colorscheme wombat256
"colorscheme xoria256
" Toggle dark/light default colour theme for shitty terms
"map <F2> :let &background = ( &background == "dark" ? "light" : "dark" )<CR>
" Compile and run keymappings
au FileType php map <F10> :!php %<CR>
au FileType python map <F10> :!python %<CR>
au FileType perl map <F10> :!perl %<CR>
au FileType ruby map <F10> :!ruby %<CR>
au FileType lua map <F10> :!lua %<CR>
au FileType html,xhtml map <F10> :!firefox %<CR>
au FileType tex map <F10> :!texi2pdf -c %<CR>
" Get the commit responsible for the current line
nmap <c-b> :call BlameCurrentLine()<cr>
" Get the current line number & file name, view the git commit that inserted it
fun! BlameCurrentLine()
let lnum = line(".")
let file = @%
exec "!gitBlameFromLineNo " lnum file
endfun
map <F12> <ESC>ggg?G``" apply rot13 for people snooping over shoulder, good fun
highlight ExtraWhitespace ctermbg=red guibg=red
autocmd Syntax * syn match ExtraWhitespace /\s\+$\| \+\ze\t/ containedin=ALL
if !has("gui_running")
if &term == "screen"
set <C-Right>=Oc
set <C-Left>=Od
imap <C-Right> <ESC>:bn<RETURN>
imap <C-Left> <ESC>:bp<RETURN>
endif
else
set guifont=Dejavu\ Sans\ Mono\ 10
"set guioptions-=m
set guioptions-=T
set lines=80 columns=125
endif
|