# HG changeset patch # User luka # Date 1764337517 18000 # Node ID eeda6b1401ae94a831b3da6d68645ba94403544e # Parent 9c80955f0c6e3ece36fc031c6927fe6a20baf948 changing files to .vim diff -r 9c80955f0c6e -r eeda6b1401ae .vimrc --- a/.vimrc Fri Oct 31 14:24:31 2025 -0400 +++ b/.vimrc Fri Nov 28 08:45:17 2025 -0500 @@ -6,7 +6,7 @@ inoremap " Support for tags closing and classes -source $HOME/.vim/plugins/taghelp +source $HOME/.vim/plugins/taghelp.vim source $HOME/.vim/plugins/dbtables/dbtables.vim source $HOME/.vim/plugins/hghelp/hghelp.vim source $HOME/.vim/plugins/globalsearch.vim @@ -83,17 +83,17 @@ " Environment Plugins " " NERDTree -source $HOME/.vim/plugins/nerdtree +source $HOME/.vim/plugins/nerdtree.vim " Coding and language specifics " " LSP - ale -source $HOME/.vim/plugins/ale +source $HOME/.vim/plugins/ale.vim " Blade Plug 'jwalton512/vim-blade', { 'for': 'php' } " Use release branch (recommended) -source $HOME/.vim/plugins/coc +source $HOME/.vim/plugins/coc.vim " AI-ify Plug 'madox2/vim-ai' @@ -106,7 +106,7 @@ call plug#end() " CTRLP -source $HOME/.vim/plugins/ctrlp +source $HOME/.vim/plugins/ctrlp.vim " Netwr set nocp diff -r 9c80955f0c6e -r eeda6b1401ae plugins/ale --- a/plugins/ale Fri Oct 31 14:24:31 2025 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,19 +0,0 @@ -" LSP client -Plug 'dense-analysis/ale' - -let g:ale_php_langserver_executable = expand('~/.config/composer/vendor/phpactor/language-server/bin/serve.php') - -let g:ale_linters = { -\ 'php': ['phpcs', 'phpstan', 'psalm', 'ctags'], -\} - -let g:ale_php_ctags_executable = 'ctags' - -" Enable completion where available. -" This setting must be set before ALE is loaded. -" -" You should not turn this setting on if you wish to use ALE as a completion -" source for other completion plugins, like Deoplete. -let g:ale_completion_enabled = 0 -let g:ale_sign_column_always = 1 -let g:ale_lint_delay = 500 diff -r 9c80955f0c6e -r eeda6b1401ae plugins/ale.vim --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/plugins/ale.vim Fri Nov 28 08:45:17 2025 -0500 @@ -0,0 +1,19 @@ +" LSP client +Plug 'dense-analysis/ale' + +let g:ale_php_langserver_executable = expand('~/.config/composer/vendor/phpactor/language-server/bin/serve.php') + +let g:ale_linters = { +\ 'php': ['phpcs', 'phpstan', 'psalm', 'ctags'], +\} + +let g:ale_php_ctags_executable = 'ctags' + +" Enable completion where available. +" This setting must be set before ALE is loaded. +" +" You should not turn this setting on if you wish to use ALE as a completion +" source for other completion plugins, like Deoplete. +let g:ale_completion_enabled = 0 +let g:ale_sign_column_always = 1 +let g:ale_lint_delay = 500 diff -r 9c80955f0c6e -r eeda6b1401ae plugins/coc --- a/plugins/coc Fri Oct 31 14:24:31 2025 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,163 +0,0 @@ -Plug 'neoclide/coc.nvim', {'branch': 'release'} -" https://raw.githubusercontent.com/neoclide/coc.nvim/master/doc/coc-example-config.vim - -" May need for Vim (not Neovim) since coc.nvim calculates byte offset by count -" utf-8 byte sequence -set encoding=utf-8 -" Some servers have issues with backup files, see #649 -set nobackup -set nowritebackup - -" Having longer updatetime (default is 4000 ms = 4s) leads to noticeable -" delays and poor user experience -set updatetime=300 - -" Always show the signcolumn, otherwise it would shift the text each time -" diagnostics appear/become resolved -set signcolumn=yes - -" Use tab for trigger completion with characters ahead and navigate -" NOTE: There's always complete item selected by default, you may want to enable -" no select by `"suggest.noselect": true` in your configuration file -" NOTE: Use command ':verbose imap ' to make sure tab is not mapped by -" other plugin before putting this into your config -inoremap - \ coc#pum#visible() ? coc#pum#next(1) : - \ CheckBackspace() ? "\" : - \ coc#refresh() -inoremap coc#pum#visible() ? coc#pum#prev(1) : "\" - -" Make to accept selected completion item or notify coc.nvim to format -" u breaks current undo, please make your own choice -inoremap coc#pum#visible() ? coc#pum#confirm() - \: "\u\\=coc#on_enter()\" - -function! CheckBackspace() abort - let col = col('.') - 1 - return !col || getline('.')[col - 1] =~# '\s' -endfunction - -" Use to trigger completion -if has('nvim') - inoremap coc#refresh() -else - inoremap coc#refresh() -endif - -" Use `[g` and `]g` to navigate diagnostics -" Use `:CocDiagnostics` to get all diagnostics of current buffer in location list -nmap [g (coc-diagnostic-prev) -nmap ]g (coc-diagnostic-next) - -" GoTo code navigation -nmap gd (coc-definition) -nmap gy (coc-type-definition) -nmap gi (coc-implementation) -nmap gr (coc-references) - -" Use K to show documentation in preview window -nnoremap K :call ShowDocumentation() - -function! ShowDocumentation() - if CocAction('hasProvider', 'hover') - call CocActionAsync('doHover') - else - call feedkeys('K', 'in') - endif -endfunction - -" Highlight the symbol and its references when holding the cursor -autocmd CursorHold * silent call CocActionAsync('highlight') - -" Symbol renaming -nmap rn (coc-rename) - -" Formatting selected code -xmap f (coc-format-selected) -nmap f (coc-format-selected) - -augroup mygroup - autocmd! - " Setup formatexpr specified filetype(s) - autocmd FileType typescript,json setl formatexpr=CocAction('formatSelected') - " Update signature help on jump placeholder - autocmd User CocJumpPlaceholder call CocActionAsync('showSignatureHelp') -augroup end - -" Applying code actions to the selected code block -" Example: `aap` for current paragraph -xmap a (coc-codeaction-selected) -nmap a (coc-codeaction-selected) - -" Remap keys for applying code actions at the cursor position -nmap ac (coc-codeaction-cursor) -" Remap keys for apply code actions affect whole buffer -nmap as (coc-codeaction-source) -" Apply the most preferred quickfix action to fix diagnostic on the current line -nmap 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 -xmap if (coc-funcobj-i) -omap if (coc-funcobj-i) -xmap af (coc-funcobj-a) -omap af (coc-funcobj-a) -xmap ic (coc-classobj-i) -omap ic (coc-classobj-i) -xmap ac (coc-classobj-a) -omap ac (coc-classobj-a) - -" Remap and to scroll float windows/popups -if has('nvim-0.4.0') || has('patch-8.2.0750') - nnoremap coc#float#has_scroll() ? coc#float#scroll(1) : "\" - nnoremap coc#float#has_scroll() ? coc#float#scroll(0) : "\" - inoremap coc#float#has_scroll() ? "\=coc#float#scroll(1)\" : "\" - inoremap coc#float#has_scroll() ? "\=coc#float#scroll(0)\" : "\" - vnoremap coc#float#has_scroll() ? coc#float#scroll(1) : "\" - vnoremap coc#float#has_scroll() ? coc#float#scroll(0) : "\" -endif - -" Use CTRL-S for selections ranges -" Requires 'textDocument/selectionRange' support of language server -nmap (coc-range-select) -xmap (coc-range-select) - -" Add `:Format` command to format current buffer -command! -nargs=0 Format :call CocActionAsync('format') - -" Add `:Fold` command to fold current buffer -command! -nargs=? Fold :call CocAction('fold', ) - -" Add `:OR` command for organize imports of the current buffer -command! -nargs=0 OR :call CocActionAsync('runCommand', 'editor.action.organizeImport') - -" Add (Neo)Vim's native statusline support -" NOTE: Please see `:h coc-status` for integrations with external plugins that -" provide custom statusline: lightline.vim, vim-airline -set statusline^=%{coc#status()}%{get(b:,'coc_current_function','')} - -" Mappings for CoCList -" Show all diagnostics -nnoremap ca :CocList diagnostics -" Manage extensions -nnoremap ce :CocList extensions -" Show commands -nnoremap cc :CocList commands -" Find symbol of current document -nnoremap co :CocList outline -" Search workspace symbols -nnoremap cs :CocList -I symbols -" Do default action for next item -nnoremap cj :CocNext -" Do default action for previous item -nnoremap ck :CocPrev -" Resume latest coc list -nnoremap cp :CocListResume diff -r 9c80955f0c6e -r eeda6b1401ae plugins/coc.vim --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/plugins/coc.vim Fri Nov 28 08:45:17 2025 -0500 @@ -0,0 +1,163 @@ +Plug 'neoclide/coc.nvim', {'branch': 'release'} +" https://raw.githubusercontent.com/neoclide/coc.nvim/master/doc/coc-example-config.vim + +" May need for Vim (not Neovim) since coc.nvim calculates byte offset by count +" utf-8 byte sequence +set encoding=utf-8 +" Some servers have issues with backup files, see #649 +set nobackup +set nowritebackup + +" Having longer updatetime (default is 4000 ms = 4s) leads to noticeable +" delays and poor user experience +set updatetime=300 + +" Always show the signcolumn, otherwise it would shift the text each time +" diagnostics appear/become resolved +set signcolumn=yes + +" Use tab for trigger completion with characters ahead and navigate +" NOTE: There's always complete item selected by default, you may want to enable +" no select by `"suggest.noselect": true` in your configuration file +" NOTE: Use command ':verbose imap ' to make sure tab is not mapped by +" other plugin before putting this into your config +inoremap + \ coc#pum#visible() ? coc#pum#next(1) : + \ CheckBackspace() ? "\" : + \ coc#refresh() +inoremap coc#pum#visible() ? coc#pum#prev(1) : "\" + +" Make to accept selected completion item or notify coc.nvim to format +" u breaks current undo, please make your own choice +inoremap coc#pum#visible() ? coc#pum#confirm() + \: "\u\\=coc#on_enter()\" + +function! CheckBackspace() abort + let col = col('.') - 1 + return !col || getline('.')[col - 1] =~# '\s' +endfunction + +" Use to trigger completion +if has('nvim') + inoremap coc#refresh() +else + inoremap coc#refresh() +endif + +" Use `[g` and `]g` to navigate diagnostics +" Use `:CocDiagnostics` to get all diagnostics of current buffer in location list +nmap [g (coc-diagnostic-prev) +nmap ]g (coc-diagnostic-next) + +" GoTo code navigation +nmap gd (coc-definition) +nmap gy (coc-type-definition) +nmap gi (coc-implementation) +nmap gr (coc-references) + +" Use K to show documentation in preview window +nnoremap K :call ShowDocumentation() + +function! ShowDocumentation() + if CocAction('hasProvider', 'hover') + call CocActionAsync('doHover') + else + call feedkeys('K', 'in') + endif +endfunction + +" Highlight the symbol and its references when holding the cursor +autocmd CursorHold * silent call CocActionAsync('highlight') + +" Symbol renaming +nmap rn (coc-rename) + +" Formatting selected code +xmap f (coc-format-selected) +nmap f (coc-format-selected) + +augroup mygroup + autocmd! + " Setup formatexpr specified filetype(s) + autocmd FileType typescript,json setl formatexpr=CocAction('formatSelected') + " Update signature help on jump placeholder + autocmd User CocJumpPlaceholder call CocActionAsync('showSignatureHelp') +augroup end + +" Applying code actions to the selected code block +" Example: `aap` for current paragraph +xmap a (coc-codeaction-selected) +nmap a (coc-codeaction-selected) + +" Remap keys for applying code actions at the cursor position +nmap ac (coc-codeaction-cursor) +" Remap keys for apply code actions affect whole buffer +nmap as (coc-codeaction-source) +" Apply the most preferred quickfix action to fix diagnostic on the current line +nmap 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 +xmap if (coc-funcobj-i) +omap if (coc-funcobj-i) +xmap af (coc-funcobj-a) +omap af (coc-funcobj-a) +xmap ic (coc-classobj-i) +omap ic (coc-classobj-i) +xmap ac (coc-classobj-a) +omap ac (coc-classobj-a) + +" Remap and to scroll float windows/popups +if has('nvim-0.4.0') || has('patch-8.2.0750') + nnoremap coc#float#has_scroll() ? coc#float#scroll(1) : "\" + nnoremap coc#float#has_scroll() ? coc#float#scroll(0) : "\" + inoremap coc#float#has_scroll() ? "\=coc#float#scroll(1)\" : "\" + inoremap coc#float#has_scroll() ? "\=coc#float#scroll(0)\" : "\" + vnoremap coc#float#has_scroll() ? coc#float#scroll(1) : "\" + vnoremap coc#float#has_scroll() ? coc#float#scroll(0) : "\" +endif + +" Use CTRL-S for selections ranges +" Requires 'textDocument/selectionRange' support of language server +nmap (coc-range-select) +xmap (coc-range-select) + +" Add `:Format` command to format current buffer +command! -nargs=0 Format :call CocActionAsync('format') + +" Add `:Fold` command to fold current buffer +command! -nargs=? Fold :call CocAction('fold', ) + +" Add `:OR` command for organize imports of the current buffer +command! -nargs=0 OR :call CocActionAsync('runCommand', 'editor.action.organizeImport') + +" Add (Neo)Vim's native statusline support +" NOTE: Please see `:h coc-status` for integrations with external plugins that +" provide custom statusline: lightline.vim, vim-airline +set statusline^=%{coc#status()}%{get(b:,'coc_current_function','')} + +" Mappings for CoCList +" Show all diagnostics +nnoremap ca :CocList diagnostics +" Manage extensions +nnoremap ce :CocList extensions +" Show commands +nnoremap cc :CocList commands +" Find symbol of current document +nnoremap co :CocList outline +" Search workspace symbols +nnoremap cs :CocList -I symbols +" Do default action for next item +nnoremap cj :CocNext +" Do default action for previous item +nnoremap ck :CocPrev +" Resume latest coc list +nnoremap cp :CocListResume diff -r 9c80955f0c6e -r eeda6b1401ae plugins/ctrlp --- a/plugins/ctrlp Fri Oct 31 14:24:31 2025 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,9 +0,0 @@ -" Ignored files/directories from autocomplete (and CtrlP) -set wildignore+=*/tmp/* -set wildignore+=*.so -set wildignore+=*.zip -set wildignore+=*/vendor/bundle/* -set wildignore+=*/node_modules/* -set wildignore+=*node_modules/* -set wildignore+=*/vendor/* -set wildignore+=*vendor/* diff -r 9c80955f0c6e -r eeda6b1401ae plugins/ctrlp.vim --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/plugins/ctrlp.vim Fri Nov 28 08:45:17 2025 -0500 @@ -0,0 +1,9 @@ +" Ignored files/directories from autocomplete (and CtrlP) +set wildignore+=*/tmp/* +set wildignore+=*.so +set wildignore+=*.zip +set wildignore+=*/vendor/bundle/* +set wildignore+=*/node_modules/* +set wildignore+=*node_modules/* +set wildignore+=*/vendor/* +set wildignore+=*vendor/* diff -r 9c80955f0c6e -r eeda6b1401ae plugins/nerdtree --- a/plugins/nerdtree Fri Oct 31 14:24:31 2025 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,8 +0,0 @@ -Plug 'preservim/nerdtree' - -nnoremap n :NERDTreeFocus -nnoremap :NERDTree -nnoremap :NERDTreeToggle - -" Start NERDTree and leave the cursor in it. -" autocmd VimEnter * NERDTree diff -r 9c80955f0c6e -r eeda6b1401ae plugins/nerdtree.vim --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/plugins/nerdtree.vim Fri Nov 28 08:45:17 2025 -0500 @@ -0,0 +1,8 @@ +Plug 'preservim/nerdtree' + +nnoremap n :NERDTreeFocus +nnoremap :NERDTree +nnoremap :NERDTreeToggle + +" Start NERDTree and leave the cursor in it. +" autocmd VimEnter * NERDTree diff -r 9c80955f0c6e -r eeda6b1401ae plugins/taghelp --- a/plugins/taghelp Fri Oct 31 14:24:31 2025 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,97 +0,0 @@ -autocmd BufRead,BufNewFile *.blade.php set filetype=blade - - -" autocmd FileType blade inoremap > =CreateTag() - - -" Abbreviations -autocmd FileType blade iabbr class= class=""=Eatchar('\s') -autocmd FileType blade iabbr id= id=""=Eatchar('\s') -autocmd FileType blade iabbr log console.log()=Eatchar('\s') - - - - -func Eatchar(pat) - let c = nr2char(getchar(0)) - return (c =~ a:pat) ? '' : c -endfunc - -func CreateTag() - let line = getline('.') - let end = col('.') - 1 - let begin = end - 1 - let start = '' - let tagname_regexp = '[a-zA-Z0-9-_\.#]' - let first_chars = '[a-zA-Z0-9]' - let id_regexp = '[#]' - let class_regexp = '[\.]' - let tagname = '' - let id = '' - let classes = '' - let current_type = 0 " 0: tagname, 1: classes, 2: id - " incase the previous character was not in the usage - if line[begin] !~ first_chars - return '>' - endif - - " reverse until we leave the replacement - while begin > 0 - if line[begin] !~ tagname_regexp - let begin += 1 - break - endif - let begin -= 1 - endwhile - - let start = begin - - " start over reading the tag name - while begin < end - "deteremine if the type changes - if line[begin] =~ id_regexp - let current_type = 2 - elseif line[begin] =~ class_regexp - let current_type = 1 - "need a space in the class if there is already classes - if classes != '' - let classes .= ' ' - endif - else - " Write to the current type - if current_type == 0 - let tagname .= line[begin] - elseif current_type == 1 - let classes .= line[begin] - elseif current_type == 2 - let id .= line[begin] - endif - endif - - let begin += 1 - endwhile - - " Trim the strings, just in case - let tagname = trim(tagname) - let id = trim(id) - let classes = trim(classes) - - - let str = '<' .tagname - if id != '' - let str .= ' id="' . id . '"' - endif - if classes != '' - let str .= ' class="' . classes . '"' - endif - let str .= '> ' - " delete the previous characters - let del_count = (end-start) - execute "normal! " . del_count . "X" - " delete the char under the cursor - execute "normal! x" - - return str . repeat("\", len(tagname) + 4) - -endfunc - diff -r 9c80955f0c6e -r eeda6b1401ae plugins/taghelp.vim --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/plugins/taghelp.vim Fri Nov 28 08:45:17 2025 -0500 @@ -0,0 +1,97 @@ +autocmd BufRead,BufNewFile *.blade.php set filetype=blade + + +" autocmd FileType blade inoremap > =CreateTag() + + +" Abbreviations +autocmd FileType blade iabbr class= class=""=Eatchar('\s') +autocmd FileType blade iabbr id= id=""=Eatchar('\s') +autocmd FileType blade iabbr log console.log()=Eatchar('\s') + + + + +func Eatchar(pat) + let c = nr2char(getchar(0)) + return (c =~ a:pat) ? '' : c +endfunc + +func CreateTag() + let line = getline('.') + let end = col('.') - 1 + let begin = end - 1 + let start = '' + let tagname_regexp = '[a-zA-Z0-9-_\.#]' + let first_chars = '[a-zA-Z0-9]' + let id_regexp = '[#]' + let class_regexp = '[\.]' + let tagname = '' + let id = '' + let classes = '' + let current_type = 0 " 0: tagname, 1: classes, 2: id + " incase the previous character was not in the usage + if line[begin] !~ first_chars + return '>' + endif + + " reverse until we leave the replacement + while begin > 0 + if line[begin] !~ tagname_regexp + let begin += 1 + break + endif + let begin -= 1 + endwhile + + let start = begin + + " start over reading the tag name + while begin < end + "deteremine if the type changes + if line[begin] =~ id_regexp + let current_type = 2 + elseif line[begin] =~ class_regexp + let current_type = 1 + "need a space in the class if there is already classes + if classes != '' + let classes .= ' ' + endif + else + " Write to the current type + if current_type == 0 + let tagname .= line[begin] + elseif current_type == 1 + let classes .= line[begin] + elseif current_type == 2 + let id .= line[begin] + endif + endif + + let begin += 1 + endwhile + + " Trim the strings, just in case + let tagname = trim(tagname) + let id = trim(id) + let classes = trim(classes) + + + let str = '<' .tagname + if id != '' + let str .= ' id="' . id . '"' + endif + if classes != '' + let str .= ' class="' . classes . '"' + endif + let str .= '> ' + " delete the previous characters + let del_count = (end-start) + execute "normal! " . del_count . "X" + " delete the char under the cursor + execute "normal! x" + + return str . repeat("\", len(tagname) + 4) + +endfunc + diff -r 9c80955f0c6e -r eeda6b1401ae test.vim