Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/Jorengarenar/miniSnip
Lightweight snippet plugin for Vim
https://github.com/Jorengarenar/miniSnip
plugin snippets vim vim-plugin
Last synced: 3 months ago
JSON representation
Lightweight snippet plugin for Vim
- Host: GitHub
- URL: https://github.com/Jorengarenar/miniSnip
- Owner: Jorengarenar
- License: mit
- Created: 2020-05-25T00:59:21.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2023-12-10T02:06:03.000Z (11 months ago)
- Last Synced: 2024-06-10T02:31:44.488Z (5 months ago)
- Topics: plugin, snippets, vim, vim-plugin
- Language: Vim Script
- Homepage:
- Size: 67.4 KB
- Stars: 51
- Watchers: 5
- Forks: 7
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
```
┏━━━┓
┃┏━┓┃
┏┓┏┳┳━┓┏┫┗━━┳━┓┏┳━━┓
┃┗┛┣┫┏┓╋╋━━┓┃┏┓╋┫┏┓┃
┃┃┃┃┃┃┃┃┃┗━┛┃┃┃┃┃┗┛┃
┗┻┻┻┻┛┗┻┻━━━┻┛┗┻┫┏━┛
┃┃
┗┛
```**miniSnip** is lightweight and minimal snippet plugin written in Vim Script.
## Installation
Use your favourite plugin manager to install miniSnip:
#### [minPlug](https://github.com/Jorengarenar/minPlug):
```vim
MinPlug Jorengarenar/miniSnip
```#### [vim-plug](https://github.com/junegunn/vim-plug):
```vim
Plug 'Jorengarenar/miniSnip'
```#### Vim's packages
```bash
cd ~/.vim/pack/plugins/start
git clone git://github.com/Jorengarenar/miniSnip.git
```#### [NeoBundle](https://github.com/Shougo/neobundle.vim)
```vim
NeoBundle 'Jorengarenar/miniSnip'
```## Usage
To get started with miniSnip, in your runtime (on UNIX usually: `~/.vim`)
create a directory called `miniSnip/all`. Then placing a file called `foo.snip`
inside it will create the `foo` snippet, which you can access by typing
`foo` in insert mode.Filetype-aware snippets are also available. For example, a file called
`main` in `~/.vim/miniSnip/java/main.snip` will create a `main` snippet only when
`filetype=java`, allowing you to add a `main` for C, `main` for C++ and so on.See [the documentation](doc/miniSnip.txt) to learn the snippet syntax and options.
## Features
* default values of placeholders (e.g. `<{example}>`)
* references to previous tags (e.g. `<{~2}>` refers to second placeholder)
* evaluation of Vim functions (e.g. `<{!expand('%')}>`)
* ins-completion function
* `<{+}>` will be targeted last (equivalent of `$0` in UltiSnips)
* filetype-aware snippets
* changing delimiters, snippet file filetype etc. (`:h miniSnip-configuration`)
* local snippets (`:h g:miniSnip_local`)
* named placeholders (`:h g:miniSnip_named`)
* global and local to buffer configuration (`:h g:miniSnip-configuration`)## Examples
* `c/incl.snip`
```
? Include header file
#include "<{!substitute(expand('%:t'), '\.c', '\.h', '')}>"
```* `html/html.snip`
```
? HTML basic structure
$ `{{` `}}`
{{Joren}}
{{}}
```
* `sql/join_no_match.snip`
```
SELECT <{table1}>.<{ID_1}>
FROM <{~1}>
LEFT JOIN <{table2}> ON <{~1}>.<{~2}> = <{~3}>.<{ID_2}>
WHERE <{~3}>.<{~4}> IS NULL
```* `sh/wrapper_exec.snip`
```
for dir in $(echo "$PATH" | tr ":" "\n" | grep -Fxv "$(dirname $0)"); do
[ -x "$dir/$(basename $0)" ] && exec "$dir/$(basename $0)" $@
done
```
---For more information, see [the documentation](doc/miniSnip.txt).
---
Based on [vim-minisnip](https://github.com/joereynolds/vim-minisnip)
Main differences:
* reference tags aren't relative, but absolute, i.e. `<{~1}>` will refer to
first placeholder insted to the previous, `<{~2}>` will refer to the second
instead of the penultimate
* references aren't in quotes
* references to bigger numbers than 9
* descriptions (`:h g:miniSnip_descmark`)
* option to change delimiters for specific snippet (`:h g:miniSnip_delimChg`)
* extending filetypes (`:h g:miniSnip_extends`)
* cursor at the end of snippets without placeholders, not the beginning
* directories instead of prefixes for snippets file management
* respect `expandtab`
* one final placeholder (`:h g:miniSnip_finalTag`) instead of final delimiters
* local snippets
* named placeholders
* configurable character class used to get snippet name