summaryrefslogtreecommitdiffstats
path: root/.config/nvim
diff options
context:
space:
mode:
authorYigit Sever2021-10-08 00:09:37 +0300
committerYigit Sever2021-10-08 00:09:37 +0300
commita8903ac96dd7cd0e1af968d729e557d579f26124 (patch)
treeafe2c89a0fbc1b0bfe79dd1b9ea9d7050f83fc08 /.config/nvim
parent82bc7c109cd3890b3494d88f7ead43c3aa3e7860 (diff)
downloaddotfiles-a8903ac96dd7cd0e1af968d729e557d579f26124.tar.gz
dotfiles-a8903ac96dd7cd0e1af968d729e557d579f26124.tar.bz2
dotfiles-a8903ac96dd7cd0e1af968d729e557d579f26124.zip
neovim: migrate to init.lua
Diffstat (limited to '.config/nvim')
-rw-r--r--.config/nvim/init.lua17
-rwxr-xr-x.config/nvim/init.vim607
-rw-r--r--.config/nvim/lua/mappings.lua131
-rw-r--r--.config/nvim/lua/plugin_settings.lua126
-rw-r--r--.config/nvim/lua/plugins.lua136
-rw-r--r--.config/nvim/lua/settings.lua103
6 files changed, 513 insertions, 607 deletions
diff --git a/.config/nvim/init.lua b/.config/nvim/init.lua
new file mode 100644
index 0000000..417af8a
--- /dev/null
+++ b/.config/nvim/init.lua
@@ -0,0 +1,17 @@
1-- ┌──────────────────┐
2-- │ ▗ │
3-- │▛▀▖▞▀▖▞▀▖▌ ▌▄ ▛▚▀▖│
4-- │▌ ▌▛▀ ▌ ▌▐▐ ▐ ▌▐ ▌│
5-- │▘ ▘▝▀▘▝▀ ▘ ▀▘▘▝ ▘│
6-- └──────────────────┘
7-- ┌────────┐
8-- │▜ │
9-- │▐ ▌ ▌▝▀▖│
10-- │▐ ▌ ▌▞▀▌│
11-- │ ▘▝▀▘▝▀▘│
12-- └────────┘
13
14require('settings')
15require('mappings')
16require('plugins')
17require('plugin_settings')
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
diff --git a/.config/nvim/lua/mappings.lua b/.config/nvim/lua/mappings.lua
new file mode 100644
index 0000000..fe59a99
--- /dev/null
+++ b/.config/nvim/lua/mappings.lua
@@ -0,0 +1,131 @@
1-- ┌──────────────────┐
2-- │ ▗ │
3-- │▛▀▖▞▀▖▞▀▖▌ ▌▄ ▛▚▀▖│
4-- │▌ ▌▛▀ ▌ ▌▐▐ ▐ ▌▐ ▌│
5-- │▘ ▘▝▀▘▝▀ ▘ ▀▘▘▝ ▘│
6-- └──────────────────┘
7-- ┌────────────────────────┐
8-- │ ▗ │
9-- │▛▚▀▖▝▀▖▛▀▖▛▀▖▄ ▛▀▖▞▀▌▞▀▘│
10-- │▌▐ ▌▞▀▌▙▄▘▙▄▘▐ ▌ ▌▚▄▌▝▀▖│
11-- │▘▝ ▘▝▀▘▌ ▌ ▀▘▘ ▘▗▄▘▀▀ │
12-- └────────────────────────┘
13
14-- map helper
15local function map(mode, lhs, rhs, opts)
16 local options = {noremap = true, silent = true}
17 if opts then options = vim.tbl_extend('force', options, opts) end
18 vim.api.nvim_set_keymap(mode, lhs, rhs, options)
19end
20
21-- local map = vim.api.nvim_set_keymap
22local cmd = vim.cmd
23local M = {}
24
25-- brute force deasciify everything
26map('n', '<Leader>tc', 'TurkishDeasciifyForce()', {expr = true})
27map('x', '<Leader>tc', 'TurkishDeasciifyForce()', {expr = true})
28map('n', '<Leader>tctc', "TurkishDeasciifyForce() .. '_'", {expr = true})
29
30-- use turkish-mode to selectively deasciify
31map('n', '<Leader>tr', 'TurkishDeasciify()', {expr = true})
32map('x', '<Leader>tr', 'TurkishDeasciify()', {expr = true})
33map('n', '<Leader>trtr', "TurkishDeasciify() .. '_'", {expr = true})
34
35-- ascii everything
36map('n', '<Leader>rt', 'TurkishAsciify()', {expr = true})
37map('x', '<Leader>rt', 'TurkishAsciify()', {expr = true})
38map('n', '<Leader>rtrt', "TurkishAsciify() .. '_'", {expr = true})
39
40-- https://stackoverflow.com/questions/4256697/vim-search-and-highlight-but-do-not-jump
41-- search & highlight but do not jump
42map('n', '*', ':keepjumps normal! mi*`i<CR>')
43map('n', '#', ':keepjumps normal! mi#`i<CR> ')
44
45-- Save file as sudo on files that require root permission
46map('c', 'w!!', 'execute "silent! write !sudo tee % >/dev/null" <bar> edit!')
47
48-- replace ex mode with gq (format lines)
49map('n', 'Q', 'gq')
50
51-- set formatprg to sentences, for prose
52map('n', '<Leader>fp', ":set formatprg=~/.local/bin/sentences<CR>")
53
54-- Replace all is aliased to S.
55map('n', 'S', ':%s//g<Left><Left>')
56
57-- If you like "Y" to work from the cursor to the end of line (which is more
58-- logical, but not Vi-compatible)
59map('n', 'Y', 'y$')
60
61-- jump to buffer
62map('n', '<Leader>b', ':ls<cr>:b<space>')
63
64-- Up and down are more logical with g..
65map('n', 'k', 'gk')
66map('n', 'j', 'gj')
67map('i', '<Up>', '<Esc>gka')
68map('i', '<Down>', '<Esc>gja')
69
70-- Disable highlight when <leader><cr> is pressed
71map('n', '<Leader><Cr>', ':noh<Cr>')
72-- Space used to toggle folds, now it's x (because x is d)
73map('n', '<Space>', '"_x')
74
75-- separate cut and delete
76map('n', 'x', 'd')
77map('x', 'x', 'd')
78map('n', 'xx', 'dd')
79map('n', 'X', 'D')
80
81-- change into pwd of current directory
82map('n', '<Leader>cd', ':cd %:p:h<CR>:pwd<CR>')
83
84-- press \g and start writing prose
85map('n', '<Leader>g', ':Goyo<CR>')
86
87-- plug mappings {{{1 --
88
89-- <Plug> mappings should not be noremap
90-- https://www.reddit.com/r/vim/comments/78izt4/please_help_understand_how_to_use_plug_mapping/
91local function plugmap(mode, lhs, rhs, opts)
92 local options = {noremap = false, silent = true}
93 if opts then options = vim.tbl_extend('force', options, opts) end
94 vim.api.nvim_set_keymap(mode, lhs, rhs, options)
95end
96
97-- sneak using grave, s is for sandwich
98plugmap('n', '`', '<Plug>Sneak_s')
99plugmap('n', '`', '<Plug>Sneak_s')
100plugmap('n', '<Leader>`', '<Plug>Sneak_S')
101plugmap('n', "'", '`')
102
103-- use the special yoink paste that rotates
104plugmap('n', 'p', '<Plug>(YoinkPaste_p)')
105plugmap('n', 'P', '<Plug>(YoinkPaste_P)')
106
107-- substitute from yank
108plugmap('n', '<Leader>ys', '<plug>(SubversiveSubstitute)')
109plugmap('n', '<Leader>yss', '<plug>(SubversiveSubstituteLine)')
110plugmap('n', '<Leader>yS', '<plug>(SubversiveSubstituteToEndOfLine)')
111
112-- substitute over range
113plugmap('n', '<Leader>s', '<plug>(SubversiveSubstituteRange)')
114plugmap('x', '<Leader>s', '<plug>(SubversiveSubstituteRange)')
115plugmap('n', '<Leader>ss', '<plug>(SubversiveSubstituteWordRange)')
116
117-- subvert over range
118plugmap('n', '<Leader><Leader>s', '<plug>(SubversiveSubvertRange)')
119plugmap('x', '<Leader><Leader>s', '<plug>(SubversiveSubvertRange)')
120plugmap('n', '<Leader><Leader>ss', '<plug>(SubversiveSubvertWordRange)')
121
122-- iterate over yank list
123plugmap('n', '<c-n>', '<Plug>(YoinkPostPasteSwapBack)')
124plugmap('n', '<c-p>', '<Plug>(YoinkPostPasteSwapForward)')
125
126-- insert mode completion
127plugmap('i', '<c-x><c-k>', '<plug>(fzf-complete-word)')
128plugmap('i', '<c-x><c-f>', '<plug>(fzf-complete-path)')
129plugmap('i', '<c-x><c-l>', '<plug>(fzf-complete-line)')
130
131-- 1}}} --
diff --git a/.config/nvim/lua/plugin_settings.lua b/.config/nvim/lua/plugin_settings.lua
new file mode 100644
index 0000000..6de7ebd
--- /dev/null
+++ b/.config/nvim/lua/plugin_settings.lua
@@ -0,0 +1,126 @@
1-- ┌──────────────────┐
2-- │ ▗ │
3-- │▛▀▖▞▀▖▞▀▖▌ ▌▄ ▛▚▀▖│
4-- │▌ ▌▛▀ ▌ ▌▐▐ ▐ ▌▐ ▌│
5-- │▘ ▘▝▀▘▝▀ ▘ ▀▘▘▝ ▘│
6-- └──────────────────┘
7-- ┌─────────────────────────────────────┐
8-- │ ▜ ▐ ▐ ▗ │
9-- │▛▀▖▐ ▌ ▌▞▀▌▗▖▖▞▀▘▞▀▖▜▀ ▜▀ ▄ ▛▀▖▞▀▌▞▀▘│
10-- │▙▄▘▐ ▌ ▌▚▄▌▘▝ ▝▀▖▛▀ ▐ ▖▐ ▖▐ ▌ ▌▚▄▌▝▀▖│
11-- │▌ ▘▝▀▘▗▄▘ ▀▀ ▝▀▘ ▀ ▀ ▀▘▘ ▘▗▄▘▀▀ │
12-- └─────────────────────────────────────┘
13
14local g = vim.g -- global for let options
15local opt = vim.opt -- convenient :set
16local cmd = vim.cmd -- vim commands
17
18-- vimwiki {{{ --
19g.vimwiki_list = {
20 {
21 path = '/home/yigit/nextcloud/personal_wiki/text',
22 path_html = '/home/yigit/nextcloud/personal_wiki/html',
23 auto_generate_tags = 1,
24 automatic_nested_syntaxes = 1,
25 template_path = '/home/yigit/nextcloud/personal_wiki/templates',
26 template_default = 'default_template',
27 template_ext = '.html',
28 auto_export = 1,
29 auto_tags = 1
30 }
31}
32
33g.vimwiki_global_ext = 0
34g.vimwiki_hl_headers = 1
35-- }}} vimwiki --
36
37-- lualine {{{ --
38require'lualine'.setup {
39 options = {
40 lower = true,
41 icons_enabled = true,
42 theme = 'rose-pine',
43 section_separators = {'', ''},
44 component_separators = {'', ''},
45 disabled_filetypes = {}
46 },
47 sections = {
48 lualine_a = {{'mode', lower = true}},
49 lualine_b = {'branch', 'diff'},
50 lualine_c = {'filename'},
51 lualine_x = {'encoding', 'fileformat', 'filetype'},
52 lualine_y = {'progress'},
53 lualine_z = {
54 'location', {
55 'diagnostics',
56 sources = {'ale'},
57 sections = {'error', 'warn', 'info', 'hint'},
58 symbols = {error = 'e', warn = 'w', info = 'i', hint = 'h'}
59 }
60 }
61 },
62 inactive_sections = {
63 lualine_a = {},
64 lualine_b = {},
65 lualine_c = {'filename'},
66 lualine_x = {},
67 lualine_y = {},
68 lualine_z = {}
69 },
70 tabline = {},
71 extensions = {}
72}
73-- }}} requi --
74
75-- Cutlass suite {{{1 --
76
77-- cutlass/yoink/subverse suite
78g.yoinkIncludeDeleteOperations = 1
79
80-- fix the Target STRING not available
81g.clipboard = {
82 name = 'xsel_override',
83 copy = {
84 ['+'] = 'xsel --input --clipboard',
85 ['*'] = 'xsel --input --primary',
86 },
87 paste = {
88 ['+'] = 'xsel --output --clipboard',
89 ['*'] = 'xsel --output --primary',
90 },
91 cache_enabled = 1,
92}
93
94-- 1}}} --
95
96-- UltiSnips {{{ --
97opt.runtimepath:append('/home/yigit/.vim/my-snippets/')
98g.UltiSnipsEditSplit = "vertical"
99-- ctrl + l expands the snippet, c + j/k navigates placeholders
100g.UltiSnipsExpandTrigger = "<C-l>"
101g.UltiSnipsEnableSnipMate = "1"
102-- }}} UltiSnips --
103
104-- float preview
105g["float_preview#docked"] = 0
106
107-- highlight on yank
108cmd('highlight HighlightedyankRegion cterm=reverse gui=reverse')
109g.highlightedyank_highlight_duration = 200
110
111-- beacon {{{ --
112g.beacon_size = 100
113g.beacon_shrink = 1
114cmd('highlight Beacon guibg=red ctermbg=15')
115-- }}} beacon --
116
117-- vim-slime {{{ --
118g.slime_target = "tmux"
119g.slime_paste_file = "/home/yigit/.slime_paste"
120-- g.slime_default_config = {socket_name = get(split($TMUX, ","), 0), target_pane = "{last}"}
121-- }}} vim-slime --
122
123-- vimtex {{{ --
124g.vimtex_view_method = 'zathura'
125g.vimtex_quickfix_mode = 0
126-- }}} vimtex --
diff --git a/.config/nvim/lua/plugins.lua b/.config/nvim/lua/plugins.lua
new file mode 100644
index 0000000..58cccbc
--- /dev/null
+++ b/.config/nvim/lua/plugins.lua
@@ -0,0 +1,136 @@
1-- ┌───────────────────┐
2-- │ ▜ ▗ │
3-- │▛▀▖▐ ▌ ▌▞▀▌▄ ▛▀▖▞▀▘│
4-- │▙▄▘▐ ▌ ▌▚▄▌▐ ▌ ▌▝▀▖│
5-- │▌ ▘▝▀▘▗▄▘▀▘▘ ▘▀▀ │
6-- └───────────────────┘
7
8return require('packer').startup(function()
9 -- Packer can manage itself
10 use 'wbthomason/packer.nvim'
11
12 -- latex suite
13 use {'lervag/vimtex', ft = {'tex', 'latex', 'plaintext'}}
14
15 -- still here
16 use 'dense-analysis/ale'
17 -- manages tag files
18 use 'ludovicchabant/vim-gutentags'
19 -- run tests (todo: write tests)
20 use 'janko/vim-test'
21 -- type in file send to repl
22 use 'jpalardy/vim-slime'
23 -- snippets to expand
24 use {'SirVer/ultisnips', 'honza/vim-snippets'}
25 -- Highlight the yanked region
26 use 'machakann/vim-highlightedyank'
27
28 -- auto pair plugin, people hate these
29 use 'tmsvg/pear-tree'
30 -- git diff in the sign column
31 use 'airblade/vim-gitgutter'
32 -- completion preview of floating window
33 use 'ncm2/float-preview.nvim'
34
35 -- language packs
36 use 'sheerun/vim-polyglot'
37 -- i3 config syntax
38 use 'mboughaba/i3config.vim'
39 -- kitty config filetype
40 use 'fladson/vim-kitty'
41
42 use{'junegunn/fzf', dir = '~/.fzf'}
43 use 'junegunn/fzf.vim'
44
45 -- file explorer
46 use 'lambdalisue/fern.vim'
47 -- bug in neovim, so required for now
48 -- https://github.com/lambdalisue/fern.vim/issues/120
49 use 'antoinemadec/FixCursorHold.nvim'
50
51 -- displays tags ordered by scope
52 use 'majutsushi/tagbar'
53 -- Undo tree
54 use {
55 'mbbill/undotree',
56 cmd = 'UndotreeToggle',
57 config = [[vim.g.undotree_SetFocusWhenToggle = 1]],
58 }
59 -- Highlight colors
60 use {
61 'norcalli/nvim-colorizer.lua',
62 ft = { 'css', 'javascript', 'vim', 'html' },
63 config = [[require('colorizer').setup {'css', 'javascript', 'vim', 'html'}]],
64 }
65
66 -- cutlass suite, x, d, \ys etc.
67 use {
68 'svermeulen/vim-cutlass',
69 'svermeulen/vim-subversive',
70 'svermeulen/vim-yoink'
71 }
72
73 -- Personal wiki
74 use 'vimwiki/vimwiki'
75 -- centers the writing
76 use 'junegunn/goyo.vim'
77 -- highlights the current paragraph
78 use 'junegunn/limelight.vim'
79 -- change ASCII text to Turkish text
80 use 'yigitsever/turkish-deasciifier.vim'
81
82 -- text alignment \w :Tab
83 use 'godlygeek/tabular'
84 -- move selections up and down with alt+[j,k]
85 use 'matze/vim-move'
86 -- surround text objects; sa, sr and sd
87 use 'machakann/vim-sandwich'
88 -- provide additional text objects
89 use 'wellle/targets.vim'
90 -- indentation level text object, ia, ii
91 use 'michaeljsmith/vim-indent-object'
92 -- visual feedback for substitute holy shit this is amazing
93 use 'markonm/traces.vim'
94 -- see the contents of registers on "/<CTRL-R>
95 use 'junegunn/vim-peekaboo'
96 -- use <leader>k to highlight multiple words)
97 use 'lfv89/vim-interestingwords'
98 -- swap delimited items using g>, g<
99 use 'machakann/vim-swap'
100 -- jump to location by 2 characters, `
101 use 'justinmk/vim-sneak'
102 -- reopen files at your last edit position
103 use 'farmergreg/vim-lastplace'
104 -- flash cursor on jump
105 use 'DanilaMihailov/beacon.nvim'
106
107 -- cursorline of the $CURRENT_YEAR
108 use {
109 'hoob3rt/lualine.nvim',
110 requires = {'kyazdani42/nvim-web-devicons', opt = true}
111 }
112 -- colour theme of the $CURRENT_YEAR
113 use 'rose-pine/neovim'
114
115 -- enable repeating supported plugin maps with '.'
116 use 'tpope/vim-repeat'
117 -- pairs of handy bracket mappings
118 use 'tpope/vim-unimpaired'
119 -- git wrapper
120 use {
121 'tpope/vim-fugitive', cmd = { 'Git', 'Gstatus', 'Gblame', 'Gpush', 'Gpull' }
122 }
123 -- increment dates, times & more
124 use 'tpope/vim-speeddating'
125 -- search, substitute and abbreviate
126 use 'tpope/vim-abolish'
127 -- provides ga, show unicode stuff of char under cursor
128 use 'tpope/vim-characterize'
129 -- comment helper
130 use 'tpope/vim-commentary'
131 -- asynchronous build and test dispatcher
132 use {'tpope/vim-dispatch', opt = true, cmd = {'Dispatch', 'Make', 'Focus', 'Start'}}
133
134 -- fancy start screen
135 use 'mhinz/vim-startify'
136end)
diff --git a/.config/nvim/lua/settings.lua b/.config/nvim/lua/settings.lua
new file mode 100644
index 0000000..5996c51
--- /dev/null
+++ b/.config/nvim/lua/settings.lua
@@ -0,0 +1,103 @@
1-- ┌──────────────────┐
2-- │ ▗ │
3-- │▛▀▖▞▀▖▞▀▖▌ ▌▄ ▛▚▀▖│
4-- │▌ ▌▛▀ ▌ ▌▐▐ ▐ ▌▐ ▌│
5-- │▘ ▘▝▀▘▝▀ ▘ ▀▘▘▝ ▘│
6-- └──────────────────┘
7-- ┌───────────────────────┐
8-- │ ▐ ▐ ▗ │
9-- │▞▀▘▞▀▖▜▀ ▜▀ ▄ ▛▀▖▞▀▌▞▀▘│
10-- │▝▀▖▛▀ ▐ ▖▐ ▖▐ ▌ ▌▚▄▌▝▀▖│
11-- │▀▀ ▝▀▘ ▀ ▀ ▀▘▘ ▘▗▄▘▀▀ │
12-- └───────────────────────┘
13
14local o = vim.o -- gl[o]bal options
15local wo = vim.wo -- [w]indow-local [o]ptions
16local bo = vim.bo -- [b]uffer-local [o]ptions
17local opt = vim.opt -- convenient :set
18
19-- look & feel
20o.termguicolors = true
21vim.cmd('colorscheme rose-pine')
22
23-- interact with system clipboard
24opt.clipboard:append('unnamedplus')
25
26-- copy indent on a new line
27o.autoindent = true
28
29-- :h tabstop, 2. point
30-- use appropriate number of spaces to insert a <Tab>
31o.expandtab = true
32o.shiftwidth = 4
33o.softtabstop = 4
34o.tabstop = 8
35
36-- use english for spellchecking, but don't spellcheck by default
37o.spell = true
38o.spelllang = "en_gb"
39o.spell = false
40
41-- tab completion, zsh style
42o.wildmode = "full"
43opt.wildignore = {
44 '*.o', '*.obj', '*.class', '*.aux', '*.lof', '*.log', '*.lot', '*.fls',
45 '*.toc', '*.fmt', '*.fot', '*.cb', '*.cb2', '.*.lb', '.dvi', '*.xdv',
46 '*.bbl', '*.bcf', '*.blg', '*-blx.aux', '*-blx.bib', '*.run.xml',
47 '*.fdb_latexmk', '*.synctex', '*.synctex(busy)', '*.synctex.gz',
48 '*.synctex.gz(busy)', '*.pdfsync'
49}
50
51-- put one space while joining (not two)
52o.joinspaces = false
53
54-- keep n lines above/below cursor while scrolling
55o.scrolloff = 4
56-- line numbers
57o.number = true
58-- fold manually, when I place markers
59o.foldmethod = "marker"
60-- set the terminal title
61o.title = true
62-- wrap using 'breakat' character
63o.linebreak = true
64-- new split panes will split to below and right
65o.splitbelow = true
66o.splitright = true
67-- highlight the current line, yoc undoes
68o.cursorline = true
69-- current line actual number, rest are relative
70o.relativenumber = true
71-- we are already using a cursorline, don't clobber linter messages
72o.showmode = false
73-- jump to the matching bracket briefly
74o.showmatch = true
75-- move freely between buffers
76o.hidden = true
77
78-- persistent undo
79o.undodir = "/home/yigit/.vim/undodir"
80o.undofile = true
81
82-- lower case searches ignore case, upper case searches do not
83o.ignorecase = true
84o.smartcase = true
85
86-- https://stackoverflow.com/a/3445040/
87-- switch case labels
88o.cinoptions = "l1"
89
90if vim.fn.executable("rg") then
91 o.grepprg = "rg --vimgrep --no-heading --smart-case"
92end
93
94-- iwhite: ignore changes in amount of white space.
95-- vertical: start diff mode with vertical splits
96-- filler: show filler lines,
97opt.diffopt = {
98 "iwhite", "vertical", "filler", "algorithm:patience", "indent-heuristic"
99}
100
101-- menu: use a popup menu to show the possible completions
102-- preview: show extra information
103opt.completeopt = {"menu", "preview"}