summaryrefslogtreecommitdiff
path: root/fnl/config
diff options
context:
space:
mode:
authorGustaf Rydholm <gustaf.rydholm@gmail.com>2022-04-03 21:22:20 +0200
committerGustaf Rydholm <gustaf.rydholm@gmail.com>2022-04-03 21:22:20 +0200
commitffc0a822e4fe8e61eef703b59a8abbe06ca5a06c (patch)
tree10b66a7354396df07aaf0cb7885e5fcc23dfa71c /fnl/config
parent81dce587f968f58cbb6ca74cc9a57a7bef9b56c8 (diff)
feat(cmp): add fnl config
Diffstat (limited to 'fnl/config')
-rw-r--r--fnl/config/cmp.fnl47
1 files changed, 47 insertions, 0 deletions
diff --git a/fnl/config/cmp.fnl b/fnl/config/cmp.fnl
new file mode 100644
index 0000000..a9163a1
--- /dev/null
+++ b/fnl/config/cmp.fnl
@@ -0,0 +1,47 @@
+;; Configuration for completion plugin.
+(module config.cmp
+ {autoload {nvim aniseed.nvim
+ util util}})
+
+(local luasnip (let [(ok? luasnip) util.load-plugin :luasnip]
+ (when ok?
+ ((require :luasnip/loaders/from_vscode).lazy_load)
+ luasnip)))
+
+(local lspkind (let [(ok? lspkind) util.load-plugin :lspkind]
+ (when ok?
+ lspkind)))
+
+(lspkind.init)
+
+(defn- snip [args]
+ (luasnip.lsp_expand args.body)
+
+(let [(ok? cmp) util.load-plugin :cmp]
+ (when ok?
+ (cmp.setup {
+ :snippet {
+ :expand snip}
+ :mapping {
+ "<C-k>" (cmp.mapping.select_prev_item)
+ "<C-j>" (cmp.mapping.select_next_item)}
+ :sources [
+ {:name "nvim_lsp"}
+ {:name "nvim_lua"}
+ {:name "luasnip"}
+ {:name "buffer" :keyword_length 4}
+ {:name "path" :keyword_length 6}]
+ :formatting {:format (lspkind.cmp_format {
+ :with_text true
+ :menu {
+ :buffer "[Buf]"
+ :nvim_lsp "[LSP]"
+ :nvim_lua "[api]"
+ :path "[path]"
+ :luasnip "[Snip]"
+ }})}
+ :documentation {
+ :border [ "╭" "─" "╮" "│" "╯" "─" "╰" "│" ]}
+ :experimental {
+ :ghost_text false
+ :native_menu false}})))