-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathvimrc
186 lines (157 loc) · 6.37 KB
/
vimrc
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
" Filip Hlasek (fhlasek)
" Github page: https://github.com/fhlasek/.vim
" __ _ _ _
" / _|| |__ ( | __ _ ___ ___ | | __
" | |_ | _ \ | | / _` |/ __| / _ \| |/ /
" | _|| | | || || (_| |\__ \| __/| <
" |_| |_| |_||_| \__,_||___/ \___||_|\_\
" _
" __ __(_) _ __ ___ _ __ ___
" \ \ / /| || '_ ` _ \ | '__|/ __|
" \ V / | || | | | | || | | (__
" \_/ |_||_| |_| |_||_| \___|
"
set nocompatible " Vim is more useful without Vi compatibility
set backspace=eol,start,indent
set incsearch " incremental search while typing
set hlsearch " highlight all matches
set history=200 " how many entries may be stored in the history
set showcmd " show command in the last line of the screen
set tabstop=2 " the width of the <TAB> character
set expandtab " <TAB> is replaced by spaces
set shiftwidth=2 " affects what happens when you press >>, << or ==
set smartindent " automatically insert a level of indentation in some cases
set autoindent " copy the indentation from the previous line
set spelllang=en " language used by spell check
set encoding=utf-8
set fileencodings=utf8,cp1250,latin2
set mouse=ar " mouse enabled in all modes
set number " display line numbers
set cursorline " highlight the screen line of the cursor
set ruler " show the line and column number
set laststatus=2 " the last window will always have a status line
set t_Co=256 " enable 256 colors
set scrolloff=5 " the number of lines to keep above and below the cursor
set splitbelow " open new horizontal split panes to bottom
set splitright " open new vertical split panes to right
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
syntax on
" gray colors: (black) 232, ..., 255 (white)
highlight Normal ctermfg=255 ctermbg=232
highlight LineNr ctermfg=241 ctermbg=234
highlight CursorLine ctermbg=233 cterm=NONE
highlight CursorLineNr ctermfg=11
highlight SpellBad ctermbg=52
highlight SpellCap ctermbg=88
highlight Search ctermbg=245
highlight Comment ctermfg=27
highlight Directory ctermfg=27
highlight Pmenu ctermfg=250 ctermbg=235
highlight PmenuSel ctermfg=254 ctermbg=237
highlight DiffAdd ctermbg=10 cterm=bold
highlight DiffChange ctermbg=236
highlight DiffDelete ctermbg=88
highlight DiffText ctermbg=17 cterm=bold
highlight SpecialKey ctermfg=19
" display invisible characters (tab must consist of two characters)
set list listchars=tab:>-,trail:.
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" don't expand tabs in Makefiles and Dockerfiles
autocmd FileType make setlocal noexpandtab
autocmd BufNewFile,BufRead Dockerfile setlocal noexpandtab
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" I don't want to type <SHIFT>; aka : (one of the most common command)
nmap ; :
" hotkey for showing / hiding line numbers
nmap , :set invnumber<Return>
" reselect visual block after indent/outdent
vnoremap < <gv
vnoremap > >gv
" split pane horizontally or vertically
map <Bar> :vsplit<Return>
map - :split<Return>
" auto 'set paste' and 'set nopaste' (other option is to set pastetoggle=<F2>)
let &t_SI .= "\<Esc>[?2004h"
let &t_EI .= "\<Esc>[?2004l"
inoremap <special> <expr> <Esc>[200~ XTermPasteBegin()
function! XTermPasteBegin()
set pastetoggle=<Esc>[201~
set paste
return ""
endfunction
" pane switching
map <Tab> <C-W>w
" buffer switching
nnoremap [C :bnext<Return>
nnoremap [D :bprevious<Return>
nmap = :buffer
" tabs switching
nmap <S-Left> :tabprevious<Return>
nmap <S-Right> :tabnext<Return>
imap <S-Left> <Esc>:tabprevious<Return>
imap <S-Right> <Esc>:tabnext<Return>
" JSON formatter
nmap =j :%!python -m json.tool<CR>
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Vim plugins - included using Pathogen
if !empty(globpath(&runtimepath, 'bundle/vim-pathogen/autoload/pathogen.vim'))
runtime bundle/vim-pathogen/autoload/pathogen.vim
execute pathogen#infect()
filetype plugin indent on
endif
if exists("g:loaded_pathogen")
" NerdTree
if &runtimepath =~ 'nerdtree'
highlight def link NERDTreeRO NERDTreeFile
let NERDTreeShowBookmarks = 1
" hotkeys for showing / hiding NerdTree
nmap § :NERDTreeFocus<Return>
nmap \\ :NERDTreeToggle<Return>
endif
" Syntastic
if &runtimepath =~ 'syntastic'
set statusline+=%#warningmsg#
set statusline+=%{SyntasticStatuslineFlag()}
set statusline+=%*
let g:syntastic_always_populate_loc_list = 1
let g:syntastic_auto_loc_list = 1
let g:syntastic_check_on_open = 1
let g:syntastic_check_on_wq = 0
let g:syntastic_enable_signs = 0
let g:syntastic_python_flake8_exec = 'python3'
let g:syntastic_python_flake8_args = ['-m', 'flake8']
let g:syntastic_python_checkers = ['python3', 'py3kwarn']
let g:ycm_python_binary_path = '/usr/bin/python'
let g:syntastic_cpp_compiler = 'clang++'
let g:syntastic_cpp_compiler_options = ' -std=c++11 -stdlib=libc++'
endif
" Airline
if &runtimepath =~ 'vim-airline'
let g:airline_powerline_fonts = 1
let g:airline_symbols = get(g:, 'airline_symbols', {})
let g:airline_symbols.maxlinenr = ''
let g:airline_symbols.linenr = ''
if !empty(globpath(&runtimepath, 'autoload/airline/themes/single_dark.vim'))
let g:airline_theme = 'single_dark'
endif
" show the list of buffers
let g:airline#extensions#tabline#enabled = 1
let g:airline#extensions#tabline#buffer_nr_show = 1
let g:airline#extensions#tabline#tab_nr_type = 1
let g:airline#extensions#tabline#fnamemod = ':t' " show just the filename
" set 'Airline friendly' font
set guifont=Meslo\ LG\ M\ for\ Powerline:h11
endif
" YouCompleteMe
if &runtimepath =~ 'YouCompleteMe'
let g:ycm_global_ycm_extra_conf = '~/.ycm_extra_conf.py'
let g:ycm_goto_buffer_command = 'vertical-split'
nnoremap f :YcmCompleter GoToDeclaration<Return>
set completeopt-=preview " don't show preview on autocompletion
endif
endif
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" load machine specific configuration
if filereadable(expand("~/.vimlocal.vim"))
source ~/.vimlocal.vim
endif