From 28ea0e3cbe1c0f980a05d6fb13a428bcab2ea1c5 Mon Sep 17 00:00:00 2001 From: Vikas Kushwaha Date: Fri, 13 Jun 2025 08:37:31 +0530 Subject: neovim updates --- .config/nvim/coc.vim | 15 ++- .config/nvim/init.vim | 103 +++++++++++------- .config/nvim/plugins.conf.d/coc-onload.vim | 147 ++++++++++++++++++++++++++ .config/nvim/plugins.conf.d/coc-settings.json | 10 ++ .config/nvim/plugins.conf.d/fzf.vim | 23 ++++ .config/nvim/plugins.conf.d/onedark.vim | 38 +++++++ .config/nvim/plugins.conf.d/out.vim | 36 +++++++ .config/nvim/plugins.conf.d/vimspector.vim | 21 ++++ .config/nvim/plugins.conf.d/zeal.vim | 7 ++ .config/nvim/templates/_default.sh | 2 + .config/nvim/templates/sh/err.sh | 2 + .config/nvim/templates/sh/getopts.sh | 6 ++ .config/nvim/templates/sh/help.sh | 10 ++ .config/nvim/user/coc-onload.vim | 147 -------------------------- .config/nvim/user/coc-settings.json | 10 -- .config/nvim/user/fzf.vim | 19 ---- .config/nvim/user/onedark.vim | 38 ------- .config/nvim/user/out.vim | 36 ------- .config/nvim/user/vimspector.vim | 21 ---- .config/nvim/user/zeal.vim | 7 -- 20 files changed, 373 insertions(+), 325 deletions(-) create mode 100644 .config/nvim/plugins.conf.d/coc-onload.vim create mode 100644 .config/nvim/plugins.conf.d/coc-settings.json create mode 100644 .config/nvim/plugins.conf.d/fzf.vim create mode 100644 .config/nvim/plugins.conf.d/onedark.vim create mode 100644 .config/nvim/plugins.conf.d/out.vim create mode 100644 .config/nvim/plugins.conf.d/vimspector.vim create mode 100644 .config/nvim/plugins.conf.d/zeal.vim create mode 100644 .config/nvim/templates/_default.sh create mode 100644 .config/nvim/templates/sh/err.sh create mode 100644 .config/nvim/templates/sh/getopts.sh create mode 100644 .config/nvim/templates/sh/help.sh delete mode 100644 .config/nvim/user/coc-onload.vim delete mode 100644 .config/nvim/user/coc-settings.json delete mode 100644 .config/nvim/user/fzf.vim delete mode 100644 .config/nvim/user/onedark.vim delete mode 100644 .config/nvim/user/out.vim delete mode 100644 .config/nvim/user/vimspector.vim delete mode 100644 .config/nvim/user/zeal.vim (limited to '.config/nvim') diff --git a/.config/nvim/coc.vim b/.config/nvim/coc.vim index 1175735..2ba6c06 100644 --- a/.config/nvim/coc.vim +++ b/.config/nvim/coc.vim @@ -7,21 +7,21 @@ packadd! vim-jsx-pretty " packadd! copilot.vim " --> Fzf -" source ~/.config/nvim/user/fzf.vim +" source ~/.config/nvim/plugins.conf.d/fzf.vim " set rtp+=/usr/share/vim/vimfiles " --> Zeal -source ~/.config/nvim/user/zeal.vim +source ~/.config/nvim/plugins.conf.d/zeal.vim " --> Onedark theme -source ~/.config/nvim/user/onedark.vim +source ~/.config/nvim/plugins.conf.d/onedark.vim " --> Vimspector -source ~/.config/nvim/user/vimspector.vim +source ~/.config/nvim/plugins.conf.d/vimspector.vim " --> COC -autocmd! User coc.nvim source $HOME/.config/nvim/user/coc-onload.vim -let g:coc_config_home = '$HOME/.config/nvim/user' +autocmd! User coc.nvim source $HOME/.config/nvim/plugins.conf.d/coc-onload.vim +let g:coc_config_home = '$HOME/.config/nvim/plugins.conf.d' let g:coc_data_home = '$HOME/.local/share/nvim/site/coc' let g:coc_global_extensions = [ \ 'coc-json', @@ -45,8 +45,5 @@ inoremap coc#refresh() nnoremap :source ~/.config/nvim/coc.vim -" autocmd VimLeave * call SaveSess() -" autocmd VimEnter * nested call RestoreSess() - AirlineTheme CocList extensions diff --git a/.config/nvim/init.vim b/.config/nvim/init.vim index 67eb5b8..fbda0fa 100644 --- a/.config/nvim/init.vim +++ b/.config/nvim/init.vim @@ -33,13 +33,12 @@ if filereadable(config_dir . "autoload/plug.vim") endif packadd! fzf.vim -source ~/.config/nvim/user/fzf.vim +source ~/.config/nvim/plugins.conf.d/fzf.vim set rtp+=/usr/share/vim/vimfiles let g:Verdin#autocomplete = 1 let g:livepreview_previewer = 'zathura' let g:tex_flavor = 'latex' -let g:session_filename = '.session.vim' set title showmatch nowrap mouse=a scrolloff=5 set tabstop=2 shiftwidth=0 @@ -88,46 +87,74 @@ nnoremap o :LfWorkingDirectory nnoremap l :LfCurrentFileNewTab nnoremap o :LfWorkingDirectoryExistingOrNewTab + " --> Sessions -fu! SaveSess() - execute 'mksession! ' . getcwd() . '/' . g:session_filename +let g:session_filename = '.session.vim' + +function! SaveSess() + execute 'mksession! ' . getcwd() . '/' . g:session_filename endfunction -fu! RestoreSess() -if filereadable(getcwd() . '/' . g:session_filename) - execute 'so ' . getcwd() . '/' . g:session_filename - if bufexists(1) - for l in range(1, bufnr('$')) - if bufwinnr(l) == -1 - exec 'sbuffer ' . l - endif - endfor - endif -endif +function! RestoreSess() + execute 'so ' . getcwd() . '/' . g:session_filename + if bufexists(1) + for l in range(1, bufnr('$')) + if bufwinnr(l) == -1 + exec 'sbuffer ' . l + endif + endfor + endif endfunction -command! -nargs=0 Mksess :call SaveSess() -command! -nargs=0 Resess :call RestoreSess() +if argc() == 0 && filereadable(getcwd() . '/' . g:session_filename) + autocmd VimLeave * call SaveSess() + autocmd VimEnter * nested call RestoreSess() +endif + +command! -nargs=0 Mksession :call SaveSess() + " --> Template Management -function SourceTemplate() - let b:template = glob("${XDG_CONFIG_HOME:-$HOME/.config}/nvim/templates/_default." . expand('%:e')) - if !empty(b:template) - execute('0r' . b:template) +let g:templates_dir = "${XDG_CONFIG_HOME:-$HOME/.config}/nvim/templates" + +function ReadDefaultTemplate() + let b:default_template = glob(g:templates_dir . "/_default." . expand('%:e')) + if !empty(b:default_template) + execute('0r ' . b:default_template) endif endfunction -autocmd BufNewFile * call SourceTemplate() +autocmd BufNewFile * call ReadDefaultTemplate() + +function ReadTemplate(template) + execute('r ' . a:template) +endfunction + +function FzfTemplates() + call fzf#run(fzf#wrap({ + \ 'source': 'find ' . g:templates_dir . '/' . &filetype . ' -mindepth 1', + \ 'sink': function('ReadTemplate'), + \ 'options': ['--delimiter', '/templates/' . &filetype . '/', '--with-nth', '2..'], + \ })) +endfunction + +command -nargs=0 Templates call FzfTemplates() +nnoremap t :Templates + + +" --> Other commands autocmd TermOpen * startinsert -command! -nargs=* TermSplit split | terminal -command! -nargs=* TermVSplit vsplit | terminal +command! -nargs=* TermSplit split | terminal +command! -nargs=* TermVSplit vsplit | terminal + +command -nargs=* T tabnew +command Gi execute "tabnew" system('EDITOR=echo gi') -command! -nargs=* T tabnew -" --> Bindings and configs +" --> Bindings if !exists('g:lasttab') let g:lasttab = 1 @@ -194,24 +221,21 @@ autocmd FileType go inoremap ;ae err:=<++>iferr! nnoremap fl :w:!dev lint "%" nnoremap fm :w:%!dev format "%" nnoremap fM :w:%!dev minify "%" -nnoremap fc :w:!dev compile "%" -nnoremap fe :w:!dev run "%" -nnoremap ft :w:!dev test "%" -nnoremap fb :w:!dev build "%" +nnoremap fc :w:se nornu:!dev compile "%":se rnu +nnoremap fe :w:se nornu:!dev run "%":se rnu +nnoremap fa :w:se nornu:!dev test "%":se rnu +nnoremap fb :w:se nornu:!dev build "%":se rnu nnoremap fr :w:!dev clean "%" nnoremap Fl :w:TermSplit dev lint "%" nnoremap Fm :w:TermSplit dev format "%" -nnoremap Fc :w:TermSplit dev compile "%" -nnoremap Fe :w:TermSplit dev run "%" -nnoremap Ft :w:TermSplit dev test "%" +nnoremap Fc :w:se nornu:TermSplit dev compile "%" +nnoremap Fe :w:se nornu:TermSplit dev run "%" +nnoremap Fb :w:se nornu:TermSplit dev build "%" +nnoremap Fa :w:se nornu:TermSplit dev test "%" nnoremap Fr :w:TermSplit dev clean "%" -nnoremap b :w:se nornu:!dev build "%":se rnu -nnoremap B :w:se nornu:TermSplit dev build "%" -nnoremap t :w:se nornu:!dev test "%":se rnu -nnoremap T :w:se nornu:TermSplit dev test "%" - +nnoremap a :w:se nornu:!dev test "%":se rnu nnoremap w :set wrap! nnoremap fo :!opout "%:p" nnoremap :source ~/.config/nvim/init.vim @@ -220,6 +244,9 @@ nnoremap s :%s//gc nnoremap gc :TermSplit git add --all && git commit nnoremap gp :TermSplit gitpush + +" --> Update shortcuts + let shortcuts = config_dir . "shortcuts.vim" if filereadable(shortcuts) execute "source " . shortcuts diff --git a/.config/nvim/plugins.conf.d/coc-onload.vim b/.config/nvim/plugins.conf.d/coc-onload.vim new file mode 100644 index 0000000..b3db607 --- /dev/null +++ b/.config/nvim/plugins.conf.d/coc-onload.vim @@ -0,0 +1,147 @@ + +" May need for Vim (not Neovim) since coc.nvim calculates byte offset by count +" utf-8 byte sequence +set encoding=utf-8 +" Some servers have issues with backup files, see #649 +set nobackup +set nowritebackup + +" Having longer updatetime (default is 4000 ms = 4s) leads to noticeable +" delays and poor user experience +set updatetime=1000 + +" Always show the signcolumn, otherwise it would shift the text each time +" diagnostics appear/become resolved +set signcolumn=yes + +" Use tab for trigger completion with characters ahead and navigate +" NOTE: There's always complete item selected by default, you may want to enable +" no select by `"suggest.noselect": true` in your configuration file +" NOTE: Use command ':verbose imap ' to make sure tab is not mapped by +" other plugin before putting this into your config + inoremap + \ coc#pum#visible() ? coc#pum#next(1) : + \ CheckBackspace() ? "\" : + \ coc#refresh() + inoremap coc#pum#visible() ? coc#pum#prev(1) : "\" + +" Make to accept selected completion item or notify coc.nvim to format +" u breaks current undo, please make your own choice +inoremap coc#pum#visible() ? coc#pum#confirm() + \: "\u\\=coc#on_enter()\" + +function! CheckBackspace() abort + let col = col('.') - 1 + return !col || getline('.')[col - 1] =~# '\s' +endfunction + +" Use to trigger completion +if has('nvim') + inoremap coc#refresh() +else + inoremap coc#refresh() +endif + +" Use `[g` and `]g` to navigate diagnostics +" Use `:CocDiagnostics` to get all diagnostics of current buffer in location list +nmap [g (coc-diagnostic-prev) +nmap ]g (coc-diagnostic-next) + +" GoTo code navigation +nmap gd (coc-definition) +nmap gy (coc-type-definition) +nmap gi (coc-implementation) +nmap gr (coc-references) + +" Override neovim's builtin referencing +nmap grr (coc-references) + +" Use K to show documentation in preview window +nnoremap :call ShowDocumentation() + +function! ShowDocumentation() + if CocAction('hasProvider', 'hover') + call CocActionAsync('doHover') + else + call feedkeys('K', 'in') + endif +endfunction + +" Highlight the symbol and its references when holding the cursor +autocmd CursorHold * silent call CocActionAsync('highlight') + +" Symbol renaming +nmap rn (coc-rename) + +" Formatting selected code +xmap cf (coc-format-selected) +nmap cf (coc-format-selected) + +augroup mygroup + autocmd! + " Setup formatexpr specified filetype(s) + autocmd FileType typescript,json setl formatexpr=CocAction('formatSelected') + " Update signature help on jump placeholder + autocmd User CocJumpPlaceholder call CocActionAsync('showSignatureHelp') +augroup end + +" Applying code actions to the selected code block +" Example: `aap` for current paragraph +xmap aa (coc-codeaction-selected) +nmap aa (coc-codeaction-selected) + +" Remap keys for applying code actions at the cursor position +nmap ac (coc-codeaction-cursor) +" Remap keys for apply code actions affect whole buffer +nmap as (coc-codeaction-source) +" Apply the most preferred quickfix action to fix diagnostic on the current line +nmap aq (coc-fix-current) + +" Remap keys for applying refactor code actions +nmap re (coc-codeaction-refactor) +xmap r (coc-codeaction-refactor-selected) +nmap r (coc-codeaction-refactor-selected) + +" Run the Code Lens action on the current line +nmap cl (coc-codelens-action) + +" Map function and class text objects +" NOTE: Requires 'textDocument.documentSymbol' support from the language server +xmap if (coc-funcobj-i) +omap if (coc-funcobj-i) +xmap af (coc-funcobj-a) +omap af (coc-funcobj-a) +xmap ic (coc-classobj-i) +omap ic (coc-classobj-i) +xmap ac (coc-classobj-a) +omap ac (coc-classobj-a) + +" Remap and to scroll float windows/popups +if has('nvim-0.4.0') || has('patch-8.2.0750') + nnoremap coc#float#has_scroll() ? coc#float#scroll(1) : "\" + nnoremap coc#float#has_scroll() ? coc#float#scroll(0) : "\" + inoremap coc#float#has_scroll() ? "\=coc#float#scroll(1)\" : "\" + inoremap coc#float#has_scroll() ? "\=coc#float#scroll(0)\" : "\" + vnoremap coc#float#has_scroll() ? coc#float#scroll(1) : "\" + vnoremap coc#float#has_scroll() ? coc#float#scroll(0) : "\" +endif + +" Use CTRL-S for selections ranges +" Requires 'textDocument/selectionRange' support of language server +nmap (coc-range-select) +xmap (coc-range-select) + +" Add `:Format` command to format current buffer +command! -nargs=0 Format :call CocActionAsync('format') + +" Add `:Fold` command to fold current buffer +command! -nargs=? Fold :call CocAction('fold', ) + +" Add `:OR` command for organize imports of the current buffer +command! -nargs=0 OR :call CocActionAsync('runCommand', 'editor.action.organizeImport') + +" Add (Neo)Vim's native statusline support +" NOTE: Please see `:h coc-status` for integrations with external plugins that +" provide custom statusline: lightline.vim, vim-airline +set statusline^=%{coc#status()}%{get(b:,'coc_current_function','')} + diff --git a/.config/nvim/plugins.conf.d/coc-settings.json b/.config/nvim/plugins.conf.d/coc-settings.json new file mode 100644 index 0000000..437572d --- /dev/null +++ b/.config/nvim/plugins.conf.d/coc-settings.json @@ -0,0 +1,10 @@ +{ + "suggest.autoTrigger": "always", + "diagnostic.enable": true, + "python.linting.pycodestyleEnabled": true, + "html.autoCreateQuotes": false, + "coc.preferences.formatOnType": true, + "copilot.showRemainingText": true, + "copilot.enable": false, + "typescript.autoClosingTags": false +} diff --git a/.config/nvim/plugins.conf.d/fzf.vim b/.config/nvim/plugins.conf.d/fzf.vim new file mode 100644 index 0000000..49fec8d --- /dev/null +++ b/.config/nvim/plugins.conf.d/fzf.vim @@ -0,0 +1,23 @@ +" --> Fzf + +let g:fzf_history_dir = system('echo "${XDG_STATE_HOME:-$HOME/.local/state}/fzf/fzf_vim_history') + +let g:fzf_layout = { 'window': { 'width': 1, 'height': 1 } } +command! -bang -nargs=? -complete=dir Files + \ call fzf#vim#files(, {'options': ['--info=inline', '--preview', 'preview {}']}, 0) + +" Mapping selecting mappings +nmap (fzf-maps-n) +xmap (fzf-maps-x) +omap (fzf-maps-o) + +" Insert mode completion +imap (fzf-complete-word) +imap (fzf-complete-path) +imap (fzf-complete-line) + +" Fzf keybindings +nnoremap fh :History +nnoremap ff :Files +nnoremap f. :Files %:p:h + diff --git a/.config/nvim/plugins.conf.d/onedark.vim b/.config/nvim/plugins.conf.d/onedark.vim new file mode 100644 index 0000000..6f526bd --- /dev/null +++ b/.config/nvim/plugins.conf.d/onedark.vim @@ -0,0 +1,38 @@ +" --> Onedark Theme +if exists('+termguicolors') + let g:airline_theme = 'onedark' + let g:onedark_terminal_italics = 1 + let g:onedark_color_overrides = { + \ "foreground": { "gui": "#BBC2CF", "cterm": "145", "cterm16": "NONE" }, + \ "background": { "gui": "#181C24", "cterm": "235", "cterm16": "NONE" }, + \ "comment_grey": { "gui": "#6C7380", "cterm": "59", "cterm16": "7" }, + \ "gutter_fg_grey": { "gui": "#6272A4", "cterm": "238", "cterm16": "8" }, + \ "special_grey": { "gui": "#5Ba078", "cterm": "238", "cterm16": "7" }, + \ } + " \ "background": { "gui": "#202426", "cterm": "235", "cterm16": "NONE" }, + " + " \ "red": { "gui": "#E06C75", "cterm": "204", "cterm16": "1" }, + " \ "dark_red": { "gui": "#BE5046", "cterm": "196", "cterm16": "9" }, + " \ "green": { "gui": "#98C379", "cterm": "114", "cterm16": "2" }, + " \ "yellow": { "gui": "#E5C07B", "cterm": "180", "cterm16": "3" }, + " \ "dark_yellow": { "gui": "#D19A66", "cterm": "173", "cterm16": "11" }, + " \ "blue": { "gui": "#61AFEF", "cterm": "39", "cterm16": "4" }, + " \ "purple": { "gui": "#C678DD", "cterm": "170", "cterm16": "5" }, + " \ "cyan": { "gui": "#56B6C2", "cterm": "38", "cterm16": "6" }, + " \ "black": { "gui": "#282C34", "cterm": "235", "cterm16": "0" }, + " \ "white": { "gui": "#ABB2BF", "cterm": "145", "cterm16": "15" }, + " \ "cursor_grey": { "gui": "#2C323C", "cterm": "236", "cterm16": "0" }, + " \ "visual_grey": { "gui": "#3E4452", "cterm": "237", "cterm16": "8" }, + " \ "menu_grey": { "gui": "#3E4452", "cterm": "237", "cterm16": "7" }, + " \ "vertsplit": { "gui": "#3E4452", "cterm": "59", "cterm16": "7" }, + + " autocmd ColorScheme * call onedark#extend_highlight("LineNr", { + " \ "fg": { "gui": "#6272A4", "cterm": "238", "cterm16": "8" }, + " \ }) + let &t_8f="\[38;2;%lu;%lu;%lum" + let &t_8b="\[48;2;%lu;%lu;%lum" + " set termguicolors noshowmode + colorscheme onedark + " autocmd VimEnter * AirlineTheme +endif + diff --git a/.config/nvim/plugins.conf.d/out.vim b/.config/nvim/plugins.conf.d/out.vim new file mode 100644 index 0000000..6e4e1f1 --- /dev/null +++ b/.config/nvim/plugins.conf.d/out.vim @@ -0,0 +1,36 @@ +" capture (dump) the (somewhat long) ouput of the commands like `:digraph`, `:map', `:highlight`, `:scripnames` etc. + +function! s:dump(cmd) abort + + " Start a new split or maybe a buffer or a tab + " enew | " open a new buffer + 10split | enew | " open a new split (with 10% height (?)) + " tabnew | " open a new tab + + " Make it a scratch buffer ( `:help special-buffers`) + setlocal + \ bufhidden=wipe + \ buftype=nofile + \ nobuflisted + \ nolist + \ noswapfile + \ norelativenumber + \ nonumber + + " Write the cmd output to the buffer + put =execute(a:cmd) + " There are 2 empty line at the beginning of the buffer before the ouput of + " the cmd. Not sure from where they are comning from. Anyhow I will delete + " them. + norm gg2dd + + " No modifications to this buffer + setlocal readonly nomodifiable nomodified + + " Press escape to close when you're done + nnoremap :bd + +endfunction + +" Define a command to use the function easier +command! -nargs=1 Dump execute "call s:dump(" string() ")" diff --git a/.config/nvim/plugins.conf.d/vimspector.vim b/.config/nvim/plugins.conf.d/vimspector.vim new file mode 100644 index 0000000..521e252 --- /dev/null +++ b/.config/nvim/plugins.conf.d/vimspector.vim @@ -0,0 +1,21 @@ +" --> Vimspector +let g:vimspector_base_dir = expand('$HOME/.local/share/nvim/vimspector') +let g:vimspector_enable_mappings = 'HUMAN' +nnoremap dc VimspectorContinue +nnoremap ds VimspectorStop +nnoremap dr VimspectorRestart +nnoremap dp VimspectorPause +nnoremap dl VimspectorBreakpoints +nnoremap dd VimspectorToggleBreakpoint +nnoremap db VimspectorToggleConditionalBreakpoint +nnoremap df VimspectorAddFunctionBreakpoint +nnoremap dg VimspectorGoToCurrentLine +nnoremap dx :call vimspector#ClearBreakpoints() +nnoremap dq :VimspectorReset +nnoremap VimspectorContinue +nnoremap VimspectorStepOver +nnoremap VimspectorStepInto +nnoremap VimspectorStepOut +nnoremap VimspectorToggleBreakpoint +nnoremap VimspectorRunToCursor + diff --git a/.config/nvim/plugins.conf.d/zeal.vim b/.config/nvim/plugins.conf.d/zeal.vim new file mode 100644 index 0000000..1b2734f --- /dev/null +++ b/.config/nvim/plugins.conf.d/zeal.vim @@ -0,0 +1,7 @@ +" --> Zeal docs +let g:zv_disable_mapping = 1 +nmap z Zeavim +vmap z ZVVisSelection +nmap gz ZVOperator +nmap z ZVKeyDocset + diff --git a/.config/nvim/templates/_default.sh b/.config/nvim/templates/_default.sh new file mode 100644 index 0000000..13f4793 --- /dev/null +++ b/.config/nvim/templates/_default.sh @@ -0,0 +1,2 @@ +#!/bin/sh + diff --git a/.config/nvim/templates/sh/err.sh b/.config/nvim/templates/sh/err.sh new file mode 100644 index 0000000..a4414cd --- /dev/null +++ b/.config/nvim/templates/sh/err.sh @@ -0,0 +1,2 @@ +err() { printf '%s: %s\n' "$0" "$@" >&2; exit 1; } + diff --git a/.config/nvim/templates/sh/getopts.sh b/.config/nvim/templates/sh/getopts.sh new file mode 100644 index 0000000..9013ff9 --- /dev/null +++ b/.config/nvim/templates/sh/getopts.sh @@ -0,0 +1,6 @@ +while getopts 'h' o; do case "$o" in + h) help >&2; exit ;; + *) err "invalid option -- '$OPTARG'" ;; +esac done +shift $((OPTIND - 1)) + diff --git a/.config/nvim/templates/sh/help.sh b/.config/nvim/templates/sh/help.sh new file mode 100644 index 0000000..953de68 --- /dev/null +++ b/.config/nvim/templates/sh/help.sh @@ -0,0 +1,10 @@ +help() { echo "<++> - + +USAGE: + <++> [OPTION]... + +OPTIONS: + -h show this help message"; } + +[ "$#" -lt 1 ] && help >&2 && exit 1 + diff --git a/.config/nvim/user/coc-onload.vim b/.config/nvim/user/coc-onload.vim deleted file mode 100644 index b3db607..0000000 --- a/.config/nvim/user/coc-onload.vim +++ /dev/null @@ -1,147 +0,0 @@ - -" May need for Vim (not Neovim) since coc.nvim calculates byte offset by count -" utf-8 byte sequence -set encoding=utf-8 -" Some servers have issues with backup files, see #649 -set nobackup -set nowritebackup - -" Having longer updatetime (default is 4000 ms = 4s) leads to noticeable -" delays and poor user experience -set updatetime=1000 - -" Always show the signcolumn, otherwise it would shift the text each time -" diagnostics appear/become resolved -set signcolumn=yes - -" Use tab for trigger completion with characters ahead and navigate -" NOTE: There's always complete item selected by default, you may want to enable -" no select by `"suggest.noselect": true` in your configuration file -" NOTE: Use command ':verbose imap ' to make sure tab is not mapped by -" other plugin before putting this into your config - inoremap - \ coc#pum#visible() ? coc#pum#next(1) : - \ CheckBackspace() ? "\" : - \ coc#refresh() - inoremap coc#pum#visible() ? coc#pum#prev(1) : "\" - -" Make to accept selected completion item or notify coc.nvim to format -" u breaks current undo, please make your own choice -inoremap coc#pum#visible() ? coc#pum#confirm() - \: "\u\\=coc#on_enter()\" - -function! CheckBackspace() abort - let col = col('.') - 1 - return !col || getline('.')[col - 1] =~# '\s' -endfunction - -" Use to trigger completion -if has('nvim') - inoremap coc#refresh() -else - inoremap coc#refresh() -endif - -" Use `[g` and `]g` to navigate diagnostics -" Use `:CocDiagnostics` to get all diagnostics of current buffer in location list -nmap [g (coc-diagnostic-prev) -nmap ]g (coc-diagnostic-next) - -" GoTo code navigation -nmap gd (coc-definition) -nmap gy (coc-type-definition) -nmap gi (coc-implementation) -nmap gr (coc-references) - -" Override neovim's builtin referencing -nmap grr (coc-references) - -" Use K to show documentation in preview window -nnoremap :call ShowDocumentation() - -function! ShowDocumentation() - if CocAction('hasProvider', 'hover') - call CocActionAsync('doHover') - else - call feedkeys('K', 'in') - endif -endfunction - -" Highlight the symbol and its references when holding the cursor -autocmd CursorHold * silent call CocActionAsync('highlight') - -" Symbol renaming -nmap rn (coc-rename) - -" Formatting selected code -xmap cf (coc-format-selected) -nmap cf (coc-format-selected) - -augroup mygroup - autocmd! - " Setup formatexpr specified filetype(s) - autocmd FileType typescript,json setl formatexpr=CocAction('formatSelected') - " Update signature help on jump placeholder - autocmd User CocJumpPlaceholder call CocActionAsync('showSignatureHelp') -augroup end - -" Applying code actions to the selected code block -" Example: `aap` for current paragraph -xmap aa (coc-codeaction-selected) -nmap aa (coc-codeaction-selected) - -" Remap keys for applying code actions at the cursor position -nmap ac (coc-codeaction-cursor) -" Remap keys for apply code actions affect whole buffer -nmap as (coc-codeaction-source) -" Apply the most preferred quickfix action to fix diagnostic on the current line -nmap aq (coc-fix-current) - -" Remap keys for applying refactor code actions -nmap re (coc-codeaction-refactor) -xmap r (coc-codeaction-refactor-selected) -nmap r (coc-codeaction-refactor-selected) - -" Run the Code Lens action on the current line -nmap cl (coc-codelens-action) - -" Map function and class text objects -" NOTE: Requires 'textDocument.documentSymbol' support from the language server -xmap if (coc-funcobj-i) -omap if (coc-funcobj-i) -xmap af (coc-funcobj-a) -omap af (coc-funcobj-a) -xmap ic (coc-classobj-i) -omap ic (coc-classobj-i) -xmap ac (coc-classobj-a) -omap ac (coc-classobj-a) - -" Remap and to scroll float windows/popups -if has('nvim-0.4.0') || has('patch-8.2.0750') - nnoremap coc#float#has_scroll() ? coc#float#scroll(1) : "\" - nnoremap coc#float#has_scroll() ? coc#float#scroll(0) : "\" - inoremap coc#float#has_scroll() ? "\=coc#float#scroll(1)\" : "\" - inoremap coc#float#has_scroll() ? "\=coc#float#scroll(0)\" : "\" - vnoremap coc#float#has_scroll() ? coc#float#scroll(1) : "\" - vnoremap coc#float#has_scroll() ? coc#float#scroll(0) : "\" -endif - -" Use CTRL-S for selections ranges -" Requires 'textDocument/selectionRange' support of language server -nmap (coc-range-select) -xmap (coc-range-select) - -" Add `:Format` command to format current buffer -command! -nargs=0 Format :call CocActionAsync('format') - -" Add `:Fold` command to fold current buffer -command! -nargs=? Fold :call CocAction('fold', ) - -" Add `:OR` command for organize imports of the current buffer -command! -nargs=0 OR :call CocActionAsync('runCommand', 'editor.action.organizeImport') - -" Add (Neo)Vim's native statusline support -" NOTE: Please see `:h coc-status` for integrations with external plugins that -" provide custom statusline: lightline.vim, vim-airline -set statusline^=%{coc#status()}%{get(b:,'coc_current_function','')} - diff --git a/.config/nvim/user/coc-settings.json b/.config/nvim/user/coc-settings.json deleted file mode 100644 index 437572d..0000000 --- a/.config/nvim/user/coc-settings.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "suggest.autoTrigger": "always", - "diagnostic.enable": true, - "python.linting.pycodestyleEnabled": true, - "html.autoCreateQuotes": false, - "coc.preferences.formatOnType": true, - "copilot.showRemainingText": true, - "copilot.enable": false, - "typescript.autoClosingTags": false -} diff --git a/.config/nvim/user/fzf.vim b/.config/nvim/user/fzf.vim deleted file mode 100644 index 371b680..0000000 --- a/.config/nvim/user/fzf.vim +++ /dev/null @@ -1,19 +0,0 @@ -" --> Fzf -let g:fzf_layout = { 'window': { 'width': 1, 'height': 1 } } -command! -bang -nargs=? -complete=dir Files - \ call fzf#vim#files(, {'options': ['--info=inline', '--preview', 'preview {}']}, 0) - -" Mapping selecting mappings -nmap (fzf-maps-n) -xmap (fzf-maps-x) -omap (fzf-maps-o) - -" Insert mode completion -imap (fzf-complete-word) -imap (fzf-complete-path) -imap (fzf-complete-line) - -" Fzf keybindings -nnoremap ff :Files -nnoremap f. :Files %:p:h - diff --git a/.config/nvim/user/onedark.vim b/.config/nvim/user/onedark.vim deleted file mode 100644 index 6f526bd..0000000 --- a/.config/nvim/user/onedark.vim +++ /dev/null @@ -1,38 +0,0 @@ -" --> Onedark Theme -if exists('+termguicolors') - let g:airline_theme = 'onedark' - let g:onedark_terminal_italics = 1 - let g:onedark_color_overrides = { - \ "foreground": { "gui": "#BBC2CF", "cterm": "145", "cterm16": "NONE" }, - \ "background": { "gui": "#181C24", "cterm": "235", "cterm16": "NONE" }, - \ "comment_grey": { "gui": "#6C7380", "cterm": "59", "cterm16": "7" }, - \ "gutter_fg_grey": { "gui": "#6272A4", "cterm": "238", "cterm16": "8" }, - \ "special_grey": { "gui": "#5Ba078", "cterm": "238", "cterm16": "7" }, - \ } - " \ "background": { "gui": "#202426", "cterm": "235", "cterm16": "NONE" }, - " - " \ "red": { "gui": "#E06C75", "cterm": "204", "cterm16": "1" }, - " \ "dark_red": { "gui": "#BE5046", "cterm": "196", "cterm16": "9" }, - " \ "green": { "gui": "#98C379", "cterm": "114", "cterm16": "2" }, - " \ "yellow": { "gui": "#E5C07B", "cterm": "180", "cterm16": "3" }, - " \ "dark_yellow": { "gui": "#D19A66", "cterm": "173", "cterm16": "11" }, - " \ "blue": { "gui": "#61AFEF", "cterm": "39", "cterm16": "4" }, - " \ "purple": { "gui": "#C678DD", "cterm": "170", "cterm16": "5" }, - " \ "cyan": { "gui": "#56B6C2", "cterm": "38", "cterm16": "6" }, - " \ "black": { "gui": "#282C34", "cterm": "235", "cterm16": "0" }, - " \ "white": { "gui": "#ABB2BF", "cterm": "145", "cterm16": "15" }, - " \ "cursor_grey": { "gui": "#2C323C", "cterm": "236", "cterm16": "0" }, - " \ "visual_grey": { "gui": "#3E4452", "cterm": "237", "cterm16": "8" }, - " \ "menu_grey": { "gui": "#3E4452", "cterm": "237", "cterm16": "7" }, - " \ "vertsplit": { "gui": "#3E4452", "cterm": "59", "cterm16": "7" }, - - " autocmd ColorScheme * call onedark#extend_highlight("LineNr", { - " \ "fg": { "gui": "#6272A4", "cterm": "238", "cterm16": "8" }, - " \ }) - let &t_8f="\[38;2;%lu;%lu;%lum" - let &t_8b="\[48;2;%lu;%lu;%lum" - " set termguicolors noshowmode - colorscheme onedark - " autocmd VimEnter * AirlineTheme -endif - diff --git a/.config/nvim/user/out.vim b/.config/nvim/user/out.vim deleted file mode 100644 index 6e4e1f1..0000000 --- a/.config/nvim/user/out.vim +++ /dev/null @@ -1,36 +0,0 @@ -" capture (dump) the (somewhat long) ouput of the commands like `:digraph`, `:map', `:highlight`, `:scripnames` etc. - -function! s:dump(cmd) abort - - " Start a new split or maybe a buffer or a tab - " enew | " open a new buffer - 10split | enew | " open a new split (with 10% height (?)) - " tabnew | " open a new tab - - " Make it a scratch buffer ( `:help special-buffers`) - setlocal - \ bufhidden=wipe - \ buftype=nofile - \ nobuflisted - \ nolist - \ noswapfile - \ norelativenumber - \ nonumber - - " Write the cmd output to the buffer - put =execute(a:cmd) - " There are 2 empty line at the beginning of the buffer before the ouput of - " the cmd. Not sure from where they are comning from. Anyhow I will delete - " them. - norm gg2dd - - " No modifications to this buffer - setlocal readonly nomodifiable nomodified - - " Press escape to close when you're done - nnoremap :bd - -endfunction - -" Define a command to use the function easier -command! -nargs=1 Dump execute "call s:dump(" string() ")" diff --git a/.config/nvim/user/vimspector.vim b/.config/nvim/user/vimspector.vim deleted file mode 100644 index 521e252..0000000 --- a/.config/nvim/user/vimspector.vim +++ /dev/null @@ -1,21 +0,0 @@ -" --> Vimspector -let g:vimspector_base_dir = expand('$HOME/.local/share/nvim/vimspector') -let g:vimspector_enable_mappings = 'HUMAN' -nnoremap dc VimspectorContinue -nnoremap ds VimspectorStop -nnoremap dr VimspectorRestart -nnoremap dp VimspectorPause -nnoremap dl VimspectorBreakpoints -nnoremap dd VimspectorToggleBreakpoint -nnoremap db VimspectorToggleConditionalBreakpoint -nnoremap df VimspectorAddFunctionBreakpoint -nnoremap dg VimspectorGoToCurrentLine -nnoremap dx :call vimspector#ClearBreakpoints() -nnoremap dq :VimspectorReset -nnoremap VimspectorContinue -nnoremap VimspectorStepOver -nnoremap VimspectorStepInto -nnoremap VimspectorStepOut -nnoremap VimspectorToggleBreakpoint -nnoremap VimspectorRunToCursor - diff --git a/.config/nvim/user/zeal.vim b/.config/nvim/user/zeal.vim deleted file mode 100644 index 1b2734f..0000000 --- a/.config/nvim/user/zeal.vim +++ /dev/null @@ -1,7 +0,0 @@ -" --> Zeal docs -let g:zv_disable_mapping = 1 -nmap z Zeavim -vmap z ZVVisSelection -nmap gz ZVOperator -nmap z ZVKeyDocset - -- cgit v1.2.3