mirror of
https://github.com/elkowar/dots-of-war.git
synced 2024-11-06 03:12:24 +00:00
Add some cmp stuff to vim
This commit is contained in:
parent
bba6442cd2
commit
f46a8231a0
4 changed files with 48 additions and 14 deletions
|
@ -14,15 +14,16 @@
|
||||||
(defn use [...]
|
(defn use [...]
|
||||||
(let [pkgs [...]]
|
(let [pkgs [...]]
|
||||||
(packer.startup
|
(packer.startup
|
||||||
(fn [use]
|
{1 (fn [use]
|
||||||
(for [i 1 (a.count pkgs) 2]
|
(for [i 1 (a.count pkgs) 2]
|
||||||
(let [name (. pkgs i)
|
(let [name (. pkgs i)
|
||||||
opts (. pkgs (+ i 1))]
|
opts (. pkgs (+ i 1))]
|
||||||
(-?> (. opts :mod) (safe-req-conf))
|
(-?> (. opts :mod) (safe-req-conf))
|
||||||
(use (a.assoc opts 1 name))))))))
|
(use (a.assoc opts 1 name)))))
|
||||||
|
:config {:compile_path (.. (vim.fn.stdpath "config") "/lua/packer_compiled.lua")}})))
|
||||||
|
|
||||||
(use
|
(use
|
||||||
|
:lewis6991/impatient.nvim {}
|
||||||
:elkowar/yuck.vim {}
|
:elkowar/yuck.vim {}
|
||||||
:nvim-lua/plenary.nvim {}
|
:nvim-lua/plenary.nvim {}
|
||||||
:elkowar/antifennel-nvim {:opt false :config #(set vim.g.antifennel_executable "/home/leon/tmp/antifennel/antifennel")}
|
:elkowar/antifennel-nvim {:opt false :config #(set vim.g.antifennel_executable "/home/leon/tmp/antifennel/antifennel")}
|
||||||
|
@ -161,11 +162,19 @@
|
||||||
:hrsh7th/cmp-vsnip {}
|
:hrsh7th/cmp-vsnip {}
|
||||||
:hrsh7th/cmp-nvim-lsp {}
|
:hrsh7th/cmp-nvim-lsp {}
|
||||||
:hrsh7th/cmp-buffer {}
|
:hrsh7th/cmp-buffer {}
|
||||||
|
:hrsh7th/cmp-path {}
|
||||||
|
:hrsh7th/cmp-nvim-lua {}
|
||||||
|
:hrsh7th/cmp-calc {}
|
||||||
|
|
||||||
:hrsh7th/nvim-cmp {:opt false
|
:hrsh7th/nvim-cmp {:opt false
|
||||||
:requires [:hrsh7th/cmp-nvim-lsp
|
:requires [:hrsh7th/cmp-nvim-lsp
|
||||||
:hrsh7th/cmp-buffer
|
:hrsh7th/cmp-buffer
|
||||||
:hrsh7th/cmp-vsnip]
|
:hrsh7th/cmp-vsnip
|
||||||
|
:hrsh7th/cmp-nvim-lua
|
||||||
|
:hrsh7th/cmp-calc
|
||||||
|
:hrsh7th/cmp-path]
|
||||||
|
|
||||||
|
|
||||||
:config #(require "dots.plugins.cmp")}
|
:config #(require "dots.plugins.cmp")}
|
||||||
|
|
||||||
|
|
||||||
|
@ -223,6 +232,8 @@
|
||||||
:bakpakin/fennel.vim {}
|
:bakpakin/fennel.vim {}
|
||||||
:evanleck/vim-svelte {})
|
:evanleck/vim-svelte {})
|
||||||
|
|
||||||
|
(require "packer_compiled")
|
||||||
|
|
||||||
; >>>
|
; >>>
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -2,18 +2,39 @@
|
||||||
{autoload {a aniseed.core
|
{autoload {a aniseed.core
|
||||||
cmp cmp}})
|
cmp cmp}})
|
||||||
|
|
||||||
|
; check this for coloring maybe
|
||||||
|
; https://github.com/hrsh7th/nvim-cmp/blob/ada9ddeff71e82ad0e52c9a280a1e315a8810b9a/lua/cmp/entry.lua#L199
|
||||||
|
(defn item-formatter [item vim-item]
|
||||||
|
(let [padding (string.rep " " (- 10 (vim.fn.strwidth vim-item.abbr)))
|
||||||
|
details (?. item :completion_item :detail)]
|
||||||
|
(when details
|
||||||
|
(set vim-item.abbr (.. vim-item.abbr padding " " details))))
|
||||||
|
vim-item)
|
||||||
|
|
||||||
|
|
||||||
(cmp.setup
|
(cmp.setup
|
||||||
{:snippet {:expand (fn [args]
|
{:snippet {:expand (fn [args] ((. vim.fn :vsnip#anonymous) args.body))}
|
||||||
((. vim.fn :vsnip#anonymous) args.body))}
|
|
||||||
|
:completion {:autocomplete false}
|
||||||
|
|
||||||
:mapping {:<C-d> (cmp.mapping.scroll_docs -4)
|
:mapping {:<C-d> (cmp.mapping.scroll_docs -4)
|
||||||
:<C-f> (cmp.mapping.scroll_docs 4)
|
:<C-f> (cmp.mapping.scroll_docs 4)
|
||||||
:<C-space> (cmp.mapping.complete)
|
:<C-space> (cmp.mapping.complete)
|
||||||
:<esc> #(do (cmp.mapping.close) (vim.cmd "stopinsert"))
|
:<esc> #(do (cmp.mapping.close) (vim.cmd "stopinsert"))
|
||||||
:<CR> (cmp.mapping.confirm {:select true})}
|
:<CR> (cmp.mapping.confirm {:select true})}
|
||||||
|
|
||||||
|
;:experimental {:custom_menu true}
|
||||||
|
|
||||||
:sources [{:name "nvim_lsp" :priority 5}
|
:sources [{:name "nvim_lsp" :priority 5}
|
||||||
{:name "vsnip" :priority 3}
|
{:name "vsnip" :priority 3}
|
||||||
|
{:name "nvim_lua"}
|
||||||
|
{:name "calc"}
|
||||||
|
{:name "path"}
|
||||||
{:name "crates"}]
|
{:name "crates"}]
|
||||||
;{:name "buffer"}]
|
;{:name "buffer"}]
|
||||||
|
|
||||||
|
:formatting {:format item-formatter}
|
||||||
|
|
||||||
:sorting {:comparators [#(do
|
:sorting {:comparators [#(do
|
||||||
;(print ($1:get_kind) $1.completion_item.label "--" ($2:get_kind) $2.completion_item.label)
|
;(print ($1:get_kind) $1.completion_item.label "--" ($2:get_kind) $2.completion_item.label)
|
||||||
(if (= 15 ($1:get_kind)) false nil)) ; 15 means "SNIPPET", see https://github.com/hrsh7th/nvim-cmp/blob/main/lua/cmp/types/lsp.lua
|
(if (= 15 ($1:get_kind)) false nil)) ; 15 means "SNIPPET", see https://github.com/hrsh7th/nvim-cmp/blob/main/lua/cmp/types/lsp.lua
|
||||||
|
@ -25,3 +46,4 @@
|
||||||
cmp.config.compare.length
|
cmp.config.compare.length
|
||||||
cmp.config.compare.order]}})
|
cmp.config.compare.order]}})
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -5,10 +5,8 @@
|
||||||
|
|
||||||
(telescope.setup
|
(telescope.setup
|
||||||
{:defaults {:mappings {:i {:<esc> actions.close}}
|
{:defaults {:mappings {:i {:<esc> actions.close}}
|
||||||
:file_ignore_patterns ["Cargo.lock" ".*.snap" "docs/theme/.*"]}
|
:file_ignore_patterns ["Cargo.lock" ".*.snap" "docs/theme/.*"]}})
|
||||||
:extensions {:frecency {:persistent_filter false}}})
|
|
||||||
|
|
||||||
(telescope.load_extension "frecency")
|
|
||||||
(telescope.load_extension "dap")
|
(telescope.load_extension "dap")
|
||||||
(telescope.load_extension "packer")
|
(telescope.load_extension "packer")
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
colors dots.colors}
|
colors dots.colors}
|
||||||
require-macros [macros]})
|
require-macros [macros]})
|
||||||
|
|
||||||
|
|
||||||
(macro make-errors-epic [f]
|
(macro make-errors-epic [f]
|
||||||
`(xpcall #,f #(let [fennel# (require :aniseed.fennel)]
|
`(xpcall #,f #(let [fennel# (require :aniseed.fennel)]
|
||||||
(a.println (fennel#.traceback $1)))))
|
(a.println (fennel#.traceback $1)))))
|
||||||
|
@ -16,6 +17,8 @@
|
||||||
|
|
||||||
(make-errors-epic (require "dots.plugins"))
|
(make-errors-epic (require "dots.plugins"))
|
||||||
|
|
||||||
|
(require "impatient")
|
||||||
|
|
||||||
(make-errors-epic (require "dots.plugins.lsp"))
|
(make-errors-epic (require "dots.plugins.lsp"))
|
||||||
(make-errors-epic (require "dots.keybinds"))
|
(make-errors-epic (require "dots.keybinds"))
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue