Merge branch 'dmitmel-master'

This commit is contained in:
Keanu Timmermans 2021-05-17 17:00:10 +02:00
commit 628272dbba
Signed by: keanucode
GPG key ID: A7431C0D513CA93B
5 changed files with 49 additions and 23 deletions

View file

@ -5,11 +5,11 @@ let g:coc_filetypes += ['python']
let g:coc_user_config['python'] = { let g:coc_user_config['python'] = {
\ 'formatting': { \ 'formatting': {
\ 'provider': 'yapf', \ 'provider': 'yapf',
\ 'yapfArgs': ['--style=' . simplify(g:nvim_dotfiles_dir.'/../python/yapf.ini')] \ 'yapfArgs': ['--style=' . simplify(g:dotfiles_dir.'/python/yapf.ini')]
\ }, \ },
\ 'linting': { \ 'linting': {
\ 'pylintEnabled': v:false, \ 'pylintEnabled': v:false,
\ 'flake8Enabled': v:true, \ 'flake8Enabled': v:true,
\ 'flake8Args': ['--config=' . simplify(g:nvim_dotfiles_dir.'/../python/flake8.ini')], \ 'flake8Args': ['--config=' . simplify(g:dotfiles_dir.'/python/flake8.ini')],
\ }, \ },
\ } \ }

View file

