# HG changeset patch # User Steve Losh # Date 1286803878 14400 # Node ID cdc196e91cd2d72913ca34e2bc91e202871cb788 # Parent 85db8aa3c1cc99ee7031837f77e3479aff67968c vim: lots diff -r 85db8aa3c1cc -r cdc196e91cd2 vim/.vimrc --- a/vim/.vimrc Fri Oct 08 09:26:49 2010 -0400 +++ b/vim/.vimrc Mon Oct 11 09:31:18 2010 -0400 @@ -211,8 +211,9 @@ " Rainbows! nmap R :RainbowParenthesesToggle -" Edit .vimrc +" Edit vim stuff. nmap ev :e $MYVIMRC +nmap es :e ~/.vim/snippets/ " Sudo to write cmap w!! w !sudo tee % >/dev/null diff -r 85db8aa3c1cc -r cdc196e91cd2 vim/bundle/histwin/Makefile --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vim/bundle/histwin/Makefile Mon Oct 11 09:31:18 2010 -0400 @@ -0,0 +1,44 @@ +SCRIPT=$(wildcard plugin/*.vim) +AUTOL =$(wildcard autoload/*.vim) +DOC=$(wildcard doc/*.txt) +PLUGIN=$(shell basename "$$PWD") +VERSION=$(shell sed -n '/Version:/{s/^.*\(\S\.\S\+\)$$/\1/;p}' $(SCRIPT)) + +.PHONY: $(PLUGIN).vba README + +all: uninstall vimball install README + +vimball: $(PLUGIN).vba + +clean: + rm -f *.vba */*.orig *.~* .VimballRecord + +dist-clean: clean + +install: + vim -N -c':so %' -c':q!' $(PLUGIN)-$(VERSION).vba + +uninstall: + vim -N -c':RmVimball' -c':q!' $(PLUGIN)-$(VERSION).vba + +undo: + for i in */*.orig; do mv -f "$$i" "$${i%.*}"; done + +README: + cp -f $(DOC) README + +$(PLUGIN).vba: + rm -f $(PLUGIN)-$(VERSION).vba + vim -N -c 'ru! vimballPlugin.vim' -c ':call append("0", [ "$(SCRIPT)", "$(AUTOL)", "$(DOC)"])' -c '$$d' -c ":%MkVimball $(PLUGIN)-$(VERSION) ." -c':q!' + ln -f $(PLUGIN)-$(VERSION).vba $(PLUGIN).vba + +release: version all + +version: + perl -i.orig -pne 'if (/Version:/) {s/\.(\d*)/sprintf(".%d", 1+$$1)/e}' ${SCRIPT} ${AUTOL} + perl -i.orig -pne 'if (/g:loaded_undo_browse =/) {s/\.(\d*)/sprintf(".%d", 1+$$1)/e}' ${SCRIPT} + perl -i -pne 'if (/GetLatestVimScripts:/) {s/(\d+)\s+:AutoInstall:/sprintf("%d :AutoInstall:", 1+$$1)/e}' ${SCRIPT} ${AUTOL} + #perl -i -pne 'if (/Last Change:/) {s/\d+\.\d+\.\d\+$$/sprintf("%s", `date -R`)/e}' ${SCRIPT} + perl -i -pne 'if (/Last Change:/) {s/(:\s+).*\n/sprintf(": %s", `date -R`)/e}' ${SCRIPT} ${AUTOL} + perl -i.orig -pne 'if (/Version:/) {s/\.(\d+).*\n/sprintf(".%d %s", 1+$$1, `date -R`)/e}' ${DOC} + VERSION=$(shell sed -n '/Version:/{s/^.*\(\S\.\S\+\)$$/\1/;p}' $(SCRIPT)) diff -r 85db8aa3c1cc -r cdc196e91cd2 vim/bundle/histwin/README --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vim/bundle/histwin/README Mon Oct 11 09:31:18 2010 -0400 @@ -0,0 +1,368 @@ +*histwin.txt* Plugin to browse the undo-tree + +Version: 0.15 Thu, 07 Oct 2010 23:47:20 +0200 +Author: Christian Brabandt +Copyright: (c) 2009, 2010 by Christian Brabandt *histwin-copyright* + The VIM LICENSE applies to histwin.vim and histwin.txt + (see |copyright|) except use histwin instead of "Vim". + NO WARRANTY, EXPRESS OR IMPLIED. USE AT-YOUR-OWN-RISK. + +============================================================================== +1. Contents *histwin-contents* + +1. Contents.................................................|histwin-contents| +2. Functionality............................................|histwin-plugin| + Opening the Undo-Tree Window.............................|histwin-browse| + Using tags...............................................|histwin-tags| +3. Keybindings..............................................|histwin-keys| +4. Configuration............................................|histwin-config| + Configuraion Variables...................................|histwin-var| + Color Configuration......................................|histwin-color| + Undolevels settings......................................|histwin-ut| +5. Feedback.................................................|histwin-feedback| +6. History..................................................|histwin-history| + +============================================================================== + *histwin-plugin* *histwin* +2. Functionality + +This plugin was written to allow an easy way of browsing the |undo-tree|, that +is available with Vim. This allows to go back to any change that has been made +previously, because these states are remembered by Vim within a branch in the +undo-history. You can use |g-| or |g+| to move in Vim within the different +undo-branches. + +Unfortunately, going back to any state isn't very comfortable and you always +need to remember at what time you did that change. Therefore the +histwin-Plugin allows to easily view the available states and branch back to +any of these states. It opens a new window, which contains all available +states and using this plugin allows you to tag a previous change or go back to +a particular state. + + *histwin-browse* *:UB* +2.1 Opening the Undo-Tree Window + +By default you can open the Undo-Tree Window by issuing :UB (Mnemonic: +UndoBrowse). If you do this, you will see a window that looks +like this: + ++------------------------------------------------------+ +|Undo-Tree: FILENAME |#!/bin/bash | +|====================== | | +| | | +|" actv. keys in this window |if [ $# -ne 2 ]; the | +|" I toggles help screen | echo "Name: $0: arg| +|" goto undo branch | echo | +|" Update view | exit 1 | +|" T Tag sel. branch |fi | +|" P Toggle view | | +|" D Diff sel. branch |if true; then | +|" R Replay sel. branch | dir="${1%/*}" | +|" C Clear all tags | file="${1##*/}" | +|" Q Quit window | target="${2}/${di | +|" | if [ ! -e "${targ | +|" Undo-Tree, v0.13 | mkdir -p "$ta | +| | mv "$1" "$tar | +|Nr Time Fl Tag | | +|1) Sep 01 /Start Editing/| | +|2) Sep 01 ! /First draft/ | | +|3) 23:01:22 | | +|4) 23:02:57 * /Release 1/ | | +|5) 23:05:04 | | ++------------------------------------------------------+ + +This shows an extract of a sample file on the right side. The window on the +left side, contains an overview of all available states that are known for +this buffer or that have been tagged to remember that change. + +The first line contains 'Undo-Tree: filename' so that the user knows, for +which file this window shows the available undo-branches. This is the heading. + +Following the heading is a small information banner, that contains the most +important key combinations, that are available in this window. + +After that list, all available undo-changes are displayed. This is a list, +that contains the number, the time this change was made, some flags and the +tags, that have been entered. + +The flags can be any of '!' or '*'. The '!' indicates, that this particular +undo branch (that was probably tagged before) isn't available any more. The +'*' indicates, if that particular undo branch has been saved before (but is +only visible in the dense view). See |histwin-ut| on why certain states might +become inaccessible and what can be done against it. + +In the detailed view, that is by default displayed, when you press 'P', the +undo branch list will possibly be much longer. That is, because in this view, +each save state will be displayed (along with it's save number). You +can imagine, that this list might become very long. + +Additionally, the Change number, that identifies each change in the undo tree +will be displayed. The change number can be used with the |:undo| command to +jump to a particular change and the save number is useful with the |:earlier| +and |:later| commands. + +The active undo-branch on the right side is highlighted with the UBActive +highlighting and the cursor will be positioned on that line. Use > + +:hi UBActive + +to see how it will be highlighted. See also |histwin-color|. + + + *histwin-tags* + +By default, tags that you enter will be volatile. That is, whenever you quit +Vim, these tags are lost. Currently there is no way, to store or retrieve old +tags. + +This behaviour was okay, until with Vim 7.3 the new permanent undo feature was +included into Vim which makes undo information available even after restarting +Vim. Starting with Vim 7.3 it is often desirable, to also store the tag +information permanently. + +There is an easy way, to store your tag information easily, though. You can +make use of the |viminfo| file, that stores states and search patterns and a +like for later use. If you include the '!' flag when setting the option, vim +will also store global variables, which then will be read back when restarting +Vim (or by use of |rviminfo|). So if you like your tags be stored permanently, +be sure, that you set your viminfo option correctly. + +(Note, currently, the viminfo file only stores global variables of type +String, Float or Number, it can't store Dictionaries of Lists. There is a +patch available, that will hopefully be soon be integrated in Vim mainline. +So even if you set up your |viminfo| file correctly, the histwin plugin won't +be able to restore your tags) + +============================================================================== + *histwin-keys* +3. Keybindings + +By default, the following keys are active in Normal mode in the Undo-Tree +window: + +'Enter' Go to the branch, on which is selected with the cursor. By default, + if switching to an older branch, the buffer will be set to + 'nomodifiable'. If you don't want that, you need to set the + g:undo_tree_nomod variable to off (see |histwin-var|). +'' Update the window +'T' Tag the branch, that is selected. You'll be prompted for a tag. + To make the tag permanent, see |histwin-tags| +'P' Toggle view (the change-number and save number will be displayed). + You can use this number to go directly to that change (see |:undo|). + Additionally the saved counter will be displayed, which can be used + to go directly to the text version of a file write using |later| or + |earlier|. +'D' Start diff mode with the branch that is selected by the cursor. + (see |08.7|) +'R' Replay all changes, that have been made from the beginning. + (see |histwin-config| for adjusting the speed) +'C' Clear all tags. +'Q' Quit window + +============================================================================== + *histwin-var* *histwin-config* +4.1 Configuration variables + +You can adjust several parameters for the Undo-Tree window, by setting some +variables in your .vimrc file. + +------------------------------------------------------------------------------ + +4.1.1 Disable printing the help + +To always show only a small information banner, set this in your .vimrc +(by default this variable is 1) > + + :let g:undo_tree_help = 0 + +------------------------------------------------------------------------------ + +4.1.2 Display more details + +To always display the detailed view (which includes the Change number and the +file save counter), set the g:undo_tree_dtl=0: +(by default, this variable is 1) > + + :let g:undo_tree_dtl = 0 + +The change number can be used to directly jump to a undo state using |:undo| +and the save counter can be used to directly go to the buffer's state when the +file was written using |:earlier| and |:later| + +------------------------------------------------------------------------------ + +4.1.3 Customize the replay speed + +The speed with which to show each change, when replaying a undo-branch can be +adjusted by setting to a value in milliseconds. If not specified, this is +100ms. > + + :let g:undo_tree_speed=200 + +------------------------------------------------------------------------------ + +4.1.4 Adjust the window size. + +You can adjust the windows size by setting g:undo_tree_wdth to the number of +columns you like. By default this is considered 30. When the change number is +included in the list (see above), this value will increase by 10. > + + :let g:undo_tree_wdth=40 + +This will change the width of the window to 40 or 50, if the change number +is included. + +------------------------------------------------------------------------------ + +4.1.5 Read-only and writable buffer states + +By default, old buffer states are set read only and you cannot modify these. +This was done, since the author of the plugin started browsing the undo +branches and started changing older versions over and over again. This is +really confusing, since you start creating even more branches and you might +end up fixing old bugs over and over. + +This is what happened to the author of this plugin, so now there is a +configuration available that will set old buffers to be only read-only. +Currently, this works, by detecting, if the cursor was on the last branch in +the histwin window, and if the cursor was not on the last branch, the buffer +will be set 'nomodifiable'. You can always set the buffer to be modifiable by +issuing: > + + :setl modifiable + +The default is to set the buffer read only. To disable this, you can set the +g:undo_tree_nomod variable in your |.vimrc| like this: > + + :let g:undo_tree_nomod = 0 + +------------------------------------------------------------------------------ + + *histwin-color* +4.2 Color configuration + +If you want to customize the colors, you can simply change the following +groups, that are defined by the Undo-Tree Browser: + +UBTitle this defines the color of the title file-name. By default this links + to Title (see |hl-Title|) +UBInfo this defines how the information banner looks like. By default this + links to Comment. +UBList this group defines the List items at the start e.g. 1), 2), This + links to Identifier. +UBTime this defines, how the time is displayed. This links to Underlined. +UBTag This defines, how the tag should be highlighted. By default this + links to Special +UBDelim This group defines the look of the delimiter for the tag. By default + this links to Ignore +UBActive This group defines how the active selection is displayed. By default + this links to PmenuSel (see |hl-PmenuSel|) +UBKey This group defines, how keys are displayed within the information + banner. By default, this links to SpecialKey (see |hl-SpecialKey|) + +Say you want to change the color for the Tag values and you think, it should +look like |IncSerch|, so you can do this in your .vimrc file: > + +:hi link UBTag IncSearch + +------------------------------------------------------------------------------ + + *histwin-ut* +4.3 Undolevel settings + +When using Vim's |persistent-undo| feature and making many changes, you might +encounter the situation, when some of your tags will be flagged with an '!'. +This happens, when these undo-states are not available any more. This happens +especially, when making so many changes, that your 'undolevels' setting +interferes. Basically you have done so many changes, that your first changes +will already be deleted. So the obvious fix is to set the 'undolevels' setting +to a much higher value, like 10,000 or even higher. This will however increase +the memory usage quite a lot. + +============================================================================== + *histwin-feedback* +5. Feedback + +Feedback is always welcome. If you like the plugin, please rate it at the +vim-page: +http://www.vim.org/scripts/script.php?script_id=2932 + +You can also follow the development of the plugin at github: +http://github.com/chrisbra/histwin.vim + +Please don't hesitate to report any bugs to the maintainer, mentioned in the +third line of this document. + +============================================================================== + *histwin-history* +6. histwin History + +0.14 - don't fix the width of the histwin window + - now use the undotree() function by default (if patch 7.3.005 is + included) + - display save states in the detailed view + - display the '!' when a state is not accessible anymore + - fixed an annoying bug, that when jumping to a particular undo state, + the plugin would jump to the wrong state (I hate octal mode) + - Make displaying the time much more reliable and also don't display + the time, if the change happened more than 24h ago (instead, display + the date, when this change was done). + - slightly improved error handling. + - prepare plugin, to permantly store the undotags in the viminfo file + (this isn't supported by a plain vanilla vim and requires a patch) + - A major rewrite (code cleanup, better documentation) +0.13 - New version that uses Vim 7.3 persistent undo features + |new-persistent-undo| + - Display saved counter in detailed view + - Display indicator for saved branches. + - in diff mode, don't set the original buffer to be nomodifiable + (so you can always merge chunks). + - Check for Vim Version 7.3 (the plugin won't work with older versions + of Vim) +0.12 - Small extension to the help file + - generate help file with 'et' set, so the README at github looks + better + - Highlight the key binding using |hl-SpecialKey| + - The help tag for the color configuration was wrong. +0.11 - Set old buffers read only (disable the setting via the + g:undo_tree_nomod variable + - Make sure, Warning Messages are really displayed using :unsilent +0.10 - Fixed annoying Resizing bug + - linebreak tags, if they are too long + - dynamically grow the histwin window, for longer tags (up + to a maximum) + - Bugfix: Always indicate the correct branch + - Added a few try/catch statements and some error handling +0.9 - Error handling for Replaying (it may not work always) + - Documentation + - Use syntax highlighting + - Tagging finally works +0.8 - code cleanup + - make speed of the replay adjustable. Use g:undo_tree_speed to set + time in milliseconds +0.7.2 - make sure, when switching to a different undo-branch, the undo-tree will be reloaded + - check 'undolevel' settings +0.7.1 - fixed a problem with mapping the keys which broke the Undo-Tree keys + (I guess I don't fully understand, when to use s: and ) +0.7 - created autoloadPlugin (patch by Charles Campbell) Thanks! + - enabled GLVS (patch by Charles Campbell) Thanks! + - cleaned up old comments + - deleted :noautocmd which could cause trouble with other plugins + - small changes in coding style ( to s:, fun instead of fu) + - made Plugin available as histwin.vba + - Check for availability of :UB before defining it + (could already by defined Blockquote.vim does for example) +0.6 - fix missing bufname() when creating the undo_tree window + - make undo_tree window a little bit smaller + (size is adjustable via g:undo_tree_wdth variable) +0.5 - add missing endif (which made version 0.4 unusuable) +0.4 - Allow diffing with selected branch + - highlight current version + - Fix annoying bug, that displays + --No lines in buffer-- +0.3 - Use changenr() to determine undobranch + - updates view + - allow switching to initial load state, before + buffer was edited +============================================================================== +vim:tw=78:ts=8:ft=help:et diff -r 85db8aa3c1cc -r cdc196e91cd2 vim/bundle/histwin/autoload/histwin.vim --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vim/bundle/histwin/autoload/histwin.vim Mon Oct 11 09:31:18 2010 -0400 @@ -0,0 +1,649 @@ +" histwin.vim - Vim global plugin for browsing the undo tree +" ------------------------------------------------------------- +" Last Change: Thu, 07 Oct 2010 23:47:20 +0200 +" Maintainer: Christian Brabandt +" Version: 0.15 +" Copyright: (c) 2009, 2010 by Christian Brabandt +" The VIM LICENSE applies to histwin.vim +" (see |copyright|) except use "histwin.vim" +" instead of "Vim". +" No warranty, express or implied. +" *** *** Use At-Your-Own-Risk! *** *** +" TODO: - make tags permanent (needs patch for Vim) +" - rewrite script and make use of undotree() functionality +" that is available since Vim 7.3 (should work now) +" - Bugfix: Sometimes the histwin window contains invalid data, +" not sure how to reproduce it. Closing and reoping is +" the workaround. +" +" Init: {{{1 +let s:cpo= &cpo +set cpo&vim + +" Show help banner? +" per default enabled, you can change it, +" if you set g:undobrowse_help to 0 e.g. +" put in your .vimrc +" :let g:undo_tree_help=0 +let s:undo_help=((exists("s:undo_help") ? s:undo_help : 1) ) +" This is a little bit confusing. If the variable is set to zero and the +" detailed view will be shown. If it is set to 1 the short view will be +" displayed. +let s:undo_tree_dtl = (exists('g:undo_tree_dtl') ? g:undo_tree_dtl : (exists("s:undo_tree_dtl") ? s:undo_tree_dtl : 1)) + +" Functions: +" +fun! s:Init()"{{{1 + if exists("g:undo_tree_help") + let s:undo_help=g:undo_tree_help + endif + if !exists("s:undo_winname") + let s:undo_winname='Undo_Tree' + endif + " speed, with which the replay will be played + " (duration between each change in milliseconds) + " set :let g:undo_tree_speed=250 in your .vimrc to override + let s:undo_tree_speed = (exists('g:undo_tree_speed') ? g:undo_tree_speed : 100) + " Set prefered width + let s:undo_tree_wdth = (exists('g:undo_tree_wdth') ? g:undo_tree_wdth : 30) + " Show detail with Change nr? + let s:undo_tree_dtl = (exists('g:undo_tree_dtl') ? g:undo_tree_dtl : s:undo_tree_dtl) + " Set old versions nomodifiable + let s:undo_tree_nomod = (exists('g:undo_tree_nomod') ? g:undo_tree_nomod : 1) + " When switching to the undotree() function, be sure to use a Vim that is + " newer than 7.3.005 + let s:undo_tree_epoch = (v:version > 703 || (v:version == 703 && has("patch005")) ? 1 : 0) + + if !exists("s:undo_tree_wdth_orig") + let s:undo_tree_wdth_orig = s:undo_tree_wdth + endif + if !exists("s:undo_tree_wdth_max") + let s:undo_tree_wdth_max = 50 + endif + + if bufname('') != s:undo_winname + let s:orig_buffer = bufnr('') + endif + + " Make sure we are in the right buffer + " and this window still exists + if bufwinnr(s:orig_buffer) == -1 + wincmd p + let s:orig_buffer=bufnr('') + endif + + " Move to the buffer, we are monitoring + exe bufwinnr(s:orig_buffer) . 'wincmd w' + if !exists("b:undo_customtags") + " TODO: Activate, when viminfo patch has been incorporated into vim + " + " let fpath=fnameescape(fnamemodify(bufname('.'), ':p')) + " if exists("g:UNDO_CTAGS") && has_key(g:UNDO_CTAGS, fpath) + " let b:undo_customtags = g:UNDO_CTAGS[fpath] + " else + let b:undo_customtags={} + " endif + endif + + " global variable, that will be stored in the 'viminfo' file + " TODO: Activate, when viminfo patch has been incorporated into vim + " (currently, viminfo only stores numbers and strings, no dictionaries) + " delete the '&& 0' to enable + if !exists("g:UNDO_CTAGS") && s:undo_tree_epoch && 0 + let filename=fnameescape(fnamemodify(bufname('.'),':p')) + let g:UNDO_CTAGS={} + let g:UNDO_CTAGS[filename]=b:undo_customtags + if (!s:ReturnLastChange(g:UNDO_CTAGS[filename]) <= changenr()) + unlet g:UNDO_CTAGS[filename] + if !len(g:UNDO_CTAGS) + unlet g:UNDO_CTAGS + endif + endif + endif +endfun "}}} +fun! histwin#WarningMsg(msg)"{{{1 + echohl WarningMsg + let msg = "histwin: " . a:msg + if exists(":unsilent") == 2 + unsilent echomsg msg + else + echomsg msg + endif + echohl Normal + let v:errmsg = msg +endfun "}}} +fun! s:ReturnHistList()"{{{1 + let histdict={} + let customtags=copy(b:undo_customtags) + redir => a + sil :undol + redir end + " First item contains the header + let templist=split(a, '\n')[1:] + + + if s:undo_tree_epoch + if empty(templist) + return {} + endif + let ut=[] + " Vim 7.3 introduced the undotree function, which we'll use to get all save + " states. Unfortunately, Vim would crash, if you used the undotree() + " function before version 7.3.005 + " + " return a list of all the changes and then use only these changes, + " that are returned by the :undolist command + " (it's hard to get the right branches, so we parse the :undolist + " command and only take these entries (plus the first and last entry) + let ut=s:GetUndotreeEntries(undotree().entries) + let templist=map(templist, 'split(v:val)[0]') + let re = '^\%(' . join(templist, '\|') . '\)$' + let first = ut[0] + let first.tag='Start Editing' + if s:undo_tree_dtl + call filter(ut, 'v:val.seq =~ re') + else + call filter(ut, 'v:val.seq =~ re || v:val.save > 0') + endif + let ut= [first] + ut + + for item in ut + if has_key(customtags, item.seq) + let tag=customtags[item.seq].tag + call remove(customtags,item.seq) + else + let tag=(has_key(item, 'tag') ? item.tag : '') + endif + let histdict[item.seq]={'change': item.seq, + \'number': item.number, + \'time': item.time, + \'tag': tag, + \'save': (has_key(item, 'save') ? item.save : 0), + \} + endfor + let first_seq = first.seq + else + " include the starting point as the first change. + " unfortunately, there does not seem to exist an + " easy way to obtain the state of the first change, + " so we will be inserting a dummy entry and need to + " check later, if this is called. + let histdict[0] = {'number': 0, 'change': 0, 'time': '00:00:00', 'tag': 'Start Editing' ,'save':0} + let first_seq = matchstr(templist[0], '^\s\+\zs\d\+')+0 + + let i=1 + for item in templist + let change = matchstr(item, '^\s\+\zs\d\+') + 0 + " Actually the number attribute will not be used, but we store it + " anyway, since we are already parsing the undolist manually. + let nr = matchstr(item, '^\s\+\d\+\s\+\zs\d\+') + 0 + let time = matchstr(item, '^\%(\s\+\d\+\)\{2}\s\+\zs.\{-}\ze\s*\d*$') + let save = matchstr(item, '\s\+\zs\d\+$') + 0 + if time !~ '\d\d:\d\d:\d\d' + let time=matchstr(time, '^\d\+') + let time=strftime('%H:%M:%S', localtime()-time) + endif + if has_key(customtags, change) + let tag=customtags[change].tag + call remove(customtags,change) + else + let tag='' + endif + let histdict[change]={'change': change, 'number': nr, 'time': time, 'tag': tag, 'save': save} + let i+=1 + endfor + endif + unlet item + " Mark invalid entries in the customtags dictionary + for [key,item] in items(customtags) + if item.change < first_seq + let customtags[key].number = -1 + endif + endfor + return extend(histdict,customtags,"force") +endfun + +fun! s:SortValues(a,b)"{{{1 + return (a:a.change+0)==(a:b.change+0) ? 0 : (a:a.change+0) > (a:b.change+0) ? 1 : -1 +endfun + +fun! s:MaxTagsLen()"{{{1 + let tags = getbufvar(s:orig_buffer, 'undo_customtags') + let d=[] + " return a list of all tags + let d=values(map(copy(tags), 'v:val["tag"]')) + let d+= ["Start Editing"] + "call map(d, 'strlen(substitute(v:val, ".", "x", "g"))') + call map(d, 'strlen(v:val)') + return max(d) +endfu + +fun! s:HistWin()"{{{1 + let undo_buf=bufwinnr('^'.s:undo_winname.'$') + " Adjust size so that each tag will fit on the screen + " 16 is just the default length, that should fit within 30 chars + "let maxlen=s:MaxTagsLen() % (s:undo_tree_wdth_max) + let maxlen=s:MaxTagsLen() +" if !s:undo_tree_dtl +" let maxlen+=20 " detailed pane +" else +" let maxlen+=13 " short pane +" endif + let rd = (!s:undo_tree_dtl ? 20 : 13) + + if maxlen > 16 + let s:undo_tree_wdth = (s:undo_tree_wdth + maxlen - rd) % s:undo_tree_wdth_max + let s:undo_tree_wdth = (s:undo_tree_wdth < s:undo_tree_wdth_orig ? s:undo_tree_wdth_orig : s:undo_tree_wdth) + endif + " for the detail view, we need more space + if (!s:undo_tree_dtl) + let s:undo_tree_wdth = s:undo_tree_wdth_orig + 10 + else + let s:undo_tree_wdth = s:undo_tree_wdth_orig + endif + "if (maxlen + (!s:undo_tree_dtl*7)) > 13 + (!s:undo_tree_dtl*7) + " let s:undo_tree_wdth+=(s:undo_tree_wdth + maxlen) % s:undo_tree_wdth_max + "endif + if undo_buf != -1 + exe undo_buf . 'wincmd w' + if winwidth(0) != s:undo_tree_wdth + exe "vert res " . s:undo_tree_wdth + endif + else + execute s:undo_tree_wdth . "vsp " . s:undo_winname + setl noswapfile buftype=nowrite bufhidden=delete foldcolumn=0 nobuflisted + let undo_buf=bufwinnr("") + endif + exe bufwinnr(s:orig_buffer) . ' wincmd w' + return undo_buf +endfun + +fun! s:PrintUndoTree(winnr)"{{{1 + let bufname = (empty(bufname(s:orig_buffer)) ? '[No Name]' : fnamemodify(bufname(s:orig_buffer),':t')) + let changenr = changenr() + let histdict = b:undo_tagdict + exe a:winnr . 'wincmd w' + setl modifiable + " silent because :%d outputs this message: + " --No lines in buffer-- + silent %d _ + call setline(1,'Undo-Tree: '.bufname) + put =repeat('=', strlen(getline(1))) + put ='' + call s:PrintHelp(s:undo_help) + if s:undo_tree_dtl + call append('$', printf("%-*s %-9s %2s %s", strlen(len(histdict)), "Nr", " Time", "Fl", "Tag")) + else + call append('$', printf("%-*s %-9s %-6s %-4s %2s %s", strlen(len(histdict)), "Nr", " Time", "Change", "Save", "Fl", "Tag")) + endif + + if len(histdict) == 0 + call append('$', "\" No undotree available") + let list=[] + else + let i=1 + let list=sort(values(histdict), 's:SortValues') + for line in list + if s:undo_tree_dtl && line.number==0 + continue + endif + let tag=line.tag + " this is only an educated guess. + " This should be calculated + let width=winwidth(0) - (!s:undo_tree_dtl ? 22 : 14) + if strlen(tag) > width + let tag=substitute(tag, '.\{'.width.'}', '&\r', 'g') + endif + let tag = (empty(tag) ? tag : '/'.tag.'/') + if !s:undo_tree_dtl + call append('$', + \ printf("%0*d) %8s %6d %4d %1s %s", + \ strlen(len(histdict)), i, + \ localtime() - line['time'] > 24*3600 ? strftime('%b %d', line['time']) : strftime('%H:%M:%S', line['time']), + \ line['change'], line['save'], + \ (line['number']<0 ? '!' : ' '), + \ tag)) + else + call append('$', + \ printf("%0*d) %8s %1s %s", + \ strlen(len(histdict)), i, + \ localtime() - line['time'] > 24*3600 ? strftime('%b %d', line['time']) : strftime('%H:%M:%S', line['time']), + \ (line['number']<0 ? '!' : (line['save'] ? '*' : ' ')), + \ tag)) + " DEBUG Version: + " call append('$', + " \ printf("%0*d) %8s %1s%1s %s %s", + " \ strlen(len(histdict)), i, + " \ localtime() - line['time'] > 24*3600 ? strftime('%b %d', line['time']) : strftime('%H:%M:%S', line['time']), + " \(line['save'] ? '*' : ' '), + " \(line['number']<0 ? '!' : ' '), + " \ tag, line['change'])) + endif + let i+=1 + endfor + %s/\r/\=submatch(0).repeat(' ', match(getline('.'), '\/')+1)/eg + endif + call s:HilightLines(s:GetLineNr(changenr,list)+1) + norm! zb + setl nomodifiable +endfun + +fun! s:HilightLines(changenr)"{{{1 + syn match UBTitle '^\%1lUndo-Tree: \zs.*$' + syn match UBInfo '^".*$' contains=UBKEY + syn match UBKey '^"\s\zs\%(\(<[^>]*>\)\|\u\)\ze\s' + syn match UBList '^\d\+\ze' nextgroup=UBDate,UBTime + syn match UBDate '\w\+\s\d\+\ze' + syn match UBTime '\d\d:\d\d:\d\d' "nextgroup=UBDelimStart + syn region UBTag matchgroup=UBDelim start='/' end='/$' keepend + if a:changenr + let search_pattern = '^0*'.a:changenr.')[^/]*' + "exe 'syn match UBActive "^0*'.a:changenr.')[^/]*"' + exe 'syn match UBActive "' . search_pattern . '"' + " Put cursor on the active tag + call search(search_pattern, 'cW') + endif + + hi def link UBTitle Title + hi def link UBInfo Comment + hi def link UBList Identifier + hi def link UBTag Special + hi def link UBTime Underlined + hi def link UBDate Underlined + hi def link UBDelim Ignore + hi def link UBActive PmenuSel + hi def link UBKey SpecialKey +endfun + +fun! s:PrintHelp(...)"{{{1 + let mess=['" actv. keys in this window'] + call add(mess, '" I toggles help screen') + if a:1 + call add(mess, "\" goto undo branch") + call add(mess, "\" \t Update view") + call add(mess, "\" T\t Tag sel. branch") + call add(mess, "\" P\t Toggle view") + call add(mess, "\" D\t Diff sel. branch") + call add(mess, "\" R\t Replay sel. branch") + call add(mess, "\" C\t Clear all tags") + call add(mess, "\" Q\t Quit window") + call add(mess, '"') + call add(mess, "\" Undo-Tree, v" . printf("%.02f",g:loaded_undo_browse)) + endif + call add(mess, '') + call append('$', mess) +endfun + +fun! s:DiffUndoBranch()"{{{1 + try + let change = s:ReturnBranch() + catch /histwin:/ + call histwin#WarningMsg("Please put the cursor on one list item, when switching to a branch!") + return + endtry + let prevchangenr=UndoBranch() + if empty(prevchangenr) + return '' + endif + let cur_ft = &ft + let buffer=getline(1,'$') + try + exe ':u ' . prevchangenr + setl modifiable + catch /Vim(undo):Undo number \d\+ not found/ + call s:WarningMsg("Undo Change not found!") + return '' + endtry + exe ':botright vsp '.tempname() + call setline(1, bufname(s:orig_buffer) . ' undo-branch: ' . change) + call append('$',buffer) + exe "setl ft=".cur_ft + silent w! + diffthis + exe bufwinnr(s:orig_buffer) . 'wincmd w' + diffthis +endfun + +fun! s:GetLineNr(changenr,list) "{{{1 + let i=0 + for item in a:list + if s:undo_tree_dtl && item.number == 0 + continue + endif + if item['change'] >= a:changenr + return i + endif + let i+=1 + endfor + return -1 +endfun + +fun! s:ReplayUndoBranch()"{{{1 + try + let change = s:ReturnBranch() + catch /histwin:/ + call histwin#WarningMsg("Please put the cursor on one list item, when replaying a branch!") + return + endtry + + let tags = getbufvar(s:orig_buffer, 'undo_tagdict') + + if empty(tags) + call histwin#WarningMsg("No Undotree available. Won't Replay") + return + endif + let tlist = sort(values(tags), "s:SortValues") + if s:undo_tree_dtl + call filter(tlist, 'v:val.number != 0') + endif + let key = (len(tlist) > change ? tlist[change].change : '') + + if empty(key) + call histwin#WarningMsg("Nothing to do") + return + endif + exe bufwinnr(s:orig_buffer) . ' wincmd w' + let change_old = changenr() + try + exe ':u ' . b:undo_tagdict[key]['change'] + exe 'earlier 99999999' + redraw + while changenr() < b:undo_tagdict[key]['change'] + red + redraw + exe ':sleep ' . s:undo_tree_speed . 'm' + endw + "catch /Undo number \d\+ not found/ + catch /Vim(undo):Undo number 0 not found/ + exe ':u ' . change_old + call s:WarningMsg("Replay not possible for initial state") + catch /Vim(undo):Undo number \d\+ not found/ + exe ':u ' . change_old + call s:WarningMsg("Replay not possible\nDid you reload the file?") + endtry +endfun + +fun! s:ReturnBranch()"{{{1 + let a=matchstr(getline('.'), '^0*\zs\d\+\ze')+0 + if a == -1 + call search('^\d\+)', 'b') + let a=matchstr(getline('.'), '^0*\zs\d\+\ze')+0 + endif + if a <= 0 + throw "histwin: No Branch" + return 0 + endif + return a-1 +endfun + +fun! s:ToggleHelpScreen()"{{{1 + let s:undo_help=!s:undo_help + exe bufwinnr(s:orig_buffer) . ' wincmd w' + call s:PrintUndoTree(s:HistWin()) +endfun + +fun! s:ToggleDetail()"{{{1 + let s:undo_tree_dtl=!s:undo_tree_dtl + call histwin#UndoBrowse() +endfun + +fun! s:UndoBranchTag()"{{{1 + + try + let change = s:ReturnBranch() + catch /histwin:/ + call histwin#WarningMsg("Please put the cursor on one list item, when tagging a branch!") + return + endtry + let tags = getbufvar(s:orig_buffer, 'undo_tagdict') + if empty(tags) + call histwin#WarningMsg("No Undotree available. Won't tag") + return + endif + let cdict = getbufvar(s:orig_buffer, 'undo_customtags') + let tlist = sort(values(tags), "s:SortValues") + if s:undo_tree_dtl + call filter(tlist, 'v:val.number != 0') + endif + let key = (len(tlist) > change ? tlist[change].change : '') + if empty(key) + return + endif + call inputsave() + let tag=input("Tagname " . (change+1) . ": ", tags[key]['tag']) + call inputrestore() + + let cdict[key] = {'tag': tag, + \'number': tags[key].number+0, + \'time': tags[key].time+0, + \'change': key+0, + \'save': tags[key].save+0} + "let cdict[key] = {'tag': tag, 'number': 0, 'time': strftime('%H:%M:%S'), 'change': key, 'save': 0} + "let tags[changenr] = {'tag': cdict[changenr][tag], 'change': changenr, 'number': tags[key]['number'], 'time': tags[key]['time']} + let tags[key]['tag'] = tag + call setbufvar(s:orig_buffer, 'undo_tagdict', tags) + call setbufvar(s:orig_buffer, 'undo_customtags', cdict) +endfun + +fun! s:UndoBranch()"{{{1 + let dict = getbufvar(s:orig_buffer, 'undo_tagdict') + if empty(dict) + call histwin#WarningMsg("No Undotree available. Can't switch to a different state!") + return + endif + try + let key = s:ReturnBranch() + catch /histwin:/ + call histwin#WarningMsg("Please put the cursor on one list item, when switching to a branch!") + return + endtry + let tlist = sort(values(dict), "s:SortValues") + if s:undo_tree_dtl + call filter(tlist, 'v:val.number != 0') + endif + let key = (len(tlist) > key ? tlist[key].change : '') + if empty(key) + call histwin#WarningMsg("Nothing to do.") + return + endif + " Last line? + if line('.') == line('$') + let tmod = 0 + else + let tmod = 1 + endif + exe bufwinnr(s:orig_buffer) . 'wincmd w' + " Save cursor pos + let cpos = getpos('.') + let cmd='' + let cur_changenr=changenr() + "let list=sort(values(b:undo_tagdict), 's:SortValues') + "let len = len(b:undo_tagdict) + " if len==1, then there is no + " undo branch available, which means + " we can't undo anyway + try + if key==0 + " Jump back to initial state + "let cmd=':earlier 9999999' + :u1 + if !&modifiable + setl modifiable + endif + norm 1u + else + exe ':u '.dict[key]['change'] + endif + if s:undo_tree_nomod && tmod + setl nomodifiable + else + setl modifiable + endif + catch /E830: Undo number \d\+ not found/ + exe ':u ' . cur_changenr + call histwin#WarningMsg("Undo Change not found.") + return + endtry + " this might have changed, so we return to the old cursor + " position. This could still be wrong, so + " So this is our best effort approach. + call setpos('.', cpos) + return cur_changenr +endfun + +fun! s:MapKeys()"{{{1 + nnoremap ${2} -snippet scriptsrc - ${2} -snippet style - ${3} -snippet base - -snippet r - -snippet div -
- ${2} -
-# Embed QT Movie -snippet movie - - - - - - ${6} -snippet fieldset -
- ${1:name} - - ${3} -
-snippet form -
- ${3} - - -

