From c282b1a7e828b5d9244d1ba0e8afb6134f818984 Mon Sep 17 00:00:00 2001 From: Simon Ruderich Date: Tue, 24 Oct 2023 07:30:47 +0200 Subject: [PATCH] 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. --- vim/vimrc | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) 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 -- 2.45.2