summaryrefslogtreecommitdiffstats
path: root/.config/nvim/init.vim
diff options
context:
space:
mode:
Diffstat (limited to '.config/nvim/init.vim')
-rwxr-xr-x.config/nvim/init.vim607
1 files changed, 0 insertions, 607 deletions
diff --git a/.config/nvim/init.vim b/.config/nvim/init.vim
deleted file mode 100755
index 40fadf2..0000000
--- a/.config/nvim/init.vim
+++ /dev/null
@@ -1,607 +0,0 @@
1let g:polyglot_disabled=['latex', 'tex']
2
3"{{{ Plugs
4call plug#begin('~/.local/share/nvim/plugged')
5
6" latex " had to move vimtex to top to avoid a difficult error
7Plug 'lervag/vimtex', { 'for': ['tex', 'latex', 'plaintex']}
8autocmd User vimtex call deoplete#custom#var('omni', 'input_patterns', {
9 \ 'tex': g:vimtex#re#deoplete
10 \})
11
12" Vimscript debugger
13" Plug 'vim-scripts/Decho'
14
15" completion, 'lsp' and coding {{{ "
16
17" completion framework
18Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' }
19Plug 'lionawurscht/deoplete-biblatex'
20Plug 'deoplete-plugins/deoplete-jedi'
21" rust code completion & navigation
22Plug 'racer-rust/vim-racer'
23" syntax checking
24Plug 'dense-analysis/ale'
25" manages tag files
26Plug 'ludovicchabant/vim-gutentags'
27" run tests (todo: write tests)
28Plug 'janko/vim-test'
29" type in file send to repl
30Plug 'jpalardy/vim-slime'
31" snippets to expand
32Plug 'SirVer/ultisnips' | Plug 'honza/vim-snippets'
33" Highlight the yanked region
34Plug 'machakann/vim-highlightedyank'
35
36" auto pair plugin, people hate these
37Plug 'tmsvg/pear-tree'
38" language packs
39Plug 'sheerun/vim-polyglot'
40" i3 config syntax
41Plug 'mboughaba/i3config.vim'
42" git diff in the sign column
43Plug 'airblade/vim-gitgutter'
44" gitk apparently
45Plug 'cohama/agit.vim'
46" completion preview of floating window
47Plug 'ncm2/float-preview.nvim'
48" switch between single line and multiline
49Plug 'AndrewRadev/splitjoin.vim'
50
51" }}} completion, 'lsp' and such "
52
53" heresy {{{ "
54
55" Fuzzy finder with post-update hook
56Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' }
57Plug 'junegunn/fzf.vim'
58
59" TODO let's try out fern.vim
60Plug 'lambdalisue/fern.vim'
61" TODO bug in neovim, so required for now
62" https://github.com/lambdalisue/fern.vim/issues/120
63Plug 'antoinemadec/FixCursorHold.nvim'
64
65" displays tags ordered by scope
66Plug 'majutsushi/tagbar'
67" status/tabline
68Plug 'vim-airline/vim-airline'
69Plug 'vim-airline/vim-airline-themes'
70" undo tree visualizer
71Plug 'mbbill/undotree'
72" preview colours in source code
73Plug 'ap/vim-css-color'
74" kitty config filetype
75Plug 'fladson/vim-kitty'
76" }}} heresy "
77
78" colour theme of $CURRENT_YEAR
79Plug 'rose-pine/neovim'
80
81" prose, note taking {{{ "
82
83" Personal wiki
84Plug 'vimwiki/vimwiki'
85" centers the writing
86Plug 'junegunn/goyo.vim'
87" highlights the current paragraph
88Plug 'junegunn/limelight.vim'
89" thesaurus query & replacement
90Plug 'ron89/thesaurus_query.vim'
91" change ASCII text to Turkish text
92Plug 'yigitsever/turkish-deasciifier.vim'
93" }}} prose, note taking "
94
95" movement, editing {{{ "
96
97" text alignment \w :Tab
98Plug 'godlygeek/tabular'
99" move selections up and down with alt+[j,k]
100Plug 'matze/vim-move'
101" surround text objects; sa, sr and sd
102Plug 'machakann/vim-sandwich'
103" provide additional text objects
104Plug 'wellle/targets.vim'
105" indentation level text object, ia, ii
106Plug 'michaeljsmith/vim-indent-object'
107" visual feedback for substitute holy shit this is amazing
108Plug 'markonm/traces.vim'
109" see the contents of registers on "/<CTRL-R>
110Plug 'junegunn/vim-peekaboo'
111" use <leader>k to highlight multiple words
112Plug 'lfv89/vim-interestingwords'
113" swap delimited items using g>, g<
114Plug 'machakann/vim-swap'
115" jump to location by 2 characters, `
116Plug 'justinmk/vim-sneak'
117" reopen files at your last edit position
118Plug 'farmergreg/vim-lastplace'
119" flash cursor on jump
120Plug 'DanilaMihailov/beacon.nvim'
121" ascii drawing plugin
122Plug 'vim-scripts/DrawIt'
123
124" }}} movement, editing "
125
126" vim-easyclip suite {{{ "
127
128" splits delete into cut and delete
129Plug 'svermeulen/vim-cutlass'
130" change text with yank
131Plug 'svermeulen/vim-subversive'
132" yank history
133Plug 'svermeulen/vim-yoink'
134
135" }}} vim-easyclip suite "
136
137" tpope {{{ "
138
139" enable repeating supported plugin maps with '.'
140Plug 'tpope/vim-repeat'
141" pairs of handy bracket mappings
142Plug 'tpope/vim-unimpaired'
143" git wrapper
144Plug 'tpope/vim-fugitive'
145" increment dates, times & more
146Plug 'tpope/vim-speeddating'
147" search, substitute and abbreviate
148Plug 'tpope/vim-abolish'
149" provides ga, show unicode stuff of char under cursor
150Plug 'tpope/vim-characterize'
151" comment helper
152Plug 'tpope/vim-commentary'
153" asynchronous build and test dispatcher
154Plug 'tpope/vim-dispatch'
155" }}} tpope "
156
157" fancy start screen
158Plug 'mhinz/vim-startify'
159" asks to be placed last, sure
160Plug 'ryanoasis/vim-devicons'
161call plug#end()
162
163"}}}
164
165"{{{Auto Commands
166" Remove any trailing whitespace that is in the file
167autocmd BufRead,BufWrite * if ! &bin | silent! %s/\s\+$//ge | endif
168
169" Close vim if the only window left open is a quickfix window
170autocmd WinEnter * if winnr("$") == 1 && &buftype == "quickfix" | q | endif
171" winnr("$") how many windows left?
172
173" Resize all windows proportionally when the terminal is resized
174" let terminal resize scale the internal windows
175autocmd VimResized * :wincmd =
176
177" Set spell for prose
178autocmd FileType markdown,tex setlocal spell
179
180" Dispatch.vim plugin to use cargo run for rust projects
181autocmd FileType rust let b:dispatch = 'cargo run'
182
183" these files are formatted not with textwidth but into sentences
184autocmd FileType vimwiki,latex,tex setlocal formatprg=/home/yigit/.local/bin/sentences
185
186" runs a script that cleans out tex build files whenever I close out of a .tex file.
187autocmd VimLeave *.tex !texclear %
188"}}}
189
190" Functions {{{
191
192function! CreateNote()
193 py3 import uuid
194 exe "e! " . fnameescape("~/nextcloud/personal_wiki/text/box/" . py3eval('str(uuid.uuid4())[:6]') . ".wiki")
195 let l:text="= up =\n\n= down =\n\n= keywords =\n\n"
196 put =l:text
197 norm gg
198endfunction
199
200function! CreatePaper(citekey)
201 exe "e! " . fnameescape("~/nextcloud/personal_wiki/text/papers/" . a:citekey . ".wiki")
202
203 let l:timestap="%date " . strftime("%F")
204 let l:text="= Came From =\n\n= Takeaways =\n\n= Might Go To =\n\n"
205
206 put! =l:timestap
207 put =l:text
208endfunction
209
210function! CreateReference(citekey)
211 exe "e! " . fnameescape("~/nextcloud/personal_wiki/text/reference/" . a:citekey . ".wiki")
212
213 let l:timestap="%date " . strftime("%F")
214 let l:text="= Literature Notes =\n\n= Citation =\n\n"
215
216 put! =l:timestap
217 put =l:text
218endfunction
219
220" }}} Function "
221
222"{{{Settings
223
224" fix the Target STRING not available
225let g:clipboard = {
226 \ 'name': 'xsel_override',
227 \ 'copy': {
228 \ '+': 'xsel --input --clipboard',
229 \ '*': 'xsel --input --primary',
230 \ },
231 \ 'paste': {
232 \ '+': 'xsel --output --clipboard',
233 \ '*': 'xsel --output --primary',
234 \ },
235 \ 'cache_enabled': 1,
236 \ }
237
238" Use deoplete.
239let g:deoplete#enable_at_startup = 1
240let g:deoplete#sources#biblatex#bibfile = '~/.local/share/vim_biblatex.bib'
241
242" interact with system clipboard
243set clipboard+=unnamedplus
244
245" required for yoink/cutlass/subversive interaction
246let g:yoinkIncludeDeleteOperations = 1
247
248" Tab stuff
249set autoindent
250
251" :h tabstop, 2. point
252" Use appropriate number of spaces to insert a <Tab>
253set expandtab
254set shiftwidth=4
255set softtabstop=4
256set tabstop=8
257
258" Use english for spellchecking, but don't spellcheck by default
259set spell spelllang=en_gb
260set nospell
261
262" Tab completion, zsh style
263set wildmode=full
264set wildignore=*.o,*.obj,*.class,*.aux,*.lof,*.log,*.lot,*.fls,*.toc,*.fmt,*.fot,*.cb,*.cb2,.*.lb,.dvi,*.xdv,*.bbl,*.bcf,*.blg,*-blx.aux,*-blx.bib,*.run.xml,*.fdb_latexmk,*.synctex,*.synctex(busy),*.synctex.gz,*.synctex.gz(busy),*.pdfsync
265
266" Put one space while joining (not two)
267set nojoinspaces
268
269" Keep n lines above/below cursor while scrolling
270set scrolloff=4
271" line numbers
272set number
273" fold manually, when I place markers
274set foldmethod=marker
275" set terminal title
276set title
277" wrap using 'breakat' character
278set linebreak
279" new split panes will split to below and right
280set splitbelow
281set splitright
282" highlight the current line, yoc undoes
283set cursorline
284" current line actual number, rest are relative
285set relativenumber
286" we are already using airline, don't clobber linter messages
287set noshowmode
288" jump to the matching bracket briefly
289set showmatch
290" move freely between buffers
291set hidden
292
293" persistent undo
294set undodir=~/.vim/undodir
295set undofile
296
297" lower case searches ignore case, upper case searches do not
298set ignorecase
299set smartcase
300
301" https://stackoverflow.com/a/3445040/
302" switch case labels
303set cinoptions=l1
304
305" https://www.reddit.com/r/vim/comments/7bj837/favorite_console_tools_to_use_with_vim/
306if executable('rg')
307 set grepprg=rg\ --vimgrep\ --no-heading\ --smart-case
308endif
309
310set diffopt=algorithm:patience
311
312let g:float_preview#docked = 0
313set completeopt = "menu"
314
315" }}}
316
317"{{{Look and Feel
318set termguicolors
319colorscheme rose-pine
320
321highlight HighlightedyankRegion cterm=reverse gui=reverse
322let g:highlightedyank_highlight_duration = 200
323" }}}
324
325"{{{ Mappings
326
327" brute force deasciify everything
328nnoremap <expr> <Leader>tc TurkishDeasciifyForce()
329xnoremap <expr> <Leader>tc TurkishDeasciifyForce()
330nnoremap <expr> <Leader>tctc TurkishDeasciifyForce() .. '_'
331
332" use turkish-mode to selectively deasciify
333nnoremap <expr> <Leader>tr TurkishDeasciify()
334xnoremap <expr> <Leader>tr TurkishDeasciify()
335nnoremap <expr> <Leader>trtr TurkishDeasciify() .. '_'
336
337" ascii everything
338nnoremap <expr> <Leader>rt TurkishAsciify()
339xnoremap <expr> <Leader>rt TurkishAsciify()
340nnoremap <expr> <Leader>rtrt TurkishAsciify() .. '_'
341
342" https://stackoverflow.com/questions/4256697/vim-search-and-highlight-but-do-not-jump
343nnoremap * :keepjumps normal! mi*`i<CR>
344nnoremap # :keepjumps normal! mi#`i<CR>
345
346" Save file as sudo on files that require root permission
347cnoremap w!! execute 'silent! write !sudo tee % >/dev/null' <bar> edit!
348
349" replace ex mode with gq
350map Q gq
351
352" set formatprg to sentences, for prose
353map \fp :set formatprg=~/.local/bin/sentences<CR>
354
355" Replace all is aliased to S.
356nnoremap S :%s//g<Left><Left>
357
358" use esc in :term as well
359tnoremap <Esc> <C-\><C-n>
360
361" call CreatePaper on word below cursor
362nnoremap <leader>np gewi[[/papers/<ESC>Ea]]<ESC>bb:call CreatePaper(expand('<cword>'))<CR>
363
364" link paper
365nnoremap <leader>lp gewi[[/papers/<ESC>Ea]]<ESC>
366
367" call CreateReference on word below cursor
368nnoremap <leader>nr :call CreateReference(expand('<cword>'))<CR>
369
370" create a new note
371nnoremap <leader>nn :call CreateNote()<CR>
372
373" If you like "Y" to work from the cursor to the end of line (which is more
374" logical, but not Vi-compatible)
375map Y y$
376
377" Open the TagBar Plugin <F3>
378nnoremap <silent> <F3> :TagbarToggle<CR>
379" Fix whole buffer via ALE
380nmap <F9> <Plug>(ale_fix)
381
382" vim-test bindings
383nmap <silent> t<C-n> :TestNearest<CR>
384nmap <silent> t<C-f> :TestFile<CR>
385nmap <silent> t<C-s> :TestSuite<CR>
386nmap <silent> t<C-l> :TestLast<CR>
387nmap <silent> t<C-g> :TestVisit<CR>
388
389" Edit vimrc \ev
390nnoremap <silent> <leader>ev :tabnew<CR>:e ~/.config/nvim/init.vim<CR>
391" jump to buffer
392nnoremap <leader>b :ls<cr>:b<space>
393
394" Up and down are more logical with g..
395nnoremap <silent> k gk
396nnoremap <silent> j gj
397inoremap <silent> <Up> <Esc>gka
398inoremap <silent> <Down> <Esc>gja
399
400" Disable highlight when <leader><cr> is pressed
401nnoremap <silent> <leader><cr> :noh<cr>
402" Space used to toggle folds, now it's x (because x is d)
403nnoremap <space> "_x
404
405" checkmarks on vimwiki
406nmap <leader>v <Plug>VimwikiToggleListItem
407" add/increase header level
408nmap <leader>a <Plug>VimwikiAddHeaderLevel
409
410" sneak using grave, s is for sandwich
411nmap ` <Plug>Sneak_s
412nmap <leader>` <Plug>Sneak_S
413nnoremap ' `
414
415" separate cut and delete
416nnoremap x d
417xnoremap x d
418nnoremap xx dd
419nnoremap X D
420
421" use the special yoink paste
422nmap p <plug>(YoinkPaste_p)
423nmap P <plug>(YoinkPaste_P)
424
425" substitute from yank
426nmap <leader>ys <plug>(SubversiveSubstitute)
427nmap <leader>yss <plug>(SubversiveSubstituteLine)
428nmap <leader>yS <plug>(SubversiveSubstituteToEndOfLine)
429
430" substitute over range
431nmap <leader>s <plug>(SubversiveSubstituteRange)
432xmap <leader>s <plug>(SubversiveSubstituteRange)
433nmap <leader>ss <plug>(SubversiveSubstituteWordRange)
434
435" subvert over range
436nmap <leader><leader>s <plug>(SubversiveSubvertRange)
437xmap <leader><leader>s <plug>(SubversiveSubvertRange)
438nmap <leader><leader>ss <plug>(SubversiveSubvertWordRange)
439
440" iterate over yank list
441nmap <c-n> <plug>(YoinkPostPasteSwapBack)
442nmap <c-p> <plug>(YoinkPostPasteSwapForward)
443
444" change into pwd of current directory
445nnoremap <leader>cd :cd %:p:h<CR>:pwd<CR>
446inoremap <silent> <leader>fn <C-R>=expand("%:t:r")<CR>
447nnoremap <silent> <leader>fn :put! =expand('%:t:r')<CR>
448
449" press \g and start writing prose
450map <leader>g :Goyo<CR>
451"}}}
452
453"{{{Tagbar
454let g:tagbar_autofocus = 1
455let g:tagbar_compact = 1
456let g:tagbar_sort = 0
457let g:tagbar_width = 25
458"}}}
459
460"{{{ Airline
461let g:airline_powerline_fonts = 1
462let g:airline#extensions#tabline#formatter = 'unique_tail'
463let g:airline#extensions#tabline#enabled = 1
464let g:airline_mode_map = {}
465let g:airline_mode_map['ic'] = 'INSERT'
466
467if !exists('g:airline_symbols')
468 let g:airline_symbols = {}
469endif
470
471let g:airline_left_sep = ''
472let g:airline_left_alt_sep = ''
473let g:airline_right_sep = ''
474let g:airline_right_alt_sep = ''
475
476"}}}
477
478"{{{ Ale
479let g:ale_sign_error = '✗'
480let g:ale_sign_warning = '⚑'
481let g:ale_lint_on_text_changed = 'insert'
482let g:ale_lint_on_enter = 0
483let g:ale_pattern_options = {'\.wiki$': {'ale_enabled': 0}}
484"}}}
485
486"{{{ Ledger
487let g:ledger_maxwidth = 48
488let g:ledger_fillstring = ' ~'
489"}}}
490
491"{{{ UltiSnips
492set runtimepath+=~/.vim/my-snippets/
493let g:UltiSnipsEditSplit = "vertical"
494let g:UltiSnipsSnippetsDir = $HOME.'/.vim/my-snippets/UltiSnips'
495
496" ctrl + l expands the snippet, c + j/k navigates placeholders
497let g:UltiSnipsExpandTrigger = "<C-l>"
498let g:UltiSnipsEnableSnipMate = "1"
499"}}}
500
501"{{{ vim-startify
502function! StartifyEntryFormat()
503 return 'WebDevIconsGetFileTypeSymbol(absolute_path) ." ". entry_path'
504endfunction
505
506let entry_format = "' ['. index .']'. repeat(' ', (3 - strlen(index)))"
507
508if exists('*WebDevIconsGetFileTypeSymbol') " support for vim-devicons
509 let entry_format .= ". WebDevIconsGetFileTypeSymbol(entry_path) .' '. entry_path"
510else
511 let entry_format .= '. entry_path'
512endif
513
514let g:ascii = [
515 \' | ',
516 \'\ \ \ / -_) | _| _ \ ` \ -_)',
517 \' \_/\_/\___|_|\__|\___/_|_|_|\___|',
518 \ '',
519 \]
520
521let g:startify_custom_header =
522 \ 'map(g:ascii + startify#fortune#boxed(), "\" \".v:val")'
523
524"}}}
525
526"{{{ vimwiki
527let g:vimwiki_list = [{'path': '/home/yigit/nextcloud/personal_wiki/text',
528 \ 'path_html': '/home/yigit/nextcloud/personal_wiki/html',
529 \ 'auto_generate_tags': 1,
530 \ 'automatic_nested_syntaxes': 1,
531 \ 'template_path': '/home/yigit/nextcloud/personal_wiki/templates',
532 \ 'template_default': 'default_template',
533 \ 'template_ext': '.html',
534 \ 'auto_export': 1,
535 \ 'auto_tags': 1}]
536let g:vimwiki_global_ext = 0
537let g:vimwiki_hl_headers = 1
538"}}}
539
540" {{{ vimtex
541let g:vimtex_view_method='zathura'
542let g:vimtex_quickfix_mode=0
543" }}}
544
545" {{{ Gutentags
546let g:gutentags_enabled = 1
547let g:gutentags_add_default_project_roots = 0
548let g:gutentags_project_root = ['Makefile', '.git']
549let g:gutentags_exclude_filetypes = ['gitcommit', 'gitconfig', 'gitrebase', 'gitsendemail', 'git']
550let g:gutentags_generate_on_new = 1
551let g:gutentags_generate_on_missing = 1
552let g:gutentags_generate_on_write = 1
553let g:gutentags_generate_on_empty_buffer = 0
554let g:gutentags_ctags_exclude = [
555\ '*.git', '*.svn', '*.hg',
556\ 'cache', 'build', 'dist', 'bin', 'node_modules', 'bower_components',
557\ '*-lock.json', '*.lock',
558\ '*.min.*',
559\ '*.bak',
560\ '*.zip',
561\ '*.pyc',
562\ '*.class',
563\ '*.sln',
564\ '*.csproj', '*.csproj.user',
565\ '*.tmp',
566\ '*.cache',
567\ '*.vscode',
568\ '*.pdb',
569\ '*.exe', '*.dll', '*.bin',
570\ '*.mp3', '*.ogg', '*.flac',
571\ '*.swp', '*.swo',
572\ '.DS_Store', '*.plist',
573\ '*.bmp', '*.gif', '*.ico', '*.jpg', '*.png', '*.svg',
574\ '*.rar', '*.zip', '*.tar', '*.tar.gz', '*.tar.xz', '*.tar.bz2',
575\ '*.pdf', '*.doc', '*.docx', '*.ppt', '*.pptx', '*.xls',
576\]
577" }}}
578
579" vim-slime {{{
580let g:slime_target = "tmux"
581let g:slime_paste_file = "$HOME/.slime_paste"
582let g:slime_default_config = {"socket_name": get(split($TMUX, ","), 0), "target_pane": "{last}"}
583" }}} Slime
584
585" devicons {{{ "
586let g:WebDevIconsUnicodeDecorateFileNodesExtensionSymbols = {} " needed
587let g:WebDevIconsUnicodeDecorateFileNodesExtensionSymbols['wiki'] = '📔'
588" }}} devicons "
589
590" beacon {{{ "
591let g:beacon_size = 100
592let g:beacon_shrink = 0
593highlight Beacon guibg=red ctermbg=15
594" }}} beacon "
595
596" thesaurus_query {{{ "
597let g:tq_enabled_backends = ["mthesaur_txt"]
598let g:tq_truncation_on_relavance = 0
599" }}} thesaurus_query "
600
601" fzf.vim {{{ "
602" Insert mode completion
603imap <c-x><c-k> <plug>(fzf-complete-word)
604imap <c-x><c-f> <plug>(fzf-complete-path)
605imap <c-x><c-l> <plug>(fzf-complete-line)
606" }}} fzf.vim "
607