robin/laufey
git clone https://git.robinwobin.dev/robin/laufey
7ed6966023
master
1" Vim filetype plugin 2" Language: Forth 3" Maintainer: Johan Kotlinski <kotlinski@gmail.com> 4" Last Change: 2023 Sep 15 5" 2024 Jan 14 by Vim Project (browsefilter) 6" URL: https://github.com/jkotlinski/forth.vim 7 8if exists ( "b:did_ftplugin" ) 9finish 10endif 11let b: did_ftplugin = 1 12 13let s: cpo_save = & cpo 14set cpo & vim 15 16setlocal commentstring = \\\ %s 17setlocal comments = s:(,mb:\ ,e:),b:\\ 18setlocal iskeyword = 33-126,128-255 19 20let s: include_patterns =<< trim EOL 21 22 \<\%(INCLUDE\|REQUIRE\)\>\s\+\zs\k\+\ze 23\<S"\s\+\zs[^"]*\ze"\s\+\%(INCLUDED\|REQUIRED\)\> 24EOL 25let & l: include = $ '\c{s: include_patterns [ 1 :] ->join ( '\|' ) } ' 26 27let s: define_patterns =<< trim EOL 28: 29[2F]\=CONSTANT 30[2F]\=VALUE 31[2F]\=VARIABLE 32BEGIN-STRUCTURE 33BUFFER: 34CODE 35CREATE 36MARKER 37SYNONYM 38EOL 39let & l: define = $ '\c\<\%({s: define_patterns ->join ( '\|' ) } \)' 40 41" assume consistent intra-project file extensions 42let & 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" ) 47let s: matchit_patterns =<< trim EOL 48 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\> 58EOL 59let b: match_ignorecase = 1 60let b: match_words = s: matchit_patterns [ 1 :] ->join ( ',' ) 61let b: undo_ftplugin ..= "| unlet! b:match_ignorecase b:match_words" 62unlet s: matchit_patterns 63endif 64 65if ( has ( "gui_win32" ) || has ( "gui_gtk" )) && ! exists ( "b:browsefilter" ) 66let b: browsefilter = "Forth Source Files (*.f, *.fs, *.ft, *.fth, *.4th)\t*.f;*.fs;*.ft;*.fth;*.4th\n" 67if has ( "win32" ) 68let b: browsefilter ..= "All Files (*.*)\t*\n" 69else 70let b: browsefilter ..= "All Files (*)\t*\n" 71endif 72let b: undo_ftplugin ..= " | unlet! b:browsefilter" 73endif 74 75let & cpo = s: cpo_save 76unlet s: cpo_save 77unlet s: define_patterns s: include_patterns