feat(nvim): continue fennel rewrite pt2

This commit is contained in:
Fernando Araoz 2025-01-23 22:44:48 -05:00
parent 305d1634fa
commit d23440203c
4 changed files with 199 additions and 0 deletions

View File

@ -0,0 +1,8 @@
(local barbecue {1 :utilyre/barbecue.nvim
:dependencies [:SmiteshP/nvim-navic
:nvim-tree/nvim-web-devicons]
:name :barbecue
:opts {}
:version "*"})
[barbecue]

View File

@ -0,0 +1,66 @@
(local cokeline {1 :willothy/nvim-cokeline
:config (fn []
(local get-hex
(. (require :cokeline.hlgroups) :get_hl_attr))
(local hlgroups (require :cokeline.hlgroups))
(local yellow vim.g.terminal_color_3)
((. (require :cokeline) :setup) {:components [{:text (fn [buffer]
(.. " "
buffer.index))}
{:fg (fn [buffer]
buffer.devicon.color)
:text (fn [buffer]
(.. " "
buffer.devicon.icon))}
{:fg (fn []
(hlgroups.get_hl_attr :Comment
:fg))
:italic true
:text (fn [buffer]
buffer.unique_prefix)}
{:text (fn [buffer]
buffer.filename)
:underline (fn [buffer]
(when (and buffer.is_hovered
(not buffer.is_focused))
true))}
{:text " "}
{:on_click (fn [_
_
_
_
buffer]
(buffer:delete))
:text (fn [buffer]
(when buffer.is_modified
(lua "return \"\""))
(when buffer.is_hovered
(lua "return \"󰅙\""))
"󰅖")}
{:text " "}]
:default_hl {:bg (fn [buffer]
(or (and buffer.is_focused
(get-hex :Normal
:fg))
(get-hex :ColorColumn
:bg)))
:fg (fn [buffer]
(or (and buffer.is_focused
(get-hex :ColorColumn
:bg))
(get-hex :Normal
:fg)))}
:sidebar {:components [{:bg (fn []
(get-hex :NvimTreeNormal
:bg))
:bold true
:fg yellow
:text (fn [buf]
buf.filetype)}]
:filetype [:NvimTree
:neo-tree]}}))
:dependencies [:nvim-lua/plenary.nvim
:nvim-tree/nvim-web-devicons
:stevearc/resession.nvim]})
[cokeline]

View File

@ -11,7 +11,91 @@
(. (require :nvim-emmet)
:wrap_with_abbreviation)))})
(local autoformat {1 :stevearc/conform.nvim
:cmd [:ConformInfo]
:event [:BufWritePre]
:keys [{1 :<leader>f
2 (fn []
((. (require :conform) :format) {:async true
:lsp_format :fallback}))
:desc "[F]ormat buffer"
:mode ""}]
:opts {:format_on_save (fn [bufnr]
(local disable-filetypes
{:c true :cpp true})
(var lsp-format-opt nil)
(if (. disable-filetypes
(. vim.bo bufnr :filetype))
(set lsp-format-opt :never)
(set lsp-format-opt :fallback))
{:lsp_format lsp-format-opt
:timeout_ms 500})
:formatters_by_ft {:lua [:stylua]}
:notify_on_error false}})
(local autocomplete {1 :hrsh7th/nvim-cmp
:config (fn []
(local cmp (require :cmp))
(local luasnip (require :luasnip))
(luasnip.config.setup {})
(cmp.setup {:completion {:completeopt "menu,menuone,noinsert"}
:mapping (cmp.mapping.preset.insert {:<C-Space> (cmp.mapping.complete {})
:<C-b> (cmp.mapping.scroll_docs (- 4))
:<C-f> (cmp.mapping.scroll_docs 4)
:<C-h> (cmp.mapping (fn []
(when (luasnip.locally_jumpable (- 1))
(luasnip.jump (- 1))))
[:i
:s])
:<C-l> (cmp.mapping (fn []
(when (luasnip.expand_or_locally_jumpable)
(luasnip.expand_or_jump)))
[:i
:s])
:<C-n> (cmp.mapping.select_next_item)
:<C-p> (cmp.mapping.select_prev_item)
:<C-y> (cmp.mapping.confirm {:select true})})
:snippet {:expand (fn [args]
(luasnip.lsp_expand args.body))}
:sources [{:group_index 0
:name :lazydev}
{:name :nvim_lsp}
{:name :luasnip}
{:name :path}]}))
:dependencies [{1 :L3MON4D3/LuaSnip
:build ((fn []
(when (or (= (vim.fn.has :win32)
1)
(= (vim.fn.executable :make)
0))
(lua "return "))
"make install_jsregexp"))
:dependencies {}}
:saadparwaiz1/cmp_luasnip
:hrsh7th/cmp-nvim-lsp
:hrsh7th/cmp-path]
:event :InsertEnter})
(local comments {1 :folke/todo-comments.nvim
:dependencies [:nvim-lua/plenary.nvim]
:event :VimEnter
:opts {:signs false}})
(local mini {1 :echasnovski/mini.nvim
:config (fn []
((. (require :mini.ai) :setup) {:n_lines 500})
((. (require :mini.surround) :setup))
(local statusline (require :mini.statusline))
(statusline.setup {:use_icons vim.g.have_nerd_font})
(fn statusline.section_location []
"%2l:%-2v"))})
[
blankline
emmet
autoformat
autocomplete
comments
mini
]

View File

@ -0,0 +1,41 @@
(local whichkey
{1 :folke/which-key.nvim
:event :VimEnter
:opts {:icons {:keys (or (and vim.g.have_nerd_font {})
{:BS "<BS> "
:C "<C-…> "
:CR "<CR> "
:D "<D-…> "
:Down "<Down> "
:Esc "<Esc> "
:F1 :<F1>
:F10 :<F10>
:F11 :<F11>
:F12 :<F12>
:F2 :<F2>
:F3 :<F3>
:F4 :<F4>
:F5 :<F5>
:F6 :<F6>
:F7 :<F7>
:F8 :<F8>
:F9 :<F9>
:Left "<Left> "
:M "<M-…> "
:NL "<NL> "
:Right "<Right> "
:S "<S-…> "
:ScrollWheelDown "<ScrollWheelDown> "
:ScrollWheelUp "<ScrollWheelUp> "
:Space "<Space> "
:Tab "<Tab> "
:Up "<Up> "})
:mappings vim.g.have_nerd_font}
:spec [{1 :<leader>c :group "[C]ode" :mode [:n :x]}
{1 :<leader>d :group "[D]ocument"}
{1 :<leader>r :group "[R]ename"}
{1 :<leader>s :group "[S]earch"}
{1 :<leader>w :group "[W]orkspace"}
{1 :<leader>t :group "[T]oggle"}]}})
[whichkey]