plugin alternatives

autocompletion

language server protocol

[!NOTE]

ctrl-p

snippets

cryptmethod

comments

highly recommended

[!NOTE|label:references:]

LunarWatcher/auto-pairs

" LunarWatcher/auto-pairs
let g:AutoPairs                             = autopairs#AutoPairsDefine({ '<': '>' })
let g:AutoPairsMapBS                        = 1
let g:AutoPairsFlyMode                      = 0
let g:AutoPairsCompleteOnlyOnSpace          = 1
let g:AutoPairsNoJump                       = 0
let g:AutoPairsSpaceCompletionRegex         = '\w'
" to avoid impact with ctrl-p ( :Files )
let g:AutoPairsShortcutToggleMultilineClose = 0
let g:AutoPairsShortcutBackInsert           = '<M-b>'
let g:AutoPairsPrefix                       = '<M-j>'
let g:AutoPairsShortcutJump                 = '<M-n>'
let g:AutoPairsShortcutToggle               = '<M-j>'

augroup DevOps
  autocmd FileType markdown,html let g:AutoPairsCompleteOnlyOnSpace = 0
  autocmd FileType markdown,html let b:AutoPairs = autopairs#AutoPairsDefine({
        \ '<div>':'</div>', '<font>':'</font>', '<a>':'</a>', '<p>':'</p>',
        \ '<table>':'</table>', '<tbody>':'</tbody>',
        \ '<thread>':'</thread>', '<th>':'</th>', '<td>':'</td>'
        \ })
augroup END
vim auto-pairs
1.3.4.1 -- vim auto-pairs

junegunn/fzf.vim

set runtimepath+=/usr/local/opt/fzf                                         " $ brew install fzf
Plug '/usr/local/opt/fzf'
Plug 'junegunn/fzf.vim'

" fzf.vim
nnoremap <C-p> :Files<CR>
nnoremap <C-g> :GFiles<CR>
nnoremap <C-s> :Ag<CR>
nnoremap <silent><leader>l  :Buffers<CR>
nnoremap <silent> <Leader>H :Helptags<CR>
nnoremap <silent> <Leader>g :Commits<CR>
let g:fzf_layout                  = { 'window': { 'width': 0.9, 'height': 0.6, 'relative': v:true } }
let g:fzf_history_dir             = '~/.vim/cache/fzf-history'
let g:fzf_vim                     = {}
let g:fzf_vim.preview_window      = [ 'right,50%', 'ctrl-\' ]
let g:fzf_vim.tags_command        = 'ctags -R'
let g:fzf_vim.commits_log_options = '--graph --color=always --format="%C(auto)%h%d %s %C(black)%C(bold)%cr"'
command! -bang -nargs=? -complete=dir Files
    \ call fzf#vim#files(<q-args>, {'options': ['--layout=reverse', '--info=inline', '--preview', 'bat --color=always {}']}, <bang>0)
command! -bang -complete=dir -nargs=? LS
    \ call fzf#run(fzf#wrap('ls', {'source': 'ls', 'dir': <q-args>}, <bang>0))
inoremap <expr> <c-x><c-l> fzf#vim#complete(fzf#wrap({
  \ 'prefix': '^.*$',
  \ 'source': 'rg -n ^ --color always',
  \ 'options': '--ansi --delimiter : --nth 3..',
  \ 'reducer': { lines -> join(split(lines[0], ':\zs')[2:], '') }}
  \ )
\ )
let g:fzf_action = {
  \ 'ctrl-t': 'tab split',
  \ 'ctrl-x': 'split',
  \ 'ctrl-v': 'vsplit'
\ }
let g:fzf_colors = {
  \ 'fg':         ['fg', 'Normal'],
  \ 'bg':         ['bg', 'Normal'],
  \ 'preview-bg': ['bg', 'NormalFloat'],
  \ 'hl':         ['fg', 'Comment'],
  \ 'fg+':        ['fg', 'CursorLine', 'CursorColumn', 'Normal'],
  \ 'bg+':        ['bg', 'CursorLine', 'CursorColumn'],
  \ 'hl+':        ['fg', 'Statement'],
  \ 'info':       ['fg', 'PreProc'],
  \ 'border':     ['fg', 'Ignore'],
  \ 'prompt':     ['fg', 'Conditional'],
  \ 'pointer':    ['fg', 'Exception'],
  \ 'marker':     ['fg', 'Keyword'],
  \ 'spinner':    ['fg', 'Label'],
  \ 'header':     ['fg', 'Comment']
\ }

luochen1990/rainbow

" install
Plug 'luochen1990/rainbow'

" luochen1990/rainbow
" for i in '75' '147' '108' '196' '208' '66' '106' '172' '115' '129'; do echo -e "\e[38;05;${i}m${i}"; done | column -c 250 -s ' '; echo -e "\e[m"
let g:rainbow_active    = 1
let g:rainbow_operators = 1
let g:rainbow_conf      = {
\   'guifgs' : [ '#6A5ACD', '#ff6347', '#b58900', '#9acd32', '#EEC900', '#9A32CD', '#EE7600', '#268bd2', '#183172' ],
\   'ctermfgs' : 'xterm-256color' == $TERM ? [ '75', '147', '108', '196', '208', '66', '106', '172', '115', '129' ] : [ 'lightblue', 'lightgreen', 'yellow', 'red', 'magenta' ],
\   'parentheses': [ ['(',')'], ['\[','\]'], ['{','}'], ['<', '>'] ],
\   'separately': {
\     '*': {},
\     'markdown': {
\       'parentheses_options': 'containedin=markdownCode contained',
\     },
\     'css': {
\       'parentheses': [ ['(',')'], ['\[','\]'] ],
\     },
\     'scss': {
\       'parentheses': [ ['(',')'], ['\[','\]'] ],
\     },
\     'html': {
\       'parentheses': [ ['(',')'], ['\[','\]'], ['{','}'], ['<', '>'] ],
\     },
\     'stylus': {
\       'parentheses': [ 'start=/{/ end=/}/ fold contains=@colorableGroup' ],
\     }
\   }
\}

Yggdroot/indentLine

" install
Plug 'Yggdroot/indentLine'

" settings
nnoremap <leader>idl :IndentLineEnable<CR>

let g:indentLine_enabled              = 1
let g:indentLine_color_gui            = "#282828"
let g:indentLine_color_term           = 239
let g:indentLine_indentLevel          = 20
let g:indentLine_showFirstIndentLevel = 1
let g:indentLine_color_tty            = 0
let g:indentLine_faster               = 1
let g:indentLine_concealcursor        = 'inc'
let g:indentLine_conceallevel         = 2
if has( 'gui_running' ) || 'xterm-256color' == $TERM
  let g:indentLine_char               = '¦'
elseif has( 'win32' )
  let g:indentLine_color_term         = 8
  let g:indentLine_char               = '|'
else
  let g:indentLine_color_tty_dark     = 0
  let g:indentLine_char               = '¦'
endif

airblade/vim-gitgutter

[!NOTE|label:references:]

Plug 'airblade/vim-gitgutter'

" airblade/vim-gitgutter
set updatetime=250
set signcolumn=yes
let g:gitgutter_git_executable = '/usr/local/bin/git'
let g:gitgutter_enabled        = 1
let g:gitgutter_realtime       = 0
let g:gitgutter_eager          = 0
highlight clear SignColumn

vim-airline/vim-airline

[!NOTE|label:references:]

Plug 'tpope/vim-fugitive'
Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes'

" vim-airline/vim-airline
let g:airline_powerline_fonts                      = 1
let g:airline_highlighting_cache                   = 1
let g:airline_detect_spelllang                     = 0              " disable spelling language
let g:airline_exclude_preview                      = 0              " disable in preview window
let g:airline_theme                                = 'base16_embers'" 'apprentice', 'base16', 'gruvbox', 'zenburn', 'base16_atelierheath'
let g:Powerline_symbols                            = 'fancy'
let g:airline_section_y                            = ''             " fileencoding
let g:airline_section_x                            = ''
let g:airline_section_z                            = "%3p%% %l/%L:%c [%B]"
let g:airline_skip_empty_sections                  = 1
let g:airline_detect_modified                      = 1
let g:airline_detect_paste                         = 1
let g:airline#extensions#wordcount#enabled         = 1
let g:airline#extensions#wordcount#filetypes       = '\vtext|nroff|plaintex'
let g:airline#extensions#quickfix#enabled          = 0
let g:airline#extensions#quickfix#quickfix_text    = 'Quickfix'
let g:airline_stl_path_style                       = 'short'
let g:airline#extensions#tabline#enabled           = 1              " ╮ enable airline tabline
let g:airline#extensions#tabline#fnamemod          = ':t'           " │
let g:airline#extensions#tabline#show_close_button = 0              " │ remove 'X' at the end of the tabline
let g:airline#extensions#tabline#show_buffers      = 1              " │
let g:airline#extensions#tabline#show_splits       = 0              " │ disables the buffer name that displays on the right of the tabline
let g:airline#extensions#tabline#tab_min_count     = 2              " │ minimum of 2 tabs needed to display the tabline
let g:airline#extensions#tabline#show_tabs         = 0              " │
let g:airline#extensions#tabline#tab_nr_type       = 1              " ╯ tab number
let g:airline#extensions#branch#format             = 2
let g:airline#extensions#fzf#enabled               = 1
let g:airline#extensions#nerdtree_statusline       = 1
let g:airline#extensions#syntastic#enabled         = 1
let g:airline#extensions#coc#enabled               = 1              " ╮
let g:airline#extensions#coc#show_coc_status       = 0              " │
let g:airline#extensions#coc#error_symbol          = ' ✗:'          " ├ coc
let g:airline#extensions#coc#warning_symbol        = ' ⍨:'          " │
let g:airline#extensions#coc#stl_format_err        = '%C(␊%L)'      " │
let g:airline#extensions#coc#stl_format_warn       = '%C(␊%L)'      " ╯
let g:airline#extensions#ale#enabled               = 0              " ╮
let g:airline#extensions#ale#error_symbol          = ' ᓆ :'         " │
let g:airline#extensions#ale#warning_symbol        = ' ᣍ :'         " ├ ale
let g:airline#extensions#ale#show_line_numbers     = 0              " │
let g:airline#extensions#ale#open_lnum_symbol      = '(␊:'          " │
let g:airline#extensions#ale#close_lnum_symbol     = ')'            " ╯
" let g:airline_mode_map                           = { '__': '-', 'n' : 'N', 'i' : 'I', 'R' : 'R', 'c' : 'C', 'v' : 'V', 'V' : 'V', '': 'V', 's' : 'S', 'S' : 'S', '': 'S', }
if !exists('g:airline_symbols') | let g:airline_symbols = {} | endif
let g:airline_symbols.dirty                        = ' ♪'
let g:airline_left_sep                             = ''
let g:airline_right_sep                            = ''
function! AirlineInit()
  let g:airline_section_a = airline#section#create([ '[', 'mode', ']' ])
  let g:airline_section_y = airline#section#create([ '%{strftime("%H:%M %b-%d %a")} ', '['.&ff.']' ])
  let g:airline_section_c = '%<' . airline#section#create([ '%F' ]) " let g:airline_section_c = '%<' . '%{expand(%:p:~)}'
endfunction
autocmd User AirlineAfterInit call AirlineInit()
airline + ale
1.3.4.2 -- airline + ale
  • tips

    • remove section_

      let g:airline_section_<x>         = ''                          " remove the filetype part
      let g:airline_skip_empty_sections = 1                           " remove separators for empty sections
      
    • setup short mode

      let g:airline_mode_map = { '__': '-', 'n' : 'N', 'i' : 'I', 'R' : 'R', 'c' : 'C', 'v' : 'V', 'V' : 'V', '': 'V', 's' : 'S', 'S' : 'S', '': 'S', }
      
    • unicode symbols

      [!NOTE|label:symbols]

      • :help airline

        " powerline symbols
        let g:airline_left_sep          = ''     " \ue0b0
        let g:airline_left_alt_sep      = ''     " \ue0b1
        let g:airline_right_sep         = ''     " \ue0b2
        let g:airline_right_alt_sep     = ''     " \ue0b3
        let g:airline_symbols.branch    = ''     " \ue0a0
        let g:airline_symbols.colnr     = ' ℅:'   " \u2105 \u3a
        let g:airline_symbols.readonly  = ''     " \ue0a2
        let g:airline_symbols.linenr    = ' :'   " \ue0a1
        let g:airline_symbols.maxlinenr = '☰ '    " \u2630
        let g:airline_symbols.dirty     = '⚡'    " \u26a1
        
        " old vim-powerline symbols
        let g:airline_left_sep          = '⮀'     " \u2b80
        let g:airline_left_alt_sep      = '⮁'     " \u2b81
        let g:airline_right_sep         = '⮂'     " \u2b82
        let g:airline_right_alt_sep     = '⮃'     " \u2b83
        let g:airline_symbols.branch    = '⭠'     " \u2b60
        let g:airline_symbols.readonly  = '⭤'     " \u2b64
        let g:airline_symbols.linenr    = '⭡'     " \u2b61
        
        " unicode symbols
        let g:airline_left_sep           = '»'    " \u00bb
        let g:airline_left_sep           = '▶'    " \u25b6
        let g:airline_right_sep          = '«'    " \u00ab
        let g:airline_right_sep          = '◀'    " \u25c0
        let g:airline_symbols.colnr      = ' ㏇:' " \u33C7
        let g:airline_symbols.colnr      = ' ℅:'  " \u2105
        let g:airline_symbols.crypt      = '🔒'   " \U0001f512
        let g:airline_symbols.linenr     = '☰'    " \u2630
        let g:airline_symbols.linenr     = ' ␊:'  " \u240a
        let g:airline_symbols.linenr     = ' 
        :'  " \u2424
        let g:airline_symbols.linenr     = '¶'    " \u00b6
        let g:airline_symbols.maxlinenr  = ''
        let g:airline_symbols.maxlinenr  = '㏑'   " \u33d1
        let g:airline_symbols.branch     = '⎇'    " \u2387
        let g:airline_symbols.paste      = 'ρ'    " \u03c1
        let g:airline_symbols.paste      = 'Þ'    " \u00de
        let g:airline_symbols.paste      = '∥'    " \u2225
        let g:airline_symbols.spell      = 'Ꞩ'    " \ua7a8
        let g:airline_symbols.notexists  = 'Ɇ'    " \u0246
        let g:airline_symbols.notexists  = '∄'    " \u2204
        let g:airline_symbols.whitespace = 'Ξ'    " \u039e
        
      • :help airline-customization

        " unicode symbols
        let g:airline_left_sep           = '»'
        let g:airline_left_sep           = '▶'
        let g:airline_right_sep          = '«'
        let g:airline_right_sep          = '◀'
        let g:airline_symbols.linenr     = '␊'
        let g:airline_symbols.linenr     = '
        '
        let g:airline_symbols.linenr     = '¶'
        let g:airline_symbols.branch     = '⎇'
        let g:airline_symbols.paste      = 'ρ'
        let g:airline_symbols.paste      = 'Þ'
        let g:airline_symbols.paste      = '∥'
        let g:airline_symbols.whitespace = 'Ξ'
        
      let g:airline_symbols.branch         = '⎇'                    " ╮
      let g:airline_symbols.paste          = 'ρ'                    " ├ unicode symbols
      let g:airline_symbols.dirty          = ' ↯'                   " ╯
      
    • get theme randomly

      [!NOTE]

      let g:airline_theme                  = 'random'
      

sections

[!NOTE|label:references:]

let g:airline_section_x                          = "%-{strftime(\"%H:%M\ %d/%m/%y\")} %1*--%n%%--%*"
let g:airline_section_y                          = "%{&fenc}%{&bomb ? '[bom]' : ''}%{strlen(&ff) > 0 ? '['.&ff.']' : ''}"
let g:airline#parts#ffenc#skip_expected_string   ='utf-8[unix]'
let g:airline_section_c_only_filename            = 0

function! AirlineInit()
  " NORMAL  docs/vim/
  let g:airline_section_a = airline#section#create([ 'mode', '  ', '%{join( split(getcwd(), "/")[-2:-1], "/" )}', '/' ])
  " NORMAL  docs/vim/plugins.md
  let g:airline_section_a = airline#section#create([ 'mode', '  ', '%{join( split(expand("%:p"), "/")[-3:-1], "/" )}' ])
  let g:airline_section_y = airline#section#create(['%{strftime("%H:%M %b-%d %a")} ', '['.&ff.']'])
  let g:airline_section_c = '%<' . airline#section#create(['%{expand("%:p:~")}'])
endfunction
autocmd User AirlineAfterInit call AirlineInit()
  • section_a

    [!NOTE|label:paths:]

    • show relative path %F : let g:airline_section_c = airline#section#create([ '%F' ]) -> ~/.vimrc
    • show filename only %f : let g:airline_section_c = airline#section#create([ '%f' ]) -> .vimrc
    section_a with default mode
    1.3.4.3 -- section_a with default mode
    section_a with short mode
    1.3.4.4 -- section_a with short mode
    • via function

      function! ShortPath()
        let pathlist=split(expand("%:p:~"), "/")
        return len(pathlist) < 3 ? join( pathlist[-2:-1], "/" ) : join( pathlist[-3:-1], "/" )
      endfunction
      " or"
      function! ShortPath()
        let pathlist=split(expand("%:p:~"), "/")
        if len(pathlist) < 3 | let final_result=join( pathlist[-2:-1], "/" ) | else | let final_result=join( pathlist[-3:-1], "/" ) | endif
        return final_result
      endfunction
      
      let g:airline_section_a = airline#section#create([ 'mode', '  ', ShortPath() ])
      
      • i.e.:

        function! ShortPath()
          let pathlist=split(expand("%:p:~"), "/")
          return len(pathlist) < 3 ? join( pathlist[-2:-1], "/" ) : join( pathlist[-3:-1], "/" )
        endfunction
        function! AirlineInit()
          let g:airline_section_a = airline#section#create([ '[', 'mode', ']', '  ', '%{&fenc}', '  ', ShortPath() ])
          let g:airline_section_y = airline#section#create([ '%{strftime("%H:%M %b-%d %a")} ', '['.&ff.']' ])
          let g:airline_section_c = '%<' . airline#section#create([ '%F' ]) " let g:airline_section_c = '%<' . '%{expand(%:p:~)}'
        endfunction
        autocmd User AirlineAfterInit call AirlineInit()
        
        airline section_a shortpath
        1.3.4.5 -- airline section_a shortpath
    • via %{}

      function! AirlineInit()
        let pathlist=split( expand("%:p:~"), "/" )
        let g:airline_section_a = airline#section#create([ 'mode', '  ', '%{len(pathlist) < 3 ? join( pathlist[-2:-1], "/" ) : join( pathlist[-3:-1], "/" )}'])
      endfunction
      autocmd User AirlineAfterInit call AirlineInit()
      
      airline section_a shortpath with '%{}'
      1.3.4.6 -- airline section_a shortpath with '%{}'
  • sections with length limitation

    • %<': let g:airline_section_c = '%<' . airline#section#create(['%{expand("%:p:~")}'])
    • %-0.xx{} : let g:airline_section_c = '%<' . '%-0.13{expand("%:p:~")}'

    • i.e.:

      let g:airline_section_c = '%<' . '%-0.20{expand("%:p:~")}'
      " <docs/vim/plugins.md
      
      let g:airline_section_c = '%<' . '%{expand("%:p:~")}'
      " ~/path/to/ibook/docs/vim/plugins.md
      
      let g:airline_section_c = airline#section#create(['%F'])
      " ~/path/to/book/docs/vim/plugins.md
      

themes

  • great themes

      • base16_embers base16_embers
      • base16 base16
      • apprentice apprentice
      • gruvbox gruvbox
      • zenburn zenburn
    • angr

    • selenized/selenized_bw
    • biogoo
    • base16_default
    • base16color
    • base16_chalk
    • base16_bright
    • biogoo ( dark background in insert mode )
  • nice themes

    • owo
    • hybrid
    • bubblegum
    • supernova
    • alduin
    • base16_summerfruit
    • base16_atelierseaside
    • raven ( no background color )
    • peaksea ( no background color change )

programming

vim-syntastic/syntastic

[!NOTE|label:references:]

Plug 'vim-syntastic/syntastic'

" syntastic settings                                                " Plug 'vim-syntastic/syntastic'
set statusline+=%#warningmsg#
set statusline+=%{SyntasticStatuslineFlag()}
set statusline+=%*
let g:syntastic_always_populate_loc_list = 1
let g:syntastic_auto_loc_list            = 1
let g:syntastic_check_on_open            = 1
let g:syntastic_check_on_wq              = 0
let g:syntastic_loc_list_height          = 2
let g:syntastic_ignore_files             = ['\.py$']
let g:syntastic_html_tidy_ignore_errors  = [" proprietary attribute \"ng-"]
let g:syntastic_enable_signs             = 1
let g:syntastic_info_symbol              = 'ೲ'                      " ࠵ ϊ
let g:syntastic_error_symbol             = '✗'                      " ஓ ௐ ྾
let g:syntastic_warning_symbol           = '⍨'                      " ᓆ ᓍ
let g:syntastic_style_error_symbol       = '⍥'
let g:syntastic_style_warning_symbol     = 'ఠ'                      " ⍤ ൠ
highlight link SyntasticErrorSign        Error
highlight link SyntasticWarningSign      GruvboxYellow
highlight link SyntasticStyleErrorSign   GruvboxRedSign
highlight link SyntasticStyleWarningSign GruvboxPurpleSign
style warning
1.3.4.7 -- style warning
error
1.3.4.8 -- error
former version
  Bundle 'vim-syntastic/syntastic'

  " configure syntastic syntax checking to check on open as well as save
  set statusline+=%#warningmsg#
  set statusline+=\ %{SyntasticStatuslineFlag()}                      " vim-syntastic/syntastic
  set statusline+=\ %* |
  let g:syntastic_always_populate_loc_list  = 1
  let g:syntastic_auto_loc_list             = 1
  let g:syntastic_check_on_open             = 1
  let g:syntastic_check_on_wq               = 0
  let g:syntastic_loc_list_height           = 2
  let g:syntastic_ignore_files              = ['\.py$']
  let g:syntastic_html_tidy_ignore_errors   = [" proprietary attribute \"ng-"]

tpope/vim-commentary

" tpope/vim-commentary
map  <C-/>     gcc
map  <leader>x gcc
imap <C-/>     <Esc><Plug>CommentaryLineA
xmap <C-/>     <Plug>Commentary

augroup DevOps
  autocmd FileType ignore,gitconfig setlocal commentstring=#\ %s
augroup END

coc.nvim

[!NOTE|label:references:]

  • initialize

    $ pip install jedi
    
    Plug 'neoclide/coc.nvim', { 'branch': 'release' }
    
    " neoclide/coc.nvim
    set updatetime=300
    set signcolumn=yes
    let g:coc_global_extensions = [
      \   'coc-sh',
      \   'coc-groovy', 'coc-java',
      \   'coc-docker',
      \   'coc-json',
      \   'coc-docker',
      \   'coc-css', 'coc-htmlhint', 'coc-html-css-support',
      \   'coc-pyright',
      \   'coc-snippets',
      \   'coc-emoji'
      \ ]
    function! CheckBackspace() abort
      let col = col('.') - 1
      return !col || getline('.')[col - 1]  =~# '\s'
    endfunction
    function! ShowDocumentation()
      if CocAction('hasProvider', 'hover')
        call CocActionAsync('doHover')
      else
        call feedkeys('K', 'in')
      endif
    endfunction
    autocmd FileType   json syntax match Comment +\/\/.\+$+
    autocmd FileType   html let b:coc_root_patterns = ['.git', '.env', 'tailwind.config.js', 'tailwind.config.cjs']
    inoremap <silent><expr> <S-C-space> coc#refresh()
    inoremap <silent><expr> <DOWN>
          \ coc#pum#visible() ? coc#pum#next(1) :
          \ CheckBackspace() ? "\<Tab>" :
          \ coc#refresh()
    inoremap <expr><UP> coc#pum#visible() ? coc#pum#prev(1) : "\<C-h>"
    inoremap <silent><expr> <TAB> coc#pum#visible() ? coc#pum#confirm()
                                  \: "\<C-g>u\<CR>\<c-r>=coc#on_enter()\<CR>"
    command! -nargs=0 OR   :call     CocActionAsync('runCommand', 'editor.action.organizeImport')
    nmap     <silent> [g  <Plug>(coc-diagnostic-prev)
    nmap     <silent> ]g  <Plug>(coc-diagnostic-next)
    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)
    nnoremap <silent> K   :call ShowDocumentation()<CR>
    nmap     <leader>cl   <Plug>(coc-codelens-action)
    imap     <C-l>        <Plug>(coc-snippets-expand)
    
  • open configure file ( coc-settings.json )

    :CocConfig
    
    • language server setup
      {
          "languageserver": {
              "intelephense": {
                  "command": "intelephense",
                  "args": ["--stdio"],
                  "filetypes": ["php"],
                  "initializationOptions": {
                      "storagePath": "/tmp/intelephense"
                  }
              }
          },
      }
      
  • check information

    :CocInfo
    :checkhealth
    :CocOpenLog
    :CocCommand workspace.showOutput
    
  • CocConfig:

    {
      "codeLens.enable": true,
      "java.referencesCodeLens.enabled": true,
      "diagnostic.displayByAle": false,
      "diagnostic.errorSign": "✗",
      "diagnostic.infoSign": "i",
      "diagnostic.warningSign": "⚠",
      "diagnostic.hintSign": "➤"
    }
    
    • start completion from 2nd string
      {
        "suggest.minTriggerInputLength": 2
      }
      
    • cause issue of trigger

      [!TIP]

      • support autoTrigger: always, trigger
      {
        "suggest.autoTrigger": "trigger",
        "suggest.triggerCompletionWait": 50
      }
      
nvim coc lspconfig
1.3.4.9 -- nvim coc lspconfig
  • troubleshooting

    $ rust-analyzer --help
    error: 'rust-analyzer' is not installed for the toolchain 'stable-x86_64-unknown-linux-gnu'
    
    $ rustup component add rust-analyzer
    

extensions

[!NOTE|label:references:]

  • list all installed

    :CocList extensions
    
    $ ls ~/.config/coc/extensions/node_modules
    coc-css     coc-emoji   coc-html-css-support  coc-java  coc-omni     coc-sh        coc-tag
    coc-docker  coc-groovy  coc-htmlhint          coc-json  coc-pyright  coc-snippets
    
  • add/remove execute:

    :CocInstall coc-sh coc-groovy coc-json coc-css coc-pyright coc-snippets coc-emoji coc-omni coc-tag coc-htmlhint coc-html-css-support coc-docker
    :CocInstall @yaegassy/coc-tailwindcss3
    :CocUninstall coc-git
    
  • or

    $ nvim -c 'CocInstall -sync coc-groovy \
                                coc-java \
                                coc-css \
                                coc-pyright \
                                coc-snippet \
                                coc-emoji \
                                coc-tag \
                                coc-docker\
                                coc-htmlhint\
                                coc-html-css-support \
                                coc-sh \
                                coc-omni|q'
    
  • using custom registry

    $ cat ~/.npmrc
    coc.nvim:registry=https://registry.npmjs.org/
    
  • update extensions

    :CocUpdate
    :CocUpdateSync
    
    # or
    $ vim -c 'CocUpdateSync|q'
    

coc-snippets

: CocCommand workspace.showOutput snippets
[Info  - 04:39:05.988] Using ultisnips directories:
[
  "UltiSnips",
  "/Users/marslo/.config/coc/ultisnips"
]
[Info  - 04:39:06.009] Loading textmate snippets from filetypes: groovy

:CocList snippets
:CocCommand snippets.openSnippetFiles
:CocCommand snippets.editSnippets
:CocCommand snippets.openOutput

nvim-treesitter/nvim-treesitter

[!NOTE]

nvim-treesitter
1.3.4.10 -- nvim-treesitter
# tree-sitter executable not found
$ cargo install tree-sitter-cli
# or
$ sudo npm i -g tree-sitter-cli

$ which -a tree-sitter
~/.cargo/bin/tree-sitter
  • others

    $ pip3 install tree_sitter
    # or
    $ brew install tree_sitter
    
    Plug 'nvim-treesitter/nvim-treesitter', { 'do': ':TSUpdate' }
    
  • install

    :TSInstall bash css gitcommit git_config gpg html java jq lua python xml yaml
    
  • check via

    :TSBufToggle highlight
    :TSInstallInfo
    :TSModuleInfo
    :checkhealth nvim-treesitter
    :echo nvim_get_runtime_file('*/lua.so', v:true)
    ['/Users/marslo/.vim/plugged/nvim-treesitter/parser/lua.so', '/usr/local/Cellar/neovim/0.9.5/lib/nvim/parser/lua.so']
    

williamboman/nvim-lsp-installer

[!NOTE|label:references:]

$ mkdir -p ~/.cache/nvim/
# show all available packages
:LspInstall <TAB>
:LspInstall <package>
" i.e.:
:LspInstall groovyls

:LspInstallInfo
:LspPrintInstalled

:LspUninstall <package>
groovyls
1.3.4.11 -- groovyls

neovim/nvim-lspconfig

vim lspconfig treesitter coc
1.3.4.12 -- vim lspconfig treesitter coc
Plug 'neovim/nvim-lspconfig'
  • debug
    :LspInfo
    :LspLog
    

manual install lsp

[!NOTE]

  • gradlels

    $ mkdir -p ~/.vim/lsp
    $ git clone https://github.com/microsoft/vscode-gradle.git ~/.vim/lsp/vscode-gradle && cd $_
    $ ./gradlew installDist
    $ sudo ln -sf /opt/lsp/gradle-language-server/build/install/gradle-language-server/bin/gradle-language-server /usr/local/bin/
    $ which -a gradle-language-server
    /usr/local/bin/gradle-language-server
    
    # details for offline install
    $ la ~/.gradle/wrapper/dists/gradle-8.5-bin/5t9huq95ubn472n8rpzujfbqh/
    total 4.0K
    -rw-rw-r-- 1 marslo marslo    0 Jan 15 19:58 gradle-8.5-bin.zip.lck
    drwxrwxr-x 5 marslo marslo 4.0K Jan 15 19:58 gradle-8.5
    -rw-rw-r-- 1 marslo marslo    0 Jan 15 19:58 gradle-8.5-bin.zip.ok
    
    require'lspconfig'.gradle_ls.setup {
      filetypes = { 'groovy', 'Jenkinsfile' }
    }
    
  • groovyls

    • GroovyLanguageServer/groovy-language-server

      # java has to be less than jdk 19
      $ brew install openjdk@17
      $ export JAVA_HOME='/usr/local/opt/openjdk@17'
      $ export PATH=${JAVA_HOME}/bin:${PATH}
      $ export CPPFLAGS="-I${JAVA_HOME}/include ${CPPFLAGS}"
      
      $ git clone git@github.com:GroovyLanguageServer/groovy-language-server.git
      $ ./gradew build
      
      # run
      $ git@github.com:GroovyLanguageServer/groovy-language-server.git
      
    • ycm-core/lsp-examples

      [!NOTE|label:@deprecated] using gradlels instead of groovyls

      • full ycm-core/lsp-examples list
        Plug 'ycm-core/lsp-examples',  { 'do': 'python3 install.py --enable-groovy --enable-yaml --enable-bash --enable-json --enable-python --enable-lua --enable-docker' }
        
      # .vimrc
      Plug 'ycm-core/lsp-examples',  { 'do': 'python3 install.py --enable-groovy' }
      
      # ~/.config/nvim/init.lua
      require'lspconfig'.groovyls.setup{
        filetypes = { 'groovy', 'Jenkinsfile' },
        cmd = { "java", "-jar", "~/.vim/plugged/lsp-examples/groovy/groovy-language-server/build/libs/groovy-language-server-all.jar" },
      }
      
  • ansiblels

    $ npm install -g @ansible/ansible-language-server
    
    # ~/.config/nvim/init.lua
    require'lspconfig'.ansiblels.setup{}
    
  • bashls

    $ npm i -g bash-language-server
    
    # ~/.config/nvim/init.lua
    require'lspconfig'.bashls.setup{}
    
  • cmake | cmake-language-server

    $ pip install cmake-language-server
    
    # ~/.config/nvim/init.lua
    require'lspconfig'.cmake.setup{}
    
  • cssls

    $ npm i -g vscode-langservers-extracted
    
    # ~/.config/nvim/init.lua
    local capabilities = vim.lsp.protocol.make_client_capabilities()
    capabilities.textDocument.completion.completionItem.snippetSupport = true
    require'lspconfig'.cssls.setup { capabilities = capabilities, }
    require'lspconfig'.cssls.setup{}
    
  • dockerls

    $ npm install -g dockerfile-language-server-nodejs
    
    # ~/.config/nvim/init.lua
    require'lspconfig'.dockerls.setup{}
    
  • pylsp

    [!NOTE|label:references:]

    $ pip install python-lsp-server
    $ sudo npm install -g pyright
    
    require'lspconfig'.pylsp.setup {}
    
  • vimls

    $ npm install -g vim-language-server
    
    require'lspconfig'.vimls.setup{}
    
  • yamlls

scrooloose/nerdtree

" scrooloose/nerdtree
map <C-S-n> :NERDTreeToggle<CR>
let g:NERDTreeWinPos = 'left'
let g:NERDTreeIgnore = [ '^node_modules$' ]
nvim nerdtree devicons coc lspconfig
1.3.4.13 -- nvim nerdtree devicons coc lspconfig

others

ycm-core/YouCompleteMe

ycm-core/lsp-examples

dense-analysis/ale

hrsh7th/cmp-nvim-lsp

require('cmp_nvim_lsp').default_capabilities

require'cmp'.setup {
  sources = {
    { name = 'nvim_lsp' }
  }
}

-- The nvim-cmp almost supports LSP's capabilities so You should advertise it to LSP servers..
local capabilities = require('cmp_nvim_lsp').default_capabilities()

-- An example for configuring `clangd` LSP to use nvim-cmp as a completion engine
require('lspconfig').clangd.setup {
  capabilities = capabilities,
  ...  -- other lspconfig configs
}
Plug 'hrsh7th/cmp-nvim-lsp'
set runtimepath+=~/.vim/plugged/cmp-nvim-lsp

vim-easycomplete

[!NOTE|label:references:]

utils

vim-scripts/AuthorInfoDetect

Plug 'marslo/authorinfo'

noremap <leader>aid :AuthorInfoDetect<CR>
let g:vimrc_author = 'marslo'
let g:vimrc_email  = 'marslo.jiao@gmail.com'
autocmd BufWritePre, FileWritePre * :AuthorInfoDetect<CR>
autocmd BufWritePre               * :AuthorInfoDetect<CR>

sjl/gundo.vim

[!TIP]

  • delete undo file for 3 days ago
    $ find ~/.vim/undo -mtime +3
    # or
    $ fd --type=file \
         --change-older-than=30days \
         . \
         ~/.cache/vim/{backup,swap,undo}/ \
         -x rm -v
    
Plug 'sjl/gundo.vim'

noremap <Leader>u :GundoToggle<CR>
set undodir=~/.vim/undo/
set undofile

yegappan/mru

noremap <leader>re :MRU<CR>
let MRU_Auto_Close    = 1                                           " most recently used(mru)
let MRU_Max_Entries   = 10
let MRU_Exclude_Files = '^/tmp/.*\|^/temp/.*\|^/media/.*\|^/mnt/.*'

markdown

preservim/vim-markdown

Plug 'preservim/vim-markdown'

" preservim/vim-markdown
let g:vim_markdown_toc_autofit         = 1
let g:vim_markdown_conceal             = 0
let g:vim_markdown_conceal_code_blocks = 0
let g:vim_markdown_strikethrough       = 1
let g:vim_markdown_folding_disabled    = 1
" let g:vim_markdown_frontmatter         = 1
" let g:vim_markdown_json_frontmatter    = 1
" let g:vim_markdown_autowrite           = 1
" let g:vim_markdown_follow_anchor       = 1
" let g:vim_markdown_anchorexpr          = "'<<'.v:anchor.'>>'"

dhruvasagar/vim-table-mode

Plug 'dhruvasagar/vim-table-mode'

noremap <Leader>tm :TableModeToggle<CR>
let g:table_mode_corner          = '|'
let g:table_mode_header_fillchar = '-'
let g:table_mode_align_char      = ":"
let g:table_mode_corner          = "|"
let g:table_mode_align_char      = ":"
" let g:table_mode_corner_corner = '+'
function! s:isAtStartOfLine(mapping)
  let text_before_cursor = getline('.')[0 : col('.')-1]
  let mapping_pattern = '\V' . escape(a:mapping, '\')
  let comment_pattern = '\V' . escape(substitute(&l:commentstring, '%s.*$', '', ''), '\')
  return (text_before_cursor =~? '^' . ('\v(' . comment_pattern . '\v)?') . '\s*\v' . mapping_pattern . '\v$')
endfunction
inoreabbrev <expr> <bar><bar>
          \ <SID>isAtStartOfLine('\|\|') ?
          \ '<c-o>:TableModeEnable<cr><bar><space><bar><left><left>' : '<bar><bar>'
inoreabbrev <expr> __
          \ <SID>isAtStartOfLine('__') ?
          \ '<c-o>:silent! TableModeDisable<cr>' : '__'
let g:tabular_loaded             = 1

godlygeek/tabular

" install
Plug 'godlygeek/tabular'

" settings
noremap <Leader>tb :TableModeToggle<CR>
let g:table_mode_corner='|'
let g:table_mode_header_fillchar='-'
let g:table_mode_corner_corner='|'
function! s:isAtStartOfLine(mapping)
  let text_before_cursor = getline('.')[0 : col('.')-1]
  let mapping_pattern = '\V' . escape(a:mapping, '\')
  let comment_pattern = '\V' . escape(substitute(&l:commentstring, '%s.*$', '', ''), '\')
  return (text_before_cursor =~? '^' . ('\v(' . comment_pattern . '\v)?') . '\s*\v' . mapping_pattern . '\v$')
endfunction

inoreabbrev <expr> <bar><bar>
          \ <SID>isAtStartOfLine('\|\|') ?
          \ '<c-o>:TableModeEnable<cr><bar><space><bar><left><left>' : '<bar><bar>'
inoreabbrev <expr> __
          \ <SID>isAtStartOfLine('__') ?
          \ '<c-o>:silent! TableModeDisable<cr>' : '__'

let g:tabular_loaded = 1
if exists(":Tabularize")
  nmap <Leader>a= :Tabularize /=<CR>
  vmap <Leader>a= :Tabularize /=<CR>
  nmap <leader>a: :Tabularize /:\zs<CR>
  vmap <leader>a: :Tabularize /:\zs<CR>
  inoremap <silent> <Bar>   <Bar><Esc>:call <SID>table_auto_align()<CR>
  function! s:table_auto_align()
    let p = '^\s*|\s.*\s|\s*$'
    if exists(':Tabularize') && getline('.') =~# '^\s*|'
      \ && (getline(line('.')-1) =~# p || getline(line('.')+1) =~# p)
      let column = strlen(substitute(getline('.')[0:col('.')],'[^|]','','g'))
      let position = strlen(matchstr(getline('.')[0:col('.')],'.*|\s*\zs.*'))
      Tabularize/|/l1
      normal! 0
      call search(repeat('[^|]*|',column).'\s\{-\}'.repeat('.',position),'ce',line('.'))
    endif
  endfunction
endif

git

  • call bash cmd in silent mode
    nnoremap <leader>mp  :execute 'silent !git push --force' \| redraw!<CR>
    
git blamer blame
1.3.4.14 -- git blamer blame

tpope/vim-fugitive

Plug 'tpope/vim-fugitive'

" fugitive
nnoremap <leader>mp :silent exec '! git mp'<CR>
nnoremap <Leader>ga :Git add %:p<CR><CR>
nnoremap <Leader>gs :Gstatus<CR>
nnoremap <leader>gl :silent! Glog<CR>:bot copen<CR>
nnoremap <leader>gp :Ggrep<Space>
nnoremap <leader>gb :Git branch<Space>
nnoremap <leader>go :Git checkout<Space>
nnoremap <leader>gc :Git commit -am ""<Left>
command! -bar -nargs=* Gpull execute 'Git pull'
command! -bar -nargs=* Gpush execute 'Git push'

APZelos/blamer.nvim

Plug 'APZelos/blamer.nvim'

" APZelos/blamer.nvim
nnoremap <Leader>bb  :BlamerToggle<CR>
if has( 'nvim' )
  let g:blamer_enabled            = 1
else
  let g:blamer_enabled            = 0
endif
let g:blamer_delay                = 100
let g:blamer_show_in_visual_modes = 0
let g:blamer_show_in_insert_modes = 0
let g:blamer_relative_time        = 1
let g:blamer_prefix               = '  '

zivyangll/git-blame.vim

" zivyangll/git-blame.vim
nnoremap <Leader>ebb :<C-u>call gitblame#echo()<CR>

color and theme

[!NOTE|label:references:]

set enc=utf-8
set guifont=Powerline_Consolas:h11
set renderoptions=type:directx,gamma:1.5,contrast:0.5,geom:1,renmode:5,taamode:1,level:0.5

ryanoasis/vim-devicons

[!NOTE|label:unicodes]

RRethy/vim-hexokinase

Plug 'rrethy/vim-hexokinase', { 'do': 'make hexokinase' }

" rrethy/vim-hexokinase
let g:Hexokinase_highlighters  = [ 'backgroundfull' ]              " available options: 'virtual', 'sign_column', 'background', 'backgroundfull', 'foreground', 'foregroundfull'
let g:Hexokinase_optInPatterns = [
\     'full_hex',
\     'triple_hex',
\     'rgb',
\     'rgba',
\     'hsl',
\     'hsla',
\     'colour_names'
\ ]
let g:Hexokinase_ftEnabled     = [ 'css', 'html', 'javascript']    " not recommended

NvChad/nvim-colorizer.lua

Plug 'NvChad/nvim-colorizer.lua'
# ~/.config/nvim/init.lua
require('config/theme')

# ~/.config/nvim/lua/config/theme.lua
require 'colorizer'.setup()
require 'colorizer'.setup {
  filetypes = {
    '*';
    css = { rgb_fn = true; mode = 'background'; };
    html = { names = true; };
    cmp_docs = {always_update = true}
  },
  user_default_options = { RRGGBBAA = true, css_fn = true, css = true, tailwind = true },
  buftypes = { "*", "!prompt", "!popup", }
}

troubleshooting

airline

[!NOTE|label:references:]

  • solution : install powerline fonts

    [!NOTE]

    $ git clone git@github.com:powerline/fonts.git ${iRCHOME}/utils/
    $ git clone git@github.com:supermarin/powerline-fonts.git ${iRCHOME}/utils/
    
    $ cd ${iRCHOME}/utils/fonts
    $ ./install.sh
    
Copyright © marslo 2020-2023 all right reserved,powered by GitbookLast Modified: 2024-03-12 15:01:30

results matching ""

    No results matching ""