Merge pull request #274 from dmitmel/master

[pull] master from dmitmel:master
This commit is contained in:
pull[bot] 2021-05-31 14:50:52 +00:00 committed by GitHub
commit f740eb46f0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 63 additions and 15 deletions

View file

@ -1,11 +1,7 @@
function! airline#extensions#dotfiles_tweaks#init(ext) abort
" Undo this commit a little bit:
" <https://github.com/vim-airline/vim-airline/commit/8929bc72a13d358bb8369443386ac3cc4796ca16>
call airline#parts#define('maxlinenr', {
\ 'raw': trim(airline#parts#get('maxlinenr').raw),
\ })
call airline#parts#define('colnr', {
\ 'raw': trim(airline#parts#get('colnr').raw),
\ 'accent': 'none',
\ })
" Most of the hacks present here are not required anymore:
" <https://github.com/vim-airline/vim-airline/commit/1f94ec1556db36088897c85db62251b62b683ab3>
call airline#parts#define_accent('colnr', 'none')
endfunction

View file

@ -6,9 +6,7 @@ let g:coc_user_config['languageserver.ccls'] = {
\ 'command': 'ccls',
\ 'rootPatterns': ['.ccls', 'compile_commands.json', '.vim/', '.git/', '.hg/'],
\ 'initializationOptions': {
\ 'cache': {
\ 'directory': '/tmp/ccls',
\ },
\ 'cache.directory': tempname(),
\ },
\ }

View file

@ -0,0 +1,52 @@
let s:filetypes = ['vim']
let g:coc_filetypes += s:filetypes
let g:coc_global_extensions += ['coc-vimlsp']
let g:coc_user_config['vimlsp'] = {
\ 'suggest.fromRuntimepath': v:true,
\ }
" The coc-vimlsp plugin is basically reimplemented here because it doesn't do
" much beyond just wrapping the language server and passing some init options,
" but having two processes (plugin+LSP) almost doubles the memory usage.
"
" On a second thought... Apparently that's just how this extension works...
" Either way it spawns two processes (with the controller process having
" roughly the same memory usage regardless of being in a coc extension). And
" having updates through :CocUpdate is nice, so I'm gonna use the coc-vimlsp
" plugin itself. The janky reimplementation is left in this file for better
" times and bragging purposes.
finish
" <https://github.com/iamcco/coc-vimlsp/blob/38beb0033c24a50e306343282acb071ffae6eed4/src/index.ts#L47-L82>
" workspace.isNvim: <https://github.com/neoclide/coc.nvim/blob/1c25102840e1d6d36bca9db8114e8a56f480afc4/autoload/coc/util.vim#L539>
let g:coc_user_config['languageserver.vimls'] = {
\ 'filetypes': s:filetypes,
\ 'command': 'vim-language-server',
\ 'args': ['--stdio'],
\ 'initializationOptions': {
\ 'isNeovim': has('nvim'),
\ 'iskeyword': &iskeyword,
\ 'vimruntime': $VIMRUNTIME,
\ 'runtimepath': &runtimepath,
\ 'suggest.fromRuntimepath': v:true,
\ },
\ }
augroup dotfiles-coc-vimls
autocmd!
" NOTE: Apparently delaying runtimepath initialization even until VimEnter
" is not enough, as coc-snippets adds its plugin to rtp during coc
" intialization phase which happens sometime after VimEnter[1]. Although,
" judging by the coc source code, custom language servers are initialized
" just before activation of extensions[2], and coc-snippets adds its plugin
" to rtp in the activation phase[3], so this might be reasonable for us.
" [1]: <https://github.com/neoclide/coc.nvim/blob/1c25102840e1d6d36bca9db8114e8a56f480afc4/src/attach.ts#L111-L115>
" [2]: <https://github.com/neoclide/coc.nvim/blob/1c25102840e1d6d36bca9db8114e8a56f480afc4/src/plugin.ts#L445-L446>
" [3]: <https://github.com/neoclide/coc-snippets/blob/053311a0d9edcc88b9dc0a8e8375dd82b7705f61/src/index.ts#L102>
autocmd VimEnter * let g:coc_user_config['languageserver.vimls.initializationOptions.runtimepath'] = &runtimepath
autocmd User CocNvimInit call CocNotify('vimls', '$/change/iskeyword', &iskeyword)
autocmd OptionSet iskeyword call CocNotify('vimls', '$/change/iskeyword', v:option_new)
augroup END

View file

@ -60,7 +60,7 @@ set commentstring=//%s
" Wrapping {{{
set nowrap colorcolumn=81,101,121
set nowrap colorcolumn=81,101,121 textwidth=79
" }}}
@ -203,10 +203,12 @@ set commentstring=//%s
" Formatting {{{
" don't insert a comment after hitting 'o' or 'O' in the Normal mode
" -o: don't insert a comment after hitting 'o' or 'O' in the Normal mode
" -t: don't auto-wrap regular code while typing
" -c: don't auto-wrap comments while typing
augroup vimrc-editing-formatting
autocmd!
autocmd FileType * set formatoptions-=o
autocmd FileType * set formatoptions-=o | set formatoptions-=t | set formatoptions-=c
augroup END
" }}}

View file

@ -92,8 +92,8 @@ endif
let g:airline_symbols = {
\ 'readonly': 'RO',
\ 'whitespace': '',
\ 'colnr': '',
\ 'linenr': '',
\ 'colnr': ' :',
\ 'linenr': ' :',
\ 'maxlinenr': ' ',
\ 'branch': '',
\ 'notexists': ' [?]',