diff options
author | Gustaf Rydholm <gustaf.rydholm@gmail.com> | 2024-07-24 01:37:26 +0200 |
---|---|---|
committer | Gustaf Rydholm <gustaf.rydholm@gmail.com> | 2024-07-24 01:37:26 +0200 |
commit | 23cf10e11632e2acc23c33a665bc40e0b2a60bc8 (patch) | |
tree | 4b05e4bc55e5d6951ce0ec732e43fc3f09e88567 /fnl/plugins | |
parent | a8edade144262773a46c9adc951f420d9b2fcfd1 (diff) |
Update snippets
Diffstat (limited to 'fnl/plugins')
-rw-r--r-- | fnl/plugins/cmp.fnl | 27 |
1 files changed, 17 insertions, 10 deletions
diff --git a/fnl/plugins/cmp.fnl b/fnl/plugins/cmp.fnl index 3b8c1da..2a8d280 100644 --- a/fnl/plugins/cmp.fnl +++ b/fnl/plugins/cmp.fnl @@ -61,24 +61,31 @@ :sources [{:name :path} {:name :cmdline :option {:ignore_cmds [:Man "!"]}}]}) - (let [luasnip (require :luasnip)] - (luasnip.config.set_config {:history false - :updateevents "TextChanged,TextChangedI"}) - (luasnip.add_snippets :org [(luasnip.parser.parse_snippet :be "#+begin_src $1\n$2\n#+end_src")]) + (let [ls (require :luasnip) + fmt (require :luasnip.extras.fmt)] + (ls.config.set_config {:history false + :updateevents "TextChanged,TextChangedI"}) + (let [s ls.s + i ls.insert_node + fmt fmt.fmt] + (ls.add_snippets :org + [(s :be + (fmt "#+begin_src {}\n{}\n#+end_src" + [(i 1) (i 2)]))])) (vim.keymap.set [:i :s] :<c-k> (lambda [] - (when (luasnip.expand_or_jumpable) - (luasnip.expand_or_jump))) + (when (ls.expand_or_jumpable) + (ls.expand_or_jump))) {:silent true}) (vim.keymap.set [:i :s] :<c-j> (lambda [] - (when (luasnip.jumpable -1) - (luasnip.jump -1)) + (when (ls.jumpable -1) + (ls.jump -1)) {:silent true})) (vim.keymap.set [:i] :<c-l> (lambda [] - (when (luasnip.choice_active) - (luasnip.change_choice 1))) + (when (ls.choice_active) + (ls.change_choice 1))) {:silent true})))) {1 :hrsh7th/nvim-cmp : dependencies :event :InsertEnter : config} |