diff options
-rw-r--r-- | .github/CODEOWNERS | 8 | ||||
-rw-r--r-- | runtime/compiler/raco.vim | 14 | ||||
-rw-r--r-- | runtime/compiler/racomake.vim | 14 | ||||
-rw-r--r-- | runtime/compiler/racosetup.vim | 14 | ||||
-rw-r--r-- | runtime/compiler/racotest.vim | 14 | ||||
-rw-r--r-- | runtime/doc/eval.txt | 7 | ||||
-rw-r--r-- | runtime/doc/syntax.txt | 8 | ||||
-rw-r--r-- | runtime/doc/tags | 7 | ||||
-rw-r--r-- | runtime/doc/todo.txt | 19 | ||||
-rw-r--r-- | runtime/doc/vim9.txt | 2 | ||||
-rw-r--r-- | runtime/ftplugin/gdscript.vim | 53 | ||||
-rw-r--r-- | runtime/ftplugin/gdshader.vim | 12 | ||||
-rw-r--r-- | runtime/ftplugin/racket.vim | 82 | ||||
-rw-r--r-- | runtime/indent/gdscript.vim | 148 | ||||
-rw-r--r-- | runtime/indent/racket.vim | 60 | ||||
-rw-r--r-- | runtime/syntax/gdresource.vim | 64 | ||||
-rw-r--r-- | runtime/syntax/gdscript.vim | 104 | ||||
-rw-r--r-- | runtime/syntax/gdshader.vim | 57 | ||||
-rw-r--r-- | runtime/syntax/racket.vim | 656 |
19 files changed, 1326 insertions, 17 deletions
diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index fde927a9d7..1cd351fe78 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -120,6 +120,8 @@ runtime/ftplugin/fpcmake.vim @dkearns runtime/ftplugin/freebasic.vim @dkearns runtime/ftplugin/fstab.vim @rid9 runtime/ftplugin/gdb.vim @xeyownt +runtime/ftplugin/gdscript.vim @habamax +runtime/ftplugin/gdshader.vim @habamax runtime/ftplugin/git.vim @tpope runtime/ftplugin/gitcommit.vim @tpope runtime/ftplugin/gitconfig.vim @tpope @@ -211,6 +213,7 @@ runtime/indent/eterm.vim @dkearns runtime/indent/falcon.vim @steveno runtime/indent/framescript.vim @dkearns runtime/indent/freebasic.vim @dkearns +runtime/indent/gdscript.vim @habamax runtime/indent/gitconfig.vim @tpope runtime/indent/gitolite.vim @sitaramc runtime/indent/go.vim @dbarnett @@ -314,6 +317,9 @@ runtime/syntax/forth.vim @jkotlinski runtime/syntax/fpcmake.vim @dkearns runtime/syntax/freebasic.vim @dkearns runtime/syntax/fstab.vim @rid9 +runtime/syntax/gdresource.vim @habamax +runtime/syntax/gdscript.vim @habamax +runtime/syntax/gdshader.vim @habamax runtime/syntax/git.vim @tpope runtime/syntax/gitcommit.vim @tpope runtime/syntax/gitconfig.vim @tpope @@ -326,7 +332,7 @@ runtime/syntax/groff.vim @jmarshall runtime/syntax/haml.vim @tpope runtime/syntax/haskell.vim @coot runtime/syntax/hgcommit.vim @k-takata -runtime/syntax/html.vim @dkearns +runtime/syntax/html.vim @dkearns runtime/syntax/i3config.vim @hiqua runtime/syntax/icon.vim @dkearns runtime/syntax/indent.vim @dkearns diff --git a/runtime/compiler/raco.vim b/runtime/compiler/raco.vim new file mode 100644 index 0000000000..bd10859aa9 --- /dev/null +++ b/runtime/compiler/raco.vim @@ -0,0 +1,14 @@ +" Vim compiler file +" Compiler: raco (Racket command-line tools) +" Maintainer: D. Ben Knoble <ben.knoble+github@gmail.com> +" URL: https://github.com/benknoble/vim-racket +" Last Change: 2022 Aug 12 + +let current_compiler = 'raco' + +if exists(":CompilerSet") != 2 + command -nargs=* CompilerSet setlocal <args> +endif + +CompilerSet makeprg=raco +CompilerSet errorformat=%f:%l:%c:%m diff --git a/runtime/compiler/racomake.vim b/runtime/compiler/racomake.vim new file mode 100644 index 0000000000..dae95fec42 --- /dev/null +++ b/runtime/compiler/racomake.vim @@ -0,0 +1,14 @@ +" Vim compiler file +" Compiler: raco make (Racket command-line tools) +" Maintainer: D. Ben Knoble <ben.knoble+github@gmail.com> +" URL: https://github.com/benknoble/vim-racket +" Last Change: 2022 Aug 12 + +let current_compiler = 'racomake' + +if exists(":CompilerSet") != 2 + command -nargs=* CompilerSet setlocal <args> +endif + +CompilerSet makeprg=raco\ make\ --\ % +CompilerSet errorformat=%f:%l:%c:%m diff --git a/runtime/compiler/racosetup.vim b/runtime/compiler/racosetup.vim new file mode 100644 index 0000000000..1efe8a15a2 --- /dev/null +++ b/runtime/compiler/racosetup.vim @@ -0,0 +1,14 @@ +" Vim compiler file +" Compiler: raco setup (Racket command-line tools) +" Maintainer: D. Ben Knoble <ben.knoble+github@gmail.com> +" URL: https://github.com/benknoble/vim-racket +" Last Change: 2022 Aug 12 + +let current_compiler = 'racosetup' + +if exists(":CompilerSet") != 2 + command -nargs=* CompilerSet setlocal <args> +endif + +CompilerSet makeprg=raco\ setup +CompilerSet errorformat=%f:%l:%c:%m diff --git a/runtime/compiler/racotest.vim b/runtime/compiler/racotest.vim new file mode 100644 index 0000000000..d2a1a3c0f3 --- /dev/null +++ b/runtime/compiler/racotest.vim @@ -0,0 +1,14 @@ +" Vim compiler file +" Compiler: raco test (Racket command-line tools) +" Maintainer: D. Ben Knoble <ben.knoble+github@gmail.com> +" URL: https://github.com/benknoble/vim-racket +" Last Change: 2022 Aug 12 + +let current_compiler = 'racotest' + +if exists(":CompilerSet") != 2 + command -nargs=* CompilerSet setlocal <args> +endif + +CompilerSet makeprg=raco\ test\ % +CompilerSet errorformat=location:%f:%l:%c diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt index 9ac4942dde..fd293e4cf4 100644 --- a/runtime/doc/eval.txt +++ b/runtime/doc/eval.txt @@ -3608,6 +3608,9 @@ text... iterate over. Unlike with |List|, modifying the |Blob| does not affect the iteration. + When {object} is a |String| each item is a string with + one character, plus any combining characters. + In |Vim9| script `:endfor` cannot be shortened, to improve script readability. @@ -3827,7 +3830,9 @@ text... Like |:echomsg| but when the messages popup window is available the message is displayed there. This means it will show for three seconds and avoid a - |hit-enter| prompt. + |hit-enter| prompt. If you want to hide it before + that, press Esc in Normal mode (when it would + otherwise beep). The message window is available when Vim was compiled with the +timer and the +popupwin features. diff --git a/runtime/doc/syntax.txt b/runtime/doc/syntax.txt index 7d6b92da1a..adc1d56955 100644 --- a/runtime/doc/syntax.txt +++ b/runtime/doc/syntax.txt @@ -5368,7 +5368,9 @@ CursorLineFold Like FoldColumn when 'cursorline' is set for the cursor line. *hl-MatchParen* MatchParen Character under the cursor or just before it, if it is a paired bracket, and its match. |pi_paren.txt| - + *hl-MessageWindow* +MessageWindow Messages popup window used when 'cmdheight' is zero. If not + defined |hl-WarningMsg| is used. *hl-ModeMsg* ModeMsg 'showmode' message (e.g., "-- INSERT --"). *hl-MoreMsg* @@ -5388,6 +5390,10 @@ PmenuSel Popup menu: Selected item. PmenuSbar Popup menu: Scrollbar. *hl-PmenuThumb* PmenuThumb Popup menu: Thumb of the scrollbar. + *hl-PopupNotification* +PopupNotification + Popup window created with |popup_notification()|. If not + defined |hl-WarningMsg| is used. *hl-Question* Question |hit-enter| prompt and yes/no questions. *hl-QuickFixLine* diff --git a/runtime/doc/tags b/runtime/doc/tags index 6d882af8d4..73ecead22a 100644 --- a/runtime/doc/tags +++ b/runtime/doc/tags @@ -2469,6 +2469,9 @@ $quote eval.txt /*$quote* :echom eval.txt /*:echom* :echomsg eval.txt /*:echomsg* :echon eval.txt /*:echon* +:echow eval.txt /*:echow* +:echowin eval.txt /*:echowin* +:echowindow eval.txt /*:echowindow* :edit editing.txt /*:edit* :edit! editing.txt /*:edit!* :edit!_f editing.txt /*:edit!_f* @@ -4324,6 +4327,7 @@ E1293 textprop.txt /*E1293* E1294 textprop.txt /*E1294* E1295 textprop.txt /*E1295* E1296 textprop.txt /*E1296* +E1297 vim9.txt /*E1297* E13 message.txt /*E13* E131 eval.txt /*E131* E132 eval.txt /*E132* @@ -7735,6 +7739,7 @@ hl-LineNrAbove syntax.txt /*hl-LineNrAbove* hl-LineNrBelow syntax.txt /*hl-LineNrBelow* hl-MatchParen syntax.txt /*hl-MatchParen* hl-Menu syntax.txt /*hl-Menu* +hl-MessageWindow syntax.txt /*hl-MessageWindow* hl-ModeMsg syntax.txt /*hl-ModeMsg* hl-MoreMsg syntax.txt /*hl-MoreMsg* hl-NonText syntax.txt /*hl-NonText* @@ -7743,6 +7748,7 @@ hl-Pmenu syntax.txt /*hl-Pmenu* hl-PmenuSbar syntax.txt /*hl-PmenuSbar* hl-PmenuSel syntax.txt /*hl-PmenuSel* hl-PmenuThumb syntax.txt /*hl-PmenuThumb* +hl-PopupNotification syntax.txt /*hl-PopupNotification* hl-Question syntax.txt /*hl-Question* hl-QuickFixLine syntax.txt /*hl-QuickFixLine* hl-Scrollbar syntax.txt /*hl-Scrollbar* @@ -9432,6 +9438,7 @@ setbufvar() builtin.txt /*setbufvar()* setcellwidths() builtin.txt /*setcellwidths()* setcharpos() builtin.txt /*setcharpos()* setcharsearch() builtin.txt /*setcharsearch()* +setcmdline() builtin.txt /*setcmdline()* setcmdpos() builtin.txt /*setcmdpos()* setcursorcharpos() builtin.txt /*setcursorcharpos()* setenv() builtin.txt /*setenv()* diff --git a/runtime/doc/todo.txt b/runtime/doc/todo.txt index ea8d2c0dba..327ae01f4d 100644 --- a/runtime/doc/todo.txt +++ b/runtime/doc/todo.txt @@ -38,8 +38,13 @@ browser use: https://github.com/vim/vim/issues/1234 *known-bugs* -------------------- Known bugs and current work ----------------------- +cmdheight=0: +- :g/pattern should not use message window #11012 + *.sil detection with FTsil() (lacygoill, Aug 25) +Avoid using "Xfile" and "Xdir" in tests, use specific names. + Further Vim9 improvements, possibly after launch: - Use Vim9 for more runtime files. - Check performance with callgrind and kcachegrind. @@ -178,19 +183,10 @@ Terminal emulator window: - When 'encoding' is not utf-8, or the job is using another encoding, setup conversions. -Patches considered for including: -- use int instead of char_ for index #10818 needs a test -- Add "-n" option to xxd. #10599 needs a test -- allow for nesting of timeout, sketch in #10595 -- Add setcmdline() #10869 - Cleanup: -- Remove OLD_DIGRAPHS ? - Remove FEAT_FOOTER ? -Add 'splitscroll' #10682 Useful? Any trouble? Null Chilly says it's OK. - suggestion: names instead of numbers for the option value - problem depending on whether window is focused or not +Add 'splitscroll' #10682 Useful? Any remaining trouble? Autoconf: must use autoconf 2.69, later version generates lots of warnings - try using autoconf 2.71 and fix all "obsolete" warnings @@ -882,9 +878,6 @@ The ++ options for the :edit command are also useful on the Vim command line. Overlong utf-8 sequence is displayed wrong. (Harm te Hennepe, 2017 Sep 14, #2089) Patch with possible solution by Björn Linse. -The change list index is local to a buffer, but it doesn't make sense using it -for another buffer. (lacygoill) Copy w_changelistidx to wininfo_S and back. - X11: Putting more than about 262040 characters of text on the clipboard and pasting it in another Vim doesn't work. (Dominique Pelle, 2008 Aug 21-23) clip_x11_request_selection_cb() is called with zero value and length. diff --git a/runtime/doc/vim9.txt b/runtime/doc/vim9.txt index 5d1a823010..b77b789a2c 100644 --- a/runtime/doc/vim9.txt +++ b/runtime/doc/vim9.txt @@ -1618,7 +1618,7 @@ type, it can not be used in Vim9 script. *E1211* *E1217* *E1218* *E1219* *E1220* *E1221* *E1222* *E1223* *E1224* *E1225* *E1226* *E1227* *E1228* *E1238* *E1250* *E1251* *E1252* *E1253* - *E1256* + *E1256* *E1297* Types are checked for most builtin functions to make it easier to spot mistakes. diff --git a/runtime/ftplugin/gdscript.vim b/runtime/ftplugin/gdscript.vim new file mode 100644 index 0000000000..dc1d220d06 --- /dev/null +++ b/runtime/ftplugin/gdscript.vim @@ -0,0 +1,53 @@ +vim9script + +# Vim filetype plugin file +# Language: gdscript (Godot game engine scripting language) +# Maintainer: Maxim Kim <habamax@gmail.com> + +if exists("b:did_ftplugin") | finish | endif + +b:did_ftplugin = 1 +b:undo_ftplugin = 'setlocal cinkeys<' + \ .. '| setlocal indentkeys<' + \ .. '| setlocal commentstring<' + \ .. '| setlocal suffixesadd<' + \ .. '| setlocal foldexpr<' + \ .. '| setlocal foldignore<' + +setlocal cinkeys-=0# +setlocal indentkeys-=0# +setlocal suffixesadd=.gd +setlocal commentstring=#\ %s +setlocal foldignore= +setlocal foldexpr=GDScriptFoldLevel() + + +def GDScriptFoldLevel(): string + var line = getline(v:lnum) + if line =~? '^\s*$' + return "-1" + endif + + var sw = shiftwidth() + var indent = indent(v:lnum) / sw + var indent_next = indent(nextnonblank(v:lnum + 1)) / sw + + if indent_next > indent && line =~ ':\s*$' + return $">{indent_next}" + else + return $"{indent}" + endif +enddef + + +# Next/Previous section +def NextSection(back: bool, cnt: number) + for n in range(cnt) + search('^\s*func\s', back ? 'bW' : 'W') + endfor +enddef + +nnoremap <silent><buffer> ]] <scriptcmd>NextSection(false, v:count1)<CR> +nnoremap <silent><buffer> [[ <scriptcmd>NextSection(true, v:count1)<CR> +xmap <silent><buffer><expr> ]] "\<esc>" .. v:count1 .. ']]m>gv' +xmap <silent><buffer><expr> [[ "\<esc>" .. v:count1 .. '[[m>gv' diff --git a/runtime/ftplugin/gdshader.vim b/runtime/ftplugin/gdshader.vim new file mode 100644 index 0000000000..74de7c10f2 --- /dev/null +++ b/runtime/ftplugin/gdshader.vim @@ -0,0 +1,12 @@ +vim9script + +# Vim filetype plugin file +# Language: Godot shading language +# Maintainer: Maxim Kim <habamax@gmail.com> + +if exists("b:did_ftplugin") | finish | endif +b:did_ftplugin = 1 + +b:undo_ftplugin = 'setlocal suffixesadd<' + +setlocal suffixesadd=.gdshader diff --git a/runtime/ftplugin/racket.vim b/runtime/ftplugin/racket.vim new file mode 100644 index 0000000000..3aa413397e --- /dev/null +++ b/runtime/ftplugin/racket.vim @@ -0,0 +1,82 @@ +" Vim filetype plugin +" Language: Racket +" Maintainer: D. Ben Knoble <ben.knoble+github@gmail.com> +" Previous Maintainer: Will Langstroth <will@langstroth.com> +" URL: https://github.com/benknoble/vim-racket +" Last Change: 2022 Aug 29 + +if exists("b:did_ftplugin") + finish +endif +let b:did_ftplugin = 1 + +let s:cpo_save = &cpo +set cpo&vim + +" quick hack to allow adding values +setlocal iskeyword=@,!,#-',*-:,<-Z,a-z,~,_,94 + +" Enable auto begin new comment line when continuing from an old comment line +setlocal comments=:;;;;,:;;;,:;;,:; +setlocal formatoptions+=r + +"setlocal commentstring=;;%s +setlocal commentstring=#\|\ %s\ \|# + +setlocal formatprg=raco\ fmt + +" Undo our settings when the filetype changes away from Racket +" (this should be amended if settings/mappings are added above!) +let b:undo_ftplugin = + \ "setlocal iskeyword< lispwords< lisp< comments< formatoptions< formatprg<" + \. " | setlocal commentstring<" + +if !exists("no_plugin_maps") && !exists("no_racket_maps") + " Simply setting keywordprg like this works: + " setlocal keywordprg=raco\ docs + " but then vim says: + " "press ENTER or type a command to continue" + " We avoid the annoyance of having to hit enter by remapping K directly. + function s:RacketDoc(word) abort + execute 'silent !raco docs --' shellescape(a:word) + redraw! + endfunction + nnoremap <buffer> <Plug>RacketDoc :call <SID>RacketDoc(expand('<cword>'))<CR> + nmap <buffer> K <Plug>RacketDoc + + " For the visual mode K mapping, it's slightly more convoluted to get the + " selected text: + function! s:Racket_visual_doc() + try + let l:old_a = @a + normal! gv"ay + call system("raco docs '". @a . "'") + redraw! + return @a + finally + let @a = l:old_a + endtry + endfunction + + xnoremap <buffer> <Plug>RacketDoc :call <SID>Racket_visual_doc()<cr> + xmap <buffer> K <Plug>RacketDoc + + let b:undo_ftplugin .= + \ " | silent! execute 'nunmap <buffer> K'" + \. " | silent! execute 'xunmap <buffer> K'" +endif + +if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter") + let b:browsefilter = + \ "Racket Source Files (*.rkt *.rktl)\t*.rkt;*.rktl\n" + \. "All Files (*.*)\t*.*\n" + let b:undo_ftplugin .= " | unlet! b:browsefilter" +endif + +if exists("loaded_matchit") && !exists("b:match_words") + let b:match_words = '#|:|#' + let b:undo_ftplugin .= " | unlet! b:match_words" +endif + +let &cpo = s:cpo_save +unlet s:cpo_save diff --git a/runtime/indent/gdscript.vim b/runtime/indent/gdscript.vim new file mode 100644 index 0000000000..39f68c6cc7 --- /dev/null +++ b/runtime/indent/gdscript.vim @@ -0,0 +1,148 @@ +vim9script + +# Vim indent file +# Language: gdscript (Godot game engine) +# Maintainer: Maxim Kim <habamax@gmail.com> +# Based on python indent file. + +if exists("b:did_indent") + finish +endif +b:did_indent = 1 + +var undo_opts = "setl indentexpr< indentkeys< lisp< autoindent<" + +if exists('b:undo_indent') + b:undo_indent ..= "|" .. undo_opts +else + b:undo_indent = undo_opts +endif + +setlocal nolisp +setlocal autoindent +setlocal indentexpr=GDScriptIndent() +setlocal indentkeys+=<:>,=elif,=except + + +def GDScriptIndent(): number + # If this line is explicitly joined: If the previous line was also joined, + # line it up with that one, otherwise add two 'shiftwidth' + if getline(v:lnum - 1) =~ '\\$' + if v:lnum > 1 && getline(v:lnum - 2) =~ '\\$' + return indent(v:lnum - 1) + endif + return indent(v:lnum - 1) + (shiftwidth() * 2) + endif + + # If the start of the line is in a string don't change the indent. + if has('syntax_items') && synIDattr(synID(v:lnum, 1, 1), "name") =~ "String$" + return -1 + endif + + # Search backwards for the previous non-empty line. + var plnum = prevnonblank(v:lnum - 1) + + if plnum == 0 + # This is the first non-empty line, use zero indent. + return 0 + endif + + var plindent = indent(plnum) + var plnumstart = plnum + + # Get the line and remove a trailing comment. + # Use syntax highlighting attributes when possible. + var pline = getline(plnum) + var pline_len = strlen(pline) + if has('syntax_items') + # If the last character in the line is a comment, do a binary search for + # the start of the comment. synID() is slow, a linear search would take + # too long on a long line. + if synIDattr(synID(plnum, pline_len, 1), "name") =~ "\\(Comment\\|Todo\\)$" + var min = 1 + var max = pline_len + while min < max + var col = (min + max) / 2 + if synIDattr(synID(plnum, col, 1), "name") =~ "\\(Comment\\|Todo\\)$" + max = col + else + min = col + 1 + endif + endwhile + pline = strpart(pline, 0, min - 1) + endif + else + var col = 0 + while col < pline_len + if pline[col] == '#' + pline = strpart(pline, 0, col) + break + endif + col = col + 1 + endwhile + endif + + + # When "inside" parenthesis: If at the first line below the parenthesis add + # one 'shiftwidth' ("inside" is simplified and not really checked) + # my_var = ( + # a + # + b + # + c + # ) + if pline =~ '[({\[]\s*$' + return indent(plnum) + shiftwidth() + endif + + + # If the previous line ended with a colon, indent this line + if pline =~ ':\s*$' + return plindent + shiftwidth() + endif + + # If the previous line was a stop-execution statement... + if getline(plnum) =~ '^\s*\(break\|continue\|raise\|return\|pass\)\>' + # See if the user has already dedented + if indent(v:lnum) > indent(plnum) - shiftwidth() + # If not, recommend one dedent + return indent(plnum) - shiftwidth() + endif + # Otherwise, trust the user + return -1 + endif + + # If the current line begins with a keyword that lines up with "try" + if getline(v:lnum) =~ '^\s*\(except\|finally\)\>' + var lnum = v:lnum - 1 + while lnum >= 1 + if getline(lnum) =~ '^\s*\(try\|except\)\>' + var ind = indent(lnum) + if ind >= indent(v:lnum) + return -1 # indent is already less than this + endif + return ind # line up with previous try or except + endif + lnum = lnum - 1 + endwhile + return -1 # no matching "try"! + endif + + + # If the current line begins with a header keyword, dedent + if getline(v:lnum) =~ '^\s*\(elif\|else\)\>' + + # Unless the previous line was a one-liner + if getline(plnumstart) =~ '^\s*\(for\|if\|try\)\>' + return plindent + endif + + # Or the user has already dedented + if indent(v:lnum) <= plindent - shiftwidth() + return -1 + endif + + return plindent - shiftwidth() + endif + + return -1 +enddef diff --git a/runtime/indent/racket.vim b/runtime/indent/racket.vim new file mode 100644 index 0000000000..93bd38fbff --- /dev/null +++ b/runtime/indent/racket.vim @@ -0,0 +1,60 @@ +" Vim indent file +" Language: Racket +" Maintainer: D. Ben Knoble <ben.knoble+github@gmail.com> +" Previous Maintainer: Will Langstroth <will@langstroth.com> +" URL: https://github.com/benknoble/vim-racket +" Last Change: 2022 Aug 12 + +if exists("b:did_indent") + finish +endif +let b:did_indent = 1 + +setlocal lisp autoindent nosmartindent + +setlocal lispwords+=module,module*,module+,parameterize,let-values,let*-values,letrec-values,local +setlocal lispwords+=define/contract +setlocal lispwords+=λ +setlocal lispwords+=with-handlers +setlocal lispwords+=define-values,opt-lambda,case-lambda,syntax-rules,with-syntax,syntax-case,syntax-parse +setlocal lispwords+=define-for-syntax,define-syntax-parser,define-syntax-parse-rule,define-syntax-class,define-splicing-syntax-class +setlocal lispwords+=define-signature,unit,unit/sig,compund-unit/sig,define-values/invoke-unit/sig +setlocal lispwords+=define-opt/c,define-syntax-rule +setlocal lispwords+=define-test-suite +setlocal lispwords+=struct +setlocal lispwords+=with-input-from-file,with-output-to-file + +" Racket OOP +" TODO missing a lot of define-like forms here (e.g., define/augment, etc.) +setlocal lispwords+=class,class*,mixin,interface,class/derived +setlocal lispwords+=define/public,define/pubment,define/public-final +setlocal lispwords+=define/override,define/overment,define/override-final +setlocal lispwords+=define/augment,define/augride,define/augment-final +setlocal lispwords+=define/private + +" kanren +setlocal lispwords+=fresh,run,run*,project,conde,condu + +" loops +setlocal lispwords+=for,for/list,for/fold,for*,for*/list,for*/fold,for/or,for/and,for*/or,for*/and +setlocal lispwords+=for/hash,for/hasheq,for/hasheqv,for/sum,for/flvector,for*/flvector,for/vector,for*/vector,for*/sum,for*/hash,for*/hasheq,for*/hasheqv +setlocal lispwords+=for/async +setlocal lispwords+=for/set,for*/set +setlocal lispwords+=for/first,for*/first + +setlocal lispwords+=match,match*,match/values,define/match,match-lambda,match-lambda*,match-lambda** +setlocal lispwords+=match-let,match-let*,match-let-values,match-let*-values +setlocal lispwords+=match-letrec,match-define,match-define-values + +setlocal lispwords+=let/cc,let/ec + +" qi +setlocal lispwords+=define-flow,define-switch,flow-lambda,switch-lambda,on,switch,π,λ01 +setlocal lispwords+=define-qi-syntax,define-qi-syntax-parser,define-qi-syntax-rule + +" gui-easy +setlocal lispwords+=if-view,case-view,cond-view,list-view,dyn-view +setlocal lispwords+=case/dep +setlocal lispwords+=define/obs + +let b:undo_indent = "setlocal lisp< ai< si< lw<" diff --git a/runtime/syntax/gdresource.vim b/runtime/syntax/gdresource.vim new file mode 100644 index 0000000000..eb500aa6c2 --- /dev/null +++ b/runtime/syntax/gdresource.vim @@ -0,0 +1,64 @@ +" Vim syntax file for Godot resource (scenes) +" Language: gdresource +" Maintainer: Maxim Kim <habamax@gmail.com> +" Filenames: *.tscn, *.tres + +if exists("b:current_syntax") + finish +endif + +let s:keepcpo= &cpo +set cpo&vim + +syn match gdResourceNumber "\<0x\%(_\=\x\)\+\>" +syn match gdResourceNumber "\<0b\%(_\=[01]\)\+\>" +syn match gdResourceNumber "\<\d\%(_\=\d\)*\>" +syn match gdResourceNumber "\<\d\%(_\=\d\)*\%(e[+-]\=\d\%(_\=\d\)*\)\=\>" +syn match gdResourceNumber "\<\d\%(_\=\d\)*\.\%(e[+-]\=\d\%(_\=\d\)*\)\=\%(\W\|$\)\@=" +syn match gdResourceNumber "\%(^\|\W\)\@1<=\%(\d\%(_\=\d\)*\)\=\.\d\%(_\=\d\)*\%(e[+-]\=\d\%(_\=\d\)*\)\=\>" + +syn keyword gdResourceKeyword true false + +syn region gdResourceString + \ start=+[uU]\="+ end='"' skip='\\\\\|\\"' + \ contains=@Spell keepend + +" Section +syn region gdResourceSection matchgroup=gdResourceSectionDelimiter + \ start='^\[' end=']\s*$' + \ oneline keepend + \ contains=gdResourceSectionName,gdResourceSectionAttribute + +syn match gdResourceSectionName '\[\@<=\S\+' contained skipwhite +syn match gdResourceSectionAttribute '\S\+\s*=\s*\S\+' + \ skipwhite keepend contained + \ contains=gdResourceSectionAttributeName,gdResourceSectionAttributeValue +syn match gdResourceSectionAttributeName '\S\+\ze\(\s*=\)' skipwhite contained +syn match gdResourceSectionAttributeValue '\(=\s*\)\zs\S\+\ze' skipwhite + \ contained + \ contains=gdResourceString,gdResourceNumber,gdResourceKeyword + + +" Section body +syn match gdResourceAttribute '^\s*\S\+\s*=.*$' + \ skipwhite keepend + \ contains=gdResourceAttributeName,gdResourceAttributeValue + +syn match gdResourceAttributeName '\S\+\ze\(\s*=\)' skipwhite contained +syn match gdResourceAttributeValue '\(=\s*\)\zs.*$' skipwhite + \ contained + \ contains=gdResourceString,gdResourceNumber,gdResourceKeyword + + +hi def link gdResourceNumber Constant +hi def link gdResourceKeyword Constant +hi def link gdResourceSectionName Statement +hi def link gdResourceSectionDelimiter Delimiter +hi def link gdResourceSectionAttributeName Type +hi def link gdResourceAttributeName Identifier +hi def link gdResourceString String + +let b:current_syntax = "gdresource" + +let &cpo = s:keepcpo +unlet s:keepcpo diff --git a/runtime/syntax/gdscript.vim b/runtime/syntax/gdscript.vim new file mode 100644 index 0000000000..bf6d47c60d --- /dev/null +++ b/runtime/syntax/gdscript.vim @@ -0,0 +1,104 @@ +" Vim syntax file for Godot gdscript +" Language: gdscript +" Maintainer: Maxim Kim <habamax@gmail.com> +" Filenames: *.gd + +if exists("b:current_syntax") + finish +endif + +let s:keepcpo= &cpo +set cpo&vim + +syntax sync maxlines=100 + +syn keyword gdscriptConditional if else elif match +syn keyword gdscriptRepeat for while break continue + +syn keyword gdscriptOperator is as not and or in + +syn match gdscriptClass "\v<\u\w+>" +syn match gdscriptConstant "\<[_A-Z]\+[0-9_A-Z]*\>" +syn match gdscriptBlockStart ":\s*$" + +syn keyword gdscriptKeyword null self owner parent tool +syn keyword gdscriptBoolean false true + +syn keyword gdscriptStatement remote master puppet remotesync mastersync puppetsync sync +syn keyword gdscriptStatement return pass +syn keyword gdscriptStatement static const enum +syn keyword gdscriptStatement breakpoint assert +syn keyword gdscriptStatement onready +syn keyword gdscriptStatement class_name extends + +syn keyword gdscriptType void bool int float String contained + +syn keyword gdscriptStatement var nextgroup=gdscriptTypeDecl skipwhite +syn keyword gdscriptStatement const nextgroup=gdscriptTypeDecl skipwhite +syn match gdscriptTypeDecl "\h\w*\s*:\s*\h\w*" contains=gdscriptOperator,gdscriptType,gdscriptClass contained skipwhite +syn match gdscriptTypeDecl "->\s*\h\w*" contains=gdscriptOperator,gdscriptType,gdscriptClass skipwhite + +syn keyword gdscriptStatement export nextgroup=gdscriptExportTypeDecl skipwhite +syn match gdscriptExportTypeDecl "(.\{-}[,)]" contains=gdscriptOperator,gdscriptType,gdscriptClass contained skipwhite + +syn keyword gdscriptStatement setget nextgroup=gdscriptSetGet,gdscriptSetGetSeparator skipwhite +syn match gdscriptSetGet "\h\w*" nextgroup=gdscriptSetGetSeparator display contained skipwhite +syn match gdscriptSetGetSeparator "," nextgroup=gdscriptSetGet display contained skipwhite + +syn keyword gdscriptStatement class func signal nextgroup=gdscriptFunctionName skipwhite +syn match gdscriptFunctionName "\h\w*" nextgroup=gdscriptFunctionParams display contained skipwhite +syn match gdscriptFunctionParams "(.*)" contains=gdscriptTypeDecl display contained skipwhite + +syn match gdscriptNode "\$\h\w*\%(/\h\w*\)*" + +syn match gdscriptComment "#.*$" contains=@Spell,gdscriptTodo + +syn region gdscriptString matchgroup=gdscriptQuotes + \ start=+[uU]\=\z(['"]\)+ end="\z1" skip="\\\\\|\\\z1" + \ contains=gdscriptEscape,@Spell + +syn region gdscriptString matchgroup=gdscriptTripleQuotes + \ start=+[uU]\=\z('''\|"""\)+ end="\z1" keepend + \ contains=gdscriptEscape,@Spell + +syn match gdscriptEscape +\\[abfnrtv'"\\]+ contained +syn match gdscriptEscape "\\$" + +" Numbers +syn match gdscriptNumber "\<0x\%(_\=\x\)\+\>" +syn match gdscriptNumber "\<0b\%(_\=[01]\)\+\>" +syn match gdscriptNumber "\<\d\%(_\=\d\)*\>" +syn match gdscriptNumber "\<\d\%(_\=\d\)*\%(e[+-]\=\d\%(_\=\d\)*\)\=\>" +syn match gdscriptNumber "\<\d\%(_\=\d\)*\.\%(e[+-]\=\d\%(_\=\d\)*\)\=\%(\W\|$\)\@=" +syn match gdscriptNumber "\%(^\|\W\)\@1<=\%(\d\%(_\=\d\)*\)\=\.\d\%(_\=\d\)*\%(e[+-]\=\d\%(_\=\d\)*\)\=\>" + +" XXX, TODO, etc +syn keyword gdscriptTodo TODO XXX FIXME HACK NOTE BUG contained + +hi def link gdscriptStatement Statement +hi def link gdscriptKeyword Keyword +hi def link gdscriptConditional Conditional +hi def link gdscriptBoolean Boolean +hi def link gdscriptOperator Operator +hi def link gdscriptRepeat Repeat +hi def link gdscriptSetGet Function +hi def link gdscriptFunctionName Function +hi def link gdscriptClass Type +hi def link gdscriptConstant Constant +hi def link gdscriptBuiltinStruct Typedef +hi def link gdscriptComment Comment +hi def link gdscriptString String +hi def link gdscriptQuotes String +hi def link gdscriptTripleQuotes String +hi def link gdscriptEscape Special +hi def link gdscriptNode PreProc +hi def link gdscriptType Type +hi def link gdscriptNumber Number +hi def link gdscriptBlockStart Special +hi def link gdscriptTodo Todo + + +let b:current_syntax = "gdscript" + +let &cpo = s:keepcpo +unlet s:keepcpo diff --git a/runtime/syntax/gdshader.vim b/runtime/syntax/gdshader.vim new file mode 100644 index 0000000000..f0d9f7edd9 --- /dev/null +++ b/runtime/syntax/gdshader.vim @@ -0,0 +1,57 @@ +" Vim syntax file for Godot shading language +" Language: gdshader +" Maintainer: Maxim Kim <habamax@gmail.com> +" Filenames: *.gdshader + +if exists("b:current_syntax") + finish +endif + +syn keyword gdshaderConditional if else switch case default +syn keyword gdshaderRepeat for while do +syn keyword gdshaderStatement return discard +syn keyword gdshaderBoolean true false + +syn keyword gdshaderKeyword shader_type render_mode +syn keyword gdshaderKeyword in out inout +syn keyword gdshaderKeyword lowp mediump highp +syn keyword gdshaderKeyword uniform varying const +syn keyword gdshaderKeyword flat smooth + +syn keyword gdshaderType float vec2 vec3 vec4 +syn keyword gdshaderType uint uvec2 uvec3 uvec4 +syn keyword gdshaderType int ivec2 ivec3 ivec4 +syn keyword gdshaderType void bool +syn keyword gdshaderType bvec2 bvec3 bvec4 +syn keyword gdshaderType mat2 mat3 mat4 +syn keyword gdshaderType sampler2D isampler2D usampler2D samplerCube + +syn match gdshaderMember "\v<(\.)@<=[a-z_]+\w*>" +syn match gdshaderBuiltin "\v<[A-Z_]+[A-Z0-9_]*>" +syn match gdshaderFunction "\v<\w*>(\()@=" + +syn match gdshaderNumber "\v<\d+(\.)@!>" +syn match gdshaderFloat "\v<\d*\.\d+(\.)@!>" +syn match gdshaderFloat "\v<\d*\.=\d+(e-=\d+)@=" +syn match gdshaderExponent "\v(\d*\.=\d+)@<=e-=\d+>" + +syn match gdshaderComment "\v//.*$" contains=@Spell +syn region gdshaderComment start="/\*" end="\*/" contains=@Spell +syn keyword gdshaderTodo TODO FIXME XXX NOTE BUG HACK OPTIMIZE containedin=gdshaderComment + +hi def link gdshaderConditional Conditional +hi def link gdshaderRepeat Repeat +hi def link gdshaderStatement Statement +hi def link gdshaderBoolean Boolean +hi def link gdshaderKeyword Keyword +hi def link gdshaderMember Identifier |