Team Ai
Datasetpublic

codekingpro/portable-devtools

sourceHugging Faceupdated 5mo agoView on Hugging Face
1likes14kdownloads
abaqus.vim125 linesDownload Raw Back to ftplugin
1" Vim filetype plugin file2" Language:     Abaqus finite element input file (www.abaqus.com)3" Maintainer:   Carl Osterwisch <costerwi@gmail.com>4" Last Change:  2022 Oct 085"               2024 Jan 14 by Vim Project (browsefilter)6"               2024 May 23 by Riley Bruins <ribru17@gmail.com> ('commentstring')7 8" Only do this when not done yet for this buffer9if exists("b:did_ftplugin") | finish | endif10 11" Don't load another plugin for this buffer12let b:did_ftplugin = 113 14" Save the compatibility options and temporarily switch to vim defaults15let s:cpo_save = &cpoptions16set cpoptions&vim17 18" Set the format of the include file specification for Abaqus19" Used in :check gf ^wf [i and other commands20setlocal include=\\<\\cINPUT\\s*=21 22" Remove characters up to the first = when evaluating filenames23setlocal includeexpr=substitute(v:fname,'.\\{-}=','','')24 25" Remove comma from valid filename characters since it is used to26" separate keyword parameters27setlocal isfname-=,28 29" Define format of comment lines (see 'formatoptions' for uses)30setlocal comments=:**31setlocal commentstring=**\ %s32 33" Definitions start with a * and assign a NAME, NSET, or ELSET34" Used in [d ^wd and other commands35setlocal define=^\\*\\a.*\\c\\(NAME\\\|NSET\\\|ELSET\\)\\s*=36 37" Abaqus keywords and identifiers may include a - character38setlocal iskeyword+=-39 40let b:undo_ftplugin = "setlocal include< includeexpr< isfname<"41    \ . " comments< commentstring< define< iskeyword<"42 43if has("folding")44    " Fold all lines that do not begin with *45    setlocal foldexpr=getline(v:lnum)[0]!=\"\*\"46    setlocal foldmethod=expr47    let b:undo_ftplugin .= " foldexpr< foldmethod<"48endif49 50" Set the file browse filter (currently only supported under Win32 gui)51if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter")52    let b:browsefilter = "Abaqus Input Files (*.inp *.inc)\t*.inp;*.inc\n" .53    \ "Abaqus Results (*.dat)\t*.dat\n" .54    \ "Abaqus Messages (*.pre, *.msg, *.sta)\t*.pre;*.msg;*.sta\n"55    if has("win32")56        let b:browsefilter .= "All Files (*.*)\t*\n"57    else58        let b:browsefilter .= "All Files (*)\t*\n"59    endif60    let b:undo_ftplugin .= "|unlet! b:browsefilter"61endif62 63" Define patterns for the matchit plugin64if exists("loaded_matchit") && !exists("b:match_words")65    let b:match_ignorecase = 166    let b:match_words =67    \ '\*part:\*end\s*part,' .68    \ '\*assembly:\*end\s*assembly,' .69    \ '\*instance:\*end\s*instance,' .70    \ '\*step:\*end\s*step'71    let b:undo_ftplugin .= "|unlet! b:match_ignorecase b:match_words"72endif73 74if !exists("no_plugin_maps") && !exists("no_abaqus_maps")75  " Map [[ and ]] keys to move [count] keywords backward or forward76  nnoremap <silent><buffer> ]] :call <SID>Abaqus_NextKeyword(1)<CR>77  nnoremap <silent><buffer> [[ :call <SID>Abaqus_NextKeyword(-1)<CR>78  function! <SID>Abaqus_NextKeyword(direction)79    .mark '80    if a:direction < 081      let flags = 'b'82    else83      let flags = ''84    endif85    let l:count = abs(a:direction) * v:count186    while l:count > 0 && search("^\\*\\a", flags)87      let l:count -= 188    endwhile89  endfunction90 91  " Map \\ to toggle commenting of the current line or range92  noremap <silent><buffer> <LocalLeader><LocalLeader>93      \ :call <SID>Abaqus_ToggleComment()<CR>j94  function! <SID>Abaqus_ToggleComment() range95    if strpart(getline(a:firstline), 0, 2) == "**"96      " Un-comment all lines in range97      silent execute a:firstline . ',' . a:lastline . 's/^\*\*//'98    else99      " Comment all lines in range100      silent execute a:firstline . ',' . a:lastline . 's/^/**/'101    endif102  endfunction103 104  " Map \s to swap first two comma separated fields105  noremap <silent><buffer> <LocalLeader>s :call <SID>Abaqus_Swap()<CR>106  function! <SID>Abaqus_Swap() range107    silent execute a:firstline . ',' . a:lastline . 's/\([^*,]*\),\([^,]*\)/\2,\1/'108  endfunction109 110  let b:undo_ftplugin .= "|unmap <buffer> [[|unmap <buffer> ]]"111      \ . "|unmap <buffer> <LocalLeader><LocalLeader>"112      \ . "|unmap <buffer> <LocalLeader>s"113endif114 115" Undo must be done in nocompatible mode for <LocalLeader>.116let b:undo_ftplugin = "let b:cpo_save = &cpoptions|"117    \ . "set cpoptions&vim|"118    \ . b:undo_ftplugin119    \ . "|let &cpoptions = b:cpo_save"120    \ . "|unlet b:cpo_save"121 122" Restore saved compatibility options123let &cpoptions = s:cpo_save124unlet s:cpo_save125 
codekingpro/portable-devtools · Team Ai