diff --git a/conf.d/nvim/coc.vim b/conf.d/nvim/coc.vim index fdc86ff..a084fb8 100644 --- a/conf.d/nvim/coc.vim +++ b/conf.d/nvim/coc.vim @@ -13,86 +13,96 @@ " """"""""""""""""""""" -" Use tab for trigger completion with characters ahead and navigate. +" 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. +" other plugin before putting this into your config inoremap - \ pumvisible() ? "\" : - \ check_back_space() ? "\" : + \ coc#pum#visible() ? coc#pum#next(1) : + \ CheckBackspace() ? "\" : \ coc#refresh() -inoremap pumvisible() ? "\" : "\" +inoremap coc#pum#visible() ? coc#pum#prev(1) : "\" -function! s:check_back_space() abort +" 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. +" Use to trigger completion if has('nvim') inoremap coc#refresh() else inoremap coc#refresh() endif -" Make auto-select the first completion item and notify coc.nvim to -" format on enter, could be remapped by other vim plugin -inoremap pumvisible() ? coc#_select_confirm() - \: "\u\\=coc#on_enter()\" - " Use `[g` and `]g` to navigate diagnostics -" Use `:CocDiagnostics` to get all diagnostics of current buffer in location list. +" 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. +" GoTo code navigation nmap gd (coc-definition) nmap gy (coc-type-definition) nmap gi (coc-implementation) nmap gr (coc-references) -" Use K to show documentation in preview window. -nnoremap K :call show_documentation() +" Use K to show documentation in preview window +nnoremap K :call ShowDocumentation() -function! s:show_documentation() - if (index(['vim','help'], &filetype) >= 0) - execute 'h '.expand('') - elseif (coc#rpc#ready()) +function! ShowDocumentation() + if CocAction('hasProvider', 'hover') call CocActionAsync('doHover') else - execute '!' . &keywordprg . " " . expand('') + call feedkeys('K', 'in') endif endfunction -" Highlight the symbol and its references when holding the cursor. +" Highlight the symbol and its references when holding the cursor autocmd CursorHold * silent call CocActionAsync('highlight') -" Symbol renaming. +" Symbol renaming nmap rn (coc-rename) -" Formatting selected code. +" Formatting selected code xmap f (coc-format-selected) nmap f (coc-format-selected) augroup mygroup autocmd! - " Setup formatexpr specified filetype(s). + " Setup formatexpr specified filetype(s) autocmd FileType typescript,json setl formatexpr=CocAction('formatSelected') - " Update signature help on jump placeholder. + " Update signature help on jump placeholder autocmd User CocJumpPlaceholder call CocActionAsync('showSignatureHelp') augroup end -" Applying codeAction to the selected region. +" Applying code actions to the selected code block " Example: `aap` for current paragraph xmap a (coc-codeaction-selected) nmap a (coc-codeaction-selected) -" Remap keys for applying codeAction to the current buffer. -nmap ac (coc-codeaction) -" Apply AutoFix to problem on the current line. +" 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 qf (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. +" NOTE: Requires 'textDocument.documentSymbol' support from the language server xmap if (coc-funcobj-i) omap if (coc-funcobj-i) xmap af (coc-funcobj-a) @@ -102,7 +112,7 @@ omap ic (coc-classobj-i) xmap ac (coc-classobj-a) omap ac (coc-classobj-a) -" Remap and for scroll float windows/popups. +" 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) : "\" @@ -112,41 +122,41 @@ if has('nvim-0.4.0') || has('patch-8.2.0750') vnoremap coc#float#has_scroll() ? coc#float#scroll(0) : "\" endif -" Use CTRL-S for selections ranges. -" Requires 'textDocument/selectionRange' support of language server. +" 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 CocAction('format') +" Add `:Format` command to format current buffer +command! -nargs=0 Format :call CocActionAsync('format') -" Add `:Fold` command to fold current buffer. +" 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 CocAction('runCommand', 'editor.action.organizeImport') +" 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. +" 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. +" provide custom statusline: lightline.vim, vim-airline set statusline^=%{coc#status()}%{get(b:,'coc_current_function','')} " Mappings for CoCList -" Show all diagnostics. +" Show all diagnostics nnoremap a :CocList diagnostics -" Manage extensions. +" Manage extensions nnoremap e :CocList extensions -" Show commands. +" Show commands nnoremap c :CocList commands -" Find symbol of current document. +" Find symbol of current document nnoremap o :CocList outline -" Search workspace symbols. +" Search workspace symbols nnoremap s :CocList -I symbols -" Do default action for next item. +" Do default action for next item nnoremap j :CocNext -" Do default action for previous item. +" Do default action for previous item nnoremap k :CocPrev -" Resume latest coc list. +" Resume latest coc list nnoremap p :CocListResume diff --git a/conf.d/nvim/dashboard.lua b/conf.d/nvim/dashboard.lua index a8252d3..c209562 100644 --- a/conf.d/nvim/dashboard.lua +++ b/conf.d/nvim/dashboard.lua @@ -30,29 +30,29 @@ local home = os.getenv('HOME') local db = require('dashboard') local dotfiles = '\'' .. home .. '/dotfiles\'' -db.preview_command = 'cat | lolcat -a' -db.preview_file_path = home .. '/.config/nvim/header1.cat' -db.preview_file_height = 20 -db.preview_file_width = 32 +-- db.preview_command = 'cat ' +-- db.preview_file_path = home .. '/.config/nvim/header1.cat' +-- db.preview_file_height = 20 +-- db.preview_file_width = 32 --- db.custom_header = { --- '', --- ' ⣿⣿⣷⡁⢆⠈⠕⢕⢂⢕⢂⢕⢂⢔⢂⢕⢄⠂⣂⠂⠆⢂⢕⢂⢕⢂⢕⢂⢕⢂ ', --- ' ⣿⣿⣿⡷⠊⡢⡹⣦⡑⢂⢕⢂⢕⢂⢕⢂⠕⠔⠌⠝⠛⠶⠶⢶⣦⣄⢂⢕⢂⢕ ', --- ' ⣿⣿⠏⣠⣾⣦⡐⢌⢿⣷⣦⣅⡑⠕⠡⠐⢿⠿⣛⠟⠛⠛⠛⠛⠡⢷⡈⢂⢕⢂ ', --- ' ⠟⣡⣾⣿⣿⣿⣿⣦⣑⠝⢿⣿⣿⣿⣿⣿⡵⢁⣤⣶⣶⣿⢿⢿⢿⡟⢻⣤⢑⢂ ', --- ' ⣾⣿⣿⡿⢟⣛⣻⣿⣿⣿⣦⣬⣙⣻⣿⣿⣷⣿⣿⢟⢝⢕⢕⢕⢕⢽⣿⣿⣷⣔ ', --- ' ⣿⣿⠵⠚⠉⢀⣀⣀⣈⣿⣿⣿⣿⣿⣿⣿⣿⣿⣗⢕⢕⢕⢕⢕⢕⣽⣿⣿⣿⣿ ', --- ' ⢷⣂⣠⣴⣾⡿⡿⡻⡻⣿⣿⣴⣿⣿⣿⣿⣿⣿⣷⣵⣵⣵⣷⣿⣿⣿⣿⣿⣿⡿ ', --- ' ⢌⠻⣿⡿⡫⡪⡪⡪⡪⣺⣿⣿⣿⣿⣿⠿⠿⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠃ ', --- ' ⠣⡁⠹⡪⡪⡪⡪⣪⣾⣿⣿⣿⣿⠋⠐⢉⢍⢄⢌⠻⣿⣿⣿⣿⣿⣿⣿⣿⠏⠈ ', --- ' ⡣⡘⢄⠙⣾⣾⣾⣿⣿⣿⣿⣿⣿⡀⢐⢕⢕⢕⢕⢕⡘⣿⣿⣿⣿⣿⣿⠏⠠⠈ ', --- ' ⠌⢊⢂⢣⠹⣿⣿⣿⣿⣿⣿⣿⣿⣧⢐⢕⢕⢕⢕⢕⢅⣿⣿⣿⣿⡿⢋⢜⠠⠈ ', --- ' ⠄⠁⠕⢝⡢⠈⠻⣿⣿⣿⣿⣿⣿⣿⣷⣕⣑⣑⣑⣵⣿⣿⣿⡿⢋⢔⢕⣿⠠⠈ ', --- ' ⠨⡂⡀⢑⢕⡅⠂⠄⠉⠛⠻⠿⢿⣿⣿⣿⣿⣿⣿⣿⣿⡿⢋⢔⢕⢕⣿⣿⠠⠈ ', --- ' ⠄⠪⣂⠁⢕⠆⠄⠂⠄⠁⡀⠂⡀⠄⢈⠉⢍⢛⢛⢛⢋⢔⢕⢕⢕⣽⣿⣿⠠⠈ ', --- '', --- } +db.custom_header = { + '', + ' ⣿⣿⣷⡁⢆⠈⠕⢕⢂⢕⢂⢕⢂⢔⢂⢕⢄⠂⣂⠂⠆⢂⢕⢂⢕⢂⢕⢂⢕⢂ ', + ' ⣿⣿⣿⡷⠊⡢⡹⣦⡑⢂⢕⢂⢕⢂⢕⢂⠕⠔⠌⠝⠛⠶⠶⢶⣦⣄⢂⢕⢂⢕ ', + ' ⣿⣿⠏⣠⣾⣦⡐⢌⢿⣷⣦⣅⡑⠕⠡⠐⢿⠿⣛⠟⠛⠛⠛⠛⠡⢷⡈⢂⢕⢂ ', + ' ⠟⣡⣾⣿⣿⣿⣿⣦⣑⠝⢿⣿⣿⣿⣿⣿⡵⢁⣤⣶⣶⣿⢿⢿⢿⡟⢻⣤⢑⢂ ', + ' ⣾⣿⣿⡿⢟⣛⣻⣿⣿⣿⣦⣬⣙⣻⣿⣿⣷⣿⣿⢟⢝⢕⢕⢕⢕⢽⣿⣿⣷⣔ ', + ' ⣿⣿⠵⠚⠉⢀⣀⣀⣈⣿⣿⣿⣿⣿⣿⣿⣿⣿⣗⢕⢕⢕⢕⢕⢕⣽⣿⣿⣿⣿ ', + ' ⢷⣂⣠⣴⣾⡿⡿⡻⡻⣿⣿⣴⣿⣿⣿⣿⣿⣿⣷⣵⣵⣵⣷⣿⣿⣿⣿⣿⣿⡿ ', + ' ⢌⠻⣿⡿⡫⡪⡪⡪⡪⣺⣿⣿⣿⣿⣿⠿⠿⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠃ ', + ' ⠣⡁⠹⡪⡪⡪⡪⣪⣾⣿⣿⣿⣿⠋⠐⢉⢍⢄⢌⠻⣿⣿⣿⣿⣿⣿⣿⣿⠏⠈ ', + ' ⡣⡘⢄⠙⣾⣾⣾⣿⣿⣿⣿⣿⣿⡀⢐⢕⢕⢕⢕⢕⡘⣿⣿⣿⣿⣿⣿⠏⠠⠈ ', + ' ⠌⢊⢂⢣⠹⣿⣿⣿⣿⣿⣿⣿⣿⣧⢐⢕⢕⢕⢕⢕⢅⣿⣿⣿⣿⡿⢋⢜⠠⠈ ', + ' ⠄⠁⠕⢝⡢⠈⠻⣿⣿⣿⣿⣿⣿⣿⣷⣕⣑⣑⣑⣵⣿⣿⣿⡿⢋⢔⢕⣿⠠⠈ ', + ' ⠨⡂⡀⢑⢕⡅⠂⠄⠉⠛⠻⠿⢿⣿⣿⣿⣿⣿⣿⣿⣿⡿⢋⢔⢕⢕⣿⣿⠠⠈ ', + ' ⠄⠪⣂⠁⢕⠆⠄⠂⠄⠁⡀⠂⡀⠄⢈⠉⢍⢛⢛⢛⢋⢔⢕⢕⢕⣽⣿⣿⠠⠈ ', + '', +} db.custom_center = { { diff --git a/conf.d/nvim/ddc.vim b/conf.d/nvim/ddc.vim index 6a161a9..123703b 100644 --- a/conf.d/nvim/ddc.vim +++ b/conf.d/nvim/ddc.vim @@ -1,4 +1,10 @@ " Customize global settings + +" You must set the default ui. +" Note: native ui +" https://github.com/Shougo/ddc-ui-native" +call ddc#custom#patch_global('ui', 'native') + " Use around source. " https://github.com/Shougo/ddc-around call ddc#custom#patch_global('sources', ['around']) @@ -30,7 +36,6 @@ call ddc#custom#patch_filetype('markdown', 'sourceParams', { \ }) " Mappings - " : completion. inoremap \ ddc#map#pum_visible() ? '' : @@ -42,3 +47,6 @@ inoremap ddc#map#pum_visible() ? '' : '' " Use ddc. call ddc#enable() + + +" vim:ft=vim diff --git a/conf.d/nvim/init.vim b/conf.d/nvim/init.vim index a601aef..f4744bf 100644 --- a/conf.d/nvim/init.vim +++ b/conf.d/nvim/init.vim @@ -1,7 +1,7 @@ " File : init.vim " Author : Jeff LANCE " Date : 15.04.2015 -" Last Modified Date: 17.11.2021 +" Last Modified Date: 01.09.2022 " Last Modified By : Jeff LANCE """""""""""""""""""""""""""""""""""""""""""""" @@ -305,17 +305,6 @@ autocmd VimEnter * " \ | Dashboard \ | endif -" " needed so deoplete can auto select the first suggestion -" set completeopt+=noinsert -" " comment this line to enable autocompletion preview window -" " (displays documentation related to the selected completion option) -" " disabled by default because preview makes the window flicker -" set completeopt-=preview - -" " autocompletion of files and commands behaves like shell -" " (complete only the common part, list the options that match) -" " set wildmode=list:longest - """"""""""""""""""""""""""""""""""""""""""""""""""""""""""" @@ -449,7 +438,6 @@ let g:colorizer_auto_filetype='css,html,xml,py,js' " Commentary {{{ " ----- -" autocmd FileType toml setlocal commentstring=#\ %s @@ -653,6 +641,14 @@ let g:python3_host_prog = '/usr/bin/python3' " }}} +" Noice {{{ +" ----- + +lua require("noice").setup() + +" ----- +" }}} + " OCaml {{{ " ----- @@ -667,6 +663,15 @@ set rtp^="/home/jeff/.opam/default/share/ocp-indent/vim" " }}} +" Pum {{{ +" ----- + +source ${HOME}/.config/nvim/pum.vim + +" ----- +" }}} + + " Slime {{{ " ----- let g:slime_target = "tmux" @@ -760,18 +765,24 @@ let g:tex_flavor = 'latex' " }}} +" Vimwiki {{{ +" ----- -""""""""""""""""""""""""""""""""""""""""""""""""" -" ____ _____ _ ____ _____ ___ _______ __ -" / ___|_ _|/ \ | _ \_ _|_ _| ___\ \ / / -" \___ \ | | / _ \ | |_) || | | || |_ \ V / -" ___) || |/ ___ \| _ < | | | || _| | | -" |____/ |_/_/ \_\_| \_\|_| |___|_| |_| -" -""""""""""""""""""""""""""""""""""""""""""""""""" +let g:vimwiki_list = [{ + \ 'path': '~/Projets/web/www.jefflance.me/posts/', + \ 'auto_export': 1, + \ 'automatic_nested_syntaxes': 1, + \ 'path_html': '/home/jeff/Projets/web/www.jefflance.me/posts/', + \ 'nested_syntaxes': {'python': 'python', 'c++': 'cpp'}, + \ 'syntax': 'media', + \ 'ext': '.wiki', + \ 'custom_wiki2html': '/home/jeff/bin/web/nikola_build.sh', + \ 'html_filename_parameterization': 1, +\ }] -" Load functions from file -" source ${HOME}/.config/nvim/startscreen.vim +" /home/jeff/.local/bin/vimwiki_markdown +" ----- +" }}} diff --git a/conf.d/nvim/keybindings.vim b/conf.d/nvim/keybindings.vim index a8a1110..bd9d7a1 100644 --- a/conf.d/nvim/keybindings.vim +++ b/conf.d/nvim/keybindings.vim @@ -16,6 +16,9 @@ " Custom {{{ " ----- +" For COC +verbose imap + " Disable highlights when you press : map :noh @@ -29,12 +32,6 @@ map s :echom 'Source file' :so % map ; map! ; -" Open a current file with sudo -" map E :e suda://% - -" Save a current file with sudo -" map W :w suda://% - " Comment the target of a motion map / :Commentary @@ -43,7 +40,7 @@ map >> map << " (Re|Un)do -map uu +" map uu " Save as map :saveas diff --git a/conf.d/nvim/plug.vim b/conf.d/nvim/plug.vim index a9307aa..b2bd278 100644 --- a/conf.d/nvim/plug.vim +++ b/conf.d/nvim/plug.vim @@ -45,9 +45,11 @@ Plug 'glepnir/dashboard-nvim' Plug 'vim-denops/denops.vim' Plug 'Shougo/ddc.vim' Plug 'Shougo/ddu.vim' -Plug 'Shougo/ddc-around' +Plug 'Shougo/ddc-ui-native' +Plug 'Shougo/ddc-source-around' Plug 'Shougo/ddc-matcher_head' Plug 'Shougo/ddc-sorter_rank' +Plug 'Shougo/pum.vim' " Buffer exploration Plug 'bagrat/vim-buffet', { 'as': 'buffet' } @@ -56,6 +58,10 @@ Plug 'bagrat/vim-buffet', { 'as': 'buffet' } Plug 'nvim-lua/plenary.nvim' Plug 'nvim-telescope/telescope.nvim', { 'tag': '0.1.0' } +" Noice +Plug 'folke/noice.nvim' +Plug 'MunifTanjim/nui.nvim' + " Devicons Plug 'kyazdani42/nvim-web-devicons' @@ -65,6 +71,9 @@ Plug 'pearofducks/ansible-vim' " Artify Plug 'delphinus/artify.nvim' +" Diagram syntax +Plug 'zhaozg/vim-diagram' + " Editorconfig Plug 'editorconfig/editorconfig-vim' @@ -159,8 +168,8 @@ Plug 'jupyter-vim/jupyter-vim' " indentLine Plug 'Yggdroot/indentLine' -" " Mermaid diagram -" Plug 'zhaozg/vim-diagram' +" vim-wiki +Plug 'vimwiki/vimwiki' " Required {{{ " ----- diff --git a/conf.d/nvim/pum.vim b/conf.d/nvim/pum.vim new file mode 100644 index 0000000..08a8591 --- /dev/null +++ b/conf.d/nvim/pum.vim @@ -0,0 +1,30 @@ +" File : pum.vim +" Author : Jeff LANCE +" Date : 02.01.2023 +" Last Modified Date: 02.01.2023 +" Last Modified By : Jeff LANCE + +""""""""""""""""""""""""""" +" ____ __ ____ ___ +" / __ \/ / / / |/ / +" / /_/ / / / / /|_/ / +" / ____/ /_/ / / / / +" /_/ \____/_/ /_/ +" +""""""""""""""""""""""""""" + +" General {{{ +" ----- + +inoremap call pum#map#insert_relative(+1) +inoremap call pum#map#insert_relative(-1) +inoremap call pum#map#confirm() +inoremap call pum#map#cancel() +inoremap call pum#map#insert_relative_page(+1) +inoremap call pum#map#insert_relative_page(-1) + +" ----- +" }}} + + +" vim:ft=vim