1" Vim filetype plugin file 2" Language: Abaqus finite element input file (www.abaqus.com) 3" Maintainer: Carl Osterwisch <[email protected]> 4" Last Change: 2004 Jul 06 5 6" Only do this when not done yet for this buffer 7if exists("b:did_ftplugin") | finish | endif 8 9" Don't load another plugin for this buffer 10let b:did_ftplugin = 1 11 12" Save the compatibility options and temporarily switch to vim defaults 13let s:cpo_save = &cpoptions 14set cpoptions&vim 15 16" Folding 17if version >= 600 18 " Fold all lines that do not begin with * 19 setlocal foldexpr=getline(v:lnum)[0]!=\"\*\" 20 setlocal foldmethod=expr 21endif 22 23" Set the format of the include file specification for Abaqus 24" Used in :check gf ^wf [i and other commands 25setlocal include=\\<\\cINPUT\\s*= 26 27" Remove characters up to the first = when evaluating filenames 28setlocal includeexpr=substitute(v:fname,'.\\{-}=','','') 29 30" Remove comma from valid filename characters since it is used to 31" separate keyword parameters 32setlocal isfname-=, 33 34" Define format of comment lines (see 'formatoptions' for uses) 35setlocal comments=:** 36setlocal commentstring=**%s 37 38" Definitions start with a * and assign a NAME, NSET, or ELSET 39" Used in [d ^wd and other commands 40setlocal define=^\\*\\a.*\\c\\(NAME\\\|NSET\\\|ELSET\\)\\s*= 41 42" Abaqus keywords and identifiers may include a - character 43setlocal iskeyword+=- 44 45" Set the file browse filter (currently only supported under Win32 gui) 46if has("gui_win32") && !exists("b:browsefilter") 47 let b:browsefilter = "Abaqus Input Files (*.inp *.inc)\t*.inp;*.inc\n" . 48 \ "Abaqus Results (*.dat)\t*.dat\n" . 49 \ "Abaqus Messages (*.pre *.msg *.sta)\t*.pre;*.msg;*.sta\n" . 50 \ "All Files (*.*)\t*.*\n" 51endif 52 53" Define keys used to move [count] sections backward or forward. 54" TODO: Make this do something intelligent in visual mode. 55nnoremap <silent> <buffer> [[ :call <SID>Abaqus_Jump('?^\*\a?')<CR> 56nnoremap <silent> <buffer> ]] :call <SID>Abaqus_Jump('/^\*\a/')<CR> 57function! <SID>Abaqus_Jump(motion) range 58 let s:count = v:count1 59 mark ' 60 while s:count > 0 61 silent! execute a:motion 62 let s:count = s:count - 1 63 endwhile 64endfunction 65 66" Define key to toggle commenting of the current line or range 67noremap <silent> <buffer> <m-c> :call <SID>Abaqus_ToggleComment()<CR>j 68function! <SID>Abaqus_ToggleComment() range 69 if strpart(getline(a:firstline), 0, 2) == "**" 70 " Un-comment all lines in range 71 silent execute a:firstline . ',' . a:lastline . 's/^\*\*//' 72 else 73 " Comment all lines in range 74 silent execute a:firstline . ',' . a:lastline . 's/^/**/' 75 endif 76endfunction 77 78" Restore saved compatibility options 79let &cpoptions = s:cpo_save 80