Changed completion's for the cmdline

This commit is contained in:
Alexander Rosenberg 2023-02-08 21:45:02 -08:00
parent ea6256c0ac
commit eb3ce80e7d
Signed by: Zander671
GPG Key ID: 5FD0394ADBD72730
2 changed files with 83 additions and 9 deletions

View File

@ -16,7 +16,7 @@
[ :i :c ])
:<C-e> (cmp.mapping (cmp.mapping.abort)
[ :i :c ])
:<CR> (cmp.mapping
:<cr> (cmp.mapping
(cmp.mapping.confirm { :select false })
[ :i :c ])
:<C-j> (cmp.mapping
@ -59,6 +59,8 @@
{ :name "treesitter" :priority 1 :group 2 }
{ :name "buffer" :priority 0 :group 3 }
{ :name "path" :priority 0 :group 4 }]
:view {
:entries { :name "custom" :selection_order "near_cursor" }}
:sorting {
:priority_weight 2
:comparators [
@ -75,17 +77,89 @@
]}})
(cmp.setup.filetype [ :lisp ]
{ :option { :fuzzy false }
:sources
:sources
[{ :name "vlime" :priority 2 :group 1 }
{ :name "snippy" :priority 2 :group 2 }
{ :name "buffer" :priority 0 :group 3 }
{ :name "path" :priority 0 :group 4 }]})
(let [cmdline-mappings
{ :<C-space> (cmp.mapping (cmp.mapping.complete)
[ :i :c ])
:<C-e> (cmp.mapping (cmp.mapping.abort)
[ :i :c ])
:<cr> (cmp.mapping
(cmp.mapping.confirm { :select false })
[ :i :c ])
:<Tab> (cmp.mapping
(fn []
(if (cmp.visible)
(cmp.select_next_item)
(do
(cmp.complete)
(cmp.complete_common_string))))
[ :i :c ])
:<S-Tab> (cmp.mapping
(fn []
(if (cmp.visible)
(cmp.select_prev_item)
(do
(cmp.complete)
(cmp.complete_common_string))))
[ :i :c ])
:<C-k> (cmp.mapping
(fn []
(if (cmp.visible)
(cmp.select_next_item
{ :behavior cmp.SelectBehavior.Select })
(vim.api.nvim_feedkeys
(vim.api.nvim_replace_termcodes :<up>
true
false
true)
:n false)))
[ :i :c ])
:<C-j> (cmp.mapping
(fn []
(if (cmp.visible)
(cmp.select_prev_item
{ :behavior cmp.SelectBehavior.Select })
(vim.api.nvim_feedkeys
(vim.api.nvim_replace_termcodes :<down>
true
false
true)
:n false)))
[ :i :c ])
:<C-p> (cmp.mapping
(cmp.mapping.select_next_item
{ :behavior cmp.SelectBehavior.Select })
[ :i :c ])
:<C-n> (cmp.mapping
(cmp.mapping.select_prev_item
{ :behavior cmp.SelectBehavior.Select })
[ :i :c ])
:<up> (cmp.mapping
(fn [fallback]
(if (cmp.visible)
(cmp.select_next_item
{ :behavior cmp.SelectBehavior.Select })
(fallback)))
[ :i :c ])
:<down> (cmp.mapping
(fn [fallback]
(if (cmp.visible)
(cmp.select_prev_item
{ :behavior cmp.SelectBehavior.Select })
(fallback)))
[ :i :c ])}]
(cmp.setup.cmdline "/"
{ :mapping (cmp.mapping.preset.cmdline)
{ :completion { :autocomplete true }
:mapping cmdline-mappings
:sources (cmp.config.sources
[{ :name "buffer" }])})
(cmp.setup.cmdline ":"
{ :mapping (cmp.mapping.preset.cmdline)
:sources (cmp.config.sources
[{ :name "cmdline" }
{ :name "path" }])}))}
{ :completion { :autocomplete false }
:mapping cmdline-mappings
:sources (cmp.config.sources
[{ :name "cmdline" }
{ :name "path" }])})))}

View File

@ -38,8 +38,8 @@
(bind! :n :D "<cmd>Telescope lsp_type_definitions<cr>" buf)
;; Some trouble commands
(bind! :n :<leader>e "<cmd>TroubleToggle document_diagnostics<cr>")
(bind! :n :<leader>E "<cmd>TroubleToggle workspace_diagnostics<cr>"))
(bind! :n :<leader>q "<cmd>TroubleToggle document_diagnostics<cr>")
(bind! :n :<leader>Q "<cmd>TroubleToggle workspace_diagnostics<cr>"))
(fn get-data-dir [server root]