nvim: switch from cmp to blink.cmp
This commit is contained in:
parent
c9a390f19c
commit
611a189ab0
14 changed files with 150 additions and 270 deletions
|
@ -497,11 +497,11 @@
|
|||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1735140310,
|
||||
"narHash": "sha256-NuhGCcev/etYS4qAsh905St1Co0tK8FjgGDovUeCVjo=",
|
||||
"lastModified": 1735226532,
|
||||
"narHash": "sha256-4UYXERaJPiiy+JxjKo+IWuHN7kgwmlYdV5x8Ew+YNGQ=",
|
||||
"owner": "nixos",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "bb881a68c1174d38ee466a35f5e23d03a938b186",
|
||||
"rev": "03539677da5a6caba6a6b3d2143ec63b116902d3",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
(let [mod {}
|
||||
keymap vim.keymap
|
||||
substitute (require :substitute)
|
||||
fzf (require :fzf-lua)
|
||||
(ok-substitute substitute) (pcall require :substitute)
|
||||
(ok-fzf fzf) (pcall require :fzf-lua)
|
||||
fzf-layout-bottom {:winopts_fn #(let [height (math.floor (* vim.o.lines
|
||||
0.4))]
|
||||
{:split (.. "belowright new | resize "
|
||||
|
@ -9,45 +9,51 @@
|
|||
fzf-layout-dropdown {:winopts {:height 0.4
|
||||
:width 0.6
|
||||
:preview {:hidden :hidden}}}
|
||||
npairs (require :nvim-autopairs)
|
||||
hover (require :hover)
|
||||
gitsigns (require :gitsigns)
|
||||
neogit (require :neogit)
|
||||
wk (require :which-key)
|
||||
(ok-npairs npairs) (pcall require :nvim-autopairs)
|
||||
(ok-hover hover) (pcall require :hover)
|
||||
(ok-gitsigns gitsigns) (pcall require :gitsigns)
|
||||
(ok-neogit neogit) (pcall require :neogit)
|
||||
(ok-wk wk) (pcall require :which-key)
|
||||
repl (require :nifoc.repl)
|
||||
repo (require :nifoc.repo)
|
||||
formatting (require :nifoc.formatting)]
|
||||
(fn mod.setup []
|
||||
(keymap.set :n :<space> :<nop> {:noremap true})
|
||||
;; Leader Mappings
|
||||
(keymap.set :n :<leader>o fzf.files {:desc "Find Files"})
|
||||
(keymap.set :n :<leader>s #(fzf.live_grep fzf-layout-bottom)
|
||||
{:desc "Live Grep"})
|
||||
(when ok-fzf
|
||||
(keymap.set :n :<leader>o fzf.files {:desc "Find Files"})
|
||||
(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>u "<cmd>UrlView buffer<CR>" {:desc "Open UrlView"})
|
||||
(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>bl fzf.buffers {:desc "List Buffers"})
|
||||
(keymap.set :n :<leader>bf fzf.grep_curbuf {:desc "Find In Buffer"})
|
||||
(keymap.set :n :<leader>bt fzf.treesitter {:desc "Find via Treesitter"})
|
||||
(keymap.set :n :<leader>g #(neogit.open {:kind :split})
|
||||
{:desc "Open Neogit"})
|
||||
(keymap.set :n :<leader>vs #(neogit.open {:kind :split})
|
||||
{:desc "VCS Status"})
|
||||
(keymap.set :n :<leader>vb #(fzf.git_branches fzf-layout-dropdown)
|
||||
{:desc "List VCS Branches"})
|
||||
(keymap.set :n :<leader>vl #(gitsigns.blame_line {:full true})
|
||||
{:desc "Blame Line"})
|
||||
(when ok-fzf
|
||||
(keymap.set :n :<leader>bl fzf.buffers {:desc "List Buffers"})
|
||||
(keymap.set :n :<leader>bf fzf.grep_curbuf {:desc "Find In Buffer"})
|
||||
(keymap.set :n :<leader>bt fzf.treesitter {:desc "Find via Treesitter"}))
|
||||
(when ok-neogit
|
||||
(keymap.set :n :<leader>g #(neogit.open {:kind :split})
|
||||
{:desc "Open Neogit"})
|
||||
(keymap.set :n :<leader>vs #(neogit.open {:kind :split})
|
||||
{:desc "VCS Status"}))
|
||||
(when ok-fzf
|
||||
(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>vvr #(repo.open-repo) {:desc "Open repository"})
|
||||
(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>vtc #(repo.run-ci) {:desc "Trigger CI"})
|
||||
(keymap.set :n :<leader>lk fzf.keymaps {:desc "Show Keymappings"})
|
||||
(keymap.set :n :<leader>ld #(fzf.diagnostics_document fzf-layout-bottom)
|
||||
{:desc "Show Diagnostics"})
|
||||
(keymap.set :n :<leader>lt :<cmd>TodoFzfLua<CR>
|
||||
{:desc "Show Todo Comments"})
|
||||
(when ok-fzf
|
||||
(keymap.set :n :<leader>lk fzf.keymaps {:desc "Show Keymappings"})
|
||||
(keymap.set :n :<leader>ld #(fzf.diagnostics_document fzf-layout-bottom)
|
||||
{:desc "Show Diagnostics"})
|
||||
(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>dlr :<cmd>LspRestart<CR> {:desc "Restart LSP"})
|
||||
(keymap.set :n :<leader>ds #(vim.diagnostic.open_float {:scope :line})
|
||||
|
@ -55,8 +61,9 @@
|
|||
(keymap.set :n :<leader>dtp :<cmd>TSPlaygroundToggle<CR>
|
||||
{:desc "Toggle Treetsitter Playground"})
|
||||
;; Other Mappings
|
||||
(keymap.set :i :<CR> npairs.autopairs_cr
|
||||
{:expr true :replace_keycodes false :silent true})
|
||||
(when ok-npairs
|
||||
(keymap.set :i :<CR> npairs.autopairs_cr
|
||||
{:expr true :replace_keycodes false :silent true}))
|
||||
(keymap.set :n :F #(formatting.maybe-format-buffer 0)
|
||||
{:desc "Format Buffer"})
|
||||
(keymap.set :n :<A-Left> :b)
|
||||
|
@ -74,7 +81,8 @@
|
|||
{:noremap true :silent true})
|
||||
(keymap.set :n :p "<Plug>(YankyPutAfter)")
|
||||
(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 :n :gp "<Plug>(YankyGPutAfter)")
|
||||
(keymap.set :n :gP "<Plug>(YankyGPutBefore)")
|
||||
|
@ -84,35 +92,39 @@
|
|||
(keymap.set :x :y "<Plug>(YankyYank)")
|
||||
(keymap.set :n "-" :<cmd>Oil<CR> {:desc "Open Oil"})
|
||||
;; hover.nvim
|
||||
(keymap.set :n :K hover.hover {:desc "Show Documentation"})
|
||||
(keymap.set :n :gK hover.hover_select {:desc "hover.nvim selection"})
|
||||
(keymap.set :n :<C-p> #(hover.hover_switch :previous)
|
||||
{:desc "hover.nvim previous source"})
|
||||
(keymap.set :n :<C-n> #(hover.hover_switch :next)
|
||||
{:desc "hover.nvim next source"})
|
||||
(keymap.set :n :<MouseMove> hover.hover_mouse {:desc "hover.nvim mouse"})
|
||||
(when ok-hover
|
||||
(keymap.set :n :K hover.hover {:desc "Show Documentation"})
|
||||
(keymap.set :n :gK hover.hover_select {:desc "hover.nvim selection"})
|
||||
(keymap.set :n :<C-p> #(hover.hover_switch :previous)
|
||||
{:desc "hover.nvim previous source"})
|
||||
(keymap.set :n :<C-n> #(hover.hover_switch :next)
|
||||
{:desc "hover.nvim next source"}))
|
||||
;; Label
|
||||
(wk.add [{1 :<leader>v :group :vcs}
|
||||
{1 :<leader>l :group :list/lsp}
|
||||
{1 :<leader>d :group :debug}]))
|
||||
(when ok-wk
|
||||
(wk.add [{1 :<leader>v :group :vcs}
|
||||
{1 :<leader>l :group :list/lsp}
|
||||
{1 :<leader>d :group :debug}])))
|
||||
|
||||
(fn mod.lsp-attach [_client bufnr]
|
||||
(keymap.set :n :<leader>t #(fzf.lsp_document_symbols fzf-layout-dropdown)
|
||||
{:buffer bufnr :desc "LSP Document Symbols"})
|
||||
(keymap.set :n :<leader>tw #(fzf.lsp_workspace_symbols fzf-layout-dropdown)
|
||||
{:buffer bufnr :desc "LSP Workspace Symbols"})
|
||||
(when ok-fzf
|
||||
(keymap.set :n :<leader>t #(fzf.lsp_document_symbols fzf-layout-dropdown)
|
||||
{:buffer bufnr :desc "LSP Document Symbols"})
|
||||
(keymap.set :n :<leader>tw
|
||||
#(fzf.lsp_workspace_symbols fzf-layout-dropdown)
|
||||
{:buffer bufnr :desc "LSP Workspace Symbols"}))
|
||||
(keymap.set :n :<leader>th
|
||||
#(vim.lsp.inlay_hint.enable (not (vim.lsp.inlay_hint.is_enabled bufnr))
|
||||
{: bufnr})
|
||||
{:buffer bufnr :desc "Toggle Inlay Hints"})
|
||||
(keymap.set :n :<leader>lca fzf.lsp_code_actions
|
||||
{:buffer bufnr :desc "LSP Code Action"})
|
||||
(keymap.set :n :<leader>lfr fzf.lsp_references
|
||||
{:buffer bufnr :desc "Find References"})
|
||||
(keymap.set :n :<leader>lfd fzf.lsp_definitions
|
||||
{:buffer bufnr :desc "Find Definitions"})
|
||||
(keymap.set :n :<leader>lfi fzf.lsp_implementations
|
||||
{:buffer bufnr :desc "Find Implementations"}))
|
||||
(when ok-fzf
|
||||
(keymap.set :n :<leader>lca fzf.lsp_code_actions
|
||||
{:buffer bufnr :desc "LSP Code Action"})
|
||||
(keymap.set :n :<leader>lfr fzf.lsp_references
|
||||
{:buffer bufnr :desc "Find References"})
|
||||
(keymap.set :n :<leader>lfd fzf.lsp_definitions
|
||||
{:buffer bufnr :desc "Find Definitions"})
|
||||
(keymap.set :n :<leader>lfi fzf.lsp_implementations
|
||||
{:buffer bufnr :desc "Find Implementations"})))
|
||||
|
||||
(fn mod.terminal-open [bufnr]
|
||||
(let [map-opts {:buffer bufnr}]
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
v vim.v
|
||||
statusline (require :nifoc.statusline)
|
||||
diagnostic vim.diagnostic
|
||||
gitsigns (require :gitsigns)
|
||||
(ok-gitsigns gitsigns) (pcall require :gitsigns)
|
||||
gitsigns-ns (api.nvim_create_namespace :gitsigns_signs_)
|
||||
augroup (vim.api.nvim_create_augroup :NifocStatuscolumn {:clear true})
|
||||
aucmd vim.api.nvim_create_autocmd]
|
||||
|
@ -64,11 +64,12 @@
|
|||
(vim.diagnostic.get $1.buf))
|
||||
:group augroup
|
||||
:desc "Update cached diagnostic signs"})
|
||||
(aucmd :User {:pattern :GitSignsUpdate
|
||||
:callback #(when (not= $1.data nil)
|
||||
(update-cache-gitsigns $1.data.buffer))
|
||||
:group augroup
|
||||
:desc "Update cached gitsigns signs"})
|
||||
(when (= b.nifoc_gitsigns_enabled 1)
|
||||
(aucmd :User {:pattern :GitSignsUpdate
|
||||
:callback #(when (not= $1.data nil)
|
||||
(update-cache-gitsigns $1.data.buffer))
|
||||
:group augroup
|
||||
:desc "Update cached gitsigns signs"}))
|
||||
(aucmd :BufWipeout
|
||||
{:callback (fn [args]
|
||||
(tset cache :diagnostics args.buf nil)
|
||||
|
@ -107,7 +108,8 @@
|
|||
cursor-pos [mouse.line 0]]
|
||||
(api.nvim_win_set_cursor mouse.winid
|
||||
cursor-pos)
|
||||
(vim.defer_fn #(gitsigns.blame_line {:full true})
|
||||
(vim.defer_fn #(when ok-gitsigns
|
||||
(gitsigns.blame_line {:full true}))
|
||||
100)))}})
|
||||
(set mod.gitsigns-or-bar [{:condition #(and (not= b.nifoc_gitsigns_enabled 1)
|
||||
(or (o.number:get)
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
repo (require :nifoc.repo)
|
||||
nifoc-treesitter (require :nifoc.treesitter)
|
||||
navic (require :nvim-navic)
|
||||
neogit (require :neogit)
|
||||
(ok-neogit neogit) (pcall require :neogit)
|
||||
fzf (require :fzf-lua)
|
||||
fzf-layout-bottom {:winopts_fn #(let [height (math.floor (* vim.o.lines
|
||||
0.4))]
|
||||
|
@ -179,7 +179,7 @@
|
|||
:hl {:fg colors.black :bg colors.orange :bold true}}
|
||||
3 {:provider #(.. $1.git-head " ")
|
||||
: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}}
|
||||
4 mod.space
|
||||
5 {:provider #(.. " " $1.git-added " ")
|
||||
|
|
|
@ -8,9 +8,6 @@
|
|||
g vim.g
|
||||
dracula (require :dracula)
|
||||
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)
|
||||
|
||||
(fn mod.setup []
|
||||
|
@ -29,46 +26,6 @@
|
|||
(highlight :IlluminatedWordText {:bg mod.colors.selection})
|
||||
(highlight :IlluminatedWordRead {:bg mod.colors.selection})
|
||||
(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
|
||||
(highlight :NeogitBranch {:fg mod.colors.green :bold true})
|
||||
(highlight :NeogitBranchHead
|
||||
|
|
|
@ -1,20 +1,20 @@
|
|||
(let [mod {}
|
||||
treesitter (require :nvim-treesitter)
|
||||
(ok treesitter) (pcall require :nvim-treesitter)
|
||||
set-bufvar vim.api.nvim_buf_set_var]
|
||||
(fn mod.setup []
|
||||
(treesitter.define_modules {:nifoc_hooks {:enable false
|
||||
:attach (lambda [bufnr]
|
||||
(set-bufvar bufnr
|
||||
:nifoc_treesitter_enabled
|
||||
1))
|
||||
:detach (lambda [bufnr]
|
||||
(set-bufvar bufnr
|
||||
:nifoc_treesitter_enabled
|
||||
0))
|
||||
:is_supported #true}}))
|
||||
(if ok
|
||||
(treesitter.define_modules {:nifoc_hooks {:enable false
|
||||
:attach (lambda [bufnr]
|
||||
(set-bufvar bufnr
|
||||
:nifoc_treesitter_enabled
|
||||
1))
|
||||
:detach (lambda [bufnr]
|
||||
(set-bufvar bufnr
|
||||
:nifoc_treesitter_enabled
|
||||
0))
|
||||
:is_supported #true}})))
|
||||
|
||||
(fn mod.active? []
|
||||
(= vim.b.nifoc_treesitter_enabled 1))
|
||||
|
||||
mod)
|
||||
|
||||
|
|
42
home/config/nvim/plugins/blink-cmp.fnl
Normal file
42
home/config/nvim/plugins/blink-cmp.fnl
Normal 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}}}))
|
|
@ -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)))
|
|
@ -8,7 +8,6 @@
|
|||
:untracked {:text "┆"}}
|
||||
:numhl false
|
||||
:linehl false
|
||||
:diff_opts {:internal true}
|
||||
:preview_config {:border :rounded}
|
||||
:on_attach (fn [bufnr]
|
||||
(set-bufvar bufnr :nifoc_gitsigns_enabled 1))}))
|
||||
(set-bufvar bufnr :nifoc_gitsigns_enabled 0))}))
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
(let [lsp (require :lspconfig)
|
||||
cmp (require :cmp_nvim_lsp)
|
||||
cmp (require :blink.cmp)
|
||||
schemastore (require :schemastore)
|
||||
navic (require :nvim-navic)
|
||||
diagnostic (require :nifoc.diagnostic)
|
||||
|
@ -30,9 +30,7 @@
|
|||
:desc "Automatic LSP setup"})
|
||||
;; Servers
|
||||
(vim.lsp.set_log_level :OFF)
|
||||
(let [capabilities (vim.tbl_deep_extend :force
|
||||
(vim.lsp.protocol.make_client_capabilities)
|
||||
(cmp.default_capabilities))
|
||||
(let [capabilities (cmp.get_lsp_capabilities nil true)
|
||||
handlers {:textDocument/hover (vim.lsp.with vim.lsp.handlers.hover
|
||||
{:border :rounded})
|
||||
:textDocument/signatureHelp (vim.lsp.with vim.lsp.handlers.signature_help
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
(let [neogit (require :neogit)
|
||||
gitsigns (require :gitsigns)
|
||||
(ok-gitsigns gitsigns) (pcall require :gitsigns)
|
||||
augroup (vim.api.nvim_create_augroup :NifocNeogit {:clear true})
|
||||
aucmd vim.api.nvim_create_autocmd]
|
||||
(neogit.setup {})
|
||||
|
@ -17,5 +17,5 @@
|
|||
:NeogitPullComplete
|
||||
:NeogitPushComplete
|
||||
:NeogitStatusRefreshed]
|
||||
:callback #(gitsigns.refresh)
|
||||
:callback #(when ok-gitsigns (gitsigns.refresh))
|
||||
:group augroup}))
|
||||
|
|
|
@ -10,10 +10,8 @@
|
|||
:dockerfile
|
||||
:eex
|
||||
:elixir
|
||||
:elvish
|
||||
:erlang
|
||||
:fennel
|
||||
:fish
|
||||
:git_config
|
||||
:git_rebase
|
||||
:gitattributes
|
||||
|
|
|
@ -3,6 +3,8 @@
|
|||
let
|
||||
inherit (pkgs.stdenv) isDarwin;
|
||||
inherit (lib) optionals;
|
||||
|
||||
inherit (pkgs) vimPlugins;
|
||||
in
|
||||
{
|
||||
programs.neovim = {
|
||||
|
@ -84,7 +86,7 @@ in
|
|||
nvim-web-devicons
|
||||
|
||||
{
|
||||
plugin = wezterm-nvim;
|
||||
plugin = vimPlugins.wezterm-nvim;
|
||||
config = builtins.readFile ../../config/nvim/plugins/wezterm.fnl;
|
||||
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;
|
||||
type = "fennel";
|
||||
}
|
||||
|
||||
{
|
||||
plugin = todo-comments-nvim;
|
||||
plugin = vimPlugins.todo-comments-nvim;
|
||||
config = builtins.readFile ../../config/nvim/plugins/todo-comments.fnl;
|
||||
type = "fennel";
|
||||
}
|
||||
|
@ -187,19 +189,14 @@ in
|
|||
type = "fennel";
|
||||
}
|
||||
|
||||
# cmp
|
||||
# Completion
|
||||
{
|
||||
plugin = nvim-cmp;
|
||||
config = builtins.readFile ../../config/nvim/plugins/cmp.fnl;
|
||||
plugin = vimPlugins.blink-cmp;
|
||||
config = builtins.readFile ../../config/nvim/plugins/blink-cmp.fnl;
|
||||
type = "fennel";
|
||||
}
|
||||
|
||||
cmp-nvim-lsp
|
||||
cmp_luasnip
|
||||
cmp-async-path
|
||||
cmp-buffer
|
||||
cmp-cmdline
|
||||
cmp-nvim-lsp-document-symbol
|
||||
vimPlugins.blink-compat
|
||||
|
||||
# Formatting
|
||||
|
||||
|
@ -268,11 +265,11 @@ in
|
|||
type = "fennel";
|
||||
}
|
||||
|
||||
{
|
||||
plugin = gitsigns-nvim;
|
||||
config = builtins.readFile ../../config/nvim/plugins/gitsigns.fnl;
|
||||
type = "fennel";
|
||||
}
|
||||
# {
|
||||
# plugin = gitsigns-nvim;
|
||||
# config = builtins.readFile ../../config/nvim/plugins/gitsigns.fnl;
|
||||
# type = "fennel";
|
||||
# }
|
||||
|
||||
{
|
||||
plugin = diffview-nvim;
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
- src: nvim-lua/popup.nvim
|
||||
- src: nvim-lua/plenary.nvim
|
||||
- src: kyazdani42/nvim-web-devicons
|
||||
- src: willothy/wezterm.nvim
|
||||
- src: romainl/vim-cool
|
||||
# Keybindings
|
||||
- src: gbprod/yanky.nvim
|
||||
|
@ -13,8 +12,6 @@
|
|||
- src: Mofiqul/dracula.nvim
|
||||
# Syntax
|
||||
- src: nvim-treesitter/nvim-treesitter
|
||||
- src: HiPhish/rainbow-delimiters.nvim
|
||||
- src: folke/todo-comments.nvim
|
||||
# Finder
|
||||
- src: ibhagwan/fzf-lua
|
||||
# LSP
|
||||
|
@ -30,15 +27,6 @@
|
|||
- src: folke/ts-comments.nvim
|
||||
# Snippets
|
||||
- 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
|
||||
- src: stevearc/conform.nvim
|
||||
# Pairs
|
||||
|
|
Loading…
Reference in a new issue