summaryrefslogtreecommitdiff
path: root/.config/nvim/plugins.conf.d
diff options
context:
space:
mode:
Diffstat (limited to '.config/nvim/plugins.conf.d')
-rw-r--r--.config/nvim/plugins.conf.d/coc-onload.vim147
-rw-r--r--.config/nvim/plugins.conf.d/coc-settings.json10
-rw-r--r--.config/nvim/plugins.conf.d/fzf.vim23
-rw-r--r--.config/nvim/plugins.conf.d/onedark.vim38
-rw-r--r--.config/nvim/plugins.conf.d/out.vim36
-rw-r--r--.config/nvim/plugins.conf.d/vimspector.vim21
-rw-r--r--.config/nvim/plugins.conf.d/zeal.vim7
7 files changed, 282 insertions, 0 deletions
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 <tab>' to make sure tab is not mapped by
+" other plugin before putting this into your config
+ inoremap <silent><expr> <TAB>
+ \ coc#pum#visible() ? coc#pum#next(1) :
+ \ CheckBackspace() ? "\<Tab>" :
+ \ coc#refresh()
+ inoremap <expr><S-TAB> coc#pum#visible() ? coc#pum#prev(1) : "\<C-h>"
+
+" Make <CR> to accept selected completion item or notify coc.nvim to format
+" <C-g>u breaks current undo, please make your own choice
+inoremap <silent><expr> <CR> coc#pum#visible() ? coc#pum#confirm()
+ \: "\<C-g>u\<CR>\<c-r>=coc#on_enter()\<CR>"
+
+function! CheckBackspace() abort
+ let col = col('.') - 1
+ return !col || getline('.')[col - 1] =~# '\s'
+endfunction
+
+" Use <c-space> to trigger completion
+if has('nvim')
+ inoremap <silent><expr> <c-space> coc#refresh()
+else
+ inoremap <silent><expr> <c-@> coc#refresh()
+endif
+
+" Use `[g` and `]g` to navigate diagnostics
+" Use `:CocDiagnostics` to get all diagnostics of current buffer in location list
+nmap <silent> [g <Plug>(coc-diagnostic-prev)
+nmap <silent> ]g <Plug>(coc-diagnostic-next)
+
+" GoTo code navigation
+nmap <silent> gd <Plug>(coc-definition)
+nmap <silent> gy <Plug>(coc-type-definition)
+nmap <silent> gi <Plug>(coc-implementation)
+nmap <silent> gr <Plug>(coc-references)
+
+" Override neovim's builtin referencing
+nmap <silent> grr <Plug>(coc-references)
+
+" Use K to show documentation in preview window
+nnoremap <silent> <C-k> :call ShowDocumentation()<CR>
+
+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 <leader>rn <Plug>(coc-rename)
+
+" Formatting selected code
+xmap <leader>cf <Plug>(coc-format-selected)
+nmap <leader>cf <Plug>(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: `<leader>aap` for current paragraph
+xmap <leader>aa <Plug>(coc-codeaction-selected)
+nmap <leader>aa <Plug>(coc-codeaction-selected)
+
+" Remap keys for applying code actions at the cursor position
+nmap <leader>ac <Plug>(coc-codeaction-cursor)
+" Remap keys for apply code actions affect whole buffer
+nmap <leader>as <Plug>(coc-codeaction-source)
+" Apply the most preferred quickfix action to fix diagnostic on the current line
+nmap <leader>aq <Plug>(coc-fix-current)
+
+" Remap keys for applying refactor code actions
+nmap <silent> <leader>re <Plug>(coc-codeaction-refactor)
+xmap <silent> <leader>r <Plug>(coc-codeaction-refactor-selected)
+nmap <silent> <leader>r <Plug>(coc-codeaction-refactor-selected)
+
+" Run the Code Lens action on the current line
+nmap <leader>cl <Plug>(coc-codelens-action)
+
+" Map function and class text objects
+" NOTE: Requires 'textDocument.documentSymbol' support from the language server
+xmap if <Plug>(coc-funcobj-i)
+omap if <Plug>(coc-funcobj-i)
+xmap af <Plug>(coc-funcobj-a)
+omap af <Plug>(coc-funcobj-a)
+xmap ic <Plug>(coc-classobj-i)
+omap ic <Plug>(coc-classobj-i)
+xmap ac <Plug>(coc-classobj-a)
+omap ac <Plug>(coc-classobj-a)
+
+" Remap <C-f> and <C-b> to scroll float windows/popups
+if has('nvim-0.4.0') || has('patch-8.2.0750')
+ nnoremap <silent><nowait><expr> <C-f> coc#float#has_scroll() ? coc#float#scroll(1) : "\<C-f>"
+ nnoremap <silent><nowait><expr> <C-b> coc#float#has_scroll() ? coc#float#scroll(0) : "\<C-b>"
+ inoremap <silent><nowait><expr> <C-f> coc#float#has_scroll() ? "\<c-r>=coc#float#scroll(1)\<cr>" : "\<Right>"
+ inoremap <silent><nowait><expr> <C-b> coc#float#has_scroll() ? "\<c-r>=coc#float#scroll(0)\<cr>" : "\<Left>"
+ vnoremap <silent><nowait><expr> <C-f> coc#float#has_scroll() ? coc#float#scroll(1) : "\<C-f>"
+ vnoremap <silent><nowait><expr> <C-b> coc#float#has_scroll() ? coc#float#scroll(0) : "\<C-b>"
+endif
+
+" Use CTRL-S for selections ranges
+" Requires 'textDocument/selectionRange' support of language server
+nmap <silent> <C-s> <Plug>(coc-range-select)
+xmap <silent> <C-s> <Plug>(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', <f-args>)
+
+" 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(<q-args>, {'options': ['--info=inline', '--preview', 'preview {}']}, <bang>0)
+
+" Mapping selecting mappings
+nmap <leader><tab> <plug>(fzf-maps-n)
+xmap <leader><tab> <plug>(fzf-maps-x)
+omap <leader><tab> <plug>(fzf-maps-o)
+
+" Insert mode completion
+imap <c-x><c-k> <plug>(fzf-complete-word)
+imap <c-x><c-f> <plug>(fzf-complete-path)
+imap <c-x><c-l> <plug>(fzf-complete-line)
+
+" Fzf keybindings
+nnoremap <leader>fh :History<CR>
+nnoremap <leader>ff :Files<CR>
+nnoremap <leader>f. :Files %:p:h<CR>
+
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="\<Esc>[38;2;%lu;%lu;%lum"
+ let &t_8b="\<Esc>[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 <buffer><silent> <Esc> :bd<CR>
+
+endfunction
+
+" Define a command to use the function easier
+command! -nargs=1 Dump execute "call s:dump(" string(<q-args>) ")"
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 <leader>dc <Plug>VimspectorContinue
+nnoremap <leader>ds <Plug>VimspectorStop
+nnoremap <leader>dr <Plug>VimspectorRestart
+nnoremap <leader>dp <Plug>VimspectorPause
+nnoremap <leader>dl <Plug>VimspectorBreakpoints
+nnoremap <leader>dd <Plug>VimspectorToggleBreakpoint
+nnoremap <leader>db <Plug>VimspectorToggleConditionalBreakpoint
+nnoremap <leader>df <Plug>VimspectorAddFunctionBreakpoint
+nnoremap <leader>dg <Plug>VimspectorGoToCurrentLine
+nnoremap <leader>dx :call vimspector#ClearBreakpoints()<CR>
+nnoremap <leader>dq :VimspectorReset<CR>
+nnoremap <A-C> <Plug>VimspectorContinue
+nnoremap <A-n> <Plug>VimspectorStepOver
+nnoremap <A-i> <Plug>VimspectorStepInto
+nnoremap <A-o> <Plug>VimspectorStepOut
+nnoremap <A-b> <Plug>VimspectorToggleBreakpoint
+nnoremap <A-c> <Plug>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 <leader>z <Plug>Zeavim
+vmap <leader>z <Plug>ZVVisSelection
+nmap gz <Plug>ZVOperator
+nmap <leader><leader>z <Plug>ZVKeyDocset
+