From: Simon Ruderich Date: Tue, 24 Oct 2023 05:30:47 +0000 (+0200) Subject: vim: support modelines in Go which change 'tabstop' X-Git-Url: https://ruderich.org/simon/gitweb/?a=commitdiff_plain;h=c282b1a7e828b5d9244d1ba0e8afb6134f818984;p=config%2Fdotfiles.git vim: support modelines in Go which change 'tabstop' I've used Go with the default setting of eight spaces per tab for a long time but the lines do indeed get very long. So permit using a modeline to switch back to four spaces per tab. --- diff --git a/vim/vimrc b/vim/vimrc index 86c1e70..84813d9 100644 --- a/vim/vimrc +++ b/vim/vimrc @@ -920,11 +920,10 @@ if has('eval') endif " Settings for securemodelines. - " Only allow items I need (also includes spl which is not enabled by - " default). + " Only allow items I need if v:version >= 700 " need lists let g:secure_modelines_allowed_items = ['ft', 'spl', 'fdm', - \ 'sw', 'sts', 'noet'] + \ 'ts', 'sw', 'sts', 'noet'] endif " Settings for gnupg. @@ -1082,8 +1081,9 @@ if has('autocmd') autocmd FileType vimperator setlocal commentstring=\"%s " Use TeX compiler for (La)TeX files. autocmd FileType tex compiler tex -" Go always uses tabs for indentation. - autocmd FileType go call UseTabs() +" Go always uses tabs for indentation; use BufRead so modelines can overwrite +" settings like 'tabstop' + autocmd BufRead,StdinReadPost *.go call UseTabs() " FTDETECT AUTO COMMANDS