From 5d8220bda0b668cdaf6d89cdf6fa4ba11e853034 Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Tue, 16 Jul 2024 22:28:32 +0200 Subject: [PATCH] vim-patch:3e07d5a: runtime(go): add recommended indent options to ftplugin related: vim/vim#15264 https://github.com/vim/vim/commit/3e07d5aef19ac34a61b9d58c2e0698351d392f52 Co-authored-by: markmacode --- runtime/doc/filetype.txt | 11 +++++++++++ runtime/ftplugin/go.vim | 6 ++++++ 2 files changed, 17 insertions(+) diff --git a/runtime/doc/filetype.txt b/runtime/doc/filetype.txt index 2d2cafb494..cdb6f1d7f0 100644 --- a/runtime/doc/filetype.txt +++ b/runtime/doc/filetype.txt @@ -604,6 +604,17 @@ in the preview window. It is equivalent to calling "git diff --cached" plus any arguments given to the command. +GO *ft-go-plugin* + +By default the following options are set, based on Golang official docs: > + + setlocal noexpandtab softtabstop=0 shiftwidth=0 + +To disable this behavior, set the following variable in your vimrc: > + + let g:go_recommended_style = 0 + + GPROF *ft-gprof-plugin* The gprof filetype plugin defines a mapping to jump from a function diff --git a/runtime/ftplugin/go.vim b/runtime/ftplugin/go.vim index 61dc1a13b7..75f78cfa4b 100644 --- a/runtime/ftplugin/go.vim +++ b/runtime/ftplugin/go.vim @@ -2,6 +2,7 @@ " Language: Go " Maintainer: David Barnett (https://github.com/google/vim-ft-go) " Last Change: 2014 Aug 16 +" 2024 Jul 16 by Vim Project (add recommended indent style) if exists('b:did_ftplugin') finish @@ -15,4 +16,9 @@ setlocal commentstring=//\ %s let b:undo_ftplugin = 'setl fo< com< cms<' +if get(g:, 'go_recommended_style', 1) + setlocal noexpandtab softtabstop=0 shiftwidth=0 + let b:undo_ftplugin ..= ' | setl et< sts< sw<' +endif + " vim: sw=2 sts=2 et