From aca4398140adedc6fe666879dbe20eb2d3240970 Mon Sep 17 00:00:00 2001 From: jgmdev Date: Sat, 20 Jun 2015 01:06:56 -0400 Subject: [PATCH 01/42] Added more php and js plugins alongside a cpp omnicomplete plugin. --- .gitmodules | 18 ++++++++++++++++++ plugins/cpp-complete | 1 + plugins/js-jquery | 1 + plugins/js-jquery-doc | 1 + plugins/php-complete | 1 + plugins/php-cs-fixer | 1 + plugins/php-namespace | 1 + 7 files changed, 24 insertions(+) create mode 160000 plugins/cpp-complete create mode 160000 plugins/js-jquery create mode 160000 plugins/js-jquery-doc create mode 160000 plugins/php-complete create mode 160000 plugins/php-cs-fixer create mode 160000 plugins/php-namespace diff --git a/.gitmodules b/.gitmodules index 3deda34..002fbf8 100644 --- a/.gitmodules +++ b/.gitmodules @@ -67,3 +67,21 @@ [submodule "plugins/coffee-script"] path = plugins/coffee-script url = https://github.com/kchmck/vim-coffee-script.git +[submodule "plugins/php-namespace"] + path = plugins/php-namespace + url = https://github.com/arnaud-lb/vim-php-namespace.git +[submodule "plugins/php-cs-fixer"] + path = plugins/php-cs-fixer + url = https://github.com/stephpy/vim-php-cs-fixer.git +[submodule "plugins/php-complete"] + path = plugins/php-complete + url = https://github.com/shawncplus/phpcomplete.vim.git +[submodule "plugins/cpp-complete"] + path = plugins/cpp-complete + url = https://github.com/vim-scripts/OmniCppComplete.git +[submodule "plugins/js-jquery"] + path = plugins/js-jquery + url = https://github.com/itspriddle/vim-jquery.git +[submodule "plugins/js-jquery-doc"] + path = plugins/js-jquery-doc + url = https://github.com/lucapette/vim-jquery-doc.git diff --git a/plugins/cpp-complete b/plugins/cpp-complete new file mode 160000 index 0000000..2fac015 --- /dev/null +++ b/plugins/cpp-complete @@ -0,0 +1 @@ +Subproject commit 2fac015957895dffa6b298e3c028ac30560d015b diff --git a/plugins/js-jquery b/plugins/js-jquery new file mode 160000 index 0000000..61890d8 --- /dev/null +++ b/plugins/js-jquery @@ -0,0 +1 @@ +Subproject commit 61890d8e5ba8a873526fb91c6484aa445cc20b56 diff --git a/plugins/js-jquery-doc b/plugins/js-jquery-doc new file mode 160000 index 0000000..3293931 --- /dev/null +++ b/plugins/js-jquery-doc @@ -0,0 +1 @@ +Subproject commit 32939319b0bbf9714b3ba46fbe600a6842e96737 diff --git a/plugins/php-complete b/plugins/php-complete new file mode 160000 index 0000000..5832df7 --- /dev/null +++ b/plugins/php-complete @@ -0,0 +1 @@ +Subproject commit 5832df73c2e4f94e955cb569682ddee1943036d6 diff --git a/plugins/php-cs-fixer b/plugins/php-cs-fixer new file mode 160000 index 0000000..f51509f --- /dev/null +++ b/plugins/php-cs-fixer @@ -0,0 +1 @@ +Subproject commit f51509f7acbccc87298009f9bc5b9c6ab48f9f8f diff --git a/plugins/php-namespace b/plugins/php-namespace new file mode 160000 index 0000000..9a1c88c --- /dev/null +++ b/plugins/php-namespace @@ -0,0 +1 @@ +Subproject commit 9a1c88cd14162f61a3535d514b5d07a1e4f12805 From 26c449788044c511e990d0fa88bb375ab9d270d9 Mon Sep 17 00:00:00 2001 From: jgmdev Date: Sat, 20 Jun 2015 01:07:21 -0400 Subject: [PATCH 02/42] Improved php preset. --- presets/php.vim | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/presets/php.vim b/presets/php.vim index e64b9f3..1f1f42b 100644 --- a/presets/php.vim +++ b/presets/php.vim @@ -1,2 +1,18 @@ " php-doc : helpers for creating phpdoc -call vim_kicks_ass#with_plugins(["php-doc", "php-fix-html-indent"]) +call vim_kicks_ass#with_plugins(["php-doc","php-fix-html-indent"]) + +" add PhpDoc command and binding +com! -nargs=0 -bang PhpDoc call PhpDoc() +nnoremap pd :PhpDoc + +" php-complete : autocompletion support +call vim_kicks_ass#with_plugins(["php-complete"]) + +" enable code completion support +set omnifunc=syntaxcomplete#Complete + +" php-cs-fixer : format source code using PHP Coding Standards +call vim_kicks_ass#with_plugins(["php-cs-fixer"]) + +" php-namespace : insert needed namespaces at heading of file +call vim_kicks_ass#with_plugins(["php-namespace"]) From 2de3dd704cbbdf737867762c8a7751e456a712af Mon Sep 17 00:00:00 2001 From: jgmdev Date: Sat, 20 Jun 2015 01:07:52 -0400 Subject: [PATCH 03/42] Added javascript preset. --- presets/javascript.vim | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 presets/javascript.vim diff --git a/presets/javascript.vim b/presets/javascript.vim new file mode 100644 index 0000000..c72f792 --- /dev/null +++ b/presets/javascript.vim @@ -0,0 +1,5 @@ +" load dependencies +call vim_kicks_ass#with_plugins(["syntastic"]) + +" load plugins for javascript +call vim_kicks_ass#with_plugins(["javascript","json","js-jquery","js-jquery-doc"]) From daf7bda4263fe0a69a1e0e81e5009193cdb67756 Mon Sep 17 00:00:00 2001 From: jgmdev Date: Sat, 20 Jun 2015 01:14:07 -0400 Subject: [PATCH 04/42] Added jgmdev vimrc. --- templates/vimrc.jgmdev | 92 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 92 insertions(+) create mode 100644 templates/vimrc.jgmdev diff --git a/templates/vimrc.jgmdev b/templates/vimrc.jgmdev new file mode 100644 index 0000000..0aa270d --- /dev/null +++ b/templates/vimrc.jgmdev @@ -0,0 +1,92 @@ +" _ _ _ _ +" (_) | | (_) | | +" __ ___ _ __ ___ ______| | ___ ___| | _____ ______ __ _ ___ ___ +" \ \ / / | '_ ` _ \______| |/ / |/ __| |/ / __|______/ _` / __/ __| +" \ V /| | | | | | | | <| | (__| <\__ \ | (_| \__ \__ \ +" \_/ |_|_| |_| |_| |_|\_\_|\___|_|\_\___/ \__,_|___/___/ +" +" .vimrc used by jgmdev (github.com/jgmdev) +" +" -- based on template/vimrc +" -- based on template/vimrc.kibs + +" make sure we are in full Vim mode +set nocompatible + +" enable filetype specific plugins +filetype on +filetype plugin on +filetype indent on + +" which plugins to enable, can be a list of plugins or a single string +call vim_kicks_ass#with_plugins(["fugitive", "surround", "markdown"]) +call vim_kicks_ass#with_plugins(["autoclose","nerdcommenter","tabular"]) + +" fix: some weird issues with arrowkeys using autoclose in console +if !has("gui_running") + let g:AutoClosePreservDotReg = 0 +endif + +" load php preset +call vim_kicks_ass#using_presets("php") + +" load javascript preset +call vim_kicks_ass#using_presets("javascript") + +" load colorscheme +call vim_kicks_ass#using_colorschemes("jellybeans") +colorscheme jellybeans + +" editing options +syntax on +set ff=unix +set nowrap +set backspace=indent,eol,start +set tabstop=4 +set softtabstop=4 +set shiftwidth=4 +set expandtab +set copyindent +set shiftround +set autoindent +set smarttab +set undolevels=1000 +set number " linenumbering +set laststatus=2 " always show statusline +set statusline=%F\ %y%([%R%M]%)\ %{SyntasticStatuslineFlag()}\ %=%{getcwd()}\ %{fugitive#statusline()} +set visualbell +set noerrorbells +set nobackup +set noswapfile + +" override line number color +highlight LineNr ctermfg=Gray + +" override text selection color +highlight Visual ctermbg=DarkGreen ctermfg=White + +" display a right margin +set colorcolumn=81 +highlight ColorColumn ctermbg=White + +" enable code completion support +set omnifunc=syntaxcomplete#Complete + +" bind omni complete to ctrl + space +function! Auto_complete_string() + if pumvisible() + return "\" + else + return "\\\=Auto_complete_opened()\" + end +endfunction + +function! Auto_complete_opened() + if pumvisible() + return "\" + end + return "" +endfunction + +inoremap Auto_complete_string() +inoremap Auto_complete_string() From f483e5e06b06c12a3c6ff5436dd7448218fbbee9 Mon Sep 17 00:00:00 2001 From: jgmdev Date: Sat, 20 Jun 2015 04:36:29 -0400 Subject: [PATCH 05/42] Added easytags and misc plugins. --- .gitmodules | 9 +++++++++ plugins/easytags | 1 + plugins/misc | 1 + 3 files changed, 11 insertions(+) create mode 160000 plugins/easytags create mode 160000 plugins/misc diff --git a/.gitmodules b/.gitmodules index 002fbf8..b77f353 100644 --- a/.gitmodules +++ b/.gitmodules @@ -85,3 +85,12 @@ [submodule "plugins/js-jquery-doc"] path = plugins/js-jquery-doc url = https://github.com/lucapette/vim-jquery-doc.git +[submodule "plugins/easytags"] + path = plugins/easytags + url = https://github.com/xolox/vim-easytags +[submodule "misc"] + path = misc + url = https://github.com/xolox/vim-misc +[submodule "plugins/misc"] + path = plugins/misc + url = https://github.com/xolox/vim-misc.git diff --git a/plugins/easytags b/plugins/easytags new file mode 160000 index 0000000..a339a8c --- /dev/null +++ b/plugins/easytags @@ -0,0 +1 @@ +Subproject commit a339a8c4409f547e3e2bfd1e1c48975536935b46 diff --git a/plugins/misc b/plugins/misc new file mode 160000 index 0000000..3e6b8fb --- /dev/null +++ b/plugins/misc @@ -0,0 +1 @@ +Subproject commit 3e6b8fb6f03f13434543ce1f5d24f6a5d3f34f0b From 8a799c850fd8e65b9a23955ed25d26b977219d72 Mon Sep 17 00:00:00 2001 From: jgmdev Date: Sat, 20 Jun 2015 04:37:19 -0400 Subject: [PATCH 06/42] Minor php preset improvement. --- presets/php.vim | 1 + 1 file changed, 1 insertion(+) diff --git a/presets/php.vim b/presets/php.vim index 1f1f42b..a56cff1 100644 --- a/presets/php.vim +++ b/presets/php.vim @@ -7,6 +7,7 @@ nnoremap pd :PhpDoc " php-complete : autocompletion support call vim_kicks_ass#with_plugins(["php-complete"]) +let g:phpcomplete_parse_docblock_comments = 1 " enable code completion support set omnifunc=syntaxcomplete#Complete From 421860c23f6feb80aeddab0053075af36ad1c28d Mon Sep 17 00:00:00 2001 From: jgmdev Date: Sat, 20 Jun 2015 04:39:36 -0400 Subject: [PATCH 07/42] Enabled easytags on jgmdev template. --- templates/vimrc.jgmdev | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/templates/vimrc.jgmdev b/templates/vimrc.jgmdev index 0aa270d..b3c406c 100644 --- a/templates/vimrc.jgmdev +++ b/templates/vimrc.jgmdev @@ -19,9 +19,13 @@ filetype plugin on filetype indent on " which plugins to enable, can be a list of plugins or a single string +call vim_kicks_ass#with_plugins(["misc","easytags"]) call vim_kicks_ass#with_plugins(["fugitive", "surround", "markdown"]) call vim_kicks_ass#with_plugins(["autoclose","nerdcommenter","tabular"]) +" Enable non blocking tags generation +let g:easytags_async = 1 + " fix: some weird issues with arrowkeys using autoclose in console if !has("gui_running") let g:AutoClosePreservDotReg = 0 From a0de1732dabb5eb35c606bf52aac4f762e5ffe42 Mon Sep 17 00:00:00 2001 From: jgmdev Date: Sun, 21 Jun 2015 01:35:38 -0400 Subject: [PATCH 08/42] Added taglist plugin to jgmdev template --- templates/vimrc.jgmdev | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/vimrc.jgmdev b/templates/vimrc.jgmdev index b3c406c..5813fd8 100644 --- a/templates/vimrc.jgmdev +++ b/templates/vimrc.jgmdev @@ -19,7 +19,7 @@ filetype plugin on filetype indent on " which plugins to enable, can be a list of plugins or a single string -call vim_kicks_ass#with_plugins(["misc","easytags"]) +call vim_kicks_ass#with_plugins(["misc","easytags", "taglist"]) call vim_kicks_ass#with_plugins(["fugitive", "surround", "markdown"]) call vim_kicks_ass#with_plugins(["autoclose","nerdcommenter","tabular"]) From ba3e79d811b88ea19f9ff59901617a4fd5cb68d8 Mon Sep 17 00:00:00 2001 From: jgmdev Date: Sun, 21 Jun 2015 17:59:04 -0400 Subject: [PATCH 09/42] Added autocomplpop and neocomplete plugins. --- .gitmodules | 13 ++++++++----- plugins/autocomplpop | 1 + plugins/neocomplete | 1 + templates/vimrc.jgmdev | 36 +++++++++++++++++++----------------- 4 files changed, 29 insertions(+), 22 deletions(-) create mode 160000 plugins/autocomplpop create mode 160000 plugins/neocomplete diff --git a/.gitmodules b/.gitmodules index b77f353..c285fcd 100644 --- a/.gitmodules +++ b/.gitmodules @@ -57,7 +57,7 @@ url = https://github.com/vim-scripts/taglist.vim.git [submodule "plugins/easymotion"] path = plugins/easymotion - url = https://github.com/Lokaltog/vim-easymotion + url = https://github.com/Lokaltog/vim-easymotion.git [submodule "plugins/sparkup"] path = plugins/sparkup url = https://github.com/bingaman/vim-sparkup.git @@ -87,10 +87,13 @@ url = https://github.com/lucapette/vim-jquery-doc.git [submodule "plugins/easytags"] path = plugins/easytags - url = https://github.com/xolox/vim-easytags -[submodule "misc"] - path = misc - url = https://github.com/xolox/vim-misc + url = https://github.com/xolox/vim-easytags.git [submodule "plugins/misc"] path = plugins/misc url = https://github.com/xolox/vim-misc.git +[submodule "plugins/autocomplpop"] + path = plugins/autocomplpop + url = https://github.com/othree/vim-autocomplpop.git +[submodule "plugins/neocomplete"] + path = plugins/neocomplete + url = https://github.com/Shougo/neocomplete.vim.git diff --git a/plugins/autocomplpop b/plugins/autocomplpop new file mode 160000 index 0000000..c8fc239 --- /dev/null +++ b/plugins/autocomplpop @@ -0,0 +1 @@ +Subproject commit c8fc239b5e2d3e2a8b0dc10e9656ee5285bbf06c diff --git a/plugins/neocomplete b/plugins/neocomplete new file mode 160000 index 0000000..66cb31e --- /dev/null +++ b/plugins/neocomplete @@ -0,0 +1 @@ +Subproject commit 66cb31ed05861608329306eb92e081b19fac22da diff --git a/templates/vimrc.jgmdev b/templates/vimrc.jgmdev index 5813fd8..78b46c8 100644 --- a/templates/vimrc.jgmdev +++ b/templates/vimrc.jgmdev @@ -1,4 +1,3 @@ -" _ _ _ _ " (_) | | (_) | | " __ ___ _ __ ___ ______| | ___ ___| | _____ ______ __ _ ___ ___ " \ \ / / | '_ ` _ \______| |/ / |/ __| |/ / __|______/ _` / __/ __| @@ -19,7 +18,7 @@ filetype plugin on filetype indent on " which plugins to enable, can be a list of plugins or a single string -call vim_kicks_ass#with_plugins(["misc","easytags", "taglist"]) +call vim_kicks_ass#with_plugins(["misc","easytags", "taglist","l9","autocomplpop"]) call vim_kicks_ass#with_plugins(["fugitive", "surround", "markdown"]) call vim_kicks_ass#with_plugins(["autoclose","nerdcommenter","tabular"]) @@ -39,7 +38,6 @@ call vim_kicks_ass#using_presets("javascript") " load colorscheme call vim_kicks_ass#using_colorschemes("jellybeans") -colorscheme jellybeans " editing options syntax on @@ -63,10 +61,10 @@ set noerrorbells set nobackup set noswapfile -" override line number color +" override line number color to fix jellybeans issues highlight LineNr ctermfg=Gray -" override text selection color +" override text selection color to fix jellybeans issues highlight Visual ctermbg=DarkGreen ctermfg=White " display a right margin @@ -78,19 +76,23 @@ set omnifunc=syntaxcomplete#Complete " bind omni complete to ctrl + space function! Auto_complete_string() - if pumvisible() - return "\" - else - return "\\\=Auto_complete_opened()\" - end -endfunction - -function! Auto_complete_opened() - if pumvisible() - return "\" - end - return "" + return "\\" endfunction inoremap Auto_complete_string() inoremap Auto_complete_string() + +" set colorscheme +colorscheme darkblue + +" set key bindings +let maplocalleader = "," + +nnoremap s :TlistToggle +nnoremap j +nnoremap jh +nnoremap d :PhpDoc +nnoremap :tabp +nnoremap :tabn +nnoremap sq :wq +nnoremap q :q! From f432d43b5aef814afa6f4bbf08930a9cb0cf2e4b Mon Sep 17 00:00:00 2001 From: jgmdev Date: Sun, 21 Jun 2015 21:25:52 -0400 Subject: [PATCH 10/42] Enabled syntastic on jgmdev template. --- templates/vimrc.jgmdev | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/templates/vimrc.jgmdev b/templates/vimrc.jgmdev index 78b46c8..e7dc1bf 100644 --- a/templates/vimrc.jgmdev +++ b/templates/vimrc.jgmdev @@ -18,10 +18,15 @@ filetype plugin on filetype indent on " which plugins to enable, can be a list of plugins or a single string -call vim_kicks_ass#with_plugins(["misc","easytags", "taglist","l9","autocomplpop"]) -call vim_kicks_ass#with_plugins(["fugitive", "surround", "markdown"]) +call vim_kicks_ass#with_plugins(["misc","easytags","taglist"]) +call vim_kicks_ass#with_plugins(["l9","autocomplpop","syntastic"]) +call vim_kicks_ass#with_plugins(["fugitive","surround","markdown"]) call vim_kicks_ass#with_plugins(["autoclose","nerdcommenter","tabular"]) +" syntastic options +let g:syntastic_enable_signs=1 +let g:syntastic_auto_loc_list=1 + " Enable non blocking tags generation let g:easytags_async = 1 From 7498376b84f4927123d3e0e66576a534eed8c461 Mon Sep 17 00:00:00 2001 From: jgmdev Date: Sun, 21 Jun 2015 23:39:51 -0400 Subject: [PATCH 11/42] Enabled hlsearch on jgmdev template. --- templates/vimrc.jgmdev | 1 + 1 file changed, 1 insertion(+) diff --git a/templates/vimrc.jgmdev b/templates/vimrc.jgmdev index e7dc1bf..49d9cbc 100644 --- a/templates/vimrc.jgmdev +++ b/templates/vimrc.jgmdev @@ -65,6 +65,7 @@ set visualbell set noerrorbells set nobackup set noswapfile +set hlsearch " override line number color to fix jellybeans issues highlight LineNr ctermfg=Gray From 199c793ce456a1228ccc0c2f072fbfc33104cb0a Mon Sep 17 00:00:00 2001 From: jgmdev Date: Tue, 23 Jun 2015 18:34:23 -0400 Subject: [PATCH 12/42] Added html5 plugin and molokai colorscheme. --- .gitmodules | 3 + colors/molokai/colors/molokai.vim | 270 ++++++++++++++++++++++++++++++ plugins/html5 | 1 + templates/vimrc.jgmdev | 18 +- 4 files changed, 289 insertions(+), 3 deletions(-) create mode 100644 colors/molokai/colors/molokai.vim create mode 160000 plugins/html5 diff --git a/.gitmodules b/.gitmodules index c285fcd..c1b7b60 100644 --- a/.gitmodules +++ b/.gitmodules @@ -97,3 +97,6 @@ [submodule "plugins/neocomplete"] path = plugins/neocomplete url = https://github.com/Shougo/neocomplete.vim.git +[submodule "plugins/html5"] + path = plugins/html5 + url = https://github.com/othree/html5.vim.git diff --git a/colors/molokai/colors/molokai.vim b/colors/molokai/colors/molokai.vim new file mode 100644 index 0000000..2e4ba73 --- /dev/null +++ b/colors/molokai/colors/molokai.vim @@ -0,0 +1,270 @@ + +" Vim color file +" +" Author: Tomas Restrepo +" +" Note: Based on the monokai theme for textmate +" by Wimer Hazenberg and its darker variant +" by Hamish Stuart Macpherson +" + +hi clear + +set background=dark +if version > 580 + " no guarantees for version 5.8 and below, but this makes it stop + " complaining + hi clear + if exists("syntax_on") + syntax reset + endif +endif +let g:colors_name="molokai" + +if exists("g:molokai_original") + let s:molokai_original = g:molokai_original +else + let s:molokai_original = 0 +endif + + +hi Boolean guifg=#AE81FF +hi Character guifg=#E6DB74 +hi Number guifg=#AE81FF +hi String guifg=#E6DB74 +hi Conditional guifg=#F92672 gui=bold +hi Constant guifg=#AE81FF gui=bold +hi Cursor guifg=#000000 guibg=#F8F8F0 +hi iCursor guifg=#000000 guibg=#F8F8F0 +hi Debug guifg=#BCA3A3 gui=bold +hi Define guifg=#66D9EF +hi Delimiter guifg=#8F8F8F +hi DiffAdd guibg=#13354A +hi DiffChange guifg=#89807D guibg=#4C4745 +hi DiffDelete guifg=#960050 guibg=#1E0010 +hi DiffText guibg=#4C4745 gui=italic,bold + +hi Directory guifg=#A6E22E gui=bold +hi Error guifg=#960050 guibg=#1E0010 +hi ErrorMsg guifg=#F92672 guibg=#232526 gui=bold +hi Exception guifg=#A6E22E gui=bold +hi Float guifg=#AE81FF +hi FoldColumn guifg=#465457 guibg=#000000 +hi Folded guifg=#465457 guibg=#000000 +hi Function guifg=#A6E22E +hi Identifier guifg=#FD971F +hi Ignore guifg=#808080 guibg=bg +hi IncSearch guifg=#C4BE89 guibg=#000000 + +hi Keyword guifg=#F92672 gui=bold +hi Label guifg=#E6DB74 gui=none +hi Macro guifg=#C4BE89 gui=italic +hi SpecialKey guifg=#66D9EF gui=italic + +hi MatchParen guifg=#000000 guibg=#FD971F gui=bold +hi ModeMsg guifg=#E6DB74 +hi MoreMsg guifg=#E6DB74 +hi Operator guifg=#F92672 + +" complete menu +hi Pmenu guifg=#66D9EF guibg=#000000 +hi PmenuSel guibg=#808080 +hi PmenuSbar guibg=#080808 +hi PmenuThumb guifg=#66D9EF + +hi PreCondit guifg=#A6E22E gui=bold +hi PreProc guifg=#A6E22E +hi Question guifg=#66D9EF +hi Repeat guifg=#F92672 gui=bold +hi Search guifg=#FFFFFF guibg=#455354 +" marks +hi SignColumn guifg=#A6E22E guibg=#232526 +hi SpecialChar guifg=#F92672 gui=bold +hi SpecialComment guifg=#7E8E91 gui=bold +hi Special guifg=#66D9EF guibg=bg gui=italic +if has("spell") + hi SpellBad guisp=#FF0000 gui=undercurl + hi SpellCap guisp=#7070F0 gui=undercurl + hi SpellLocal guisp=#70F0F0 gui=undercurl + hi SpellRare guisp=#FFFFFF gui=undercurl +endif +hi Statement guifg=#F92672 gui=bold +hi StatusLine guifg=#455354 guibg=fg +hi StatusLineNC guifg=#808080 guibg=#080808 +hi StorageClass guifg=#FD971F gui=italic +hi Structure guifg=#66D9EF +hi Tag guifg=#F92672 gui=italic +hi Title guifg=#ef5939 +hi Todo guifg=#FFFFFF guibg=bg gui=bold + +hi Typedef guifg=#66D9EF +hi Type guifg=#66D9EF gui=none +hi Underlined guifg=#808080 gui=underline + +hi VertSplit guifg=#808080 guibg=#080808 gui=bold +hi VisualNOS guibg=#403D3D +hi Visual guibg=#403D3D +hi WarningMsg guifg=#FFFFFF guibg=#333333 gui=bold +hi WildMenu guifg=#66D9EF guibg=#000000 + +if s:molokai_original == 1 + hi Normal guifg=#F8F8F2 guibg=#272822 + hi Comment guifg=#75715E + hi CursorLine guibg=#3E3D32 + hi CursorLineNr guifg=#FD971F gui=none + hi CursorColumn guibg=#3E3D32 + hi ColorColumn guibg=#3B3A32 + hi LineNr guifg=#BCBCBC guibg=#3B3A32 + hi NonText guifg=#75715E + hi SpecialKey guifg=#75715E +else + hi Normal guifg=#F8F8F2 guibg=#1B1D1E + hi Comment guifg=#7E8E91 + hi CursorLine guibg=#293739 + hi CursorLineNr guifg=#FD971F gui=none + hi CursorColumn guibg=#293739 + hi ColorColumn guibg=#232526 + hi LineNr guifg=#465457 guibg=#232526 + hi NonText guifg=#465457 + hi SpecialKey guifg=#465457 +end + +" +" Support for 256-color terminal +" +if &t_Co > 255 + if s:molokai_original == 1 + hi Normal ctermbg=234 + hi CursorLine ctermbg=235 cterm=none + hi CursorLineNr ctermfg=208 cterm=none + else + hi Normal ctermfg=252 ctermbg=233 + hi CursorLine ctermbg=234 cterm=none + hi CursorLineNr ctermfg=208 cterm=none + endif + hi Boolean ctermfg=135 + hi Character ctermfg=144 + hi Number ctermfg=135 + hi String ctermfg=144 + hi Conditional ctermfg=161 cterm=bold + hi Constant ctermfg=135 cterm=bold + hi Cursor ctermfg=16 ctermbg=253 + hi Debug ctermfg=225 cterm=bold + hi Define ctermfg=81 + hi Delimiter ctermfg=241 + + hi DiffAdd ctermbg=24 + hi DiffChange ctermfg=181 ctermbg=239 + hi DiffDelete ctermfg=162 ctermbg=53 + hi DiffText ctermbg=102 cterm=bold + + hi Directory ctermfg=118 cterm=bold + hi Error ctermfg=219 ctermbg=89 + hi ErrorMsg ctermfg=199 ctermbg=16 cterm=bold + hi Exception ctermfg=118 cterm=bold + hi Float ctermfg=135 + hi FoldColumn ctermfg=67 ctermbg=16 + hi Folded ctermfg=67 ctermbg=16 + hi Function ctermfg=118 + hi Identifier ctermfg=208 cterm=none + hi Ignore ctermfg=244 ctermbg=232 + hi IncSearch ctermfg=193 ctermbg=16 + + hi keyword ctermfg=161 cterm=bold + hi Label ctermfg=229 cterm=none + hi Macro ctermfg=193 + hi SpecialKey ctermfg=81 + + hi MatchParen ctermfg=16 ctermbg=208 cterm=bold + hi ModeMsg ctermfg=229 + hi MoreMsg ctermfg=229 + hi Operator ctermfg=161 + + " complete menu + hi Pmenu ctermfg=81 ctermbg=16 + hi PmenuSel ctermfg=253 ctermbg=244 + hi PmenuSbar ctermbg=232 + hi PmenuThumb ctermfg=81 + + hi PreCondit ctermfg=118 cterm=bold + hi PreProc ctermfg=118 + hi Question ctermfg=81 + hi Repeat ctermfg=161 cterm=bold + hi Search ctermfg=253 ctermbg=66 + + " marks column + hi SignColumn ctermfg=118 ctermbg=235 + hi SpecialChar ctermfg=161 cterm=bold + hi SpecialComment ctermfg=245 cterm=bold + hi Special ctermfg=81 + if has("spell") + hi SpellBad ctermbg=52 + hi SpellCap ctermbg=17 + hi SpellLocal ctermbg=17 + hi SpellRare ctermfg=none ctermbg=none cterm=reverse + endif + hi Statement ctermfg=161 cterm=bold + hi StatusLine ctermfg=238 ctermbg=253 + hi StatusLineNC ctermfg=244 ctermbg=232 + hi StorageClass ctermfg=208 + hi Structure ctermfg=81 + hi Tag ctermfg=161 + hi Title ctermfg=166 + hi Todo ctermfg=231 ctermbg=232 cterm=bold + + hi Typedef ctermfg=81 + hi Type ctermfg=81 cterm=none + hi Underlined ctermfg=244 cterm=underline + + hi VertSplit ctermfg=244 ctermbg=232 cterm=bold + hi VisualNOS ctermbg=238 + hi Visual ctermbg=235 + hi WarningMsg ctermfg=231 ctermbg=238 cterm=bold + hi WildMenu ctermfg=81 ctermbg=16 + + hi Comment ctermfg=59 + hi CursorColumn ctermbg=234 + hi ColorColumn ctermbg=234 + hi LineNr ctermfg=250 ctermbg=234 + hi NonText ctermfg=59 + + hi SpecialKey ctermfg=59 + + if exists("g:rehash256") && g:rehash256 == 1 + hi Normal ctermfg=252 ctermbg=234 + hi CursorLine ctermbg=236 cterm=none + hi CursorLineNr ctermfg=208 cterm=none + + hi Boolean ctermfg=141 + hi Character ctermfg=222 + hi Number ctermfg=141 + hi String ctermfg=222 + hi Conditional ctermfg=197 cterm=bold + hi Constant ctermfg=141 cterm=bold + + hi DiffDelete ctermfg=125 ctermbg=233 + + hi Directory ctermfg=154 cterm=bold + hi Error ctermfg=125 ctermbg=233 + hi Exception ctermfg=154 cterm=bold + hi Float ctermfg=141 + hi Function ctermfg=154 + hi Identifier ctermfg=208 + + hi Keyword ctermfg=197 cterm=bold + hi Operator ctermfg=197 + hi PreCondit ctermfg=154 cterm=bold + hi PreProc ctermfg=154 + hi Repeat ctermfg=197 cterm=bold + + hi Statement ctermfg=197 cterm=bold + hi Tag ctermfg=197 + hi Title ctermfg=203 + hi Visual ctermbg=238 + + hi Comment ctermfg=244 + hi LineNr ctermfg=239 ctermbg=235 + hi NonText ctermfg=239 + hi SpecialKey ctermfg=239 + endif +end diff --git a/plugins/html5 b/plugins/html5 new file mode 160000 index 0000000..40e924c --- /dev/null +++ b/plugins/html5 @@ -0,0 +1 @@ +Subproject commit 40e924c9f333609e8c5b0bbf30775281e1cd9ccf diff --git a/templates/vimrc.jgmdev b/templates/vimrc.jgmdev index 49d9cbc..8d08826 100644 --- a/templates/vimrc.jgmdev +++ b/templates/vimrc.jgmdev @@ -21,7 +21,11 @@ filetype indent on call vim_kicks_ass#with_plugins(["misc","easytags","taglist"]) call vim_kicks_ass#with_plugins(["l9","autocomplpop","syntastic"]) call vim_kicks_ass#with_plugins(["fugitive","surround","markdown"]) -call vim_kicks_ass#with_plugins(["autoclose","nerdcommenter","tabular"]) +call vim_kicks_ass#with_plugins(["html5","nerdcommenter","tabular"]) + +" easytags options to disable features that affect peformance +let g:easytags_syntax_keyword = 'always' +let b:easytags_auto_highlight = 0 " syntastic options let g:syntastic_enable_signs=1 @@ -43,9 +47,11 @@ call vim_kicks_ass#using_presets("javascript") " load colorscheme call vim_kicks_ass#using_colorschemes("jellybeans") +call vim_kicks_ass#using_colorschemes("molokai") " editing options syntax on +set t_Co=256 " enable more colors for schemes that require them. set ff=unix set nowrap set backspace=indent,eol,start @@ -55,7 +61,7 @@ set shiftwidth=4 set expandtab set copyindent set shiftround -set autoindent +"set autoindent set smarttab set undolevels=1000 set number " linenumbering @@ -66,6 +72,12 @@ set noerrorbells set nobackup set noswapfile set hlsearch +set cursorline + +" improve performance +set nocursorcolumn +set norelativenumber +syntax sync minlines=500 " override line number color to fix jellybeans issues highlight LineNr ctermfg=Gray @@ -89,7 +101,7 @@ inoremap Auto_complete_string() inoremap Auto_complete_string() " set colorscheme -colorscheme darkblue +colorscheme molokai " set key bindings let maplocalleader = "," From fbdd9360f26a87d9000a1eb5ad15d258283d3afe Mon Sep 17 00:00:00 2001 From: jgmdev Date: Fri, 26 Jun 2015 13:18:19 -0400 Subject: [PATCH 13/42] Added autocmd to jgmdev template to strip trailing spaces and convert tabs to spaces on buf write. --- templates/vimrc.jgmdev | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/templates/vimrc.jgmdev b/templates/vimrc.jgmdev index 8d08826..4ed2533 100644 --- a/templates/vimrc.jgmdev +++ b/templates/vimrc.jgmdev @@ -114,3 +114,7 @@ nnoremap :tabp nnoremap :tabn nnoremap sq :wq nnoremap q :q! + +" auto commands +autocmd BufWritePre * :%s/\s\+$//e " strip trailing spaces +autocmd BufWritePre * :retab " convert tabs to spaces From 5e00f966847b04cf185dd6ae87fe7ad972a2df68 Mon Sep 17 00:00:00 2001 From: jgmdev Date: Fri, 26 Jun 2015 13:32:24 -0400 Subject: [PATCH 14/42] Fixed oh-my-zsh github link. --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 0a57991..d2a998f 100644 --- a/README.md +++ b/README.md @@ -8,8 +8,8 @@ colorschemes and custom made presets, which can be enabled or disabled easily us vim-kicks-ass plugin. You will also find templates which you can use as your own vimrc, or you can use them for inspiration for creating your own. -My inspiration comes from the great [oh-my-zsh](https://github.com/robbyrussel/oh-my-zsh) project, where a lot of -people has forked, contributed and otherwise helped creating a great framework for configuring zshell. I +My inspiration comes from the great [oh-my-zsh](https://github.com/robbyrussell/oh-my-zsh) project, where a lot of +people has forked, contributed and otherwise helped creating a great framework for configuring zshell. I wan't the same for VIM. I am not the greatest vimscript developer, nor am I the most advanced superuser of VIM, but with help from From 1de3ab43fb0e89b94f2b520aa135b0998af3eba7 Mon Sep 17 00:00:00 2001 From: jgmdev Date: Fri, 26 Jun 2015 13:56:57 -0400 Subject: [PATCH 15/42] Added closetag plugin. --- .gitmodules | 3 +++ plugins/closetag | 1 + templates/vimrc.jgmdev | 5 +++-- 3 files changed, 7 insertions(+), 2 deletions(-) create mode 160000 plugins/closetag diff --git a/.gitmodules b/.gitmodules index c1b7b60..d82a528 100644 --- a/.gitmodules +++ b/.gitmodules @@ -100,3 +100,6 @@ [submodule "plugins/html5"] path = plugins/html5 url = https://github.com/othree/html5.vim.git +[submodule "plugins/closetag"] + path = plugins/closetag + url = https://github.com/docunext/closetag.vim.git diff --git a/plugins/closetag b/plugins/closetag new file mode 160000 index 0000000..a52525b --- /dev/null +++ b/plugins/closetag @@ -0,0 +1 @@ +Subproject commit a52525b7220bb28309d1905108e9e8914fdb4112 diff --git a/templates/vimrc.jgmdev b/templates/vimrc.jgmdev index 4ed2533..b898d07 100644 --- a/templates/vimrc.jgmdev +++ b/templates/vimrc.jgmdev @@ -9,7 +9,7 @@ " -- based on template/vimrc " -- based on template/vimrc.kibs -" make sure we are in full Vim mode +" make sure we are in full Vim mode set nocompatible " enable filetype specific plugins @@ -22,6 +22,7 @@ call vim_kicks_ass#with_plugins(["misc","easytags","taglist"]) call vim_kicks_ass#with_plugins(["l9","autocomplpop","syntastic"]) call vim_kicks_ass#with_plugins(["fugitive","surround","markdown"]) call vim_kicks_ass#with_plugins(["html5","nerdcommenter","tabular"]) +call vim_kicks_ass#with_plugins("closetag") " easytags options to disable features that affect peformance let g:easytags_syntax_keyword = 'always' @@ -69,7 +70,7 @@ set laststatus=2 " always show statusline set statusline=%F\ %y%([%R%M]%)\ %{SyntasticStatuslineFlag()}\ %=%{getcwd()}\ %{fugitive#statusline()} set visualbell set noerrorbells -set nobackup +set nobackup set noswapfile set hlsearch set cursorline From ba4c1288c036918ece45f33b472c29656067af5f Mon Sep 17 00:00:00 2001 From: jgmdev Date: Fri, 26 Jun 2015 14:12:06 -0400 Subject: [PATCH 16/42] Adjusted jgmdev bindings. --- templates/vimrc.jgmdev | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/templates/vimrc.jgmdev b/templates/vimrc.jgmdev index b898d07..27ca538 100644 --- a/templates/vimrc.jgmdev +++ b/templates/vimrc.jgmdev @@ -111,8 +111,9 @@ nnoremap s :TlistToggle nnoremap j nnoremap jh nnoremap d :PhpDoc -nnoremap :tabp -nnoremap :tabn +nnoremap e :Explore +nnoremap [ :tabp +nnoremap ] :tabn nnoremap sq :wq nnoremap q :q! From 6d9096dc1b9d2c08bcfcecab6c779ede2c301640 Mon Sep 17 00:00:00 2001 From: jgmdev Date: Fri, 26 Jun 2015 15:01:31 -0400 Subject: [PATCH 17/42] Added dectecindent plugin. --- .gitmodules | 3 +++ plugins/detectindent | 1 + templates/vimrc.jgmdev | 24 +++++++++++++----------- 3 files changed, 17 insertions(+), 11 deletions(-) create mode 160000 plugins/detectindent diff --git a/.gitmodules b/.gitmodules index d82a528..42ba210 100644 --- a/.gitmodules +++ b/.gitmodules @@ -103,3 +103,6 @@ [submodule "plugins/closetag"] path = plugins/closetag url = https://github.com/docunext/closetag.vim.git +[submodule "plugins/detectindent"] + path = plugins/detectindent + url = https://github.com/ciaranm/detectindent diff --git a/plugins/detectindent b/plugins/detectindent new file mode 160000 index 0000000..c09ab6e --- /dev/null +++ b/plugins/detectindent @@ -0,0 +1 @@ +Subproject commit c09ab6effc29ef913c531816eb980460f8dc9ed2 diff --git a/templates/vimrc.jgmdev b/templates/vimrc.jgmdev index 27ca538..f8c52f2 100644 --- a/templates/vimrc.jgmdev +++ b/templates/vimrc.jgmdev @@ -22,31 +22,32 @@ call vim_kicks_ass#with_plugins(["misc","easytags","taglist"]) call vim_kicks_ass#with_plugins(["l9","autocomplpop","syntastic"]) call vim_kicks_ass#with_plugins(["fugitive","surround","markdown"]) call vim_kicks_ass#with_plugins(["html5","nerdcommenter","tabular"]) -call vim_kicks_ass#with_plugins("closetag") +call vim_kicks_ass#with_plugins(["closetag","detectindent"]) -" easytags options to disable features that affect peformance +" easytags options to enable/disable features that affect peformance let g:easytags_syntax_keyword = 'always' let b:easytags_auto_highlight = 0 +let g:easytags_async = 1 " syntastic options let g:syntastic_enable_signs=1 let g:syntastic_auto_loc_list=1 -" Enable non blocking tags generation -let g:easytags_async = 1 +" detectindent options +let g:detectindent_preferred_expandtab = 1 +let g:detectindent_preferred_indent = 4 +let g:detectindent_preferred_when_mixed = 1 " fix: some weird issues with arrowkeys using autoclose in console if !has("gui_running") let g:AutoClosePreservDotReg = 0 endif -" load php preset +" load presets call vim_kicks_ass#using_presets("php") - -" load javascript preset call vim_kicks_ass#using_presets("javascript") -" load colorscheme +" load colorschemes call vim_kicks_ass#using_colorschemes("jellybeans") call vim_kicks_ass#using_colorschemes("molokai") @@ -68,8 +69,8 @@ set undolevels=1000 set number " linenumbering set laststatus=2 " always show statusline set statusline=%F\ %y%([%R%M]%)\ %{SyntasticStatuslineFlag()}\ %=%{getcwd()}\ %{fugitive#statusline()} -set visualbell -set noerrorbells +"set visualbell +"set noerrorbells set nobackup set noswapfile set hlsearch @@ -101,7 +102,7 @@ endfunction inoremap Auto_complete_string() inoremap Auto_complete_string() -" set colorscheme +" set default colorscheme colorscheme molokai " set key bindings @@ -120,3 +121,4 @@ nnoremap q :q! " auto commands autocmd BufWritePre * :%s/\s\+$//e " strip trailing spaces autocmd BufWritePre * :retab " convert tabs to spaces +autocmd BufReadPost * :DetectIndent From 835d01730806115fb5c01ba506fdef5ac0ce82fd Mon Sep 17 00:00:00 2001 From: jgmdev Date: Fri, 26 Jun 2015 15:46:57 -0400 Subject: [PATCH 18/42] Added gitignore. --- .gitignore | 1 + 1 file changed, 1 insertion(+) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..a0e76af --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.netrwhist From 0133d4e87382c0425ab8b340922f54438d5c1cd6 Mon Sep 17 00:00:00 2001 From: jgmdev Date: Sat, 27 Jun 2015 17:44:19 -0400 Subject: [PATCH 19/42] Performance improvements to jgmdev template. --- templates/vimrc.jgmdev | 2 ++ 1 file changed, 2 insertions(+) diff --git a/templates/vimrc.jgmdev b/templates/vimrc.jgmdev index f8c52f2..0fa8f3f 100644 --- a/templates/vimrc.jgmdev +++ b/templates/vimrc.jgmdev @@ -80,6 +80,8 @@ set cursorline set nocursorcolumn set norelativenumber syntax sync minlines=500 +let g:loaded_matchparen=1 +set regexpengine=1 " seems to improve performance with cursorline " override line number color to fix jellybeans issues highlight LineNr ctermfg=Gray From fd347de04487fba00183c24ab0a3b24846490820 Mon Sep 17 00:00:00 2001 From: jgmdev Date: Wed, 25 Sep 2019 23:03:36 -0400 Subject: [PATCH 20/42] Added new submodules. --- .gitmodules | 12 ++++++++++++ colors/onedark.vim | 1 + plugins/fzf.vim | 1 + plugins/lightline.vim | 1 + plugins/nerdtree | 1 + 5 files changed, 16 insertions(+) create mode 160000 colors/onedark.vim create mode 160000 plugins/fzf.vim create mode 160000 plugins/lightline.vim create mode 160000 plugins/nerdtree diff --git a/.gitmodules b/.gitmodules index 42ba210..b648a00 100644 --- a/.gitmodules +++ b/.gitmodules @@ -106,3 +106,15 @@ [submodule "plugins/detectindent"] path = plugins/detectindent url = https://github.com/ciaranm/detectindent +[submodule "plugins/fzf.vim"] + path = plugins/fzf.vim + url = https://git::@github.com/junegunn/fzf.vim.git +[submodule "plugins/lightline.vim"] + path = plugins/lightline.vim + url = https://git::@github.com/itchyny/lightline.vim.git +[submodule "plugins/nerdtree"] + path = plugins/nerdtree + url = https://git::@github.com/scrooloose/nerdtree.git +[submodule "colors/onedark.vim"] + path = colors/onedark.vim + url = https://git::@github.com/joshdick/onedark.vim.git diff --git a/colors/onedark.vim b/colors/onedark.vim new file mode 160000 index 0000000..a9225db --- /dev/null +++ b/colors/onedark.vim @@ -0,0 +1 @@ +Subproject commit a9225db0fd9a2511dbb50d1a77f641411e959db1 diff --git a/plugins/fzf.vim b/plugins/fzf.vim new file mode 160000 index 0000000..359a80e --- /dev/null +++ b/plugins/fzf.vim @@ -0,0 +1 @@ +Subproject commit 359a80e3a34aacbd5257713b6a88aa085337166f diff --git a/plugins/lightline.vim b/plugins/lightline.vim new file mode 160000 index 0000000..c9ab296 --- /dev/null +++ b/plugins/lightline.vim @@ -0,0 +1 @@ +Subproject commit c9ab296e856bed4e694180efb6ffb692cf18ed8f diff --git a/plugins/nerdtree b/plugins/nerdtree new file mode 160000 index 0000000..bd744ea --- /dev/null +++ b/plugins/nerdtree @@ -0,0 +1 @@ +Subproject commit bd744eab8df5730db167a26486bc9afde46c4046 From 73eb16e842d4316e9cf8c7493b9c59238d647a98 Mon Sep 17 00:00:00 2001 From: jgmdev Date: Wed, 25 Sep 2019 23:05:39 -0400 Subject: [PATCH 21/42] Added support to activate plugins, colorschemes, etc... using repository urls or path. --- vim_kicks_ass.vim | 269 ++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 224 insertions(+), 45 deletions(-) diff --git a/vim_kicks_ass.vim b/vim_kicks_ass.vim index 3a24acf..1544480 100644 --- a/vim_kicks_ass.vim +++ b/vim_kicks_ass.vim @@ -1,19 +1,37 @@ " Manage your VIM configuration with help from everybody " Many thanks to Tim Pope and his pathogen plugin, " from where i copied some great functions -" -" Maintainer: Sune Kibsgaard Pedersen +" +" Maintainers: Sune Kibsgaard Pedersen +" Jefferson Gonzalez " Homepage: https://github.com/kibs/vim-kicks-ass " License: VIM License +" +" Thanks: https://github.com/junegunn/vim-plug +" which source code was used to impement +" git repository parsing and cloning. " make sure we only load once, also set this to 1 in .vimrc to disable plugin if exists("g:loaded_vim_kicks_ass") finish endif + let g:loaded_vim_kicks_ass = 1 -" vim_kicks_ass root folder +" make sure the git application is on path +if !executable('git') + echohl ErrorMsg + echo '[vim-kicks-ass] needs git to function.' + echohl None + finish +endif + +" vim_kicks_ass root folder and other settings let s:root = fnamemodify(resolve(expand(':p')), ":p:h") +let s:plugins_path = s:root."/plugins" +let s:colors_path = s:root."/colors" +let s:is_win = has('win32') +let s:base_spec = {'branch': 'master', 'frozen': 0} " ------------------------------------------------------- " public functions @@ -21,30 +39,79 @@ let s:root = fnamemodify(resolve(expand(':p')), ":p:h") " add plugins function vim_kicks_ass#with_plugins(plugins) - call s:add(s:listify(a:plugins), s:root.s:separator()."plugins", "plugin") + let plugins = s:download(s:listify(a:plugins), "plugins") + call s:add(plugins, s:path(s:plugins_path), "plugin") endfunction " remove plugins which should not be loaded function vim_kicks_ass#without_plugins(plugins) - call s:remove(s:listify(a:plugins), s:root.s:separator()."plugins") + call s:remove(s:listify(a:plugins), s:root.s:separator()."plugins") +endfunction + +" set the colorscheme which should be loaded and used +function vim_kicks_ass#using_colorschemes(schemes) + let schemes = s:download(s:listify(a:schemes), "colors") + call s:add(schemes, s:path(s:colors_path), "colorscheme") endfunction " load presets function vim_kicks_ass#using_presets(presets) - let sep = s:separator() - for preset in s:listify(a:presets) - let path = s:root.sep."presets".sep.preset.".vim" - if glob(path) == "" - call s:msg("preset ".preset." not found") - else - execute ":source ".path - endif - endfor + let sep = s:separator() + for preset in s:listify(a:presets) + let path = s:root.sep."presets".sep.preset.".vim" + if glob(path) == "" + call s:msg("preset ".preset." not found") + else + execute ":source ".path + endif + endfor endfunction -" set the colorscheme which should be loaded and used -function vim_kicks_ass#using_colorschemes(schemes) - call s:add(s:listify(a:schemes), s:root.s:separator()."colors", "colorscheme") +" update all submodules +function vim_kicks_ass#update_all() + call s:msg("checking for module updates") + echo system( + \ "cd ".s:root. + \ " && ". + \ "git submodule foreach git pull origin master" + \ ) +endfunction + +" add repo and enable it. +function vim_kicks_ass#with_repo(repo, type, ...) + let name = '' + let type = s:trim(a:type) + if a:0 == 1 + let name = vim_kicks_ass#add_repo(repo, type, a:1) + else + let name = vim_kicks_ass#add_repo(repo, type) + endif + call s:add(s:listify(name, s:path(s:root.'/'.type), a:type)) +endfunction + +" clones a repository if doesn't exists. +function vim_kicks_ass#add_repo(repo, type, ...) + if a:0 > 1 + return s:err('Invalid number of arguments (2..3)') + endif + let repo = s:trim(a:repo) + let rtype = s:trim(a:type) + let opts = a:0 == 1 ? s:parse_options(a:1) : s:base_spec + let name = get(opts, 'as', fnamemodify(repo, ':t:s?\.git$??')) + let spec = extend(s:infer_properties(name, repo, rtype), opts) + let rpath = rtype.'/'.name + if empty(glob(spec.dir)) + call s:msg("adding ".name) + call system("cd ".s:root." && "."git submodule add ".spec.uri." ".rpath) + call system("cd ".s:root." && "."git submodule update --init ".rpath) + if spec.branch != "master" + call system("cd ".spec.dir." && "."git checkout ".spec.branch) + endif + if has_key(spec, "do") + call system("cd ".spec.dir." && ".spec.do) + endif + endif + return name endfunction " ------------------------------------------------------- @@ -53,46 +120,59 @@ endfunction " make sure we always get a list from some data function s:listify(values) - if type(a:values) == type("") - return [a:values] - else - return a:values - endif + if type(a:values) == type("") + return [a:values] + else + return a:values + endif endfunction " tell user something function s:msg(message) - echo "[vim-kicks-ass] ".a:message + echo "[vim-kicks-ass] ".a:message +endfunction + +" downloads only plugins with a / separator. +function s:download(repos, type) + let repos = [] + for repo in a:repos + if repo =~ '/' + call add(repos, vim_kicks_ass#add_repo(repo, s:trim(a:type))) + else + call add(repos, repo) + endif + endfor + return repos endfunction " add dirs to runtimepath function s:add(dirs, root, type) - let paths = s:split(&rtp) - let sep = s:separator() - for dir in a:dirs - let path = a:root.sep.dir - if glob(path.sep."*") == "" - call s:msg("initializing ".a:type." ".dir) - call system("cd ".s:root." && git submodule update --init ".path) - endif - if index(paths, path) == -1 - let paths = insert(paths, path) - endif - endfor - let &rtp = s:join(paths) + let paths = s:split(&rtp) + let sep = s:separator() + for dir in a:dirs + let path = a:root.sep.dir + if glob(path.sep."*") == "" + call s:msg("initializing ".a:type." ".dir) + call system("cd ".s:root." && git submodule update --init ".path) + endif + if index(paths, path) == -1 + let paths = insert(paths, path) + endif + endfor + let &rtp = s:join(paths) endfunction " remove dirs from runtimepath function s:remove(dirs, root) - let paths = s:split(&rtp) - let sep = s:separator() - for dir in a:dirs - let i = index(paths, a:root.sep.dir) - if i != -1 - call remove(paths, i) - endif - endfor - let &rtp = s:join(paths) + let paths = s:split(&rtp) + let sep = s:separator() + for dir in a:dirs + let i = index(paths, a:root.sep.dir) + if i != -1 + call remove(paths, i) + endif + endfor + let &rtp = s:join(paths) endfunction " split a path into a list @@ -129,7 +209,106 @@ function s:join(...) return substitute(path,'^,','','') endfunction " }}}1 +function s:parse_options(arg) + let opts = copy(s:base_spec) + let type = type(a:arg) + if type == type('') + let opts.tag = a:arg + elseif type == type({}) + call extend(opts, a:arg) + if has_key(opts, 'dir') + let opts.dir = s:dirpath(expand(opts.dir)) + endif + else + throw 'Invalid argument type (expected: string of dictionary)' + endif + return opts +endfunction + +function s:infer_properties(name, repo, type) + let repo = a:repo + if s:is_local_plug(repo) + return {'dir': s:dirpath(expand(repo))} + else + if repo =~ ':' + let uri = repo + else + if repo !~ '/' + throw printf('Invalid argument: %s (implicit `vim-scripts` expansion is deprecated)', repo) + endif + let fmt = 'https://git::@github.com/%s.git' + let uri = printf(fmt, repo) + endif + let type_dir = s:path(s:root.'/'.s:trim(a:type)) + if !isdirectory(type_dir) + call mkdir(type_dir, "p") + endif + return {'dir': s:dirpath(type_dir.'/'.a:name), 'uri': uri} + endif +endfunction + +if s:is_win + function! s:rtp(spec) + return s:path(a:spec.dir . get(a:spec, 'rtp', '')) + endfunction + + function! s:path(path) + return s:trim(substitute(a:path, '/', '\', 'g')) + endfunction + + function! s:dirpath(path) + return s:path(a:path) . '\' + endfunction + + function! s:is_local_plug(repo) + return a:repo =~? '^[a-z]:\|^[%~]' + endfunction + + " Copied from fzf + function! s:wrap_cmds(cmds) + return map(['@echo off', 'for /f "tokens=4" %%a in (''chcp'') do set origchcp=%%a', 'chcp 65001 > nul'] + + \ (type(a:cmds) == type([]) ? a:cmds : [a:cmds]) + + \ ['chcp %origchcp% > nul'], 'v:val."\r"') + endfunction + + function! s:batchfile(cmd) + let batchfile = tempname().'.bat' + call writefile(s:wrap_cmds(a:cmd), batchfile) + let cmd = plug#shellescape(batchfile, {'shell': &shell, 'script': 1}) + if &shell =~# 'powershell\.exe$' + let cmd = '& ' . cmd + endif + return [batchfile, cmd] + endfunction +else + function! s:rtp(spec) + return s:dirpath(a:spec.dir . get(a:spec, 'rtp', '')) + endfunction + + function! s:path(path) + return s:trim(a:path) + endfunction + + function! s:dirpath(path) + return substitute(a:path, '[/\\]*$', '/', '') + endfunction + + function! s:is_local_plug(repo) + return a:repo[0] =~ '[/$~]' + endfunction +endif + " \ on Windows unless shellslash is set, / everywhere else. function s:separator() return !exists("+shellslash") || &shellslash ? '/' : '\' endfunction " }}}1 + +function s:trim(str) + return substitute(a:str, '[\/]\+$', '', '') +endfunction + +function s:err(msg) + echohl ErrorMsg + echom '[vim-kicks-ass] '.a:msg + echohl None +endfunction From 4ecdfd372626568920f6cd1c614cabf94b61e1c6 Mon Sep 17 00:00:00 2001 From: jgmdev Date: Wed, 25 Sep 2019 23:09:01 -0400 Subject: [PATCH 22/42] Updated submodules to latest commits. --- colors/jellybeans | 2 +- plugins/autocomplpop | 2 +- plugins/easytags | 2 +- plugins/fugitive | 2 +- plugins/html5 | 2 +- plugins/javascript | 2 +- plugins/markdown | 2 +- plugins/nerdcommenter | 2 +- plugins/php-complete | 2 +- plugins/php-cs-fixer | 2 +- plugins/php-namespace | 2 +- plugins/surround | 2 +- plugins/syntastic | 2 +- plugins/tabular | 2 +- 14 files changed, 14 insertions(+), 14 deletions(-) diff --git a/colors/jellybeans b/colors/jellybeans index 9e4b612..ef83bf4 160000 --- a/colors/jellybeans +++ b/colors/jellybeans @@ -1 +1 @@ -Subproject commit 9e4b612bc6729f8a6f39d2f37755511236a93ff9 +Subproject commit ef83bf4dc8b3eacffc97bf5c96ab2581b415c9fa diff --git a/plugins/autocomplpop b/plugins/autocomplpop index c8fc239..5ceb2df 160000 --- a/plugins/autocomplpop +++ b/plugins/autocomplpop @@ -1 +1 @@ -Subproject commit c8fc239b5e2d3e2a8b0dc10e9656ee5285bbf06c +Subproject commit 5ceb2dfd368b36af029fabaed1bef3c5c4306d34 diff --git a/plugins/easytags b/plugins/easytags index a339a8c..72a8753 160000 --- a/plugins/easytags +++ b/plugins/easytags @@ -1 +1 @@ -Subproject commit a339a8c4409f547e3e2bfd1e1c48975536935b46 +Subproject commit 72a8753b5d0a951e547c51b13633f680a95b5483 diff --git a/plugins/fugitive b/plugins/fugitive index dba7bad..417b3bb 160000 --- a/plugins/fugitive +++ b/plugins/fugitive @@ -1 +1 @@ -Subproject commit dba7bad83629ade30548c95c6cd88440603aad49 +Subproject commit 417b3bb818f86d2a92dbb0ee3857af7de1ade8c8 diff --git a/plugins/html5 b/plugins/html5 index 40e924c..3db896b 160000 --- a/plugins/html5 +++ b/plugins/html5 @@ -1 +1 @@ -Subproject commit 40e924c9f333609e8c5b0bbf30775281e1cd9ccf +Subproject commit 3db896baa26839b866db3db5d8997cc830874a24 diff --git a/plugins/javascript b/plugins/javascript index 9990a76..b6c8c84 160000 --- a/plugins/javascript +++ b/plugins/javascript @@ -1 +1 @@ -Subproject commit 9990a767695c78a44611ce33fb2dbc25c83d8827 +Subproject commit b6c8c8419240bdd29b5eb51a47d488fd390deed5 diff --git a/plugins/markdown b/plugins/markdown index 34e28b3..a2e123a 160000 --- a/plugins/markdown +++ b/plugins/markdown @@ -1 +1 @@ -Subproject commit 34e28b3f6f6d702ff2963b8196eccae9344ed4bc +Subproject commit a2e123a288a72efe3f800c3a90736f9d2e48ebea diff --git a/plugins/nerdcommenter b/plugins/nerdcommenter index b28e7be..50f307b 160000 --- a/plugins/nerdcommenter +++ b/plugins/nerdcommenter @@ -1 +1 @@ -Subproject commit b28e7be63235982501ab7dd30c03ea7feef7b095 +Subproject commit 50f307bbf68e7402a1564689910ec65ae7ab1781 diff --git a/plugins/php-complete b/plugins/php-complete index 5832df7..d074960 160000 --- a/plugins/php-complete +++ b/plugins/php-complete @@ -1 +1 @@ -Subproject commit 5832df73c2e4f94e955cb569682ddee1943036d6 +Subproject commit d0749608acd360f4f93342bed75020b1f4b8ec81 diff --git a/plugins/php-cs-fixer b/plugins/php-cs-fixer index f51509f..2a8a757 160000 --- a/plugins/php-cs-fixer +++ b/plugins/php-cs-fixer @@ -1 +1 @@ -Subproject commit f51509f7acbccc87298009f9bc5b9c6ab48f9f8f +Subproject commit 2a8a75744b05da48504b1a30b11521e62597104a diff --git a/plugins/php-namespace b/plugins/php-namespace index 9a1c88c..8741c0a 160000 --- a/plugins/php-namespace +++ b/plugins/php-namespace @@ -1 +1 @@ -Subproject commit 9a1c88cd14162f61a3535d514b5d07a1e4f12805 +Subproject commit 8741c0a71758fc4525efa0e7b09ae5ed81522126 diff --git a/plugins/surround b/plugins/surround index d9e6bfd..fab8621 160000 --- a/plugins/surround +++ b/plugins/surround @@ -1 +1 @@ -Subproject commit d9e6bfdd902fc661c8fd58ede248ccfc3b3039d7 +Subproject commit fab8621670f71637e9960003af28365129b1dfd0 diff --git a/plugins/syntastic b/plugins/syntastic index 88dbca8..0336c35 160000 --- a/plugins/syntastic +++ b/plugins/syntastic @@ -1 +1 @@ -Subproject commit 88dbca87c80de9b7852672907f6fc9fb935f531c +Subproject commit 0336c35c0b10b46d85cdd9c3df721f978429e82c diff --git a/plugins/tabular b/plugins/tabular index b7b4d87..339091a 160000 --- a/plugins/tabular +++ b/plugins/tabular @@ -1 +1 @@ -Subproject commit b7b4d8791a50013b56c2d68b6c5708c808203b54 +Subproject commit 339091ac4dd1f17e225fe7d57b48aff55f99b23a From a823bcae3c849655f4dcc3d12679234cbe2e88a3 Mon Sep 17 00:00:00 2001 From: jgmdev Date: Thu, 26 Sep 2019 03:47:12 -0400 Subject: [PATCH 23/42] Disable newer php-complete plugin. --- presets/php.vim | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/presets/php.vim b/presets/php.vim index a56cff1..f808841 100644 --- a/presets/php.vim +++ b/presets/php.vim @@ -6,12 +6,10 @@ com! -nargs=0 -bang PhpDoc call PhpDoc() nnoremap pd :PhpDoc " php-complete : autocompletion support -call vim_kicks_ass#with_plugins(["php-complete"]) +" enable php-complete for newer code completion code base +"call vim_kicks_ass#with_plugins(["php-complete"]) let g:phpcomplete_parse_docblock_comments = 1 -" enable code completion support -set omnifunc=syntaxcomplete#Complete - " php-cs-fixer : format source code using PHP Coding Standards call vim_kicks_ass#with_plugins(["php-cs-fixer"]) From ea39dd4a59f4a0f476f7566d72625fdb8c431ab0 Mon Sep 17 00:00:00 2001 From: jgmdev Date: Thu, 26 Sep 2019 04:01:19 -0400 Subject: [PATCH 24/42] Replaced json plugin with newer version. --- .gitmodules | 6 +++ plugins/json/README.markdown | 5 --- plugins/json/ftdetect/json.vim | 1 - plugins/json/syntax/json.vim | 77 ---------------------------------- plugins/vim-json | 1 + plugins/vim-polyglot | 1 + presets/javascript.vim | 4 +- 7 files changed, 11 insertions(+), 84 deletions(-) delete mode 100644 plugins/json/README.markdown delete mode 100644 plugins/json/ftdetect/json.vim delete mode 100644 plugins/json/syntax/json.vim create mode 160000 plugins/vim-json create mode 160000 plugins/vim-polyglot diff --git a/.gitmodules b/.gitmodules index b648a00..39443cb 100644 --- a/.gitmodules +++ b/.gitmodules @@ -118,3 +118,9 @@ [submodule "colors/onedark.vim"] path = colors/onedark.vim url = https://git::@github.com/joshdick/onedark.vim.git +[submodule "plugins/vim-polyglot"] + path = plugins/vim-polyglot + url = https://git::@github.com/sheerun/vim-polyglot.git +[submodule "plugins/vim-json"] + path = plugins/vim-json + url = https://git::@github.com/elzr/vim-json.git diff --git a/plugins/json/README.markdown b/plugins/json/README.markdown deleted file mode 100644 index 2e3f08f..0000000 --- a/plugins/json/README.markdown +++ /dev/null @@ -1,5 +0,0 @@ -json.vim -============ - -Syntax highlighting for json files, created by Jeroen Ruigrok van der Werven -and taken from [vim.org](http://www.vim.org/scripts/script.php?script_id=1945) diff --git a/plugins/json/ftdetect/json.vim b/plugins/json/ftdetect/json.vim deleted file mode 100644 index a028791..0000000 --- a/plugins/json/ftdetect/json.vim +++ /dev/null @@ -1 +0,0 @@ -autocmd BufNewFile,BufRead *.json set filetype=json foldmethod=syntax diff --git a/plugins/json/syntax/json.vim b/plugins/json/syntax/json.vim deleted file mode 100644 index f3e27ba..0000000 --- a/plugins/json/syntax/json.vim +++ /dev/null @@ -1,77 +0,0 @@ -" Vim syntax file -" Language: JSON -" Maintainer: Jeroen Ruigrok van der Werven -" Last Change: 2009-06-16 -" Version: 0.4 -" {{{1 - -" Syntax setup {{{2 -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded - -if !exists("main_syntax") - if version < 600 - syntax clear - elseif exists("b:current_syntax") - finish - endif - let main_syntax = 'json' -endif - -" Syntax: Strings {{{2 -syn region jsonString start=+"+ skip=+\\\\\|\\"+ end=+"+ contains=jsonEscape -" Syntax: JSON does not allow strings with single quotes, unlike JavaScript. -syn region jsonStringSQ start=+'+ skip=+\\\\\|\\"+ end=+'+ - -" Syntax: Escape sequences {{{3 -syn match jsonEscape "\\["\\/bfnrt]" contained -syn match jsonEscape "\\u\x\{4}" contained - -" Syntax: Strings should always be enclosed with quotes. -syn match jsonNoQuotes "\<\a\+\>" - -" Syntax: Numbers {{{2 -syn match jsonNumber "-\=\<\%(0\|[1-9]\d*\)\%(\.\d\+\)\=\%([eE][-+]\=\d\+\)\=\>" - -" Syntax: An integer part of 0 followed by other digits is not allowed. -syn match jsonNumError "-\=\<0\d\.\d*\>" - -" Syntax: Boolean {{{2 -syn keyword jsonBoolean true false - -" Syntax: Null {{{2 -syn keyword jsonNull null - -" Syntax: Braces {{{2 -syn match jsonBraces "[{}\[\]]" - -" Define the default highlighting. {{{1 -" For version 5.7 and earlier: only when not done already -" For version 5.8 and later: only when an item doesn't have highlighting yet -if version >= 508 || !exists("did_json_syn_inits") - if version < 508 - let did_json_syn_inits = 1 - command -nargs=+ HiLink hi link - else - command -nargs=+ HiLink hi def link - endif - HiLink jsonString String - HiLink jsonEscape Special - HiLink jsonNumber Number - HiLink jsonBraces Operator - HiLink jsonNull Function - HiLink jsonBoolean Boolean - - HiLink jsonNumError Error - HiLink jsonStringSQ Error - HiLink jsonNoQuotes Error - delcommand HiLink -endif - -let b:current_syntax = "json" -if main_syntax == 'json' - unlet main_syntax -endif - -" Vim settings {{{2 -" vim: ts=8 fdm=marker diff --git a/plugins/vim-json b/plugins/vim-json new file mode 160000 index 0000000..3727f08 --- /dev/null +++ b/plugins/vim-json @@ -0,0 +1 @@ +Subproject commit 3727f089410e23ae113be6222e8a08dd2613ecf2 diff --git a/plugins/vim-polyglot b/plugins/vim-polyglot new file mode 160000 index 0000000..4f3df59 --- /dev/null +++ b/plugins/vim-polyglot @@ -0,0 +1 @@ +Subproject commit 4f3df59be709bf0d5c5c67dc804fde49abdc2700 diff --git a/presets/javascript.vim b/presets/javascript.vim index c72f792..5b96f76 100644 --- a/presets/javascript.vim +++ b/presets/javascript.vim @@ -2,4 +2,6 @@ call vim_kicks_ass#with_plugins(["syntastic"]) " load plugins for javascript -call vim_kicks_ass#with_plugins(["javascript","json","js-jquery","js-jquery-doc"]) +call vim_kicks_ass#with_plugins([ + \ "javascript","elzr/vim-json","js-jquery","js-jquery-doc" + \ ]) From 5ebef1980c5110db44a53699f8223e6a3eb050d3 Mon Sep 17 00:00:00 2001 From: jgmdev Date: Thu, 26 Sep 2019 07:37:17 -0400 Subject: [PATCH 25/42] Removed wrong mustache module. --- .gitmodules | 3 --- plugins/mustache | 1 - 2 files changed, 4 deletions(-) delete mode 160000 plugins/mustache diff --git a/.gitmodules b/.gitmodules index 39443cb..75fc0e1 100644 --- a/.gitmodules +++ b/.gitmodules @@ -61,9 +61,6 @@ [submodule "plugins/sparkup"] path = plugins/sparkup url = https://github.com/bingaman/vim-sparkup.git -[submodule "plugins/mustache"] - path = plugins/mustache - url = git@github.com:valinorsgatekeeper/vim-kicks-ass.git [submodule "plugins/coffee-script"] path = plugins/coffee-script url = https://github.com/kchmck/vim-coffee-script.git diff --git a/plugins/mustache b/plugins/mustache deleted file mode 160000 index 68b957d..0000000 --- a/plugins/mustache +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 68b957dabbf6d229bac5c1deea5a2eb0bd37b471 From ac2582002f64ee9fe7d73500246deac7fcac5224 Mon Sep 17 00:00:00 2001 From: jgmdev Date: Thu, 26 Sep 2019 07:39:13 -0400 Subject: [PATCH 26/42] Re-added mustache module. --- .gitmodules | 3 +++ plugins/mustache | 1 + 2 files changed, 4 insertions(+) create mode 160000 plugins/mustache diff --git a/.gitmodules b/.gitmodules index 75fc0e1..e0bad61 100644 --- a/.gitmodules +++ b/.gitmodules @@ -121,3 +121,6 @@ [submodule "plugins/vim-json"] path = plugins/vim-json url = https://git::@github.com/elzr/vim-json.git +[submodule "plugins/mustache"] + path = plugins/mustache + url = https://github.com/mustache/vim-mustache-handlebars.git diff --git a/plugins/mustache b/plugins/mustache new file mode 160000 index 0000000..697fa02 --- /dev/null +++ b/plugins/mustache @@ -0,0 +1 @@ +Subproject commit 697fa0277042a028d1731d36397c42d9f182a785 From 5d1cdd36b96a2a2bc8c6fdf3939ce830d17c8020 Mon Sep 17 00:00:00 2001 From: jgmdev Date: Thu, 26 Sep 2019 07:47:00 -0400 Subject: [PATCH 27/42] Updated php preset --- presets/php.vim | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/presets/php.vim b/presets/php.vim index f808841..f74223d 100644 --- a/presets/php.vim +++ b/presets/php.vim @@ -3,13 +3,17 @@ call vim_kicks_ass#with_plugins(["php-doc","php-fix-html-indent"]) " add PhpDoc command and binding com! -nargs=0 -bang PhpDoc call PhpDoc() -nnoremap pd :PhpDoc +nnoremap d :PhpDoc " php-complete : autocompletion support " enable php-complete for newer code completion code base "call vim_kicks_ass#with_plugins(["php-complete"]) let g:phpcomplete_parse_docblock_comments = 1 +if !executable("php-cs-fixer") + echo "Remember to install php-cs-fixer." +endif + " php-cs-fixer : format source code using PHP Coding Standards call vim_kicks_ass#with_plugins(["php-cs-fixer"]) From 9fe5502ac88b556590943a78d79ac867c07e83e7 Mon Sep 17 00:00:00 2001 From: jgmdev Date: Thu, 26 Sep 2019 08:54:24 -0400 Subject: [PATCH 28/42] Added jcommenter plugin --- plugins/jcommenter/README | 17 + plugins/jcommenter/plugin/jcommenter.vim | 1250 ++++++++++++++++++++++ 2 files changed, 1267 insertions(+) create mode 100644 plugins/jcommenter/README create mode 100644 plugins/jcommenter/plugin/jcommenter.vim diff --git a/plugins/jcommenter/README b/plugins/jcommenter/README new file mode 100644 index 0000000..7fbd60a --- /dev/null +++ b/plugins/jcommenter/README @@ -0,0 +1,17 @@ +This is a mirror of http://www.vim.org/scripts/script.php?script_id=20 + +Updated 29.12.2002 KB + +Description: +Generates JavaDoc (and some other) comments for java-sources. This is triggered by executing the JCommentWriter()-function while the cursor is over something meaningfull, or if a selection exists, the selected text is parsed and the comment template is generated based on that. + +The following comments are generated (in the appropriate situations): +1. File comments: user specifies the template, generated when the cursor is on the first line of the file. +2. Class comments: generated when on top of a class declaration +3. Method comments: generated when on top of a metod declaration. @return, @params, and @throws are generated, if applicable. If executed on a method declaration which already has JavaDoc-comments, updates the javadoc-comments by removing/adding tags as needed. +4. Field comments. Simply adds an empty JavaDoc-comment template above the field declaration +5. Copy @ -tags. When executed on @something, creates a tag with the same name directly above the line the cursor is currently on. +6. @throws for RuntimeExceptions. When executed on a line containing something like "throw new RuntimeException()", a @throws-tag is added to the previous JavaDoc-comment. +7. Block-end comments. When executed on a line containing a '}'-character and possibly some whitespace (but nothing else), generates a one-line-comment describing what block the '}' is terminating. For example, the comment for "aVeryLongMethod" is "// END: aVeryLongMethod". + +There are a bunch of other functions to support the comment generation (see the start of the script for full documentation). The style of the comment templates is configurable (see the file for configuration and description of the options) diff --git a/plugins/jcommenter/plugin/jcommenter.vim b/plugins/jcommenter/plugin/jcommenter.vim new file mode 100644 index 0000000..3110ecc --- /dev/null +++ b/plugins/jcommenter/plugin/jcommenter.vim @@ -0,0 +1,1250 @@ +" NOTE: Here begins the configuration script for the JCommenter. Later on this +" same file you can find the real script. +" It is a good idea to copy-paste the configuration part to another file, as +" you might want to preserve it for the next version (remember to add +" the new options!). +" See below for the real script description + +" --- cut here (configuration) --- + +" Configuration file for jcommenter +" +" Copy the necessary contents from this file to your .vimrc, or modify this +" file and add a source command to vimrc to read this file. +" +" The initial settings correspond with Sun's coding conventions. + + +" map the commenter: +map :call JCommentWriter() +imap :call JCommentWriter() + +" map searching for invalid comments. meta-n for next invalid comment, meta-p +" for previous. "Invalid" in this case means that the "main" comments are missing +" or the tag description is missing. Handy when searching for missing comments +" or when jumping to next tag (no need to use cursor keys (yuck!) or quit insert +" mode). +map :call SearchInvalidComment(0) +imap :call SearchInvalidComment(0)a +map :call SearchInvalidComment(1) +imap :call SearchInvalidComment(1)a + + +" modeline: +let b:jcommenter_modeline = "/* vim: set " . (&et ? "et" : "noet") . " sw=" . &sw . " ts=" . &ts . ": */" +. +" A way to automate the creation of the comments. Works only if the +" class/method declaration is on one row. Comments are generated when the +" beginning '{' is entered, if the proper function/class declaration is found. +" Should work independet of the location of the '{'. Recognizing whether the +" '{' starts a class/method or something else might fail, and comments might +" be generated for example for an 'if' clause. Has not happened yet, though. +" Uncomment to activate: +"imap { {:call search('\w', 'b'):call ConditionalWriter()0:call search('{')a + +" a nice trick: +" If you type '}-' and a space/enter/esc, jcommenter will be +" automatically called on the function/class declaration whose end the '}' is: +iabbrev }- }h%?\w:nohl:call JCommentWriter() + +" Move cursor to the place where inserting comments supposedly should start +let b:jcommenter_move_cursor = 1 + +" Defines whether to move the cursor to the line which has "/**", or the line +" after that (effective only if b:jcommenter_move_cursor is enabled) +let b:jcommenter_description_starts_from_first_line = 0 + +" Start insert mode after calling the commenter. Effective only if +" b:jcommenter_move_cursor is enabled. +let b:jcommenter_autostart_insert_mode = 1 + +" The number of empty rows (containing only the star) to be added for the +" description of the method +let b:jcommenter_method_description_space = 2 + +" The number of empty rows (containing only the star) to be added for the´ +" description of the field. Can be also -1, which means that "/** */" is added +" above the field declaration +let b:jcommenter_field_description_space = 1 + +" The number of empty rows (containing only the star) to be added for the +" description of the class +let b:jcommenter_class_description_space = 2 + +" If this option is enabled, and a method has no exceptions, parameters or +" return value, the space for the description of that method is allways one +" row. This is handy if you want to keep an empty line between the description +" and the tags, as is defined in Sun's java code conventions +let b:jcommenter_smart_method_description_spacing = 1 + +" the default content for the author-tag of class-comments. Leave empty to add +" just the empty tag, or outcomment to prevent author tag generation +let b:jcommenter_class_author = '' + +" the default content for the version-tag of class-comments. Leave empty to add +" just the empty tag, or outcomment to prevent version tag generation +let b:jcommenter_class_version = '' + +" The default author added to the file comments. leave empty to add just the +" field where the autor can be added, or outcomment to remove it. +let b:jcommenter_file_author = '' + +" The default copyright holder added to the file comments. leave empty to +" add just the field where the copyright info can be added, or outcomment +" to remove it. +let b:jcommenter_file_copyright = '' + +" Change this to true, if you want to use "@exception" instead of "@throws". +let b:jcommenter_use_exception_tag = 0 + +" set to true if you don't like the automatically added "created"-time +let b:jcommenter_file_noautotime = 0 + +" define whether jcommenter tries to parse and update the existing Doc-comments +" on the item it was executed on. If this feature is disabled, a completely new +" comment-template is written +let b:jcommenter_update_comments = 1 + +" If you want to put some text where the parameter text, return text etc. would +" normally go, uncomment and add the wanted text to these variables (this feature +" is considered "unsupported", which means it will not work perfectly with every +" other aspect of this script. For example, this will break the logic used to +" find "invalid" comments, see mappings above): +"let b:jcommenter_default_param = '' +"let b:jcommenter_default_return = '' +"let b:jcommenter_default_throw = '' + +" Another "unsupported" feature: define the number of lines added after each +" "tag-group" (except exceptions, which is often the last group). does not work +" well with comment updating currently: +"let b:jcommenter_tag_space = 1 + + +" define wheter jcommenter should remove old tags (eg. if the return value was +" changed from int to void). Will not work for exceptions, since it should not +" remove RuntimeExceptions, and recognizing whether an exception is RTE is very +" hard. +" This feature is not throughly tested, and might delete something it was not +" supposed to, so use with care. Only applicable if +" b:jcommenter_update_comments is enabled. +let b:jcommenter_remove_tags_on_update = 1 + +" Whether to prepend an empty line before the generated comment, if the +" line just above the comment would otherwise be non-empty. +let b:jcommenter_add_empty_line = 1 + +" Uncomment and modify if you're not happy with the default file +" comment-template: +"function! JCommenter_OwnFileComments() +" call append(0, '/* File name : ' . bufname("%")) +" call append(1, ' * authors : ') +" call append(2, ' * created : ' . strftime("%c")) +" call append(3, ' *') +" call append(4, ' */') +"endfunction + + +" --- cut here (configuration) --- + +" File: jcommenter.vim +" Summary: Functions for documenting java-code +" Author: Kalle Björklid +" Last Modified: 29.12.2002 +" Version: 1.3.1 +" Modifications: +" 1.3.1 : Fixed two bugs concerning the modifications of 1.3-version. +" 1.3 : Added check to see whether the script is already loaded +" Option to have an empty line automatically added before the +" generated comment if there was none previously. See config +" ("b:jcommenter_add_empty_line"). +" 1.2.1 : When executed on last line (must be empty), modeline gets generated. +" Option to have default @return, @param etc. values. see config. +" Option to have space between "Tag groups" +" 1.2 : Complete method comment updating. Now removes '@param'-tags +" if the parameter does not exist in the method header. +" Set "b:jcommenter_remove_tags_on_update" to true if you want to +" use this option. Exceptions will not get removed ever, since +" determining whether they are RuntimeExceptions or not is very +" hard. +" If executed on a string like "throw new RuntimeException()", a +" @throws tag (or @exception) will be added to the previous +" Javadoc comments. +" Corrected a problem where updating didn't work if a new parameter's +" name began the same way than an existing one's. +" Now behaves correctly even when "extra stuff" is included in the +" range. +" Added mapping for insert mode to the config-file. +" Added an abbreviation (see config file). Quite nice, I think. +" Added a new public function for searching for "invalid" comments. +" See config-file for description and mappings. +" Added end-function/class/etc commenting: if you call the commenter +" on a line that contains only a closing '}', the function/class +" name is written as a comment after that. Handy when you have +" a long method/class declaration. +" A way to automatically generate the comments when the '{'-character +" after the class/method declaration. See config-file for mapping +" (need to be uncommented to be active). +" 1.12: Fixed a bug where all methods were interpreted as constructors +" if 'ignorecase' was on. Thanks to David Menuhin for debugging this. +" 1.11: Fixed a bug where the end part of the whole buffer was sometimes +" deleted when updating w/ the b:jcommenter_remove_tags_on_update +" enabled. +" 1.1 : Can now choose between '@throws' and '@exception' tags. +" When executed on single-line comments ("/** blah blah */") expands +" them into multiline comments preserving the text +" Partial method documentation comment updating (see below for +" description) At this point, there's a behavoiur fault where +" single-line comments get expanded even if there's no tags to add. +" 1.0 : Did a complete rewrite of the script-code (this is the main reason +" for the version-number leap) +" A separate config-file, which should be modified to reflect the +" user's preferences +" More variables for better customization +" Due to the rewrite, should now be more robust (allthough new bugs +" may have been introduced during the process) +" Cursor movement and auto-start insert mode +" Better control over the look of the comment templates +" See installation instructions below (has changed) +" 0.4 : Recognizes now methods that have whitespaces before the '('. +" The file comments can now be completely redefined (see below for +" instructions) without editing the script. +" The comment-skeleton for fields is changed from '/** */ to correspond +" with the Sun's code conventions: +" /** +" * +" */ +" 0.3 : Added tag copying +" Recognizes interfaces (same as classes) +" 0.21: Improved the java-method recognition. +" 0.2 : initial public release. +" +" Tested on gvim 6.0 on Win32 +" +" Description: Functions for automatically generating JavaDoc compatible +" documentation for java source-files. +" The JCommentWriter() can produce four kinds of comments depending on the +" current line/range. +" - File comments. When the JCommentWriter()-function is called on the first +" line of the file, a template for file comments is created. It looks like +" this: +" +" /* Filename : +" * Author : +" * Summary : +" * Version : +" * Created : +" */ +" +" The file name and 'Created'-date are automatically filled. The author- +" field is filled with the contents of 'b:jcommenter_file_author'-variable. +" The automated date insertion can be prevented by defining the +" 'b:jcommenter_file_noautotime'-variable. +" You can redefine completely the file comments-writer-function. See the +" configuration script for more info +" +" - Class comments. When the JCommentWriter()-function is called on the +" header of a class, a template for class comments is created. It looks like +" this: +" +" /** +" * +" * @author +" * @version +" */ +" public class ClassName { ... +" +" The @author-field is automatically filled with the contents of the +" 'b:jcommenter_class_author'-variable. +" The @version-field is automatically filled with the contents of the +" 'b:jcommenter_class_def_version'-variable +" - Method comments. JCommentWriter()-function automatically generates +" the template for method comments if it is called on a header of a +" method. The JavaDoc-tags are automatically generated by detecting +" the parameter names, return value and exceptions that are declared +" in the header of the method. An example: +" +" /** +" * +" * @param numbers +" * @param str +" * @return +" * @throws IOException +" * @throws NumberFormatException +" */ +" public String [] method(Integer[] numbers, String str) throws +" IOException, NumberFormatException { +" +" Note: since the method header is on two lines, you need to specify +" the range (include everything before the '{', or ';' if the method is +" abstract). This can be done simply with line-wise visual selection. +" - Updating method comments (since 1.1): +" If executed on a method declaration that allready has Doc-comments, +" you can let jcommenter to try to parse the existing comments and +" add the tags that are new (for example, if you have declared another +" exception to be thrown) to the comments. At this time (version 1.1) +" the removing of old tags is limited to the @return-tag. +" See the config-script for variables concerning this feature. +" - Field comments. Appends this above the field declaration: +" /** +" * +" */ +" Can also be changed to '/** */', see the config-file. +" - Extending single-line comments into mulitline: +" When executed on a line like '/** blah blah blah */, the result is: +" /** +" * blah blah blah +" */ +" - When executed on an existing JavaDoc tag, copy that tag under that line. +" For example, when executed on the following line: +" * @throws IOException If cannot read file +" the result is: +" * @throws IOException If cannot read file +" * @throws +" Not that life changing, but quite nice when you want to document those +" RuntimeExceptions, or need to add another paramter. +" - RuntimeException tag adding. If you execute the commenter on a line +" like "throw new RuntimeException()", the previous doc-comments are +" searched, and a tag for the RuntimeException is added there. +" - Function/class/etc. end commenting. If you execute the commenter +" on a line containing only a closing '}' (and mabye some whitespace), +" the method/class name is added as a comment after the bracet: +" public aVeryLongMethod() { +" ... +" } // END: aVeryLongMethod +" - Cycle through incomplete comments using SearchInvalidComment-method. +" If you use the default mappings, use to go to next incomplete +" comment, and to go to previous one. Handy when finding +" incomplete comments, and completing a template just generated (don't +" have to quit insert mode or use arrow keys). +" - When executed on last line of the file (which must be empty) a +" modeline gets generated. See config-file for format. +" +" Installation: +" +" 0. (optional) copy-paste the configuration-part above to another file +" (save it somewhere) +" 1. Edit the config-section. It is commented, so I won't explain the +" options here). +" 2. Put something like +" aurocmd FileType java source $VIM/macros/jcommenter.vim +" autocmd FileType java source $VIM/macros/jcommenter_config.vim +" to your vimrc. Note that loading the config-part after the actual +" script guarantees that your options are used instad of the script +" defaults. +" +" Usage: +" If you didn't change the mapping specified in the config-file, you can +" can trigger the comment-generation by pressing Alt-c (or "Meta-c"). As +" described above, the cursor must be on the first line or on the same line +" as the method/class/attribute declaration in order to achieve something +" useful. If the declaration extends to several lines, the range must be +" specified. Range should include everything from the declaration that +" comes before the '{' or ';'. Everything after either of those characters +" is ignored, so linewise selection is a handy way to do this +" +" Notes: +" - If a method name starts with an uppercase letter, it is handled as a +" constructor (no @return-tag is generated) +" +" TODO: search for function etc not commented +" TODO: support for the umlaut-chars etc. that can be also used in java +" TODO: Inner classes/interfaces... +" TODO: sort exceptions alphabetically (see +" http://java.sun.com/j2se/javadoc/writingdoccomments/index.html) +" TODO: comment the script +" +" Comments: +" Send any comments or bugreports to bjorklid@st.jyu.fi +" Happy coding! ;-) +"===================================================================== + + +" THE SCRIPT + +" Load only once: +if exists("b:did_javacom") + finish +endif +let b:did_javacom = 1 + +" varible that tells what is put before the written string when using +" the AppendStr-function. +let s:indent = '' + +" The string that includes the text of the line on which the commenter +" was called, or the whole range. This is what is parsed. +let s:combinedString = '' + +let s:rangeStart = 1 " line on which the range started +let s:rangeEnd = 1 " line on which the range ended + +let s:defaultMethodDescriptionSpace = 1 +let s:defaultFieldDescriptionSpace = 1 +let s:defaultClassDescriptionSpace = 1 + +let s:linesAppended = 0 " this counter is increased when the AppendStr-method + " is called. + +let s:docCommentStart = -1 +let s:docCommentEnd = -1 + +let s:defaultParamText = (exists('b:jcommenter_default_param')) ? b:jcommenter_default_param : '' +let s:defaultReturnText = (exists('b:jcommenter_default_return')) ? b:jcommenter_default_return : '' +let s:defaultThrowText = (exists('b:jcommenter_default_throw')) ? b:jcommenter_default_throw : '' + +" =================================================== +" Public functions +" =================================================== + +function! JCommentWriter() range + let s:oldICValue = &ignorecase + let &ignorecase = 0 + + let s:rangeStart = a:firstline + let s:rangeEnd = a:lastline + let s:combinedString = s:GetCombinedString(s:rangeStart, s:rangeEnd) + + + let s:debugstring = '' + + if s:IsFileComments() + call s:WriteFileComments() + elseif s:IsModeLine() + call s:WriteModeLine() + elseif s:IsFunctionEnd() + call s:WriteFunctionEndComments() + elseif s:IsExceptionDeclaration() + call s:WriteFoundException() + elseif s:IsMethod() + let s:debugstring = s:debugstring . 'isMethod ' + call s:WriteMethodComments() + if s:method_comment_update_only == 0 + call s:AddEmpty() + endif + elseif s:IsClass() + call s:WriteClassComments() + call s:AddEmpty() + elseif s:IsSinglelineComment() + call s:ExpandSinglelineComments(s:rangeStart) + elseif s:IsCommentTag() + call s:WriteCopyOfTag() + elseif s:IsVariable() + call s:WriteFieldComments() + call s:AddEmpty() + else + call s:Message('Nothing to do') + endif + + " echo s:debugstring + + let &ignorecase = s:oldICValue + let b:jcommenter_lines_appended = s:linesAppended +endfunction + +fun! s:AddEmpty() + if exists("b:jcommenter_add_empty_line") && b:jcommenter_add_empty_line + if getline(a:firstline - 2) !~ '^\s*$' + let s:appendPos = a:firstline - 2 + call s:AppendStr("") + endif + endif +endfun + + +" =================================================== +" The update functions for method comments +" =================================================== + +function! s:UpdateAllTags() + let s:indent = s:GetIndentation(s:combinedString) + call s:UpdateParameters() + call s:UpdateReturnValue() + call s:UpdateExceptions() +endfunction + +function! s:UpdateExceptions() + let exceptionName = s:GetNextThrowName() + let seeTagPos = s:FindTag(s:docCommentStart, s:docCommentEnd, 'see', '') + if seeTagPos > -1 + let tagAppendPos = seeTagPos - 1 + else + let tagAppendPos = s:docCommentEnd - 1 + endif + while exceptionName != '' + let tagPos = s:FindTag(s:docCommentStart, s:docCommentEnd, 'throws', exceptionName) + if tagPos < 0 + let tagPos = s:FindTag(s:docCommentStart, s:docCommentEnd, 'exception', exceptionName) + endif + if tagPos > -1 + let tagAppendPos = tagPos + let exceptionName = s:GetNextThrowName() + continue + endif + let s:appendPos = tagAppendPos + call s:AppendStr(' * @throws ' . exceptionName . ' ' . s:defaultThrowText) + call s:MarkUpdateMade(tagAppendPos + 1) + let s:docCommentEnd = s:docCommentEnd + 1 + let tagAppendPos = tagAppendPos + 1 + let tagName = s:GetNextParameterName() + endwhile +endfunction + +function! s:UpdateReturnValue() + if s:method_returnValue == '' + if exists("b:jcommenter_remove_tags_on_update") && b:jcommenter_remove_tags_on_update + call s:RemoveTag(s:docCommentStart, s:docCommentEnd, 'return', '') + endif + return + endif + let returnTagPos = s:FindFirstTag(s:docCommentStart, s:docCommentEnd, 'return') + if returnTagPos > -1 && s:method_returnValue != '' + return + endif + let tagAppendPos = s:FindFirstTag(s:docCommentStart, s:docCommentEnd, 'throws') - 1 + if tagAppendPos < 0 + let tagAppendPos = s:FindFirstTag(s:docCommentStart, s:docCommentEnd, 'exception') - 1 + endif + if tagAppendPos < 0 + let tagAppendPos = s:FindFirstTag(s:docCommentStart, s:docCommentEnd, 'see') - 1 + endif + if tagAppendPos < 0 + let tagAppendPos = s:docCommentEnd - 1 + endif + let s:appendPos = tagAppendPos + call s:AppendStr(' * @return ' . s:defaultReturnText) + call s:MarkUpdateMade(tagAppendPos + 1) + let s:docCommentEnd = s:docCommentEnd + 1 +endfunction + +function! s:RemoveNonExistingParameters() + call s:ResolveMethodParams(s:combinedString) + let paramlist = s:method_paramList + let pos = s:FindFirstTag(s:docCommentStart, s:docCommentEnd, 'param') + let Start = pos + + while pos > 0 + let line = getline(pos) + let tagParam = substitute(line, '^\s*\(\*\s*\)\=@[a-zA-Z]*\s\+\(\S*\).*', '\2', '') + + let paramExists = 0 + let existingParam = s:GetNextParameterName() + while existingParam != '' + + if existingParam == tagParam + let paramExists = 1 + break + endif + let existingParam = s:GetNextParameterName() + endwhile + if paramExists == 0 + call s:RemoveTag(Start, s:docCommentEnd, 'param', tagParam) + else + let Start = Start + 1 + endif + + let s:method_paramList = paramlist + let pos = s:FindFirstTag(Start, s:docCommentEnd, 'param') + endwhile +endfunction + +function! s:UpdateParameters() + let tagName = s:GetNextParameterName() + + "Try to find out where the tags that might be added should be written. + let tagAppendPos = s:FindFirstTag(s:docCommentStart, s:docCommentEnd, 'param') - 1 + if tagAppendPos < 0 + let tagAppendPos = s:FindFirstTag(s:docCommentStart, s:docCommentEnd, 'return') - 1 + endif + if tagAppendPos < 0 + let tagAppendPos = s:FindFirstTag(s:docCommentStart, s:docCommentEnd, 'throws') - 1 + endif + if tagAppendPos < 0 + let tagAppendPos = s:FindFirstTag(s:docCommentStart, s:docCommentEnd, 'exception') - 1 + endif + if tagAppendPos < 0 + let tagAppendPos = s:FindFirstTag(s:docCommentStart, s:docCommentEnd, 'see') - 1 + endif + if tagAppendPos < 0 + let tagAppendPos = s:docCommentEnd - 1 + endif + + while tagName != '' + let tagPos = s:FindTag(s:docCommentStart, s:docCommentEnd, 'param', tagName) + if tagPos > -1 + let tagAppendPos = tagPos + let tagName = s:GetNextParameterName() + continue + endif + let s:appendPos = tagAppendPos + call s:AppendStr(' * @param ' . tagName . ' ' . s:defaultParamText) + call s:MarkUpdateMade(tagAppendPos + 1) + let s:docCommentEnd = s:docCommentEnd + 1 + let tagAppendPos = tagAppendPos + 1 + let tagName = s:GetNextParameterName() + endwhile + + if exists("b:jcommenter_remove_tags_on_update") && b:jcommenter_remove_tags_on_update + call s:RemoveNonExistingParameters() + endif +endfunction + +function! s:FindTag(rangeStart, rangeEnd, tagName, tagParam) + let i = a:rangeStart + while i <= a:rangeEnd + if a:tagParam != '' + if getline(i) =~ '^\s*\(\*\s*\)\=@' . a:tagName . '\s\+' . a:tagParam . '\(\s\|$\)' + return i + endif + else + if getline(i) =~ '^\s*\(\*\s*\)\=@' . a:tagName . '\(\s\|$\)' + return i + endif + endif + let i = i + 1 + endwhile + return -1 +endfunction + +function! s:FindFirstTag(rangeStart, rangeEnd, tagName) + let i = a:rangeStart + while i <= a:rangeEnd + if getline(i) =~ '^\s*\(\*\s*\)\=@' . a:tagName . '\(\s\|$\)' + return i + endif + let i = i + 1 + endwhile + return -1 +endfunction + +function! s:FindAnyTag(rangeStart, rangeEnd) + let i = a:rangeStart + while i <= a:rangeEnd + if getline(i) =~ '^\s*\(\*\s*\)\=@' + return i + endif + let i = i + 1 + endwhile + return -1 +endfunction + +function! s:RemoveTag(rangeStart, rangeEnd, tagName, tagParam) + let tagStartPos = s:FindTag(a:rangeStart, a:rangeEnd, a:tagName, a:tagParam) + if tagStartPos == -1 + return 0 + endif + let tagEndPos = s:FindAnyTag(tagStartPos + 1, a:rangeEnd) + if tagEndPos == -1 + let tagEndPos = s:docCommentEnd - 1 + endif + let linesToDelete = tagEndPos - tagStartPos + exe "normal " . tagStartPos . "G" . linesToDelete . "dd" + let s:docCommentEnd = s:docCommentEnd - linesToDelete +endfunction + +function! s:MarkUpdateMade(linenum) + if s:firstUpdatedTagLine == -1 || a:linenum < s:firstUpdatedTagLine + let s:firstUpdatedTagLine = a:linenum + endif +endfunction + +" =================================================== +" From single line to multi line +" =================================================== + +function! s:ExpandSinglelineCommentsEx(line, space) + let str = getline(a:line) + let singleLinePattern = '^\s*/\*\*\s*\(.*\)\*/\s*$' + if str !~ singleLinePattern + return + endif + let s:indent = s:GetIndentation(str) + let str = substitute(str, singleLinePattern, '\1', '') + exe "normal " . a:line . "Gdd" + let s:appendPos = a:line - 1 + call s:AppendStr('/**') + call s:AppendStr(' * ' . str) + let i = 0 + while a:space > i + call s:AppendStr(' * ') + let i = i + 1 + endwhile + call s:AppendStr(' */') + let s:docCommentStart = a:line + let s:docCommentEnd = a:line + 2 + a:space +endfunction + +function! s:ExpandSinglelineComments(line) + call s:ExpandSinglelineCommentsEx(a:line, 0) +endfunction + +" =================================================== +" Functions for writing the comments +" =================================================== + +function! s:WriteMethodComments() + call s:ResolveMethodParams(s:combinedString) + let s:appendPos = s:rangeStart - 1 + let s:indent = s:method_indent + let s:linesAppended = 0 + + let existingDocCommentType = s:HasDocComments() + let s:method_comment_update_only = 0 + + if existingDocCommentType && exists("b:jcommenter_update_comments") && b:jcommenter_update_comments + let s:method_comment_update_only = 1 + if existingDocCommentType == 1 + call s:ExpandSinglelineCommentsEx(s:singleLineCommentPos, 1) + endif + let s:firstUpdatedTagLine = -1 + call s:UpdateAllTags() + if exists("b:jcommenter_move_cursor") && b:jcommenter_move_cursor && s:firstUpdatedTagLine != -1 + exe "normal " . s:firstUpdatedTagLine . "G$" + if exists("b:jcommenter_autostart_insert_mode") && b:jcommenter_autostart_insert_mode + startinsert! + endif + endif + return + endif + + if exists("b:jcommenter_method_description_space") + let descriptionSpace = b:jcommenter_method_description_space + else + let descriptionSpace = s:defaultMethodDescriptionSpace + endif + + call s:AppendStr('/** ') + + let param = s:GetNextParameterName() + let exception = s:GetNextThrowName() + + if param == '' && s:method_returnValue == '' && exception == '' && exists("b:jcommenter_smart_method_description_spacing") && b:jcommenter_smart_method_description_spacing + call s:AppendStars(1) + else + call s:AppendStars(descriptionSpace) + endif + + let hadParam = (param != '') + + while param != '' + call s:AppendStr(' * @param ' . param . ' ' . s:defaultParamText) + let param = s:GetNextParameterName() + endwhile + + if exists('b:jcommenter_tag_space') && b:jcommenter_tag_space && hadParam + call s:AppendStars(b:jcommenter_tag_space) + endif + + let hadReturn = (s:method_returnValue != '') + + if s:method_returnValue != '' + call s:AppendStr(' * @return ' . s:defaultReturnText) + let s:debugstring = s:debugstring . 'wroteReturnTag ' + endif + + if exists('b:jcommenter_tag_space') && b:jcommenter_tag_space && hadReturn + call s:AppendStars(b:jcommenter_tag_space) + endif + + if exists("b:jcommenter_use_exception_tag") && b:jcommenter_use_exception_tag + let exTag = '@exception ' + else + let exTag = '@throws ' + endif + +" let hadException = (exception != '') + + while exception != '' + call s:AppendStr(' * ' . exTag . exception . ' ' . s:defaultThrowText) + let exception = s:GetNextThrowName() + endwhile + + call s:AppendStr(' */') + + call s:MoveCursor() + +endfunction + +function! s:WriteFunctionEndComments() + normal 0 + if (getline(".")[0] != '}') + call search('}') " won't work if the '}' is the first char (thus the 'if') + endif + normal % + " Now we are on the '{' mark. Next we go backwards to the line on which the + " class/method declaration seems to be on: + call search('\%(^\|.*\s\)\%(\%(\(\h\w*\)\s*(\)\|\%(\%(class\|interface\)\s\+\(\u\w*\)\)\).*', 'b') + let header = getline(".") + let name = substitute(header, '\%(^\|.*\s\)\%(\%(\(\h\w*\)\s*(\)\|\%(\%(class\|interface\)\s\+\(\u\w*\)\)\).*', '\1\2', '') + call search('{') " go back to the end... + normal % + exe 'normal a // END: ' . name +endfunction + +function! s:WriteFoundException() + let exceptionName = substitute(s:combinedString, '.*\ 1 + let linenum = linenum - 1 + let str = getline(linenum) + endwhile + if str !~ '\*/\s*$' || str =~ '/\*\*.*\*/' + return 0 + endif + let s:docCommentEnd = linenum + let linenum = linenum - 1 + let str = getline(linenum) + while str !~ '\(/\*\|\*/\)' && linenum >= 1 + let linenum = linenum - 1 + let str = getline(linenum) + endwhile + if str =~ '^\s*/\*\*' + let s:docCommentStart = linenum + return 1 + else + let s:docCommentStart = -1 + let s:docCommentEnd = -1 + return 0 + endif +endfunction + + +function! s:SearchPrevDocComments() + let linenum = s:rangeStart - 1 + while 1 + let str = getline(linenum) + while str !~ '\*/' && linenum > 1 + let linenum = linenum - 1 + let str = getline(linenum) + endwhile + if linenum <= 1 + return 0 + endif + let s:docCommentEnd = linenum + let linenum = linenum - 1 + let str = getline(linenum) + while str !~ '\(/\*\|\*/\)' && linenum >= 1 + let linenum = linenum - 1 + let str = getline(linenum) + endwhile + if str =~ '^\s*/\*\*' + let s:docCommentStart = linenum + return 1 + else + if linenum == 1 + let s:docCommentStart = -1 + let s:docCommentEnd = -1 + return 0 + endif + endif + endwhile +endfunction + +function! s:HasSingleLineDocComments() + let linenum = s:rangeStart - 1 + let str = getline(linenum) + while str =~ '^\s*$' && linenum > 1 + let linenum = linenum - 1 + let str = getline(linenum) + endwhile + if str =~ '^\s*/\*\*.*\*/\s*$' + let s:singleLineCommentPos = linenum + let s:docCommentStart = linenum + let s:docCommentEnd = linenum + return 1 + endif + return 0 +endfunction + +function! s:HasDocComments() + if s:HasSingleLineDocComments() + return 1 + elseif s:HasMultilineDocComments() + return 2 + endif +endfunction + +" =================================================== +" Utility functions +" =================================================== + +function! s:GetIndentation(string) + return substitute(a:string, '^\(\s*\).*', '\1', '') +endfunction + +" returns one string combined from the strings on the given range. +function! s:GetCombinedString(rangeStart, rangeEnd) + let line = a:rangeStart + let combinedString = getline(line) + + while line < a:rangeEnd + let line = line + 1 + let combinedString = combinedString . ' ' . getline(line) + endwhile + + return substitute(combinedString, '^\([^;{]*[;{]\=\).*', '\1', '') +endfunction + +function! s:AppendStars(amount) + let i = a:amount + while i > 0 + call s:AppendStr(' * ') + let i = i - 1 + endwhile +endfunction + + +function! s:MoveCursorToEOL(line) + exe "normal " . a:line . "G$" +endfunction + +function! s:MoveCursor() + if !exists("b:jcommenter_move_cursor") + return + endif + if !b:jcommenter_move_cursor + return + endif + let startInsert = exists("b:jcommenter_autostart_insert_mode") && b:jcommenter_autostart_insert_mode + if exists("b:jcommenter_description_starts_from_first_line") && b:jcommenter_description_starts_from_first_line + call s:MoveCursorToEOL(s:rangeStart) + else + call s:MoveCursorToEOL(s:rangeStart + 1) + endif + if startInsert + startinsert + endif +endfunction + +let s:appendPos = 1 + +" A function for appending strings to the buffer. +" First set the 's:appendPos', then call this function repeatedly to append +" strings after that position. +function! s:AppendStr(string) + call append(s:appendPos, s:indent . a:string) + let s:appendPos = s:appendPos + 1 + let s:linesAppended = s:linesAppended + 1 +endfunction + +function! s:Trim(string) + return substitute(a:string, '^\s*\(.\{-}\)\s*$', '\1', '') +endfunction + +function! s:Message(string) + echo '[JCommenter] ' . a:string +endfunction + +"=============================================== +let s:noCommentTrunk = '^\s*\/\*\*\s*\n\%(\s*\*\s*\n\)*\%(\s*\*\s*@\|\s*\*\/\)' +let s:noParamTagComment = '^\s*\*\s*@\%(param\|throws\|exception\)\%(\s\+\h\w*\)\=\s*$' +let s:noTagComment = '^\s*\*\s*@\%(return\|see\|version\|since\)\s*$' +let s:invalComments = '\%(' . s:noCommentTrunk . '\)\|\%(' . s:noParamTagComment . '\)\|\%(' . s:noTagComment . '\)' + + +fun! SearchInvalidComment(backwards) + let param = a:backwards ? "wb" : "w" + if a:backwards + if !b:jcommenter_description_starts_from_first_line && getline(".") =~ '^\s*\*\s*$' + normal k + endif + normal k$ + endif + let result = search(s:invalComments, param) + if result > 0 + if !b:jcommenter_description_starts_from_first_line + let isTrunk = (getline(".") =~ '^\s*\/\*\*') + if isTrunk + normal j + endif + endif + normal $zz + else + call s:Message('No invalid comments found') + endif +endfun + +function! ConditionalWriter() + let line = getline(".") + let doDoc = (line =~ '\(^\|\s\)\h\w*\s\+\h\w*\s*(.*)') " Methods (allways have ret. value) + let doDoc2 = (line =~ '^\s*\u\w*\s*(.*)') " Constructors (allways begin w/ uppercase letter) + let doDoc3 = (line =~ '^\s*\%([a-z]\+\s\+\)*class\s\+\u\w*\%(\s\+\%(implements\|extends\)\s\+.*\)\{0,2}') + if doDoc || doDoc2 || doDoc3 + let oldmove = b:jcommenter_move_cursor + let b:jcommenter_move_cursor = 0 + call JCommentWriter() + let b:jcommenter_move_cursor = oldmove + endif +endfunction + +" vim: set et sw=2 ts=2: From 48c2a4e872898b5161d2f1ecc9eaebc0ae1b0cde Mon Sep 17 00:00:00 2001 From: jgmdev Date: Thu, 26 Sep 2019 09:20:52 -0400 Subject: [PATCH 29/42] Updated jgmdev template. --- templates/vimrc.jgmdev | 194 +++++++++++++++++++++++++++++------------ 1 file changed, 136 insertions(+), 58 deletions(-) diff --git a/templates/vimrc.jgmdev b/templates/vimrc.jgmdev index 0fa8f3f..7f2b13a 100644 --- a/templates/vimrc.jgmdev +++ b/templates/vimrc.jgmdev @@ -15,19 +15,52 @@ set nocompatible " enable filetype specific plugins filetype on filetype plugin on -filetype indent on +filetype indent off " disable annoying auto indentation -" which plugins to enable, can be a list of plugins or a single string -call vim_kicks_ass#with_plugins(["misc","easytags","taglist"]) -call vim_kicks_ass#with_plugins(["l9","autocomplpop","syntastic"]) -call vim_kicks_ass#with_plugins(["fugitive","surround","markdown"]) -call vim_kicks_ass#with_plugins(["html5","nerdcommenter","tabular"]) -call vim_kicks_ass#with_plugins(["closetag","detectindent"]) +" ------------------------------------------------------- +" CHECK REQUIRED DEPENDENCIES +" ------------------------------------------------------- +if !executable("git") + echo "Remember to install git." +endif + +if !executable("ctags") + echo "Remember to install for autocomplete support." +endif + +if !executable("fzf") || !executable("rg") + echo "Remember to install fzf and ripgrep for file searching." +endif + +" ------------------------------------------------------- +" LOAD PLUGINS +" ------------------------------------------------------- +call vim_kicks_ass#with_plugins([ + \ "misc", "easytags", "taglist", + \ "l9", "autocomplpop", "syntastic", + \ "fugitive", "autoclose", "markdown", + \ "html5", "nerdcommenter", "tabular", + \ "closetag", "detectindent", "junegunn/fzf.vim", + \ "itchyny/lightline.vim", "scrooloose/nerdtree", + \ "sheerun/vim-polyglot", "jcommenter", "endwise", + \ ]) + +" ------------------------------------------------------- +" PLUGIN SETTINGS +" ------------------------------------------------------- + +" autocomplpop options +let g:acp_mappingDriven = 1 " don't autocomplete on backspace +let g:acp_completeoptPreview = 1 " display function arguments preview +let g:acp_behaviorKeywordLength = 1 " keyword autocomplete with 1 character " easytags options to enable/disable features that affect peformance -let g:easytags_syntax_keyword = 'always' -let b:easytags_auto_highlight = 0 +let g:easytags_syntax_keyword = 'auto' " Use auto or always (faster) +let g:easytags_auto_highlight = 1 let g:easytags_async = 1 +set tags=./tags; " project tags file +let g:easytags_dynamic_files = 1 " use project tags file if available +let g:easytags_by_filetype = "~/.vim" " generate tag files by file type " syntastic options let g:syntastic_enable_signs=1 @@ -38,89 +71,134 @@ let g:detectindent_preferred_expandtab = 1 let g:detectindent_preferred_indent = 4 let g:detectindent_preferred_when_mixed = 1 +" lightline options +let g:lightline = { + \ 'active': { + \ 'left': [ + \ ['mode', 'paste'], + \ ['readonly', 'filename', 'modified'], + \ ['syntastic', 'gitbranch'] + \ ], + \ 'right': [ + \ ['lineinfo'], + \ ['percent'], + \ ['fileformat', 'fileencoding', 'filetype'] + \ ] + \ }, + \ 'component_function': { + \ 'gitbranch': "fugitive#statusline", + \ 'syntastic': "SyntasticStatuslineFlag" + \ } + \ } + " fix: some weird issues with arrowkeys using autoclose in console if !has("gui_running") let g:AutoClosePreservDotReg = 0 endif -" load presets -call vim_kicks_ass#using_presets("php") -call vim_kicks_ass#using_presets("javascript") - -" load colorschemes -call vim_kicks_ass#using_colorschemes("jellybeans") -call vim_kicks_ass#using_colorschemes("molokai") - -" editing options +" ------------------------------------------------------- +" LOAD PRESETS +" ------------------------------------------------------- +call vim_kicks_ass#using_presets([ + \ 'php', 'javascript' + \ ]) + +" ------------------------------------------------------- +" LOAD COLORSCHEMES +" ------------------------------------------------------- +call vim_kicks_ass#using_colorschemes([ + \ "jellybeans", "molokai", "joshdick/onedark.vim", + \ ]) + +" ------------------------------------------------------- +" EDITOR OPTIONS +" ------------------------------------------------------- syntax on +colorscheme onedark set t_Co=256 " enable more colors for schemes that require them. set ff=unix set nowrap -set backspace=indent,eol,start +"set backspace=indent,eol,start set tabstop=4 set softtabstop=4 set shiftwidth=4 set expandtab set copyindent set shiftround -"set autoindent +set smartindent set smarttab -set undolevels=1000 +set undolevels=100000 set number " linenumbering set laststatus=2 " always show statusline -set statusline=%F\ %y%([%R%M]%)\ %{SyntasticStatuslineFlag()}\ %=%{getcwd()}\ %{fugitive#statusline()} +"set statusline=%F\ %y%([%R%M]%)\ %{SyntasticStatuslineFlag()}\ %=%{getcwd()}\ %{fugitive#statusline()} "set visualbell "set noerrorbells -set nobackup -set noswapfile set hlsearch set cursorline - -" improve performance -set nocursorcolumn -set norelativenumber -syntax sync minlines=500 -let g:loaded_matchparen=1 -set regexpengine=1 " seems to improve performance with cursorline +set relativenumber " override line number color to fix jellybeans issues -highlight LineNr ctermfg=Gray +"highlight LineNr ctermfg=Gray " override text selection color to fix jellybeans issues -highlight Visual ctermbg=DarkGreen ctermfg=White +"highlight Visual ctermbg=DarkGreen ctermfg=White " display a right margin -set colorcolumn=81 -highlight ColorColumn ctermbg=White - -" enable code completion support -set omnifunc=syntaxcomplete#Complete - -" bind omni complete to ctrl + space -function! Auto_complete_string() - return "\\" -endfunction - -inoremap Auto_complete_string() -inoremap Auto_complete_string() - -" set default colorscheme -colorscheme molokai - -" set key bindings -let maplocalleader = "," - -nnoremap s :TlistToggle +set colorcolumn=81 " position +"highlight ColorColumn ctermbg=White " set custom color for margin + +" ------------------------------------------------------- +" KEY BINDINGS +" ------------------------------------------------------- +let mapleader = '\' +let maplocalleader = ',' + +" show list of symbols +nnoremap l :TlistToggle +" goto definition nnoremap j nnoremap jh -nnoremap d :PhpDoc +nnoremap +nnoremap +" comment/uncomment +nnoremap c :call NERDComment(0, "toggle") +vnoremap c :call NERDComment(1, "toggle") +inoremap c :call NERDComment(0, "toggle") +" generate php doc block +nnoremap d :call JCommentWriter() +nnoremap D :call PhpDoc() nnoremap e :Explore +" tabs navigation previous/next nnoremap [ :tabp nnoremap ] :tabn +" save/quit +nnoremap s :w nnoremap sq :wq -nnoremap q :q! - -" auto commands +nnoremap q :q +" shift tab unindent +nnoremap >> +nnoremap << +inoremap +" bind omnicomplete to CTRL+Space (doesn't works) +inoremap pumvisible() \|\| &omnifunc == '' ? + \ "\C-n>" : + \ "\C-x>\C-o>=pumvisible() ?" . + \ "\"\\c-n>\\c-p>\\c-n>\" :" . + \ "\" \\bs>\\C-n>\"\" +inoremap +" search files/content +nnoremap f :Files +nnoremap F :Rg +" toggle search highlight +nnoremap h :set hlsearch! +" display directory tree (use o to collapse/uncollapse) +nnoremap t :NERDTreeToggle +" php bindings +nnoremap f :call PhpCsFixerFixFile() + +" ------------------------------------------------------- +" AUTO COMMANDS +" ------------------------------------------------------- autocmd BufWritePre * :%s/\s\+$//e " strip trailing spaces autocmd BufWritePre * :retab " convert tabs to spaces autocmd BufReadPost * :DetectIndent From f15151cd4b13f506824b0ed94e57ef87dac9036b Mon Sep 17 00:00:00 2001 From: jgmdev Date: Thu, 26 Sep 2019 11:07:47 -0400 Subject: [PATCH 30/42] Updated plugins --- plugins/autoclose | 2 +- plugins/endwise | 2 +- plugins/fugitive | 2 +- plugins/nerdcommenter | 2 +- plugins/nerdtree | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/plugins/autoclose b/plugins/autoclose index 4dfe50a..a9a3b73 160000 --- a/plugins/autoclose +++ b/plugins/autoclose @@ -1 +1 @@ -Subproject commit 4dfe50a95093da3488a0c0b0928abb591b1cb403 +Subproject commit a9a3b7384657bc1f60a963fd6c08c63fc48d61c3 diff --git a/plugins/endwise b/plugins/endwise index 86e1d4a..f67d022 160000 --- a/plugins/endwise +++ b/plugins/endwise @@ -1 +1 @@ -Subproject commit 86e1d4ab9192245ae83831f073c0452f3b7baba8 +Subproject commit f67d022169bd04d3c000f47b1c03bfcbc4209470 diff --git a/plugins/fugitive b/plugins/fugitive index 417b3bb..80ef196 160000 --- a/plugins/fugitive +++ b/plugins/fugitive @@ -1 +1 @@ -Subproject commit 417b3bb818f86d2a92dbb0ee3857af7de1ade8c8 +Subproject commit 80ef19665a707aa8947dd9e5b8f82cbcec2f7b74 diff --git a/plugins/nerdcommenter b/plugins/nerdcommenter index 50f307b..a4b7c04 160000 --- a/plugins/nerdcommenter +++ b/plugins/nerdcommenter @@ -1 +1 @@ -Subproject commit 50f307bbf68e7402a1564689910ec65ae7ab1781 +Subproject commit a4b7c046b3d3e170c6f62a6209abfa0760d6694a diff --git a/plugins/nerdtree b/plugins/nerdtree index bd744ea..496b61e 160000 --- a/plugins/nerdtree +++ b/plugins/nerdtree @@ -1 +1 @@ -Subproject commit bd744eab8df5730db167a26486bc9afde46c4046 +Subproject commit 496b61ead1acd80128164cce5c2ff8e89c42ded2 From b0438cba360e8a14df1b8c690eed28708c654230 Mon Sep 17 00:00:00 2001 From: jgmdev Date: Thu, 26 Sep 2019 16:47:50 -0400 Subject: [PATCH 31/42] Always checkout master branch when upgrading plugins. --- vim_kicks_ass.vim | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/vim_kicks_ass.vim b/vim_kicks_ass.vim index 1544480..039f166 100644 --- a/vim_kicks_ass.vim +++ b/vim_kicks_ass.vim @@ -73,7 +73,9 @@ function vim_kicks_ass#update_all() echo system( \ "cd ".s:root. \ " && ". - \ "git submodule foreach git pull origin master" + \ "git submodule foreach git pull origin master". + \ " && ". + \ "git submodule foreach git checkout master" \ ) endfunction From 7a0f97332fa90a8927d4784f3045ef4b1b9459db Mon Sep 17 00:00:00 2001 From: jgmdev Date: Thu, 26 Sep 2019 16:49:40 -0400 Subject: [PATCH 32/42] Re-enabled latest php-complete on php preset. --- presets/php.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/presets/php.vim b/presets/php.vim index f74223d..0bf7741 100644 --- a/presets/php.vim +++ b/presets/php.vim @@ -7,7 +7,7 @@ nnoremap d :PhpDoc " php-complete : autocompletion support " enable php-complete for newer code completion code base -"call vim_kicks_ass#with_plugins(["php-complete"]) +call vim_kicks_ass#with_plugins(["php-complete"]) let g:phpcomplete_parse_docblock_comments = 1 if !executable("php-cs-fixer") From 57a7624f22e16fb73c0edabcca821e7ea40e2133 Mon Sep 17 00:00:00 2001 From: jgmdev Date: Thu, 26 Sep 2019 16:51:04 -0400 Subject: [PATCH 33/42] Removed commented bits from my template. --- templates/vimrc.jgmdev | 25 +++++++------------------ 1 file changed, 7 insertions(+), 18 deletions(-) diff --git a/templates/vimrc.jgmdev b/templates/vimrc.jgmdev index 7f2b13a..5679954 100644 --- a/templates/vimrc.jgmdev +++ b/templates/vimrc.jgmdev @@ -24,8 +24,8 @@ if !executable("git") echo "Remember to install git." endif -if !executable("ctags") - echo "Remember to install for autocomplete support." +if !executable("ctags") && !executable("phpctags") + echo "Remember to install phpctags or ctags for autocomplete support." endif if !executable("fzf") || !executable("rg") @@ -36,7 +36,7 @@ endif " LOAD PLUGINS " ------------------------------------------------------- call vim_kicks_ass#with_plugins([ - \ "misc", "easytags", "taglist", + \ "misc", "taglist", \ "l9", "autocomplpop", "syntastic", \ "fugitive", "autoclose", "markdown", \ "html5", "nerdcommenter", "tabular", @@ -56,6 +56,7 @@ let g:acp_behaviorKeywordLength = 1 " keyword autocomplete with 1 character " easytags options to enable/disable features that affect peformance let g:easytags_syntax_keyword = 'auto' " Use auto or always (faster) +let g:easytags_auto_update = 1 let g:easytags_auto_highlight = 1 let g:easytags_async = 1 set tags=./tags; " project tags file @@ -128,24 +129,12 @@ set shiftround set smartindent set smarttab set undolevels=100000 -set number " linenumbering -set laststatus=2 " always show statusline -"set statusline=%F\ %y%([%R%M]%)\ %{SyntasticStatuslineFlag()}\ %=%{getcwd()}\ %{fugitive#statusline()} -"set visualbell -"set noerrorbells +set number " linenumbering +set laststatus=2 " always show statusline set hlsearch set cursorline set relativenumber - -" override line number color to fix jellybeans issues -"highlight LineNr ctermfg=Gray - -" override text selection color to fix jellybeans issues -"highlight Visual ctermbg=DarkGreen ctermfg=White - -" display a right margin -set colorcolumn=81 " position -"highlight ColorColumn ctermbg=White " set custom color for margin +set colorcolumn=81 " right margin position " ------------------------------------------------------- " KEY BINDINGS From 9272452f045e86661a27bafbeb214d4b63d05774 Mon Sep 17 00:00:00 2001 From: jgmdev Date: Fri, 27 Sep 2019 12:57:57 -0400 Subject: [PATCH 34/42] Updates to my template --- templates/vimrc.jgmdev | 29 +++++++++++++++++++++++++---- 1 file changed, 25 insertions(+), 4 deletions(-) diff --git a/templates/vimrc.jgmdev b/templates/vimrc.jgmdev index 5679954..b333e05 100644 --- a/templates/vimrc.jgmdev +++ b/templates/vimrc.jgmdev @@ -54,14 +54,35 @@ let g:acp_mappingDriven = 1 " don't autocomplete on backspace let g:acp_completeoptPreview = 1 " display function arguments preview let g:acp_behaviorKeywordLength = 1 " keyword autocomplete with 1 character -" easytags options to enable/disable features that affect peformance +" easytags option +let g:easytags_cmd = 'ctags' let g:easytags_syntax_keyword = 'auto' " Use auto or always (faster) -let g:easytags_auto_update = 1 -let g:easytags_auto_highlight = 1 +let g:easytags_auto_update = 1 " automatically generate tags while coding +let g:easytags_auto_highlight = 1 " can affect performance let g:easytags_async = 1 +if !isdirectory("~/.vim/typetags") + call mkdir("~/.vim/typetags", "p") +endif set tags=./tags; " project tags file let g:easytags_dynamic_files = 1 " use project tags file if available -let g:easytags_by_filetype = "~/.vim" " generate tag files by file type +let g:easytags_file = "~/.vim/tags" +let g:easytags_by_filetype = "~/.vim/typetags" " generate tag files by file type +" enable tag recursion if inside a repository +let git_repo = isdirectory(getcwd().'/'.".git") +let fossil_repo = file_readable(getcwd().'/'.".fslckout") +if git_repo || fossil_repo + let g:easytags_autorecurse = 1 + echo 'Recursive tags scanning enabled.' +endif +let g:easytags_languages = { + \ 'php': { + \ 'cmd': g:easytags_cmd, + \ 'args': ['--fields=+aimlS'], + \ 'fileoutput_opt': '-f', + \ 'stdout_opt': '-f-', + \ 'recurse_flag': '-R' + \ } + \} " syntastic options let g:syntastic_enable_signs=1 From 37f2db32743c769e86b7003e6efff8ea6afc303b Mon Sep 17 00:00:00 2001 From: jgmdev Date: Fri, 27 Sep 2019 17:58:43 -0400 Subject: [PATCH 35/42] Added vim-css-color plugin, improved jgmdev template. --- .gitmodules | 3 +++ plugins/vim-css-color | 1 + templates/vimrc.jgmdev | 35 ++++++++++++++++++++--------------- 3 files changed, 24 insertions(+), 15 deletions(-) create mode 160000 plugins/vim-css-color diff --git a/.gitmodules b/.gitmodules index e0bad61..91829d9 100644 --- a/.gitmodules +++ b/.gitmodules @@ -124,3 +124,6 @@ [submodule "plugins/mustache"] path = plugins/mustache url = https://github.com/mustache/vim-mustache-handlebars.git +[submodule "plugins/vim-css-color"] + path = plugins/vim-css-color + url = https://git::@github.com/ap/vim-css-color.git diff --git a/plugins/vim-css-color b/plugins/vim-css-color new file mode 160000 index 0000000..1f9fe5c --- /dev/null +++ b/plugins/vim-css-color @@ -0,0 +1 @@ +Subproject commit 1f9fe5c1f9e0a6bfc41b14d070f4d878d445ae96 diff --git a/templates/vimrc.jgmdev b/templates/vimrc.jgmdev index b333e05..b8ddba4 100644 --- a/templates/vimrc.jgmdev +++ b/templates/vimrc.jgmdev @@ -17,6 +17,10 @@ filetype on filetype plugin on filetype indent off " disable annoying auto indentation +" for configuration +let vim_path=expand(':p:h')."/.vim" +let $VIMHOME=vim_path + " ------------------------------------------------------- " CHECK REQUIRED DEPENDENCIES " ------------------------------------------------------- @@ -36,13 +40,14 @@ endif " LOAD PLUGINS " ------------------------------------------------------- call vim_kicks_ass#with_plugins([ - \ "misc", "taglist", + \ "misc", "easytags", "taglist", \ "l9", "autocomplpop", "syntastic", \ "fugitive", "autoclose", "markdown", \ "html5", "nerdcommenter", "tabular", \ "closetag", "detectindent", "junegunn/fzf.vim", \ "itchyny/lightline.vim", "scrooloose/nerdtree", \ "sheerun/vim-polyglot", "jcommenter", "endwise", + \ "ap/vim-css-color" \ ]) " ------------------------------------------------------- @@ -58,15 +63,15 @@ let g:acp_behaviorKeywordLength = 1 " keyword autocomplete with 1 character let g:easytags_cmd = 'ctags' let g:easytags_syntax_keyword = 'auto' " Use auto or always (faster) let g:easytags_auto_update = 1 " automatically generate tags while coding -let g:easytags_auto_highlight = 1 " can affect performance +let g:easytags_auto_highlight = 0 " can affect performance let g:easytags_async = 1 -if !isdirectory("~/.vim/typetags") - call mkdir("~/.vim/typetags", "p") +if !isdirectory(vim_path."/typetags") + call mkdir(vim_path."/typetags", "p") endif set tags=./tags; " project tags file let g:easytags_dynamic_files = 1 " use project tags file if available -let g:easytags_file = "~/.vim/tags" -let g:easytags_by_filetype = "~/.vim/typetags" " generate tag files by file type +let g:easytags_file = vim_path."/tags" +let g:easytags_by_filetype = vim_path."/typetags" " generate tag files by file type " enable tag recursion if inside a repository let git_repo = isdirectory(getcwd().'/'.".git") let fossil_repo = file_readable(getcwd().'/'.".fslckout") @@ -74,15 +79,6 @@ if git_repo || fossil_repo let g:easytags_autorecurse = 1 echo 'Recursive tags scanning enabled.' endif -let g:easytags_languages = { - \ 'php': { - \ 'cmd': g:easytags_cmd, - \ 'args': ['--fields=+aimlS'], - \ 'fileoutput_opt': '-f', - \ 'stdout_opt': '-f-', - \ 'recurse_flag': '-R' - \ } - \} " syntastic options let g:syntastic_enable_signs=1 @@ -135,11 +131,18 @@ call vim_kicks_ass#using_colorschemes([ " ------------------------------------------------------- " EDITOR OPTIONS " ------------------------------------------------------- + +" create the swap files directory +if !isdirectory(vim_path."/swap") + call mkdir(vim_path."/swap", "p") +endif + syntax on colorscheme onedark set t_Co=256 " enable more colors for schemes that require them. set ff=unix set nowrap +set directory=$VIMHOME/swap// "set backspace=indent,eol,start set tabstop=4 set softtabstop=4 @@ -156,6 +159,8 @@ set hlsearch set cursorline set relativenumber set colorcolumn=81 " right margin position +set mouse=a " enable mouse +set completeopt=menuone,longest,popup,noselect,noinsert " ------------------------------------------------------- " KEY BINDINGS From 437639d502aaf8a6fad63692609a4cfe0394db4e Mon Sep 17 00:00:00 2001 From: jgmdev Date: Wed, 2 Oct 2019 17:49:10 -0400 Subject: [PATCH 36/42] Add 'after' directory of a plugin to the runtime path. --- vim_kicks_ass.vim | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/vim_kicks_ass.vim b/vim_kicks_ass.vim index 039f166..a2a4fd6 100644 --- a/vim_kicks_ass.vim +++ b/vim_kicks_ass.vim @@ -160,6 +160,10 @@ function s:add(dirs, root, type) if index(paths, path) == -1 let paths = insert(paths, path) endif + let after_path = path."/"."after" + if isdirectory(after_path) + let paths = insert(paths, after_path) + endif endfor let &rtp = s:join(paths) endfunction From 2e76d769c15c384b1c6a41f2ed539409607263f0 Mon Sep 17 00:00:00 2001 From: jgmdev Date: Wed, 2 Oct 2019 18:16:07 -0400 Subject: [PATCH 37/42] Some improvements to jgmdev template. --- templates/vimrc.jgmdev | 90 +++++++++++++++++++++++++++++++++--------- 1 file changed, 71 insertions(+), 19 deletions(-) diff --git a/templates/vimrc.jgmdev b/templates/vimrc.jgmdev index b8ddba4..1e3e132 100644 --- a/templates/vimrc.jgmdev +++ b/templates/vimrc.jgmdev @@ -36,28 +36,76 @@ if !executable("fzf") || !executable("rg") echo "Remember to install fzf and ripgrep for file searching." endif +if !executable("php-cs-fixer") + echo "Remember to install php-cs-fixer." +endif + " ------------------------------------------------------- " LOAD PLUGINS " ------------------------------------------------------- call vim_kicks_ass#with_plugins([ - \ "misc", "easytags", "taglist", - \ "l9", "autocomplpop", "syntastic", - \ "fugitive", "autoclose", "markdown", - \ "html5", "nerdcommenter", "tabular", - \ "closetag", "detectindent", "junegunn/fzf.vim", - \ "itchyny/lightline.vim", "scrooloose/nerdtree", - \ "sheerun/vim-polyglot", "jcommenter", "endwise", - \ "ap/vim-css-color" + \ 'misc', 'easytags', 'taglist', + \ 'l9', 'autocomplpop', 'syntastic', + \ 'fugitive', 'autoclose', 'markdown', + \ 'html5', 'nerdcommenter', 'tabular', + \ 'closetag', 'detectindent', 'junegunn/fzf.vim', + \ 'itchyny/lightline.vim', 'scrooloose/nerdtree', + \ 'sheerun/vim-polyglot', 'jcommenter', 'endwise', + \ 'ap/vim-css-color', 'prabirshrestha/async.vim', 'prabirshrestha/vim-lsp', + \ 'php-doc', 'php-fix-html-indent', 'php-cs-fixer', 'php-namespace', + \ 'mikoto2000/buffer_selector.vim' + \ ]) + +" ------------------------------------------------------- +" LOAD PRESETS +" ------------------------------------------------------- +call vim_kicks_ass#using_presets([ + \ 'javascript' \ ]) " ------------------------------------------------------- " PLUGIN SETTINGS " ------------------------------------------------------- +" vim-lsp +let g:lsp_signs_enabled = 0 +let g:lsp_diagnostics_echo_cursor = 1 +let g:lsp_insert_text_enabled = 0 +let g:lsp_preview_autoclose = 0 + +" Enable intelephense for vim-lsp or newer php-complete +" npm install -g intelephense +if executable("intelephense") + if !isdirectory(vim_path."/intelephense") + call mkdir(vim_path."/intelephense", "p") + endif + au User lsp_setup call lsp#register_server({ + \ 'name': 'intelephense', + \ 'cmd': {server_info->['intelephense', '--stdio']}, + \ 'initialization_options': {"storagePath": vim_path."/intelephense"}, + \ 'whitelist': ['php'], + \ }) + autocmd FileType php setlocal omnifunc=lsp#complete +else + " php-complete : autocompletion support + " enable php-complete for newer code completion code base + call vim_kicks_ass#with_plugins('php-complete') + let g:phpcomplete_parse_docblock_comments = 1 +endif + +" npm install -g vscode-css-languageserver-bin +if executable('css-languageserver') + au User lsp_setup call lsp#register_server({ + \ 'name': 'css-languageserver', + \ 'cmd': {server_info->['css-languageserver', '--stdio']}, + \ 'whitelist': ['css', 'less', 'sass'], + \ }) +endif + " autocomplpop options let g:acp_mappingDriven = 1 " don't autocomplete on backspace +let g:acp_behaviorKeywordLength = 2 " keyword autocomplete with 1 character let g:acp_completeoptPreview = 1 " display function arguments preview -let g:acp_behaviorKeywordLength = 1 " keyword autocomplete with 1 character " easytags option let g:easytags_cmd = 'ctags' @@ -77,7 +125,7 @@ let git_repo = isdirectory(getcwd().'/'.".git") let fossil_repo = file_readable(getcwd().'/'.".fslckout") if git_repo || fossil_repo let g:easytags_autorecurse = 1 - echo 'Recursive tags scanning enabled.' + "echo 'Recursive tags scanning enabled.' endif " syntastic options @@ -114,13 +162,6 @@ if !has("gui_running") let g:AutoClosePreservDotReg = 0 endif -" ------------------------------------------------------- -" LOAD PRESETS -" ------------------------------------------------------- -call vim_kicks_ass#using_presets([ - \ 'php', 'javascript' - \ ]) - " ------------------------------------------------------- " LOAD COLORSCHEMES " ------------------------------------------------------- @@ -160,7 +201,9 @@ set cursorline set relativenumber set colorcolumn=81 " right margin position set mouse=a " enable mouse -set completeopt=menuone,longest,popup,noselect,noinsert +set completeopt=menuone,longest,preview,noselect,noinsert +set visualbell " disable annoying error sound +set t_vb= " ------------------------------------------------------- " KEY BINDINGS @@ -168,10 +211,14 @@ set completeopt=menuone,longest,popup,noselect,noinsert let mapleader = '\' let maplocalleader = ',' +" Document traversing +nnoremap :call buffer_selector#OpenBufferSelector() +inoremap :call buffer_selector#OpenBufferSelector() " show list of symbols nnoremap l :TlistToggle " goto definition -nnoremap j +nnoremap :LspDefinition +inoremap :LspDefinition nnoremap jh nnoremap nnoremap @@ -201,6 +248,11 @@ inoremap pumvisible() \|\| &omnifunc == '' ? \ "\"\\c-n>\\c-p>\\c-n>\" :" . \ "\" \\bs>\\C-n>\"\" inoremap +" Show function signature +nnoremap :LspHover +inoremap :LspHover +nnoremap :LspPeekDefinition +inoremap :LspPeekDefinition " search files/content nnoremap f :Files nnoremap F :Rg From ac0d68c0a260f1b2b6e83ee0d6f8c0b944818155 Mon Sep 17 00:00:00 2001 From: jgmdev Date: Thu, 3 Oct 2019 13:25:32 -0400 Subject: [PATCH 38/42] Added workspace management plugin to jgmdev template. --- templates/vimrc.jgmdev | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/templates/vimrc.jgmdev b/templates/vimrc.jgmdev index 1e3e132..88bd961 100644 --- a/templates/vimrc.jgmdev +++ b/templates/vimrc.jgmdev @@ -53,7 +53,7 @@ call vim_kicks_ass#with_plugins([ \ 'sheerun/vim-polyglot', 'jcommenter', 'endwise', \ 'ap/vim-css-color', 'prabirshrestha/async.vim', 'prabirshrestha/vim-lsp', \ 'php-doc', 'php-fix-html-indent', 'php-cs-fixer', 'php-namespace', - \ 'mikoto2000/buffer_selector.vim' + \ 'mikoto2000/buffer_selector.vim', 'thaerkh/vim-workspace' \ ]) " ------------------------------------------------------- @@ -67,6 +67,9 @@ call vim_kicks_ass#using_presets([ " PLUGIN SETTINGS " ------------------------------------------------------- +" vim-workspace +let g:workspace_session_directory = vim_path.'/sessions/' + " vim-lsp let g:lsp_signs_enabled = 0 let g:lsp_diagnostics_echo_cursor = 1 @@ -211,6 +214,8 @@ set t_vb= let mapleader = '\' let maplocalleader = ',' +" Workspace session (create or delete a session for current directory) +nnoremap s :ToggleWorkspace " Document traversing nnoremap :call buffer_selector#OpenBufferSelector() inoremap :call buffer_selector#OpenBufferSelector() @@ -225,7 +230,7 @@ nnoremap " comment/uncomment nnoremap c :call NERDComment(0, "toggle") vnoremap c :call NERDComment(1, "toggle") -inoremap c :call NERDComment(0, "toggle") +inoremap :call NERDComment(0, "toggle") " generate php doc block nnoremap d :call JCommentWriter() nnoremap D :call PhpDoc() @@ -233,15 +238,22 @@ nnoremap e :Explore " tabs navigation previous/next nnoremap [ :tabp nnoremap ] :tabn +" open files +nnoremap o :edit +nnoremap O :tabnew +nnoremap v :vsplit +nnoremap V :split " save/quit nnoremap s :w nnoremap sq :wq nnoremap q :q +nnoremap Q :qa +nnoremap x :bd " shift tab unindent nnoremap >> nnoremap << inoremap -" bind omnicomplete to CTRL+Space (doesn't works) +" bind omnicomplete to CTRL+Space (doesn't works in terminal but does on gvim) inoremap pumvisible() \|\| &omnifunc == '' ? \ "\C-n>" : \ "\C-x>\C-o>=pumvisible() ?" . From 38b27a65cc522b3b4240140dec4ca3153055f0c3 Mon Sep 17 00:00:00 2001 From: jgmdev Date: Thu, 3 Oct 2019 15:17:55 -0400 Subject: [PATCH 39/42] Added vim-buffkill plugin to jgmdev template. --- templates/vimrc.jgmdev | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/templates/vimrc.jgmdev b/templates/vimrc.jgmdev index 88bd961..024ae90 100644 --- a/templates/vimrc.jgmdev +++ b/templates/vimrc.jgmdev @@ -53,7 +53,8 @@ call vim_kicks_ass#with_plugins([ \ 'sheerun/vim-polyglot', 'jcommenter', 'endwise', \ 'ap/vim-css-color', 'prabirshrestha/async.vim', 'prabirshrestha/vim-lsp', \ 'php-doc', 'php-fix-html-indent', 'php-cs-fixer', 'php-namespace', - \ 'mikoto2000/buffer_selector.vim', 'thaerkh/vim-workspace' + \ 'mikoto2000/buffer_selector.vim', 'thaerkh/vim-workspace', + \ 'qpkorr/vim-bufkill' \ ]) " ------------------------------------------------------- @@ -113,7 +114,7 @@ let g:acp_completeoptPreview = 1 " display function arguments preview " easytags option let g:easytags_cmd = 'ctags' let g:easytags_syntax_keyword = 'auto' " Use auto or always (faster) -let g:easytags_auto_update = 1 " automatically generate tags while coding +let g:easytags_auto_update = 0 " automatically generate tags while coding let g:easytags_auto_highlight = 0 " can affect performance let g:easytags_async = 1 if !isdirectory(vim_path."/typetags") @@ -248,7 +249,7 @@ nnoremap s :w nnoremap sq :wq nnoremap q :q nnoremap Q :qa -nnoremap x :bd +nnoremap x :BD " shift tab unindent nnoremap >> nnoremap << From c349068b926092271904dbebf92cf728e7032db8 Mon Sep 17 00:00:00 2001 From: jgmdev Date: Tue, 12 Nov 2019 15:47:55 -0400 Subject: [PATCH 40/42] Added optional registration of php-language-server on jgmdev template. --- templates/vimrc.jgmdev | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/templates/vimrc.jgmdev b/templates/vimrc.jgmdev index 024ae90..281daa7 100644 --- a/templates/vimrc.jgmdev +++ b/templates/vimrc.jgmdev @@ -86,7 +86,17 @@ if executable("intelephense") au User lsp_setup call lsp#register_server({ \ 'name': 'intelephense', \ 'cmd': {server_info->['intelephense', '--stdio']}, - \ 'initialization_options': {"storagePath": vim_path."/intelephense"}, + \ 'initialization_options'" {"storagePath": vim_path."/intelephense"}, + \ 'whitelist': ['php'], + \ }) + autocmd FileType php setlocal omnifunc=lsp#complete +" Enable php-language-server for vim-lsp +" git clone https://github.com/felixfbecker/php-language-server ~/.vim/php-language-server +" cd ~/.vim/php-language-server/ && composer install && composer run-script parse-stubs +elseif isdirectory(vim_path."/php-language-server") + au User lsp_setup call lsp#register_server({ + \ 'name': 'php-language-server', + \ 'cmd': {server_info->['php', expand("~/.vim/php-language-server/bin/php-language-server.php")]}, \ 'whitelist': ['php'], \ }) autocmd FileType php setlocal omnifunc=lsp#complete From 1e5b3f5ae9be4de9b963e100ff629c21e5064313 Mon Sep 17 00:00:00 2001 From: jgmdev Date: Tue, 3 Dec 2019 14:35:56 -0400 Subject: [PATCH 41/42] Fixes to jgmdev template. --- templates/vimrc.jgmdev | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/templates/vimrc.jgmdev b/templates/vimrc.jgmdev index 281daa7..e3e6734 100644 --- a/templates/vimrc.jgmdev +++ b/templates/vimrc.jgmdev @@ -37,7 +37,7 @@ if !executable("fzf") || !executable("rg") endif if !executable("php-cs-fixer") - echo "Remember to install php-cs-fixer." + echo "Remember to install php-cs-fixer." endif " ------------------------------------------------------- @@ -86,7 +86,7 @@ if executable("intelephense") au User lsp_setup call lsp#register_server({ \ 'name': 'intelephense', \ 'cmd': {server_info->['intelephense', '--stdio']}, - \ 'initialization_options'" {"storagePath": vim_path."/intelephense"}, + \ 'initialization_options': {"storagePath": expand("~/.vim/intelephense")}, \ 'whitelist': ['php'], \ }) autocmd FileType php setlocal omnifunc=lsp#complete @@ -173,7 +173,7 @@ let g:lightline = { " fix: some weird issues with arrowkeys using autoclose in console if !has("gui_running") - let g:AutoClosePreservDotReg = 0 + let g:AutoClosePreservDotReg = 0 endif " ------------------------------------------------------- @@ -260,6 +260,7 @@ nnoremap sq :wq nnoremap q :q nnoremap Q :qa nnoremap x :BD +nnoremap X :tabclose " shift tab unindent nnoremap >> nnoremap << From 34fa5f83bbb0a8e4a12bf91492824b4f65f813dd Mon Sep 17 00:00:00 2001 From: jgmdev Date: Tue, 3 Dec 2019 17:13:49 -0400 Subject: [PATCH 42/42] Use async complete on jgmdev template. --- templates/vimrc.jgmdev | 62 +++++++++++++++++++++++++++++++++++++++--- 1 file changed, 58 insertions(+), 4 deletions(-) diff --git a/templates/vimrc.jgmdev b/templates/vimrc.jgmdev index e3e6734..be2a2b2 100644 --- a/templates/vimrc.jgmdev +++ b/templates/vimrc.jgmdev @@ -45,7 +45,7 @@ endif " ------------------------------------------------------- call vim_kicks_ass#with_plugins([ \ 'misc', 'easytags', 'taglist', - \ 'l9', 'autocomplpop', 'syntastic', + \ 'l9', 'syntastic', \ 'fugitive', 'autoclose', 'markdown', \ 'html5', 'nerdcommenter', 'tabular', \ 'closetag', 'detectindent', 'junegunn/fzf.vim', @@ -57,6 +57,11 @@ call vim_kicks_ass#with_plugins([ \ 'qpkorr/vim-bufkill' \ ]) +call vim_kicks_ass#with_plugins([ + \ 'prabirshrestha/asyncomplete.vim', + \ 'prabirshrestha/asyncomplete-lsp.vim', + \ ]) + " ------------------------------------------------------- " LOAD PRESETS " ------------------------------------------------------- @@ -64,6 +69,49 @@ call vim_kicks_ass#using_presets([ \ 'javascript' \ ]) +" ------------------------------------------------------- +" Autocompletion backends for asynccomplete +" ------------------------------------------------------- + +" Keyword completion +call vim_kicks_ass#with_plugins([ + \ 'prabirshrestha/asyncomplete-buffer.vim', + \ ]) + +call asyncomplete#register_source(asyncomplete#sources#buffer#get_source_options({ + \ 'name': 'buffer', + \ 'whitelist': ['*'], + \ 'blacklist': ['go'], + \ 'completor': function('asyncomplete#sources#buffer#completor'), + \ 'config': { + \ 'max_buffer_size': -1, + \ }, + \ })) + +" File name completion +call vim_kicks_ass#with_plugins([ + \ 'prabirshrestha/asyncomplete-file.vim' + \ ]) + +au User asyncomplete_setup call asyncomplete#register_source(asyncomplete#sources#file#get_source_options({ + \ 'name': 'file', + \ 'whitelist': ['*'], + \ 'priority': 10, + \ 'completor': function('asyncomplete#sources#file#completor') + \ })) + +" Omni completion +call vim_kicks_ass#with_plugins([ + \ 'yami-beta/asyncomplete-omni.vim' + \ ]) + +call asyncomplete#register_source(asyncomplete#sources#omni#get_source_options({ + \ 'name': 'omni', + \ 'whitelist': ['*'], + \ 'blacklist': ['c', 'cpp', 'html', 'php', 'css', 'less', 'sass'], + \ 'completor': function('asyncomplete#sources#omni#completor') + \ })) + " ------------------------------------------------------- " PLUGIN SETTINGS " ------------------------------------------------------- @@ -71,6 +119,9 @@ call vim_kicks_ass#using_presets([ " vim-workspace let g:workspace_session_directory = vim_path.'/sessions/' +" asynccomplete +let g:asyncomplete_auto_popup = 1 + " vim-lsp let g:lsp_signs_enabled = 0 let g:lsp_diagnostics_echo_cursor = 1 @@ -89,7 +140,7 @@ if executable("intelephense") \ 'initialization_options': {"storagePath": expand("~/.vim/intelephense")}, \ 'whitelist': ['php'], \ }) - autocmd FileType php setlocal omnifunc=lsp#complete + "autocmd FileType php setlocal omnifunc=lsp#complete " Enable php-language-server for vim-lsp " git clone https://github.com/felixfbecker/php-language-server ~/.vim/php-language-server " cd ~/.vim/php-language-server/ && composer install && composer run-script parse-stubs @@ -99,7 +150,7 @@ elseif isdirectory(vim_path."/php-language-server") \ 'cmd': {server_info->['php', expand("~/.vim/php-language-server/bin/php-language-server.php")]}, \ 'whitelist': ['php'], \ }) - autocmd FileType php setlocal omnifunc=lsp#complete + "autocmd FileType php setlocal omnifunc=lsp#complete else " php-complete : autocompletion support " enable php-complete for newer code completion code base @@ -111,9 +162,12 @@ endif if executable('css-languageserver') au User lsp_setup call lsp#register_server({ \ 'name': 'css-languageserver', - \ 'cmd': {server_info->['css-languageserver', '--stdio']}, + \ 'cmd': {server_info->[&shell, &shellcmdflag, 'css-languageserver --stdio']}, \ 'whitelist': ['css', 'less', 'sass'], \ }) + "autocmd FileType css setlocal omnifunc=lsp#complete + "autocmd FileType less setlocal omnifunc=lsp#complete + "autocmd FileType sass setlocal omnifunc=lsp#complete endif " autocomplpop options