annotate runtime/ftplugin/basic.vim @ 33825:d515e012d713 v9.0.2128

patch 9.0.2128: runtime(swig): add syntax and filetype plugins Commit: https://github.com/vim/vim/commit/2e31065a650015892179e520038bf2083a9519b6 Author: Julien Marrec <julien.marrec@gmail.com> Date: Sat Nov 25 15:30:46 2023 +0100 patch 9.0.2128: runtime(swig): add syntax and filetype plugins Add syntax and filetype plugins for SWIG (Simplified Wrapper Interface Generator) description files. The default syntax for .i files highlights comments in a reverse color scheme which doesn't look well. This syntax builds on vim's c++ syntax by adding highlighting for common swig directives and user defined directives. For an alternative syntax, see vimscript #1247 (which I found after writing this). closes: #13562 Co-authored-by: Mat?j Cepl <mcepl@cepl.eu> Co-authored-by: Julien Marrec <julien.marrec@gmail.com> Signed-off-by: Julien Marrec <julien.marrec@gmail.com> Signed-off-by: Doug Kearns <dougkearns@gmail.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
author Christian Brabandt <cb@256bit.org>
date Sat, 25 Nov 2023 15:45:06 +0100
parents 912224cab37f
children 8ae680be2a51
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
23737
34b4eb3a8458 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1 " Vim filetype plugin file
27459
5825405e4e2c Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 23737
diff changeset
2 " Language: BASIC (QuickBASIC 4.5)
23737
34b4eb3a8458 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3 " Maintainer: Doug Kearns <dougkearns@gmail.com>
29352
912224cab37f Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 27459
diff changeset
4 " Last Change: 2022 Jun 22
23737
34b4eb3a8458 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
5
34b4eb3a8458 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
6 if exists("b:did_ftplugin")
34b4eb3a8458 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
7 finish
34b4eb3a8458 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
8 endif
34b4eb3a8458 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
9 let b:did_ftplugin = 1
34b4eb3a8458 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
10
34b4eb3a8458 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
11 let s:cpo_save = &cpo
34b4eb3a8458 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
12 set cpo&vim
34b4eb3a8458 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
13
27459
5825405e4e2c Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 23737
diff changeset
14 setlocal comments=:REM\ ,:Rem\ ,:rem\ ,:'
23737
34b4eb3a8458 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
15 setlocal commentstring='\ %s
34b4eb3a8458 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
16 setlocal formatoptions-=t formatoptions+=croql
34b4eb3a8458 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
17
29352
912224cab37f Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 27459
diff changeset
18 let b:undo_ftplugin = "setl fo< com< cms<"
912224cab37f Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 27459
diff changeset
19
27459
5825405e4e2c Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 23737
diff changeset
20 " TODO: support exit ... as middle matches?
5825405e4e2c Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 23737
diff changeset
21 if exists("loaded_matchit") && !exists("b:match_words")
5825405e4e2c Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 23737
diff changeset
22 let s:line_start = '\%(^\s*\)\@<='
5825405e4e2c Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 23737
diff changeset
23 let s:not_end = '\%(end\s\+\)\@<!'
5825405e4e2c Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 23737
diff changeset
24 let s:not_end_or_exit = '\%(\%(end\|exit\)\s\+\)\@<!'
5825405e4e2c Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 23737
diff changeset
25
5825405e4e2c Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 23737
diff changeset
26 let b:match_ignorecase = 1
5825405e4e2c Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 23737
diff changeset
27 let b:match_words =
5825405e4e2c Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 23737
diff changeset
28 \ s:not_end_or_exit .. '\<def\s\+fn:\<end\s\+def\>,' ..
5825405e4e2c Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 23737
diff changeset
29 \ s:not_end_or_exit .. '\<function\>:\<end\s\+function\>,' ..
5825405e4e2c Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 23737
diff changeset
30 \ s:not_end_or_exit .. '\<sub\>:\<end\s\+sub\>,' ..
5825405e4e2c Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 23737
diff changeset
31 \ s:not_end .. '\<type\>:\<end\s\+type\>,' ..
5825405e4e2c Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 23737
diff changeset
32 \ s:not_end .. '\<select\>:\%(select\s\+\)\@<!\<case\%(\s\+\%(else\|is\)\)\=\>:\<end\s\+select\>,' ..
5825405e4e2c Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 23737
diff changeset
33 \ '\<do\>:\<loop\>,' ..
5825405e4e2c Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 23737
diff changeset
34 \ '\<for\>\%(\s\+\%(input\|output\|random\|append\|binary\)\)\@!:\<next\>,' ..
5825405e4e2c Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 23737
diff changeset
35 \ '\<while\>:\<wend\>,' ..
5825405e4e2c Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 23737
diff changeset
36 \ s:line_start .. 'if\%(.*\<then\s*\%($\|''\)\)\@=:\<\%(' .. s:line_start .. 'else\|elseif\)\>:\<end\s\+if\>,' ..
5825405e4e2c Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 23737
diff changeset
37 \ '\<lock\>:\<unlock\>'
5825405e4e2c Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 23737
diff changeset
38 let b:match_skip = 'synIDattr(synID(line("."),col("."),1),"name") =~? "comment\\|string" || ' ..
5825405e4e2c Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 23737
diff changeset
39 \ 'strpart(getline("."), 0, col(".") ) =~? "\\<exit\\s\\+"'
5825405e4e2c Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 23737
diff changeset
40
29352
912224cab37f Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 27459
diff changeset
41 let b:undo_ftplugin ..= " | unlet! b:match_ignorecase b:match_skip b:match_words"
912224cab37f Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 27459
diff changeset
42
27459
5825405e4e2c Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 23737
diff changeset
43 unlet s:line_start s:not_end s:not_end_or_exit
23737
34b4eb3a8458 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
44 endif
34b4eb3a8458 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
45
27459
5825405e4e2c Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 23737
diff changeset
46 if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter")
5825405e4e2c Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 23737
diff changeset
47 let b:browsefilter = "BASIC Source Files (*.bas)\t*.bas\n" ..
5825405e4e2c Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 23737
diff changeset
48 \ "BASIC Include Files (*.bi, *.bm)\t*.bi;*.bm\n" ..
5825405e4e2c Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 23737
diff changeset
49 \ "All Files (*.*)\t*.*\n"
29352
912224cab37f Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 27459
diff changeset
50 let b:basic_set_browsefilter = 1
912224cab37f Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 27459
diff changeset
51 let b:undo_ftplugin ..= " | unlet! b:browsefilter b:basic_set_browsefilter"
27459
5825405e4e2c Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 23737
diff changeset
52 endif
5825405e4e2c Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 23737
diff changeset
53
23737
34b4eb3a8458 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
54 let &cpo = s:cpo_save
34b4eb3a8458 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
55 unlet s:cpo_save
27459
5825405e4e2c Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 23737
diff changeset
56
5825405e4e2c Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 23737
diff changeset
57 " vim: nowrap sw=2 sts=2 ts=8 noet fdm=marker: