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
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
|
"{{{ Plugs
call plug#begin('~/.local/share/nvim/plugged')
"A code-completion engine for Vim
Plug 'Valloric/YouCompleteMe'
"syntax checking
Plug 'w0rp/ale'
"manages tag files
Plug 'ludovicchabant/vim-gutentags'
"snippet solution
Plug 'SirVer/ultisnips' | Plug 'honza/vim-snippets'
"autopair plugin
Plug 'tmsvg/pear-tree'
"colored brackets
Plug 'luochen1990/rainbow'
" Plugin outside ~/.vim/plugged with post-update hook
Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' }
"tree explorer
Plug 'scrooloose/nerdtree'
"displays tags ordered by scope
Plug 'majutsushi/tagbar'
"status/tabline
Plug 'bling/vim-airline'
" color theme.
Plug 'arcticicestudio/nord-vim'
Plug 'aonemd/kuroi.vim'
"Personal wiki
Plug 'vimwiki/vimwiki'
"distraction-free writing
Plug 'junegunn/goyo.vim'
" latex
Plug 'lervag/vimtex'
"visual display of indent levels
Plug 'nathanaelkane/vim-indent-guides'
"text alignment
Plug 'godlygeek/tabular'
"access cheat.sh sheets
Plug 'dbeniamine/cheat.sh-vim'
"color code highlight
Plug 'chrisbra/Colorizer'
"move selections up and down
Plug 'matze/vim-move'
"folding ledger files
Plug 'ledger/vim-ledger'
"reporen files at your last edit position
Plug 'farmergreg/vim-lastplace'
"toggle, display and navigate marks
Plug 'kshenoy/vim-signature'
"git diff in the sign column
Plug 'airblade/vim-gitgutter'
"jump to location by 2 characters
Plug 'justinmk/vim-sneak'
"splits delete into cut and delete
Plug 'svermeulen/vim-cutlass'
"change text with yank
Plug 'svermeulen/vim-subversive'
"yank history
Plug 'svermeulen/vim-yoink'
"enable repeating supported plugin maps with '.'
Plug 'tpope/vim-repeat'
"quoting/parenthesizing made simple
Plug 'tpope/vim-surround'
"pairs of handy bracket mappings
Plug 'tpope/vim-unimpaired'
"git wrapper
Plug 'tpope/vim-fugitive'
"increment dates, times & more
Plug 'tpope/vim-speeddating'
"search, substitute and abbreviate
Plug 'tpope/vim-abolish'
"provides ga, show unicode stuff of char under cursor
Plug 'tpope/vim-characterize'
"comment helper
Plug 'tpope/vim-commentary'
"fancy start screen
Plug 'mhinz/vim-startify'
Plug 'ryanoasis/vim-devicons' " asks to be placed last, sure
call plug#end() " required
"}}}
"{{{Auto Commands
" Automatically cd into the directory that the file is in
autocmd BufEnter * silent! lcd %:p:h
" Remove any trailing whitespace that is in the file
autocmd BufRead,BufWrite * if ! &bin | silent! %s/\s\+$//ge | endif
" Close vim if the only window left open is NERDTree
autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif
" Resize all windows proportionally when the terminal is resized
" let terminal resize scale the internal windows
autocmd VimResized * :wincmd =
"}}}
"{{{Misc Settings
let g:ycm_global_ycm_extra_conf = '~/.ycm_extra_conf.py'
" Tab stuff
set autoindent
set expandtab " Use appropriate number of spaces to insert a <Tab>
set shiftwidth=4
set softtabstop=4
set tabstop=8
" Use english for spellchecking, but don't spellcheck by default
set spell spelllang=en_us
set nospell
" Cool tab completion stuff
set wildmode=list:longest,full
set wildignore=*.o,*.obj,*.class
set scrolloff=4 " Keep n lines above/below cursor
set mouse=c
set number " line numbers
set foldmethod=marker " folding stuffs
set title " set terminal title
set showmatch " jump to the matching bracket briefly, REMOVE AFTER TESTING
set linebreak " wrap using 'breakat' character
set splitbelow " new split panes will split to below and right
set splitright
" persistent undo
set undodir=~/.vim/undodir
set undofile
" lower case searches ignore case, upper case searches do not
set ignorecase
set smartcase
" https://stackoverflow.com/a/3445040/
" switch case labels
set cinoptions=l1
" }}}
"{{{Look and Feel
set termguicolors
"highlight NormalNC guibg='Black'
let g:nord_underline = 1
let g:nord_italic = 1
let g:nord_italic_comments = 1
let g:nord_cursor_line_number_background = 1
colorscheme nord
" }}}
"{{{ Functions
"{{{ Open URL in browser
function! Browser ()
let line = getline (".")
let line = matchstr (line, "http[^ ]*")
exec "!firefox ".line
endfunction
"}}}
"{{{Theme Rotating
let themeindex=0
function! RotateColorTheme()
let y = -1
while y == -1
let colorstring = "#nord#kuroi#"
let x = match( colorstring, "#", g:themeindex )
let y = match( colorstring, "#", x + 1 )
let g:themeindex = x + 1
if y == -1
let g:themeindex = 0
else
let themestring = strpart(colorstring, x + 1, y - x - 1)
return ":colorscheme ".themestring
endif
endwhile
endfunction
" }}}
"}}}
"{{{ Mappings
" Open Url on this line with the browser \w
map <Leader>w :call Browser ()<CR>
" Open the TagBar Plugin <F3>
nnoremap <silent> <F3> :TagbarToggle<CR>
" Open NERDTree <F4>
nnoremap <silent> <F4> :NERDTreeToggle<CR>
" Next Tab
nnoremap <silent> <C-Right> :tabnext<CR>
" Previous Tab
nnoremap <silent> <C-Left> :tabprevious<CR>
" New Tab
nnoremap <silent> <C-t> :tabnew<CR>
" Rotate Color Scheme <F8>
nnoremap <silent> <F8> :execute RotateColorTheme()<CR>
" FixIt from YCM
map <F9> :YcmCompleter FixIt<CR>
" Edit vimrc \ev
nnoremap <silent> <Leader>ev :tabnew<CR>:e ~/.config/nvim/init.vim<CR>
" Up and down are more logical with g..
nnoremap <silent> k gk
nnoremap <silent> j gj
inoremap <silent> <Up> <Esc>gka
inoremap <silent> <Down> <Esc>gja
" This is totally awesome - remap jj to escape in insert mode. You'll never type jj anyway, so it's great!
inoremap jj <Esc>
nnoremap JJJJ <Nop>
" quicker window movement
nnoremap <C-j> <C-w>j
nnoremap <C-k> <C-w>k
nnoremap <C-h> <C-w>h
nnoremap <C-l> <C-w>l
" Disable highlight when <leader><cr> is pressed
nnoremap <Leader><cr> :noh<cr>
" Space will toggle folds!
nnoremap <space> za
" Search mappings: These will make it so that going to the next one in a
" search will center on the line it's found in.
map N Nzz
map n nzz
"}}}
"{{{Tagbar
let g:tagbar_autofocus = 1
let g:tagbar_compact = 1
let g:tagbar_sort = 0
let g:tagbar_width = 25
"}}}
"{{{ Airline
let g:airline_powerline_fonts = 1
let g:airline#extensions#tabline#formatter = 'unique_tail'
let g:airline#extensions#ycm#enabled = 1
"}}}
"{{{ NERDTree
let g:NERDTreeWinSize=25
"}}}
"{{{ Ale
let g:ale_sign_error = '✗'
let g:ale_sign_warning = '⚑'
"}}}
"{{{ YouCompleteMe
let g:ycm_always_populate_location_list = 1
let g:ycm_error_symbol = '✗'
let g:ycm_warning_symbol = '⚑'
map <leader>g :YcmCompleter GoToDefinition<CR>
let g:ycm_filetype_blacklist = {
\ 'tagbar': 1,
\ 'qf': 1,
\ 'notes': 1,
\ 'markdown': 1,
\ 'unite': 1,
\ 'text': 1,
\ 'startify': 1,
\ 'vimwiki': 1,
\ 'pandoc': 1,
\ 'infolog': 1,
\ 'mail': 1
\}
let g:ycm_filetype_specific_completion_to_disable = {
\ 'gitcommit': 1,
\ 'vim': 1
\}
"}}}
"{{{ Ledger
let g:ledger_extra_options = '--pedantic --explicit --check-payees'
au FileType ledger noremap { ?^\d<CR>
au FileType ledger noremap } /^\d<CR>
let g:ledger_maxwidth = 48
let g:ledger_fillstring = ' ~'
"}}}
"{{{ UltiSnips/YouCompleteMe
set runtimepath+=~/.vim/my-snippets/
let g:UltiSnipsEditSplit="vertical"
let g:UltiSnipsSnippetsDir=$HOME.'/.vim/my-snippets/UltiSnips'
" these navigate ycm
let g:ycm_key_list_select_completion = ['<TAB>', '<C-j>']
let g:ycm_key_list_previous_completion = ['<S-TAB>', '<C-k>']
" ctrl + l expands the snippet, c + j/k navigates placeholders
let g:UltiSnipsExpandTrigger = "<C-l>"
let g:UltiSnipsJumpForwardTrigger = "<C-j>"
let g:UltiSnipsJumpBackwardTrigger = "<C-k>"
let g:UltiSnipsListSnippets = "<C-h>"
"}}}
"{{{ vim-startify
function! StartifyEntryFormat()
return 'WebDevIconsGetFileTypeSymbol(absolute_path) ." ". entry_path'
endfunction
let entry_format = "' ['. index .']'. repeat(' ', (3 - strlen(index)))"
if exists('*WebDevIconsGetFileTypeSymbol') " support for vim-devicons
let entry_format .= ". WebDevIconsGetFileTypeSymbol(entry_path) .' '. entry_path"
else
let entry_format .= '. entry_path'
endif
let g:ascii = [
\' | ',
\'\ \ \ / -_) | _| _ \ ` \ -_)',
\' \_/\_/\___|_|\__|\___/_|_|_|\___|',
\ '',
\]
let g:startify_custom_header =
\ 'map(g:ascii + startify#fortune#boxed(), "\" \".v:val")'
"}}}
"{{{ vimwiki
let g:vimwiki_list = [{'path': '/home/yigit/Dropbox/personal_wiki',
\ 'path_html': '~/Dropbox/personal_wiki_html',
\ 'css_name': 'tufte.css',
\ 'auto_export': 1}]
let g:vimwiki_global_ext = 0
map <Leader>c <Plug>VimwikiToggleListItem
"}}}
"{{{ yanks/registers and clips
set clipboard=unnamed,unnamedplus
" s for substitute
nmap <leader>ys <plug>(SubversiveSubstitute)
nmap <leader>yss <plug>(SubversiveSubstituteLine)
nmap <leader>yS <plug>(SubversiveSubstituteToEndOfLine)
nmap <leader>s <plug>(SubversiveSubstituteRange)
xmap <leader>s <plug>(SubversiveSubstituteRange)
nmap <leader>ss <plug>(SubversiveSubstituteWordRange)
nmap <leader><leader>s <plug>(SubversiveSubvertRange)
xmap <leader><leader>s <plug>(SubversiveSubvertRange)
nmap <leader><leader>ss <plug>(SubversiveSubvertWordRange)
nmap <c-n> <plug>(YoinkPostPasteSwapBack)
nmap <c-p> <plug>(YoinkPostPasteSwapForward)
let g:yoinkIncludeDeleteOperations = 1
nmap p <plug>(YoinkPaste_p)
nmap P <plug>(YoinkPaste_P)
nnoremap x d
xnoremap x d
nnoremap xx dd
nnoremap X D
"}}}
" {{{ vimtex
let g:vimtex_view_method = 'zathura'
" }}}
" {{{ rainbow
let g:rainbow_active = 0
" }}}
|