scrooloose / snipmate-snippets Goto Github PK
View Code? Open in Web Editor NEWA collection of snippets for snipmate
A collection of snippets for snipmate
# #!/bin/bash
# need snippet for 'usage'
# source: http://snipt.net/voyeg3r/tag/snippets
snippet date
`system("date +%m-%d-%Y")`
# header for shell script
snippet sh
#!/bin/bash
# Criado em: `system("date +%m-%d-%Y")`
# Last Change: `system("date +%m-%d-%Y")`
# vim:ft=sh:fdm=syntax:nu:
# Instituicao: ${1:instituicao}
# Proposito do script: ${2:descricao}
# Autor: ${3:`system("whoami")`}
# site: ${4:site}
snippet #!
#!/bin/bash
# test if has dir
snippet ifdir
[ -d ${1:namedir} ] || mkdir $1 ; cd $1
snippet ifile
if [ ! -e ${1:filename} ]; then
echo " file $1 not present"
fi
snippet if
if [[ ${1:condition} ]]; then
${2:#statements}
fi
snippet elif
elif [[ ${1:condition} ]]; then
${2:#statements}
snippet for
for (( ${2:i} = 0; $2 < ${1:count}; $2++ )); do
${3:#statements}
done
snippet wh
while [[ ${1:condition} ]]; do
${2:#statements}
done
snippet until
[[ ${1:condition} ]]; do
${2:#statements}
done
snippet case
case ${1:word} in
${2:pattern})
${3};;
esac
# ifroot - if root
snippet ir
# testa se está logado como root
if [ "$(id -u)" != "0" ]; then
echo " Need be root"
sleep 2
exit 1
fi
snippet lock
LOCK_FILE=/tmp/.lock
(set -C; : > $LOCK_FILE) 2> /dev/null
if [ $? != "0" ]; then
echo "Lock File exists - exiting"
sleep 1
exit 1
fi
snippet usage
usage()
{
echo "Usage: $(basename $${1:0}) ${2:argument}"
echo "${3:explanation}"
}
i think the snippets should put into [filetype]/.snippet like the $vimruntime/ftplugin/
so that if i have a lot of ruby snippets , i could put them into [filetype]/.snippet
then the snippet could be extended without configuration. :-)
Could you incorporate Node.js Snippets:
https://github.com/jamescarr/snipmate-nodejs
That would be GREAT !!!
I love your collection !
Hey there,
I'm just a user. But I get this error message every time I open a Rakefile:
"Rakefile" 22L, 752C Warning in snipMate.vim: Snippet ass is already defined. See :h multi_snip for help on snippets with multiple matches. Warning in snipMate.vim: Snippet rep is already defined. See :h multi_snip for help on snippets with multiple matches. Warning in snipMate.vim: Snippet anr is already defined. See :h multi_snip for help on snippets with multiple matches. Warning in snipMate.vim: Snippet shns is already defined. See :h multi_snip for help on snippets with multiple matches.
example is "va.snippet": "validates_associated :<+attribute+><+, :on => :<+:create+>+>"
so, if I write "va" in my VIM - this "va" expands to "validates_associated :<+attribute+><+, :on => :<+:create+>+>", but cursor is at the end of line, and there's no navigation by fields on tab or C-j
Hovewer, snippets like "sweeper.snippet" are working well.
I use vim 7.2.182, Linux, and latest of scrooloose/snipmate-snippets and scrooloose/vimfiles.
I tried to solve this myself, and found that there's doc/imaps.txt document, but no plugin/imaps.vim, googled for that, put it into plugin/ and even got some example IMAPS with "<+...+>" working, but snipMate behavior is still the same. It ignores presence of imaps.vim
It happened to me that I ran 'rake' twice, and when I took a look at 'snippets' dir content, every folder in there had another symlink to the same location of its parent. e.g.:
After the first 'rake', the snippets folder looked like:
~/.vim/bundle/snipmate/snippets/ruby/foo.snippet
~/.vim/bundle/snipmate/snippets/ruby/bar.snippet
...
But After the second 'rake', the snippets folder looked like:
~/.vim/bundle/snipmate/snippets/ruby/ruby
~/.vim/bundle/snipmate/snippets/ruby/foo.snippet
~/.vim/bundle/snipmate/snippets/ruby/bar.snippet
...
Where this first entry ("ruby") is actually a symlink to its parent.
I commited a change to my fork that fixed this issue for me (53f3a7f). I can pull it if you think it worths.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.