From beb3ed1effdc5dbd047c583598b83615075363b7 Mon Sep 17 00:00:00 2001 From: Gustaf Rydholm Date: Mon, 29 Jul 2024 00:03:28 +0200 Subject: Update how lsp, snippets and plugins are loaded --- fnl/plugins/snippets.fnl | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 fnl/plugins/snippets.fnl (limited to 'fnl/plugins/snippets.fnl') diff --git a/fnl/plugins/snippets.fnl b/fnl/plugins/snippets.fnl new file mode 100644 index 0000000..91865d6 --- /dev/null +++ b/fnl/plugins/snippets.fnl @@ -0,0 +1,33 @@ +;; Snippets functionality. + +(local dependencies [:rafamadriz/friendly-snippets]) + +(λ add-snippets [name] + (let [snippets (require (.. :plugins.snippets. name))] + (snippets.add-snippets))) + +(local {: load-and-apply} (require :util.load)) + +(λ config [] + (let [ls (require :luasnip) + luasnip-vscode (require :luasnip.loaders.from_vscode)] + (luasnip-vscode.lazy_load) + (load-and-apply :/fnl/plugins/snippets add-snippets) + (ls.config.set_config {:history false + :updateevents "TextChanged,TextChangedI"}) + (vim.keymap.set [:i :s] : + (lambda [] + (when (ls.expand_or_jumpable) + (ls.expand_or_jump))) {:silent true}) + (vim.keymap.set [:i :s] : + (lambda [] + (when (ls.jumpable -1) + (ls.jump -1)) + {:silent true})) + (vim.keymap.set [:i] : + (lambda [] + (when (ls.choice_active) + (ls.change_choice 1))) + {:silent true}))) + +{1 :L3MON4D3/LuaSnip :event :InsertEnter : config : dependencies} -- cgit v1.2.3-70-g09d2