runtime(go): add recommended indent options to ftplugin Commit: https://github.com/vim/vim/commit/3e07d5aef19ac34a61b9d58c2e0698351d392f52 Author: markmacode <c...@mamo.aleeas.com> Date: Tue Jul 16 21:20:34 2024 +0200
runtime(go): add recommended indent options to ftplugin related: https://github.com/vim/vim/issues/15264 Signed-off-by: markmacode <c...@mamo.aleeas.com> Signed-off-by: Christian Brabandt <c...@256bit.org> diff --git a/runtime/doc/filetype.txt b/runtime/doc/filetype.txt index 1885f8688..6c706b177 100644 --- a/runtime/doc/filetype.txt +++ b/runtime/doc/filetype.txt @@ -1,4 +1,4 @@ -*filetype.txt* For Vim version 9.1. Last change: 2024 Jul 15 +*filetype.txt* For Vim version 9.1. Last change: 2024 Jul 16 VIM REFERENCE MANUAL by Bram Moolenaar @@ -641,6 +641,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 <C-]> to jump from a function diff --git a/runtime/ftplugin/go.vim b/runtime/ftplugin/go.vim index 61dc1a13b..75f78cfa4 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 -- -- You received this message from the "vim_dev" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/vim_dev/E1sTxvN-0091Up-4O%40256bit.org.