robin/laufey

git clone https://git.robinwobin.dev/robin/laufey

Christian Clasonvim-patch:93197fde0f1d7ed6966023

master
2.0 KiB77 linesraw
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")
9  finish
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
32  BEGIN-STRUCTURE
33  BUFFER:
34  CODE
35  CREATE
36  MARKER
37  SYNONYM
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")
47  let 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\>
58  EOL
59  let b:match_ignorecase = 1
60  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_patterns
63endif
64
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  else
70    let b:browsefilter ..= "All Files (*)\t*\n"
71  endif
72  let b:undo_ftplugin ..= " | unlet! b:browsefilter"
73endif
74
75let &cpo = s:cpo_save
76unlet s:cpo_save
77unlet s:define_patterns s:include_patterns