Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move UltiSnips snippets into vim-snippets. #311

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 0 additions & 45 deletions AUTHORS

This file was deleted.

201 changes: 41 additions & 160 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
IMPORTANT: comment on: [What about merging with Ultisnip using its engine](https://github.com/garbas/vim-snipmate/issues/114)

Snipmate & UltiSnip Snippets
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is outdated. UltiSnips is now a drop in replacement for snipMate - merging is in one sense "done" and in one sense "not needed".

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No Its not, see other comment. Just because you say it doesn't make it true. What might be missing
a) declacative approach
b) selecting the snippet files to us
c) being able to define your own viml function which patches/adds/removes snippets
...

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The discussion is outdated still - there has been made no progress and no decision for months and it seems like we have reached a feature saturation more or less. It is also about engines, not datafiles - most users will not care. I have no problem referencing this someplace else, but not as first line on the top.

============================

Expand All @@ -9,82 +7,64 @@ 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
- `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.

github.com/garbas/vim-snipmate:
VimL, snipmate-snippets, engine sometimes behaves strange, supports
rewriting snippets on the fly (eg adding a second version with folding
markers)

github.com/MarcWeber/UltiSnips:
python, snipmate-snippets and UltiSnips-snippets

github.com/SirVer/ultisnips:
python, UltiSnips-snippets

github.com/Shougo/neosnippet:
viml, has a compatible mode allowing to reuse most snipmate snippets ?

github.com/drmingdrmer/xptemplate:
Totally different syntax, does not read snippets contained in this file,
but it is also very powerful. It does not support vim-snippets (just
listing it here for completness)

This tries to be a more comprehensive list (which still is incomplete)
http://vim-wiki.mawercer.de/wiki/topic/text-snippets-skeletons-templates.html
- [github.com/SirVer/ultisnips](https://github.com/SirVer/ultisnips):
python, supports all snippets in this repo.
- [github.com/garbas/vim-snipmate](https://github.com/garbas/vim-snipmate):
VimL, snipmate-snippets, engine sometimes behaves strange. Supports
snippets/*
- [github.com/Shougo/neosnippet](https://github.com/Shougo/neosnippet.vim):
VimL, supports snippets/* with some configuration.

UltiSnips engine has additional features such as "nested snippets".
UltiSnips has additional features such as high speed, nesting snippets,
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I made some advertisement here, but I believe that all statements are accurate and I only voiced the opinion that was already there. If desired, I can tone it down a bit.

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 MarcWeber/UltiSnips a try because its
fast and supports all important features. You can prefer the UltiSnip versions
of the snippets by setting the "always_use_first_snippet" option to 1.
Which one to use? If you have python give [SirVer/ultisnips](https://github.com/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.
[garbas/vim-snipmate](https://github.com/garbas/vim-snipmate) and cope with the
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This has no relevance to this repo as it comes with its own snippets and will never support these.

minor bugs found in the engine.


Installation
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I changed this to be for Vundle as it is the most popular plugin manager right now (with 4577 stars). pathogen is close second (4340 stars), but I reason that users that use pathogen can figure out how to convert the installation instruction to git repos. I mention VAM as suggested alternative because it seems superior (I have never tried it though), but as it only has <10% of the stars of the others it seems silly to add instructions for it and not for the mainstream ones.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

VAM is maintained by two users, VAM can emualate Vundle (or could If I would spend another 6 hours on vundle (as I did reviewing the issues - finding many duplications). I don't think that stars are the right way to draw conclusions. VAM has been first, VAM has all features vundle has, VAM provides dependency management. VAM has a pool (thus allows to manage the community by softly telling users about alternatives) etc. VAM is nice to windows users because it supports vam.mawercer.de etc.
We know that vundle appears to have more users - but it doesn't mean its the better plugin manager (it caused Shougo to fork in the end).
We are aware of this: MarcWeber/vim-addon-manager#148

The "declarative" design behind VAM is superior: I've created an issue:
VundleVim/Vundle.vim#388

One important difference is that vundle depends on vim-scripts, thus cannot install all scripts because vim scripts maps titles to urls without caring about some titltes being used multiple times VAM (vim-pi) use script_id disambiguation.

I don't want to discuss its nice to have a plugin listed in your .vimrc and starting vim doesn't tell you that its missing (vundle case). It matters to me. I prefer declarative approaches in most cases - similar difference can be seen in your UltiSnips version vs my fork. Please keep VAM for those reasons. Supporting vundle also means supporting the dev workflow of vundle (trivial issues not getting processed for 2 years!). This leads to duplication and waste of time.

Summary about issues can be found here at the bottom:
VundleVim/Vundle.vim#241

The action we took for VAM was improving the README and preparing that missing features (such as version lock) could be implemented trivially.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not arguing that VAM is superior, I am arguing that my changes are useful to more people than the text we had before. I am also arguing that the changes to track with VAM are easy to make if you - especially as most users of VAM will probably have been converted from Vundle. As soon as more people use VAM I am all for switching this again. For now I believe Vundle is the common denominator.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And we should push vim-pi because we want vim-pi to be the place to discuss vim distribution in general. vim-pi wants to be open to linux distributions and systems like npackd. Nobody did it yet - but we could generate debian/gentoo/nix/... packages. The main issue why we didn't is amount of work - lack of interested - but we have some discussions going on. vim-pi wants to standardize plugin installation, too.

Eg have a look at : https://bitbucket.org/vimcommunity/vim-pi/issue/95/proposal-declarative-extensible-cross

Anyway: neovim (and lack of intersest) a reason to suspend all work. We should wait and see what's going to happen. Thus please join such discussions - so that we can make NeoBundle, vundle, and VAM have the same interface, such as "Script name, {opts}". - some managers would support some opts, other would not. But in 80% of all simple cases it would just work for all users.

Also compare this: #307
This is one of the reasons why I started that effort - more and more plugin managers get written (see vim-wiki), and making all users have dozens of install instructions doesn't make sense.

That's one of the reasons why I want to "ignore stars" and try pushing the "better solutions". I agree that what is a better solutions depends on personal view. In this case its minimizing overall work and duplication.

============
First be aware that there are many options, see "Snippet engines" above.
Second be aware than there are [tons of plugin managers](http://vim-wiki.mawercer.de/wiki/topic/vim%20plugin%20managment.html)
which is why Marc Weber thinks that it doesn't make sense to repeat the same
repetitive information everywhere.
------------

*Recommended way:*
[vim-addon-manager](vim-addon-manager) (because Marc Weber wrote it for exactly
this reason, it supports simple dependency management). Eg you're done by this
line in your .vimrc:
First be aware that there are many options, see "Snippet engines" above. Second
be aware than there are [tons of plugin
managers](http://vim-wiki.mawercer.de/wiki/topic/vim%20plugin%20managment.html).
The install instructions are for [Vundle](https://github.com/gmarik/Vundle.vim),
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed all references to MarcWeber/UltiSnips - it does not support "priority" and has some other outstanding bugs that I do not want to support. I'll continue supporting my version of course.

but should be easy to adapt for you situation. We recommend a smart plugin
manager like [vim-addon-manager](https://github.com/MarcWeber/vim-addon-manager)
that will take care of tracking dependencies for you.

```
" assuming you want to use snipmate snippet engine
ActivateAddons vim-snippets snipmate
```
Using UltiSnips as your engine:

[vim-pi](https://bitbucket.org/vimcommunity/vim-pi/issue/90/we-really-need-a-web-interface)
Is the place to discuss plugin managers and repository resources.
Bundle 'SirVer/ultisnips'
Bundle 'honza/vim-snippets'

About how to install snipate see [snipmate@garbas](https://github.com/garbas/vim-snipmate)
Using snipMate as your engine:

(Bundle, Pathogen, git clone - keywords to make people find this link by ctrl-f search)
I know that I should be reading the docs of the snippet engine, just let me copy paste into my .vmirc:
(See this pull request)[https://github.com/honza/vim-snippets/pull/307/files].
Bundle 'MarcWeber/vim-addon-mw-utils' " Dependency.
Bundle 'tomtom/tlib_vim' " Dependency.
Bundle 'garbas/vim-snipmate'
Bundle 'honza/vim-snippets'

TROUBLE
=======
If you still have trouble getting this to work create a github ticket, ask on
irc or the mailinglist.

Policies / for contributors
===========================
---------------------------

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

Expand All @@ -96,11 +76,7 @@ el : else ..
wh : while (cond) ...
```

