diff options
author | Gustaf Rydholm <gustaf.rydholm@gmail.com> | 2024-07-24 23:52:59 +0200 |
---|---|---|
committer | Gustaf Rydholm <gustaf.rydholm@gmail.com> | 2024-07-24 23:52:59 +0200 |
commit | 77b60223fdc2af9ebcb39f563fee6f7b21294d27 (patch) | |
tree | 41fa6a8c61ae616144c26fb07af32a32de206eeb /fnl/plugins/snippets/init.fnl | |
parent | 23cf10e11632e2acc23c33a665bc40e0b2a60bc8 (diff) |
Refactor snippets
Diffstat (limited to 'fnl/plugins/snippets/init.fnl')
-rw-r--r-- | fnl/plugins/snippets/init.fnl | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/fnl/plugins/snippets/init.fnl b/fnl/plugins/snippets/init.fnl new file mode 100644 index 0000000..b586d76 --- /dev/null +++ b/fnl/plugins/snippets/init.fnl @@ -0,0 +1,31 @@ +;; Snippets functionality. + +(local dependencies [:rafamadriz/friendly-snippets]) + +(fn add-snippets [] + (let [org (require :plugins.snippets.org)] + (org.add-snippets))) + +(fn config [] + (let [ls (require :luasnip) + luasnip-vscode (require :luasnip.loaders.from_vscode)] + (luasnip-vscode.lazy_load) + (add-snippets) + (ls.config.set_config {:history false + :updateevents "TextChanged,TextChangedI"}) + (vim.keymap.set [:i :s] :<c-k> + (lambda [] + (when (ls.expand_or_jumpable) + (ls.expand_or_jump))) {:silent true}) + (vim.keymap.set [:i :s] :<c-j> + (lambda [] + (when (ls.jumpable -1) + (ls.jump -1)) + {:silent true})) + (vim.keymap.set [:i] :<c-l> + (lambda [] + (when (ls.choice_active) + (ls.change_choice 1))) + {:silent true}))) + +{1 :L3MON4D3/LuaSnip :event :InsertEnter : config : dependencies} |