From a8903ac96dd7cd0e1af968d729e557d579f26124 Mon Sep 17 00:00:00 2001 From: Yigit Sever Date: Fri, 8 Oct 2021 00:09:37 +0300 Subject: neovim: migrate to init.lua --- .config/nvim/init.lua | 17 + .config/nvim/init.vim | 607 ----------------------------------- .config/nvim/lua/mappings.lua | 131 ++++++++ .config/nvim/lua/plugin_settings.lua | 126 ++++++++ .config/nvim/lua/plugins.lua | 136 ++++++++ .config/nvim/lua/settings.lua | 103 ++++++ 6 files changed, 513 insertions(+), 607 deletions(-) create mode 100644 .config/nvim/init.lua delete mode 100755 .config/nvim/init.vim create mode 100644 .config/nvim/lua/mappings.lua create mode 100644 .config/nvim/lua/plugin_settings.lua create mode 100644 .config/nvim/lua/plugins.lua create mode 100644 .config/nvim/lua/settings.lua (limited to '.config/nvim') 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 @@ +-- ┌──────────────────┐ +-- │ ▗ │ +-- │▛▀▖▞▀▖▞▀▖▌ ▌▄ ▛▚▀▖│ +-- │▌ ▌▛▀ ▌ ▌▐▐ ▐ ▌▐ ▌│ +-- │▘ ▘▝▀▘▝▀ ▘ ▀▘▘▝ ▘│ +-- └──────────────────┘ +-- ┌────────┐ +-- │▜ │ +-- │▐ ▌ ▌▝▀▖│ +-- │▐ ▌ ▌▞▀▌│ +-- │ ▘▝▀▘▝▀▘│ +-- └────────┘ + +require('settings') +require('mappings') +require('plugins') +require('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 @@ -let g:polyglot_disabled=['latex', 'tex'] - -"{{{ Plugs -call plug#begin('~/.local/share/nvim/plugged') - -" latex " had to move vimtex to top to avoid a difficult error -Plug 'lervag/vimtex', { 'for': ['tex', 'latex', 'plaintex']} -autocmd User vimtex call deoplete#custom#var('omni', 'input_patterns', { - \ 'tex': g:vimtex#re#deoplete - \}) - -" Vimscript debugger -" Plug 'vim-scripts/Decho' - -" completion, 'lsp' and coding {{{ " - -" completion framework -Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' } -Plug 'lionawurscht/deoplete-biblatex' -Plug 'deoplete-plugins/deoplete-jedi' -" rust code completion & navigation -Plug 'racer-rust/vim-racer' -" syntax checking -Plug 'dense-analysis/ale' -" manages tag files -Plug 'ludovicchabant/vim-gutentags' -" run tests (todo: write tests) -Plug 'janko/vim-test' -" type in file send to repl -Plug 'jpalardy/vim-slime' -" snippets to expand -Plug 'SirVer/ultisnips' | Plug 'honza/vim-snippets' -" Highlight the yanked region -Plug 'machakann/vim-highlightedyank' - -" auto pair plugin, people hate these -Plug 'tmsvg/pear-tree' -" language packs -Plug 'sheerun/vim-polyglot' -" i3 config syntax -Plug 'mboughaba/i3config.vim' -" git diff in the sign column -Plug 'airblade/vim-gitgutter' -" gitk apparently -Plug 'cohama/agit.vim' -" completion preview of floating window -Plug 'ncm2/float-preview.nvim' -" switch between single line and multiline -Plug 'AndrewRadev/splitjoin.vim' - -" }}} completion, 'lsp' and such " - -" heresy {{{ " - -" Fuzzy finder with post-update hook -Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' } -Plug 'junegunn/fzf.vim' - -" TODO let's try out fern.vim -Plug 'lambdalisue/fern.vim' -" TODO bug in neovim, so required for now -" https://github.com/lambdalisue/fern.vim/issues/120 -Plug 'antoinemadec/FixCursorHold.nvim' - -" displays tags ordered by scope -Plug 'majutsushi/tagbar' -" status/tabline -Plug 'vim-airline/vim-airline' -Plug 'vim-airline/vim-airline-themes' -" undo tree visualizer -Plug 'mbbill/undotree' -" preview colours in source code -Plug 'ap/vim-css-color' -" kitty config filetype -Plug 'fladson/vim-kitty' -" }}} heresy " - -" colour theme of $CURRENT_YEAR -Plug 'rose-pine/neovim' - -" prose, note taking {{{ " - -" Personal wiki -Plug 'vimwiki/vimwiki' -" centers the writing -Plug 'junegunn/goyo.vim' -" highlights the current paragraph -Plug 'junegunn/limelight.vim' -" thesaurus query & replacement -Plug 'ron89/thesaurus_query.vim' -" change ASCII text to Turkish text -Plug 'yigitsever/turkish-deasciifier.vim' -" }}} prose, note taking " - -" movement, editing {{{ " - -" text alignment \w :Tab -Plug 'godlygeek/tabular' -" move selections up and down with alt+[j,k] -Plug 'matze/vim-move' -" surround text objects; sa, sr and sd -Plug 'machakann/vim-sandwich' -" provide additional text objects -Plug 'wellle/targets.vim' -" indentation level text object, ia, ii -Plug 'michaeljsmith/vim-indent-object' -" visual feedback for substitute holy shit this is amazing -Plug 'markonm/traces.vim' -" see the contents of registers on "/ -Plug 'junegunn/vim-peekaboo' -" use k to highlight multiple words -Plug 'lfv89/vim-interestingwords' -" swap delimited items using g>, g< -Plug 'machakann/vim-swap' -" jump to location by 2 characters, ` -Plug 'justinmk/vim-sneak' -" reopen files at your last edit position -Plug 'farmergreg/vim-lastplace' -" flash cursor on jump -Plug 'DanilaMihailov/beacon.nvim' -" ascii drawing plugin -Plug 'vim-scripts/DrawIt' - -" }}} movement, editing " - -" vim-easyclip suite {{{ " - -" splits delete into cut and delete -Plug 'svermeulen/vim-cutlass' -" change text with yank -Plug 'svermeulen/vim-subversive' -" yank history -Plug 'svermeulen/vim-yoink' - -" }}} vim-easyclip suite " - -" tpope {{{ " - -" enable repeating supported plugin maps with '.' -Plug 'tpope/vim-repeat' -" 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' -" asynchronous build and test dispatcher -Plug 'tpope/vim-dispatch' -" }}} tpope " - -" fancy start screen -Plug 'mhinz/vim-startify' -" asks to be placed last, sure -Plug 'ryanoasis/vim-devicons' -call plug#end() - -"}}} - -"{{{Auto Commands -" 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 a quickfix window -autocmd WinEnter * if winnr("$") == 1 && &buftype == "quickfix" | q | endif -" winnr("$") how many windows left? - -" Resize all windows proportionally when the terminal is resized -" let terminal resize scale the internal windows -autocmd VimResized * :wincmd = - -" Set spell for prose -autocmd FileType markdown,tex setlocal spell - -" Dispatch.vim plugin to use cargo run for rust projects -autocmd FileType rust let b:dispatch = 'cargo run' - -" these files are formatted not with textwidth but into sentences -autocmd FileType vimwiki,latex,tex setlocal formatprg=/home/yigit/.local/bin/sentences - -" runs a script that cleans out tex build files whenever I close out of a .tex file. -autocmd VimLeave *.tex !texclear % -"}}} - -" Functions {{{ - -function! CreateNote() - py3 import uuid - exe "e! " . fnameescape("~/nextcloud/personal_wiki/text/box/" . py3eval('str(uuid.uuid4())[:6]') . ".wiki") - let l:text="= up =\n\n= down =\n\n= keywords =\n\n" - put =l:text - norm gg -endfunction - -function! CreatePaper(citekey) - exe "e! " . fnameescape("~/nextcloud/personal_wiki/text/papers/" . a:citekey . ".wiki") - - let l:timestap="%date " . strftime("%F") - let l:text="= Came From =\n\n= Takeaways =\n\n= Might Go To =\n\n" - - put! =l:timestap - put =l:text -endfunction - -function! CreateReference(citekey) - exe "e! " . fnameescape("~/nextcloud/personal_wiki/text/reference/" . a:citekey . ".wiki") - - let l:timestap="%date " . strftime("%F") - let l:text="= Literature Notes =\n\n= Citation =\n\n" - - put! =l:timestap - put =l:text -endfunction - -" }}} Function " - -"{{{Settings - -" fix the Target STRING not available -let g:clipboard = { - \ 'name': 'xsel_override', - \ 'copy': { - \ '+': 'xsel --input --clipboard', - \ '*': 'xsel --input --primary', - \ }, - \ 'paste': { - \ '+': 'xsel --output --clipboard', - \ '*': 'xsel --output --primary', - \ }, - \ 'cache_enabled': 1, - \ } - -" Use deoplete. -let g:deoplete#enable_at_startup = 1 -let g:deoplete#sources#biblatex#bibfile = '~/.local/share/vim_biblatex.bib' - -" interact with system clipboard -set clipboard+=unnamedplus - -" required for yoink/cutlass/subversive interaction -let g:yoinkIncludeDeleteOperations = 1 - -" Tab stuff -set autoindent - -" :h tabstop, 2. point -" Use appropriate number of spaces to insert a -set expandtab -set shiftwidth=4 -set softtabstop=4 -set tabstop=8 - -" Use english for spellchecking, but don't spellcheck by default -set spell spelllang=en_gb -set nospell - -" Tab completion, zsh style -set wildmode=full -set 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 - -" Put one space while joining (not two) -set nojoinspaces - -" Keep n lines above/below cursor while scrolling -set scrolloff=4 -" line numbers -set number -" fold manually, when I place markers -set foldmethod=marker -" set terminal title -set title -" wrap using 'breakat' character -set linebreak -" new split panes will split to below and right -set splitbelow -set splitright -" highlight the current line, yoc undoes -set cursorline -" current line actual number, rest are relative -set relativenumber -" we are already using airline, don't clobber linter messages -set noshowmode -" jump to the matching bracket briefly -set showmatch -" move freely between buffers -set hidden - -" 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 - -" https://www.reddit.com/r/vim/comments/7bj837/favorite_console_tools_to_use_with_vim/ -if executable('rg') - set grepprg=rg\ --vimgrep\ --no-heading\ --smart-case -endif - -set diffopt=algorithm:patience - -let g:float_preview#docked = 0 -set completeopt = "menu" - -" }}} - -"{{{Look and Feel -set termguicolors -colorscheme rose-pine - -highlight HighlightedyankRegion cterm=reverse gui=reverse -let g:highlightedyank_highlight_duration = 200 -" }}} - -"{{{ Mappings - -" brute force deasciify everything -nnoremap tc TurkishDeasciifyForce() -xnoremap tc TurkishDeasciifyForce() -nnoremap tctc TurkishDeasciifyForce() .. '_' - -" use turkish-mode to selectively deasciify -nnoremap tr TurkishDeasciify() -xnoremap tr TurkishDeasciify() -nnoremap trtr TurkishDeasciify() .. '_' - -" ascii everything -nnoremap rt TurkishAsciify() -xnoremap rt TurkishAsciify() -nnoremap rtrt TurkishAsciify() .. '_' - -" https://stackoverflow.com/questions/4256697/vim-search-and-highlight-but-do-not-jump -nnoremap * :keepjumps normal! mi*`i -nnoremap # :keepjumps normal! mi#`i - -" Save file as sudo on files that require root permission -cnoremap w!! execute 'silent! write !sudo tee % >/dev/null' edit! - -" replace ex mode with gq -map Q gq - -" set formatprg to sentences, for prose -map \fp :set formatprg=~/.local/bin/sentences - -" Replace all is aliased to S. -nnoremap S :%s//g - -" use esc in :term as well -tnoremap - -" call CreatePaper on word below cursor -nnoremap np gewi[[/papers/Ea]]bb:call CreatePaper(expand('')) - -" link paper -nnoremap lp gewi[[/papers/Ea]] - -" call CreateReference on word below cursor -nnoremap nr :call CreateReference(expand('')) - -" create a new note -nnoremap nn :call CreateNote() - -" If you like "Y" to work from the cursor to the end of line (which is more -" logical, but not Vi-compatible) -map Y y$ - -" Open the TagBar Plugin -nnoremap :TagbarToggle -" Fix whole buffer via ALE -nmap (ale_fix) - -" vim-test bindings -nmap t :TestNearest -nmap t :TestFile -nmap t :TestSuite -nmap t :TestLast -nmap t :TestVisit - -" Edit vimrc \ev -nnoremap ev :tabnew:e ~/.config/nvim/init.vim -" jump to buffer -nnoremap b :ls:b - -" Up and down are more logical with g.. -nnoremap k gk -nnoremap j gj -inoremap gka -inoremap gja - -" Disable highlight when is pressed -nnoremap :noh -" Space used to toggle folds, now it's x (because x is d) -nnoremap "_x - -" checkmarks on vimwiki -nmap v VimwikiToggleListItem -" add/increase header level -nmap a VimwikiAddHeaderLevel - -" sneak using grave, s is for sandwich -nmap ` Sneak_s -nmap ` Sneak_S -nnoremap ' ` - -" separate cut and delete -nnoremap x d -xnoremap x d -nnoremap xx dd -nnoremap X D - -" use the special yoink paste -nmap p (YoinkPaste_p) -nmap P (YoinkPaste_P) - -" substitute from yank -nmap ys (SubversiveSubstitute) -nmap yss (SubversiveSubstituteLine) -nmap yS (SubversiveSubstituteToEndOfLine) - -" substitute over range -nmap s (SubversiveSubstituteRange) -xmap s (SubversiveSubstituteRange) -nmap ss (SubversiveSubstituteWordRange) - -" subvert over range -nmap s (SubversiveSubvertRange) -xmap s (SubversiveSubvertRange) -nmap ss (SubversiveSubvertWordRange) - -" iterate over yank list -nmap (YoinkPostPasteSwapBack) -nmap (YoinkPostPasteSwapForward) - -" change into pwd of current directory -nnoremap cd :cd %:p:h:pwd -inoremap fn =expand("%:t:r") -nnoremap fn :put! =expand('%:t:r') - -" press \g and start writing prose -map g :Goyo -"}}} - -"{{{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#tabline#enabled = 1 -let g:airline_mode_map = {} -let g:airline_mode_map['ic'] = 'INSERT' - -if !exists('g:airline_symbols') - let g:airline_symbols = {} -endif - -let g:airline_left_sep = '' -let g:airline_left_alt_sep = '' -let g:airline_right_sep = '' -let g:airline_right_alt_sep = '' - -"}}} - -"{{{ Ale -let g:ale_sign_error = '✗' -let g:ale_sign_warning = '⚑' -let g:ale_lint_on_text_changed = 'insert' -let g:ale_lint_on_enter = 0 -let g:ale_pattern_options = {'\.wiki$': {'ale_enabled': 0}} -"}}} - -"{{{ Ledger -let g:ledger_maxwidth = 48 -let g:ledger_fillstring = ' ~' -"}}} - -"{{{ UltiSnips -set runtimepath+=~/.vim/my-snippets/ -let g:UltiSnipsEditSplit = "vertical" -let g:UltiSnipsSnippetsDir = $HOME.'/.vim/my-snippets/UltiSnips' - -" ctrl + l expands the snippet, c + j/k navigates placeholders -let g:UltiSnipsExpandTrigger = "" -let g:UltiSnipsEnableSnipMate = "1" -"}}} - -"{{{ 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/nextcloud/personal_wiki/text', - \ 'path_html': '/home/yigit/nextcloud/personal_wiki/html', - \ 'auto_generate_tags': 1, - \ 'automatic_nested_syntaxes': 1, - \ 'template_path': '/home/yigit/nextcloud/personal_wiki/templates', - \ 'template_default': 'default_template', - \ 'template_ext': '.html', - \ 'auto_export': 1, - \ 'auto_tags': 1}] -let g:vimwiki_global_ext = 0 -let g:vimwiki_hl_headers = 1 -"}}} - -" {{{ vimtex -let g:vimtex_view_method='zathura' -let g:vimtex_quickfix_mode=0 -" }}} - -" {{{ Gutentags -let g:gutentags_enabled = 1 -let g:gutentags_add_default_project_roots = 0 -let g:gutentags_project_root = ['Makefile', '.git'] -let g:gutentags_exclude_filetypes = ['gitcommit', 'gitconfig', 'gitrebase', 'gitsendemail', 'git'] -let g:gutentags_generate_on_new = 1 -let g:gutentags_generate_on_missing = 1 -let g:gutentags_generate_on_write = 1 -let g:gutentags_generate_on_empty_buffer = 0 -let g:gutentags_ctags_exclude = [ -\ '*.git', '*.svn', '*.hg', -\ 'cache', 'build', 'dist', 'bin', 'node_modules', 'bower_components', -\ '*-lock.json', '*.lock', -\ '*.min.*', -\ '*.bak', -\ '*.zip', -\ '*.pyc', -\ '*.class', -\ '*.sln', -\ '*.csproj', '*.csproj.user', -\ '*.tmp', -\ '*.cache', -\ '*.vscode', -\ '*.pdb', -\ '*.exe', '*.dll', '*.bin', -\ '*.mp3', '*.ogg', '*.flac', -\ '*.swp', '*.swo', -\ '.DS_Store', '*.plist', -\ '*.bmp', '*.gif', '*.ico', '*.jpg', '*.png', '*.svg', -\ '*.rar', '*.zip', '*.tar', '*.tar.gz', '*.tar.xz', '*.tar.bz2', -\ '*.pdf', '*.doc', '*.docx', '*.ppt', '*.pptx', '*.xls', -\] -" }}} - -" vim-slime {{{ -let g:slime_target = "tmux" -let g:slime_paste_file = "$HOME/.slime_paste" -let g:slime_default_config = {"socket_name": get(split($TMUX, ","), 0), "target_pane": "{last}"} -" }}} Slime - -" devicons {{{ " -let g:WebDevIconsUnicodeDecorateFileNodesExtensionSymbols = {} " needed -let g:WebDevIconsUnicodeDecorateFileNodesExtensionSymbols['wiki'] = '📔' -" }}} devicons " - -" beacon {{{ " -let g:beacon_size = 100 -let g:beacon_shrink = 0 -highlight Beacon guibg=red ctermbg=15 -" }}} beacon " - -" thesaurus_query {{{ " -let g:tq_enabled_backends = ["mthesaur_txt"] -let g:tq_truncation_on_relavance = 0 -" }}} thesaurus_query " - -" fzf.vim {{{ " -" Insert mode completion -imap (fzf-complete-word) -imap (fzf-complete-path) -imap (fzf-complete-line) -" }}} fzf.vim " - 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 @@ +-- ┌──────────────────┐ +-- │ ▗ │ +-- │▛▀▖▞▀▖▞▀▖▌ ▌▄ ▛▚▀▖│ +-- │▌ ▌▛▀ ▌ ▌▐▐ ▐ ▌▐ ▌│ +-- │▘ ▘▝▀▘▝▀ ▘ ▀▘▘▝ ▘│ +-- └──────────────────┘ +-- ┌────────────────────────┐ +-- │ ▗ │ +-- │▛▚▀▖▝▀▖▛▀▖▛▀▖▄ ▛▀▖▞▀▌▞▀▘│ +-- │▌▐ ▌▞▀▌▙▄▘▙▄▘▐ ▌ ▌▚▄▌▝▀▖│ +-- │▘▝ ▘▝▀▘▌ ▌ ▀▘▘ ▘▗▄▘▀▀ │ +-- └────────────────────────┘ + +-- map helper +local function map(mode, lhs, rhs, opts) + local options = {noremap = true, silent = true} + if opts then options = vim.tbl_extend('force', options, opts) end + vim.api.nvim_set_keymap(mode, lhs, rhs, options) +end + +-- local map = vim.api.nvim_set_keymap +local cmd = vim.cmd +local M = {} + +-- brute force deasciify everything +map('n', 'tc', 'TurkishDeasciifyForce()', {expr = true}) +map('x', 'tc', 'TurkishDeasciifyForce()', {expr = true}) +map('n', 'tctc', "TurkishDeasciifyForce() .. '_'", {expr = true}) + +-- use turkish-mode to selectively deasciify +map('n', 'tr', 'TurkishDeasciify()', {expr = true}) +map('x', 'tr', 'TurkishDeasciify()', {expr = true}) +map('n', 'trtr', "TurkishDeasciify() .. '_'", {expr = true}) + +-- ascii everything +map('n', 'rt', 'TurkishAsciify()', {expr = true}) +map('x', 'rt', 'TurkishAsciify()', {expr = true}) +map('n', 'rtrt', "TurkishAsciify() .. '_'", {expr = true}) + +-- https://stackoverflow.com/questions/4256697/vim-search-and-highlight-but-do-not-jump +-- search & highlight but do not jump +map('n', '*', ':keepjumps normal! mi*`i') +map('n', '#', ':keepjumps normal! mi#`i ') + +-- Save file as sudo on files that require root permission +map('c', 'w!!', 'execute "silent! write !sudo tee % >/dev/null" edit!') + +-- replace ex mode with gq (format lines) +map('n', 'Q', 'gq') + +-- set formatprg to sentences, for prose +map('n', 'fp', ":set formatprg=~/.local/bin/sentences") + +-- Replace all is aliased to S. +map('n', 'S', ':%s//g') + +-- If you like "Y" to work from the cursor to the end of line (which is more +-- logical, but not Vi-compatible) +map('n', 'Y', 'y$') + +-- jump to buffer +map('n', 'b', ':ls:b') + +-- Up and down are more logical with g.. +map('n', 'k', 'gk') +map('n', 'j', 'gj') +map('i', '', 'gka') +map('i', '', 'gja') + +-- Disable highlight when is pressed +map('n', '', ':noh') +-- Space used to toggle folds, now it's x (because x is d) +map('n', '', '"_x') + +-- separate cut and delete +map('n', 'x', 'd') +map('x', 'x', 'd') +map('n', 'xx', 'dd') +map('n', 'X', 'D') + +-- change into pwd of current directory +map('n', 'cd', ':cd %:p:h:pwd') + +-- press \g and start writing prose +map('n', 'g', ':Goyo') + +-- plug mappings {{{1 -- + +-- mappings should not be noremap +-- https://www.reddit.com/r/vim/comments/78izt4/please_help_understand_how_to_use_plug_mapping/ +local function plugmap(mode, lhs, rhs, opts) + local options = {noremap = false, silent = true} + if opts then options = vim.tbl_extend('force', options, opts) end + vim.api.nvim_set_keymap(mode, lhs, rhs, options) +end + +-- sneak using grave, s is for sandwich +plugmap('n', '`', 'Sneak_s') +plugmap('n', '`', 'Sneak_s') +plugmap('n', '`', 'Sneak_S') +plugmap('n', "'", '`') + +-- use the special yoink paste that rotates +plugmap('n', 'p', '(YoinkPaste_p)') +plugmap('n', 'P', '(YoinkPaste_P)') + +-- substitute from yank +plugmap('n', 'ys', '(SubversiveSubstitute)') +plugmap('n', 'yss', '(SubversiveSubstituteLine)') +plugmap('n', 'yS', '(SubversiveSubstituteToEndOfLine)') + +-- substitute over range +plugmap('n', 's', '(SubversiveSubstituteRange)') +plugmap('x', 's', '(SubversiveSubstituteRange)') +plugmap('n', 'ss', '(SubversiveSubstituteWordRange)') + +-- subvert over range +plugmap('n', 's', '(SubversiveSubvertRange)') +plugmap('x', 's', '(SubversiveSubvertRange)') +plugmap('n', 'ss', '(SubversiveSubvertWordRange)') + +-- iterate over yank list +plugmap('n', '', '(YoinkPostPasteSwapBack)') +plugmap('n', '', '(YoinkPostPasteSwapForward)') + +-- insert mode completion +plugmap('i', '', '(fzf-complete-word)') +plugmap('i', '', '(fzf-complete-path)') +plugmap('i', '', '(fzf-complete-line)') + +-- 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 @@ +-- ┌──────────────────┐ +-- │ ▗ │ +-- │▛▀▖▞▀▖▞▀▖▌ ▌▄ ▛▚▀▖│ +-- │▌ ▌▛▀ ▌ ▌▐▐ ▐ ▌▐ ▌│ +-- │▘ ▘▝▀▘▝▀ ▘ ▀▘▘▝ ▘│ +-- └──────────────────┘ +-- ┌─────────────────────────────────────┐ +-- │ ▜ ▐ ▐ ▗ │ +-- │▛▀▖▐ ▌ ▌▞▀▌▗▖▖▞▀▘▞▀▖▜▀ ▜▀ ▄ ▛▀▖▞▀▌▞▀▘│ +-- │▙▄▘▐ ▌ ▌▚▄▌▘▝ ▝▀▖▛▀ ▐ ▖▐ ▖▐ ▌ ▌▚▄▌▝▀▖│ +-- │▌ ▘▝▀▘▗▄▘ ▀▀ ▝▀▘ ▀ ▀ ▀▘▘ ▘▗▄▘▀▀ │ +-- └─────────────────────────────────────┘ + +local g = vim.g -- global for let options +local opt = vim.opt -- convenient :set +local cmd = vim.cmd -- vim commands + +-- vimwiki {{{ -- +g.vimwiki_list = { + { + path = '/home/yigit/nextcloud/personal_wiki/text', + path_html = '/home/yigit/nextcloud/personal_wiki/html', + auto_generate_tags = 1, + automatic_nested_syntaxes = 1, + template_path = '/home/yigit/nextcloud/personal_wiki/templates', + template_default = 'default_template', + template_ext = '.html', + auto_export = 1, + auto_tags = 1 + } +} + +g.vimwiki_global_ext = 0 +g.vimwiki_hl_headers = 1 +-- }}} vimwiki -- + +-- lualine {{{ -- +require'lualine'.setup { + options = { + lower = true, + icons_enabled = true, + theme = 'rose-pine', + section_separators = {'', ''}, + component_separators = {'', ''}, + disabled_filetypes = {} + }, + sections = { + lualine_a = {{'mode', lower = true}}, + lualine_b = {'branch', 'diff'}, + lualine_c = {'filename'}, + lualine_x = {'encoding', 'fileformat', 'filetype'}, + lualine_y = {'progress'}, + lualine_z = { + 'location', { + 'diagnostics', + sources = {'ale'}, + sections = {'error', 'warn', 'info', 'hint'}, + symbols = {error = 'e', warn = 'w', info = 'i', hint = 'h'} + } + } + }, + inactive_sections = { + lualine_a = {}, + lualine_b = {}, + lualine_c = {'filename'}, + lualine_x = {}, + lualine_y = {}, + lualine_z = {} + }, + tabline = {}, + extensions = {} +} +-- }}} requi -- + +-- Cutlass suite {{{1 -- + +-- cutlass/yoink/subverse suite +g.yoinkIncludeDeleteOperations = 1 + +-- fix the Target STRING not available +g.clipboard = { + name = 'xsel_override', + copy = { + ['+'] = 'xsel --input --clipboard', + ['*'] = 'xsel --input --primary', + }, + paste = { + ['+'] = 'xsel --output --clipboard', + ['*'] = 'xsel --output --primary', + }, + cache_enabled = 1, +} + +-- 1}}} -- + +-- UltiSnips {{{ -- +opt.runtimepath:append('/home/yigit/.vim/my-snippets/') +g.UltiSnipsEditSplit = "vertical" +-- ctrl + l expands the snippet, c + j/k navigates placeholders +g.UltiSnipsExpandTrigger = "" +g.UltiSnipsEnableSnipMate = "1" +-- }}} UltiSnips -- + +-- float preview +g["float_preview#docked"] = 0 + +-- highlight on yank +cmd('highlight HighlightedyankRegion cterm=reverse gui=reverse') +g.highlightedyank_highlight_duration = 200 + +-- beacon {{{ -- +g.beacon_size = 100 +g.beacon_shrink = 1 +cmd('highlight Beacon guibg=red ctermbg=15') +-- }}} beacon -- + +-- vim-slime {{{ -- +g.slime_target = "tmux" +g.slime_paste_file = "/home/yigit/.slime_paste" +-- g.slime_default_config = {socket_name = get(split($TMUX, ","), 0), target_pane = "{last}"} +-- }}} vim-slime -- + +-- vimtex {{{ -- +g.vimtex_view_method = 'zathura' +g.vimtex_quickfix_mode = 0 +-- }}} 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 @@ +-- ┌───────────────────┐ +-- │ ▜ ▗ │ +-- │▛▀▖▐ ▌ ▌▞▀▌▄ ▛▀▖▞▀▘│ +-- │▙▄▘▐ ▌ ▌▚▄▌▐ ▌ ▌▝▀▖│ +-- │▌ ▘▝▀▘▗▄▘▀▘▘ ▘▀▀ │ +-- └───────────────────┘ + +return require('packer').startup(function() + -- Packer can manage itself + use 'wbthomason/packer.nvim' + + -- latex suite + use {'lervag/vimtex', ft = {'tex', 'latex', 'plaintext'}} + + -- still here + use 'dense-analysis/ale' + -- manages tag files + use 'ludovicchabant/vim-gutentags' + -- run tests (todo: write tests) + use 'janko/vim-test' + -- type in file send to repl + use 'jpalardy/vim-slime' + -- snippets to expand + use {'SirVer/ultisnips', 'honza/vim-snippets'} + -- Highlight the yanked region + use 'machakann/vim-highlightedyank' + + -- auto pair plugin, people hate these + use 'tmsvg/pear-tree' + -- git diff in the sign column + use 'airblade/vim-gitgutter' + -- completion preview of floating window + use 'ncm2/float-preview.nvim' + + -- language packs + use 'sheerun/vim-polyglot' + -- i3 config syntax + use 'mboughaba/i3config.vim' + -- kitty config filetype + use 'fladson/vim-kitty' + + use{'junegunn/fzf', dir = '~/.fzf'} + use 'junegunn/fzf.vim' + + -- file explorer + use 'lambdalisue/fern.vim' + -- bug in neovim, so required for now + -- https://github.com/lambdalisue/fern.vim/issues/120 + use 'antoinemadec/FixCursorHold.nvim' + + -- displays tags ordered by scope + use 'majutsushi/tagbar' + -- Undo tree + use { + 'mbbill/undotree', + cmd = 'UndotreeToggle', + config = [[vim.g.undotree_SetFocusWhenToggle = 1]], + } + -- Highlight colors + use { + 'norcalli/nvim-colorizer.lua', + ft = { 'css', 'javascript', 'vim', 'html' }, + config = [[require('colorizer').setup {'css', 'javascript', 'vim', 'html'}]], + } + + -- cutlass suite, x, d, \ys etc. + use { + 'svermeulen/vim-cutlass', + 'svermeulen/vim-subversive', + 'svermeulen/vim-yoink' + } + + -- Personal wiki + use 'vimwiki/vimwiki' + -- centers the writing + use 'junegunn/goyo.vim' + -- highlights the current paragraph + use 'junegunn/limelight.vim' + -- change ASCII text to Turkish text + use 'yigitsever/turkish-deasciifier.vim' + + -- text alignment \w :Tab + use 'godlygeek/tabular' + -- move selections up and down with alt+[j,k] + use 'matze/vim-move' + -- surround text objects; sa, sr and sd + use 'machakann/vim-sandwich' + -- provide additional text objects + use 'wellle/targets.vim' + -- indentation level text object, ia, ii + use 'michaeljsmith/vim-indent-object' + -- visual feedback for substitute holy shit this is amazing + use 'markonm/traces.vim' + -- see the contents of registers on "/ + use 'junegunn/vim-peekaboo' + -- use k to highlight multiple words) + use 'lfv89/vim-interestingwords' + -- swap delimited items using g>, g< + use 'machakann/vim-swap' + -- jump to location by 2 characters, ` + use 'justinmk/vim-sneak' + -- reopen files at your last edit position + use 'farmergreg/vim-lastplace' + -- flash cursor on jump + use 'DanilaMihailov/beacon.nvim' + + -- cursorline of the $CURRENT_YEAR + use { + 'hoob3rt/lualine.nvim', + requires = {'kyazdani42/nvim-web-devicons', opt = true} + } + -- colour theme of the $CURRENT_YEAR + use 'rose-pine/neovim' + + -- enable repeating supported plugin maps with '.' + use 'tpope/vim-repeat' + -- pairs of handy bracket mappings + use 'tpope/vim-unimpaired' + -- git wrapper + use { + 'tpope/vim-fugitive', cmd = { 'Git', 'Gstatus', 'Gblame', 'Gpush', 'Gpull' } + } + -- increment dates, times & more + use 'tpope/vim-speeddating' + -- search, substitute and abbreviate + use 'tpope/vim-abolish' + -- provides ga, show unicode stuff of char under cursor + use 'tpope/vim-characterize' + -- comment helper + use 'tpope/vim-commentary' + -- asynchronous build and test dispatcher + use {'tpope/vim-dispatch', opt = true, cmd = {'Dispatch', 'Make', 'Focus', 'Start'}} + + -- fancy start screen + use 'mhinz/vim-startify' +end) 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 @@ +-- ┌──────────────────┐ +-- │ ▗ │ +-- │▛▀▖▞▀▖▞▀▖▌ ▌▄ ▛▚▀▖│ +-- │▌ ▌▛▀ ▌ ▌▐▐ ▐ ▌▐ ▌│ +-- │▘ ▘▝▀▘▝▀ ▘ ▀▘▘▝ ▘│ +-- └──────────────────┘ +-- ┌───────────────────────┐ +-- │ ▐ ▐ ▗ │ +-- │▞▀▘▞▀▖▜▀ ▜▀ ▄ ▛▀▖▞▀▌▞▀▘│ +-- │▝▀▖▛▀ ▐ ▖▐ ▖▐ ▌ ▌▚▄▌▝▀▖│ +-- │▀▀ ▝▀▘ ▀ ▀ ▀▘▘ ▘▗▄▘▀▀ │ +-- └───────────────────────┘ + +local o = vim.o -- gl[o]bal options +local wo = vim.wo -- [w]indow-local [o]ptions +local bo = vim.bo -- [b]uffer-local [o]ptions +local opt = vim.opt -- convenient :set + +-- look & feel +o.termguicolors = true +vim.cmd('colorscheme rose-pine') + +-- interact with system clipboard +opt.clipboard:append('unnamedplus') + +-- copy indent on a new line +o.autoindent = true + +-- :h tabstop, 2. point +-- use appropriate number of spaces to insert a +o.expandtab = true +o.shiftwidth = 4 +o.softtabstop = 4 +o.tabstop = 8 + +-- use english for spellchecking, but don't spellcheck by default +o.spell = true +o.spelllang = "en_gb" +o.spell = false + +-- tab completion, zsh style +o.wildmode = "full" +opt.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' +} + +-- put one space while joining (not two) +o.joinspaces = false + +-- keep n lines above/below cursor while scrolling +o.scrolloff = 4 +-- line numbers +o.number = true +-- fold manually, when I place markers +o.foldmethod = "marker" +-- set the terminal title +o.title = true +-- wrap using 'breakat' character +o.linebreak = true +-- new split panes will split to below and right +o.splitbelow = true +o.splitright = true +-- highlight the current line, yoc undoes +o.cursorline = true +-- current line actual number, rest are relative +o.relativenumber = true +-- we are already using a cursorline, don't clobber linter messages +o.showmode = false +-- jump to the matching bracket briefly +o.showmatch = true +-- move freely between buffers +o.hidden = true + +-- persistent undo +o.undodir = "/home/yigit/.vim/undodir" +o.undofile = true + +-- lower case searches ignore case, upper case searches do not +o.ignorecase = true +o.smartcase = true + +-- https://stackoverflow.com/a/3445040/ +-- switch case labels +o.cinoptions = "l1" + +if vim.fn.executable("rg") then + o.grepprg = "rg --vimgrep --no-heading --smart-case" +end + +-- iwhite: ignore changes in amount of white space. +-- vertical: start diff mode with vertical splits +-- filler: show filler lines, +opt.diffopt = { + "iwhite", "vertical", "filler", "algorithm:patience", "indent-heuristic" +} + +-- menu: use a popup menu to show the possible completions +-- preview: show extra information +opt.completeopt = {"menu", "preview"} -- cgit v1.2.3-70-g09d2