From 56393fa2b5677095d3ccac3ba70120f24a7064ea Mon Sep 17 00:00:00 2001 From: ivan-boikov Date: Thu, 5 Sep 2024 21:29:32 +0200 Subject: nvim retabbing, use tabs by default --- nvim/.config/nvim/init.vim | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'nvim/.config') diff --git a/nvim/.config/nvim/init.vim b/nvim/.config/nvim/init.vim index 1f8a062..86366fb 100644 --- a/nvim/.config/nvim/init.vim +++ b/nvim/.config/nvim/init.vim @@ -140,7 +140,7 @@ set tabstop=4 " The width of a TAB is set to 4. " a width of 4. set shiftwidth=4 " Indents will have a width of 4 set softtabstop=4 " Sets the number of columns for a TAB -set noexpandtab " Expand TABs to spaces +set expandtab " spaces to tabs set shiftround " Round indent to multiple of 'shiftwidth' set smartindent " Do smart indenting when starting a new line set autoindent " Copy indent from current line, over to the new line @@ -177,6 +177,21 @@ set formatoptions-=t " show tabs set list set listchars=tab:>- +set listchars+=space:ยท + +function TabSpaceToggle() + if &expandtab + set shiftwidth=4 + set softtabstop=0 + set noexpandtab + else + set shiftwidth=4 + set softtabstop=4 + set expandtab + endif + execute('%retab!') +endfunction +nmap t mz:execute TabSpaceToggle()'z nmap :bnext -- cgit v1.2.3