diff options
author | Gustaf Rydholm <gustaf.rydholm@gmail.com> | 2023-01-08 02:49:49 +0100 |
---|---|---|
committer | Gustaf Rydholm <gustaf.rydholm@gmail.com> | 2023-01-08 02:49:49 +0100 |
commit | 86fc163e549d78136855ac2b45e91ffb2f43affc (patch) | |
tree | 20fab78a2ff2635af5ac95f2b2a11d9d07ace0e1 | |
parent | 0d7f782cb4e68cff000beb00e8ab64308a66f3f0 (diff) |
Refactor config loading
40 files changed, 1000 insertions, 1076 deletions
diff --git a/fnl/config/alpha.fnl b/fnl/config/alpha.fnl index e25e6ab..87c45e0 100644 --- a/fnl/config/alpha.fnl +++ b/fnl/config/alpha.fnl @@ -1,42 +1,47 @@ ;; A customizable greeter. -(module config.alpha {autoload {util config.util}}) -(def- ascii-art [" ##############..... ############## " - " ##############......############## " - " ##########..........########## " - " ##########........########## " - " ##########.......########## " - " ##########.....##########.. " - " ##########....##########..... " - " ..##########..##########......... " - " ....##########.#########............. " - " ..################JJJ............ " - " ################............. " - " ##############.JJJ.JJJJJJJJJJ " - " ############...JJ...JJ..JJ JJ " - " ##########....JJ...JJ..JJ JJ " - " ########......JJJ..JJJ JJJ JJJ " - " ###### ......... " - " ..... " - " . "]) +(local ascii-art [" ##############..... ############## " + " ##############......############## " + " ##########..........########## " + " ##########........########## " + " ##########.......########## " + " ##########.....##########.. " + " ##########....##########..... " + " ..##########..##########......... " + " ....##########.#########............. " + " ..################JJJ............ " + " ################............. " + " ##############.JJJ.JJJJJJJJJJ " + " ############...JJ...JJ..JJ JJ " + " ##########....JJ...JJ..JJ JJ " + " ########......JJJ..JJJ JJJ JJJ " + " ###### ......... " + " ..... " + " . "]) -(let [alpha (util.prequire :alpha)] - (let [dashboard (require :alpha.themes.dashboard)] - (set dashboard.section.header.val ascii-art) - (set dashboard.section.buttons.val - [(dashboard.button :e " New file" ":ene <BAR> startinsert <CR>") - (dashboard.button :f " Find file" - ":Telescope find_files theme=dropdown<CR>") - (dashboard.button :t " Find text" - ":Telescope live_grep theme=dropdown<CR>") - (dashboard.button :p " Find project" - ":Telescope projects theme=dropdown<CR>") - (dashboard.button :r " Recently used files" - ":Telescope oldfiles theme=dropdown<CR>") - (dashboard.button :c " Configuration" - ":e ~/.config/nvim/init.lua <CR>") - (dashboard.button :q " Quit Neovim" ":qa<CR>")]) - (set dashboard.section.header.opts.hl :AlphaHeader) - (set dashboard.section.buttons.opts.hl :AlphaButtons) - (set dashboard.opts.opts.noautocmd true) - (alpha.setup dashboard.opts))) +(fn setup [] + (let [alpha (require :alpha)] + (let [dashboard (require :alpha.themes.dashboard)] + (set dashboard.section.header.val ascii-art) + (set dashboard.section.buttons.val + [(dashboard.button :e " New file" ":ene <BAR> startinsert <CR>") + (dashboard.button :f " Find file" + ":Telescope find_files theme=dropdown<CR>") + (dashboard.button :t " Find text" + ":Telescope live_grep theme=dropdown<CR>") + (dashboard.button :p " Find project" + ":Telescope projects theme=dropdown<CR>") + (dashboard.button :r " Recently used files" + ":Telescope oldfiles theme=dropdown<CR>") + (dashboard.button :c " Configuration" + ":e ~/.config/nvim/init.lua <CR>") + (dashboard.button :q " Quit Neovim" ":qa<CR>")]) + (set dashboard.section.header.opts.hl :AlphaHeader) + (set dashboard.section.buttons.opts.hl :AlphaButtons) + (set dashboard.opts.opts.noautocmd true) + (alpha.setup dashboard.opts)))) + +{1 :goolord/alpha-nvim + :event :VimEnter + :config (fn [] + (setup))} diff --git a/fnl/config/autocmd.fnl b/fnl/config/autocmd.fnl index c12020f..e58803b 100644 --- a/fnl/config/autocmd.fnl +++ b/fnl/config/autocmd.fnl @@ -7,7 +7,7 @@ (defn create-autocmd [event opts] (nvim.create_autocmd event opts)) (create-autocmd :FileType - {:pattern [:qf :help :man :lspinfo] + {:pattern [:qf :help :man :lspinfo :spectre_panel] :command "nnoremap <silent> <buffer> q :close<CR>"}) (create-autocmd :TextYankPost @@ -46,3 +46,11 @@ (env.init nvim.g.aniseed#env))}) (create-autocmd :FocusGained {:command :checktime}) + +(create-autocmd :TermOpen + {:pattern "term://*toggleterm#*" + :callback (fn [] + (vim.keymap.set :t :<C-h> "<Cmd>wincmd h<CR>" {}) + (vim.keymap.set :t :<C-j> "<Cmd>wincmd j<CR>" {}) + (vim.keymap.set :t :<C-k> "<Cmd>wincmd k<CR>" {}) + (vim.keymap.set :t :<C-l> "<Cmd>wincmd l<CR>" {}))}) diff --git a/fnl/config/autopairs.fnl b/fnl/config/autopairs.fnl index d7865b5..076b120 100644 --- a/fnl/config/autopairs.fnl +++ b/fnl/config/autopairs.fnl @@ -1,21 +1,20 @@ ;; Autopairs for brackets and quote symbols. -(module config.autopairs {autoload {util config.util}}) -(def- opts {:check_ts true - :ts_config {:lua [:string :source] - :javascript [:string :template_string] - :java false} - :disable_filetype [:TelescopePrompt :spectre_panel] - :fast_warp {:map :<M-e> - :chars ["{" "[" "(" "\"" "'"] - :pattern (string.gsub "[%'%\"%)%>%]%)%}%,]" "%s+" "") - :check_comma true - :highlight :PmenuSel - :highlight_grey :LineNr - :offset 0 - :end_key "$" - :keys :qwertyuiopzxcvbnmasdfghjkl - :highlight :PmenuSel - :highlight_grey :LineNr}}) +(local opts {:check_ts true + :ts_config {:lua [:string :source] + :javascript [:string :template_string] + :java false} + :disable_filetype [:TelescopePrompt :spectre_panel] + :fast_warp {:map :<M-e> + :chars ["{" "[" "(" "\"" "'"] + :pattern (string.gsub "[%'%\"%)%>%]%)%}%,]" "%s+" "") + :check_comma true + :highlight :PmenuSel + :highlight_grey :LineNr + :offset 0 + :end_key "$" + :keys :qwertyuiopzxcvbnmasdfghjkl + :highlight :PmenuSel + :highlight_grey :LineNr}}) -(util.setup :nvim-autopairs opts) +{1 :windwp/nvim-autopairs :event :InsertEnter :config opts} diff --git a/fnl/config/better-escape.fnl b/fnl/config/better-escape.fnl index 659d22f..f262784 100644 --- a/fnl/config/better-escape.fnl +++ b/fnl/config/better-escape.fnl @@ -1,9 +1,8 @@ ;; Better escape without nasty delay. -(module config.better-escape {autoload {util config.util}}) -(def- opts {:mapping [:kk :jj] - :timeout vim.o.timeoutlen - :clear_empty_lines false - :keys :<Esc>}) +(local opts {:mapping [:kk :jj] + :timeout vim.o.timeoutlen + :clear_empty_lines false + :keys :<Esc>}) -(util.setup :better_escape opts) +{1 :max397574/better-escape.nvim :event :BufReadPost :config opts} diff --git a/fnl/config/bqf.fnl b/fnl/config/bqf.fnl index 59a1aad..e2b0791 100644 --- a/fnl/config/bqf.fnl +++ b/fnl/config/bqf.fnl @@ -1,4 +1,3 @@ ;; Make Neovim's quickfix window better. -(module config.bqf {autoload {util config.util}}) -(util.setup :bqf {}) +{1 :kevinhwang91/nvim-bqf :event :BufReadPost :config true} diff --git a/fnl/config/cmd.fnl b/fnl/config/cmd.fnl index e548839..735bbc4 100644 --- a/fnl/config/cmd.fnl +++ b/fnl/config/cmd.fnl @@ -84,3 +84,10 @@ (let [persistence (util.prequire :persistence)] (persistence.stop))) {:nargs 0}) + +(nvim.create_user_command :FindFiles + (lambda [] + (util.telescope-builtin :find_files + {:theme :get_dropdown + :previewer false})) + {:nargs 0}) diff --git a/fnl/config/cmp.fnl b/fnl/config/cmp.fnl index d1cedec..a062d92 100644 --- a/fnl/config/cmp.fnl +++ b/fnl/config/cmp.fnl @@ -1,49 +1,65 @@ ;; Configuration for completion plugin. -(module config.cmp {autoload {nvim aniseed.nvim util config.util}}) -(let [cmp (util.prequire :cmp) - lspkind (util.prequire :lspkind) - luasnip (util.prequire :luasnip) - luasnip-vscode (require :luasnip.loaders.from_vscode)] - (luasnip-vscode.lazy_load) - (lspkind.init) - (cmp.setup {:snippet {:expand (fn [args] - (luasnip.lsp_expand args.body))} - :completion {:completopt "menu,menuone,noinsert"} - :mapping (cmp.mapping.preset.insert {:<C-k> (cmp.mapping.select_prev_item) - :<C-j> (cmp.mapping.select_next_item) - :<C-b> (cmp.mapping (cmp.mapping.scroll_docs -1) - [:i :c]) - :<C-f> (cmp.mapping (cmp.mapping.scroll_docs 1) - [:i :c]) - :<C-space> (cmp.mapping (cmp.mapping.complete) - [:i - :c]) - :<C-e> (cmp.mapping {:i (cmp.mapping.abort) - :c (cmp.mapping.close)}) - :<CR> (cmp.mapping.confirm {:select true}) - :<CR> (cmp.mapping.confirm {:select true})}) - :sources [{:name :nvim_lsp} - {:name :nvim_lua} - {:name :luasnip} - {:name :spell} - {:name :orgmode} - {:name :buffer :keyword_length 4} - {:name :path :keyword_length 6}] - :formatting {:format (lspkind.cmp_format {:with_text true - :menu {:buffer "" - :nvim_lsp "" - :nvim_lua "" - :path "" - :luasnip ""}})} - :window {:documentation {:border ["╭" - "─" - "╮" - "│" - "╯" - "─" - "╰" - "│"]}} - :confirm_opts {:behavior cmp.ConfirmBehavior.Replace - :select false} - :experimental {:ghost_text false :native_menu false}})) +(fn setup [] + (let [cmp (require :cmp) + lspkind (require :lspkind) + luasnip (require :luasnip) + luasnip-vscode (require :luasnip.loaders.from_vscode)] + (luasnip-vscode.lazy_load) + (lspkind.init) + (cmp.setup {:snippet {:expand (fn [args] + (luasnip.lsp_expand args.body))} + :completion {:completopt "menu,menuone,noinsert"} + :mapping (cmp.mapping.preset.insert {:<C-k> (cmp.mapping.select_prev_item) + :<C-j> (cmp.mapping.select_next_item) + :<C-b> (cmp.mapping (cmp.mapping.scroll_docs -1) + [:i + :c]) + :<C-f> (cmp.mapping (cmp.mapping.scroll_docs 1) + [:i + :c]) + :<C-space> (cmp.mapping (cmp.mapping.complete) + [:i + :c]) + :<C-e> (cmp.mapping {:i (cmp.mapping.abort) + :c (cmp.mapping.close)}) + :<CR> (cmp.mapping.confirm {:select true}) + :<CR> (cmp.mapping.confirm {:select true})}) + :sources [{:name :nvim_lsp} + {:name :nvim_lua} + {:name :luasnip} + {:name :spell} + {:name :orgmode} + {:name :buffer :keyword_length 4} + {:name :path :keyword_length 6}] + :formatting {:format (lspkind.cmp_format {:with_text true + :menu {:buffer "" + :nvim_lsp "" + :nvim_lua "" + :path "" + :luasnip ""}})} + :window {:documentation {:border ["╭" + "─" + "╮" + "│" + "╯" + "─" + "╰" + "│"]}} + :confirm_opts {:behavior cmp.ConfirmBehavior.Replace + :select false} + :experimental {:ghost_text false :native_menu false}}))) + +{1 :hrsh7th/nvim-cmp + :dependencies [:hrsh7th/cmp-buffer + :onsails/lspkind-nvim + :hrsh7th/cmp-nvim-lsp + :hrsh7th/cmp-cmdline + :L3MON4D3/LuaSnip + :rafamadriz/friendly-snippets + :hrsh7th/cmp-path + :saadparwaiz1/cmp_luasnip + :f3fora/cmp-spell] + :event :InsertEnter + :config (fn [] + (setup))} diff --git a/fnl/config/colorizer.fnl b/fnl/config/colorizer.fnl deleted file mode 100644 index ff7fbab..0000000 --- a/fnl/config/colorizer.fnl +++ /dev/null @@ -1,4 +0,0 @@ -;; Enables colorization of color codes in source files. -(module config.colorizer {autoload {util config.util}}) - -(util.setup :colorizer {}) diff --git a/fnl/config/colorscheme.fnl b/fnl/config/colorscheme.fnl index 8c27ca4..83175c2 100644 --- a/fnl/config/colorscheme.fnl +++ b/fnl/config/colorscheme.fnl @@ -1,9 +1,16 @@ ;; Load neovim colorscheme. -(module config.colorscheme {autoload {util config.util}}) (local colorscheme :no-clown-fiesta) -(def- opts {:styles {:type {:bold true}}}) +(local opts {:styles {:type {:bold true}}}) -(util.setup :no-clown-fiesta opts) -(vim.cmd (.. "colorscheme " colorscheme)) +(fn setup [] + (let [plugin (require colorscheme)] + (plugin.setup opts) + (vim.cmd (.. "colorscheme " colorscheme)))) + +{1 :aktersnurra/no-clown-fiesta.nvim + :lazy false + :priority 1000 + :config (fn [] + (setup))} diff --git a/fnl/config/comment.fnl b/fnl/config/comment.fnl index 6879df6..29b7871 100644 --- a/fnl/config/comment.fnl +++ b/fnl/config/comment.fnl @@ -1,21 +1,20 @@ ;; Language aware commenting. -(module config.comment {autoload {util config.util}}) -(def- opts {:toggler {;; Line-comment toggle keymap - :line :mcc - ;; Block-comment toggle keymap - :block :mbc} - ;; LHS of operator-pending mappings in NORMAL and VISUAL mode - :opleader {;; Line-comment keymap - :line :mc - ;; Block-comment keymap - :block :mb} - ;; LHS of extra mappings - :extra {;; Add comment on the line above - :above :mcO - ;; Add comment on the line below - :below :mco - ;; Add comment at the end of line - :eol :mcA}}) +(local opts {:toggler {;; Line-comment toggle keymap + :line :mcc + ;; Block-comment toggle keymap + :block :mbc} + ;; LHS of operator-pending mappings in NORMAL and VISUAL mode + :opleader {;; Line-comment keymap + :line :mc + ;; Block-comment keymap + :block :mb} + ;; LHS of extra mappings + :extra {;; Add comment on the line above + :above :mcO + ;; Add comment on the line below + :below :mco + ;; Add comment at the end of line + :eol :mcA}}) -(util.setup :Comment opts) +{1 :numToStr/Comment.nvim :event :BufReadPost :config opts} diff --git a/fnl/config/diffview.fnl b/fnl/config/diffview.fnl deleted file mode 100644 index 3772d32..0000000 --- a/fnl/config/diffview.fnl +++ /dev/null @@ -1,6 +0,0 @@ -;; Trim whitespaces on save. -(module config.diffview {autoload {util config.util}}) - -(def- opts {}) - -(util.setup :diffview opts) diff --git a/fnl/config/flit.fnl b/fnl/config/flit.fnl index d80a0d9..536c505 100644 --- a/fnl/config/flit.fnl +++ b/fnl/config/flit.fnl @@ -1,9 +1,8 @@ ;; fFtT motions on roids. -(module config.flit {autoload {util config.util nvim aniseed.nvim}}) -(def- opts {:keys {:f :f :F :F :t :t :T :T} - :labeled_modes :v - :multiline true - :opts {}}) +(local opts {:keys {:f :f :F :F :t :t :T :T} + :labeled_modes :v + :multiline true + :opts {}}) -(util.setup :flit opts) +{1 :ggandor/flit.nvim :event :BufReadPost :config opts} diff --git a/fnl/config/gitsigns.fnl b/fnl/config/gitsigns.fnl index 663e3e0..7b7ed95 100644 --- a/fnl/config/gitsigns.fnl +++ b/fnl/config/gitsigns.fnl @@ -1,49 +1,48 @@ ;; Add git signs to source files. -(module config.gitsigns {autoload {util config.util}}) -(def- signs {:add {:hl :GitSignsAdd - :text "|" - :numhl :GitSignsAddNr - :linehl :GitSignsAddLn} - :change {:hl :GitSignsChange - :text "|" - :numhl :GitSignsChangeNr - :linehl :GitSignsChangeLn} - :delete {:hl :GitSignsDelete - :text "_" - :numhl :GitSignsDeleteNr - :linehl :GitSignsDeleteLn} - :topdelete {:hl :GitSignsDelete - :text "‾" - :numhl :GitSignsDeleteNr - :linehl :GitSignsDeleteLn} - :changedelete {:hl :GitSignsChange - :text "~" - :numhl :GitSignsChangeNr - :linehl :GitSignsChangeLn}}) +(local signs {:add {:hl :GitSignsAdd + :text "|" + :numhl :GitSignsAddNr + :linehl :GitSignsAddLn} + :change {:hl :GitSignsChange + :text "|" + :numhl :GitSignsChangeNr + :linehl :GitSignsChangeLn} + :delete {:hl :GitSignsDelete + :text "_" + :numhl :GitSignsDeleteNr + :linehl :GitSignsDeleteLn} + :topdelete {:hl :GitSignsDelete + :text "‾" + :numhl :GitSignsDeleteNr + :linehl :GitSignsDeleteLn} + :changedelete {:hl :GitSignsChange + :text "~" + :numhl :GitSignsChangeNr + :linehl :GitSignsChangeLn}}) -(def- opts {: signs - :signcolumn true - :numhl false - :linehl false - :word_diff false - :watch_gitdir {:interval 1000 :follow_files true} - :attach_to_untracked true - :current_line_blame false - :current_line_blame_opts {:virt_text true - :virt_text_pos :eol - :delay 1000 - :ignore_whitespace false} - :current_line_blame_formatter_opts {:relative_time false} - :sign_priority 6 - :update_debounce 100 - :status_formatter nil - :max_file_length 40000 - :preview_config {:border :single - :style :minimal - :relative :cursor - :row 0 - :col 1} - :yadm {:enable false}}) +(local opts {: signs + :signcolumn true + :numhl false + :linehl false + :word_diff false + :watch_gitdir {:interval 1000 :follow_files true} + :attach_to_untracked true + :current_line_blame false + :current_line_blame_opts {:virt_text true + :virt_text_pos :eol + :delay 1000 + :ignore_whitespace false} + :current_line_blame_formatter_opts {:relative_time false} + :sign_priority 6 + :update_debounce 100 + :status_formatter nil + :max_file_length 40000 + :preview_config {:border :single + :style :minimal + :relative :cursor + :row 0 + :col 1} + :yadm {:enable false}}) -(util.setup :gitsigns opts) +{1 :lewis6991/gitsigns.nvim :event :BufReadPost :config opts} diff --git a/fnl/config/harpoon.fnl b/fnl/config/harpoon.fnl index 9f9d2f2..9bdd81f 100644 --- a/fnl/config/harpoon.fnl +++ b/fnl/config/harpoon.fnl @@ -1,19 +1,19 @@ ;; Harpoon files for navigation. -(module config.harpoon {autoload {util config.util nvim aniseed.nvim}}) -(def- opts {}) +(fn setup [] + (vim.keymap.set :n :<tab> + (fn [] + (util.telescope-ext :harpoon :marks + {:theme :get_dropdown + :previewer false + :initial_mode :normal + :prompt_title :Harpoon})) + {}) + (vim.keymap.set :n :<s-tab> + "<cmd>Telescope buffers theme=dropdown previewer=false initial_mode=normal<cr>" + {})) -(util.setup :harpoon opts) - -(vim.keymap.set :n :<tab> - (fn [] - (util.telescope-ext :harpoon :marks - {:theme :get_dropdown - :previewer false - :initial_mode :normal - :prompt_title :Harpoon})) - {}) - -(nvim.set_keymap :n :<s-tab> - "<cmd>Telescope buffers theme=dropdown previewer=false initial_mode=normal<cr>" - {}) +{1 :ThePrimeagen/harpoon + :event :BufReadPost + :config (fn [] + (setup))} diff --git a/fnl/config/lazy.fnl b/fnl/config/lazy.fnl index 09b0243..faa53c2 100644 --- a/fnl/config/lazy.fnl +++ b/fnl/config/lazy.fnl @@ -1,14 +1,27 @@ ;; Lazy opts. -(module config.lazy {autoload {util config.util}}) -(def- opts {:defaults {:lazy true :version "*"} - :install {:colorscheme [:no-clown-fiesta]} - :checker {:enabled true} - :performance {:rtp {:disabled_plugins [:gzip - :matchit - :matchparen - :netrwPlugin - :tarPlugin - :tohtml - :tutor - :zipPlugin]}}}) +{:install {:colorscheme [:no-clown-fiesta]} + :performance {:rtp {:disabled_plugins [:gzip + :matchit + :matchparen + :netrwPlugin + :tarPlugin + :tohtml + :tutor + :zipPlugin]}} + :ui {:icons {:cmd " " + :config " " + :event " " + :ft " " + :init " " + :import " " + :keys " " + :lazy "鈴 " + :loaded "● " + :not_loaded "○ " + :plugin " " + :runtime " " + :source " " + :start " " + :task " " + :list ["● " " " " " "‒ "]}}} diff --git a/fnl/config/leap.fnl b/fnl/config/leap.fnl index 868f9eb..2a03da1 100644 --- a/fnl/config/leap.fnl +++ b/fnl/config/leap.fnl @@ -1,8 +1,11 @@ ;; Leap through text. -(module config.leap {autoload {util config.util nvim aniseed.nvim}}) -(def- opts {}) +(fn setup [] + (let [leap (require :leap)] + (leap.setup {}) + (leap.set_default_keymaps))) -(let [leap (util.prequire :leap)] - (leap.setup opts) - (leap.set_default_keymaps)) +{1 :ggandor/leap.nvim + :event :BufReadPost + :config (fn [] + (setup))} diff --git a/fnl/config/lir.fnl b/fnl/config/lir.fnl index 45fb052..22b15cf 100644 --- a/fnl/config/lir.fnl +++ b/fnl/config/lir.fnl @@ -1,44 +1,50 @@ ;; Simple file manager. -(module config.lir {autoload {util config.util nvim aniseed.nvim}}) -(defn- opts [actions mark-actions clipboard-actions] - {:show_hidden_files false - :devicons_enable true - :mappings {:l actions.edit - :<C-s> actions.split - :v actions.vsplit - :<C-t> actions.tabedit - :h actions.up - :q actions.quit - :A actions.mkdir - :a actions.newfile - :r actions.rename - "@" actions.cd - :Y actions.yank_path - :i actions.toggle_show_hidden - :d actions.delete - :J (fn [] - (mark-actions.toggle_mark) - (vim.cmd "normal! j")) - :c clipboard-actions.copy - :x clipboard-actions.cut - :p clipboard-actions.paste} - :float {:winblend 0 - :curdir_window {:enable false :highlight_dirname true} - :win_opts (fn [] - (let [width (math.floor (* vim.o.columns 0.7)) - height (math.floor (* vim.o.lines 0.7))] - {:border :rounded : width : height}))} - :hide_cursor false - :on_init (fn [] - (nvim.buf_set_keymap 0 :x :J - ":<C-u>lua require(\"lir.mark.actions\").toggle_mark(\"v\")<CR>" - {:noremap true :silent true}))}) +(fn opts [actions mark-actions clipboard-actions] + {:show_hidden_files false + :devicons_enable true + :mappings {:l actions.edit + :<C-s> actions.split + :v actions.vsplit + :<C-t> actions.tabedit + :h actions.up + :q actions.quit + :A actions.mkdir + :a actions.newfile + :r actions.rename + "@" actions.cd + :Y actions.yank_path + :i actions.toggle_show_hidden + :d actions.delete + :J (fn [] + (mark-actions.toggle_mark) + (vim.cmd "normal! j")) + :c clipboard-actions.copy + :x clipboard-actions.cut + :p clipboard-actions.paste} + :float {:winblend 0 + :curdir_window {:enable false :highlight_dirname true} + :win_opts (fn [] + (let [width (math.floor (* vim.o.columns 0.7)) + height (math.floor (* vim.o.lines 0.7))] + {:border :rounded : width : height}))} + :hide_cursor false + :on_init (fn [] + (nvim.buf_set_keymap 0 :x :J + ":<C-u>lua require(\"lir.mark.actions\").toggle_mark(\"v\")<CR>" + {:noremap true :silent true}))}) -(let [lir (util.prequire :lir)] - (let [actions (require :lir.actions) - mark-actions (require :lir.mark.actions) - clipboard-actions (require :lir.clipboard.actions)] - (lir.setup (opts actions mark-actions clipboard-actions)) - (nvim.set_keymap :n "-" ":lua require'lir.float'.toggle()<cr>" - {:noremap true :silent true}))) +(fn setup [] + (let [lir (require :lir)] + (let [actions (require :lir.actions) + mark-actions (require :lir.mark.actions) + clipboard-actions (require :lir.clipboard.actions)] + (lir.setup (opts actions mark-actions clipboard-actions)) + (nvim.set_keymap :n "-" ":lua require'lir.float'.toggle()<cr>" + {:noremap true :silent true})))) + +{1 :tamago324/lir.nvim + :keys "-" + :config (fn [] + (setup)) + :dependencies [:kyazdani42/nvim-web-devicons]} diff --git a/fnl/config/lsp/lspconfig.fnl b/fnl/config/lsp/lspconfig.fnl index b7143ab..74faa26 100644 --- a/fnl/config/lsp/lspconfig.fnl +++ b/fnl/config/lsp/lspconfig.fnl @@ -1,30 +1,40 @@ ;; Setup of lsps. -(module config.lsp.lspconfig - {autoload {nvim aniseed.nvim - util config.util - keymaps config.lsp.keymaps}}) -(defn- on-attach [] - (nvim.create_autocmd :LspAttach - {:callback (fn [args] - (let [bufnr (. args :buf)] - (keymaps.on-attach bufnr)))})) +(fn on-attach [] + (vim.api.nvim_create_autocmd :LspAttach + {:callback (fn [args] + (let [keymaps (require :config.lsp.keymaps) + bufnr (. args :buf)] + (keymaps.on-attach bufnr)))})) -(defn- capabilities [] - (let [cmp-lsp (util.prequire :cmp_nvim_lsp)] +(fn capabilities [] + (let [cmp-lsp (require :cmp_nvim_lsp)] (cmp-lsp.default_capabilities (vim.lsp.protocol.make_client_capabilities)))) -(defn- mason-opts [servers] +(fn mason-opts [servers] {:ensure_installed (vim.tbl_keys servers) :automatic_installation true}) -(let [lspconfig (util.prequire :lspconfig) - mason-lspconfig (util.prequire :mason-lspconfig) - servers (require :config.lsp.servers)] - (on-attach) - (mason-lspconfig.setup (mason-opts servers)) - (mason-lspconfig.setup_handlers [(fn [server-name] - (let [server-config (. lspconfig - server-name) - opts (or (. servers server-name) {})] - (tset opts :capabilities (capabilities)) - (server-config.setup opts)))])) +(fn setup [] + (require :config.lsp.diagnostics) + (let [lspconfig (require :lspconfig) + mason-lspconfig (require :mason-lspconfig) + servers (require :config.lsp.servers)] + (on-attach) + (mason-lspconfig.setup (mason-opts servers)) + (mason-lspconfig.setup_handlers [(fn [server-name] + (let [server-config (. lspconfig + server-name) + opts (or (. servers server-name) + {})] + (tset opts :capabilities + (capabilities)) + (server-config.setup opts)))]))) + +{1 :neovim/nvim-lspconfig + :event :BufReadPre + :dependencies [:mason.nvim + :williamboman/mason-lspconfig.nvim + :b0o/SchemaStore.nvim + :hrsh7th/cmp-nvim-lsp] + :config (fn [] + (setup))} diff --git a/fnl/config/lsp/mason.fnl b/fnl/config/lsp/mason.fnl index adc60a4..fd40102 100644 --- a/fnl/config/lsp/mason.fnl +++ b/fnl/config/lsp/mason.fnl @@ -1,9 +1,11 @@ ;; Mason manages external tooling, e.g. lsp, formatters, and linters. -(module config.lsp.mason {autoload {util config.util}}) -(def- opts {:ui {:icons {:package_installed "✓" - :package_pending "➜" - :package_uninstalled "✗"}} - :max_concurrent_installers 10}) +(local opts {:ui {:icons {:package_installed " " + :package_pending " " + :package_uninstalled " "}} + :max_concurrent_installers 10}) -(util.setup :mason opts) +{1 :williamboman/mason.nvim + :cmd :Mason + :keys [{1 :<leader>m 2 :<cmd>Mason<cr> :desc :Mason}] + :config opts} diff --git a/fnl/config/lsp/null-ls.fnl b/fnl/config/lsp/null-ls.fnl index fd3a61d..2d03b0d 100644 --- a/fnl/config/lsp/null-ls.fnl +++ b/fnl/config/lsp/null-ls.fnl @@ -1,35 +1,41 @@ ;; Adds LSP diagnostics and formatting. -(module config.lsp.null-ls {autoload {util config.util}}) -(def- mason-opts {:ensure_installed nil - :automatic_installation true - :automatic_setup false}) +(local mason-opts {:ensure_installed nil + :automatic_installation true + :automatic_setup false}) -(let [null-ls (util.prequire :null-ls) - mason-null-ls (util.prequire :mason-null-ls)] - (let [formatting null-ls.builtins.formatting - diagnostics null-ls.builtins.diagnostics] - (null-ls.setup {:debug false - :sources [diagnostics.codespell - diagnostics.cpplint - diagnostics.gitlint - diagnostics.hadolint - diagnostics.jsonlint - diagnostics.misspell - diagnostics.ruff - diagnostics.selene - diagnostics.shellcheck - diagnostics.sqlfluff - diagnostics.write_good - diagnostics.yamllint - formatting.fnlfmt - formatting.markdownlint - formatting.prettierd - formatting.ruff - formatting.rustfmt - formatting.shellharden - formatting.shfmt - formatting.sqlfluff - formatting.stylua - formatting.terraform_fmt]})) - (mason-null-ls.setup mason-opts)) +(fn setup [] + (let [null-ls (require :null-ls) + mason-null-ls (require :mason-null-ls)] + (let [formatting null-ls.builtins.formatting + diagnostics null-ls.builtins.diagnostics] + (null-ls.setup {:debug false + :sources [diagnostics.codespell + diagnostics.cpplint + diagnostics.gitlint + diagnostics.hadolint + diagnostics.jsonlint + diagnostics.misspell + diagnostics.ruff + diagnostics.selene + diagnostics.shellcheck + diagnostics.sqlfluff + diagnostics.write_good + diagnostics.yamllint + formatting.fnlfmt + formatting.markdownlint + formatting.prettierd + formatting.ruff + formatting.rustfmt + formatting.shellharden + formatting.shfmt + formatting.sqlfluff + formatting.stylua + formatting.terraform_fmt]})) + (mason-null-ls.setup mason-opts))) + +{1 :jose-elias-alvarez/null-ls.nvim + :dependencies [:mason.nvim :jayp0521/mason-null-ls.nvim] + :event :BufReadPre + :config (fn [] + (setup))} diff --git a/fnl/config/lualine.fnl b/fnl/config/lualine.fnl index b9a790f..34f735c 100644 --- a/fnl/config/lualine.fnl +++ b/fnl/config/lualine.fnl @@ -1,83 +1,87 @@ ;; Statusbar. -(module config.lualine {autoload {util config.util}}) -(def- disable [:neogitstatus - :netrw - :lir - :lazy - :alpha - :Outline - :NeogitStatus - :NeogitCommitMessage]) +(local disable [:neogitstatus + :netrw + :lir + :lazy + :alpha + :Outline + :NeogitStatus + :NeogitCommitMessage]) -(def- ignore [:help :packer :spectre_panel :TelescopePrompt]) +(local ignore [:help :packer :spectre_panel :TelescopePrompt]) -(defn- active-clients [] (let [clients (vim.lsp.buf_get_clients) - client_names []] - (each [_ client (pairs clients)] - (if (not= client.name :null-ls) - (table.insert client_names client.name))) - (if (> (length client_names) 0) - (table.concat client_names ", ") - ""))) +(fn active-clients [] + (let [clients (vim.lsp.buf_get_clients) + client_names []] + (each [_ client (pairs clients)] + (if (not= client.name :null-ls) + (table.insert client_names client.name))) + (if (> (length client_names) 0) + (table.concat client_names ", ") + ""))) -(defn- hide-in-width [] (> (vim.fn.winwidth 0) 80)) +(fn hide-in-width [] + (> (vim.fn.winwidth 0) 80)) -(def- diagnostics {1 :diagnostics - :sources [:nvim_diagnostic] - :sections [:error :warn] - :symbols {:error " " :warn " "} - :colored false - :disabled_buftypes [:nvim-tree] - :padding 0 - :update_in_insert false - :always_visible true}) +(local diagnostics {1 :diagnostics + :sources [:nvim_diagnostic] + :sections [:error :warn] + :symbols {:error " " :warn " "} + :colored false + :disabled_buftypes [:nvim-tree] + :padding 0 + :update_in_insert false + :always_visible true}) -(def- diff {1 :diff - :colored false - :disabled_buftypes [:nvim-tree] - :cond hide-in-width}) +(local diff {1 :diff + :colored false + :disabled_buftypes [:nvim-tree] + :cond hide-in-width}) -(def- branch {1 "b:gitsigns_head" - :icon " " - :disabled_buftypes [:nvim-tree] - :cond hide-in-width}) +(local branch {1 "b:gitsigns_head" + :icon " " + :disabled_buftypes [:nvim-tree] + :cond hide-in-width}) -(def- filetype {1 :filetype - :icon_only true - :disabled_buftypes [:nvim-tree] - :colored false - :cond hide_in_width}) +(local filetype {1 :filetype + :icon_only true + :disabled_buftypes [:nvim-tree] + :colored false + :cond hide_in_width}) -(def- language-server {1 active-clients - :disabled_buftypes [:nvim-tree] - :cond hide_in_width}) +(local language-server {1 active-clients + :disabled_buftypes [:nvim-tree] + :cond hide_in_width}) -(def- lsp-progress {1 :lsp_progress - :display_components [[:title :percentage :message]] - :timer {:progress_enddelay 500 - :lsp_client_name_enddelay 500}}) +(local lsp-progress + {1 :lsp_progress + :display_components [[:title :percentage :message]] + :timer {:progress_enddelay 500 :lsp_client_name_enddelay 500}}) -(def- opts {:options {:icons_enabled true - :theme :auto - :component_separators "" - :section_separators {:left "" :right ""} - :disabled_filetypes disable - :ignore_focus ignore - :always_divide_middle true - :globalstatus true} - :sections {:lualine_a [:mode] - :lualine_b [branch diff] - :lualine_c {} - :lualine_x [lsp_progress language-server diagnostics] - :lualine_y [filetype] - :lualine_z [:location :progress]} - :inactive_sections {:lualine_a [:mode] - :lualine_b {} - :lualine_c {} - :lualine_x {} - :lualine_y {} - :lualine_z [:location :progress]} - :extensions []}) +(local opts {:options {:icons_enabled true + :theme :auto + :component_separators "" + :section_separators {:left "" :right ""} + :disabled_filetypes disable + :ignore_focus ignore + :always_divide_middle true + :globalstatus true} + :sections {:lualine_a [:mode] + :lualine_b [branch diff] + :lualine_c {} + :lualine_x [lsp_progress language-server diagnostics] + :lualine_y [filetype] + :lualine_z [:location :progress]} + :inactive_sections {:lualine_a [:mode] + :lualine_b {} + :lualine_c {} + :lualine_x {} + :lualine_y {} + :lualine_z [:location :progress]} + :extensions []}) -(util.setup :lualine opts) +{1 :nvim-lualine/lualine.nvim + :event :VeryLazy + :config opts + :dependencies [:kyazdani42/nvim-web-devicons :arkav/lualine-lsp-progress]} diff --git a/fnl/config/minibar.fnl b/fnl/config/minibar.fnl index 145577f..9e49c7f 100644 --- a/fnl/config/minibar.fnl +++ b/fnl/config/minibar.fnl @@ -1,30 +1,32 @@ -(module config.minibar {autoload {util config.util}}) +;; Show the filename in the top left corner. -(def- opts {:ignore-filetypes [:help - :harpoon - :startify - :dashboard - :lir - :alpha - :packer - :neogitstatus - :Trouble - :org - :lazy - :netrw - :Outline - :NeogitStatus - :NeogitCommitMessage - :NeogitNotification - :NeogitCommitView - :spectre_panel - ""] - :events [:CursorMoved - :TermOpen - :DirChanged - :BufWinEnter - :BufFilePost - :InsertEnter - :BufWritePost]}) +(local opts {:ignore-filetypes [:help + :harpoon + :startify + :dashboard + :lir + :alpha + :packer + :neogitstatus + :Trouble + :org + :lazy + :netrw + :Outline + :NeogitStatus + :NeogitCommitMessage + :NeogitNotification + :NeogitCommitView + :spectre_panel + ""] + :events [:CursorMoved + :TermOpen + :DirChanged + :BufWinEnter + :BufFilePost + :InsertEnter + :BufWritePost]}) -(util.setup :minibar opts) + {1 :aktersnurra/minibar.nvim + :event :BufReadPre + :config opts} diff --git a/fnl/config/neogit.fnl b/fnl/config/neogit.fnl deleted file mode 100644 index 2d9f515..0000000 --- a/fnl/config/neogit.fnl +++ /dev/null @@ -1,4 +0,0 @@ -;; UI for git. -(module config.neogit {autoload {util config.util}}) - -(util.setup :neogit {}) diff --git a/fnl/config/orgmode.fnl b/fnl/config/orgmode.fnl index bc73bb7..99e55be 100644 --- a/fnl/config/orgmode.fnl +++ b/fnl/config/orgmode.fnl @@ -1,29 +1,24 @@ ;; Orgmode for nvim. -(module config.orgmode {autoload {nvim aniseed.nvim util config.util}}) -(nvim.ex.set :conceallevel=2) -(nvim.ex.set :concealcursor=nc) +(local templates + {:t {:description :Task :template "* TODO %?\n %u\n DEADLINE: %T\n"} + :m {:description :Meeting :template "* Meeting %?"} + :n {:description :Note :template "* NOTE %? :NOTE:\n %u\n"}}) -(def- templates - {:t {:description :Task :template "* TODO %?\n %u\n DEADLINE: %T\n"} - :m {:description :Meeting :template "* Meeting %?"} - :n {:description :Note :template "* NOTE %? :NOTE:\n %u\n"}}) +(local opts {:org_agenda_files ["~/.local/share/org/**/*"] + :org_hide_emphasis_markers true + :org_agenda_start_on_weekday false + :org_default_notes_file "~/.local/share/org/refile.org" + :org_agenda_templates templates}) -(defn- create-title [task] - (string.format "%s (%s)" task.category task.humanized_duration)) +(fn setup [] + (let [orgmode (require :orgmode)] + (tset vim.opt :conceallevel 2) + (tset vim.opt :concealcursor :nc) + (orgmode.setup_ts_grammar) + (orgmode.setup opts))) -(defn- create-subtitle [task] - (string.format "%s %s %s" (string.rep "*" task.level) task.todo - task.title)) - -(defn- get-date [task] (string.format "%s: %s" task.type (task.time:to_string))) - -(def- opts {:org_agenda_files ["~/.local/share/org/**/*"] - :org_hide_emphasis_markers true - :org_agenda_start_on_weekday false - :org_default_notes_file "~/.local/share/org/refile.org" - :org_agenda_templates templates}) - -(let [orgmode (util.prequire :orgmode)] - (orgmode.setup_ts_grammar) - (orgmode.setup opts)) +{1 :nvim-orgmode/orgmode + :event :BufReadPost + :config (fn [] + (setup))} diff --git a/fnl/config/persistence.fnl b/fnl/config/persistence.fnl index ad93131..e1368f1 100644 --- a/fnl/config/persistence.fnl +++ b/fnl/config/persistence.fnl @@ -1,6 +1,5 @@ ;; Session manager. -(module config.persistence {autoload {util config.util}}) -(def- opts {:options [:buffers :curdir :tabpages :winsize :help]}) +(local opts {:options [:buffers :curdir :tabpages :winsize :help]}) -(util.setup :persistence opts) +{1 :folke/persistence.nvim :event :VeryLazy :config opts} diff --git a/fnl/config/project.fnl b/fnl/config/project.fnl index 1617ca5..eceef84 100644 --- a/fnl/config/project.fnl +++ b/fnl/config/project.fnl @@ -1,7 +1,6 @@ ;; Provides project management. -(module config.project {autoload {util config.util}}) -(def- opts {:active true +(local opts {:active true :on_config_done nil :manual_mode false :detection_methods [:patterns] @@ -11,4 +10,6 @@ :ignore_lsp {} :datapath (vim.fn.stdpath :data)}) -(util.setup :project_nvim opts) + {1 :ahmedkhalf/project.nvim + :event :BufReadPre + :config opts} diff --git a/fnl/config/spectre.fnl b/fnl/config/spectre.fnl index f0afa52..c662935 100644 --- a/fnl/config/spectre.fnl +++ b/fnl/config/spectre.fnl @@ -1,63 +1,62 @@ ;; Find and replace. -(module config.spectre {autoload {util config.util}}) -(def- opts {:color_devicons true - :highlight {:ui :String :search :DiffChange :replace :DiffDelete} - :mapping {:toggle_line {:map :t - :cmd "<cmd>lua require('spectre').toggle_line()<CR>" - :desc "toggle current item"} - :enter_file {:map :<cr> - :cmd "<cmd>lua require('spectre.actions').select_entry()<CR>" - :desc "goto current file"} - :send_to_qf {:map :Q - :cmd "<cmd>lua require('spectre.actions').send_to_qf()<CR>" - :desc "send all item to quickfix"} - :replace_cmd {:map :c - :cmd "<cmd>lua require('spectre.actions').replace_cmd()<CR>" - :desc "input replace vim command"} - :show_option_menu {:map :o - :cmd "<cmd>lua require('spectre').show_options()<CR>" - :desc "show option"} - :run_replace {:map :R - :cmd "<cmd>lua require('spectre.actions').run_replace()<CR>" - :desc "replace all"} - :change_view_mode {:map :m - :cmd "<cmd>lua require('spectre').change_view()<CR>" - :desc "change result view mode"} - :toggle_ignore_case {:map :I - :cmd "<cmd>lua require('spectre').change_options('ignore-case')<CR>" - :desc "toggle ignore case"} - :toggle_ignore_hidden {:map :H - :cmd "<cmd>lua require('spectre').change_options('hidden')<CR>" - :desc "toggle search hidden"}} - :find_engine {:rg {:cmd :rg - :args [:--color=never - :--no-heading - :--with-filename - :--line-number - :--column] - :options {:ignore-case {:value :--ignore-case - :icon "[I]" - :desc "ignore case"} - :hidden {:value :--hidden - :desc "hidden file" - :icon "[H]"}}} - :ag {:cmd :ag - :args [:--vimgrep :-s] - :options {:ignore-case {:value :-i - :icon "[I]" - :desc "ignore case"} - :hidden {:value :--hidden - :desc "hidden file" - :icon "[H]"}}}} - :replace_engine {:sed {:cmd :sed :args nil} - :options {:ignore-case {:value :--ignore-case - :icon "[I]" - :desc "ignore case"}}} - :default {:find {:cmd :rg :options [:ignore-case]} - :replace {:cmd :sed}} - :replace_vim_cmd :cdo - :is_open_target_win true - :is_insert_mode false}) +(local opts {:color_devicons true + :highlight {:ui :String :search :DiffChange :replace :DiffDelete} + :mapping {:toggle_line {:map :t + :cmd "<cmd>lua require('spectre').toggle_line()<CR>" + :desc "toggle current item"} + :enter_file {:map :<cr> + :cmd "<cmd>lua require('spectre.actions').select_entry()<CR>" + :desc "goto current file"} + :send_to_qf {:map :Q + :cmd "<cmd>lua require('spectre.actions').send_to_qf()<CR>" + :desc "send all item to quickfix"} + :replace_cmd {:map :c + :cmd "<cmd>lua require('spectre.actions').replace_cmd()<CR>" + :desc "input replace vim command"} + :show_option_menu {:map :o + :cmd "<cmd>lua require('spectre').show_options()<CR>" + :desc "show option"} + :run_replace {:map :R + :cmd "<cmd>lua require('spectre.actions').run_replace()<CR>" + :desc "replace all"} + :change_view_mode {:map :m + :cmd "<cmd>lua require('spectre').change_view()<CR>" + :desc "change result view mode"} + :toggle_ignore_case {:map :I + :cmd "<cmd>lua require('spectre').change_options('ignore-case')<CR>" + :desc "toggle ignore case"} + :toggle_ignore_hidden {:map :H + :cmd "<cmd>lua require('spectre').change_options('hidden')<CR>" + :desc "toggle search hidden"}} + :find_engine {:rg {:cmd :rg + :args [:--color=never + :--no-heading + :--with-filename + :--line-number + :--column] + :options {:ignore-case {:value :--ignore-case + :icon "[I]" + :desc "ignore case"} + :hidden {:value :--hidden + :desc "hidden file" + :icon "[H]"}}} + :ag {:cmd :ag + :args [:--vimgrep :-s] + :options {:ignore-case {:value :-i + :icon "[I]" + :desc "ignore case"} + :hidden {:value :--hidden + :desc "hidden file" + :icon "[H]"}}}} + :replace_engine {:sed {:cmd :sed :args nil} + :options {:ignore-case {:value :--ignore-case + :icon "[I]" + :desc "ignore case"}}} + :default {:find {:cmd :rg :options [:ignore-case]} + :replace {:cmd :sed}} + :replace_vim_cmd :cdo + :is_open_target_win true + :is_insert_mode false}) -(util.setup :spectre opts) +{1 :windwp/nvim-spectre :event :BufReadPost :config opts} diff --git a/fnl/config/stay-in-place.fnl b/fnl/config/stay-in-place.fnl deleted file mode 100644 index be3ccd3..0000000 --- a/fnl/config/stay-in-place.fnl +++ /dev/null @@ -1,4 +0,0 @@ -;; Prevent the cursor from moving when using shift and filter actions. -(module config.stay-in-place {autoload {util config.util}}) - -(util.setup :stay-in-place {}) diff --git a/fnl/config/surround.fnl b/fnl/config/surround.fnl deleted file mode 100644 index 2406ecd..0000000 --- a/fnl/config/surround.fnl +++ /dev/null @@ -1,6 +0,0 @@ -;; Surround selections. -(module config.surround {autoload {util config.util}}) - -(def- opts {}) - -(util.setup :nvim-surround opts) diff --git a/fnl/config/telescope.fnl b/fnl/config/telescope.fnl index ac3c33c..ce4fb9c 100644 --- a/fnl/config/telescope.fnl +++ b/fnl/config/telescope.fnl @@ -1,82 +1,95 @@ ;; Telescope a highly extendable fuzzy finder over lists. -(module config.telescope {autoload {util config.util nvim aniseed.nvim}}) -(def- opts {:noremap true :silent true}) +(local opts {:noremap true :silent true}) -(let [telescope (util.prequire :telescope)] - (let [actions (require :telescope.actions)] - (telescope.setup {:defaults {:prompt_prefix " " - :selection_caret "> " - :path_display [:smart] - :color_devicons false - :vimgrep_arguments [:rg - :--color=never - :--no-heading - :--with-filename - :--line-number - :--column - :--smart-case - :--hidden] - :mappings {:i {:<C-n> actions.cycle_history_next - :<C-p> actions.cycle_history_prev - :<C-j> actions.move_selection_next - :<C-k> actions.move_selection_previous - :<C-c> actions.close - :<Down> actions.move_selection_next - :<Up> actions.move_selection_previous - :<CR> actions.select_default - :<C-x> actions.select_horizontal - :<C-v> actions.select_vertical - :<C-t> actions.select_tab - :<C-u> actions.preview_scrolling_up - :<C-d> actions.preview_scrolling_down - :<PageUp> actions.results_scrolling_up - :<PageDown> actions.results_scrolling_down - :<Tab> (+ actions.toggle_selection - actions.move_selection_worse) - :<S-Tab> (+ actions.toggle_selection - actions.move_selection_better) - :<C-q> (+ actions.send_to_qflist - actions.open_qflist) - :<M-q> (+ actions.send_selected_to_qflist - actions.open_qflist) - :<C-l> actions.complete_tag - :<C-_> actions.which_key} - :n {:<esc> actions.close - :<CR> actions.select_default - :<C-x> actions.select_horizontal - :<C-v> actions.select_vertical - :<C-t> actions.select_tab - :<Tab> (+ actions.toggle_selection - actions.move_selection_worse) - :<S-Tab> (+ actions.toggle_selection - actions.move_selection_better) - :<C-q> (+ actions.send_to_qflist - actions.open_qflist) - :<M-q> (+ actions.send_selected_to_qflist - actions.open_qflist) - :j actions.move_selection_next - :k actions.move_selection_previous - :H actions.move_to_top - :M actions.move_to_middle - :L actions.move_to_bottom - :<Down> actions.move_selection_next - :<Up> actions.move_selection_previous - :gg actions.move_to_top - :G actions.move_to_bottom - :q actions.close - :<C-u> actions.preview_scrolling_up - :<C-d> actions.preview_scrolling_down - :<PageUp> actions.results_scrolling_up - :<PageDown> actions.results_scrolling_down - :dd actions.delete_buffer - :? actions.which_key}}} - :extensions {:fzf {:fuzzy true - :override_generic_sorter true - :override_file_sorter true - :case_mode :smart_case}}}) - (telescope.load_extension :fzf) - (telescope.load_extension :frecency) - (telescope.load_extension :orgmode) - (telescope.load_extension :projects) - (telescope.load_extension :harpoon))) +(fn setup [] + (let [telescope (util.prequire :telescope)] + (let [actions (require :telescope.actions)] + (telescope.setup {:defaults {:prompt_prefix " " + :selection_caret "> " + :path_display [:smart] + :color_devicons false + :vimgrep_arguments [:rg + :--color=never + :--no-heading + :--with-filename + :--line-number + :--column + :--smart-case + :--hidden] + :mappings {:i {:<C-n> actions.cycle_history_next + :<C-p> actions.cycle_history_prev + :<C-j> actions.move_selection_next + :<C-k> actions.move_selection_previous + :<C-c> actions.close + :<Down> actions.move_selection_next + :<Up> actions.move_selection_previous + :<CR> actions.select_default + :<C-x> actions.select_horizontal + :<C-v> actions.select_vertical + :<C-t> actions.select_tab + :<C-u> actions.preview_scrolling_up + :<C-d> actions.preview_scrolling_down + :<PageUp> actions.results_scrolling_up + :<PageDown> actions.results_scrolling_down + :<Tab> (+ actions.toggle_selection + actions.move_selection_worse) + :<S-Tab> (+ actions.toggle_selection + actions.move_selection_better) + :<C-q> (+ actions.send_to_qflist + actions.open_qflist) + :<M-q> (+ actions.send_selected_to_qflist + actions.open_qflist) + :<C-l> actions.complete_tag + :<C-_> actions.which_key} + :n {:<esc> actions.close + :<CR> actions.select_default + :<C-x> actions.select_horizontal + :<C-v> actions.select_vertical + :<C-t> actions.select_tab + :<Tab> (+ actions.toggle_selection + actions.move_selection_worse) + :<S-Tab> (+ actions.toggle_selection + actions.move_selection_better) + :<C-q> (+ actions.send_to_qflist + actions.open_qflist) + :<M-q> (+ actions.send_selected_to_qflist + actions.open_qflist) + :j actions.move_selection_next + :k actions.move_selection_previous + :H actions.move_to_top + :M actions.move_to_middle + :L actions.move_to_bottom + :<Down> actions.move_selection_next + :<Up> actions.move_selection_previous + :gg actions.move_to_top + :G actions.move_to_bottom + :q actions.close + :<C-u> actions.preview_scrolling_up + :<C-d> actions.preview_scrolling_down + :<PageUp> actions.results_scrolling_up + :<PageDown> actions.results_scrolling_down + :dd actions.delete_buffer + :? actions.which_key}}} + :extensions {:fzf {:fuzzy true + :override_generic_sorter true + :override_file_sorter true + :case_mode :smart_case}}}) + (telescope.load_extension :fzf) + (telescope.load_extension :frecency) + (telescope.load_extension :orgmode) + (telescope.load_extension :projects) + (telescope.load_extension :harpoon)))) + +{1 :nvim-telescope/telescope.nvim + :cmd :Telescope + :dependencies [:nvim-lua/popup.nvim + :nvim-telescope/telescope-frecency.nvim + :tami5/sqlite.lua + :ahmedkhalf/project.nvim + :nvim-lua/plenary.nvim + :nvim-telescope/telescope-fzf-native.nvim + :nvim-telescope/telescope-frecency.nvim + :joaomsa/telescope-orgmode.nvim] + :config (fn [] + (setup))} diff --git a/fnl/config/toggleterm.fnl b/fnl/config/toggleterm.fnl index dd561f3..3c8aa39 100644 --- a/fnl/config/toggleterm.fnl +++ b/fnl/config/toggleterm.fnl @@ -1,16 +1,5 @@ ;; Terminal inside nvim. -(module config.toggleterm - {autoload {util config.util nvim aniseed.nvim autocmd config.autocmd}}) -(def- opts {:size 16 :shade_terminals false}) +(local opts {:size 16 :shade_terminals false}) -(defn- set-terminal-keymaps [] - (nvim.set_keymap :t :<C-h> "<Cmd>wincmd h<CR>" {}) - (nvim.set_keymap :t :<C-j> "<Cmd>wincmd j<CR>" {}) - (nvim.set_keymap :t :<C-k> "<Cmd>wincmd k<CR>" {}) - (nvim.set_keymap :t :<C-l> "<Cmd>wincmd l<CR>" {})) - -(util.setup :toggleterm opts) -(autocmd.create-autocmd :TermOpen - {:pattern "term://*toggleterm#*" - :callback set-terminal-keymaps}) +{1 :akinsho/toggleterm.nvim :cmd :ToggleTerm :config opts} diff --git a/fnl/config/treesitter.fnl b/fnl/config/treesitter.fnl index e61e2c0..a8918d2 100644 --- a/fnl/config/treesitter.fnl +++ b/fnl/config/treesitter.fnl @@ -1,32 +1,34 @@ ;; Treesitter is a tool for building syntax trees for source files. ;; In the neovim context it helps with better coloring. -(module config.treesitter {autoload {util config.util}}) -(def- opts {:ensure_installed [:c - :rust - :lua - :hcl - :org - :haskell - :python - :fennel - :make - :go - :ocaml - :erlang - :vim - :yaml - :html - :toml - :dockerfile - :markdown - :latex] - :sync_install false - :ignore_install [""] - :autopairs {:enable true} - :highlight {:enable true :disable [:org]} - :context_commentstring {:enable true :enable_autocmd false} - :indent {:enable true :disable [:yaml :python :css]} - :playground {:enable true}}) +(local opts {:ensure_installed [:c + :rust + :lua + :hcl + :org + :haskell + :python + :fennel + :make + :go + :ocaml + :erlang + :vim + :yaml + :html + :toml + :dockerfile + :markdown + :latex] + :sync_install false + :ignore_install [""] + :autopairs {:enable true} + :highlight {:enable true :disable [:org]} + :context_commentstring {:enable true :enable_autocmd false} + :indent {:enable true :disable [:yaml :python :css]} + :playground {:enable true}}) -(util.setup :nvim-treesitter.configs opts) +{1 :nvim-treesitter/nvim-treesitter + :build ":TSUpdate" + :event :BufReadPre + :config opts} diff --git a/fnl/config/trim.fnl b/fnl/config/trim.fnl index 8a2ec43..e21b715 100644 --- a/fnl/config/trim.fnl +++ b/fnl/config/trim.fnl @@ -1,6 +1,5 @@ ;; Trim whitespaces on save. -(module config.trim {autoload {util config.util}}) -(def- opts {:disable [:python]}) +(local opts {:disable [:python]}) -(util.setup :trim opts) +{1 :cappyzawa/trim.nvim :event :BufFilePre :config opts} diff --git a/fnl/config/trouble.fnl b/fnl/config/trouble.fnl index b45fecd..988f2ed 100644 --- a/fnl/config/trouble.fnl +++ b/fnl/config/trouble.fnl @@ -1,82 +1,81 @@ ;; Pretty diagnostics. -(module config.trouble {autoload {util config.util}}) -(def- opts {:position :bottom - ;; position of the list can be: bottom, top, left, right - :height 10 - ;; height of the trouble list when position is top or bottom - :width 50 - ;; width of the list when position is left or right - :icons true - ;; use devicons for filenames - :mode :workspace_diagnostics - ;; "workspace_diagnostics", "document_diagnostics", "quickfix", "lsp_references", "loclist" - :fold_open "" - ;; icon used for open folds - :fold_closed "" - ;; icon used for closed folds - :group true - ;; group results by file - :padding true - ;; add an extra new line on top of the list - :action_keys {;; key mappings for actions in the trouble list - ;; map to {} to remove a mapping for example: - ;; close {} - :close :q - ;; close the list - :cancel :<esc> - ;; cancel the preview and get back to your last window / buffer / cursor - :refresh :r - ;; manually refresh - :jump [:<cr> :<tab>] - ;; jump to the diagnostic or open / close folds - :open_split [:<c-x>] - ;; open buffer in new split - :open_vsplit [:<c-v>] - ;; open buffer in new vsplit - :open_tab [:<c-t>] - ;; open buffer in new tab - :jump_close [:o] - ;; jump to the diagnostic and close the list - :toggle_mode :m - ;; toggle between "workspace" and "document" diagnostics mode - :toggle_preview :P - ;; toggle auto_preview - :hover :K - ;; opens a small popup with the full multiline message - :preview :p - ;; preview the diagnostic location - :close_folds [:zM :zm] - ;; close all folds - :open_folds [:zR :zr] - ;; open all folds - :toggle_fold [:zA :za] - ;; toggle fold of current file - :previous :k - ;; previous item - :next :j - ;; next item - } - :indent_lines true - ;; add an indent guide below the fold icons - :auto_open false - ;; automatically open the list when you have diagnostics - :auto_close false - ;; automatically close the list when you have no diagnostics - :auto_preview true - ;; automatically preview the location of the diagnostic. <esc> to close preview and go back to last window - :auto_fold false - ;; automatically fold a file trouble list at creation - :auto_jump [:lsp_definitions] - ;; for the given modes, automatically jump if there is only a single result - :signs {;; icons / text used for a diagnostic - :error "" - :warning "" - :hint "" - :information "" - :other ""} - :use_diagnostic_signs false - ;; enabling this will use the signs defined in your lsp client - }) +(local opts {:position :bottom + ;; position of the list can be: bottom, top, left, right + :height 10 + ;; height of the trouble list when position is top or bottom + :width 50 + ;; width of the list when position is left or right + :icons true + ;; use devicons for filenames + :mode :workspace_diagnostics + ;; "workspace_diagnostics", "document_diagnostics", "quickfix", "lsp_references", "loclist" + :fold_open "" + ;; icon used for open folds + :fold_closed "" + ;; icon used for closed folds + :group true + ;; group results by file + :padding true + ;; add an extra new line on top of the list + :action_keys {;; key mappings for actions in the trouble list + ;; map to {} to remove a mapping for example: + ;; close {} + :close :q + ;; close the list + :cancel :<esc> + ;; cancel the preview and get back to your last window / buffer / cursor + :refresh :r + ;; manually refresh + :jump [:<cr> :<tab>] + ;; jump to the diagnostic or open / close folds + :open_split [:<c-x>] + ;; open buffer in new split + :open_vsplit [:<c-v>] + ;; open buffer in new vsplit + :open_tab [:<c-t>] + ;; open buffer in new tab + :jump_close [:o] + ;; jump to the diagnostic and close the list + :toggle_mode :m + ;; toggle between "workspace" and "document" diagnostics mode + :toggle_preview :P + ;; toggle auto_preview + :hover :K + ;; opens a small popup with the full multiline message + :preview :p + ;; preview the diagnostic location + :close_folds [:zM :zm] + ;; close all folds + :open_folds [:zR :zr] + ;; open all folds + :toggle_fold [:zA :za] + ;; toggle fold of current file + :previous :k + ;; previous item + :next :j + ;; next item + } + :indent_lines true + ;; add an indent guide below the fold icons + :auto_open false + ;; automatically open the list when you have diagnostics + :auto_close false + ;; automatically close the list when you have no diagnostics + :auto_preview true + ;; automatically preview the location of the diagnostic. <esc> to close preview and go back to last window + :auto_fold false + ;; automatically fold a file trouble list at creation + :auto_jump [:lsp_definitions] + ;; for the given modes, automatically jump if there is only a single result + :signs {;; icons / text used for a diagnostic + :error "" + :warning "" + :hint "" + :information "" + :other ""} + :use_diagnostic_signs false + ;; enabling this will use the signs defined in your lsp client + }) -(util.setup :trouble opts) +{1 :folke/trouble.nvim :cmd :TroubleToggle :config opts} diff --git a/fnl/config/vim-slash.fnl b/fnl/config/vim-slash.fnl index 726ed8f..6f50ae4 100644 --- a/fnl/config/vim-slash.fnl +++ b/fnl/config/vim-slash.fnl @@ -1,4 +1,6 @@ ;; Provides a set of mappings for enhancing in-buffer search experience. -(module config.vim-slash) -(vim.cmd "noremap <plug>(slash-after) zz") +{1 :junegunn/vim-slash + :event :BufReadPost + :config (fn [] + (vim.cmd "noremap <plug>(slash-after) zz"))} diff --git a/fnl/config/which-key.fnl b/fnl/config/which-key.fnl index 405fb1c..588869d 100644 --- a/fnl/config/which-key.fnl +++ b/fnl/config/which-key.fnl @@ -1,7 +1,6 @@ ;; Which-key provides a pop-up menu for some key mappings. -(module config.which-key {autoload {util config.util}}) -(def- setup {:plugins {:marks true +(local opts {:plugins {:marks true :registers true :spelling {:enabled true :suggestions 20} :presets {:operators false @@ -25,147 +24,147 @@ :disable {:filetypes [:netrw]} :triggers_blacklist {:i [:j :k] :v [:j :k]}}) -(def- mopts {:mode :n - :prefix :m - :buffer nil - :silent true - :noremap true - :nowait true}) - -(def- mmappings {:a [:<cmd>HarpoonAdd<cr> :Harpoon] - :d [:<cmd>DiffviewFileHistory<cr> :DiffviewFileHistory] - :f [(fn [] - (util.telescope-builtin :find_files - {:theme :get_dropdown - :previewer false})) - "Find files"] - :g ["<cmd>Telescope live_grep theme=dropdown<cr>" "Find text"] - :n [:<cmd>Neogit<cr> :Neogit] - :p [:<cmd>SaveSession<cr> "Save Session"] - :q ["<cmd>Gitsigns diffthis HEAD<cr>" "Gitsigns diff"] - :r [:<cmd>HarpoonUI<cr> "Harpoon UI"] - :s [:<cmd>HarpoonPrev<cr> "Harpoon Prev"] - :t [:<cmd>HarpoonNext<cr> "Harpoon Next"] - :v ["<cmd>lua vim.lsp.buf.rename()<cr>" :Rename] - :x ["<cmd>DiffviewOpen -uno<cr>" :DiffviewOpen] - :z [:<cmd>DiffviewClose<cr> :DiffviewClose]}) - -(def- nopts {:mode :n - :prefix :<leader> - :buffer nil - :silent true - :noremap true - :nowait true}) - -(def- find - {:name :find - :C ["<cmd>Telescope commands theme=dropdown<cr>" :Commands] - :H ["<cmd>Telescope highlights<cr>" :Highlights] - :R ["<cmd>Telescope registers theme=dropdown<cr>" :Registers] - :S ["<cmd>Telescope grep_string theme=dropdown<cr>" "Find String"] - :b ["<cmd>Telescope git_branches theme=dropdown<cr>" "Checkout branch"] - :c ["<cmd>Telescope colorscheme theme=dropdown<cr>" :Colorscheme] - :f [(fn [] - (util.telescope-builtin :find_files - {:theme :get_dropdown :previewer false})) - "Find files"] - :h ["<cmd>Telescope help_tags theme=dropdown<cr>" :Help] - :k ["<cmd>Telescope keymaps theme=dropdown<cr>" :Keymaps] - :l ["<cmd>Telescope resume theme=dropdown<cr>" "Last Search"] - :p ["<cmd>Telescope projects theme=dropdown<cr>" "Find project"] - :r ["<cmd>Telescope oldfiles theme=dropdown<cr>" "Recent File"] - :s [:<cmd>SearchSession<cr> "Find Session"] - :t ["<cmd>Telescope live_grep theme=dropdown<cr>" "Find text"]}) - -(def- diagnostics {:name :diagnostics - :t [:<cmd>TroubleToggle<cr> :Trouble] - :g ["<cmd>Telescope diagnostics theme=dropdown<cr>" - "Telescope diagnostics"]}) - -(def- git {:name :git - :R ["<cmd>lua require 'gitsigns'.reset_buffer()<cr>" "Reset Buffer"] - :b ["<cmd>Telescope git_branches theme=dropdown<cr>" - "Checkout branch"] - :c ["<cmd>Telescope git_commits theme=dropdown<cr>" - "Checkout commit"] - :d ["<cmd>Gitsigns diffthis HEAD<cr>" :Diff] - :j ["<cmd>lua require 'gitsigns'.next_hunk()<cr>" "Next Hunk"] - :k ["<cmd>lua require 'gitsigns'.prev_hunk()<cr>" "Prev Hunk"] - :l ["<cmd>lua require 'gitsigns'.blame_line()<cr>" :Blame] - :o ["<cmd>Telescope git_status theme=dropdown<cr>" - "Open changed file"] - :p ["<cmd>lua require 'gitsigns'.preview_hunk()<cr>" "Preview Hunk"] - :r ["<cmd>lua require 'gitsigns'.reset_hunk()<cr>" "Reset Hunk"] - :s ["<cmd>lua require 'gitsigns'.stage_hunk()<cr>" "Stage Hunk"] - :u ["<cmd>lua require 'gitsigns'.undo_stage_hunk()<cr>" - "Undo Stage Hunk"]}) - -(def- lsp - {:name :lsp - :S ["<cmd>Telescope lsp_dynamic_workspace_symbols<cr>" - "Workspace Symbols"] - :a ["<cmd>lua vim.lsp.buf.code_action()<cr>" "Code Action"] - :f ["<cmd>lua vim.lsp.buf.format { async = true }<cr>" :Format] - :i [:<cmd>LspInfo<cr> :Info] - :l ["<cmd>lua vim.lsp.codelens.run()<cr>" "CodeLens Action"] - :r ["<cmd>lua vim.lsp.buf.rename()<cr>" :Rename] - :s ["<cmd>Telescope lsp_document_symbols<cr>" "Document Symbols"]}) - -(def- replace {:name :replace - :m [:<cmd>ReplaceInBuf<cr> "Replace in Buffer"] - :n [:<cmd>Replace<cr> :Replace] - :e [:<cmd>ReplaceWord<cr> "Replace Word"]}) - -(def- session {:name :session - :m [:<cmd>RestoreSession<cr> "Restore session"] - :n [:<cmd>RestoreLastSession<cr> "Restore last session"] - :e [:<cmd>IgnoreSession<cr> "Ignore current session"]}) - -(def- treesitter - {:name :Treesitter :p [:<cmd>TSPlaygroundToggle<cr> :Playground]}) - -(def- nmappings {:a ["<cmd>Telescope lsp_document_symbols theme=dropdown<cr>" - "Document Symbols"] - :T treesitter - :<BS> [:<cmd>BufDel<CR> "Close Buffer"] - :j diagnostics - :f find - :g git - :h [:<cmd>ColorizerToggle<cr> :Colorizer] - :l lsp - :m [:<cmd>Mason<cr> :Mason] - :n [:<cmd>SymbolsOutline<cr> "Symbols outline"] - :r replace - :s session - :t [:<cmd>ToggleTerm<cr> :Terminal] - :u [:<cmd>UndotreeToggle<cr> :Undotree] - :y ["<cmd>Lazy home<cr>" :Home] - :z [:<cmd>ZenMode<cr> "Zen Mode"]}) - -(def- vopts {:mode :v - :prefix :<leader> - :buffer nil - :silent true - :noremap true - :nowait true}) - -(def- vmappings {:n [:<esc><cmd>CommentVisual<cr> :Comment]}) - -(def- gopts {:mode :n - :prefix :g - :buffer nil - :silent true - :noremap true - :nowait true}) - -(def- gmappings {:a [:<cmd>OrgAgendaPrompt<cr> "Open agenda prompt"] - :c [:<cmd>OrgCapturePrompt<cr> "Open capture prompt"] - :m ["<cmd>Telescope orgmode search_headings theme=dropdown<cr>" - "Search headings"]}) - -(let [which-key (util.prequire :which-key)] - (which-key.setup setup) - (which-key.register mmappings mopts) - (which-key.register nmappings nopts) - (which-key.register vmappings vopts) - (which-key.register gmappings gopts)) +(local mopts {:mode :n + :prefix :m + :buffer nil + :silent true + :noremap true + :nowait true}) + +(local mmappings {:a [:<cmd>HarpoonAdd<cr> :Harpoon] + :d [:<cmd>DiffviewFileHistory<cr> :DiffviewFileHistory] + :f [:<cmd>FindFiles<cr> "Find files"] + :g ["<cmd>Telescope live_grep theme=dropdown<cr>" + "Find text"] + :n [:<cmd>Neogit<cr> :Neogit] + :p [:<cmd>SaveSession<cr> "Save Session"] + :q ["<cmd>Gitsigns diffthis HEAD<cr>" "Gitsigns diff"] + :r [:<cmd>HarpoonUI<cr> "Harpoon UI"] + :s [:<cmd>HarpoonPrev<cr> "Harpoon Prev"] + :t [:<cmd>HarpoonNext<cr> "Harpoon Next"] + :v ["<cmd>lua vim.lsp.buf.rename()<cr>" :Rename] + :x ["<cmd>DiffviewOpen -uno<cr>" :DiffviewOpen] + :z [:<cmd>DiffviewClose<cr> :DiffviewClose]}) + +(local nopts {:mode :n + :prefix :<leader> + :buffer nil + :silent true + :noremap true + :nowait true}) + +(local find + {:name :find + :C ["<cmd>Telescope commands theme=dropdown<cr>" :Commands] + :H ["<cmd>Telescope highlights<cr>" :Highlights] + :R ["<cmd>Telescope registers theme=dropdown<cr>" :Registers] + :S ["<cmd>Telescope grep_string theme=dropdown<cr>" "Find String"] + :b ["<cmd>Telescope git_branches theme=dropdown<cr>" "Checkout branch"] + :c ["<cmd>Telescope colorscheme theme=dropdown<cr>" :Colorscheme] + :f [:<cmd>FindFiles<cr> "Find files"] + :h ["<cmd>Telescope help_tags theme=dropdown<cr>" :Help] + :k ["<cmd>Telescope keymaps theme=dropdown<cr>" :Keymaps] + :l ["<cmd>Telescope resume theme=dropdown<cr>" "Last Search"] + :p ["<cmd>Telescope projects theme=dropdown<cr>" "Find project"] + :r ["<cmd>Telescope oldfiles theme=dropdown<cr>" "Recent File"] + :s [:<cmd>SearchSession<cr> "Find Session"] + :t ["<cmd>Telescope live_grep theme=dropdown<cr>" "Find text"]}) + +(local diagnostics {:name :diagnostics + :t [:<cmd>TroubleToggle<cr> :Trouble] + :g ["<cmd>Telescope diagnostics theme=dropdown<cr>" + "Telescope diagnostics"]}) + +(local git {:name :git + :R ["<cmd>lua require 'gitsigns'.reset_buffer()<cr>" + "Reset Buffer"] + :b ["<cmd>Telescope git_branches theme=dropdown<cr>" + "Checkout branch"] + :c ["<cmd>Telescope git_commits theme=dropdown<cr>" + "Checkout commit"] + :d ["<cmd>Gitsigns diffthis HEAD<cr>" :Diff] + :j ["<cmd>lua require 'gitsigns'.next_hunk()<cr>" "Next Hunk"] + :k ["<cmd>lua require 'gitsigns'.prev_hunk()<cr>" "Prev Hunk"] + :l ["<cmd>lua require 'gitsigns'.blame_line()<cr>" :Blame] + :o ["<cmd>Telescope git_status theme=dropdown<cr>" + "Open changed file"] + :p ["<cmd>lua require 'gitsigns'.preview_hunk()<cr>" + "Preview Hunk"] + :r ["<cmd>lua require 'gitsigns'.reset_hunk()<cr>" "Reset Hunk"] + :s ["<cmd>lua require 'gitsigns'.stage_hunk()<cr>" "Stage Hunk"] + :u ["<cmd>lua require 'gitsigns'.undo_stage_hunk()<cr>" + "Undo Stage Hunk"]}) + +(local lsp + {:name :lsp + :S ["<cmd>Telescope lsp_dynamic_workspace_symbols<cr>" + "Workspace Symbols"] + :a ["<cmd>lua vim.lsp.buf.code_action()<cr>" "Code Action"] + :f ["<cmd>lua vim.lsp.buf.format { async = true }<cr>" :Format] + :i [:<cmd>LspInfo<cr> :Info] + :l ["<cmd>lua vim.lsp.codelens.run()<cr>" "CodeLens Action"] + :r ["<cmd>lua vim.lsp.buf.rename()<cr>" :Rename] + :s ["<cmd>Telescope lsp_document_symbols<cr>" "Document Symbols"]}) + +(local replace {:name :replace + :m [:<cmd>ReplaceInBuf<cr> "Replace in Buffer"] + :n [:<cmd>Replace<cr> :Replace] + :e [:<cmd>ReplaceWord<cr> "Replace Word"]}) + +(local session + {:name :session + :m [:<cmd>RestoreSession<cr> "Restore session"] + :n [:<cmd>RestoreLastSession<cr> "Restore last session"] + :e [:<cmd>IgnoreSession<cr> "Ignore current session"]}) + +(local treesitter + {:name :Treesitter :p [:<cmd>TSPlaygroundToggle<cr> :Playground]}) + +(local nmappings {:a ["<cmd>Telescope lsp_document_symbols theme=dropdown<cr>" + "Document Symbols"] + :T treesitter + :<BS> [:<cmd>BufDel<CR> "Close Buffer"] + :j diagnostics + :f find + :g git + :h [:<cmd>ColorizerToggle<cr> :Colorizer] + :l lsp + :m [:<cmd>Mason<cr> :Mason] + :n [:<cmd>SymbolsOutline<cr> "Symbols outline"] + :r replace + :s session + :t [:<cmd>ToggleTerm<cr> :Terminal] + :u [:<cmd>UndotreeToggle<cr> :Undotree] + :y ["<cmd>Lazy home<cr>" :Home] + :z [:<cmd>ZenMode<cr> "Zen Mode"]}) + +(local vopts {:mode :v + :prefix :<leader> + :buffer nil + :silent true + :noremap true + :nowait true}) + +(local vmappings {:n [:<esc><cmd>CommentVisual<cr> :Comment]}) + +(local gopts {:mode :n + :prefix :g + :buffer nil + :silent true + :noremap true + :nowait true}) + +(local gmappings {:a [:<cmd>OrgAgendaPrompt<cr> "Open agenda prompt"] + :c [:<cmd>OrgCapturePrompt<cr> "Open capture prompt"] + :m ["<cmd>Telescope orgmode search_headings theme=dropdown<cr>" + "Search headings"]}) + +(fn setup [] + (let [which-key (require :which-key)] + (which-key.setup opts) + (which-key.register mmappings mopts) + (which-key.register nmappings nopts) + (which-key.register vmappings vopts) + (which-key.register gmappings gopts))) + +{1 :folke/which-key.nvim :event :VeryLazy :config (fn [] (setup))} diff --git a/fnl/config/window-picker.fnl b/fnl/config/window-picker.fnl index c055fb9..d03d9e9 100644 --- a/fnl/config/window-picker.fnl +++ b/fnl/config/window-picker.fnl @@ -1,17 +1,20 @@ ;; Trim whitespaces on save. -(module config.window-picker {autoload {util config.util nvim aniseed.nvim}}) -(def- opts {:other_win_hl_color "#171717" - :fg_color "#E1E1E1" - :selection_chars :MNEIOARSTG}) +(local opts {:other_win_hl_color "#171717" + :fg_color "#E1E1E1" + :selection_chars :MNEIOARSTG}) -(util.setup :window-picker opts) +(fn pick-window [] + (let [window-picker (require :window-picker)] + (let [win (window-picker.pick_window)] + (if (not= win nil) + (nvim.set_current_win win))))) -(defn- pick-window [] - (let [window-picker (require :window-picker)] - (let [win (window-picker.pick_window)] - (if (not= win nil) - (nvim.set_current_win win))))) - -(vim.keymap.set :n :<C-s> (fn [] - (pick-window)) {}) +{1 :s1n7ax/nvim-window-picker + :event :BufReadPost + :config (fn [] + (let [window-picker (require :window-picker)] + (window-picker.setup opts) + (vim.keymap.set :n :<C-s> + (fn [] + (pick-window)) {})))} diff --git a/fnl/config/zen.fnl b/fnl/config/zen.fnl index 1ba643d..1a0c94e 100644 --- a/fnl/config/zen.fnl +++ b/fnl/config/zen.fnl @@ -1,7 +1,6 @@ ;; Zen mode. -(module config.zen {autoload {util config.util}}) -(def- opts {:window {:backdrop 1 +(local opts {:window {:backdrop 1 :height 1 :width 120 :options {:signcolumn :no @@ -11,4 +10,4 @@ :tmux {:enabled true} :twilight {:enabled true}}}) -(util.setup :zen-mode opts) +{1 :folke/zen-mode.nvim :cmd :ZenMode :config opts} diff --git a/fnl/plugins.fnl b/fnl/plugins.fnl index 5d3453f..b315066 100644 --- a/fnl/plugins.fnl +++ b/fnl/plugins.fnl @@ -1,182 +1,47 @@ ;; List of plugins. -[;; Color related plugins - {1 :aktersnurra/no-clown-fiesta.nvim - :lazy false - :priority 1000 - :config (fn [] - (require :config.colorscheme))} - {1 :norcalli/nvim-colorizer.lua - :cmd :ColorizerToggle - :config (fn [] - (require :config.colorizer))} - {1 :nvim-treesitter/nvim-treesitter - :build ":TSUpdate" - :event :BufReadPre - :config (fn [] - (require :config.treesitter))} - ;; Completions - {1 :hrsh7th/nvim-cmp - :dependencies [{1 :hrsh7th/cmp-buffer} - {1 :onsails/lspkind-nvim} - {1 :hrsh7th/cmp-nvim-lsp} - {1 :hrsh7th/cmp-cmdline} - {1 :L3MON4D3/LuaSnip} - {1 :hrsh7th/cmp-path} - {1 :saadparwaiz1/cmp_luasnip} - {1 :f3fora/cmp-spell}] - :event :InsertEnter - :config (fn [] - (require :config.cmp))} - {1 :rafamadriz/friendly-snippets :event :InsertEnter} - ;; Core plugins +[(require :config.alpha) + (require :config.autopairs) + (require :config.better-escape) + (require :config.bqf) + (require :config.cmp) + (require :config.colorscheme) + (require :config.comment) + (require :config.flit) + (require :config.gitsigns) + (require :config.harpoon) + (require :config.leap) + (require :config.lir) + (require :config.lualine) + (require :config.minibar) + (require :config.orgmode) + (require :config.persistence) + (require :config.project) + (require :config.spectre) + (require :config.telescope) + (require :config.toggleterm) + (require :config.treesitter) + (require :config.trim) + (require :config.trouble) + (require :config.vim-slash) + (require :config.which-key) + (require :config.window-picker) + (require :config.zen) + (require :config.lsp.mason) + (require :config.lsp.lspconfig) + (require :config.lsp.null-ls) {1 :Olical/aniseed} - ;; Git plugins + {1 :nvim-telescope/telescope-fzf-native.nvim :build :make} + {1 :ojroques/nvim-bufdel :cmd :BufDel} + {1 :mbbill/undotree :cmd :UndotreeToggle} + {1 :simrat39/symbols-outline.nvim :cmd :SymbolsOutline :config true} + {1 :gbprod/stay-in-place.nvim :event :BufReadPost :config true} + {1 :kylechui/nvim-surround :event :InsertEnter :config true} + {1 :norcalli/nvim-colorizer.lua :cmd :ColorizerToggle :config true} {1 :sindrets/diffview.nvim :cmd [:DiffviewFileHistory :DiffviewOpen] - :config (fn [] - (require :config.diffview))} + :config true} {1 :TimUntersberger/neogit :cmd :Neogit :dependencies [:nvim-lua/plenary.nvim] - :config (fn [] - (require :config.neogit))} - {1 :lewis6991/gitsigns.nvim - :event :BufReadPost - :config (fn [] - (require :config.gitsigns))} - ;; LSP - {1 :williamboman/mason.nvim - :cmd :Mason - :keys [{1 :<leader>m 2 :<cmd>Mason<cr> :desc :Mason}] - :config (fn [] - (require :config.lsp.mason))} - {1 :jose-elias-alvarez/null-ls.nvim - :dependencies [:mason.nvim :jayp0521/mason-null-ls.nvim] - :event :BufReadPre - :config (fn [] - (require :config.lsp.null-ls))} - {1 :neovim/nvim-lspconfig - :event :BufReadPre - :dependencies [:mason.nvim - :williamboman/mason-lspconfig.nvim - :b0o/SchemaStore.nvim - :hrsh7th/cmp-nvim-lsp] - :config (fn [] - (require :config.lsp.diagnostics) - (require :config.lsp.lspconfig))} - {1 :folke/trouble.nvim - :cmd :TroubleToggle - :config (fn [] - (require :config.trouble))} - ;; Misc plugins - {1 :nvim-orgmode/orgmode - :event :BufReadPost - :config (fn [] - (require :config.orgmode))} - {1 :ojroques/nvim-bufdel :cmd :BufDel} - {1 :akinsho/toggleterm.nvim - :cmd :ToggleTerm - :config (fn [] - (require :config.toggleterm))} - ;; Search plugins - {1 :nvim-telescope/telescope-fzf-native.nvim :build :make} - {1 :nvim-telescope/telescope.nvim - :cmd :Telescope - :dependencies [:nvim-lua/popup.nvim - :nvim-telescope/telescope-frecency.nvim - :tami5/sqlite.lua - :ahmedkhalf/project.nvim - :nvim-lua/plenary.nvim - :nvim-telescope/telescope-fzf-native.nvim - :nvim-telescope/telescope-frecency.nvim - :joaomsa/telescope-orgmode.nvim] - :config (fn [] - (require :config.project) - (require :config.telescope))} - {1 :tamago324/lir.nvim - :keys "-" - :config (fn [] - (require :config.lir)) - :dependencies [:kyazdani42/nvim-web-devicons]} - {1 :ggandor/leap.nvim - :event :BufReadPost - :config (fn [] - (require :config.leap))} - {1 :ggandor/flit.nvim - :event :BufReadPost - :config (fn [] - (require :config.flit))} - {1 :windwp/nvim-spectre - :event :BufReadPost - :config (fn [] - (require :config.spectre))} - {1 :junegunn/vim-slash - :event :BufReadPost - :config (fn [] - (require :config.vim-slash))} - {1 :ThePrimeagen/harpoon - :event :BufReadPost - :config (fn [] - (require :config.harpoon))} - ;; Session plugins - {1 :folke/persistence.nvim - :event :VeryLazy - :config (fn [] - (require :config.persistence))} - ;; Text manipulation - {1 :numToStr/Comment.nvim - :event :BufReadPost - :config (fn [] - (require :config.comment))} - {1 :kylechui/nvim-surround - :event :InsertEnter - :config (fn [] - (require :config.surround))} - {1 :gbprod/stay-in-place.nvim - :event :BufReadPost - :config (fn [] - (require :config.stay-in-place))} - {1 :cappyzawa/trim.nvim - :event :BufFilePre - :config (fn [] - (require :config.trim))} - {1 :max397574/better-escape.nvim - :event :BufReadPost - :config (fn [] - (require :config.better-escape))} - {1 :windwp/nvim-autopairs - :event :InsertEnter - :config (fn [] - (require :config.autopairs))} - {1 :mbbill/undotree :cmd :UndotreeToggle} - {1 :nvim-lualine/lualine.nvim - :event :VeryLazy - :config (fn [] - (require :config.lualine)) - :dependencies [:kyazdani42/nvim-web-devicons :arkav/lualine-lsp-progress]} - {1 :aktersnurra/minibar.nvim - :event :BufReadPre - :config (fn [] - (require :config.minibar))} - {1 :folke/zen-mode.nvim - :cmd :ZenMode - :config (fn [] - (require :config.zen))} - {1 :kevinhwang91/nvim-bqf - :event :BufReadPost - :config (fn [] - (require :config.bqf))} - {1 :s1n7ax/nvim-window-picker - :event :BufReadPost - :config (fn [] - (require :config.window-picker))} - {1 :goolord/alpha-nvim - :event :VimEnter - :config (fn [] - (require :config.alpha))} - {1 :simrat39/symbols-outline.nvim :cmd :SymbolsOutline :config true} - {1 :folke/which-key.nvim - :event :VeryLazy - :config (fn [] - (require :config.which-key))}] + :config true}] diff --git a/lazy-lock.json b/lazy-lock.json index e405f5a..b06649a 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -16,7 +16,7 @@ "friendly-snippets": { "branch": "main", "commit": "484fb38b8f493ceeebf4e6fc499ebe41e10aae25" }, "gitsigns.nvim": { "branch": "main", "commit": "d4f8c01280413919349f5df7daccd0c172143d7c" }, "harpoon": { "branch": "master", "commit": "21d0d1bfa3000e4384740bfaefa0ebc51c773786" }, - "lazy.nvim": { "branch": "main", "commit": "8798ccc95031225e3b2241bd8b2d26c2452b06c4" }, + "lazy.nvim": { "branch": "main", "commit": "8a3754717162cd453abd8da87a6020beaba17994" }, "leap.nvim": { "branch": "main", "commit": "a968ab4250840dc879e805f918b4f3b892310a12" }, "lir.nvim": { "branch": "master", "commit": "84af01547e51e15fc97e878330414385eeb825e8" }, "lspkind-nvim": { "branch": "master", "commit": "c68b3a003483cf382428a43035079f78474cd11e" }, @@ -29,7 +29,7 @@ "neogit": { "branch": "master", "commit": "84cf7efba6e4daed11a1185ea09fa553a3ca3d4f" }, "no-clown-fiesta.nvim": { "branch": "master", "commit": "8d4f03c8211a7b5528cd9fa8212d8f1e7baea485" }, "null-ls.nvim": { "branch": "main", "commit": "915558963709ea17c5aa246ca1c9786bfee6ddb4" }, - "nvim-autopairs": { "branch": "master", "commit": "03580d758231956d33c8dd91e2be195106a79fa4" }, + "nvim-autopairs": { "branch": "master", "commit": "f00eb3b766c370cb34fdabc29c760338ba9e4c6c" }, "nvim-bqf": { "branch": "main", "commit": "c059d724434f2e320fd59c398084e33dd2e6706b" }, "nvim-bufdel": { "branch": "main", "commit": "a60b3531e5bd56f8602acb4ba7f5b2eeb782d54b" }, "nvim-cmp": { "branch": "main", "commit": "11a95792a5be0f5a40bab5fc5b670e5b1399a939" }, @@ -37,7 +37,7 @@ "nvim-lspconfig": { "branch": "master", "commit": "41dc4e017395d73af0333705447e858b7db1f75e" }, "nvim-spectre": { "branch": "master", "commit": "68ea562b485b6593e325e7916c3bd6e833d433e7" }, "nvim-surround": { "branch": "main", "commit": "ad56e6234bf42fb7f7e4dccc7752e25abd5ec80e" }, - "nvim-treesitter": { "branch": "master", "commit": "5b8a152c6c9de4004725c20b891658e698430c70" }, + "nvim-treesitter": { "branch": "master", "commit": "3e316204f8ec8450bbaace69d0bf8fe332633fec" }, "nvim-web-devicons": { "branch": "master", "commit": "7f55bc36eddec87597167a97de5b690997edaf7d" }, "nvim-window-picker": { "branch": "main", "commit": "5902827d0e338890a22849e2f18dc80d1cc1a8db" }, "orgmode": { "branch": "master", "commit": "dadf56334d2be7d9e8ad1e22c697a6e75f0164b7" }, @@ -57,6 +57,7 @@ "trouble.nvim": { "branch": "main", "commit": "83ec606e7065adf134d17f4af6bae510e3c491c1" }, "undotree": { "branch": "master", "commit": "1a23ea84bd02c34f50d8e10a8b4bfc89597ffe4e" }, "vim-slash": { "branch": "master", "commit": "31aee09b7ea8893a18fa34f65e63e364fc998444" }, + "vim-startuptime": { "branch": "master", "commit": "cb4c112b9e0f224236ee4eab6bf5153406b3f88b" }, "which-key.nvim": { "branch": "main", "commit": "802219ba26409f325a5575e3b684b6cb054e2cc5" }, "zen-mode.nvim": { "branch": "main", "commit": "4313a5828e4d48c5f2f135f29d46f769a59dcfdc" } }
\ No newline at end of file |