diff --git a/UltiSnips/vue.snippets b/UltiSnips/vue.snippets index ecf68ef..d5d13ac 100644 --- a/UltiSnips/vue.snippets +++ b/UltiSnips/vue.snippets @@ -140,3 +140,11 @@ snippet .tran "vue transition selector" } }$0 endsnippet + +snippet script "" + +endsnippet diff --git a/coc-settings.json b/coc-settings.json deleted file mode 100644 index 81937e9..0000000 --- a/coc-settings.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "coc.preferences.triggerAfterInsertEnter": false, - "coc.preferences.autoTrigger": "none", - "coc.preferences.noselect": true, - "coc.preferences.triggerSignatureHelp": true, - "coc.preferences.diagnostic.enable": true, - "coc.preferences.diagnostic.warningSign": "λ", - "coc.preferences.diagnostic.errorSign": "Λ", - "coc.preferences.diagnostic.infoSign": "λ", - "coc.preferences.diagnostic.hintSign": "λ", - "coc.preferences.timeout": 1000, - - "coc.source.buffer.ignoreGitignore": true, - - "javascript.suggestionActions.enabled": false -} - diff --git a/config/plugins.nvim.vim b/config/plugins.nvim.vim new file mode 100644 index 0000000..609b69e --- /dev/null +++ b/config/plugins.nvim.vim @@ -0,0 +1,371 @@ +" #vim-hexokinase {{{ + " https://github.com/RRethy/vim-hexokinase + Plug 'RRethy/vim-hexokinase' + let g:Hexokinase_highlighters = ['virtual'] + let g:Hexokinase_virtualText = '██████' + nnoremap cc :HexokinaseToggle + nnoremap cr :HexokinaseRefresh + + "}}} +" #ranger.vim {{{ + " https://github.com/francoiscabrol/ranger.vim + Plug 'francoiscabrol/ranger.vim' + let g:ranger_map_keys = 0 + + "}}} + +" #ALE {{{ + " https://github.com/w0rp/ale + + Plug 'w0rp/ale' + " let g:ale_completion_enabled = 1 + + let g:ale_disable_lsp = 1 + let g:ale_sign_column_always = 1 + let g:ale_open_list = 0 + let g:ale_fix_on_save = 1 + let g:ale_fix_on_save_ignore = { 'vue': ['eslint'] } + + let g:ale_linters = {'scss': ['stylelint'], 'javascript': ['eslint'], 'json': ['jsonlint'], 'php':['php'], 'python': [], 'html':['htmlhint'], 'vue': []} + let g:ale_fixers = {'scss': ['prettier'], 'javascript': ['eslint'], 'json': ['jq'], 'python': ['black'], 'vue': ['eslint']} + + let g:ale_html_htmlhint_options = '-c ~/.htmlhintrc --format=unix' + + let g:ale_python_pyls_config = { +\ 'pyls': { +\ 'pycodestyle': { 'enabled': v:false }, +\ 'configurationSources': ['flake8'] +\ } +\ } + + let g:ale_sign_error = 'Α' + let g:ale_sign_warning = 'α' + + nmap \\ (ale_detail) + nmap \f (ale_fix) + nmap \r (ale_find_references) + nmap \g (ale_go_to_definition) + nmap \d (ale_documentation) + nmap \h (ale_hover) + nmap \n (ale_next) + nmap \p (ale_previous) + + "}}} +" #coc.nvim{{{ + " https://github.com/neoclide/coc.nvim + + Plug 'neoclide/coc.nvim', {'tag': '*', 'do': { -> coc#util#install()}} + + let g:coc_snippet_next = '' + let g:coc_snippet_prev = '' + + inoremap coc#refresh() + nnoremap K :call show_documentation() + nnoremap \c (coc-definition) + nnoremap \y (coc-type-definition) + nnoremap \i (coc-implementation) + nnoremap \r (coc-references) + nnoremap \m (coc-rename) + " vnoremap \f (coc-format-selected) + " nnoremap \f (coc-format-selected) + command! -nargs=0 Format :call CocAction('format') + command! -nargs=? Fold :call CocAction('fold', ) + + function! s:show_documentation() + if &filetype == 'vim' || &filetype == 'help' + execute 'h '.expand('') + else + call CocAction('doHover') + endif + endfunction + +" }}} +" #css3-syntax{{{ + Plug 'hail2u/vim-css3-syntax' + + "}}} +" #delimitMate{{{ +" https://github.com/Raimondi/delimitMate + Plug 'Raimondi/delimitMate' + let delimitMate_expand_cr = 1 + let delimitMate_expand_space = 1 + "}}} +" #echodoc.vim{{{ +" https://github.com/Shougo/echodoc.vim + Plug 'Shougo/echodoc.vim' + "}}} +" #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-fugitive{{{ + " https://github.com/tpope/vim-fugitive/blob/master/README.markdown + Plug 'tpope/vim-fugitive' + nnoremap gs :Gstatus + nnoremap gd :tabedit %:Gdiff + nnoremap gc :Gcommit + nnoremap gl :Glog + nnoremap gp :Gpush:copen + nnoremap gp :Gpushjob:copen + + "}}} +" #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 + + "}}} +" #html5{{{ + " https://github.com/othree/html5.vim + Plug 'othree/html5.vim' + + "}}} +" #i3config.vim{{{ + " https://github.com/mboughaba/i3config.vim + Plug 'mboughaba/i3config.vim' + + "}}} +" #MatchTagAlways{{{ + " https://github.com/Valloric/MatchTagAlways + Plug 'Valloric/MatchTagAlways' +let g:mta_filetypes = { + \ 'jinja' : 1, + \ 'html' : 1, + \ 'vue' : 1, + \ 'xhtml' : 1, + \ 'xml' : 1, + \} + "}}} +" #php.vim{{{ + " https://github.com/StanAngeloff/php.vim + Plug 'StanAngeloff/php.vim' + + "}}} +" #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 + + "}}} +" #quickscope{{{ + " https://github.com/unblevable/quick-scope + Plug 'unblevable/quick-scope' + let g:qs_highlight_on_keys = ['f', 'F', 't', 'T'] + "}}} +" #rainbow{{{ + " https://github.com/luochen1990/rainbow/blob/master/README.md + Plug 'luochen1990/rainbow' + let g:rainbow_active = 0 + nnoremap rt :RainbowToggle + "}}} +" #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'], + \ ['private', 'public', 'protected'] + \ ] + + "}}} +" #tagbar {{{ + " Plug 'majutsushi/tagbar' + " + " nnoremap tb :TagbarOpen fj + " nnoremap ] :tag /[.#@]=expand('') + " let g:tagbar_autoclose = 1 + " " let g:tagbar_autopreview = 1 + " " let g:tagbar_previewwin_pos = '' + " + " let g:tagbar_type_css = { + " \ 'ctagstype' : 'css', + " \ 'kinds' : [ + " \ 'c:classes', + " \ 'i:ids', + " \ 't:tags', + " \ 'm:medias' + " \ ] + " \} + " + " let g:tagbar_type_scss = { + " \ 'ctagstype' : 'scss', + " \ 'kinds' : [ + " \ 'v:variables', + " \ 'c:classes', + " \ 'i:ids', + " \ 't:tags', + " \ 'd:medias', + " \ 'm:mixins', + " \ 'f:functions' + " \ ] + " \} + " + " let g:tagbar_type_vue = { + " \ 'ctagstype' : 'vue', + " \ 'kinds' : [ + " \ 'o:objects', + " \ 'f:functions', + " \ 'a:array', + " \ 's:string', + " \ 'b:boolean', + " \ 'n:number', + " \ 'v:variable' + " \ ] + " \ } + + "}}} +" #ultisnips {{{ + " https://github.com/sirver/UltiSnips + Plug 'SirVer/ultisnips' + " and some snippets + " https://github.com/honza/vim-snippets + " Plug 'honza/vim-snippets' + + nnoremap ul :call ListUltisnips() + inoremap jkul :call ListUltisnips() + + let g:UltiSnipsSnippetsDir='~/.vim/UltiSnips' + " Trigger configuration. Do not use if you use https://github.com/Valloric/YouCompleteMe. + let g:UltiSnipsExpandTrigger='' + let g:UltiSnipsJumpForwardTrigger='' + let g:UltiSnipsJumpBackwardTrigger='' + let g:UltiSnipsEditSplit='horizontal' + + function! ListUltisnips() abort"{{{ + let l:snips = UltiSnips#SnippetsInCurrentScope(1) + let l:keylist = sort(keys(l:snips)) + echo ' --------------------------------------------------' + for l:key in l:keylist + echo printf(" %-10s\t%s", l:key, l:snips[l:key]) + endfor + echo '---------------------------------------------------' + endfunction + + "}}} + function! CompleteSnippets(findstart, base)"{{{ + if a:findstart + let l:line = getline('.') + let l:start = col('.') - 1 + while l:start > 0 && l:line[l:start - 1] =~ '\a' + let l:start -= 1 + endwhile + return l:start + else + let l:res = [] + let l:snips = UltiSnips#SnippetsInCurrentScope(1) + let l:keylist = sort(keys(l:snips)) + for l:key in l:keylist + if l:key =~ '^' . a:base + let l:item = {'word': l:key, 'menu': l:snips[l:key]} + call add(l:res, l:item) + endif + endfor + return l:res + endif + endfunction + + "}}} + + set completefunc=CompleteSnippets + + "}}} +" #vim-dispatch{{{ + " https://github.com/tpope/vim-dispatch + Plug 'tpope/vim-dispatch' + + "}}} +" #vim-gutentags {{{ + " https://github.com/ludovicchabant/vim-gutentags + Plug 'ludovicchabant/vim-gutentags' + + let g:gutentags_ctags_tagfile = '.tags' + let g:gutentags_ctags_exclude = ['package.json', 'Session.vim', 'package-lock.json', 'TODO.txt'] + + "}}} +" #vim-javascript{{{ + Plug 'pangloss/vim-javascript' + + "}}} +" #vim-Jinja2-Syntax{{{ +" https://github.com/studio-vx/Vim-Jinja2-Syntax +" original: https://github.com/Glench/Vim-Jinja2-Syntax + Plug 'studio-vx/Vim-Jinja2-Syntax' + + "}}} +" #vim-json{{{ + " https://github.com/elzr/vim-json + Plug 'elzr/vim-json' + + "}}} +" #vim-SyntaxRange{{{ +" https://github.com/inkarkat/vim-SyntaxRange + " Plug 'inkarkat/vim-SyntaxRange' + " command! HiJinja call SyntaxRange#Include('{{', '}}', 'jinja', 'jinjaBraces', 'jinjaVariable') + " command! HiJinja call SyntaxRange#IncludeEx('start=/{{-\?/hs=s+2 end=/-\?}}/he=s-1', 'jinja') +"}}} +" #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 + + + "}}} +" #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' } + + "}}} +" #vim-git{{{ + " https://github.com/tpope/vim-git + Plug 'tpope/vim-git' + + "}}} + + + + +" vim: set fdm=marker ft=vim: diff --git a/config/plugins.shared.vim b/config/plugins.shared.vim new file mode 100644 index 0000000..4359e79 --- /dev/null +++ b/config/plugins.shared.vim @@ -0,0 +1,94 @@ +" #Netrw {{{ + + let g:netrw_liststyle=3 + let g:netrw_list_hide='^\..*' + let g:netrw_preview = 0 + + "}}} +" #Obsession{{{ + " fork of tpope/vim-obsession + Plug 'studio-vx/vim-obsession' + + "}}} +" #undotree {{{ + Plug 'mbbill/undotree' + nnoremap ut :UndotreeToggle + + "}}} +" #tcomment_vim{{{ + " https://github.com/tomtom/tcomment_vim + Plug 'tomtom/tcomment_vim' + +"}}} +" #vim-easy-align {{{ + " https://github.com/junegunn/vim-easy-align + Plug 'junegunn/vim-easy-align' + + xmap ga (EasyAlign) + nmap ga (EasyAlign) + + "}}} +" #vim-fzf {{{ +" https://github.com/junegunn/fzf.vim +if executable('fzf') && v:version >= 704 + Plug 'junegunn/fzf.vim' + + nnoremap fg :GFiles + nnoremap ff :Files + nnoremap fr :History + nnoremap ft :Tags + nnoremap fb :Buffers + nnoremap fh :Helptags + nnoremap fa :Ag + nnoremap fA :Ag! + + " Ag! gives fullscreen with preview + command! -bang -nargs=* Ag + \ call fzf#vim#ag(, + \ 0 ? fzf#vim#with_preview('up:60%') + \ : fzf#vim#with_preview('right:50%:hidden', '?'), + \ 0) + + let g:fzf_colors = + \ { 'fg': ['fg', 'Normal'], + \ 'bg': ['bg', 'Normal'], + \ 'hl': ['fg', 'Label'], + \ 'fg+': ['fg', 'CursorLine', 'CursorColumn', 'Normal'], + \ 'bg+': ['bg', 'CursorLine', 'CursorColumn'], + \ 'hl+': ['fg', 'WildMenu'], + \ 'info': ['fg', 'Comment'], + \ 'border': ['fg', 'Ignore'], + \ 'prompt': ['fg', 'Constant'], + \ 'pointer': ['fg', 'Special'], + \ 'marker': ['fg', 'Keyword'], + \ 'spinner': ['fg', 'Label'], + \ 'header': ['fg', 'Comment'] } +endif + +"}}} +" #vim-markdown{{{ +" https://github.com/plasticboy/vim-markdown +Plug 'plasticboy/vim-markdown' +let g:vim_markdown_toc_autofit = 1 +let g:vim_markdown_fenced_languages = ['bash=sh'] +"}}} +" #vim-repeat{{{ + " https://github.com/tpope/vim-repeat + Plug 'tpope/vim-repeat' + + "}}} +" #vim-rsi{{{ + "https://github.com/tpope/vim-rsi + Plug 'tpope/vim-rsi' + + "}}} +" #vim-surround{{{ + Plug 'tpope/vim-surround' + + "}}} +" #wakatime{{{ + " https://wakatime.com/vim + Plug 'wakatime/vim-wakatime' + + "}}} + diff --git a/config/plugins.vim b/config/plugins.vim new file mode 100644 index 0000000..0b6c747 --- /dev/null +++ b/config/plugins.vim @@ -0,0 +1,7 @@ +" #vimwiki {{{ + " https://github.com/vimwiki/vimwiki + Plug 'vimwiki/vimwiki' + let g:vimwiki_list = [{'path': '~/vimwiki/', 'path_html': '~/vimwiki_html/'}] + + "}}} + diff --git a/config/statusline.vim b/config/statusline.vim new file mode 100644 index 0000000..64f9e47 --- /dev/null +++ b/config/statusline.vim @@ -0,0 +1,241 @@ +set statusline=%!GetStatus(1) + +augroup statusline "{{{ + autocmd! + autocmd WinNew,WinEnter * setlocal statusline=%!GetStatus(1) + autocmd WinLeave * setlocal statusline=%!GetStatus(0) + autocmd Filetype qf setlocal statusline=%!GetStatus(1) + autocmd Filetype help setlocal statusline=%!GetStatus(1) +augroup END +"}}} + +function! GetStatus(isactive) abort "{{{ + " let l:linter = ale#statusline#Count(bufnr('')) + let l:divider = '- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - >' + let l:separator = '%#StatusLineSeparator# ' + let l:normal = '%#StatusLineNormal#' + let l:active = '%#StatusLineActive#' + let l:linterdash = '%#LinterDash#·' + let l:linterdashactive = '%#LinterDashActive#·' + let l:statusline = l:separator + + "buffer number {{{ + if a:isactive + let l:statusline .= '%#StatusLineBufferNrActive#' + else + let l:statusline .= '%#StatusLineBufferNr#' + endif + let l:statusline .= ' %n ' . l:separator +"}}} + + " file percentage {{{ + if a:isactive + let l:statusline .= '%#StatusLinePercentActive#' + let l:statusline .= ' %P %#StatusLineNoiseActive#of %#StatusLineLinecountActive#%L ' + else + let l:statusline .= '%#StatusLinePercent#' + let l:statusline .= ' %P %#StatusLineNoise#of %#StatusLineLinecount#%L ' + endif"}}} + + " non-empty buftype (help, quickfix, etc) {{{ + if a:isactive + let l:statusline .= l:active . "%{&buftype == '' ? '' : ' '}%q%h%w%#StatusLineActiveNoText#" + else + let l:statusline .= l:normal . "%{&buftype == '' ? '' : ' '}%q%h%w%#StatusLineNormalNoText#" + endif + let l:statusline .= "%{&buftype == '' ? '' : ' '}%s" +"}}} + + " right/left divider {{{ + let l:statusline.=l:separator + " modified version + let l:color = 'StatusLineDivMod' . (a:isactive?'Active':'') + let l:statusline .= GetStatusFrag("&modified && mode() != 'i'", l:color, '%<', l:divider) + + " unmodified version + let l:color = 'StatusLineDiv' . (a:isactive?'Active':'') + let l:statusline .= GetStatusFrag("!&modified && mode() != 'i'", l:color, '%<', l:divider) + + " input mode version + if a:isactive + let l:statusline .= GetStatusFrag("mode() == 'i'", 'StatusLineDivInput', '%<', l:divider) + endif + + let l:statusline.= l:separator . '%*%=' +"}}} + + " file info{{{ + if a:isactive == 1 + " let l:statusline.=l:active + let l:statusline.='%#StatusLineFileInfo#' + " let l:statusline.=" %{strlen(&ft)?&ft:'none'} " + " let l:statusline.=l:separator . l:active + let l:statusline.='%{strlen(&fenc)?&fenc:&enc}' + " let l:statusline.=l:separator . l:active + let l:statusline.=' %{&fileformat}' + let l:statusline.="%{strlen(expand('%:e')) > 1?' ' . expand('%:e'):''}" + " let l:statusline.=l:separator . l:active + " let l:statusline.=' %{&spelllang} ' + let l:statusline .= l:separator + endif +"}}} + + " path/filename.extension {{{ + if a:isactive + if &readonly + let l:statusline .= '%#StatusLineWarningActive# %r ' + let l:statusline .= '%#StatusLineFileReadOnlyActive#' + " let l:statusline.='%#StatusLineDirActive# ' + let l:statusline.="%{expand('%:p:h:t')}/" + " let l:statusline.='%#StatusLineFileActive#' + + let l:statusline.="%{expand('%:t:r')}" + + " let l:statusline.='%#StatusLineDotActive#' + let l:statusline.="%{strlen(expand('%:e'))?'.':''}" + " let l:statusline.='%#StatusLineExtActive#' + let l:statusline.="%{expand('%:e')} " + else + let l:statusline.='%#StatusLineDirActive# ' + let l:statusline.="%{expand('%:p:h:t')}/" + let l:statusline.='%#StatusLineFileActive#' + + let l:statusline.="%{expand('%:t:r')}" + + let l:statusline.='%#StatusLineDotActive#' + let l:statusline.="%{strlen(expand('%:e'))?'.':''}" + let l:statusline.='%#StatusLineExtActive#' + let l:statusline.="%{expand('%:e')} " + endif + else + let l:statusline .= ' %#StatusLineWarning#%r' + let l:statusline.='%#StatusLineDir# ' + let l:statusline.="%{fnamemodify(expand('%:p:h'),':~')}/" + let l:statusline.='%#StatusLineFile#' + + let l:statusline.="%{expand('%:t:r')}" + + let l:statusline.='%#StatusLineDot#' + let l:statusline.="%{strlen(expand('%:e'))?'.':''}" + let l:statusline.='%#StatusLineExt#' + let l:statusline.="%{strlen(expand('%:e'))?expand('%:e'):expand('%:e')} " + endif + "}}} + + let l:statusline.='%*' . l:separator + + " linter status {{{ + if a:isactive + " errors + let l:statusline .= "%#LinterDashActive#%{(GetLinterStatus('error') == 0?'-':'')}" + let l:statusline .= "%#LinterErrorActive#%{(GetLinterStatus('error') == 0?'':GetLinterStatus('error'))}" + " style errors + let l:statusline .= l:linterdashactive + let l:statusline .= "%#LinterDashActive#%{(GetLinterStatus('style_error') == 0?'-':'')}" + let l:statusline .= "%#LinterErrorStyleActive#%{(GetLinterStatus('style_error') == 0?'':GetLinterStatus('style_error'))} " + + " warnings + let l:statusline .= "%#LinterDashActive#%{(GetLinterStatus('warning') == 0?'-':'')}" + let l:statusline .= "%#LinterWarningActive#%{(GetLinterStatus('warning') == 0?'':GetLinterStatus('warning'))}" + " style warnings + let l:statusline .= l:linterdashactive + let l:statusline .= "%#LinterDashActive#%{(GetLinterStatus('style_warning') == 0?'-':'')}" + let l:statusline .= "%#LinterWarningStyleActive#%{(GetLinterStatus('style_warning') == 0?'':GetLinterStatus('style_warning'))} " + + " info + let l:statusline .= "%#LinterDashActive#%{(GetLinterStatus('info') == 0?'-':'')}" + let l:statusline .= "%#LinterInfoActive#%{(GetLinterStatus('info') == 0?'':GetLinterStatus('info'))}" + else + " errors + let l:statusline .= "%#LinterDash#%{(GetLinterStatus('error') == 0?'-':'')}" + let l:statusline .= "%#LinterError#%{(GetLinterStatus('error') == 0?'':GetLinterStatus('error'))}" + " style errors + let l:statusline .= l:linterdash + let l:statusline .= "%{(GetLinterStatus('style_error') == 0?'-':'')}" + let l:statusline .= "%#LinterErrorStyle#%{(GetLinterStatus('style_error') == 0?'':GetLinterStatus('style_error'))} " + + " warnings + let l:statusline .= "%#LinterDash#%{(GetLinterStatus('warning') == 0?'-':'')}" + let l:statusline .= "%#LinterWarning#%{(GetLinterStatus('warning') == 0?'':GetLinterStatus('warning'))}" + " style warnings + let l:statusline .= l:linterdash + let l:statusline .= "%{(GetLinterStatus('style_warning') == 0?'-':'')}" + let l:statusline .= "%#LinterWarningStyle#%{(GetLinterStatus('style_warning') == 0?'':GetLinterStatus('style_warning'))} " + + " info + let l:statusline .= "%#LinterInfo#%{GetLinterStatus('info') == 0 ? '-' : GetLinterStatus('info')}" + endif +"}}} + + let l:statusline .= ' ' . l:separator + + if exists('gutentags#statusline') + let l:statusline .= '%#StatusLineWarning#%{gutentags#statusline("", "", "☢")}' + endif + + return l:statusline + +endfunction +"}}} + +" highlight groups {{{ +hi def link StatusLineSeparator Ignore +hi def link StatusLineNormal StatusLineNC +hi def link StatusLineActive StatusLine +hi def link StatusLineNormalNoText TabLineFill +hi def link StatusLineActiveNoText TabLineFill + +hi def link StatusLineNoise StatusLineNormal +hi def link StatusLineNoiseActive StatusLineNormal + +hi def link StatusLineBufferNr StatusLineNormal +hi def link StatusLineBufferNrActive StatusLineActive + +hi def link StatusLinePercent StatusLineNormal +hi def link StatusLinePercentActive StatusLineActive +hi def link StatusLineLinecount StatusLinePercent +hi def link StatusLineLinecountActive StatusLinePercentActive + +hi DivActive ctermbg=darkgray ctermfg=darkgray guibg=#666666 guifg=#666666 +hi DivMod ctermbg=darkred ctermfg=darkred guibg=#660000 guifg=#660000 +hi DivModActive ctermbg=red ctermfg=red guibg=#aa0000 guifg=#aa0000 +hi DivInput ctermbg=darkblue ctermfg=darkblue guibg=#000022 guifg=#000022 +hi def link StatusLineDiv TabLineFill +hi def link StatusLineDivActive DivActive +hi def link StatusLineDivMod DivMod +hi def link StatusLineDivModActive DivModActive +hi def link StatusLineDivInput DivInput + +hi def link StatusLineFileInfo StatusLineActive + +hi def link StatusLineFile StatusLineNormal +hi def link StatusLineFileActive StatusLineActive +hi def link StatusLineDir StatusLineFile +hi def link StatusLineDirActive StatusLineFileActive +hi def link StatusLineDot StatusLineDir +hi def link StatusLineDotActive StatusLineDirActive +hi def link StatusLineExt StatusLineDir +hi def link StatusLineExtActive StatusLineDirActive + +hi def link StatusLineFileReadOnlyActive WarningMsg +hi def link StatusLineWarning StatusLineNormal +hi def link StatusLineWarningActive WarningMsg + +hi def link LinterDash Normal +hi def link LinterDashActive Normal + +hi def link LinterError Normal +hi def link LinterErrorActive ErrorMsg + +hi def link LinterErrorStyle Normal +hi def link LinterErrorStyleActive SpellBad + +hi def link LinterWarning Normal +hi def link LinterWarningActive SpellCap + +hi def link LinterWarningStyle Normal +hi def link LinterWarningStyleActive LinterWarningActive + +hi def link LinterInfo Normal +hi def link LinterInfoActive SpellRare +"}}} diff --git a/config/tabline.vim b/config/tabline.vim new file mode 100644 index 0000000..21b716e --- /dev/null +++ b/config/tabline.vim @@ -0,0 +1,76 @@ +" Rename tabs to show tab number. +" based on: +" http://stackoverflow.com/questions/5927952/whats-implementation-of-vims-default-tabline-function + +function! MyTabLine() "{{{ + let l:customtabline = '' + let l:currenttabnum = tabpagenr() + let l:lasttabnumber = tabpagenr('$') + let l:tabnumber = 1 + while l:tabnumber <= l:lasttabnumber + let l:buflist = tabpagebuflist(l:tabnumber) + let l:winnr = tabpagewinnr(l:tabnumber) + + if l:lasttabnumber > 1 + let l:customtabline .= '%' . l:tabnumber . 'T' + let l:customtabline .= (l:tabnumber == l:currenttabnum ? '%1*' : '%2*') + + let l:customtabline .= (l:tabnumber == l:currenttabnum ? '%#TabLineNumSel#' : '%#TabLineNum#') + let l:customtabline .= ' ' . l:tabnumber . ' ' + let l:customtabline .= (l:tabnumber == l:currenttabnum ? '%#TabLineItemSel#' : '%#TabLineItem#') + endif + + let l:bufnr = l:buflist[l:winnr - 1] + let l:file = bufname(l:bufnr) + let l:buftype = getbufvar(l:bufnr, '&buftype') + + if l:buftype ==# 'help' + let l:file = 'help:' . fnamemodify(l:file, ':t:r') + + elseif l:buftype ==# 'quickfix' + let l:file = 'quickfix' + + elseif l:buftype ==# 'nofile' + if l:file =~# '\/.' + let l:file = substitute(l:file, '.*\/\ze.', '', '') + endif + + else + let l:file = fnamemodify(l:file, ':p:t') + + endif + + if l:file ==# '' + let l:file = "''" + endif + + let l:customtabline .= l:file . ' ' + + let l:tabnumber = l:tabnumber + 1 + + endwhile + + let l:customtabline .= '%T%#TabLineFill#%=' + + if exists('*gutentags#statusline') + let l:customtabline .= '%#TabLineItemSel# %{gutentags#statusline("[ ", " ☢ ] ")}' + endif + let l:customtabline .= '%#TabLineItem# %{getcwd()}% ' + if exists('*fugitive#statusline') + let l:customtabline .= '%#TabLineItem# %{fugitive#statusline()}% ' + endif + if exists('*ObsessionStatus') + let l:customtabline .= "%#TabLineItemSel# %{ObsessionStatus(fnamemodify(v:this_session,':t'),'---')} %*" + endif + + return l:customtabline + +endfunction +"}}} + +set tabline=%!MyTabLine() + +hi def link TabLineItem TabLine +hi def link TabLineItemSel TabLineSel +hi def link TabLineNum TabLine +hi def link TabLineNumSel TabLineSel diff --git a/vimrc b/vimrc index 3298ba3..040fa0e 100644 --- a/vimrc +++ b/vimrc @@ -4,596 +4,31 @@ if &shell =~# 'fish$' set shell=bash endif -runtime vimrc-config - -let g:vimrc_load_dev_plugins = exists('g:vimrc_load_dev_plugins') - \ ? g:vimrc_load_dev_plugins : 0 -let g:vimrc_enable_statusline = exists('g:vimrc_enable_statusline') - \ ? g:vimrc_enable_statusline : 0 -let g:vimrc_enable_tabline = exists('g:vimrc_enable_tabline') - \ ? g:vimrc_enable_tabline : 0 -let g:vimrc_auto_window_settings = exists('g:vimrc_auto_window_settings') - \ ? g:vimrc_auto_window_settings : 0 -"}}} - " #plugins {{{ -if empty(glob('~/.vim/autoload/plug.vim'))"{{{ - silent !curl -fLo ~/.vim/autoload/plug.vim --create-dirs - \ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim - autocmd VimEnter * PlugInstall --sync | source $MYVIMRC -endif -"}}} - - if has('nvim') - call plug#begin('~/.config/nvim/bundle') -else + if empty(glob('~/.config/nvim/autoload/plug.vim'))"{{{ + silent !curl -fLo ~/.config/nvim/autoload/plug.vim --create-dirs + \ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim + autocmd VimEnter * PlugInstall --sync | source $MYVIMRC + endif + "}}} + call plug#begin('~/.vim/bundle') + source ~/.config/vim/config/plugins.nvim.vim +else + if empty(glob('~/.vim/autoload/plug.vim'))"{{{ + silent !curl -fLo ~/.vim/autoload/plug.vim --create-dirs + \ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim + autocmd VimEnter * PlugInstall --sync | source $MYVIMRC + endif + "}}} + + call plug#begin('~/.config/nvim/bundle') + source ~/.config/vim/config/plugins.vim endif - Plug '~/.config/vim/vim/bundle/vim-learnxiny' - -" #Netrw {{{ - - let g:netrw_liststyle=3 - let g:netrw_list_hide='^\..*' - let g:netrw_preview = 0 - - "}}} -" #MatchTagAlways{{{ - " https://github.com/Valloric/MatchTagAlways - Plug 'Valloric/MatchTagAlways' -let g:mta_filetypes = { - \ 'jinja' : 1, - \ 'html' : 1, - \ 'vue' : 1, - \ 'xhtml' : 1, - \ 'xml' : 1, - \} - "}}} -" #Obsession{{{ - " fork of tpope/vim-obsession - Plug 'studio-vx/vim-obsession' - - "}}} -" #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'], - \ ['private', 'public', 'protected'] - \ ] - - "}}} -" #undotree {{{ - Plug 'mbbill/undotree' - nnoremap ut :UndotreeToggle - - "}}} -" #tcomment_vim{{{ - " https://github.com/tomtom/tcomment_vim - Plug 'tomtom/tcomment_vim' - -"}}} -" #vim-easy-align {{{ - " https://github.com/junegunn/vim-easy-align - Plug 'junegunn/vim-easy-align' - - xmap ga (EasyAlign) - nmap ga (EasyAlign) - - "}}} -" #vim-fzf {{{ -" https://github.com/junegunn/fzf.vim -if executable('fzf') && v:version >= 704 - Plug 'junegunn/fzf.vim' - - nnoremap fg :GFiles - nnoremap ff :Files - nnoremap fr :History - nnoremap ft :Tags - nnoremap fb :Buffers - nnoremap fh :Helptags - nnoremap fa :Ag - nnoremap fA :Ag! - - " Ag! gives fullscreen with preview - command! -bang -nargs=* Ag - \ call fzf#vim#ag(, - \ 0 ? fzf#vim#with_preview('up:60%') - \ : fzf#vim#with_preview('right:50%:hidden', '?'), - \ 0) - - let g:fzf_colors = - \ { 'fg': ['fg', 'Normal'], - \ 'bg': ['bg', 'Normal'], - \ 'hl': ['fg', 'Label'], - \ 'fg+': ['fg', 'CursorLine', 'CursorColumn', 'Normal'], - \ 'bg+': ['bg', 'CursorLine', 'CursorColumn'], - \ 'hl+': ['fg', 'WildMenu'], - \ 'info': ['fg', 'Comment'], - \ 'border': ['fg', 'Ignore'], - \ 'prompt': ['fg', 'Constant'], - \ 'pointer': ['fg', 'Special'], - \ 'marker': ['fg', 'Keyword'], - \ 'spinner': ['fg', 'Label'], - \ 'header': ['fg', 'Comment'] } -endif - -"}}} -" #vim-markdown{{{ -" https://github.com/plasticboy/vim-markdown -Plug 'plasticboy/vim-markdown' -let g:vim_markdown_toc_autofit = 1 -let g:vim_markdown_fenced_languages = ['bash=sh'] -"}}} -" #vim-repeat{{{ - " https://github.com/tpope/vim-repeat - Plug 'tpope/vim-repeat' - - "}}} -" #vim-rsi{{{ - "https://github.com/tpope/vim-rsi - Plug 'tpope/vim-rsi' - - "}}} -" #vim-surround{{{ - Plug 'tpope/vim-surround' - - "}}} -" #vim-fugitive{{{ - " https://github.com/tpope/vim-fugitive/blob/master/README.markdown - Plug 'tpope/vim-fugitive' - nnoremap gs :Gstatus - nnoremap gd :tabedit %:Gdiff - nnoremap gc :Gcommit - nnoremap gl :Glog - nnoremap gp :Gpush:copen - nnoremap gp :Gpushjob:copen - - "}}} -" #wakatime{{{ - " https://wakatime.com/vim - Plug 'wakatime/vim-wakatime' - - "}}} -" development plugins -if g:vimrc_load_dev_plugins"{{{ -" #ALE {{{ - " https://github.com/w0rp/ale - Plug 'w0rp/ale' - " let g:ale_completion_enabled = 1 - - let g:ale_sign_column_always = 1 - let g:ale_open_list = 0 - let g:ale_fix_on_save = 1 - - " when coc enabled - " let g:ale_linters = {'scss': ['stylelint'], 'javascript': [], 'php':['php'], 'html':['htmlhint'], 'python': [], 'vue': []} - - " when coc not enabled - let g:ale_linters = {'scss': ['stylelint'], 'javascript': ['tsserver', 'eslint'], 'json': ['jsonlint'], 'php':['php'], 'python': ['pyls'], 'html':['htmlhint'], 'vue': ['vls', 'stylelint', 'eslint']} - let g:ale_linter_aliases = {'vue': ['css', 'javascript', 'typescript']} - let g:ale_fixers = {'scss': ['prettier'], 'javascript': ['eslint'], 'json': ['jq'], 'python': ['black'], 'vue': ['prettier', 'eslint']} - - let g:ale_html_htmlhint_options = '-c ~/.htmlhintrc --format=unix' - - let g:ale_python_pyls_config = { -\ 'pyls': { -\ 'pycodestyle': { 'enabled': v:false }, -\ 'configurationSources': ['flake8'] -\ } -\ } - - let g:ale_sign_error = 'Α' - let g:ale_sign_warning = 'α' - - nmap \\ (ale_detail) - nmap \f (ale_fix) - nmap \r (ale_find_references) - nmap \g (ale_go_to_definition) - nmap \d (ale_documentation) - nmap \h (ale_hover) - nmap \n (ale_next) - nmap \p (ale_previous) - - "}}} -" " #coc.nvim{{{ -" " https://github.com/neoclide/coc.nvim -" Plug 'neoclide/coc.nvim', {'tag': '*', 'do': { -> coc#util#install()}} -" -" let g:coc_snippet_next = '' -" let g:coc_snippet_prev = '' -" -" inoremap coc#refresh() -" nnoremap K :call show_documentation() -" nnoremap \d (coc-definition) -" nnoremap \y (coc-type-definition) -" nnoremap \i (coc-implementation) -" nnoremap \r (coc-references) -" nnoremap \n (coc-rename) -" vnoremap \f (coc-format-selected) -" nnoremap \f (coc-format-selected) -" command! -nargs=0 Format :call CocAction('format') -" command! -nargs=? Fold :call CocAction('fold', ) -" -" function! s:show_documentation() -" if &filetype == 'vim' || &filetype == 'help' -" execute 'h '.expand('') -" else -" call CocAction('doHover') -" endif -" endfunction -" " }}} -" #css3-syntax{{{ - Plug 'hail2u/vim-css3-syntax' - - "}}} -" #delimitMate{{{ -" https://github.com/Raimondi/delimitMate - Plug 'Raimondi/delimitMate' - let delimitMate_expand_cr = 1 - let delimitMate_expand_space = 1 - "}}} -" #emmet-vim {{{ - " https://github.com/mattn/emmet-vim - Plug 'mattn/emmet-vim' - let g:user_emmet_leader_key=',,' - let g:user_emmet_settings = { - \ 'indentation': ' ', - \} - - "}}} -" #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 - - "}}} -" #html5{{{ - " https://github.com/othree/html5.vim - Plug 'othree/html5.vim' - - "}}} -" #i3config.vim{{{ - " https://github.com/mboughaba/i3config.vim - Plug 'mboughaba/i3config.vim' - - "}}} -" #php.vim{{{ - " https://github.com/StanAngeloff/php.vim - Plug 'StanAngeloff/php.vim' - - "}}} -" #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 - - "}}} -" #quickscope{{{ - " https://github.com/unblevable/quick-scope - Plug 'unblevable/quick-scope' - let g:qs_highlight_on_keys = ['f', 'F', 't', 'T'] - "}}} -" #rainbow{{{ - " https://github.com/luochen1990/rainbow/blob/master/README.md - Plug 'luochen1990/rainbow' - let g:rainbow_active = 0 - nnoremap rt :RainbowToggle - "}}} -" #scss-syntax{{{ - Plug 'cakebaker/scss-syntax.vim' - - "}}} -" #tagbar {{{ - " Plug 'majutsushi/tagbar' - " - " nnoremap tb :TagbarOpen fj - " nnoremap ] :tag /[.#@]=expand('') - " let g:tagbar_autoclose = 1 - " " let g:tagbar_autopreview = 1 - " " let g:tagbar_previewwin_pos = '' - " - " let g:tagbar_type_css = { - " \ 'ctagstype' : 'css', - " \ 'kinds' : [ - " \ 'c:classes', - " \ 'i:ids', - " \ 't:tags', - " \ 'm:medias' - " \ ] - " \} - " - " let g:tagbar_type_scss = { - " \ 'ctagstype' : 'scss', - " \ 'kinds' : [ - " \ 'v:variables', - " \ 'c:classes', - " \ 'i:ids', - " \ 't:tags', - " \ 'd:medias', - " \ 'm:mixins', - " \ 'f:functions' - " \ ] - " \} - " - " let g:tagbar_type_vue = { - " \ 'ctagstype' : 'vue', - " \ 'kinds' : [ - " \ 'o:objects', - " \ 'f:functions', - " \ 'a:array', - " \ 's:string', - " \ 'b:boolean', - " \ 'n:number', - " \ 'v:variable' - " \ ] - " \ } - - "}}} -" #ultisnips {{{ - " https://github.com/sirver/UltiSnips - Plug 'SirVer/ultisnips' - " and some snippets - " https://github.com/honza/vim-snippets - " Plug 'honza/vim-snippets' - - nnoremap ul :call ListUltisnips() - inoremap jkul :call ListUltisnips() - - let g:UltiSnipsSnippetsDir='~/.vim/UltiSnips' - " Trigger configuration. Do not use if you use https://github.com/Valloric/YouCompleteMe. - let g:UltiSnipsExpandTrigger='' - let g:UltiSnipsJumpForwardTrigger='' - let g:UltiSnipsJumpBackwardTrigger='' - let g:UltiSnipsEditSplit='horizontal' - - function! ListUltisnips() abort"{{{ - let l:snips = UltiSnips#SnippetsInCurrentScope(1) - let l:keylist = sort(keys(l:snips)) - echo ' --------------------------------------------------' - for l:key in l:keylist - echo printf(" %-10s\t%s", l:key, l:snips[l:key]) - endfor - echo '---------------------------------------------------' - endfunction - - "}}} - function! CompleteSnippets(findstart, base)"{{{ - if a:findstart - let l:line = getline('.') - let l:start = col('.') - 1 - while l:start > 0 && l:line[l:start - 1] =~ '\a' - let l:start -= 1 - endwhile - return l:start - else - let l:res = [] - let l:snips = UltiSnips#SnippetsInCurrentScope(1) - let l:keylist = sort(keys(l:snips)) - for l:key in l:keylist - if l:key =~ '^' . a:base - let l:item = {'word': l:key, 'menu': l:snips[l:key]} - call add(l:res, l:item) - endif - endfor - return l:res - endif - endfunction - - "}}} - - set completefunc=CompleteSnippets - - "}}} -" #vim-dispatch{{{ - " https://github.com/tpope/vim-dispatch - Plug 'tpope/vim-dispatch' - - "}}} -" #vim-gutentags {{{ - " https://github.com/ludovicchabant/vim-gutentags - Plug 'ludovicchabant/vim-gutentags' - - let g:gutentags_ctags_tagfile = '.tags' - let g:gutentags_ctags_exclude = ['package.json', 'Session.vim', 'package-lock.json', 'TODO.txt'] - - "}}} -" #vim-javascript{{{ - Plug 'pangloss/vim-javascript' - - "}}} -" #vim-Jinja2-Syntax{{{ -" https://github.com/studio-vx/Vim-Jinja2-Syntax -" original: https://github.com/Glench/Vim-Jinja2-Syntax - Plug 'studio-vx/Vim-Jinja2-Syntax' - - "}}} -" #vim-json{{{ - " https://github.com/elzr/vim-json - Plug 'elzr/vim-json' - - "}}} -" #vim-lsp {{{ - " https://github.com/prabirshrestha/vim-lsp - " Plug 'prabirshrestha/async.vim' - " Plug 'prabirshrestha/vim-lsp' - " - " let g:lsp_signs_enabled = 1 - " let g:lsp_signs_error = {'text': '▶'} - " let g:lsp_signs_warning = {'text': '▶'} - " let g:lsp_signs_information = {'text': '◆'} - " let g:lsp_signs_hint = {'text': '◆'} - " let g:lsp_diagnostics_echo_cursor = 1 - " let g:lsp_diagnostics_echo_delay = 0 - " nnoremap \l :cclose:LspDocumentDiagnostics - " nnoremap \h :LspHover - " nnoremap \d :LspDefinition - " nnoremap \r :LspReferences - " nnoremap \n :LspRename - " nnoremap \s :LspDocumentSymbol - " nnoremap \w :LspWorkspaceSymbol - " nnoremap \ff :LspDocumentFormat - " nnoremap \fr :LspDocumentRangeFormat - " augroup User lsp_setup - " autocmd! - " if executable('vls') "{{{ - " autocmd User lsp_setup call lsp#register_server({ - " \ 'name': 'vue', - " \ 'cmd': {server_info->['vls']}, - " \ 'whitelist': ['vue'], - " \ }) - " endif - " "}}} - " if executable('pyls') "{{{ - " autocmd User lsp_setup call lsp#register_server({ - " \ 'name': 'pyls', - " \ 'cmd': {server_info->['pyls']}, - " \ 'whitelist': ['python'], - " \ }) - " endif - " "}}} - " if executable('typescript-language-server') "{{{ - " au User lsp_setup call lsp#register_server({ - " \ 'name': 'typescript-language-server', - " \ 'cmd': { server_info->[&shell, &shellcmdflag, 'typescript-language-server --stdio']}, - " \ 'root_uri': { server_info->lsp#utils#path_to_uri(lsp#utils#find_nearest_parent_directory(lsp#utils#get_buffer_path(), '.git/..'))}, - " \ 'whitelist': ['typescript', 'javascript', 'javascript.jsx'] - " \ }) - " endif - " "}}} - " augroup END - - ""}}} -" #vim-SyntaxRange{{{ -" https://github.com/inkarkat/vim-SyntaxRange - " Plug 'inkarkat/vim-SyntaxRange' - " command! HiJinja call SyntaxRange#Include('{{', '}}', 'jinja', 'jinjaBraces', 'jinjaVariable') - " command! HiJinja call SyntaxRange#IncludeEx('start=/{{-\?/hs=s+2 end=/-\?}}/he=s-1', 'jinja') -"}}} -" #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 - - - "}}} -" #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' } - - "}}} -" #vim-git{{{ - " https://github.com/tpope/vim-git - Plug 'tpope/vim-git' - - "}}} -endif"}}} #dev plugins end - - -if has('nvim') " nvim only plugins -" #colorV {{{ - " https://github.com/gu-fan/colorv.vim - Plug 'gu-fan/colorv.vim' - "}}} -" #vim-hexokinase {{{ - " https://github.com/RRethy/vim-hexokinase - Plug 'RRethy/vim-hexokinase' - let g:Hexokinase_virtualText = '██████' - nnoremap cc :HexokinaseToggle - nnoremap cr :HexokinaseRefresh - "}}} -" #ranger.vim {{{ - " https://github.com/francoiscabrol/ranger.vim - Plug 'francoiscabrol/ranger.vim' - let g:ranger_map_keys = 0 - "}}} - -else " vim only plugins -" #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' - nnoremap cc :call ToggleColorPreview() - "}}} - -end - -" #colorV settings {{{ - 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 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 "}}} -" }}} - - +source ~/.config/vim/config/plugins.shared.vim call plug#end() runtime macros/matchit.vim @@ -1310,17 +745,15 @@ iabbrev ct'' content-type: ''; " }}} " auto_window_settings {{{ -if g:vimrc_auto_window_settings - augroup auto_window_settings - autocmd! - autocmd WinEnter * call WinEnterColorColumn() - autocmd WinEnter * set cursorline | set cursorcolumn - " autocmd WinLeave * setlocal colorcolumn=0 - autocmd WinLeave * call WinLeaveColorColumn() - autocmd WinLeave * set nocursorline | set nocursorcolumn - augroup END + augroup auto_window_settings + autocmd! + autocmd WinEnter * call WinEnterColorColumn() + autocmd WinEnter * set cursorline | set cursorcolumn + " autocmd WinLeave * setlocal colorcolumn=0 + autocmd WinLeave * call WinLeaveColorColumn() + autocmd WinLeave * set nocursorline | set nocursorcolumn + augroup END -endif " }}} " Automatically reload .vimrc if changed {{{ augroup myvimrc @@ -1347,250 +780,6 @@ endif "----------------------------------------------------------------------------}}} " #statusline {{{ -if g:vimrc_enable_statusline - set statusline=%!GetStatus(1) - - augroup statusline "{{{ - autocmd! - autocmd WinNew,WinEnter * setlocal statusline=%!GetStatus(1) - autocmd WinLeave * setlocal statusline=%!GetStatus(0) - autocmd Filetype qf setlocal statusline=%!GetStatus(1) - autocmd Filetype help setlocal statusline=%!GetStatus(1) - augroup END -"}}} - - function! GetStatus(isactive) abort "{{{ - " let l:linter = ale#statusline#Count(bufnr('')) - let l:divider = '- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - >' - let l:separator = '%#StatusLineSeparator# ' - let l:normal = '%#StatusLineNormal#' - let l:active = '%#StatusLineActive#' - let l:linterdash = '%#LinterDash#·' - let l:linterdashactive = '%#LinterDashActive#·' - let l:statusline = l:separator - - "buffer number {{{ - if a:isactive - let l:statusline .= '%#StatusLineBufferNrActive#' - else - let l:statusline .= '%#StatusLineBufferNr#' - endif - let l:statusline .= ' %n ' . l:separator - "}}} - - " file percentage {{{ - if a:isactive - let l:statusline .= '%#StatusLinePercentActive#' - let l:statusline .= ' %P %#StatusLineNoiseActive#of %#StatusLineLinecountActive#%L ' - else - let l:statusline .= '%#StatusLinePercent#' - let l:statusline .= ' %P %#StatusLineNoise#of %#StatusLineLinecount#%L ' - endif"}}} - - " non-empty buftype (help, quickfix, etc) {{{ - if a:isactive - let l:statusline .= l:active . "%{&buftype == '' ? '' : ' '}%q%h%w%#StatusLineActiveNoText#" - else - let l:statusline .= l:normal . "%{&buftype == '' ? '' : ' '}%q%h%w%#StatusLineNormalNoText#" - endif - let l:statusline .= "%{&buftype == '' ? '' : ' '}%s" - "}}} - - " right/left divider {{{ - let l:statusline.=l:separator - " modified version - let l:color = 'StatusLineDivMod' . (a:isactive?'Active':'') - let l:statusline .= GetStatusFrag("&modified && mode() != 'i'", l:color, '%<', l:divider) - - " unmodified version - let l:color = 'StatusLineDiv' . (a:isactive?'Active':'') - let l:statusline .= GetStatusFrag("!&modified && mode() != 'i'", l:color, '%<', l:divider) - - " input mode version - if a:isactive - let l:statusline .= GetStatusFrag("mode() == 'i'", 'StatusLineDivInput', '%<', l:divider) - endif - - let l:statusline.= l:separator . '%*%=' - "}}} - - " file info{{{ - if a:isactive == 1 - " let l:statusline.=l:active - let l:statusline.='%#StatusLineFileInfo#' - " let l:statusline.=" %{strlen(&ft)?&ft:'none'} " - " let l:statusline.=l:separator . l:active - let l:statusline.='%{strlen(&fenc)?&fenc:&enc}' - " let l:statusline.=l:separator . l:active - let l:statusline.=' %{&fileformat}' - let l:statusline.="%{strlen(expand('%:e')) > 1?' ' . expand('%:e'):''}" - " let l:statusline.=l:separator . l:active - " let l:statusline.=' %{&spelllang} ' - let l:statusline .= l:separator - endif - "}}} - - " path/filename.extension {{{ - if a:isactive - if &readonly - let l:statusline .= '%#StatusLineWarningActive# %r ' - let l:statusline .= '%#StatusLineFileReadOnlyActive#' - " let l:statusline.='%#StatusLineDirActive# ' - let l:statusline.="%{expand('%:p:h:t')}/" - " let l:statusline.='%#StatusLineFileActive#' - - let l:statusline.="%{expand('%:t:r')}" - - " let l:statusline.='%#StatusLineDotActive#' - let l:statusline.="%{strlen(expand('%:e'))?'.':''}" - " let l:statusline.='%#StatusLineExtActive#' - let l:statusline.="%{expand('%:e')} " - else - let l:statusline.='%#StatusLineDirActive# ' - let l:statusline.="%{expand('%:p:h:t')}/" - let l:statusline.='%#StatusLineFileActive#' - - let l:statusline.="%{expand('%:t:r')}" - - let l:statusline.='%#StatusLineDotActive#' - let l:statusline.="%{strlen(expand('%:e'))?'.':''}" - let l:statusline.='%#StatusLineExtActive#' - let l:statusline.="%{expand('%:e')} " - endif - else - let l:statusline .= ' %#StatusLineWarning#%r' - let l:statusline.='%#StatusLineDir# ' - let l:statusline.="%{fnamemodify(expand('%:p:h'),':~')}/" - let l:statusline.='%#StatusLineFile#' - - let l:statusline.="%{expand('%:t:r')}" - - let l:statusline.='%#StatusLineDot#' - let l:statusline.="%{strlen(expand('%:e'))?'.':''}" - let l:statusline.='%#StatusLineExt#' - let l:statusline.="%{strlen(expand('%:e'))?expand('%:e'):expand('%:e')} " - endif - "}}} - - let l:statusline.='%*' . l:separator - - " linter status {{{ - if a:isactive - " errors - let l:statusline .= "%#LinterDashActive#%{(GetLinterStatus('error') == 0?'-':'')}" - let l:statusline .= "%#LinterErrorActive#%{(GetLinterStatus('error') == 0?'':GetLinterStatus('error'))}" - " style errors - let l:statusline .= l:linterdashactive - let l:statusline .= "%#LinterDashActive#%{(GetLinterStatus('style_error') == 0?'-':'')}" - let l:statusline .= "%#LinterErrorStyleActive#%{(GetLinterStatus('style_error') == 0?'':GetLinterStatus('style_error'))} " - - " warnings - let l:statusline .= "%#LinterDashActive#%{(GetLinterStatus('warning') == 0?'-':'')}" - let l:statusline .= "%#LinterWarningActive#%{(GetLinterStatus('warning') == 0?'':GetLinterStatus('warning'))}" - " style warnings - let l:statusline .= l:linterdashactive - let l:statusline .= "%#LinterDashActive#%{(GetLinterStatus('style_warning') == 0?'-':'')}" - let l:statusline .= "%#LinterWarningStyleActive#%{(GetLinterStatus('style_warning') == 0?'':GetLinterStatus('style_warning'))} " - - " info - let l:statusline .= "%#LinterDashActive#%{(GetLinterStatus('info') == 0?'-':'')}" - let l:statusline .= "%#LinterInfoActive#%{(GetLinterStatus('info') == 0?'':GetLinterStatus('info'))}" - else - " errors - let l:statusline .= "%#LinterDash#%{(GetLinterStatus('error') == 0?'-':'')}" - let l:statusline .= "%#LinterError#%{(GetLinterStatus('error') == 0?'':GetLinterStatus('error'))}" - " style errors - let l:statusline .= l:linterdash - let l:statusline .= "%{(GetLinterStatus('style_error') == 0?'-':'')}" - let l:statusline .= "%#LinterErrorStyle#%{(GetLinterStatus('style_error') == 0?'':GetLinterStatus('style_error'))} " - - " warnings - let l:statusline .= "%#LinterDash#%{(GetLinterStatus('warning') == 0?'-':'')}" - let l:statusline .= "%#LinterWarning#%{(GetLinterStatus('warning') == 0?'':GetLinterStatus('warning'))}" - " style warnings - let l:statusline .= l:linterdash - let l:statusline .= "%{(GetLinterStatus('style_warning') == 0?'-':'')}" - let l:statusline .= "%#LinterWarningStyle#%{(GetLinterStatus('style_warning') == 0?'':GetLinterStatus('style_warning'))} " - - " info - let l:statusline .= "%#LinterInfo#%{GetLinterStatus('info') == 0 ? '-' : GetLinterStatus('info')}" - endif - "}}} - - let l:statusline .= ' ' . l:separator - - if exists('gutentags#statusline') - let l:statusline .= '%#StatusLineWarning#%{gutentags#statusline("", "", "☢")}' - endif - - return l:statusline - - endfunction - "}}} - -" highlight groups {{{ - hi def link StatusLineSeparator Ignore - hi def link StatusLineNormal StatusLineNC - hi def link StatusLineActive StatusLine - hi def link StatusLineNormalNoText TabLineFill - hi def link StatusLineActiveNoText TabLineFill - - hi def link StatusLineNoise StatusLineNormal - hi def link StatusLineNoiseActive StatusLineNormal - - hi def link StatusLineBufferNr StatusLineNormal - hi def link StatusLineBufferNrActive StatusLineActive - - hi def link StatusLinePercent StatusLineNormal - hi def link StatusLinePercentActive StatusLineActive - hi def link StatusLineLinecount StatusLinePercent - hi def link StatusLineLinecountActive StatusLinePercentActive - - hi DivActive ctermbg=darkgray ctermfg=darkgray guibg=#666666 guifg=#666666 - hi DivMod ctermbg=darkred ctermfg=darkred guibg=#660000 guifg=#660000 - hi DivModActive ctermbg=red ctermfg=red guibg=#aa0000 guifg=#aa0000 - hi DivInput ctermbg=darkblue ctermfg=darkblue guibg=#000022 guifg=#000022 - hi def link StatusLineDiv TabLineFill - hi def link StatusLineDivActive DivActive - hi def link StatusLineDivMod DivMod - hi def link StatusLineDivModActive DivModActive - hi def link StatusLineDivInput DivInput - - hi def link StatusLineFileInfo StatusLineActive - - hi def link StatusLineFile StatusLineNormal - hi def link StatusLineFileActive StatusLineActive - hi def link StatusLineDir StatusLineFile - hi def link StatusLineDirActive StatusLineFileActive - hi def link StatusLineDot StatusLineDir - hi def link StatusLineDotActive StatusLineDirActive - hi def link StatusLineExt StatusLineDir - hi def link StatusLineExtActive StatusLineDirActive - - hi def link StatusLineFileReadOnlyActive WarningMsg - hi def link StatusLineWarning StatusLineNormal - hi def link StatusLineWarningActive WarningMsg - - hi def link LinterDash Normal - hi def link LinterDashActive Normal - - hi def link LinterError Normal - hi def link LinterErrorActive ErrorMsg - - hi def link LinterErrorStyle Normal - hi def link LinterErrorStyleActive SpellBad - - hi def link LinterWarning Normal - hi def link LinterWarningActive SpellCap - - hi def link LinterWarningStyle Normal - hi def link LinterWarningStyleActive LinterWarningActive - - hi def link LinterInfo Normal - hi def link LinterInfoActive SpellRare - "}}} - -else set statusline=\ set statusline+=[%n]\ \ set statusline+=%p\ of\ %L @@ -1598,93 +787,8 @@ else set statusline+=%y\ set statusline+=%r\ %m\ %F set statusline+=\ -endif "----------------------------------------------------------------------------}}} -" #tabline {{{ -if exists('+showtabline') && g:vimrc_enable_tabline - - " Rename tabs to show tab number. - " based on: - " http://stackoverflow.com/questions/5927952/whats-implementation-of-vims-default-tabline-function - - function! MyTabLine() "{{{ - let l:customtabline = '' - let l:currenttabnum = tabpagenr() - let l:lasttabnumber = tabpagenr('$') - let l:tabnumber = 1 - while l:tabnumber <= l:lasttabnumber - let l:buflist = tabpagebuflist(l:tabnumber) - let l:winnr = tabpagewinnr(l:tabnumber) - - if l:lasttabnumber > 1 - let l:customtabline .= '%' . l:tabnumber . 'T' - let l:customtabline .= (l:tabnumber == l:currenttabnum ? '%1*' : '%2*') - - let l:customtabline .= (l:tabnumber == l:currenttabnum ? '%#TabLineNumSel#' : '%#TabLineNum#') - let l:customtabline .= ' ' . l:tabnumber . ' ' - let l:customtabline .= (l:tabnumber == l:currenttabnum ? '%#TabLineItemSel#' : '%#TabLineItem#') - endif - - let l:bufnr = l:buflist[l:winnr - 1] - let l:file = bufname(l:bufnr) - let l:buftype = getbufvar(l:bufnr, '&buftype') - - if l:buftype ==# 'help' - let l:file = 'help:' . fnamemodify(l:file, ':t:r') - - elseif l:buftype ==# 'quickfix' - let l:file = 'quickfix' - - elseif l:buftype ==# 'nofile' - if l:file =~# '\/.' - let l:file = substitute(l:file, '.*\/\ze.', '', '') - endif - - else - let l:file = fnamemodify(l:file, ':p:t') - - endif - - if l:file ==# '' - let l:file = "''" - endif - - let l:customtabline .= l:file . ' ' - - let l:tabnumber = l:tabnumber + 1 - - endwhile - - let l:customtabline .= '%T%#TabLineFill#%=' - - if exists('*gutentags#statusline') - let l:customtabline .= '%#TabLineItemSel# %{gutentags#statusline("[ ", " ☢ ] ")}' - endif - let l:customtabline .= '%#TabLineItem# %{getcwd()}% ' - if exists('*fugitive#statusline') - let l:customtabline .= '%#TabLineItem# %{fugitive#statusline()}% ' - endif - if exists('*ObsessionStatus') - let l:customtabline .= "%#TabLineItemSel# %{ObsessionStatus(fnamemodify(v:this_session,':t'),'---')} %*" - endif - - return l:customtabline - - endfunction -"}}} - - set showtabline=2 - set tabline=%!MyTabLine() - - hi def link TabLineItem TabLine - hi def link TabLineItemSel TabLineSel - hi def link TabLineNum TabLine - hi def link TabLineNumSel TabLineSel - -endif -"----------------------------------------------------------------------------}}} - runtime vimrc-overrides "}}}