summaryrefslogtreecommitdiffstats
path: root/.config/nvim
diff options
context:
space:
mode:
authorYigit Sever2019-05-01 16:12:28 +0300
committerYigit Sever2019-05-01 16:12:28 +0300
commit73fdb6ea1e4ccabb67aa312a8f7850aad1b29466 (patch)
tree7cf17a30d5ff130f4875b86c4382d94392042e2f /.config/nvim
parentde0f47cda434ac221f20ae54582918b5625204a0 (diff)
downloaddotfiles-73fdb6ea1e4ccabb67aa312a8f7850aad1b29466.tar.gz
dotfiles-73fdb6ea1e4ccabb67aa312a8f7850aad1b29466.tar.bz2
dotfiles-73fdb6ea1e4ccabb67aa312a8f7850aad1b29466.zip
Change completion framework
Diffstat (limited to '.config/nvim')
-rwxr-xr-x.config/nvim/init.vim199
1 files changed, 74 insertions, 125 deletions
diff --git a/.config/nvim/init.vim b/.config/nvim/init.vim
index ee6007c..24fe7ba 100755
--- a/.config/nvim/init.vim
+++ b/.config/nvim/init.vim
@@ -1,8 +1,8 @@
1"{{{ Plugs 1"{{{ Plugs
2call plug#begin('~/.local/share/nvim/plugged') 2call plug#begin('~/.local/share/nvim/plugged')
3 3
4"A code-completion engine for Vim 4"completion
5Plug 'Valloric/YouCompleteMe' 5Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' }
6"syntax checking 6"syntax checking
7Plug 'w0rp/ale' 7Plug 'w0rp/ale'
8"manages tag files 8"manages tag files
@@ -25,7 +25,7 @@ Plug 'majutsushi/tagbar'
25"status/tabline 25"status/tabline
26Plug 'bling/vim-airline' 26Plug 'bling/vim-airline'
27 27
28" color theme. 28" color themes
29Plug 'arcticicestudio/nord-vim' 29Plug 'arcticicestudio/nord-vim'
30Plug 'aonemd/kuroi.vim' 30Plug 'aonemd/kuroi.vim'
31 31
@@ -40,8 +40,6 @@ Plug 'lervag/vimtex'
40Plug 'nathanaelkane/vim-indent-guides' 40Plug 'nathanaelkane/vim-indent-guides'
41"text alignment 41"text alignment
42Plug 'godlygeek/tabular' 42Plug 'godlygeek/tabular'
43"access cheat.sh sheets
44Plug 'dbeniamine/cheat.sh-vim'
45"color code highlight 43"color code highlight
46Plug 'chrisbra/Colorizer' 44Plug 'chrisbra/Colorizer'
47"move selections up and down 45"move selections up and down
@@ -49,7 +47,7 @@ Plug 'matze/vim-move'
49 47
50"folding ledger files 48"folding ledger files
51Plug 'ledger/vim-ledger' 49Plug 'ledger/vim-ledger'
52"reporen files at your last edit position 50"reopen files at your last edit position
53Plug 'farmergreg/vim-lastplace' 51Plug 'farmergreg/vim-lastplace'
54"toggle, display and navigate marks 52"toggle, display and navigate marks
55Plug 'kshenoy/vim-signature' 53Plug 'kshenoy/vim-signature'
@@ -91,9 +89,6 @@ call plug#end() " required
91"}}} 89"}}}
92 90
93"{{{Auto Commands 91"{{{Auto Commands
94" Automatically cd into the directory that the file is in
95autocmd BufEnter * silent! lcd %:p:h
96
97" Remove any trailing whitespace that is in the file 92" Remove any trailing whitespace that is in the file
98autocmd BufRead,BufWrite * if ! &bin | silent! %s/\s\+$//ge | endif 93autocmd BufRead,BufWrite * if ! &bin | silent! %s/\s\+$//ge | endif
99 94
@@ -106,7 +101,15 @@ autocmd VimResized * :wincmd =
106"}}} 101"}}}
107 102
108"{{{Misc Settings 103"{{{Misc Settings
109let g:ycm_global_ycm_extra_conf = '~/.ycm_extra_conf.py' 104
105" Use deoplete.
106let g:deoplete#enable_at_startup = 1
107
108" interact with system clipboard
109set clipboard=unnamed,unnamedplus
110
111" required for yoink/cutlass/subversive interaction
112let g:yoinkIncludeDeleteOperations = 1
110 113
111" Tab stuff 114" Tab stuff
112set autoindent 115set autoindent
@@ -114,14 +117,17 @@ set expandtab " Use appropriate number of spaces to insert a <Tab>
114set shiftwidth=4 117set shiftwidth=4
115set softtabstop=4 118set softtabstop=4
116set tabstop=8 119set tabstop=8
120
117" Use english for spellchecking, but don't spellcheck by default 121" Use english for spellchecking, but don't spellcheck by default
118set spell spelllang=en_us 122set spell spelllang=en_us
119set nospell 123set nospell
124
120" Cool tab completion stuff 125" Cool tab completion stuff
121set wildmode=list:longest,full 126set wildmode=list:longest,full
122set wildignore=*.o,*.obj,*.class 127set wildignore=*.o,*.obj,*.class
128set nojoinspaces
129
123set scrolloff=4 " Keep n lines above/below cursor 130set scrolloff=4 " Keep n lines above/below cursor
124set mouse=c
125set number " line numbers 131set number " line numbers
126set foldmethod=marker " folding stuffs 132set foldmethod=marker " folding stuffs
127set title " set terminal title 133set title " set terminal title
@@ -129,20 +135,30 @@ set showmatch " jump to the matching bracket briefly, REMOVE AFTER TESTING
129set linebreak " wrap using 'breakat' character 135set linebreak " wrap using 'breakat' character
130set splitbelow " new split panes will split to below and right 136set splitbelow " new split panes will split to below and right
131set splitright 137set splitright
138set cursorline
139
132" persistent undo 140" persistent undo
133set undodir=~/.vim/undodir 141set undodir=~/.vim/undodir
134set undofile 142set undofile
143
135" lower case searches ignore case, upper case searches do not 144" lower case searches ignore case, upper case searches do not
136set ignorecase 145set ignorecase
137set smartcase 146set smartcase
147
138" https://stackoverflow.com/a/3445040/ 148" https://stackoverflow.com/a/3445040/
139" switch case labels 149" switch case labels
140set cinoptions=l1 150set cinoptions=l1
151
152" https://www.reddit.com/r/vim/comments/7bj837/favorite_console_tools_to_use_with_vim/
153if executable('rg')
154 set grepprg=rg\ --vimgrep\ --no-heading
155endif
156
141" }}} 157" }}}
142 158
143"{{{Look and Feel 159"{{{Look and Feel
160
144set termguicolors 161set termguicolors
145"highlight NormalNC guibg='Black'
146 162
147let g:nord_underline = 1 163let g:nord_underline = 1
148let g:nord_italic = 1 164let g:nord_italic = 1
@@ -150,75 +166,40 @@ let g:nord_italic_comments = 1
150let g:nord_cursor_line_number_background = 1 166let g:nord_cursor_line_number_background = 1
151 167
152colorscheme nord 168colorscheme nord
153" }}}
154 169
155"{{{ Functions
156
157"{{{ Open URL in browser
158
159function! Browser ()
160 let line = getline (".")
161 let line = matchstr (line, "http[^ ]*")
162 exec "!firefox ".line
163endfunction
164
165"}}}
166
167"{{{Theme Rotating
168let themeindex=0
169function! RotateColorTheme()
170 let y = -1
171 while y == -1
172 let colorstring = "#nord#kuroi#"
173 let x = match( colorstring, "#", g:themeindex )
174 let y = match( colorstring, "#", x + 1 )
175 let g:themeindex = x + 1
176 if y == -1
177 let g:themeindex = 0
178 else
179 let themestring = strpart(colorstring, x + 1, y - x - 1)
180 return ":colorscheme ".themestring
181 endif
182 endwhile
183endfunction
184" }}} 170" }}}
185 171
186"}}}
187
188"{{{ Mappings 172"{{{ Mappings
189" Open Url on this line with the browser \w 173
190map <Leader>w :call Browser ()<CR>
191" Open the TagBar Plugin <F3> 174" Open the TagBar Plugin <F3>
192nnoremap <silent> <F3> :TagbarToggle<CR> 175nnoremap <silent> <F3> :TagbarToggle<CR>
193" Open NERDTree <F4> 176" Open NERDTree <F4>
194nnoremap <silent> <F4> :NERDTreeToggle<CR> 177nnoremap <silent> <F4> :NERDTreeToggle<CR>
195" Next Tab
196nnoremap <silent> <C-Right> :tabnext<CR>
197" Previous Tab
198nnoremap <silent> <C-Left> :tabprevious<CR>
199" New Tab 178" New Tab
200nnoremap <silent> <C-t> :tabnew<CR> 179nnoremap <silent> <C-t> :tabnew<CR>
201" Rotate Color Scheme <F8>
202nnoremap <silent> <F8> :execute RotateColorTheme()<CR>
203" FixIt from YCM 180" FixIt from YCM
204map <F9> :YcmCompleter FixIt<CR> 181map <F9> :YcmCompleter FixIt<CR>
205" Edit vimrc \ev 182" Edit vimrc \ev
206nnoremap <silent> <Leader>ev :tabnew<CR>:e ~/.config/nvim/init.vim<CR> 183nnoremap <silent> <Leader>ev :tabnew<CR>:e ~/.config/nvim/init.vim<CR>
184
207" Up and down are more logical with g.. 185" Up and down are more logical with g..
208nnoremap <silent> k gk 186nnoremap <silent> k gk
209nnoremap <silent> j gj 187nnoremap <silent> j gj
210inoremap <silent> <Up> <Esc>gka 188inoremap <silent> <Up> <Esc>gka
211inoremap <silent> <Down> <Esc>gja 189inoremap <silent> <Down> <Esc>gja
190
212" This is totally awesome - remap jj to escape in insert mode. You'll never type jj anyway, so it's great! 191" This is totally awesome - remap jj to escape in insert mode. You'll never type jj anyway, so it's great!
213inoremap jj <Esc> 192inoremap jj <Esc>
214nnoremap JJJJ <Nop> 193nnoremap JJJJ <Nop>
194
215" quicker window movement 195" quicker window movement
216nnoremap <C-j> <C-w>j 196nnoremap <C-j> <C-w>j
217nnoremap <C-k> <C-w>k 197nnoremap <C-k> <C-w>k
218nnoremap <C-h> <C-w>h 198nnoremap <C-h> <C-w>h
219nnoremap <C-l> <C-w>l 199nnoremap <C-l> <C-w>l
200
220" Disable highlight when <leader><cr> is pressed 201" Disable highlight when <leader><cr> is pressed
221nnoremap <Leader><cr> :noh<cr> 202nnoremap <silent> <Leader><cr> :noh<cr>
222" Space will toggle folds! 203" Space will toggle folds!
223nnoremap <space> za 204nnoremap <space> za
224" Search mappings: These will make it so that going to the next one in a 205" Search mappings: These will make it so that going to the next one in a
@@ -226,6 +207,44 @@ nnoremap <space> za
226map N Nzz 207map N Nzz
227map n nzz 208map n nzz
228 209
210" checkmarks on vimwiki
211nnoremap <Leader>c <Plug>VimwikiToggleListItem
212
213"""""""""""""""""""""""""""
214" yanks/registers/clips "
215"""""""""""""""""""""""""""
216" separate cut and delete
217nnoremap x d
218xnoremap x d
219nnoremap xx dd
220nnoremap X D
221
222" use the special yoink paste
223nmap p <plug>(YoinkPaste_p)
224nmap P <plug>(YoinkPaste_P)
225
226" substitute from yank
227nnoremap <leader>ys <plug>(SubversiveSubstitute)
228nnoremap <leader>yss <plug>(SubversiveSubstituteLine)
229nnoremap <leader>yS <plug>(SubversiveSubstituteToEndOfLine)
230
231" substitute over range
232nnoremap <leader>s <plug>(SubversiveSubstituteRange)
233xnoremap <leader>s <plug>(SubversiveSubstituteRange)
234nnoremap <leader>ss <plug>(SubversiveSubstituteWordRange)
235
236" subvert over range
237nnoremap <leader><Leader>s <plug>(SubversiveSubvertRange)
238xnoremap <leader><leader>s <plug>(SubversiveSubvertRange)
239nnoremap <leader><leader>ss <plug>(SubversiveSubvertWordRange)
240
241" iterate over yank list
242nnoremap <c-n> <plug>(YoinkPostPasteSwapBack)
243nnoremap <c-p> <plug>(YoinkPostPasteSwapForward)
244
245" change into pwd of current directory
246nnoremap <leader>cd :cd %:p:h<CR>:pwd<CR>
247
229"}}} 248"}}}
230 249
231"{{{Tagbar 250"{{{Tagbar
@@ -251,56 +270,19 @@ let g:ale_sign_error = '✗'
251let g:ale_sign_warning = '⚑' 270let g:ale_sign_warning = '⚑'
252"}}} 271"}}}
253 272
254"{{{ YouCompleteMe
255let g:ycm_always_populate_location_list = 1
256let g:ycm_error_symbol = '✗'
257let g:ycm_warning_symbol = '⚑'
258
259map <leader>g :YcmCompleter GoToDefinition<CR>
260
261let g:ycm_filetype_blacklist = {
262 \ 'tagbar': 1,
263 \ 'qf': 1,
264 \ 'notes': 1,
265 \ 'markdown': 1,
266 \ 'unite': 1,
267 \ 'text': 1,
268 \ 'startify': 1,
269 \ 'vimwiki': 1,
270 \ 'pandoc': 1,
271 \ 'infolog': 1,
272 \ 'mail': 1
273 \}
274
275let g:ycm_filetype_specific_completion_to_disable = {
276 \ 'gitcommit': 1,
277 \ 'vim': 1
278 \}
279
280"}}}
281
282"{{{ Ledger 273"{{{ Ledger
283let g:ledger_extra_options = '--pedantic --explicit --check-payees' 274" let g:ledger_extra_options = '--pedantic --explicit --check-payees'
284au FileType ledger noremap { ?^\d<CR>
285au FileType ledger noremap } /^\d<CR>
286let g:ledger_maxwidth = 48 275let g:ledger_maxwidth = 48
287let g:ledger_fillstring = ' ~' 276let g:ledger_fillstring = ' ~'
288"}}} 277"}}}
289 278
290"{{{ UltiSnips/YouCompleteMe 279"{{{ UltiSnips
291set runtimepath+=~/.vim/my-snippets/ 280set runtimepath+=~/.vim/my-snippets/
292let g:UltiSnipsEditSplit="vertical" 281let g:UltiSnipsEditSplit="vertical"
293let g:UltiSnipsSnippetsDir=$HOME.'/.vim/my-snippets/UltiSnips' 282let g:UltiSnipsSnippetsDir=$HOME.'/.vim/my-snippets/UltiSnips'
294 283
295" these navigate ycm
296let g:ycm_key_list_select_completion = ['<TAB>', '<C-j>']
297let g:ycm_key_list_previous_completion = ['<S-TAB>', '<C-k>']
298
299" ctrl + l expands the snippet, c + j/k navigates placeholders 284" ctrl + l expands the snippet, c + j/k navigates placeholders
300let g:UltiSnipsExpandTrigger = "<C-l>" 285let g:UltiSnipsExpandTrigger = "<C-l>"
301let g:UltiSnipsJumpForwardTrigger = "<C-j>"
302let g:UltiSnipsJumpBackwardTrigger = "<C-k>"
303let g:UltiSnipsListSnippets = "<C-h>"
304"}}} 286"}}}
305 287
306"{{{ vim-startify 288"{{{ vim-startify
@@ -334,39 +316,6 @@ let g:vimwiki_list = [{'path': '/home/yigit/Dropbox/personal_wiki',
334 \ 'css_name': 'tufte.css', 316 \ 'css_name': 'tufte.css',
335 \ 'auto_export': 1}] 317 \ 'auto_export': 1}]
336let g:vimwiki_global_ext = 0 318let g:vimwiki_global_ext = 0
337map <Leader>c <Plug>VimwikiToggleListItem
338"}}}
339
340"{{{ yanks/registers and clips
341
342set clipboard=unnamed,unnamedplus
343
344" s for substitute
345nmap <leader>ys <plug>(SubversiveSubstitute)
346nmap <leader>yss <plug>(SubversiveSubstituteLine)
347nmap <leader>yS <plug>(SubversiveSubstituteToEndOfLine)
348
349nmap <leader>s <plug>(SubversiveSubstituteRange)
350xmap <leader>s <plug>(SubversiveSubstituteRange)
351nmap <leader>ss <plug>(SubversiveSubstituteWordRange)
352
353nmap <leader><leader>s <plug>(SubversiveSubvertRange)
354xmap <leader><leader>s <plug>(SubversiveSubvertRange)
355nmap <leader><leader>ss <plug>(SubversiveSubvertWordRange)
356
357nmap <c-n> <plug>(YoinkPostPasteSwapBack)
358nmap <c-p> <plug>(YoinkPostPasteSwapForward)
359
360let g:yoinkIncludeDeleteOperations = 1
361
362nmap p <plug>(YoinkPaste_p)
363nmap P <plug>(YoinkPaste_P)
364
365nnoremap x d
366xnoremap x d
367
368nnoremap xx dd
369nnoremap X D
370"}}} 319"}}}
371 320
372" {{{ vimtex 321" {{{ vimtex