summaryrefslogtreecommitdiff
path: root/nvim/.config
diff options
context:
space:
mode:
authorivan-boikov <ik.boikov.public@protonmail.com>2024-09-05 21:29:32 +0200
committerivan-boikov <ik.boikov.public@protonmail.com>2024-09-05 21:29:32 +0200
commit56393fa2b5677095d3ccac3ba70120f24a7064ea (patch)
treec8aea36c7ff0d44691372eedce4f123878dfabe4 /nvim/.config
parent092763a2149898ab6ae71778f9b18ef6904e2750 (diff)
nvim retabbing, use tabs by default
Diffstat (limited to 'nvim/.config')
-rw-r--r--nvim/.config/nvim/init.vim17
1 files changed, 16 insertions, 1 deletions
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 <leader>t mz:execute TabSpaceToggle()<CR>'z
nmap <M-Tab> :bnext<CR>