aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Clason <c.clason@uni-graz.at>2024-07-16 22:26:43 +0200
committerChristian Clason <c.clason@uni-graz.at>2024-07-17 11:11:58 +0200
commitc146580e9d9fb0d99410665bd42b1edd7405738e (patch)
tree0d353f10966b71e42d03814e93fd167cca85ebd3
parent61ea4665916909853cf74256a6b350a680f08565 (diff)
downloadrneovim-c146580e9d9fb0d99410665bd42b1edd7405738e.tar.gz
rneovim-c146580e9d9fb0d99410665bd42b1edd7405738e.tar.bz2
rneovim-c146580e9d9fb0d99410665bd42b1edd7405738e.zip
vim-patch:6a54dcb: runtime(gdscript): add recommended indent options to ftplugin
related: vim/vim#15264 https://github.com/vim/vim/commit/6a54dcbbd68e70ee067348d1d9c1898befc56972 Co-authored-by: markmacode <code@mamo.aleeas.com>
-rw-r--r--runtime/doc/filetype.txt11
-rw-r--r--runtime/ftplugin/gdscript.vim5
2 files changed, 16 insertions, 0 deletions
diff --git a/runtime/doc/filetype.txt b/runtime/doc/filetype.txt
index c20651a775..2d2cafb494 100644
--- a/runtime/doc/filetype.txt
+++ b/runtime/doc/filetype.txt
@@ -586,6 +586,17 @@ any #lang directive overrides, use the following command: >
let g:freebasic_lang = "fblite"
+GDSCRIPT *ft-gdscript-plugin*
+
+By default the following options are set, based on Godot official docs: >
+
+ setlocal noexpandtab softtabstop=0 shiftwidth=0
+
+To disable this behavior, set the following variable in your vimrc: >
+
+ let g:gdscript_recommended_style = 0
+
+
GIT COMMIT *ft-gitcommit-plugin*
One command, :DiffGitCached, is provided to show a diff of the current commit
diff --git a/runtime/ftplugin/gdscript.vim b/runtime/ftplugin/gdscript.vim
index 692afdd0ea..8869c9a019 100644
--- a/runtime/ftplugin/gdscript.vim
+++ b/runtime/ftplugin/gdscript.vim
@@ -25,6 +25,11 @@ setlocal commentstring=#\ %s
setlocal foldignore=
setlocal foldexpr=s:GDScriptFoldLevel()
+if get(g:, 'gdscript_recommended_style', 1)
+ setlocal noexpandtab tabstop=4 softtabstop=0 shiftwidth=0
+ let b:undo_ftplugin ..= ' | setlocal expandtab< tabstop< softtabstop< shiftwidth<'
+endif
+
function s:GDScriptFoldLevel() abort
let line = getline(v:lnum)