From 029f72b1a93430b24b88eb3a72c6114d9f149737 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 10 Apr 2024 22:09:20 +0200 Subject: Adding upstream version 2:9.1.0016. Signed-off-by: Daniel Baumann --- runtime/ftplugin/vhdl.vim | 108 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 108 insertions(+) create mode 100644 runtime/ftplugin/vhdl.vim (limited to 'runtime/ftplugin/vhdl.vim') diff --git a/runtime/ftplugin/vhdl.vim b/runtime/ftplugin/vhdl.vim new file mode 100644 index 0000000..ff56166 --- /dev/null +++ b/runtime/ftplugin/vhdl.vim @@ -0,0 +1,108 @@ +" VHDL filetype plugin +" Language: VHDL +" Maintainer: R.Shankar +" Modified By: Gerald Lai +" Last Change: 2011 Dec 11 +" 2023 Aug 28 by Vim Project (undo_ftplugin, commentstring) + +" Only do this when not done yet for this buffer +if exists("b:did_ftplugin") + finish +endif + +" Don't load another plugin for this buffer +let b:did_ftplugin = 1 + +let s:cpo_save = &cpo +set cpo&vim + +" Set 'formatoptions' to break comment lines but not other lines, +" and insert the comment leader when hitting or using "o". +"setlocal fo-=t fo+=croqlm1 + +" Set 'comments' to format dashed lists in comments. +"setlocal comments=sO:*\ -,mO:*\ \ ,exO:*/,s1:/*,mb:*,ex:*/,:// + +setlocal commentstring=--\ %s + +" Format comments to be up to 78 characters long +"setlocal tw=75 + +" let b:undo_ftplugin = "setl cms< com< fo< tw<" + +let b:undo_ftplugin = "setl cms< " + +" Win32 can filter files in the browse dialog +"if has("gui_win32") && !exists("b:browsefilter") +" let b:browsefilter = "Verilog Source Files (*.v)\t*.v\n" . +" \ "All Files (*.*)\t*.*\n" +" let b:undo_ftplugin .= " | unlet! b:browsefilter" +"endif + +" Let the matchit plugin know what items can be matched. +if ! exists("b:match_words") && exists("loaded_matchit") + let b:match_ignorecase=1 + let s:notend = '\%(\:\:\:\,'. + \ s:notend.'\:\:\,'. + \ s:notend.'\:\,'. + \ s:notend.'\:\,'. + \ s:notend.'\:\,'. + \ s:notend.'\:\,'. + \ s:notend.'\:\,'. + \ s:notend.'\:\,'. + \ s:notend.'\:\,'. + \ s:notend.'\:\,'. + \ s:notend.'\:\,'. + \ s:notend.'\:\,'. + \ s:notend.'\:\,'. + \ s:notend.'\:\,'. + \ s:notend.'\:\,'. + \ s:notend.'\:\' + let b:undo_ftplugin .= " | unlet! b:match_ignorecase b:match_words" +endif + +if !exists("no_plugin_maps") && !exists("no_vhdl_maps") + " count repeat + function! CountWrapper(cmd) + let i = v:count1 + if a:cmd[0] == ":" + while i > 0 + execute a:cmd + let i = i - 1 + endwhile + else + execute "normal! gv\" + execute "normal ".i.a:cmd + let curcol = col(".") + let curline = line(".") + normal! gv + call cursor(curline, curcol) + endif + endfunction + + " explore motion + " keywords: "architecture", "block", "configuration", "component", "entity", "function", "package", "procedure", "process", "record", "units" + let b:vhdl_explore = '\%(architecture\|block\|configuration\|component\|entity\|function\|package\|procedure\|process\|record\|units\)' + noremap [[ :cal CountWrapper(':cal search("\\%(--.*\\)\\@\\c\\\\%^","bW")') + noremap ]] :cal CountWrapper(':cal search("\\%(--.*\\)\\@\\c\\\\%$","W")') + noremap [] :cal CountWrapper(':cal search("\\%(--.*\\)\\@\\c\\\\%^","bW")') + noremap ][ :cal CountWrapper(':cal search("\\%(--.*\\)\\@\\c\\\\%$","W")') + vnoremap [[ :cal CountWrapper('[[') + vnoremap ]] :cal CountWrapper(']]') + vnoremap [] :cal CountWrapper('[]') + vnoremap ][ :cal CountWrapper('][') + let b:undo_ftplugin .= + \ " | silent! execute 'nunmap [['" . + \ " | silent! execute 'nunmap ]]'" . + \ " | silent! execute 'nunmap []'" . + \ " | silent! execute 'nunmap ]['" . + \ " | silent! execute 'vunmap [['" . + \ " | silent! execute 'vunmap ]]'" . + \ " | silent! execute 'vunmap []'" . + \ " | silent! execute 'vunmap ]['" +endif + +let &cpo = s:cpo_save +unlet s:cpo_save -- cgit v1.2.3