annotate runtime/ftplugin/vhdl.vim @ 34550:4d8d41b7a8eb v9.1.0176

patch 9.1.0176: Cursor column wrong with 'virtualedit' and conceal Commit: https://github.com/vim/vim/commit/253ff4dece4e6cc4a9ff3ed935bc78f832b6fb7c Author: zeertzjq <zeertzjq@outlook.com> Date: Wed Mar 13 20:38:26 2024 +0100 patch 9.1.0176: Cursor column wrong with 'virtualedit' and conceal Problem: Cursor column wrong with 'virtualedit' and conceal. Solution: Correct cursor column at end of line if never reached. (zeertzjq) closes: #14190 Signed-off-by: zeertzjq <zeertzjq@outlook.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
author Christian Brabandt <cb@256bit.org>
date Wed, 13 Mar 2024 20:45:02 +0100
parents 8ae680be2a51
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
671
83a006f81bac updated for version 7.0199
vimboss
parents: 153
diff changeset
1 " VHDL filetype plugin
83a006f81bac updated for version 7.0199
vimboss
parents: 153
diff changeset
2 " Language: VHDL
3224
8b8ef1fed009 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 671
diff changeset
3 " Maintainer: R.Shankar <shankar.pec?gmail.com>
671
83a006f81bac updated for version 7.0199
vimboss
parents: 153
diff changeset
4 " Modified By: Gerald Lai <laigera+vim?gmail.com>
3224
8b8ef1fed009 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 671
diff changeset
5 " Last Change: 2011 Dec 11
34134
8ae680be2a51 runtime(ftplugin): Use "*" browsefilter pattern to match "All Files"
Christian Brabandt <cb@256bit.org>
parents: 33051
diff changeset
6 " 2024 Jan 14 by Vim Project (browsefilter)
33051
02939ae3aaca runtime: Set b:undo_ftplugin where missing (#12943)
Christian Brabandt <cb@256bit.org>
parents: 3224
diff changeset
7 " 2023 Aug 28 by Vim Project (undo_ftplugin, commentstring)
153
19670b05ee32 updated for version 7.0047
vimboss
parents:
diff changeset
8
19670b05ee32 updated for version 7.0047
vimboss
parents:
diff changeset
9 " Only do this when not done yet for this buffer
19670b05ee32 updated for version 7.0047
vimboss
parents:
diff changeset
10 if exists("b:did_ftplugin")
19670b05ee32 updated for version 7.0047
vimboss
parents:
diff changeset
11 finish
19670b05ee32 updated for version 7.0047
vimboss
parents:
diff changeset
12 endif
19670b05ee32 updated for version 7.0047
vimboss
parents:
diff changeset
13
19670b05ee32 updated for version 7.0047
vimboss
parents:
diff changeset
14 " Don't load another plugin for this buffer
19670b05ee32 updated for version 7.0047
vimboss
parents:
diff changeset
15 let b:did_ftplugin = 1
19670b05ee32 updated for version 7.0047
vimboss
parents:
diff changeset
16
3224
8b8ef1fed009 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 671
diff changeset
17 let s:cpo_save = &cpo
8b8ef1fed009 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 671
diff changeset
18 set cpo&vim
8b8ef1fed009 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 671
diff changeset
19
153
19670b05ee32 updated for version 7.0047
vimboss
parents:
diff changeset
20 " Set 'formatoptions' to break comment lines but not other lines,
19670b05ee32 updated for version 7.0047
vimboss
parents:
diff changeset
21 " and insert the comment leader when hitting <CR> or using "o".
19670b05ee32 updated for version 7.0047
vimboss
parents:
diff changeset
22 "setlocal fo-=t fo+=croqlm1
19670b05ee32 updated for version 7.0047
vimboss
parents:
diff changeset
23
19670b05ee32 updated for version 7.0047
vimboss
parents:
diff changeset
24 " Set 'comments' to format dashed lists in comments.
19670b05ee32 updated for version 7.0047
vimboss
parents:
diff changeset
25 "setlocal comments=sO:*\ -,mO:*\ \ ,exO:*/,s1:/*,mb:*,ex:*/,://
19670b05ee32 updated for version 7.0047
vimboss
parents:
diff changeset
26
33051
02939ae3aaca runtime: Set b:undo_ftplugin where missing (#12943)
Christian Brabandt <cb@256bit.org>
parents: 3224
diff changeset
27 setlocal commentstring=--\ %s
02939ae3aaca runtime: Set b:undo_ftplugin where missing (#12943)
Christian Brabandt <cb@256bit.org>
parents: 3224
diff changeset
28
153
19670b05ee32 updated for version 7.0047
vimboss
parents:
diff changeset
29 " Format comments to be up to 78 characters long
671
83a006f81bac updated for version 7.0199
vimboss
parents: 153
diff changeset
30 "setlocal tw=75
153
19670b05ee32 updated for version 7.0047
vimboss
parents:
diff changeset
31
33051
02939ae3aaca runtime: Set b:undo_ftplugin where missing (#12943)
Christian Brabandt <cb@256bit.org>
parents: 3224
diff changeset
32 let b:undo_ftplugin = "setl cms< "
02939ae3aaca runtime: Set b:undo_ftplugin where missing (#12943)
Christian Brabandt <cb@256bit.org>
parents: 3224
diff changeset
33
34134
8ae680be2a51 runtime(ftplugin): Use "*" browsefilter pattern to match "All Files"
Christian Brabandt <cb@256bit.org>
parents: 33051
diff changeset
34 " Win32 and GTK can filter files in the browse dialog
8ae680be2a51 runtime(ftplugin): Use "*" browsefilter pattern to match "All Files"
Christian Brabandt <cb@256bit.org>
parents: 33051
diff changeset
35 "if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter")
8ae680be2a51 runtime(ftplugin): Use "*" browsefilter pattern to match "All Files"
Christian Brabandt <cb@256bit.org>
parents: 33051
diff changeset
36 " if has("win32")
8ae680be2a51 runtime(ftplugin): Use "*" browsefilter pattern to match "All Files"
Christian Brabandt <cb@256bit.org>
parents: 33051
diff changeset
37 " let b:browsefilter ..= "All Files (*.*)\t*\n"
8ae680be2a51 runtime(ftplugin): Use "*" browsefilter pattern to match "All Files"
Christian Brabandt <cb@256bit.org>
parents: 33051
diff changeset
38 " else
8ae680be2a51 runtime(ftplugin): Use "*" browsefilter pattern to match "All Files"
Christian Brabandt <cb@256bit.org>
parents: 33051
diff changeset
39 " let b:browsefilter ..= "All Files (*)\t*\n"
8ae680be2a51 runtime(ftplugin): Use "*" browsefilter pattern to match "All Files"
Christian Brabandt <cb@256bit.org>
parents: 33051
diff changeset
40 " endif
33051
02939ae3aaca runtime: Set b:undo_ftplugin where missing (#12943)
Christian Brabandt <cb@256bit.org>
parents: 3224
diff changeset
41 " let b:undo_ftplugin .= " | unlet! b:browsefilter"
153
19670b05ee32 updated for version 7.0047
vimboss
parents:
diff changeset
42 "endif
19670b05ee32 updated for version 7.0047
vimboss
parents:
diff changeset
43
19670b05ee32 updated for version 7.0047
vimboss
parents:
diff changeset
44 " Let the matchit plugin know what items can be matched.
19670b05ee32 updated for version 7.0047
vimboss
parents:
diff changeset
45 if ! exists("b:match_words") && exists("loaded_matchit")
19670b05ee32 updated for version 7.0047
vimboss
parents:
diff changeset
46 let b:match_ignorecase=1
19670b05ee32 updated for version 7.0047
vimboss
parents:
diff changeset
47 let s:notend = '\%(\<end\s\+\)\@<!'
671
83a006f81bac updated for version 7.0199
vimboss
parents: 153
diff changeset
48 let b:match_words =
83a006f81bac updated for version 7.0199
vimboss
parents: 153
diff changeset
49 \ s:notend.'\<if\>:\<elsif\>:\<else\>:\<end\s\+if\>,'.
83a006f81bac updated for version 7.0199
vimboss
parents: 153
diff changeset
50 \ s:notend.'\<case\>:\<when\>:\<end\s\+case\>,'.
83a006f81bac updated for version 7.0199
vimboss
parents: 153
diff changeset
51 \ s:notend.'\<loop\>:\<end\s\+loop\>,'.
83a006f81bac updated for version 7.0199
vimboss
parents: 153
diff changeset
52 \ s:notend.'\<for\>:\<end\s\+for\>,'.
83a006f81bac updated for version 7.0199
vimboss
parents: 153
diff changeset
53 \ s:notend.'\<generate\>:\<end\s\+generate\>,'.
83a006f81bac updated for version 7.0199
vimboss
parents: 153
diff changeset
54 \ s:notend.'\<record\>:\<end\s\+record\>,'.
83a006f81bac updated for version 7.0199
vimboss
parents: 153
diff changeset
55 \ s:notend.'\<units\>:\<end\s\+units\>,'.
83a006f81bac updated for version 7.0199
vimboss
parents: 153
diff changeset
56 \ s:notend.'\<process\>:\<end\s\+process\>,'.
83a006f81bac updated for version 7.0199
vimboss
parents: 153
diff changeset
57 \ s:notend.'\<block\>:\<end\s\+block\>,'.
83a006f81bac updated for version 7.0199
vimboss
parents: 153
diff changeset
58 \ s:notend.'\<function\>:\<end\s\+function\>,'.
83a006f81bac updated for version 7.0199
vimboss
parents: 153
diff changeset
59 \ s:notend.'\<entity\>:\<end\s\+entity\>,'.
83a006f81bac updated for version 7.0199
vimboss
parents: 153
diff changeset
60 \ s:notend.'\<component\>:\<end\s\+component\>,'.
83a006f81bac updated for version 7.0199
vimboss
parents: 153
diff changeset
61 \ s:notend.'\<architecture\>:\<end\s\+architecture\>,'.
83a006f81bac updated for version 7.0199
vimboss
parents: 153
diff changeset
62 \ s:notend.'\<package\>:\<end\s\+package\>,'.
83a006f81bac updated for version 7.0199
vimboss
parents: 153
diff changeset
63 \ s:notend.'\<procedure\>:\<end\s\+procedure\>,'.
83a006f81bac updated for version 7.0199
vimboss
parents: 153
diff changeset
64 \ s:notend.'\<configuration\>:\<end\s\+configuration\>'
33051
02939ae3aaca runtime: Set b:undo_ftplugin where missing (#12943)
Christian Brabandt <cb@256bit.org>
parents: 3224
diff changeset
65 let b:undo_ftplugin .= " | unlet! b:match_ignorecase b:match_words"
153
19670b05ee32 updated for version 7.0047
vimboss
parents:
diff changeset
66 endif
671
83a006f81bac updated for version 7.0199
vimboss
parents: 153
diff changeset
67
33051
02939ae3aaca runtime: Set b:undo_ftplugin where missing (#12943)
Christian Brabandt <cb@256bit.org>
parents: 3224
diff changeset
68 if !exists("no_plugin_maps") && !exists("no_vhdl_maps")
02939ae3aaca runtime: Set b:undo_ftplugin where missing (#12943)
Christian Brabandt <cb@256bit.org>
parents: 3224
diff changeset
69 " count repeat
02939ae3aaca runtime: Set b:undo_ftplugin where missing (#12943)
Christian Brabandt <cb@256bit.org>
parents: 3224
diff changeset
70 function! <SID>CountWrapper(cmd)
02939ae3aaca runtime: Set b:undo_ftplugin where missing (#12943)
Christian Brabandt <cb@256bit.org>
parents: 3224
diff changeset
71 let i = v:count1
02939ae3aaca runtime: Set b:undo_ftplugin where missing (#12943)
Christian Brabandt <cb@256bit.org>
parents: 3224
diff changeset
72 if a:cmd[0] == ":"
02939ae3aaca runtime: Set b:undo_ftplugin where missing (#12943)
Christian Brabandt <cb@256bit.org>
parents: 3224
diff changeset
73 while i > 0
02939ae3aaca runtime: Set b:undo_ftplugin where missing (#12943)
Christian Brabandt <cb@256bit.org>
parents: 3224
diff changeset
74 execute a:cmd
02939ae3aaca runtime: Set b:undo_ftplugin where missing (#12943)
Christian Brabandt <cb@256bit.org>
parents: 3224
diff changeset
75 let i = i - 1
02939ae3aaca runtime: Set b:undo_ftplugin where missing (#12943)
Christian Brabandt <cb@256bit.org>
parents: 3224
diff changeset
76 endwhile
02939ae3aaca runtime: Set b:undo_ftplugin where missing (#12943)
Christian Brabandt <cb@256bit.org>
parents: 3224
diff changeset
77 else
02939ae3aaca runtime: Set b:undo_ftplugin where missing (#12943)
Christian Brabandt <cb@256bit.org>
parents: 3224
diff changeset
78 execute "normal! gv\<Esc>"
02939ae3aaca runtime: Set b:undo_ftplugin where missing (#12943)
Christian Brabandt <cb@256bit.org>
parents: 3224
diff changeset
79 execute "normal ".i.a:cmd
02939ae3aaca runtime: Set b:undo_ftplugin where missing (#12943)
Christian Brabandt <cb@256bit.org>
parents: 3224
diff changeset
80 let curcol = col(".")
02939ae3aaca runtime: Set b:undo_ftplugin where missing (#12943)
Christian Brabandt <cb@256bit.org>
parents: 3224
diff changeset
81 let curline = line(".")
02939ae3aaca runtime: Set b:undo_ftplugin where missing (#12943)
Christian Brabandt <cb@256bit.org>
parents: 3224
diff changeset
82 normal! gv
02939ae3aaca runtime: Set b:undo_ftplugin where missing (#12943)
Christian Brabandt <cb@256bit.org>
parents: 3224
diff changeset
83 call cursor(curline, curcol)
02939ae3aaca runtime: Set b:undo_ftplugin where missing (#12943)
Christian Brabandt <cb@256bit.org>
parents: 3224
diff changeset
84 endif
02939ae3aaca runtime: Set b:undo_ftplugin where missing (#12943)
Christian Brabandt <cb@256bit.org>
parents: 3224
diff changeset
85 endfunction
671
83a006f81bac updated for version 7.0199
vimboss
parents: 153
diff changeset
86
33051
02939ae3aaca runtime: Set b:undo_ftplugin where missing (#12943)
Christian Brabandt <cb@256bit.org>
parents: 3224
diff changeset
87 " explore motion
02939ae3aaca runtime: Set b:undo_ftplugin where missing (#12943)
Christian Brabandt <cb@256bit.org>
parents: 3224
diff changeset
88 " keywords: "architecture", "block", "configuration", "component", "entity", "function", "package", "procedure", "process", "record", "units"
02939ae3aaca runtime: Set b:undo_ftplugin where missing (#12943)
Christian Brabandt <cb@256bit.org>
parents: 3224
diff changeset
89 let b:vhdl_explore = '\%(architecture\|block\|configuration\|component\|entity\|function\|package\|procedure\|process\|record\|units\)'
02939ae3aaca runtime: Set b:undo_ftplugin where missing (#12943)
Christian Brabandt <cb@256bit.org>
parents: 3224
diff changeset
90 noremap <buffer><silent>[[ :<C-u>cal <SID>CountWrapper(':cal search("\\%(--.*\\)\\@<!\\%(\\<end\\s\\+\\)\\@<!\\<".b:vhdl_explore."\\>\\c\\<Bar>\\%^","bW")')<CR>
02939ae3aaca runtime: Set b:undo_ftplugin where missing (#12943)
Christian Brabandt <cb@256bit.org>
parents: 3224
diff changeset
91 noremap <buffer><silent>]] :<C-u>cal <SID>CountWrapper(':cal search("\\%(--.*\\)\\@<!\\%(\\<end\\s\\+\\)\\@<!\\<".b:vhdl_explore."\\>\\c\\<Bar>\\%$","W")')<CR>
02939ae3aaca runtime: Set b:undo_ftplugin where missing (#12943)
Christian Brabandt <cb@256bit.org>
parents: 3224
diff changeset
92 noremap <buffer><silent>[] :<C-u>cal <SID>CountWrapper(':cal search("\\%(--.*\\)\\@<!\\<end\\s\\+".b:vhdl_explore."\\>\\c\\<Bar>\\%^","bW")')<CR>
02939ae3aaca runtime: Set b:undo_ftplugin where missing (#12943)
Christian Brabandt <cb@256bit.org>
parents: 3224
diff changeset
93 noremap <buffer><silent>][ :<C-u>cal <SID>CountWrapper(':cal search("\\%(--.*\\)\\@<!\\<end\\s\\+".b:vhdl_explore."\\>\\c\\<Bar>\\%$","W")')<CR>
02939ae3aaca runtime: Set b:undo_ftplugin where missing (#12943)
Christian Brabandt <cb@256bit.org>
parents: 3224
diff changeset
94 vnoremap <buffer><silent>[[ :<C-u>cal <SID>CountWrapper('[[')<CR>
02939ae3aaca runtime: Set b:undo_ftplugin where missing (#12943)
Christian Brabandt <cb@256bit.org>
parents: 3224
diff changeset
95 vnoremap <buffer><silent>]] :<C-u>cal <SID>CountWrapper(']]')<CR>
02939ae3aaca runtime: Set b:undo_ftplugin where missing (#12943)
Christian Brabandt <cb@256bit.org>
parents: 3224
diff changeset
96 vnoremap <buffer><silent>[] :<C-u>cal <SID>CountWrapper('[]')<CR>
02939ae3aaca runtime: Set b:undo_ftplugin where missing (#12943)
Christian Brabandt <cb@256bit.org>
parents: 3224
diff changeset
97 vnoremap <buffer><silent>][ :<C-u>cal <SID>CountWrapper('][')<CR>
02939ae3aaca runtime: Set b:undo_ftplugin where missing (#12943)
Christian Brabandt <cb@256bit.org>
parents: 3224
diff changeset
98 let b:undo_ftplugin .=
02939ae3aaca runtime: Set b:undo_ftplugin where missing (#12943)
Christian Brabandt <cb@256bit.org>
parents: 3224
diff changeset
99 \ " | silent! execute 'nunmap <buffer> [['" .
02939ae3aaca runtime: Set b:undo_ftplugin where missing (#12943)
Christian Brabandt <cb@256bit.org>
parents: 3224
diff changeset
100 \ " | silent! execute 'nunmap <buffer> ]]'" .
02939ae3aaca runtime: Set b:undo_ftplugin where missing (#12943)
Christian Brabandt <cb@256bit.org>
parents: 3224
diff changeset
101 \ " | silent! execute 'nunmap <buffer> []'" .
02939ae3aaca runtime: Set b:undo_ftplugin where missing (#12943)
Christian Brabandt <cb@256bit.org>
parents: 3224
diff changeset
102 \ " | silent! execute 'nunmap <buffer> ]['" .
02939ae3aaca runtime: Set b:undo_ftplugin where missing (#12943)
Christian Brabandt <cb@256bit.org>
parents: 3224
diff changeset
103 \ " | silent! execute 'vunmap <buffer> [['" .
02939ae3aaca runtime: Set b:undo_ftplugin where missing (#12943)
Christian Brabandt <cb@256bit.org>
parents: 3224
diff changeset
104 \ " | silent! execute 'vunmap <buffer> ]]'" .
02939ae3aaca runtime: Set b:undo_ftplugin where missing (#12943)
Christian Brabandt <cb@256bit.org>
parents: 3224
diff changeset
105 \ " | silent! execute 'vunmap <buffer> []'" .
02939ae3aaca runtime: Set b:undo_ftplugin where missing (#12943)
Christian Brabandt <cb@256bit.org>
parents: 3224
diff changeset
106 \ " | silent! execute 'vunmap <buffer> ]['"
02939ae3aaca runtime: Set b:undo_ftplugin where missing (#12943)
Christian Brabandt <cb@256bit.org>
parents: 3224
diff changeset
107 endif
3224
8b8ef1fed009 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 671
diff changeset
108
8b8ef1fed009 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 671
diff changeset
109 let &cpo = s:cpo_save
8b8ef1fed009 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 671
diff changeset
110 unlet s:cpo_save