-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvimrc
336 lines (270 loc) · 9.15 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
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
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
set encoding=utf-8
syntax on
filetype plugin indent on " Needed for Nerd Commenter as well
let mapleader = " " " Changing default master key to space
"256 color
"if !has('gui_running')
"set t_Co=256
" set t_AB=^[[48;5;%dm
" set t_AF=^[[38;5;%dm
"endif
let $NVIM_TUI_ENABLE_TRUE_COLOR=1
set termguicolors
set background=dark
"let base16colorspace=256
set nomodeline
set cursorline
set nowrap
set wildmenu
set wildmode=longest:full,full
set colorcolumn=80
" Except ... on Markdown. Good stuff?
autocmd FileType markdown setlocal wrap
" Adjust system undo levels
set undolevels=100
" Use system clipboard
set clipboard=unnamed
"set clipboard=unnamedplus
map <C-c> "+y<CR> " CTRL+C to copy in Vmode
" Set tab width and convert tabs to spaces
set tabstop=2
set softtabstop=2
set shiftwidth=2
set expandtab
set smartindent
"autocmd Filetype vimrc setlocal ts=2 sw=2 "expandtab
"autocmd Filetype C setlocal ts=3 sw=2
" Don't let Vim hide characters or make loud dings
set conceallevel=1
set noerrorbells
" Number gutter
set number
set numberwidth=2
" Space above/beside cursor from screen edges
set scrolloff=5
set sidescrolloff=5
" Remaping Esc to jj
inoremap jj <ESC>
set ignorecase
set smartcase
set autoindent " indent
" set showmatch " highlight matching brackets
set autoread " when file was changed
set lazyredraw " redraw only when we need to"
set hlsearch " highlight same words while searching with Shift + *
"Ability to cancel a search with Escape (marcgg.com)
nnoremap <silent> <Esc> :nohlsearch<Bar>:echo<CR>
" Removes the delay when hitting esc in insert mode
set ttimeout
set ttimeoutlen=1
" Automatically refresh changed files
set autoread
" Wrap long lines
nnoremap wl gggqG
" Redraw vim
nnoremap rr :so $MYVIMRC \| checktime<CR>
" Highlight last inserted text
nnoremap gV `[v`]
" Adding empty lines
nnoremap <Leader>[ :<c-u>put! =repeat(nr2char(10), v:count1)<cr>'[
nnoremap <Leader>] :<c-u>put =repeat(nr2char(10), v:count1)<cr>
" Moving current line
nnoremap <Leader>m[ :<c-u>execute 'move -1-'. v:count1<cr>
nnoremap <Leader>m] :<c-u>execute 'move +'. v:count1<cr>
" ========================= Plugin Manager =========================
"
call plug#begin('~/.config/nvim/plugged')
" Important?
Plug 'Shougo/unite.vim'
" Visual
Plug 'chriskempson/base16-vim'
Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes'
" Plug 'itchyny/lightline.vim'
Plug 'rakr/vim-one'
Plug 'morhetz/gruvbox'
" Project - Navigation - Files
Plug 'ctrlpvim/ctrlp.vim', { 'on': 'CtrlP' }
Plug 'mhinz/vim-grepper'
Plug 'Shougo/vimfiler.vim', { 'on': 'VimFiler' }
Plug 'scrooloose/nerdtree'
Plug 'Xuyuanp/nerdtree-git-plugin'
Plug 'mileszs/ack.vim'
" Code help
Plug 'tpope/vim-repeat' " repeat more commands with '.'
Plug 'terryma/vim-multiple-cursors' " multiple cursors like in ST
" Plug 'Shougo/deoplete.nvim', { 'on': [], 'do': ':UpdateRemotePlugins', 'tag': 'e28d519' } " autocomplete, use e28d519 because of https://github.com/Shougo/deoplete.nvim/issues/291
" Plug 'zchee/deoplete-clang'
Plug 'Raimondi/delimitMate', { 'on': [] } " closing brackets
Plug 'terryma/vim-expand-region' " change visual selection by using '+' / '-'
Plug 'mbbill/undotree' " undo history tree
Plug 'Yggdroot/indentLine' " indent columns
Plug 'tpope/vim-surround' " better brackets
Plug 'scrooloose/syntastic' " check syntax
Plug 'matze/vim-move'
Plug 'majutsushi/tagbar'
"Plug 'w0rp/ale'
Plug 'sheerun/vim-polyglot'
Plug 'scrooloose/nerdcommenter'
Plug 'ervandew/supertab'
Plug 'valloric/youcompleteme'
Plug 'SirVer/ultisnips'
Plug 'honza/vim-snippets'
Plug 'ryanoasis/vim-devicons'
" Movement
Plug 'justinmk/vim-sneak'
Plug 'easymotion/vim-easymotion'
Plug 'yuttie/comfortable-motion.vim'
" Tmux
Plug 'christoomey/vim-tmux-navigator'
Plug 'tmux-plugins/vim-tmux'
Plug 'tmux-plugins/vim-tmux-focus-events'
" git
Plug 'tpope/vim-fugitive' " git commands
Plug 'airblade/vim-gitgutter' " git gutter
call plug#end()
" ========================= Configuration =========================
"
"
" Unite
let g:unite_force_overwrite_statusline = 0
let g:vimfiler_force_overwrite_statusline = 0
let g:vimshell_force_overwrite_statusline = 0
" Disable mouse support
set mouse=r
let $NVIM_TUI_ENABLE_CURSOR_SHAPE=1
" Next/Previous Buffer/Tab
nnoremap <Tab> :bnext!<CR>
nnoremap <S-Tab> :bprev!<CR><Paste>
" Change arrow keys to resize panes
nnoremap <Left> :vertical resize -1<CR>
nnoremap <Right> :vertical resize +1<CR>
nnoremap <Up> :resize -1<CR>
nnoremap <Down> :resize +1<CR>
" Disable arrow keys completely in Insert Mode
imap <up> <nop>
imap <down> <nop>
imap <left> <nop>
imap <right> <nop>
" Set ENTER to go new line without insert!
nnoremap <cr> o<esc>
" Reload vim config /// github.com/ismay
nnoremap <leader>r :source $MYVIMRC<CR>
" Clear search
nnoremap <leader>c :let @/ = ""<CR>
" Select all
nnoremap <leader>a ggVG<CR>
" Copy all
nnoremap <leader>y ggVGy<CR>
" Colorschem
"colorscheme base16-harmonic-dark
colorscheme gruvbox
" Indent line
let g:indentLine_enabled = 1
"let g:indentLine_char = "⟩"
" What is this code below?
set laststatus=2
set noshowmode " remove extra default info from nvim
" " --- CtrlP -----------------------------
"
nnoremap <Leader>p :CtrlP<CR>
nnoremap <Leader>t :CtrlP<CR>
" use The Silver Searcher https://github.com/ggreer/the_silver_searcher
"if executable('ag')
" use Ag over Grep
" set grepprg=ag\ --nogroup\ --nocolor
" let g:ackprg = 'ag --nogroup --nocolor --column'
" let g:ackprg = 'ag --vimgrep'
"endif
" --- Ag/Ack/Grep -----------------------
if executable('ag')
" use ag over grep
set grepprg=ag\ --nogroup\ --nocolor
" define Ag command
command! -nargs=+ -complete=file -bar Ag silent! grep! <args>|cwindow|redraw!
" bind \ to grep shortcut
nnoremap \ :Ag<SPACE>
endif
" --- VimGrepper ------------------------
"
" Find match in enter project and in current buffers
nnoremap <Leader>fp :Grepper<Space>-query<Space>
nnoremap <Leader>fb :Grepper<Space>-buffers<Space>-query<Space>-<Space>
" --- VimFiler 00------------------------
" SPACE backtick to toggle
" SPACE ~ to open file tree from current buffer's dir
map ` :VimFiler -explorer<CR>
map ~ :VimFilerCurrentDir -explorer -find<CR>
" --- Deoplete --------------------------
" let g:deoplete#enable_at_startup = 1
" Clang path for deoplete
" let g:deoplete#sources#clang#libclang_path = '/usr/lib/libclang.so'
" let g:deoplete#sources#clang#clang_header = '/usr/lib/clang'
" let g:deoplete#sources#clang#std = 'c11'
" deoplete tab-complete
" inoremap <expr><tab> pumvisible() ? "\<c-n>" : "\<tab>"
" --- Vim-sneak -------------------------
"
let g:sneak#s_next = 1
nmap f <Plug>Sneak_f
nmap F <Plug>Sneak_F
xmap f <Plug>Sneak_f
xmap F <Plug>Sneak_F
omap f <Plug>Sneak_f
omap F <Plug>Sneak_F
" --- Vim easymotion -------------------
"
let g:EasyMotion_smartcase = 1
let g:EasyMotion_keys='qwertyuiopasdfghjklzxcvbnm'
map <leader> <Plug>(easymotion-prefix)
" --- Nerdtree --------------------------
"
let NERDTreeMapActivateNode='l'
let NERDTreeMapCloseDir='h'
let NERDTreeMapOpenSplit='<c-s>'
let NERDTreeMapOpenVSplit='<c-v>'
let NERDTreeMinimalUI = 1
let NERDTreeAutoDeleteBuffer = 1
let NERDTreeIgnore=['\.DS_Store', '\~$', '\.swp']
nnoremap <leader>n :NERDTreeToggle<CR>
" --- Ale -------------------------------
"
let g:ale_sign_error = '>>'
let g:ale_sign_warning = '--'
let g:ale_sign_column_always = 1
let g:ale_statusline_format = ['⨉ %d', '⚠ %d', '⬥ ok']
" --- Comfortable motion ----------------
"
let g:comfortable_motion_scroll_down_key = "j"
let g:comfortable_motion_scroll_up_key = "k"
" --- Gitgutter -------------------------
"
"let g:gitgutter_sign_column_always = 1
set signcolumn=yes
let g:gitgutter_sign_added = '++'
let g:gitgutter_sign_modified = '~~'
let g:gitgutter_sign_removed = '__'
let g:gitgutter_sign_removed_first_line = '¯¯'
let g:gitgutter_sign_modified_removed = '~_'
" --- Tagbar ----------------------------
"
nmap <leader>m :TagbarToggle<CR>
" --- Airline ---------------------------
"
let g:airline_theme='one'
let g:airline#extensions#tabline#enabled = 1
let g:airline_powerline_fonts = 1
" --- Ultisnip --------------------------
"
" If you want :UltiSnipsEdit to split your window.
let g:UltiSnipsEditSplit="vertical"
" Make YCM compatible with UltiSnips (using supertab)
let g:ycm_key_list_select_completion = ['<C-j>', '<Down>']
let g:ycm_key_list_previous_completion = ['<C-k>', '<Up>']
let g:SuperTabDefaultCompletionType = '<C-j>'
" Better key bindings for UltiSnipsExpandTrigger
let g:UltiSnipsExpandTrigger = "<tab>"
let g:UltiSnipsJumpForwardTrigger = "<tab>"
let g:UltiSnipsJumpBackwardTrigger = "<s-tab>"
" make sure this is the last line
filetype plugin indent on