2023-02-19 21:23:55 +01:00
|
|
|
(local (cmp luasnip mztenv)
|
|
|
|
(values (require :cmp) (require :luasnip) (require :mzte_nv)))
|
|
|
|
|
2023-06-08 19:57:16 +02:00
|
|
|
(local sources {:buffer " "
|
2023-02-23 10:56:20 +01:00
|
|
|
:conjure " "
|
2023-02-19 21:23:55 +01:00
|
|
|
:crates " "
|
|
|
|
:luasnip " "
|
|
|
|
:nvim_lsp " "
|
|
|
|
:path " "
|
|
|
|
:treesitter " "})
|
|
|
|
|
|
|
|
(cmp.setup {:snippet {:expand #(luasnip.lsp_expand (. $1 :body))}
|
|
|
|
:mapping {:<C-b> (cmp.mapping (cmp.mapping.scroll_docs -4) [:i :c])
|
|
|
|
:<C-f> (cmp.mapping (cmp.mapping.scroll_docs 4) [:i :c])
|
|
|
|
:<C-Space> (cmp.mapping (cmp.mapping.complete) [:i :c])
|
|
|
|
:<Tab> (cmp.mapping mztenv.cmp.onTab [:i :s])
|
|
|
|
:<S-Tab> (cmp.mapping (cmp.mapping.select_prev_item))
|
2023-05-28 18:29:21 +02:00
|
|
|
:<C-Tab> (cmp.mapping #(if (luasnip.expand_or_jumpable)
|
|
|
|
(luasnip.expand_or_jump)
|
|
|
|
($1))
|
|
|
|
[:i :s])
|
2023-02-19 21:23:55 +01:00
|
|
|
:<CR> (cmp.mapping.confirm {:select true})}
|
|
|
|
:sources (cmp.config.sources (icollect [n _ (pairs sources)]
|
|
|
|
{:name n}))
|
|
|
|
:formatting {:format (fn [entry vim-item]
|
|
|
|
(tset vim-item :menu
|
|
|
|
(. sources entry.source.name))
|
|
|
|
vim-item)}})
|
|
|
|
|
|
|
|
(cmp.setup.cmdline "/" {:sources {:name :buffer}})
|
|
|
|
(cmp.setup.cmdline ":"
|
|
|
|
{:sources (cmp.config.sources [{:name :path}]
|
|
|
|
[{:name :cmdline}])})
|
|
|
|
|
2023-06-08 19:57:16 +02:00
|
|
|
(local signs {:Error " " :Warn " " :Hint " " :Info " "})
|
2023-02-19 21:23:55 +01:00
|
|
|
|
|
|
|
(each [k v (pairs signs)]
|
|
|
|
(let [hl (.. :DiagnosticSign k)]
|
|
|
|
(vim.fn.sign_define hl {:text v :texthl hl :numhl hl})))
|