This commit is contained in:
ManjaroOne666 2019-09-12 18:35:01 +01:00
parent 66b05e29fe
commit e984e9308d
7 changed files with 29 additions and 935 deletions

View File

@ -1,325 +0,0 @@
" #vim-hexokinase {{{
" https://github.com/RRethy/vim-hexokinase
Plug 'RRethy/vim-hexokinase'
let g:Hexokinase_highlighters = ['virtual']
let g:Hexokinase_virtualText = '██████'
nnoremap <silent> <cr>cc :HexokinaseToggle<CR>
nnoremap <silent> <cr>cr :HexokinaseRefresh<CR>
"}}}
" #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': [], 'javascript': [], 'json': [], 'php':['php'], 'python': [], 'html':['htmlhint'], 'vue': []}
let g:ale_fixers = {'scss': ['prettier'], 'javascript': [], 'json': ['jq'], 'python': [], 'vue': []}
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 gh <Plug>(ale_hover)
nmap <space>aa <Plug>(ale_detail)
nmap <space>af <Plug>(ale_fix)
nmap <space>ar <Plug>(ale_find_references)
nmap <space>ad <Plug>(ale_go_to_definition)
nmap <space>aD <Plug>(ale_documentation)
nmap <space>an <Plug>(ale_next)
nmap <space>ap <Plug>(ale_previous)
"}}}
" #coc.nvim{{{
" https://github.com/neoclide/coc.nvim
" SEE BOTTOM OF VIMRC FOR coc#add_extension statement
" for some reason fails when added some other places
Plug 'neoclide/coc.nvim', {'tag': '*', 'do': { -> coc#util#install()}}
let g:coc_snippet_next = '<tab>'
let g:coc_snippet_prev = '<s-tab>'
inoremap <silent><expr> <c-n> coc#refresh()
nnoremap <silent> <silent> gH :call CocAction('doHover')<CR>
nnoremap <silent> <space>cf :call CocAction('doQuickfix')<CR>
nnoremap <silent> <space>cd :call CocAction('jumpDefinition')<CR>
nnoremap <silent> <space>ci :call CocAction('jumpImplementation')<CR>
nnoremap <silent> <space>cr :call CocAction('jumpReferences')<CR>
nnoremap <silent> <space>cm :call CocAction('rename')<CR>
nnoremap <silent> <space>ca :call CocAction('codeAction')<CR>
nnoremap <silent> <space>cs :call CocAction('documentSymbols')<CR>
nnoremap <silent> <space>cS :call CocAction('workspaceSymbols')<CR>
nnoremap <silent> <space>cn :call CocAction('diagnosticNext')<CR>
nnoremap <silent> <space>cp :call CocAction('diagnosticPrevious')<CR>
" vnoremap \f <Plug>(coc-format-selected)
" nnoremap \f <Plug>(coc-format-selected)
command! -nargs=0 Format :call CocAction('format')
command! -nargs=? Fold :call CocAction('fold', <f-args>)
" }}}
" #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 <silent> <space>gs :Gstatus<CR>
nnoremap <silent> <space>gd :tabedit %<CR>:Gdiff<CR>
nnoremap <silent> <space>gc :Gcommit<CR>
nnoremap <silent> <space>gl :Glog<CR>
nnoremap <silent> <space>gp :Gpush<CR>:copen<CR>
nnoremap <silent> <space>gp :Gpushjob<CR>:copen<CR>
"}}}
" #gitgutter {{{
" https://github.com/airblade/vim-gitgutter/blob/master/README.mkd
Plug 'airblade/vim-gitgutter'
nmap ]h <Plug>GitGutterNextHunk
nmap [h <Plug>GitGutterPrevHunk
omap ih <Plug>GitGutterTextObjectInnerPending
omap ah <Plug>GitGutterTextObjectOuterPending
xmap ih <Plug>GitGutterTextObjectInnerVisual
xmap ah <Plug>GitGutterTextObjectOuterVisual
"}}}
" #MatchTagAlways{{{
" https://github.com/Valloric/MatchTagAlways
Plug 'Valloric/MatchTagAlways'
let g:mta_filetypes = {
\ 'jinja' : 1,
\ 'html' : 1,
\ 'vue' : 1,
\ 'xhtml' : 1,
\ 'xml' : 1,
\}
"}}}
" #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
"}}}
" #polyglot{{{
" https://github.com/sheerun/vim-polyglot
Plug 'sheerun/vim-polyglot'
" vue options
let g:vue_disable_pre_processors=0
" set custom syntax highlighting
augroup fixhighlighting
autocmd!
autocmd BufNewFile,BufRead *.vue syntax sync fromstart
augroup END
"}}}
" #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 <cr>9 :RainbowToggle<cr>
nnoremap <cr>( :RainbowToggle<cr>
"}}}
" #switch {{{
"https://github.com/AndrewRadev/switch.vim
Plug 'AndrewRadev/switch.vim'
let g:switch_mapping = '<space>-'
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 <space>tb :TagbarOpen fj<CR>
" nnoremap <space>] :tag /[.#@]<c-r>=expand('<cword>')<cr><cr>
" 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 <space>ul :call ListUltisnips()<cr>
inoremap jkul <c-o>:call ListUltisnips()<cr>
let g:UltiSnipsSnippetsDir='~/.vim/UltiSnips'
" Trigger configuration. Do not use <tab> if you use https://github.com/Valloric/YouCompleteMe.
let g:UltiSnipsExpandTrigger='<tab>'
let g:UltiSnipsJumpForwardTrigger='<tab>'
let g:UltiSnipsJumpBackwardTrigger='<s-tab>'
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']
let g:gutentags_resolve_symlinks = 1
"}}}
" #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-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')
"}}}
" #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:

View File

@ -1,7 +0,0 @@
" #vimwiki {{{
" https://github.com/vimwiki/vimwiki
Plug 'vimwiki/vimwiki'
let g:vimwiki_list = [{'path': '~/vimwiki/', 'path_html': '~/vimwiki_html/'}]
"}}}

View File

@ -1,241 +0,0 @@
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
"}}}

View File

@ -1,76 +0,0 @@
" 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

295
vimrc
View File

@ -15,7 +15,7 @@ if has('nvim')
"}}}
call plug#begin('~/.vim/bundle')
source ~/.config/vim/config/plugins.nvim.vim
source ~/.config/nvim/init.plugins.vim
"
else
if empty(glob('~/.vim/autoload/plug.vim'))"{{{
@ -26,10 +26,10 @@ else
"}}}
call plug#begin('~/.config/nvim/bundle')
source ~/.config/vim/config/plugins.vim
source ~/.config/vim/vimrc.plugins.vim
endif
source ~/.config/vim/config/plugins.shared.vim
source ~/.config/vim/vimrc.plugins.shared
call plug#end()
runtime macros/matchit.vim
@ -38,98 +38,6 @@ runtime macros/matchit.vim
"----------------------------------------------------------------------------}}}
" #functions {{{
function! SetColor(name, fg, bg, fg_l, bg_l, style) abort"{{{
if &background ==? 'dark'
if a:fg ==? 'normal'
let l:guifg = ' guifg=' . g:d_normal_fg
let l:ctermfg = 'ctermfg=black'
" let l:termfg = 'termfg=black'
elseif a:fg ==? 'none'
let l:guifg = ' guifg=' . g:d_normal_bg
let l:ctermfg = ' ctermfg=white'
" let l:termfg = ' termfg=white'
elseif a:fg ==? ''
let l:guifg = ''
let l:ctermfg = ''
" let l:termfg = ''
else
let l:guifg = ' guifg=' . a:fg
let l:ctermfg = ' ctermfg=black'
" let l:termfg = ' termfg=black'
endif
if a:bg ==? 'none'
let l:guibg = ' guibg=NONE'
let l:ctermbg = ' ctermbg=none'
" let l:termbg = ' termbg=none'
elseif a:bg ==? ''
let l:guibg = ''
let l:ctermbg = ''
" let l:termbg = ''
else
let l:guibg = ' guibg=' . a:bg
let l:ctermbg = ' ctermbg=black'
endif
else " light background
if a:fg_l ==? 'normal'
let l:guifg = ' guifg=' . g:l_normal_fg
let l:ctermfg = ' ctermfg=black'
" let l:termfg = ' termfg=black'
elseif a:fg_l ==? 'none'
let l:guifg = ' guifg=' . g:l_normal_bg
let l:ctermfg = ' ctermfg=white'
" let l:termfg = ' termfg=white'
elseif a:fg_l ==? ''
let l:guifg = ''
let l:ctermfg = ''
let l:termfg = ''
else
let l:guifg = ' guifg=' . a:fg_l
let l:ctermfg = ' ctermfg=black'
" let l:termfg = ' termfg=black'
endif
if a:bg_l ==? 'none'
let l:guibg = ' guibg=NONE'
let l:ctermbg = ' ctermbg=none'
" let l:termbg = ' termbg=none'
elseif a:bg_l ==? ''
let l:guibg = ''
let l:ctermbg = ''
" let l:termbg = ''
else
let l:guibg = ' guibg=' . a:bg_l
let l:ctermbg = ' ctermbg=white'
" let l:termbg = ' termbg=white'
endif
endif
if a:style ==? ''
let l:style = ' term=none cterm=none gui=NONE'
else
let l:style = ' term=' . a:style . ' cterm=' . a:style . ' gui=' . a:style
endif
let l:histring = 'hi! ' . a:name . l:guifg . l:guibg . l:style
let l:histring .= l:ctermfg . l:ctermbg
" let l:histring .= l:termfg . l:termbg
execute 'hi clear ' . a:name
execute l:histring
endfunction
"}}}
function! GetStatusFrag(condition, colorname, conditionprefix, text) abort "{{{
" TODO better name
let l:frag='%#' . a:colorname . '#'
let l:frag.=a:conditionprefix
let l:frag.='%{(' . a:condition . ")?'" . a:text . "':''}"
return l:frag
endfunction
"}}}
function! MyFoldText() "{{{
if !exists('g:foldtext_column')
let g:foldtext_column = 80 " column to right align foldtext with
@ -173,38 +81,6 @@ function! MyFoldText() "{{{
return l:foldtext
endfunction
"}}}
function! IndentFoldTextColumn(amount) abort "{{{
if !exists('g:foldtext_column')
" column to right align foldtext with
let g:foldtext_column = 80
endif
if !exists('b:foldtext_column')
" column to right align foldtext with
let b:foldtext_column = g:foldtext_column
endif
if a:amount == 0
let b:foldtext_column = g:foldtext_column
return
endif
let l:newcolumn = b:foldtext_column + a:amount
if l:newcolumn < 20
let l:newcolumn = 20
elseif l:newcolumn > g:foldtext_maxcolumn
let l:newcolumn = g:foldtext_maxcolumn
endif
let b:foldtext_column = l:newcolumn
endfunction
nnoremap <space>z, :<C-U>call IndentFoldTextColumn(-5 * (v:count == 0 ? 1 : v:count))<CR>
nnoremap <space>z. :<C-U>call IndentFoldTextColumn(5 * (v:count == 0 ? 1 : v:count))<CR>
nnoremap <space>z= :call IndentFoldTextColumn(0)<CR>
"}}}
function! <SID>SynStack()"{{{
if !exists('*synstack')
@ -214,82 +90,7 @@ function! <SID>SynStack()"{{{
endfunc
nmap <space>pp :call <SID>SynStack()<CR>
"}}}
function! s:Get_env() abort "{{{
" devdocs DD
" https://gist.github.com/romainl/8d3b73428b4366f75a19be2dad2f0987#file-devdocs-vim
if has('win64') || has('win32') || has('win16')
return 'WINDOWS'
else
return toupper(substitute(system('uname'), '\n', '', ''))
endif
endfunction
" What command to use on what system
let s:cmds = {'DARWIN': 'open', 'LINUX': 'qutebrowser', 'WINDOWS': 'start'}
" Build the URL stub
let s:stub = s:cmds[<SID>Get_env()] . " 'http://devdocs.io/?q="
command! -nargs=* DD silent! call system(len(split(<q-args>, ' ')) == 0 ?
\ s:stub . &ft . ' ' . expand('<cword>') . "'" : len(split(<q-args>, ' ')) == 1 ?
\ s:stub . &ft . ' ' . <q-args> . "'" : s:stub . <q-args> . "'")
"}}}
if has('nvim')
if !exists('*RangerExplorer') "{{{
function RangerExplorer() abort
exec 'silent Ranger'
endfun
nnoremap <space>ra :call RangerExplorer()<CR>
endif
else
if !exists('*RangerExplorer')
function RangerExplorer() abort
exec 'silent !ranger --choosefile=/tmp/vim_ranger_current_file ' . expand('%:p:h')
if filereadable('/tmp/vim_ranger_current_file')
exec 'edit ' . system('cat /tmp/vim_ranger_current_file')
call system('rm /tmp/vim_ranger_current_file')
endif
redraw!
endfun
nnoremap <space>ra :call RangerExplorer()<CR>
endif
endif
"}}}
function! WinEnterColorColumn() abort"{{{
if &buftype != ''
setlocal colorcolumn=0
elseif exists('b:colorcolumn_restore')
execute 'setlocal colorcolumn=' . b:colorcolumn_restore
endif
endfunction
"}}}
function! WinLeaveColorColumn() abort"{{{
let b:colorcolumn_restore = &colorcolumn
setlocal colorcolumn=0
endfunction
"}}}
function! GetLinterStatus(key) abort "{{{
let l:statuscount = 0
if exists('b:ale_linted')
let l:linter = ale#statusline#Count(bufnr(''))
else
let l:linter = GetDiagnosticCountsFromSigns(bufnr(''))
endif
if has_key(l:linter, a:key)
let l:statuscount = l:linter[a:key]
endif
return l:statuscount
endfunction
"}}}
function! s:RunShellCommand(cmdline) abort"{{{
" Shell command
" http://vim.wikia.com/wiki/VimTip1599
@ -346,38 +147,6 @@ endfunction
command! -complete=shellcmd -nargs=+ Shell call s:RunShellCommand(<q-args>)
let g:shell_scratch_buffer_nr = -1
"}}}
function! GetDiagnosticCountsFromSigns(buffer) abort "{{{
let l:error = 0
let l:warn = 0
let l:info = 0
let l:hint = 0
redir => l:result
silent exec 'sign place buffer=' . a:buffer
redir end
let l:lines = split(l:result, '\n')
for l:line in l:lines
if l:line =~? 'Error'
let l:error += 1
endif
if l:line =~? 'Warning'
let l:warn += 1
endif
if l:line =~? 'Info'
let l:info += 1
endif
if l:line =~? 'Hint'
let l:hint += 1
endif
endfor
return {'error': l:error, 'warning': l:warn, 'info': l:info, 'hint': l:hint}
endfunction
"}}}
function! SaveAndExecute(ex_command) abort "{{{
" https://stackoverflow.com/a/40195855
@ -408,8 +177,8 @@ function! SaveAndExecute(ex_command) abort "{{{
setlocal nobuflisted
setlocal winfixheight
setlocal cursorline " make it easy to distinguish
setlocal nonumber
setlocal norelativenumber
" setlocal nonumber
" setlocal norelativenumber
setlocal showbreak=""
nnoremap <silent> <buffer> q :bdelete!<CR>'.zz
@ -467,7 +236,7 @@ command! -nargs=1 -complete=command Redir silent call Redir(<q-args>)
"}}}
function! OpenNetrw() abort "{{{
Texplore
setl rnu nu
" setl rnu nu
endfunction
"}}}
@ -485,8 +254,6 @@ function! CloseNetrw(keep_buffer) abort "{{{
endif
endfunction
"}}}
"}}} end #functions
"----------------------------------------------------------------------------}}}
"#commands{{{
" TrimWhitespace{{{
@ -545,10 +312,8 @@ endif
set hidden
set number relativenumber
set hlsearch
" set completeopt=menuone,preview
set completeopt=menuone
set nospell
@ -610,7 +375,7 @@ nnoremap <cr>l :colorscheme monotonous-light<cr>
nnoremap <cr>d :colorscheme monotonous-dark<cr>
nnoremap 0 ^
nnoremap <silent><space>cs :let @/=""<cr>
nnoremap : :setlocal norelativenumber<CR>:
nnoremap <space>: :setlocal number<CR>:
nnoremap <silent> <space>rc :so $MYVIMRC<CR>
nnoremap <silent><expr> <space>nh (&hls && v:hlsearch ? ':nohls' : ':set hls')."\n"
nnoremap <silent> <space>sl :set invlist<CR>
@ -631,7 +396,8 @@ nnoremap <silent> <space>ry diw"0P
" quick grep of visual selection
vnoremap <space>gr y:grep! -R <C-r>" .
" open quickfix window of TODOs
nnoremap <space>td :grep! -R 'TODO' .<CR>:botright cwindow<CR>:echo len(getqflist()) 'TODOs'<CR>
" FIXME i want fixme!!!
nnoremap <space>td :grep -RE '(TODO\\|FIXME)' .<CR>:botright cwindow<CR>:echo len(getqflist()) 'TODOs'<CR>
" devdocs mapping
nnoremap <space>dd :DD<CR>
" write and delete current buffer
@ -740,9 +506,7 @@ iabbrev ct'' content-type: '';
" persistent folds {{{
augroup AutoSaveFolds
autocmd!
" autocmd BufWinLeave ?* mkview
autocmd BufWrite ?* mkview
" autocmd BufWinEnter ?* silent loadview
autocmd BufRead ?* silent! loadview
augroup END
@ -763,28 +527,13 @@ iabbrev ct'' content-type: '';
" }}}
" line numbering {{{
augroup linenumbering
autocmd!
autocmd InsertEnter * :set norelativenumber
autocmd InsertLeave * :set number relativenumber
autocmd WinEnter * :set number relativenumber
autocmd WinLeave * set norelativenumber
if exists('##CmdlineEnter')
autocmd CmdlineEnter * :redraw | :set norelativenumber
autocmd CmdlineLeave * :set number relativenumber
augroup linenumbering
autocmd!
autocmd CmdlineEnter * :redraw | :set number
autocmd CmdlineLeave * :set nonumber
augroup END
endif
augroup END
" }}}
" 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
" }}}
" Automatically reload .vimrc if changed {{{
@ -793,13 +542,6 @@ iabbrev ct'' content-type: '';
autocmd BufWritePost .vimrc,_vimrc,vimrc,.gvimrc,_gvimrc,gvimrc so $MYVIMRC | if has('gui_running') | so $MYGVIMRC | endif
augroup END
" }}}
" Open qfix after grepping {{{
" augroup qfixopen
" autocmd!
" autocmd QuickFixCmdPost *grep* botright cwindow
" augroup END
" }}}
" Open quickfix window{{{
augroup QuickFixAutoload
@ -814,7 +556,8 @@ iabbrev ct'' content-type: '';
" #statusline {{{
set statusline=\
set statusline+=[%n]\ \
set statusline+=%p\ of\ %L
set statusline+=%l\ of\ %L\
set statusline+=(%p%%)
set statusline+=%=
set statusline+=%y\
set statusline+=%r\ %m\ %F
@ -822,11 +565,7 @@ iabbrev ct'' content-type: '';
"----------------------------------------------------------------------------}}}
runtime vimrc-overrides
"}}}
if has('nvim')
" TODO - try 'coc-tsserver'
call coc#add_extension( 'coc-vetur', 'coc-python', 'coc-phpls', 'coc-json', 'coc-css', 'coc-prettier', 'coc-eslint', 'coc-vimlsp')
endif
" vim: set foldmethod=marker:

View File

@ -28,14 +28,6 @@
Plug 'tomtom/tcomment_vim'
"}}}
" #vim-easy-align {{{
" https://github.com/junegunn/vim-easy-align
Plug 'junegunn/vim-easy-align'
xmap ga <Plug>(EasyAlign)
nmap ga <Plug>(EasyAlign)
"}}}
" #vim-fzf {{{
" https://github.com/junegunn/fzf.vim
if executable('fzf') && v:version >= 704
@ -85,6 +77,18 @@ if executable('fzf') && v:version >= 704
\ 'header': ['fg', 'Comment'] }
endif
"}}}
" #polyglot{{{
" https://github.com/sheerun/vim-polyglot
Plug 'sheerun/vim-polyglot'
" vue options
let g:vue_disable_pre_processors=0
" set custom syntax highlighting
augroup fixhighlighting
autocmd!
autocmd BufNewFile,BufRead *.vue syntax sync fromstart
augroup END
"}}}
" #vim-markdown{{{
" https://github.com/plasticboy/vim-markdown

0
vimrc.plugins.vim Normal file
View File