-
Notifications
You must be signed in to change notification settings - Fork 0
/
.vimrc
229 lines (193 loc) · 8.89 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
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
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Vundle "
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
set nocompatible
filetype off
set rtp+=~/dotfiles/.vim/bundle/Vundle.vim
call vundle#begin()
Plugin 'VundleVim/Vundle.vim'
Plugin 'ctrlpvim/ctrlp.vim'
"Plugin 'easymotion/vim-easymotion'
Plugin 'haya14busa/incsearch-easymotion.vim'
Plugin 'haya14busa/incsearch-fuzzy.vim'
Plugin 'haya14busa/incsearch.vim'
Plugin 'morhetz/gruvbox'
"Plugin 'scrooloose/syntastic'
Plugin 'tpope/vim-fugitive'
Plugin 'vim-airline/vim-airline'
"Plugin 'scrooloose/nerdtree'
Plugin 'leafgarland/typescript-vim'
Plugin 'w0rp/ale'
Plugin 'airblade/vim-gitgutter'
Plugin 'myusuf3/numbers.vim'
Plugin 'rhysd/vim-grammarous'
Plugin 'lervag/vimtex'
call vundle#end()
filetype plugin indent on
" Brief help
" :PluginList - lists configured plugins
" :PluginInstall - installs plugins; append `!` to update or just :PluginUpdate
" :PluginSearch foo - searches for foo; append `!` to refresh local cache
" :PluginClean - confirms removal of unused plugins; append `!` to auto-approve removal
"
" see :h vundle for more details or wiki for FAQ
" Put your non-Plugin stuff after this line
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Mine "
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
syntax enable
let mapleader=" "
set colorcolumn=80 " Show a visual line at C80
set cursorline " Line where the cursor is more visible
set encoding=utf8 " Use UTF-8 as default encoding
set mouse="a" " Disable the mouse
set number " Show line numbers
set numberwidth=4 " Width of numbers column
set scrolloff=4 " Keep a context of 4 lines when scrolling
set showmatch " Show matching brace when closing one
set ttimeoutlen=10 " Timeout value for keycodes
set updatetime=250 " Vim's waiting time before acknowledging end of typing
" Indentation and Alignment
set tabstop=4 " 1 tab := 4 spaces
set softtabstop=4 " Backspace removes 4 spaces
set shiftwidth=4 " Use 4 spaces for indentation
set expandtab " Use spaces instead of tabs
set smarttab " Actually not used with the current settings
set autoindent " To turn it on
" Wrap
set wrap " Wrap
set linebreak " Don't split words
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Maps "
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Allow saving of files as sudo when vim is not started with sudo
cmap w!! w !sudo tee > /dev/null %
" Insert date "here"
nmap \<C-D> "=system("date -R")<CR>p
imap \<C-D> <C-R>=system("date -R")<CR>
" Press F4 to toggle highlighting on/off, and show current value
nmap <F4> :set hlsearch! hlsearch?<CR>
" Fix syntax highlight (when broken)
nmap <F12> :syntax sync fromstart<CR>
imap <F12> <C-o>:syntax sync fromstart<CR>
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Integrations "
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Pretty format JSON file
:command Pjson %!python -m json.tool
" ClangFormat integration
map <Leader>= :pyf /usr/share/clang/clang-format.py<CR>
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Interface settings "
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
set background=dark
colorscheme gruvbox
if has("gui_running") " i.e. if gvim
set lines=24 columns=80 " Default size of a terminal
set guioptions-=T " Hide the toolbar
set guifont=Monospace\ 10 " Set the font (equal to the terminal)
let &co=80 + &foldcolumn + (&number || &relativenumber ? &numberwidth : 0)
elseif &term =~ '256color'
" disable Background Color Erase (BCE) so that color schemes
" render properly when inside 256-color tmux and GNU screen.
" see also http://snk.tuxfamily.org/log/vim-256color-bce.html
set t_ut=
" activate the use of 24-bit color
" set termguicolors
else
" in case the terminal doesn't announce 256 colors.. assume it anyway
set t_Co=256
endif
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Hard Mode "
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
noremap <Up> <NOP>
noremap <Down> <NOP>
noremap <Left> <NOP>
noremap <Right> <NOP>
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" vim-airline "
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
set laststatus=2 " Show bar at all times
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" ctrlp "
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
let g:ctrlp_working_path_mode = 'ra'
let g:ctrlp_user_command = ['.git',
\ 'cd %s && git ls-files -co --exclude-standard']
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" EasyMotion "
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" <Leader>f{char} to move to {char}
map <Leader>f <Plug>(easymotion-bd-f)
nmap <Leader>f <Plug>(easymotion-overwin-f)
" <Leader>s{char}{char} to move to {char}{char}
nmap <Leader>s <Plug>(easymotion-overwin-f2)
" Move to line
map <Leader>L <Plug>(easymotion-bd-jk)
nmap <Leader>L <Plug>(easymotion-overwin-line)
" Move to word
map <Leader>w <Plug>(easymotion-bd-w)
nmap <Leader>w <Plug>(easymotion-overwin-w)
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" IncSearch "
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
map / <Plug>(incsearch-forward)
map ? <Plug>(incsearch-backward)
map g/ <Plug>(incsearch-stay)
" incsearch.vim x fuzzy x vim-easymotion
function! s:config_easyfuzzymotion(...) abort
return extend(copy({
\ 'converters': [incsearch#config#fuzzy#converter()],
\ 'modules': [incsearch#config#easymotion#module()],
\ 'keymap': {"\<CR>": '<Over>(easymotion)'},
\ 'is_expr': 0,
\ 'is_stay': 1
\ }), get(a:, 1, {}))
endfunction
noremap <silent><expr> <Space>/ incsearch#go(<SID>config_easyfuzzymotion())
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" 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_mode_map = { 'mode': 'active',
\ 'active_filetypes': ['foo', 'bar'],
\ 'passive_filetypes': ['java', 'tex'] }
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" gitgutter"
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
let g:gitgutter_realtime=0
let g:gitgutter_eager=0
let g:gitgutter_terminal_reports_focus=0
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" undofiles"
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
set backup " keep a backup file (restore to previous version)
set undofile " keep an undo file (undo changes after closing)
set backupdir=~/.vim/.backup//
set undodir=~/.vim/.undo//
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" spell check"
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
set spelllang=en_us " spell checking
autocmd BufRead,BufNewFile *.tex setlocal spell "spell checking files
hi clear SpellBad
hi SpellBad cterm=underline
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" ale "
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
let g:ale_linters = {
\ 'latex': ['chktex', 'lacheck', 'proselint'],
\ 'c': ['clang', 'gcc'],
\ 'cpp': ['clang', 'gcc'],
\}
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" remaapping escape
cnoremap kj <C-C>
cnoremap jk <C-C>