1
0
Fork 0
mirror of synced 2024-12-23 23:33:21 -05:00

lets try again...

This commit is contained in:
amix 2012-08-16 23:41:25 -04:00
parent 85888ddbd3
commit bb9c85e523
306 changed files with 47995 additions and 21 deletions

@ -1 +0,0 @@
Subproject commit 168883af7aec05f139af251f47eadd5dfb802c9d

@ -1 +0,0 @@
Subproject commit 2051d4e5384b94b4e258b059e959ffb5202dec11

@ -1 +0,0 @@
Subproject commit 528a59f26d12278698bb946f8fb82a63711eec21

@ -1 +0,0 @@
Subproject commit a1071f30656b26645b69f59e1e05257829a39620

@ -1 +0,0 @@
Subproject commit fb8387fd066e9757e53727131a6d197cecf4bb55

@ -1 +0,0 @@
Subproject commit d6dcb9b0fb5beac9e84cfb84c1917b7e0df5850f

@ -1 +0,0 @@
Subproject commit d605010cab695dca64c5cd9bf8bbcc8db9864815

@ -1 +0,0 @@
Subproject commit dcdab0cd55da5e0b8655c000d99d96624cd6404c

1
sources_non_forked/ack.vim/.gitignore vendored Normal file
View file

@ -0,0 +1 @@
tags

View file

@ -0,0 +1,96 @@
# ack.vim #
This plugin is a front for the Perl module
[App::Ack](http://search.cpan.org/~petdance/ack/ack). Ack can be used as a
replacement for 99% of the uses of _grep_. This plugin will allow you to run
ack from vim, and shows the results in a split window.
The *Official Version* of this plugin is available at [vim.org](http://www.vim.org/scripts/script.php?script_id=2572).
## Installation ##
### Ack
You have to install [ack](http://betterthangrep.com/), of course.
Install on Debian / Ubuntu with:
sudo apt-get install ack-grep
For Debian / Ubuntu you can add this line into your .vimrc:
let g:ackprg="ack-grep -H --nocolor --nogroup --column"
Install on Gentoo with:
sudo emerge ack
Install with Homebrew:
brew install ack
Install with MacPorts:
sudo port install p5-app-ack
Install with Gentoo Prefix
emerge ack
Otherwise, you are on your own.
### The Plugin
If you have [Rake](http://rake.rubyforge.org/) installed, you can just run: `rake install`.
Otherwise, the file ack.vim goes in ~/.vim/plugin, and the ack.txt file belongs in ~/.vim/doc. Be sure to run
:helptags ~/.vim/doc
afterwards.
## Usage ##
:Ack [options] {pattern} [{directory}]
Search recursively in {directory} (which defaults to the current directory) for the {pattern}.
Files containing the search term will be listed in the split window, along with
the line number of the occurrence, once for each occurrence. [Enter] on a line
in this window will open the file, and place the cursor on the matching line.
Just like where you use :grep, :grepadd, :lgrep, and :lgrepadd, you can use `:Ack`, `:AckAdd`, `:LAck`, and `:LAckAdd` respectively. (See `doc/ack.txt`, or install and `:h Ack` for more information.)
**From the [ack docs](http://betterthangrep.com/)** (my favorite feature):
--type=TYPE, --type=noTYPE
Specify the types of files to include or exclude from a search. TYPE is a filetype, like perl or xml. --type=perl can also be specified as --perl, and --type=noperl can be done as --noperl.
If a file is of both type "foo" and "bar", specifying --foo and --nobar will exclude the file, because an exclusion takes precedence over an inclusion.
Type specifications can be repeated and are ORed together.
See ack --help=types for a list of valid types.
### Keyboard Shortcuts ###
In the quickfix window, you can use:
o to open (same as enter)
go to preview file (open but maintain focus on ack.vim results)
t to open in new tab
T to open in new tab silently
v to open in vertical split
gv to open in vertical split silently
q to close the quickfix window
This Vim plugin is derived (and by derived, I mean copied, essentially) from
Antoine Imbert's blog post [Ack and Vim
Integration](http://blog.ant0ine.com/typepad/2007/03/ack-and-vim-integration.html) (in
particular, the function at the bottom of the post). I added a help file that
provides just enough reference to get you going. I also highly recommend you
check out the docs for the Perl script 'ack', for obvious reasons: [ack -
grep-like text finder](http://betterthangrep.com/).

View file

@ -0,0 +1,23 @@
# Added by Josh Nichols, a.k.a. technicalpickles
require 'rake'
files = ['doc/ack.txt', 'plugin/ack.vim']
desc 'Install plugin and documentation'
task :install do
vimfiles = if ENV['VIMFILES']
ENV['VIMFILES']
elsif RUBY_PLATFORM =~ /(win|w)32$/
File.expand_path("~/vimfiles")
else
File.expand_path("~/.vim")
end
files.each do |file|
target_file = File.join(vimfiles, file)
FileUtils.mkdir_p File.dirname(target_file)
FileUtils.cp file, target_file
puts " Copied #{file} to #{target_file}"
end
end

View file

@ -0,0 +1,70 @@
*ack.txt* Plugin that integrates ack with Vim
==============================================================================
Author: Antoine Imbert <antoine.imbert+ackvim@gmail.com> *ack-author*
License: Same terms as Vim itself (see |license|)
==============================================================================
INTRODUCTION *ack*
This plugin is a front for the Perl module App::Ack. Ack can be used as a
replacement for grep. This plugin will allow you to run ack from vim, and
shows the results in a split window.
:Ack[!] [options] {pattern} [{directory}] *:Ack*
Search recursively in {directory} (which defaults to the current
directory) for the {pattern}. Behaves just like the |:grep| command, but
will open the |Quickfix| window for you. If [!] is not given the first
error is jumped to.
:AckAdd [options] {pattern} [{directory}] *:AckAdd*
Just like |:Ack|, but instead of making a new list, the matches are
appended to the current |quickfix| list.
:AckFromSearch [{directory}] *:AckFromSearch*
Just like |:Ack| but the pattern is from previous search.
:LAck [options] {pattern} [{directory}] *:LAck*
Just like |:Ack| but instead of the |quickfix| list, matches are placed in
the current |location-list|.
:LAckAdd [options] {pattern} [{directory}] *:LAckAdd*
Just like |:AckAdd| but instead of the |quickfix| list, matches are added
to the current |location-list|
:AckFile [options] {pattern} [{directory}] *:AckFile*
Search recursively in {directory} (which defaults to the current
directory) for filenames matching the {pattern}. Behaves just like the
|:grep| command, but will open the |Quickfix| window for you.
Files containing the search term will be listed in the split window, along
with the line number of the occurrence, once for each occurrence. <Enter> on
a line in this window will open the file, and place the cursor on the matching
line.
See http://betterthangrep.com/ for more information.
==============================================================================
MAPPINGS *ack-mappings*
The following keyboard shortcuts are available in the quickfix window:
o open file (same as enter).
go preview file (open but maintain focus on ack.vim results).
t open in a new tab.
T open in new tab silently.
v open in vertical split.
gv open in vertical split silently.
q close the quickfix window.

View file

@ -0,0 +1,80 @@
" NOTE: You must, of course, install the ack script
" in your path.
" On Debian / Ubuntu:
" sudo apt-get install ack-grep
" On your vimrc:
" let g:ackprg="ack-grep -H --nocolor --nogroup --column"
"
" With MacPorts:
" sudo port install p5-app-ack
" Location of the ack utility
if !exists("g:ackprg")
let g:ackprg="ack -H --nocolor --nogroup --column"
endif
function! s:Ack(cmd, args)
redraw
echo "Searching ..."
" If no pattern is provided, search for the word under the cursor
if empty(a:args)
let l:grepargs = expand("<cword>")
else
let l:grepargs = a:args
end
" Format, used to manage column jump
if a:cmd =~# '-g$'
let g:ackformat="%f"
else
let g:ackformat="%f:%l:%c:%m"
end
let grepprg_bak=&grepprg
let grepformat_bak=&grepformat
try
let &grepprg=g:ackprg
let &grepformat=g:ackformat
silent execute a:cmd . " " . l:grepargs
finally
let &grepprg=grepprg_bak
let &grepformat=grepformat_bak
endtry
if a:cmd =~# '^l'
botright lopen
else
botright copen
endif
exec "nnoremap <silent> <buffer> q :ccl<CR>"
exec "nnoremap <silent> <buffer> t <C-W><CR><C-W>T"
exec "nnoremap <silent> <buffer> T <C-W><CR><C-W>TgT<C-W><C-W>"
exec "nnoremap <silent> <buffer> o <CR>"
exec "nnoremap <silent> <buffer> go <CR><C-W><C-W>"
exec "nnoremap <silent> <buffer> v <C-W><C-W><C-W>v<C-L><C-W><C-J><CR>"
exec "nnoremap <silent> <buffer> gv <C-W><C-W><C-W>v<C-L><C-W><C-J><CR><C-W><C-J>"
" If highlighting is on, highlight the search keyword.
if exists("g:ackhighlight")
let @/=a:args
set hlsearch
end
redraw!
endfunction
function! s:AckFromSearch(cmd, args)
let search = getreg('/')
" translate vim regular expression to perl regular expression.
let search = substitute(search,'\(\\<\|\\>\)','\\b','g')
call s:Ack(a:cmd, '"' . search .'" '. a:args)
endfunction
command! -bang -nargs=* -complete=file Ack call s:Ack('grep<bang>',<q-args>)
command! -bang -nargs=* -complete=file AckAdd call s:Ack('grepadd<bang>', <q-args>)
command! -bang -nargs=* -complete=file AckFromSearch call s:AckFromSearch('grep<bang>', <q-args>)
command! -bang -nargs=* -complete=file LAck call s:Ack('lgrep<bang>', <q-args>)
command! -bang -nargs=* -complete=file LAckAdd call s:Ack('lgrepadd<bang>', <q-args>)
command! -bang -nargs=* -complete=file AckFile call s:Ack('grep<bang> -g', <q-args>)

View file

@ -0,0 +1,20 @@
This is a mirror of http://www.vim.org/scripts/script.php?script_id=42
With bufexplorer, you can quickly and easily switch between buffers by using the one of the default public interfaces:
'\be' (normal open) or
'\bs' (force horizontal split open) or
'\bv' (force vertical split open)
Once the bufexplorer window is open you can use the normal movement keys (hjkl) to move around and then use <Enter> or <Left-Mouse-Click> to select the buffer you would like to open. If you would like to have the selected buffer opened in a new tab, simply press either <Shift-Enter> or 't'. Please note that when opening a buffer in a tab, that if the buffer is already in another tab, bufexplorer can switch to that tab automatically for you if you would like. More about that in the supplied VIM help.
Bufexplorer also offers various options including:
- Display the list of buffers in various sort orders including:
- Most Recently Used (MRU) which is the default
- Buffer number
- File name
- File extension
- Full file path name
- Delete buffer from list
For more about options, sort orders, configuration options, etc. please see the supplied VIM help.

View file

@ -0,0 +1,513 @@
*bufexplorer.txt* Buffer Explorer Last Change: 16 Feb 2010
Buffer Explorer *buffer-explorer* *bufexplorer*
Version 7.2.8
Plugin for easily exploring (or browsing) Vim |:buffers|.
|bufexplorer-installation| Installation
|bufexplorer-usage| Usage
|bufexplorer-windowlayout| Window Layout
|bufexplorer-customization| Customization
|bufexplorer-changelog| Change Log
|bufexplorer-todo| Todo
|bufexplorer-credits| Credits
For Vim version 7.0 and above.
This plugin is only available if 'compatible' is not set.
{Vi does not have any of this}
==============================================================================
INSTALLATION *bufexplorer-installation*
To install:
- Download the bufexplorer.zip.
- Extract the zip archive into your runtime directory.
The archive contains plugin/bufexplorer.vim, and doc/bufexplorer.txt.
- Start Vim or goto an existing instance of Vim.
- Execute the following command:
>
:helptag <your runtime directory>/doc
<
This will generate all the help tags for any file located in the doc
directory.
==============================================================================
USAGE *bufexplorer-usage*
To start exploring in the current window, use: >
\be or :BufExplorer
To start exploring in a newly split horizontal window, use: >
\bs or :BufExplorerHorizontalSplit
To start exploring in a newly split vertical window, use: >
\bv or :BufExplorerVerticalSplit
If you would like to use something other than '\', you may simply change the
leader (see |mapleader|).
Note: If the current buffer is modified when bufexplorer started, the current
window is always split and the new bufexplorer is displayed in that new
window.
Commands to use once exploring:
<F1> Toggle help information.
<enter> Opens the buffer that is under the cursor into the current
window.
<leftmouse> Opens the buffer that is under the cursor into the current
window.
<shift-enter> Opens the buffer that is under the cursor in another tab.
d |:delete|the buffer under the cursor from the list. The
buffer's 'buflisted' is cleared. This allows for the buffer to
be displayed again using the 'show unlisted' command.
R Toggles relative path/absolute path.
T Toggles to show only buffers for this tab or not.
D |:wipeout|the buffer under the cursor from the list. When a
buffers is wiped, it will not be shown when unlisted buffer are
displayed.
f Toggles whether you are taken to the active window when
selecting a buffer or not.
o Opens the buffer that is under the cursor into the current
window.
p Toggles the showing of a split filename/pathname.
q Quit exploring.
r Reverses the order the buffers are listed in.
s Selects the order the buffers are listed in. Either by buffer
number, file name, file extension, most recently used (MRU), or
full path.
t Opens the buffer that is under the cursor in another tab.
u Toggles the showing of "unlisted" buffers.
Once invoked, Buffer Explorer displays a sorted list (MRU is the default
sort method) of all the buffers that are currently opened. You are then
able to move the cursor to the line containing the buffer's name you are
wanting to act upon. Once you have selected the buffer you would like,
you can then either open it, close it(delete), resort the list, reverse
the sort, quit exploring and so on...
===============================================================================
WINDOW LAYOUT *bufexplorer-windowlayout*
-------------------------------------------------------------------------------
" Press <F1> for Help
" Sorted by mru | Locate buffer | Absolute Split path
"=
01 %a bufexplorer.txt C:\Vim\vimfiles\doc line 87
02 # bufexplorer.vim c:\Vim\vimfiles\plugin line 1
-------------------------------------------------------------------------------
| | | | |
| | | | +-- Current Line #.
| | | +-- Relative/Full Path
| | +-- Buffer Name.
| +-- Buffer Attributes. See|:buffers|for more information.
+-- Buffer Number. See|:buffers|for more information.
===============================================================================
CUSTOMIZATION *bufexplorer-customization*
*g:bufExplorerChgWin*
If set, bufexplorer will bring up the selected buffer in the window specified
by g:bufExplorerChgWin.
*g:bufExplorerDefaultHelp*
To control whether the default help is displayed or not, use: >
let g:bufExplorerDefaultHelp=0 " Do not show default help.
let g:bufExplorerDefaultHelp=1 " Show default help.
The default is to show the default help.
*g:bufExplorerDetailedHelp*
To control whether detailed help is display by, use: >
let g:bufExplorerDetailedHelp=0 " Do not show detailed help.
let g:bufExplorerDetailedHelp=1 " Show detailed help.
The default is NOT to show detailed help.
*g:bufExplorerFindActive*
To control whether you are taken to the active window when selecting a buffer,
use: >
let g:bufExplorerFindActive=0 " Do not go to active window.
let g:bufExplorerFindActive=1 " Go to active window.
The default is to be taken to the active window.
*g:bufExplorerFuncRef*
When a buffer is selected, the functions specified either singly or as a list
will be called.
*g:bufExplorerReverseSort*
To control whether to sort the buffer in reverse order or not, use: >
let g:bufExplorerReverseSort=0 " Do not sort in reverse order.
let g:bufExplorerReverseSort=1 " Sort in reverse order.
The default is NOT to sort in reverse order.
*g:bufExplorerShowDirectories*
Directories usually show up in the list from using a command like ":e .".
To control whether to show directories in the buffer list or not, use: >
let g:bufExplorerShowDirectories=1 " Show directories.
let g:bufExplorerShowDirectories=0 " Don't show directories.
The default is to show directories.
*g:bufExplorerShowRelativePath*
To control whether to show absolute paths or relative to the current
directory, use: >
let g:bufExplorerShowRelativePath=0 " Show absolute paths.
let g:bufExplorerShowRelativePath=1 " Show relative paths.
The default is to show absolute paths.
*g:bufExplorerShowTabBuffer*
To control weither or not to show buffers on for the specific tab or not, use: >
let g:bufExplorerShowTabBuffer=0 " No.
let g:bufExplorerShowTabBuffer=1 " Yes.
The default is not to show.
*g:bufExplorerShowUnlisted*
To control whether to show unlisted buffer or not, use: >
let g:bufExplorerShowUnlisted=0 " Do not show unlisted buffers.
let g:bufExplorerShowUnlisted=1 " Show unlisted buffers.
The default is to NOT show unlisted buffers.
*g:bufExplorerSortBy*
To control what field the buffers are sorted by, use: >
let g:bufExplorerSortBy='extension' " Sort by file extension.
let g:bufExplorerSortBy='fullpath' " Sort by full file path name.
let g:bufExplorerSortBy='mru' " Sort by most recently used.
let g:bufExplorerSortBy='name' " Sort by the buffer's name.
let g:bufExplorerSortBy='number' " Sort by the buffer's number.
The default is to sort by mru.
*g:bufExplorerSplitBelow*
To control where the new split window will be placed above or below the
current window, use: >
let g:bufExplorerSplitBelow=1 " Split new window below current.
let g:bufExplorerSplitBelow=0 " Split new window above current.
The default is to use what ever is set by the global &splitbelow
variable.
*g:bufExplorerSplitOutPathName*
To control whether to split out the path and file name or not, use: >
let g:bufExplorerSplitOutPathName=1 " Split the path and file name.
let g:bufExplorerSplitOutPathName=0 " Don't split the path and file
" name.
The default is to split the path and file name.
*g:bufExplorerSplitRight*
To control where the new vsplit window will be placed to the left or right of
current window, use: >
let g:bufExplorerSplitRight=0 " Split left.
let g:bufExplorerSplitRight=1 " Split right.
The default is to use the global &splitright.
===============================================================================
CHANGE LOG *bufexplorer-changelog*
7.2.8 - Enhancements:
* Thanks to Charles Campbell for integrating bufexplorer with GDBMGR.
http://mysite.verizon.net/astronaut/vim/index.html#GDBMGR
7.2.7 - Fix:
* My 1st attempt to fix the "cache" issue where buffers information
has changed but the cache/display does not reflect those changes.
More work still needs to be done.
7.2.6 - Fix:
* Thanks to Michael Henry for pointing out that I totally forgot to
update the inline help to reflect the previous change to the 'd'
and 'D' keys. Opps!
7.2.5 - Fix:
* Philip Morant suggested switching the command (bwipe) associated
with the 'd' key with the command (bdelete) associated with the 'D'
key. This made sense since the 'd' key is more likely to be used
compared to the 'D' key.
7.2.4 - Fix:
* I did not implement the patch provided by Godefroid Chapelle
correctly. I missed one line which happened to be the most
important one :)
7.2.3 - Enhancements:
* Thanks to David Fishburn for helping me out with a much needed
code overhaul as well as some awesome performance enhancements.
He also reworked the handling of tabs.
* Thanks to Vladimir Dobriakov for making the suggestions on
enhancing the documentation to include a better explaination of
what is contained in the main bufexplorer window.
* Thanks to Yuriy Ershov for added code that when the bufexplorer
window is opened, the cursor is now positioned at the line with the
active buffer (useful in non-MRU sort modes).
* Yuriy also added the abiltiy to cycle through the sort fields in
reverse order.
Fixes:
* Thanks to Michael Henry for supplying a patch that allows
bufexplorer to be opened even when there is one buffer or less.
* Thanks to Godefroid Chapelle for supplying a patch that fixed
MRU sort order after loading a session.
7.2.2 - Fixes:
* Thanks to David L. Dight for spotting and fixing an issue when
using ctrl^. bufexplorer would incorrectly handle the previous
buffer so that when ctrl^ was pressed the incorrect file was opened.
7.2.1 - Fixes:
* Thanks to Dimitar for spotting and fixing a feature that was
inadvertently left out of the previous version. The feature was
when bufexplorer was used together with WinManager, you could use
the tab key to open a buffer in a split window.
7.2.0 - Enhancements:
* For all those missing the \bs and \bv commands, these have now
returned. Thanks to Phil O'Connell for asking for the return of
these missing features and helping test out this version.
Fixes:
* Fixed problem with the bufExplorerFindActive code not working
correctly.
* Fixed an incompatibility between bufexplorer and netrw that caused
buffers to be incorrectly removed from the MRU list.
7.1.7 - Fixes:
* TaCahiroy fixed several issues related to opening a buffer in a
tab.
7.1.6 - Fixes:
* Removed ff=unix from modeline in bufexplorer.txt. Found by Bill
McCarthy.
7.1.5 - Fixes:
* Could not open unnamed buffers. Fixed by TaCahiroy.
7.1.4 - Fixes:
* Sometimes when a file's path has 'white space' in it, extra buffers
would be created containing each piece of the path. i.e:
opening c:\document and settings\test.txt would create a buffer
named "and" and a buffer named "Documents". This was reported and
fixed by TaCa Yoss.
7.1.3 - Fixes:
* Added code to allow only one instance of the plugin to run at a
time. Thanks Dennis Hostetler.
7.1.2 - Fixes:
* Fixed a jumplist issue spotted by JiangJun. I overlooked the
'jumplist' and with a couple calls to 'keepjumps', everything is
fine again.
* Went back to just having a plugin file, no autoload file. By having
the autoload, WinManager was no longer working and without really
digging into the cause, it was easier to go back to using just a
plugin file.
7.1.1 - Fixes:
* A problem spotted by Thomas Arendsen Hein.
When running Vim (7.1.94), error E493 was being thrown.
Enhancements:
* Added 'D' for 'delete' buffer as the 'd' command was a 'wipe'
buffer.
7.1.0 - Another 'major' update, some by Dave Larson, some by me.
* Making use of 'autoload' now to make the plugin load quicker.
* Removed '\bs' and '\bv'. These are now controlled by the user. The
user can issue a ':sp' or ':vs' to create a horizontal or vertical
split window and then issue a '\be'
* Added handling of tabs.
7.0.17 - Fixed issue with 'drop' command.
Various enhancements and improvements.
7.0.16 - Fixed issue reported by Liu Jiaping on non Windows systems, which was
...
Open file1, open file2, modify file1, open bufexplorer, you get the
following error:
--------8<--------
Error detected while processing function
<SNR>14_StartBufExplorer..<SNR>14_SplitOpen:
line 4:
E37: No write since last change (add ! to override)
But the worse thing is, when I want to save the current buffer and
type ':w', I get another error message:
E382: Cannot write, 'buftype' option is set
--------8<--------
7.0.15 - Thanks to Mark Smithfield for suggesting bufexplorer needed to handle
the ':args' command.
7.0.14 - Thanks to Randall Hansen for removing the requirement of terminal
versions to be recompiled with 'gui' support so the 'drop' command
would work. The 'drop' command is really not needed in terminal
versions.
7.0.13 - Fixed integration with WinManager.
Thanks to Dave Eggum for another update.
- Fix: The detailed help didn't display the mapping for toggling
the split type, even though the split type is displayed.
- Fixed incorrect description in the detailed help for toggling
relative or full paths.
- Deprecated s:ExtractBufferNbr(). Vim's str2nr() does the same
thing.
- Created a s:Set() function that sets a variable only if it hasn't
already been defined. It's useful for initializing all those
default settings.
- Removed checks for repetitive command definitions. They were
unnecessary.
- Made the help highlighting a little more fancy.
- Minor reverse compatibility issue: Changed ambiguous setting
names to be more descriptive of what they do (also makes the code
easier to follow):
Changed bufExplorerSortDirection to bufExplorerReverseSort
Changed bufExplorerSplitType to bufExplorerSplitVertical
Changed bufExplorerOpenMode to bufExplorerUseCurrentWindow
- When the BufExplorer window closes, all the file-local marks are
now deleted. This may have the benefit of cleaning up some of the
jumplist.
- Changed the name of the parameter for StartBufExplorer from
"split" to "open". The parameter is a string which specifies how
the buffer will be open, not if it is split or not.
- Deprecated DoAnyMoreBuffersExist() - it is a one line function
only used in one spot.
- Created four functions (SplitOpen(), RebuildBufferList(),
UpdateHelpStatus() and ReSortListing()) all with one purpose - to
reduce repeated code.
- Changed the name of AddHeader() to CreateHelp() to be more
descriptive of what it does. It now returns an array instead of
updating the window directly. This has the benefit of making the
code more efficient since the text the function returns is used a
little differently in the two places the function is called.
- Other minor simplifications.
7.0.12 - MAJOR Update.
This version will ONLY run with Vim version 7.0 or greater.
Dave Eggum has made some 'significant' updates to this latest
version:
- Added BufExplorerGetAltBuf() global function to be used in the
users rulerformat.
- Added g:bufExplorerSplitRight option.
- Added g:bufExplorerShowRelativePath option with mapping.
- Added current line highlighting.
- The split type can now be changed whether bufexplorer is opened
in split mode or not.
- Various major and minor bug fixes and speed improvements.
- Sort by extension.
Other improvements/changes:
- Changed the help key from '?' to <F1> to be more 'standard'.
- Fixed splitting of vertical bufexplorer window.
Hopefully I have not forgot something :)
7.0.11 - Fixed a couple of highlighting bugs, reported by David Eggum. He also
changed passive voice to active on a couple of warning messages.
7.0.10 - Fixed bug report by Xiangjiang Ma. If the 'ssl' option is set,
the slash character used when displaying the path was incorrect.
7.0.9 - Martin Grenfell found and eliminated an annoying bug in the
bufexplorer/winmanager integration. The bug was were an
annoying message would be displayed when a window was split or
a new file was opened in a new window. Thanks Martin!
7.0.8 - Thanks to Mike Li for catching a bug in the WinManager integration.
The bug was related to the incorrect displaying of the buffer
explorer's window title.
7.0.7 - Thanks to Jeremy Cowgar for adding a new enhancement. This
enhancement allows the user to press 'S', that is capital S, which
will open the buffer under the cursor in a newly created split
window.
7.0.6 - Thanks to Larry Zhang for finding a bug in the "split" buffer code.
If you force set g:bufExplorerSplitType='v' in your vimrc, and if you
tried to do a \bs to split the bufexplorer window, it would always
split horizontal, not vertical. He also found that I had a typeo in
that the variable g:bufExplorerSplitVertSize was all lower case in
the documentation which was incorrect.
7.0.5 - Thanks to Mun Johl for pointing out a bug that if a buffer was
modified, the '+' was not showing up correctly.
7.0.4 - Fixed a problem discovered first by Xiangjiang Ma. Well since I've
been using vim 7.0 and not 6.3, I started using a function (getftype)
that is not in 6.3. So for backward compatibility, I conditionaly use
this function now. Thus, the g:bufExplorerShowDirectories feature is
only available when using vim 7.0 and above.
7.0.3 - Thanks to Erwin Waterlander for finding a problem when the last
buffer was deleted. This issue got me to rewrite the buffer display
logic (which I've wanted to do for sometime now).
Also great thanks to Dave Eggum for coming up with idea for
g:bufExplorerShowDirectories. Read the above information about this
feature.
7.0.2 - Thanks to Thomas Arendsen Hein for finding a problem when a user
has the default help turned off and then brought up the explorer. An
E493 would be displayed.
7.0.1 - Thanks to Erwin Waterlander for finding a couple problems.
The first problem allowed a modified buffer to be deleted. Opps! The
second problem occurred when several files were opened, BufExplorer
was started, the current buffer was deleted using the 'd' option, and
then BufExplorer was exited. The deleted buffer was still visible
while it is not in the buffers list. Opps again!
7.0.0 - Thanks to Shankar R. for suggesting to add the ability to set
the fixed width (g:bufExplorerSplitVertSize) of a new window
when opening bufexplorer vertically and fixed height
(g:bufExplorerSplitHorzSize) of a new window when opening
bufexplorer horizontally. By default, the windows are normally
split to use half the existing width or height.
6.3.0 - Added keepjumps so that the jumps list would not get cluttered with
bufexplorer related stuff.
6.2.3 - Thanks to Jay Logan for finding a bug in the vertical split position
of the code. When selecting that the window was to be split
vertically by doing a '\bv', from then on, all splits, i.e. '\bs',
were split vertically, even though g:bufExplorerSplitType was not set
to 'v'.
6.2.2 - Thanks to Patrik Modesto for adding a small improvement. For some
reason his bufexplorer window was always showing up folded. He added
'setlocal nofoldenable' and it was fixed.
6.2.1 - Thanks goes out to Takashi Matsuo for added the 'fullPath' sorting
logic and option.
6.2.0 - Thanks goes out to Simon Johann-Ganter for spotting and fixing a
problem in that the last search pattern is overridden by the search
pattern for blank lines.
6.1.6 - Thanks to Artem Chuprina for finding a pesky bug that has been around
for sometime now. The <esc> key mapping was causing the buffer
explored to close prematurely when vim was run in an xterm. The <esc>
key mapping is now removed.
6.1.5 - Thanks to Khorev Sergey. Added option to show default help or not.
6.1.4 - Thanks goes out to Valery Kondakoff for suggesting the addition of
setlocal nonumber and foldcolumn=0. This allows for line numbering
and folding to be turned off temporarily while in the explorer.
6.1.3 - Added folding. Did some code cleanup. Added the ability to force the
newly split window to be temporarily vertical, which was suggested by
Thomas Glanzmann.
6.1.2 - Now pressing the <esc> key will quit, just like 'q'.
Added folds to hide winmanager configuration.
If anyone had the 'C' option in their cpoptions they would receive
a E10 error on startup of BufExplorer. cpo is now saved, updated and
restored. Thanks to Charles E Campbell, Jr.
Attempted to make sure there can only be one BufExplorer window open
at a time.
6.1.1 - Thanks to Brian D. Goodwin for adding toupper to FileNameCmp. This
way buffers sorted by name will be in the correct order regardless of
case.
6.0.16 - Thanks to Andre Pang for the original patch/idea to get bufexplorer
to work in insertmode/modeless mode (evim). Added Initialize
and Cleanup autocommands to handle commands that need to be
performed when starting or leaving bufexplorer.
6.0.15 - Srinath Avadhanulax added a patch for winmanager.vim.
6.0.14 - Fix a few more bug that I thought I already had fixed. Thanks
to Eric Bloodworth for adding 'Open Mode/Edit in Place'. Added
vertical splitting.
6.0.13 - Thanks to Charles E Campbell, Jr. for pointing out some embarrassing
typos that I had in the documentation. I guess I need to run
the spell checker more :o)
6.0.12 - Thanks to Madoka Machitani, for the tip on adding the augroup command
around the MRUList autocommands.
6.0.11 - Fixed bug report by Xiangjiang Ma. '"=' was being added to the
search history which messed up hlsearch.
6.0.10 - Added the necessary hooks so that the Srinath Avadhanula's
winmanager.vim script could more easily integrate with this script.
Tried to improve performance.
6.0.9 - Added MRU (Most Recently Used) sort ordering.
6.0.8 - Was not resetting the showcmd command correctly.
Added nifty help file.
6.0.7 - Thanks to Brett Carlane for some great enhancements. Some are added,
some are not, yet. Added highlighting of current and alternate
filenames. Added splitting of path/filename toggle. Reworked
ShowBuffers().
Changed my email address.
6.0.6 - Copyright notice added. Needed this so that it could be distributed
with Debian Linux. Fixed problem with the SortListing() function
failing when there was only one buffer to display.
6.0.5 - Fixed problems reported by David Pascoe, in that you where unable to
hit 'd' on a buffer that belonged to a files that no longer existed
and that the 'yank' buffer was being overridden by the help text when
the bufexplorer was opened.
6.0.4 - Thanks to Charles Campbell, Jr. for making this plugin more plugin
*compliant*, adding default keymappings of <Leader>be and <Leader>bs
as well as fixing the 'w:sortDirLabel not being defined' bug.
6.0.3 - Added sorting capabilities. Sort taken from explorer.vim.
6.0.2 - Can't remember. (2001-07-25)
6.0.1 - Initial release.
===============================================================================
TODO *bufexplorer-todo*
- Nothing as of now, buf if you have any suggestions, drop me an email.
===============================================================================
CREDITS *bufexplorer-credits*
Author: Jeff Lanzarotta <delux256-vim at yahoo dot com>
Credit must go out to Bram Moolenaar and all the Vim developers for
making the world's best editor (IMHO). I also want to thank everyone who
helped and gave me suggestions. I wouldn't want to leave anyone out so I
won't list names.
===============================================================================
vim:tw=78:noet:wrap:ts=8:ft=help:norl:

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,6 @@
*.markdown
*.zip
note.txt
tags
.hg*
tmp/*

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,140 @@
" =============================================================================
" File: autoload/ctrlp/bookmarkdir.vim
" Description: Bookmarked directories extension
" Author: Kien Nguyen <github.com/kien>
" =============================================================================
" Init {{{1
if exists('g:loaded_ctrlp_bookmarkdir') && g:loaded_ctrlp_bookmarkdir
fini
en
let g:loaded_ctrlp_bookmarkdir = 1
cal add(g:ctrlp_ext_vars, {
\ 'init': 'ctrlp#bookmarkdir#init()',
\ 'accept': 'ctrlp#bookmarkdir#accept',
\ 'lname': 'bookmarked dirs',
\ 'sname': 'bkd',
\ 'type': 'tabs',
\ 'opmul': 1,
\ 'nolim': 1,
\ 'wipe': 'ctrlp#bookmarkdir#remove',
\ })
let s:id = g:ctrlp_builtins + len(g:ctrlp_ext_vars)
" Utilities {{{1
fu! s:getinput(str, ...)
echoh Identifier
cal inputsave()
let input = call('input', a:0 ? [a:str] + a:000 : [a:str])
cal inputrestore()
echoh None
retu input
endf
fu! s:cachefile()
if !exists('s:cadir') || !exists('s:cafile')
let s:cadir = ctrlp#utils#cachedir().ctrlp#utils#lash().'bkd'
let s:cafile = s:cadir.ctrlp#utils#lash().'cache.txt'
en
retu s:cafile
endf
fu! s:writecache(lines)
cal ctrlp#utils#writecache(a:lines, s:cadir, s:cafile)
endf
fu! s:getbookmarks()
retu ctrlp#utils#readfile(s:cachefile())
endf
fu! s:savebookmark(name, cwd)
let cwds = exists('+ssl') ? [tr(a:cwd, '\', '/'), tr(a:cwd, '/', '\')] : [a:cwd]
let entries = filter(s:getbookmarks(), 'index(cwds, s:parts(v:val)[1]) < 0')
cal s:writecache(insert(entries, a:name.' '.a:cwd))
endf
fu! s:setentries()
let time = getftime(s:cachefile())
if !( exists('s:bookmarks') && time == s:bookmarks[0] )
let s:bookmarks = [time, s:getbookmarks()]
en
endf
fu! s:parts(str)
let mlist = matchlist(a:str, '\v([^\t]+)\t(.*)$')
retu mlist != [] ? mlist[1:2] : ['', '']
endf
fu! s:process(entries, type)
retu map(a:entries, 's:modify(v:val, a:type)')
endf
fu! s:modify(entry, type)
let [name, dir] = s:parts(a:entry)
let dir = fnamemodify(dir, a:type)
retu name.' '.( dir == '' ? '.' : dir )
endf
fu! s:msg(name, cwd)
redr
echoh Identifier | echon 'Bookmarked ' | echoh Constant
echon a:name.' ' | echoh Directory | echon a:cwd
echoh None
endf
fu! s:syntax()
if !ctrlp#nosy()
cal ctrlp#hicheck('CtrlPBookmark', 'Identifier')
cal ctrlp#hicheck('CtrlPTabExtra', 'Comment')
sy match CtrlPBookmark '^> [^\t]\+' contains=CtrlPLinePre
sy match CtrlPTabExtra '\zs\t.*\ze$'
en
endf
" Public {{{1
fu! ctrlp#bookmarkdir#init()
cal s:setentries()
cal s:syntax()
retu s:process(copy(s:bookmarks[1]), ':.')
endf
fu! ctrlp#bookmarkdir#accept(mode, str)
let parts = s:parts(s:modify(a:str, ':p'))
cal call('s:savebookmark', parts)
if a:mode =~ 't\|v\|h'
cal ctrlp#exit()
en
cal ctrlp#setdir(parts[1], a:mode =~ 't\|h' ? 'chd!' : 'lc!')
if a:mode == 'e'
cal ctrlp#switchtype(0)
cal ctrlp#recordhist()
cal ctrlp#prtclear()
en
endf
fu! ctrlp#bookmarkdir#add(dir)
let str = 'Directory to bookmark: '
let cwd = a:dir != '' ? a:dir : s:getinput(str, getcwd(), 'dir')
if cwd == '' | retu | en
let cwd = fnamemodify(cwd, ':p')
let name = s:getinput('Bookmark as: ', cwd)
if name == '' | retu | en
let name = tr(name, ' ', ' ')
cal s:savebookmark(name, cwd)
cal s:msg(name, cwd)
endf
fu! ctrlp#bookmarkdir#remove(entries)
cal s:process(a:entries, ':p')
cal s:writecache(a:entries == [] ? [] :
\ filter(s:getbookmarks(), 'index(a:entries, v:val) < 0'))
cal s:setentries()
retu s:process(copy(s:bookmarks[1]), ':.')
endf
fu! ctrlp#bookmarkdir#id()
retu s:id
endf
"}}}
" vim:fen:fdm=marker:fmr={{{,}}}:fdl=0:fdc=1:ts=2:sw=2:sts=2

View file

@ -0,0 +1,239 @@
" =============================================================================
" File: autoload/ctrlp/buffertag.vim
" Description: Buffer Tag extension
" Maintainer: Kien Nguyen <github.com/kien>
" Credits: Much of the code was taken from tagbar.vim by Jan Larres, plus
" a few lines from taglist.vim by Yegappan Lakshmanan and from
" buffertag.vim by Takeshi Nishida.
" =============================================================================
" Init {{{1
if exists('g:loaded_ctrlp_buftag') && g:loaded_ctrlp_buftag
fini
en
let g:loaded_ctrlp_buftag = 1
cal add(g:ctrlp_ext_vars, {
\ 'init': 'ctrlp#buffertag#init(s:crfile)',
\ 'accept': 'ctrlp#buffertag#accept',
\ 'lname': 'buffer tags',
\ 'sname': 'bft',
\ 'exit': 'ctrlp#buffertag#exit()',
\ 'type': 'tabs',
\ 'opts': 'ctrlp#buffertag#opts()',
\ })
let s:id = g:ctrlp_builtins + len(g:ctrlp_ext_vars)
let [s:pref, s:opts] = ['g:ctrlp_buftag_', {
\ 'systemenc': ['s:enc', &enc],
\ 'ctags_bin': ['s:bin', ''],
\ 'types': ['s:usr_types', {}],
\ }]
let s:bins = [
\ 'ctags-exuberant',
\ 'exuberant-ctags',
\ 'exctags',
\ '/usr/local/bin/ctags',
\ '/opt/local/bin/ctags',
\ 'ctags',
\ 'ctags.exe',
\ 'tags',
\ ]
let s:types = {
\ 'asm' : '%sasm%sasm%sdlmt',
\ 'aspperl': '%sasp%sasp%sfsv',
\ 'aspvbs' : '%sasp%sasp%sfsv',
\ 'awk' : '%sawk%sawk%sf',
\ 'beta' : '%sbeta%sbeta%sfsv',
\ 'c' : '%sc%sc%sdgsutvf',
\ 'cpp' : '%sc++%sc++%snvdtcgsuf',
\ 'cs' : '%sc#%sc#%sdtncEgsipm',
\ 'cobol' : '%scobol%scobol%sdfgpPs',
\ 'eiffel' : '%seiffel%seiffel%scf',
\ 'erlang' : '%serlang%serlang%sdrmf',
\ 'expect' : '%stcl%stcl%scfp',
\ 'fortran': '%sfortran%sfortran%spbceiklmntvfs',
\ 'html' : '%shtml%shtml%saf',
\ 'java' : '%sjava%sjava%spcifm',
\ 'javascript': '%sjavascript%sjavascript%sf',
\ 'lisp' : '%slisp%slisp%sf',
\ 'lua' : '%slua%slua%sf',
\ 'make' : '%smake%smake%sm',
\ 'pascal' : '%spascal%spascal%sfp',
\ 'perl' : '%sperl%sperl%sclps',
\ 'php' : '%sphp%sphp%scdvf',
\ 'python' : '%spython%spython%scmf',
\ 'rexx' : '%srexx%srexx%ss',
\ 'ruby' : '%sruby%sruby%scfFm',
\ 'scheme' : '%sscheme%sscheme%ssf',
\ 'sh' : '%ssh%ssh%sf',
\ 'csh' : '%ssh%ssh%sf',
\ 'zsh' : '%ssh%ssh%sf',
\ 'slang' : '%sslang%sslang%snf',
\ 'sml' : '%ssml%ssml%secsrtvf',
\ 'sql' : '%ssql%ssql%scFPrstTvfp',
\ 'tcl' : '%stcl%stcl%scfmp',
\ 'vera' : '%svera%svera%scdefgmpPtTvx',
\ 'verilog': '%sverilog%sverilog%smcPertwpvf',
\ 'vim' : '%svim%svim%savf',
\ 'yacc' : '%syacc%syacc%sl',
\ }
cal map(s:types, 'printf(v:val, "--language-force=", " --", "-types=")')
if executable('jsctags')
cal extend(s:types, { 'javascript': { 'args': '-f -', 'bin': 'jsctags' } })
en
fu! ctrlp#buffertag#opts()
for [ke, va] in items(s:opts)
let {va[0]} = exists(s:pref.ke) ? {s:pref.ke} : va[1]
endfo
" Ctags bin
if empty(s:bin)
for bin in s:bins | if executable(bin)
let s:bin = bin
brea
en | endfo
el
let s:bin = expand(s:bin, 1)
en
" Types
cal extend(s:types, s:usr_types)
endf
" Utilities {{{1
fu! s:validfile(fname, ftype)
if ( !empty(a:fname) || !empty(a:ftype) ) && filereadable(a:fname)
\ && index(keys(s:types), a:ftype) >= 0 | retu 1 | en
retu 0
endf
fu! s:exectags(cmd)
if exists('+ssl')
let [ssl, &ssl] = [&ssl, 0]
en
if &sh =~ 'cmd\.exe'
let [sxq, &sxq, shcf, &shcf] = [&sxq, '"', &shcf, '/s /c']
en
let output = system(a:cmd)
if &sh =~ 'cmd\.exe'
let [&sxq, &shcf] = [sxq, shcf]
en
if exists('+ssl')
let &ssl = ssl
en
retu output
endf
fu! s:exectagsonfile(fname, ftype)
let [ags, ft] = ['-f - --sort=no --excmd=pattern --fields=nKs ', a:ftype]
if type(s:types[ft]) == 1
let ags .= s:types[ft]
let bin = s:bin
elsei type(s:types[ft]) == 4
let ags = s:types[ft]['args']
let bin = expand(s:types[ft]['bin'], 1)
en
if empty(bin) | retu '' | en
let cmd = s:esctagscmd(bin, ags, a:fname)
if empty(cmd) | retu '' | en
let output = s:exectags(cmd)
if v:shell_error || output =~ 'Warning: cannot open' | retu '' | en
retu output
endf
fu! s:esctagscmd(bin, args, ...)
if exists('+ssl')
let [ssl, &ssl] = [&ssl, 0]
en
let fname = a:0 == 1 ? shellescape(a:1) : ''
let cmd = shellescape(a:bin).' '.a:args.' '.fname
if exists('+ssl')
let &ssl = ssl
en
if has('iconv')
let last = s:enc != &enc ? s:enc : !empty($LANG) ? $LANG : &enc
let cmd = iconv(cmd, &enc, last)
en
retu cmd
endf
fu! s:process(fname, ftype)
if !s:validfile(a:fname, a:ftype) | retu [] | endif
let ftime = getftime(a:fname)
if has_key(g:ctrlp_buftags, a:fname)
\ && g:ctrlp_buftags[a:fname]['time'] >= ftime
let lines = g:ctrlp_buftags[a:fname]['lines']
el
let data = s:exectagsonfile(a:fname, a:ftype)
let [raw, lines] = [split(data, '\n\+'), []]
for line in raw | if len(split(line, ';"')) == 2
let parsed_line = s:parseline(line)
if parsed_line != ''
cal add(lines, parsed_line)
en
en | endfo
let cache = { a:fname : { 'time': ftime, 'lines': lines } }
cal extend(g:ctrlp_buftags, cache)
en
retu lines
endf
fu! s:parseline(line)
let eval = '\v^([^\t]+)\t(.+)\t\/\^(.+)\$\/\;\"\t(.+)\tline(no)?\:(\d+)'
let vals = matchlist(a:line, eval)
if vals == [] | retu '' | en
let [bufnr, bufname] = [bufnr('^'.vals[2].'$'), fnamemodify(vals[2], ':p:t')]
retu vals[1].' '.vals[4].'|'.bufnr.':'.bufname.'|'.vals[6].'| '.vals[3]
endf
fu! s:syntax()
if !ctrlp#nosy()
cal ctrlp#hicheck('CtrlPTagKind', 'Title')
cal ctrlp#hicheck('CtrlPBufName', 'Directory')
cal ctrlp#hicheck('CtrlPTabExtra', 'Comment')
sy match CtrlPTagKind '\zs[^\t|]\+\ze|\d\+:[^|]\+|\d\+|'
sy match CtrlPBufName '|\d\+:\zs[^|]\+\ze|\d\+|'
sy match CtrlPTabExtra '\zs\t.*\ze$' contains=CtrlPBufName,CtrlPTagKind
en
endf
" Public {{{1
fu! ctrlp#buffertag#init(fname)
let bufs = exists('s:btmode') && s:btmode
\ ? filter(ctrlp#buffers(), 'filereadable(v:val)')
\ : [exists('s:bufname') ? s:bufname : a:fname]
let lines = []
for each in bufs
let bname = fnamemodify(each, ':p')
let tftype = get(split(getbufvar(bname, '&ft'), '\.'), 0, '')
cal extend(lines, s:process(bname, tftype))
endfo
cal s:syntax()
retu lines
endf
fu! ctrlp#buffertag#accept(mode, str)
let vals = matchlist(a:str, '\v^[^\t]+\t+[^\t|]+\|(\d+)\:[^\t|]+\|(\d+)\|')
let bufnr = str2nr(get(vals, 1))
if bufnr
cal ctrlp#acceptfile(a:mode, bufname(bufnr), get(vals, 2))
en
endf
fu! ctrlp#buffertag#cmd(mode, ...)
let s:btmode = a:mode
if a:0 && !empty(a:1)
let s:bufname = fnamemodify(a:1, ':p')
en
retu s:id
endf
fu! ctrlp#buffertag#exit()
unl! s:btmode s:bufname
endf
"}}}
" vim:fen:fdm=marker:fmr={{{,}}}:fdl=0:fdc=1:ts=2:sw=2:sts=2

View file

@ -0,0 +1,95 @@
" =============================================================================
" File: autoload/ctrlp/changes.vim
" Description: Change list extension
" Author: Kien Nguyen <github.com/kien>
" =============================================================================
" Init {{{1
if exists('g:loaded_ctrlp_changes') && g:loaded_ctrlp_changes
fini
en
let g:loaded_ctrlp_changes = 1
cal add(g:ctrlp_ext_vars, {
\ 'init': 'ctrlp#changes#init(s:bufnr, s:crbufnr)',
\ 'accept': 'ctrlp#changes#accept',
\ 'lname': 'changes',
\ 'sname': 'chs',
\ 'exit': 'ctrlp#changes#exit()',
\ 'type': 'tabe',
\ 'sort': 0,
\ 'nolim': 1,
\ })
let s:id = g:ctrlp_builtins + len(g:ctrlp_ext_vars)
" Utilities {{{1
fu! s:changelist(bufnr)
sil! exe 'noa hid b' a:bufnr
redi => result
sil! changes
redi END
retu map(split(result, "\n")[1:], 'tr(v:val, " ", " ")')
endf
fu! s:process(clines, ...)
let [clines, evas] = [[], []]
for each in a:clines
let parts = matchlist(each, '\v^.\s*\d+\s+(\d+)\s+(\d+)\s(.*)$')
if !empty(parts)
if parts[3] == '' | let parts[3] = ' ' | en
cal add(clines, parts[3].' |'.a:1.':'.a:2.'|'.parts[1].':'.parts[2].'|')
en
endfo
retu reverse(filter(clines, 'count(clines, v:val) == 1'))
endf
fu! s:syntax()
if !ctrlp#nosy()
cal ctrlp#hicheck('CtrlPBufName', 'Directory')
cal ctrlp#hicheck('CtrlPTabExtra', 'Comment')
sy match CtrlPBufName '\t|\d\+:\zs[^|]\+\ze|\d\+:\d\+|$'
sy match CtrlPTabExtra '\zs\t.*\ze$' contains=CtrlPBufName
en
endf
" Public {{{1
fu! ctrlp#changes#init(original_bufnr, bufnr)
let bufnr = exists('s:bufnr') ? s:bufnr : a:bufnr
let bufs = exists('s:clmode') && s:clmode ? ctrlp#buffers('id') : [bufnr]
cal filter(bufs, 'v:val > 0')
let [swb, &swb] = [&swb, '']
let lines = []
for each in bufs
let fnamet = fnamemodify(bufname(each), ':t')
cal extend(lines, s:process(s:changelist(each), each, fnamet))
endfo
sil! exe 'noa hid b' a:original_bufnr
let &swb = swb
cal ctrlp#syntax()
cal s:syntax()
retu lines
endf
fu! ctrlp#changes#accept(mode, str)
let info = matchlist(a:str, '\t|\(\d\+\):[^|]\+|\(\d\+\):\(\d\+\)|$')
let bufnr = str2nr(get(info, 1))
if bufnr
cal ctrlp#acceptfile(a:mode, bufname(bufnr))
cal cursor(get(info, 2), get(info, 3))
sil! norm! zvzz
en
endf
fu! ctrlp#changes#cmd(mode, ...)
let s:clmode = a:mode
if a:0 && !empty(a:1)
let s:bufnr = bufnr('^'.fnamemodify(a:1, ':p').'$')
en
retu s:id
endf
fu! ctrlp#changes#exit()
unl! s:clmode s:bufnr
endf
"}}}
" vim:fen:fdm=marker:fmr={{{,}}}:fdl=0:fdc=1:ts=2:sw=2:sts=2

View file

@ -0,0 +1,92 @@
" =============================================================================
" File: autoload/ctrlp/dir.vim
" Description: Directory extension
" Author: Kien Nguyen <github.com/kien>
" =============================================================================
" Init {{{1
if exists('g:loaded_ctrlp_dir') && g:loaded_ctrlp_dir
fini
en
let [g:loaded_ctrlp_dir, g:ctrlp_newdir] = [1, 0]
let s:ars = ['s:maxdepth', 's:maxfiles', 's:compare_lim', 's:glob', 's:caching']
cal add(g:ctrlp_ext_vars, {
\ 'init': 'ctrlp#dir#init('.join(s:ars, ', ').')',
\ 'accept': 'ctrlp#dir#accept',
\ 'lname': 'dirs',
\ 'sname': 'dir',
\ 'type': 'path',
\ 'specinput': 1,
\ })
let s:id = g:ctrlp_builtins + len(g:ctrlp_ext_vars)
let s:dircounts = {}
" Utilities {{{1
fu! s:globdirs(dirs, depth)
let entries = split(globpath(a:dirs, s:glob), "\n")
let [dirs, depth] = [ctrlp#dirnfile(entries)[0], a:depth + 1]
cal extend(g:ctrlp_alldirs, dirs)
let nr = len(g:ctrlp_alldirs)
if !empty(dirs) && !s:max(nr, s:maxfiles) && depth <= s:maxdepth
sil! cal ctrlp#progress(nr)
cal s:globdirs(join(dirs, ','), depth)
en
endf
fu! s:max(len, max)
retu a:max && a:len > a:max ? 1 : 0
endf
fu! s:nocache()
retu !s:caching || ( s:caching > 1 && get(s:dircounts, s:cwd) < s:caching )
endf
" Public {{{1
fu! ctrlp#dir#init(...)
let s:cwd = getcwd()
for each in range(len(s:ars))
let {s:ars[each]} = a:{each + 1}
endfo
let cadir = ctrlp#utils#cachedir().ctrlp#utils#lash().'dir'
let cafile = cadir.ctrlp#utils#lash().ctrlp#utils#cachefile('dir')
if g:ctrlp_newdir || s:nocache() || !filereadable(cafile)
let [s:initcwd, g:ctrlp_alldirs] = [s:cwd, []]
cal s:globdirs(s:cwd, 0)
cal ctrlp#rmbasedir(g:ctrlp_alldirs)
if len(g:ctrlp_alldirs) <= s:compare_lim
cal sort(g:ctrlp_alldirs, 'ctrlp#complen')
en
cal ctrlp#utils#writecache(g:ctrlp_alldirs, cadir, cafile)
let g:ctrlp_newdir = 0
el
if !( exists('s:initcwd') && s:initcwd == s:cwd )
let s:initcwd = s:cwd
let g:ctrlp_alldirs = ctrlp#utils#readfile(cafile)
en
en
cal extend(s:dircounts, { s:cwd : len(g:ctrlp_alldirs) })
retu g:ctrlp_alldirs
endf
fu! ctrlp#dir#accept(mode, str)
let path = a:mode == 'h' ? getcwd() : s:cwd.ctrlp#utils#lash().a:str
if a:mode =~ 't\|v\|h'
cal ctrlp#exit()
en
cal ctrlp#setdir(path, a:mode =~ 't\|h' ? 'chd!' : 'lc!')
if a:mode == 'e'
sil! cal ctrlp#statusline()
cal ctrlp#setlines(s:id)
cal ctrlp#recordhist()
cal ctrlp#prtclear()
en
endf
fu! ctrlp#dir#id()
retu s:id
endf
"}}}
" vim:fen:fdm=marker:fmr={{{,}}}:fdl=0:fdc=1:ts=2:sw=2:sts=2

View file

@ -0,0 +1,62 @@
" =============================================================================
" File: autoload/ctrlp/line.vim
" Description: Line extension
" Author: Kien Nguyen <github.com/kien>
" =============================================================================
" Init {{{1
if exists('g:loaded_ctrlp_line') && g:loaded_ctrlp_line
fini
en
let g:loaded_ctrlp_line = 1
cal add(g:ctrlp_ext_vars, {
\ 'init': 'ctrlp#line#init()',
\ 'accept': 'ctrlp#line#accept',
\ 'lname': 'lines',
\ 'sname': 'lns',
\ 'type': 'tabe',
\ })
let s:id = g:ctrlp_builtins + len(g:ctrlp_ext_vars)
" Utilities {{{1
fu! s:syntax()
if !ctrlp#nosy()
cal ctrlp#hicheck('CtrlPBufName', 'Directory')
cal ctrlp#hicheck('CtrlPTabExtra', 'Comment')
sy match CtrlPBufName '\t|\zs[^|]\+\ze|\d\+:\d\+|$'
sy match CtrlPTabExtra '\zs\t.*\ze$' contains=CtrlPBufName
en
endf
" Public {{{1
fu! ctrlp#line#init()
let [bufs, lines] = [ctrlp#buffers('id'), []]
for bufnr in bufs
let [lfb, bufn] = [getbufline(bufnr, 1, '$'), bufname(bufnr)]
let lfb = lfb == [] ? ctrlp#utils#readfile(fnamemodify(bufn, ':p')) : lfb
cal map(lfb, 'tr(v:val, '' '', '' '')')
let [linenr, len_lfb, buft] = [1, len(lfb), fnamemodify(bufn, ':t')]
wh linenr <= len_lfb
let lfb[linenr - 1] .= ' |'.buft.'|'.bufnr.':'.linenr.'|'
let linenr += 1
endw
cal extend(lines, filter(lfb, 'v:val !~ ''^\s*\t|[^|]\+|\d\+:\d\+|$'''))
endfo
cal s:syntax()
retu lines
endf
fu! ctrlp#line#accept(mode, str)
let info = matchlist(a:str, '\t|[^|]\+|\(\d\+\):\(\d\+\)|$')
let bufnr = str2nr(get(info, 1))
if bufnr
cal ctrlp#acceptfile(a:mode, bufname(bufnr), get(info, 2))
en
endf
fu! ctrlp#line#id()
retu s:id
endf
"}}}
" vim:fen:fdm=marker:fmr={{{,}}}:fdl=0:fdc=1:ts=2:sw=2:sts=2

View file

@ -0,0 +1,83 @@
" =============================================================================
" File: autoload/ctrlp/mixed.vim
" Description: Mixing Files + MRU + Buffers
" Author: Kien Nguyen <github.com/kien>
" =============================================================================
" Init {{{1
if exists('g:loaded_ctrlp_mixed') && g:loaded_ctrlp_mixed
fini
en
let [g:loaded_ctrlp_mixed, g:ctrlp_newmix] = [1, 0]
cal add(g:ctrlp_ext_vars, {
\ 'init': 'ctrlp#mixed#init(s:compare_lim)',
\ 'accept': 'ctrlp#acceptfile',
\ 'lname': 'fil + mru + buf',
\ 'sname': 'mix',
\ 'type': 'path',
\ 'opmul': 1,
\ 'specinput': 1,
\ })
let s:id = g:ctrlp_builtins + len(g:ctrlp_ext_vars)
" Utilities {{{1
fu! s:newcache(cwd)
if g:ctrlp_newmix || !has_key(g:ctrlp_allmixes, 'data') | retu 1 | en
retu g:ctrlp_allmixes['cwd'] != a:cwd
\ || g:ctrlp_allmixes['filtime'] < getftime(ctrlp#utils#cachefile())
\ || g:ctrlp_allmixes['mrutime'] < getftime(ctrlp#mrufiles#cachefile())
\ || g:ctrlp_allmixes['bufs'] < len(ctrlp#mrufiles#bufs())
endf
fu! s:getnewmix(cwd, clim)
if g:ctrlp_newmix
cal ctrlp#mrufiles#refresh('raw')
let g:ctrlp_newcache = 1
en
let g:ctrlp_lines = copy(ctrlp#files())
cal ctrlp#progress('Mixing...')
let mrufs = copy(ctrlp#mrufiles#list('raw'))
if exists('+ssl') && &ssl
cal map(mrufs, 'tr(v:val, "\\", "/")')
en
let bufs = map(ctrlp#buffers('id'), 'fnamemodify(bufname(v:val), ":p")')
let mrufs = bufs + filter(mrufs, 'index(bufs, v:val) < 0')
if len(mrufs) > len(g:ctrlp_lines)
cal filter(mrufs, 'stridx(v:val, a:cwd)')
el
let cwd_mrufs = filter(copy(mrufs), '!stridx(v:val, a:cwd)')
let cwd_mrufs = ctrlp#rmbasedir(cwd_mrufs)
for each in cwd_mrufs
let id = index(g:ctrlp_lines, each)
if id >= 0 | cal remove(g:ctrlp_lines, id) | en
endfo
en
cal map(mrufs, 'fnamemodify(v:val, ":.")')
let g:ctrlp_lines = len(mrufs) > len(g:ctrlp_lines)
\ ? g:ctrlp_lines + mrufs : mrufs + g:ctrlp_lines
if len(g:ctrlp_lines) <= a:clim
cal sort(g:ctrlp_lines, 'ctrlp#complen')
en
let g:ctrlp_allmixes = { 'filtime': getftime(ctrlp#utils#cachefile()),
\ 'mrutime': getftime(ctrlp#mrufiles#cachefile()), 'cwd': a:cwd,
\ 'bufs': len(ctrlp#mrufiles#bufs()), 'data': g:ctrlp_lines }
endf
" Public {{{1
fu! ctrlp#mixed#init(clim)
let cwd = getcwd()
if s:newcache(cwd)
cal s:getnewmix(cwd, a:clim)
el
let g:ctrlp_lines = g:ctrlp_allmixes['data']
en
let g:ctrlp_newmix = 0
retu g:ctrlp_lines
endf
fu! ctrlp#mixed#id()
retu s:id
endf
"}}}
" vim:fen:fdm=marker:fmr={{{,}}}:fdl=0:fdc=1:ts=2:sw=2:sts=2

View file

@ -0,0 +1,119 @@
" =============================================================================
" File: autoload/ctrlp/mrufiles.vim
" Description: Most Recently Used Files extension
" Author: Kien Nguyen <github.com/kien>
" =============================================================================
" Static variables {{{1
let [s:mrbs, s:mrufs] = [[], []]
fu! ctrlp#mrufiles#opts()
let [pref, opts] = ['g:ctrlp_mruf_', {
\ 'max': ['s:max', 250],
\ 'include': ['s:in', ''],
\ 'exclude': ['s:ex', ''],
\ 'case_sensitive': ['s:cseno', 1],
\ 'relative': ['s:re', 0],
\ }]
for [ke, va] in items(opts)
let [{va[0]}, {pref.ke}] = [pref.ke, exists(pref.ke) ? {pref.ke} : va[1]]
endfo
endf
cal ctrlp#mrufiles#opts()
" Utilities {{{1
fu! s:excl(fn)
retu !empty({s:ex}) && a:fn =~# {s:ex}
endf
fu! s:mergelists()
let diskmrufs = ctrlp#utils#readfile(ctrlp#mrufiles#cachefile())
cal filter(diskmrufs, 'index(s:mrufs, v:val) < 0')
let mrufs = s:mrufs + diskmrufs
retu s:chop(mrufs)
endf
fu! s:chop(mrufs)
if len(a:mrufs) > {s:max} | cal remove(a:mrufs, {s:max}, -1) | en
retu a:mrufs
endf
fu! s:reformat(mrufs)
if {s:re}
let cwd = exists('+ssl') ? tr(getcwd(), '/', '\') : getcwd()
cal filter(a:mrufs, '!stridx(v:val, cwd)')
en
retu map(a:mrufs, 'fnamemodify(v:val, ":.")')
endf
fu! s:record(bufnr)
if s:locked | retu | en
let bufnr = a:bufnr + 0
if bufnr <= 0 | retu | en
let bufname = bufname(bufnr)
if empty(bufname) | retu | en
let fn = fnamemodify(bufname, ':p')
let fn = exists('+ssl') ? tr(fn, '/', '\') : fn
cal filter(s:mrbs, 'v:val != bufnr')
cal insert(s:mrbs, bufnr)
if ( !empty({s:in}) && fn !~# {s:in} ) || ( !empty({s:ex}) && fn =~# {s:ex} )
\ || !empty(&bt) || !filereadable(fn) | retu
en
cal filter(s:mrufs, 'v:val !='.( {s:cseno} ? '#' : '?' ).' fn')
cal insert(s:mrufs, fn)
endf
fu! s:savetofile(mrufs)
cal ctrlp#utils#writecache(a:mrufs, s:cadir, s:cafile)
endf
" Public {{{1
fu! ctrlp#mrufiles#refresh(...)
let s:mrufs = s:mergelists()
cal filter(s:mrufs, '!empty(ctrlp#utils#glob(v:val, 1)) && !s:excl(v:val)')
if exists('+ssl')
cal map(s:mrufs, 'tr(v:val, "/", "\\")')
cal filter(s:mrufs, 'count(s:mrufs, v:val) == 1')
en
cal s:savetofile(s:mrufs)
retu a:0 && a:1 == 'raw' ? [] : s:reformat(copy(s:mrufs))
endf
fu! ctrlp#mrufiles#remove(files)
let s:mrufs = []
if a:files != []
let s:mrufs = s:mergelists()
cal filter(s:mrufs, 'index(a:files, v:val, 0, '.(!{s:cseno}).') < 0')
en
cal s:savetofile(s:mrufs)
retu s:reformat(copy(s:mrufs))
endf
fu! ctrlp#mrufiles#list(...)
retu a:0 ? a:1 == 'raw' ? s:mergelists() : 0 : s:reformat(s:mergelists())
endf
fu! ctrlp#mrufiles#bufs()
retu s:mrbs
endf
fu! ctrlp#mrufiles#cachefile()
if !exists('s:cadir') || !exists('s:cafile')
let s:cadir = ctrlp#utils#cachedir().ctrlp#utils#lash().'mru'
let s:cafile = s:cadir.ctrlp#utils#lash().'cache.txt'
en
retu s:cafile
endf
fu! ctrlp#mrufiles#init()
if !has('autocmd') | retu | en
let s:locked = 0
aug CtrlPMRUF
au!
au BufAdd,BufEnter,BufLeave,BufUnload * cal s:record(expand('<abuf>', 1))
au QuickFixCmdPre *vimgrep* let s:locked = 1
au QuickFixCmdPost *vimgrep* let s:locked = 0
au VimLeavePre * cal s:savetofile(s:mergelists())
aug END
endf
"}}}
" vim:fen:fdm=marker:fmr={{{,}}}:fdl=0:fdc=1:ts=2:sw=2:sts=2

View file

@ -0,0 +1,62 @@
" =============================================================================
" File: autoload/ctrlp/quickfix.vim
" Description: Quickfix extension
" Author: Kien Nguyen <github.com/kien>
" =============================================================================
" Init {{{1
if exists('g:loaded_ctrlp_quickfix') && g:loaded_ctrlp_quickfix
fini
en
let g:loaded_ctrlp_quickfix = 1
cal add(g:ctrlp_ext_vars, {
\ 'init': 'ctrlp#quickfix#init()',
\ 'accept': 'ctrlp#quickfix#accept',
\ 'lname': 'quickfix',
\ 'sname': 'qfx',
\ 'type': 'line',
\ 'sort': 0,
\ 'nolim': 1,
\ })
let s:id = g:ctrlp_builtins + len(g:ctrlp_ext_vars)
fu! s:lineout(dict)
retu printf('%s|%d:%d| %s', bufname(a:dict['bufnr']), a:dict['lnum'],
\ a:dict['col'], matchstr(a:dict['text'], '\s*\zs.*\S'))
endf
" Utilities {{{1
fu! s:syntax()
if !ctrlp#nosy()
cal ctrlp#hicheck('CtrlPqfLineCol', 'Search')
sy match CtrlPqfLineCol '|\zs\d\+:\d\+\ze|'
en
endf
" Public {{{1
fu! ctrlp#quickfix#init()
cal s:syntax()
retu map(getqflist(), 's:lineout(v:val)')
endf
fu! ctrlp#quickfix#accept(mode, str)
let items = matchlist(a:str, '^\([^|]\+\ze\)|\(\d\+\):\(\d\+\)|')
if items == [] | retu | en
let [md, filpath] = [a:mode, fnamemodify(items[1], ':p')]
if empty(filpath) | retu | en
cal ctrlp#exit()
let cmd = md == 't' ? 'tabe' : md == 'h' ? 'new' : md == 'v' ? 'vne'
\ : ctrlp#normcmd('e')
let cmd = cmd == 'e' && &modified ? 'hid e' : cmd
exe cmd ctrlp#fnesc(filpath)
cal cursor(items[2], items[3])
sil! norm! zvzz
cal ctrlp#setlcdir()
endf
fu! ctrlp#quickfix#id()
retu s:id
endf
"}}}
" vim:fen:fdm=marker:fmr={{{,}}}:fdl=0:fdc=1:ts=2:sw=2:sts=2

View file

@ -0,0 +1,56 @@
" =============================================================================
" File: autoload/ctrlp/rtscript.vim
" Description: Runtime scripts extension
" Author: Kien Nguyen <github.com/kien>
" =============================================================================
" Init {{{1
if exists('g:loaded_ctrlp_rtscript') && g:loaded_ctrlp_rtscript
fini
en
let [g:loaded_ctrlp_rtscript, g:ctrlp_newrts] = [1, 0]
cal add(g:ctrlp_ext_vars, {
\ 'init': 'ctrlp#rtscript#init(s:caching)',
\ 'accept': 'ctrlp#acceptfile',
\ 'lname': 'runtime scripts',
\ 'sname': 'rts',
\ 'type': 'path',
\ 'opmul': 1,
\ })
let s:id = g:ctrlp_builtins + len(g:ctrlp_ext_vars)
let s:filecounts = {}
" Utilities {{{1
fu! s:nocache()
retu !s:caching || ( s:caching > 1 && get(s:filecounts, s:cwd) < s:caching )
endf
" Public {{{1
fu! ctrlp#rtscript#init(caching)
let [s:caching, s:cwd] = [a:caching, getcwd()]
if g:ctrlp_newrts || s:nocache()
\ || !( exists('g:ctrlp_rtscache') && g:ctrlp_rtscache[0] == &rtp )
sil! cal ctrlp#progress('Indexing...')
let entries = split(globpath(&rtp, '**/*.*'), "\n")
cal filter(entries, 'count(entries, v:val) == 1')
let [entries, echoed] = [ctrlp#dirnfile(entries)[1], 1]
el
let [entries, results] = g:ctrlp_rtscache[2:3]
en
if g:ctrlp_newrts || s:nocache()
\ || !( exists('g:ctrlp_rtscache') && g:ctrlp_rtscache[:1] == [&rtp, s:cwd] )
if !exists('echoed') | sil! cal ctrlp#progress('Processing...') | en
let results = map(copy(entries), 'fnamemodify(v:val, '':.'')')
en
let [g:ctrlp_rtscache, g:ctrlp_newrts] = [[&rtp, s:cwd, entries, results], 0]
cal extend(s:filecounts, { s:cwd : len(results) })
retu results
endf
fu! ctrlp#rtscript#id()
retu s:id
endf
"}}}
" vim:fen:fdm=marker:fmr={{{,}}}:fdl=0:fdc=1:ts=2:sw=2:sts=2

View file

@ -0,0 +1,124 @@
" =============================================================================
" File: autoload/ctrlp/tag.vim
" Description: Tag file extension
" Author: Kien Nguyen <github.com/kien>
" =============================================================================
" Init {{{1
if exists('g:loaded_ctrlp_tag') && g:loaded_ctrlp_tag
fini
en
let g:loaded_ctrlp_tag = 1
cal add(g:ctrlp_ext_vars, {
\ 'init': 'ctrlp#tag#init()',
\ 'accept': 'ctrlp#tag#accept',
\ 'lname': 'tags',
\ 'sname': 'tag',
\ 'enter': 'ctrlp#tag#enter()',
\ 'type': 'tabs',
\ })
let s:id = g:ctrlp_builtins + len(g:ctrlp_ext_vars)
" Utilities {{{1
fu! s:findcount(str)
let [tg, fname] = split(a:str, '\t\+\ze[^\t]\+$')
let tgs = taglist('^'.tg.'$')
if len(tgs) < 2
retu [1, 1]
en
let bname = fnamemodify(bufname('%'), ':p')
let fname = expand(fnamemodify(simplify(fname), ':s?^[.\/]\+??:p:.'), 1)
let [fnd, ct, pos, idx] = [0, 0, 0, 0]
wh idx < len(tgs)
if bname == fnamemodify(tgs[idx]["filename"], ':p')
cal insert(tgs, remove(tgs, idx))
brea
en
let idx += 1
endw
for each in tgs
let ct += 1
let fulname = fnamemodify(each["filename"], ':p')
if stridx(fulname, fname) >= 0
\ && strlen(fname) + stridx(fulname, fname) == strlen(fulname)
let fnd += 1
let pos = ct
en
if fnd > 1 | brea | en
endfo
retu [fnd, pos]
endf
fu! s:filter(tags)
let nr = 0
wh 0 < 1
if a:tags == [] | brea | en
if a:tags[nr] =~ '^!' && a:tags[nr] !~ '^!_TAG_'
let nr += 1
con
en
if a:tags[nr] =~ '^!_TAG_' && len(a:tags) > nr
cal remove(a:tags, nr)
el
brea
en
endw
retu a:tags
endf
fu! s:syntax()
if !ctrlp#nosy()
cal ctrlp#hicheck('CtrlPTabExtra', 'Comment')
sy match CtrlPTabExtra '\zs\t.*\ze$'
en
endf
" Public {{{1
fu! ctrlp#tag#init()
if empty(s:tagfiles) | retu [] | en
let g:ctrlp_alltags = []
let tagfiles = sort(filter(s:tagfiles, 'count(s:tagfiles, v:val) == 1'))
for each in tagfiles
let alltags = s:filter(ctrlp#utils#readfile(each))
cal extend(g:ctrlp_alltags, alltags)
endfo
cal s:syntax()
retu g:ctrlp_alltags
endf
fu! ctrlp#tag#accept(mode, str)
cal ctrlp#exit()
let str = matchstr(a:str, '^[^\t]\+\t\+[^\t]\+\ze\t')
let [tg, fnd] = [split(str, '^[^\t]\+\zs\t')[0], s:findcount(str)]
let cmds = {
\ 't': ['tab sp', 'tab stj'],
\ 'h': ['sp', 'stj'],
\ 'v': ['vs', 'vert stj'],
\ 'e': ['', 'tj'],
\ }
let cmd = fnd[0] == 1 ? cmds[a:mode][0] : cmds[a:mode][1]
let cmd = cmd == 'tj' && &mod ? 'hid '.cmd : cmd
let cmd = a:mode == 't' ? ctrlp#tabcount().cmd : cmd
if fnd[0] == 1
if cmd != ''
exe cmd
en
exe fnd[1].'ta' tg
el
exe cmd tg
en
cal ctrlp#setlcdir()
endf
fu! ctrlp#tag#id()
retu s:id
endf
fu! ctrlp#tag#enter()
let tfs = tagfiles()
let s:tagfiles = tfs != [] ? filter(map(tfs, 'fnamemodify(v:val, ":p")'),
\ 'filereadable(v:val)') : []
endf
"}}}
" vim:fen:fdm=marker:fmr={{{,}}}:fdl=0:fdc=1:ts=2:sw=2:sts=2

View file

@ -0,0 +1,154 @@
" =============================================================================
" File: autoload/ctrlp/undo.vim
" Description: Undo extension
" Author: Kien Nguyen <github.com/kien>
" =============================================================================
" Init {{{1
if ( exists('g:loaded_ctrlp_undo') && g:loaded_ctrlp_undo )
fini
en
let g:loaded_ctrlp_undo = 1
cal add(g:ctrlp_ext_vars, {
\ 'init': 'ctrlp#undo#init()',
\ 'accept': 'ctrlp#undo#accept',
\ 'lname': 'undo',
\ 'sname': 'udo',
\ 'enter': 'ctrlp#undo#enter()',
\ 'exit': 'ctrlp#undo#exit()',
\ 'type': 'line',
\ 'sort': 0,
\ 'nolim': 1,
\ })
let s:id = g:ctrlp_builtins + len(g:ctrlp_ext_vars)
let s:text = map(['second', 'seconds', 'minutes', 'hours', 'days', 'weeks',
\ 'months', 'years'], '" ".v:val." ago"')
" Utilities {{{1
fu! s:getundo()
if exists('*undotree')
\ && ( v:version > 703 || ( v:version == 703 && has('patch005') ) )
retu [1, undotree()]
el
redi => result
sil! undol
redi END
retu [0, split(result, "\n")[1:]]
en
endf
fu! s:flatten(tree, cur)
let flatdict = {}
for each in a:tree
let saved = has_key(each, 'save') ? 'saved' : ''
let current = each['seq'] == a:cur ? 'current' : ''
cal extend(flatdict, { each['seq'] : [each['time'], saved, current] })
if has_key(each, 'alt')
cal extend(flatdict, s:flatten(each['alt'], a:cur))
en
endfo
retu flatdict
endf
fu! s:elapsed(nr)
let [text, time] = [s:text, localtime() - a:nr]
let mins = time / 60
let hrs = time / 3600
let days = time / 86400
let wks = time / 604800
let mons = time / 2592000
let yrs = time / 31536000
if yrs > 1
retu yrs.text[7]
elsei mons > 1
retu mons.text[6]
elsei wks > 1
retu wks.text[5]
elsei days > 1
retu days.text[4]
elsei hrs > 1
retu hrs.text[3]
elsei mins > 1
retu mins.text[2]
elsei time == 1
retu time.text[0]
elsei time < 120
retu time.text[1]
en
endf
fu! s:syntax()
if ctrlp#nosy() | retu | en
for [ke, va] in items({'T': 'Directory', 'Br': 'Comment', 'Nr': 'String',
\ 'Sv': 'Comment', 'Po': 'Title'})
cal ctrlp#hicheck('CtrlPUndo'.ke, va)
endfo
sy match CtrlPUndoT '\v\d+ \zs[^ ]+\ze|\d+:\d+:\d+'
sy match CtrlPUndoBr '\[\|\]'
sy match CtrlPUndoNr '\[\d\+\]' contains=CtrlPUndoBr
sy match CtrlPUndoSv 'saved'
sy match CtrlPUndoPo 'current'
endf
fu! s:dict2list(dict)
for ke in keys(a:dict)
let a:dict[ke][0] = s:elapsed(a:dict[ke][0])
endfo
retu map(keys(a:dict), 'eval(''[v:val, a:dict[v:val]]'')')
endf
fu! s:compval(...)
retu a:2[0] - a:1[0]
endf
fu! s:format(...)
let saved = !empty(a:1[1][1]) ? ' '.a:1[1][1] : ''
let current = !empty(a:1[1][2]) ? ' '.a:1[1][2] : ''
retu a:1[1][0].' ['.a:1[0].']'.saved.current
endf
fu! s:formatul(...)
let parts = matchlist(a:1,
\ '\v^\s+(\d+)\s+\d+\s+([^ ]+\s?[^ ]+|\d+\s\w+\s\w+)(\s*\d*)$')
retu parts == [] ? '----'
\ : parts[2].' ['.parts[1].']'.( parts[3] != '' ? ' saved' : '' )
endf
" Public {{{1
fu! ctrlp#undo#init()
let entries = s:undos[0] ? s:undos[1]['entries'] : s:undos[1]
if empty(entries) | retu [] | en
if !exists('s:lines')
if s:undos[0]
let entries = s:dict2list(s:flatten(entries, s:undos[1]['seq_cur']))
let s:lines = map(sort(entries, 's:compval'), 's:format(v:val)')
el
let s:lines = map(reverse(entries), 's:formatul(v:val)')
en
en
cal s:syntax()
retu s:lines
endf
fu! ctrlp#undo#accept(mode, str)
let undon = matchstr(a:str, '\[\zs\d\+\ze\]')
if empty(undon) | retu | en
cal ctrlp#exit()
exe 'u' undon
endf
fu! ctrlp#undo#id()
retu s:id
endf
fu! ctrlp#undo#enter()
let s:undos = s:getundo()
endf
fu! ctrlp#undo#exit()
unl! s:lines
endf
"}}}
" vim:fen:fdm=marker:fmr={{{,}}}:fdl=0:fdc=1:ts=2:sw=2:sts=2

View file

@ -0,0 +1,72 @@
" =============================================================================
" File: autoload/ctrlp/utils.vim
" Description: Utilities
" Author: Kien Nguyen <github.com/kien>
" =============================================================================
" Static variables {{{1
fu! ctrlp#utils#lash()
retu &ssl || !exists('+ssl') ? '/' : '\'
endf
let s:lash = ctrlp#utils#lash()
fu! s:lash(...)
retu ( a:0 ? a:1 : getcwd() ) !~ '[\/]$' ? s:lash : ''
endf
fu! ctrlp#utils#opts()
let usrhome = $HOME.s:lash($HOME)
let cahome = exists('$XDG_CACHE_HOME') ? $XDG_CACHE_HOME : usrhome.'.cache'
let s:cache_dir = isdirectory(usrhome.'.ctrlp_cache')
\ ? usrhome.'.ctrlp_cache' : cahome.s:lash(cahome).'ctrlp'
if exists('g:ctrlp_cache_dir')
let s:cache_dir = expand(g:ctrlp_cache_dir, 1)
if isdirectory(s:cache_dir.s:lash(s:cache_dir).'.ctrlp_cache')
let s:cache_dir = s:cache_dir.s:lash(s:cache_dir).'.ctrlp_cache'
en
en
endf
cal ctrlp#utils#opts()
" Files and Directories {{{1
fu! ctrlp#utils#cachedir()
retu s:cache_dir
endf
fu! ctrlp#utils#cachefile(...)
let [tail, dir] = [a:0 == 1 ? '.'.a:1 : '', a:0 == 2 ? a:1 : getcwd()]
let cache_file = substitute(dir, '\([\/]\|^\a\zs:\)', '%', 'g').tail.'.txt'
retu a:0 == 1 ? cache_file : s:cache_dir.s:lash(s:cache_dir).cache_file
endf
fu! ctrlp#utils#readfile(file)
if filereadable(a:file)
let data = readfile(a:file)
if empty(data) || type(data) != 3
unl data
let data = []
en
retu data
en
retu []
endf
fu! ctrlp#utils#mkdir(dir)
if exists('*mkdir') && !isdirectory(a:dir)
sil! cal mkdir(a:dir, 'p')
en
retu a:dir
endf
fu! ctrlp#utils#writecache(lines, ...)
if isdirectory(ctrlp#utils#mkdir(a:0 ? a:1 : s:cache_dir))
sil! cal writefile(a:lines, a:0 >= 2 ? a:2 : ctrlp#utils#cachefile())
en
endf
fu! ctrlp#utils#glob(...)
let cond = v:version > 702 || ( v:version == 702 && has('patch051') )
retu call('glob', cond ? a:000 : [a:1])
endf
"}}}
" vim:fen:fdm=marker:fmr={{{,}}}:fdl=0:fdc=1:ts=2:sw=2:sts=2

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,66 @@
" =============================================================================
" File: plugin/ctrlp.vim
" Description: Fuzzy file, buffer, mru, tag, etc finder.
" Author: Kien Nguyen <github.com/kien>
" =============================================================================
" GetLatestVimScripts: 3736 1 :AutoInstall: ctrlp.zip
if ( exists('g:loaded_ctrlp') && g:loaded_ctrlp ) || v:version < 700 || &cp
fini
en
let g:loaded_ctrlp = 1
let [g:ctrlp_lines, g:ctrlp_allfiles, g:ctrlp_alltags, g:ctrlp_alldirs,
\ g:ctrlp_allmixes, g:ctrlp_buftags, g:ctrlp_ext_vars, g:ctrlp_builtins]
\ = [[], [], [], [], {}, {}, [], 2]
if !exists('g:ctrlp_map') | let g:ctrlp_map = '<c-p>' | en
if !exists('g:ctrlp_cmd') | let g:ctrlp_cmd = 'CtrlP' | en
com! -n=? -com=dir CtrlP cal ctrlp#init(0, { 'dir': <q-args> })
com! -n=? -com=dir CtrlPMRUFiles cal ctrlp#init(2, { 'dir': <q-args> })
com! -bar CtrlPBuffer cal ctrlp#init(1)
com! -bar CtrlPLastMode cal ctrlp#init(-1)
com! -bar CtrlPClearCache cal ctrlp#clr()
com! -bar CtrlPClearAllCaches cal ctrlp#clra()
com! -bar CtrlPReload cal ctrlp#reset()
com! -bar ClearCtrlPCache cal ctrlp#clr()
com! -bar ClearAllCtrlPCaches cal ctrlp#clra()
com! -bar ResetCtrlP cal ctrlp#reset()
com! -bar CtrlPCurWD cal ctrlp#init(0, { 'mode': '' })
com! -bar CtrlPCurFile cal ctrlp#init(0, { 'mode': 'c' })
com! -bar CtrlPRoot cal ctrlp#init(0, { 'mode': 'rc' })
if g:ctrlp_map != '' && !hasmapto(':<c-u>'.g:ctrlp_cmd.'<cr>', 'n')
exe 'nn <silent>' g:ctrlp_map ':<c-u>'.g:ctrlp_cmd.'<cr>'
en
cal ctrlp#mrufiles#init()
com! -bar CtrlPTag cal ctrlp#init(ctrlp#tag#id())
com! -bar CtrlPQuickfix cal ctrlp#init(ctrlp#quickfix#id())
com! -n=? -com=dir CtrlPDir
\ cal ctrlp#init(ctrlp#dir#id(), { 'dir': <q-args> })
com! -n=? -com=buffer CtrlPBufTag
\ cal ctrlp#init(ctrlp#buffertag#cmd(0, <q-args>))
com! -bar CtrlPBufTagAll cal ctrlp#init(ctrlp#buffertag#cmd(1))
com! -bar CtrlPRTS cal ctrlp#init(ctrlp#rtscript#id())
com! -bar CtrlPUndo cal ctrlp#init(ctrlp#undo#id())
com! -bar CtrlPLine cal ctrlp#init(ctrlp#line#id())
com! -n=? -com=buffer CtrlPChange
\ cal ctrlp#init(ctrlp#changes#cmd(0, <q-args>))
com! -bar CtrlPChangeAll cal ctrlp#init(ctrlp#changes#cmd(1))
com! -bar CtrlPMixed cal ctrlp#init(ctrlp#mixed#id())
com! -bar CtrlPBookmarkDir cal ctrlp#init(ctrlp#bookmarkdir#id())
com! -n=? -com=dir CtrlPBookmarkDirAdd
\ cal ctrlp#call('ctrlp#bookmarkdir#add', <q-args>)

View file

@ -0,0 +1,87 @@
# ctrlp.vim
Full path fuzzy __file__, __buffer__, __mru__, __tag__, __...__ finder for Vim.
* Written in pure Vimscript for MacVim, gVim and Vim 7.0+.
* Full support for Vim's regexp as search patterns.
* Built-in Most Recently Used (MRU) files monitoring.
* Built-in project's root finder.
* Open multiple files at once.
* Create new files and directories.
* [Extensible][2].
![ctrlp][1]
## Basic Usage
* Run `:CtrlP` or `:CtrlP [starting-directory]` to invoke CtrlP in find file mode.
* Run `:CtrlPBuffer` or `:CtrlPMRU` to invoke CtrlP in find buffer or find MRU file mode.
* Run `:CtrlPMixed` to search in Files, Buffers and MRU files at the same time.
Check `:help ctrlp-commands` and `:help ctrlp-extensions` for other commands.
##### Once CtrlP is open:
* Press `<F5>` to purge the cache for the current directory to get new files, remove deleted files and apply new ignore options.
* Press `<c-f>` and `<c-b>` to cycle between modes.
* Press `<c-d>` to switch to filename only search instead of full path.
* Press `<c-r>` to switch to regexp mode.
* Use `<c-n>`, `<c-p>` to select the next/previous string in the prompt's history.
* Use `<c-y>` to create a new file and its parent directories.
* Use `<c-z>` to mark/unmark multiple files and `<c-o>` to open them.
Run `:help ctrlp-mappings` or submit `?` in CtrlP for more mapping help.
* Submit two or more dots `..` to go up the directory tree by one or multiple levels.
* End the input string with a colon `:` followed by a command to execute it on the opening file(s):
Use `:25` to jump to line 25.
Use `:/any\:\ string` to jump to the first instance of `any: string`.
Use `:difft` when opening multiple files to run `:difft` on the first 4 files.
## Basic Options
* Change the default mapping and the default command to invoke CtrlP:
```vim
let g:ctrlp_map = '<c-p>'
let g:ctrlp_cmd = 'CtrlP'
```
* When invoked, unless a starting directory is specified, CtrlP will set its local working directory according to this variable:
```vim
let g:ctrlp_working_path_mode = 'rc'
```
`{empty-string}` - don't manage working directory.
`c` - the directory of the current file.
`r` - the nearest ancestor that contains one of these directories or files:
`.git` `.hg` `.svn` `.bzr` `_darcs`
Define additional root markers with the `g:ctrlp_root_markers` option.
* Exclude files and directories using Vim's `wildignore` and CtrlP's own `g:ctrlp_custom_ignore`:
```vim
set wildignore+=*/tmp/*,*.so,*.swp,*.zip " MacOSX/Linux
set wildignore+=tmp\*,*.swp,*.zip,*.exe " Windows
let g:ctrlp_custom_ignore = '\.git$\|\.hg$\|\.svn$'
let g:ctrlp_custom_ignore = {
\ 'dir': '\.git$\|\.hg$\|\.svn$',
\ 'file': '\.exe$\|\.so$\|\.dll$',
\ 'link': 'some_bad_symbolic_links',
\ }
```
* Use a custom file listing command:
```vim
let g:ctrlp_user_command = 'find %s -type f' " MacOSX/Linux
let g:ctrlp_user_command = 'dir %s /-n /b /s /a-d' " Windows
```
Check `:help ctrlp-options` for other options.
## Installation
Use your favorite method or check the homepage for a [quick installation guide][3].
[1]: http://i.imgur.com/yIynr.png
[2]: https://github.com/kien/ctrlp.vim/tree/extensions
[3]: http://kien.github.com/ctrlp.vim#installation

View file

@ -0,0 +1,43 @@
This is a mirror of http://www.vim.org/scripts/script.php?script_id=3065
This is a pleasant and ergonomic light-background color scheme, designed for long hours of coding and working. The UI elements are muted without being drab, the syntax elements are colorful without being garish, and the background is relaxing without being soporific. It is of a low-enough contrast so as not to cause eye-burn, but high-enough contrast so as not to cause eye-strain. The syntax coloration offers just a little higher resolution than most, distinguishing between class names vs. functions, strings and numbers vs. other constants, etc. Many of the colors in this color scheme are drawn from Mayan murals, paintings and codices, and thus the name.
Screenshots:
==========
- Python: http://jeetworks.org/files/images/mayansmoke-python1.png
- C++: http://jeetworks.org/files/images/mayansmoke-cpp1.png
Customization:
==============
If any of the following highlights are defined (e.g., in your "~/.vimrc"), these will override the default highlight definitions:
MayanSmokeCursorLine (will be applied to: CursorColumn and CursorLine)
MayanSmokeSearch (will be applied to: Search and IncSearch)
MayanSmokeSpecialKey (will be applied to: SpecialKey)
For example, you can set the following in your "~/.vimrc" to select your own colors for these items:
hi MayanSmokeCursorLine guifg=NONE guibg=yellow gui=NONE
hi MayanSmokeSearch guifg=white guibg=blue gui=NONE
hi MayanSmokeSpecialKey guifg=NONE guibg=green gui=NONE
Alternatively, you can define one or more of the following values in your "~/.vimrc" to select different pre-defined levels of visibility for the above highlights:
let g:mayansmoke_cursor_line_visibility = 0 " lower visibility
let g:mayansmoke_cursor_line_visibility = 1 " medium visibility
let g:mayansmoke_cursor_line_visibility = 2 " higher visibility
let g:mayansmoke_search_visibility = 0 " low visibility
let g:mayansmoke_search_visibility = 1 " medium visibility (default)
let g:mayansmoke_search_visibility = 2 " high visibility
let g:mayansmoke_search_visibility = 3 " very high visibility
let g:mayansmoke_search_visibility = 4 " highest visibility
let g:mayansmoke_special_key_visibility = 0 " lower visibility
let g:mayansmoke_special_key_visibility = 1 " medium visibility
let g:mayansmoke_special_key_visibility = 2 " higher visibility

View file

@ -0,0 +1,343 @@
" =============================================================================
"
" File: mayansmoke.vim
" Description: Vim color scheme file
" Maintainer: Jeet Sukumaran (GUI colors); Clayton Parker (cterm colors)
"
" =============================================================================
" Initialization and Setup {{{1
" =============================================================================
set background=light
highlight clear
if exists("syntax_on")
syntax reset
endif
let colors_name = "mayansmoke"
" }}}
" Normal Color {{{1
" =============================================================================
hi Normal gui=NONE guifg=Black guibg=#F4F4E8
" }}}
" Highlight Groups {{{1
" =============================================================================
" Groups (see ':help highlight-groups'):
" ColorColumn highlight to use with ':set colorcolumn'
" Cursor the character under the cursor
" CursorIM like Cursor, but used when in IME mode |CursorIM|
" CursorColumn the screen column that the cursor is in when 'cursorcolumn' is set
" CursorLine the screen line that the cursor is in when 'cursorline' is set
" Directory directory names (and other special names in listings)
" DiffAdd diff mode: Added line |diff.txt|
" DiffChange diff mode: Changed line |diff.txt|
" DiffDelete diff mode: Deleted line |diff.txt|
" DiffText diff mode: Changed text within a changed line |diff.txt|
" ErrorMsg error messages on the command line
" VertSplit the column separating vertically split windows
" Folded line used for closed folds
" FoldColumn 'foldcolumn'
" SignColumn column where |signs| are displayed
" IncSearch 'incsearch' highlighting; also used for the text replaced with ":s///c"
" LineNr Line number for ":number" and ":#" commands, and when 'number' option is set.
" MatchParen The character under the cursor or just before it, if it is a paired bracket, and its match. |pi_paren.txt|
" ModeMsg 'showmode' message (e.g., "-- INSERT --")
" MoreMsg |more-prompt|
" NonText '~' and '@' at the end of the window, etc.
" Normal normal text
" Pmenu Popup menu: normal item.
" PmenuSel Popup menu: selected item.
" PmenuSbar Popup menu: scrollbar.
" PmenuThumb Popup menu: Thumb of the scrollbar.
" Question |hit-enter| prompt and yes/no questions
" Search Last search pattern highlighting (see 'hlsearch').
" SpecialKey Meta and special keys listed with ":map", text that is displayed differently from what it really is (such as tabs, spaces in listchars etc.).
" SpellBad Word that is not recognized by the spellchecker. |spell|
" SpellCap Word that should start with a capital. |spell|
" SpellLocal Word that is recognized by the spellchecker as one that is
" SpellRare Word that is recognized by the spellchecker as one that is hardly ever used. |spell|
" StatusLine status line of current window
" StatusLineNC status lines of not-current windows
" TabLine tab pages line, not active tab page label
" TabLineFill tab pages line, where there are no labels
" TabLineSel tab pages line, active tab page label
" Title titles for output from ":set all", ":autocmd" etc.
" Visual Visual mode selection
" VisualNOS Visual mode selection when vim is "Not Owning the Selection".
" WarningMsg warning messages
" WildMenu current match in 'wildmenu' completion
hi ColorColumn guifg=NONE guibg=#EEEEDD
hi Cursor guifg=bg guibg=fg gui=NONE
if hlexists('MayanSmokeCursorLine')
hi link CursorColumn MayanSmokeCursorLine
hi link CursorLine MayanSmokeCursorLine
elseif exists('g:mayansmoke_cursor_line_visibility') && g:mayansmoke_cursor_line_visibility >= 2
hi CursorColumn guifg=NONE guibg=NavajoWhite gui=NONE
hi CursorLine guifg=NONE guibg=NavajoWhite gui=NONE
elseif exists('g:mayansmoke_cursor_line_visibility') && g:mayansmoke_cursor_line_visibility >= 1
hi CursorColumn guifg=NONE guibg=white gui=NONE
hi CursorLine guifg=NONE guibg=white gui=NONE
else
hi CursorColumn guifg=NONE guibg=#FFFDD0 gui=NONE
hi CursorLine guifg=NONE guibg=#FFFDD0 gui=NONE
endif
hi CursorIM guifg=bg guibg=fg gui=NONE
hi lCursor guifg=bg guibg=fg gui=NONE
hi DiffAdd guifg=NONE guibg=SeaGreen1 gui=NONE
hi DiffChange guifg=NONE guibg=LightSkyBlue1 gui=NONE
hi DiffDelete guifg=NONE guibg=LightCoral gui=NONE
hi DiffText guifg=black guibg=LightCyan1 gui=NONE
hi Directory guifg=#1600FF guibg=bg gui=NONE
hi ErrorMsg guifg=Red2 guibg=NONE gui=NONE
hi FoldColumn guifg=SteelBlue4 guibg=LightYellow2 gui=bold
hi Folded guifg=SteelBlue4 guibg=Gainsboro gui=italic
if hlexists('MayanSmokeSearch')
hi link IncSearch MayanSmokeSearch
hi link Search MayanSmokeSearch
elseif exists('g:mayansmoke_search_visibility') && g:mayansmoke_search_visibility >= 4
hi IncSearch guifg=white guibg=red gui=NONE
hi Search guifg=white guibg=red gui=NONE
elseif exists('g:mayansmoke_search_visibility') && g:mayansmoke_search_visibility == 3
hi IncSearch guifg=black guibg=gold gui=NONE
hi Search guifg=black guibg=gold gui=NONE
elseif exists('g:mayansmoke_search_visibility') && g:mayansmoke_search_visibility == 2
hi IncSearch guifg=white guibg=darkorange gui=NONE
hi Search guifg=white guibg=darkorange gui=NONE
elseif exists('g:mayansmoke_search_visibility') && g:mayansmoke_search_visibility == 0
hi IncSearch guifg=black guibg=tan gui=NONE
hi Search guifg=black guibg=tan gui=NONE
else
hi IncSearch guifg=black guibg=khaki gui=NONE
hi Search guifg=black guibg=khaki gui=NONE
endif
hi LineNr guifg=#666677 guibg=#cccfbf gui=NONE
hi MatchParen guifg=black guibg=LemonChiffon3 gui=bold
hi ModeMsg guifg=White guibg=tomato1 gui=bold
hi MoreMsg guifg=SeaGreen4 guibg=bg gui=bold
hi NonText guifg=LightCyan3 guibg=bg gui=bold
hi Pmenu guifg=Orange4 guibg=LightYellow3 gui=NONE
hi PmenuSel guifg=ivory2 guibg=NavajoWhite4 gui=bold
hi PmenuSbar guifg=White guibg=#999666 gui=NONE
hi PmenuThumb guifg=White guibg=#7B7939 gui=NONE
hi Question guifg=Chartreuse4 guibg=bg gui=bold
hi SignColumn guifg=white guibg=LightYellow3 gui=NONE
if hlexists('MayanSmokeSpecialKey')
hi link SpecialKey MayanSmokeSpecialKey
elseif exists('g:mayansmoke_special_key_visibility') && g:mayansmoke_special_key_visibility >= 2
hi SpecialKey guifg=black guibg=NavajoWhite gui=NONE
elseif exists('g:mayansmoke_special_key_visibility') && g:mayansmoke_special_key_visibility == 0
hi SpecialKey guifg=bisque3 guibg=NONE gui=NONE
else
hi SpecialKey guifg=white guibg=ivory3 gui=NONE
endif
hi SpellBad guisp=Firebrick2 gui=undercurl
hi SpellCap guisp=Blue gui=undercurl
hi SpellLocal guisp=DarkCyan gui=undercurl
hi SpellRare guisp=Magenta gui=undercurl
hi StatusLine guifg=#FFFEEE guibg=#557788 gui=NONE
" hi StatusLineNC guifg=#EAE6E2 guibg=LightSteelBlue3 gui=italic
hi StatusLineNC guifg=#F4F4EE guibg=#99aabb gui=italic
hi TabLine guifg=fg guibg=LightGrey gui=underline
hi TabLineFill guifg=fg guibg=bg gui=reverse
hi TabLineSel guifg=fg guibg=bg gui=bold
hi Title guifg=DeepSkyBlue3 guibg=bg gui=bold
hi VertSplit guifg=#99aabb guibg=#99aabb
hi Visual guifg=white guibg=DeepSkyBlue1 gui=NONE
hi WarningMsg guifg=Firebrick2 guibg=bg gui=NONE
hi WildMenu guifg=Black guibg=SkyBlue gui=NONE
" }}}
" 256-Color Terminal Colors, by Clayton Parker {{{1
" =============================================================================
hi Normal cterm=NONE ctermfg=16 ctermbg=255
hi Comment ctermfg=110
hi Constant ctermfg=214
hi String ctermfg=30
hi Boolean ctermfg=88
hi Identifier ctermfg=160
hi Function ctermfg=132
hi Statement ctermfg=21
hi Keyword ctermfg=45
hi PreProc ctermfg=27
hi Type ctermfg=147
hi Special ctermfg=64
hi Ignore ctermfg=255
hi Error ctermfg=196 ctermbg=255 term=none
hi Todo ctermfg=136 ctermbg=255 cterm=NONE
hi VimError ctermfg=160 ctermbg=16
hi VimCommentTitle ctermfg=110
hi qfLineNr ctermfg=16 ctermbg=46 cterm=NONE
hi pythonDecorator ctermfg=208 ctermbg=255 cterm=NONE
hi Cursor ctermfg=255 ctermbg=16 cterm=NONE
hi CursorColumn ctermfg=NONE ctermbg=255 cterm=NONE
hi CursorIM ctermfg=255 ctermbg=16 cterm=NONE
hi CursorLine ctermfg=NONE ctermbg=254 cterm=NONE
hi lCursor ctermfg=255 ctermbg=16 cterm=NONE
hi DiffAdd ctermfg=16 ctermbg=48 cterm=NONE
hi DiffChange ctermfg=16 ctermbg=153 cterm=NONE
hi DiffDelete ctermfg=16 ctermbg=203 cterm=NONE
hi DiffText ctermfg=16 ctermbg=226 cterm=NONE
hi Directory ctermfg=21 ctermbg=255 cterm=NONE
hi ErrorMsg ctermfg=160 ctermbg=NONE cterm=NONE
hi FoldColumn ctermfg=24 ctermbg=252 cterm=NONE
hi Folded ctermfg=24 ctermbg=252 cterm=NONE
hi IncSearch ctermfg=255 ctermbg=160 cterm=NONE
hi LineNr ctermfg=253 ctermbg=110 cterm=NONE
hi NonText ctermfg=110 ctermbg=255 cterm=NONE
hi Pmenu ctermfg=fg ctermbg=195 cterm=NONE
hi PmenuSbar ctermfg=255 ctermbg=153 cterm=NONE
hi PmenuSel ctermfg=255 ctermbg=21 cterm=NONE
hi PmenuThumb ctermfg=111 ctermbg=255 cterm=NONE
hi SignColumn ctermfg=110 ctermbg=254 cterm=NONE
hi Search ctermfg=255 ctermbg=160 cterm=NONE
hi SpecialKey ctermfg=255 ctermbg=144 cterm=NONE
hi SpellBad ctermfg=16 ctermbg=229 cterm=NONE
hi SpellCap ctermfg=16 ctermbg=231 cterm=NONE
hi SpellLocal ctermfg=16 ctermbg=231 cterm=NONE
hi SpellRare ctermfg=16 ctermbg=226 cterm=NONE
hi StatusLine ctermfg=255 ctermbg=24 cterm=NONE
hi StatusLineNC ctermfg=253 ctermbg=110 cterm=NONE
hi Title ctermfg=75 ctermbg=255 cterm=NONE
hi VertSplit ctermfg=255 ctermbg=24 cterm=NONE
hi Visual ctermfg=255 ctermbg=153 cterm=NONE
hi WildMenu ctermfg=16 ctermbg=117 cterm=NONE
" 1}}}
" Syntax {{{1
" =============================================================================
" General {{{2
" -----------------------------------------------------------------------------
" Groups ('*' = major; see 'help group-name'):
" *Comment any comment
" *Constant any constant
" String a string constant: "this is a string"
" Character a character constant: 'c', '\n'
" Number a number constant: 234, 0xff
" Boolean a boolean constant: TRUE, false
" Float a floating point constant: 2.3e10
" *Identifier any variable name
" Function function name (also: methods for classes)
" *Statement any statement
" Conditional if, then, else, endif, switch, etc.
" Repeat for, do, while, etc.
" Label case, default, etc.
" Operator "sizeof", "+", "*", etc.
" Keyword any other keyword
" Exception try, catch, throw
" *PreProc generic Preprocessor
" Include preprocessor #include
" Define preprocessor #define
" Macro same as Define
" PreCondit preprocessor #if, #else, #endif, etc.
" *Type int, long, char, etc.
" StorageClass static, register, volatile, etc.
" Structure struct, union, enum, etc.
" Typedef A typedef
" *Special any special symbol
" SpecialChar special character in a constant
" Tag you can use CTRL-] on this
" Delimiter character that needs attention
" SpecialComment special things inside a comment
" Debug debugging statements
" *Error any erroneous construct
" *Todo anything that needs extra attention
" hi Comment guifg=#A2B5CD guibg=NONE gui=italic
hi Comment guifg=#96AAC2 guibg=NONE gui=italic
hi Constant guifg=DarkOrange guibg=NONE gui=NONE
hi String guifg=Aquamarine4 guibg=NONE gui=NONE
hi Boolean guifg=IndianRed4 guibg=NONE gui=NONE
hi Identifier guifg=brown3 guibg=NONE gui=NONE
hi Function guifg=VioletRed4 guibg=NONE gui=NONE
hi Statement guifg=blue1 guibg=NONE gui=NONE
hi Keyword guifg=DodgerBlue guibg=NONE gui=NONE
hi PreProc guifg=blue1 guibg=NONE gui=NONE
hi Type guifg=LightSlateBlue guibg=NONE gui=NONE
hi Special guifg=DarkOliveGreen4 guibg=NONE gui=NONE
hi Ignore guifg=bg guibg=NONE gui=NONE
hi Error guifg=Red guibg=NONE gui=underline
hi Todo guifg=tan4 guibg=NONE gui=underline
" 2}}}
" Vim {{{2
" -----------------------------------------------------------------------------
hi VimError guifg=red guibg=Black gui=bold
hi VimCommentTitle guifg=DarkSlateGray4 guibg=bg gui=bold,italic
" 2}}}
" QuickFix {{{2
" -----------------------------------------------------------------------------
" syn match qfFileName "^[^|]*" nextgroup=qfSeparator
" syn match qfSeparator "|" nextgroup=qfLineNr contained
" syn match qfLineNr "[^|]*" contained contains=qfError
" syn match qfError "error" contained
hi qfFileName guifg=LightSkyBlue4 guibg=NONE gui=italic
hi qfLineNr guifg=coral guibg=NONE gui=bold
hi qfError guifg=red guibg=NONE gui=bold
" 2}}}
" Python {{{2
" -----------------------------------------------------------------------------
hi pythonDecorator guifg=orange3 guibg=NONE gui=bold
hi link pythonDecoratorFunction pythonDecorator
" 2}}}
" Diff {{{2
" -----------------------------------------------------------------------------
hi diffOldFile guifg=#006666 guibg=NONE gui=NONE
hi diffNewFile guifg=#0088FF guibg=NONE gui=bold
hi diffFile guifg=#0000FF guibg=NONE gui=NONE
hi link diffOnly Constant
hi link diffIdentical Constant
hi link diffDiffer Constant
hi link diffBDiffer Constant
hi link diffIsA Constant
hi link diffNoEOL Constant
hi link diffCommon Constant
hi diffRemoved guifg=#BB0000 guibg=NONE gui=NONE
hi diffChanged guifg=DarkSeaGreen guibg=NONE gui=NONE
hi diffAdded guifg=#00AA00 guibg=NONE gui=NONE
hi diffLine guifg=thistle4 guibg=NONE gui=italic
hi link diffSubname diffLine
hi link diffComment Comment
" 2}}}
" PHP (contributed by Ryan Kulla) {{{2
" -----------------------------------------------------------------------------
" Ryan Kulla's addition for PHP syntax highlighting (for regular/terminal vim)
hi phpConditional ctermfg=21 cterm=NONE guifg=black
hi phpIdentifier ctermfg=0 cterm=NONE guifg=black
hi phpOperator ctermfg=black cterm=NONE guifg=black
hi phpRegion ctermfg=132 cterm=NONE guifg=VioletRed4
hi phpComparison ctermfg=black cterm=NONE guifg=black
hi phpType ctermfg=darkgreen cterm=NONE guifg=darkgreen
hi phpParent ctermfg=black cterm=NONE guifg=black
hi phpMethodsVar ctermfg=132 cterm=NONE guifg=VioletRed4
hi phpStatement ctermfg=21 cterm=NONE guifg=blue
hi phpStorageClass ctermfg=21 cterm=NONE guifg=blue
hi phpStringSingle ctermfg=30 cterm=NONE guifg=Aquamarine4
hi phpStringDouble ctermfg=30 cterm=NONE guifg=Aquamarine4
hi phpFunctions ctermfg=21 cterm=NONE guifg=blue
hi phpSpecialFunction ctermfg=21 cterm=NONE guifg=blue
hi phpRepeat ctermfg=21 cterm=NONE guifg=blue
hi phpNumber ctermfg=214 cterm=bold guifg=brown
hi phpTodo ctermfg=red cterm=bold guifg=red gui=bold
hi phpDefine ctermfg=21 cterm=NONE guifg=blue
hi phpConstant ctermfg=21 cterm=NONE guifg=black
hi phpCoreConstant ctermfg=21 cterm=NONE guifg=black
hi phpMemberSelector ctermfg=black cterm=NONE guifg=black
hi phpLabel ctermfg=21 cterm=NONE guifg=blue
hi phpStructure ctermfg=black cterm=NONE guifg=black
hi phpRelation ctermfg=black cterm=NONE guifg=black
hi phpEnvVar ctermfg=black cterm=NONE guifg=black
hi phpIntVar ctermfg=0 cterm=bold guifg=black gui=bold
hi phpBoolean ctermfg=58 cterm=NONE guifg=brown
" 2}}}
" 1}}}

View file

@ -0,0 +1,3 @@
*~
*.swp
tags

View file

@ -0,0 +1,104 @@
The NERD Tree
=============
Intro
-----
The NERD tree allows you to explore your filesystem and to open files and
directories. It presents the filesystem to you in the form of a tree which you
manipulate with the keyboard and/or mouse. It also allows you to perform
simple filesystem operations.
The following features and functionality are provided by the NERD tree:
* Files and directories are displayed in a hierarchical tree structure
* Different highlighting is provided for the following types of nodes:
* files
* directories
* sym-links
* windows .lnk files
* read-only files
* executable files
* Many (customisable) mappings are provided to manipulate the tree:
* Mappings to open/close/explore directory nodes
* Mappings to open files in new/existing windows/tabs
* Mappings to change the current root of the tree
* Mappings to navigate around the tree
* ...
* Directories and files can be bookmarked.
* Most NERD tree navigation can also be done with the mouse
* Filtering of tree content (can be toggled at runtime)
* custom file filters to prevent e.g. vim backup files being displayed
* optional displaying of hidden files (. files)
* files can be "turned off" so that only directories are displayed
* The position and size of the NERD tree window can be customised
* The order in which the nodes in the tree are listed can be customised.
* A model of your filesystem is created/maintained as you explore it. This
has several advantages:
* All filesystem information is cached and is only re-read on demand
* If you revisit a part of the tree that you left earlier in your
session, the directory nodes will be opened/closed as you left them
* The script remembers the cursor position and window position in the NERD
tree so you can toggle it off (or just close the tree window) and then
reopen it (with NERDTreeToggle) the NERD tree window will appear exactly
as you left it
* You can have a separate NERD tree for each tab, share trees across tabs,
or a mix of both.
* By default the script overrides the default file browser (netw), so if
you :edit a directory a (slighly modified) NERD tree will appear in the
current window
* A programmable menu system is provided (simulates right clicking on a node)
* one default menu plugin is provided to perform basic filesytem
operations (create/delete/move/copy files/directories)
* There's an API for adding your own keymappings
Installation
------------
[pathogen.vim](https://github.com/tpope/vim-pathogen) is the recommended way to install nerdtree.
cd ~/.vim/bundle
git clone https://github.com/scrooloose/nerdtree.git
Then reload vim, run `:helptags`, and check out `:help NERD_tree.txt`.
Faq
---
__Q. Can I have the nerdtree on every tab automatically?__
A. Nope. If this is something you want then chances are you aren't using tabs
and buffers as they were intended to be used. Read this
http://stackoverflow.com/questions/102384/using-vims-tabs-like-buffers
If you are interested in this behaviour then consider [vim-nerdtree-tabs](https://github.com/jistr/vim-nerdtree-tabs)
__Q. How can I open a NERDTree automatically when vim starts up?__
A. Stick this in your vimrc: `autocmd vimenter * NERDTree`
__Q. How can I open a NERDTree automatically when vim starts up if no files were specified?__
A. Stick this in your vimrc `autocmd vimenter * if !argc() | NERDTree | endif`
__Q. How can I close vim if the only window left open is a NERDTree?__
A. Stick this in your vimrc:
`autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTreeType") && b:NERDTreeType == "primary") | q | endif`
Changelog
---------
4.2.0 (2011-12-28)
* Add NERDTreeDirArrows option to make the UI use pretty arrow chars instead of the old +~| chars to define the tree structure (sickill)
* shift the syntax highlighting out into its own syntax file (gnap) * add some mac specific options to the filesystem menu - for macvim only (andersonfreitas)
* Add NERDTreeMinimalUI option to remove some non functional parts of the nerdtree ui (camthompson)
* tweak the behaviour of :NERDTreeFind - see :help :NERDTreeFind for the new behaviour (benjamingeiger)
* if no name is given to :Bookmark, make it default to the name of the target file/dir (minyoung)
* use 'file' completion when doing copying, create, and move operations (EvanDotPro)
* lots of misc bug fixes (paddyoloughlin, sdewald, camthompson, Vitaly Bogdanov, AndrewRadev, mathias, scottstvnsn, kml, wycats, me RAWR!)

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,41 @@
" ============================================================================
" File: exec_menuitem.vim
" Description: plugin for NERD Tree that provides an execute file menu item
" Maintainer: Martin Grenfell <martin.grenfell at gmail dot com>
" Last Change: 22 July, 2009
" License: This program is free software. It comes without any warranty,
" to the extent permitted by applicable law. You can redistribute
" it and/or modify it under the terms of the Do What The Fuck You
" Want To Public License, Version 2, as published by Sam Hocevar.
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"
" ============================================================================
if exists("g:loaded_nerdtree_exec_menuitem")
finish
endif
let g:loaded_nerdtree_exec_menuitem = 1
call NERDTreeAddMenuItem({
\ 'text': '(!)Execute file',
\ 'shortcut': '!',
\ 'callback': 'NERDTreeExecFile',
\ 'isActiveCallback': 'NERDTreeExecFileActive' })
function! NERDTreeExecFileActive()
let node = g:NERDTreeFileNode.GetSelected()
return !node.path.isDirectory && node.path.isExecutable
endfunction
function! NERDTreeExecFile()
let treenode = g:NERDTreeFileNode.GetSelected()
echo "==========================================================\n"
echo "Complete the command to execute (add arguments etc):\n"
let cmd = treenode.path.str({'escape': 1})
let cmd = input(':!', cmd . ' ')
if cmd != ''
exec ':!' . cmd
else
echo "Aborted"
endif
endfunction

View file

@ -0,0 +1,224 @@
" ============================================================================
" File: fs_menu.vim
" Description: plugin for the NERD Tree that provides a file system menu
" Maintainer: Martin Grenfell <martin.grenfell at gmail dot com>
" Last Change: 17 July, 2009
" License: This program is free software. It comes without any warranty,
" to the extent permitted by applicable law. You can redistribute
" it and/or modify it under the terms of the Do What The Fuck You
" Want To Public License, Version 2, as published by Sam Hocevar.
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"
" ============================================================================
if exists("g:loaded_nerdtree_fs_menu")
finish
endif
let g:loaded_nerdtree_fs_menu = 1
call NERDTreeAddMenuItem({'text': '(a)dd a childnode', 'shortcut': 'a', 'callback': 'NERDTreeAddNode'})
call NERDTreeAddMenuItem({'text': '(m)ove the current node', 'shortcut': 'm', 'callback': 'NERDTreeMoveNode'})
call NERDTreeAddMenuItem({'text': '(d)elete the current node', 'shortcut': 'd', 'callback': 'NERDTreeDeleteNode'})
if has("gui_mac") || has("gui_macvim")
call NERDTreeAddMenuItem({'text': '(r)eveal in Finder the current node', 'shortcut': 'r', 'callback': 'NERDTreeRevealInFinder'})
call NERDTreeAddMenuItem({'text': '(o)pen the current node with system editor', 'shortcut': 'o', 'callback': 'NERDTreeExecuteFile'})
call NERDTreeAddMenuItem({'text': '(q)uicklook the current node', 'shortcut': 'q', 'callback': 'NERDTreeQuickLook'})
endif
if g:NERDTreePath.CopyingSupported()
call NERDTreeAddMenuItem({'text': '(c)copy the current node', 'shortcut': 'c', 'callback': 'NERDTreeCopyNode'})
endif
"FUNCTION: s:echo(msg){{{1
function! s:echo(msg)
redraw
echomsg "NERDTree: " . a:msg
endfunction
"FUNCTION: s:echoWarning(msg){{{1
function! s:echoWarning(msg)
echohl warningmsg
call s:echo(a:msg)
echohl normal
endfunction
"FUNCTION: s:promptToDelBuffer(bufnum, msg){{{1
"prints out the given msg and, if the user responds by pushing 'y' then the
"buffer with the given bufnum is deleted
"
"Args:
"bufnum: the buffer that may be deleted
"msg: a message that will be echoed to the user asking them if they wish to
" del the buffer
function! s:promptToDelBuffer(bufnum, msg)
echo a:msg
if nr2char(getchar()) ==# 'y'
exec "silent bdelete! " . a:bufnum
endif
endfunction
"FUNCTION: NERDTreeAddNode(){{{1
function! NERDTreeAddNode()
let curDirNode = g:NERDTreeDirNode.GetSelected()
let newNodeName = input("Add a childnode\n".
\ "==========================================================\n".
\ "Enter the dir/file name to be created. Dirs end with a '/'\n" .
\ "", curDirNode.path.str() . g:NERDTreePath.Slash(), "file")
if newNodeName ==# ''
call s:echo("Node Creation Aborted.")
return
endif
try
let newPath = g:NERDTreePath.Create(newNodeName)
let parentNode = b:NERDTreeRoot.findNode(newPath.getParent())
let newTreeNode = g:NERDTreeFileNode.New(newPath)
if parentNode.isOpen || !empty(parentNode.children)
call parentNode.addChild(newTreeNode, 1)
call NERDTreeRender()
call newTreeNode.putCursorHere(1, 0)
endif
catch /^NERDTree/
call s:echoWarning("Node Not Created.")
endtry
endfunction
"FUNCTION: NERDTreeMoveNode(){{{1
function! NERDTreeMoveNode()
let curNode = g:NERDTreeFileNode.GetSelected()
let newNodePath = input("Rename the current node\n" .
\ "==========================================================\n" .
\ "Enter the new path for the node: \n" .
\ "", curNode.path.str(), "file")
if newNodePath ==# ''
call s:echo("Node Renaming Aborted.")
return
endif
try
let bufnum = bufnr(curNode.path.str())
call curNode.rename(newNodePath)
call NERDTreeRender()
"if the node is open in a buffer, ask the user if they want to
"close that buffer
if bufnum != -1
let prompt = "\nNode renamed.\n\nThe old file is open in buffer ". bufnum . (bufwinnr(bufnum) ==# -1 ? " (hidden)" : "") .". Delete this buffer? (yN)"
call s:promptToDelBuffer(bufnum, prompt)
endif
call curNode.putCursorHere(1, 0)
redraw
catch /^NERDTree/
call s:echoWarning("Node Not Renamed.")
endtry
endfunction
" FUNCTION: NERDTreeDeleteNode() {{{1
function! NERDTreeDeleteNode()
let currentNode = g:NERDTreeFileNode.GetSelected()
let confirmed = 0
if currentNode.path.isDirectory
let choice =input("Delete the current node\n" .
\ "==========================================================\n" .
\ "STOP! To delete this entire directory, type 'yes'\n" .
\ "" . currentNode.path.str() . ": ")
let confirmed = choice ==# 'yes'
else
echo "Delete the current node\n" .
\ "==========================================================\n".
\ "Are you sure you wish to delete the node:\n" .
\ "" . currentNode.path.str() . " (yN):"
let choice = nr2char(getchar())
let confirmed = choice ==# 'y'
endif
if confirmed
try
call currentNode.delete()
call NERDTreeRender()
"if the node is open in a buffer, ask the user if they want to
"close that buffer
let bufnum = bufnr(currentNode.path.str())
if buflisted(bufnum)
let prompt = "\nNode deleted.\n\nThe file is open in buffer ". bufnum . (bufwinnr(bufnum) ==# -1 ? " (hidden)" : "") .". Delete this buffer? (yN)"
call s:promptToDelBuffer(bufnum, prompt)
endif
redraw
catch /^NERDTree/
call s:echoWarning("Could not remove node")
endtry
else
call s:echo("delete aborted")
endif
endfunction
" FUNCTION: NERDTreeCopyNode() {{{1
function! NERDTreeCopyNode()
let currentNode = g:NERDTreeFileNode.GetSelected()
let newNodePath = input("Copy the current node\n" .
\ "==========================================================\n" .
\ "Enter the new path to copy the node to: \n" .
\ "", currentNode.path.str(), "file")
if newNodePath != ""
"strip trailing slash
let newNodePath = substitute(newNodePath, '\/$', '', '')
let confirmed = 1
if currentNode.path.copyingWillOverwrite(newNodePath)
call s:echo("Warning: copying may overwrite files! Continue? (yN)")
let choice = nr2char(getchar())
let confirmed = choice ==# 'y'
endif
if confirmed
try
let newNode = currentNode.copy(newNodePath)
if !empty(newNode)
call NERDTreeRender()
call newNode.putCursorHere(0, 0)
endif
catch /^NERDTree/
call s:echoWarning("Could not copy node")
endtry
endif
else
call s:echo("Copy aborted.")
endif
redraw
endfunction
function! NERDTreeQuickLook()
let treenode = g:NERDTreeFileNode.GetSelected()
if treenode != {}
call system("qlmanage -p 2>/dev/null '" . treenode.path.str() . "'")
endif
endfunction
function! NERDTreeRevealInFinder()
let treenode = g:NERDTreeFileNode.GetSelected()
if treenode != {}
let x = system("open -R '" . treenode.path.str() . "'")
endif
endfunction
function! NERDTreeExecuteFile()
let treenode = g:NERDTreeFileNode.GetSelected()
if treenode != {}
let x = system("open '" . treenode.path.str() . "'")
endif
endfunction
" vim: set sw=4 sts=4 et fdm=marker:

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,88 @@
let s:tree_up_dir_line = '.. (up a dir)'
"NERDTreeFlags are syntax items that should be invisible, but give clues as to
"how things should be highlighted
syn match NERDTreeFlag #\~#
syn match NERDTreeFlag #\[RO\]#
"highlighting for the .. (up dir) line at the top of the tree
execute "syn match NERDTreeUp #\\V". s:tree_up_dir_line ."#"
"highlighting for the ~/+ symbols for the directory nodes
syn match NERDTreeClosable #\~\<#
syn match NERDTreeClosable #\~\.#
syn match NERDTreeOpenable #+\<#
syn match NERDTreeOpenable #+\.#he=e-1
"highlighting for the tree structural parts
syn match NERDTreePart #|#
syn match NERDTreePart #`#
syn match NERDTreePartFile #[|`]-#hs=s+1 contains=NERDTreePart
"quickhelp syntax elements
syn match NERDTreeHelpKey #" \{1,2\}[^ ]*:#hs=s+2,he=e-1
syn match NERDTreeHelpKey #" \{1,2\}[^ ]*,#hs=s+2,he=e-1
syn match NERDTreeHelpTitle #" .*\~#hs=s+2,he=e-1 contains=NERDTreeFlag
syn match NERDTreeToggleOn #".*(on)#hs=e-2,he=e-1 contains=NERDTreeHelpKey
syn match NERDTreeToggleOff #".*(off)#hs=e-3,he=e-1 contains=NERDTreeHelpKey
syn match NERDTreeHelpCommand #" :.\{-}\>#hs=s+3
syn match NERDTreeHelp #^".*# contains=NERDTreeHelpKey,NERDTreeHelpTitle,NERDTreeFlag,NERDTreeToggleOff,NERDTreeToggleOn,NERDTreeHelpCommand
"highlighting for readonly files
syn match NERDTreeRO #.*\[RO\]#hs=s+2 contains=NERDTreeFlag,NERDTreeBookmark,NERDTreePart,NERDTreePartFile
"highlighting for sym links
syn match NERDTreeLink #[^-| `].* -> # contains=NERDTreeBookmark,NERDTreeOpenable,NERDTreeClosable,NERDTreeDirSlash
"highlighing for directory nodes and file nodes
syn match NERDTreeDirSlash #/#
syn match NERDTreeDir #[^-| `].*/# contains=NERDTreeLink,NERDTreeDirSlash,NERDTreeOpenable,NERDTreeClosable
syn match NERDTreeExecFile #[|` ].*\*\($\| \)# contains=NERDTreeLink,NERDTreePart,NERDTreeRO,NERDTreePartFile,NERDTreeBookmark
syn match NERDTreeFile #|-.*# contains=NERDTreeLink,NERDTreePart,NERDTreeRO,NERDTreePartFile,NERDTreeBookmark,NERDTreeExecFile
syn match NERDTreeFile #`-.*# contains=NERDTreeLink,NERDTreePart,NERDTreeRO,NERDTreePartFile,NERDTreeBookmark,NERDTreeExecFile
syn match NERDTreeCWD #^[</].*$#
"highlighting for bookmarks
syn match NERDTreeBookmark # {.*}#hs=s+1
"highlighting for the bookmarks table
syn match NERDTreeBookmarksLeader #^>#
syn match NERDTreeBookmarksHeader #^>-\+Bookmarks-\+$# contains=NERDTreeBookmarksLeader
syn match NERDTreeBookmarkName #^>.\{-} #he=e-1 contains=NERDTreeBookmarksLeader
syn match NERDTreeBookmark #^>.*$# contains=NERDTreeBookmarksLeader,NERDTreeBookmarkName,NERDTreeBookmarksHeader
if exists("g:NERDChristmasTree") && g:NERDChristmasTree
hi def link NERDTreePart Special
hi def link NERDTreePartFile Type
hi def link NERDTreeFile Normal
hi def link NERDTreeExecFile Title
hi def link NERDTreeDirSlash Identifier
hi def link NERDTreeClosable Type
else
hi def link NERDTreePart Normal
hi def link NERDTreePartFile Normal
hi def link NERDTreeFile Normal
hi def link NERDTreeClosable Title
endif
hi def link NERDTreeBookmarksHeader statement
hi def link NERDTreeBookmarksLeader ignore
hi def link NERDTreeBookmarkName Identifier
hi def link NERDTreeBookmark normal
hi def link NERDTreeHelp String
hi def link NERDTreeHelpKey Identifier
hi def link NERDTreeHelpCommand Identifier
hi def link NERDTreeHelpTitle Macro
hi def link NERDTreeToggleOn Question
hi def link NERDTreeToggleOff WarningMsg
hi def link NERDTreeDir Directory
hi def link NERDTreeUp Directory
hi def link NERDTreeCWD Statement
hi def link NERDTreeLink Macro
hi def link NERDTreeOpenable Title
hi def link NERDTreeFlag ignore
hi def link NERDTreeRO WarningMsg
hi def link NERDTreeBookmark Statement
hi def link NERDTreeCurrentNode Search

View file

@ -0,0 +1,28 @@
" ----- Emulate 'gf' but recognize :line format -----
function! GotoFile(w)
let curword = expand("<cfile>")
if (strlen(curword) == 0)
return
endif
let matchstart = match(curword, ':\d\+$')
if matchstart > 0
let pos = '+' . strpart(curword, matchstart+1)
let fname = strpart(curword, 0, matchstart)
else
let pos = ""
let fname = curword
endif
" Open new window if requested
if a:w == "new"
new
endif
" Use 'find' so path is searched like 'gf' would
execute 'find ' . pos . ' ' . fname
endfunction
set isfname+=: " include colon in filenames
" Override vim commands 'gf', '^Wf', '^W^F'
nnoremap gf :call GotoFile("")<CR>
nnoremap <C-W>f :call GotoFile("new")<CR>
nnoremap <C-W><C-F> :call GotoFile("new")<CR>

View file

@ -0,0 +1,38 @@
Adam Folmert
Alberto Pose
Angel Alonso
Ben Orenstein
Bill Casarin
Christopher Joslyn
Daniel Hahler
Elliot Murphy
Eustaquio Rangel
Henrik Nyh
Honza Pokorny
Jakub Nawalaniec
James F. Herdman
Jon Bernard
Kozo NISHIDA
Leandro Pincini
Marc Weber
Marcin Kulik
Marjan.Hratson
Micah Elliott
Michael Sanders
Naveed Massjouni
Rob Hudson
Rok Garbas
Sebastian Schulze
Srushti Ambekallu
Stephen Tudor
Steven Oliver
Stuart Colville
Tom Adams
Zied ABID
fo60213
marutanm
msanders
Povilas Balzaravičius Pawka
Dmitry Dementev
Travis Holton
Chrisyue

View file

@ -0,0 +1,20 @@
Copyright (c) 2011 see AUTHORS
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View file

@ -0,0 +1,47 @@
Snipmate Snippets
=================
This repository contains snippets files for various programming languages for
the famous [snipMate][1] plugin for vim. This repository is
community-maintained and many people have contributed snippet files and other
improvements already.
[vim-snipmate][1] was originally started by [Michael Sanders][2] who has now
unfortunately abandoned the project. [Rok Garbas][3] is now maintaining a
[fork][4] of the project in hopes of improving the existing code base.
Language maintainers
--------------------
No one can really be proficient in all programming languages. If you would like
to maintain snippets for a language, please get in touch.
* Python - [honza](http://github.com/honza)
* Javascript - [honza](http://github.com/honza)
* HTML Django - [honza](http://github.com/honza)
* Markdown - [honza](http://github.com/honza)
* Ruby - [taq](http://github.com/taq)
* PHP - [chrisyue](http://github.com/chrisyue)
Contributing notes
------------------
Until further work is done on `vim-snipmate`, please don't add folding markers
into snippets.
Authors
-------
For a list of authors, please see the `AUTHORS` files.
License
-------
Just as the original snipMate plugin, all the snippets are licensed under the
terms of the MIT license.
[1]: http://github.com/garbas/vim-snipmate
[2]: http://github.com/msanders
[3]: http://github.com/garbas
[4]: http://github.com/garbas/vim-snipmate

View file

@ -0,0 +1,10 @@
{
"name" : "snipmate-snippets",
"author" : "community",
"maintainer" : "honza @ github & others",
"repository" : {"type": "git", "url": "git://github.com/honza/snipmate-snippets.git"},
"dependencies" : {
"snipmate": {}
},
"description" : "community driven set of snippets for snipmate"
}

View file

@ -0,0 +1,227 @@
# Global snippets
# (c) holds no legal value ;)
snippet c)
Copyright `&enc[:2] == "utf" ? "©" : "(c)"` `strftime("%Y")` ${1:`g:snips_author`}. All Rights Reserved.${2}
snippet date
`strftime("%Y-%m-%d")`
snippet ddate
`strftime("%B %d, %Y")`
snippet time
`strftime("%H:%M")`
snippet lorem
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
snippet GPL2
${1:One line to give the program's name and a brief description.}
Copyright (C) `strftime("%Y")` ${2:copyright holder}
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software Foundation,
Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
${3}
snippet LGPL2
${1:One line to give the program's name and a brief description.}
Copyright (C) `strftime("%Y")` ${2:copyright holder}
This library is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with this library; if not, write to the Free Software Foundation,
Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
${3}
snippet GPL3
${1:one line to give the program's name and a brief description.}
Copyright (C) `strftime("%Y")` ${2:copyright holder}
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
${3}
snippet LGPL3
${1:One line to give the program's name and a brief description.}
Copyright (C) `strftime("%Y")` ${2:copyright holder}
This library is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with this library; if not, write to the Free Software Foundation,
Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
${3}
snippet BSD2
${1:one line to give the program's name and a brief description}
Copyright (C) `strftime("%Y")` ${2:copyright holder}
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY $2 ''AS IS'' AND ANY
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL $2 BE LIABLE FOR ANY
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
The views and conclusions contained in the software and documentation
are those of the authors and should not be interpreted as representing
official policies, either expressedor implied, of $2.
${4}
snippet BSD3
${1:one line to give the program's name and a brief description}
Copyright (C) `strftime("%Y")` ${2:copyright holder}
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of the ${3:organization} nor the
names of its contributors may be used to endorse or promote products
derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY $2 ''AS IS'' AND ANY
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL $2 BE LIABLE FOR ANY
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
${4}
snippet BSD4
${1:one line to give the program's name and a brief description}
Copyright (C) `strftime("%Y")` ${2:copyright holder}
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. All advertising materials mentioning features or use of this software
must display the following acknowledgement:
This product includes software developed by the ${3:organization}.
4. Neither the name of the $3 nor the
names of its contributors may be used to endorse or promote products
derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY $2 ''AS IS'' AND ANY
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL $2 BE LIABLE FOR ANY
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
${4}
snippet MIT
${1:one line to give the program's name and a brief description}
Copyright (C) `strftime("%Y")` ${2:copyright holder}
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
${3}
snippet APACHE
${1:one line to give the program's name and a brief description}
Copyright `strftime("%Y")` ${2:copyright holder}
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
${3}
snippet BEERWARE
${1:one line to give the program's name and a brief description}
Copyright `strftime("%Y")` ${2:copyright holder}
Licensed under the "THE BEER-WARE LICENSE" (Revision 42):
${1:`g:snips_author`} wrote this file. As long as you retain this notice you
can do whatever you want with this stuff. If we meet some day, and you think
this stuff is worth it, you can buy me a beer or coffee in return
${3}

View file

@ -0,0 +1,157 @@
snippet main
package {
import flash.display.*;
import flash.Events.*;
public class Main extends Sprite {
public function Main ( ) {
trace("start");
stage.scaleMode = StageScaleMode.NO_SCALE;
stage.addEventListener(Event.RESIZE, resizeListener);
}
private function resizeListener (e:Event):void {
trace("The application window changed size!");
trace("New width: " + stage.stageWidth);
trace("New height: " + stage.stageHeight);
}
}
}
snippet class
${1:public|internal} class ${2:name} ${3:extends } {
public function $2 ( ) {
("start");
}
}
snippet all
package name {
${1:public|internal|final} class ${2:name} ${3:extends } {
private|public| static const FOO = "abc";
private|public| static var BAR = "abc";
// class initializer - no JIT !! one time setup
if Cababilities.os == "Linux|MacOS" {
FOO = "other";
}
// constructor:
public function $2 ( ){
super2();
trace("start");
}
public function name (a, b...){
super.name(..);
lable:break
}
}
}
function A(){
// A can only be accessed within this file
}
snippet switch
switch(${1}){
case ${2}:
${3}
break;
default:
}
snippet case
case ${1}:
${2}
break;
snippet package
package ${1:package}{
${2}
}
snippet wh
while ${1:cond}{
${2}
}
snippet do
do {
${2}
} while (${1:cond})
snippet while
while ${1:cond}{
${2}
}
snippet for enumerate names
for (${1:var} in ${2:object}){
${3}
}
snippet for enumerate values
for each (${1:var} in ${2:object}){
${3}
}
snippet get_set
function get ${1:name} {
return ${2}
}
function set $1 (newValue) {
${3}
}
snippet interface
interface name {
function method(${1}):${2:returntype};
}
snippet try
try {
${1}
} catch (error:ErrorType) {
${2}
} finally {
${3}
}
# For Loop (same as c.snippet)
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 */}
}
# If Condition
snippet if
if (${1:/* condition */}) {
${2:/* code */}
}
snippet el
else {
${1}
}
# Ternary conditional
snippet t
${1:/* condition */} ? ${2:a} : ${3:b}
snippet fun
function ${1:function_name}(${2})${3}
{
${4:/* code */}
}
# FlxSprite (usefull when using the flixel library)
snippet FlxSprite
package
{
import org.flixel.*
public class ${1:ClassName} extends ${2:FlxSprite}
{
public function $1(${3: X:Number, Y:Number}):void
{
super(X,Y);
${4: //code...}
}
override public function update():void
{
super.update();
${5: //code...}
}
}
}

View file

@ -0,0 +1,35 @@
# Snippets for code blocks used oftenly in Apache files.
# <Directory>
snippet dir
<Directory ${1:/}>
DirectoryIndex ${2:index.html}
Order Deny,Allow
Deny from All
</Directory>
# <FilesMatch>
snippet filesmatch
<FilesMatch "${1:regex}">
${2}
</FilesMatch>
# <IfModule>
snippet ifmodule
<IfModule ${1:mod_example.c}>
${2}
</IfModule>
# <LimitExcept>
snippet limitexcept
<LimitExcept ${1:POST GET}>
${2}
</LimitExcept>
# <Proxy>
snippet proxy
<Proxy ${1:*}>
${2}
</Proxy>
# <VirtualHost>
snippet virtualhost
<VirtualHost ${1:*}:${2:80}>
ServerAdmin ${3:webmaster@example.com}
DocumentRoot ${4:/www/example.com}
ServerName ${5:www.example.com}
</VirtualHost>

View file

@ -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)

View file

@ -0,0 +1,134 @@
# main()
snippet main
int main(int argc, const char *argv[])
{
${1}
return 0;
}
snippet mainn
int main(void)
{
${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
snippet once
#ifndef ${1:`toupper(Filename('$1_H', 'UNTITLED_H'))`}
#define $1
${2}
#endif /* end of include guard: $1 */
# If Condition
snippet if
if (${1:/* condition */}) {
${2:/* code */}
}
snippet el
else {
${1}
}
# Ternary 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}
# This is kind of convenient
snippet .
[${1}]${2}
# GPL
snippet gpl
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* Copyright (C) ${1:Author}, `strftime("%Y")`
*/
${2}

View file

@ -0,0 +1,204 @@
# Opscode Chef Cookbook Recipe Resources
# Snippet by: Mike Smullin <mike@smullindesign.com>
# Based on: http://wiki.opscode.com/display/chef/Resources
# @TODO: Include Meta attributes and actions in all snippets
# @TODO: Finish writing snippets for remaining Resources
snippet cookbook_file
# Cookbook File resource
cookbook_file ${1:"/path/to/file"} do # The remote path where the file will reside
${2:#}backup ${3} # How many backups of this file to keep. Set to false if you want no backups
${4:#}group ${5} # The group owner of the file (string or id)
${6:#}mode ${7} # The octal mode of the file - e.g. 0755
${8:#}owner ${9} # The owner for the file
${10:#}source ${11} # The basename of the source file
${12:#}cookbook ${13} # The cookbook this file is stored in
${14:#}${15: action :create} # Create this file (Default)
${16:#}${17: action :create_if_missing} # Create only if it doesn't exist yet
${18:#}${19: action :delete} # Delete this file
end
snippet execute
# Execute resource
execute ${1:"command to execute"} do # The command to execute
${2:#}creates ${3:nil} # A file this command creates - if the file exists, the command will not be run.
${4:#}cwd ${5:nil} # Current working directory to run the command from.
${6:#}environment ${7:nil} # A hash of environment variables to set before running this command.
${8:#}group ${9:nil} # A group name or group ID that we should change to before running this command.
${10:#}path ${11:nil} # An array of paths to use when searching for the command. Nil uses system path.
${12:#}returns ${13:0} # The return value of the command - this resource raises an exception if the return value does not match.
${14:#}timeout ${15:nil} # How many seconds to let the command run before timing it out.
${16:#}user ${17:nil} # A user name or user ID that we should change to before running this command.
${18:#}umask ${19:nil} # Umask for files created by the command
${20:#}${21:action :run} # Run this command (Default)
${22:#}${23:action :nothing} # Do not run this command
end
snippet link
# Link resource
link ${1:"/target/file"} do # The file name of the link
${2:#}to ${3} # The real file you want to link to
${4:#}link_type ${5:symbolic} # Either :symbolic or :hard
${6:#}owner ${7} # The owner of the symlink
${8:#}group ${9} # The group of the symlink
${10:#}${11:action :create} # Create a link (Default)
${12:#}${13:action :delete} # Delete a link
end
snippet package
# Package resource
package ${1:"package_name"} do # Name of the package to install
${2:#}version ${3:nil} # The version of the package to install/upgrade
${4:#}response_file ${5:nil} # An optional response file - used to pre-seed packages (note: the file is fetched by Remote File)
${6:#}source ${7} # Used to provide an optional package source for providers that use a local file (rubygems, dpkg and rpm)
${8:#}options ${9:nil} # Add additional options to the underlying package command
${10:#}gem_binary ${11:gem} # A gem_package attribut to specify a gem binary. Useful for installing ruby 1.9 gems while running chef in ruby 1.8
${12:#}${13:action :install} # Install a package - if version is provided, install that specific version (Default)
${14:#}${15:action :upgrade} # Upgrade a package - if version is provided, upgrade to that specific version
${16:#}${17:action :remove} # Remove a package
${18:#}${19:action :purge} # Purge a package (this usually entails removing configuration files as well as the package itself)
end
snippet service
# Service resource
service ${1:"service_name"} do # Name of the service
${2:#}enabled ${3:nil} # Whether the service is enabled at boot time
${4:#}running ${5:nil} # Make sure the service is running. Start if stopped
${6:#}pattern ${7} # Pattern to look for in the process table
${8:#}start_command ${9:nil} # Command used to start this service
${10:#}stop_command ${11:nil} # Command used to stop this service
${12:#}status_command ${13:nil} # Command used to check the service run status
${14:#}restart_command ${15:nil} # Command used to restart this service
${16:#}reload_command ${17:nil} # Command used to tell this service to reload its configuration
${18:#}supports ${19:false} # Features this service supports, ie :restart, :reload, :status
${20:#}${21:action :enable} # Enable this service
${22:#}${23:action :disable} # Disable this service
${24:#}${25:action :nothing} # Don't do anything with this service (Default)
${26:#}${27:action :start} # Start this service
${28:#}${29:action :stop} # Stop this service
${30:#}${31:action :restart} # Restart this service
${32:#}${33:action :reload} # Reload the configuration for this service
end
snippet file
# File resource
file ${1:"/path/to/file"} do # Path to the file
${2:#}backup ${3:5} # How many backups of this file to keep. Set to false if you want no backups.
${4:#}owner ${5} # The owner for the file
${6:#}group ${7} # The group owner of the file (string or id)
${8:#}mode ${9} # The octal mode of the file (4-digit format)
${10:#}content ${11:nil} # A string to write to the file. This will replace any previous content if set
${12:#}${13:action :create} # Create this file (Default)
${14:#}${15:action :delete} # Delete this file
${16:#}${17:action :touch} # Touch this file (update the mtime/atime)
end
snippet directory
# Directory resource
directory ${1:"/path/to/dir"} do # The path to the directory
${2:#}group ${3} # The group owner of the directory (string or id)
${4:#}mode ${5} # The octal mode of the directory, eg 0755
${6:#}owner ${7} # The owner for the directory
${10:#}recursive ${11:false} # When deleting the directory, delete it recursively. When creating the directory, create recursively (ie, mkdir -p)
${12:#}${13:action :create} # Create this directory (Default)
${14:#}${15:action :delete} # Delete this directory
end
snippet template
# Template resource
template ${1:"/path/to/file"} do # Path to the file
${2:#}cookbook ${3:nil} # Specify the cookbook where the template is located, default is current cookbook
${4:#}source ${5:nil} # Template source file. Found in templates/default for the cookbook
${6:#}variables ${7} # Variables to use in the template
${8:#}local ${9:false} # Is the template already present on the node?
${10:#}backup ${11:5} # How many backups of this file to keep. Set to false if you want no backups.
${12:#}owner ${13} # The owner for the file
${14:#}group ${15} # The group owner of the file (string or id)
${16:#}mode ${17} # The octal mode of the file (4-digit format)
${18:#}content ${19:nil} # A string to write to the file. This will replace any previous content if set
${20:#}${21:action :create} # Create the file (Default)
${22:#}${23:action :delete} # Delete this file
${24:#}${25:action :touch} # Touch this file (update the mtime/atime)
end
snippet svn
# SCM Resource, Chef::Provider::Subversion
svn ${1:"/destination/path"} do # Path to clone/checkout/export the source to
${2:#}repository ${3} # URI of the repository
${4:#}revision ${5:"HEAD"} # revision to checkout. can be symbolic, like "HEAD" or an SCM specific revision id
${6:#}reference ${7} # (Git only) alias for revision
${8:#}user ${9:nil} # System user to own the checked out code
${10:#}group ${11:nil} # System group to own the checked out code
${12:#}svn_username ${13} # (Subversion only) Username for Subversion operations
${14:#}svn_password ${15} # (Subversion only) Password for Subversion operations
${16:#}svn_arguments ${17} # (Subversion only) Extra arguments passed to the subversion command
${18:#}${19:action :sync} # Update the source to the specified revision, or get a new checkout (Default)
${20:#}${21:action :checkout} # Checkout the source. Does nothing if a checkout is available
${22:#}${23:action :export} # Export the source, excluding or removing any version control artifacts
end
snippet git
# SCM Resource, Chef::Provider::Git
git ${1:"/destination/path"} do # Path to clone/checkout/export the source to
${2:#}repository ${3} # URI of the repository
${4:#}revision ${5:"HEAD"} # revision to checkout. can be symbolic, like "HEAD" or an SCM specific revision id
${6:#}reference ${7} # (Git only) alias for revision
${8:#}user ${9:nil} # System user to own the checked out code
${10:#}group ${11:nil} # System group to own the checked out code
${12:#}depth ${13:nil} # (Git only) Number of past revisions to include in Git shallow clone
${14:#}enable_submodules ${15:"false"} # (Git only) performs a submodule init and submodule update
${16:#}remote ${17:"origin"} # (Git only) remote repository to use for syncing an existing clone
${18:#}ssh_wrapper ${19} # (Git only) path to a wrapper script for running SSH with git. GIT_SSH environment variable is set to this.
${20:#}${21:action :sync} # Update the source to the specified revision, or get a new clone (Default)
${22:#}${23:action :checkout} # Clone the source. Does nothing if a checkout is available
${24:#}${25:action :export} # Export the source, excluding or removing any version control artifacts
end
snippet deploy
# Deploy resource
deploy ${1:"/deploy/dir/"} do # Path to deploy to
${2:#}deploy_to ${3} # The "meta root" for your application.
${4:#}repository ${5} # URI of the repository
${6:#}repo ${7} # alias for repository
${8:#}revision ${9:"HEAD"} # revision to checkout. can be symbolic, like "HEAD" or an SCM specific revision id
${10:#}branch ${11} # alias for revision
${12:#}user ${13:nil} # System user to run the deploy as
${14:#}group ${15:nil} # System group to run the deploy as
${16:#}svn_username ${17} # (Subversion only) Username for Subversion operations}
${18:#}svn_password ${19} # (Subversion only) Password for Subversion operations}
${20:#}svn_arguments ${21} # (Subversion only) Extra arguments passed to the subversion command}
${22:#}shallow_clone ${23:nil} # (Git only) boolean, true sets clone depth to 5
${24:#}enable_submodules ${25:false} # (Git only) performs a submodule init and submodule update
${26:#}remote ${27:"origin"} # (Git only) remote repository to use for syncing an existing clone
${28:#}ssh_wrapper ${29} # (Git only) path to a wrapper script for running SSH with git. GIT_SSH environment variable is set to this.
${30:#}git_ssh_wrapper ${31} # alias for ssh_wrapper
${32:#}scm_provider ${33:Chef::Provider::Git} # SCM Provider to use.
${34:#}repository_cache ${35: "cached-copy"} # Name of the subdirectory where the pristine copy of your app's source is kept
${36:#}environment ${37} # A hash of the form {"ENV_VARIABLE"=>"VALUE"}}
${38:#}purge_before_symlink ${39:%w(log tmp/pids public/system)} # An array of paths, relative to app root, to be removed from a checkout before symlinking
${40:#}create_dirs_before_symlink ${41:%w(tmp public config)} # Directories to create before symlinking. Runs after purge_before_symlink
${42:#}symlinks ${43:"system" => "public/system", "pids" => "tmp/pids", "log" => "log"} # A hash that maps files in the shared directory to their paths in the current release
${44:#}symlink_before_migrate ${45:"config/database.yml" => "config/database.yml"} # A hash that maps files in the shared directory into the current release. Runs before migration
${46:#}migrate ${47:false} # Should the migration command be executed? (true or false)
${48:#}migration_command ${49} # A string containing a shell command to execute to run the migration
${50:#}restart_command ${51:nil} # A code block to evaluate or a string containing a shell command
${52:#}before_migrate ${53:"deploy/before_migrate.rb"} # A block or path to a file containing chef code to run before migrating
${54:#}before_symlink ${55:"deploy/before_symlink.rb"} # A block or path to a file containing chef code to run before symlinking
${56:#}before_restart ${57:"deploy/before_restart.rb"} # A block or path to a file containing chef code to run before restarting
${58:#}after_restart ${59:"deploy/after_restart.rb"} # A block or path to a file containing chef code to run after restarting
${60:#}${61::deploy} # Deploy the application (Default)
${62:#}${63::force_deploy} # For the revision deploy strategy, this removes any existing release of the same code version and re-deploys in its place
${64:#}${65::rollback} # Rollback the application to the previous release
end

View file

@ -0,0 +1,90 @@
snippet comm
(comment
${1}
)
snippet condp
(condp ${1:pred} ${2:expr}
${3})
snippet def
(def ${1})
snippet defm
(defmethod ${1:multifn} "${2:doc-string}" ${3:dispatch-val} [${4:args}]
${5})
snippet defmm
(defmulti ${1:name} "${2:doc-string}" ${3:dispatch-fn})
snippet defma
(defmacro ${1:name} "${2:doc-string}" ${3:dispatch-fn})
snippet defn
(defn ${1:name} "${2:doc-string}" [${3:arg-list}]
${4})
snippet defp
(defprotocol ${1:name}
${2})
snippet defr
(defrecord ${1:name} [${2:fields}]
${3:protocol}
${4})
snippet deft
(deftest ${1:name}
(is (= ${2:assertion})))
${3})
snippet is
(is (= ${1} ${2}))
snippet defty
(deftype ${1:Name} [${2:fields}]
${3:Protocol}
${4})
snippet doseq
(doseq [${1:elem} ${2:coll}]
${3})
snippet fn
(fn [${1:arg-list}] ${2})
snippet if
(if ${1:test-expr}
${2:then-expr}
${3:else-expr})
snippet if-let
(if-let [${1:result} ${2:test-expr}]
(${3:then-expr} $1)
(${4:else-expr}))
snippet imp
(:import [${1:package}])
& {:keys [${1:keys}] :or {${2:defaults}}}
snippet let
(let [${1:name} ${2:expr}]
${3})
snippet letfn
(letfn [(${1:name) [${2:args}]
${3})])
snippet map
(map ${1:func} ${2:coll})
snippet mapl
(map #(${1:lambda}) ${2:coll})
snippet met
(${1:name} [${2:this} ${3:args}]
${4})
snippet ns
(ns ${1:name}
${2})
snippet dotimes
(dotimes [_ 10]
(time
(dotimes [_ ${1:times}]
${2})))
snippet pmethod
(${1:name} [${2:this} ${3:args}])
snippet refer
(:refer-clojure :exclude [${1}])
snippet require
(:require [${1:namespace} :as [${2}]])
snippet use
(:use [${1:namespace} :only [${2}]])
snippet print
(println ${1})
snippet reduce
(reduce ${1:(fn [p n] ${3})} ${2})
snippet when
(when ${1:test} ${2:body})
snippet when-let
(when-let [${1:result} ${2:test}]
${3:body})

View file

@ -0,0 +1,58 @@
snippet cmake
CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
PROJECT(${1:ProjectName})
FIND_PACKAGE(${2:LIBRARY})
INCLUDE_DIRECTORIES(
${$2_INCLUDE_DIR}
)
ADD_SUBDIRECTORY(${3:src})
ADD_EXECUTABLE($1)
TARGET_LINK_LIBRARIES($1
${$2_LIBRARIES}
)
snippet include
INCLUDE_DIRECTORIES(
${${1:INCLUDE_DIR}}
)
snippet find
FIND_PACKAGE(${1:LIBRARY})
snippet glob
FILE(GLOB ${1:SRCS} *.${2:cpp})
snippet subdir
ADD_SUBDIRECTORY(${1:src})
snippet lib
ADD_LIBRARY(${1:lib} ${2:STATIC}
${${3:SRCS}}
)
snippet link
TARGET_LINK_LIBRARIES(${1:bin}
${2:somelib}
)
snippet bin
ADD_EXECUTABLE(${1:bin})
snippet set
SET(${1:var} ${2:val})
snippet dep
ADD_DEPENDENCIES(${1:target}
${2:dep}
)
snippet props
SET_TARGET_PROPERTIES(${1:target}
${2:PROPERTIES} ${3:COMPILE_FLAGS}
${4:"-O3 -Wall -pedantic"}
)

View file

@ -0,0 +1,87 @@
# Array comprehension
snippet fora
for ${1:name} in ${2:array}
${3:// body...}
# Object comprehension
snippet foro
for ${1:key}, ${2:value} of ${3:object}
${4:// body...}
# Range comprehension (inclusive)
snippet forr
for ${1:name} in [${2:start}..${3:finish}]
${4:// body...}
snippet forrb
for ${1:name} in [${2:start}..${3:finish}] by ${4:step}
${5:// body...}
# Range comprehension (exclusive)
snippet forrex
for ${1:name} in [${2:start}...${3:finish}]
${4:// body...}
snippet forrexb
for ${1:name} in [${2:start}...${3:finish}] by ${4:step}
${5:// body...}
# Function
snippet fun
(${1:args}) ->
${2:// body...}
# Function (bound)
snippet bfun
(${1:args}) =>
${2:// body...}
# Class
snippet cla class ..
class ${1:`substitute(Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`}
${2}
snippet cla class .. constructor: ..
class ${1:`substitute(Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`}
constructor: (${2:args}) ->
${3}
${4}
snippet cla class .. extends ..
class ${1:`substitute(Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`} extends ${2:ParentClass}
${3}
snippet cla class .. extends .. constructor: ..
class ${1:`substitute(Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`} extends ${2:ParentClass}
constructor: (${3:args}) ->
${4}
${5}
# If
snippet if
if ${1:condition}
${2:// body...}
# If __ Else
snippet ife
if ${1:condition}
${2:// body...}
else
${3:// body...}
# Else if
snippet elif
else if ${1:condition}
${2:// body...}
# Ternary If
snippet ifte
if ${1:condition} then ${2:value} else ${3:other}
# Unless
snippet unl
${1:action} unless ${2:condition}
# Switch
snippet swi
switch ${1:object}
when ${2:value}
${3:// body...}
# Log
snippet log
console.log ${1}
# Try __ Catch
snippet try
try
${1}
catch ${2:error}
${3}
# Require
snippet req
${2:$1} = require '${1:sys}'${3}

View file

@ -0,0 +1,66 @@
# Read File Into Vector
snippet readfile
std::vector<char> 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}> ${3};
# std::vector
snippet vector
std::vector<${1:char}> ${2};
# Namespace
snippet ns
namespace ${1:`Filename('', 'my')`} {
${2}
} /* namespace $1 */
# Class
snippet class
class ${1:`Filename('$1', 'name')`}
{
public:
$1(${2});
~$1();
private:
${3:/* data */}
};
snippet fori
for (int ${2:i} = 0; $2 < ${1:count}; $2${3:++}) {
${4:/* code */}
}
# auto iterator
snippet itera
for (auto ${1:i} = $1.begin(); $1 != $1.end(); ++$1) {
${2:std::cout << *$1 << std::endl;}
}
# iterator
snippet iter
for (${1:std::vector}<${2:type}>::${3:const_iterator} ${4:i} = ${5:container}.begin(); $4 != $5.end(); ++$4) {
${6}
}
# member function implementations
snippet mfun
${4:void} ${1:`Filename('$1', 'ClassName')`}::${2:memberFunction}(${3}) {
${5:return};
}
snippet scout
std::cout << ${1} << std::endl;
snippet cout
cout << ${1} << endl;
snippet scin
std::cin >> ${1};
snippet cin
cin >> ${1};

View file

@ -0,0 +1,374 @@
# cs.snippets
# ===========
#
# Standard C-Sharp snippets for snipmate.
#
# Largely ported over from Visual Studio 2010 snippets plus
# a few snippets from Resharper plus a few widely known snippets.
#
# Most snippets on elements (i.e. classes, properties)
# follow suffix conventions. The order of suffixes to a snippet
# is fixed.
#
# Snippet Suffix Order
# --------------------
# 1. Access Modifiers
# 2. Class Modifiers
#
# Access Modifier Suffix Table
# ----------------------------
# + = public
# & = internal
# | = protected
# - = private
#
# Example: `cls&` expands to `internal class $1`.
# Access modifiers might be doubled to indicate
# different modifiers for get/set on properties.
# Example: `pb+-` expands to `public bool $1 { get; private set; }`
#
# Class Modifier Table
# --------------------
# ^ = static
# % = abstract
#
# Example: `cls|%` expands to `protected abstract class $1`
#
# On method and property snippets, you can directly set
# one of the common types int, string and bool, if desired,
# just by appending the type modifier.
#
# Type Modifier Table
# -------------------
# i = integer
# s = string
# b = bool
#
# Example: `pi+&` expands to `public int $1 { get; internal set; }`
#
# I'll most propably add more stuff in here like
# * List/Array constructio
# * Mostly used generics
# * Linq
# * Funcs, Actions, Predicates
# * Lambda
# * Events
#
# Feedback is welcome!
#
# entry point
snippet sim
public static int Main(string[] args) {
${1}
return 0;
}
snippet simc
public class Application {
public static int Main(string[] args) {
${1}
return 0;
}
}
# if condition
snippet if
if (${1}) {
${2}
}
snippet el
else {
${1}
}
snippet ifs
if (${1})
${2}
# ternary conditional
snippet t
${1} ? ${2} : ${3}
snippet ?
${1} ? ${2} : ${3}
# do while loop
snippet do
do {
${2}
} while (${1});
# while loop
snippet wh
while (${1}) {
${2}
}
# for loop
snippet for
for (int ${1:i} = 0; $1 < ${2:count}; $1${3:++}) {
${4}
}
# foreach
snippet fore
foreach (var ${1:entry} in ${2}) {
${3}
}
snippet foreach
foreach (var ${1:entry} in ${2}) {
${3}
}
snippet each
foreach (var ${1:entry} in ${2}) {
${3}
}
# interfaces
snippet interface
public interface ${1:`Filename()`} {
${2}
}
snippet if+
public interface ${1:`Filename()`} {
${2}
}
# class bodies
snippet class
public class ${1:`Filename()`} {
${2}
}
snippet cls
${2:public} class ${1:`Filename()`} {
${3}
}
snippet cls+
public class ${1:`Filename()`} {
${2}
}
snippet cls+^
public static class ${1:`Filename()`} {
${2}
}
snippet cls&
internal class ${1:`Filename()`} {
${2}
}
snippet cls&^
internal static class ${1:`Filename()`} {
${2}
}
snippet cls|
protected class ${1:`Filename()`} {
${2}
}
snippet cls|%
protected abstract class ${1:`Filename()`} {
${2}
}
# constructor
snippet ctor
public ${1:`Filename()`}() {
${2}
}
# properties - auto properties by default.
# default type is int with layout get / set.
snippet prop
${1:public} ${2:int} ${3:} { get; set; }${4}
snippet p
${1:public} ${2:int} ${3:} { get; set; }${4}
snippet p+
public ${1:int} ${2:} { get; set; }${3}
snippet p+&
public ${1:int} ${2:} { get; internal set; }${3}
snippet p+|
public ${1:int} ${2:} { get; protected set; }${3}
snippet p+-
public ${1:int} ${2:} { get; private set; }${3}
snippet p&
internal ${1:int} ${2:} { get; set; }${3}
snippet p&|
internal ${1:int} ${2:} { get; protected set; }${3}
snippet p&-
internal ${1:int} ${2:} { get; private set; }${3}
snippet p|
protected ${1:int} ${2:} { get; set; }${3}
snippet p|-
protected ${1:int} ${2:} { get; private set; }${3}
snippet p-
private ${1:int} ${2:} { get; set; }${3}
# property - bool
snippet pi
${1:public} int ${2:} { get; set; }${3}
snippet pi+
public int ${1} { get; set; }${2}
snippet pi+&
public int ${1} { get; internal set; }${2}
snippet pi+|
public int ${1} { get; protected set; }${2}
snippet pi+-
public int ${1} { get; private set; }${2}
snippet pi&
internal int ${1} { get; set; }${2}
snippet pi&|
internal int ${1} { get; protected set; }${2}
snippet pi&-
internal int ${1} { get; private set; }${2}
snippet pi|
protected int ${1} { get; set; }${2}
snippet pi|-
protected int ${1} { get; private set; }${2}
snippet pi-
private int ${1} { get; set; }${2}
# property - bool
snippet pb
${1:public} bool ${2:} { get; set; }${3}
snippet pb+
public bool ${1} { get; set; }${2}
snippet pb+&
public bool ${1} { get; internal set; }${2}
snippet pb+|
public bool ${1} { get; protected set; }${2}
snippet pb+-
public bool ${1} { get; private set; }${2}
snippet pb&
internal bool ${1} { get; set; }${2}
snippet pb&|
internal bool ${1} { get; protected set; }${2}
snippet pb&-
internal bool ${1} { get; private set; }${2}
snippet pb|
protected bool ${1} { get; set; }${2}
snippet pb|-
protected bool ${1} { get; private set; }${2}
snippet pb-
private bool ${1} { get; set; }${2}
# property - string
snippet ps
${1:public} string ${2:} { get; set; }${3}
snippet ps+
public string ${1} { get; set; }${2}
snippet ps+&
public string ${1} { get; internal set; }${2}
snippet ps+|
public string ${1} { get; protected set; }${2}
snippet ps+-
public string ${1} { get; private set; }${2}
snippet ps&
internal string ${1} { get; set; }${2}
snippet ps&|
internal string ${1} { get; protected set; }${2}
snippet ps&-
internal string ${1} { get; private set; }${2}
snippet ps|
protected string ${1} { get; set; }${2}
snippet ps|-
protected string ${1} { get; private set; }${2}
snippet ps-
private string ${1} { get; set; }${2}
# members - void
snippet m
${1:public} ${2:void} ${3:}(${4:}) {
${5:}
}
snippet m+
public ${1:void} ${2:}(${3:}) {
${4:}
}
snippet m&
internal ${1:void} ${2:}(${3:}) {
${4:}
}
snippet m|
protected ${1:void} ${2:}(${3:}) {
${4:}
}
snippet m-
private ${1:void} ${2:}(${3:}) {
${4:}
}
# members - int
snippet mi
${1:public} int ${2:}(${3:}) {
${4:return 0;}
}
snippet mi+
public int ${1:}(${2:}) {
${3:return 0;}
}
snippet mi&
internal int ${1:}(${2:}) {
${3:return 0;}
}
snippet mi|
protected int ${1:}(${2:}) {
${3:return 0;}
}
snippet mi-
private int ${1:}(${2:}) {
${3:return 0;}
}
# members - bool
snippet mb
${1:public} bool ${2:}(${3:}) {
${4:return false;}
}
snippet mb+
public bool ${1:}(${2:}) {
${3:return false;}
}
snippet mb&
internal bool ${1:}(${2:}) {
${3:return false;}
}
snippet mb|
protected bool ${1:}(${2:}) {
${3:return false;}
}
snippet mb-
private bool ${1:}(${2:}) {
${3:return false;}
}
# members - string
snippet ms
${1:public} string ${2:}(${3:}) {
${4:return "";}
}
snippet ms+
public string ${1:}(${2:}) {
${3:return "";}
}
snippet ms&
internal string ${1:}(${2:}) {
${3:return "";}
}
snippet ms|
protected string ${1:}(${2:}) {
${3:return "";}
}
snippet ms-
private string ${1:}(${2:}) {
${3:return "";}
}
# structure
snippet struct
public struct ${1:`Filename()`} {
${2}
}
# enumeration
snippet enum
public enum ${1} {
${2}
}
# preprocessor directives
snippet #if
#if
${1}
#endif
# inline xml documentation
snippet ///
/// <summary>
/// ${1}
/// </summary>
snippet <p
<param name="${1}">${2:$1}</param>${3}
snippet <ex
<exception cref="${1:System.Exception}">${2}</exception>${3}
snippet <r
<returns>${1}</returns>{${2}
snippet <s
<see cref="${1}"/>${2}
snippet <rem
<remarks>${1}</remarks>${2}
snippet <c
<code>${1}</code>${2}

View file

@ -0,0 +1,967 @@
snippet .
${1} {
${2}
}
snippet !
!important
snippet bdi:m+
-moz-border-image: url(${1}) ${2:0} ${3:0} ${4:0} ${5:0} ${6:stretch} ${7:stretch};
snippet bdi:m
-moz-border-image: ${1};
snippet bdrz:m
-moz-border-radius: ${1};
snippet bxsh:m+
-moz-box-shadow: ${1:0} ${2:0} ${3:0} #${4:000};
snippet bxsh:m
-moz-box-shadow: ${1};
snippet bdi:w+
-webkit-border-image: url(${1}) ${2:0} ${3:0} ${4:0} ${5:0} ${6:stretch} ${7:stretch};
snippet bdi:w
-webkit-border-image: ${1};
snippet bdrz:w
-webkit-border-radius: ${1};
snippet bxsh:w+
-webkit-box-shadow: ${1:0} ${2:0} ${3:0} #${4:000};
snippet bxsh:w
-webkit-box-shadow: ${1};
snippet @f
@font-face {
font-family: ${1};
src: url(${2});
}
snippet @i
@import url(${1});
snippet @m
@media ${1:print} {
${2}
}
snippet bg+
background: #${1:FFF} url(${2}) ${3:0} ${4:0} ${5:no-repeat};
snippet bga
background-attachment: ${1};
snippet bga:f
background-attachment: fixed;
snippet bga:s
background-attachment: scroll;
snippet bgbk
background-break: ${1};
snippet bgbk:bb
background-break: bounding-box;
snippet bgbk:c
background-break: continuous;
snippet bgbk:eb
background-break: each-box;
snippet bgcp
background-clip: ${1};
snippet bgcp:bb
background-clip: border-box;
snippet bgcp:cb
background-clip: content-box;
snippet bgcp:nc
background-clip: no-clip;
snippet bgcp:pb
background-clip: padding-box;
snippet bgc
background-color: #${1:FFF};
snippet bgc:t
background-color: transparent;
snippet bgi
background-image: url(${1});
snippet bgi:n
background-image: none;
snippet bgo
background-origin: ${1};
snippet bgo:bb
background-origin: border-box;
snippet bgo:cb
background-origin: content-box;
snippet bgo:pb
background-origin: padding-box;
snippet bgpx
background-position-x: ${1};
snippet bgpy
background-position-y: ${1};
snippet bgp
background-position: ${1:0} ${2:0};
snippet bgr
background-repeat: ${1};
snippet bgr:n
background-repeat: no-repeat;
snippet bgr:x
background-repeat: repeat-x;
snippet bgr:y
background-repeat: repeat-y;
snippet bgr:r
background-repeat: repeat;
snippet bgz
background-size: ${1};
snippet bgz:a
background-size: auto;
snippet bgz:ct
background-size: contain;
snippet bgz:cv
background-size: cover;
snippet bg
background: ${1};
snippet bg:ie
filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='${1}',sizingMethod='${2:crop}');
snippet bg:n
background: none;
snippet bd+
border: ${1:1px} ${2:solid} #${3:000};
snippet bdb+
border-bottom: ${1:1px} ${2:solid} #${3:000};
snippet bdbc
border-bottom-color: #${1:000};
snippet bdbi
border-bottom-image: url(${1});
snippet bdbi:n
border-bottom-image: none;
snippet bdbli
border-bottom-left-image: url(${1});
snippet bdbli:c
border-bottom-left-image: continue;
snippet bdbli:n
border-bottom-left-image: none;
snippet bdblrz
border-bottom-left-radius: ${1};
snippet bdbri
border-bottom-right-image: url(${1});
snippet bdbri:c
border-bottom-right-image: continue;
snippet bdbri:n
border-bottom-right-image: none;
snippet bdbrrz
border-bottom-right-radius: ${1};
snippet bdbs
border-bottom-style: ${1};
snippet bdbs:n
border-bottom-style: none;
snippet bdbw
border-bottom-width: ${1};
snippet bdb
border-bottom: ${1};
snippet bdb:n
border-bottom: none;
snippet bdbk
border-break: ${1};
snippet bdbk:c
border-break: close;
snippet bdcl
border-collapse: ${1};
snippet bdcl:c
border-collapse: collapse;
snippet bdcl:s
border-collapse: separate;
snippet bdc
border-color: #${1:000};
snippet bdci
border-corner-image: url(${1});
snippet bdci:c
border-corner-image: continue;
snippet bdci:n
border-corner-image: none;
snippet bdf
border-fit: ${1};
snippet bdf:c
border-fit: clip;
snippet bdf:of
border-fit: overwrite;
snippet bdf:ow
border-fit: overwrite;
snippet bdf:r
border-fit: repeat;
snippet bdf:sc
border-fit: scale;
snippet bdf:sp
border-fit: space;
snippet bdf:st
border-fit: stretch;
snippet bdi
border-image: url(${1}) ${2:0} ${3:0} ${4:0} ${5:0} ${6:stretch} ${7:stretch};
snippet bdi:n
border-image: none;
snippet bdl+
border-left: ${1:1px} ${2:solid} #${3:000};
snippet bdlc
border-left-color: #${1:000};
snippet bdli
border-left-image: url(${1});
snippet bdli:n
border-left-image: none;
snippet bdls
border-left-style: ${1};
snippet bdls:n
border-left-style: none;
snippet bdlw
border-left-width: ${1};
snippet bdl
border-left: ${1};
snippet bdl:n
border-left: none;
snippet bdlt
border-length: ${1};
snippet bdlt:a
border-length: auto;
snippet bdrz
border-radius: ${1};
snippet bdr+
border-right: ${1:1px} ${2:solid} #${3:000};
snippet bdrc
border-right-color: #${1:000};
snippet bdri
border-right-image: url(${1});
snippet bdri:n
border-right-image: none;
snippet bdrs
border-right-style: ${1};
snippet bdrs:n
border-right-style: none;
snippet bdrw
border-right-width: ${1};
snippet bdr
border-right: ${1};
snippet bdr:n
border-right: none;
snippet bdsp
border-spacing: ${1};
snippet bds
border-style: ${1};
snippet bds:ds
border-style: dashed;
snippet bds:dtds
border-style: dot-dash;
snippet bds:dtdtds
border-style: dot-dot-dash;
snippet bds:dt
border-style: dotted;
snippet bds:db
border-style: double;
snippet bds:g
border-style: groove;
snippet bds:h
border-style: hidden;
snippet bds:i
border-style: inset;
snippet bds:n
border-style: none;
snippet bds:o
border-style: outset;
snippet bds:r
border-style: ridge;
snippet bds:s
border-style: solid;
snippet bds:w
border-style: wave;
snippet bdt+
border-top: ${1:1px} ${2:solid} #${3:000};
snippet bdtc
border-top-color: #${1:000};
snippet bdti
border-top-image: url(${1});
snippet bdti:n
border-top-image: none;
snippet bdtli
border-top-left-image: url(${1});
snippet bdtli:c
border-corner-image: continue;
snippet bdtli:n
border-corner-image: none;
snippet bdtlrz
border-top-left-radius: ${1};
snippet bdtri
border-top-right-image: url(${1});
snippet bdtri:c
border-top-right-image: continue;
snippet bdtri:n
border-top-right-image: none;
snippet bdtrrz
border-top-right-radius: ${1};
snippet bdts
border-top-style: ${1};
snippet bdts:n
border-top-style: none;
snippet bdtw
border-top-width: ${1};
snippet bdt
border-top: ${1};
snippet bdt:n
border-top: none;
snippet bdw
border-width: ${1};
snippet bd
border: ${1};
snippet bd:n
border: none;
snippet b
bottom: ${1};
snippet b:a
bottom: auto;
snippet bxsh+
box-shadow: ${1:0} ${2:0} ${3:0} #${4:000};
snippet bxsh
box-shadow: ${1};
snippet bxsh:n
box-shadow: none;
snippet bxz
box-sizing: ${1};
snippet bxz:bb
box-sizing: border-box;
snippet bxz:cb
box-sizing: content-box;
snippet cps
caption-side: ${1};
snippet cps:b
caption-side: bottom;
snippet cps:t
caption-side: top;
snippet cl
clear: ${1};
snippet cl:b
clear: both;
snippet cl:l
clear: left;
snippet cl:n
clear: none;
snippet cl:r
clear: right;
snippet cp
clip: ${1};
snippet cp:a
clip: auto;
snippet cp:r
clip: rect(${1:0} ${2:0} ${3:0} ${4:0});
snippet c
color: #${1:000};
snippet ct
content: ${1};
snippet ct:a
content: attr(${1});
snippet ct:cq
content: close-quote;
snippet ct:c
content: counter(${1});
snippet ct:cs
content: counters(${1});
snippet ct:ncq
content: no-close-quote;
snippet ct:noq
content: no-open-quote;
snippet ct:n
content: normal;
snippet ct:oq
content: open-quote;
snippet coi
counter-increment: ${1};
snippet cor
counter-reset: ${1};
snippet cur
cursor: ${1};
snippet cur:a
cursor: auto;
snippet cur:c
cursor: crosshair;
snippet cur:d
cursor: default;
snippet cur:ha
cursor: hand;
snippet cur:he
cursor: help;
snippet cur:m
cursor: move;
snippet cur:p
cursor: pointer;
snippet cur:t
cursor: text;
snippet d
display: ${1};
snippet d:mib
display: -moz-inline-box;
snippet d:mis
display: -moz-inline-stack;
snippet d:b
display: block;
snippet d:cp
display: compact;
snippet d:ib
display: inline-block;
snippet d:itb
display: inline-table;
snippet d:i
display: inline;
snippet d:li
display: list-item;
snippet d:n
display: none;
snippet d:ri
display: run-in;
snippet d:tbcp
display: table-caption;
snippet d:tbc
display: table-cell;
snippet d:tbclg
display: table-column-group;
snippet d:tbcl
display: table-column;
snippet d:tbfg
display: table-footer-group;
snippet d:tbhg
display: table-header-group;
snippet d:tbrg
display: table-row-group;
snippet d:tbr
display: table-row;
snippet d:tb
display: table;
snippet ec
empty-cells: ${1};
snippet ec:h
empty-cells: hide;
snippet ec:s
empty-cells: show;
snippet exp
expression()
snippet fl
float: ${1};
snippet fl:l
float: left;
snippet fl:n
float: none;
snippet fl:r
float: right;
snippet f+
font: ${1:1em} ${2:Arial},${3:sans-serif};
snippet fef
font-effect: ${1};
snippet fef:eb
font-effect: emboss;
snippet fef:eg
font-effect: engrave;
snippet fef:n
font-effect: none;
snippet fef:o
font-effect: outline;
snippet femp
font-emphasize-position: ${1};
snippet femp:a
font-emphasize-position: after;
snippet femp:b
font-emphasize-position: before;
snippet fems
font-emphasize-style: ${1};
snippet fems:ac
font-emphasize-style: accent;
snippet fems:c
font-emphasize-style: circle;
snippet fems:ds
font-emphasize-style: disc;
snippet fems:dt
font-emphasize-style: dot;
snippet fems:n
font-emphasize-style: none;
snippet fem
font-emphasize: ${1};
snippet ff
font-family: ${1};
snippet ff:c
font-family: ${1:'Monotype Corsiva','Comic Sans MS'},cursive;
snippet ff:f
font-family: ${1:Capitals,Impact},fantasy;
snippet ff:m
font-family: ${1:Monaco,'Courier New'},monospace;
snippet ff:ss
font-family: ${1:Helvetica,Arial},sans-serif;
snippet ff:s
font-family: ${1:Georgia,'Times New Roman'},serif;
snippet fza
font-size-adjust: ${1};
snippet fza:n
font-size-adjust: none;
snippet fz
font-size: ${1};
snippet fsm
font-smooth: ${1};
snippet fsm:aw
font-smooth: always;
snippet fsm:a
font-smooth: auto;
snippet fsm:n
font-smooth: never;
snippet fst
font-stretch: ${1};
snippet fst:c
font-stretch: condensed;
snippet fst:e
font-stretch: expanded;
snippet fst:ec
font-stretch: extra-condensed;
snippet fst:ee
font-stretch: extra-expanded;
snippet fst:n
font-stretch: normal;
snippet fst:sc
font-stretch: semi-condensed;
snippet fst:se
font-stretch: semi-expanded;
snippet fst:uc
font-stretch: ultra-condensed;
snippet fst:ue
font-stretch: ultra-expanded;
snippet fs
font-style: ${1};
snippet fs:i
font-style: italic;
snippet fs:n
font-style: normal;
snippet fs:o
font-style: oblique;
snippet fv
font-variant: ${1};
snippet fv:n
font-variant: normal;
snippet fv:sc
font-variant: small-caps;
snippet fw
font-weight: ${1};
snippet fw:b
font-weight: bold;
snippet fw:br
font-weight: bolder;
snippet fw:lr
font-weight: lighter;
snippet fw:n
font-weight: normal;
snippet f
font: ${1};
snippet h
height: ${1};
snippet h:a
height: auto;
snippet l
left: ${1};
snippet l:a
left: auto;
snippet lts
letter-spacing: ${1};
snippet lh
line-height: ${1};
snippet lisi
list-style-image: url(${1});
snippet lisi:n
list-style-image: none;
snippet lisp
list-style-position: ${1};
snippet lisp:i
list-style-position: inside;
snippet lisp:o
list-style-position: outside;
snippet list
list-style-type: ${1};
snippet list:c
list-style-type: circle;
snippet list:dclz
list-style-type: decimal-leading-zero;
snippet list:dc
list-style-type: decimal;
snippet list:d
list-style-type: disc;
snippet list:lr
list-style-type: lower-roman;
snippet list:n
list-style-type: none;
snippet list:s
list-style-type: square;
snippet list:ur
list-style-type: upper-roman;
snippet lis
list-style: ${1};
snippet lis:n
list-style: none;
snippet mb
margin-bottom: ${1};
snippet mb:a
margin-bottom: auto;
snippet ml
margin-left: ${1};
snippet ml:a
margin-left: auto;
snippet mr
margin-right: ${1};
snippet mr:a
margin-right: auto;
snippet mt
margin-top: ${1};
snippet mt:a
margin-top: auto;
snippet m
margin: ${1};
snippet m:4
margin: ${1:0} ${2:0} ${3:0} ${4:0};
snippet m:3
margin: ${1:0} ${2:0} ${3:0};
snippet m:2
margin: ${1:0} ${2:0};
snippet m:0
margin: 0;
snippet m:a
margin: auto;
snippet mah
max-height: ${1};
snippet mah:n
max-height: none;
snippet maw
max-width: ${1};
snippet maw:n
max-width: none;
snippet mih
min-height: ${1};
snippet miw
min-width: ${1};
snippet op
opacity: ${1};
snippet op:ie
filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=${1:100});
snippet op:ms
-ms-filter: 'progid:DXImageTransform.Microsoft.Alpha(Opacity=${1:100})';
snippet orp
orphans: ${1};
snippet o+
outline: ${1:1px} ${2:solid} #${3:000};
snippet oc
outline-color: ${1:#000};
snippet oc:i
outline-color: invert;
snippet oo
outline-offset: ${1};
snippet os
outline-style: ${1};
snippet ow
outline-width: ${1};
snippet o
outline: ${1};
snippet o:n
outline: none;
snippet ovs
overflow-style: ${1};
snippet ovs:a
overflow-style: auto;
snippet ovs:mq
overflow-style: marquee;
snippet ovs:mv
overflow-style: move;
snippet ovs:p
overflow-style: panner;
snippet ovs:s
overflow-style: scrollbar;
snippet ovx
overflow-x: ${1};
snippet ovx:a
overflow-x: auto;
snippet ovx:h
overflow-x: hidden;
snippet ovx:s
overflow-x: scroll;
snippet ovx:v
overflow-x: visible;
snippet ovy
overflow-y: ${1};
snippet ovy:a
overflow-y: auto;
snippet ovy:h
overflow-y: hidden;
snippet ovy:s
overflow-y: scroll;
snippet ovy:v
overflow-y: visible;
snippet ov
overflow: ${1};
snippet ov:a
overflow: auto;
snippet ov:h
overflow: hidden;
snippet ov:s
overflow: scroll;
snippet ov:v
overflow: visible;
snippet pb
padding-bottom: ${1};
snippet pl
padding-left: ${1};
snippet pr
padding-right: ${1};
snippet pt
padding-top: ${1};
snippet p
padding: ${1};
snippet p:4
padding: ${1:0} ${2:0} ${3:0} ${4:0};
snippet p:3
padding: ${1:0} ${2:0} ${3:0};
snippet p:2
padding: ${1:0} ${2:0};
snippet p:0
padding: 0;
snippet pgba
page-break-after: ${1};
snippet pgba:aw
page-break-after: always;
snippet pgba:a
page-break-after: auto;
snippet pgba:l
page-break-after: left;
snippet pgba:r
page-break-after: right;
snippet pgbb
page-break-before: ${1};
snippet pgbb:aw
page-break-before: always;
snippet pgbb:a
page-break-before: auto;
snippet pgbb:l
page-break-before: left;
snippet pgbb:r
page-break-before: right;
snippet pgbi
page-break-inside: ${1};
snippet pgbi:a
page-break-inside: auto;
snippet pgbi:av
page-break-inside: avoid;
snippet pos
position: ${1};
snippet pos:a
position: absolute;
snippet pos:f
position: fixed;
snippet pos:r
position: relative;
snippet pos:s
position: static;
snippet q
quotes: ${1};
snippet q:en
quotes: '\201C' '\201D' '\2018' '\2019';
snippet q:n
quotes: none;
snippet q:ru
quotes: '\00AB' '\00BB' '\201E' '\201C';
snippet rz
resize: ${1};
snippet rz:b
resize: both;
snippet rz:h
resize: horizontal;
snippet rz:n
resize: none;
snippet rz:v
resize: vertical;
snippet r
right: ${1};
snippet r:a
right: auto;
snippet tbl
table-layout: ${1};
snippet tbl:a
table-layout: auto;
snippet tbl:f
table-layout: fixed;
snippet tal
text-align-last: ${1};
snippet tal:a
text-align-last: auto;
snippet tal:c
text-align-last: center;
snippet tal:l
text-align-last: left;
snippet tal:r
text-align-last: right;
snippet ta
text-align: ${1};
snippet ta:c
text-align: center;
snippet ta:l
text-align: left;
snippet ta:r
text-align: right;
snippet td
text-decoration: ${1};
snippet td:l
text-decoration: line-through;
snippet td:n
text-decoration: none;
snippet td:o
text-decoration: overline;
snippet td:u
text-decoration: underline;
snippet te
text-emphasis: ${1};
snippet te:ac
text-emphasis: accent;
snippet te:a
text-emphasis: after;
snippet te:b
text-emphasis: before;
snippet te:c
text-emphasis: circle;
snippet te:ds
text-emphasis: disc;
snippet te:dt
text-emphasis: dot;
snippet te:n
text-emphasis: none;
snippet th
text-height: ${1};
snippet th:a
text-height: auto;
snippet th:f
text-height: font-size;
snippet th:m
text-height: max-size;
snippet th:t
text-height: text-size;
snippet ti
text-indent: ${1};
snippet ti:-
text-indent: -9999px;
snippet tj
text-justify: ${1};
snippet tj:a
text-justify: auto;
snippet tj:d
text-justify: distribute;
snippet tj:ic
text-justify: inter-cluster;
snippet tj:ii
text-justify: inter-ideograph;
snippet tj:iw
text-justify: inter-word;
snippet tj:k
text-justify: kashida;
snippet tj:t
text-justify: tibetan;
snippet to+
text-outline: ${1:0} ${2:0} #${3:000};
snippet to
text-outline: ${1};
snippet to:n
text-outline: none;
snippet tr
text-replace: ${1};
snippet tr:n
text-replace: none;
snippet tsh+
text-shadow: ${1:0} ${2:0} ${3:0} #${4:000};
snippet tsh
text-shadow: ${1};
snippet tsh:n
text-shadow: none;
snippet tt
text-transform: ${1};
snippet tt:c
text-transform: capitalize;
snippet tt:l
text-transform: lowercase;
snippet tt:n
text-transform: none;
snippet tt:u
text-transform: uppercase;
snippet tw
text-wrap: ${1};
snippet tw:no
text-wrap: none;
snippet tw:n
text-wrap: normal;
snippet tw:s
text-wrap: suppress;
snippet tw:u
text-wrap: unrestricted;
snippet t
top: ${1};
snippet t:a
top: auto;
snippet va
vertical-align: ${1};
snippet va:bl
vertical-align: baseline;
snippet va:b
vertical-align: bottom;
snippet va:m
vertical-align: middle;
snippet va:sub
vertical-align: sub;
snippet va:sup
vertical-align: super;
snippet va:tb
vertical-align: text-bottom;
snippet va:tt
vertical-align: text-top;
snippet va:t
vertical-align: top;
snippet v
visibility: ${1};
snippet v:c
visibility: collapse;
snippet v:h
visibility: hidden;
snippet v:v
visibility: visible;
snippet whsc
white-space-collapse: ${1};
snippet whsc:ba
white-space-collapse: break-all;
snippet whsc:bs
white-space-collapse: break-strict;
snippet whsc:k
white-space-collapse: keep-all;
snippet whsc:l
white-space-collapse: loose;
snippet whsc:n
white-space-collapse: normal;
snippet whs
white-space: ${1};
snippet whs:n
white-space: normal;
snippet whs:nw
white-space: nowrap;
snippet whs:pl
white-space: pre-line;
snippet whs:pw
white-space: pre-wrap;
snippet whs:p
white-space: pre;
snippet wid
widows: ${1};
snippet w
width: ${1};
snippet w:a
width: auto;
snippet wob
word-break: ${1};
snippet wob:ba
word-break: break-all;
snippet wob:bs
word-break: break-strict;
snippet wob:k
word-break: keep-all;
snippet wob:l
word-break: loose;
snippet wob:n
word-break: normal;
snippet wos
word-spacing: ${1};
snippet wow
word-wrap: ${1};
snippet wow:no
word-wrap: none;
snippet wow:n
word-wrap: normal;
snippet wow:s
word-wrap: suppress;
snippet wow:u
word-wrap: unrestricted;
snippet z
z-index: ${1};
snippet z:a
z-index: auto;
snippet zoo
zoom: 1;

View file

@ -0,0 +1,82 @@
snippet lib
#library('${1}');
${2}
snippet im
#import('${1}');
${2}
snippet so
#source('${1}');
${2}
snippet main
static void main() {
${1:/* code */}
}
snippet st
static ${1}
snippet fi
final ${1}
snippet re
return ${1}
snippet br
break;
snippet th
throw ${1}
snippet cl
class ${1:`Filename("", "untitled")`} ${2}
snippet in
interface ${1:`Filename("", "untitled")`} ${2}
snippet imp
implements ${1}
snippet ext
extends ${1}
snippet if
if (${1:true}) {
${2}
}
snippet ife
if (${1:true}) {
${2}
} else {
${3}
}
snippet el
else
snippet sw
switch (${1}) {
${2}
}
snippet cs
case ${1}:
${2}
snippet de
default:
${1}
snippet for
for (var ${2:i} = 0, len = ${1:things}.length; $2 < len; ${3:++}$2) {
${4:$1[$2]}
}
snippet fore
for (final ${2:item} in ${1:itemList}) {
${3:/* code */}
}
snippet wh
while (${1:/* condition */}) {
${2:/* code */}
}
snippet dowh
do {
${2:/* code */}
} while (${1:/* condition */});
snippet as
assert(${1:/* condition */});
snippet try
try {
${2}
} catch (${1:Exception e}) {
}
snippet tryf
try {
${2}
} catch (${1:Exception e}) {
} finally {
}

View file

@ -0,0 +1,11 @@
# DEP-3 (http://dep.debian.net/deps/dep3/) style patch header
snippet header DEP-3 style header
Description: ${1}
Origin: ${2:vendor|upstream|other}, ${3:url of the original patch}
Bug: ${4:url in upstream bugtracker}
Forwarded: ${5:no|not-needed|url}
Author: ${6:`g:snips_author`}
Reviewed-by: ${7:name and email}
Last-Update: ${8:`strftime("%Y-%m-%d")`}
Applied-Upstream: ${9:upstream version|url|commit}

View file

@ -0,0 +1,108 @@
# Model Fields
# Note: Optional arguments are using defaults that match what Django will use
# as a default, e.g. with max_length fields. Doing this as a form of self
# documentation and to make it easy to know whether you should override the
# default or not.
# Note: Optional arguments that are booleans will use the opposite since you
# can either not specify them, or override them, e.g. auto_now_add=False.
snippet auto
${1:FIELDNAME} = models.AutoField(${2})
snippet bool
${1:FIELDNAME} = models.BooleanField(${2:default=True})
snippet char
${1:FIELDNAME} = models.CharField(max_length=${2}${3:, blank=True})
snippet comma
${1:FIELDNAME} = models.CommaSeparatedIntegerField(max_length=${2}${3:, blank=True})
snippet date
${1:FIELDNAME} = models.DateField(${2:auto_now_add=True, auto_now=True}${3:, blank=True, null=True})
snippet datetime
${1:FIELDNAME} = models.DateTimeField(${2:auto_now_add=True, auto_now=True}${3:, blank=True, null=True})
snippet decimal
${1:FIELDNAME} = models.DecimalField(max_digits=${2}, decimal_places=${3})
snippet email
${1:FIELDNAME} = models.EmailField(max_length=${2:75}${3:, blank=True})
snippet file
${1:FIELDNAME} = models.FileField(upload_to=${2:path/for/upload}${3:, max_length=100})
snippet filepath
${1:FIELDNAME} = models.FilePathField(path=${2:"/abs/path/to/dir"}${3:, max_length=100}${4:, match="*.ext"}${5:, recursive=True}${6:, blank=True, })
snippet float
${1:FIELDNAME} = models.FloatField(${2})
snippet image
${1:FIELDNAME} = models.ImageField(upload_to=${2:path/for/upload}${3:, height_field=height, width_field=width}${4:, max_length=100})
snippet int
${1:FIELDNAME} = models.IntegerField(${2})
snippet ip
${1:FIELDNAME} = models.IPAddressField(${2})
snippet nullbool
${1:FIELDNAME} = models.NullBooleanField(${2})
snippet posint
${1:FIELDNAME} = models.PositiveIntegerField(${2})
snippet possmallint
${1:FIELDNAME} = models.PositiveSmallIntegerField(${2})
snippet slug
${1:FIELDNAME} = models.SlugField(max_length=${2:50}${3:, blank=True})
snippet smallint
${1:FIELDNAME} = models.SmallIntegerField(${2})
snippet text
${1:FIELDNAME} = models.TextField(${2:blank=True})
snippet time
${1:FIELDNAME} = models.TimeField(${2:auto_now_add=True, auto_now=True}${3:, blank=True, null=True})
snippet url
${1:FIELDNAME} = models.URLField(${2:verify_exists=False}${3:, max_length=200}${4:, blank=True})
snippet xml
${1:FIELDNAME} = models.XMLField(schema_path=${2:None}${3:, blank=True})
# Relational Fields
snippet fk
${1:FIELDNAME} = models.ForeignKey(${2:OtherModel}${3:, related_name=''}${4:, limit_choices_to=}${5:, to_field=''})
snippet m2m
${1:FIELDNAME} = models.ManyToManyField(${2:OtherModel}${3:, related_name=''}${4:, limit_choices_to=}${5:, symmetrical=False}${6:, through=''}${7:, db_table=''})
snippet o2o
${1:FIELDNAME} = models.OneToOneField(${2:OtherModel}${3:, parent_link=True}${4:, related_name=''}${5:, limit_choices_to=}${6:, to_field=''})
# Code Skeletons
snippet form
class ${1:FormName}(forms.Form):
"""${2:docstring}"""
${3}
snippet model
class ${1:ModelName}(models.Model):
"""${2:docstring}"""
${3}
class Meta:
${4}
def __unicode__(self):
${5}
def save(self, force_insert=False, force_update=False):
${6}
@models.permalink
def get_absolute_url(self):
return ('${7:view_or_url_name}' ${8})
snippet modeladmin
class ${1:ModelName}Admin(admin.ModelAdmin):
${2}
admin.site.register($1, $1Admin)
snippet tabularinline
class ${1:ModelName}Inline(admin.TabularInline):
model = $1
snippet stackedinline
class ${1:ModelName}Inline(admin.StackedInline):
model = $1
snippet r2r
return render_to_response('${1:template.html}', {
${2}
}${3:, context_instance=RequestContext(request)}
)

View file

@ -0,0 +1,160 @@
# module and export all
snippet mod
-module(${1:`Filename('', 'my')`}).
-compile([export_all]).
start() ->
${2}
stop() ->
ok.
# define directive
snippet def
-define(${1:macro}, ${2:body}).${3}
# export directive
snippet exp
-export([${1:function}/${2:arity}]).
# include directive
snippet inc
-include("${1:file}").${2}
# behavior directive
snippet beh
-behaviour(${1:behaviour}).${2}
# if expression
snippet if
if
${1:guard} ->
${2:body}
end
# case expression
snippet case
case ${1:expression} of
${2:pattern} ->
${3:body};
end
# anonymous function
snippet fun
fun (${1:Parameters}) -> ${2:body} end${3}
# try...catch
snippet try
try
${1}
catch
${2:_:_} -> ${3:got_some_exception}
end
# record directive
snippet rec
-record(${1:record}, {
${2:field}=${3:value}}).${4}
# todo comment
snippet todo
%% TODO: ${1}
## Snippets below (starting with '%') are in EDoc format.
## See http://www.erlang.org/doc/apps/edoc/chapter.html#id56887 for more details
# doc comment
snippet %d
%% @doc ${1}
# end of doc comment
snippet %e
%% @end
# specification comment
snippet %s
%% @spec ${1}
# private function marker
snippet %p
%% @private
# OTP application
snippet application
-module(${1:`Filename('', 'my')`}).
-behaviour(application).
-export([start/2, stop/1]).
start(_Type, _StartArgs) ->
case ${2:root_supervisor}:start_link() of
{ok, Pid} ->
{ok, Pid};
Other ->
{error, Other}
end.
stop(_State) ->
ok.
# OTP supervisor
snippet supervisor
-module(${1:`Filename('', 'my')`}).
-behaviour(supervisor).
%% API
-export([start_link/0]).
%% Supervisor callbacks
-export([init/1]).
-define(SERVER, ?MODULE).
start_link() ->
supervisor:start_link({local, ?SERVER}, ?MODULE, []).
init([]) ->
Server = {${2:my_server}, {$2, start_link, []},
permanent, 2000, worker, [$2]},
Children = [Server],
RestartStrategy = {one_for_one, 0, 1},
{ok, {RestartStrategy, Children}}.
# OTP gen_server
snippet gen_server
-module(${1:`Filename('', 'my')`}).
-behaviour(gen_server).
%% API
-export([
start_link/0
]).
%% gen_server callbacks
-export([init/1, handle_call/3, handle_cast/2, handle_info/2,
terminate/2, code_change/3]).
-define(SERVER, ?MODULE).
-record(state, {}).
%%%===================================================================
%%% API
%%%===================================================================
start_link() ->
gen_server:start_link({local, ?SERVER}, ?MODULE, [], []).
%%%===================================================================
%%% gen_server callbacks
%%%===================================================================
init([]) ->
{ok, #state{}}.
handle_call(_Request, _From, State) ->
Reply = ok,
{reply, Reply, State}.
handle_cast(_Msg, State) ->
{noreply, State}.
handle_info(_Info, State) ->
{noreply, State}.
terminate(_Reason, _State) ->
ok.
code_change(_OldVsn, State, _Extra) ->
{ok, State}.
%%%===================================================================
%%% Internal functions
%%%===================================================================

View file

@ -0,0 +1,117 @@
# .erb and .rhmtl files
# Includes html.snippets
# Rails *****************************
snippet rc
<% ${1} %>
snippet rce
<%= ${1} %>${2}
snippet %
<% ${1} %>
snippet =
<%= ${1} %>${2}
snippet end
<% end %>${1}
snippet ead
<% ${1}.each do |${2}| %>
${3}
<% end %>
snippet for
<% for ${2:item} in ${1} %>
${3}
<% end %>
snippet rp
<%= render :partial => '${1:item}' %>
snippet rpl
<%= render :partial => '${1:item}', :locals => { :${2:name} => '${3:value}'$4 } %>
snippet rps
<%= render :partial => '${1:item}', :status => ${2:500} %>
snippet rpc
<%= render :partial => '${1:item}', :collection => ${2:items} %>
snippet lia
<%= link_to '${1:link text...}', :action => '${2:index}' %>
snippet liai
<%= link_to '${1:link text...}', :action => '${2:edit}', :id => ${3:@item} %>
snippet lic
<%= link_to '${1:link text...}', :controller => '${2:items}' %>
snippet lica
<%= link_to '${1:link text...}', :controller => '${2:items}', :action => '${3:index}' %>
snippet licai
<%= link_to '${1:link text...}', :controller => '${2:items}', :action => '${3:edit}', :id => ${4:@item} %>
snippet yield
<%= yield ${1::content_symbol} %>${2}
snippet conf
<% content_for :${1:head} do %>
${2}
<% end %>
snippet cs
<%= collection_select <+object+>, <+method+>, <+collection+>, <+value_method+>, <+text_method+><+, <+[options]+>, <+[html_options]+>+> %>
snippet ct
<%= content_tag '${1:DIV}', ${2:content}${3:,options} %>
snippet ff
<% form_for @${1:model} do |f| %>
${2}
<% end %>
snippet ffcb
<%= ${1:f}.check_box :${2:attribute} %>
snippet ffe
<% error_messages_for :${1:model} %>
<% form_for @${2:model} do |f| %>
${3}
<% end %>
snippet ffff
<%= ${1:f}.file_field :${2:attribute} %>
snippet ffhf
<%= ${1:f}.hidden_field :${2:attribute} %>
snippet ffl
<%= ${1:f}.label :${2:attribute}, '${3:$2}' %>
snippet ffpf
<%= ${1:f}.password_field :${2:attribute} %>
snippet ffrb
<%= ${1:f}.radio_button :${2:attribute}, :${3:tag_value} %>
snippet ffs
<%= ${1:f}.submit "${2:submit}" %>
snippet ffta
<%= ${1:f}.text_area :${2:attribute} %>
snippet fftf
<%= ${1:f}.text_field :${2:attribute} %>
snippet fields
<% fields_for :${1:model}, @$1 do |${2:f}| %>
${3}
<% end %>
snippet ff
<%= form_for @${1:model} do |f| %>
${2}
<% end %>
snippet i18
I18n.t('${1:type.key}')${2}
snippet it
<%= image_tag "${1}"${2} %>
snippet jit
<%= javascript_include_tag ${1::all} %>
snippet jsit
<%= javascript_include_tag "${1}" %>
snippet lim
<%= link_to ${1:model}.${2:name}, ${3:$1}_path(${4:$1}) %>
snippet linp
<%= link_to "${1:Link text...}", ${2:parent}_${3:child}_path(${4:@$2}, ${5:@$3}) %>
snippet linpp
<%= link_to "${1:Link text...}", ${2:parent}_${3:child}_path(${4:@$2}) %>
snippet lip
<%= link_to "${1:Link text...}", ${2:model}_path(${3:@$2}) %>
snippet lipp
<%= link_to "${1:Link text...}", ${2:model}s_path %>
snippet lt
<%= link_to "${1:name}", ${2:dest} %>
snippet ofcfs
<%= options_from_collection_for_select ${1:collection}, ${2:value_method}, ${3:text_method}, ${4:selected_value} %>
snippet rf
<%= render :file => "${1:file}"${2} %>
snippet rt
<%= render :template => "${1:file}"${2} %>
snippet slt
<%= stylesheet_link_tag ${1::all}, :cache => ${2:true} %>
snippet sslt
<%= stylesheet_link_tag "${1}" %>

View file

@ -0,0 +1,71 @@
snippet #!
#!/usr/bin/env falcon
# Import
snippet imp
import ${1:module}
# Function
snippet fun
function ${2:function_name}(${3})
${4:/* code */}
end
# Class
snippet class
class ${1:class_name}(${2:class_params})
${3:/* members/methods */}
end
# If
snippet if
if ${1:condition}
${2:/* code */}
end
# If else
snippet ife
if ${1:condition}
${2:/* code */}
else
${1}
end
# If else if
snippet elif
elif ${1:condition}
${2:/* code */}
# Switch case
snippet switch
switch ${1:expression}
case ${2:item}
case ${3:item}
default
end
# Select
snippet select
select ${1:variable}
case ${2:TypeSpec}
case ${3:TypeSpec}
default
end
# For/in Loop
snippet forin
for ${1:element} in ${2:container}
${3:/* code */}
end
# For/to Loop
snippet forto
for ${1:lowerbound} to ${2:upperbound}
${3:/* code */}
end
# While Loop
snippet while
while ${1:conidition}
${2:/* code */}
end

View file

@ -0,0 +1,201 @@
# append
snippet ap
append(${1:slice}, ${2:value})
# bool
snippet bl
bool
# byte
snippet bt
byte
# break
snippet br
break
# channel
snippet ch
chan ${1:int}
# case
snippet cs
case ${1:value}:
${2:/* code */}
# const
snippet c
const ${1:NAME} = ${2:0}
# constants with iota
snippet co
const (
${1:NAME1} = iota
${2:NAME2}
)
# continue
snippet cn
continue
# defer
snippet df
defer ${1:func}()
# defer recover
snippet dfr
defer func() {
if err := recover(); err != nil {
${1:/* code */}
}
}()
# gpl
snippet gpl
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* Copyright (C) ${1:Author}, `strftime("%Y")`
*/
${2}
# int
snippet i
int
# import
snippet im
import (
"${1:package}"
)
# interface
snippet in
interface{}
# full interface snippet
snippet inf
interface ${1:name} {
${2:/* methods */}
}${3}
# if condition
snippet if
if ${1:/* condition */} {
${2:/* code */}
}
# else snippet
snippet el
else {
${1}
}
# error snippet
snippet ir
if err != nil {
return err
}
${1}
# false
snippet f
false
# fallthrough
snippet ft
fallthrough
# float
snippet fl
float32
# float32
snippet f3
float32
# float64
snippet f6
float64
# if else
snippet ie
if ${1:/* condition */} {
${2:/* code */}
} else {
${3}
}
# for loop
snippet fo
for ${2:i} = 0; $2 < ${1:count}; $2${3:++} {
${4:/* code */}
}
# for range loop
snippet fr
for ${1:k}, ${2:v} := range ${3} {
${4:/* code */}
}
# function simple
snippet fun
func ${1:funcName}(${2}) ${3:os.Error} {
${4:/* code */}
}
# function on receiver
snippet fum
func (self ${1:type}) ${2:funcName}(${3}) ${4:os.Error} {
${5:/* code */}
}
# make
snippet mk
make(${1:[]string}, ${2:0})
# map
snippet mp
map[${1:string}]${2:int}
# main()
snippet main
func main() {
${1:/* code */}
}
# new
snippet nw
new(${1:type})
# panic
snippet pn
panic("${1:msg}")
# print
snippet pr
fmt.Printf("${1:%s}\n", ${2:var})${3}
# range
snippet rn
range ${1}
# return
snippet rt
return ${1}
# result
snippet rs
result
# select
snippet sl
select {
case ${1:v1} := <-${2:chan1}
${3:/* code */}
case ${4:v2} := <-${5:chan2}
${6:/* code */}
default:
${7:/* code */}
}
# string
snippet sr
string
# struct
snippet st
struct ${1:name} {
${2:/* data */}
}${4}
# switch
snippet sw
switch ${1:var} {
case ${2:value1}:
${3:/* code */}
case ${4:value2}:
${5:/* code */}
default:
${6:/* code */}
}
snippet sp
fmt.Sprintf("${1:%s}", ${2:var})${3}
# true
snippet t
true
# variable declaration
snippet v
var ${1:t} ${2:string}

View file

@ -0,0 +1,20 @@
snippet t
%table
%tr
%th
${1:headers}
%tr
%td
${2:headers}
snippet ul
%ul
%li
${1:item}
%li
snippet =rp
= render :partial => '${1:partial}'
snippet =rpl
= render :partial => '${1:partial}', :locals => {}
snippet =rpc
= render :partial => '${1:partial}', :collection => @$1

View file

@ -0,0 +1,82 @@
snippet lang
{-# LANGUAGE ${1:OverloadedStrings} #-}
snippet info
-- |
-- Module : ${1:Module.Namespace}
-- Copyright : ${2:Author} ${3:2011-2012}
-- License : ${4:BSD3}
--
-- Maintainer : ${5:email@something.com}
-- Stability : ${6:experimental}
-- Portability : ${7:unknown}
--
-- ${8:Description}
--
snippet import
import ${1:Data.Text}
snippet import2
import ${1:Data.Text} (${2:head})
snippet importq
import qualified ${1:Data.Text} as ${2:T}
snippet inst
instance ${1:Monoid} ${2:Type} where
${3}
snippet type
type ${1:Type} = ${2:Type}
snippet data
data ${1:Type} = ${2:$1} ${3:Int}
snippet newtype
newtype ${1:Type} = ${2:$1} ${3:Int}
snippet class
class ${1:Class} a where
${2}
snippet module
module `substitute(substitute(expand('%:r'), '[/\\]','.','g'),'^\%(\l*\.\)\?','','')` (
) where
`expand('%') =~ 'Main' ? "\n\nmain = do\n print \"hello world\"" : ""`
snippet const
${1:name} :: ${2:a}
$1 = ${3:undefined}
snippet fn
${1:fn} :: ${2:a} -> ${3:a}
$1 ${4} = ${5:undefined}
snippet fn2
${1:fn} :: ${2:a} -> ${3:a} -> ${4:a}
$1 ${5} = ${6:undefined}
snippet ap
${1:map} ${2:fn} ${3:list}
snippet do
do
snippet λ
\${1:x} -> ${2}
snippet \
\${1:x} -> ${2}
snippet <-
${1:a} <- ${2:m a}
snippet ←
${1:a} <- ${2:m a}
snippet ->
${1:m a} -> ${2:a}
snippet →
${1:m a} -> ${2:a}
snippet tup
(${1:a}, ${2:b})
snippet tup2
(${1:a}, ${2:b}, ${3:c})
snippet tup3
(${1:a}, ${2:b}, ${3:c}, ${4:d})
snippet rec
${1:Record} { ${2:recFieldA} = ${3:undefined}
, ${4:recFieldB} = ${5:undefined}
}
snippet case
case ${1:something} of
${2} -> ${3}
snippet let
let ${1} = ${2}
in ${3}
snippet where
where
${1:fn} = ${2:undefined}

View file

@ -0,0 +1,816 @@
# Some useful Unicode entities
# Non-Breaking Space
snippet nbs
&nbsp;
# ←
snippet left
&#x2190;
# →
snippet right
&#x2192;
# ↑
snippet up
&#x2191;
# ↓
snippet down
&#x2193;
# ↩
snippet return
&#x21A9;
# ⇤
snippet backtab
&#x21E4;
# ⇥
snippet tab
&#x21E5;
# ⇧
snippet shift
&#x21E7;
# ⌃
snippet ctrl
&#x2303;
# ⌅
snippet enter
&#x2305;
# ⌘
snippet cmd
&#x2318;
# ⌥
snippet option
&#x2325;
# ⌦
snippet delete
&#x2326;
# ⌫
snippet backspace
&#x232B;
# ⎋
snippet esc
&#x238B;
# Generic Doctype
snippet doctype HTML 4.01 Strict
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
snippet doctype HTML 4.01 Transitional
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
snippet doctype HTML 5
<!DOCTYPE HTML>
snippet doctype XHTML 1.0 Frameset
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
snippet doctype XHTML 1.0 Strict
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
snippet doctype XHTML 1.0 Transitional
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
snippet doctype XHTML 1.1
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
# HTML Doctype 4.01 Strict
snippet docts
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
# HTML Doctype 4.01 Transitional
snippet doct
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
# HTML Doctype 5
snippet doct5
<!DOCTYPE HTML>
# XHTML Doctype 1.0 Frameset
snippet docxf
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
# XHTML Doctype 1.0 Strict
snippet docxs
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
# XHTML Doctype 1.0 Transitional
snippet docxt
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
# XHTML Doctype 1.1
snippet docx
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
# Attributes
snippet attr
${1:attribute}="${2:property}"
snippet attr+
${1:attribute}="${2:property}" attr+${3}
snippet .
class="${1}"${2}
snippet #
id="${1}"${2}
snippet alt
alt="${1}"${2}
snippet charset
charset="${1:utf-8}"${2}
snippet data
data-${1}="${2:$1}"${3}
snippet for
for="${1}"${2}
snippet height
height="${1}"${2}
snippet href
href="${1:#}"${2}
snippet lang
lang="${1:en}"${2}
snippet media
media="${1}"${2}
snippet name
name="${1}"${2}
snippet rel
rel="${1}"${2}
snippet scope
scope="${1:row}"${2}
snippet src
src="${1}"${2}
snippet title=
title="${1}"${2}
snippet type
type="${1}"${2}
snippet value
value="${1}"${2}
snippet width
width="${1}"${2}
# Elements
snippet a
<a href="${1:#}">${2:$1}</a>
snippet a.
<a class="${1}" href="${2:#}">${3:$1}</a>
snippet a#
<a id="${1}" href="${2:#}">${3:$1}</a>
snippet a:ext
<a href="http://${1:example.com}">${2:$1}</a>
snippet a:mail
<a href="mailto:${1:joe@example.com}?subject=${2:feedback}">${3:email me}</a>
snippet abbr
<abbr title="${1}">${2}</abbr>
snippet address
<address>
${1}
</address>
snippet area
<area shape="${1:rect}" coords="${2}" href="${3}" alt="${4}" />
snippet area+
<area shape="${1:rect}" coords="${2}" href="${3}" alt="${4}" />
area+${5}
snippet area:c
<area shape="circle" coords="${1}" href="${2}" alt="${3}" />
snippet area:d
<area shape="default" coords="${1}" href="${2}" alt="${3}" />
snippet area:p
<area shape="poly" coords="${1}" href="${2}" alt="${3}" />
snippet area:r
<area shape="rect" coords="${1}" href="${2}" alt="${3}" />
snippet article
<article>
${1}
</article>
snippet article.
<article class="${1}">
${2}
</article>
snippet article#
<article id="${1}">
${2}
</article>
snippet aside
<aside>
${1}
</aside>
snippet aside.
<aside class="${1}">
${2}
</aside>
snippet aside#
<aside id="${1}">
${2}
</aside>
snippet audio
<audio src="${1}>${2}</audio>
snippet b
<b>${1}</b>
snippet base
<base href="${1}" target="${2}" />
snippet bdi
<bdi>${1}</bdo>
snippet bdo
<bdo dir="${1}">${2}</bdo>
snippet bdo:l
<bdo dir="ltr">${1}</bdo>
snippet bdo:r
<bdo dir="rtl">${1}</bdo>
snippet blockquote
<blockquote>
${1}
</blockquote>
snippet body
<body>
${1}
</body>
snippet br
<br />${1}
snippet button
<button type="${1:submit}">${2}</button>
snippet button.
<button class="${1:button}" type="${2:submit}">${3}</button>
snippet button#
<button id="${1}" type="${2:submit}">${3}</button>
snippet button:s
<button type="submit">${1}</button>
snippet button:r
<button type="reset">${1}</button>
snippet canvas
<canvas>
${1}
</canvas>
snippet caption
<caption>${1}</caption>
snippet cite
<cite>${1}</cite>
snippet code
<code>${1}</code>
snippet col
<col />${1}
snippet col+
<col />
col+${1}
snippet colgroup
<colgroup>
${1}
</colgroup>
snippet colgroup+
<colgroup>
<col />
col+${1}
</colgroup>
snippet command
<command type="command" label="${1}" icon="${2}" />
snippet command:c
<command type="checkbox" label="${1}" icon="${2}" />
snippet command:r
<command type="radio" radiogroup="${1}" label="${2}" icon="${3}" />
snippet datagrid
<datagrid>
${1}
</datagrid>
snippet datalist
<datalist>
${1}
</datalist>
snippet datatemplate
<datatemplate>
${1}
</datatemplate>
snippet dd
<dd>${1}</dd>
snippet dd.
<dd class="${1}">${2}</dd>
snippet dd#
<dd id="${1}">${2}</dd>
snippet del
<del>${1}</del>
snippet details
<details>${1}</details>
snippet dfn
<dfn>${1}</dfn>
snippet dialog
<dialog>
${1}
</dialog>
snippet div
<div>
${1}
</div>
snippet div.
<div class="${1}">
${2}
</div>
snippet div#
<div id="${1}">
${2}
</div>
snippet dl
<dl>
${1}
</dl>
snippet dl.
<dl class="${1}">
${2}
</dl>
snippet dl#
<dl id="${1}">
${2}
</dl>
snippet dl+
<dl>
<dt>${1}</dt>
<dd>${2}</dd>
dt+${3}
</dl>
snippet dt
<dt>${1}</dt>
snippet dt.
<dt class="${1}">${2}</dt>
snippet dt#
<dt id="${1}">${2}</dt>
snippet dt+
<dt>${1}</dt>
<dd>${2}</dd>
dt+${3}
snippet em
<em>${1}</em>
snippet embed
<embed src=${1} type="${2} />
snippet fieldset
<fieldset>
${1}
</fieldset>
snippet fieldset.
<fieldset class="${1}">
${2}
</fieldset>
snippet fieldset#
<fieldset id="${1}">
${2}
</fieldset>
snippet fieldset+
<fieldset>
<legend><span>${1}</span></legend>
${2}
</fieldset>
fieldset+${3}
snippet figcaption
<figcaption>${1}</figcaption>
snippet figure
<figure>${1}</figure>
snippet footer
<footer>
${1}
</footer>
snippet footer.
<footer class="${1}>
${2}
</footer>
snippet footer#
<footer id="${1}>
${2}
</footer>
snippet form
<form action="${1}" method="${2:get}" accept-charset="utf-8">
${3}
</form>
snippet form.
<form class="${1}" action="${2}" method="${3:get}" accept-charset="utf-8">
${4}
</form>
snippet form#
<form id="${1}" action="${2}" method="${3:get}" accept-charset="utf-8">
${4}
</form>
snippet h1
<h1>${1}</h1>
snippet h1.
<h1 class="${1}">${2}</h1>
snippet h1#
<h1 id="${1}">${2}</h1>
snippet h2
<h2>${1}</h2>
snippet h2.
<h2 class="${1}">${2}</h2>
snippet h2#
<h2 id="${1}">${2}</h2>
snippet h3
<h3>${1}</h3>
snippet h3.
<h3 class="${1}">${2}</h3>
snippet h3#
<h3 id="${1}">${2}</h3>
snippet h4
<h4>${1}</h4>
snippet h4.
<h4 class="${1}">${2}</h4>
snippet h4#
<h4 id="${1}">${2}</h4>
snippet h5
<h5>${1}</h5>
snippet h5.
<h5 class="${1}">${2}</h5>
snippet h5#
<h5 id="${1}">${2}</h5>
snippet h6
<h6>${1}</h6>
snippet h6.
<h6 class="${1}">${2}</h6>
snippet h6#
<h6 id="${1}">${2}</h6>
snippet head
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>${1:`substitute(Filename('', 'Page Title'), '^.', '\u&', '')`}</title>
${2}
</head>
snippet header
<header>
${1}
</header>
snippet header.
<header class="${1}">
${2}
</header>
snippet header#
<header id="${1}">
${2}
</header>
snippet hgroup
<hgroup>
${1}
</hgroup>
snippet hgroup.
<hgroup class="${1}>
${2}
</hgroup>
snippet hr
<hr />${1}
snippet html
<html>
${1}
</html>
snippet xhtml
<html xmlns="http://www.w3.org/1999/xhtml">
${1}
</html>
snippet i
<i>${1}</i>
snippet iframe
<iframe src="${1}" frameborder="0"></iframe>${2}
snippet iframe.
<iframe class="${1}" src="${2}" frameborder="0"></iframe>${3}
snippet iframe#
<iframe id="${1}" src="${2}" frameborder="0"></iframe>${3}
snippet img
<img src="${1}" alt="${2}" />${3}
snippet img.
<img class="${1}" src="${2}" alt="${3}" />${4}
snippet img#
<img id="${1}" src="${2}" alt="${3}" />${4}
snippet input
<input type="${1:text/submit/hidden/button/image}" name="${2}" id="${3:$2}" value="${4}" />${5}
snippet input.
<input class="${1}" type="${2:text/submit/hidden/button/image}" name="${3}" id="${4:$3}" value="${5}" />${6}
snippet input:text
<input type="text" name="${1}" id="${2:$1}" value="${3}" />${4}
snippet input:submit
<input type="submit" name="${1}" id="${2:$1}" value="${3}" />${4}
snippet input:hidden
<input type="hidden" name="${1}" id="${2:$1}" value="${3}" />${4}
snippet input:button
<input type="button" name="${1}" id="${2:$1}" value="${3}" />${4}
snippet input:image
<input type="image" name="${1}" id="${2:$1}" src="${3}" alt="${4}" />${5}
snippet input:checkbox
<input type="checkbox" name="${1}" id="${2:$1}" />${3}
snippet input:radio
<input type="radio" name="${1}" id="${2:$1}" />${3}
snippet input:color
<input type="color" name="${1}" id="${2:$1}" value="${3}" />${4}
snippet input:date
<input type="date" name="${1}" id="${2:$1}" value="${3}" />${4}
snippet input:datetime
<input type="datetime" name="${1}" id="${2:$1}" value="${3}" />${4}
snippet input:datetime-local
<input type="datetime-local" name="${1}" id="${2:$1}" value="${3}" />${4}
snippet input:email
<input type="email" name="${1}" id="${2:$1}" value="${3}" />${4}
snippet input:file
<input type="file" name="${1}" id="${2:$1}" value="${3}" />${4}
snippet input:month
<input type="month" name="${1}" id="${2:$1}" value="${3}" />${4}
snippet input:number
<input type="number" name="${1}" id="${2:$1}" value="${3}" />${4}
snippet input:password
<input type="password" name="${1}" id="${2:$1}" value="${3}" />${4}
snippet input:range
<input type="range" name="${1}" id="${2:$1}" value="${3}" />${4}
snippet input:reset
<input type="reset" name="${1}" id="${2:$1}" value="${3}" />${4}
snippet input:search
<input type="search" name="${1}" id="${2:$1}" value="${3}" />${4}
snippet input:time
<input type="time" name="${1}" id="${2:$1}" value="${3}" />${4}
snippet input:url
<input type="url" name="${1}" id="${2:$1}" value="${3}" />${4}
snippet input:week
<input type="week" name="${1}" id="${2:$1}" value="${3}" />${4}
snippet ins
<ins>${1}</ins>
snippet kbd
<kbd>${1}</kbd>
snippet keygen
<keygen>${1}</keygen>
snippet label
<label for="${2:$1}">${1}</label>
snippet label:i
<label for="${2:$1}">${1}</label>
<input type="${3:text/submit/hidden/button}" name="${4:$2}" id="${5:$2}" value="${6}" />${7}
snippet label:s
<label for="${2:$1}">${1}</label>
<select name="${3:$2}" id="${4:$2}">
<option value="${5}">${6:$5}</option>
</select>
snippet legend
<legend>${1}</legend>
snippet legend+
<legend><span>${1}</span></legend>
snippet li
<li>${1}</li>
snippet li.
<li class="${1}">${2}</li>
snippet li+
<li>${1}</li>
li+${2}
snippet lia
<li><a href="${2:#}">${1}</a></li>
snippet lia+
<li><a href="${2:#}">${1}</a></li>
lia+${3}
snippet link
<link rel="${1}" href="${2}" title="${3}" type="${4}" />${5}
snippet link:atom
<link rel="alternate" href="${1:atom.xml}" title="Atom" type="application/atom+xml" />${2}
snippet link:css
<link rel="stylesheet" href="${2:style.css}" type="text/css" media="${3:all}" />${4}
snippet link:favicon
<link rel="shortcut icon" href="${1:favicon.ico}" type="image/x-icon" />${2}
snippet link:rss
<link rel="alternate" href="${1:rss.xml}" title="RSS" type="application/atom+xml" />${2}
snippet link:touch
<link rel="apple-touch-icon" href="${1:favicon.png}" />${2}
snippet map
<map name="${1}">
${2}
</map>
snippet map.
<map class="${1}" name="${2}">
${3}
</map>
snippet map#
<map name="${1}" id="${2:$1}>
${3}
</map>
snippet map+
<map name="${1}">
<area shape="${2}" coords="${3}" href="${4}" alt="${5}" />${6}
</map>${7}
snippet mark
<mark>${1}</mark>
snippet menu
<menu>
${1}
</menu>
snippet menu:c
<menu type="context">
${1}
</menu>
snippet menu:t
<menu type="toolbar">
${1}
</menu>
snippet meta
<meta http-equiv="${1}" content="${2}" />${3}
snippet meta:compat
<meta http-equiv="X-UA-Compatible" content="IE=${1:7,8,edge}" />${3}
snippet meta:refresh
<meta http-equiv="refresh" content="text/html;charset=UTF-8" />${3}
snippet meta:utf
<meta http-equiv="content-type" content="text/html;charset=UTF-8" />${3}
snippet meter
<meter>${1}</meter>
snippet nav
<nav>
${1}
</nav>
snippet nav.
<nav class="${1}">
${2}
</nav>
snippet nav#
<nav id="${1}">
${2}
</nav>
snippet noscript
<noscript>
${1}
</noscript>
snippet object
<object data="${1}" type="${2}">
${3}
</object>${4}
# Embed QT Movie
snippet movie
<object width="$2" height="$3" classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B"
codebase="http://www.apple.com/qtactivex/qtplugin.cab">
<param name="src" value="$1" />
<param name="controller" value="$4" />
<param name="autoplay" value="$5" />
<embed src="${1:movie.mov}"
width="${2:320}" height="${3:240}"
controller="${4:true}" autoplay="${5:true}"
scale="tofit" cache="true"
pluginspage="http://www.apple.com/quicktime/download/" />
</object>${6}
snippet ol
<ol>
${1}
</ol>
snippet ol.
<ol class="${1}>
${2}
</ol>
snippet ol#
<ol id="${1}>
${2}
</ol>
snippet ol+
<ol>
<li>${1}</li>
li+${2}
</ol>
snippet opt
<option value="${1}">${2:$1}</option>
snippet opt+
<option value="${1}">${2:$1}</option>
opt+${3}
snippet optt
<option>${1}</option>
snippet optgroup
<optgroup>
<option value="${1}">${2:$1}</option>
opt+${3}
</optgroup>
snippet output
<output>${1}</output>
snippet p
<p>${1}</p>
snippet param
<param name="${1}" value="${2}" />${3}
snippet pre
<pre>
${1}
</pre>
snippet progress
<progress>${1}</progress>
snippet q
<q>${1}</q>
snippet rp
<rp>${1}</rp>
snippet rt
<rt>${1}</rt>
snippet ruby
<ruby>
<rp><rt>${1}</rt></rp>
</ruby>
snippet s
<s>${1}</s>
snippet samp
<samp>
${1}
</samp>
snippet script
<script type="text/javascript" charset="utf-8">
${1}
</script>
snippet scriptsrc
<script src="${1}.js" type="text/javascript" charset="utf-8"></script>
snippet section
<section>
${1}
</section>
snippet section.
<section class="${1}">
${2}
</section>
snippet section#
<section id="${1}">
${2}
</section>
snippet select
<select name="${1}" id="${2:$1}">
${3}
</select>
snippet select.
<select name="${1}" id="${2:$1}" class="${3}>
${4}
</select>
snippet select+
<select name="${1}" id="${2:$1}">
<option value="${3}">${4:$3}</option>
opt+${5}
</select>
snippet small
<small>${1}</small>
snippet source
<source src="${1}" type="${2}" media="${3}" />
snippet span
<span>${1}</span>
snippet strong
<strong>${1}</strong>
snippet style
<style type="text/css" media="${1:all}">
${2}
</style>
snippet sub
<sub>${1}</sub>
snippet summary
<summary>
${1}
</summary>
snippet sup
<sup>${1}</sup>
snippet table
<table border="${1:0}">
${2}
</table>
snippet table.
<table class="${1}" border="${2:0}">
${3}
</table>
snippet table#
<table id="${1}" border="${2:0}">
${3}
</table>
snippet tbody
<tbody>
${1}
</tbody>
snippet td
<td>${1}</td>
snippet td.
<td class="${1}">${2}</td>
snippet td#
<td id="${1}">${2}</td>
snippet td+
<td>${1}</td>
td+${2}
snippet textarea
<textarea name="${1}" id=${2:$1} rows="${3:8}" cols="${4:40}">${5}</textarea>${6}
snippet tfoot
<tfoot>
${1}
</tfoot>
snippet th
<th>${1}</th>
snippet th.
<th class="${1}">${2}</th>
snippet th#
<th id="${1}">${2}</th>
snippet th+
<th>${1}</th>
th+${2}
snippet thead
<thead>
${1}
</thead>
snippet time
<time datetime="${1}" pubdate="${2:$1}>${3:$1}</time>
snippet title
<title>${1:`substitute(Filename('', 'Page Title'), '^.', '\u&', '')`}</title>
snippet tr
<tr>
${1}
</tr>
snippet tr+
<tr>
<td>${1}</td>
td+${2}
</tr>
snippet track
<track src="${1}" srclang="${2}" label="${3}" default="${4:default}>${5}</track>${6}
snippet ul
<ul>
${1}
</ul>
snippet ul.
<ul class="${1}">
${2}
</ul>
snippet ul#
<ul id="${1}">
${2}
</ul>
snippet ul+
<ul>
<li>${1}</li>
li+${2}
</ul>
snippet var
<var>${1}</var>
snippet video
<video src="${1} height="${2}" width="${3}" preload="${5:none}" autoplay="${6:autoplay}>${7}</video>${8}
snippet wbr
<wbr />${1}

View file

@ -0,0 +1,136 @@
# Generic tags
snippet %
{% ${1} %}${2}
snippet %%
{% ${1:tag_name} %}
${2}
{% end$1 %}
snippet {
{{ ${1} }}${2}
# Template Tags
snippet autoescape
{% autoescape ${1:off} %}
${2}
{% endautoescape %}
snippet block
{% block ${1} %}
${2}
{% endblock %}
snippet #
{# ${1:comment} #}
snippet comment
{% comment %}
${1}
{% endcomment %}
snippet cycle
{% cycle ${1:val1} ${2:val2} ${3:as ${4}} %}
snippet debug
{% debug %}
snippet extends
{% extends "${1:base.html}" %}
snippet filter
{% filter ${1} %}
${2}
{% endfilter %}
snippet firstof
{% firstof ${1} %}
snippet for
{% for ${1} in ${2} %}
${3}
{% endfor %}
snippet empty
{% empty %}
${1}
snippet if
{% if ${1} %}
${2}
{% endif %}
snippet else
{% else %}
${1}
snippet ifchanged
{% ifchanged %}${1}{% endifchanged %}
snippet ifequal
{% ifequal ${1} ${2} %}
${3}
{% endifequal %}
snippet ifnotequal
{% ifnotequal ${1} ${2} %}
${3}
{% endifnotequal %}
snippet include
{% include "${1}" %}
snippet load
{% load ${1} %}
snippet now
{% now "${1:jS F Y H:i}" %}
snippet regroup
{% regroup ${1} by ${2} as ${3} %}
snippet spaceless
{% spaceless %}${1}{% endspaceless %}
snippet ssi
{% ssi ${1} %}
snippet trans
{% trans "${1:string}" %}
snippet url
{% url ${1} as ${2} %}
snippet widthratio
{% widthratio ${1:this_value} ${2:max_value} ${3:100} %}
snippet with
{% with ${1} as ${2} %}
# Template Filters
# Note: Since SnipMate can't determine which template filter you are
# expanding without the "|" character, these do not add the "|"
# character. These save a few keystrokes still.
# Note: Template tags that take no arguments are not implemented.
snippet add
add:"${1}"
snippet center
center:"${1}"
snippet cut
cut:"${1}"
snippet date
date:"${1}"
snippet default
default:"${1}"
snippet defaultifnone
default_if_none:"${1}"
snippet dictsort
dictsort:"${1}"
snippet dictsortrev
dictsortreversed:"${1}"
snippet divisibleby
divisibleby:"${1}"
snippet floatformat
floatformat:"${1}"
snippet getdigit
get_digit:"${1}"
snippet join
join:"${1}"
snippet lengthis
length_is:"${1}"
snippet pluralize
pluralize:"${1}"
snippet removetags
removetags:"${1}"
snippet slice
slice:"${1}"
snippet stringformat
stringformat:"${1}"
snippet time
time:"${1}"
snippet truncatewords
truncatewords:${1}
snippet truncatewordshtml
truncatewords_html:${1}
snippet urlizetrunc
urlizetrunc:${1}
snippet wordwrap
wordwrap:${1}

View file

@ -0,0 +1,55 @@
# Generic tags
snippet {
{{ ${1} }}
# Template tags
snippet extends
{% extends "${1:base.html}" %}
snippet autoescape
{% autoescape ${1:xhtml_escape | None} %}
snippet apply
{% apply ${1:function} %}
${2}
{% end %}
snippet block
{% block ${1} %}
${2}
{% end %}
snippet for
{% for ${1:item} in ${2} %}
${3}
{% end %}
snippet from
{% from ${1:x} import ${2:y} %}
snippet if
{% if ${1:condition} %}
${2}
{% end %}
snippet elif
{% elif ${1:condition} %}
snippet else
{% else %}
snippet import
{% import ${1:module} %}
snippet include
{% include "${1:filename}" %}
snippet module
{% module ${1:expression} %}
snippet raw
{% raw ${1:expression} %}
snippet set
{% set ${1:x} = ${2:y} %}
snippet try
{% try %}
${1}
{% except %}
${2}
{% finallly %}
${3}
{% end %}
snippet while
{% while ${1:condition} %}
${2}
{% end %}

View file

@ -0,0 +1,240 @@
## Access Modifiers
snippet po
protected
snippet pu
public
snippet pr
private
##
## Annotations
snippet before
@Before
static void ${1:intercept}(${2:args}) { ${3} }
snippet mm
@ManyToMany
${1}
snippet mo
@ManyToOne
${1}
snippet om
@OneToMany${1:(cascade=CascadeType.ALL)}
${2}
snippet oo
@OneToOne
${1}
##
## Basic Java packages and import
snippet im
import
snippet j.b
java.beans.
snippet j.i
java.io.
snippet j.m
java.math.
snippet j.n
java.net.
snippet j.u
java.util.
##
## Class
snippet cl
class ${1:`Filename("", "untitled")`} ${2}
snippet in
interface ${1:`Filename("", "untitled")`} ${2:extends Parent}${3}
snippet tc
public class ${1:`Filename()`} extends ${2:TestCase}
##
## Class Enhancements
snippet ext
extends
snippet imp
implements
##
## Comments
snippet /*
/*
* ${1}
*/
##
## Constants
snippet co
static public final ${1:String} ${2:var} = ${3};${4}
snippet cos
static public final String ${1:var} = "${2}";${3}
##
## Control Statements
snippet case
case ${1}:
${2}
snippet def
default:
${2}
snippet el
else
snippet elif
else if (${1}) ${2}
snippet if
if (${1}) ${2}
snippet sw
switch (${1}) {
${2}
}
##
## Create a Method
snippet m
${1:void} ${2:method}(${3}) ${4:throws }${5}
##
## Create a Variable
snippet v
${1:String} ${2:var}${3: = null}${4};${5}
##
## Enhancements to Methods, variables, classes, etc.
snippet ab
abstract
snippet fi
final
snippet st
static
snippet sy
synchronized
##
## Error Methods
snippet err
System.err.print("${1:Message}");
snippet errf
System.err.printf("${1:Message}", ${2:exception});
snippet errln
System.err.println("${1:Message}");
##
## Exception Handling
snippet as
assert ${1:test} : "${2:Failure message}";${3}
snippet ca
catch(${1:Exception} ${2:e}) ${3}
snippet thr
throw
snippet ths
throws
snippet try
try {
${3}
} catch(${1:Exception} ${2:e}) {
}
snippet tryf
try {
${3}
} catch(${1:Exception} ${2:e}) {
} finally {
}
##
## Find Methods
snippet findall
List<${1:listName}> ${2:items} = ${1}.findAll();${3}
snippet findbyid
${1:var} ${2:item} = ${1}.findById(${3});${4}
##
## Javadocs
snippet /**
/**
* ${1}
*/
snippet @au
@author `system("grep \`id -un\` /etc/passwd | cut -d \":\" -f5")`
snippet @br
@brief ${1:Description}
snippet @fi
@file ${1:`Filename()`}.java
snippet @pa
@param ${1:param}
snippet @re
@return ${1:param}
##
## Logger Methods
snippet debug
Logger.debug(${1:param});${2}
snippet error
Logger.error(${1:param});${2}
snippet info
Logger.info(${1:param});${2}
snippet warn
Logger.warn(${1:param});${2}
##
## Loops
snippet enfor
for (${1} : ${2}) ${3}
snippet for
for (${1}; ${2}; ${3}) ${4}
snippet wh
while (${1}) ${2}
##
## Main method
snippet main
public static void main (String[] args) {
${1:/* code */}
}
##
## Print Methods
snippet print
System.out.print("${1:Message");
snippet printf
System.out.printf("${1:Message", ${2:args});
snippet println
System.out.println(${1});
##
## Render Methods
snippet ren
render(${1:param});${2}
snippet rena
renderArgs.put("${1}", ${2});${3}
snippet renb
renderBinary(${1:param});${2}
snippet renj
renderJSON(${1:param});${2}
snippet renx
renderXml(${1:param});${2}
##
## Setter and Getter Methods
snippet set
${1:public} void set${3:}(${2:String} ${4:}){
this.$4 = $4;
}
snippet get
${1:public} ${2:String} get${3:}(){
return this.${4:};
}
##
## Terminate Methods or Loops
snippet re
return
snippet br
break;
##
## Test Methods
snippet t
public void test${1:Name}() throws Exception {
${2}
}
snippet test
@Test
public void test${1:Name}() throws Exception {
${2}
}
##
## Utils
snippet Sc
Scanner
##
## Miscellaneous
snippet action
public static void ${1:index}(${2:args}) { ${3} }
snippet rnf
notFound(${1:param});${2}
snippet rnfin
notFoundIfNull(${1:param});${2}
snippet rr
redirect(${1:param});${2}
snippet ru
unauthorized(${1:param});${2}
snippet unless
(unless=${1:param});${2}

View file

@ -0,0 +1,589 @@
snippet add
${1:obj}.add('${2:selector expression}')${3}
snippet addClass
${1:obj}.addClass('${2:class name}')${3}
snippet after
${1:obj}.after('${2:Some text <b>and bold!</b>}')${3}
snippet ajax
$.ajax({
url: '${1:mydomain.com/url}',
type: '${2:POST}',
dataType: '${3:xml/html/script/json}',
data: $.param( $('${4:Element or Expression}') ),
complete: function (jqXHR, textStatus) {
${5:// callback}
},
success: function (data, textStatus, jqXHR) {
${6:// success callback}
},
error: function (jqXHR, textStatus, errorThrown) {
${7:// error callback}
}
});
snippet ajaxcomplete
${1:obj}.ajaxComplete(function (${1:e}, xhr, settings) {
${2:// callback}
});
snippet ajaxerror
${1:obj}.ajaxError(function (${1:e}, xhr, settings, thrownError) {
${2:// error callback}
});
${3}
snippet ajaxget
$.get('${1:mydomain.com/url}',
${2:{ param1: value1 },}
function (data, textStatus, jqXHR) {
${3:// success callback}
}
);
snippet ajaxpost
$.post('${1:mydomain.com/url}',
${2:{ param1: value1 },}
function (data, textStatus, jqXHR) {
${3:// success callback}
}
);
snippet ajaxprefilter
$.ajaxPrefilter(function (${1:options}, ${2:originalOptions}, jqXHR) {
${3: // Modify options, control originalOptions, store jqXHR, etc}
});
snippet ajaxsend
${1:obj}.ajaxSend(function (${1:request, settings}) {
${2:// error callback}
});
${3}
snippet ajaxsetup
$.ajaxSetup({
url: "${1:mydomain.com/url}",
type: "${2:POST}",
dataType: "${3:xml/html/script/json}",
data: $.param( $("${4:Element or Expression}") ),
complete: function (jqXHR, textStatus) {
${5:// callback}
},
success: function (data, textStatus, jqXHR) {
${6:// success callback}
},
error: function (jqXHR, textStatus, errorThrown) {
${7:// error callback}
}
});
snippet ajaxstart
$.ajaxStart(function () {
${1:// handler for when an AJAX call is started and no other AJAX calls are in progress};
});
${2}
snippet ajaxstop
$.ajaxStop(function () {
${1:// handler for when all AJAX calls have been completed};
});
${2}
snippet ajaxsuccess
$.ajaxSuccess(function (${1:e}, xhr, settings) {
${2:// handler for when any AJAX call is successfully completed};
});
${2}
snippet andself
${1:obj}.andSelf()${2}
snippet animate
${1:obj}.animate({${2:param1: value1, param2: value2}}, ${3:speed})${4}
snippet append
${1:obj}.append('${2:Some text <b>and bold!</b>}')${3}
snippet appendTo
${1:obj}.appendTo('${2:selector expression}')${3}
snippet attr
${1:obj}.attr('${2:attribute}', '${3:value}')${4}
snippet attrm
${1:obj}.attr({'${2:attr1}': '${3:value1}', '${4:attr2}': '${5:value2}'})${6}
snippet before
${1:obj}.before('${2:Some text <b>and bold!</b>}')${3}
snippet bind
${1:obj}.bind('${2:event name}', function (${3:e}) {
${4:// event handler}
});
snippet blur
${1:obj}.blur(function (${2:e}) {
${3:// event handler}
});
snippet C
$.Callbacks()${1}
snippet Cadd
${1:callbacks}.add(${2:callbacks})${3}
snippet Cdis
${1:callbacks}.disable()${2}
snippet Cempty
${1:callbacks}.empty()${2}
snippet Cfire
${1:callbacks}.fire(${2:args})${3}
snippet Cfired
${1:callbacks}.fired()${2}
snippet Cfirew
${1:callbacks}.fireWith(${2:this}, ${3:args})${4}
snippet Chas
${1:callbacks}.has(${2:callback})${3}
snippet Clock
${1:callbacks}.lock()${2}
snippet Clocked
${1:callbacks}.locked()${2}
snippet Crem
${1:callbacks}.remove(${2:callbacks})${3}
snippet change
${1:obj}.change(function (${2:e}) {
${3:// event handler}
});
snippet children
${1:obj}.children('${2:selector expression}')${3}
snippet clearq
${1:obj}.clearQueue(${2:'queue name'})${3}
snippet click
${1:obj}.click(function (${2:e}) {
${3:// event handler}
});
snippet clone
${1:obj}.clone()${2}
snippet contains
$.contains(${1:container}, ${2:contents});
snippet css
${1:obj}.css('${2:attribute}', '${3:value}')${4}
snippet csshooks
$.cssHooks['${1:CSS prop}'] = {
get: function (elem, computed, extra) {
${2: // handle getting the CSS property}
},
set: function (elem, value) {
${3: // handle setting the CSS value}
}
};
snippet cssm
${1:obj}.css({${2:attribute1}: '${3:value1}', ${4:attribute2}: '${5:value2}'})${6}
snippet D
$.Deferred()${1}
snippet Dalways
${1:deferred}.always(${2:callbacks})${3}
snippet Ddone
${1:deferred}.done(${2:callbacks})${3}
snippet Dfail
${1:deferred}.fail(${2:callbacks})${3}
snippet Disrej
${1:deferred}.isRejected()${2}
snippet Disres
${1:deferred}.isResolved()${2}
snippet Dnotify
${1:deferred}.notify(${2:args})${3}
snippet Dnotifyw
${1:deferred}.notifyWith(${2:this}, ${3:args})${4}
snippet Dpipe
${1:deferred}.then(${2:doneFilter}, ${3:failFilter}, ${4:progressFilter})${5}
snippet Dprog
${1:deferred}.progress(${2:callbacks})${3}
snippet Dprom
${1:deferred}.promise(${2:target})${3}
snippet Drej
${1:deferred}.reject(${2:args})${3}
snippet Drejw
${1:deferred}.rejectWith(${2:this}, ${3:args})${4}
snippet Dres
${1:deferred}.resolve(${2:args})${3}
snippet Dresw
${1:deferred}.resolveWith(${2:this}, ${3:args})${4}
snippet Dstate
${1:deferred}.state()${2}
snippet Dthen
${1:deferred}.then(${2:doneCallbacks}, ${3:failCallbacks}, ${4:progressCallbacks})${5}
snippet Dwhen
$.when(${1:deferreds})${2}
snippet data
${1:obj}.data(${2:obj})${3}
snippet dataa
$.data('${1:selector expression}', '${2:key}'${3:, 'value'})${4}
snippet dblclick
${1:obj}.dblclick(function (${2:e}) {
${3:// event handler}
});
snippet delay
${1:obj}.delay('${2:slow/400/fast}'${3:, 'queue name'})${4}
snippet dele
${1:obj}.delegate('${2:selector expression}', '${3:event name}', function (${4:e}) {
${5:// event handler}
});
snippet deq
${1:obj}.dequeue(${2:'queue name'})${3}
snippet deqq
$.dequeue('${1:selector expression}'${2:, 'queue name'})${3}
snippet detach
${1:obj}.detach('${2:selector expression}')${3}
snippet die
${1:obj}.die(${2:event}, ${3:handler})${4}
snippet each
${1:obj}.each(function (index) {
${2:this.innerHTML = this + " is the element, " + index + " is the position";}
});
snippet el
$('<${1}/>'${2:, {}})${3}
snippet eltrim
$.trim('${1:string}')${2}
snippet empty
${1:obj}.empty()${2}
snippet end
${1:obj}.end()${2}
snippet eq
${1:obj}.eq(${2:element index})${3}
snippet error
${1:obj}.error(function (${2:e}) {
${3:// event handler}
});
snippet eventsmap
{
:f${1}
}
snippet extend
$.extend(${1:true, }${2:target}, ${3:obj})${4}
snippet fadein
${1:obj}.fadeIn('${2:slow/400/fast}')${3}
snippet fadeinc
${1:obj}.fadeIn('slow/400/fast', function () {
${2:// callback};
});
snippet fadeout
${1:obj}.fadeOut('${2:slow/400/fast}')${3}
snippet fadeoutc
${1:obj}.fadeOut('slow/400/fast', function () {
${2:// callback};
});
snippet fadeto
${1:obj}.fadeTo('${2:slow/400/fast}', ${3:0.5})${4}
snippet fadetoc
${1:obj}.fadeTo('slow/400/fast', ${2:0.5}, function () {
${3:// callback};
});
snippet filter
${1:obj}.filter('${2:selector expression}')${3}
snippet filtert
${1:obj}.filter(function (${2:index}) {
${3:// test code}
})${4}
snippet find
${1:obj}.find('${2:selector expression}')${3}
snippet focus
${1:obj}.focus(function (${2:e}) {
${3:// event handler}
});
snippet focusin
${1:obj}.focusIn(function (${2:e}) {
${3:// event handler}
});
snippet focusout
${1:obj}.focusOut(function (${2:e}) {
${3:// event handler}
});
snippet get
${1:obj}.get(${2:element index})${3}
snippet getjson
$.getJSON('${1:mydomain.com/url}',
${2:{ param1: value1 },}
function (data, textStatus, jqXHR) {
${3:// success callback}
}
);
snippet getscript
$.getScript('${1:mydomain.com/url}', function (script, textStatus, jqXHR) {
${2:// callback}
});
snippet grep
$.grep(${1:array}, function (item, index) {
${2:// test code}
}${3:, true});
snippet hasc
${1:obj}.hasClass('${2:className}')${3}
snippet hasd
$.hasData('${1:selector expression}');
snippet height
${1:obj}.height(${2:integer})${3}
snippet hide
${1:obj}.hide('${2:slow/400/fast}')${3}
snippet hidec
${1:obj}.hide('${2:slow/400/fast}', function () {
${3:// callback}
});
snippet hover
${1:obj}.hover(function (${2:e}) {
${3:// event handler}
}, function ($2) {
${4:// event handler}
});${5}
snippet html
${1:obj}.html('${2:Some text <b>and bold!</b>}')${3}
snippet inarr
$.inArray(${1:value}, ${2:array});
snippet insa
${1:obj}.insertAfter('${2:selector expression}')${3}
snippet insb
${1:obj}.insertBefore('${2:selector expression}')${3}
snippet is
${1:obj}.is('${2:selector expression}')${3}
snippet isarr
$.isArray(${1:obj})${2}
snippet isempty
$.isEmptyObject(${1:obj})${2}
snippet isfunc
$.isFunction(${1:obj})${2}
snippet isnum
$.isNumeric(${1:value})${2}
snippet isobj
$.isPlainObject(${1:obj})${2}
snippet iswin
$.isWindow(${1:obj})${2}
snippet isxml
$.isXMLDoc(${1:node})${2}
snippet jj
$('${1:selector}')${2}
snippet kdown
${1:obj}.keydown(function (${2:e}) {
${3:// event handler}
});
snippet kpress
${1:obj}.keypress(function (${2:e}) {
${3:// event handler}
});
snippet kup
${1:obj}.keyup(function (${2:e}) {
${3:// event handler}
});
snippet last
${1:obj}.last('${1:selector expression}')${3}
snippet live
${1:obj}.live('${2:events}', function (${3:e}) {
${4:// event handler}
});
snippet load
${1:obj}.load(function (${2:e}) {
${3:// event handler}
});
snippet loadf
${1:obj}.load('${2:mydomain.com/url}',
${2:{ param1: value1 },}
function (responseText, textStatus, xhr) {
${3:// success callback}
}
});
snippet makearray
$.makeArray(${1:obj});
snippet map
${1:obj}.map(function (${2:index}, ${3:element}) {
${4:// callback}
});
snippet mapp
$.map(${1:arrayOrObject}, function (${2:value}, ${3:indexOrKey}) {
${4:// callback}
});
snippet merge
$.merge(${1:target}, ${2:original});
snippet mdown
${1:obj}.mousedown(function (${2:e}) {
${3:// event handler}
});
snippet menter
${1:obj}.mouseenter(function (${2:e}) {
${3:// event handler}
});
snippet mleave
${1:obj}.mouseleave(function (${2:e}) {
${3:// event handler}
});
snippet mmove
${1:obj}.mousemove(function (${2:e}) {
${3:// event handler}
});
snippet mout
${1:obj}.mouseout(function (${2:e}) {
${3:// event handler}
});
snippet mover
${1:obj}.mouseover(function (${2:e}) {
${3:// event handler}
});
snippet mup
${1:obj}.mouseup(function (${2:e}) {
${3:// event handler}
});
snippet next
${1:obj}.next('${2:selector expression}')${3}
snippet nexta
${1:obj}.nextAll('${2:selector expression}')${3}
snippet nextu
${1:obj}.nextUntil('${2:selector expression}'${3:, 'filter expression'})${4}
snippet not
${1:obj}.not('${2:selector expression}')${3}
snippet off
${1:obj}.off('${2:events}', '${3:selector expression}'${4:, handler})${5}
snippet offset
${1:obj}.offset()${2}
snippet offsetp
${1:obj}.offsetParent()${2}
snippet on
${1:obj}.on('${2:events}', '${3:selector expression}', function (${4:e}) {
${5:// event handler}
});
snippet one
${1:obj}.one('${2:event name}', function (${3:e}) {
${4:// event handler}
});
snippet outerh
${1:obj}.outerHeight()${2}
snippet outerw
${1:obj}.outerWidth()${2}
snippet param
$.param(${1:obj})${2}
snippet parent
${1:obj}.parent('${2:selector expression}')${3}
snippet parents
${1:obj}.parents('${2:selector expression}')${3}
snippet parentsu
${1:obj}.parentsUntil('${2:selector expression}'${3:, 'filter expression'})${4}
snippet parsejson
$.parseJSON(${1:data})${2}
snippet parsexml
$.parseXML(${1:data})${2}
snippet pos
${1:obj}.position()${2}
snippet prepend
${1:obj}.prepend('${2:Some text <b>and bold!</b>}')${3}
snippet prependto
${1:obj}.prependTo('${2:selector expression}')${3}
snippet prev
${1:obj}.prev('${2:selector expression}')${3}
snippet preva
${1:obj}.prevAll('${2:selector expression}')${3}
snippet prevu
${1:obj}.prevUntil('${2:selector expression}'${3:, 'filter expression'})${4}
snippet promise
${1:obj}.promise(${2:'fx'}, ${3:target})${4}
snippet prop
${1:obj}.prop('${2:property name}')${3}
snippet proxy
$.proxy(${1:function}, ${2:this})${3}
snippet pushstack
${1:obj}.pushStack(${2:elements})${3}
snippet queue
${1:obj}.queue(${2:name}${3:, newQueue})${4}
snippet queuee
$.queue(${1:element}${2:, name}${3:, newQueue})${4}
snippet ready
$(function () {
${1}
});
snippet rem
${1:obj}.remove()${2}
snippet rema
${1:obj}.removeAttr('${2:attribute name}')${3}
snippet remc
${1:obj}.removeClass('${2:class name}')${3}
snippet remd
${1:obj}.removeData('${2:key name}')${3}
snippet remdd
$.removeData(${1:element}${2:, 'key name}')${3}
snippet remp
${1:obj}.removeProp('${2:property name}')${3}
snippet repa
${1:obj}.replaceAll(${2:target})${3}
snippet repw
${1:obj}.replaceWith(${2:content})${3}
snippet reset
${1:obj}.reset(function (${2:e}) {
${3:// event handler}
});
snippet resize
${1:obj}.resize(function (${2:e}) {
${3:// event handler}
});
snippet scroll
${1:obj}.scroll(function (${2:e}) {
${3:// event handler}
});
snippet scrolll
${1:obj}.scrollLeft(${2:value})${3}
snippet scrollt
${1:obj}.scrollTop(${2:value})${3}
snippet sdown
${1:obj}.slideDown('${2:slow/400/fast}')${3}
snippet sdownc
${1:obj}.slideDown('${2:slow/400/fast}', function () {
${3:// callback};
});
snippet select
${1:obj}.select(function (${2:e}) {
${3:// event handler}
});
snippet serialize
${1:obj}.serialize()${2}
snippet serializea
${1:obj}.serializeArray()${2}
snippet show
${1:obj}.show('${2:slow/400/fast}')${3}
snippet showc
${1:obj}.show('${2:slow/400/fast}', function () {
${3:// callback}
});
snippet sib
${1:obj}.siblings('${2:selector expression}')${3}
snippet size
${1:obj}.size()${2}
snippet slice
${1:obj}.slice(${2:start}${3:, end})${4}
snippet stoggle
${1:obj}.slideToggle('${2:slow/400/fast}')${3}
snippet stop
${1:obj}.stop('${2:queue}', ${3:false}, ${4:false})${5}
snippet submit
${1:obj}.submit(function (${2:e}) {
${3:// event handler}
});
snippet sup
${1:obj}.slideUp('${2:slow/400/fast}')${3}
snippet supc
${1:obj}.slideUp('${2:slow/400/fast}', function () {
${3:// callback};
});
snippet text
${1:obj}.text(${2:'some text'})${3}
snippet this
$(this)${1}
snippet toarr
${1:obj}.toArray()
snippet tog
${1:obj}.toggle(function (${2:e}) {
${3:// event handler}
}, function ($2) {
${4:// event handler}
});
${4}
snippet togclass
${1:obj}.toggleClass('${2:class name}')${3}
snippet togsh
${1:obj}.toggle('${2:slow/400/fast}')${3}
snippet trig
${1:obj}.trigger('${2:event name}')${3}
snippet trigh
${1:obj}.triggerHandler('${2:event name}')${3}
snippet $trim
$.trim(${1:str})${2}
snippet $type
$.type(${1:obj})${2}
snippet unbind
${1:obj}.unbind('${2:event name}')${3}
snippet undele
${1:obj}.undelegate(${2:selector expression}, ${3:event}, ${4:handler})${5}
snippet uniq
$.unique(${1:array})${2}
snippet unload
${1:obj}.unload(function (${2:e}) {
${3:// event handler}
});
snippet unwrap
${1:obj}.unwrap()${2}
snippet val
${1:obj}.val('${2:text}')${3}
snippet width
${1:obj}.width(${2:integer})${3}
snippet wrap
${1:obj}.wrap('${2:&lt;div class="extra-wrapper"&gt;&lt;/div&gt;}')${3}

View file

@ -0,0 +1,156 @@
# 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}) {
${3}
}${2:;}
# Immediate function
snippet (f
(function(${1}) {
${3:/* code */}
}(${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: += 1}) {
${4:$1[$2]}
}
# for (...) {...} (Improved Native For-Loop)
snippet forr
for (var ${2:i} = ${1:Things}.length - 1; $2 >= 0; $2${3: -= 1}) {
${4:$1[$2]}
}
# while (...) {...}
snippet wh
while (${1:/* condition */}) {
${2:/* code */}
}
# try
snippet try
try {
${1:/* code */}
} catch(${2:e}) {
${3:/* handle error */}
}
# 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}
# console.log (Firebug)
snippet cl
console.log(${1});
# return
snippet ret
return ${1:result}
# for (property in object ) { ... }
snippet fori
for (var ${1:prop} in ${2:Things}) {
${3:$2[$1]}
}
# hasOwnProperty
snippet has
hasOwnProperty(${1})
# docstring
snippet /**
/**
* ${1:description}
*
*/
snippet @par
@param {${1:type}} ${2:name} ${3:description}
snippet @ret
@return {${1:type}} ${2:description}
# JSON.parse
snippet jsonp
JSON.parse(${1:jstr});
# JSON.stringify
snippet jsons
JSON.stringify(${1:object});
# self-defining function
snippet sdf
var ${1:function_name} = function (${2:argument}) {
${3:// initial code ...}
$1 = function ($2) {
${4:// main code}
};
}
# singleton
snippet sing
function ${1:Singleton} (${2:argument}) {
// the cached instance
var instance;
// rewrite the constructor
$1 = function $1($2) {
return instance;
};
// carry over the prototype properties
$1.prototype = this;
// the instance
instance = new $1();
// reset the constructor pointer
instance.constructor = $1;
${3:// code ...}
return instance;
}

View file

@ -0,0 +1,99 @@
snippet @page
<%@page contentType="text/html" pageEncoding="UTF-8"%>
snippet jstl
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
snippet jstl:c
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
snippet jstl:fn
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
snippet cpath
${pageContext.request.contextPath}
snippet cout
<c:out value="${1}" default="${2}" />
snippet cset
<c:set var="${1}" value="${2}" />
snippet cremove
<c:remove var="${1}" scope="${2:page}" />
snippet ccatch
<c:catch var="${1}" />
snippet cif
<c:if test="${${1}}">
${2}
</c:if>
snippet cchoose
<c:choose>
${1}
</c:choose>
snippet cwhen
<c:when test="${${1}}">
${2}
</c:when>
snippet cother
<c:otherwise>
${1}
</c:otherwise>
snippet cfore
<c:forEach items="${${1}}" var="${2}" varStatus="${3}">
${4:<c:out value="$2" />}
</c:forEach>
snippet cfort
<c:set var="${1}">${2:item1,item2,item3}</c:set>
<c:forTokens var="${3}" items="${$1}" delims="${4:,}">
${5:<c:out value="$3" />}
</c:forTokens>
snippet cparam
<c:param name="${1}" value="${2}" />
snippet cparam+
<c:param name="${1}" value="${2}" />
cparam+${3}
snippet cimport
<c:import url="${1}" />
snippet cimport+
<c:import url="${1}">
<c:param name="${2}" value="${3}" />
cparam+${4}
</c:import>
snippet curl
<c:url value="${1}" var="${2}" />
<a href="${$2}">${3}</a>
snippet curl+
<c:url value="${1}" var="${2}">
<c:param name="${4}" value="${5}" />
cparam+${6}
</c:url>
<a href="${$2}">${3}</a>
snippet credirect
<c:redirect url="${1}" />
snippet contains
${fn:contains(${1:string}, ${2:substr})}
snippet contains:i
${fn:containsIgnoreCase(${1:string}, ${2:substr})}
snippet endswith
${fn:endsWith(${1:string}, ${2:suffix})}
snippet escape
${fn:escapeXml(${1:string})}
snippet indexof
${fn:indexOf(${1:string}, ${2:substr})}
snippet join
${fn:join(${1:collection}, ${2:delims})}
snippet length
${fn:length(${1:collection_or_string})}
snippet replace
${fn:replace(${1:string}, ${2:substr}, ${3:replace})}
snippet split
${fn:split(${1:string}, ${2:delims})}
snippet startswith
${fn:startsWith(${1:string}, ${2:prefix})}
snippet substr
${fn:substring(${1:string}, ${2:begin}, ${3:end})}
snippet substr:a
${fn:substringAfter(${1:string}, ${2:substr})}
snippet substr:b
${fn:substringBefore(${1:string}, ${2:substr})}
snippet lc
${fn:toLowerCase(${1:string})}
snippet uc
${fn:toUpperCase(${1:string})}
snippet trim
${fn:trim(${1:string})}

View file

@ -0,0 +1,21 @@
snippet #!
#!/usr/bin/env lua
$1
snippet local
local ${1:x} = ${2:1}
snippet fun
function ${1:fname}(${2:...})
${3:-- body}
end
snippet for
for ${1:i}=${2:1},${3:10} do
${4:print(i)}
end
snippet forp
for ${1:i},${2:v} in pairs(${3:table_name}) do
${4:-- body}
end
snippet fori
for ${1:i},${2:v} in ipairs(${3:table_name}) do
${4:-- body}
end

View file

@ -0,0 +1,4 @@
snippet ifeq
ifeq (${1:cond0},${2:cond1})
${3:code}
endif

View file

@ -0,0 +1,54 @@
snippet def
<%def name="${1:name}">
${2:}
</%def>
snippet call
<%call expr="${1:name}">
${2:}
</%call>
snippet doc
<%doc>
${1:}
</%doc>
snippet text
<%text>
${1:}
</%text>
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 <!%
<!% ${1:} %>
snippet inherit
<%inherit file="${1:filename}" />
snippet include
<%include file="${1:filename}" />
snippet namespace
<%namespace file="${1:name}" />
snippet page
<%page args="${1:}" />

View file

@ -0,0 +1,87 @@
# Markdown
# Includes octopress (http://octopress.org/) snippets
snippet [
[${1:text}](http://${2:address} "${3:title}")
snippet [*
[${1:link}](${2:`@*`} "${3:title}")${4}
snippet [:
[${1:id}]: http://${2:url} "${3:title}"
snippet [:*
[${1:id}]: ${2:`@*`} "${3:title}"
snippet ![
![${1:alttext}](${2:/images/image.jpg} "${3:title}")
snippet ![*
![${1:alt}](${2:`@*`} "${3:title}")${4}
snippet ![:
![${1:id}]: ${2:url} "${3:title}"
snippet ![:*
![${1:id}]: ${2:`@*`} "${3:title}"
snippet ===
`repeat('=', strlen(getline(line(".") - 1)))`
${1}
snippet ---
`repeat('-', strlen(getline(line(".") - 1)))`
${1}
snippet blockquote
{% blockquote %}
${1:quote}
{% endblockquote %}
snippet blockquote-author
{% blockquote ${1:author}, ${2:title} %}
${3:quote}
{% endblockquote %}
snippet blockquote-link
{% blockquote ${1:author} ${2:URL} ${3:link_text} %}
${4:quote}
{% endblockquote %}
snippet bt-codeblock-short
```
${1:code_snippet}
```
snippet bt-codeblock-full
``` ${1:language} ${2:title} ${3:URL} ${4:link_text}
${5:code_snippet}
```
snippet codeblock-short
{% codeblock %}
${1:code_snippet}
{% endcodeblock %}
snippet codeblock-full
{% codeblock ${1:title} lang:${2:language} ${3:URL} ${4:link_text} %}
${5:code_snippet}
{% endcodeblock %}
snippet gist-full
{% gist ${1:gist_id} ${2:filename} %}
snippet gist-short
{% gist ${1:gist_id} %}
snippet img
{% img ${1:class} ${2:URL} ${3:width} ${4:height} ${5:title_text} ${6:alt_text} %}
snippet youtube
{% youtube ${1:video_id} %}
# The quote should appear only once in the text. It is inherently part of it.
# See http://octopress.org/docs/plugins/pullquote/ for more info.
snippet pullquote
{% pullquote %}
${1:text} {" ${2:quote} "} ${3:text}
{% endpullquote %}

View file

@ -0,0 +1,247 @@
# #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
snippet @interface
@interface ${1:`Filename('', 'someClass')`} : ${2:NSObject}
{${3}
}
${4}
@end
# Class Implementation
snippet impl
@implementation ${1:`Filename('', 'someClass')`}
${2}
@end
snippet @implementation
@implementation ${1:`Filename('', 'someClass')`}
${2}
@end
# Protocol
snippet pro
@protocol ${1:`Filename('$1Delegate', 'MyProtocol')`} ${2:<NSObject>}
${3}
@end
snippet @protocol
@protocol ${1:`Filename('$1Delegate', 'MyProtocol')`} ${2:<NSObject>}
${3}
@end
# init Definition
snippet init
- (id)init
{
if (self = [super init]) {
${1}
}
return self;
}
# dealloc Definition
snippet dealloc
- (void) dealloc
{
${1:deallocations}
[super dealloc];
}
snippet su
[super ${1:init}]${2}
snippet ibo
IBOutlet ${1:NSSomeClass} *${2:$1};${3}
# Category
snippet cat
@interface ${1:NSObject} (${2:MyCategory})
@end
@implementation $1 ($2)
${3}
@end
# Category Interface
snippet cath
@interface ${1:`Filename('$1', 'NSObject')`} (${2:MyCategory})
${3}
@end
# 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;
}
# 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 fore
for (${1:object} in ${2:array}) {
${3:statements}
}
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}
}
snippet fora
unsigned int ${1:object}Count = [${2:array} count];
for (unsigned int index = 0; index < $1Count; index++) {
${3:id} $1 = [$2 $1AtIndex:index];
${4}
}
# Try / Catch Block
snippet @try
@try {
${1:statements}
}
@catch (NSException * e) {
${2:handler}
}
@finally {
${3:statements}
}
snippet @catch
@catch (${1:exception}) {
${2:handler}
}
snippet @finally
@finally {
${1:statements}
}
# 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}
snippet a
[[${1:foo} alloc] init${2}];${3}
# retain
snippet ret
[${1:foo} retain];${2}
# release
snippet rel
[${1:foo} release];
# 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:-}
snippet cl
@class ${1:Foo};${2}
snippet color
[[NSColor ${1:blackColor}] set];
# NSArray
snippet array
NSMutableArray *${1:array} = [NSMutable array];${2}
snippet nsa
NSArray ${1}
snippet nsma
NSMutableArray ${1}
snippet aa
NSArray * array;${1}
snippet ma
NSMutableArray * array;${1}
# NSDictionary
snippet dict
NSMutableDictionary *${1:dict} = [NSMutableDictionary dictionary];${2}
snippet nsd
NSDictionary ${1}
snippet nsmd
NSMutableDictionary ${1}
# NSString
snippet nss
NSString ${1}
snippet nsms
NSMutableString ${1}

View file

@ -0,0 +1,358 @@
# #!/usr/bin/perl
snippet #!
#!/usr/bin/env 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
local $@;
eval {
${1:# do something risky...}
};
if (my $e = $@) {
${2:# handle failure...}
}
# While Loop
snippet wh
while (${1}) {
${2:# body...}
}
# While Loop One-line
snippet xwh
${1:expression} while ${2:condition};${3}
# C-style For Loop
snippet cfor
for (my $${2:var} = 0; $$2 < ${1:count}; $$2${3:++}) {
${4:# body...}
}
# For loop one-line
snippet xfor
${1:expression} for @${2:array};${3}
# Foreach Loop
snippet for
foreach my $${1:x} (@${2:array}) {
${3:# body...}
}
# Foreach Loop One-line
snippet fore
${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} = do { local $/; open my $file, '<', "${2:file}"; <$file> };
${3}
# strict warnings
snippet strwar
use strict;
use warnings;
# standard versioning with perlcritic bypass
snippet vers
## no critic
our $VERSION = '${1:version}';
eval $VERSION;
## use critic
# new 'switch' like feature
snippet switch
use feature 'switch';
# Anonymous subroutine
snippet asub
sub {
${1:# body }
}
# Begin block
snippet begin
BEGIN {
${1:# begin body}
}
# call package function with some parameter
snippet pkgmv
__PACKAGE__->${1:package_method}(${2:var})
# call package function without a parameter
snippet pkgm
__PACKAGE__->${1:package_method}()
# call package "get_" function without a parameter
snippet pkget
__PACKAGE__->get_${1:package_method}()
# call package function with a parameter
snippet pkgetv
__PACKAGE__->get_${1:package_method}(${2:var})
# complex regex
snippet qrx
qr/
${1:regex}
/xms
#simpler regex
snippet qr/
qr/${1:regex}/x
#given
snippet given
given ($${1:var}) {
${2:# cases}
${3:# default}
}
# switch-like case
snippet when
when (${1:case}) {
${2:# body}
}
# hash slice
snippet hslice
@{ ${1:hash} }{ ${2:array} }
# map
snippet map
map { ${2: body } } ${1: @array } ;
# Pod stub
snippet ppod
=head1 NAME
${1:ClassName} - ${2:ShortDesc}
=head1 SYNOPSIS
use $1;
${3:# synopsis...}
=head1 DESCRIPTION
${4:# longer description...}
=head1 INTERFACE
=head1 DEPENDENCIES
=head1 SEE ALSO
# Heading for a subroutine stub
snippet psub
=head2 ${1:MethodName}
${2:Summary....}
# Heading for inline subroutine pod
snippet psubi
=head2 ${1:MethodName}
${2:Summary...}
=cut
# Subroutine signature
snippet parg
=over 2
=item
Arguments
=over 3
=item
C<${1:DataStructure}>
${2:Sample}
=back
=item
Return
=over 3
=item
C<${3:...return data}>
=back
=back
# Moose package
snippet moosecl
package ${1:ClassName};
use Moose;
#extends '${2:# ParentClass}';
${6:# body of class}
1;
__END__
=head1 NAME
$1 - ${3:ShortDesc}
=head1 SYNOPSIS
${4:# synopsis...}
=head1 DESCRIPTION
${5:# longer description...}
# Moose has
snippet has
has ${1:attribute} => (
is => '${2:ro|rw}',
isa => '${3:Str|Int|HashRef|ArrayRef|etc}',
default => ${4:defaultvalue}
,${5:# other attributes}
);
# override
snippet override
override ${1:attribute} => sub {
${2:# my $self = shift;};
${3:# my ($self,$args) = @_;};
};
# use test classes
snippet tuse
use Test::More;
use Test::Deep ();
use Test::Exception;
# local test lib
snippet tlib
use lib qw{ ./t/lib };
#test methods
snippet tmeths
$ENV{TEST_METHOD} = '${1:regex}';
# runtestclass
snippet trunner
use ${1:test_class};
$1->runtests();
# Test::Class-style test
snippet tsub
sub t${1:number}_${2:test_case} :Test(${3:num_of_tests}) {
my $self = shift;
${4:# body}
}
# Test::Routine-style test
snippet trsub
test ${1:test_name} => { description => '${2:Description of test.}'} => sub {
my ($self) = @_;
${3:# test code}
};
#prep test method
snippet tprep
sub prep${1:number}_${2:test_case} :Test(startup) {
my $self = shift;
${4:# body}
}
# cause failures to print stack trace
snippet debug_trace
use Carp; # 'verbose';
# cloak "die"
# warn "warning"
$SIG{'__DIE__'} = sub {
require Carp; Carp::confess
};

View file

@ -0,0 +1,349 @@
snippet <?
<?php
${1}
snippet ec
echo ${1};
snippet <?e
<?php echo ${1} ?>
# this one is for php5.4
snippet <?=
<?=${1}?>
snippet ns
namespace ${1:Foo\Bar\Baz};
${2}
snippet use
use ${1:Foo\Bar\Baz};
${2}
snippet c
${1:abstract }class ${2:`Filename()`}
{
${3}
}
snippet i
interface ${1:`Filename()`}
{
${2}
}
snippet t.
$this->${1}
snippet f
function ${1:foo}(${2:array }${3:$bar})
{
${4}
}
# method
snippet m
${1:abstract }${2:protected}${3: static} function ${4:foo}(${5:array }${6:$bar})
{
${7}
}
# setter method
# I think vim's functions will not be called at the snipMate's runtime
# but `compile` time
# so `tolower` here won't work
# but it would be wonderful if we could make the property and parameter to lower case
snippet sm
${1:public} function set${2:Foo}(${3:$2 }$${4:`tolower('$2')`})
{
$this->${5:$4} = $$4;
${6}
return $this;
}
# getter method
snippet gm
${1:public} function get${2:Foo}()
{
return $this->${3:$2};
}
#setter
snippet $s
${1:$foo}->set${2:Bar}(${3});
#getter
snippet $g
${1:$foo}->get${2:Bar}();
# Tertiary conditional
snippet =?:
$${1:foo} = ${2:true} ? ${3:a} : ${4};
snippet ?:
${1:true} ? ${2:a} : ${3}
snippet C
$_COOKIE['${1:variable}']${2}
snippet E
$_ENV['${1:variable}']${2}
snippet F
$_FILES['${1:variable}']${2}
snippet G
$_GET['${1:variable}']${2}
snippet P
$_POST['${1:variable}']${2}
snippet R
$_REQUEST['${1:variable}']${2}
snippet S
$_SERVER['${1:variable}']${2}
snippet SS
$_SESSION['${1:variable}']${2}
# the following are old ones
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}
# Start Docblock
snippet /*
/**
* ${1}
*/
# Class - post doc
snippet doc_cp
/**
* ${1:undocumented class}
*
* @package ${2:default}
* @subpackage ${3:default}
* @author ${4:`g:snips_author`}
*/${5}
# 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}
*
* @package ${4:default}
* @subpackage ${5:default}
* @author ${6:`g:snips_author`}
*/
${1:}class ${2:}
{
${7}
} // 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}
*/
# Interface
snippet interface
/**
* ${2:undocumented class}
*
* @package ${3:default}
* @author ${4:`g:snips_author`}
*/
interface ${1:}
{
${5}
}
# class ...
snippet class
/**
* ${1}
*/
class ${2:ClassName}
{
${3}
/**
* ${4}
*/
${5:public} function ${6:__construct}(${7:argument})
{
${8:// 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 ifil
<?php if (${1:/* condition */}): ?>
${2:<!-- code... -->}
<?php endif; ?>
snippet ife
if (${1:/* condition */}) {
${2:// code...}
} else {
${3:// code...}
}
${4}
snippet ifeil
<?php if (${1:/* condition */}): ?>
${2:<!-- html... -->}
<?php else: ?>
${3:<!-- html... -->}
<?php endif; ?>
${4}
snippet else
else {
${1:// code...}
}
snippet elseif
elseif (${1:/* condition */}) {
${2:// code...}
}
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:value}) {
${3:// code...}
}
snippet foreachil
<?php foreach ($${1:variable} as $${2:value}): ?>
${3:<!-- html... -->}
<?php endforeach; ?>
snippet foreachk
foreach ($${1:variable} as $${2:key} => $${3:value}) {
${4:// code...}
}
snippet foreachkil
<?php foreach ($${1:variable} as $${2:key} => $${3:value}): ?>
${4:<!-- html... -->}
<?php endforeach; ?>
# $... = array (...)
snippet array
$${1:arrayName} = array('${2}' => ${3});${4}
snippet try
try {
${2}
} catch (${1:Exception} $e) {
}
# lambda with closure
snippet lambda
${1:static }function (${2:args}) use (${3:&$x, $y /*put vars in scope (closure) */}) {
${4}
};
# pre_dump();
snippet pd
echo '<pre>'; var_dump(${1}); echo '</pre>';
# pre_dump(); die();
snippet pdd
echo '<pre>'; var_dump(${1}); echo '</pre>'; die(${2:});
snippet vd
var_dump(${1});
snippet vdd
var_dump(${1}); die(${2:});
snippet http_redirect
header ("HTTP/1.1 301 Moved Permanently");
header ("Location: ".URL);
exit();
# Getters & Setters
snippet getset
/**
* Gets the value of ${1:}
*
* @return ${2}
*/
public function get$1()
{
return $this->$1;
}
/**
* Sets the value of $1
*
* @param mixed $$1 ${3}
*/
public function set$1($$1)
{
$this->$1 = $$1;
return $this;
}
snippet rett
return true;
snippet retf
return false;

View file

@ -0,0 +1,5 @@
snippet msg
msgid "${1}"
msgstr "${2}"
${3}

View file

@ -0,0 +1,784 @@
#BASICS
# doc
snippet doc
/**
* ${1:Description}
*
* @author ${2:name}
* @since ${3:`strftime("%d/%m/%y %H:%M:%S")`}
*/
${4}
# doc comment
snippet docc
/**
* ${1:@private}$0
*/
${2}
# class
snippet class
${1:public }class ${2:`fnamemodify(bufname("%"),":t:r")`} ${3:extends}
{
//--------------------------------------
// CONSTRUCTOR
//--------------------------------------
public $2 (${4:arguments}) {
${0:// expression}
}
}
# package
snippet package
/**
* ${1:Description}
*
* @author ${2:$TM_FULLNAME}
* @since ${3:`strftime("%d/%m/%y %H:%M:%S")`}
*/
package ${4:package};
# function
snippet fun
${1:void/private/protected/public}${2: static} ${3:name}(${4}) {
${5://if not void return null;}
}
${6}
snippet fn
${1:void }${2:name}(${3}) {
${4://if not void return null;}
}
${5}
# constant
snippet const
static final ${1:Object} ${2:VAR_NAM} = ${3};
# var
snippet var
${1:private/public }${2:static }${3:String} ${4:str}${5: =}${6:value};
# var objects
snippet obj
${1:private/public }${2:Object} ${3:o}${4: = new }$2(${5});
#loop for
snippet for
for (int ${2:i} = 0; $2 < ${1:Things}.length; $2${3:++}) {
${4:$1[$2]}
};
#loop while
snippet while
while (${1:/* condition */}) {
${2:/* code */}
}
#break
snippet break
break ${1:label};
#case
snippet case
case ${1:expression} :
${2}
break;
#default
snippet default
default :
${1}
break;
#switch
snippet switch
switch(${1:expression}) {
case '${3:case}':
${4:// code}
break;
${5}
default:
${2:// code}
}
#try
snippet try
try {
${3}
} catch(${1:Exception} ${2:e}) {
}
#try catch finally
snippet tryf
try {
${3}
} catch(${1:Exception} ${2:e}) {
} finally {
}
#throw
snippet throw
throw new ("${1:Exception()}");
#ternary
snippet ?
? ${1:trueExpression} : ${2:falseExpression}
${3}
snippet if
if (${1:true}) {${2}}
# if ... else
snippet ife
if (${1:true}) {${2}}
else{${3}}
#get
snippet get
public ${1:String} get${2}() {
return ${2:fieldName};
}
#set
snippet set
public void set${1}(${2:String} new${1}) {
${1:fieldName} = new${1};
}
#printIn
snippet println
println("${1:`fnamemodify(bufname("%"),":t:r")`}::${2:method}() "${3: +} ${4});
#println string
snippet pr
println("${1}");
#setup draw
snippet setup
void setup(){
${1}
}
void draw(){
${2}
}
#setup OPENGL
snippet opengl
import processing.opengl.*;
import javax.media.opengl.*;
PGraphicsOpenGL pgl;
GL gl;
void setup(){
size( ${1:300}, ${2:300}, OPENGL );
colorMode( RGB, 1.0 );
hint( ENABLE_OPENGL_4X_SMOOTH );
pgl = (PGraphicsOpenGL) g;
gl = pgl.gl;
gl.setSwapInterval(1);
initGL();
${3}
}
void draw(){
pgl.beginGL();
${4}
pgl.endGL();
getOpenGLErrors();
}
void initGL(){
${5}
}
void getOpenGLErrors(){
int error = gl.glGetError();
switch (error){
case 1280 :
println("GL_INVALID_ENUM - An invalid enumerant was passed to an OpenGL command.");
break;
case 1282 :
println("GL_INVALID_OPERATION - An OpenGL command was issued that was invalid or inappropriate for the current state.");
break;
case 1281 :
println("GL_INVALID_VALUE - A value was passed to OpenGL that was outside the allowed range.");
break;
case 1285 :
println("GL_OUT_OF_MEMORY - OpenGL was unable to allocate enough memory to process a command.");
break;
case 1283 :
println("GL_STACK_OVERFLOW - A command caused an OpenGL stack to overflow.");
break;
case 1284 :
println("GL_STACK_UNDERFLOW - A command caused an OpenGL stack to underflow.");
break;
case 32817 :
println("GL_TABLE_TOO_LARGE");
break;
}
}
#GL Functions
snippet gl begin gl
pgl.beginGL();
${1}
pgl.endGL();
snippet gl gl swap interval
// specify the minimum swap interval for buffer swaps.
gl.setSwapInterval(${1:interval});
snippet gl gl call list
// execute a display list
gl.glCallList(${1:list});
snippet gl gl gen buffers
// import java.nio.IntBuffer;
// import java.nio.FloatBuffer;
// import com.sun.opengl.util.BufferUtil;
// You might need to create four buffers to store vertext data, normal data, texture coordinate data, and indices in vertex arrays
IntBuffer bufferObjects = IntBuffer.allocate(${1:4});
gl.glGenBuffers($1, bufferObjects);
int vertexCount = ${2:3};
int numCoordinates = ${3:3};
// vertexCount * numCoordinates
FloatBuffer vertices = BufferUtil.newFloatBuffer(vertexCount * numCoordinates);
float[] v = {0.0f, 0.0f, 0.0f,
1.0f, 0.0f, 0.0f,
0.0f, 1.0f, 1.0f};
vertices.put(v);
// Bind the first buffer object ID for use with vertext array data
gl.glBindBuffer(GL.GL_ARRAY_BUFFER, bufferObjects.get(0));
gl.glBufferData(GL.GL_ARRAY_BUFFER, vertexCount * numCoordinates * BufferUtil.SIZEOF_FLOAT, vertices, GL.GL_STATIC_DRAW);
snippet gl gl bind buffer
${2:// A buffer ID of zero unbinds a buffer object}
gl.glBindBuffer(GL.GL_ARRAY_BUFFER, ${1:0});
snippet gl gl delete buffers
${3:// Parameters are the same for glGenBuffers}
gl.glDeleteBuffers(${1:4}, ${2:bufferObjects});
snippet gl gl depth mask
// enable or disable writing into the depth buffer
gl.glDepthMask(${1:flag});
snippet gl gl load identity
// replaces the top of the active matrix stack with the identity matrix
gl.glLoadIdentity();
snippet gl gl tex coord 2f
// set the current texture coordinates - 2 floats
gl.glTexCoord2f(${1:0.0f}, ${2:0.0f});
snippet gl gl vertex 2f
gl.glVertex2f(${1:0.0f}, ${2:0.0f});
snippet gl gl vertex 3f
gl.glVertex3f(${1:0.0f}, ${2:0.0f}, ${3:0.0f});
snippet gl gl translate f
// multiply the current matrix by a translation matrix
gl.glTranslatef(${1:x}, ${2:y}, ${3:z});
snippet gl gl rotate f
// rotate, x-axis, y-axis, z-axiz
gl.glRotatef(${1:angle}, ${2:x}, ${3:y}, ${4:z});
snippet gl gl scale f
// multiply the current matrix by a general scaling matrix
gl.glScalef(${1:x}, ${2:y}, ${3:z});
snippet gl gl color 4f
gl.glColor4f(${1:red}, ${2:green}, ${3:blue}, ${4:alpha});
snippet gl gl clear color
gl.glClearColor(${1:red}, ${2:green}, ${3:blue}, ${4:alpha});
snippet gl gl color 3f
gl.glColor3f(${1:red}, ${2:green}, ${3:blue});
snippet gl gl push matrix
// spush and pop the current matrix stack
gl.glPushMatrix();
${1}
gl.glPopMatrix();
snippet gl gl gen lists
gl.glGenLists(${1:1})
snippet gl gl flush
// Empties buffers. Call this when all previous issues commands completed
gl.glFlush();
${1}
snippet gl gl get error
println(gl.glGetError());
snippet gl gl clear
gl.glClear(${1:GL.GL_COLOR_BUFFER_BIT}${2: | }${3:GL.GL_DEPTH_BUFFER_BIT});
#frame operations
snippet fr framerate
frameRate(${1:30});
${2}
snippet fr frameRate
frameRate
snippet fr frameCount
frameCount
snippet fr saveFrame
saveFrame("${1:filename-####}${2:.ext}");
#size
snippet size normal size
size(${1:200}, ${2:200}${3:, P3D});
snippet size opengl size
size(${1:200}, ${2:200}${3:, OPENGL});
#PRIMITIVES
#color
snippet color
color ${1:c}${2: = color(}${3:value1, }${4:value2, }${5:value3)};
#char
snippet char
char ${1:m}${2: = "}${3:char"};
#float
snippet float
float ${1:f}${2: = }${3:0.0f};
#int
snippet int
int ${1:f}${2: = }${3:0};
#boolean
snippet boolean
boolean ${1:b}${2: = }${3:true};
#byte
snippet byte
byte ${1:b}${2: = }${3:127};
#string
snippet string
String ${1:str}${2: = "}${3:CCCP"};
#array
snippet array
${1:int}[] ${2:numbers}${3: = new $1}[${4:length}];
#object
snippet object
${1:Object} ${2:o}${3: = new $1}(${4});
#curve
snippet curve curve
curve(${1:x1}, ${2:y1}, ${3:x2}, ${4:y2}, ${5:x3}, ${6:y3}, ${7:x4}, ${8:y4});
snippet curve curve 3D
curve(${1:x1}, ${2:y1}, ${3:z1}, ${4:x2}, ${5:y2}, ${6:z2}, ${7:x3}, ${8:y3}, ${9:z3}, ${10:x4}, ${11:y4}, ${12:z4});
snippet curve curve Detail
curveDetail(${1:detail});
snippet curve curve point
curvePoint(${1:a}, ${2:b}, ${3:c}, ${4:d}, ${5:t});
snippet curve curve tightness
curveTightness(${1:squishy});
#bezier
snippet bezier bezier
bezier(${1:x1}, ${2:y1}, ${3:cx1}, ${4:cy1}, ${5:cx2}, ${6:cy2}, ${7:x2}, ${8:y2});
snippet bezier bezier 3D
bezier(${1:x1}, ${2:y1}, ${3:z1}, ${4:cx1}, ${5:cy1}, ${6:cz1}, ${7:cx2}, ${8:cy2}, ${9:cz2}, ${10:x2}, ${11:y2}, ${12:z2});
snippet bezier bezier detail
bezierDetail(${1:detail});
snippet bezier bezier tangent
bezierTangent(${1:a}, ${2:b}, ${3:c}, ${4:d}, ${5:t});
snippet bezier bezier point
bezierPoint(${1:a}, ${2:b}, ${3:c}, ${4:d}, ${5:t});
#vertex
snippet vertex vertex
vertex(${1:x}, ${2:y}${3:, }${4:u}${5:, }${6:v});
snippet vertex vertex 3D
vertex(${1:x}, ${2:y}, ${3:z}${4:, }${5:u}${6:, }${7:v});
snippet vertex vertex bezier
bezierVertex(${1:cx1}, ${2:cy1}, ${3:cx2}, ${4:cy2}, ${5:x}, ${6:y});
snippet vertex vertex bezier 3D
bezierVertex(${1:cx1}, ${2:cy1}, ${3:cz1}, ${4:cx2}, ${5:cy2}, ${6:cz2}, ${7:x}, ${8:y}, ${9:z});
snippet vertex vertex curve
curveVertex(${1:x}, ${2:y});
snippet vertex vertex curve 3D
curveVertex(${1:x}, ${2:y}, ${3:z});
#stroke
snippet stroke stroke
stroke(${1:value1}, ${2:value2}, ${3:value3}${4:, }${5:alpha});
snippet stroke stroke weight
strokeWeight(${1:1});
snippet stroke no stroke
noStroke();
#mouse
snippet mouse mouse x
mouseX
snippet mouse mouse y
mouseY
snippet mouse mouse drag
void mouseDragged(){
${1}
}
snippet mouse mouse move
void mouseMoved(){
${1}
}
snippet mouse mouse release
void mouseReleased(){
${1}
}
snippet mouse mouse pressed
void mousePressed(){
${1}
}
snippet mouse mouse pressed?
mousePressed
snippet mouse mouse button?
mouseButton
snippet mouse pmouse X
pmouseX
snippet mouse pmouse Y
pmouseY
#key
snippet key keycode?
keyCode
snippet key key
key
snippet key key released
void keyReleased(){
${1}
}
snippet key key typed
void keyTyped(){
${1}
}
snippet key key pressed
void keyPressed(){
${1}
}
snippet key key pressed?
keyPressed
#file
snippet file load string
loadStrings("${1:filename}");
snippet file save string
saveStrings(${1:filename}, ${2:strings});
snippet file load bytes
loadBytes("${1:filename}");
snippet file begin record
beginRecord(${1:renderer}, ${2:filename});
snippet file end record
endRecord();
snippet file save bytes
saveBytes(${1:filename}, ${2:bytes});
snippet file create writer
createWriter(${1:filename});
snippet file create reader
createReader(${1:filename});
#time
snippet time hour
hour()
snippet time milliseconds
millis()
snippet time year
year()
snippet time minutes
minutes()
snippet time month
month()
snippet time second
second()
#matrix
snippet matrix reset matrix
translate(${1:x}, ${2:y}, ${3:z});
snippet matrix print matrix
printMatrix();
snippet matrix push matrix
pushMatrix();
${1:};
popMatrix();
#text
snippet txt text data
text(${1:data}, ${2:x}, ${3:y}${4:, }${5:z});
snippet txt text string data
text(${1:stringdata}, ${2:x}, ${3:y}, ${4:width}, ${5:height}${6:, }${7:z});
snippet txt text size
textSize(${1:size});
snippet txt text leading
textLeading(${1:size});
snippet txt text width
textWidth(${1:data});
snippet txt text descent
textDescent();
snippet txt text ascent
textAscent();
snippet txt font
PFont ${1:font};
$1 = loadFont("${2:FFScala-32.vlw}");
#load font
snippet txt load font
${1:font} = loadFont("${2:FFScala-32.vlw}");
snippet txt text font
textFont(${1:font}${2:, }${3:size});
#math
snippet math tangent
tan(${1:rad});
snippet math atan
atan(${1:rad});
snippet math atan2
atan2(${1:rad});
snippet math sin
sin(${1:rad});
snippet math asin
asin(${1:rad});
snippet math cos
cos(${1:rad});
snippet math acos
acos(${1:rad});
snippet math degrees
degrees(${1:rad});
snippet math radians
radians(${1:deg});
snippet math random seed
randomSeed(${1:value});
snippet math random
random(${1:value1}${2:, }${3:value2});
snippet math half PI
HALF_PI
snippet math 2 PI
TWO_PI
snippet math PI
PI
snippet math pow
pow(${1:num}, ${2:exponent});
snippet math floor
floor(${1:value});
snippet math sqrt
sqrt(${1:value});
snippet math abs
abs(${1:value});
snippet math sq
sq(${1:value});
snippet math ceil
ceil(${1:value});
snippet math exp
exp(${1:value});
snippet math round
round(${1:value}};
snippet math min
min(${1:value1}, ${2:value2}${3:, }${4:value3});
snippet math max
max(${1:value1}, ${2:value2}${3:, }${4:value3});
snippet math array max
max(${1:array});
snippet math array min
min(${1:array});
snippet math logarithm
log(${1:value});
snippet math map
map(${1:value}, ${2:low1}, ${4:high1}, ${5:low2}, ${6:high2});
snippet math normalize
norm(${1:value}, ${2:low}, ${3:high});
snippet math constrain
constrain(${1:value}, ${2:min}, ${3:max});
snippet math magnitude of a vector
mag(${1:a}, ${2:b}${3:, }${4:c});
snippet math distance
dist(${1:x1}, ${2:y1}, ${4:x2}, ${5:y2});
snippet math distance 3D
dist(${1:x1}, ${2:y1}, ${3:z1}, ${4:x2}, ${5:y2}, ${6:z2});
#noise math
snippet noise set noise
noise(${1:x}${2:, }${3:y}${4:, }${5:z});
snippet noise noise detail
noiseDetail(${1:octaves}${2:, }${3:falloff});
snippet noise noise seed
noiseSeed(${1:x});
#material
snippet material shininess
shininess(${1:shine});
snippet material specular
specular(${1:value1}, ${2:value2}, ${3:value3}${4:, }${5:alpha});
snippet material ambient
ambient(${1:value1}, ${2:value2}, ${3:value3});
snippet material emissive
emissive(${1:value1}, ${2:value2}, ${3:value3});
#light
snippet light no light
noLights();
snippet light light
lights();
snippet light diretional light
directionalLight(${1:v1}, ${2:v2}, ${3:v3}, ${4:nx}, ${5:ny}, ${6:nz});
snippet light point light
pointLight(${1:v1}, ${2:v2}, ${3:v3}, ${4:nx}, ${5:ny}, ${6:nz});
snippet light falloff light
lightFalloff(${1:constant}, ${2:linear}, ${3:quadratic});
snippet light normal light
normal(${1:nx}, ${2:ny}, ${3:nz});
snippet light specular light
lightFalloff(${1:v1}, ${2:v2}, ${3:v3});
snippet light ambient light
ambientLight(${1:v1}, ${2:v2}, ${3:v3}${7:, ${4:x}, ${5:y}, ${6:z}});
snippet light spot light
spotLight(${1:v1}, ${2:v2}, ${3:v3}, ${4:x}, ${5:y}, ${6:z}, ${7:nx}, ${8:ny}, ${9:nz}, ${10:angle}, ${11:concentration});
#camera
snippet cam camera
camera(${1:eyeX}, ${2:eyeY}, ${3:eyeZ}, ${4:centerX}, ${5:centerY}, ${6:centerZ}, ${7:upX}, ${8:upY}, ${9:upZ});
snippet cam ortho
ortho(${1:left}, ${2:right}, ${3:bottom}, ${4:top}, ${5:near}, ${6:far});
snippet cam begin camera
beginCamera();
snippet cam end camera
endCamera();
snippet cam print camera
printCamera();
snippet cam print camera projection
printProjection();
snippet cam perspective camera
perspective(${1:fov}, ${2:aspect}, ${3:zNear}, ${4:zFar});
snippet cam frustrum
frustrum(${1:left}, ${2:right}, ${3:bottom}, ${4:top}, ${5:near}, ${6:far});
#transformations
snippet trans rotate
rotate${1:X}(${1:angle});
snippet trans translate
translate(${1:x}, ${2:y}${3:, }${4:z});
snippet trans scale size
scale(${1:size});
snippet trans scale
scale(${1:x}, ${2:y}${3:, }${4:z});
#coordinates
snippet coord
${1:model/screen}${2:X}(${3:x}, ${4:y}, ${5:z});
#effects
snippet fx brightness
brightness(${1:color});
snippet fx lerp color
lerpColor(${1:c1}, ${2:c2}, ${3:amt});
snippet fx saturation
saturation(${1:color});
snippet fx hue
hue(${1:color});
snippet fx alpha
alpha(${1:color});
snippet fx tint
tint(${1:value1}, ${2:value2}, ${3:value3}${4:, }${5:alpha});
snippet fx notint
noTint();
#pixel
snippet px set pixel
set(${1:x}, ${2:y}, ${3:color/image});
snippet px update pixel
updatePixels();
snippet px load pixel
loadPixels();
snippet px pixels
pixels[${1:index}]
snippet px get pixel
get(${1:x}, ${2:y}${3:, }${4:width}${5:, }${6:height});
#geometric figures
snippet geof triangle
triangle(${1:x1}, ${2:y1}, ${3:x2}, ${4:y2}, ${5:x3}, ${6:y3});
snippet geof line
line(${1:x1}, ${2:y1}, ${3:x2}, ${4:y2});
snippet geof line 3D
line(${1:x1}, ${2:y1}, ${3:z1}, ${4:x2}, ${5:y2}, ${6:z2});
snippet geof arc
arc(${1:x}, ${2:y}, ${3:width}, ${4:height}, ${5:start}, ${6:stop});
snippet geof point
point(${1:x}, ${2:y}${3:, }${4:z});
snippet geof quad
quad(${1:x1}, ${2:y1}, ${3:x2}, ${4:y2}, ${5:x3}, ${6:y3}, ${7:x4}, ${8:y4});
snippet geof ellipse
ellipse(${1:x}, ${2:y}, ${3:width}, ${4:height});
snippet geof rect
rect(${1:x}, ${2:y}, ${3:width}, ${4:height});
snippet geof box
box(${1:width}, ${2:height}, ${3:depth});
snippet geof sphere
sphere(${1:radius});
snippet geof sphere details
sphereDetail(${1:n});
snippet geof set smooth
smooth();
snippet geof set no smooth
noSmooth();
#array operations
snippet arrop normal split
split("${1:str}"${2: , }${3:delimiter});
snippet arrop split Tokens
splitTokens(${1:str}${2:, }${3:tokens});
snippet arrop join
join(${1:strgArray}${2: , }${3:seperator});
snippet arrop shorten
shorten(${1:array});
snippet arrop concat
concat(${1:array1}, ${2:array2});
snippet arrop subset
subset(${1:array}, ${2:offset});
snippet arrop append
append(${1:array}, ${2:element});
snippet arrop reverse
reverse(${1:array});
snippet arrop splice
splice(${1:array}, ${2:value/array2}, ${3:index});
snippet arrop sort
sort(${1:dataArray}${2:, }${3:count});
snippet arrop expand
expand(${1:array}${2:, }${3:newSize});
snippet arrop array copy
arrayCopy(${1:src}, ${2:dest}, ${3:, }${3:length});
#string operations
snippet strop str
str("${1:str}");
snippet strop match
match(${1:str}, ${2:regexp});
snippet strop trim
trim(${1:str});
snippet strop nf
nf(${2:value}, ${3:left}${4:, }${5:right});
snippet strop nfs
nfs(${2:value}, ${3:left}${4:, }${5:right});
snippet strop nfp
nfp(${2:value}, ${3:left}${4:, }${5:right});
snippet strop nfc
nfc(${1:value}${2:, }${3:right});
#convert
snippet convert unbinary
unbinary("${1:str}"});
snippet convert hexadecimal
hex(${1:c});
snippet convert unhex
unhex(${1:c});
snippet convert binary
binary(${1:value}${2:, }${3:digits});
#image operations
snippet image load image
loadImage(${1:filename});
snippet image image
image(${1:img}, ${2:x}, ${3:y}${4:, }${5:width}${6:, }${7:height});
snippet copy copy
copy(${1:srcImg}${2:, }${3:x}, ${4:y}, ${5:width}, ${6:height}, ${7:dx}, ${8:dy}, ${9:dwidth}, ${10:dheight});
#containers
snippet bg
background(${1:value1}, ${2:value2}, ${3:value3}${4:, }${5:alpha});
snippet pg
PGraphics pg;
pg = createGraphics(${1:width}, ${2:height}${3:, }${4:applet});
snippet pimage
PImage(${1:width}, ${2:height});
#UTILS
#nofill
snippet nofill
noFill();
#fill
snippet fill
fill(${1:value1}, ${2:value2}, ${3:value3}${4:, }${5:alpha});
#red
snippet red
red(${1:color});
#green
snippet green
green(${1:color});
#blue
snippet blue
blue(${1:color});
#status
snippet status
status(${1:text});
#param
snippet param
param(${1:s});
#link
snippet link
link(${1:url}${2:, }${3:target});
#@param
snippet @
@${1:param/return/private/public} ${1:parameter} ${2:description}

View file

@ -0,0 +1,58 @@
# Progress/OpenEdge ABL snippets
# define
snippet defbuf
DEFINE BUFFER b_${1:TableName} FOR $1 ${2}.
snippet defvar
DEFINE VARIABLE ${1:VariableName} AS ${2}.
snippet nl
NO-LOCK
snippet ne
NO-ERROR
snippet nle
NO-LOCK NO-ERROR
snippet ini
INITIAL ${1:?}
snippet nu
NO-UNDO
snippet err
ERROR
snippet ff
FIND FIRST ${1:BufferName}
${2:WHERE $1.${3}} ${4}
snippet input
DEFINE INPUT PARAMETER ${1:ParamName} AS ${2}.
snippet output
DEFINE OUTPUT PARAMETER ${1:ParamName} AS ${2:ParamType}.
snippet proc
/******************************************************************************/
PROCEDURE ${1:ProcName}:
${2}
END PROCEDURE. /* $1 */
/******************************************************************************/
snippet alert
MESSAGE "${1:MessageContent}" ${2:Data} VIEW-AS ALERT-BOX.
snippet if
IF ${1:Condition}
THEN ${2:Action}
${3:ELSE ${4:OtherWise}}
snippet do
DO${1: Clauses}:
${2}
END.
# datatypes
snippet int
INTEGER
snippet char
CHARACTER
snippet log
LOGICAL
snippet dec
DECIMAL
snippet sep
/* ------------------------------------------------------------------------- */

View file

@ -0,0 +1,155 @@
# Snippets for use with VIM and http://www.vim.org/scripts/script.php?script_id=2540
#
# Please contact R.I.Pienaar <rip@devco.net> for additions and feedback,
# see it in action @ http://www.devco.net/archives/2009/09/22/vim_and_puppet.php
# Language Constructs
snippet class
class ${1:`Filename('', 'name')`} {
${2}
}
snippet node
node "${1:`Filename('', 'fqdn')`}" {
${2}
}
snippet case
case $${1:variable} {
default: { ${2} }
}
snippet ife
if $${1:variable} {
${2}
} else {
${3}
}
snippet if
if $${1:variable} {
${2}
}
snippet else
else {
${1}
}
snippet ?
? {
'${1}' => ${2}
}
#
# blocks etc and general syntax sugar
snippet [
[ ${1} ]${2}
snippet >
${1} => ${2}
snippet p:
"puppet://puppet/${1:module name}/${2:file name}"
#
# Functions
snippet alert
alert("${1:message}")${2}
snippet crit
crit("${1:message}")${2}
snippet debug
debug("${1:message}")${2}
snippet defined
defined(${1:Resource}["${2:name}"])${3}
snippet emerg
emerg("${1:message}")${2}
snippet extlookup Simple extlookup
extlookup("${1:variable}")${2}
snippet extlookup Extlookup with defaults
extlookup("${1:variable}", "${2:default}")${3}
snippet extlookup Extlookup with defaults and custom data file
extlookup("${1:variable}", "${2:default}", "${3:data source}")${4}
snippet fail
fail("${1:message}")${2}
snippet info
info("${1:message}")${2}
snippet inline_template
inline_template("<%= ${1} %>")${2}
snippet notice
notice("${1:message}")${2}
snippet realize
realize(${1:Resource}[${2:name}])${3}
snippet regsubst
regsubst(${1:hay stack}, ${2:needle}, "${3:replacement}")${4}
snippet inc
include ${1:classname}${2}
snippet split
split(${1:hay stack}, "${2:patten}")${3}
snippet versioncmp
versioncmp("${1:version}", "${2:version}")${3}
snippet warning
warning("${1:message}")${2}
#
# Types
snippet cron
cron{ "${1:name}":
command => "${2}",
user => "${3:root}",
${4} => ${5}
}
snippet exec
exec{ "${1:name}":
command => "${2:$1}",
user => "${3:root}",
${4} => ${5}
}
snippet user
user{ "${1:user}":
comment => "${2:$1}",
ensure => present,
managehome => true,
home => "${3:/home/$1}"
}
snippet group
group{ "${1:group}":
ensure => ${2:present}
}
snippet host
host{ "${1:hostname}":
ip => ${2:127.0.0.1}
}
snippet mailalias
mailalias{ "${1:localpart}":
recipient => "${2:recipient}"
}
snippet mount
mount{ "${1:destination path}":
ensure => ${2:mounted},
device => "${3:device name or path}"
}
snippet package
package{ "${1:package name}":
ensure => ${2:present}
}
snippet yumrepo
yumrepo{ "${1:repo name}":
descr => "${2:$1}",
enabled => ${3:1}
}
snippet define
define ${1} (${2}) {
${3}
}
snippet service
service{ "${1:service}":
enable => ${2:true},
ensure => ${3:running},
hasstatus => true,
}
snippet file
file{ "${1:path}":
${2} => ${3}
}

View file

@ -0,0 +1,141 @@
snippet #!
#!/usr/bin/env python
snippet imp
import ${1:module}
snippet from
from ${1:package} import ${2:module}
# Module Docstring
snippet docs
'''
File: ${1:`Filename('$1.py', 'foo.py')`}
Author: ${2:`g:snips_author`}
Description: ${3}
'''
snippet wh
while ${1:condition}:
${2:# code...}
# dowh - does the same as do...while in other languages
snippet dowh
while True:
${1:# code...}
if ${2:condition}:
break
snippet with
with ${1:expr} as ${2:var}:
${3:# code...}
# New Class
snippet cl
class ${1:ClassName}(${2:object}):
"""${3:docstring for $1}"""
def __init__(self, ${4:arg}):
${5:super($1, self).__init__()}
self.$4 = $4
${6}
# New Function
snippet def
def ${1:fname}(${2:`indent('.') ? 'self' : ''`}):
"""${3:docstring for $1}"""
${4:pass}
snippet deff
def ${1:fname}(${2:`indent('.') ? 'self' : ''`}):
${3}
# New Method
snippet defs
def ${1:mname}(self, ${2:arg}):
${3:pass}
# New Property
snippet property
def ${1:foo}():
doc = "${2:The $1 property.}"
def fget(self):
${3:return self._$1}
def fset(self, value):
${4:self._$1 = value}
# Ifs
snippet if
if ${1:condition}:
${2:code...}
snippet el
else:
${1:code...}
snippet ei
elif ${1:condition}:
${2:code...}
# For
snippet for
for ${1:item} in ${2:items}:
${3:code...}
# Encodes
snippet cutf8
# -*- coding: utf-8 -*-
snippet clatin1
# -*- coding: latin-1 -*-
snippet cascii
# -*- coding: ascii -*-
# Lambda
snippet ld
${1:var} = lambda ${2:vars} : ${3: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}
# if __name__ == '__main__':
snippet ifmain
if __name__ == '__main__':
${1:main()}
# __magic__
snippet _
__${1:init}__${2}
# python debugger (pdb)
snippet pdb
import pdb; pdb.set_trace()
# ipython debugger (ipdb)
snippet ipdb
import ipdb; ipdb.set_trace()
# ipython debugger (pdbbb)
snippet pdbbb
import pdbpp; pdbpp.set_trace()
snippet pprint
import pprint; pprint.pprint(${1})${2}
snippet "
"""
${1:doc}
"""
# test function/method
snippet test
def test_${1:description}(${2:`indent('.') ? 'self' : ''`}):
${3:pass}
# test case
snippet testcase
class ${1:ExampleCase}(unittest.TestCase):
def test_${2:description}(self):
${3:pass}
snippet fut
from __future__ import ${1}

View file

@ -0,0 +1,95 @@
snippet #!
#!/usr/bin/env Rscript
# includes
snippet lib
library(${1:package})
snippet req
require(${1:package})
snippet source
source('${1:file}')
# conditionals
snippet if
if (${1:condition}) {
${2:code}
}
snippet el
else {
${1:code}
}
snippet ei
else if (${1:condition}) {
${2:code}
}
# functions
snippet fun
${1:name} = function (${2:variables}) {
${3:code}
}
snippet ret
return(${1:code})
# dataframes, lists, etc
snippet df
${1:name}[${2:rows}, ${3:cols}]
snippet c
c(${1:items})
snippet li
list(${1:items})
snippet mat
matrix(${1:data}, nrow=${2:rows}, ncol=${3:cols})
# apply functions
snippet apply
apply(${1:array}, ${2:margin}, ${3:function})
snippet lapply
lapply(${1:list}, ${2:function})
snippet sapply
lapply(${1:list}, ${2:function})
snippet vapply
vapply(${1:list}, ${2:function}, ${3:type})
snippet mapply
mapply(${1:function}, ${2:...})
snippet tapply
tapply(${1:vector}, ${2:index}, ${3:function})
snippet rapply
rapply(${1:list}, ${2:function})
# plyr functions
snippet dd
ddply(${1:frame}, ${2:variables}, ${3:function})
snippet dl
dlply(${1:frame}, ${2:variables}, ${3:function})
snippet da
daply(${1:frame}, ${2:variables}, ${3:function})
snippet d_
d_ply(${1:frame}, ${2:variables}, ${3:function})
snippet ad
adply(${1:array}, ${2:margin}, ${3:function})
snippet al
alply(${1:array}, ${2:margin}, ${3:function})
snippet aa
aaply(${1:array}, ${2:margin}, ${3:function})
snippet a_
a_ply(${1:array}, ${2:margin}, ${3:function})
snippet ld
ldply(${1:list}, ${2:function})
snippet ll
llply(${1:list}, ${2:function})
snippet la
laply(${1:list}, ${2:function})
snippet l_
l_ply(${1:list}, ${2:function})
snippet md
mdply(${1:matrix}, ${2:function})
snippet ml
mlply(${1:matrix}, ${2:function})
snippet ma
maply(${1:matrix}, ${2:function})
snippet m_
m_ply(${1:matrix}, ${2:function})

View file

@ -0,0 +1,22 @@
# rst
snippet :
:${1:Text}: ${2:blah blah}
snippet *
*${1:Emphasis}*
snippet **
**${1:Strong emphasis}**
snippet _
\`${1:Text}\`_
.. _\`$1\`: ${2:blah blah}
snippet =
${1:Title}
=====${2:=}
${3}
snippet -
${1:Title}
-----${2:-}
${3}
snippet cont:
.. contents::

View file

@ -0,0 +1,925 @@
########################################
# Ruby snippets - for Rails, see below #
########################################
# #!/usr/bin/env ruby
snippet #!
#!/usr/bin/env ruby
# encoding: utf-8
# New Block
snippet =b
=begin rdoc
${1}
=end
snippet y
:yields: ${1:arguments}
snippet rb
#!/usr/bin/env ruby -wKU
snippet beg
begin
${3}
rescue ${1:Exception} => ${2:e}
end
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 for
for ${1:e} in ${2:c}
${3}
end
snippet until
until ${1:condition}
${2}
end
snippet cla class .. end
class ${1:`substitute(Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`}
${2}
end
snippet cla class .. initialize .. end
class ${1:`substitute(Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`}
def initialize(${2:args})
${3}
end
end
snippet cla class .. < ParentClass .. initialize .. end
class ${1:`substitute(Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`} < ${2:ParentClass}
def initialize(${3:args})
${4}
end
end
snippet cla ClassName = Struct .. do .. end
${1:`substitute(Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`} = 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__/ }
end
snippet cla class << self .. end
class << ${1:self}
${2}
end
# class .. < DelegateClass .. initialize .. end
snippet cla-
class ${1:`substitute(Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`} < DelegateClass(${2:ParentClass})
def initialize(${3:args})
super(${4:del_obj})
${5}
end
end
snippet mod module .. end
module ${1:`substitute(Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`}
${2}
end
snippet mod module .. module_function .. end
module ${1:`substitute(Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`}
module_function
${2}
end
snippet mod module .. ClassMethods .. end
module ${1:`substitute(Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`}
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}
snippet atp
attr_protected :${1:attr_names}
snippet ata
attr_accessible :${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 ead
each do |${1:e}|
${2}
end
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 eaid
each_index do |${1:i}|
${2}
end
snippet eak
each_key { |${1:key}| ${2} }
snippet eakd
each_key do |${1:key}|
${2}
end
snippet eal
each_line { |${1:line}| ${2} }
snippet eald
each_line do |${1:line}|
${2}
end
snippet eap
each_pair { |${1:name}, ${2:val}| ${3} }
snippet eapd
each_pair do |${1:name}, ${2:val}|
${3}
end
snippet eas-
each_slice(${1:2}) { |${2:group}| ${3} }
snippet easd-
each_slice(${1:2}) do |${2:group}|
${3}
end
snippet eav
each_value { |${1:val}| ${2} }
snippet eavd
each_value do |${1:val}|
${2}
end
snippet eawi
each_with_index { |${1:e}, ${2:i}| ${3} }
snippet eawid
each_with_index do |${1:e},${2:i}|
${3}
end
snippet reve
reverse_each { |${1:e}| ${2} }
snippet reved
reverse_each do |${1:e}|
${2}
end
snippet inj
inject(${1:init}) { |${2:mem}, ${3:var}| ${4} }
snippet injd
inject(${1:init}) do |${2:mem}, ${3:var}|
${4}
end
snippet map
map { |${1:e}| ${2} }
snippet mapd
map do |${1:e}|
${2}
end
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 cold
collect do |${1:e}|
${2}
end
snippet det
detect { |${1:e}| ${2} }
snippet detd
detect do |${1:e}|
${2}
end
snippet fet
fetch(${1:name}) { |${2:key}| ${3} }
snippet fin
find { |${1:e}| ${2} }
snippet find
find do |${1:e}|
${2}
end
snippet fina
find_all { |${1:e}| ${2} }
snippet finad
find_all do |${1:e}|
${2}
end
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 scad
scan(${1:/pattern/}) do |${2:match}|
${3}
end
snippet max
max { |a, b| ${1} }
snippet min
min { |a, b| ${1} }
snippet par
partition { |${1:e}| ${2} }
snippet pard
partition do |${1:e}|
${2}
end
snippet rej
reject { |${1:e}| ${2} }
snippet rejd
reject do |${1:e}|
${2}
end
snippet sel
select { |${1:e}| ${2} }
snippet seld
select do |${1:e}|
${2}
end
snippet lam
lambda { |${1:args}| ${2} }
snippet doo
do
${1}
end
snippet dov
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 asrd
assert_raise ${1:Exception} do
${2}
end
snippet asnr
assert_nothing_raised ${1:Exception} { ${2} }
snippet asnrd
assert_nothing_raised ${1:Exception} do
${2}
end
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 astd
assert_throws :${1:expected} do
${2}
end
snippet asnt
assert_nothing_thrown { ${1} }
snippet asntd
assert_nothing_thrown do
${1}
end
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
# block
snippet b
{ |${1:var}| ${2} }
snippet begin
begin
raise 'A test exception.'
rescue Exception => e
puts e.message
puts e.backtrace.inspect
else
# other exception
ensure
# always executed
end
#debugging
snippet debug
require 'ruby-debug'; debugger; true;
snippet pry
require 'pry'; binding.pry
#############################################
# Rails snippets - for pure Ruby, see above #
#############################################
snippet art
assert_redirected_to ${1::action => "${2:index}"}
snippet artnp
assert_redirected_to ${1:parent}_${2:child}_path(${3:@$1}, ${4:@$2})
snippet artnpp
assert_redirected_to ${1:parent}_${2:child}_path(${3:@$1})
snippet artp
assert_redirected_to ${1:model}_path(${2:@$1})
snippet artpp
assert_redirected_to ${1:model}s_path
snippet asd
assert_difference "${1:Model}.${2:count}", $1 do
${3}
end
snippet asnd
assert_no_difference "${1:Model}.${2:count}" do
${3}
end
snippet asre
assert_response :${1:success}, @response.body${2}
snippet asrj
assert_rjs :${1:replace}, "${2:dom id}"
snippet ass
assert_select '${1:path}', :${2:text} => '${3:inner_html' ${4:do}
snippet bf
before_filter :${1:method}
snippet bt
belongs_to :${1:association}
snippet crw
cattr_accessor :${1:attr_names}
snippet defcreate
def create
@${1:model_class_name} = ${2:ModelClassName}.new(params[:$1])
respond_to do |wants|
if @$1.save
flash[:notice] = '$2 was successfully created.'
wants.html { redirect_to(@$1) }
wants.xml { render :xml => @$1, :status => :created, :location => @$1 }
else
wants.html { render :action => "new" }
wants.xml { render :xml => @$1.errors, :status => :unprocessable_entity }
end
end
end${3}
snippet defdestroy
def destroy
@${1:model_class_name} = ${2:ModelClassName}.find(params[:id])
@$1.destroy
respond_to do |wants|
wants.html { redirect_to($1s_url) }
wants.xml { head :ok }
end
end${3}
snippet defedit
def edit
@${1:model_class_name} = ${2:ModelClassName}.find(params[:id])
end
snippet defindex
def index
@${1:model_class_name} = ${2:ModelClassName}.all
respond_to do |wants|
wants.html # index.html.erb
wants.xml { render :xml => @$1s }
end
end${3}
snippet defnew
def new
@${1:model_class_name} = ${2:ModelClassName}.new
respond_to do |wants|
wants.html # new.html.erb
wants.xml { render :xml => @$1 }
end
end${3}
snippet defshow
def show
@${1:model_class_name} = ${2:ModelClassName}.find(params[:id])
respond_to do |wants|
wants.html # show.html.erb
wants.xml { render :xml => @$1 }
end
end${3}
snippet defupdate
def update
@${1:model_class_name} = ${2:ModelClassName}.find(params[:id])
respond_to do |wants|
if @$1.update_attributes(params[:$1])
flash[:notice] = '$2 was successfully updated.'
wants.html { redirect_to(@$1) }
wants.xml { head :ok }
else
wants.html { render :action => "edit" }
wants.xml { render :xml => @$1.errors, :status => :unprocessable_entity }
end
end
end${3}
snippet flash
flash[:${1:notice}] = "${2}"
snippet habtm
has_and_belongs_to_many :${1:object}, :join_table => "${2:table_name}", :foreign_key => "${3}_id"${4}
snippet hm
has_many :${1:object}
snippet hmd
has_many :${1:other}s, :class_name => "${2:$1}", :foreign_key => "${3:$1}_id", :dependent => :destroy${4}
snippet hmt
has_many :${1:object}, :through => :${2:object}
snippet ho
has_one :${1:object}
snippet i18
I18n.t('${1:type.key}')${2}
snippet ist
<%= image_submit_tag("${1:agree.png}", :id => "${2:id}"${3} %>
snippet log
Rails.logger.${1:debug} ${2}
snippet log2
RAILS_DEFAULT_LOGGER.${1:debug} ${2}
snippet logd
logger.debug { "${1:message}" }${2}
snippet loge
logger.error { "${1:message}" }${2}
snippet logf
logger.fatal { "${1:message}" }${2}
snippet logi
logger.info { "${1:message}" }${2}
snippet logw
logger.warn { "${1:message}" }${2}
snippet mapc
${1:map}.${2:connect} '${3:controller/:action/:id}'
snippet mapca
${1:map}.catch_all "*${2:anything}", :controller => "${3:default}", :action => "${4:error}"${5}
snippet mapr
${1:map}.resource :${2:resource}
snippet maprs
${1:map}.resources :${2:resource}
snippet mapwo
${1:map}.with_options :${2:controller} => '${3:thing}' do |$3|
${4}
end
snippet mbs
before_save :${1:method}
snippet mcht
change_table :${1:table_name} do |t|
${2}
end
snippet mp
map(&:${1:id})
snippet mrw
mattr_accessor :${1:attr_names}
snippet oa
order("${1:field}")
snippet od
order("${1:field} DESC")
snippet pa
params[:${1:id}]${2}
snippet ra
render :action => "${1:action}"
snippet ral
render :action => "${1:action}", :layout => "${2:layoutname}"
snippet rest
respond_to do |wants|
wants.${1:html} { ${2} }
end
snippet rf
render :file => "${1:filepath}"
snippet rfu
render :file => "${1:filepath}", :use_full_path => ${2:false}
snippet ri
render :inline => "${1:<%= 'hello' %>}"
snippet ril
render :inline => "${1:<%= 'hello' %>}", :locals => { ${2::name} => "${3:value}"${4} }
snippet rit
render :inline => "${1:<%= 'hello' %>}", :type => ${2::rxml}
snippet rjson
render :json => ${1:text to render}
snippet rl
render :layout => "${1:layoutname}"
snippet rn
render :nothing => ${1:true}
snippet rns
render :nothing => ${1:true}, :status => ${2:401}
snippet rp
render :partial => "${1:item}"
snippet rpc
render :partial => "${1:item}", :collection => ${2:@$1s}
snippet rpl
render :partial => "${1:item}", :locals => { :${2:$1} => ${3:@$1}
snippet rpo
render :partial => "${1:item}", :object => ${2:@$1}
snippet rps
render :partial => "${1:item}", :status => ${2:500}
snippet rt
render :text => "${1:text to render}"
snippet rtl
render :text => "${1:text to render}", :layout => "${2:layoutname}"
snippet rtlt
render :text => "${1:text to render}", :layout => ${2:true}
snippet rts
render :text => "${1:text to render}", :status => ${2:401}
snippet ru
render :update do |${1:page}|
$1.${2}
end
snippet rxml
render :xml => ${1:text to render}
snippet sc
scope :${1:name}, :where(:@${2:field} => ${3:value})
snippet sl
scope :${1:name}, lambda do |${2:value}|
where("${3:field = ?}", ${4:bind var})
end
snippet sha1
Digest::SHA1.hexdigest(${1:string})
snippet sweeper
class ${1:ModelClassName}Sweeper < ActionController::Caching::Sweeper
observe $1
def after_save(${2:model_class_name})
expire_cache($2)
end
def after_destroy($2)
expire_cache($2)
end
def expire_cache($2)
expire_page
end
end
snippet tcb
t.boolean :${1:title}
${2}
snippet tcbi
t.binary :${1:title}, :limit => ${2:2}.megabytes
${3}
snippet tcd
t.decimal :${1:title}, :precision => ${2:10}, :scale => ${3:2}
${4}
snippet tcda
t.date :${1:title}
${2}
snippet tcdt
t.datetime :${1:title}
${2}
snippet tcf
t.float :${1:title}
${2}
snippet tch
t.change :${1:name}, :${2:string}, :${3:limit} => ${4:80}
${5}
snippet tci
t.integer :${1:title}
${2}
snippet tcl
t.integer :lock_version, :null => false, :default => 0
${1}
snippet tcr
t.references :${1:taggable}, :polymorphic => { :default => '${2:Photo}' }
${3}
snippet tcs
t.string :${1:title}
${2}
snippet tct
t.text :${1:title}
${2}
snippet tcti
t.time :${1:title}
${2}
snippet tcts
t.timestamp :${1:title}
${2}
snippet tctss
t.timestamps
${1}
snippet va
validates_associated :${1:attribute}
snippet vao
validates_acceptance_of :${1:terms}
snippet vc
validates_confirmation_of :${1:attribute}
snippet ve
validates_exclusion_of :${1:attribute}, :in => ${2:%w( mov avi )}
snippet vf
validates_format_of :${1:attribute}, :with => /${2:regex}/
snippet vi
validates_inclusion_of :${1:attribute}, :in => %w(${2: mov avi })
snippet vl
validates_length_of :${1:attribute}, :within => ${2:3}..${3:20}
snippet vn
validates_numericality_of :${1:attribute}
snippet vpo
validates_presence_of :${1:attribute}
snippet vu
validates_uniqueness_of :${1:attribute}
snippet wants
wants.${1:js|xml|html} { ${2} }
snippet wc
where(${1:"conditions"}${2:, bind_var})
snippet wh
where(${1:field} => ${2:value})
snippet xdelete
xhr :delete, :${1:destroy}, :id => ${2:1}${3}
snippet xget
xhr :get, :${1:show}, :id => ${2:1}${3}
snippet xpost
xhr :post, :${1:create}, :${2:object} => { ${3} }
snippet xput
xhr :put, :${1:update}, :id => ${2:1}, :${3:object} => { ${4} }${5}
snippet test
test "should ${1:do something}" do
${2}
end
#migrations
snippet mac
add_column :${1:table_name}, :${2:column_name}, :${3:data_type}
snippet mrc
remove_column :${1:table_name}, :${2:column_name}
snippet mrnc
rename_column :${1:table_name}, :${2:old_column_name}, :${3:new_column_name}
snippet mcc
change_column :${1:table}, :${2:column}, :${3:type}
snippet mccc
t.column :${1:title}, :${2:string}
snippet mct
create_table :${1:table_name} do |t|
t.column :${2:name}, :${3:type}
end
snippet migration
class ${1:class_name} < ActiveRecord::Migration
def self.up
${2}
end
def self.down
end
end
snippet trc
t.remove :${1:column}
snippet tre
t.rename :${1:old_column_name}, :${2:new_column_name}
${3}
snippet tref
t.references :${1:model}
#rspec
snippet it
it "${1:spec_name}" do
${2}
end
snippet itp
it "${1:spec_name}"
${2}
snippet desc
describe ${1:class_name} do
${2}
end
snippet cont
context "${1:message}" do
${2}
end
snippet bef
before :${1:each} do
${2}
end
snippet aft
after :${1:each} do
${2}
end

View file

@ -0,0 +1,43 @@
# Shebang. Executing bash via /usr/bin/env makes scripts more portable.
snippet #!
#!/usr/bin/env 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 fori
for ${1:needle} in ${2:haystack} ; 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
snippet go
while getopts '${1:o}' ${2:opts}
do
case $$2 in
${3:o0})
${4:#staments};;
esac
done
# Set SCRIPT_DIR variable to directory script is located.
snippet sdir
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"

View file

@ -0,0 +1,9 @@
# snippets for making snippets :)
snippet snip
snippet ${1:trigger}
${2}
snippet msnip
snippet ${1:trigger} ${2:description}
${3}
snippet v
{VISUAL}

View file

@ -0,0 +1,92 @@
# #!/usr/bin/env tclsh
snippet #!
#!/usr/bin/env 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

View file

@ -0,0 +1,197 @@
# recomendation: change the fold marker from {{{,}}} to (fold),(end) ; tex uses "{" and "}" a lot
#PREAMBLE
#newcommand
snippet nc
\newcommand{\${1:cmd}}[${2:opt}]{${3:realcmd}}${4}
#usepackage
snippet up
\usepackage[${1:[options}]{${2:package}}
#newunicodechar
snippet nuc
\newunicodechar{${1}}{${2:\ensuremath}${3:tex-substitute}}}
#DeclareMathOperator
snippet dmo
\DeclareMathOperator{${1}}{${2}}
#DOCUMENT
# \begin{}...\end{}
snippet begin
\begin{${1:env}}
${2}
\end{$1}
# Tabular
snippet tab
\begin{${1:tabular}}{${2:c}}
${3}
\end{$1}
snippet thm
\begin[${1:author}]{${2:thm}}
${3}
\end{$1}
snippet center
\begin{center}
${1}
\end{center}
# 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}
# Equation
snippet eq*
\begin{equation*}
${1}
\end{equation*}
# Unnumbered Equation
snippet \
\[
${1}
\]
# Enumerate
snippet enum
\begin{enumerate}
\item ${1}
\end{enumerate}
# Itemize
snippet itemize
\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)
#References
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}
snippet index
\index{${1:index}}${2}
#cite
snippet cite
\cite{${1}}${2}
#Formating text: italic, bold, underline, small capital, emphase ..
snippet it
\textit{${1:text}}
snippet bf
\textbf{${1:text}}
snippet under
\underline{${1:text}}
snippet emp
\emph{${1:text}}
snippet sc
\textsc{${1:text}}
#Choosing font
snippet sf
\textsf{${1:text}}
snippet rm
\textrm{${1:text}}
snippet tt
\texttt{${1:text}}
#misc
snippet ft
\footnote{${1:text}}
snippet fig
\begin{figure}
\begin{center}
\includegraphics[scale=${1}]{Figures/${2}}
\end{center}
\caption{${3}}
\label{fig:${4}}
\end{figure}
snippet tikz
\begin{figure}
\begin{center}
\begin{tikzpicture}[scale=${1:1}]
${2}
\end{tikzpicture}
\end{center}
\caption{${3}}
\label{fig:${4}}
\end{figure}
#math
snippet stackrel
\stackrel{${1:above}}{${2:below}} ${3}
snippet frac
\frac{${1:num}}{${2:denom}}
snippet sum
\sum^{${1:n}}_{${2:i=1}}{${3}}

View file

@ -0,0 +1,30 @@
# Jekyll post header
snippet header
---
title: ${1:title}
layout: post
date: ${2:date} ${3:hour:minute:second} -05:00
---
# Image
snippet img
!${1:url}(${2:title}):${3:link}!
# Table
snippet |
|${1}|${2}
# Link
snippet link
"${1:link text}":${2:url}
# Acronym
snippet (
(${1:Expand acronym})${2}
# Footnote
snippet fn
[${1:ref number}] ${3}
fn$1. ${2:footnote}

View file

@ -0,0 +1,45 @@
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:`expand('%') =~ 'autoload' ? substitute(matchstr(expand('%:p'),'autoload/\zs.*\ze.vim'),'[/\\]','#','g').'#' : ''`}${2:function_name}(${3})
${4:" code}
endf
snippet t
try
${1}
catch ${2}
${3}
endtry
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
snippet au
augroup ${1:AU_NAME}
" this one is which you're most likely to use?
autocmd ${2:BufRead,BufNewFile} ${3:*.ext,*.ext3|<buffer[=N]>} ${4}
augroup end
snippet bun
Bundle '${1}'

View file

@ -0,0 +1,97 @@
snippet apply-templates with-param
<xsl:apply-templates select="${1:*}">
<xsl:with-param name="${2:param}">${3}</xsl:with-param>${4}
</xsl:apply-templates>${5}
snippet apply-templates sort-by
<xsl:apply-templates select="${1:*}">
<xsl:sort select="${2:node}" order="${3:ascending}" data-type="${4:text}">${5}
</xsl:apply-templates>${6}
snippet apply-templates
<xsl:apply-templates select="${1:*}" />${2}
snippet attribute blank
<xsl:attribute name="${1:name}">${2}</xsl:attribute>${3}
snippet attribute value-of
<xsl:attribute name="${1:name}">
<xsl:value-of select="${2:*}" />
</xsl:attribute>${3}
snippet call-template
<xsl:call-template name="${1:template}" />
snippet call-template with-param
<xsl:call-template name="${1:template}">
<xsl:with-param name="${2:param}">${3}</xsl:with-param>${4}
</xsl:call-template>${5}
snippet choose
<xsl:choose>
<xsl:when test="${1:value}">
${2}
</xsl:when>${3}
</xsl:choose>
snippet copy-of
<xsl:copy-of select="${1:*}" />${2}
snippet for-each
<xsl:for-each select="${1:*}">${2}
</xsl:for-each>${3}
snippet if
<xsl:if test="${1:test}">${2}
</xsl:if>${3}
snippet import
<xsl:import href="${1:stylesheet}" />${2}
snippet include
<xsl:include href="${1:stylesheet}" />${2}
snippet otherwise
<xsl:otherwise>${1}
</xsl:otherwise>
snippet param
<xsl:param name="${1:name}">${2}
</xsl:param>${3}
snippet stylesheet
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">${1}
</xsl:stylesheet>
snippet template
<xsl:template match="${1:*}">${3}
</xsl:template>
snippet template named
<xsl:template name="${1:name}">${2}
</xsl:template>
snippet text
<xsl:text>${1}</xsl:text>
snippet value-of
<xsl:value-of select="${1:*}" />${2}
snippet variable blank
<xsl:variable name="${1:name}">${2}
</xsl:variable>
snippet variable select
<xsl:variable select="${1:*}" />${2}
snippet when
<xsl:when test="${1:test}">${2}
</xsl:when>
snippet with-param
<xsl:with-param name="${1:name}">${2}</xsl:with-param>
snippet with-param select
<xsl:with-param name="${1:name}" select="${2:*}" />

View file

@ -0,0 +1,62 @@
# #!/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 fori
for ${1:needle} in ${2:haystack} ; 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}
}

View file

@ -0,0 +1,72 @@
This is a mirror of http://www.vim.org/scripts/script.php?script_id=1863
This library provides some utility functions. There isn't much need to
install it unless another plugin requires you to do so.
The most useful functions provided by this library probably are:
tlib#input#List(), tlib#input#ListW()
- Display a list
- Dynamically filter items matching a pattern (somethat like google)
- E.g. you filter for "foo -bar": show all entries containing foo but not bar.
- Select items from a list
- Do stuff
- Developers can define keys that trigger some action with the
selected items
- Demo: http://vimsomnia.blogspot.com/2010/11/selecting-items-from-list-with-tlibs.html
tlib#input#EditList
+ Edit a list (copy, cut, paste, delete, edit ...)
:TLet VAR = VALUE
Set a variable only if it doesn't already exist.
:TScratch
Open a scratch buffer (a buffer without a file).
:TVarArg VAR1, [VAR2, DEFAULT2] ...
Handle "rest" (variable) arguments in functions.
EXAMPLES:
function! Foo(...)
TVarArg ['a', 1], 'b'
echo 'a='. a
echo 'b='. b
endf
TBrowseOutput COMMAND
Every wondered how to effciently browse the output of a command
without redirecting it to a file? This command takes a command as
argument and presents the output via |tlib#input#List()| so that you
can easily search for a keyword (e.g. the name of a variable or
function) and the like.
If you press enter, the selected line will be copied to the command
line. Press ESC to cancel browsing.
EXAMPLES:
TBrowseOutput 20verb TeaseTheCulprit
TBrowseOutput let
TBrowseOutput map
Related (small) plugins that utilize tlib and thus provide some degree of uniform user experience:
tbibtools (vimscript #1915): bibtex-related utilities (sort, reformat, list contents ...)
tmarks (vimscript #2594): Browse, place, & delete marks
tmboxbrowser (vimscript #1906): A mbox browser -- Read your e-mails with vim
tmru (vimscript #1864): Most Recently Used Files
trag (vimscript #2033): A slightly language-aware alternative to grep
tregisters (vimscript #2017): List, edit, and run/execute registers/clipboards
tselectbuffer (vimscript #1866): A quick buffer selector/switcher
tselectfiles (vimscript #1865): A quick file selector/browser/explorer (sort of)
ttagecho (vimscript #2055): Show current tag information
ttagcomplete (vimscript #2069): Context-sensitive tags-based completion and code skeletons
ttags (vimscript #2018): Tag list browser (List, filter, preview, jump to tags)
ttoc (vimscript #2014): A regexp-based table of contents of the current buffer
vikitasks (vimscript #2894): Search viki files for tasks and display them in a list
For full details, please see:
http://github.com/tomtom/tlib_vim/blob/master/doc/tlib.txt
Also available via git
http://github.com/tomtom/tlib_vim

View file

@ -0,0 +1,12 @@
" tlib.vim
" @Author: Tom Link (micathom AT gmail com?subject=[vim])
" @Website: http://www.vim.org/account/profile.php?user_id=4037
" @License: GPL (see http://www.gnu.org/licenses/gpl.txt)
" @Created: 2007-07-17.
" @Last Change: 2010-01-03.
" @Revision: 0.0.7
" call tlog#Log('Load: '. expand('<sfile>')) " vimtlib-sfile
" Dummy file for backwards compatibility.

Some files were not shown because too many files have changed in this diff Show more