From 2fad4c0b392bb9d7fbb742be1fd5d214683b8ebb Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Thu, 31 Aug 2023 08:21:25 +0200 Subject: vim-patch:1610528cc305 runtime(forth): Update syntax and ftplugin files (vim/vim#12976) https://github.com/vim/vim/commit/1610528cc3052103e368c4175b09db6f9a6c150c Co-authored-by: dkearns --- runtime/ftplugin/forth.vim | 71 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 runtime/ftplugin/forth.vim (limited to 'runtime/ftplugin/forth.vim') diff --git a/runtime/ftplugin/forth.vim b/runtime/ftplugin/forth.vim new file mode 100644 index 0000000000..5343784a21 --- /dev/null +++ b/runtime/ftplugin/forth.vim @@ -0,0 +1,71 @@ +" Vim filetype plugin +" Language: Forth +" Maintainer: Johan Kotlinski +" Last Change: 2023 Aug 08 +" URL: https://github.com/jkotlinski/forth.vim + +if exists("b:did_ftplugin") + finish +endif +let b:did_ftplugin = 1 + +let s:cpo_save = &cpo +set cpo&vim + +setlocal commentstring=\\\ %s +setlocal comments=s:(,mb:\ ,e:),b:\\ +setlocal iskeyword=33-126,128-255 + +let s:include_patterns =<< trim EOL + + \<\%(INCLUDE\|REQUIRE\)\>\s\+\zs\k\+\ze + \ +EOL +let &l:include = $'\c{ s:include_patterns[1:]->join('\|') }' + +let s:define_patterns =<< trim EOL + : + [2F]\=CONSTANT + [2F]\=VALUE + [2F]\=VARIABLE + BEGIN-STRUCTURE + BUFFER: + CODE + CREATE + MARKER + SYNONYM +EOL +let &l:define = $'\c\<\%({ s:define_patterns->join('\|') }\)' + +" assume consistent intra-project file extensions +let &l:suffixesadd = "." .. expand("%:e") + +let b:undo_ftplugin = "setl cms< com< def< inc< isk< sua<" + +if exists("loaded_matchit") && !exists("b:match_words") + let s:matchit_patterns =<< trim EOL + + \<\:\%(NONAME\)\=\>:\:\<;\> + \:\:\ + \<\[IF]\>:\<\[ELSE]\>:\<\[THEN]\> + \:\:\<+\=LOOP\> + \:\ + \:\ + \:\:\<\%(AGAIN\|REPEAT\|UNTIL\)\> + \:\ + \:\ + EOL + let b:match_ignorecase = 1 + let b:match_words = s:matchit_patterns[1:]->join(',') + let b:undo_ftplugin ..= "| unlet! b:match_ignorecase b:match_words" +endif + +if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter") + let b:browsefilter = "Forth Source Files (*.f *.fs *.ft *.fth *.4th)\t*.f;*.fs;*.ft;*.fth;*.4th\n" .. + \ "All Files (*.*)\t*.*\n" + let b:undo_ftplugin ..= " | unlet! b:browsefilter" +endif + +let &cpo = s:cpo_save +unlet s:cpo_save +unlet s:define_patterns s:include_patterns s:matchit_patterns -- cgit From be10d65bfafe056025ffffa2c1131712b9a493a5 Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Fri, 15 Sep 2023 16:50:03 +0200 Subject: vim-patch:c1f8bb37c6a8 runtime(forth): Fix :unlet error in ftplugin (vim/vim#13090) Fixes vim/vim#13089. https://github.com/vim/vim/commit/c1f8bb37c6a8e0babc2a41f16860763b57c23fa1 Co-authored-by: dkearns --- runtime/ftplugin/forth.vim | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'runtime/ftplugin/forth.vim') diff --git a/runtime/ftplugin/forth.vim b/runtime/ftplugin/forth.vim index 5343784a21..d28c8484e1 100644 --- a/runtime/ftplugin/forth.vim +++ b/runtime/ftplugin/forth.vim @@ -1,7 +1,7 @@ " Vim filetype plugin " Language: Forth " Maintainer: Johan Kotlinski -" Last Change: 2023 Aug 08 +" Last Change: 2023 Sep 15 " URL: https://github.com/jkotlinski/forth.vim if exists("b:did_ftplugin") @@ -58,6 +58,7 @@ if exists("loaded_matchit") && !exists("b:match_words") let b:match_ignorecase = 1 let b:match_words = s:matchit_patterns[1:]->join(',') let b:undo_ftplugin ..= "| unlet! b:match_ignorecase b:match_words" + unlet s:matchit_patterns endif if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter") @@ -68,4 +69,4 @@ endif let &cpo = s:cpo_save unlet s:cpo_save -unlet s:define_patterns s:include_patterns s:matchit_patterns +unlet s:define_patterns s:include_patterns -- cgit