diff --git a/vimrc b/vimrc index 1f0c3f1..373188d 100644 --- a/vimrc +++ b/vimrc @@ -9,55 +9,195 @@ endif call plug#begin('~/.vim/bundle') +" #Activity Watch #aw-watcher-vim{{{ +" https://github.com/ActivityWatch/aw-watcher-vim +Plug 'ActivityWatch/aw-watcher-vim' + +"}}} +" #ALE {{{ +" https://github.com/w0rp/ale +Plug 'w0rp/ale' + +nnoremap ne :lnext +nnoremap pe :lprev + +let g:ale_sign_error = '>>' +let g:ale_sign_warning = '>' +let g:ale_sign_column_always = 1 +let g:ale_open_list = 0 + +let g:ale_linters = {'scss': ['stylelint'], 'javascript': [], 'php':['php'], 'html':['htmlhint'], 'python': [], 'vue': []} +let g:ale_html_htmlhint_options = '-c ~/.htmlhintrc --format=unix' +let g:ale_fixers = {'javascript': ['eslint']} + +"}}} +" #colorV {{{ +" original: +" https://github.com/gu-fan/colorv.vim +" Plug 'gu-fan/colorv.vim' +" custom fork: +" https://github.com/studio-vx/colorv.vim +Plug 'studio-vx/colorv.vim' + +let g:ColorVForceGuiColors = 1 + +let g:colorv_no_global_map = 1 +let g:colorv_win_pos = 'top' +let g:colorv_preview_area = 0 + +nnoremap cv :ColorV +nnoremap ce :ColorVEdit +nnoremap cc :call ToggleColorPreview() +nnoremap ci :ColorVInsert +nnoremap cp :ColorVPicker + +let w:colorv_is_previewing = 0 +function! ToggleColorPreview() abort "{{{ + if !exists('w:colorv_is_previewing') + let w:colorv_is_previewing = 0 + endif + if w:colorv_is_previewing == 0 + execute 'ColorVPreview' + let w:colorv_is_previewing = 1 + else + execute 'ColorVClear' + let w:colorv_is_previewing = 0 + endif +endfunction "}}} + + +"}}} " #css3-syntax{{{ Plug 'hail2u/vim-css3-syntax' "}}} -" #scss-syntax{{{ -Plug 'cakebaker/scss-syntax.vim' +" #Ctrlp {{{ +Plug 'ctrlpvim/ctrlp.vim' +" :h ctrlp-commands +" :h ctrlp-extensions + +let g:ctrlp_extensions = ['tag', 'buffertag', 'quickfix', 'undo'] + +if executable('ag') + " Use ag in CtrlP for listing files. Lightning fast and respects .gitignore + let g:ctrlp_user_command = 'ag %s -l --nocolor -g ""' + " ag is fast enough that CtrlP doesn't need to cache + let g:ctrlp_use_caching = 0 +endif +" Use ag over grep +if executable('ag') + set grepprg=ag\ --nogroup\ --nocolor\ --ignore\ node_modules +endif "}}} -" #vim-vue {{{ -" https://github.com/posva/vim-vue -Plug 'posva/vim-vue' +" #emmet-vim {{{ +" https://github.com/mattn/emmet-vim +Plug 'mattn/emmet-vim' +let g:user_emmet_leader_key=',,' +let g:user_emmet_settings = { +\ 'indentation': ' ', +\} -" disable preprocessor checking for vue files - increases speed -let g:vue_disable_pre_processors=0 -" set custom syntax highlighting -augroup fixhighlighting - autocmd! - autocmd BufNewFile,BufRead *.vue syntax sync fromstart -augroup END +"}}} +" #gitgutter {{{ +" https://github.com/airblade/vim-gitgutter/blob/master/README.mkd +Plug 'airblade/vim-gitgutter' - " #vim-yaml - " https://github.com/stephpy/vim-yaml - Plug 'stephpy/vim-yaml' - - " #python-syntax - " https://github.com/vim-python/python-syntax - Plug 'vim-python/python-syntax' - let g:python_highlight_all = 1 +nmap ]h GitGutterNextHunk +nmap [h GitGutterPrevHunk +omap ih GitGutterTextObjectInnerPending +omap ah GitGutterTextObjectOuterPending +xmap ih GitGutterTextObjectInnerVisual +xmap ah GitGutterTextObjectOuterVisual +"}}} +" #gitv{{{ +" https://github.com/gregsexton/gitv +Plug 'gregsexton/gitv' "}}} "#html5{{{ " https://github.com/othree/html5.vim Plug 'othree/html5.vim' +"}}} +"#i3config.vim{{{ +" https://github.com/mboughaba/i3config.vim +Plug 'mboughaba/i3config.vim' + +"}}} +" #inline_edit.vim {{{ +" https://github.com/AndrewRadev/inline_edit.vim +Plug 'AndrewRadev/inline_edit.vim' + +let g:inline_edit_patterns = [{ + \ 'main_filetype': '*html', + \ 'sub_filetype': 'scss', + \ 'indent_adjustment': 1, + \ 'start': '[^>]*lang=.scss[^>]*>', + \ 'end': '' + \ }] + +let g:inline_edit_autowrite = 1 +let g:inline_edit_proxy_type = 'tempfile' +let g:inline_edit_new_buffer_command ='tabedit' +let g:inline_edit_modify_statusline = 0 + +nnoremap ie :InlineEdit + +"}}} +" #MatchTagAlways{{{ +" https://github.com/Valloric/MatchTagAlways +Plug 'Valloric/MatchTagAlways' + +"}}} +" #Netrw {{{ + +let g:netrw_liststyle=3 +let g:netrw_list_hide='^\..*' +let g:netrw_preview = 0 + +"}}} +" #Obsession{{{ +Plug 'tpope/vim-obsession' + "}}} " #php.vim{{{ " https://github.com/StanAngeloff/php.vim Plug 'StanAngeloff/php.vim' "}}} -"#vim-json{{{ -" https://github.com/elzr/vim-json -Plug 'elzr/vim-json' +" #phpcomplete.vim{{{ +" https://github.com/shawncplus/phpcomplete.vim +Plug 'shawncplus/phpcomplete.vim' +" https://github.com/dsawardekar/wordpress.vim +" For up to date Wordpress Files see: +" https://github.com/joseluis/wordpress.vim-generator "}}} -"#i3config.vim{{{ -" https://github.com/mboughaba/i3config.vim -Plug 'mboughaba/i3config.vim' +" #quickscope{{{ +" https://github.com/unblevable/quick-scope +Plug 'unblevable/quick-scope' +let g:qs_highlight_on_keys = ['f', 'F', 't', 'T'] +"}}} +" #scss-syntax{{{ +Plug 'cakebaker/scss-syntax.vim' + +"}}} +" #switch {{{ +"https://github.com/AndrewRadev/switch.vim +Plug 'AndrewRadev/switch.vim' + +let g:switch_mapping = '-' +let g:switch_custom_definitions = [ + \ ['0', '1'], + \ ['ease-in', 'ease-out', 'ease-in-out', 'linear'], + \ ['auto', 'none'], + \ ['left', 'right'], + \ ['top', 'bottom'], + \ ['row', 'column'], + \ ['relative', 'absolute', 'fixed'] +\ ] "}}} " #tagbar {{{ @@ -105,42 +245,6 @@ let g:tagbar_type_vue = { \ ] \ } -"}}} -" #vim-surround{{{ -Plug 'tpope/vim-surround' - -"}}} -" #undotree {{{ -Plug 'mbbill/undotree' -nnoremap ut :UndotreeToggle - -"}}} -" #Ctrlp {{{ -Plug 'ctrlpvim/ctrlp.vim' -" :h ctrlp-commands -" :h ctrlp-extensions - -let g:ctrlp_extensions = ['tag', 'buffertag', 'quickfix', 'undo'] - -if executable('ag') - " Use ag in CtrlP for listing files. Lightning fast and respects .gitignore - let g:ctrlp_user_command = 'ag %s -l --nocolor -g ""' - " ag is fast enough that CtrlP doesn't need to cache - let g:ctrlp_use_caching = 0 -endif -" Use ag over grep -if executable('ag') - set grepprg=ag\ --nogroup\ --nocolor\ --ignore\ node_modules -endif - -"}}} -" #Obsession{{{ -Plug 'tpope/vim-obsession' - -"}}} -" #vim-javascript{{{ -Plug 'pangloss/vim-javascript' - "}}} " #ultisnips {{{ " https://github.com/sirver/UltiSnips @@ -197,43 +301,9 @@ endfunction set completefunc=CompleteSnippets "}}} -" #ALE {{{ -" https://github.com/w0rp/ale -Plug 'w0rp/ale' - -nnoremap ne :lnext -nnoremap pe :lprev - -let g:ale_sign_error = '>>' -let g:ale_sign_warning = '>' -let g:ale_sign_column_always = 1 -let g:ale_open_list = 0 - -let g:ale_linters = {'scss': ['stylelint'], 'javascript': [], 'php':['php'], 'html':['htmlhint'], 'python': [], 'vue': []} -let g:ale_html_htmlhint_options = '-c ~/.htmlhintrc --format=unix' -let g:ale_fixers = {'javascript': ['eslint']} - -"}}} -" #MatchTagAlways{{{ -" https://github.com/Valloric/MatchTagAlways -Plug 'Valloric/MatchTagAlways' - -"}}} -" #phpcomplete.vim{{{ -" https://github.com/shawncplus/phpcomplete.vim -Plug 'shawncplus/phpcomplete.vim' -" https://github.com/dsawardekar/wordpress.vim -" For up to date Wordpress Files see: -" https://github.com/joseluis/wordpress.vim-generator - -"}}} -" #wordpress.vim{{{ -" doesn't support universal ctags -" #Plug 'dsawardekar/wordpress.vim' -" This fork does: -" https://github.com/DArcMattr/wordpress.vim/tree/universal-ctags -" Using studio-vx fork -Plug 'studio-vx/wordpress.vim', { 'branch': 'universal-ctags' } +" #undotree {{{ +Plug 'mbbill/undotree' +nnoremap ut :UndotreeToggle "}}} " #vim-commentary{{{ @@ -241,24 +311,17 @@ Plug 'studio-vx/wordpress.vim', { 'branch': 'universal-ctags' } Plug 'tpope/vim-commentary' "}}} -" #vim-repeat{{{ -" https://github.com/tpope/vim-repeat -Plug 'tpope/vim-repeat' +" #vim-dispatch{{{ +" https://github.com/tpope/vim-dispatch +Plug 'tpope/vim-dispatch' "}}} -" #emmet-vim {{{ -" https://github.com/mattn/emmet-vim -Plug 'mattn/emmet-vim' -let g:user_emmet_leader_key=',,' -let g:user_emmet_settings = { -\ 'indentation': ' ', -\} +" #vim-easy-align {{{ +" https://github.com/junegunn/vim-easy-align +Plug 'junegunn/vim-easy-align' -"}}} -" #vimwiki {{{ -" https://github.com/vimwiki/vimwiki -Plug 'vimwiki/vimwiki' -let g:vimwiki_list = [{'path': '~/vimwiki/', 'path_html': '~/vimwiki_html/'}] +xmap ga (EasyAlign) +nmap ga (EasyAlign) "}}} " #vim-gutentags {{{ @@ -269,101 +332,9 @@ let g:gutentags_ctags_tagfile = '.tags' let g:gutentags_ctags_exclude = ['package.json', 'Session.vim', 'package-lock.json', 'TODO.txt'] "}}} -" #vim-dispatch{{{ -" https://github.com/tpope/vim-dispatch -Plug 'tpope/vim-dispatch' - -"}}} -" #colorV {{{ -" original: -" https://github.com/gu-fan/colorv.vim -" Plug 'gu-fan/colorv.vim' -" custom fork: -" https://github.com/studio-vx/colorv.vim -Plug 'studio-vx/colorv.vim' - -let g:ColorVForceGuiColors = 1 - -let g:colorv_no_global_map = 1 -let g:colorv_win_pos = 'top' -let g:colorv_preview_area = 0 - -nnoremap cv :ColorV -nnoremap ce :ColorVEdit -nnoremap cc :call ToggleColorPreview() -nnoremap ci :ColorVInsert -nnoremap cp :ColorVPicker - -let w:colorv_is_previewing = 0 -function! ToggleColorPreview() abort "{{{ - if !exists('w:colorv_is_previewing') - let w:colorv_is_previewing = 0 - endif - if w:colorv_is_previewing == 0 - execute 'ColorVPreview' - let w:colorv_is_previewing = 1 - else - execute 'ColorVClear' - let w:colorv_is_previewing = 0 - endif -endfunction "}}} - - -"}}} -" #switch {{{ -"https://github.com/AndrewRadev/switch.vim -Plug 'AndrewRadev/switch.vim' - -let g:switch_mapping = '-' -let g:switch_custom_definitions = [ - \ ['0', '1'], - \ ['ease-in', 'ease-out', 'ease-in-out', 'linear'], - \ ['auto', 'none'], - \ ['left', 'right'], - \ ['top', 'bottom'], - \ ['row', 'column'], - \ ['relative', 'absolute', 'fixed'] -\ ] - -"}}} -" #gitgutter {{{ -" https://github.com/airblade/vim-gitgutter/blob/master/README.mkd -Plug 'airblade/vim-gitgutter' - -nmap ]h GitGutterNextHunk -nmap [h GitGutterPrevHunk -omap ih GitGutterTextObjectInnerPending -omap ah GitGutterTextObjectOuterPending -xmap ih GitGutterTextObjectInnerVisual -xmap ah GitGutterTextObjectOuterVisual - -"}}} -" #fugitive-vim{{{ -" https://github.com/tpope/vim-fugitive/blob/master/README.markdown -Plug 'tpope/vim-fugitive' - -"}}} -" #vim-git{{{ -" https://github.com/tpope/vim-git -Plug 'tpope/vim-git' - -"}}} -" #gitv{{{ -" https://github.com/gregsexton/gitv -Plug 'gregsexton/gitv' - -"}}} -" #wakatime{{{ -" https://wakatime.com/vim -Plug 'wakatime/vim-wakatime' - -"}}} -" #vim-easy-align {{{ -" https://github.com/junegunn/vim-easy-align -Plug 'junegunn/vim-easy-align' - -xmap ga (EasyAlign) -nmap ga (EasyAlign) +"#vim-json{{{ +" https://github.com/elzr/vim-json +Plug 'elzr/vim-json' "}}} " #vim-lsp {{{ @@ -416,36 +387,75 @@ augroup User lsp_setup augroup END "}}} -" #inline_edit.vim {{{ -" https://github.com/AndrewRadev/inline_edit.vim -Plug 'AndrewRadev/inline_edit.vim' - -let g:inline_edit_patterns = [{ - \ 'main_filetype': '*html', - \ 'sub_filetype': 'scss', - \ 'indent_adjustment': 1, - \ 'start': '[^>]*lang=.scss[^>]*>', - \ 'end': '' - \ }] - -let g:inline_edit_autowrite = 1 -let g:inline_edit_proxy_type = 'tempfile' -let g:inline_edit_new_buffer_command ='tabedit' -let g:inline_edit_modify_statusline = 0 - -nnoremap ie :InlineEdit +" #vim-repeat{{{ +" https://github.com/tpope/vim-repeat +Plug 'tpope/vim-repeat' "}}} -" #Netrw {{{ - -let g:netrw_liststyle=3 -let g:netrw_list_hide='^\..*' -let g:netrw_preview = 0 +"#vim-rsi{{{ +"https://github.com/tpope/vim-rsi +Plug 'tpope/vim-rsi' "}}} -" #Activity Watch #aw-watcher-vim{{{ -" https://github.com/ActivityWatch/aw-watcher-vim -Plug 'ActivityWatch/aw-watcher-vim' +" #vim-surround{{{ +Plug 'tpope/vim-surround' + +"}}} +" #vim-vue {{{ +" https://github.com/posva/vim-vue +Plug 'posva/vim-vue' + +" disable preprocessor checking for vue files - increases speed +let g:vue_disable_pre_processors=0 +" set custom syntax highlighting +augroup fixhighlighting + autocmd! + autocmd BufNewFile,BufRead *.vue syntax sync fromstart +augroup END + + " #vim-yaml + " https://github.com/stephpy/vim-yaml + Plug 'stephpy/vim-yaml' + + " #python-syntax + " https://github.com/vim-python/python-syntax + Plug 'vim-python/python-syntax' + let g:python_highlight_all = 1 + + +"}}} +" #vim-javascript{{{ +Plug 'pangloss/vim-javascript' + +"}}} +" #vimwiki {{{ +" https://github.com/vimwiki/vimwiki +Plug 'vimwiki/vimwiki' +let g:vimwiki_list = [{'path': '~/vimwiki/', 'path_html': '~/vimwiki_html/'}] + +"}}} +" #wordpress.vim{{{ +" doesn't support universal ctags +" #Plug 'dsawardekar/wordpress.vim' +" This fork does: +" https://github.com/DArcMattr/wordpress.vim/tree/universal-ctags +" Using studio-vx fork +Plug 'studio-vx/wordpress.vim', { 'branch': 'universal-ctags' } + +"}}} +" #fugitive-vim{{{ +" https://github.com/tpope/vim-fugitive/blob/master/README.markdown +Plug 'tpope/vim-fugitive' + +"}}} +" #vim-git{{{ +" https://github.com/tpope/vim-git +Plug 'tpope/vim-git' + +"}}} +" #wakatime{{{ +" https://wakatime.com/vim +Plug 'wakatime/vim-wakatime' "}}} call plug#end() @@ -853,6 +863,13 @@ endfunction "}}} "----------------------------------------------------------------------------}}} +"#commands{{{ +" remove trailing whitespace +command! -range=% TrimWhitespace let b:wv = winsaveview() | + \ keeppattern ,s/\s\+$// | + \ call winrestview(b:wv) + +"}}} " #settings {{{ scriptencoding utf-8 set ttyfast