feat(nvim): continue fennel rewrite pt. ??

This commit is contained in:
Fernando Araoz 2025-01-23 22:53:32 -05:00
parent d23440203c
commit 9b03b2bf0a
3 changed files with 186 additions and 0 deletions

View File

@ -0,0 +1,103 @@
(local lualine {1 :nvim-lualine/lualine.nvim
:config (fn []
(local lualine (require :lualine))
(local colors
{:bg "#202328"
:blue "#51afef"
:cyan "#008080"
:darkblue "#081633"
:fg "#bbc2cf"
:green "#98be65"
:magenta "#c678dd"
:orange "#FF8800"
:red "#ec5f67"
:violet "#a9a1e1"
:yellow "#ECBE7B"})
(local conditions
{:buffer_not_empty (fn []
(not= (vim.fn.empty (vim.fn.expand "%:t"))
1))
:check_git_workspace (fn []
(local filepath
(vim.fn.expand "%:p:h"))
(local gitdir
(vim.fn.finddir :.git
(.. filepath
";")))
(and (and gitdir
(> (length gitdir)
0))
(< (length gitdir)
(length filepath))))
:hide_in_width (fn []
(> (vim.fn.winwidth 0) 80))})
(local config
{:inactive_sections {:lualine_a {}
:lualine_b {}
:lualine_c {}
:lualine_x {}
:lualine_y {}
:lualine_z {}}
:options {:component_separators ""
:section_separators ""
:theme :auto}
:sections {:lualine_a [{1 :mode
:color {:gui :bold}
:fmt (fn [name ctx]
(local first-letter
(string.sub name
1
1))
(local rest
(string.sub name
2))
(local str-lower
(string.lower rest))
(.. first-letter
str-lower))}]
:lualine_b {}
:lualine_c {}
:lualine_x {}
:lualine_y {}
:lualine_z {}}})
(fn ins-left [component]
(table.insert config.sections.lualine_c component))
(fn ins-right [component]
(table.insert config.sections.lualine_x component))
(ins-left [:location])
(ins-left {1 :diagnostics
:diagnostics_color {:error {:fg colors.red}
:info {:fg colors.cyan}
:warn {:fg colors.yellow}}
:sources [:nvim_diagnostic]
:symbols {:error " "
:info " "
:warn " "}})
(ins-left [(fn [] "%=")])
(ins-right [:filetype])
(ins-right {1 "o:encoding"
:color {:fg colors.green :gui :bold}
:cond conditions.hide_in_width
:fmt string.upper})
(ins-right {1 :fileformat
:color {:fg colors.green :gui :bold}
:fmt string.upper
:icons_enabled false})
(ins-right {1 :branch
:color {:fg colors.violet :gui :bold}
:icon ""})
(ins-right {1 :diff
:cond conditions.hide_in_width
:diff_color {:added {:fg colors.green}
:modified {:fg colors.orange}
:removed {:fg colors.red}}
:symbols {:added " "
:modified "󰝤 "
:removed " "}})
(lualine.setup config))
:dependencies [:nvim-tree/nvim-web-devicons]})
[lualine]

View File

@ -0,0 +1,63 @@
(local telescope {1 :nvim-telescope/telescope.nvim
:branch :0.1.x
:config (fn []
((. (require :telescope) :setup) {:defaults {:layout_config {:horizontal {:height 0.95
:preview_width 0.5
:width 0.95}
:vertical {:height 0.9
:preview_height 0.7
:width 0.7}}
:layout_strategy :vertical}
:extensions {:ui-select [((. (require :telescope.themes)
:get_dropdown))]}})
(pcall (. (require :telescope) :load_extension)
:fzf)
(pcall (. (require :telescope) :load_extension)
:ui-select)
(local builtin (require :telescope.builtin))
(vim.keymap.set :n :<leader>sh builtin.help_tags
{:desc "[S]earch [H]elp"})
(vim.keymap.set :n :<leader>sk builtin.keymaps
{:desc "[S]earch [K]eymaps"})
(vim.keymap.set :n :<leader>sf builtin.find_files
{:desc "[S]earch [F]iles"})
(vim.keymap.set :n :<leader>ss builtin.builtin
{:desc "[S]earch [S]elect Telescope"})
(vim.keymap.set :n :<leader>sw builtin.grep_string
{:desc "[S]earch current [W]ord"})
(vim.keymap.set :n :<leader>sg builtin.live_grep
{:desc "[S]earch by [G]rep"})
(vim.keymap.set :n :<leader>sd builtin.diagnostics
{:desc "[S]earch [D]iagnostics"})
(vim.keymap.set :n :<leader>s. builtin.oldfiles
{:desc "[S]earch Recent Files (\".\" for repeat)"})
(vim.keymap.set :n :<leader>/ builtin.buffers
{:desc "[/] Find existing buffers"})
(vim.keymap.set :n :<leader>sc
(fn []
(builtin.colorscheme ((. (require :telescope.themes)
:get_dropdown) {:previewer false
:winblend 20})))
{:desc "[S]earch [C]olorschemes"})
(vim.keymap.set :n :<leader><leader>
builtin.current_buffer_fuzzy_find
{:desc "[ ] Fuzzily search in current buffer"})
(vim.keymap.set :n :<leader>s/
(fn []
(builtin.live_grep {:grep_open_files true
:prompt_title "Live Grep in Open Files"}))
{:desc "[S]earch [/] in Open Files"})
(vim.keymap.set :n :<leader>sn
(fn []
(builtin.find_files {:cwd (vim.fn.stdpath :config)}))
{:desc "[S]earch [N]eovim files"}))
:dependencies [:nvim-lua/plenary.nvim
{1 :nvim-telescope/telescope-fzf-native.nvim
:build :make
:cond (fn [] (= (vim.fn.executable :make) 1))}
[:nvim-telescope/telescope-ui-select.nvim]
{1 :nvim-tree/nvim-web-devicons
:enabled vim.g.have_nerd_font}]
:event :VimEnter})
[telescope]

View File

@ -0,0 +1,20 @@
(local neotree {1 :nvim-treesitter/nvim-treesitter
:build ":TSUpdate"
:main :nvim-treesitter.configs
:opts {:auto_install true
:ensure_installed [:bash
:c
:diff
:html
:lua
:luadoc
:markdown
:markdown_inline
:query
:vim
:vimdoc]
:highlight {:additional_vim_regex_highlighting [:ruby]
:enable true}
:indent {:disable [:ruby] :enable true}}})
[neotree]