If you're not satisfied with these defaults, open a ticket that we implement
aliasing. Then you can remap "else" to "el" or the like.


Don't add stupid placeholder default texts like
Don't add useless placeholder default texts like
```
if (${1:condition}){
${2:some code here}
Expand All @@ -114,20 +90,8 @@ if (${1}){
}
```

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

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: https://github.com/honza/vim-snippets/issues/230


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:

Expand All @@ -139,69 +103,14 @@ so that all users can benefit from them. People can list their snippet reposito
Installation using VAM: "github:rbonvall/snipmate-snippets-bib"


Future - ideas - examples
=========================
[overview snippet engines](http://vim-wiki.mawercer.de/wiki/topic/text-snippets-skeletons-templates.html)
If you have ideas you can add them to that list of "snippet engine features by example".


Historical notes
================

[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.

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 github.com/garbas/vim-snipmate this way:


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

or github.com/MarcWeber/UltiSnips this way:


```vim
let g:UltiSnips = {}

let g:UltiSnips.snipmate_ft_filter = {
\ 'default' : {'filetypes': ["FILETYPE"] },
\ 'ruby' : {'filetypes': ["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 stop again
at will. So its ok if people maintain a language only for a short period of
time - or jump in and get things done - don't let the flow stop :)
vim-snippets is not like the "linux kernel".
Notes: People are interested in snippets - and their interest may wane again.
This list is kept up-to-date on a best effort basis.

* Python - [honza](http://github.com/honza)
* Javascript - [honza](http://github.com/honza)
Expand All @@ -213,35 +122,7 @@ vim-snippets is not like the "linux kernel".
* Falcon - [steveno](https://github.com/steveno)
* Elixir - [iurifq](https://github.com/iurifq)

Contributing notes
------------------

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.

Because MarcWeber/UltiSnips [6] supports also snipmate-snippets there is no
need to duplicate all snippets - only those snippets who use advanced UltiSnips
features should be duplicated in UltiSnips (?)

Currently all snippets from UltiSnips have been put into UltiSnips - some work
on merging should be done (dropping duplicates etc)

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
[6]: http://github.com/MarcWeber/UltiSnips
[7]: http://github.com/SirVer/ultisnips
All the snippets are licensed under the terms of the MIT license.
12 changes: 4 additions & 8 deletions UltiSnips/README
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
This directory contains the main scripts that come bundled with UltiSnips.
This directory contains the snippets for UltiSnips.
https://github.com/sirver/ultisnips

Standing On The Shoulders of Giants
===================================
Expand All @@ -10,12 +11,7 @@ two projects:
TextMate: http://svn.textmate.org/trunk/Bundles/
SnipMate: http://code.google.com/p/snipmate/

All snippets from those sources were copied and cleaned up, so that they are
- not using shell script, only python (so they are cross platform compatible)
- not using any feature that UltiSnips doesn't offer

UltiSnips has seen contributions by various individuals. Those contributions
have been merged into this collection seamlessly and without further comments.
UltiSnips has seen contributions by many individuals. Those contributions have
been merged into this collection seamlessly and without further comments.

-- vim:ft=rst:nospell:

Loading