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 o.timeoutlen 400)
(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_node_provider 0)
(set g.loaded_perl_provider 0)

View file

@ -9,6 +9,14 @@
gitsigns (require :gitsigns)
repl (require :nifoc.repl)
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 []
(keymap.set :n :<space> :<nop> {:noremap true})
;; Leader Mappings
@ -48,7 +56,8 @@
(keymap.set :n :<leader>dtp :<cmd>TSPlaygroundToggle<CR>
{:desc "Toggle Treetsitter Playground"})
;; 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-Right> :w)
(keymap.set :n :<S-Left> "^")
@ -66,7 +75,13 @@
(keymap.set :x :gp "<Plug>(YankyGPutAfter)")
(keymap.set :x :gP "<Plug>(YankyGPutBefore)")
(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]
(keymap.set :n :<leader>t

View file

@ -1,6 +1,5 @@
(let [lsp (require :lspconfig)
lsp-configs (require :lspconfig.configs)
coq (require :coq)
navic (require :nvim-navic)
diagnostic (require :nifoc.diagnostic)
augroup (vim.api.nvim_create_augroup :NifocLsp {:clear true})
@ -22,13 +21,16 @@
(when (client.supports_method :textDocument/inlayHint)
(vim.lsp.inlay_hint bufnr true)
(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)))
:group augroup
:desc "Automatic LSP setup"})
;; Servers
(vim.lsp.set_log_level :OFF)
(let [flags {:allow_incremental_sync true :debounce_text_changes 700}
default-config (coq.lsp_ensure_capabilities {: flags})
default-config {: flags}
default-servers [:bashls
:cssls
:dockerls

View file

@ -11,6 +11,15 @@
:clues [(miniclue.gen_clues.builtin_completion)]})
;; https://github.com/echasnovski/mini.nvim/blob/main/readmes/mini-comment.md
((. (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
(hipatterns.setup {:highlighters {:fixme {:pattern "%f[%w]()FIXME()%f[%W]"
:group :MiniHipatternsFixme}

View file

@ -184,15 +184,6 @@ in
telescope-ui-select-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
{
plugin = nvim-lspconfig;