annotate runtime/ftplugin/octave.vim @ 30422:52b7188f13b1

Added tag v9.0.0546 for changeset 425b686c5244788b67d1205e696f6d04bedb0f24
author Bram Moolenaar <Bram@vim.org>
date Thu, 22 Sep 2022 17:15:04 +0200
parents 11b656e74444
children 8ae680be2a51
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
25773
11b656e74444 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1 " Vim filetype plugin file
11b656e74444 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2 " Language: GNU Octave
11b656e74444 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3 " Maintainer: Doug Kearns <dougkearns@gmail.com>
11b656e74444 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
4 " Last Change: 2021 Sep 02
11b656e74444 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
5
11b656e74444 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
6 if exists("b:did_ftplugin")
11b656e74444 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
7 finish
11b656e74444 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
8 endif
11b656e74444 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
9 let b:did_ftplugin = 1
11b656e74444 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
10
11b656e74444 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
11 let s:cpo_save = &cpo
11b656e74444 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
12 set cpo&vim
11b656e74444 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
13
11b656e74444 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
14 " TODO: update Matlab ftplugin and source it as the base file?
11b656e74444 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
15
11b656e74444 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
16 setlocal comments=s:%{,m:\ ,e:%},s:#{,m:\ ,e:#},:%,:#
11b656e74444 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
17 setlocal commentstring=#\ %s
11b656e74444 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
18 setlocal formatoptions-=t formatoptions+=croql
11b656e74444 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
19
11b656e74444 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
20 setlocal keywordprg=info\ octave\ --vi-keys\ --index-search
11b656e74444 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
21
11b656e74444 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
22 if exists("loaded_matchit") && !exists("b:match_words")
11b656e74444 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
23 let b:match_words = '\<unwind_protect\>:\<unwind_protect_cleanup\>:\<end_unwind_protect\>'
11b656e74444 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
24 if exists("octave_use_matlab_end")
11b656e74444 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
25 let b:match_words ..= ',' ..
11b656e74444 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
26 \ '\<\%(classdef\|enumeration\|events\|for\|function\|if\|methods\|parfor\|properties\|switch\|while\|try\)\>' ..
11b656e74444 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
27 \ ':' ..
11b656e74444 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
28 \ '\<\%(elseif\|else\|case\|otherwise\|break\|continue\|catch\)\>' ..
11b656e74444 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
29 \ ':' ..
11b656e74444 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
30 \ '\<end\>'
11b656e74444 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
31 else
11b656e74444 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
32 let b:match_words ..= ',' ..
11b656e74444 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
33 \ '\<classdef\>:\<endclassdef\>,' ..
11b656e74444 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
34 \ '\<enumeration\>:\<endenumeration\>,' ..
11b656e74444 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
35 \ '\<events\>:\<endevents\>,' ..
11b656e74444 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
36 \ '\<do\>:\<\%(break\|continue\)\>:\<until\>' ..
11b656e74444 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
37 \ '\<for\>:\<\%(break\|continue\)\>:\<endfor\>,' ..
11b656e74444 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
38 \ '\<function\>:\<return\>:\<endfunction\>,' ..
11b656e74444 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
39 \ '\<if\>:\<\%(elseif\|else\)\>:\<endif\>,' ..
11b656e74444 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
40 \ '\<methods\>:\<endmethods\>,' ..
11b656e74444 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
41 \ '\<parfor\>:\<endparfor\>,' ..
11b656e74444 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
42 \ '\<properties\>:\<endproperties\>,' ..
11b656e74444 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
43 \ '\<switch\>:\<\%(case\|otherwise\)\>:\<endswitch\>,' ..
11b656e74444 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
44 \ '\<while\>:\<\%(break\|continue\)\>:\<endwhile\>,' ..
11b656e74444 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
45 \ '\<try\>:\<catch\>:\<end_try_catch\>'
11b656e74444 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
46 endif
11b656e74444 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
47 " only match in statement position
11b656e74444 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
48 let s:statement_start = escape('\%(\%(^\|;\)\s*\)\@<=', '\')
11b656e74444 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
49 let b:match_words = substitute(b:match_words, '\\<', s:statement_start, 'g')
11b656e74444 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
50 endif
11b656e74444 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
51
11b656e74444 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
52 if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter")
11b656e74444 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
53 let b:browsefilter = "GNU Octave Source Files (*.m)\t*.m\n" ..
11b656e74444 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
54 \ "All Files (*.*)\t*.*\n"
11b656e74444 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
55 endif
11b656e74444 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
56
11b656e74444 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
57 let b:undo_ftplugin = "setl com< cms< fo< kp< " ..
11b656e74444 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
58 \ "| unlet! b:browsefilter b:match_words"
11b656e74444 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
59
11b656e74444 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
60 let &cpo = s:cpo_save
11b656e74444 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
61 unlet s:cpo_save
11b656e74444 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
62
11b656e74444 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
63 " vim: nowrap sw=2 sts=2 ts=8 noet: