1
0
Fork 0

nvim: switch from cmp to blink.cmp
Some checks failed
Build / build-arm64-linux (push) Failing after 1s
Build / build-amd64-linux (push) Successful in 2m36s

This commit is contained in:
Daniel Kempkens 2024-12-27 01:47:43 +01:00
parent c9a390f19c
commit 611a189ab0
Signed by: daniel
SSH key fingerprint: SHA256:Ks/MyhQYcPRQiwMKLAKquWCdCPe3JXlb1WttgnAoSeM
14 changed files with 150 additions and 270 deletions

View file

@ -497,11 +497,11 @@
}, },
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1735140310, "lastModified": 1735226532,
"narHash": "sha256-NuhGCcev/etYS4qAsh905St1Co0tK8FjgGDovUeCVjo=", "narHash": "sha256-4UYXERaJPiiy+JxjKo+IWuHN7kgwmlYdV5x8Ew+YNGQ=",
"owner": "nixos", "owner": "nixos",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "bb881a68c1174d38ee466a35f5e23d03a938b186", "rev": "03539677da5a6caba6a6b3d2143ec63b116902d3",
"type": "github" "type": "github"
}, },
"original": { "original": {

View file

@ -1,7 +1,7 @@
(let [mod {} (let [mod {}
keymap vim.keymap keymap vim.keymap
substitute (require :substitute) (ok-substitute substitute) (pcall require :substitute)
fzf (require :fzf-lua) (ok-fzf fzf) (pcall require :fzf-lua)
fzf-layout-bottom {:winopts_fn #(let [height (math.floor (* vim.o.lines fzf-layout-bottom {:winopts_fn #(let [height (math.floor (* vim.o.lines
0.4))] 0.4))]
{:split (.. "belowright new | resize " {:split (.. "belowright new | resize "
@ -9,45 +9,51 @@
fzf-layout-dropdown {:winopts {:height 0.4 fzf-layout-dropdown {:winopts {:height 0.4
:width 0.6 :width 0.6
:preview {:hidden :hidden}}} :preview {:hidden :hidden}}}
npairs (require :nvim-autopairs) (ok-npairs npairs) (pcall require :nvim-autopairs)
hover (require :hover) (ok-hover hover) (pcall require :hover)
gitsigns (require :gitsigns) (ok-gitsigns gitsigns) (pcall require :gitsigns)
neogit (require :neogit) (ok-neogit neogit) (pcall require :neogit)
wk (require :which-key) (ok-wk wk) (pcall require :which-key)
repl (require :nifoc.repl) repl (require :nifoc.repl)
repo (require :nifoc.repo) repo (require :nifoc.repo)
formatting (require :nifoc.formatting)] formatting (require :nifoc.formatting)]
(fn mod.setup [] (fn mod.setup []
(keymap.set :n :<space> :<nop> {:noremap true}) (keymap.set :n :<space> :<nop> {:noremap true})
;; Leader Mappings ;; Leader Mappings
(keymap.set :n :<leader>o fzf.files {:desc "Find Files"}) (when ok-fzf
(keymap.set :n :<leader>s #(fzf.live_grep fzf-layout-bottom) (keymap.set :n :<leader>o fzf.files {:desc "Find Files"})
{:desc "Live Grep"}) (keymap.set :n :<leader>s #(fzf.live_grep fzf-layout-bottom)
{:desc "Live Grep"}))
(keymap.set :n :<leader>fn :<cmd>enew<CR> {:desc "New File"}) (keymap.set :n :<leader>fn :<cmd>enew<CR> {:desc "New File"})
(keymap.set :n :<leader>u "<cmd>UrlView buffer<CR>" {:desc "Open UrlView"}) (keymap.set :n :<leader>u "<cmd>UrlView buffer<CR>" {:desc "Open UrlView"})
(keymap.set :n :<leader>c repl.open-shell {:desc "Open Shell"}) (keymap.set :n :<leader>c repl.open-shell {:desc "Open Shell"})
(keymap.set :n :<leader>r repl.open-repl {:desc "Open REPL"}) (keymap.set :n :<leader>r repl.open-repl {:desc "Open REPL"})
(keymap.set :n :<leader>bl fzf.buffers {:desc "List Buffers"}) (when ok-fzf
(keymap.set :n :<leader>bf fzf.grep_curbuf {:desc "Find In Buffer"}) (keymap.set :n :<leader>bl fzf.buffers {:desc "List Buffers"})
(keymap.set :n :<leader>bt fzf.treesitter {:desc "Find via Treesitter"}) (keymap.set :n :<leader>bf fzf.grep_curbuf {:desc "Find In Buffer"})
(keymap.set :n :<leader>g #(neogit.open {:kind :split}) (keymap.set :n :<leader>bt fzf.treesitter {:desc "Find via Treesitter"}))
{:desc "Open Neogit"}) (when ok-neogit
(keymap.set :n :<leader>vs #(neogit.open {:kind :split}) (keymap.set :n :<leader>g #(neogit.open {:kind :split})
{:desc "VCS Status"}) {:desc "Open Neogit"})
(keymap.set :n :<leader>vb #(fzf.git_branches fzf-layout-dropdown) (keymap.set :n :<leader>vs #(neogit.open {:kind :split})
{:desc "List VCS Branches"}) {:desc "VCS Status"}))
(keymap.set :n :<leader>vl #(gitsigns.blame_line {:full true}) (when ok-fzf
{:desc "Blame Line"}) (keymap.set :n :<leader>vb #(fzf.git_branches fzf-layout-dropdown)
{:desc "List VCS Branches"}))
(when ok-gitsigns
(keymap.set :n :<leader>vl #(gitsigns.blame_line {:full true})
{:desc "Blame Line"}))
(keymap.set :n :<leader>vd :<cmd>DiffviewOpen<CR> {:desc "Open DiffView"}) (keymap.set :n :<leader>vd :<cmd>DiffviewOpen<CR> {:desc "Open DiffView"})
(keymap.set :n :<leader>vvr #(repo.open-repo) {:desc "Open repository"}) (keymap.set :n :<leader>vvr #(repo.open-repo) {:desc "Open repository"})
(keymap.set :n :<leader>vvm #(repo.open-merge-request) {:desc "Open MR"}) (keymap.set :n :<leader>vvm #(repo.open-merge-request) {:desc "Open MR"})
(keymap.set :n :<leader>vvc #(repo.open-ci) {:desc "Open CI"}) (keymap.set :n :<leader>vvc #(repo.open-ci) {:desc "Open CI"})
(keymap.set :n :<leader>vtc #(repo.run-ci) {:desc "Trigger CI"}) (keymap.set :n :<leader>vtc #(repo.run-ci) {:desc "Trigger CI"})
(keymap.set :n :<leader>lk fzf.keymaps {:desc "Show Keymappings"}) (when ok-fzf
(keymap.set :n :<leader>ld #(fzf.diagnostics_document fzf-layout-bottom) (keymap.set :n :<leader>lk fzf.keymaps {:desc "Show Keymappings"})
{:desc "Show Diagnostics"}) (keymap.set :n :<leader>ld #(fzf.diagnostics_document fzf-layout-bottom)
(keymap.set :n :<leader>lt :<cmd>TodoFzfLua<CR> {:desc "Show Diagnostics"})
{:desc "Show Todo Comments"}) (keymap.set :n :<leader>lt :<cmd>TodoFzfLua<CR>
{:desc "Show Todo Comments"}))
(keymap.set :n :<leader>dli :<cmd>LspInfo<CR> {:desc "LSP Info"}) (keymap.set :n :<leader>dli :<cmd>LspInfo<CR> {:desc "LSP Info"})
(keymap.set :n :<leader>dlr :<cmd>LspRestart<CR> {:desc "Restart LSP"}) (keymap.set :n :<leader>dlr :<cmd>LspRestart<CR> {:desc "Restart LSP"})
(keymap.set :n :<leader>ds #(vim.diagnostic.open_float {:scope :line}) (keymap.set :n :<leader>ds #(vim.diagnostic.open_float {:scope :line})
@ -55,8 +61,9 @@
(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 :i :<CR> npairs.autopairs_cr (when ok-npairs
{:expr true :replace_keycodes false :silent true}) (keymap.set :i :<CR> npairs.autopairs_cr
{:expr true :replace_keycodes false :silent true}))
(keymap.set :n :F #(formatting.maybe-format-buffer 0) (keymap.set :n :F #(formatting.maybe-format-buffer 0)
{:desc "Format Buffer"}) {:desc "Format Buffer"})
(keymap.set :n :<A-Left> :b) (keymap.set :n :<A-Left> :b)
@ -74,7 +81,8 @@
{:noremap true :silent true}) {:noremap true :silent true})
(keymap.set :n :p "<Plug>(YankyPutAfter)") (keymap.set :n :p "<Plug>(YankyPutAfter)")
(keymap.set :n :P "<Plug>(YankyPutBefore)") (keymap.set :n :P "<Plug>(YankyPutBefore)")
(keymap.set :x :p substitute.visual) (when ok-substitute
(keymap.set :x :p substitute.visual))
(keymap.set :x :P "<Plug>(YankyPutBefore)") (keymap.set :x :P "<Plug>(YankyPutBefore)")
(keymap.set :n :gp "<Plug>(YankyGPutAfter)") (keymap.set :n :gp "<Plug>(YankyGPutAfter)")
(keymap.set :n :gP "<Plug>(YankyGPutBefore)") (keymap.set :n :gP "<Plug>(YankyGPutBefore)")
@ -84,35 +92,39 @@
(keymap.set :x :y "<Plug>(YankyYank)") (keymap.set :x :y "<Plug>(YankyYank)")
(keymap.set :n "-" :<cmd>Oil<CR> {:desc "Open Oil"}) (keymap.set :n "-" :<cmd>Oil<CR> {:desc "Open Oil"})
;; hover.nvim ;; hover.nvim
(keymap.set :n :K hover.hover {:desc "Show Documentation"}) (when ok-hover
(keymap.set :n :gK hover.hover_select {:desc "hover.nvim selection"}) (keymap.set :n :K hover.hover {:desc "Show Documentation"})
(keymap.set :n :<C-p> #(hover.hover_switch :previous) (keymap.set :n :gK hover.hover_select {:desc "hover.nvim selection"})
{:desc "hover.nvim previous source"}) (keymap.set :n :<C-p> #(hover.hover_switch :previous)
(keymap.set :n :<C-n> #(hover.hover_switch :next) {:desc "hover.nvim previous source"})
{:desc "hover.nvim next source"}) (keymap.set :n :<C-n> #(hover.hover_switch :next)
(keymap.set :n :<MouseMove> hover.hover_mouse {:desc "hover.nvim mouse"}) {:desc "hover.nvim next source"}))
;; Label ;; Label
(wk.add [{1 :<leader>v :group :vcs} (when ok-wk
{1 :<leader>l :group :list/lsp} (wk.add [{1 :<leader>v :group :vcs}
{1 :<leader>d :group :debug}])) {1 :<leader>l :group :list/lsp}
{1 :<leader>d :group :debug}])))
(fn mod.lsp-attach [_client bufnr] (fn mod.lsp-attach [_client bufnr]
(keymap.set :n :<leader>t #(fzf.lsp_document_symbols fzf-layout-dropdown) (when ok-fzf
{:buffer bufnr :desc "LSP Document Symbols"}) (keymap.set :n :<leader>t #(fzf.lsp_document_symbols fzf-layout-dropdown)
(keymap.set :n :<leader>tw #(fzf.lsp_workspace_symbols fzf-layout-dropdown) {:buffer bufnr :desc "LSP Document Symbols"})
{:buffer bufnr :desc "LSP Workspace Symbols"}) (keymap.set :n :<leader>tw
#(fzf.lsp_workspace_symbols fzf-layout-dropdown)
{:buffer bufnr :desc "LSP Workspace Symbols"}))
(keymap.set :n :<leader>th (keymap.set :n :<leader>th
#(vim.lsp.inlay_hint.enable (not (vim.lsp.inlay_hint.is_enabled bufnr)) #(vim.lsp.inlay_hint.enable (not (vim.lsp.inlay_hint.is_enabled bufnr))
{: bufnr}) {: bufnr})
{:buffer bufnr :desc "Toggle Inlay Hints"}) {:buffer bufnr :desc "Toggle Inlay Hints"})
(keymap.set :n :<leader>lca fzf.lsp_code_actions (when ok-fzf
{:buffer bufnr :desc "LSP Code Action"}) (keymap.set :n :<leader>lca fzf.lsp_code_actions
(keymap.set :n :<leader>lfr fzf.lsp_references {:buffer bufnr :desc "LSP Code Action"})
{:buffer bufnr :desc "Find References"}) (keymap.set :n :<leader>lfr fzf.lsp_references
(keymap.set :n :<leader>lfd fzf.lsp_definitions {:buffer bufnr :desc "Find References"})
{:buffer bufnr :desc "Find Definitions"}) (keymap.set :n :<leader>lfd fzf.lsp_definitions
(keymap.set :n :<leader>lfi fzf.lsp_implementations {:buffer bufnr :desc "Find Definitions"})
{:buffer bufnr :desc "Find Implementations"})) (keymap.set :n :<leader>lfi fzf.lsp_implementations
{:buffer bufnr :desc "Find Implementations"})))
(fn mod.terminal-open [bufnr] (fn mod.terminal-open [bufnr]
(let [map-opts {:buffer bufnr}] (let [map-opts {:buffer bufnr}]

View file

@ -6,7 +6,7 @@
v vim.v v vim.v
statusline (require :nifoc.statusline) statusline (require :nifoc.statusline)
diagnostic vim.diagnostic diagnostic vim.diagnostic
gitsigns (require :gitsigns) (ok-gitsigns gitsigns) (pcall require :gitsigns)
gitsigns-ns (api.nvim_create_namespace :gitsigns_signs_) gitsigns-ns (api.nvim_create_namespace :gitsigns_signs_)
augroup (vim.api.nvim_create_augroup :NifocStatuscolumn {:clear true}) augroup (vim.api.nvim_create_augroup :NifocStatuscolumn {:clear true})
aucmd vim.api.nvim_create_autocmd] aucmd vim.api.nvim_create_autocmd]
@ -64,11 +64,12 @@
(vim.diagnostic.get $1.buf)) (vim.diagnostic.get $1.buf))
:group augroup :group augroup
:desc "Update cached diagnostic signs"}) :desc "Update cached diagnostic signs"})
(aucmd :User {:pattern :GitSignsUpdate (when (= b.nifoc_gitsigns_enabled 1)
:callback #(when (not= $1.data nil) (aucmd :User {:pattern :GitSignsUpdate
(update-cache-gitsigns $1.data.buffer)) :callback #(when (not= $1.data nil)
:group augroup (update-cache-gitsigns $1.data.buffer))
:desc "Update cached gitsigns signs"}) :group augroup
:desc "Update cached gitsigns signs"}))
(aucmd :BufWipeout (aucmd :BufWipeout
{:callback (fn [args] {:callback (fn [args]
(tset cache :diagnostics args.buf nil) (tset cache :diagnostics args.buf nil)
@ -107,7 +108,8 @@
cursor-pos [mouse.line 0]] cursor-pos [mouse.line 0]]
(api.nvim_win_set_cursor mouse.winid (api.nvim_win_set_cursor mouse.winid
cursor-pos) cursor-pos)
(vim.defer_fn #(gitsigns.blame_line {:full true}) (vim.defer_fn #(when ok-gitsigns
(gitsigns.blame_line {:full true}))
100)))}}) 100)))}})
(set mod.gitsigns-or-bar [{:condition #(and (not= b.nifoc_gitsigns_enabled 1) (set mod.gitsigns-or-bar [{:condition #(and (not= b.nifoc_gitsigns_enabled 1)
(or (o.number:get) (or (o.number:get)

View file

@ -10,7 +10,7 @@
repo (require :nifoc.repo) repo (require :nifoc.repo)
nifoc-treesitter (require :nifoc.treesitter) nifoc-treesitter (require :nifoc.treesitter)
navic (require :nvim-navic) navic (require :nvim-navic)
neogit (require :neogit) (ok-neogit neogit) (pcall require :neogit)
fzf (require :fzf-lua) fzf (require :fzf-lua)
fzf-layout-bottom {:winopts_fn #(let [height (math.floor (* vim.o.lines fzf-layout-bottom {:winopts_fn #(let [height (math.floor (* vim.o.lines
0.4))] 0.4))]
@ -179,7 +179,7 @@
:hl {:fg colors.black :bg colors.orange :bold true}} :hl {:fg colors.black :bg colors.orange :bold true}}
3 {:provider #(.. $1.git-head " ") 3 {:provider #(.. $1.git-head " ")
:on_click {:name :heirline_git_branch :on_click {:name :heirline_git_branch
:callback #(neogit.open {:kind :split})} :callback #(when ok-neogit (neogit.open {:kind :split}))}
:hl {:fg colors.black :bg colors.orange :bold true}} :hl {:fg colors.black :bg colors.orange :bold true}}
4 mod.space 4 mod.space
5 {:provider #(.. " " $1.git-added " ") 5 {:provider #(.. " " $1.git-added " ")

View file

@ -8,9 +8,6 @@
g vim.g g vim.g
dracula (require :dracula) dracula (require :dracula)
dracula-colors (dracula.colors)] dracula-colors (dracula.colors)]
(fn swap-bg-with-fg [fg group]
(highlight group {: fg :bg (highlight-get-field group :fg)}))
(set mod.colors dracula-colors) (set mod.colors dracula-colors)
(fn mod.setup [] (fn mod.setup []
@ -29,46 +26,6 @@
(highlight :IlluminatedWordText {:bg mod.colors.selection}) (highlight :IlluminatedWordText {:bg mod.colors.selection})
(highlight :IlluminatedWordRead {:bg mod.colors.selection}) (highlight :IlluminatedWordRead {:bg mod.colors.selection})
(highlight :IlluminatedWordWrite {:bg mod.colors.selection :underline true}) (highlight :IlluminatedWordWrite {:bg mod.colors.selection :underline true})
;; cmp
(highlight :PmenuSel {:fg mod.colors.white :bg "#363848"})
(highlight :CmpCursorLine {:bg "#363848"})
(highlight :CmpItemAbbr {:fg mod.colors.white :bg :NONE})
(highlight :CmpItemAbbrMatch {:fg mod.colors.cyan :bg :NONE :bold true})
(highlight :CmpItemAbbrMatchFuzzy
{:fg mod.colors.cyan :bg :NONE :bold true})
(highlight :CmpItemAbbrDeprecated
{:fg mod.colors.white :bg :NONE :strikethrough true})
(highlight :CmpItemMenu {:fg mod.colors.purple :bg :NONE :italic true})
(let [cmp-groups [:CmpItemKindField
:CmpItemKindProperty
:CmpItemKindEvent
:CmpItemKindText
:CmpItemKindEnum
:CmpItemKindKeyword
:CmpItemKindConstant
:CmpItemKindConstructor
:CmpItemKindReference
:CmpItemKindFunction
:CmpItemKindStruct
:CmpItemKindClass
:CmpItemKindModule
:CmpItemKindOperator
:CmpItemKindVariable
:CmpItemKindUnit
:CmpItemKindSnippet
:CmpItemKindFolder
:CmpItemKindMethod
:CmpItemKindValue
:CmpItemKindEnumMember
:CmpItemKindInterface
:CmpItemKindColor
:CmpItemKindTypeParameter]]
(each [_ group (pairs cmp-groups)]
(swap-bg-with-fg mod.colors.black group)))
(highlight :CmpItemKindFile {:fg mod.colors.black :bg mod.colors.white})
(highlight :CmpItemKindFolder {:fg mod.colors.black :bg mod.colors.white})
(highlight :CmpItemKindTabNine
{:fg mod.colors.black :bg mod.colors.bright_magenta})
;; neogit ;; neogit
(highlight :NeogitBranch {:fg mod.colors.green :bold true}) (highlight :NeogitBranch {:fg mod.colors.green :bold true})
(highlight :NeogitBranchHead (highlight :NeogitBranchHead

View file

@ -1,20 +1,20 @@
(let [mod {} (let [mod {}
treesitter (require :nvim-treesitter) (ok treesitter) (pcall require :nvim-treesitter)
set-bufvar vim.api.nvim_buf_set_var] set-bufvar vim.api.nvim_buf_set_var]
(fn mod.setup [] (fn mod.setup []
(treesitter.define_modules {:nifoc_hooks {:enable false (if ok
:attach (lambda [bufnr] (treesitter.define_modules {:nifoc_hooks {:enable false
(set-bufvar bufnr :attach (lambda [bufnr]
:nifoc_treesitter_enabled (set-bufvar bufnr
1)) :nifoc_treesitter_enabled
:detach (lambda [bufnr] 1))
(set-bufvar bufnr :detach (lambda [bufnr]
:nifoc_treesitter_enabled (set-bufvar bufnr
0)) :nifoc_treesitter_enabled
:is_supported #true}})) 0))
:is_supported #true}})))
(fn mod.active? [] (fn mod.active? []
(= vim.b.nifoc_treesitter_enabled 1)) (= vim.b.nifoc_treesitter_enabled 1))
mod) mod)

View file

@ -0,0 +1,42 @@
(let [cmp (require :blink.cmp)
(ok-luasnip luasnip) (pcall require :luasnip)
config-snippets (if ok-luasnip
{:expand (fn [snippet]
(luasnip.lsp_expand snippet))
:active (fn [filter]
(if (and filter filter.direction)
(luasnip.jumpable filter.direction)
(luasnip.in_snippet)))
:jump (fn [direction] (luasnip.jump direction))}
{})
config-sources-providers (if (pcall require :cmp_tabnine.config)
{:cmp_tabnine {:name :cmp_tabnine
:module :blink.compat.source}}
{})]
(cmp.setup {:keymap {:preset :none
:<CR> [:accept :fallback]
:<esc> [:cancel :fallback]
:<Tab> [(fn [cmp]
(if (cmp.snippet_active) (cmp.accept)
(cmp.select_next)))
:snippet_forward
:fallback]
:<S-Tab> [:select_prev :snippet_backward :fallback]
:<Up> [:select_prev :fallback]
:<Down> [:select_next :fallback]
:<C-space> [:show
:show_documentation
:hide_documentation]
:<C-b> [:scroll_documentation_up :fallback]
:<C-f> [:scroll_documentation_down :fallback]
:<C-e> [:hide :fallback]}
:completion {:list {:selection :manual}
:menu {:min_width 20 :max_height 25}
:documentation {:auto_show true
:window {:border :rounded}}
:ghost_text {:enabled false}}
:signature {:enabled true}
:snippets config-snippets
:sources {:default [:lsp :cmp_tabnine :path :luasnip :buffer]
:providers config-sources-providers}
:fuzzy {:prebuilt_binaries {:download false :force_version nil}}}))

View file

@ -1,113 +0,0 @@
(let [cmp (require :cmp)
luasnip (require :luasnip)
lspkind (require :lspkind)
npairs (require :nvim-autopairs.completion.cmp)]
(fn main-sources []
(let [maybe-tabnine (if (pcall require :cmp_tabnine.config)
[{:name :cmp_tabnine}]
[])]
(vim.list_extend (vim.list_extend [{:name :nvim_lsp}] maybe-tabnine)
[{:name :async_path} {:name :luasnip}])))
(fn comparator-list []
(let [compare (require :cmp.config.compare)
maybe-tabnine (if (pcall require :cmp_tabnine.compare)
[(require :cmp_tabnine.compare)]
[])]
(vim.list_extend (vim.list_extend [compare.offset
compare.exact
compare.score]
maybe-tabnine)
[compare.recently_used
compare.locality
compare.kind
compare.length
compare.order])))
(fn has-words-before? []
(let [(line col) (-> 0 (vim.api.nvim_win_get_cursor) (unpack))]
(if (not= col 0)
(let [line-content (vim.api.nvim_buf_get_lines 0 (- line 1) line true)
cursor-content (: (. line-content 1) :sub col col)]
(= (cursor-content:match "%s") nil))
false)))
(fn map-tab [fallback]
(if (cmp.visible) (cmp.select_next_item)
(luasnip.expand_or_jumpable) (luasnip.expand_or_jump)
(has-words-before?) (cmp.complete)
(fallback)))
(fn map-stab [fallback]
(if (cmp.visible) (cmp.select_prev_item)
(luasnip.jumpable -1) (luasnip.jump -1)
(fallback)))
(cmp.setup {:sources (cmp.config.sources (main-sources)
[{:name :treesitter
:keyword_length 3}
{:name :buffer}])
:sorting {:priority_weight 2 :comparators (comparator-list)}
:mapping (cmp.mapping.preset.insert {:<C-e> (cmp.mapping {:i (cmp.mapping.abort)
:c (cmp.mapping.close)})
:<esc> (cmp.mapping {:i (cmp.mapping.abort)})
:<Tab> (cmp.mapping {:c #(if (cmp.visible)
(cmp.select_next_item {:behavior cmp.SelectBehavior.Insert})
(cmp.complete))
:i map-tab
:s map-tab})
:<S-Tab> (cmp.mapping {:c #(if (cmp.visible)
(cmp.select_prev_item {:behavior cmp.SelectBehavior.Insert})
(cmp.complete))
:i map-stab
:s map-stab})
:<C-Space> (cmp.mapping.confirm {:behavior cmp.ConfirmBehavior.Insert
:select true})
:<CR> (cmp.mapping.confirm {:select true})})
:window {:completion {:winhighlight "Normal:Pmenu,FloatBorder:Pmenu,CursorLine:CmpCursorLine,Search:None"
:col_offset -3
:side_padding 0
:scrollbar true}
:documentation (cmp.config.window.bordered)}
:view {:entries {:name :custom :selection_order :near_cursor}}
:completion {:keyword_length 2
:completeopt "menu,menuone,noinsert"}
:snippet {:expand (fn [args]
(luasnip.lsp_expand args.body))}
:formatting {:fields [:kind :abbr :menu]
:format (fn [entry vim-item]
(let [kind-fn (lspkind.cmp_format {:mode :symbol_text
:maxwidth 50})
kind (kind-fn entry vim-item)
strings (vim.split kind.kind "%s"
{:trimempty true})]
(if (= entry.source.name :cmp_tabnine)
(do
(set kind.kind " 󱜚 ")
(set kind.menu " (TabNine)"))
(= entry.source.name :cmp_yanky)
(do
(set kind.kind " 󰅌 ")
(set kind.menu " (Clipboard)"))
(= (. strings 1) :TypeParameter)
(do
(set kind.kind "  ")
(set kind.menu
" (TypeParameter)"))
(do
(set kind.kind
(.. " " (or (. strings 1) "")
" "))
(set kind.menu
(.. " ("
(or (. strings 2) "") ")"))))
kind))}})
(cmp.setup.cmdline "/"
{:sources (cmp.config.sources [{:name :nvim_lsp_document_symbol}]
[{:name :buffer}])
:mapping (cmp.mapping.preset.cmdline)})
(cmp.setup.cmdline ":"
{:sources (cmp.config.sources [{:name :async_path}]
[{:name :cmdline}])
:mapping (cmp.mapping.preset.cmdline)})
(cmp.event:on :confirm_done (npairs.on_confirm_done)))

View file

@ -8,7 +8,6 @@
:untracked {:text "┆"}} :untracked {:text "┆"}}
:numhl false :numhl false
:linehl false :linehl false
:diff_opts {:internal true}
:preview_config {:border :rounded} :preview_config {:border :rounded}
:on_attach (fn [bufnr] :on_attach (fn [bufnr]
(set-bufvar bufnr :nifoc_gitsigns_enabled 1))})) (set-bufvar bufnr :nifoc_gitsigns_enabled 0))}))

View file

@ -1,5 +1,5 @@
(let [lsp (require :lspconfig) (let [lsp (require :lspconfig)
cmp (require :cmp_nvim_lsp) cmp (require :blink.cmp)
schemastore (require :schemastore) schemastore (require :schemastore)
navic (require :nvim-navic) navic (require :nvim-navic)
diagnostic (require :nifoc.diagnostic) diagnostic (require :nifoc.diagnostic)
@ -30,9 +30,7 @@
:desc "Automatic LSP setup"}) :desc "Automatic LSP setup"})
;; Servers ;; Servers
(vim.lsp.set_log_level :OFF) (vim.lsp.set_log_level :OFF)
(let [capabilities (vim.tbl_deep_extend :force (let [capabilities (cmp.get_lsp_capabilities nil true)
(vim.lsp.protocol.make_client_capabilities)
(cmp.default_capabilities))
handlers {:textDocument/hover (vim.lsp.with vim.lsp.handlers.hover handlers {:textDocument/hover (vim.lsp.with vim.lsp.handlers.hover
{:border :rounded}) {:border :rounded})
:textDocument/signatureHelp (vim.lsp.with vim.lsp.handlers.signature_help :textDocument/signatureHelp (vim.lsp.with vim.lsp.handlers.signature_help

View file

@ -1,5 +1,5 @@
(let [neogit (require :neogit) (let [neogit (require :neogit)
gitsigns (require :gitsigns) (ok-gitsigns gitsigns) (pcall require :gitsigns)
augroup (vim.api.nvim_create_augroup :NifocNeogit {:clear true}) augroup (vim.api.nvim_create_augroup :NifocNeogit {:clear true})
aucmd vim.api.nvim_create_autocmd] aucmd vim.api.nvim_create_autocmd]
(neogit.setup {}) (neogit.setup {})
@ -17,5 +17,5 @@
:NeogitPullComplete :NeogitPullComplete
:NeogitPushComplete :NeogitPushComplete
:NeogitStatusRefreshed] :NeogitStatusRefreshed]
:callback #(gitsigns.refresh) :callback #(when ok-gitsigns (gitsigns.refresh))
:group augroup})) :group augroup}))

View file

@ -10,10 +10,8 @@
:dockerfile :dockerfile
:eex :eex
:elixir :elixir
:elvish
:erlang :erlang
:fennel :fennel
:fish
:git_config :git_config
:git_rebase :git_rebase
:gitattributes :gitattributes

View file

@ -3,6 +3,8 @@
let let
inherit (pkgs.stdenv) isDarwin; inherit (pkgs.stdenv) isDarwin;
inherit (lib) optionals; inherit (lib) optionals;
inherit (pkgs) vimPlugins;
in in
{ {
programs.neovim = { programs.neovim = {
@ -84,7 +86,7 @@ in
nvim-web-devicons nvim-web-devicons
{ {
plugin = wezterm-nvim; plugin = vimPlugins.wezterm-nvim;
config = builtins.readFile ../../config/nvim/plugins/wezterm.fnl; config = builtins.readFile ../../config/nvim/plugins/wezterm.fnl;
type = "fennel"; type = "fennel";
} }
@ -123,13 +125,13 @@ in
} }
{ {
plugin = rainbow-delimiters-nvim; plugin = vimPlugins.rainbow-delimiters-nvim;
config = builtins.readFile ../../config/nvim/plugins/rainbow-delimiters.fnl; config = builtins.readFile ../../config/nvim/plugins/rainbow-delimiters.fnl;
type = "fennel"; type = "fennel";
} }
{ {
plugin = todo-comments-nvim; plugin = vimPlugins.todo-comments-nvim;
config = builtins.readFile ../../config/nvim/plugins/todo-comments.fnl; config = builtins.readFile ../../config/nvim/plugins/todo-comments.fnl;
type = "fennel"; type = "fennel";
} }
@ -187,19 +189,14 @@ in
type = "fennel"; type = "fennel";
} }
# cmp # Completion
{ {
plugin = nvim-cmp; plugin = vimPlugins.blink-cmp;
config = builtins.readFile ../../config/nvim/plugins/cmp.fnl; config = builtins.readFile ../../config/nvim/plugins/blink-cmp.fnl;
type = "fennel"; type = "fennel";
} }
cmp-nvim-lsp vimPlugins.blink-compat
cmp_luasnip
cmp-async-path
cmp-buffer
cmp-cmdline
cmp-nvim-lsp-document-symbol
# Formatting # Formatting
@ -268,11 +265,11 @@ in
type = "fennel"; type = "fennel";
} }
{ # {
plugin = gitsigns-nvim; # plugin = gitsigns-nvim;
config = builtins.readFile ../../config/nvim/plugins/gitsigns.fnl; # config = builtins.readFile ../../config/nvim/plugins/gitsigns.fnl;
type = "fennel"; # type = "fennel";
} # }
{ {
plugin = diffview-nvim; plugin = diffview-nvim;

View file

@ -2,7 +2,6 @@
- src: nvim-lua/popup.nvim - src: nvim-lua/popup.nvim
- src: nvim-lua/plenary.nvim - src: nvim-lua/plenary.nvim
- src: kyazdani42/nvim-web-devicons - src: kyazdani42/nvim-web-devicons
- src: willothy/wezterm.nvim
- src: romainl/vim-cool - src: romainl/vim-cool
# Keybindings # Keybindings
- src: gbprod/yanky.nvim - src: gbprod/yanky.nvim
@ -13,8 +12,6 @@
- src: Mofiqul/dracula.nvim - src: Mofiqul/dracula.nvim
# Syntax # Syntax
- src: nvim-treesitter/nvim-treesitter - src: nvim-treesitter/nvim-treesitter
- src: HiPhish/rainbow-delimiters.nvim
- src: folke/todo-comments.nvim
# Finder # Finder
- src: ibhagwan/fzf-lua - src: ibhagwan/fzf-lua
# LSP # LSP
@ -30,15 +27,6 @@
- src: folke/ts-comments.nvim - src: folke/ts-comments.nvim
# Snippets # Snippets
- src: L3MON4D3/LuaSnip - src: L3MON4D3/LuaSnip
# cmp
- src: hrsh7th/nvim-cmp
- src: hrsh7th/cmp-nvim-lsp
- src: saadparwaiz1/cmp_luasnip
- src: https://codeberg.org/FelipeLema/cmp-async-path.git
name: cmp-async-path
- src: hrsh7th/cmp-buffer
- src: hrsh7th/cmp-cmdline
- src: hrsh7th/cmp-nvim-lsp-document-symbol
# Formatting # Formatting
- src: stevearc/conform.nvim - src: stevearc/conform.nvim
# Pairs # Pairs