Commit graph

34 commits

Author SHA1 Message Date
polirritmico
a7a4b4682c docs: Add descriptions for <Plug> mappings 2024-03-03 09:18:37 +01:00
L3MON4D3
1e57afa005 Format with stylua 2023-12-02 16:24:58 +01:00
L3MON4D3
ce400352e6 feat: major overhaul of loaders. Check DOC.md-changes for the gist.
Previously, we could not
* add files that were not present when `load/lazy_load` was called to
  the collection. This is pretty annoying if one wants to add
  project-local snippets, or snippets for a new filetype (ofc).
* load collections whose directory/package.json(c) did not exist when
  `load` was called.
  This is also an annoyance when creating project-local snippets, since
  a re-`load()` is required for the snippets to be picked up.
* pick up on changes to the snippet-files from another neovim-instance
  (due to reloading on BufWritePost)

This patch fixes all of these by modularizing the loaders a bit more,
into one component ("Collection") which takes care of all the logic of
loading different files, and another ("fswatchers") which notify the
collections when a file-change is detected. This allows, first of all, a
better design where the first concern can be nullified, and secondly, us
to use libuvs api for file-watching, to implement the last two (if a
potentially non-existing collection should be loaded, we can use libuv
to wait for the collection-root/manifest-file, and create the collection
once that exists).

Another cool addition is the loader-snippet-cache, which makes it so
that the snippet files (for vscode and snipmate) are only loaded once
for all filetypes, and not once for each filetype. That's probably not
noticeable though, except if a collection with many extends/languages
for one json-file is loaded :D
2023-12-02 16:24:58 +01:00
Cheng XU
c93c45731b Use event.buf directly to get bufnr
Due to the neovim's issue (https://github.com/neovim/neovim/issues/16416),
using `vim.fn.expand` sometimes throws Keyboard interrupt error when
pressing Ctrl-C (a common alternative to Esc).

This works around the above issue by simply getting the buffer number
from event argument.
2023-11-04 09:17:26 +01:00
Serdar Sayın
7cbbe4a831 fix: vim.pretty_print is deprecated (^neovim-0.9.0)
see:
040f145984/runtime/doc/news.txt (LL321C3-L321C3)

vim.pretty_print is removed in development (prerelease) build:
https://github.com/neovim/neovim/releases/tag/nightly
2023-05-06 00:22:08 +02:00
leiserfg
d33cf7de14 Format with stylua 2023-02-21 12:19:49 +01:00
leiserfg
5673a27252 Prefer vim.filetype.add over ftdetect scripts 2023-02-21 12:19:49 +01:00
L3MON4D3
b8eeac5579 Format with stylua 2023-02-18 16:37:23 +01:00
Max
a37a52ec19 feat!(Breaking Change): move most of plugin/luasnip.vim to lua.
Since this uses the autocmd-api, from now on neovim 0.7.0 will be the
minimum supported version (up from 0.5.0).
2023-02-18 16:37:23 +01:00
Mike
f36fca2aa5 feat: Add new locally_jumpable(dir) function 2022-09-08 22:14:12 +02:00
L3MON4D3
e471a296c9 add load_ft_func to customize filetypes loaded for a given buffer.
This can be used to load more than the buffers &filetype, for example,
if `ft_func` uses treesitter to correctly expand snippets in injected
regions, the buffers &filetype may not include all filetypes of these
regions.
So, via load_ft_func(bufnr) -> filetype[] (aka. list of strings), such
buffers can be detected and load snippets for all possible injected
regions.
2022-05-20 19:56:59 +02:00
L3MON4D3
76f23e4719 Move lazy_load-autocommands into plugin/luasnip.vim.
So lazy_load() always loads already-loaded filetypes, even if the
load-events don't occur again.
2022-05-12 23:40:36 +02:00
L3MON4D3
eb1a3b393e feat: Enable repeating snippets via vim-repeat (closes #225).
Simply stores snippet+opts during snip_expand() and points vim-repeat
to a function that calls snip_expand() with the stored parameters.
2022-01-02 15:49:47 +01:00
rhcher
08233ce310 add luasnip#expand_or_locally_jumpable() function. 2021-11-09 15:53:42 +08:00
hituzi no sippo
32a9b59633
fix mode of <Plug>luasnip-expand-snippet keymap to select 2021-09-04 07:07:17 +09:00
L3MON4D3
f03b4c00ad Add <Plug>-mapping for previous choice (Closes #131). 2021-08-25 19:34:17 +02:00
L3MON4D3
1230441a80 Add function to check if the current snippet was deleted+<Plug>-mapping. 2021-08-24 12:43:37 +02:00
L3MON4D3
d4ddebdb4f Add expand and expandable function+vim-versions (close #79). 2021-07-20 21:33:06 +02:00
L3MON4D3
c1ed401f82
Merge branch 'master' into update_config_correctly 2021-07-11 20:41:26 +02:00
L3MON4D3
b94accc402 Delete nodes from deleted buffer. 2021-06-30 23:30:34 +02:00
L3MON4D3
943508a957 Rename list_available, make it return table (more flexible). 2021-06-23 16:04:44 +02:00
L3MON4D3
87b09838e3 Add LuaSnipListAvailable, does exactly what it sounds like (inspired by #32). 2021-06-23 15:36:42 +02:00
TJ DeVries
c9c4bee198 fix: reset config when config is updated 2021-06-11 15:14:15 -04:00
L3MON4D3
cdecbab548 Add option to choose which events update dependent nodes. 2021-05-31 13:51:55 +02:00
L3MON4D3
65d2b2f58b Update aucmd and comment as snippets are more node-agnostic now. 2021-05-30 10:50:45 +02:00
leiserfg
59c313e198 Add jumpable viml function 2021-05-26 19:35:16 +02:00
L3MON4D3
ecbb7b5512 Move autoload-stuff to plugin. 2021-05-25 19:05:33 +02:00
leiserfg
01833cb687 Move autogrup to plugins as it has to be loaded asap 2021-05-25 10:33:25 +02:00
L3MON4D3
5912861b79 Add <Plug>-map's for select mode. 2021-05-12 23:46:41 +02:00
L3MON4D3
96193dd292 Ad command for unlinking. 2021-04-18 10:06:33 +02:00
L3MON4D3
9a02142e6d Add 'jumpable' to check if jumping forward/backward is possible. 2021-03-31 15:29:03 +02:00
L3MON4D3
e713998d45 Choices dont need to be confirmed anymore. 2021-03-21 11:11:57 +01:00
L3MON4D3
d3388313c1 Add viml-bindings. 2021-03-20 22:11:51 +01:00
L3MON4D3
93a02c864c Make mappings simpler/possible. 2021-03-19 16:02:24 +01:00