-
-snippet h1 -

${2:$1}

-snippet input - ${4} -snippet label - ${7} -snippet link - ${4} -snippet mailto - ${3:email me} -snippet meta - ${3} -snippet opt - ${3} -snippet optt - ${2} -snippet select - ${5} -snippet table - - - -
${2:Header}
${3:Data}
${4} -snippet textarea - ${5} diff -r 85db8aa3c1cc -r cdc196e91cd2 vim/bundle/snipmate/snippets/java.snippets --- a/vim/bundle/snipmate/snippets/java.snippets Fri Oct 08 09:26:49 2010 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,78 +0,0 @@ -snippet main - public static void main (String [] args) - { - ${1:/* code */} - } -snippet pu - public -snippet po - protected -snippet pr - private -snippet st - static -snippet fi - final -snippet ab - abstract -snippet re - return -snippet br - break; -snippet de - default: - ${1} -snippet ca - catch(${1:Exception} ${2:e}) ${3} -snippet th - throw -snippet sy - synchronized -snippet im - import -snippet j.u - java.util -snippet j.i - java.io. -snippet j.b - java.beans. -snippet j.n - java.net. -snippet j.m - java.math. -snippet if - if (${1}) ${2} -snippet el - else -snippet elif - else if (${1}) ${2} -snippet wh - while (${1}) ${2} -snippet for - for (${1}; ${2}; ${3}) ${4} -snippet fore - for (${1} : ${2}) ${3} -snippet sw - switch (${1}) ${2} -snippet cs - case ${1}: - ${2} - ${3} -snippet tc - public class ${1:`Filename()`} extends ${2:TestCase} -snippet t - public void test${1:Name}() throws Exception ${2} -snippet cl - class ${1:`Filename("", "untitled")`} ${2} -snippet in - interface ${1:`Filename("", "untitled")`} ${2:extends Parent}${3} -snippet m - ${1:void} ${2:method}(${3}) ${4:throws }${5} -snippet v - ${1:String} ${2:var}${3: = null}${4};${5} -snippet co - static public final ${1:String} ${2:var} = ${3};${4} -snippet cos - static public final String ${1:var} = "${2}";${3} -snippet as - assert ${1:test} : "${2:Failure message}";${3} diff -r 85db8aa3c1cc -r cdc196e91cd2 vim/bundle/snipmate/snippets/javascript.snippets --- a/vim/bundle/snipmate/snippets/javascript.snippets Fri Oct 08 09:26:49 2010 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,74 +0,0 @@ -# Prototype -snippet proto - ${1:class_name}.prototype.${2:method_name} = - function(${3:first_argument}) { - ${4:// body...} - }; -# Function -snippet fun - function ${1:function_name} (${2:argument}) { - ${3:// body...} - } -# Anonymous Function -snippet f - function(${1}) {${2}}; -# if -snippet if - if (${1:true}) {${2}}; -# if ... else -snippet ife - if (${1:true}) {${2}} - else{${3}}; -# tertiary conditional -snippet t - ${1:/* condition */} ? ${2:a} : ${3:b} -# switch -snippet switch - switch(${1:expression}) { - case '${3:case}': - ${4:// code} - break; - ${5} - default: - ${2:// code} - } -# case -snippet case - case '${1:case}': - ${2:// code} - break; - ${3} -# for (...) {...} -snippet for - for (var ${2:i} = 0; $2 < ${1:Things}.length; $2${3:++}) { - ${4:$1[$2]} - }; -# for (...) {...} (Improved Native For-Loop) -snippet forr - for (var ${2:i} = ${1:Things}.length - 1; $2 >= 0; $2${3:--}) { - ${4:$1[$2]} - }; -# while (...) {...} -snippet wh - while (${1:/* condition */}) { - ${2:/* code */} - } -# do...while -snippet do - do { - ${2:/* code */} - } while (${1:/* condition */}); -# Object Method -snippet :f - ${1:method_name}: function(${2:attribute}) { - ${4} - }${3:,} -# setTimeout function -snippet timeout - setTimeout(function() {${3}}${2}, ${1:10}; -# Get Elements -snippet get - getElementsBy${1:TagName}('${2}')${3} -# Get Element -snippet gett - getElementBy${1:Id}('${2}')${3} diff -r 85db8aa3c1cc -r cdc196e91cd2 vim/bundle/snipmate/snippets/mako.snippets --- a/vim/bundle/snipmate/snippets/mako.snippets Fri Oct 08 09:26:49 2010 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,54 +0,0 @@ -snippet def - <%def name="${1:name}"> - ${2:} - -snippet call - <%call expr="${1:name}"> - ${2:} - -snippet doc - <%doc> - ${1:} - -snippet text - <%text> - ${1:} - -snippet for - % for ${1:i} in ${2:iter}: - ${3:} - % endfor -snippet if if - % if ${1:condition}: - ${2:} - % endif -snippet if if/else - % if ${1:condition}: - ${2:} - % else: - ${3:} - % endif -snippet try - % try: - ${1:} - % except${2:}: - ${3:pass} - % endtry -snippet wh - % while ${1:}: - ${2:} - % endwhile -snippet $ - ${ ${1:} } -snippet <% - <% ${1:} %> -snippet -snippet inherit - <%inherit file="${1:filename}" /> -snippet include - <%include file="${1:filename}" /> -snippet namespace - <%namespace file="${1:name}" /> -snippet page - <%page args="${1:}" /> diff -r 85db8aa3c1cc -r cdc196e91cd2 vim/bundle/snipmate/snippets/objc.snippets --- a/vim/bundle/snipmate/snippets/objc.snippets Fri Oct 08 09:26:49 2010 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,184 +0,0 @@ -# #import <...> -snippet Imp - #import <${1:Cocoa/Cocoa.h}>${2} -# #import "..." -snippet imp - #import "${1:`Filename()`.h}"${2} -# @selector(...) -snippet sel - @selector(${1:method}:)${3} -# @"..." string -snippet s - @"${1}"${2} -# Object -snippet o - ${1:NSObject} *${2:foo} = [${3:$1 alloc}]${4};${5} -# NSLog(...) -snippet log - NSLog(@"${1:%@}"${2});${3} -# Class -snippet objc - @interface ${1:`Filename('', 'someClass')`} : ${2:NSObject} - { - } - @end - - @implementation $1 - ${3} - @end -# Class Interface -snippet int - @interface ${1:`Filename('', 'someClass')`} : ${2:NSObject} - {${3} - } - ${4} - @end -# Class Implementation -snippet impl - @implementation ${1:`Filename('', 'someClass')`} - ${2} - @end -snippet init - - (id)init - { - [super init]; - return self; - } -snippet ifself - if (self = [super init]) { - ${1:/* code */} - } - return self; -snippet ibo - IBOutlet ${1:NSSomeClass} *${2:$1};${3} -# Category -snippet cat - @interface ${1:NSObject} (${2:Category}) - @end - - @implementation $1 ($2) - ${3} - @end -# Category Interface -snippet cath - @interface ${1:NSObject} (${2:Category}) - ${3} - @end -# NSArray -snippet array - NSMutableArray *${1:array} = [NSMutable array];${2} -# NSDictionary -snippet dict - NSMutableDictionary *${1:dict} = [NSMutableDictionary dictionary];${2} -# NSBezierPath -snippet bez - NSBezierPath *${1:path} = [NSBezierPath bezierPath];${2} -# Method -snippet m - - (${1:id})${2:method} - { - ${3} - } -# Method declaration -snippet md - - (${1:id})${2:method};${3} -# IBAction declaration -snippet ibad - - (IBAction)${1:method}:(${2:id})sender;${3} -# IBAction method -snippet iba - - (IBAction)${1:method}:(${2:id})sender - { - ${3} - } -# awakeFromNib method -snippet wake - - (void)awakeFromNib - { - ${1} - } -# Class Method -snippet M - + (${1:id})${2:method} - {${3} - return nil; - } -# Sub-method (Call super) -snippet sm - - (${1:id})${2:method} - { - [super $2];${3} - return self; - } -# Method: Initialize -snippet I - + (void) initialize - { - [[NSUserDefaults standardUserDefaults] registerDefaults:[NSDictionary dictionaryWIthObjectsAndKeys: - ${1}@"value", @"key", - nil]]; - } -# Accessor Methods For: -# Object -snippet objacc - - (${1:id})${2:thing} - { - return $2; - } - - - (void)set$2:($1)${3:new$2} - { - [$3 retain]; - [$2 release]; - $2 = $3; - }${4} -# for (object in array) -snippet forin - for (${1:Class} *${2:some$1} in ${3:array}) { - ${4} - } -snippet forarray - unsigned int ${1:object}Count = [${2:array} count]; - - for (unsigned int index = 0; index < $1Count; index++) { - ${3:id} $1 = [$2 $1AtIndex:index]; - ${4} - } -# IBOutlet -# @property (Objective-C 2.0) -snippet prop - @property (${1:retain}) ${2:NSSomeClass} ${3:*$2};${4} -# @synthesize (Objective-C 2.0) -snippet syn - @synthesize ${1:property};${2} -# [[ alloc] init] -snippet alloc - [[${1:foo} alloc] init${2}];${3} -# retain -snippet ret - [${1:foo} retain];${2} -# release -snippet rel - [${1:foo} release]; - ${2:$1 = nil;} -# autorelease -snippet arel - [${1:foo} autorelease]; -# autorelease pool -snippet pool - NSAutoreleasePool *${1:pool} = [[NSAutoreleasePool alloc] init]; - ${2:/* code */} - [$1 drain]; -# Throw an exception -snippet except - NSException *${1:badness}; - $1 = [NSException exceptionWithName:@"${2:$1Name}" - reason:@"${3}" - userInfo:nil]; - [$1 raise]; -snippet prag - #pragma mark ${1:foo} -snippet cl - @class ${1:Foo};${2} -snippet color - [[NSColor ${1:blackColor}] set]; diff -r 85db8aa3c1cc -r cdc196e91cd2 vim/bundle/snipmate/snippets/perl.snippets --- a/vim/bundle/snipmate/snippets/perl.snippets Fri Oct 08 09:26:49 2010 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,91 +0,0 @@ -# #!/usr/bin/perl -snippet #! - #!/usr/bin/perl - -# Hash Pointer -snippet . - => -# Function -snippet sub - sub ${1:function_name} { - ${2:#body ...} - } -# Conditional -snippet if - if (${1}) { - ${2:# body...} - } -# Conditional if..else -snippet ife - if (${1}) { - ${2:# body...} - } else { - ${3:# else...} - } -# Conditional if..elsif..else -snippet ifee - if (${1}) { - ${2:# body...} - } elsif (${3}) { - ${4:# elsif...} - } else { - ${5:# else...} - } -# Conditional One-line -snippet xif - ${1:expression} if ${2:condition};${3} -# Unless conditional -snippet unless - unless (${1}) { - ${2:# body...} - } -# Unless conditional One-line -snippet xunless - ${1:expression} unless ${2:condition};${3} -# Try/Except -snippet eval - eval { - ${1:# do something risky...} - }; - if ($@) { - ${2:# handle failure...} - } -# While Loop -snippet wh - while (${1}) { - ${2:# body...} - } -# While Loop One-line -snippet xwh - ${1:expression} while ${2:condition};${3} -# For Loop -snippet for - for (my $${2:var} = 0; $$2 < ${1:count}; $$2${3:++}) { - ${4:# body...} - } -# Foreach Loop -snippet fore - foreach my $${1:x} (@${2:array}) { - ${3:# body...} - } -# Foreach Loop One-line -snippet xfore - ${1:expression} foreach @${2:array};${3} -# Package -snippet cl - package ${1:ClassName}; - - use base qw(${2:ParentClass}); - - sub new { - my $class = shift; - $class = ref $class if ref $class; - my $self = bless {}, $class; - $self; - } - - 1;${3} -# Read File -snippet slurp - my $${1:var}; - { local $/ = undef; local *FILE; open FILE, "<${2:file}"; $$1 = ; close FILE }${3} diff -r 85db8aa3c1cc -r cdc196e91cd2 vim/bundle/snipmate/snippets/php.snippets --- a/vim/bundle/snipmate/snippets/php.snippets Fri Oct 08 09:26:49 2010 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,216 +0,0 @@ -snippet php - -snippet ec - echo "${1:string}"${2}; -snippet inc - include '${1:file}';${2} -snippet inc1 - include_once '${1:file}';${2} -snippet req - require '${1:file}';${2} -snippet req1 - require_once '${1:file}';${2} -# $GLOBALS['...'] -snippet globals - $GLOBALS['${1:variable}']${2: = }${3:something}${4:;}${5} -snippet $_ COOKIE['...'] - $_COOKIE['${1:variable}']${2} -snippet $_ ENV['...'] - $_ENV['${1:variable}']${2} -snippet $_ FILES['...'] - $_FILES['${1:variable}']${2} -snippet $_ Get['...'] - $_GET['${1:variable}']${2} -snippet $_ POST['...'] - $_POST['${1:variable}']${2} -snippet $_ REQUEST['...'] - $_REQUEST['${1:variable}']${2} -snippet $_ SERVER['...'] - $_SERVER['${1:variable}']${2} -snippet $_ SESSION['...'] - $_SESSION['${1:variable}']${2} -# Start Docblock -snippet /* - /** - * ${1} - **/ -# Class - post doc -snippet doc_cp - /** - * ${1:undocumented class} - * - * @package ${2:default} - * @author ${3:`g:snips_author`} - **/${4} -# Class Variable - post doc -snippet doc_vp - /** - * ${1:undocumented class variable} - * - * @var ${2:string} - **/${3} -# Class Variable -snippet doc_v - /** - * ${3:undocumented class variable} - * - * @var ${4:string} - **/ - ${1:var} $${2};${5} -# Class -snippet doc_c - /** - * ${3:undocumented class} - * - * @packaged ${4:default} - * @author ${5:`g:snips_author`} - **/ - ${1:}class ${2:} - {${6} - } // END $1class $2 -# Constant Definition - post doc -snippet doc_dp - /** - * ${1:undocumented constant} - **/${2} -# Constant Definition -snippet doc_d - /** - * ${3:undocumented constant} - **/ - define(${1}, ${2});${4} -# Function - post doc -snippet doc_fp - /** - * ${1:undocumented function} - * - * @return ${2:void} - * @author ${3:`g:snips_author`} - **/${4} -# Function signature -snippet doc_s - /** - * ${4:undocumented function} - * - * @return ${5:void} - * @author ${6:`g:snips_author`} - **/ - ${1}function ${2}(${3});${7} -# Function -snippet doc_f - /** - * ${4:undocumented function} - * - * @return ${5:void} - * @author ${6:`g:snips_author`} - **/ - ${1}function ${2}(${3}) - {${7} - } -# Header -snippet doc_h - /** - * ${1} - * - * @author ${2:`g:snips_author`} - * @version ${3:$Id$} - * @copyright ${4:$2}, `strftime('%d %B, %Y')` - * @package ${5:default} - **/ - - /** - * Define DocBlock - *// -# Interface -snippet doc_i - /** - * ${2:undocumented class} - * - * @package ${3:default} - * @author ${4:`g:snips_author`} - **/ - interface ${1:} - {${5} - } // END interface $1 -# class ... -snippet class - /** - * ${1} - **/ - class ${2:ClassName} - { - ${3} - function ${4:__construct}(${5:argument}) - { - ${6:// code...} - } - } -# define(...) -snippet def - define('${1}'${2});${3} -# defined(...) -snippet def? - ${1}defined('${2}')${3} -snippet wh - while (${1:/* condition */}) { - ${2:// code...} - } -# do ... while -snippet do - do { - ${2:// code... } - } while (${1:/* condition */}); -snippet if - if (${1:/* condition */}) { - ${2:// code...} - } -snippet ife - if (${1:/* condition */}) { - ${2:// code...} - } else { - ${3:// code...} - } - ${4} -snippet else - else { - ${1:// code...} - } -snippet elseif - elseif (${1:/* condition */}) { - ${2:// code...} - } -# Tertiary conditional -snippet t - $${1:retVal} = (${2:condition}) ? ${3:a} : ${4:b};${5} -snippet switch - switch ($${1:variable}) { - case '${2:value}': - ${3:// code...} - break; - ${5} - default: - ${4:// code...} - break; - } -snippet case - case '${1:value}': - ${2:// code...} - break;${3} -snippet for - for ($${2:i} = 0; $$2 < ${1:count}; $$2${3:++}) { - ${4: // code...} - } -snippet foreach - foreach ($${1:variable} as $${2:key}) { - ${3:// code...} - } -snippet fun - ${1:public }function ${2:FunctionName}(${3}) - { - ${4:// code...} - } -# $... = array (...) -snippet array - $${1:arrayName} = array('${2}' => ${3});${4} diff -r 85db8aa3c1cc -r cdc196e91cd2 vim/bundle/snipmate/snippets/python.snippets --- a/vim/bundle/snipmate/snippets/python.snippets Fri Oct 08 09:26:49 2010 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,63 +0,0 @@ -snippet #! - #!/usr/bin/env python -snippet from - from ${1:sys} import ${2:*} -snippet while - while ${1:True}: - ${2:pass} -snippet for - for ${1:x} in ${2:xs}: - ${3:pass} -snippet fore - for ${1:n}, ${2:item} in enumerate(${3:items}): - ${4:pass} -snippet class - class ${1:ClassName}(${2:object}): - def __init__(self${3:, args}): - ${4:super($1, self).__init__()} - ${5} -snippet def - def ${1:function}(${2}): - ${3:pass} -snippet defs - def ${1:method}(self${2}): - ${3:pass} -snippet lam - lambda ${1:args}: ${2:action} -snippet . - self. -snippet try Try/Except - try: - ${1:pass} - except ${2:Exception}, ${3:e}: - ${4:raise $3} -snippet try Try/Except/Else - try: - ${1:pass} - except ${2:Exception}, ${3:e}: - ${4:raise $3} - else: - ${5:pass} -snippet try Try/Except/Finally - try: - ${1:pass} - except ${2:Exception}, ${3:e}: - ${4:raise $3} - finally: - ${5:pass} -snippet try Try/Except/Else/Finally - try: - ${1:pass} - except ${2:Exception}, ${3:e}: - ${4:raise $3} - else: - ${5:pass} - finally: - ${6:pass} -snippet ifmain - if __name__ == '__main__': - ${1:main()} -snippet _ - __${1:init}__${2} -snippet *** - *args, **kwargs diff -r 85db8aa3c1cc -r cdc196e91cd2 vim/bundle/snipmate/snippets/ruby.snippets --- a/vim/bundle/snipmate/snippets/ruby.snippets Fri Oct 08 09:26:49 2010 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,420 +0,0 @@ -# #!/usr/bin/ruby -snippet #! - #!/usr/bin/ruby - -# New Block -snippet =b - =begin rdoc - ${1} - =end -snippet y - :yields: ${1:arguments} -snippet rb - #!/usr/bin/env ruby -wKU - -snippet req - require "${1}"${2} -snippet # - # => -snippet end - __END__ -snippet case - case ${1:object} - when ${2:condition} - ${3} - end -snippet when - when ${1:condition} - ${2} -snippet def - def ${1:method_name} - ${2} - end -snippet deft - def test_${1:case_name} - ${2} - end -snippet if - if ${1:condition} - ${2} - end -snippet ife - if ${1:condition} - ${2} - else - ${3} - end -snippet elsif - elsif ${1:condition} - ${2} -snippet unless - unless ${1:condition} - ${2} - end -snippet while - while ${1:condition} - ${2} - end -snippet until - until ${1:condition} - ${2} - end -snippet cla class .. end - class ${1:`substitute(Filename(), '^.', '\u&', '')`} - ${2} - end -snippet cla class .. initialize .. end - class ${1:`substitute(Filename(), '^.', '\u&', '')`} - def initialize(${2:args}) - ${3} - end - - - end -snippet cla class .. < ParentClass .. initialize .. end - class ${1:`substitute(Filename(), '^.', '\u&', '')`} < ${2:ParentClass} - def initialize(${3:args}) - ${4} - end - - - end -snippet cla ClassName = Struct .. do .. end - ${1:`substitute(Filename(), '^.', '\u&', '')`} = Struct.new(:${2:attr_names}) do - def ${3:method_name} - ${4} - end - - - end -snippet cla class BlankSlate .. initialize .. end - class ${1:BlankSlate} - instance_methods.each { |meth| undef_method(meth) unless meth =~ /\A__/ } -snippet cla class << self .. end - class << ${1:self} - ${2} - end -# class .. < DelegateClass .. initialize .. end -snippet cla- - class ${1:`substitute(Filename(), '^.', '\u&', '')`} < DelegateClass(${2:ParentClass}) - def initialize(${3:args}) - super(${4:del_obj}) - - ${5} - end - - - end -snippet mod module .. end - module ${1:`substitute(Filename(), '^.', '\u&', '')`} - ${2} - end -snippet mod module .. module_function .. end - module ${1:`substitute(Filename(), '^.', '\u&', '')`} - module_function - - ${2} - end -snippet mod module .. ClassMethods .. end - module ${1:`substitute(Filename(), '^.', '\u&', '')`} - module ClassMethods - ${2} - end - - module InstanceMethods - - end - - def self.included(receiver) - receiver.extend ClassMethods - receiver.send :include, InstanceMethods - end - end -# attr_reader -snippet r - attr_reader :${1:attr_names} -# attr_writer -snippet w - attr_writer :${1:attr_names} -# attr_accessor -snippet rw - attr_accessor :${1:attr_names} -# include Enumerable -snippet Enum - include Enumerable - - def each(&block) - ${1} - end -# include Comparable -snippet Comp - include Comparable - - def <=>(other) - ${1} - end -# extend Forwardable -snippet Forw- - extend Forwardable -# def self -snippet defs - def self.${1:class_method_name} - ${2} - end -# def method_missing -snippet defmm - def method_missing(meth, *args, &blk) - ${1} - end -snippet defd - def_delegator :${1:@del_obj}, :${2:del_meth}, :${3:new_name} -snippet defds - def_delegators :${1:@del_obj}, :${2:del_methods} -snippet am - alias_method :${1:new_name}, :${2:old_name} -snippet app - if __FILE__ == $PROGRAM_NAME - ${1} - end -# usage_if() -snippet usai - if ARGV.${1} - abort "Usage: #{$PROGRAM_NAME} ${2:ARGS_GO_HERE}"${3} - end -# usage_unless() -snippet usau - unless ARGV.${1} - abort "Usage: #{$PROGRAM_NAME} ${2:ARGS_GO_HERE}"${3} - end -snippet array - Array.new(${1:10}) { |${2:i}| ${3} } -snippet hash - Hash.new { |${1:hash}, ${2:key}| $1[$2] = ${3} } -snippet file File.foreach() { |line| .. } - File.foreach(${1:"path/to/file"}) { |${2:line}| ${3} } -snippet file File.read() - File.read(${1:"path/to/file"})${2} -snippet Dir Dir.global() { |file| .. } - Dir.glob(${1:"dir/glob/*"}) { |${2:file}| ${3} } -snippet Dir Dir[".."] - Dir[${1:"glob/**/*.rb"}]${2} -snippet dir - Filename.dirname(__FILE__) -snippet deli - delete_if { |${1:e}| ${2} } -snippet fil - fill(${1:range}) { |${2:i}| ${3} } -# flatten_once() -snippet flao - inject(Array.new) { |${1:arr}, ${2:a}| $1.push(*$2)}${3} -snippet zip - zip(${1:enums}) { |${2:row}| ${3} } -# downto(0) { |n| .. } -snippet dow - downto(${1:0}) { |${2:n}| ${3} } -snippet ste - step(${1:2}) { |${2:n}| ${3} } -snippet tim - times { |${1:n}| ${2} } -snippet upt - upto(${1:1.0/0.0}) { |${2:n}| ${3} } -snippet loo - loop { ${1} } -snippet ea - each { |${1:e}| ${2} } -snippet eab - each_byte { |${1:byte}| ${2} } -snippet eac- each_char { |chr| .. } - each_char { |${1:chr}| ${2} } -snippet eac- each_cons(..) { |group| .. } - each_cons(${1:2}) { |${2:group}| ${3} } -snippet eai - each_index { |${1:i}| ${2} } -snippet eak - each_key { |${1:key}| ${2} } -snippet eal - each_line { |${1:line}| ${2} } -snippet eap - each_pair { |${1:name}, ${2:val}| ${3} } -snippet eas- - each_slice(${1:2}) { |${2:group}| ${3} } -snippet eav - each_value { |${1:val}| ${2} } -snippet eawi - each_with_index { |${1:e}, ${2:i}| ${3} } -snippet reve - reverse_each { |${1:e}| ${2} } -snippet inj - inject(${1:init}) { |${2:mem}, ${3:var}| ${4} } -snippet map - map { |${1:e}| ${2} } -snippet mapwi- - enum_with_index.map { |${1:e}, ${2:i}| ${3} } -snippet sor - sort { |a, b| ${1} } -snippet sorb - sort_by { |${1:e}| ${2} } -snippet ran - sort_by { rand } -snippet all - all? { |${1:e}| ${2} } -snippet any - any? { |${1:e}| ${2} } -snippet cl - classify { |${1:e}| ${2} } -snippet col - collect { |${1:e}| ${2} } -snippet det - detect { |${1:e}| ${2} } -snippet fet - fetch(${1:name}) { |${2:key}| ${3} } -snippet fin - find { |${1:e}| ${2} } -snippet fina - find_all { |${1:e}| ${2} } -snippet gre - grep(${1:/pattern/}) { |${2:match}| ${3} } -snippet sub - ${1:g}sub(${2:/pattern/}) { |${3:match}| ${4} } -snippet sca - scan(${1:/pattern/}) { |${2:match}| ${3} } -snippet max - max { |a, b|, ${1} } -snippet min - min { |a, b|, ${1} } -snippet par - partition { |${1:e}|, ${2} } -snippet rej - reject { |${1:e}|, ${2} } -snippet sel - select { |${1:e}|, ${2} } -snippet lam - lambda { |${1:args}| ${2} } -snippet do - do |${1:variable}| - ${2} - end -snippet : - :${1:key} => ${2:"value"}${3} -snippet ope - open(${1:"path/or/url/or/pipe"}, "${2:w}") { |${3:io}| ${4} } -# path_from_here() -snippet patfh - File.join(File.dirname(__FILE__), *%2[${1:rel path here}])${2} -# unix_filter {} -snippet unif - ARGF.each_line${1} do |${2:line}| - ${3} - end -# option_parse {} -snippet optp - require "optparse" - - options = {${1:default => "args"}} - - ARGV.options do |opts| - opts.banner = "Usage: #{File.basename($PROGRAM_NAME)} -snippet opt - opts.on( "-${1:o}", "--${2:long-option-name}", ${3:String}, - "${4:Option description.}") do |${5:opt}| - ${6} - end -snippet tc - require "test/unit" - - require "${1:library_file_name}" - - class Test${2:$1} < Test::Unit::TestCase - def test_${3:case_name} - ${4} - end - end -snippet ts - require "test/unit" - - require "tc_${1:test_case_file}" - require "tc_${2:test_case_file}"${3} -snippet as - assert(${1:test}, "${2:Failure message.}")${3} -snippet ase - assert_equal(${1:expected}, ${2:actual})${3} -snippet asne - assert_not_equal(${1:unexpected}, ${2:actual})${3} -snippet asid - assert_in_delta(${1:expected_float}, ${2:actual_float}, ${3:2 ** -20})${4} -snippet asio - assert_instance_of(${1:ExpectedClass}, ${2:actual_instance})${3} -snippet asko - assert_kind_of(${1:ExpectedKind}, ${2:actual_instance})${3} -snippet asn - assert_nil(${1:instance})${2} -snippet asnn - assert_not_nil(${1:instance})${2} -snippet asm - assert_match(/${1:expected_pattern}/, ${2:actual_string})${3} -snippet asnm - assert_no_match(/${1:unexpected_pattern}/, ${2:actual_string})${3} -snippet aso - assert_operator(${1:left}, :${2:operator}, ${3:right})${4} -snippet asr - assert_raise(${1:Exception}) { ${2} } -snippet asnr - assert_nothing_raised(${1:Exception}) { ${2} } -snippet asrt - assert_respond_to(${1:object}, :${2:method})${3} -snippet ass assert_same(..) - assert_same(${1:expected}, ${2:actual})${3} -snippet ass assert_send(..) - assert_send([${1:object}, :${2:message}, ${3:args}])${4} -snippet asns - assert_not_same(${1:unexpected}, ${2:actual})${3} -snippet ast - assert_throws(:${1:expected}) { ${2} } -snippet asnt - assert_nothing_thrown { ${1} } -snippet fl - flunk("${1:Failure message.}")${2} -# Benchmark.bmbm do .. end -snippet bm- - TESTS = ${1:10_000} - Benchmark.bmbm do |results| - ${2} - end -snippet rep - results.report("${1:name}:") { TESTS.times { ${2} }} -# Marshal.dump(.., file) -snippet Md - File.open(${1:"path/to/file.dump"}, "wb") { |${2:file}| Marshal.dump(${3:obj}, $2) }${4} -# Mashal.load(obj) -snippet Ml - File.open(${1:"path/to/file.dump"}, "rb") { |${2:file}| Marshal.load($2) }${3} -# deep_copy(..) -snippet deec - Marshal.load(Marshal.dump(${1:obj_to_copy}))${2} -snippet Pn- - PStore.new(${1:"file_name.pstore"})${2} -snippet tra - transaction(${1:true}) { ${2} } -# xmlread(..) -snippet xml- - REXML::Document.new(File.read(${1:"path/to/file"}))${2} -# xpath(..) { .. } -snippet xpa - elements.each(${1:"//Xpath"}) do |${2:node}| - ${3} - end -# class_from_name() -snippet clafn - split("::").inject(Object) { |par, const| par.const_get(const) } -# singleton_class() -snippet sinc - class << self; self end -snippet nam - namespace :${1:`Filename()`} do - ${2} - end -snippet tas - desc "${1:Task description\}" - task :${2:task_name => [:dependent, :tasks]} do - ${3} - end diff -r 85db8aa3c1cc -r cdc196e91cd2 vim/bundle/snipmate/snippets/sh.snippets --- a/vim/bundle/snipmate/snippets/sh.snippets Fri Oct 08 09:26:49 2010 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,28 +0,0 @@ -# #!/bin/bash -snippet #! - #!/bin/bash - -snippet if - if [[ ${1:condition} ]]; then - ${2:#statements} - fi -snippet elif - elif [[ ${1:condition} ]]; then - ${2:#statements} -snippet for - for (( ${2:i} = 0; $2 < ${1:count}; $2++ )); do - ${3:#statements} - done -snippet wh - while [[ ${1:condition} ]]; do - ${2:#statements} - done -snippet until - until [[ ${1:condition} ]]; do - ${2:#statements} - done -snippet case - case ${1:word} in - ${2:pattern}) - ${3};; - esac diff -r 85db8aa3c1cc -r cdc196e91cd2 vim/bundle/snipmate/snippets/snippet.snippets --- a/vim/bundle/snipmate/snippets/snippet.snippets Fri Oct 08 09:26:49 2010 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,7 +0,0 @@ -# snippets for making snippets :) -snippet snip - snippet ${1:trigger} - ${2} -snippet msnip - snippet ${1:trigger} ${2:description} - ${3} diff -r 85db8aa3c1cc -r cdc196e91cd2 vim/bundle/snipmate/snippets/tcl.snippets --- a/vim/bundle/snipmate/snippets/tcl.snippets Fri Oct 08 09:26:49 2010 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,92 +0,0 @@ -# #!/usr/bin/tclsh -snippet #! - #!/usr/bin/tclsh - -# Process -snippet pro - proc ${1:function_name} {${2:args}} { - ${3:#body ...} - } -#xif -snippet xif - ${1:expr}? ${2:true} : ${3:false} -# Conditional -snippet if - if {${1}} { - ${2:# body...} - } -# Conditional if..else -snippet ife - if {${1}} { - ${2:# body...} - } else { - ${3:# else...} - } -# Conditional if..elsif..else -snippet ifee - if {${1}} { - ${2:# body...} - } elseif {${3}} { - ${4:# elsif...} - } else { - ${5:# else...} - } -# If catch then -snippet ifc - if { [catch {${1:#do something...}} ${2:err}] } { - ${3:# handle failure...} - } -# Catch -snippet catch - catch {${1}} ${2:err} ${3:options} -# While Loop -snippet wh - while {${1}} { - ${2:# body...} - } -# For Loop -snippet for - for {set ${2:var} 0} {$$2 < ${1:count}} {${3:incr} $2} { - ${4:# body...} - } -# Foreach Loop -snippet fore - foreach ${1:x} {${2:#list}} { - ${3:# body...} - } -# after ms script... -snippet af - after ${1:ms} ${2:#do something} -# after cancel id -snippet afc - after cancel ${1:id or script} -# after idle -snippet afi - after idle ${1:script} -# after info id -snippet afin - after info ${1:id} -# Expr -snippet exp - expr {${1:#expression here}} -# Switch -snippet sw - switch ${1:var} { - ${3:pattern 1} { - ${4:#do something} - } - default { - ${2:#do something} - } - } -# Case -snippet ca - ${1:pattern} { - ${2:#do something} - }${3} -# Namespace eval -snippet ns - namespace eval ${1:path} {${2:#script...}} -# Namespace current -snippet nsc - namespace current diff -r 85db8aa3c1cc -r cdc196e91cd2 vim/bundle/snipmate/snippets/tex.snippets --- a/vim/bundle/snipmate/snippets/tex.snippets Fri Oct 08 09:26:49 2010 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,115 +0,0 @@ -# \begin{}...\end{} -snippet begin - \begin{${1:env}} - ${2} - \end{$1} -# Tabular -snippet tab - \begin{${1:tabular}}{${2:c}} - ${3} - \end{$1} -# Align(ed) -snippet ali - \begin{align${1:ed}} - ${2} - \end{align$1} -# Gather(ed) -snippet gat - \begin{gather${1:ed}} - ${2} - \end{gather$1} -# Equation -snippet eq - \begin{equation} - ${1} - \end{equation} -# Unnumbered Equation -snippet \ - \\[ - ${1} - \\] -# Enumerate -snippet enum - \begin{enumerate} - \item ${1} - \end{enumerate} -# Itemize -snippet item - \begin{itemize} - \item ${1} - \end{itemize} -# Description -snippet desc - \begin{description} - \item[${1}] ${2} - \end{description} -# Matrix -snippet mat - \begin{${1:p/b/v/V/B/small}matrix} - ${2} - \end{$1matrix} -# Cases -snippet cas - \begin{cases} - ${1:equation}, &\text{ if }${2:case}\\ - ${3} - \end{cases} -# Split -snippet spl - \begin{split} - ${1} - \end{split} -# Part -snippet part - \part{${1:part name}} % (fold) - \label{prt:${2:$1}} - ${3} - % part $2 (end) -# Chapter -snippet cha - \chapter{${1:chapter name}} % (fold) - \label{cha:${2:$1}} - ${3} - % chapter $2 (end) -# Section -snippet sec - \section{${1:section name}} % (fold) - \label{sec:${2:$1}} - ${3} - % section $2 (end) -# Sub Section -snippet sub - \subsection{${1:subsection name}} % (fold) - \label{sub:${2:$1}} - ${3} - % subsection $2 (end) -# Sub Sub Section -snippet subs - \subsubsection{${1:subsubsection name}} % (fold) - \label{ssub:${2:$1}} - ${3} - % subsubsection $2 (end) -# Paragraph -snippet par - \paragraph{${1:paragraph name}} % (fold) - \label{par:${2:$1}} - ${3} - % paragraph $2 (end) -# Sub Paragraph -snippet subp - \subparagraph{${1:subparagraph name}} % (fold) - \label{subp:${2:$1}} - ${3} - % subparagraph $2 (end) -snippet itd - \item[${1:description}] ${2:item} -snippet figure - ${1:Figure}~\ref{${2:fig:}}${3} -snippet table - ${1:Table}~\ref{${2:tab:}}${3} -snippet listing - ${1:Listing}~\ref{${2:list}}${3} -snippet section - ${1:Section}~\ref{${2:sec:}}${3} -snippet page - ${1:page}~\pageref{${2}}${3} diff -r 85db8aa3c1cc -r cdc196e91cd2 vim/bundle/snipmate/snippets/vim.snippets --- a/vim/bundle/snipmate/snippets/vim.snippets Fri Oct 08 09:26:49 2010 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,32 +0,0 @@ -snippet header - " File: ${1:`expand('%:t')`} - " Author: ${2:`g:snips_author`} - " Description: ${3} - ${4:" Last Modified: `strftime("%B %d, %Y")`} -snippet guard - if exists('${1:did_`Filename()`}') || &cp${2: || version < 700} - finish - endif - let $1 = 1${3} -snippet f - fun ${1:function_name}(${2}) - ${3:" code} - endf -snippet for - for ${1:needle} in ${2:haystack} - ${3:" code} - endfor -snippet wh - while ${1:condition} - ${2:" code} - endw -snippet if - if ${1:condition} - ${2:" code} - endif -snippet ife - if ${1:condition} - ${2} - else - ${3} - endif diff -r 85db8aa3c1cc -r cdc196e91cd2 vim/bundle/snipmate/snippets/zsh.snippets --- a/vim/bundle/snipmate/snippets/zsh.snippets Fri Oct 08 09:26:49 2010 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,58 +0,0 @@ -# #!/bin/zsh -snippet #! - #!/bin/zsh - -snippet if - if ${1:condition}; then - ${2:# statements} - fi -snippet ife - if ${1:condition}; then - ${2:# statements} - else - ${3:# statements} - fi -snippet elif - elif ${1:condition} ; then - ${2:# statements} -snippet for - for (( ${2:i} = 0; $2 < ${1:count}; $2++ )); do - ${3:# statements} - done -snippet fore - for ${1:item} in ${2:list}; do - ${3:# statements} - done -snippet wh - while ${1:condition}; do - ${2:# statements} - done -snippet until - until ${1:condition}; do - ${2:# statements} - done -snippet repeat - repeat ${1:integer}; do - ${2:# statements} - done -snippet case - case ${1:word} in - ${2:pattern}) - ${3};; - esac -snippet select - select ${1:answer} in ${2:choices}; do - ${3:# statements} - done -snippet ( - ( ${1:#statements} ) -snippet { - { ${1:#statements} } -snippet [ - [[ ${1:test} ]] -snippet always - { ${1:try} } always { ${2:always} } -snippet fun - function ${1:name} (${2:args}) { - ${3:# body} - } diff -r 85db8aa3c1cc -r cdc196e91cd2 vim/ftplugin/htmldjango/surround.vim --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vim/ftplugin/htmldjango/surround.vim Mon Oct 11 09:31:18 2010 -0400 @@ -0,0 +1,6 @@ +let g:surround_{char2nr("b")} = "{% block\1 \r..*\r &\1 %}\r{% endblock %}" +let g:surround_{char2nr("i")} = "{% if\1 \r..*\r &\1 %}\r{% endif %}" +let g:surround_{char2nr("w")} = "{% with\1 \r..*\r &\1 %}\r{% endwith %}" +let g:surround_{char2nr("c")} = "{% comment\1 \r..*\r &\1 %}\r{% endcomment %}" +let g:surround_{char2nr("f")} = "{% for\1 \r..*\r &\1 %}\r{% endfor %}" + diff -r 85db8aa3c1cc -r cdc196e91cd2 vim/snippets/_.snippets --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vim/snippets/_.snippets Mon Oct 11 09:31:18 2010 -0400 @@ -0,0 +1,7 @@ +# Global snippets + +# (c) holds no legal value ;) +snippet c) + `&enc[:2] == "utf" ? "©" : "(c)"` Copyright `strftime("%Y")` ${1:`g:snips_author`}. All Rights Reserved.${2} +snippet date + `strftime("%Y-%m-%d")` diff -r 85db8aa3c1cc -r cdc196e91cd2 vim/snippets/autoit.snippets --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vim/snippets/autoit.snippets Mon Oct 11 09:31:18 2010 -0400 @@ -0,0 +1,66 @@ +snippet if + If ${1:condition} Then + ${2:; True code} + EndIf +snippet el + Else + ${1} +snippet elif + ElseIf ${1:condition} Then + ${2:; True code} +# If/Else block +snippet ifel + If ${1:condition} Then + ${2:; True code} + Else + ${3:; Else code} + EndIf +# If/ElseIf/Else block +snippet ifelif + If ${1:condition 1} Then + ${2:; True code} + ElseIf ${3:condition 2} Then + ${4:; True code} + Else + ${5:; Else code} + EndIf +# Switch block +snippet switch + Switch (${1:condition}) + Case {$2:case1}: + {$3:; Case 1 code} + Case Else: + {$4:; Else code} + EndSwitch +# Select block +snippet select + Select (${1:condition}) + Case {$2:case1}: + {$3:; Case 1 code} + Case Else: + {$4:; Else code} + EndSelect +# While loop +snippet while + While (${1:condition}) + ${2:; code...} + WEnd +# For loop +snippet for + For ${1:n} = ${3:1} to ${2:count} + ${4:; code...} + Next +# New Function +snippet func + Func ${1:fname}(${2:`indent('.') ? 'self' : ''`}): + ${4:Return} + EndFunc +# Message box +snippet msg + MsgBox(${3:MsgType}, ${1:"Title"}, ${2:"Message Text"}) +# Debug Message +snippet debug + MsgBox(0, "Debug", ${1:"Debug Message"}) +# Show Variable Debug Message +snippet showvar + MsgBox(0, "${1:VarName}", $1) diff -r 85db8aa3c1cc -r cdc196e91cd2 vim/snippets/c.snippets --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vim/snippets/c.snippets Mon Oct 11 09:31:18 2010 -0400 @@ -0,0 +1,110 @@ +# main() +snippet main + int main(int argc, const char *argv[]) + { + ${1} + return 0; + } +# #include <...> +snippet inc + #include <${1:stdio}.h>${2} +# #include "..." +snippet Inc + #include "${1:`Filename("$1.h")`}"${2} +# #ifndef ... #define ... #endif +snippet Def + #ifndef $1 + #define ${1:SYMBOL} ${2:value} + #endif${3} +snippet def + #define +snippet ifdef + #ifdef ${1:FOO} + ${2:#define } + #endif +snippet #if + #if ${1:FOO} + ${2} + #endif +# Header Include-Guard +# (the randomizer code is taken directly from TextMate; it could probably be +# cleaner, I don't know how to do it in vim script) +snippet once + #ifndef ${1:`toupper(Filename('', 'UNTITLED').'_'.system("/usr/bin/ruby -e 'print (rand * 2821109907455).round.to_s(36)'"))`} + + #define $1 + + ${2} + + #endif /* end of include guard: $1 */ +# If Condition +snippet if + if (${1:/* condition */}) { + ${2:/* code */} + } +snippet el + else { + ${1} + } +# Tertiary conditional +snippet t + ${1:/* condition */} ? ${2:a} : ${3:b} +# Do While Loop +snippet do + do { + ${2:/* code */} + } while (${1:/* condition */}); +# While Loop +snippet wh + while (${1:/* condition */}) { + ${2:/* code */} + } +# For Loop +snippet for + for (${2:i} = 0; $2 < ${1:count}; $2${3:++}) { + ${4:/* code */} + } +# Custom For Loop +snippet forr + for (${1:i} = ${2:0}; ${3:$1 < 10}; $1${4:++}) { + ${5:/* code */} + } +# Function +snippet fun + ${1:void} ${2:function_name}(${3}) + { + ${4:/* code */} + } +# Function Declaration +snippet fund + ${1:void} ${2:function_name}(${3});${4} +# Typedef +snippet td + typedef ${1:int} ${2:MyCustomType};${3} +# Struct +snippet st + struct ${1:`Filename('$1_t', 'name')`} { + ${2:/* data */} + }${3: /* optional variable list */};${4} +# Typedef struct +snippet tds + typedef struct ${2:_$1 }{ + ${3:/* data */} + } ${1:`Filename('$1_t', 'name')`}; +# Typdef enum +snippet tde + typedef enum { + ${1:/* data */} + } ${2:foo}; +# printf +# unfortunately version this isn't as nice as TextMates's, given the lack of a +# dynamic `...` +snippet pr + printf("${1:%s}\n"${2});${3} +# fprintf (again, this isn't as nice as TextMate's version, but it works) +snippet fpr + fprintf(${1:stderr}, "${2:%s}\n"${3});${4} +snippet . + [${1}]${2} +snippet un + unsigned diff -r 85db8aa3c1cc -r cdc196e91cd2 vim/snippets/cpp.snippets --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vim/snippets/cpp.snippets Mon Oct 11 09:31:18 2010 -0400 @@ -0,0 +1,30 @@ +# Read File Into Vector +snippet readfile + std::vector v; + if (FILE *${2:fp} = fopen(${1:"filename"}, "r")) { + char buf[1024]; + while (size_t len = fread(buf, 1, sizeof(buf), $2)) + v.insert(v.end(), buf, buf + len); + fclose($2); + }${3} +# std::map +snippet map + std::map<${1:key}, ${2:value}> map${3}; +# std::vector +snippet vector + std::vector<${1:char}> v${2}; +# Namespace +snippet ns + namespace ${1:`Filename('', 'my')`} { + ${2} + } /* $1 */ +# Class +snippet cl + class ${1:`Filename('$1_t', 'name')`} { + public: + $1 (${2:arguments}); + virtual ~$1 (); + + private: + ${3:/* data */} + }; diff -r 85db8aa3c1cc -r cdc196e91cd2 vim/snippets/html.snippets --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vim/snippets/html.snippets Mon Oct 11 09:31:18 2010 -0400 @@ -0,0 +1,190 @@ +# Some useful Unicode entities +# Non-Breaking Space +snippet nbs +   +# ← +snippet left + ← +# → +snippet right + → +# ↑ +snippet up + ↑ +# ↓ +snippet down + ↓ +# ↩ +snippet return + ↩ +# ⇤ +snippet backtab + ⇤ +# ⇥ +snippet tab + ⇥ +# ⇧ +snippet shift + ⇧ +# ⌃ +snippet control + ⌃ +# ⌅ +snippet enter + ⌅ +# ⌘ +snippet command + ⌘ +# ⌥ +snippet option + ⌥ +# ⌦ +snippet delete + ⌦ +# ⌫ +snippet backspace + ⌫ +# ⎋ +snippet escape + ⎋ +# Generic Doctype +snippet doctype HTML 4.01 Strict + +snippet doctype HTML 4.01 Transitional + +snippet doctype HTML 5 + +snippet doctype XHTML 1.0 Frameset + +snippet doctype XHTML 1.0 Strict + +snippet doctype XHTML 1.0 Transitional + +snippet doctype XHTML 1.1 + +# HTML Doctype 4.01 Strict +snippet docts + +# HTML Doctype 4.01 Transitional +snippet doct + +# HTML Doctype 5 +snippet doct5 + +# XHTML Doctype 1.0 Frameset +snippet docxf + +# XHTML Doctype 1.0 Strict +snippet docxs + +# XHTML Doctype 1.0 Transitional +snippet docxt + +# XHTML Doctype 1.1 +snippet docx + +snippet html + + ${1} + +snippet xhtml + + ${1} + +snippet body + + ${1} + +snippet head + + + + ${1:`substitute(Filename('', 'Page Title'), '^.', '\u&', '')`} + ${2} + +snippet title + ${1:`substitute(Filename('', 'Page Title'), '^.', '\u&', '')`}${2} +snippet script + ${2} +snippet scriptsrc + ${2} +snippet style + ${3} +snippet base + +snippet r + +snippet div +
+ ${2} +
+# Embed QT Movie +snippet movie + + + + + + ${6} +snippet fieldset +
+ ${1:name} + + ${3} +
+snippet form +
+ ${3} + + +

+
+snippet h1 +

${2:$1}

+snippet input + ${4} +snippet label + ${7} +snippet link + ${4} +snippet mailto + ${3:email me} +snippet meta + ${3} +snippet opt + ${3} +snippet optt + ${2} +snippet select + ${5} +snippet table + + + +
${2:Header}
${3:Data}
${4} +snippet textarea + ${5} diff -r 85db8aa3c1cc -r cdc196e91cd2 vim/snippets/java.snippets --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vim/snippets/java.snippets Mon Oct 11 09:31:18 2010 -0400 @@ -0,0 +1,78 @@ +snippet main + public static void main (String [] args) + { + ${1:/* code */} + } +snippet pu + public +snippet po + protected +snippet pr + private +snippet st + static +snippet fi + final +snippet ab + abstract +snippet re + return +snippet br + break; +snippet de + default: + ${1} +snippet ca + catch(${1:Exception} ${2:e}) ${3} +snippet th + throw +snippet sy + synchronized +snippet im + import +snippet j.u + java.util +snippet j.i + java.io. +snippet j.b + java.beans. +snippet j.n + java.net. +snippet j.m + java.math. +snippet if + if (${1}) ${2} +snippet el + else +snippet elif + else if (${1}) ${2} +snippet wh + while (${1}) ${2} +snippet for + for (${1}; ${2}; ${3}) ${4} +snippet fore + for (${1} : ${2}) ${3} +snippet sw + switch (${1}) ${2} +snippet cs + case ${1}: + ${2} + ${3} +snippet tc + public class ${1:`Filename()`} extends ${2:TestCase} +snippet t + public void test${1:Name}() throws Exception ${2} +snippet cl + class ${1:`Filename("", "untitled")`} ${2} +snippet in + interface ${1:`Filename("", "untitled")`} ${2:extends Parent}${3} +snippet m + ${1:void} ${2:method}(${3}) ${4:throws }${5} +snippet v + ${1:String} ${2:var}${3: = null}${4};${5} +snippet co + static public final ${1:String} ${2:var} = ${3};${4} +snippet cos + static public final String ${1:var} = "${2}";${3} +snippet as + assert ${1:test} : "${2:Failure message}";${3} diff -r 85db8aa3c1cc -r cdc196e91cd2 vim/snippets/javascript.snippets --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vim/snippets/javascript.snippets Mon Oct 11 09:31:18 2010 -0400 @@ -0,0 +1,74 @@ +# Prototype +snippet proto + ${1:class_name}.prototype.${2:method_name} = + function(${3:first_argument}) { + ${4:// body...} + }; +# Function +snippet fun + function ${1:function_name} (${2:argument}) { + ${3:// body...} + } +# Anonymous Function +snippet f + function(${1}) {${2}}; +# if +snippet if + if (${1:true}) {${2}}; +# if ... else +snippet ife + if (${1:true}) {${2}} + else{${3}}; +# tertiary conditional +snippet t + ${1:/* condition */} ? ${2:a} : ${3:b} +# switch +snippet switch + switch(${1:expression}) { + case '${3:case}': + ${4:// code} + break; + ${5} + default: + ${2:// code} + } +# case +snippet case + case '${1:case}': + ${2:// code} + break; + ${3} +# for (...) {...} +snippet for + for (var ${2:i} = 0; $2 < ${1:Things}.length; $2${3:++}) { + ${4:$1[$2]} + }; +# for (...) {...} (Improved Native For-Loop) +snippet forr + for (var ${2:i} = ${1:Things}.length - 1; $2 >= 0; $2${3:--}) { + ${4:$1[$2]} + }; +# while (...) {...} +snippet wh + while (${1:/* condition */}) { + ${2:/* code */} + } +# do...while +snippet do + do { + ${2:/* code */} + } while (${1:/* condition */}); +# Object Method +snippet :f + ${1:method_name}: function(${2:attribute}) { + ${4} + }${3:,} +# setTimeout function +snippet timeout + setTimeout(function() {${3}}${2}, ${1:10}; +# Get Elements +snippet get + getElementsBy${1:TagName}('${2}')${3} +# Get Element +snippet gett + getElementBy${1:Id}('${2}')${3} diff -r 85db8aa3c1cc -r cdc196e91cd2 vim/snippets/mako.snippets --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vim/snippets/mako.snippets Mon Oct 11 09:31:18 2010 -0400 @@ -0,0 +1,54 @@ +snippet def + <%def name="${1:name}"> + ${2:} + +snippet call + <%call expr="${1:name}"> + ${2:} + +snippet doc + <%doc> + ${1:} + +snippet text + <%text> + ${1:} + +snippet for + % for ${1:i} in ${2:iter}: + ${3:} + % endfor +snippet if if + % if ${1:condition}: + ${2:} + % endif +snippet if if/else + % if ${1:condition}: + ${2:} + % else: + ${3:} + % endif +snippet try + % try: + ${1:} + % except${2:}: + ${3:pass} + % endtry +snippet wh + % while ${1:}: + ${2:} + % endwhile +snippet $ + ${ ${1:} } +snippet <% + <% ${1:} %> +snippet +snippet inherit + <%inherit file="${1:filename}" /> +snippet include + <%include file="${1:filename}" /> +snippet namespace + <%namespace file="${1:name}" /> +snippet page + <%page args="${1:}" /> diff -r 85db8aa3c1cc -r cdc196e91cd2 vim/snippets/objc.snippets --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vim/snippets/objc.snippets Mon Oct 11 09:31:18 2010 -0400 @@ -0,0 +1,184 @@ +# #import <...> +snippet Imp + #import <${1:Cocoa/Cocoa.h}>${2} +# #import "..." +snippet imp + #import "${1:`Filename()`.h}"${2} +# @selector(...) +snippet sel + @selector(${1:method}:)${3} +# @"..." string +snippet s + @"${1}"${2} +# Object +snippet o + ${1:NSObject} *${2:foo} = [${3:$1 alloc}]${4};${5} +# NSLog(...) +snippet log + NSLog(@"${1:%@}"${2});${3} +# Class +snippet objc + @interface ${1:`Filename('', 'someClass')`} : ${2:NSObject} + { + } + @end + + @implementation $1 + ${3} + @end +# Class Interface +snippet int + @interface ${1:`Filename('', 'someClass')`} : ${2:NSObject} + {${3} + } + ${4} + @end +# Class Implementation +snippet impl + @implementation ${1:`Filename('', 'someClass')`} + ${2} + @end +snippet init + - (id)init + { + [super init]; + return self; + } +snippet ifself + if (self = [super init]) { + ${1:/* code */} + } + return self; +snippet ibo + IBOutlet ${1:NSSomeClass} *${2:$1};${3} +# Category +snippet cat + @interface ${1:NSObject} (${2:Category}) + @end + + @implementation $1 ($2) + ${3} + @end +# Category Interface +snippet cath + @interface ${1:NSObject} (${2:Category}) + ${3} + @end +# NSArray +snippet array + NSMutableArray *${1:array} = [NSMutable array];${2} +# NSDictionary +snippet dict + NSMutableDictionary *${1:dict} = [NSMutableDictionary dictionary];${2} +# NSBezierPath +snippet bez + NSBezierPath *${1:path} = [NSBezierPath bezierPath];${2} +# Method +snippet m + - (${1:id})${2:method} + { + ${3} + } +# Method declaration +snippet md + - (${1:id})${2:method};${3} +# IBAction declaration +snippet ibad + - (IBAction)${1:method}:(${2:id})sender;${3} +# IBAction method +snippet iba + - (IBAction)${1:method}:(${2:id})sender + { + ${3} + } +# awakeFromNib method +snippet wake + - (void)awakeFromNib + { + ${1} + } +# Class Method +snippet M + + (${1:id})${2:method} + {${3} + return nil; + } +# Sub-method (Call super) +snippet sm + - (${1:id})${2:method} + { + [super $2];${3} + return self; + } +# Method: Initialize +snippet I + + (void) initialize + { + [[NSUserDefaults standardUserDefaults] registerDefaults:[NSDictionary dictionaryWIthObjectsAndKeys: + ${1}@"value", @"key", + nil]]; + } +# Accessor Methods For: +# Object +snippet objacc + - (${1:id})${2:thing} + { + return $2; + } + + - (void)set$2:($1)${3:new$2} + { + [$3 retain]; + [$2 release]; + $2 = $3; + }${4} +# for (object in array) +snippet forin + for (${1:Class} *${2:some$1} in ${3:array}) { + ${4} + } +snippet forarray + unsigned int ${1:object}Count = [${2:array} count]; + + for (unsigned int index = 0; index < $1Count; index++) { + ${3:id} $1 = [$2 $1AtIndex:index]; + ${4} + } +# IBOutlet +# @property (Objective-C 2.0) +snippet prop + @property (${1:retain}) ${2:NSSomeClass} ${3:*$2};${4} +# @synthesize (Objective-C 2.0) +snippet syn + @synthesize ${1:property};${2} +# [[ alloc] init] +snippet alloc + [[${1:foo} alloc] init${2}];${3} +# retain +snippet ret + [${1:foo} retain];${2} +# release +snippet rel + [${1:foo} release]; + ${2:$1 = nil;} +# autorelease +snippet arel + [${1:foo} autorelease]; +# autorelease pool +snippet pool + NSAutoreleasePool *${1:pool} = [[NSAutoreleasePool alloc] init]; + ${2:/* code */} + [$1 drain]; +# Throw an exception +snippet except + NSException *${1:badness}; + $1 = [NSException exceptionWithName:@"${2:$1Name}" + reason:@"${3}" + userInfo:nil]; + [$1 raise]; +snippet prag + #pragma mark ${1:foo} +snippet cl + @class ${1:Foo};${2} +snippet color + [[NSColor ${1:blackColor}] set]; diff -r 85db8aa3c1cc -r cdc196e91cd2 vim/snippets/perl.snippets --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vim/snippets/perl.snippets Mon Oct 11 09:31:18 2010 -0400 @@ -0,0 +1,91 @@ +# #!/usr/bin/perl +snippet #! + #!/usr/bin/perl + +# Hash Pointer +snippet . + => +# Function +snippet sub + sub ${1:function_name} { + ${2:#body ...} + } +# Conditional +snippet if + if (${1}) { + ${2:# body...} + } +# Conditional if..else +snippet ife + if (${1}) { + ${2:# body...} + } else { + ${3:# else...} + } +# Conditional if..elsif..else +snippet ifee + if (${1}) { + ${2:# body...} + } elsif (${3}) { + ${4:# elsif...} + } else { + ${5:# else...} + } +# Conditional One-line +snippet xif + ${1:expression} if ${2:condition};${3} +# Unless conditional +snippet unless + unless (${1}) { + ${2:# body...} + } +# Unless conditional One-line +snippet xunless + ${1:expression} unless ${2:condition};${3} +# Try/Except +snippet eval + eval { + ${1:# do something risky...} + }; + if ($@) { + ${2:# handle failure...} + } +# While Loop +snippet wh + while (${1}) { + ${2:# body...} + } +# While Loop One-line +snippet xwh + ${1:expression} while ${2:condition};${3} +# For Loop +snippet for + for (my $${2:var} = 0; $$2 < ${1:count}; $$2${3:++}) { + ${4:# body...} + } +# Foreach Loop +snippet fore + foreach my $${1:x} (@${2:array}) { + ${3:# body...} + } +# Foreach Loop One-line +snippet xfore + ${1:expression} foreach @${2:array};${3} +# Package +snippet cl + package ${1:ClassName}; + + use base qw(${2:ParentClass}); + + sub new { + my $class = shift; + $class = ref $class if ref $class; + my $self = bless {}, $class; + $self; + } + + 1;${3} +# Read File +snippet slurp + my $${1:var}; + { local $/ = undef; local *FILE; open FILE, "<${2:file}"; $$1 = ; close FILE }${3} diff -r 85db8aa3c1cc -r cdc196e91cd2 vim/snippets/php.snippets --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vim/snippets/php.snippets Mon Oct 11 09:31:18 2010 -0400 @@ -0,0 +1,216 @@ +snippet php + +snippet ec + echo "${1:string}"${2}; +snippet inc + include '${1:file}';${2} +snippet inc1 + include_once '${1:file}';${2} +snippet req + require '${1:file}';${2} +snippet req1 + require_once '${1:file}';${2} +# $GLOBALS['...'] +snippet globals + $GLOBALS['${1:variable}']${2: = }${3:something}${4:;}${5} +snippet $_ COOKIE['...'] + $_COOKIE['${1:variable}']${2} +snippet $_ ENV['...'] + $_ENV['${1:variable}']${2} +snippet $_ FILES['...'] + $_FILES['${1:variable}']${2} +snippet $_ Get['...'] + $_GET['${1:variable}']${2} +snippet $_ POST['...'] + $_POST['${1:variable}']${2} +snippet $_ REQUEST['...'] + $_REQUEST['${1:variable}']${2} +snippet $_ SERVER['...'] + $_SERVER['${1:variable}']${2} +snippet $_ SESSION['...'] + $_SESSION['${1:variable}']${2} +# Start Docblock +snippet /* + /** + * ${1} + **/ +# Class - post doc +snippet doc_cp + /** + * ${1:undocumented class} + * + * @package ${2:default} + * @author ${3:`g:snips_author`} + **/${4} +# Class Variable - post doc +snippet doc_vp + /** + * ${1:undocumented class variable} + * + * @var ${2:string} + **/${3} +# Class Variable +snippet doc_v + /** + * ${3:undocumented class variable} + * + * @var ${4:string} + **/ + ${1:var} $${2};${5} +# Class +snippet doc_c + /** + * ${3:undocumented class} + * + * @packaged ${4:default} + * @author ${5:`g:snips_author`} + **/ + ${1:}class ${2:} + {${6} + } // END $1class $2 +# Constant Definition - post doc +snippet doc_dp + /** + * ${1:undocumented constant} + **/${2} +# Constant Definition +snippet doc_d + /** + * ${3:undocumented constant} + **/ + define(${1}, ${2});${4} +# Function - post doc +snippet doc_fp + /** + * ${1:undocumented function} + * + * @return ${2:void} + * @author ${3:`g:snips_author`} + **/${4} +# Function signature +snippet doc_s + /** + * ${4:undocumented function} + * + * @return ${5:void} + * @author ${6:`g:snips_author`} + **/ + ${1}function ${2}(${3});${7} +# Function +snippet doc_f + /** + * ${4:undocumented function} + * + * @return ${5:void} + * @author ${6:`g:snips_author`} + **/ + ${1}function ${2}(${3}) + {${7} + } +# Header +snippet doc_h + /** + * ${1} + * + * @author ${2:`g:snips_author`} + * @version ${3:$Id$} + * @copyright ${4:$2}, `strftime('%d %B, %Y')` + * @package ${5:default} + **/ + + /** + * Define DocBlock + *// +# Interface +snippet doc_i + /** + * ${2:undocumented class} + * + * @package ${3:default} + * @author ${4:`g:snips_author`} + **/ + interface ${1:} + {${5} + } // END interface $1 +# class ... +snippet class + /** + * ${1} + **/ + class ${2:ClassName} + { + ${3} + function ${4:__construct}(${5:argument}) + { + ${6:// code...} + } + } +# define(...) +snippet def + define('${1}'${2});${3} +# defined(...) +snippet def? + ${1}defined('${2}')${3} +snippet wh + while (${1:/* condition */}) { + ${2:// code...} + } +# do ... while +snippet do + do { + ${2:// code... } + } while (${1:/* condition */}); +snippet if + if (${1:/* condition */}) { + ${2:// code...} + } +snippet ife + if (${1:/* condition */}) { + ${2:// code...} + } else { + ${3:// code...} + } + ${4} +snippet else + else { + ${1:// code...} + } +snippet elseif + elseif (${1:/* condition */}) { + ${2:// code...} + } +# Tertiary conditional +snippet t + $${1:retVal} = (${2:condition}) ? ${3:a} : ${4:b};${5} +snippet switch + switch ($${1:variable}) { + case '${2:value}': + ${3:// code...} + break; + ${5} + default: + ${4:// code...} + break; + } +snippet case + case '${1:value}': + ${2:// code...} + break;${3} +snippet for + for ($${2:i} = 0; $$2 < ${1:count}; $$2${3:++}) { + ${4: // code...} + } +snippet foreach + foreach ($${1:variable} as $${2:key}) { + ${3:// code...} + } +snippet fun + ${1:public }function ${2:FunctionName}(${3}) + { + ${4:// code...} + } +# $... = array (...) +snippet array + $${1:arrayName} = array('${2}' => ${3});${4} diff -r 85db8aa3c1cc -r cdc196e91cd2 vim/snippets/python.snippets --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vim/snippets/python.snippets Mon Oct 11 09:31:18 2010 -0400 @@ -0,0 +1,63 @@ +snippet #! + #!/usr/bin/env python +snippet from + from ${1:sys} import ${2:*} +snippet while + while ${1:True}: + ${2:pass} +snippet for + for ${1:x} in ${2:xs}: + ${3:pass} +snippet fore + for ${1:n}, ${2:item} in enumerate(${3:items}): + ${4:pass} +snippet class + class ${1:ClassName}(${2:object}): + def __init__(self${3:, args}): + ${4:super($1, self).__init__()} + ${5} +snippet def + def ${1:function}(${2}): + ${3:pass} +snippet defs + def ${1:method}(self${2}): + ${3:pass} +snippet lam + lambda ${1:args}: ${2:action} +snippet . + self. +snippet try Try/Except + try: + ${1:pass} + except ${2:Exception}, ${3:e}: + ${4:raise $3} +snippet try Try/Except/Else + try: + ${1:pass} + except ${2:Exception}, ${3:e}: + ${4:raise $3} + else: + ${5:pass} +snippet try Try/Except/Finally + try: + ${1:pass} + except ${2:Exception}, ${3:e}: + ${4:raise $3} + finally: + ${5:pass} +snippet try Try/Except/Else/Finally + try: + ${1:pass} + except ${2:Exception}, ${3:e}: + ${4:raise $3} + else: + ${5:pass} + finally: + ${6:pass} +snippet ifmain + if __name__ == '__main__': + ${1:main()} +snippet _ + __${1:init}__${2} +snippet *** + *args, **kwargs diff -r 85db8aa3c1cc -r cdc196e91cd2 vim/snippets/ruby.snippets --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vim/snippets/ruby.snippets Mon Oct 11 09:31:18 2010 -0400 @@ -0,0 +1,420 @@ +# #!/usr/bin/ruby +snippet #! + #!/usr/bin/ruby + +# New Block +snippet =b + =begin rdoc + ${1} + =end +snippet y + :yields: ${1:arguments} +snippet rb + #!/usr/bin/env ruby -wKU + +snippet req + require "${1}"${2} +snippet # + # => +snippet end + __END__ +snippet case + case ${1:object} + when ${2:condition} + ${3} + end +snippet when + when ${1:condition} + ${2} +snippet def + def ${1:method_name} + ${2} + end +snippet deft + def test_${1:case_name} + ${2} + end +snippet if + if ${1:condition} + ${2} + end +snippet ife + if ${1:condition} + ${2} + else + ${3} + end +snippet elsif + elsif ${1:condition} + ${2} +snippet unless + unless ${1:condition} + ${2} + end +snippet while + while ${1:condition} + ${2} + end +snippet until + until ${1:condition} + ${2} + end +snippet cla class .. end + class ${1:`substitute(Filename(), '^.', '\u&', '')`} + ${2} + end +snippet cla class .. initialize .. end + class ${1:`substitute(Filename(), '^.', '\u&', '')`} + def initialize(${2:args}) + ${3} + end + + + end +snippet cla class .. < ParentClass .. initialize .. end + class ${1:`substitute(Filename(), '^.', '\u&', '')`} < ${2:ParentClass} + def initialize(${3:args}) + ${4} + end + + + end +snippet cla ClassName = Struct .. do .. end + ${1:`substitute(Filename(), '^.', '\u&', '')`} = Struct.new(:${2:attr_names}) do + def ${3:method_name} + ${4} + end + + + end +snippet cla class BlankSlate .. initialize .. end + class ${1:BlankSlate} + instance_methods.each { |meth| undef_method(meth) unless meth =~ /\A__/ } +snippet cla class << self .. end + class << ${1:self} + ${2} + end +# class .. < DelegateClass .. initialize .. end +snippet cla- + class ${1:`substitute(Filename(), '^.', '\u&', '')`} < DelegateClass(${2:ParentClass}) + def initialize(${3:args}) + super(${4:del_obj}) + + ${5} + end + + + end +snippet mod module .. end + module ${1:`substitute(Filename(), '^.', '\u&', '')`} + ${2} + end +snippet mod module .. module_function .. end + module ${1:`substitute(Filename(), '^.', '\u&', '')`} + module_function + + ${2} + end +snippet mod module .. ClassMethods .. end + module ${1:`substitute(Filename(), '^.', '\u&', '')`} + module ClassMethods + ${2} + end + + module InstanceMethods + + end + + def self.included(receiver) + receiver.extend ClassMethods + receiver.send :include, InstanceMethods + end + end +# attr_reader +snippet r + attr_reader :${1:attr_names} +# attr_writer +snippet w + attr_writer :${1:attr_names} +# attr_accessor +snippet rw + attr_accessor :${1:attr_names} +# include Enumerable +snippet Enum + include Enumerable + + def each(&block) + ${1} + end +# include Comparable +snippet Comp + include Comparable + + def <=>(other) + ${1} + end +# extend Forwardable +snippet Forw- + extend Forwardable +# def self +snippet defs + def self.${1:class_method_name} + ${2} + end +# def method_missing +snippet defmm + def method_missing(meth, *args, &blk) + ${1} + end +snippet defd + def_delegator :${1:@del_obj}, :${2:del_meth}, :${3:new_name} +snippet defds + def_delegators :${1:@del_obj}, :${2:del_methods} +snippet am + alias_method :${1:new_name}, :${2:old_name} +snippet app + if __FILE__ == $PROGRAM_NAME + ${1} + end +# usage_if() +snippet usai + if ARGV.${1} + abort "Usage: #{$PROGRAM_NAME} ${2:ARGS_GO_HERE}"${3} + end +# usage_unless() +snippet usau + unless ARGV.${1} + abort "Usage: #{$PROGRAM_NAME} ${2:ARGS_GO_HERE}"${3} + end +snippet array + Array.new(${1:10}) { |${2:i}| ${3} } +snippet hash + Hash.new { |${1:hash}, ${2:key}| $1[$2] = ${3} } +snippet file File.foreach() { |line| .. } + File.foreach(${1:"path/to/file"}) { |${2:line}| ${3} } +snippet file File.read() + File.read(${1:"path/to/file"})${2} +snippet Dir Dir.global() { |file| .. } + Dir.glob(${1:"dir/glob/*"}) { |${2:file}| ${3} } +snippet Dir Dir[".."] + Dir[${1:"glob/**/*.rb"}]${2} +snippet dir + Filename.dirname(__FILE__) +snippet deli + delete_if { |${1:e}| ${2} } +snippet fil + fill(${1:range}) { |${2:i}| ${3} } +# flatten_once() +snippet flao + inject(Array.new) { |${1:arr}, ${2:a}| $1.push(*$2)}${3} +snippet zip + zip(${1:enums}) { |${2:row}| ${3} } +# downto(0) { |n| .. } +snippet dow + downto(${1:0}) { |${2:n}| ${3} } +snippet ste + step(${1:2}) { |${2:n}| ${3} } +snippet tim + times { |${1:n}| ${2} } +snippet upt + upto(${1:1.0/0.0}) { |${2:n}| ${3} } +snippet loo + loop { ${1} } +snippet ea + each { |${1:e}| ${2} } +snippet eab + each_byte { |${1:byte}| ${2} } +snippet eac- each_char { |chr| .. } + each_char { |${1:chr}| ${2} } +snippet eac- each_cons(..) { |group| .. } + each_cons(${1:2}) { |${2:group}| ${3} } +snippet eai + each_index { |${1:i}| ${2} } +snippet eak + each_key { |${1:key}| ${2} } +snippet eal + each_line { |${1:line}| ${2} } +snippet eap + each_pair { |${1:name}, ${2:val}| ${3} } +snippet eas- + each_slice(${1:2}) { |${2:group}| ${3} } +snippet eav + each_value { |${1:val}| ${2} } +snippet eawi + each_with_index { |${1:e}, ${2:i}| ${3} } +snippet reve + reverse_each { |${1:e}| ${2} } +snippet inj + inject(${1:init}) { |${2:mem}, ${3:var}| ${4} } +snippet map + map { |${1:e}| ${2} } +snippet mapwi- + enum_with_index.map { |${1:e}, ${2:i}| ${3} } +snippet sor + sort { |a, b| ${1} } +snippet sorb + sort_by { |${1:e}| ${2} } +snippet ran + sort_by { rand } +snippet all + all? { |${1:e}| ${2} } +snippet any + any? { |${1:e}| ${2} } +snippet cl + classify { |${1:e}| ${2} } +snippet col + collect { |${1:e}| ${2} } +snippet det + detect { |${1:e}| ${2} } +snippet fet + fetch(${1:name}) { |${2:key}| ${3} } +snippet fin + find { |${1:e}| ${2} } +snippet fina + find_all { |${1:e}| ${2} } +snippet gre + grep(${1:/pattern/}) { |${2:match}| ${3} } +snippet sub + ${1:g}sub(${2:/pattern/}) { |${3:match}| ${4} } +snippet sca + scan(${1:/pattern/}) { |${2:match}| ${3} } +snippet max + max { |a, b|, ${1} } +snippet min + min { |a, b|, ${1} } +snippet par + partition { |${1:e}|, ${2} } +snippet rej + reject { |${1:e}|, ${2} } +snippet sel + select { |${1:e}|, ${2} } +snippet lam + lambda { |${1:args}| ${2} } +snippet do + do |${1:variable}| + ${2} + end +snippet : + :${1:key} => ${2:"value"}${3} +snippet ope + open(${1:"path/or/url/or/pipe"}, "${2:w}") { |${3:io}| ${4} } +# path_from_here() +snippet patfh + File.join(File.dirname(__FILE__), *%2[${1:rel path here}])${2} +# unix_filter {} +snippet unif + ARGF.each_line${1} do |${2:line}| + ${3} + end +# option_parse {} +snippet optp + require "optparse" + + options = {${1:default => "args"}} + + ARGV.options do |opts| + opts.banner = "Usage: #{File.basename($PROGRAM_NAME)} +snippet opt + opts.on( "-${1:o}", "--${2:long-option-name}", ${3:String}, + "${4:Option description.}") do |${5:opt}| + ${6} + end +snippet tc + require "test/unit" + + require "${1:library_file_name}" + + class Test${2:$1} < Test::Unit::TestCase + def test_${3:case_name} + ${4} + end + end +snippet ts + require "test/unit" + + require "tc_${1:test_case_file}" + require "tc_${2:test_case_file}"${3} +snippet as + assert(${1:test}, "${2:Failure message.}")${3} +snippet ase + assert_equal(${1:expected}, ${2:actual})${3} +snippet asne + assert_not_equal(${1:unexpected}, ${2:actual})${3} +snippet asid + assert_in_delta(${1:expected_float}, ${2:actual_float}, ${3:2 ** -20})${4} +snippet asio + assert_instance_of(${1:ExpectedClass}, ${2:actual_instance})${3} +snippet asko + assert_kind_of(${1:ExpectedKind}, ${2:actual_instance})${3} +snippet asn + assert_nil(${1:instance})${2} +snippet asnn + assert_not_nil(${1:instance})${2} +snippet asm + assert_match(/${1:expected_pattern}/, ${2:actual_string})${3} +snippet asnm + assert_no_match(/${1:unexpected_pattern}/, ${2:actual_string})${3} +snippet aso + assert_operator(${1:left}, :${2:operator}, ${3:right})${4} +snippet asr + assert_raise(${1:Exception}) { ${2} } +snippet asnr + assert_nothing_raised(${1:Exception}) { ${2} } +snippet asrt + assert_respond_to(${1:object}, :${2:method})${3} +snippet ass assert_same(..) + assert_same(${1:expected}, ${2:actual})${3} +snippet ass assert_send(..) + assert_send([${1:object}, :${2:message}, ${3:args}])${4} +snippet asns + assert_not_same(${1:unexpected}, ${2:actual})${3} +snippet ast + assert_throws(:${1:expected}) { ${2} } +snippet asnt + assert_nothing_thrown { ${1} } +snippet fl + flunk("${1:Failure message.}")${2} +# Benchmark.bmbm do .. end +snippet bm- + TESTS = ${1:10_000} + Benchmark.bmbm do |results| + ${2} + end +snippet rep + results.report("${1:name}:") { TESTS.times { ${2} }} +# Marshal.dump(.., file) +snippet Md + File.open(${1:"path/to/file.dump"}, "wb") { |${2:file}| Marshal.dump(${3:obj}, $2) }${4} +# Mashal.load(obj) +snippet Ml + File.open(${1:"path/to/file.dump"}, "rb") { |${2:file}| Marshal.load($2) }${3} +# deep_copy(..) +snippet deec + Marshal.load(Marshal.dump(${1:obj_to_copy}))${2} +snippet Pn- + PStore.new(${1:"file_name.pstore"})${2} +snippet tra + transaction(${1:true}) { ${2} } +# xmlread(..) +snippet xml- + REXML::Document.new(File.read(${1:"path/to/file"}))${2} +# xpath(..) { .. } +snippet xpa + elements.each(${1:"//Xpath"}) do |${2:node}| + ${3} + end +# class_from_name() +snippet clafn + split("::").inject(Object) { |par, const| par.const_get(const) } +# singleton_class() +snippet sinc + class << self; self end +snippet nam + namespace :${1:`Filename()`} do + ${2} + end +snippet tas + desc "${1:Task description\}" + task :${2:task_name => [:dependent, :tasks]} do + ${3} + end diff -r 85db8aa3c1cc -r cdc196e91cd2 vim/snippets/sh.snippets --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vim/snippets/sh.snippets Mon Oct 11 09:31:18 2010 -0400 @@ -0,0 +1,28 @@ +# #!/bin/bash +snippet #! + #!/bin/bash + +snippet if + if [[ ${1:condition} ]]; then + ${2:#statements} + fi +snippet elif + elif [[ ${1:condition} ]]; then + ${2:#statements} +snippet for + for (( ${2:i} = 0; $2 < ${1:count}; $2++ )); do + ${3:#statements} + done +snippet wh + while [[ ${1:condition} ]]; do + ${2:#statements} + done +snippet until + until [[ ${1:condition} ]]; do + ${2:#statements} + done +snippet case + case ${1:word} in + ${2:pattern}) + ${3};; + esac diff -r 85db8aa3c1cc -r cdc196e91cd2 vim/snippets/snippet.snippets --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vim/snippets/snippet.snippets Mon Oct 11 09:31:18 2010 -0400 @@ -0,0 +1,7 @@ +# snippets for making snippets :) +snippet snip + snippet ${1:trigger} + ${2} +snippet msnip + snippet ${1:trigger} ${2:description} + ${3} diff -r 85db8aa3c1cc -r cdc196e91cd2 vim/snippets/tcl.snippets --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vim/snippets/tcl.snippets Mon Oct 11 09:31:18 2010 -0400 @@ -0,0 +1,92 @@ +# #!/usr/bin/tclsh +snippet #! + #!/usr/bin/tclsh + +# Process +snippet pro + proc ${1:function_name} {${2:args}} { + ${3:#body ...} + } +#xif +snippet xif + ${1:expr}? ${2:true} : ${3:false} +# Conditional +snippet if + if {${1}} { + ${2:# body...} + } +# Conditional if..else +snippet ife + if {${1}} { + ${2:# body...} + } else { + ${3:# else...} + } +# Conditional if..elsif..else +snippet ifee + if {${1}} { + ${2:# body...} + } elseif {${3}} { + ${4:# elsif...} + } else { + ${5:# else...} + } +# If catch then +snippet ifc + if { [catch {${1:#do something...}} ${2:err}] } { + ${3:# handle failure...} + } +# Catch +snippet catch + catch {${1}} ${2:err} ${3:options} +# While Loop +snippet wh + while {${1}} { + ${2:# body...} + } +# For Loop +snippet for + for {set ${2:var} 0} {$$2 < ${1:count}} {${3:incr} $2} { + ${4:# body...} + } +# Foreach Loop +snippet fore + foreach ${1:x} {${2:#list}} { + ${3:# body...} + } +# after ms script... +snippet af + after ${1:ms} ${2:#do something} +# after cancel id +snippet afc + after cancel ${1:id or script} +# after idle +snippet afi + after idle ${1:script} +# after info id +snippet afin + after info ${1:id} +# Expr +snippet exp + expr {${1:#expression here}} +# Switch +snippet sw + switch ${1:var} { + ${3:pattern 1} { + ${4:#do something} + } + default { + ${2:#do something} + } + } +# Case +snippet ca + ${1:pattern} { + ${2:#do something} + }${3} +# Namespace eval +snippet ns + namespace eval ${1:path} {${2:#script...}} +# Namespace current +snippet nsc + namespace current diff -r 85db8aa3c1cc -r cdc196e91cd2 vim/snippets/tex.snippets --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vim/snippets/tex.snippets Mon Oct 11 09:31:18 2010 -0400 @@ -0,0 +1,115 @@ +# \begin{}...\end{} +snippet begin + \begin{${1:env}} + ${2} + \end{$1} +# Tabular +snippet tab + \begin{${1:tabular}}{${2:c}} + ${3} + \end{$1} +# Align(ed) +snippet ali + \begin{align${1:ed}} + ${2} + \end{align$1} +# Gather(ed) +snippet gat + \begin{gather${1:ed}} + ${2} + \end{gather$1} +# Equation +snippet eq + \begin{equation} + ${1} + \end{equation} +# Unnumbered Equation +snippet \ + \\[ + ${1} + \\] +# Enumerate +snippet enum + \begin{enumerate} + \item ${1} + \end{enumerate} +# Itemize +snippet item + \begin{itemize} + \item ${1} + \end{itemize} +# Description +snippet desc + \begin{description} + \item[${1}] ${2} + \end{description} +# Matrix +snippet mat + \begin{${1:p/b/v/V/B/small}matrix} + ${2} + \end{$1matrix} +# Cases +snippet cas + \begin{cases} + ${1:equation}, &\text{ if }${2:case}\\ + ${3} + \end{cases} +# Split +snippet spl + \begin{split} + ${1} + \end{split} +# Part +snippet part + \part{${1:part name}} % (fold) + \label{prt:${2:$1}} + ${3} + % part $2 (end) +# Chapter +snippet cha + \chapter{${1:chapter name}} % (fold) + \label{cha:${2:$1}} + ${3} + % chapter $2 (end) +# Section +snippet sec + \section{${1:section name}} % (fold) + \label{sec:${2:$1}} + ${3} + % section $2 (end) +# Sub Section +snippet sub + \subsection{${1:subsection name}} % (fold) + \label{sub:${2:$1}} + ${3} + % subsection $2 (end) +# Sub Sub Section +snippet subs + \subsubsection{${1:subsubsection name}} % (fold) + \label{ssub:${2:$1}} + ${3} + % subsubsection $2 (end) +# Paragraph +snippet par + \paragraph{${1:paragraph name}} % (fold) + \label{par:${2:$1}} + ${3} + % paragraph $2 (end) +# Sub Paragraph +snippet subp + \subparagraph{${1:subparagraph name}} % (fold) + \label{subp:${2:$1}} + ${3} + % subparagraph $2 (end) +snippet itd + \item[${1:description}] ${2:item} +snippet figure + ${1:Figure}~\ref{${2:fig:}}${3} +snippet table + ${1:Table}~\ref{${2:tab:}}${3} +snippet listing + ${1:Listing}~\ref{${2:list}}${3} +snippet section + ${1:Section}~\ref{${2:sec:}}${3} +snippet page + ${1:page}~\pageref{${2}}${3} diff -r 85db8aa3c1cc -r cdc196e91cd2 vim/snippets/vim.snippets --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vim/snippets/vim.snippets Mon Oct 11 09:31:18 2010 -0400 @@ -0,0 +1,32 @@ +snippet header + " File: ${1:`expand('%:t')`} + " Author: ${2:`g:snips_author`} + " Description: ${3} + ${4:" Last Modified: `strftime("%B %d, %Y")`} +snippet guard + if exists('${1:did_`Filename()`}') || &cp${2: || version < 700} + finish + endif + let $1 = 1${3} +snippet f + fun ${1:function_name}(${2}) + ${3:" code} + endf +snippet for + for ${1:needle} in ${2:haystack} + ${3:" code} + endfor +snippet wh + while ${1:condition} + ${2:" code} + endw +snippet if + if ${1:condition} + ${2:" code} + endif +snippet ife + if ${1:condition} + ${2} + else + ${3} + endif diff -r 85db8aa3c1cc -r cdc196e91cd2 vim/snippets/zsh.snippets --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vim/snippets/zsh.snippets Mon Oct 11 09:31:18 2010 -0400 @@ -0,0 +1,58 @@ +# #!/bin/zsh +snippet #! + #!/bin/zsh + +snippet if + if ${1:condition}; then + ${2:# statements} + fi +snippet ife + if ${1:condition}; then + ${2:# statements} + else + ${3:# statements} + fi +snippet elif + elif ${1:condition} ; then + ${2:# statements} +snippet for + for (( ${2:i} = 0; $2 < ${1:count}; $2++ )); do + ${3:# statements} + done +snippet fore + for ${1:item} in ${2:list}; do + ${3:# statements} + done +snippet wh + while ${1:condition}; do + ${2:# statements} + done +snippet until + until ${1:condition}; do + ${2:# statements} + done +snippet repeat + repeat ${1:integer}; do + ${2:# statements} + done +snippet case + case ${1:word} in + ${2:pattern}) + ${3};; + esac +snippet select + select ${1:answer} in ${2:choices}; do + ${3:# statements} + done +snippet ( + ( ${1:#statements} ) +snippet { + { ${1:#statements} } +snippet [ + [[ ${1:test} ]] +snippet always + { ${1:try} } always { ${2:always} } +snippet fun + function ${1:name} (${2:args}) { + ${3:# body} + } diff -r 85db8aa3c1cc -r cdc196e91cd2 vim/syntax/django.vim --- a/vim/syntax/django.vim Fri Oct 08 09:26:49 2010 -0400 +++ b/vim/syntax/django.vim Mon Oct 11 09:31:18 2010 -0400 @@ -1,25 +1,96 @@ " Vim syntax file " Language: Django template " Maintainer: Dave Hodder -" Last Change: 2009 Jan 12 +" Last Change: 2010 May 19 + +" For version 5.x: Clear all syntax items +" For version 6.x: Quit when a syntax file was already loaded +if version < 600 + syntax clear +elseif exists("b:current_syntax") + finish +endif + +syntax case match + +" Mark illegal characters +syn match djangoError "%}\|}}\|#}" + +" Django template built-in tags and parameters +" 'comment' doesn't appear here because it gets special treatment +syn keyword djangoStatement contained autoescape csrf_token empty +" FIXME ==, !=, <, >, <=, and >= should be djangoStatements: +" syn keyword djangoStatement contained == != < > <= >= +syn keyword djangoStatement contained and as block endblock by cycle debug else +syn keyword djangoStatement contained extends filter endfilter firstof for +syn keyword djangoStatement contained endfor if endif ifchanged endifchanged +syn keyword djangoStatement contained ifequal endifequal ifnotequal +syn keyword djangoStatement contained endifnotequal in include load not now or +syn keyword djangoStatement contained parsed regroup reversed spaceless +syn keyword djangoStatement contained endspaceless ssi templatetag openblock +syn keyword djangoStatement contained closeblock openvariable closevariable +syn keyword djangoStatement contained openbrace closebrace opencomment +syn keyword djangoStatement contained closecomment widthratio url with endwith +syn keyword djangoStatement contained get_current_language trans noop blocktrans +syn keyword djangoStatement contained endblocktrans get_available_languages +syn keyword djangoStatement contained get_current_language_bidi plural -" matchit.vim (extended "%" matching) contributed by Michael Brown. -" Borrowed from html.vim Thanks to Johannes Zellner and Benji Fisher. -if exists("loaded_matchit") - let b:match_ignorecase = 1 - let b:match_skip = 's:Comment' - let b:match_words = '<:>,' . - \ '<\@<=[ou]l\>[^>]*\%(>\|$\):<\@<=li\>:<\@<=/[ou]l>,' . - \ '<\@<=dl\>[^>]*\%(>\|$\):<\@<=d[td]\>:<\@<=/dl>,' . - \ '<\@<=\([^/][^ \t>]*\)[^>]*\%(>\|$\):<\@<=/\1>,' . - \ '{% *if .*%}:{% *else *%}:{% *endif *%},' . - \ '{% *ifequal .*%}:{% *else *%}:{% *endifequal *%},' . - \ '{% *ifnotequal .*%}:{% *else *%}:{% *endifnotequal *%},' . - \ '{% *ifchanged .*%}:{% *else *%}:{% *endifchanged *%},' . - \ '{% *for .*%}:{% *endfor *%},' . - \ '{% *with .*%}:{% *endwith *%},' . - \ '{% *comment .*%}:{% *endcomment *%},' . - \ '{% *block .*%}:{% *endblock *%},' . - \ '{% *filter .*%}:{% *endfilter *%},' . - \ '{% *spaceless .*%}:{% *endspaceless *%}' +" Django templete built-in filters +syn keyword djangoFilter contained add addslashes capfirst center cut date +syn keyword djangoFilter contained default default_if_none dictsort +syn keyword djangoFilter contained dictsortreversed divisibleby escape escapejs +syn keyword djangoFilter contained filesizeformat first fix_ampersands +syn keyword djangoFilter contained floatformat get_digit join last length length_is +syn keyword djangoFilter contained linebreaks linebreaksbr linenumbers ljust +syn keyword djangoFilter contained lower make_list phone2numeric pluralize +syn keyword djangoFilter contained pprint random removetags rjust slice slugify +syn keyword djangoFilter contained safe safeseq stringformat striptags +syn keyword djangoFilter contained time timesince timeuntil title +syn keyword djangoFilter contained truncatewords truncatewords_html unordered_list upper urlencode +syn keyword djangoFilter contained urlize urlizetrunc wordcount wordwrap yesno + +" Keywords to highlight within comments +syn keyword djangoTodo contained TODO FIXME XXX + +" Django template constants (always surrounded by double quotes) +syn region djangoArgument contained start=/"/ skip=/\\"/ end=/"/ + +" Mark illegal characters within tag and variables blocks +syn match djangoTagError contained "#}\|{{\|[^%]}}\|[&#]" +syn match djangoVarError contained "#}\|{%\|%}\|[<>!&#%]" + +" Django template tag and variable blocks +syn region djangoTagBlock start="{%" end="%}" contains=djangoStatement,djangoFilter,djangoArgument,djangoTagError display +syn region djangoVarBlock start="{{" end="}}" contains=djangoFilter,djangoArgument,djangoVarError display + +" Django template 'comment' tag and comment block +syn region djangoComment start="{%\s*comment\s*%}" end="{%\s*endcomment\s*%}" contains=djangoTodo +syn region djangoComBlock start="{#" end="#}" contains=djangoTodo + +" Define the default highlighting. +" For version 5.7 and earlier: only when not done already +" For version 5.8 and later: only when an item doesn't have highlighting yet +if version >= 508 || !exists("did_django_syn_inits") + if version < 508 + let did_django_syn_inits = 1 + command -nargs=+ HiLink hi link + else + command -nargs=+ HiLink hi def link + endif + + HiLink djangoTagBlock PreProc + HiLink djangoVarBlock PreProc + HiLink djangoStatement Statement + HiLink djangoFilter Identifier + HiLink djangoArgument Constant + HiLink djangoTagError Error + HiLink djangoVarError Error + HiLink djangoError Error + HiLink djangoComment Comment + HiLink djangoComBlock Comment + HiLink djangoTodo Todo + + delcommand HiLink endif + +let b:current_syntax = "django" diff -r 85db8aa3c1cc -r cdc196e91cd2 vim/syntax/htmldjango.vim --- a/vim/syntax/htmldjango.vim Fri Oct 08 09:26:49 2010 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,34 +0,0 @@ -" Vim syntax file -" Language: Django HTML template -" Maintainer: Dave Hodder -" Last Change: 2007 Jan 26 - -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") - finish -endif - -if !exists("main_syntax") - let main_syntax = 'html' -endif - -if version < 600 - so :p:h/django.vim - so :p:h/html.vim -else - runtime! syntax/django.vim - runtime! syntax/html.vim - unlet b:current_syntax -endif - -syn cluster djangoBlocks add=djangoTagBlock,djangoVarBlock,djangoComment,djangoComBlock - -syn region djangoTagBlock start="{%" end="%}" contains=djangoStatement,djangoFilter,djangoArgument,djangoTagError display containedin=ALLBUT,@djangoBlocks -syn region djangoVarBlock start="{{" end="}}" contains=djangoFilter,djangoArgument,djangoVarError display containedin=ALLBUT,@djangoBlocks -syn region djangoComment start="{%\s*comment\s*%}" end="{%\s*endcomment\s*%}" contains=djangoTodo containedin=ALLBUT,@djangoBlocks -syn region djangoComBlock start="{#" end="#}" contains=djangoTodo containedin=ALLBUT,@djangoBlocks - -let b:current_syntax = "htmldjango"