(local cmp (require :cmp)) (fn has-words-before [] (let [(line col) (unpack (vim.api.nvim_win_get_cursor 0)) cur-line (. (vim.api.nvim_buf_get_lines 0 (- line 1) line true 1))] (and (not= col 0) (= (: (: cur-line :sub col col) :match "%s") nil)))) (let [lspkind (require :lspkind)] (cmp.setup {:formatting {:format lspkind.cmp_format :show_labelDetails true} ;:snippet {:expand (fn [args] ; (let [luasnip (require :luasnip)] ; (luasnip.lsp_expand args.body)) :sources [{:name "buffer"} {:name "nvim_lsp"} {:name "look"} {:name "path"} {:name "calc"} {:name "spell"} {:name "tags"}] :mapping {"" (cmp.mapping.scroll_docs -4) "" (cmp.mapping.scroll_docs 4) "" (cmp.mapping (cmp.mapping.select_prev_item) [:i :c]) "" (cmp.mapping (cmp.mapping.select_next_item) [:i :c]) "" (cmp.mapping.close) "" (cmp.mapping.confirm {:select true})}})) ; "" (cmp.mapping tab [:i :s]) ; "" (cmp.mapping stab [:i :s])}}))