From c2b7d428190dbc16a2c0b18ce724beaee12be1b1 Mon Sep 17 00:00:00 2001 From: Gustaf Rydholm Date: Wed, 24 Jul 2024 01:20:47 +0200 Subject: Start of the great snip journey --- fnl/plugins/cmp.fnl | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'fnl') diff --git a/fnl/plugins/cmp.fnl b/fnl/plugins/cmp.fnl index 1745191..3b8c1da 100644 --- a/fnl/plugins/cmp.fnl +++ b/fnl/plugins/cmp.fnl @@ -32,7 +32,7 @@ {:name :buffer :group_index 2} {:name :spell :group_index 3} {:name :nvim_lua} - {:name :luasnip} + {:name :luasnip :group_index 1 :keyword_length 1} {:name :path :keyword_length 6}] :performance {:debounce 200 :throttle 250 @@ -41,11 +41,17 @@ (cmp.setup.filetype [:org :orgagenda] {:sources [{:name :orgmode :group_index 1} {:name :buffer :group_index 2} + {:name :luasnip + :group_index 1 + :keyword_length 1} {:name :spell :group_index 3}]}) (cmp.setup.filetype [:sql] {:sources [{:name :vim-dadbod-completion :group_index 1} {:name :buffer :group_index 2} + {:name :luasnip + :group_index 1 + :keyword_length 1} {:name :spell :group_index 3}]}) (cmp.setup.cmdline "/" {:mapping (cmp.mapping.preset.cmdline) @@ -58,6 +64,7 @@ (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")]) (vim.keymap.set [:i :s] : (lambda [] (when (luasnip.expand_or_jumpable) @@ -67,6 +74,11 @@ (lambda [] (when (luasnip.jumpable -1) (luasnip.jump -1)) - {:silent true}))))) + {:silent true})) + (vim.keymap.set [:i] : + (lambda [] + (when (luasnip.choice_active) + (luasnip.change_choice 1))) + {:silent true})))) {1 :hrsh7th/nvim-cmp : dependencies :event :InsertEnter : config} -- cgit v1.2.3-70-g09d2