Mercurial > vim
annotate runtime/ftplugin/abaqus.vim @ 31798:5948cc887603 v9.0.1231
patch 9.0.1231: completion of :runtime does not handle {where} argument
Commit: https://github.com/vim/vim/commit/3770f4c9cde7b5fcd10b6fa2e665cd0b69450fb2
Author: zeertzjq <zeertzjq@outlook.com>
Date: Sun Jan 22 18:38:51 2023 +0000
patch 9.0.1231: completion of :runtime does not handle {where} argument
Problem: Completion of :runtime does not handle {where} argument.
Solution: Parse the {where} argument. (closes https://github.com/vim/vim/issues/11863)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sun, 22 Jan 2023 19:45:04 +0100 |
parents | 3295247d97a5 |
children | 8ae680be2a51 |
rev | line source |
---|---|
7 | 1 " Vim filetype plugin file |
2 " Language: Abaqus finite element input file (www.abaqus.com) | |
29659 | 3 " Maintainer: Carl Osterwisch <costerwi@gmail.com> |
30875 | 4 " Last Change: 2022 Oct 08 |
7 | 5 |
6 " Only do this when not done yet for this buffer | |
7 if exists("b:did_ftplugin") | finish | endif | |
8 | |
9 " Don't load another plugin for this buffer | |
10 let b:did_ftplugin = 1 | |
11 | |
12 " Save the compatibility options and temporarily switch to vim defaults | |
13 let s:cpo_save = &cpoptions | |
14 set cpoptions&vim | |
15 | |
16 " Set the format of the include file specification for Abaqus | |
17 " Used in :check gf ^wf [i and other commands | |
18 setlocal include=\\<\\cINPUT\\s*= | |
19 | |
20 " Remove characters up to the first = when evaluating filenames | |
21 setlocal includeexpr=substitute(v:fname,'.\\{-}=','','') | |
22 | |
15 | 23 " Remove comma from valid filename characters since it is used to |
24 " separate keyword parameters | |
25 setlocal isfname-=, | |
26 | |
7 | 27 " Define format of comment lines (see 'formatoptions' for uses) |
28 setlocal comments=:** | |
29 setlocal commentstring=**%s | |
30 | |
31 " Definitions start with a * and assign a NAME, NSET, or ELSET | |
32 " Used in [d ^wd and other commands | |
33 setlocal define=^\\*\\a.*\\c\\(NAME\\\|NSET\\\|ELSET\\)\\s*= | |
34 | |
35 " Abaqus keywords and identifiers may include a - character | |
36 setlocal iskeyword+=- | |
37 | |
2034 | 38 let b:undo_ftplugin = "setlocal include< includeexpr< isfname<" |
39 \ . " comments< commentstring< define< iskeyword<" | |
40 | |
41 if has("folding") | |
42 " Fold all lines that do not begin with * | |
43 setlocal foldexpr=getline(v:lnum)[0]!=\"\*\" | |
44 setlocal foldmethod=expr | |
45 let b:undo_ftplugin .= " foldexpr< foldmethod<" | |
46 endif | |
47 | |
7 | 48 " Set the file browse filter (currently only supported under Win32 gui) |
29659 | 49 if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter") |
7 | 50 let b:browsefilter = "Abaqus Input Files (*.inp *.inc)\t*.inp;*.inc\n" . |
51 \ "Abaqus Results (*.dat)\t*.dat\n" . | |
52 \ "Abaqus Messages (*.pre *.msg *.sta)\t*.pre;*.msg;*.sta\n" . | |
53 \ "All Files (*.*)\t*.*\n" | |
3496
d1e4abe8342c
Fixed compatible mode in most runtime files.
Bram Moolenaar <bram@vim.org>
parents:
3410
diff
changeset
|
54 let b:undo_ftplugin .= "|unlet! b:browsefilter" |
7 | 55 endif |
56 | |
2034 | 57 " Define patterns for the matchit plugin |
58 if exists("loaded_matchit") && !exists("b:match_words") | |
59 let b:match_ignorecase = 1 | |
29659 | 60 let b:match_words = |
2034 | 61 \ '\*part:\*end\s*part,' . |
62 \ '\*assembly:\*end\s*assembly,' . | |
63 \ '\*instance:\*end\s*instance,' . | |
64 \ '\*step:\*end\s*step' | |
3496
d1e4abe8342c
Fixed compatible mode in most runtime files.
Bram Moolenaar <bram@vim.org>
parents:
3410
diff
changeset
|
65 let b:undo_ftplugin .= "|unlet! b:match_ignorecase b:match_words" |
2034 | 66 endif |
67 | |
29659 | 68 if !exists("no_plugin_maps") && !exists("no_abaqus_maps") |
30875 | 69 " Map [[ and ]] keys to move [count] keywords backward or forward |
70 nnoremap <silent><buffer> ]] :call <SID>Abaqus_NextKeyword(1)<CR> | |
71 nnoremap <silent><buffer> [[ :call <SID>Abaqus_NextKeyword(-1)<CR> | |
72 function! <SID>Abaqus_NextKeyword(direction) | |
73 .mark ' | |
74 if a:direction < 0 | |
75 let flags = 'b' | |
76 else | |
77 let flags = '' | |
78 endif | |
79 let l:count = abs(a:direction) * v:count1 | |
80 while l:count > 0 && search("^\\*\\a", flags) | |
81 let l:count -= 1 | |
82 endwhile | |
83 endfunction | |
7 | 84 |
30875 | 85 " Map \\ to toggle commenting of the current line or range |
29659 | 86 noremap <silent><buffer> <LocalLeader><LocalLeader> |
87 \ :call <SID>Abaqus_ToggleComment()<CR>j | |
88 function! <SID>Abaqus_ToggleComment() range | |
30875 | 89 if strpart(getline(a:firstline), 0, 2) == "**" |
90 " Un-comment all lines in range | |
91 silent execute a:firstline . ',' . a:lastline . 's/^\*\*//' | |
92 else | |
93 " Comment all lines in range | |
94 silent execute a:firstline . ',' . a:lastline . 's/^/**/' | |
95 endif | |
96 endfunction | |
97 | |
98 " Map \s to swap first two comma separated fields | |
99 noremap <silent><buffer> <LocalLeader>s :call <SID>Abaqus_Swap()<CR> | |
100 function! <SID>Abaqus_Swap() range | |
101 silent execute a:firstline . ',' . a:lastline . 's/\([^*,]*\),\([^,]*\)/\2,\1/' | |
29659 | 102 endfunction |
7 | 103 |
29659 | 104 let b:undo_ftplugin .= "|unmap <buffer> [[|unmap <buffer> ]]" |
105 \ . "|unmap <buffer> <LocalLeader><LocalLeader>" | |
30875 | 106 \ . "|unmap <buffer> <LocalLeader>s" |
29659 | 107 endif |
2034 | 108 |
3496
d1e4abe8342c
Fixed compatible mode in most runtime files.
Bram Moolenaar <bram@vim.org>
parents:
3410
diff
changeset
|
109 " Undo must be done in nocompatible mode for <LocalLeader>. |
28808
0f0fed554cdc
Update runtime files, translations
Bram Moolenaar <Bram@vim.org>
parents:
3496
diff
changeset
|
110 let b:undo_ftplugin = "let b:cpo_save = &cpoptions|" |
3496
d1e4abe8342c
Fixed compatible mode in most runtime files.
Bram Moolenaar <bram@vim.org>
parents:
3410
diff
changeset
|
111 \ . "set cpoptions&vim|" |
d1e4abe8342c
Fixed compatible mode in most runtime files.
Bram Moolenaar <bram@vim.org>
parents:
3410
diff
changeset
|
112 \ . b:undo_ftplugin |
28808
0f0fed554cdc
Update runtime files, translations
Bram Moolenaar <Bram@vim.org>
parents:
3496
diff
changeset
|
113 \ . "|let &cpoptions = b:cpo_save" |
0f0fed554cdc
Update runtime files, translations
Bram Moolenaar <Bram@vim.org>
parents:
3496
diff
changeset
|
114 \ . "|unlet b:cpo_save" |
3496
d1e4abe8342c
Fixed compatible mode in most runtime files.
Bram Moolenaar <bram@vim.org>
parents:
3410
diff
changeset
|
115 |
7 | 116 " Restore saved compatibility options |
117 let &cpoptions = s:cpo_save | |
3410
94601b379f38
Updated runtime files. Add Dutch translations.
Bram Moolenaar <bram@vim.org>
parents:
2034
diff
changeset
|
118 unlet s:cpo_save |