vim-snipper.txt For Vim version 7.5 Last change: July 15, 2022
Vim-Snipper
A semi-automatic, minimalistic
snippets plugin
that does not get in your way!
Author: Óscar Pereira
Email: See https://gd7.eu/contact
License: GPL
Vim-Snipper is a plugin for snippet expansion, that strives to have the same
"work and feel" of Michael Sanders' snipMate plugin
(https://github.com/msanders/snipmate.vim). In fact, after installing it,
you can grab some *.snippet files (e.g., mine, that are based on Sanders',
available at https://github.com/notnotrandom/vim-snipper-snippets), and just
start using the plugin!
By "using", I mean the following: type a trigger (say, "for" in a *.c file),
hit <Tab>: the skeleton of a for loop will be shown, with the variables etc.
as tabstops. Type the names you want, go back and forth between tabstops
with <Tab> and <S-Tab>, until you are satisfied, and then it's done!
There is also passive completion: changing e.g. the variable name once, will
change it in the other places where it shows up. All in all, I strived to
make this snippet plugin "just work" -- so as to let the user focus on his
task, rather than on his tool.
Shoutouts & thanks
* Michael Sanders, the original author of the snipMate plugin.
==============================================================================
Table of Contents vim_snipper-toc
1. Installation vim_snipper-installation
2. Snippet files vim_snipper-snippets
==============================================================================
1. Installation vim_snipper-installation
To install Vim-Snipper, I will assume you are a good citizen, and use
something like Tim Pope's Pathogen plugin, or something to that effect. In
the case of Pathogen, just clone this plugin into the bundle directory,
usually ~/.vim/bundle, and run :Helptags afterwords.
Next, open up vimrc and ensure it contains the following line:
filetype plugin indent on
For basic usage, the only additional thing you need are *.snippet files,
about which, see vim_snipper-snippets.
However, there are three settings that you can use:
debug: Boolean
* Vim-Snipper shows debug output.
* Default: 0 (debug output is not shown).
*
disable: Boolean
* Vim-Snipper is disabled temporarily.
* Default: 0 (Vim-Snipper is loaded).
snippet_location: String
* Directory where the plugin most look for *.snippet files.
* Default: '~/.vim/snippets'.
You set these, er, settings, by defining a Dictionary called
g:snipper_config in your vimrc.
Example:
let g:snipper_config = {
\ 'debug' : 1,
\ 'disable' : 0,
\ 'snippet_location' : '~/snippets/',
\}
==============================================================================
2. Snippet files vim_snipper-snippets
Back when I started using Sanders' snipMate plugin, I quickly modified the
provided snippets to suit my tastes -- and those changes were so quick and
heavy, that convinced me that a plugin to insert and process snippets is
one thing, but the snippets themselves are another thing. Hence, this
plugin of mine does not come with snippets out of the box.
However, that does not mean that the user has to start writing his
snippets from scratch, because I do provide a starting point, namely the
bunch of snippets available here:
https://github.com/notnotrandom/vim-snipper-snippets. My suggestion is to
clone them into the whatever location g:snipper_config.snippet_location
points to, and start using them. And then, do as I have done: modify them
to suit your own needs.
==============================================================================
vim:tw=78:ts=8:ft=help:norl