]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
runtime(gdscript): add recommended indent options to ftplugin
authormarkmacode <code@mamo.aleeas.com>
Tue, 16 Jul 2024 19:18:06 +0000 (21:18 +0200)
committerChristian Brabandt <cb@256bit.org>
Tue, 16 Jul 2024 19:18:06 +0000 (21:18 +0200)
related: #15264

Signed-off-by: markmacode <code@mamo.aleeas.com>
Signed-off-by: Maxim Kim <habamax@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
runtime/doc/filetype.txt
runtime/ftplugin/gdscript.vim

index a342ba464055dd4f1a264527665f03be59ed5630..1885f86882f8695c806cb3a5b884754386af950f 100644 (file)
@@ -623,6 +623,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
index 93519d8afef97e8d6aa29d6d8fd78b32432f96bc..d1f41c8eafc264f9b8ff3e821cefcde281d08a29 100644 (file)
@@ -4,6 +4,7 @@ vim9script
 # Language: gdscript (Godot game engine scripting language)
 # Maintainer: Maxim Kim <habamax@gmail.com>
 # Website: https://github.com/habamax/vim-gdscript
+# Last Change: 2024 Jul 14
 
 if exists("b:did_ftplugin") | finish | endif
 
@@ -22,6 +23,11 @@ setlocal commentstring=#\ %s
 setlocal foldignore=
 setlocal foldexpr=GDScriptFoldLevel()
 
+if get(g:, 'gdscript_recommended_style', 1)
+    setlocal noexpandtab tabstop=4 softtabstop=0 shiftwidth=0
+    b:undo_ftplugin ..= ' | setlocal expandtab< tabstop< softtabstop< shiftwidth<'
+endif
+
 
 def GDScriptFoldLevel(): string
     var line = getline(v:lnum)