highly recommended
[!NOTE|label:references:]
Copy " 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
Copy set runtimepath += /usr/ local /opt/ fzf " $ brew install fzf
Plug '/usr/local/opt/fzf'
Plug 'junegunn/fzf.vim'
" junegunn/fzf.vim
nnoremap <silent> <leader> ff :Files<CR>
nnoremap <silent> <leader>gf :GFiles<CR>
nnoremap <silent> <leader>ag :Ag<CR>
nnoremap <silent> <leader>l :Buffers<CR>
nnoremap <silent> <Leader>H :Helptags<CR>
nnoremap <silent> <Leader>g :Commits<CR>
nnoremap <silent> <Leader> hh :History:<CR>
inoremap <expr> <c-x><c-k> fzf#vim#complete ( 'cat /usr/share/dict/words' )
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_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"'
let $FZF_DEFAULT_COMMAND = 'ag --hidden --ignore .git -l -g ""'
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 ))
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_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' ]
\ }
Copy 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' : [ 'start=/(/ end=/)/ fold' , 'start=/\[/ end=/\]/ fold' , 'start=/{/ end=/}/ fold' ],
\ 'operators' : '_,_' ,
\ 'separately' : {
\ '*' : {},
\ 'markdown' : {
\ 'parentheses_options' : 'containedin=markdownCode contained' ,
\ },
\ 'css' : {
\ 'parentheses' : [ [ '(' , ')' ], [ '\[' , '\]' ] ],
\ },
\ 'scss' : {
\ 'parentheses' : [ [ '(' , ')' ], [ '\[' , '\]' ] ],
\ },
\ 'stylus' : {
\ 'parentheses' : [ 'start=/{/ end=/}/ fold contains=@colorableGroup' ],
\ },
\ 'vim' : {
\ 'parentheses': ['start=/(/ end=/)/', 'start=/\[/ end=/\]/', 'start=/{/ end=/}/ fold', 'start=/(/ end=/)/ containedin=vimFuncBody', 'start=/\[/ end=/\]/ containedin=vimFuncBody', 'start=/{/ end=/}/ fold containedin=vimFuncBody'],
\ },
\ 'html' : {
\ 'parentheses': ['start=/\v\<((area|base|br|col|embed|hr|img|input|keygen|link|menuitem|meta|param|source|track|wbr)[ >])@!\z([-_:a-zA-Z0-9]+)(\s+[-_:a-zA-Z0-9]+(\=("[^"]*"|'."'".'[^'."'".']*'."'".'|[^ '."'".'"><=`]*))?)*\>/ end=#</\z1># fold'],
\ },
\ 'nerdtree' : 0
\ }}
Copy 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
[!NOTE|label:references:]
tips:
check loaded extensions : :AirlineExtension
Copy 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 ()
tips
remove section_
Copy let g:airline_section_<x> = '' " remove the filetype part
let g:airline_skip_empty_sections = 1 " remove separators for empty sections
setup short mode
Copy 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
Copy " 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
Copy " 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 = 'Ξ'
Copy let g:airline_symbols.branch = '⎇' " ╮
let g:airline_symbols.paste = 'ρ' " ├ unicode symbols
let g:airline_symbols.dirty = ' ↯' " ╯
sections
[!NOTE|label:references:]
Copy 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
via function
Copy 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.:
Copy 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 ()
via %{}
Copy 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 ()
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.:
Copy 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
apprentice
gruvbox
zenburn
biogoo ( dark background in insert mode )
nice themes
raven ( no background color )
peaksea ( no background color change )
programming
[!NOTE|label:references:]
Copy 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
Copy 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- "]
[!TIP|label:references:]
initialize
Copy " install
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-json' ,
\ 'coc-css' , 'coc-htmlhint' , 'coc-html-css-support' ,
\ 'coc-pyright' ,
\ 'coc-snippets' ,
\ 'coc-docker' ,
\ '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> <DOWN>
\ coc#pum#visible () ? coc#pum#next ( 1 ) : CheckBackspace ()
\ ? "\<DOWN>" : coc#refresh ()
inoremap <expr><UP> coc#pum#visible () ? coc#pum#prev ( 1 ) : "\<C-h>"
inoremap <silent><expr> <C-M>
\ 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)
" coc-snippets ( ctrl-j )
imap <C-l> <Plug>(coc-snippets-expand)
vmap <C-j> <Plug>(coc-snippets-select)
let g:coc_snippet_next = '<c-j>'
let g:coc_snippet_prev = '<c-k>'
imap <C-j> <Plug>(coc-snippets-expand-jump)
inoremap <silent><expr> <C-j>
\ pumvisible () ? coc#_select_confirm () :
\ coc#expandableOrJumpable () ? "\<C-r>=coc#rpc#request('doKeymap', ['snippets-expand-jump',''])\<CR>" :
\ CheckBackSpace () ? "\<TAB>" :
\ coc#refresh ()
function! CheckBackSpace () abort
let col = col ( '.' ) - 1
return ! col || getline ( '.' )[col - 1 ] =~# '\s'
endfunction
open configure file ( coc-settings.json
)
language server setup
Copy {
"languageserver" : {
"intelephense" : {
"command" : "intelephense" ,
"args" : [ "--stdio" ] ,
"filetypes" : [ "php" ] ,
"initializationOptions" : {
"storagePath" : "/tmp/intelephense"
}
}
} ,
}
check information
Copy :CocInfo
:checkhealth
:CocOpenLog
:CocCommand workspace.showOutput
CocConfig:
Copy {
"codeLens.enable" : true ,
"java.referencesCodeLens.enabled" : true ,
"diagnostic.displayByAle" : false ,
"diagnostic.errorSign" : "✘" ,
"diagnostic.infoSign" : "ᓆ" ,
"diagnostic.warningSign" : "ᑹ" ,
"diagnostic.hintSign" : "➤" ,
"diagnostic-languageserver.filetypes" : {
"yaml" : [ "yamllint" ] ,
"vim" : "vint" ,
"sh" : "shellcheck"
} ,
"html-css-support.styleSheets" : [
"https://cdn.jsdelivr.net/npm/bootstrap@4.5.3/dist/css/bootstrap.min.css" ,
"/style.css" ,
"style.css"
] ,
"html-css-support.enabledLanguages" : [ "html" , "markdown" ] ,
"coc.source.file.ignoreHidden" : false ,
"snippets.userSnippetsDirectory" : "~/.marslo/vimrc.d/snips"
}
start completion from 2nd string
Copy {
"suggest.minTriggerInputLength" : 2
}
Copy
- cause issue of trigger
> [!TIP]
> - support autoTrigger: `always`, `trigger`
```json
{
"suggest.autoTrigger": "trigger",
"suggest.triggerCompletionWait": 50
}
shortcuts
Copy " neoclide/coc.nvim
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)
nmap <leader>cl <Plug>(coc-codelens-action)
nnoremap <silent>K :call ShowDocumentation ()<CR>
<Plug>(coc-diagnostic-prev)
: [ + g : previous diagnostic
<Plug>(coc-diagnostic-next)
: ] + g : next diagnostic
<Plug>(coc-definition)
: g + d : go to definition
<Plug>(coc-type-definition)
: g + y : type definition
<Plug>(coc-implementation)
: g + i : implementation
<Plug>(coc-references)
: g + r : references
<Plug>(coc-codelens-action)
: c + l : code lens action
troubleshooting
[!NOTE|label:references:]
Copy $ rust-analyzer --help
error: 'rust-analyzer' is not installed for the toolchain 'stable-x86_64-unknown-linux-gnu'
$ rustup component add rust-analyzer
[!NOTE|label:references:]
Copy " ~/.vimrc.d/extension
Plug 'neoclide/coc.nvim' , { 'branch' : 'release' }
Plug 'honza/vim-snippets'
let g:coc_global_extensions = [ 'coc-snippets' ]
" coc-snippets ( ctrl-j )
imap <C-l> <Plug>(coc-snippets-expand)
vmap <C-j> <Plug>(coc-snippets-select)
let g:coc_snippet_next = '<c-j>'
let g:coc_snippet_prev = '<c-k>'
imap <C-j> <Plug>(coc-snippets-expand-jump)
inoremap <silent><expr> <C-j>
\ pumvisible () ? coc#_select_confirm () :
\ coc#expandableOrJumpable () ? "\<C-r>=coc#rpc#request('doKeymap', ['snippets-expand-jump',''])\<CR>" :
\ CheckBackSpace () ? "\<TAB>" :
\ coc#refresh ()
function! CheckBackSpace () abort
let col = col ( '.' ) - 1
return ! col || getline ( '.' )[col - 1 ] =~# '\s'
endfunction
Copy " ~/.vimrc.d/hightlight
" coc-snippet
highlight ! link snipLeadingSpaces snipComment
commands
Copy :CocList snippets
:CocCommand snippets.openSnippetFiles
:CocCommand snippets.editSnippets
:CocCommand snippets.openOutput
: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
extensions management
[!NOTE|label:references:]
list all installed
Copy :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:
Copy :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
Copy $ 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'
[!NOTE]
if install from standalone package, tree-sitter
required
osx: $ brew install tree-sitter
Copy # tree-sitter executable not found
$ cargo install tree-sitter-cli
# or
$ sudo npm i -g tree-sitter-cli
# or
$ brew install tree-sitter
$ which -a tree-sitter
~ /.cargo/bin/tree-sitter
# macos
$ which -a tree-sitter
/usr/local/bin/tree-sitter
others
Copy $ pip3 install tree_sitter
configure
Copy Plug 'nvim-treesitter/nvim-treesitter' , { 'do' : ':TSUpdate' }
Copy -- ~/.config/nvim/init.vim
require ( 'config/nvim-treesitter' )
-- ~/.config/nvim/lua/config/nvim-treesitter.lua
require 'nvim-treesitter.configs' . setup {
ensure_installed = { "c", "lua", "vim", "vimdoc", "query", "python", "bash", "groovy", "java", "yaml", "xml", "cmake", "css", "dockerfile", "git_config", "gitcommit", "gitignore", "jq", "json", "markdown", "ssh_config", "vimdoc", "ini" },
sync_install = true ,
-- install automatically
auto_install = true ,
ignore_install = { "javascript" },
indent = {
enable = true ,
disable = { "markdown" },
},
incremental_selection = {
enable = true ,
keymaps = {
init_selection = "<CR>" ,
node_incremental = "<CR>" ,
node_decremental = "<BS>" ,
scope_incremental = "<TAB>" ,
},
},
highlight = {
enable = true ,
disable = { "markdown" },
additional_vim_regex_highlighting = false ,
},
}
require ( "nvim-treesitter.install" ).prefer_git = true
install manually
Copy :TSInstall bash css gitcommit git_config gpg html java jq lua python xml yaml
commands
Copy :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' ]
[!NOTE|label:references:]
setup
Copy Plug 'github/copilot.vim'
" github/copilot.vim
let g:copilot_proxy = 'http://proxy.sample.com:8080'
let g:copilot_proxy_strict_ssl = v: false
let g:copilot_filetypes = {
\ '*' : v: false ,
\ 'gitcommit' : v: true ,
\ 'markdown' : v: true ,
\ 'yaml' : v: true ,
\ 'groovy' : v: true ,
\ 'python' : v: true ,
\ 'Jenkinsfile' : v: true ,
\ 'sh' : v: true
\ }
" disable for extra large file
autocmd BufReadPre *
\ let f = getfsize ( expand ( "<afile>" ))
\ | if f > 100000 || f == - 2
\ | let b:copilot_enabled = v: false
\ | endif
" invpaste -> paste in insert/normal/visual mode
noremap <leader> pp :set invpaste<cr>
map <silent> <F2> :Copilot disable<CR>
Copy :Copilot setup
" check status
:Copilot status
Copilot: Ready
" or
Copilot: Disabled for filetype = c by g:copilot_filetypes
:Copilot log
:resize - 5
:Copilot panel
config
[!NOTE|label:references:]
copilot enable/disable for filetypes:
Copy let g:copilot_proxy = '192.168.100.1:8080'
let g:copilot_proxy_strict_ssl = v: false
shortcuts
copilot#Accept("\<CR>")
: Tab : accept suggestion
Copy " to re-mapping
imap <silent><script><expr> <C-J> copilot#Accept ( "\<CR>" )
let g:copilot_no_tab_map = v: true
<Plug>(copilot-accept-word)
: Meta/Alt + ⇢: accept the next word of the current suggestion
Copy " to re-mapping
imap <C-L> <Plug>(copilot-accept-word)
<Plug>(copilot-accept-line)
: Meta/Alt + Ctrl + ⇢ : accept the next line of the current suggestion
Copy " to re-mapping
imap <C-M-L> <Plug>(copilot-accept-line)
<Plug>(copilot-next)
: Meta/Alt + ] : next suggestion
<Plug>(copilot-previous)
: Meta/Alt + [ : previous suggestion
<Plug>(copilot-dismiss)
: Control/Ctrl + ] : dismiss the current suggestion.
<Plug>(copilot-suggest)
: Meta/Alt + </kbd>> : explicitly request a suggestion, even if Copilot is disabled
self-signed certificate error
[!NOTE|label:references:]
Copy $ openssl x509 -inform der -in <exported_cert>.cer -out mycert.pem
$ export NODE_EXTRA_CA_CERTS="/path/to/mycert.pem"
# or
$ keytool -import -storepass changeit -keystore PATH_TO_YOUR_INTELLIJ_JRE/lib/security/cacerts -file PATH_TO_YOUR_CUSTOM_ROOTCA.pem
vscode
Copy // settings.json
{
"http.proxyStrictSSL": false,
"http.proxy": "http://proxy.sample.com:8080",
}
[!NOTE|label:references:]
Copy " install
Plug 'CopilotC-Nvim/CopilotChat.nvim' , { 'branch': 'canary' } " ╮
Plug 'zbirenbaum/copilot.lua' " ├ copilot chat
Plug 'nvim-lua/plenary.nvim' " ╯
Copy -- ~/.config/nvim/init.vim
require("CopilotChat").setup {
debug = true,
allow_insecure = true,
show_folds = false,
}
troubleshooting
No GitHub token found in WSL
error message
Copy No GitHub token found, please use `:Copilot setup` to set it up from copilot.vim or copilot.lua
error log
Copy [CopilotChat.nvim] [ERROR 23:59:58] /home/marslo/.vim/plugged/CopilotChat.nvim/lua/CopilotChat/copilot.lua:275: No GitHub token found, please use `:Copilot setup` to set it up from copilot.vim or copilot.lua
solution
Copy $ user="$(jq -c -r 'to_entries[].value.user' < ~/.config/github-copilot/apps.json)"
$ token="$(jq -c -r 'to_entries[].value.oauth_token' < ~/.config/github-copilot/apps.json)"
$ echo "{\"github.com\":{\"user\":\"${user}\",\"oauth_token\":\"${token}\"}}" > ~/.config/github-copilot/hosts.json
Copy Plug 'tomtom/tcomment_vim'
" tomtom/tcomment_vim
" g:tcomment_mapleader1 = ','
map <leader>x gcc
vmap <leader>x <c-_>b
nmap <C-/> gcc
imap <C-/> <c-_><c-_>
vmap <C-/> <c-_>b
[!NOTE|label:references:]
Copy " ~/.vimrc.d/extension
Plug 'stephpy/vim-yaml' " ╮ yaml
Plug 'pedrohdz/vim-yaml-folds' " ╯
Plug 'dense-analysis/ale'
" pedrohdz/vim-yaml-folds " brew install yamllint; pipx install yamllint
set foldlevelstart=20
" dense-analysis/ale
" error: ✘ 👾 💣 🙅 🤦; warning: ⚠ ⸮ ⸘ ☹ info: ⸚ ϔ 𐘿 𐰦 ; style_error: ᑹ ; style_warning: ᓏ
let g:ale_echo_msg_format = '[%linter%] %code%: %s [%severity%] '
let g:ale_virtualtext_prefix = '%comment% %type% [%code%]: '
let g:ale_sign_error = '💢'
let g:ale_sign_warning = 'ᑹᑹ'
let g:ale_sign_info = 'ᓆ'
let g:ale_sign_style_error = '⍥'
let g:ale_sign_style_warning = 'ᓍ'
let g:ale_lint_on_text_changed = 'never'
let g:ale_fix_on_save = 0
let g:ale_lint_on_save = 1
let g:ale_warn_about_trailing_blank_lines = 1
let g:ale_warn_about_trailing_whitespace = 1
let g:ale_set_balloons = 1
let g:ale_hover_to_preview = 1
let g:ale_floating_preview = 1
let g:ale_close_preview_on_insert = 1
shortcuts
Copy noremap ]a :ALENextWrap<CR>
noremap [a :ALEPreviousWrap<CR>
noremap ]A :ALELast<CR>
noremap [A :ALEFirst<CR>
:ALEPreviousWrap<CR>
: [ + a
linter/checker install
Copy $ brew install checkstyle stylelint prettier
# shell
$ brew install bashate shfmt
# yaml
$ brew install yamllint yamlfmt
# java
$ brew install google-java-format
# groovy/Jenkinsfile
$ npm i -g npm-groovy-lint
Copy " vim-syntastic/syntastic
" info: ࠵ ೲ; error: ஓ ௐ ྾; warning ᓆ ᓍ 𐘿; style_warning: ⍤ ൠ
set statusline+=%#warningmsg#
if has('unix')
set statusline+=\ %{SyntasticStatuslineFlag()}
endif
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 = 'ఠ'
let g:syntastic_dockerfile_checkers = [ 'hadolint' ]
highlight link SyntasticErrorSign Error
highlight link SyntasticWarningSign GruvboxYellow
highlight link SyntasticStyleErrorSign GruvboxRedSign
highlight link SyntasticStyleWarningSign GruvboxPurpleSign
color and theme
[!NOTE|label:references:]
Copy set encoding=UTF-8
if has('win32') || has('win64')
set guifont=OperatorMonoLig\ Nerd\ Font\ Mono:h29
else
set guifont=OperatorMono\ Nerd\ Font:h29
set renderoptions=type:directx,renmode:5
endif
more
Copy set guifont=Agave\ Nerd\ Font\ Mono:h32
set guifont=JetBrainsMono\ Nerd\ Font\ Mono:h26
set guifont=OperatorMono\ Nerd\ Font:h29
set renderoptions=type:directx,gamma:1.5,contrast:0.5,geom:1,renmode:5,taamode:1,level:0.5
[!NOTE|label:references:]
Copy Plug 'scrooloose/nerdtree'
" scrooloose/nerdtree
map <C-A-n> :NERDTreeToggle<CR>
nnoremap <silent> <leader>nt :NERDTreeToggle<CR>
let NERDTreeShowHidden = 1
let NERDTreeHighlightCursorline = 0
let g:NERDTreeShowLineNumbers = 0
let g:NERDTreeQuitOnOpen = 1
let g:NERDTreeWinPos = 'left'
let g:NERDTreeWinSize = 25
" will cause tiagofumo/vim-nerdtree-syntax-highlight highlight issue
" let g:NERDTreeFileLines = 1
let g:NERDTreeDirArrowExpandable = '+'
let g:NERDTreeDirArrowCollapsible = '⏵'
let g:NERDTreeIgnore = [
\ '^.*history$',
\ '.*iterm2_shell_integration.*',
\ '^.*\.swp',
\ '.*\.log',
\ '.wget-hsts',
\ '.DS_Store',
\ '^__pycache__$',
\ 'vim_mru_files',
\ 'viminfo',
\ '^node_modules$',
\ '^.git$',
\ '^.Trash$',
\ 'NERDTree.*',
\ 'CFUserTextEncoding',
\ '.*tags',
\ '.cache',
\ '.bundle',
\ '.bash_.*',
\ '.gradle.*',
\ '.gnupg'
\]
autocmd BufEnter * if winnr() == winnr('h') && bufname('#') =~ 'NERD_tree_\d\+' && bufname('%') !~ 'NERD_tree_\d\+' && winnr('$') > 1 |
\ let buf=bufnr() | buffer# | execute "normal! \<C-W>w" | execute 'buffer'.buf | endif
autocmd BufEnter * if winnr('$') == 1 && exists('b:NERDTree') && b:NERDTree.isTabTree() | quit | endif
" start nerdtree when vim start
autocmd VimEnter * NERDTree
[!NOTE|label:unicodes]
bracket issue in nerdtree
Copy " ryanoasis/vim-devicons
let g:WebDevIconsOS = 'Darwin'
let g:DevIconsEnableFoldersOpenClose = 1
let g:DevIconsEnableFolderExtensionPatternMatching = 0
let g:DevIconsDefaultFolderOpenSymbol = ''
let g:WebDevIconsUnicodeDecorateFolderNodesDefaultSymbol = ''
let g:WebDevIconsUnicodeDecorateFileNodesExtensionSymbols = {}
let g:WebDevIconsUnicodeDecorateFileNodesExtensionSymbols['log'] = ''
let g:WebDevIconsUnicodeDecorateFileNodesExtensionSymbols['json'] = ''
let g:WebDevIconsUnicodeDecorateFileNodesExtensionSymbols['md'] = ''
let g:WebDevIconsUnicodeDecorateFileNodesExtensionSymbols['perm'] = ''
let g:WebDevIconsUnicodeDecorateFileNodesExtensionSymbols['groovy'] = ''
let g:WebDevIconsUnicodeDecorateFileNodesExtensionSymbols['sh'] = ''
let g:WebDevIconsUnicodeDecorateFileNodesExtensionSymbols['yaml'] = ''
let g:WebDevIconsUnicodeDecorateFileNodesExtensionSymbols['yml'] = ''
let g:WebDevIconsUnicodeDecorateFileNodesExtensionSymbols['gitcommit'] = ''
let g:WebDevIconsUnicodeDecorateFileNodesExactSymbols = {}
let g:WebDevIconsUnicodeDecorateFileNodesExactSymbols['jenkinsfile'] = ''
let g:WebDevIconsUnicodeDecorateFileNodesExactSymbols['devops'] = ''
let g:WebDevIconsUnicodeDecorateFileNodesExactSymbols['vimrc.d'] = ''
let g:WebDevIconsUnicodeDecorateFileNodesExactSymbols['vars'] = ''
let g:WebDevIconsUnicodeDecorateFileNodesExactSymbols['src'] = ''
let g:WebDevIconsUnicodeDecorateFileNodesPatternSymbols = {}
let g:WebDevIconsUnicodeDecorateFileNodesPatternSymbols['.*ignore$'] = ''
let g:WebDevIconsUnicodeDecorateFileNodesPatternSymbols['.*rc$'] = ''
let g:WebDevIconsUnicodeDecorateFileNodesPatternSymbols['.*git.*$'] = ''
if exists('g:loaded_webdevicons') | call webdevicons#refresh() | endif
autocmd filetype nerdtree set conceallevel=3
autocmd filetype nerdtree set concealcursor=nvic
" tiagofumo/vim-nerdtree-syntax-highlight
" #293739 #BDBB72 #808000 #ba55d3 #183172 #0d6efd #3a346f #fd7e14 #d63384 #6c71c4
let g:NERDTreeSyntaxEnabledExtensions = ['rb', 'lua', 'vim', 'sh', 'py', 'groovy', 'css', 'html', 'json', 'log']
let g:NERDTreeSyntaxEnabledExactMatches = ['.marslo', 'jenkins', 'virtualization', 'vimrc.d', 'devops', 'vars', 'jenkinsfile', '.vimrc']
let g:NERDTreeExtensionHighlightColor = {}
let g:NERDTreeExtensionHighlightColor['groovy'] = '8FAA54' " #8FAA54
let g:NERDTreeExtensionHighlightColor['log'] = '44788E' " #44788E
let g:NERDTreeExtensionHighlightColor['yaml'] = '9370db' " #9370db
let g:NERDTreeExtensionHighlightColor['yml'] = '9370db' " #9370db
let g:NERDTreeExtensionHighlightColor['png'] = '719899' " #719899
let g:NERDTreeExtensionHighlightColor['css'] = 'fd7e14' " #fd7e14
let g:NERDTreeExactMatchHighlightColor = {}
let g:NERDTreeExactMatchHighlightColor['README'] = '0099BD' " #0099BD
let g:NERDTreePatternMatchHighlightColor = {}
let g:NERDTreePatternMatchHighlightColor['.*rc$'] = '616E88' " #616E88
let g:NERDTreePatternMatchHighlightColor['.*git.*$'] = '6c71c4' " #6c71c4
let g:NERDTreePatternMatchHighlightColor['.*rc$'] = '4682b4' " #4682b4
let g:NERDTreePatternMatchHighlightColor['.*ignore$'] = 'cd853f' " #cd853f
let g:NERDTreePatternMatchHighlightColor['.*\.bak$'] = '293739' " #293739
default settings
Copy let g:WebDevIconsUnicodeDecorateFolderNodes = 1
let g:WebDevIconsNerdTreeAfterGlyphPadding = ' '
let g:webdevicons_enable_nerdtree = 1
let g:webdevicons_enable_unite = 1
let g:webdevicons_enable_vimfiler = 1
let g:webdevicons_conceal_nerdtree_brackets = 1
let g:WebDevIconsNerdTreeGitPluginForceVAlign = 1
let g:DevIconsEnableFolderExtensionPatternMatching = 0
:echo g:WebDevIconsUnicodeDecorateFileNodesExtensionSymbols
{'erl': '', 'styl': '', 'db': '', 'rmd': '', 'c++': '', 'pyc': '', 'pyd': '', 'go': '', 'suo':
'', 'lua': '', 'bash': '', 'pyo': '', 'mustache': '', 'gif': '', 'nix': '', 'jsx': '', 'leex':
'', 'lhs': '', 'sol': 'ﲹ', 'scala': '', 'zsh': '', 'jpeg': '', 'pem': '', 'ts': '', 'xcplaygroun
d': '', 'fsi': '', 'coffee': '', 'scss': '', 'js': '', 'gitcommit': '', 'xul': '', 'mdx': '', '
less': '', 'fish': '', 'htm': '', 'rb': '', 'f#': '', 'c': '', 'd': '', 'md': '', 'webp': '',
'h': '', 'mli': 'λ', 'mk': '', 'rs': '', 'haml': '', 'png': '', 'hh': '', 'php': '', 'cc': '',
't': '', 'jl': '', 'json': '', 'cljc': '', 'exs': '', 'jenkinsfile': '', 'hs': '', 'sql': '', '
ico': '', 'ps1': '', 'cs': '', 'bmp': '', 'sln': '', 'cljs': '', 'html': '', 'cpp': '', 'hrl':
'', 'ml': 'λ', 'sass': '', 'vue': '﵂', 'awk': '', 'conf': '', 'pl': '', 'pm': '', 'cp': '', 'rli
b': '', 'pp': '', 'tex': 'ﭨ', 'elm': '', 'jpg': '', 'toml': '', 'webmanifest': '', 'mjs': '', 's
wift': '', 'r': 'ﳒ', 'ai': '', 'fs': '', 'csh': '', 'psd': '', 'psb': '', 'heex': '', 'rss': ''
, 'cxx': '', 'css': '', 'log': '', 'rake': '', 'sh': '', 'hpp': '', 'bat': '', 'fsx': '', 'ini'
: '', 'gemspec': '', 'markdown': '', 'hbs': '', 'twig': '', 'rproj': '鉶', 'yaml': '', 'fsscript'
: '', 'ksh': '', 'vim': '', 'ejs': '', 'clj': '', 'ex': '', 'edn': '', 'slim': '', 'eex': '',
'tsx': '', 'dump': '', 'groovy': '', 'py': '', 'hxx': '', 'diff': '', 'dart': '', 'java': '', '
yml': ''}
:echo g:WebDevIconsUnicodeDecorateFileNodesExactSymbols
{'.vimrc': '', 'gruntfile.coffee': '', '_gvimrc': '', '_vimrc': '', 'dropbox': '', '.gvimrc': '',
'license': '', 'procfile': '', 'config.ru': '', 'gemfile': '', '.gitignore': '', 'COMMIT_EDITMSG'
: '', 'src': '', '.gitmodules': '', 'makefile': '', 'rakefile': '', '.bashprofile': '', 'gulpfile
.coffee': '', 'gruntfile.js': '', '.zshenv': '', 'gruntfile.ls': '', 'node_modules': '', 'gulpfile
.js': '', '.bashrc': '', 'robots.txt': '', '.zshrc': '', 'mix.lock': '', 'gulpfile.ls': '', 'exac
t-match-case-sensitive-2': '2', 'docker-compose.yml': '', '.gitconfig': '', '.gitattributes': '', 'r
eact.jsx': '', 'exact-match-case-sensitive-1.txt': '1', 'dockerfile': '', '.zprofile': '', 'cmakelis
ts.txt': '', '.ds_store': '', 'favicon.ico': ''}
Copy Plug 'ryanoasis/vim-devicons'
Plug 'tiagofumo/vim-nerdtree-syntax-highlight'
" ryanoasis/vim-devicons
let g:WebDevIconsOS = 'Darwin'
let g:WebDevIconsUnicodeDecorateFolderNodes = 1
let g:WebDevIconsNerdTreeAfterGlyphPadding = ' '
let g:webdevicons_enable_nerdtree = 1
let g:webdevicons_enable_unite = 1
let g:webdevicons_enable_vimfiler = 1
let g:webdevicons_conceal_nerdtree_brackets = 1
let g:DevIconsEnableFoldersOpenClose = 1
let g:DevIconsDefaultFolderOpenSymbol = ''
let g:WebDevIconsUnicodeDecorateFolderNodesDefaultSymbol = ''
let g:DevIconsEnableFolderExtensionPatternMatching = 1
let g:WebDevIconsNerdTreeGitPluginForceVAlign = 1
let g:WebDevIconsUnicodeDecorateFileNodesExtensionSymbols = {}
let g:WebDevIconsUnicodeDecorateFileNodesExtensionSymbols['log'] = ''
let g:WebDevIconsUnicodeDecorateFileNodesExtensionSymbols['json'] = ''
let g:WebDevIconsUnicodeDecorateFileNodesExtensionSymbols['md'] = ''
let g:WebDevIconsUnicodeDecorateFileNodesExactSymbols = {}
let g:WebDevIconsUnicodeDecorateFileNodesExactSymbols['src'] = ''
if exists('g:loaded_webdevicons') | call webdevicons#refresh() | endif
" tiagofumo/vim-nerdtree-syntax-highlight
let s:brown = "905532" " #905532
let s:aqua = "3AFFDB" " #3AFFDB
let s:blue = "689FB6" " #689FB6
let s:darkBlue = "44788E" " #44788E
let s:purple = "834F79" " #834F79
let s:lightPurple = "834F79" " #834F79
let s:red = "AE403F" " #AE403F
let s:beige = "F5C06F" " #F5C06F
let s:yellow = "F09F17" " #F09F17
let s:orange = "D4843E" " #D4843E
let s:darkOrange = "F16529" " #F16529
let s:pink = "CB6F6F" " #CB6F6F
let s:salmon = "EE6E73" " #EE6E73
let s:green = "8FAA54" " #8FAA54
let s:lightGreen = "31B53E" " #31B53E
let s:white = "FFFFFF" " #FFFFFF
let s:rspec_red = 'FE405F' " #FE405F
let s:git_orange = 'F54D27' " #F54D27
let g:NERDTreeHighlightCursorline = 1
let g:NERDTreeExtensionHighlightColor = {}
let g:NERDTreeExtensionHighlightColor['groovy'] = s:beige
let g:NERDTreeExtensionHighlightColor['md'] = "CC6666"
let g:NERDTreeExactMatchHighlightColor = {}
let g:NERDTreeExactMatchHighlightColor['.gitignore'] = s:git_orange
let g:NERDTreePatternMatchHighlightColor = {}
let g:NERDTreePatternMatchHighlightColor['.*\.md$'] = s:yellow
let g:WebDevIconsDefaultFolderSymbolColor = s:beige
let g:WebDevIconsDefaultFileSymbolColor = s:darkBlue
let g:NERDTreeSyntaxEnabledExtensions = ['rb', 'sh', 'py', 'groovy', 'css', 'html']
let g:NERDTreeSyntaxEnabledExactMatches = ['.marslo', 'jenkins', 'virtualization', 'devops']
more settings for vim-devicon | latest
Copy Plug 'ryanoasis/vim-devicons'
let g:WebDevIconsUnicodeDecorateFolderNodes = 1
let g:DevIconsEnableFoldersOpenClose = 1
if exists("g:loaded_webdevicons") | call webdevicons#refresh() | endif
augroup devicons
autocmd!
autocmd FileType nerdtree setlocal nolist
autocmd FileType nerdtree syntax match hideBracketsInNerdTree "\]" contained conceal containedin=ALL
autocmd FileType nerdtree syntax match hideBracketsInNerdTree "\[" contained conceal containedin=ALL
autocmd FileType nerdtree setlocal conceallevel=3
autocmd FileType nerdtree setlocal concealcursor=nvic
augroup END
function! DeviconsColors(config)
let colors = keys(a:config)
augroup devicons_colors
autocmd!
for color in colors
if color == 'normal'
exec 'autocmd FileType nerdtree,startify if &background == ''dark'' | '.
\ 'highlight devicons_'.color.' guifg='.g:sol.gui.base01.' ctermfg='.g:sol.cterm.base01.' | '.
\ 'else | '.
\ 'highlight devicons_'.color.' guifg='.g:sol.gui.base1.' ctermfg='.g:sol.cterm.base1.' | '.
\ 'endif'
elseif color == 'emphasize'
exec 'autocmd FileType nerdtree,startify if &background == ''dark'' | '.
\ 'highlight devicons_'.color.' guifg='.g:sol.gui.base1.' ctermfg='.g:sol.cterm.base1.' | '.
\ 'else | '.
\ 'highlight devicons_'.color.' guifg='.g:sol.gui.base01.' ctermfg='.g:sol.cterm.base01.' | '.
\ 'endif'
else
exec 'autocmd FileType nerdtree,startify highlight devicons_'.color.' guifg='.g:sol.gui[color].' ctermfg='.g:sol.cterm[color]
endif
exec 'autocmd FileType nerdtree,startify syntax match devicons_'.color.' /\v'.join(a:config[color], '|').'/ containedin=ALL'
endfor
augroup END
endfunction
let g:devicons_colors = {
\'normal': ['', '', '', '', ''],
\'emphasize': ['', '', '', '', '', '', '', '', '', '', ''],
\'yellow': ['', '', ''],
\'orange': ['', '', '', 'λ', '', ''],
\'red': ['', '', '', '', '', '', '', '', ''],
\'magenta': [''],
\'violet': ['', '', '', ''],
\'blue': ['', '', '', '', '', '', '', '', '', '', '', '', ''],
\'cyan': ['', '', '', ''],
\'green': ['', '', '', '']
\}
call DeviconsColors(g:devicons_colors)
Copy 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
utils
Copy 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>
Copy " ~/.vimrc
if has( 'persistent_undo' )
if has('nvim')
let target_path = expand( '~/.vim/undo' )
set undodir=expand('~/.vim/undo')
else
let target_path = expand( '~/.vim/undo/vundo' )
endif
if !isdirectory( target_path )
call system( 'mkdir -p ' . target_path )
endif
set undofile
let &undodir=target_path
endif
Copy " ~/.vimrc.d/extension
Plug 'simnalamburt/vim-mundo'
"simnalamburt/vim-mundo
noremap <Leader>u :MundoToggle<CR>
let g:mundo_prefer_python3 = 1
let g:mundo_width = 26
Copy 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/.*'
[!NOTE|label:references:]
markdown
Copy 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 " =1 to disable folding
let g:vim_markdown_new_list_item_indent = 2
other configurations
Copy 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.'>>'"
Copy Plug 'dhruvasagar/vim-table-mode'
noremap <Leader>tm :TableModeToggle<CR>
let g:tabular_loaded = 1
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 = '+'
automatic alignment table in markdown
Copy 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>' : '__'
Copy Plug 'godlygeek/tabular'
" settings
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>
endif
function for auto-alignment
Copy 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
git
call bash cmd in silent mode
Copy nnoremap <leader>mp :execute 'silent !git push --force' \| redraw!<CR>
" or to call gitalias
nnoremap <leader>mp :execute 'silent !git mp' \| redraw!<CR>
[!NOTE|label:references:]
Copy Plug 'airblade/vim-gitgutter'
" airblade/vim-gitgutter
set updatetime=250
set signcolumn=yes
let g:gitgutter_enabled = 1
let g:gitgutter_realtime = 0
let g:gitgutter_eager = 0
if has('win32') || has('win64')
let g:gitgutter_git_executable = 'c:\iMarslo\myprograms\Git\bin\git.exe'
else
let g:gitgutter_git_executable = '/usr/local/bin/git'
endif
highlight clear SignColumn
shortcuts
Copy noremap ]h :GitGutterNextHunk<CR>
noremap [h :GitGutterPrevHunk<CR>
:GitGutterNextHunk<CR>
: ] + h
:GitGutterPrevHunk<CR>
: [ + h
Copy 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'
Copy 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 = ' '
let g:blamer_template = '<committer> • <commit-short> • <summary>'
Copy " zivyangll/git-blame.vim
nnoremap <Leader>ebb :<C-u>call gitblame#echo()<CR>
troubleshooting
airline
[!NOTE|label:references:]
fonts
lujiacn/Monaco for Powerline.md
Copy if has("mac") || has("macunix")
set guifont=Monaco\ for\ Powerline:h24
elseif has("win32") || has("win64")
set guifont=Monaco\ for\ Powerline:h14:cANSI
set renderoptions=type:directx,renmode:5
endif
solution : install powerline fonts
[!NOTE]
Copy $ 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