Giter Club home page Giter Club logo

vis-ultisnips's Introduction

UltiSnips plugin for Vis editor.

This isn't an official plugin reimplementation. I am not in any way affiliated with UltiSnips developer(s).

I needed this functionality in Vis, and UltiSnips seemed powerful and mature enough, and had plenty of templates available.

How to make it work

Configuration

  1. copy snippets.lua into your .config/vis/plugins directory

  2. (optional) if you don't already have snippets, get them. You can clone https://github.com/honza/vim-snippets

  3. in snippets.lua modify the snippetfiles value so that it points to the absolute path where you keep your UltiSnip snippets. Trailing slash is necessary

Usage

In insert mode, hit <C-j> to show vis-menu with all snippets found for the currently set syntax - it literally looks for a file in your path called <syntax>.lua. You can also pre-type the snippet tabtrigger that you're looking for.

When snippet is expanded, all of its tags will be added to the selection jumplist. You can use Vis motions g< and g> to navigate between them.

What works

You can:

  • get a list of snippets per syntax
  • insert the snippet
  • navigate around its anchor points

What is known to not work

Temporarily

  1. Multiple selections for same tag numbers (only figured out half an hour ago a solution to multiple selections)

Is unlikely to work until someone fixes it (ie. I don't care much about it right now)

  1. python interpolations, date interpolations, etc etc etc

  2. nested tags (correctly parsed, but not correctly inserted)

  3. options

What is supposed to work but might not

  • Parsing of more complex snippets. Lpeg grammar for this is quite complex (I'm looking at you, nested tags feature)

  • vis-menu for one or the other reason corrupts my terminal when invoked. This might be plugin doing something its not supposed to - but I don't know what. If you do, please PR. Mind you, dmenu has no such problems.

  • who knows??? This was supposed to be few hours project max, ended up being a rabbit hole!

Final notes

All of this, because muscle memory from vim made me remember I can't just insert {-# LANGUAGE ...#-} pragma via template.

And I didn't like that.

So I spent upwards of 15h writing this plugin.

Go figure.

vis-ultisnips's People

Contributors

machinedgod avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.