• Stars
    star
    4,813
  • Rank 8,748 (Top 0.2 %)
  • Language Vim Snippet
  • License
    MIT License
  • Created over 13 years ago
  • Updated 4 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

vim-snipmate default snippets (Previously snipmate-snippets)

snipMate & UltiSnip Snippets

Build Status

This repository contains snippets files for various programming languages.

It is community-maintained and many people have contributed snippet files and other improvements already.

Contents

  • snippets/*: snippets using snipMate format
  • UltiSnips/*: snippets using UltiSnips format

Snippet engines supporting vim-snippets

There are different forks of snippet engines which allow the user to insert snippets by typing the name of a snippet hitting the expansion mapping.

There tries to be a more comprehensive list (which still is incomplete) here: http://vim-wiki.mawercer.de/wiki/topic/text-snippets-skeletons-templates.html

UltiSnips has additional features such as high speed, nesting snippets, expanding snippets in snippets and offers powerful transformations on text in snippets (like visual selections or placeholder texts).

Which one to use? If you have python give SirVer/ultisnips a try because its fast and has the most features.

If you have VimL only (vim without python support) your best option is using garbas/vim-snipmate and cope with the minor bugs found in the engine.

If you use Neovim and prefer Lua plugins, L3MON4D3/LuaSnip is the best option.

Q: Should snipMate be deprecated in favour of UltiSnips?

A: No, because snipMate is VimL, and UltiSnips requires Python. Some people want to use snippets without having to install Vim with Python support. Yes - this sucks.

One solution would be: Use snippets if they are good enough, but allow overriding them in UltiSnips. This would avoid most duplication while still serving most users. AFAIK there is a nested-placeholder branch for snipMate too. snipMate is still improved by Adnan Zafar. So maybe time is not ready to make a final decision yet.

github issue/discussion

Vendor Snippets

Additional library and framework snippets are available for UltiSnips users in the UltiSnips/ directory. These files are removed from the default language namespaces to prevent them from all being loaded automatically. If there is a separate library, framework, or package you would like to support open a pull request!

Additional snippets can be added to the current buffer with the :UltiSnipsAddFiletypes command followed by the snippet name without the "snippets" ending. For example, to add the JavaScript Jasmine snippets, run: :UltiSnipsAddFiletypes javascript-jasmine. To have this snippet loaded everytime a JavaScript file is opened or created you can add the command to your -.vim/ftplugin/javascript.vim file. Another way is to add autocmd FileType js UltiSnipsAddFiletypes javascript-jasmine in your .vimrc.

For more see the UltiSnips docs (:help UltiSnips).

Installation

First be aware that there are many options, see "Snippet engines" above. Second be aware than there are tons of plugin managers which is why Marc Weber thinks that it doesn't make sense to repeat the same repetitive information everywhere.

The recommended way to install these snippets is by using vim-addon-manager. Marc Weber wrote it for exactly this reason, it supports simple dependency management. E.g. all you need is this line in your .vimrc:

" assuming you want to use snipmate snippet engine
ActivateAddons vim-snippets snipmate

vim-pi Is the place to discuss plugin managers and repository resources.

For snipMate installation instructions, please see snipmate@garbas.

Pull requests adding installation instructions for Pathogen, Bundle, git clone, etc. are welcome and much appreciated.

Getting help

If you still have trouble getting this to work, please create a GitHub issue.

Things to consider when contributing

Some snippets are useful for almost all languages, so let's try to have the same triggers for them:

if : if without else
ife: if $1 else $2
eif : else if ($1) { .. }
el  : else ..
wh  : while (cond) ...

Don't add useless placeholder default texts like:

if (${1:condition}){
  ${0:some code here}
}

instead use:

if (${1}){
  ${0:${VISUAL}}
}

Exception: Functions which are used less often, such as Vim's matchall(), matchstr() functions which case hints may be helpful to remember order. In the VimL case get vim-dev plugin which has function completion

Thus for conditions (while, if ..) and block bodies just use ${N} - Thanks

When the snippet can be used to wrap existing code leverage ${VISUAL}

Open questions: What about one line if ee then .. else .. vs if \n .. then \n ... \n else \n .. ? Which additional policies to add? Discuss at: #230

folding markers: Until further work is done on vim-snipmate, please don't add folding markers into snippets. vim-snipmate has some comments about how to patch all snippets on the fly adding those.

Currently all snippets from UltiSnips have been put into /UltiSnips - some work on merging should be done (dropping duplicates etc). Also see engines section above.

Related repositories

We also encourage people to maintain sets of snippets for particular use cases so that all users can benefit from them. People can list their snippet repositories here:

Installation using VAM: https://github.com/MarcWeber/vim-addon-manager

Future ideas and examples

overview snippet engines If you have ideas you can add them to that list of "snippet engine features by example".

Historical notes

vim-snipmate was originally started by Michael Sanders who has now unfortunately abandoned the project. Rok Garbas is now maintaining a fork of the project in hopes of improving the existing code base.

Versions / dialects / ..

There are some issues, such as newer language versions may require other snippets than older. If this exists we currently recommend doing this:

  • add snippets/ruby.snippets (common snippets)
  • add snippets/ruby-1.8.snippets (1.8 only)
  • add snippets/ruby-1.9.snippets (1.9 only)

then configure https://github.com/garbas/vim-snipmate this way:

let g:snipMate = {}
let g:snipMate.scope_aliases = {}
let g:snipMate.scope_aliases['ruby'] = 'ruby,ruby-rails,ruby-1.9'

If it happens that you work on a project requiring ruby-1.8 snippets instead, consider using vim-addon-local-vimrc and override the filetypes.

Well - of course it may not make sense to create a new file for each ruby-library-version triplet. Sometimes postfixing a name such as

migrate_lib_20_down
migrate_lib_20_up

will do it then if syntax has changed.

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.

Notes: People are interested in snippets - and their interest may wane again. This list is kept up-to-date on a best effort basis.

License

Just as the original snipMate plugin, all the snippets are licensed under the terms of the MIT license.

More Repositories

1

140medley

A micro-framework or a collection of small, helpful utilities for common javascript tasks.
JavaScript
351
star
2

smithy

A tiny git forge written in Go
Go
220
star
3

anosql

Easy SQL in Python
Python
208
star
4

bibles

Machine-readable versions of popular English translations of the Bible
166
star
5

redish

A multi-threaded, TCP, key-value store inspired by Redis implemented in Haskell.
Haskell
137
star
6

node-thumbnail

Thumbnail worker queue for node.js
JavaScript
102
star
7

lenscap

Lenscap is a static site generator for creating beautiful photo narratives
Python
97
star
8

django-chef

django with chef template (no longer maintained)
Ruby
86
star
9

base16-st

Colors for the st terminal
C
82
star
10

inertia

A Lisp to Javascript compiler
JavaScript
78
star
11

vim2pygments

Convert vim colorschemes to Pygments styles
Python
72
star
12

suggestr.js

The dead simple javascript autocompleter
JavaScript
68
star
13

dockerfile.vim

Syntax highlighting for Dockerfiles
Vim Script
54
star
14

mutt-notmuch-py

Python
46
star
15

oauth-service

OAuth service in Django/Flask (proof of concept/example app)
Python
41
star
16

kindle-highlight-parser

Parse the highlights file from your Kindle and display it in JSON or Markdown
Go
41
star
17

socrates

socrates is a static site generator written in Python
Python
31
star
18

writer.vim

vim plugin for writing prose
Vim Script
25
star
19

dotfiles

My awesome dotfiles.
Emacs Lisp
25
star
20

clitwi

A dead-simple command line Twitter client
Python
21
star
21

cljs-node

A leiningen template for cljs scripts that target nodejs
Clojure
18
star
22

sheepskin

Document authoring utility
Shell
18
star
23

gif-maker

Make animated gifs from video clips
Shell
16
star
24

nigel

A simple IRC bot that responds to commands. Inspired by Hubot. Implemented in Python.
Python
15
star
25

ajax.js

Super simple ajax utility
JavaScript
14
star
26

jordan

Clojure library for Compojure that allows you to specify which routes require the user to be logged in or to be an administrator
Clojure
14
star
27

heroku-sprunge

Roll your own sprunge on your domain
Python
13
star
28

rembrant

rembrant is a photo organizational tool and an online gallery builder
JavaScript
9
star
29

Posterous-App-Engine

Posterous-style blogging on App Engine
Python
9
star
30

wharf-ci

Jenkins-like, docker-based, GitHub-backed build system
CSS
7
star
31

bond

Bond - the spy agent
Clojure
6
star
32

westminster-reference-bible

6
star
33

film-simulations

Fuji X Film Simulation Settings
Python
6
star
34

renaissance.css

The perfect page in CSS
CSS
5
star
35

honza.github.com

My website
HTML
5
star
36

vim.io

CoffeeScript
5
star
37

keylogger

keylogger output analyzer
Clojure
5
star
38

heroku-bouncer

Keep your app alive
4
star
39

email-parsing

Email parsing in Clojure
Clojure
4
star
40

solarized-pygments

Solarized pygments style
Python
4
star
41

photolab.coffee

Photolab is a photo organizational and sorting tool.
CoffeeScript
4
star
42

greek-new-testament

This is a tool which helps you read and study the New Testament in the original Greek.
Python
4
star
43

renodiff

Convert your git patch to a reno release note
Python
4
star
44

greekapp

This is a Django app that allows you to interact with the text of the New Testament in its original language.
Python
3
star
45

textual-criticism-game

3
star
46

pypass

python-based random password generator
Python
3
star
47

photolab.py

Python
3
star
48

server-sanity

Vim Script
3
star
49

jslintnode.js

Run your javascript files through the JSLint tool from the comfort of your command prompt.
JavaScript
3
star
50

1689

TeX
3
star
51

django-riemann

Send logs from Django to Riemann
Python
3
star
52

gopro-tools

Shell
3
star
53

ansel

Ansel, the photo gallery
Clojure
2
star
54

hnios

HN for iOS
Python
2
star
55

punctuation

Add real HTML punctuation
Python
2
star
56

todo.js

A fast, reliable, extensible, powerful todo list application written in Javascript.
JavaScript
2
star
57

film-detect

Rust
2
star
58

license.js

Detect a project's open source license on Github
JavaScript
2
star
59

stickies-app

StickiesApp
JavaScript
2
star
60

amara-chrome

JavaScript
2
star
61

clj-gpx

Clojure
2
star
62

textus-receptus

2
star
63

rediclus

A simple Redis clone in Clojure
Clojure
2
star
64

pygmented-markdown

Markdown script that parses your code with Pygments
Python
2
star
65

grab-free-machine

Python
2
star
66

finances.js

This is an example, proof-of-concept, application to showcase backbone.js
JavaScript
2
star
67

bolt

Real-time chat/Twitter clone in Node.js, Express, Socket.io, Redis
JavaScript
2
star
68

nathan-university

Homework for the "Create your own programming language" course at http://nathansuniversity.com/.
JavaScript
2
star
69

riddle

Riddle is a simple theme for Sphinx
1
star
70

merge-upstream

Shell
1
star
71

c25k-org

1
star
72

sifra

Python
1
star
73

gauges-clj

Clojure
1
star
74

web-development

1
star
75

trumpett

trumpett is a Twitter client for Android
Java
1
star
76

gemini

Rust
1
star
77

documents

1
star
78

hilltopfm

PHP
1
star
79

srt.clj

SRT parser in Clojure
Clojure
1
star
80

raised

Python
1
star
81

MdChrome

Markdown preview Chrome extension
JavaScript
1
star
82

magit-gerrit-plus

Emacs Lisp
1
star
83

CoffeeTodo

This is here for archiving purposes. It will probably be deleted soon.
Python
1
star
84

ggl

global git log
Rust
1
star
85

fluent-forever-625

1
star
86

bedfordbaptist.touch

Android application to allow quick access to Bedford Baptist Church information.
Java
1
star
87

gitutils

Fun git scripts written in Python
Python
1
star
88

cs-todo

Todo app in ClojureScript
CSS
1
star
89

chaperone

Chaperone is a command line, time tracking utility
Python
1
star
90

osis

A golang library for parsing OSIS values to English
Go
1
star
91

django-persistent-models

A drop-in replacement for django.db.models.Model that provides a persistent version of the model class
1
star
92

pyselecta

Fuzzy search
Go
1
star
93

vote

Python
1
star
94

filmdetect

Go
1
star
95

pannote

Search your text files
Python
1
star