Skip to content

Instantly share code, notes, and snippets.

@lwoodson
Created November 26, 2012 11:25
Show Gist options
  • Save lwoodson/4147733 to your computer and use it in GitHub Desktop.
Save lwoodson/4147733 to your computer and use it in GitHub Desktop.
Simple bash script to list the snipMate snippets available to different filetypes in vim.
#! /bin/bash
list_snippets_for() {
egrep "^snippet|^#" ~/.vim/snippets/$1.snippets | awk '/^#/ {comment = comment $0} /^snippet/ {print $0 "\t\t" comment; comment=""}'
}
if [ "$1" == "" ]
then
echo "You must specify at least one file type as an argument to ls_snip"
exit
fi
for filetype in "$@"
do
echo `echo $filetype | awk '{print toupper($0)}'`
list_snippets_for $filetype
echo
done
@lwoodson
Copy link
Author

[lwoodson@lwoodson-mint-vb spike] [root@rva-lw] $ ls_snip javascript html
JAVASCRIPT
snippet proto # Prototype
snippet fun # Function
snippet f # Anonymous Function
snippet if # if
snippet ife # if ... else
snippet t # tertiary conditional
snippet switch # switch
snippet case # case
snippet for # for (...) {...}
snippet forr # for (...) {...} (Improved Native For-Loop)
snippet wh # while (...) {...}
snippet do # do...while
snippet :f # Object Method
snippet timeout # setTimeout function
snippet get # Get Elements
snippet gett # Get Element

HTML
snippet nbs # Some useful Unicode entities# Non-Breaking Space
snippet left # ←
snippet right # →
snippet up # ↑
snippet down # ↓
snippet return # ↩
snippet backtab # ⇤
snippet tab # ⇥
snippet shift # ⇧
snippet control # ⌃
snippet enter # ⌅
snippet command # ⌘
snippet option # ⌥
snippet delete # ⌦
snippet backspace # ⌫
snippet escape # ⎋
snippet doctype HTML 4.01 Strict # Generic Doctype
snippet doctype HTML 4.01 Transitional
snippet doctype HTML 5
snippet doctype XHTML 1.0 Frameset
snippet doctype XHTML 1.0 Strict
snippet doctype XHTML 1.0 Transitional
snippet doctype XHTML 1.1
snippet docts # HTML Doctype 4.01 Strict
snippet doct # HTML Doctype 4.01 Transitional
snippet doct5 # HTML Doctype 5
snippet docxf # XHTML Doctype 1.0 Frameset
snippet docxs # XHTML Doctype 1.0 Strict
snippet docxt # XHTML Doctype 1.0 Transitional
snippet docx # XHTML Doctype 1.1
snippet html
snippet xhtml
snippet body
snippet head
snippet title
snippet script
snippet scriptsrc
snippet style
snippet base
snippet r
snippet div
snippet movie # Embed QT Movie
snippet fieldset
snippet form
snippet h1
snippet input
snippet label
snippet link
snippet mailto
snippet meta
snippet opt
snippet optt
snippet select
snippet table
snippet textarea
snippet fcg

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment