1
0
Fork 0

nvim: Improve mini.completion behaviour

This commit is contained in:
Daniel Kempkens 2023-10-23 14:30:10 +02:00
parent ea785631e6
commit fc3d1832dd
Signed by: daniel
SSH key fingerprint: SHA256:Ks/MyhQYcPRQiwMKLAKquWCdCPe3JXlb1WttgnAoSeM
2 changed files with 21 additions and 4 deletions

View file

@ -18,7 +18,6 @@
(set o.showbreak "↪ ") (set o.showbreak "↪ ")
(set o.backspace [:indent :eol :start]) (set o.backspace [:indent :eol :start])
(set o.signcolumn :no) (set o.signcolumn :no)
(set o.completeopt [:menu :menuone :noselect])
(set o.startofline false) (set o.startofline false)
(set o.synmaxcol 300) (set o.synmaxcol 300)
(set o.viewoptions [:cursor :folds :slash :unix]) (set o.viewoptions [:cursor :folds :slash :unix])
@ -49,7 +48,7 @@
(set o.conceallevel 2) (set o.conceallevel 2)
(set o.concealcursor :nc) (set o.concealcursor :nc)
(set o.updatetime 1000) (set o.updatetime 1000)
(o.shortmess:append :cS) (o.shortmess:append :S)
(set o.termguicolors true) (set o.termguicolors true)
(set o.mouse :a) (set o.mouse :a)
(set o.mousemodel :popup_setpos) (set o.mousemodel :popup_setpos)

View file

@ -1,5 +1,10 @@
(let [miniclue (require :mini.clue) (let [miniclue (require :mini.clue)
hipatterns (require :mini.hipatterns)] hipatterns (require :mini.hipatterns)
b vim.b
api vim.api
ctrl_n (api.nvim_replace_termcodes :<C-g><C-g><C-n> true false true)
augroup (vim.api.nvim_create_augroup :NifocMini {:clear true})
aucmd vim.api.nvim_create_autocmd]
;; https://github.com/echasnovski/mini.nvim/blob/main/readmes/mini-ai.md ;; https://github.com/echasnovski/mini.nvim/blob/main/readmes/mini-ai.md
((. (require :mini.ai) :setup) {}) ((. (require :mini.ai) :setup) {})
;; https://github.com/echasnovski/mini.nvim/blob/main/readmes/mini-clue.md ;; https://github.com/echasnovski/mini.nvim/blob/main/readmes/mini-clue.md
@ -12,6 +17,14 @@
;; 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 ;; https://github.com/echasnovski/mini.nvim/blob/main/readmes/mini-completion.md
(set b.nifoc_completion_fallback_count 0)
(fn completion-fallback []
(let [count b.nifoc_completion_fallback_count]
(when (< count 3)
(api.nvim_feedkeys ctrl_n :n false)
(set b.nifoc_completion_fallback_count (+ count 1)))))
((. (require :mini.completion) :setup) {:window {:info {:height 25 ((. (require :mini.completion) :setup) {:window {:info {:height 25
:width 80 :width 80
:border :rounded} :border :rounded}
@ -19,7 +32,12 @@
:width 80 :width 80
:border :rounded}} :border :rounded}}
:lsp_completion {:source_func :omnifunc :lsp_completion {:source_func :omnifunc
:auto_setup false}}) :auto_setup false}
:fallback_action completion-fallback})
(aucmd [:InsertLeave :CursorHoldI]
{:callback #(set b.nifoc_completion_fallback_count 0)
:group augroup
:desc "Re-enable completion fallback on cursor-hold"})
;; 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}