codekingpro/portable-devtools
114k
1" Vim filetype plugin2" Language: Forth3" Maintainer: Johan Kotlinski <kotlinski@gmail.com>4" Last Change: 2023 Sep 155" 2024 Jan 14 by Vim Project (browsefilter)6" URL: https://github.com/jkotlinski/forth.vim7 8if exists("b:did_ftplugin")9 finish10endif11let b:did_ftplugin = 112 13let s:cpo_save = &cpo14set cpo&vim15 16setlocal commentstring=\\\ %s17setlocal comments=s:(,mb:\ ,e:),b:\\18setlocal iskeyword=33-126,128-25519 20let s:include_patterns =<< trim EOL21 22 \<\%(INCLUDE\|REQUIRE\)\>\s\+\zs\k\+\ze23 \<S"\s\+\zs[^"]*\ze"\s\+\%(INCLUDED\|REQUIRED\)\>24EOL25let &l:include = $'\c{ s:include_patterns[1:]->join('\|') }'26 27let s:define_patterns =<< trim EOL28 :29 [2F]\=CONSTANT30 [2F]\=VALUE31 [2F]\=VARIABLE32 BEGIN-STRUCTURE33 BUFFER:34 CODE35 CREATE36 MARKER37 SYNONYM38EOL39let &l:define = $'\c\<\%({ s:define_patterns->join('\|') }\)'40 41" assume consistent intra-project file extensions42let &l:suffixesadd = "." .. expand("%:e")43 44let b:undo_ftplugin = "setl cms< com< def< inc< isk< sua<"45 46if exists("loaded_matchit") && !exists("b:match_words")47 let s:matchit_patterns =<< trim EOL48 49 \<\:\%(NONAME\)\=\>:\<EXIT\>:\<;\>50 \<IF\>:\<ELSE\>:\<THEN\>51 \<\[IF]\>:\<\[ELSE]\>:\<\[THEN]\>52 \<?\=DO\>:\<LEAVE\>:\<+\=LOOP\>53 \<CASE\>:\<ENDCASE\>54 \<OF\>:\<ENDOF\>55 \<BEGIN\>:\<WHILE\>:\<\%(AGAIN\|REPEAT\|UNTIL\)\>56 \<CODE\>:\<END-CODE\>57 \<BEGIN-STRUCTURE\>:\<END-STRUCTURE\>58 EOL59 let b:match_ignorecase = 160 let b:match_words = s:matchit_patterns[1:]->join(',')61 let b:undo_ftplugin ..= "| unlet! b:match_ignorecase b:match_words"62 unlet s:matchit_patterns63endif64 65if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter")66 let b:browsefilter = "Forth Source Files (*.f, *.fs, *.ft, *.fth, *.4th)\t*.f;*.fs;*.ft;*.fth;*.4th\n"67 if has("win32")68 let b:browsefilter ..= "All Files (*.*)\t*\n"69 else70 let b:browsefilter ..= "All Files (*)\t*\n"71 endif72 let b:undo_ftplugin ..= " | unlet! b:browsefilter"73endif74 75let &cpo = s:cpo_save76unlet s:cpo_save77unlet s:define_patterns s:include_patterns78 