tSkeleton

tSkeleton is a Vim plugin that provides file templates and code skeletons (snippets).
Download

tSkeleton Ranking & Summary

Advertisement

  • Rating:
  • License:
  • GPL
  • Price:
  • FREE
  • Publisher Name:
  • Thomas Link
  • Publisher web site:
  • http://www.vim.org/scripts/script.php?script_id=2292

tSkeleton Tags


tSkeleton Description

tSkeleton is a Vim plugin that provides file templates and code skeletons (snippets). tSkeleton is a Vim plugin that provides file templates and code skeletons (snippets). These templates may contain special tags that are replaced with some computed value (e.g., variables, user input ...), vimscript code, or place holders/jump positions (when used in conjunction with imap.vim or |TSkeletonMapGoToNextTag()|.File templates:In order to add support for a new filetype, save a skeleton file to ~/.vim/skeletons/file.suffix and add something like this to your .vimrc file:autocmd BufNewFile *.suffix TSkeletonSetup template.suffixautocmd BufNewFile /here/*.suffix TSkeletonSetup othertemplate.suffixAlternatively, you can store templates as: ~/vimfiles/skeletons/templates/GROUP/FILETYPE PATTERNCode skeletons:Smaller skeleton bits are stored in SKELETONS/bits/FILETYPE/ or SKELETONS/bits/general/. I.e., code skeletons can be filetype specific or generally available.The filenames of the bits may be grouped in submenus as in: ../tex/&Define.new&command ../tex/&Define.new&environmentThis will create skeletons for newcommand and newenvironment but willgroup the skeletons under the TSkel.Define. menu with the respective accelerators.Default key maps: < Leader >## ... Expand name under cursor < Leader >#t ... Insert code skeleton via command line < c-> ... In insert mode, expand the bit before the cursor (on a German keyboard this happens to be < c-# >< c-# >)General remarks:A list of special tags: < +FILE NAME ROOT+ > :: the file name root < +FILE NAME+ > :: the file name < +FILE SUFFIX+ > :: the file suffix < +FILE DIRNAME+ > :: the file's directory < +NOTE+ > :: a note < +DATE+ > :: the current date (the format is controlled via g:tskelDateFormat) < +AUTHOR+ > :: the author's name (g:tskelUserName) < +EMAIL+ > :: the author's e-mail (g:tskelUserEmail) < +WEBSITE+ > :: the author's homepage (g:tskelUserWWW) < +LICENSE+ > :: the name of the license this file is released under (g:tskelLicense)tSkeleton also supports the following pseudo-tags: < +CURSOR+ > :: where to place the cursor after insertion < +&NAME+ > :: a vim option < +g:NAME+ > :: a global variable < +b:NAME+ > :: a buffer local variable < +?QUERY?+ > :: query the user < +?VAR|QUERY?+ > :: query the user and propose some choices from the variable ${VAR} < +bit:BIT >, < +bit:BIT|"DEFAULT" >, < +bit:BIT|COMMANDS > :: insert a bit; if the bit isn't defined for the current filetype, use DEFAULT; if DEFAULT matches ".*"insert it as a string; otherwise interpret it as a command sequence to be fed to normal < +tskel:TSKELETON > ... :: same as the above < +include(TSKELETON)+ > :: Another synonym for the above. < +call:FUNCTION(ARGS)+ > :: Insert the result value of some function < +execute(EX COMMAND)+ > :: Run a vim command.Flow control: < +if(CONDITION)+ > < +elseif(CONDITION)+ > < +else+ > < +endif+ >Loops: < +for(VAR in LIST)+ > < +endfor+ >, < +endfor(VAR)+ >Variables: < +let(VAR=VALUE)+ >Interaction: < +input(VAR, QUERY, , )+ >Other: < +nl+ > < +joinline+ > < +nop+ >A wiki like table could then be constructed using a skeleton like this: < +input('s:my_rows?!', 'Rows: ')+ > < +input('s:my_cols?!', 'Cols: ')+ > < +for(i in range(s:my_rows))+ > |< +for(j in range(s:my_cols))+ > < +CURSOR+ > |< +endfor(j)+ >< +nop+ > < +endfor(i)+ >Unknown tags are kept in the expanded skeleton. These tags can be usedas cursor jump marks.Requirements:· Vim· tlib· VimballINSTALLATION:Edit the vba file and type: :so %See :help vimball for details. If you use vim 7.0, you probably need to update vimball first.IMPORTANT: When updating from an older version, please remove the cache files in ~/vimfiles/cache/tskel_*/** (or select "Reset" from the menu)and (if existent) the directories ~/vimfiles/skeletons/menu, ~/vimfiles/skeletons/bbits.The files are stored in ~/vimfiles/skeletons or ~/.vim/skeletons (seeg:tskelDir). The directory structure should look like this: skeletons/ NAME.SUFFIX (templates for new files) templates/ GROUP/ (templates for new files) FILETYPE PATTERN.SUFFIX map/ FILETYPE (map files for conditional expansion) bits/ FILETYPE.txt (single line templates) general/ GENERAL CODE SKELETONS ... FILETYPE/ FILETYPE SPECIFIC CODE SKELETONS: ONE SKELETON PER FILE ...What's New in This Release:· bbcode group· tskelKeyword_{&ft} and tskelGroup_{&ft} variables can be buffer-local· Case-sensitivity can be configured via :tskelCaseSensitive and :tskelCaseSensitive_{&filetype}


tSkeleton Related Software