Giter Site home page Giter Site logo

andreyorst / simplesnippets.vim Goto Github PK

View Code? Open in Web Editor NEW
86.0 4.0 5.0 331 KB

Simple snippet support for your Vim and Neovim

License: GNU General Public License v3.0

Vim Script 84.61% Python 1.23% Shell 14.16%
vim neovim vim-plugin neovim-plugin snippets snippet-manager

simplesnippets.vim's People

Contributors

andreyorst avatar hgdsraj avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

simplesnippets.vim's Issues

Snippet is inserted at wrong indentation

Hi.

I've more a question than an issue...

If I insert a snippet, it won't be inserted at the current level of indentation. It is alway inserted at column one. Are there special settings required (regarding tabstop, shiftwidth and so on)? It seem to work in gifs within the documentation though.

Thx in advance and greetings.

Integrate SimpleSnippets with "supertab" plugin?

I am currently using snipmate and would like to move to something simpler like this plugin.

However in my setup snipmate has one advantage - it be default works with supertab plugin which let's use tab for multiple purposes (keyword completion as well as snippet expansion).

Are there any plans to integrate SimpleSnippets with supertab?

'$n's somewhere in the text are confusing to SimpleSnippets

if '$n's appear somewhere in the file they're disturbing for snippets.

I've got that code somewhere in my file:

		GetLongMatch() {
			_log := new Logger("class." A_ThisFunc)

			RegExMatch(this.stExpr, "^([imsxADJUXPSC]+\))?(.*)", $)
			if (_log.Logs(Logger.Finest)) {
				_log.Finest("this.stExpr", this.stExpr)
				_log.Finest("$1", $1)
				_log.Finest("$2", $2)
			}
			
			return _log.Exit($1 "^--" (this.iFlags & OptParser.OPT_NEG ? "(no-?)?" : "") $2 "$")
		}

if I expand a snippet elsewhere it produces unwanted content:

simplesnippets_issue

The if snippet used in the example above looks like this:

if (${1:true}) {
	${0:; TODO: Add code}
}

Question: Is it possible to distinct between '$n's within the snippet and the rest of the file to avoid that behaviour? If not, a remark in the documentation would be helpfull. (I hope I haven't overseen this... ๐Ÿ˜จ)
If I replace the $ in my code, for example by an X, everything works fine what is a sufficient workaround for me. But I love your plugin and would like it to be as efficient as possible, so I opened this issue.

Environment:

  • OS: Windows 10
  • gVim version: VIM - Vi IMproved 8.1 (2018 May 18, compiled Jun 26 2018 07:57:14) / MS-Windows 64-bit GUI version / Included patches: 1-116
  • This plugin version: a414579

Feature request: Edit snippet descriptions file for current filetype

I want to be able to edit the snippet descriptions text file for the current filetype very easily.

Describe the solution you'd like
That's my local solution so far; feel free to modify and adapt it to the plugin; or take it just as an idea:

" Edit snippet descriptions for current filetype
function! SimpleSnippetsEditDescriptions()
	let ft = getbufvar(bufname('%'), '&filetype')
	if exists('g:SimpleSnippets_search_path')
		let path = g:SimpleSnippets_search_path
	else
		let path = $HOME.'/.vim/snippets/'
	endif
	:exec ':split '.path.ft.'/'.ft.'.snippets.descriptions.txt'
endfunction
command! -register SimpleSnippetsEditDescriptions call SimpleSnippetsEditDescriptions()

Output of SimpleSnippetsList is not formatted properly

Describe the bug
The output of SimpleSnippetsList is distorted on Windows.

Steps to reproduce
Submit :SimpleSnippetList on the Vim command line

Expected behavior
Display a well formed list of the available snippets.

Actual behavior
Due to the use of Linux version of the echo command the output on windows is not well formatted. Also backups of snippets (ending with ~) are displayed. IMO backup files should be suppressed in output.

Screenshot or gif (if possible)
simplesnippets_issuex_1

Environment:

  • OS: Windows 10
  • Vim version: VIM - Vi IMproved 8.1 (2018 May 17, compiled Jun 7 2018 08:35:40) / MS-Windows 64-bit GUI version / Included patches: 1-37
  • This plugin version: ac4d64e

btw: Thanks a lot for implementing SimpleSnippetsEditDescriptions . Work's great ๐Ÿ‘

Gifs, Features, Announcments

SimpleSnippets.vim

New features, improvements, doc updates, and other will be listed here.

Subscribe if you interested.

SimpleSnippets overview:
demo

Some non letter characters can't be used as placeholder separators

Summary

It is not possible to define a snippet with placeholders next to eachother or connected with nonletter characters like _ which vim inludes inside <word>

Steps to reproduce

  1. Define ${1:lorem}_${0:ipsum} or ${1:lorem}${0:ipsum} snippets
  2. Try to expand

Expected behavior:

lorem is selected, and upon jump ipsum is selected.

Actual behavior:

Select mode is on, but nothing is selected, and jumping does nothing.

Configuraton

Vim Version: NVIM v0.3.0-1062-gfe5f38d8b
This plugin version: badee69
Operating system: Archlinux
List of plugins: None

Improve snippet engine core

Improve the core of snippet engine to use different approach to make available nested placeholders and tabstops, which is impossible or near impossible to do with current implementation of the core.

Snippet body can be parsed and yanked to file, but unparsed snippet is stays in memory. While jumping placeholders can be obtained from memory and positions of placeholder's contents in the text can be used, rather then searching for the text itself. This will make possible to use nested placeholders in any order, if the unparsed snippet in memory is updated simultaneously with parsed snippet in the file. This also will make possible of non-unique bodies of different placeholders, and even empty placeholders, a.k.a. tabstops.

I will update this issue at some point of developing. Subscribe if you're interested.

Goals:

  • New user input detection method
  • Realtime mirroring
  • Tabstops
  • Nested placeholders
  • New jump engine, that is not based on searching for a string.
  • Make possible to use any incremental order of placeholder indexes.

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.