1
0
Fork 0

nvim: Use mini.completion

This commit is contained in:
Daniel Kempkens 2023-10-18 23:18:10 +02:00
parent 8fabb9c29a
commit b4f63c6e7b
Signed by: daniel
SSH key fingerprint: SHA256:Ks/MyhQYcPRQiwMKLAKquWCdCPe3JXlb1WttgnAoSeM
5 changed files with 31 additions and 13 deletions

View file

@ -67,6 +67,7 @@
(set g.mapleader " ") ; Some plugins need this, so set it before the keymap is loaded (set g.mapleader " ") ; Some plugins need this, so set it before the keymap is loaded
(set o.timeoutlen 400) (set o.timeoutlen 400)
(set g.loaded_python_provider 0) ; Disable built-in providers (set g.loaded_python_provider 0) ; Disable built-in providers
(set g.loaded_python3_provider 0)
(set g.loaded_ruby_provider 0) (set g.loaded_ruby_provider 0)
(set g.loaded_node_provider 0) (set g.loaded_node_provider 0)
(set g.loaded_perl_provider 0) (set g.loaded_perl_provider 0)

View file

@ -9,6 +9,14 @@
gitsigns (require :gitsigns) gitsigns (require :gitsigns)
repl (require :nifoc.repl) repl (require :nifoc.repl)
formatting (require :nifoc.formatting)] formatting (require :nifoc.formatting)]
(set _G.mini_cr_action
(fn []
(if (not= (vim.fn.pumvisible) 0)
(if (not= (. (vim.fn.complete_info) :selected) -1)
(vim.api.nvim_replace_termcodes :<C-y> true true true)
(vim.api.nvim_replace_termcodes :<C-y><CR> true true true))
((. (require :mini.pairs) :cr)))))
(fn mod.setup [] (fn mod.setup []
(keymap.set :n :<space> :<nop> {:noremap true}) (keymap.set :n :<space> :<nop> {:noremap true})
;; Leader Mappings ;; Leader Mappings
@ -48,7 +56,8 @@
(keymap.set :n :<leader>dtp :<cmd>TSPlaygroundToggle<CR> (keymap.set :n :<leader>dtp :<cmd>TSPlaygroundToggle<CR>
{:desc "Toggle Treetsitter Playground"}) {:desc "Toggle Treetsitter Playground"})
;; Other Mappings ;; Other Mappings
(keymap.set :n :F #(formatting.maybe-format-buffer 0) {:desc "Format Buffer"}) (keymap.set :n :F #(formatting.maybe-format-buffer 0)
{:desc "Format Buffer"})
(keymap.set :n :<A-Left> :b) (keymap.set :n :<A-Left> :b)
(keymap.set :n :<A-Right> :w) (keymap.set :n :<A-Right> :w)
(keymap.set :n :<S-Left> "^") (keymap.set :n :<S-Left> "^")
@ -66,7 +75,13 @@
(keymap.set :x :gp "<Plug>(YankyGPutAfter)") (keymap.set :x :gp "<Plug>(YankyGPutAfter)")
(keymap.set :x :gP "<Plug>(YankyGPutBefore)") (keymap.set :x :gP "<Plug>(YankyGPutBefore)")
(keymap.set :n :y "<Plug>(YankyYank)") (keymap.set :n :y "<Plug>(YankyYank)")
(keymap.set :x :y "<Plug>(YankyYank)")) (keymap.set :x :y "<Plug>(YankyYank)")
;; Completion
(keymap.set :i :<Tab> "pumvisible() ? \"\\<C-n>\" : \"\\<Tab>\""
{:expr true})
(keymap.set :i :<S-Tab> "pumvisible() ? \"\\<C-p>\" : \"\\<S-Tab>\""
{:expr true})
(keymap.set :i :<CR> "v:lua._G.mini_cr_action()" {:expr true}))
(fn mod.lsp-attach [client bufnr] (fn mod.lsp-attach [client bufnr]
(keymap.set :n :<leader>t (keymap.set :n :<leader>t

View file

@ -1,6 +1,5 @@
(let [lsp (require :lspconfig) (let [lsp (require :lspconfig)
lsp-configs (require :lspconfig.configs) lsp-configs (require :lspconfig.configs)
coq (require :coq)
navic (require :nvim-navic) navic (require :nvim-navic)
diagnostic (require :nifoc.diagnostic) diagnostic (require :nifoc.diagnostic)
augroup (vim.api.nvim_create_augroup :NifocLsp {:clear true}) augroup (vim.api.nvim_create_augroup :NifocLsp {:clear true})
@ -22,13 +21,16 @@
(when (client.supports_method :textDocument/inlayHint) (when (client.supports_method :textDocument/inlayHint)
(vim.lsp.inlay_hint bufnr true) (vim.lsp.inlay_hint bufnr true)
(setup-inlay-hint-toggle bufnr)) (setup-inlay-hint-toggle bufnr))
(when (client.supports_method :textDocument/completion)
(set vim.opt_local.omnifunc
"v:lua.MiniCompletion.completefunc_lsp"))
(diagnostic.maybe-enable-lsp client bufnr))) (diagnostic.maybe-enable-lsp client bufnr)))
:group augroup :group augroup
:desc "Automatic LSP setup"}) :desc "Automatic LSP setup"})
;; Servers ;; Servers
(vim.lsp.set_log_level :OFF) (vim.lsp.set_log_level :OFF)
(let [flags {:allow_incremental_sync true :debounce_text_changes 700} (let [flags {:allow_incremental_sync true :debounce_text_changes 700}
default-config (coq.lsp_ensure_capabilities {: flags}) default-config {: flags}
default-servers [:bashls default-servers [:bashls
:cssls :cssls
:dockerls :dockerls

View file

@ -11,6 +11,15 @@
:clues [(miniclue.gen_clues.builtin_completion)]}) :clues [(miniclue.gen_clues.builtin_completion)]})
;; https://github.com/echasnovski/mini.nvim/blob/main/readmes/mini-comment.md ;; https://github.com/echasnovski/mini.nvim/blob/main/readmes/mini-comment.md
((. (require :mini.comment) :setup) {}) ((. (require :mini.comment) :setup) {})
;; https://github.com/echasnovski/mini.nvim/blob/main/readmes/mini-completion.md
((. (require :mini.completion) :setup) {:window {:info {:height 25
:width 80
:border :rounded}
:signature {:height 25
:width 80
:border :rounded}}
:lsp_completion {:source_func :omnifunc
:auto_setup false}})
;; https://github.com/echasnovski/mini.nvim/blob/main/readmes/mini-hipatterns.md ;; https://github.com/echasnovski/mini.nvim/blob/main/readmes/mini-hipatterns.md
(hipatterns.setup {:highlighters {:fixme {:pattern "%f[%w]()FIXME()%f[%W]" (hipatterns.setup {:highlighters {:fixme {:pattern "%f[%w]()FIXME()%f[%W]"
:group :MiniHipatternsFixme} :group :MiniHipatternsFixme}

View file

@ -184,15 +184,6 @@ in
telescope-ui-select-nvim telescope-ui-select-nvim
telescope-undo-nvim telescope-undo-nvim
# Completion
{
plugin = pkgs.vimPlugins.coq_nvim;
config = builtins.readFile ../../config/nvim/plugins/coq.fnl;
type = "fennel";
}
pkgs.vimPlugins.coq-artifacts
# LSP # LSP
{ {
plugin = nvim-lspconfig; plugin = nvim-lspconfig;