Team Ai
Datasetpublic

codekingpro/portable-devtools

sourceHugging Faceupdated 5mo agoView on Hugging Face
1likes14kdownloads
eiffel.vim101 linesDownload Raw Back to ftplugin
1" Vim filetype plugin2" Language:	Eiffel3" Maintainer:	Doug Kearns <dougkearns@gmail.com>4" Last Change:	2024 Jan 145 6if (exists("b:did_ftplugin"))7  finish8endif9let b:did_ftplugin = 110 11let s:cpo_save = &cpo12set cpo&vim13 14setlocal comments=:--15setlocal commentstring=--\ %s16 17setlocal formatoptions-=t formatoptions+=croql18 19if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter")20  let b:browsefilter = "Eiffel Source Files (*.e)\t*.e\n" .21		     \ "Eiffel Control Files (*.ecf, *.ace, *.xace)\t*.ecf;*.ace;*.xace\n"22  if has("win32")23    let b:browsefilter .= "All Files (*.*)\t*\n"24  else25    let b:browsefilter .= "All Files (*)\t*\n"26  endif27endif28 29if exists("loaded_matchit") && !exists("b:match_words")30  let b:match_ignorecase = 031  " Silly \%^ trick to match note at head of pair and in middle prevents32  " 'g%' wrapping from 'note' to 'end'33  let b:match_words = '\%^:' .34		  \	'\<\%(^note\|indexing\|class\|^obsolete\|inherit\|insert\|^create\|convert\|feature\|^invariant\)\>:' .35		  \   '^end\>,' .36		  \   '\<\%(do\|deferred\|external\|once\%(\s\+"\)\@!\|check\|debug\|if\|inspect\|from\|across\)\>:' .37		  \	'\%(\%(^\s\+\)\@<=\%(then\|until\|loop\)\|\%(then\|until\|loop\)\s\+[^ -]\|' .38		  \	'\<\%(ensure\%(\s\+then\)\=\|rescue\|_then\|elseif\|else\|when\|\s\@<=invariant\|_until\|_loop\|variant\|_as\|alias\)\>\):' .39		  \   '\s\@<=end\>'40  let b:match_skip = 's:\<eiffel\%(Comment\|String\|Operator\)\>'41  noremap  [% <Nop>42  noremap  ]% <Nop>43  vnoremap a% <Nop>44endif45 46let b:undo_ftplugin = "setl fo< com< cms<" .47  \ "| unlet! b:browsefilter b:match_ignorecase b:match_words b:match_skip"48 49if !exists("g:no_plugin_maps") && !exists("g:no_eiffel_maps")50  function! s:DoMotion(pattern, count, flags) abort51    normal! m'52    for i in range(a:count)53      call search(a:pattern, a:flags)54    endfor55  endfunction56 57  let sections = '^\%(note\|indexing\|' .58	     \	 '\%(\%(deferred\|expanded\|external\|frozen\)\s\+\)*class\|' .59	     \	 'obsolete\|inherit\|insert\|create\|convert\|feature\|' .60	     \	 'invariant\|end\)\>'61 62  nnoremap <silent> <buffer> ]] :<C-U>call <SID>DoMotion(sections, v:count1, 'W')<CR>63  xnoremap <silent> <buffer> ]] :<C-U>exe "normal! gv"<Bar>call <SID>DoMotion(sections, v:count1, 'W')<CR>64  nnoremap <silent> <buffer> [[ :<C-U>call <SID>DoMotion(sections, v:count1, 'Wb')<CR>65  xnoremap <silent> <buffer> [[ :<C-U>exe "normal! gv"<Bar>call <SID>DoMotion(sections, v:count1, 'Wb')<CR>66 67  function! s:DoFeatureMotion(count, flags)68    let view = winsaveview()69    call cursor(1, 1)70    let [features_start, _] = searchpos('^feature\>')71    call search('^\s\+\a') " find the first feature72    let spaces = indent(line('.'))73    let [features_end, _] = searchpos('^\%(invariant\|note\|end\)\>')74    call winrestview(view)75    call s:DoMotion('\%>' . features_start . 'l\%<' . features_end . 'l^\s*\%' . (spaces + 1) . 'v\zs\a', a:count, a:flags)76  endfunction77 78  nnoremap <silent> <buffer> ]m :<C-U>call <SID>DoFeatureMotion(v:count1, 'W')<CR>79  xnoremap <silent> <buffer> ]m :<C-U>exe "normal! gv"<Bar>call <SID>DoFeatureMotion(v:count1, 'W')<CR>80  nnoremap <silent> <buffer> [m :<C-U>call <SID>DoFeatureMotion(v:count1, 'Wb')<CR>81  xnoremap <silent> <buffer> [m :<C-U>exe "normal! gv"<Bar>call <SID>DoFeatureMotion(v:count1, 'Wb')<CR>82 83  let comment_block_start = '^\%(\s\+--.*\n\)\@<!\s\+--'84  let comment_block_end = '^\s\+--.*\n\%(\s\+--\)\@!'85 86  nnoremap <silent> <buffer> ]- :<C-U>call <SID>DoMotion(comment_block_start, 1, 'W')<CR>87  xnoremap <silent> <buffer> ]- :<C-U>exe "normal! gv"<Bar>call <SID>DoMotion(comment_block_start, 1, 'W')<CR>88  nnoremap <silent> <buffer> [- :<C-U>call <SID>DoMotion(comment_block_end, 1, 'Wb')<CR>89  xnoremap <silent> <buffer> [- :<C-U>exe "normal! gv"<Bar>call <SID>DoMotion(comment_block_end, 1, 'Wb')<CR>90 91  let b:undo_ftplugin = b:undo_ftplugin .92    \ "| silent! execute 'unmap <buffer> [[' | silent! execute 'unmap <buffer> ]]'" .93    \ "| silent! execute 'unmap <buffer> [m' | silent! execute 'unmap <buffer> ]m'" .94    \ "| silent! execute 'unmap <buffer> [-' | silent! execute 'unmap <buffer> ]-'"95endif96 97let &cpo = s:cpo_save98unlet s:cpo_save99 100" vim: nowrap sw=2 sts=2 ts=8101 
codekingpro/portable-devtools · Team Ai