summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGustaf Rydholm <gustaf.rydholm@gmail.com>2024-07-24 01:20:47 +0200
committerGustaf Rydholm <gustaf.rydholm@gmail.com>2024-07-24 01:20:47 +0200
commitc2b7d428190dbc16a2c0b18ce724beaee12be1b1 (patch)
tree73037bdcc05b009d0a787241e3e9d7047af5a1a6
parentccf0c42b393f5c0bea71e040a30092f59062bbd1 (diff)
Start of the great snip journey
-rw-r--r--fnl/plugins/cmp.fnl16
1 files changed, 14 insertions, 2 deletions
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] :<c-k>
(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] :<c-l>
+ (lambda []
+ (when (luasnip.choice_active)
+ (luasnip.change_choice 1)))
+ {:silent true}))))
{1 :hrsh7th/nvim-cmp : dependencies :event :InsertEnter : config}