From 1810246da2873d98023f6afdb3df0822248afd19 Mon Sep 17 00:00:00 2001 From: Kevin MacMartin Date: Tue, 2 Apr 2024 22:27:30 -0400 Subject: [PATCH] Disable the fold column by default, and toggle the column with fold functionality --- vim/config/keyboard.vim | 13 ++++++++++++- vim/config/settings.vim | 2 +- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/vim/config/keyboard.vim b/vim/config/keyboard.vim index b2d9dd8..e9ee3e1 100644 --- a/vim/config/keyboard.vim +++ b/vim/config/keyboard.vim @@ -363,7 +363,18 @@ nnoremap ` ':if (&number)set nonumberif exists("b:sy")SignifyDisableendifelseset numberif exists("b:sy")SignifyEnableendifendif:echo "gutter visibility toggled"' "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 ~ ':call FoldToggle()' "toggle line wrapping (and bottom bar if using the gui) nnoremap ':set wrap!:echo "line wrapping toggled"' diff --git a/vim/config/settings.vim b/vim/config/settings.vim index b929255..da9a838 100644 --- a/vim/config/settings.vim +++ b/vim/config/settings.vim @@ -61,7 +61,7 @@ syntax on "enable syntax highlighting set formatoptions=roqnl12 "how automatic formatting is to be done 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 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