Disable the fold column by default, and toggle the column with fold functionality

This commit is contained in:
Kevin MacMartin 2024-04-02 22:27:30 -04:00
parent b78b285fb1
commit 1810246da2
2 changed files with 13 additions and 2 deletions

View file

@ -363,7 +363,18 @@
nnoremap <silent><expr> ` ':if (&number)<Bar>set nonumber<Bar>if exists("b:sy")<Bar>SignifyDisable<Bar>endif<Bar>else<Bar>set number<Bar>if exists("b:sy")<Bar>SignifyEnable<Bar>endif<Bar>endif<CR>:echo "gutter visibility toggled"<CR>' nnoremap <silent><expr> ` ':if (&number)<Bar>set nonumber<Bar>if exists("b:sy")<Bar>SignifyDisable<Bar>endif<Bar>else<Bar>set number<Bar>if exists("b:sy")<Bar>SignifyEnable<Bar>endif<Bar>endif<CR>:echo "gutter visibility toggled"<CR>'
"toggle the fold sidebar "toggle the fold sidebar
nnoremap ~ zRzi function! FoldToggle()
if (&foldcolumn == 0)
set foldenable
set foldcolumn=1
normal zR
else
set nofoldenable
set foldcolumn=0
endif
endfunction
nnoremap <silent><expr> ~ ':call FoldToggle()<CR>'
"toggle line wrapping (and bottom bar if using the gui) "toggle line wrapping (and bottom bar if using the gui)
nnoremap <silent><expr> <F1> ':set wrap!<CR>:echo "line wrapping toggled"<CR>' nnoremap <silent><expr> <F1> ':set wrap!<CR>:echo "line wrapping toggled"<CR>'

View file

@ -61,7 +61,7 @@
syntax on "enable syntax highlighting syntax on "enable syntax highlighting
set formatoptions=roqnl12 "how automatic formatting is to be done set formatoptions=roqnl12 "how automatic formatting is to be done
set diffopt=foldcolumn:0,filler "vimdiff default settings set diffopt=foldcolumn:0,filler "vimdiff default settings
set foldmethod=indent foldcolumn=1 foldlevel=2 "fold layers 3 and deeper set foldmethod=indent foldcolumn=0 "use intentation as the fold method and disable the fold column
set nofoldenable "disable folds by default set nofoldenable "disable folds by default
set tw=80 "set the default text width to 80 when nothing overrides this set tw=80 "set the default text width to 80 when nothing overrides this
set maxmempattern=10000 "increase the maximum amount of memory available for pattern matching set maxmempattern=10000 "increase the maximum amount of memory available for pattern matching