vim配置支持godot
使用插件vim-godot来支持gd script的代码高亮,快捷启动场景,配置ctages,但不启用自动补全。
1. 安装vim-godot
pathogen 包管理, window下的gwin.
$ cd D:/home/vimfiles/bundle
$ git clone https://github.com/habamax/vim-godot
2. 修改.vimrc,加入快捷键配置和gd引擎路径设置.
" Vim-godot
let g:godot_executable = 'D:/work/Godot/Godot_v4.0.3-stable_win64.exe'
func! GodotSettings() abort
setlocal foldmethod=expr
setlocal tabstop=4
nnoremap <buffer> <F4> :GodotRunLast<CR>
nnoremap <buffer> <F5> :GodotRun<CR>
nnoremap <buffer> <F6> :GodotRunCurrent<CR>
nnoremap <buffer> <F7> :GodotRunFZF<CR>
endfunc
augroup godot | au!
au FileType gdscript call GodotSettings()
augroup end
3. .ctags
放到项目根路径下
内容如下:
--langdef=GDScript
--langmap=GDScript:.gd
--regex-GDScript=/^func[ \t]+([a-zA-Z0-9_]+)/\1/f,function,function definitions/
--regex-GDScript=/^(onready[ \t]+)?var[ \t]+([a-zA-Z0-9_]+)/\2/v,variable,variable definitions/
--regex-GDScript=/^(export[ \t]*(.*)?[ \t]+)?var[ \t]+([a-zA-Z0-9_]+)/\3/v,variable,variable definitions/
运行生成tags文件,之后可进行跳转.
$ ctags -R *