@ -3,12 +3,14 @@
" Color definitions {{{ " Color definitions {{{
execute 'source' fnameescape(g:nvim_dotfiles_dir.'/../colorschemes/out/vim.vim') execute 'source' fnameescape(g:dotfiles_dir.'/colorschemes/out/vim.vim')
if !&termguicolors && exists('$_COLORSCHEME_TERMINAL') if !&termguicolors && exists('$_COLORSCHEME_TERMINAL')
set notermguicolors set notermguicolors
endif endif
let s:is_kitty = $TERM ==# 'xterm-kitty'
" }}} " }}}
" Theme setup {{{ " Theme setup {{{
@ -54,7 +56,7 @@
hi! link Directory Title hi! link Directory Title
call s:hi('Conceal', 0xC, 'NONE', '', '') call s:hi('Conceal', 0xC, 'NONE', '', '')
call s:hi('NonText', 0x3, '', '', '') call s:hi('NonText', 0x3, '', '', '')
hi! link SpecialKey NonText hi! link SpecialKey Special
call s:hi('MatchParen', 'fg', 0x3, '', '') call s:hi('MatchParen', 'fg', 0x3, '', '')
call s:hi('Keyword', 0xE, '', '', '') call s:hi('Keyword', 0xE, '', '', '')
@ -139,7 +141,6 @@
hi! link ctrlsfMatch Search hi! link ctrlsfMatch Search
hi! link ctrlsfLnumMatch ctrlsfMatch hi! link ctrlsfLnumMatch ctrlsfMatch
let s:is_kitty = $TERM ==# 'xterm-kitty'
let s:spell_fg = s:is_kitty ? '' : 'bg' let s:spell_fg = s:is_kitty ? '' : 'bg'
let s:spell_bg = s:is_kitty ? 'NONE' : '' let s:spell_bg = s:is_kitty ? 'NONE' : ''
let s:spell_attr = s:is_kitty ? 'undercurl' : '' let s:spell_attr = s:is_kitty ? 'undercurl' : ''

View file

@ -17,7 +17,6 @@
Plug 'tomtom/tcomment_vim' Plug 'tomtom/tcomment_vim'
Plug 'tpope/vim-surround' Plug 'tpope/vim-surround'
Plug 'Yggdroot/indentLine' Plug 'Yggdroot/indentLine'
Plug 'idbrii/detectindent'
Plug 'henrik/vim-indexed-search' Plug 'henrik/vim-indexed-search'
Plug 'andymass/vim-matchup' Plug 'andymass/vim-matchup'
Plug 'inkarkat/vim-ingo-library' " required by LineJuggler Plug 'inkarkat/vim-ingo-library' " required by LineJuggler
@ -57,6 +56,7 @@
" }}} " }}}
" Programming {{{ " Programming {{{
let g:polyglot_disabled = ['sensible']
Plug 'sheerun/vim-polyglot' Plug 'sheerun/vim-polyglot'
Plug 'chikamichi/mediawiki.vim' Plug 'chikamichi/mediawiki.vim'
Plug 'ron-rs/ron.vim' Plug 'ron-rs/ron.vim'

View file

@ -1,4 +1,5 @@
let g:nvim_dotfiles_dir = expand('<sfile>:p:h') let g:nvim_dotfiles_dir = expand('<sfile>:p:h')
let g:dotfiles_dir = expand('<sfile>:p:h:h')
let g:vim_ide = get(g:, 'vim_ide', 0) let g:vim_ide = get(g:, 'vim_ide', 0)
let g:vim_ide_treesitter = get(g:, 'vim_ide_treesitter', 0) let g:vim_ide_treesitter = get(g:, 'vim_ide_treesitter', 0)
@ -16,6 +17,21 @@ if !filereadable(s:vim_plug_script)
autocmd VimEnter * PlugInstall --sync autocmd VimEnter * PlugInstall --sync
endif endif
" HACK: Set `shiftwidth` to something unreasonable to make Polyglot's built-in
" indentation detector believe that it's the "default" value. The problem
" comes from the fact that Polyglot bundles vim-sleuth, but executes it in an
" autoload script, which is loaded by an ftdetect script, which is... loaded
" when vim-plug invokes `filetype on`. Thus vim-sleuth is loaded way before
" the primary chunk of my configuration is loaded, so it won't see my
" preferred indentation value, save 8 (Vim's default) to a local variable
" `s:default_shiftwidth` and always assume that some ftplugin explicitly
" modified the shiftwidth to 2 (my real default value) for that particular
" filetype. So instead I use a classic approach to rectify the problem:
" ridiculously hacky workarounds. In any case, blame this commit:
" <https://github.com/sheerun/vim-polyglot/commit/113f9b8949643f7e02c29051ad2148c3265b8131>.
let s:fake_default_shiftwidth = 0
let &shiftwidth = s:fake_default_shiftwidth
call plug#begin(s:vim_plug_home) call plug#begin(s:vim_plug_home)
Plug 'junegunn/vim-plug' Plug 'junegunn/vim-plug'
runtime! dotfiles/plugins-list.vim runtime! dotfiles/plugins-list.vim
@ -35,3 +51,27 @@ endif
" }}} " }}}
colorscheme dotfiles colorscheme dotfiles
if exists(':Sleuth')
" HACK: Continuation of the indentation detection hack. Here I first destroy
" Polyglot's vim-sleuth's autocommands, fortunately there is just one, which
" calls `s:detect_indent()` on `BufEnter`. And also registration into tpope's
" statusline plugin, which I don't use, therefore I don't care.
augroup polyglot-sleuth
autocmd!
" HACK: Now I install my own autocommand, which first resets the local
" shiftwidth to the unreasonable value picked above, which vim-sleuth
" internally compares with its local `s:default_shiftwidth`, sees that both
" are the same, and proceeds to execute the indent detection algorithm.
" Boom, my work here is done.
autocmd BufEnter * let &l:shiftwidth = s:fake_default_shiftwidth | Sleuth
augroup END
" HACK: In case you are wondering why I'm using Polyglot's bundled vim-sleuth
" given that it requires those terrible hacks to function normally and respect
" my configs, and not something like <https://github.com/idbrii/detectindent>
" (this is a fork I used to use and which checks syntax groups to improve
" detection quality). ...Well, frankly, even though vim-sleuth's detector uses
" unreliable (at first glance) regex heuristics, in practice it still works
" better than detectindent's syntax group querying.
endif

View file

@ -38,27 +38,12 @@ set commentstring=//%s
autocmd VimEnter * if bufname('%') == '' | IndentLinesDisable | endif autocmd VimEnter * if bufname('%') == '' | IndentLinesDisable | endif
augroup END augroup END
let g:detectindent_max_lines_to_analyse = 128
let g:detectindent_check_comment_syntax = 1
function s:DetectIndent()
if !empty(&bt) | return | endif
let g:detectindent_preferred_indent = &l:shiftwidth
let g:detectindent_preferred_expandtab = &l:expandtab
DetectIndent
endfunction
augroup vimrc-detect-indent
autocmd!
autocmd BufReadPost * call s:DetectIndent()
augroup END
" }}} " }}}
" Invisible characters {{{ " Invisible characters {{{
set list set list
let &listchars = "tab:\u2192 ,extends:>,precedes:<,eol:\u00ac,trail:\u00b7" let &listchars = "tab:\u2192 ,extends:>,precedes:<,eol:\u00ac,trail:\u00b7,nbsp:+"
let &showbreak = '>' let &showbreak = '>'
set display+=uhex set display+=uhex
" }}} " }}}