Compare commits
8 Commits
1c5beed613
...
4008bb543b
| Author | SHA1 | Date | |
|---|---|---|---|
|
4008bb543b
|
|||
|
d0abb14567
|
|||
|
9e18be760c
|
|||
|
04d3d6e87f
|
|||
|
526a37301a
|
|||
|
7dc9efc0e4
|
|||
|
9bc8b4b93f
|
|||
|
ead724b75b
|
@@ -37,18 +37,30 @@ setlocal showbreak=NONE
|
|||||||
" This is very hacky.
|
" This is very hacky.
|
||||||
|
|
||||||
" Only if WinResized is supported
|
" Only if WinResized is supported
|
||||||
if has('##WinResized')
|
if exists('##WinResized')
|
||||||
|
|
||||||
augroup man_resized
|
augroup man_resized
|
||||||
" The reload has to be delayed slightly, since with an `edit` directly in
|
" The reload has to be delayed slightly, since with an `edit` directly in
|
||||||
" the autocmd, the buffer will just be cleared? (TODO)
|
" the autocmd, the buffer will just be cleared? (TODO)
|
||||||
" NOTE: One could add a wrapper function that checks for the existence of
|
au! WinResized <buffer> call s:redraw_man(v:event)
|
||||||
" already running timers similar to how it's done in the
|
|
||||||
" highlight_current group (see autocommands.vim), but this feels
|
|
||||||
" overkill here.
|
|
||||||
au! WinResized <buffer> call timer_start(10, function("s:redraw_delayed"))
|
|
||||||
augroup END
|
augroup END
|
||||||
|
|
||||||
|
function s:redraw_man(event)
|
||||||
|
if exists('w:disable_man_resizing')
|
||||||
|
return
|
||||||
|
endif
|
||||||
|
|
||||||
|
if exists('w:man_resizing_timer_id')
|
||||||
|
call timer_stop(w:man_resizing_timer_id)
|
||||||
|
endif
|
||||||
|
|
||||||
|
echo a:event
|
||||||
|
|
||||||
|
" TODO: make sure that a:event contains window number and that the width
|
||||||
|
" actually changed with getwininfo()
|
||||||
|
let w:man_resizing_timer_id = timer_start(10, function("s:redraw_delayed"))
|
||||||
|
endfunction
|
||||||
|
|
||||||
" The function can't be redefined during the reload of the ftplugin (i.e.
|
" The function can't be redefined during the reload of the ftplugin (i.e.
|
||||||
" triggered by `edit`), since it is currently executing (i.e. `edit`):
|
" triggered by `edit`), since it is currently executing (i.e. `edit`):
|
||||||
"
|
"
|
||||||
@@ -56,6 +68,8 @@ augroup END
|
|||||||
"
|
"
|
||||||
if !exists("*s:redraw_delayed")
|
if !exists("*s:redraw_delayed")
|
||||||
function s:redraw_delayed(timer_id)
|
function s:redraw_delayed(timer_id)
|
||||||
|
unlet w:man_resizing_timer_id
|
||||||
|
|
||||||
" Try to keep the position as close as possible, since edit will move to
|
" Try to keep the position as close as possible, since edit will move to
|
||||||
" the start of the file
|
" the start of the file
|
||||||
" TODO: this should be more accurate
|
" TODO: this should be more accurate
|
||||||
@@ -72,5 +86,5 @@ endif
|
|||||||
" lines, messing up the whole buffer. Since this is distracting, turn it off.
|
" lines, messing up the whole buffer. Since this is distracting, turn it off.
|
||||||
setlocal nowrap
|
setlocal nowrap
|
||||||
|
|
||||||
endif " has('##WinResized')
|
endif " exists('##WinResized')
|
||||||
" ------------------------------------------------------------------------------
|
" ------------------------------------------------------------------------------
|
||||||
|
|||||||
@@ -20,3 +20,27 @@ let g:gutentags_enabled = 0
|
|||||||
" When aborting a commit I usually use :cq which I can't when committing through
|
" When aborting a commit I usually use :cq which I can't when committing through
|
||||||
" fugitive. Abbreviate it to something that works.
|
" fugitive. Abbreviate it to something that works.
|
||||||
cabbrev <buffer> cq %d <Bar> x
|
cabbrev <buffer> cq %d <Bar> x
|
||||||
|
|
||||||
|
" Fold file listings (staged, unstaged, untracked, ...) and diff
|
||||||
|
setlocal foldmethod=syntax
|
||||||
|
|
||||||
|
" Unfold staged files and diff. inspired by:
|
||||||
|
" https://vi.stackexchange.com/questions/4050/how-to-search-for-pattern-in-certain-syntax-regions/27008#27008
|
||||||
|
if has("patch-8.2.0915") || has("nvim-0.7.0")
|
||||||
|
|
||||||
|
function s:open_fold(group, content)
|
||||||
|
" Find line containing `content` that is highlighted with `group`
|
||||||
|
let l:line_nr = search(a:content, "n", 0, 0, { ->
|
||||||
|
\ synstack('.', col('.'))
|
||||||
|
\ ->map('synIDattr(v:val, "name")')
|
||||||
|
\ ->match(a:group) < 0 })
|
||||||
|
if l:line_nr <= 0
|
||||||
|
return
|
||||||
|
endif
|
||||||
|
execute l:line_nr->string() .. "foldopen"
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
call s:open_fold("gitcommitSelected", "Changes to be committed:")
|
||||||
|
call s:open_fold("gitcommitDiff", "diff --")
|
||||||
|
|
||||||
|
endif " has("patch-8.2.0915") || has("nvim-0.7.0")
|
||||||
|
|||||||
@@ -26,10 +26,13 @@ endif
|
|||||||
" ctags
|
" ctags
|
||||||
if (executable('ctags'))
|
if (executable('ctags'))
|
||||||
packadd vim-gutentags
|
packadd vim-gutentags
|
||||||
|
" Don't index these folders
|
||||||
let g:gutentags_ctags_exclude = [
|
let g:gutentags_ctags_exclude = [
|
||||||
\ 'node_modules/*',
|
\ 'node_modules/*',
|
||||||
\ '.git/*',
|
\ '.git/*',
|
||||||
\ 'build/*'
|
\ 'build/*',
|
||||||
|
\ 'venv/*',
|
||||||
|
\ '__pycache__/*'
|
||||||
\]
|
\]
|
||||||
endif
|
endif
|
||||||
|
|
||||||
@@ -53,4 +56,6 @@ if exists("g:loaded_nrrw_rgn")
|
|||||||
" Open narrow window above or to the left of the current window (default
|
" Open narrow window above or to the left of the current window (default
|
||||||
" is topleft). See :h aboveleft etc.
|
" is topleft). See :h aboveleft etc.
|
||||||
let g:nrrw_topbot_leftright = 'aboveleft'
|
let g:nrrw_topbot_leftright = 'aboveleft'
|
||||||
|
" Leave one more line of padding when the window is small
|
||||||
|
let g:nrrw_rgn_pad = 1
|
||||||
endif
|
endif
|
||||||
|
|||||||
@@ -119,6 +119,15 @@ if (exists('g:loaded_gitgutter'))
|
|||||||
" lines have been changed.
|
" lines have been changed.
|
||||||
set foldtext=gitgutter#fold#foldtext()
|
set foldtext=gitgutter#fold#foldtext()
|
||||||
endif
|
endif
|
||||||
|
" Use the number column for the signcolumn (e.g. gitgutter, lsp diagnostics),
|
||||||
|
" but don't fallback to 'auto' when &number is off
|
||||||
|
" TODO: install autocommand to set signcolumn to yes when number is turned off
|
||||||
|
" (and back to number when turned back on)
|
||||||
|
if &number
|
||||||
|
set signcolumn=number
|
||||||
|
else
|
||||||
|
set signcolumn=yes
|
||||||
|
endif
|
||||||
|
|
||||||
" Netrw
|
" Netrw
|
||||||
" Use tree style listing
|
" Use tree style listing
|
||||||
|
|||||||
@@ -50,14 +50,24 @@ if (get(g:, 'loaded_fzf'))
|
|||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
" Get red from my colorscheme
|
||||||
|
let s:red = {}
|
||||||
|
if exists("*onedark#GetColors")
|
||||||
|
let s:red = onedark#GetColors()->get("red", {})
|
||||||
|
endif
|
||||||
|
let s:red_cterm = s:red->get("cterm", "red")
|
||||||
|
let s:red_gui = s:red->get("gui", "red")
|
||||||
|
|
||||||
" Highlight trailing whitespaces
|
" Highlight trailing whitespaces
|
||||||
if match(&listchars, 'trail: \@!') > -1 && match(&listchars, '\vtab:( +)@!') > -1
|
if match(&listchars, 'trail: \@!') > -1 && match(&listchars, '\vtab:( +)@!') > -1
|
||||||
" Use foreground for coloring if tabs and trailing spaces are displayed
|
" Use foreground for coloring if tabs and trailing spaces are displayed
|
||||||
" as non-space characters
|
" as non-space characters
|
||||||
highlight TrailingWhitespace ctermfg=red guifg=red
|
execute "highlight TrailingWhitespace ctermfg=" .. s:red_cterm
|
||||||
|
\ .. " guifg=" .. s:red_gui
|
||||||
else
|
else
|
||||||
" Background otherwise
|
" Background otherwise
|
||||||
highlight TrailingWhitespace ctermbg=red guibg=red
|
execute "highlight TrailingWhitespace ctermbg=" .. s:red_cterm
|
||||||
|
\ .. " guibg=" .. s:red_gui
|
||||||
endif
|
endif
|
||||||
augroup HighlightTrailingWhitespace
|
augroup HighlightTrailingWhitespace
|
||||||
au!
|
au!
|
||||||
@@ -74,8 +84,10 @@ let g:spl_special_chars = {
|
|||||||
\ 'fr': 'àâæçèéêëîïôœùûüÿÀÂÆÇÈÉÊËÎÏÔŒÙÛÜŸ',
|
\ 'fr': 'àâæçèéêëîïôœùûüÿÀÂÆÇÈÉÊËÎÏÔŒÙÛÜŸ',
|
||||||
\ }
|
\ }
|
||||||
|
|
||||||
" Highlight non-ASCII characters in the red used by my color scheme "OneDark"
|
" Highlight non-ASCII characters in red
|
||||||
highlight NonASCIIChars ctermfg=white guifg=white ctermbg=204 guibg=#e06c75
|
execute "highlight NonASCIIChars ctermfg=white guifg=white "
|
||||||
|
\ .. "ctermbg=" .. s:red_cterm .. " guibg=" .. s:red_gui
|
||||||
|
|
||||||
" Do not highlight special characters that are valid in the respective spelllang
|
" Do not highlight special characters that are valid in the respective spelllang
|
||||||
function! HighlightNonASCIIChars()
|
function! HighlightNonASCIIChars()
|
||||||
if exists('w:non_ascii_match_id')
|
if exists('w:non_ascii_match_id')
|
||||||
|
|||||||
Reference in New Issue
Block a user