Update and simplify statusline in vimrc

This commit is contained in:
Barak Michener 2021-01-08 18:33:00 -08:00
parent 9b2bd0b702
commit eff06079de
4 changed files with 17 additions and 12 deletions

View file

@ -1,7 +1,7 @@
{ {
"dependencies": { "dependencies": {
"coc-json": ">=1.3.2", "coc-json": ">=1.3.2",
"coc-python": ">=1.2.13", "coc-pyright": ">=1.1.97",
"coc-snippets": ">=2.2.3", "coc-snippets": ">=2.2.3",
"coc-svelte": ">=0.1.1", "coc-svelte": ">=0.1.1",
"coc-tailwindcss": ">=0.7.0", "coc-tailwindcss": ">=0.7.0",

View file

@ -804,7 +804,7 @@ function! s:syntax()
syn match plugNumber /[0-9]\+[0-9.]*/ contained syn match plugNumber /[0-9]\+[0-9.]*/ contained
syn match plugBracket /[[\]]/ contained syn match plugBracket /[[\]]/ contained
syn match plugX /x/ contained syn match plugX /x/ contained
syn match plugDash /^-/ syn match plugDash /^-\{1}\ /
syn match plugPlus /^+/ syn match plugPlus /^+/
syn match plugStar /^*/ syn match plugStar /^*/
syn match plugMessage /\(^- \)\@<=.*/ syn match plugMessage /\(^- \)\@<=.*/
@ -822,6 +822,7 @@ function! s:syntax()
syn match plugError /^x.*/ syn match plugError /^x.*/
syn region plugDeleted start=/^\~ .*/ end=/^\ze\S/ syn region plugDeleted start=/^\~ .*/ end=/^\ze\S/
syn match plugH2 /^.*:\n-\+$/ syn match plugH2 /^.*:\n-\+$/
syn match plugH2 /^-\{2,}/
syn keyword Function PlugInstall PlugStatus PlugUpdate PlugClean syn keyword Function PlugInstall PlugStatus PlugUpdate PlugClean
hi def link plug1 Title hi def link plug1 Title
hi def link plug2 Repeat hi def link plug2 Repeat
@ -1077,8 +1078,9 @@ function! s:checkout(spec)
let sha = a:spec.commit let sha = a:spec.commit
let output = s:git_revision(a:spec.dir) let output = s:git_revision(a:spec.dir)
if !empty(output) && !s:hash_match(sha, s:lines(output)[0]) if !empty(output) && !s:hash_match(sha, s:lines(output)[0])
let credential_helper = s:git_version_requirement(2) ? '-c credential.helper= ' : ''
let output = s:system( let output = s:system(
\ 'git fetch --depth 999999 && git checkout '.plug#shellescape(sha).' --', a:spec.dir) \ 'git '.credential_helper.'fetch --depth 999999 && git checkout '.plug#shellescape(sha).' --', a:spec.dir)
endif endif
return output return output
endfunction endfunction
@ -1530,7 +1532,7 @@ while 1 " Without TCO, Vim stack is bound to explode
let [error, _] = s:git_validate(spec, 0) let [error, _] = s:git_validate(spec, 0)
if empty(error) if empty(error)
if pull if pull
let cmd = ['git', 'fetch'] let cmd = s:git_version_requirement(2) ? ['git', '-c', 'credential.helper=', 'fetch'] : ['git', 'fetch']
if has_tag && !empty(globpath(spec.dir, '.git/shallow')) if has_tag && !empty(globpath(spec.dir, '.git/shallow'))
call extend(cmd, ['--depth', '99999999']) call extend(cmd, ['--depth', '99999999'])
endif endif

View file

@ -8,8 +8,8 @@
"python.linting.flake8Enabled": true, "python.linting.flake8Enabled": true,
"python.linting.mypyEnabled": true, "python.linting.mypyEnabled": true,
"python.linting.mypyArgs": ["--ignore-missing-imports"], "python.linting.mypyArgs": ["--ignore-missing-imports"],
"python.jediEnabled": true, "python.venvPath": "~/.virtualenvs",
"python.autoComplete.addBrackets": false, "python.analysis.typeCheckingMode": "off",
"suggest.detailField": "abbr", "suggest.detailField": "abbr",
"suggest.snippetIndicator": "", "suggest.snippetIndicator": "",
"languageserver": { "languageserver": {
@ -28,9 +28,5 @@
"rootPatterns": ["go.mod", ".vim/", ".git/", ".hg/"], "rootPatterns": ["go.mod", ".vim/", ".git/", ".hg/"],
"filetypes": ["go"] "filetypes": ["go"]
} }
}, }
"python.autoComplete.extraPaths": [
"${env:SPARK_HOME}/python",
"${env:SPARK_HOME}/python/pyspark"
]
} }

9
.vimrc
View file

@ -136,7 +136,7 @@ Plug 'vim-airline/vim-airline-themes'
Plug 'junegunn/fzf', { 'do': { -> fzf#install() } } Plug 'junegunn/fzf', { 'do': { -> fzf#install() } }
Plug 'junegunn/fzf.vim' Plug 'junegunn/fzf.vim'
Plug 'airblade/vim-rooter' Plug 'airblade/vim-rooter'
Plug 'bling/vim-bufferline' "Plug 'bling/vim-bufferline'
Plug 'majutsushi/tagbar' Plug 'majutsushi/tagbar'
Plug 'SirVer/ultisnips' Plug 'SirVer/ultisnips'
Plug 'honza/vim-snippets' Plug 'honza/vim-snippets'
@ -471,6 +471,7 @@ let g:fzf_preview_window = ''
" * Airline " * Airline
set noshowmode set noshowmode
let g:airline_section_c = '%{StatuslineGit()}'
let g:airline#extensions#branch#enabled = 1 let g:airline#extensions#branch#enabled = 1
let g:airline#extensions#syntastic#enabled = 1 let g:airline#extensions#syntastic#enabled = 1
let g:airline#extensions#tagbar#enabled = 1 let g:airline#extensions#tagbar#enabled = 1
@ -704,6 +705,12 @@ function AutoTrimWhitespace()
endif endif
endfunction endfunction
function! StatuslineGit()
let l:root = finddir('.git/..', expand('%:p:h').';')
return expand('%:p:s!'. l:root . '!/!')
endfunction
function InstallEverything() function InstallEverything()
GoUpdateBinaries GoUpdateBinaries
BlackUpgrade BlackUpgrade