From 2a94573f54c69a9af7536586ab2c03eb88bda5e7 Mon Sep 17 00:00:00 2001 From: Gustaf Rydholm Date: Fri, 5 Jan 2024 01:50:20 +0100 Subject: Refactor --- fnl/plugins/alpha.fnl | 49 +++++++++ fnl/plugins/autopairs.fnl | 20 ++++ fnl/plugins/better-escape.fnl | 8 ++ fnl/plugins/bqf.fnl | 27 +++++ fnl/plugins/bufdel.fnl | 5 + fnl/plugins/cmp.fnl | 66 ++++++++++++ fnl/plugins/colorizer.fnl | 5 + fnl/plugins/colorscheme.fnl | 10 ++ fnl/plugins/comment.fnl | 35 +++++++ fnl/plugins/conform.fnl | 30 ++++++ fnl/plugins/core/hotpot.fnl | 3 - fnl/plugins/core/lazy.fnl | 42 -------- fnl/plugins/dadbod.fnl | 23 +++++ fnl/plugins/dial.fnl | 25 +++++ fnl/plugins/diffview.fnl | 27 +++++ fnl/plugins/dressing.fnl | 3 + fnl/plugins/easyread.fnl | 5 + fnl/plugins/editor/alpha.fnl | 49 --------- fnl/plugins/editor/autopairs.fnl | 20 ---- fnl/plugins/editor/better-escape.fnl | 8 -- fnl/plugins/editor/bqf.fnl | 27 ----- fnl/plugins/editor/bufdel.fnl | 5 - fnl/plugins/editor/cmp.fnl | 66 ------------ fnl/plugins/editor/colorizer.fnl | 5 - fnl/plugins/editor/colorscheme.fnl | 10 -- fnl/plugins/editor/comment.fnl | 35 ------- fnl/plugins/editor/conform.fnl | 30 ------ fnl/plugins/editor/dadbod.fnl | 23 ----- fnl/plugins/editor/dial.fnl | 25 ----- fnl/plugins/editor/diffview.fnl | 27 ----- fnl/plugins/editor/dressing.fnl | 3 - fnl/plugins/editor/easyread.fnl | 5 - fnl/plugins/editor/git-conflicts.fnl | 3 - fnl/plugins/editor/git-worktree.fnl | 12 --- fnl/plugins/editor/gitsigns.fnl | 77 -------------- fnl/plugins/editor/harpoon.fnl | 53 ---------- fnl/plugins/editor/leap.fnl | 37 ------- fnl/plugins/editor/lualine.fnl | 89 ---------------- fnl/plugins/editor/minibar.fnl | 31 ------ fnl/plugins/editor/neogit.fnl | 20 ---- fnl/plugins/editor/nvim-lint.fnl | 30 ------ fnl/plugins/editor/oil.fnl | 25 ----- fnl/plugins/editor/orgmode.fnl | 60 ----------- fnl/plugins/editor/persistence.fnl | 33 ------ fnl/plugins/editor/spectre.fnl | 86 ---------------- fnl/plugins/editor/stay-in-place.fnl | 3 - fnl/plugins/editor/surround.fnl | 3 - fnl/plugins/editor/telescope.fnl | 191 ----------------------------------- fnl/plugins/editor/textobjs.fnl | 5 - fnl/plugins/editor/toggleterm.fnl | 26 ----- fnl/plugins/editor/treesitter.fnl | 84 --------------- fnl/plugins/editor/trouble.fnl | 77 -------------- fnl/plugins/editor/undotree.fnl | 5 - fnl/plugins/editor/which-key.fnl | 47 --------- fnl/plugins/editor/window-picker.fnl | 19 ---- fnl/plugins/editor/zen.fnl | 15 --- fnl/plugins/git-conflicts.fnl | 3 + fnl/plugins/git-worktree.fnl | 12 +++ fnl/plugins/gitsigns.fnl | 77 ++++++++++++++ fnl/plugins/harpoon.fnl | 53 ++++++++++ fnl/plugins/hotpot.fnl | 3 + fnl/plugins/icons.fnl | 45 --------- fnl/plugins/init.fnl | 18 ---- fnl/plugins/leap.fnl | 37 +++++++ fnl/plugins/lsp/diagnostics.fnl | 2 +- fnl/plugins/lsp/init.fnl | 2 - fnl/plugins/lsp/mason.fnl | 2 +- fnl/plugins/lualine.fnl | 89 ++++++++++++++++ fnl/plugins/minibar.fnl | 31 ++++++ fnl/plugins/neogit.fnl | 20 ++++ fnl/plugins/nvim-lint.fnl | 30 ++++++ fnl/plugins/oil.fnl | 25 +++++ fnl/plugins/orgmode.fnl | 60 +++++++++++ fnl/plugins/persistence.fnl | 33 ++++++ fnl/plugins/spectre.fnl | 86 ++++++++++++++++ fnl/plugins/stay-in-place.fnl | 3 + fnl/plugins/surround.fnl | 3 + fnl/plugins/telescope.fnl | 191 +++++++++++++++++++++++++++++++++++ fnl/plugins/textobjs.fnl | 5 + fnl/plugins/toggleterm.fnl | 26 +++++ fnl/plugins/treesitter.fnl | 84 +++++++++++++++ fnl/plugins/trouble.fnl | 83 +++++++++++++++ fnl/plugins/undotree.fnl | 5 + fnl/plugins/which-key.fnl | 47 +++++++++ fnl/plugins/window-picker.fnl | 19 ++++ fnl/plugins/zen.fnl | 15 +++ 86 files changed, 1380 insertions(+), 1481 deletions(-) create mode 100644 fnl/plugins/alpha.fnl create mode 100644 fnl/plugins/autopairs.fnl create mode 100644 fnl/plugins/better-escape.fnl create mode 100644 fnl/plugins/bqf.fnl create mode 100644 fnl/plugins/bufdel.fnl create mode 100644 fnl/plugins/cmp.fnl create mode 100644 fnl/plugins/colorizer.fnl create mode 100644 fnl/plugins/colorscheme.fnl create mode 100644 fnl/plugins/comment.fnl create mode 100644 fnl/plugins/conform.fnl delete mode 100644 fnl/plugins/core/hotpot.fnl delete mode 100644 fnl/plugins/core/lazy.fnl create mode 100644 fnl/plugins/dadbod.fnl create mode 100644 fnl/plugins/dial.fnl create mode 100644 fnl/plugins/diffview.fnl create mode 100644 fnl/plugins/dressing.fnl create mode 100644 fnl/plugins/easyread.fnl delete mode 100644 fnl/plugins/editor/alpha.fnl delete mode 100644 fnl/plugins/editor/autopairs.fnl delete mode 100644 fnl/plugins/editor/better-escape.fnl delete mode 100644 fnl/plugins/editor/bqf.fnl delete mode 100644 fnl/plugins/editor/bufdel.fnl delete mode 100644 fnl/plugins/editor/cmp.fnl delete mode 100644 fnl/plugins/editor/colorizer.fnl delete mode 100644 fnl/plugins/editor/colorscheme.fnl delete mode 100644 fnl/plugins/editor/comment.fnl delete mode 100644 fnl/plugins/editor/conform.fnl delete mode 100644 fnl/plugins/editor/dadbod.fnl delete mode 100644 fnl/plugins/editor/dial.fnl delete mode 100644 fnl/plugins/editor/diffview.fnl delete mode 100644 fnl/plugins/editor/dressing.fnl delete mode 100644 fnl/plugins/editor/easyread.fnl delete mode 100644 fnl/plugins/editor/git-conflicts.fnl delete mode 100644 fnl/plugins/editor/git-worktree.fnl delete mode 100644 fnl/plugins/editor/gitsigns.fnl delete mode 100644 fnl/plugins/editor/harpoon.fnl delete mode 100644 fnl/plugins/editor/leap.fnl delete mode 100644 fnl/plugins/editor/lualine.fnl delete mode 100644 fnl/plugins/editor/minibar.fnl delete mode 100644 fnl/plugins/editor/neogit.fnl delete mode 100644 fnl/plugins/editor/nvim-lint.fnl delete mode 100644 fnl/plugins/editor/oil.fnl delete mode 100644 fnl/plugins/editor/orgmode.fnl delete mode 100644 fnl/plugins/editor/persistence.fnl delete mode 100644 fnl/plugins/editor/spectre.fnl delete mode 100644 fnl/plugins/editor/stay-in-place.fnl delete mode 100644 fnl/plugins/editor/surround.fnl delete mode 100644 fnl/plugins/editor/telescope.fnl delete mode 100644 fnl/plugins/editor/textobjs.fnl delete mode 100644 fnl/plugins/editor/toggleterm.fnl delete mode 100644 fnl/plugins/editor/treesitter.fnl delete mode 100644 fnl/plugins/editor/trouble.fnl delete mode 100644 fnl/plugins/editor/undotree.fnl delete mode 100644 fnl/plugins/editor/which-key.fnl delete mode 100644 fnl/plugins/editor/window-picker.fnl delete mode 100644 fnl/plugins/editor/zen.fnl create mode 100644 fnl/plugins/git-conflicts.fnl create mode 100644 fnl/plugins/git-worktree.fnl create mode 100644 fnl/plugins/gitsigns.fnl create mode 100644 fnl/plugins/harpoon.fnl create mode 100644 fnl/plugins/hotpot.fnl delete mode 100644 fnl/plugins/icons.fnl delete mode 100644 fnl/plugins/init.fnl create mode 100644 fnl/plugins/leap.fnl create mode 100644 fnl/plugins/lualine.fnl create mode 100644 fnl/plugins/minibar.fnl create mode 100644 fnl/plugins/neogit.fnl create mode 100644 fnl/plugins/nvim-lint.fnl create mode 100644 fnl/plugins/oil.fnl create mode 100644 fnl/plugins/orgmode.fnl create mode 100644 fnl/plugins/persistence.fnl create mode 100644 fnl/plugins/spectre.fnl create mode 100644 fnl/plugins/stay-in-place.fnl create mode 100644 fnl/plugins/surround.fnl create mode 100644 fnl/plugins/telescope.fnl create mode 100644 fnl/plugins/textobjs.fnl create mode 100644 fnl/plugins/toggleterm.fnl create mode 100644 fnl/plugins/treesitter.fnl create mode 100644 fnl/plugins/trouble.fnl create mode 100644 fnl/plugins/undotree.fnl create mode 100644 fnl/plugins/which-key.fnl create mode 100644 fnl/plugins/window-picker.fnl create mode 100644 fnl/plugins/zen.fnl (limited to 'fnl/plugins') diff --git a/fnl/plugins/alpha.fnl b/fnl/plugins/alpha.fnl new file mode 100644 index 0000000..89cfc2a --- /dev/null +++ b/fnl/plugins/alpha.fnl @@ -0,0 +1,49 @@ +;; A customizable greeter. + +(local icons (require :icons)) + +(local ascii-art [" ##############..... ############## " + " ##############......############## " + " ##########..........########## " + " ##########........########## " + " ##########.......########## " + " ##########.....##########.. " + " ##########....##########..... " + " ..##########..##########......... " + " ....##########.#########............. " + " ..################JJJ............ " + " ################............. " + " ##############.JJJ.JJJJJJJJJJ " + " ############...JJ...JJ..JJ JJ " + " ##########....JJ...JJ..JJ JJ " + " ########......JJJ..JJJ JJJ JJJ " + " ###### ......... " + " ..... " + " . "]) + +(fn config [] + (let [alpha (require :alpha)] + (let [dashboard (require :alpha.themes.dashboard)] + (set dashboard.section.header.val ascii-art) + (set dashboard.section.buttons.val + [(dashboard.button :f (.. (. icons :search-files) " Find file") + ":Telescope find_files theme=dropdown") + (dashboard.button :g (.. (. icons :search-text) " Find text") + ":Telescope live_grep theme=dropdown") + (dashboard.button :p + (.. (. icons :search-project) " Find project") + ":Telescope projects theme=dropdown") + (dashboard.button :r + (.. (. icons :recent-files) + " Recently used files") + ":Telescope oldfiles theme=dropdown") + (dashboard.button :t (.. (. icons :cog) " Configuration") + ":e ~/.config/nvim/init.lua ") + (dashboard.button :o (.. (. icons :org) " Org") + ":Telescope find_files theme=dropdown cwd=~/.local/share/org")]) + (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} diff --git a/fnl/plugins/autopairs.fnl b/fnl/plugins/autopairs.fnl new file mode 100644 index 0000000..36e8ba5 --- /dev/null +++ b/fnl/plugins/autopairs.fnl @@ -0,0 +1,20 @@ +;; Autopairs for brackets and quote symbols. + +(local opts {:check_ts true + :ts_config {:lua [:string :source] + :javascript [:string :template_string] + :java false} + :disable_filetype [:TelescopePrompt :spectre_panel] + :fast_warp {:map : + :chars ["{" "[" "(" "\"" "'"] + :pattern (string.gsub "[%'%\"%)%>%]%)%}%,]" "%s+" "") + :check_comma true + :highlight :PmenuSel + :highlight_grey :LineNr + :offset 0 + :end_key "$" + :keys :qwertyuiopzxcvbnmasdfghjkl + :highlight :PmenuSel + :highlight_grey :LineNr}}) + +{1 :windwp/nvim-autopairs :event :InsertEnter : opts} diff --git a/fnl/plugins/better-escape.fnl b/fnl/plugins/better-escape.fnl new file mode 100644 index 0000000..5bd9b0c --- /dev/null +++ b/fnl/plugins/better-escape.fnl @@ -0,0 +1,8 @@ +;; Better escape without nasty delay. + +(local opts {:mapping [:kk :jj] + :timeout vim.o.timeoutlen + :clear_empty_lines false + :keys :}) + +{1 :max397574/better-escape.nvim :event :BufReadPost : opts} diff --git a/fnl/plugins/bqf.fnl b/fnl/plugins/bqf.fnl new file mode 100644 index 0000000..387ae19 --- /dev/null +++ b/fnl/plugins/bqf.fnl @@ -0,0 +1,27 @@ +;; Make Neovim's quickfix window better. + +(local opts {:auto_enable true + :magic_window true + :auto_resize_height false + :preview {:auto_preview false + :show_title true + :delay_syntax 50 + :wrap false} + :func_map {:tab :t + :openc :o + :drop :O + :split :s + :vsplit :v + :stoggleup :M + :stoggledown :m + :stogglevm :m + :filterr :f + :filter :F + :prevhist "<" + :nexthist ">" + :sclear :c + :ptoggleitem :p + :ptoggleauto :a + :ptogglemode :P}}) + +{1 :kevinhwang91/nvim-bqf :event :BufReadPost : opts} diff --git a/fnl/plugins/bufdel.fnl b/fnl/plugins/bufdel.fnl new file mode 100644 index 0000000..e14287e --- /dev/null +++ b/fnl/plugins/bufdel.fnl @@ -0,0 +1,5 @@ +;; Delete buffers. + +(local keys [{1 : 2 :BufDel :desc "Close Buffer"}]) + +{1 :ojroques/nvim-bufdel :cmd :BufDel : keys} diff --git a/fnl/plugins/cmp.fnl b/fnl/plugins/cmp.fnl new file mode 100644 index 0000000..ca09329 --- /dev/null +++ b/fnl/plugins/cmp.fnl @@ -0,0 +1,66 @@ +;; Configuration for completion plugin. + +(local dependencies [:hrsh7th/cmp-buffer + :onsails/lspkind-nvim + :hrsh7th/cmp-nvim-lsp + :hrsh7th/cmp-cmdline + :petertriho/cmp-git + :L3MON4D3/LuaSnip + :rafamadriz/friendly-snippets + :hrsh7th/cmp-path + :saadparwaiz1/cmp_luasnip + :f3fora/cmp-spell]) + +(fn config [] + (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 {: (cmp.mapping.select_prev_item) + : (cmp.mapping.select_next_item) + : (cmp.mapping (cmp.mapping.scroll_docs -1) + [:i + :c]) + : (cmp.mapping (cmp.mapping.scroll_docs 1) + [:i + :c]) + : (cmp.mapping (cmp.mapping.complete) + [:i + :c]) + : (cmp.mapping {:i (cmp.mapping.abort) + :c (cmp.mapping.close)}) + : (cmp.mapping.confirm {:select true})}) + :sources [{:name :nvim_lsp} + {:name :nvim_lua} + {:name :luasnip} + {:name :spell} + {:name :orgmode} + {:name :neorg} + {:name :buffer :keyword_length 4} + {:name :path :keyword_length 6} + {:name :vim-dadbod-completion} + {:name :git}] + :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 :event :InsertEnter : config} diff --git a/fnl/plugins/colorizer.fnl b/fnl/plugins/colorizer.fnl new file mode 100644 index 0000000..a61b3e5 --- /dev/null +++ b/fnl/plugins/colorizer.fnl @@ -0,0 +1,5 @@ +;; Display colors of hex numbers. + +(local keys [{1 :h 2 :ColorizerToggle :desc :Colorizer}]) + +{1 :norcalli/nvim-colorizer.lua :cmd :ColorizerToggle :config true : keys} diff --git a/fnl/plugins/colorscheme.fnl b/fnl/plugins/colorscheme.fnl new file mode 100644 index 0000000..85c83fd --- /dev/null +++ b/fnl/plugins/colorscheme.fnl @@ -0,0 +1,10 @@ +;; Load neovim colorscheme. + +(local opts {:styles {:type {:bold true} :lsp {:underline false}}}) + +(fn config [] + (let [plugin (require :no-clown-fiesta)] + (plugin.setup opts) + (plugin.load))) + +{1 :aktersnurra/no-clown-fiesta.nvim : config} diff --git a/fnl/plugins/comment.fnl b/fnl/plugins/comment.fnl new file mode 100644 index 0000000..66abb33 --- /dev/null +++ b/fnl/plugins/comment.fnl @@ -0,0 +1,35 @@ +;; Language aware commenting. + +(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}}) + +(local user-cmds [[:CommentNormal + (lambda [] + (let [comment-api (require :Comment.api)] + (comment-api.toggle.linewise.current))) + {:nargs 0}] + [:CommentVisual + (lambda [] + (let [comment-api (require :Comment.api)] + (comment-api.toggle.linewise (vim.fn.visualmode)))) + {:nargs 0}]]) + +(fn init [] + (let [cmds (require :util.cmds)] + (cmds.create-user-cmds user-cmds))) + +{1 :numToStr/Comment.nvim :event :BufReadPost : inti : opts} diff --git a/fnl/plugins/conform.fnl b/fnl/plugins/conform.fnl new file mode 100644 index 0000000..511f695 --- /dev/null +++ b/fnl/plugins/conform.fnl @@ -0,0 +1,30 @@ +;; Formatting + +(fn init [] + (vim.keymap.set [:n :v] :e + (lambda [] + (let [conform (require :conform)] + (conform.format {:lsp_fallback true :async true}))) + {:desc :Format})) + +(local opts {:formatters {:fnlfmt {:command :fnlfmt + :args [:--fix :$FILENAME] + :stdin false}} + :formatters_by_ft {:* [:codespell] + :_ [:trim_whitespace :trim_newlines] + :css [:stylelint] + :fennel [:fnlfmt] + :haskell [:fourmolu] + :html [:prettierd] + :json [:jq] + :lua [:stylua] + :markdown [:prettierd] + :ocaml [:ocamlformat] + :python [:ruff_format] + :rust [:rustfmt] + :sh [:shfmt :shellharden] + :sql [:pg_format :sqlfluff] + :toml [:taplo] + :yaml [:yamlfmt]}}) + +{1 :stevearc/conform.nvim : init : opts :event [:BufReadPost :BufNewFile]} diff --git a/fnl/plugins/core/hotpot.fnl b/fnl/plugins/core/hotpot.fnl deleted file mode 100644 index eba8083..0000000 --- a/fnl/plugins/core/hotpot.fnl +++ /dev/null @@ -1,3 +0,0 @@ -;; Transpiler for fnl. - -{1 :rktjmp/hotpot.nvim} diff --git a/fnl/plugins/core/lazy.fnl b/fnl/plugins/core/lazy.fnl deleted file mode 100644 index 30903f5..0000000 --- a/fnl/plugins/core/lazy.fnl +++ /dev/null @@ -1,42 +0,0 @@ -;; Lazy opts. - -(local icons (require :plugins.icons)) - -(local opts {:install {:colorscheme [:no-clown-fiesta]} - :debug false - :defaults {:lazy false} - :performance {:cache {:enabled true} - :rtp {:disabled_plugins [:gzip - :matchit - :netrwPlugin - :tarPlugin - :tohtml - :tutor - :zipPlugin]}} - :ui {:border :single - :icons {:cmd (.. (. icons :cmd) " ") - :config (.. (. icons :cog) " ") - :event (.. (. icons :lightning) " ") - :ft (.. (. icons :document) " ") - :init (.. (. icons :cog) " ") - :import (.. (. icons :import) " ") - :keys (.. (. icons :keyboard) " ") - :lazy (.. (. icons :sleep) " ") - :loaded (.. (. icons :filled-orb) " ") - :not_loaded (.. (. icons :orb) " ") - :plugin (.. (. icons :package) " ") - :runtime (.. (. icons :vim) " ") - :source (.. (. icons :code) " ") - :start (.. (. icons :play) " ") - :task (.. (. icons :checkmark) " ") - :list [(.. (. icons :filled-orb) " ") - (.. (. icons :right-arrow) " ") - (.. (. icons :star) " ") - (.. (. icons :line) " ")]}}}) - -(fn setup [plugins] - (let [lazy (require :lazy)] - (vim.keymap.set :n :y "Lazy home" {:desc :Home}) - (lazy.setup plugins opts))) - -{: setup} diff --git a/fnl/plugins/dadbod.fnl b/fnl/plugins/dadbod.fnl new file mode 100644 index 0000000..c5ca5ec --- /dev/null +++ b/fnl/plugins/dadbod.fnl @@ -0,0 +1,23 @@ +;; Plugins for interacting with databases. + +(local dependencies [{1 :tpope/vim-dadbod :lazy true} + {1 :tpope/vim-dotenv :lazy true} + {1 :kristijanhusak/vim-dadbod-completion + :ft [:sql :plsql] + :lazy true}]) + +(local keys [{1 :dn + 2 :DBUIToggle + :mode :n + :desc "Toggle Dadbod UI"} + {1 :de + 2 :DBUIAddConnection + :mode :n + :desc "Add DB connection"}]) + +(fn init [] + (set vim.g.db_ui_use_nerd_fonts 1) + (set vim.g.db_ui_winwidth 40) + (set vim.g.db_ui_notification_width 39)) + +{1 :kristijanhusak/vim-dadbod-ui : dependencies : keys : init} diff --git a/fnl/plugins/dial.fnl b/fnl/plugins/dial.fnl new file mode 100644 index 0000000..7a888eb --- /dev/null +++ b/fnl/plugins/dial.fnl @@ -0,0 +1,25 @@ +;; Better incrementation/decrementation. + +(local keys [{1 : + 2 (fn [] + (let [dial (require :dial.map)] + (dial.inc_normal))) + :expr true + :desc :Increment} + {1 : + 2 (fn [] + (let [dial (require :dial.map)] + (dial.dec_normal))) + :expr true + :desc :Decrement}]) + +(fn config [] + (let [cfg (require :dial.config) + augend (require :dial.augend)] + (cfg.augends:register_group {:default [augend.integer.alias.decimal + augend.integer.alias.hex + (. augend.date.alias "%Y-%m-%d") + augend.constant.alias.bool + augend.semver.alias.semver]}))) + +{1 :monaqa/dial.nvim : keys : config} diff --git a/fnl/plugins/diffview.fnl b/fnl/plugins/diffview.fnl new file mode 100644 index 0000000..f041ab6 --- /dev/null +++ b/fnl/plugins/diffview.fnl @@ -0,0 +1,27 @@ +;; Inspect commits. + +(local keys + [{1 :is + 2 :DiffviewFileHistory + :desc "Repository history" + :nowait true} + {1 :it + 2 "DiffviewFileHistory --follow %" + :desc "File history"} + {1 :ir 2 :DiffviewOpen :desc :Diffview} + {1 :ia + 2 "DiffviewOpen master" + :desc "Diffview with master"} + {1 :if + 2 ".DiffviewFileHistory --follow" + :desc "Line history"} + {1 :ip + 2 "'<,'>DiffviewFileHistory --follow" + :desc "Range history" + :mode :v} + {1 :ic 2 :DiffviewClose :desc "Close diffview"}]) + +{1 :sindrets/diffview.nvim + :cmd [:DiffviewFileHistory :DiffviewOpen] + :config true + : keys} diff --git a/fnl/plugins/dressing.fnl b/fnl/plugins/dressing.fnl new file mode 100644 index 0000000..60da1b0 --- /dev/null +++ b/fnl/plugins/dressing.fnl @@ -0,0 +1,3 @@ +;; UI for inputs + +{1 :stevearc/dressing.nvim :event :BufReadPost} diff --git a/fnl/plugins/easyread.fnl b/fnl/plugins/easyread.fnl new file mode 100644 index 0000000..2652203 --- /dev/null +++ b/fnl/plugins/easyread.fnl @@ -0,0 +1,5 @@ +;; Bionic like reading. + +(local keys [{1 "," 2 :EasyreadToggle :desc :Easyread}]) + +{1 :JellyApple102/easyread.nvim : keys :config true} diff --git a/fnl/plugins/editor/alpha.fnl b/fnl/plugins/editor/alpha.fnl deleted file mode 100644 index c933a99..0000000 --- a/fnl/plugins/editor/alpha.fnl +++ /dev/null @@ -1,49 +0,0 @@ -;; A customizable greeter. - -(local icons (require :plugins.icons)) - -(local ascii-art [" ##############..... ############## " - " ##############......############## " - " ##########..........########## " - " ##########........########## " - " ##########.......########## " - " ##########.....##########.. " - " ##########....##########..... " - " ..##########..##########......... " - " ....##########.#########............. " - " ..################JJJ............ " - " ################............. " - " ##############.JJJ.JJJJJJJJJJ " - " ############...JJ...JJ..JJ JJ " - " ##########....JJ...JJ..JJ JJ " - " ########......JJJ..JJJ JJJ JJJ " - " ###### ......... " - " ..... " - " . "]) - -(fn config [] - (let [alpha (require :alpha)] - (let [dashboard (require :alpha.themes.dashboard)] - (set dashboard.section.header.val ascii-art) - (set dashboard.section.buttons.val - [(dashboard.button :f (.. (. icons :search-files) " Find file") - ":Telescope find_files theme=dropdown") - (dashboard.button :g (.. (. icons :search-text) " Find text") - ":Telescope live_grep theme=dropdown") - (dashboard.button :p - (.. (. icons :search-project) " Find project") - ":Telescope projects theme=dropdown") - (dashboard.button :r - (.. (. icons :recent-files) - " Recently used files") - ":Telescope oldfiles theme=dropdown") - (dashboard.button :t (.. (. icons :cog) " Configuration") - ":e ~/.config/nvim/init.lua ") - (dashboard.button :o (.. (. icons :org) " Org") - ":Telescope find_files theme=dropdown cwd=~/.local/share/org")]) - (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} diff --git a/fnl/plugins/editor/autopairs.fnl b/fnl/plugins/editor/autopairs.fnl deleted file mode 100644 index 36e8ba5..0000000 --- a/fnl/plugins/editor/autopairs.fnl +++ /dev/null @@ -1,20 +0,0 @@ -;; Autopairs for brackets and quote symbols. - -(local opts {:check_ts true - :ts_config {:lua [:string :source] - :javascript [:string :template_string] - :java false} - :disable_filetype [:TelescopePrompt :spectre_panel] - :fast_warp {:map : - :chars ["{" "[" "(" "\"" "'"] - :pattern (string.gsub "[%'%\"%)%>%]%)%}%,]" "%s+" "") - :check_comma true - :highlight :PmenuSel - :highlight_grey :LineNr - :offset 0 - :end_key "$" - :keys :qwertyuiopzxcvbnmasdfghjkl - :highlight :PmenuSel - :highlight_grey :LineNr}}) - -{1 :windwp/nvim-autopairs :event :InsertEnter : opts} diff --git a/fnl/plugins/editor/better-escape.fnl b/fnl/plugins/editor/better-escape.fnl deleted file mode 100644 index 5bd9b0c..0000000 --- a/fnl/plugins/editor/better-escape.fnl +++ /dev/null @@ -1,8 +0,0 @@ -;; Better escape without nasty delay. - -(local opts {:mapping [:kk :jj] - :timeout vim.o.timeoutlen - :clear_empty_lines false - :keys :}) - -{1 :max397574/better-escape.nvim :event :BufReadPost : opts} diff --git a/fnl/plugins/editor/bqf.fnl b/fnl/plugins/editor/bqf.fnl deleted file mode 100644 index 387ae19..0000000 --- a/fnl/plugins/editor/bqf.fnl +++ /dev/null @@ -1,27 +0,0 @@ -;; Make Neovim's quickfix window better. - -(local opts {:auto_enable true - :magic_window true - :auto_resize_height false - :preview {:auto_preview false - :show_title true - :delay_syntax 50 - :wrap false} - :func_map {:tab :t - :openc :o - :drop :O - :split :s - :vsplit :v - :stoggleup :M - :stoggledown :m - :stogglevm :m - :filterr :f - :filter :F - :prevhist "<" - :nexthist ">" - :sclear :c - :ptoggleitem :p - :ptoggleauto :a - :ptogglemode :P}}) - -{1 :kevinhwang91/nvim-bqf :event :BufReadPost : opts} diff --git a/fnl/plugins/editor/bufdel.fnl b/fnl/plugins/editor/bufdel.fnl deleted file mode 100644 index e14287e..0000000 --- a/fnl/plugins/editor/bufdel.fnl +++ /dev/null @@ -1,5 +0,0 @@ -;; Delete buffers. - -(local keys [{1 : 2 :BufDel :desc "Close Buffer"}]) - -{1 :ojroques/nvim-bufdel :cmd :BufDel : keys} diff --git a/fnl/plugins/editor/cmp.fnl b/fnl/plugins/editor/cmp.fnl deleted file mode 100644 index ca09329..0000000 --- a/fnl/plugins/editor/cmp.fnl +++ /dev/null @@ -1,66 +0,0 @@ -;; Configuration for completion plugin. - -(local dependencies [:hrsh7th/cmp-buffer - :onsails/lspkind-nvim - :hrsh7th/cmp-nvim-lsp - :hrsh7th/cmp-cmdline - :petertriho/cmp-git - :L3MON4D3/LuaSnip - :rafamadriz/friendly-snippets - :hrsh7th/cmp-path - :saadparwaiz1/cmp_luasnip - :f3fora/cmp-spell]) - -(fn config [] - (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 {: (cmp.mapping.select_prev_item) - : (cmp.mapping.select_next_item) - : (cmp.mapping (cmp.mapping.scroll_docs -1) - [:i - :c]) - : (cmp.mapping (cmp.mapping.scroll_docs 1) - [:i - :c]) - : (cmp.mapping (cmp.mapping.complete) - [:i - :c]) - : (cmp.mapping {:i (cmp.mapping.abort) - :c (cmp.mapping.close)}) - : (cmp.mapping.confirm {:select true})}) - :sources [{:name :nvim_lsp} - {:name :nvim_lua} - {:name :luasnip} - {:name :spell} - {:name :orgmode} - {:name :neorg} - {:name :buffer :keyword_length 4} - {:name :path :keyword_length 6} - {:name :vim-dadbod-completion} - {:name :git}] - :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 :event :InsertEnter : config} diff --git a/fnl/plugins/editor/colorizer.fnl b/fnl/plugins/editor/colorizer.fnl deleted file mode 100644 index a61b3e5..0000000 --- a/fnl/plugins/editor/colorizer.fnl +++ /dev/null @@ -1,5 +0,0 @@ -;; Display colors of hex numbers. - -(local keys [{1 :h 2 :ColorizerToggle :desc :Colorizer}]) - -{1 :norcalli/nvim-colorizer.lua :cmd :ColorizerToggle :config true : keys} diff --git a/fnl/plugins/editor/colorscheme.fnl b/fnl/plugins/editor/colorscheme.fnl deleted file mode 100644 index 85c83fd..0000000 --- a/fnl/plugins/editor/colorscheme.fnl +++ /dev/null @@ -1,10 +0,0 @@ -;; Load neovim colorscheme. - -(local opts {:styles {:type {:bold true} :lsp {:underline false}}}) - -(fn config [] - (let [plugin (require :no-clown-fiesta)] - (plugin.setup opts) - (plugin.load))) - -{1 :aktersnurra/no-clown-fiesta.nvim : config} diff --git a/fnl/plugins/editor/comment.fnl b/fnl/plugins/editor/comment.fnl deleted file mode 100644 index 66abb33..0000000 --- a/fnl/plugins/editor/comment.fnl +++ /dev/null @@ -1,35 +0,0 @@ -;; Language aware commenting. - -(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}}) - -(local user-cmds [[:CommentNormal - (lambda [] - (let [comment-api (require :Comment.api)] - (comment-api.toggle.linewise.current))) - {:nargs 0}] - [:CommentVisual - (lambda [] - (let [comment-api (require :Comment.api)] - (comment-api.toggle.linewise (vim.fn.visualmode)))) - {:nargs 0}]]) - -(fn init [] - (let [cmds (require :util.cmds)] - (cmds.create-user-cmds user-cmds))) - -{1 :numToStr/Comment.nvim :event :BufReadPost : inti : opts} diff --git a/fnl/plugins/editor/conform.fnl b/fnl/plugins/editor/conform.fnl deleted file mode 100644 index 511f695..0000000 --- a/fnl/plugins/editor/conform.fnl +++ /dev/null @@ -1,30 +0,0 @@ -;; Formatting - -(fn init [] - (vim.keymap.set [:n :v] :e - (lambda [] - (let [conform (require :conform)] - (conform.format {:lsp_fallback true :async true}))) - {:desc :Format})) - -(local opts {:formatters {:fnlfmt {:command :fnlfmt - :args [:--fix :$FILENAME] - :stdin false}} - :formatters_by_ft {:* [:codespell] - :_ [:trim_whitespace :trim_newlines] - :css [:stylelint] - :fennel [:fnlfmt] - :haskell [:fourmolu] - :html [:prettierd] - :json [:jq] - :lua [:stylua] - :markdown [:prettierd] - :ocaml [:ocamlformat] - :python [:ruff_format] - :rust [:rustfmt] - :sh [:shfmt :shellharden] - :sql [:pg_format :sqlfluff] - :toml [:taplo] - :yaml [:yamlfmt]}}) - -{1 :stevearc/conform.nvim : init : opts :event [:BufReadPost :BufNewFile]} diff --git a/fnl/plugins/editor/dadbod.fnl b/fnl/plugins/editor/dadbod.fnl deleted file mode 100644 index c5ca5ec..0000000 --- a/fnl/plugins/editor/dadbod.fnl +++ /dev/null @@ -1,23 +0,0 @@ -;; Plugins for interacting with databases. - -(local dependencies [{1 :tpope/vim-dadbod :lazy true} - {1 :tpope/vim-dotenv :lazy true} - {1 :kristijanhusak/vim-dadbod-completion - :ft [:sql :plsql] - :lazy true}]) - -(local keys [{1 :dn - 2 :DBUIToggle - :mode :n - :desc "Toggle Dadbod UI"} - {1 :de - 2 :DBUIAddConnection - :mode :n - :desc "Add DB connection"}]) - -(fn init [] - (set vim.g.db_ui_use_nerd_fonts 1) - (set vim.g.db_ui_winwidth 40) - (set vim.g.db_ui_notification_width 39)) - -{1 :kristijanhusak/vim-dadbod-ui : dependencies : keys : init} diff --git a/fnl/plugins/editor/dial.fnl b/fnl/plugins/editor/dial.fnl deleted file mode 100644 index 7a888eb..0000000 --- a/fnl/plugins/editor/dial.fnl +++ /dev/null @@ -1,25 +0,0 @@ -;; Better incrementation/decrementation. - -(local keys [{1 : - 2 (fn [] - (let [dial (require :dial.map)] - (dial.inc_normal))) - :expr true - :desc :Increment} - {1 : - 2 (fn [] - (let [dial (require :dial.map)] - (dial.dec_normal))) - :expr true - :desc :Decrement}]) - -(fn config [] - (let [cfg (require :dial.config) - augend (require :dial.augend)] - (cfg.augends:register_group {:default [augend.integer.alias.decimal - augend.integer.alias.hex - (. augend.date.alias "%Y-%m-%d") - augend.constant.alias.bool - augend.semver.alias.semver]}))) - -{1 :monaqa/dial.nvim : keys : config} diff --git a/fnl/plugins/editor/diffview.fnl b/fnl/plugins/editor/diffview.fnl deleted file mode 100644 index f041ab6..0000000 --- a/fnl/plugins/editor/diffview.fnl +++ /dev/null @@ -1,27 +0,0 @@ -;; Inspect commits. - -(local keys - [{1 :is - 2 :DiffviewFileHistory - :desc "Repository history" - :nowait true} - {1 :it - 2 "DiffviewFileHistory --follow %" - :desc "File history"} - {1 :ir 2 :DiffviewOpen :desc :Diffview} - {1 :ia - 2 "DiffviewOpen master" - :desc "Diffview with master"} - {1 :if - 2 ".DiffviewFileHistory --follow" - :desc "Line history"} - {1 :ip - 2 "'<,'>DiffviewFileHistory --follow" - :desc "Range history" - :mode :v} - {1 :ic 2 :DiffviewClose :desc "Close diffview"}]) - -{1 :sindrets/diffview.nvim - :cmd [:DiffviewFileHistory :DiffviewOpen] - :config true - : keys} diff --git a/fnl/plugins/editor/dressing.fnl b/fnl/plugins/editor/dressing.fnl deleted file mode 100644 index 60da1b0..0000000 --- a/fnl/plugins/editor/dressing.fnl +++ /dev/null @@ -1,3 +0,0 @@ -;; UI for inputs - -{1 :stevearc/dressing.nvim :event :BufReadPost} diff --git a/fnl/plugins/editor/easyread.fnl b/fnl/plugins/editor/easyread.fnl deleted file mode 100644 index 2652203..0000000 --- a/fnl/plugins/editor/easyread.fnl +++ /dev/null @@ -1,5 +0,0 @@ -;; Bionic like reading. - -(local keys [{1 "," 2 :EasyreadToggle :desc :Easyread}]) - -{1 :JellyApple102/easyread.nvim : keys :config true} diff --git a/fnl/plugins/editor/git-conflicts.fnl b/fnl/plugins/editor/git-conflicts.fnl deleted file mode 100644 index 4a4583b..0000000 --- a/fnl/plugins/editor/git-conflicts.fnl +++ /dev/null @@ -1,3 +0,0 @@ -;; Resolve git conflicts. - -{1 :akinsho/git-conflict.nvim :event :BufReadPre :tag "v1.0.0" :config true} diff --git a/fnl/plugins/editor/git-worktree.fnl b/fnl/plugins/editor/git-worktree.fnl deleted file mode 100644 index 8812859..0000000 --- a/fnl/plugins/editor/git-worktree.fnl +++ /dev/null @@ -1,12 +0,0 @@ -;; Plugins for working with git-worktrees. - -(local keys [{1 :wn - 2 "lua require('telescope').extensions.git_worktree.git_worktrees()" - :mode :n - :desc "Switch between worktrees"} - {1 :we - 2 "lua require('telescope').extensions.git_worktree.create_git_worktree()" - :mode :n - :desc "Create a worktree"}]) - -{1 :ThePrimeagen/git-worktree.nvim : keys} diff --git a/fnl/plugins/editor/gitsigns.fnl b/fnl/plugins/editor/gitsigns.fnl deleted file mode 100644 index 8150f98..0000000 --- a/fnl/plugins/editor/gitsigns.fnl +++ /dev/null @@ -1,77 +0,0 @@ -;; Add git signs to source files. - -(local keys [{1 :gR - 2 "lua require 'gitsigns'.reset_buffer()" - :mode :n - :desc "Reset Buffer"} - {1 :gd - 2 "Gitsigns diffthis HEAD" - :mode :n - :desc :Diff} - {1 :gj - 2 "lua require 'gitsigns'.next_hunk()" - :mode :n - :desc "Next Hunk"} - {1 :gk - 2 "lua require 'gitsigns'.prev_hunk()" - :mode :n - :desc "Prev Hunk"} - {1 :gl - 2 "lua require 'gitsigns'.blame_line()" - :mode :n - :desc :Blame} - {1 :gp - 2 "lua require 'gitsigns'.preview_hunk()" - :mode :n - :desc "Preview Hunk"} - {1 :gr - 2 "lua require 'gitsigns'.reset_hunk()" - :mode :n - :desc "Reset Hunk"} - {1 :gs - 2 "lua require 'gitsigns'.stage_hunk()" - :mode :n - :desc "Stage Hunk"} - {1 :gu - 2 "lua require 'gitsigns'.undo_stage_hunk()" - :mode :n - :desc "Undo Stage Hunk"} - {1 :gn - 2 ":Gitsigns select_hunk" - :mode [:o :x] - :desc "GitSigns Select Hunk"}]) - -(local icons (require :plugins.icons)) - -(local signs {:add {:text (. icons :git-add)} - :change {:text (. icons :git-add)} - :delete {:text (. icons :git-delete)} - :topdelete {:text (. icons :git-top-delete)} - :changedelete {:text (. icons :git-change-delete)} - :untracked {:text (. icons :git-untracked)}}) - -(local opts {: signs - :signcolumn true - :numhl false - :linehl false - :word_diff false - :watch_gitdir {: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 ", - " - :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}}) - -{1 :lewis6991/gitsigns.nvim :event [:BufReadPre :BufNewFile] : opts : keys} diff --git a/fnl/plugins/editor/harpoon.fnl b/fnl/plugins/editor/harpoon.fnl deleted file mode 100644 index 0791f98..0000000 --- a/fnl/plugins/editor/harpoon.fnl +++ /dev/null @@ -1,53 +0,0 @@ -;; Harpoon files for navigation. - -(local user-cmds [[:HarpoonAdd - (lambda [] - (let [harpoon (require :harpoon.mark)] - (harpoon.add_file))) - {:nargs 0}] - [:HarpoonNext - (lambda [] - (let [harpoon (require :harpoon.ui)] - (harpoon.nav_next))) - {:nargs 0}] - [:HarpoonPrev - (lambda [] - (let [harpoon (require :harpoon.ui)] - (harpoon.nav_prev))) - {:nargs 0}] - [:HarpoonUI - (lambda [] - (let [harpoon (require :harpoon.ui)] - (harpoon.toggle_quick_menu))) - {:nargs 0}]]) - -(fn telescope-ext [ext fun opts] - (let [telescope (require :telescope) - themes (require :telescope.themes) - theme (. opts :theme)] - ((. (. (. telescope :extensions) ext) fun) ((. themes theme) opts)))) - -(fn init [] - (let [cmds (require :util.cmds)] - (cmds.create-user-cmds user-cmds))) - -(fn config [] - (vim.keymap.set :n : - (fn [] - (telescope-ext :harpoon :marks - {:theme :get_dropdown - :previewer false - :initial_mode :normal - :prompt_title :Harpoon})) - {}) - (vim.keymap.set :n : - "Telescope buffers theme=dropdown previewer=false initial_mode=normal" - {}) - {:menu {:width (- (vim.api.nvim_win_get_width 0) 4)}}) - -(local keys [{1 :ma 2 :HarpoonAdd :desc :Harpoon} - {1 :mr 2 :HarpoonUI :desc "Harpoon UI"} - {1 :ms 2 :HarpoonPrev :desc "Harpoon Prev"} - {1 :mt 2 :HarpoonNext :desc "Harpoon Next"}]) - -{1 :ThePrimeagen/harpoon :event :BufReadPost : init : keys : config} diff --git a/fnl/plugins/editor/leap.fnl b/fnl/plugins/editor/leap.fnl deleted file mode 100644 index c5b700d..0000000 --- a/fnl/plugins/editor/leap.fnl +++ /dev/null @@ -1,37 +0,0 @@ -;; Leap through text. - -(local dependencies [{1 :ggandor/flit.nvim - :event :BufReadPost - :opts {:keys {:f :f :F :F :t :t :T :T} - :labeled_modes :v - :multiline true - :opts {}}} - {1 :ggandor/leap-spooky.nvim - :event :BufReadPost - :opts {;; Additional text objects, to be merged with the default ones. - ;; E.g.: {'iq', 'aq'} - :extra_text_objects nil - ;; Mappings will be generated corresponding to all native text objects, - ;; like: (ir|ar|iR|aR|im|am|iM|aM){obj}. - ;; Special line objects will also be added, by repeating the affixes. - ;; E.g. `yrr` and `ymm` will yank a line in the current - ;; window. - :affixes {;; The cursor moves to the targeted object, and stays there. - :magnetic {:window :m :cross_window :M} - ;; The operation is executed seemingly remotely (the cursor boomerangs - ;; back afterwards). - :remote {:window :r :cross_window :R}} - ;; Defines text objects like `riw`, `raw`, etc., instead of - ;; targets.vim-style `irw`, `arw`. (Note: prefix is forced if a custom - ;; text object does not start with "a" or "i".) - :prefix false - ;; The yanked text will automatically be pasted at the cursor position - ;; if the unnamed register is in use. - :paste_on_remote_yank false}}]) - -(fn config [] - (let [leap (require :leap)] - (leap.setup {}) - (leap.set_default_keymaps))) - -{1 :ggandor/leap.nvim : dependencies :event :BufReadPost : config} diff --git a/fnl/plugins/editor/lualine.fnl b/fnl/plugins/editor/lualine.fnl deleted file mode 100644 index a34e73e..0000000 --- a/fnl/plugins/editor/lualine.fnl +++ /dev/null @@ -1,89 +0,0 @@ -;; Statusbar. - -(local icons (require :plugins.icons)) - -(local disable [:neogitstatus - :netrw - :lir - :lazy - :alpha - :neo-tree - :Outline - :NeogitStatus - :NeogitCommitMessage]) - -(local ignore [:help :packer :spectre_panel :TelescopePrompt]) - -(fn active-clients [] - (let [clients (vim.lsp.buf_get_clients) - client_names []] - (each [_ client (pairs clients)] - (table.insert client_names client.name)) - (if (> (length client_names) 0) - (table.concat client_names ", ") - ""))) - -(fn hide-in-width [] - (> (vim.fn.winwidth 0) 80)) - -(local diagnostics {1 :diagnostics - :sources [:nvim_diagnostic] - :sections [:error :warn] - :symbols {:error (.. (. icons :error) " ") - :warn (.. (. icons :warn) " ")} - :colored false - :disabled_buftypes [:nvim-tree] - :padding 0 - :update_in_insert false - :always_visible true}) - -(local diff {1 :diff - :colored false - :disabled_buftypes [:nvim-tree] - :cond hide-in-width}) - -(local branch {1 "b:gitsigns_head" - :icon (. icons :git) - :disabled_buftypes [:nvim-tree] - :cond hide-in-width}) - -(local filetype {1 :filetype - :icon_only true - :disabled_buftypes [:nvim-tree] - :colored false - :cond hide-in-width}) - -(local language-server {1 active-clients - :disabled_buftypes [:nvim-tree] - :cond hide-in-width}) - -(local lsp-progress - {1 :lsp_progress - :display_components [[:title :percentage :message]] - :timer {:progress_enddelay 500 :lsp_client_name_enddelay 500}}) - -(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 []}) - -(local dependencies [:nvim-tree/nvim-web-devicons :arkav/lualine-lsp-progress]) - -{1 :nvim-lualine/lualine.nvim :event :BufReadPost : opts : dependencies} diff --git a/fnl/plugins/editor/minibar.fnl b/fnl/plugins/editor/minibar.fnl deleted file mode 100644 index d25489c..0000000 --- a/fnl/plugins/editor/minibar.fnl +++ /dev/null @@ -1,31 +0,0 @@ -;; Show the filename in the top left corner. - -(local opts {:ignore-filetypes [:help - :harpoon - :startify - :dashboard - :lir - :alpha - :packer - :neogitstatus - :Trouble - :lazy - :netrw - :Outline - :neo-tree - :neo-tree-popup - :NeogitStatus - :NeogitCommitMessage - :NeogitNotification - :NeogitCommitView - :spectre_panel - ""] - :events [:CursorMoved - :TermOpen - :DirChanged - :BufWinEnter - :BufFilePost - :InsertEnter - :BufWritePost]}) - -{1 :aktersnurra/minibar.nvim :event :BufReadPre : opts} diff --git a/fnl/plugins/editor/neogit.fnl b/fnl/plugins/editor/neogit.fnl deleted file mode 100644 index a84c9dd..0000000 --- a/fnl/plugins/editor/neogit.fnl +++ /dev/null @@ -1,20 +0,0 @@ -;; Git ui. - -(local dependencies [:nvim-lua/plenary.nvim]) - -(local keys [{1 :gm 2 :Neogit :desc :Neogit}]) - -(local auto-cmds [[:FileType - {:pattern [:NeogitStatus - :NeogitCommitMessage - :NeogitNotification - :NeogitCommitView] - :command "setlocal spell!"}]]) - -(fn init [] - (let [cmds (require :util.cmds)] - (cmds.create-auto-cmds auto-cmds))) - -(local opts {:integrations {:diffview true :telescope true}}) - -{1 :TimUntersberger/neogit :cmd :Neogit : opts : init : dependencies : keys} diff --git a/fnl/plugins/editor/nvim-lint.fnl b/fnl/plugins/editor/nvim-lint.fnl deleted file mode 100644 index 2ea01fa..0000000 --- a/fnl/plugins/editor/nvim-lint.fnl +++ /dev/null @@ -1,30 +0,0 @@ -;; Linting - -(lambda callback [] - (let [lint (require :lint)] - (lint.try_lint))) - -(fn init [] - (let [lint-augroup (vim.api.nvim_create_augroup :lint {:clear true})] - (vim.api.nvim_create_autocmd [:BufEnter - :BufWritePost - :InsertLeave - :TextChangedI] - {:group lint-augroup : callback}))) - -(fn config [] - (let [lint (require :lint)] - (set lint.linters_by_ft {:* [:codespell :write_good] - :dockerfile [:hadolint] - :fennel [:fennel] - :gitcommit [:gitlint :codespell] - :haskell [:hlint] - :json [:jsonlint] - :lua [:selene] - :python [:ruff] - :sh [:shellcheck] - :sql [:sqlfluff] - :yaml [:yamllint] - :zsh [:zsh]}))) - -{1 :mfussenegger/nvim-lint : init : config :event [:BufReadPost :BufNewFile]} diff --git a/fnl/plugins/editor/oil.fnl b/fnl/plugins/editor/oil.fnl deleted file mode 100644 index a15c22e..0000000 --- a/fnl/plugins/editor/oil.fnl +++ /dev/null @@ -1,25 +0,0 @@ -;; File explorer that lets you edit your filesystem. - -(local opts {:keymaps {:g? :actions.show_help - : :actions.select - : :actions.select_vsplit - : :actions.select_split - : :actions.select_tab - : :actions.preview - : :actions.close - : :actions.refresh - :- :actions.parent - :_ :actions.open_cwd - "`" :actions.cd - "~" :actions.tcd - :gs :actions.change_sort - :gx :actions.open_external - :g. :actions.toggle_hidden - "g\\\\" :actions.toggle_trash} - :float {:padding 1 :max_width 64 :max_height 32}}) - -(local keys [{1 "-" - 2 "lua require(\"oil\").open_float()" - :desc "Open parent directory"}]) - -{1 :stevearc/oil.nvim : opts : keys} diff --git a/fnl/plugins/editor/orgmode.fnl b/fnl/plugins/editor/orgmode.fnl deleted file mode 100644 index abf98f7..0000000 --- a/fnl/plugins/editor/orgmode.fnl +++ /dev/null @@ -1,60 +0,0 @@ -;; Orgmode for nvim. - -(local keys [{1 :ga 2 :OrgAgendaPrompt :desc "Open agenda prompt"} - {1 :gc 2 :OrgCapturePrompt :desc "Open capture prompt"} - {1 :go - 2 ":Telescope find_files theme=dropdown cwd=~/.local/share/org" - :desc "Find org file"} - {1 :gm - 2 "Telescope orgmode search_headings theme=dropdown" - :desc "Search headings"}]) - -(local user-cmds [[:OrgAgendaPrompt - (lambda [] - (let [orgmode (require :orgmode)] - (orgmode.action :agenda.prompt))) - {:nargs 0}] - [:OrgCapturePrompt - (lambda [] - (let [orgmode (require :orgmode)] - (orgmode.action :capture.prompt))) - {:nargs 0}]]) - -(local auto-cmds - [[:FileType - {:pattern :org - :callback (fn [] - (tset vim.opt_local :foldenable false) - (tset vim.opt_local :foldlevelstart 0) - (tset vim.opt_local :foldlevel 0) - (tset vim.opt_local :conceallevel 2))}]]) - -(fn init [] - (let [cmds (require :util.cmds)] - (cmds.create-user-cmds user-cmds) - (cmds.create-auto-cmds auto-cmds))) - -(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"}}) - -(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}) - -(fn config [] - (let [orgmode (require :orgmode) - bullets (require :org-bullets)] - (orgmode.setup_ts_grammar) - (orgmode.setup opts) - (bullets.setup {:concealcursor true}))) - -{1 :nvim-orgmode/orgmode - :dependencies :akinsho/org-bullets.nvim - :ft :org - : config - : init - : keys} diff --git a/fnl/plugins/editor/persistence.fnl b/fnl/plugins/editor/persistence.fnl deleted file mode 100644 index 1939564..0000000 --- a/fnl/plugins/editor/persistence.fnl +++ /dev/null @@ -1,33 +0,0 @@ -;; Session manager. - -(local keys [{1 :sn 2 :RestoreSession :desc "Restore session"} - {1 :se - 2 :RestoreLastSession - :desc "Restore last session"} - {1 :si - 2 :IgnoreSession - :desc "Ignore current session"}]) - -(local user-cmds [[:RestoreSession - (lambda [] - (let [persistence (require :persistence)] - (persistence.load))) - {:nargs 0}] - [:RestoreLastSession - (lambda [] - (let [persistence (require :persistence)] - (persistence.load {:last true}))) - {:nargs 0}] - [:IgnoreSession - (lambda [] - (let [persistence (require :persistence)] - (persistence.stop))) - {:nargs 0}]]) - -(fn init [] - (let [cmds (require :util.cmds)] - (cmds.create-user-cmds user-cmds))) - -(local opts {:options [:buffers :curdir :tabpages :winsize :help]}) - -{1 :folke/persistence.nvim :event :BufReadPre : init : keys : opts} diff --git a/fnl/plugins/editor/spectre.fnl b/fnl/plugins/editor/spectre.fnl deleted file mode 100644 index c7307f8..0000000 --- a/fnl/plugins/editor/spectre.fnl +++ /dev/null @@ -1,86 +0,0 @@ -;; Find and replace. - -(local user-cmds [[:Replace - (lambda [] - (let [spectre (require :spectre)] - (spectre.open))) - {:nargs 0}] - [:ReplaceWord - (lambda [] - (let [spectre (require :spectre)] - (spectre.open_visual {:select_word true}))) - {:nargs 0}] - [:ReplaceInBuf - (lambda [] - (let [spectre (require :spectre)] - (spectre.open_file_search))) - {:nargs 0}]]) - -(local auto-cmds - [[:FileType - {:pattern [:spectre_panel] - :command "nnoremap q :close"}] - [:FileType {:pattern [:spectre_panel] :command "setlocal spell!"}]]) - -(fn init [] - (let [cmds (require :util.cmds)] - (cmds.create-user-cmds user-cmds) - (cmds.create-auto-cmds auto-cmds))) - -(local opts {:color_devicons true - :highlight {:ui :String :search :DiffChange :replace :DiffDelete} - :mapping {:toggle_line {:map :t - :cmd "lua require('spectre').toggle_line()" - :desc "toggle current item"} - :enter_file {:map : - :cmd "lua require('spectre.actions').select_entry()" - :desc "goto current file"} - :send_to_qf {:map :Q - :cmd "lua require('spectre.actions').send_to_qf()" - :desc "send all item to quickfix"} - :replace_cmd {:map :c - :cmd "lua require('spectre.actions').replace_cmd()" - :desc "input replace vim command"} - :show_option_menu {:map :o - :cmd "lua require('spectre').show_options()" - :desc "show option"} - :run_replace {:map :R - :cmd "lua require('spectre.actions').run_replace()" - :desc "replace all"} - :change_view_mode {:map :m - :cmd "lua require('spectre').change_view()" - :desc "change result view mode"} - :toggle_ignore_case {:map :I - :cmd "lua require('spectre').change_options('ignore-case')" - :desc "toggle ignore case"} - :toggle_ignore_hidden {:map :H - :cmd "lua require('spectre').change_options('hidden')" - :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]"}}}} - :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 keys - [{1 :rn 2 :ReplaceInBuf :desc "Replace in Buffer"} - {1 :re 2 :Replace :desc :Replace} - {1 :ri 2 :ReplaceWord :desc "Replace Word"}]) - -{1 :windwp/nvim-spectre :event :BufReadPost : init : keys : opts} diff --git a/fnl/plugins/editor/stay-in-place.fnl b/fnl/plugins/editor/stay-in-place.fnl deleted file mode 100644 index b264a05..0000000 --- a/fnl/plugins/editor/stay-in-place.fnl +++ /dev/null @@ -1,3 +0,0 @@ -;; Keep cursor at character when indenting. - -{1 :gbprod/stay-in-place.nvim :event :BufReadPost :config true} diff --git a/fnl/plugins/editor/surround.fnl b/fnl/plugins/editor/surround.fnl deleted file mode 100644 index e8fda32..0000000 --- a/fnl/plugins/editor/surround.fnl +++ /dev/null @@ -1,3 +0,0 @@ -;; Surround selections. - -{1 :kylechui/nvim-surround :event :InsertEnter :config true} diff --git a/fnl/plugins/editor/telescope.fnl b/fnl/plugins/editor/telescope.fnl deleted file mode 100644 index 720c69c..0000000 --- a/fnl/plugins/editor/telescope.fnl +++ /dev/null @@ -1,191 +0,0 @@ -;; Telescope a highly extendable fuzzy finder over lists. - -(local dependencies [:nvim-lua/popup.nvim - :nvim-telescope/telescope-frecency.nvim - {1 :nvim-telescope/telescope-fzf-native.nvim :build :make} - :tami5/sqlite.lua - {1 :ahmedkhalf/project.nvim - :event :VeryLazy - :opts {:active true - :on_config_done nil - :manual_mode false - :detection_methods [:patterns] - :patterns [:git - :_darcs - :.hg - :.bzr - :.svn - :Makefile - :package.json] - :show_hidden false - :silent_chdir true - :ignore_lsp {} - :datapath (vim.fn.stdpath :data)} - :config (lambda [_ opts] - (let [project (require :project_nvim)] - (project.setup opts)))} - :nvim-lua/plenary.nvim - :nvim-telescope/telescope-fzf-native.nvim - :nvim-telescope/telescope-frecency.nvim - :joaomsa/telescope-orgmode.nvim]) - -(local extensions [:fzf :frecency :orgmode :projects :git_worktree :harpoon]) - -(fn load-extensions [telescope] - (each [_ extension (ipairs extensions)] - (telescope.load_extension extension))) - -(fn telescope-builtin [builtin opts] - (let [telescope (require :telescope.builtin) - themes (require :telescope.themes) - theme (. opts :theme)] - ((. telescope builtin) ((. themes theme) opts)))) - -(local user-cmds [[:FindFiles - (lambda [] - (telescope-builtin :find_files - {:theme :get_dropdown :previewer false})) - {:nargs 0}]]) - -(fn init [] - (let [cmds (require :util.cmds)] - (cmds.create-user-cmds user-cmds))) - -(local keys [{1 :mf 2 :FindFiles :desc "Find Files"} - {1 :mg - 2 "Telescope live_grep theme=dropdown" - :desc "Find Text"} - {1 :mp - 2 "Telescope buffers theme=dropdown previewer=false initial_mode=normal" - :desc "Switch Buffer"} - {1 :fC - 2 "Telescope commands theme=dropdown" - :desc :Commands} - {1 :fH - 2 "Telescope highlights" - :desc :Highlights} - {1 :fR - 2 "Telescope registers theme=dropdown" - :desc :Registers} - {1 :fS - 2 "Telescope grep_string theme=dropdown" - :desc "Find String"} - {1 :gb - 2 "Telescope git_branches theme=dropdown" - :desc "Checkout Branch"} - {1 :ff 2 :FindFiles :desc "Find files"} - {1 :fh - 2 "Telescope help_tags theme=dropdown" - :desc :Help} - {1 :fk - 2 "Telescope keymaps theme=dropdown" - :desc :Keymaps} - {1 :fl - 2 "Telescope resume theme=dropdown" - :desc "Last Search"} - {1 :fp - 2 "Telescope projects theme=dropdown" - :desc "Find Project"} - {1 :fr - 2 "Telescope oldfiles theme=dropdown" - :desc "Recent File"} - {1 :ft - 2 "Telescope live_grep theme=dropdown" - :desc "Find Text"} - {1 :js - 2 "Telescope diagnostics theme=dropdown" - :desc "Telescope Diagnostics"} - {1 :gc - 2 "Telescope git_commits theme=dropdown" - :desc "Checkout Commit"} - {1 :lS - 2 "Telescope lsp_dynamic_workspace_symbols" - :desc "Workspace Symbols"} - {1 :n - 2 "Telescope lsp_document_symbols theme=dropdown" - :desc "Document Symbols"}]) - -(fn config [] - (let [telescope (require :telescope) - actions (require :telescope.actions) - icons (require :plugins.icons)] - (telescope.setup {:defaults {:prompt_prefix (.. " " (. icons :telescope) - " ") - :selection_caret (.. (. icons :caret) " ") - :path_display [:smart] - :color_devicons false - :pickers {:find_files {:theme :dropdown}} - :vimgrep_arguments [:rg - :--color=never - :--no-heading - :--with-filename - :--line-number - :--column - :--smart-case - :--hidden] - :mappings {:i {: actions.cycle_history_next - : actions.cycle_history_prev - : actions.move_selection_next - : actions.move_selection_previous - : actions.close - : actions.move_selection_next - : actions.move_selection_previous - : actions.select_default - : actions.select_horizontal - : actions.select_vertical - : actions.select_tab - : actions.preview_scrolling_up - : actions.preview_scrolling_down - : actions.results_scrolling_up - : actions.results_scrolling_down - : (+ actions.toggle_selection - actions.move_selection_worse) - : (+ actions.toggle_selection - actions.move_selection_better) - : (+ actions.send_to_qflist - actions.open_qflist) - : (+ actions.send_selected_to_qflist - actions.open_qflist) - : actions.complete_tag - : actions.which_key} - :n {: actions.close - : actions.select_default - : actions.select_horizontal - : actions.select_vertical - : actions.select_tab - : (+ actions.toggle_selection - actions.move_selection_worse) - : (+ actions.toggle_selection - actions.move_selection_better) - : (+ actions.send_to_qflist - actions.open_qflist) - : (+ 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 - : actions.move_selection_next - : actions.move_selection_previous - :gg actions.move_to_top - :G actions.move_to_bottom - :q actions.close - : actions.preview_scrolling_up - : actions.preview_scrolling_down - : actions.results_scrolling_up - : 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}}}) - (load-extensions telescope))) - -{1 :nvim-telescope/telescope.nvim - :cmd :Telescope - : init - : config - : dependencies - : keys} diff --git a/fnl/plugins/editor/textobjs.fnl b/fnl/plugins/editor/textobjs.fnl deleted file mode 100644 index 8d68ac3..0000000 --- a/fnl/plugins/editor/textobjs.fnl +++ /dev/null @@ -1,5 +0,0 @@ -;; Various text objects. - -{1 :chrisgrieser/nvim-various-textobjs - :event :BufReadPost - :opts {:useDefaultKeymaps true}} diff --git a/fnl/plugins/editor/toggleterm.fnl b/fnl/plugins/editor/toggleterm.fnl deleted file mode 100644 index 12168aa..0000000 --- a/fnl/plugins/editor/toggleterm.fnl +++ /dev/null @@ -1,26 +0,0 @@ -;; Terminal inside nvim. - -(local keys [{1 :t 2 :ToggleTerm :desc :Terminal}]) - -(local opts {:size 24 :shade_terminals false}) - -(local auto-cmds [[:TermOpen - {:pattern "term://*toggleterm#*" - :callback (fn [] - (vim.keymap.set :t : "wincmd h" - {}) - (vim.keymap.set :t : "wincmd j" - {}) - (vim.keymap.set :t : "wincmd k" - {}) - (vim.keymap.set :t : "wincmd l" - {}))}] - [:TermOpen - {:pattern ["term://*toggleterm#*"] - :command "setlocal spell!"}]]) - -(fn init [] - (let [cmds (require :util.cmds)] - (cmds.create-auto-cmds auto-cmds))) - -{1 :akinsho/toggleterm.nvim :version "*" :cmd :ToggleTerm : init : keys : opts} diff --git a/fnl/plugins/editor/treesitter.fnl b/fnl/plugins/editor/treesitter.fnl deleted file mode 100644 index 103948d..0000000 --- a/fnl/plugins/editor/treesitter.fnl +++ /dev/null @@ -1,84 +0,0 @@ -;; Treesitter is a tool for building syntax trees for source files. -;; In the neovim context it helps with better coloring. - -(local opts - {:ensure_installed [:bash - :c - :dockerfile - :fennel - :haskell - :hcl - :html - :latex - :lua - :make - :markdown - :ocaml - :org - :python - :rust - :sql - :toml - :vim - :yaml] - :sync_install false - :ignore_install [""] - :autopairs {:enable true} - :highlight {:enable true :additional_vim_regex_highlighting [:org]} - :context_commentstring {:enable true :enable_autocmd false} - :indent {:enable true :disable [:yaml :python :css]} - :playground {:enable true} - :textobjects {:select {:enable true - :lookahead true - :keymaps {:aa "@parameter.outer" - :ia "@parameter.inner" - :af "@function.outer" - :if "@function.inner" - :ii "@conditional.outer" - :ai "@conditional.inner" - :il "@loop.outer" - :al "@loop.inner" - :ac "@class.outer" - :at "@comment.outer" - :ic {:query "@class.inner" - :desc "Select inner part of a class region"} - :as {:query "@scope" - :query_group :locals - :desc "Select language scope"}} - :selection_modes {"@parameter.outer" :v - "@function.outer" :V - "@class.outer" :} - :include_surrounding_whitespace true} - :swap {:enable true - :swap_next {:a "@parameter.inner"} - :swap_previous {:A "@parameter.inner"}} - :move {:enable true - :set_jumps true - :goto_next_start {"]m" "@function.outer" - "]]" {:query "@class.outer" - :desc "Next class start"} - "]o" "@loop.*" - "]s" {:query "@scope" - :query_group :locals - :desc "Next scope"} - "]z" {:query "@fold" - :query_group :folds - :desc "Next fold"}} - :goto_next_end {"]M" "@function.outer" - "][" "@class.outer"} - :goto_previous_start {"[m" "@function.outer" - "[[" "@class.outer"} - :goto_previous_end {"[M" "@function.outer" - "[]" "@class.outer"} - :goto_next {"]i" "@conditional.outer"} - :goto_previous {"[i" "@conditional.outer"}}}}) - -(fn config [] - (let [treesitter (require :nvim-treesitter.configs)] - (treesitter.setup opts))) - -{1 :nvim-treesitter/nvim-treesitter - :dependencies [{1 :nvim-treesitter/nvim-treesitter-textobjects :lazy true}] - :build ":TSUpdate" - :event [:BufReadPost :BufNewFile] - : config} diff --git a/fnl/plugins/editor/trouble.fnl b/fnl/plugins/editor/trouble.fnl deleted file mode 100644 index b9a4e3c..0000000 --- a/fnl/plugins/editor/trouble.fnl +++ /dev/null @@ -1,77 +0,0 @@ -;; Pretty diagnostics. - -(local keys [{1 :jt - 2 "TroubleToggle workspace_diagnostics" - :desc :Trouble}]) - -(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 : - ;; cancel the preview and get back to your last window / buffer / cursor - :refresh :r - ;; manually refresh - :jump [: :] - ;; jump to the diagnostic or open / close folds - :open_split [:] - ;; open buffer in new split - :open_vsplit [:] - ;; open buffer in new vsplit - :open_tab [:] - ;; 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. 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 - :use_diagnostic_signs true}) - -{1 :folke/trouble.nvim :cmd [:TroubleToggle :Trouble] : opts : keys} diff --git a/fnl/plugins/editor/undotree.fnl b/fnl/plugins/editor/undotree.fnl deleted file mode 100644 index 05de139..0000000 --- a/fnl/plugins/editor/undotree.fnl +++ /dev/null @@ -1,5 +0,0 @@ -;; Tree of undo history. - -{1 :mbbill/undotree - :cmd :UndotreeToggle - :keys [{1 :u 2 :UndotreeToggle :desc :Undotree}]} diff --git a/fnl/plugins/editor/which-key.fnl b/fnl/plugins/editor/which-key.fnl deleted file mode 100644 index 962183e..0000000 --- a/fnl/plugins/editor/which-key.fnl +++ /dev/null @@ -1,47 +0,0 @@ -;; Which-key provides a pop-up menu for some key mappings. - -(local icons (require :plugins.icons)) - -(local opts {:plugins {:marks true - :registers true - :spelling {:enabled true :suggestions 20} - :presets {:operators false - :motions false - :text_objects false - :windows true - :nav true - :z true - :g true}} - :icons {:breadcrumb (. icons :guillemet) - :separator (.. (. icons :small-right-arrow) " ") - :group "+"} - :popup_mappings {:scroll_down : :scroll_up :} - :window {:border :rounded :position :bottom :winblend 0} - :layout {:height {:min 4 :max 25} - :width {:min 20 :max 50} - :spacing 3 - :align :left} - :hidden [: : : : :call :lua "^:" "^ "] - :show_help true - :triggers :auto - :disable {:filetypes [:netrw]} - :triggers_blacklist {:i [:j :k] :v [:j :k]}}) - -(local groups {:mode [:n :v] - :d {:name :+db} - :f {:name :+find} - :g {:name :+git} - :i {:name :+diffview} - :j {:name :+diagnostics} - :l {:name :+lsp} - :o {:name :+orgmode} - :r {:name :+replace} - :s {:name :+session} - :w {:name :+worktree}}) - -(fn config [] - (let [which-key (require :which-key)] - (which-key.setup opts) - (which-key.register groups))) - -{1 :folke/which-key.nvim :event :VeryLazy : config} diff --git a/fnl/plugins/editor/window-picker.fnl b/fnl/plugins/editor/window-picker.fnl deleted file mode 100644 index e396ce1..0000000 --- a/fnl/plugins/editor/window-picker.fnl +++ /dev/null @@ -1,19 +0,0 @@ -;; Trim whitespaces on save. - -(local opts {:other_win_hl_color "#171717" - :fg_color "#E1E1E1" - :selection_chars :MNEIOARSTG}) - -(fn pick-window [] - (let [window-picker (require :window-picker)] - (let [win (window-picker.pick_window)] - (if (not= win nil) - (vim.api.nvim_set_current_win win))))) - -(fn config [] - (let [window-picker (require :window-picker)] - (window-picker.setup opts) - (vim.keymap.set :n : (fn [] - (pick-window)) {}))) - -{1 :s1n7ax/nvim-window-picker :event :BufReadPost :version :2.0.0 : config} diff --git a/fnl/plugins/editor/zen.fnl b/fnl/plugins/editor/zen.fnl deleted file mode 100644 index e9a1576..0000000 --- a/fnl/plugins/editor/zen.fnl +++ /dev/null @@ -1,15 +0,0 @@ -;; Zen mode. - -(local opts {:window {:backdrop 1 - :height 1 - :width 120 - :options {:signcolumn :no - :number false - :relativenumber false}} - :plugins {:gitsigns {:enabled false} - :tmux {:enabled true} - :twilight {:enabled true}}}) - -(local keys [{1 :gy 2 :ZenMode :desc "Zen Mode"}]) - -{1 :folke/zen-mode.nvim :cmd :ZenMode : keys : opts} diff --git a/fnl/plugins/git-conflicts.fnl b/fnl/plugins/git-conflicts.fnl new file mode 100644 index 0000000..4a4583b --- /dev/null +++ b/fnl/plugins/git-conflicts.fnl @@ -0,0 +1,3 @@ +;; Resolve git conflicts. + +{1 :akinsho/git-conflict.nvim :event :BufReadPre :tag "v1.0.0" :config true} diff --git a/fnl/plugins/git-worktree.fnl b/fnl/plugins/git-worktree.fnl new file mode 100644 index 0000000..8812859 --- /dev/null +++ b/fnl/plugins/git-worktree.fnl @@ -0,0 +1,12 @@ +;; Plugins for working with git-worktrees. + +(local keys [{1 :wn + 2 "lua require('telescope').extensions.git_worktree.git_worktrees()" + :mode :n + :desc "Switch between worktrees"} + {1 :we + 2 "lua require('telescope').extensions.git_worktree.create_git_worktree()" + :mode :n + :desc "Create a worktree"}]) + +{1 :ThePrimeagen/git-worktree.nvim : keys} diff --git a/fnl/plugins/gitsigns.fnl b/fnl/plugins/gitsigns.fnl new file mode 100644 index 0000000..a194f3c --- /dev/null +++ b/fnl/plugins/gitsigns.fnl @@ -0,0 +1,77 @@ +;; Add git signs to source files. + +(local keys [{1 :gR + 2 "lua require 'gitsigns'.reset_buffer()" + :mode :n + :desc "Reset Buffer"} + {1 :gd + 2 "Gitsigns diffthis HEAD" + :mode :n + :desc :Diff} + {1 :gj + 2 "lua require 'gitsigns'.next_hunk()" + :mode :n + :desc "Next Hunk"} + {1 :gk + 2 "lua require 'gitsigns'.prev_hunk()" + :mode :n + :desc "Prev Hunk"} + {1 :gl + 2 "lua require 'gitsigns'.blame_line()" + :mode :n + :desc :Blame} + {1 :gp + 2 "lua require 'gitsigns'.preview_hunk()" + :mode :n + :desc "Preview Hunk"} + {1 :gr + 2 "lua require 'gitsigns'.reset_hunk()" + :mode :n + :desc "Reset Hunk"} + {1 :gs + 2 "lua require 'gitsigns'.stage_hunk()" + :mode :n + :desc "Stage Hunk"} + {1 :gu + 2 "lua require 'gitsigns'.undo_stage_hunk()" + :mode :n + :desc "Undo Stage Hunk"} + {1 :gn + 2 ":Gitsigns select_hunk" + :mode [:o :x] + :desc "GitSigns Select Hunk"}]) + +(local icons (require :icons)) + +(local signs {:add {:text (. icons :git-add)} + :change {:text (. icons :git-add)} + :delete {:text (. icons :git-delete)} + :topdelete {:text (. icons :git-top-delete)} + :changedelete {:text (. icons :git-change-delete)} + :untracked {:text (. icons :git-untracked)}}) + +(local opts {: signs + :signcolumn true + :numhl false + :linehl false + :word_diff false + :watch_gitdir {: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 ", - " + :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}}) + +{1 :lewis6991/gitsigns.nvim :event [:BufReadPre :BufNewFile] : opts : keys} diff --git a/fnl/plugins/harpoon.fnl b/fnl/plugins/harpoon.fnl new file mode 100644 index 0000000..0791f98 --- /dev/null +++ b/fnl/plugins/harpoon.fnl @@ -0,0 +1,53 @@ +;; Harpoon files for navigation. + +(local user-cmds [[:HarpoonAdd + (lambda [] + (let [harpoon (require :harpoon.mark)] + (harpoon.add_file))) + {:nargs 0}] + [:HarpoonNext + (lambda [] + (let [harpoon (require :harpoon.ui)] + (harpoon.nav_next))) + {:nargs 0}] + [:HarpoonPrev + (lambda [] + (let [harpoon (require :harpoon.ui)] + (harpoon.nav_prev))) + {:nargs 0}] + [:HarpoonUI + (lambda [] + (let [harpoon (require :harpoon.ui)] + (harpoon.toggle_quick_menu))) + {:nargs 0}]]) + +(fn telescope-ext [ext fun opts] + (let [telescope (require :telescope) + themes (require :telescope.themes) + theme (. opts :theme)] + ((. (. (. telescope :extensions) ext) fun) ((. themes theme) opts)))) + +(fn init [] + (let [cmds (require :util.cmds)] + (cmds.create-user-cmds user-cmds))) + +(fn config [] + (vim.keymap.set :n : + (fn [] + (telescope-ext :harpoon :marks + {:theme :get_dropdown + :previewer false + :initial_mode :normal + :prompt_title :Harpoon})) + {}) + (vim.keymap.set :n : + "Telescope buffers theme=dropdown previewer=false initial_mode=normal" + {}) + {:menu {:width (- (vim.api.nvim_win_get_width 0) 4)}}) + +(local keys [{1 :ma 2 :HarpoonAdd :desc :Harpoon} + {1 :mr 2 :HarpoonUI :desc "Harpoon UI"} + {1 :ms 2 :HarpoonPrev :desc "Harpoon Prev"} + {1 :mt 2 :HarpoonNext :desc "Harpoon Next"}]) + +{1 :ThePrimeagen/harpoon :event :BufReadPost : init : keys : config} diff --git a/fnl/plugins/hotpot.fnl b/fnl/plugins/hotpot.fnl new file mode 100644 index 0000000..eba8083 --- /dev/null +++ b/fnl/plugins/hotpot.fnl @@ -0,0 +1,3 @@ +;; Transpiler for fnl. + +{1 :rktjmp/hotpot.nvim} diff --git a/fnl/plugins/icons.fnl b/fnl/plugins/icons.fnl deleted file mode 100644 index b1115cb..0000000 --- a/fnl/plugins/icons.fnl +++ /dev/null @@ -1,45 +0,0 @@ -;; Icons. - -{:error "" - :warn "" - :hint "" - :info "" - :git " " - :search-project "󰺅" - :search-files "󰱽" - :search-text "󱎸" - :notebook "" - :recent-files "󱋢" - :cog "" - :org "" - :checkmark "" - :right-arrow "" - :small-right-arrow "" - :guillemet "»" - :close "" - :git-add "|" - :git-delete "_" - :git-top-delete "‾" - :git-change-delete "~" - :git-untracked "┆" - :telescope "" - :caret ">" - :cmd "" - :lightning "" - :document "" - :import "" - :keyboard "" - :sleep "󰒲" - :filled-orb "●" - :orb "○" - :package "󰏗" - :vim "" - :code "" - :play "" - :star "" - :line "‒" - :ignored "" - :unstaged "" - :staged "" - :conflict "" -} diff --git a/fnl/plugins/init.fnl b/fnl/plugins/init.fnl deleted file mode 100644 index f451fc9..0000000 --- a/fnl/plugins/init.fnl +++ /dev/null @@ -1,18 +0,0 @@ -;; Load all plugins. - -(local editor-plugins (let [plugins [] - path (.. (vim.fn.stdpath :config) - :/fnl/plugins/editor)] - (each [fname (vim.fs.dir path)] - (let [fname (fname:match "^(.*)%.fnl$")] - (table.insert plugins - (require (.. :plugins.editor. fname))))) - plugins)) - -(local plugins (let [plugins editor-plugins] - (table.insert plugins (require :plugins.lsp)) - (table.insert plugins (require :plugins.core.hotpot)) - plugins)) - -(let [lazy (require :plugins.core.lazy)] - (lazy.setup plugins)) diff --git a/fnl/plugins/leap.fnl b/fnl/plugins/leap.fnl new file mode 100644 index 0000000..c5b700d --- /dev/null +++ b/fnl/plugins/leap.fnl @@ -0,0 +1,37 @@ +;; Leap through text. + +(local dependencies [{1 :ggandor/flit.nvim + :event :BufReadPost + :opts {:keys {:f :f :F :F :t :t :T :T} + :labeled_modes :v + :multiline true + :opts {}}} + {1 :ggandor/leap-spooky.nvim + :event :BufReadPost + :opts {;; Additional text objects, to be merged with the default ones. + ;; E.g.: {'iq', 'aq'} + :extra_text_objects nil + ;; Mappings will be generated corresponding to all native text objects, + ;; like: (ir|ar|iR|aR|im|am|iM|aM){obj}. + ;; Special line objects will also be added, by repeating the affixes. + ;; E.g. `yrr` and `ymm` will yank a line in the current + ;; window. + :affixes {;; The cursor moves to the targeted object, and stays there. + :magnetic {:window :m :cross_window :M} + ;; The operation is executed seemingly remotely (the cursor boomerangs + ;; back afterwards). + :remote {:window :r :cross_window :R}} + ;; Defines text objects like `riw`, `raw`, etc., instead of + ;; targets.vim-style `irw`, `arw`. (Note: prefix is forced if a custom + ;; text object does not start with "a" or "i".) + :prefix false + ;; The yanked text will automatically be pasted at the cursor position + ;; if the unnamed register is in use. + :paste_on_remote_yank false}}]) + +(fn config [] + (let [leap (require :leap)] + (leap.setup {}) + (leap.set_default_keymaps))) + +{1 :ggandor/leap.nvim : dependencies :event :BufReadPost : config} diff --git a/fnl/plugins/lsp/diagnostics.fnl b/fnl/plugins/lsp/diagnostics.fnl index 8676924..f4a2a74 100644 --- a/fnl/plugins/lsp/diagnostics.fnl +++ b/fnl/plugins/lsp/diagnostics.fnl @@ -1,6 +1,6 @@ ;; Handlers for the requests and responses from and to the lsp server. -(local icons (require :plugins.icons)) +(local icons (require :icons)) (local signs [{:name :DiagnosticSignError :text (. icons :error)} {:name :DiagnosticSignWarn :text (. icons :warn)} diff --git a/fnl/plugins/lsp/init.fnl b/fnl/plugins/lsp/init.fnl index f04ba86..c06a5aa 100644 --- a/fnl/plugins/lsp/init.fnl +++ b/fnl/plugins/lsp/init.fnl @@ -1,3 +1 @@ ;; Lsp plugins. - -[(require :plugins.lsp.lspconfig) (require :plugins.lsp.mason)] diff --git a/fnl/plugins/lsp/mason.fnl b/fnl/plugins/lsp/mason.fnl index f94f328..4187381 100644 --- a/fnl/plugins/lsp/mason.fnl +++ b/fnl/plugins/lsp/mason.fnl @@ -1,6 +1,6 @@ ;; Mason manages external tooling, e.g. lsp, formatters, and linters. -(local icons (require :plugins.icons)) +(local icons (require :icons)) (local opts {:ui {:border :single :icons {:package_installed (.. (. icons :checkmark) " ") diff --git a/fnl/plugins/lualine.fnl b/fnl/plugins/lualine.fnl new file mode 100644 index 0000000..1afad4f --- /dev/null +++ b/fnl/plugins/lualine.fnl @@ -0,0 +1,89 @@ +;; Statusbar. + +(local icons (require :icons)) + +(local disable [:neogitstatus + :netrw + :lir + :lazy + :alpha + :neo-tree + :Outline + :NeogitStatus + :NeogitCommitMessage]) + +(local ignore [:help :packer :spectre_panel :TelescopePrompt]) + +(fn active-clients [] + (let [clients (vim.lsp.buf_get_clients) + client_names []] + (each [_ client (pairs clients)] + (table.insert client_names client.name)) + (if (> (length client_names) 0) + (table.concat client_names ", ") + ""))) + +(fn hide-in-width [] + (> (vim.fn.winwidth 0) 80)) + +(local diagnostics {1 :diagnostics + :sources [:nvim_diagnostic] + :sections [:error :warn] + :symbols {:error (.. (. icons :error) " ") + :warn (.. (. icons :warn) " ")} + :colored false + :disabled_buftypes [:nvim-tree] + :padding 0 + :update_in_insert false + :always_visible true}) + +(local diff {1 :diff + :colored false + :disabled_buftypes [:nvim-tree] + :cond hide-in-width}) + +(local branch {1 "b:gitsigns_head" + :icon (. icons :git) + :disabled_buftypes [:nvim-tree] + :cond hide-in-width}) + +(local filetype {1 :filetype + :icon_only true + :disabled_buftypes [:nvim-tree] + :colored false + :cond hide-in-width}) + +(local language-server {1 active-clients + :disabled_buftypes [:nvim-tree] + :cond hide-in-width}) + +(local lsp-progress + {1 :lsp_progress + :display_components [[:title :percentage :message]] + :timer {:progress_enddelay 500 :lsp_client_name_enddelay 500}}) + +(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 []}) + +(local dependencies [:nvim-tree/nvim-web-devicons :arkav/lualine-lsp-progress]) + +{1 :nvim-lualine/lualine.nvim :event :BufReadPost : opts : dependencies} diff --git a/fnl/plugins/minibar.fnl b/fnl/plugins/minibar.fnl new file mode 100644 index 0000000..d25489c --- /dev/null +++ b/fnl/plugins/minibar.fnl @@ -0,0 +1,31 @@ +;; Show the filename in the top left corner. + +(local opts {:ignore-filetypes [:help + :harpoon + :startify + :dashboard + :lir + :alpha + :packer + :neogitstatus + :Trouble + :lazy + :netrw + :Outline + :neo-tree + :neo-tree-popup + :NeogitStatus + :NeogitCommitMessage + :NeogitNotification + :NeogitCommitView + :spectre_panel + ""] + :events [:CursorMoved + :TermOpen + :DirChanged + :BufWinEnter + :BufFilePost + :InsertEnter + :BufWritePost]}) + +{1 :aktersnurra/minibar.nvim :event :BufReadPre : opts} diff --git a/fnl/plugins/neogit.fnl b/fnl/plugins/neogit.fnl new file mode 100644 index 0000000..a84c9dd --- /dev/null +++ b/fnl/plugins/neogit.fnl @@ -0,0 +1,20 @@ +;; Git ui. + +(local dependencies [:nvim-lua/plenary.nvim]) + +(local keys [{1 :gm 2 :Neogit :desc :Neogit}]) + +(local auto-cmds [[:FileType + {:pattern [:NeogitStatus + :NeogitCommitMessage + :NeogitNotification + :NeogitCommitView] + :command "setlocal spell!"}]]) + +(fn init [] + (let [cmds (require :util.cmds)] + (cmds.create-auto-cmds auto-cmds))) + +(local opts {:integrations {:diffview true :telescope true}}) + +{1 :TimUntersberger/neogit :cmd :Neogit : opts : init : dependencies : keys} diff --git a/fnl/plugins/nvim-lint.fnl b/fnl/plugins/nvim-lint.fnl new file mode 100644 index 0000000..2ea01fa --- /dev/null +++ b/fnl/plugins/nvim-lint.fnl @@ -0,0 +1,30 @@ +;; Linting + +(lambda callback [] + (let [lint (require :lint)] + (lint.try_lint))) + +(fn init [] + (let [lint-augroup (vim.api.nvim_create_augroup :lint {:clear true})] + (vim.api.nvim_create_autocmd [:BufEnter + :BufWritePost + :InsertLeave + :TextChangedI] + {:group lint-augroup : callback}))) + +(fn config [] + (let [lint (require :lint)] + (set lint.linters_by_ft {:* [:codespell :write_good] + :dockerfile [:hadolint] + :fennel [:fennel] + :gitcommit [:gitlint :codespell] + :haskell [:hlint] + :json [:jsonlint] + :lua [:selene] + :python [:ruff] + :sh [:shellcheck] + :sql [:sqlfluff] + :yaml [:yamllint] + :zsh [:zsh]}))) + +{1 :mfussenegger/nvim-lint : init : config :event [:BufReadPost :BufNewFile]} diff --git a/fnl/plugins/oil.fnl b/fnl/plugins/oil.fnl new file mode 100644 index 0000000..fac1532 --- /dev/null +++ b/fnl/plugins/oil.fnl @@ -0,0 +1,25 @@ +;; File explorer that lets you edit your filesystem. + +(local opts {:keymaps {:g? :actions.show_help + : :actions.select + : :actions.select_vsplit + : :actions.select_split + : :actions.select_tab + : :actions.preview + :q :actions.close + : :actions.refresh + :- :actions.parent + :_ :actions.open_cwd + "`" :actions.cd + "~" :actions.tcd + :gs :actions.change_sort + :gx :actions.open_external + :g. :actions.toggle_hidden + "g\\\\" :actions.toggle_trash} + :float {:padding 1 :max_width 64 :max_height 32}}) + +(local keys [{1 "-" + 2 "lua require(\"oil\").open_float()" + :desc "Open parent directory"}]) + +{1 :stevearc/oil.nvim : opts : keys} diff --git a/fnl/plugins/orgmode.fnl b/fnl/plugins/orgmode.fnl new file mode 100644 index 0000000..abf98f7 --- /dev/null +++ b/fnl/plugins/orgmode.fnl @@ -0,0 +1,60 @@ +;; Orgmode for nvim. + +(local keys [{1 :ga 2 :OrgAgendaPrompt :desc "Open agenda prompt"} + {1 :gc 2 :OrgCapturePrompt :desc "Open capture prompt"} + {1 :go + 2 ":Telescope find_files theme=dropdown cwd=~/.local/share/org" + :desc "Find org file"} + {1 :gm + 2 "Telescope orgmode search_headings theme=dropdown" + :desc "Search headings"}]) + +(local user-cmds [[:OrgAgendaPrompt + (lambda [] + (let [orgmode (require :orgmode)] + (orgmode.action :agenda.prompt))) + {:nargs 0}] + [:OrgCapturePrompt + (lambda [] + (let [orgmode (require :orgmode)] + (orgmode.action :capture.prompt))) + {:nargs 0}]]) + +(local auto-cmds + [[:FileType + {:pattern :org + :callback (fn [] + (tset vim.opt_local :foldenable false) + (tset vim.opt_local :foldlevelstart 0) + (tset vim.opt_local :foldlevel 0) + (tset vim.opt_local :conceallevel 2))}]]) + +(fn init [] + (let [cmds (require :util.cmds)] + (cmds.create-user-cmds user-cmds) + (cmds.create-auto-cmds auto-cmds))) + +(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"}}) + +(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}) + +(fn config [] + (let [orgmode (require :orgmode) + bullets (require :org-bullets)] + (orgmode.setup_ts_grammar) + (orgmode.setup opts) + (bullets.setup {:concealcursor true}))) + +{1 :nvim-orgmode/orgmode + :dependencies :akinsho/org-bullets.nvim + :ft :org + : config + : init + : keys} diff --git a/fnl/plugins/persistence.fnl b/fnl/plugins/persistence.fnl new file mode 100644 index 0000000..1939564 --- /dev/null +++ b/fnl/plugins/persistence.fnl @@ -0,0 +1,33 @@ +;; Session manager. + +(local keys [{1 :sn 2 :RestoreSession :desc "Restore session"} + {1 :se + 2 :RestoreLastSession + :desc "Restore last session"} + {1 :si + 2 :IgnoreSession + :desc "Ignore current session"}]) + +(local user-cmds [[:RestoreSession + (lambda [] + (let [persistence (require :persistence)] + (persistence.load))) + {:nargs 0}] + [:RestoreLastSession + (lambda [] + (let [persistence (require :persistence)] + (persistence.load {:last true}))) + {:nargs 0}] + [:IgnoreSession + (lambda [] + (let [persistence (require :persistence)] + (persistence.stop))) + {:nargs 0}]]) + +(fn init [] + (let [cmds (require :util.cmds)] + (cmds.create-user-cmds user-cmds))) + +(local opts {:options [:buffers :curdir :tabpages :winsize :help]}) + +{1 :folke/persistence.nvim :event :BufReadPre : init : keys : opts} diff --git a/fnl/plugins/spectre.fnl b/fnl/plugins/spectre.fnl new file mode 100644 index 0000000..c7307f8 --- /dev/null +++ b/fnl/plugins/spectre.fnl @@ -0,0 +1,86 @@ +;; Find and replace. + +(local user-cmds [[:Replace + (lambda [] + (let [spectre (require :spectre)] + (spectre.open))) + {:nargs 0}] + [:ReplaceWord + (lambda [] + (let [spectre (require :spectre)] + (spectre.open_visual {:select_word true}))) + {:nargs 0}] + [:ReplaceInBuf + (lambda [] + (let [spectre (require :spectre)] + (spectre.open_file_search))) + {:nargs 0}]]) + +(local auto-cmds + [[:FileType + {:pattern [:spectre_panel] + :command "nnoremap q :close"}] + [:FileType {:pattern [:spectre_panel] :command "setlocal spell!"}]]) + +(fn init [] + (let [cmds (require :util.cmds)] + (cmds.create-user-cmds user-cmds) + (cmds.create-auto-cmds auto-cmds))) + +(local opts {:color_devicons true + :highlight {:ui :String :search :DiffChange :replace :DiffDelete} + :mapping {:toggle_line {:map :t + :cmd "lua require('spectre').toggle_line()" + :desc "toggle current item"} + :enter_file {:map : + :cmd "lua require('spectre.actions').select_entry()" + :desc "goto current file"} + :send_to_qf {:map :Q + :cmd "lua require('spectre.actions').send_to_qf()" + :desc "send all item to quickfix"} + :replace_cmd {:map :c + :cmd "lua require('spectre.actions').replace_cmd()" + :desc "input replace vim command"} + :show_option_menu {:map :o + :cmd "lua require('spectre').show_options()" + :desc "show option"} + :run_replace {:map :R + :cmd "lua require('spectre.actions').run_replace()" + :desc "replace all"} + :change_view_mode {:map :m + :cmd "lua require('spectre').change_view()" + :desc "change result view mode"} + :toggle_ignore_case {:map :I + :cmd "lua require('spectre').change_options('ignore-case')" + :desc "toggle ignore case"} + :toggle_ignore_hidden {:map :H + :cmd "lua require('spectre').change_options('hidden')" + :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]"}}}} + :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 keys + [{1 :rn 2 :ReplaceInBuf :desc "Replace in Buffer"} + {1 :re 2 :Replace :desc :Replace} + {1 :ri 2 :ReplaceWord :desc "Replace Word"}]) + +{1 :windwp/nvim-spectre :event :BufReadPost : init : keys : opts} diff --git a/fnl/plugins/stay-in-place.fnl b/fnl/plugins/stay-in-place.fnl new file mode 100644 index 0000000..b264a05 --- /dev/null +++ b/fnl/plugins/stay-in-place.fnl @@ -0,0 +1,3 @@ +;; Keep cursor at character when indenting. + +{1 :gbprod/stay-in-place.nvim :event :BufReadPost :config true} diff --git a/fnl/plugins/surround.fnl b/fnl/plugins/surround.fnl new file mode 100644 index 0000000..e8fda32 --- /dev/null +++ b/fnl/plugins/surround.fnl @@ -0,0 +1,3 @@ +;; Surround selections. + +{1 :kylechui/nvim-surround :event :InsertEnter :config true} diff --git a/fnl/plugins/telescope.fnl b/fnl/plugins/telescope.fnl new file mode 100644 index 0000000..1489f06 --- /dev/null +++ b/fnl/plugins/telescope.fnl @@ -0,0 +1,191 @@ +;; Telescope a highly extendable fuzzy finder over lists. + +(local dependencies [:nvim-lua/popup.nvim + :nvim-telescope/telescope-frecency.nvim + {1 :nvim-telescope/telescope-fzf-native.nvim :build :make} + :tami5/sqlite.lua + {1 :ahmedkhalf/project.nvim + :event :VeryLazy + :opts {:active true + :on_config_done nil + :manual_mode false + :detection_methods [:patterns] + :patterns [:git + :_darcs + :.hg + :.bzr + :.svn + :Makefile + :package.json] + :show_hidden false + :silent_chdir true + :ignore_lsp {} + :datapath (vim.fn.stdpath :data)} + :config (lambda [_ opts] + (let [project (require :project_nvim)] + (project.setup opts)))} + :nvim-lua/plenary.nvim + :nvim-telescope/telescope-fzf-native.nvim + :nvim-telescope/telescope-frecency.nvim + :joaomsa/telescope-orgmode.nvim]) + +(local extensions [:fzf :frecency :orgmode :projects :git_worktree :harpoon]) + +(fn load-extensions [telescope] + (each [_ extension (ipairs extensions)] + (telescope.load_extension extension))) + +(fn telescope-builtin [builtin opts] + (let [telescope (require :telescope.builtin) + themes (require :telescope.themes) + theme (. opts :theme)] + ((. telescope builtin) ((. themes theme) opts)))) + +(local user-cmds [[:FindFiles + (lambda [] + (telescope-builtin :find_files + {:theme :get_dropdown :previewer false})) + {:nargs 0}]]) + +(fn init [] + (let [cmds (require :util.cmds)] + (cmds.create-user-cmds user-cmds))) + +(local keys [{1 :mf 2 :FindFiles :desc "Find Files"} + {1 :mg + 2 "Telescope live_grep theme=dropdown" + :desc "Find Text"} + {1 :mp + 2 "Telescope buffers theme=dropdown previewer=false initial_mode=normal" + :desc "Switch Buffer"} + {1 :fC + 2 "Telescope commands theme=dropdown" + :desc :Commands} + {1 :fH + 2 "Telescope highlights" + :desc :Highlights} + {1 :fR + 2 "Telescope registers theme=dropdown" + :desc :Registers} + {1 :fS + 2 "Telescope grep_string theme=dropdown" + :desc "Find String"} + {1 :gb + 2 "Telescope git_branches theme=dropdown" + :desc "Checkout Branch"} + {1 :ff 2 :FindFiles :desc "Find files"} + {1 :fh + 2 "Telescope help_tags theme=dropdown" + :desc :Help} + {1 :fk + 2 "Telescope keymaps theme=dropdown" + :desc :Keymaps} + {1 :fl + 2 "Telescope resume theme=dropdown" + :desc "Last Search"} + {1 :fp + 2 "Telescope projects theme=dropdown" + :desc "Find Project"} + {1 :fr + 2 "Telescope oldfiles theme=dropdown" + :desc "Recent File"} + {1 :ft + 2 "Telescope live_grep theme=dropdown" + :desc "Find Text"} + {1 :js + 2 "Telescope diagnostics theme=dropdown" + :desc "Telescope Diagnostics"} + {1 :gc + 2 "Telescope git_commits theme=dropdown" + :desc "Checkout Commit"} + {1 :lS + 2 "Telescope lsp_dynamic_workspace_symbols" + :desc "Workspace Symbols"} + {1 :n + 2 "Telescope lsp_document_symbols theme=dropdown" + :desc "Document Symbols"}]) + +(fn config [] + (let [telescope (require :telescope) + actions (require :telescope.actions) + icons (require :icons)] + (telescope.setup {:defaults {:prompt_prefix (.. " " (. icons :telescope) + " ") + :selection_caret (.. (. icons :caret) " ") + :path_display [:smart] + :color_devicons false + :pickers {:find_files {:theme :dropdown}} + :vimgrep_arguments [:rg + :--color=never + :--no-heading + :--with-filename + :--line-number + :--column + :--smart-case + :--hidden] + :mappings {:i {: actions.cycle_history_next + : actions.cycle_history_prev + : actions.move_selection_next + : actions.move_selection_previous + : actions.close + : actions.move_selection_next + : actions.move_selection_previous + : actions.select_default + : actions.select_horizontal + : actions.select_vertical + : actions.select_tab + : actions.preview_scrolling_up + : actions.preview_scrolling_down + : actions.results_scrolling_up + : actions.results_scrolling_down + : (+ actions.toggle_selection + actions.move_selection_worse) + : (+ actions.toggle_selection + actions.move_selection_better) + : (+ actions.send_to_qflist + actions.open_qflist) + : (+ actions.send_selected_to_qflist + actions.open_qflist) + : actions.complete_tag + : actions.which_key} + :n {: actions.close + : actions.select_default + : actions.select_horizontal + : actions.select_vertical + : actions.select_tab + : (+ actions.toggle_selection + actions.move_selection_worse) + : (+ actions.toggle_selection + actions.move_selection_better) + : (+ actions.send_to_qflist + actions.open_qflist) + : (+ 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 + : actions.move_selection_next + : actions.move_selection_previous + :gg actions.move_to_top + :G actions.move_to_bottom + :q actions.close + : actions.preview_scrolling_up + : actions.preview_scrolling_down + : actions.results_scrolling_up + : 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}}}) + (load-extensions telescope))) + +{1 :nvim-telescope/telescope.nvim + :cmd :Telescope + : init + : config + : dependencies + : keys} diff --git a/fnl/plugins/textobjs.fnl b/fnl/plugins/textobjs.fnl new file mode 100644 index 0000000..8d68ac3 --- /dev/null +++ b/fnl/plugins/textobjs.fnl @@ -0,0 +1,5 @@ +;; Various text objects. + +{1 :chrisgrieser/nvim-various-textobjs + :event :BufReadPost + :opts {:useDefaultKeymaps true}} diff --git a/fnl/plugins/toggleterm.fnl b/fnl/plugins/toggleterm.fnl new file mode 100644 index 0000000..12168aa --- /dev/null +++ b/fnl/plugins/toggleterm.fnl @@ -0,0 +1,26 @@ +;; Terminal inside nvim. + +(local keys [{1 :t 2 :ToggleTerm :desc :Terminal}]) + +(local opts {:size 24 :shade_terminals false}) + +(local auto-cmds [[:TermOpen + {:pattern "term://*toggleterm#*" + :callback (fn [] + (vim.keymap.set :t : "wincmd h" + {}) + (vim.keymap.set :t : "wincmd j" + {}) + (vim.keymap.set :t : "wincmd k" + {}) + (vim.keymap.set :t : "wincmd l" + {}))}] + [:TermOpen + {:pattern ["term://*toggleterm#*"] + :command "setlocal spell!"}]]) + +(fn init [] + (let [cmds (require :util.cmds)] + (cmds.create-auto-cmds auto-cmds))) + +{1 :akinsho/toggleterm.nvim :version "*" :cmd :ToggleTerm : init : keys : opts} diff --git a/fnl/plugins/treesitter.fnl b/fnl/plugins/treesitter.fnl new file mode 100644 index 0000000..103948d --- /dev/null +++ b/fnl/plugins/treesitter.fnl @@ -0,0 +1,84 @@ +;; Treesitter is a tool for building syntax trees for source files. +;; In the neovim context it helps with better coloring. + +(local opts + {:ensure_installed [:bash + :c + :dockerfile + :fennel + :haskell + :hcl + :html + :latex + :lua + :make + :markdown + :ocaml + :org + :python + :rust + :sql + :toml + :vim + :yaml] + :sync_install false + :ignore_install [""] + :autopairs {:enable true} + :highlight {:enable true :additional_vim_regex_highlighting [:org]} + :context_commentstring {:enable true :enable_autocmd false} + :indent {:enable true :disable [:yaml :python :css]} + :playground {:enable true} + :textobjects {:select {:enable true + :lookahead true + :keymaps {:aa "@parameter.outer" + :ia "@parameter.inner" + :af "@function.outer" + :if "@function.inner" + :ii "@conditional.outer" + :ai "@conditional.inner" + :il "@loop.outer" + :al "@loop.inner" + :ac "@class.outer" + :at "@comment.outer" + :ic {:query "@class.inner" + :desc "Select inner part of a class region"} + :as {:query "@scope" + :query_group :locals + :desc "Select language scope"}} + :selection_modes {"@parameter.outer" :v + "@function.outer" :V + "@class.outer" :} + :include_surrounding_whitespace true} + :swap {:enable true + :swap_next {:a "@parameter.inner"} + :swap_previous {:A "@parameter.inner"}} + :move {:enable true + :set_jumps true + :goto_next_start {"]m" "@function.outer" + "]]" {:query "@class.outer" + :desc "Next class start"} + "]o" "@loop.*" + "]s" {:query "@scope" + :query_group :locals + :desc "Next scope"} + "]z" {:query "@fold" + :query_group :folds + :desc "Next fold"}} + :goto_next_end {"]M" "@function.outer" + "][" "@class.outer"} + :goto_previous_start {"[m" "@function.outer" + "[[" "@class.outer"} + :goto_previous_end {"[M" "@function.outer" + "[]" "@class.outer"} + :goto_next {"]i" "@conditional.outer"} + :goto_previous {"[i" "@conditional.outer"}}}}) + +(fn config [] + (let [treesitter (require :nvim-treesitter.configs)] + (treesitter.setup opts))) + +{1 :nvim-treesitter/nvim-treesitter + :dependencies [{1 :nvim-treesitter/nvim-treesitter-textobjects :lazy true}] + :build ":TSUpdate" + :event [:BufReadPost :BufNewFile] + : config} diff --git a/fnl/plugins/trouble.fnl b/fnl/plugins/trouble.fnl new file mode 100644 index 0000000..35e67a9 --- /dev/null +++ b/fnl/plugins/trouble.fnl @@ -0,0 +1,83 @@ +;; Pretty diagnostics. + +(local keys [{1 :jt + 2 "TroubleToggle workspace_diagnostics" + :desc :Trouble} + {1 "[e" + 2 "lua require(\"trouble\").previous({skip_groups = true, jump = true});" + :desc :Trouble} + {1 "[n" + 2 "lua require(\"trouble\").next({skip_groups = true, jump = true});" + :desc :Trouble}]) + +(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 : + ;; cancel the preview and get back to your last window / buffer / cursor + :refresh :r + ;; manually refresh + :jump [: :] + ;; jump to the diagnostic or open / close folds + :open_split [:] + ;; open buffer in new split + :open_vsplit [:] + ;; open buffer in new vsplit + :open_tab [:] + ;; 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. 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 + :use_diagnostic_signs true}) + +{1 :folke/trouble.nvim :cmd [:TroubleToggle :Trouble] : opts : keys} diff --git a/fnl/plugins/undotree.fnl b/fnl/plugins/undotree.fnl new file mode 100644 index 0000000..05de139 --- /dev/null +++ b/fnl/plugins/undotree.fnl @@ -0,0 +1,5 @@ +;; Tree of undo history. + +{1 :mbbill/undotree + :cmd :UndotreeToggle + :keys [{1 :u 2 :UndotreeToggle :desc :Undotree}]} diff --git a/fnl/plugins/which-key.fnl b/fnl/plugins/which-key.fnl new file mode 100644 index 0000000..9251832 --- /dev/null +++ b/fnl/plugins/which-key.fnl @@ -0,0 +1,47 @@ +;; Which-key provides a pop-up menu for some key mappings. + +(local icons (require :icons)) + +(local opts {:plugins {:marks true + :registers true + :spelling {:enabled true :suggestions 20} + :presets {:operators false + :motions false + :text_objects false + :windows true + :nav true + :z true + :g true}} + :icons {:breadcrumb (. icons :guillemet) + :separator (.. (. icons :small-right-arrow) " ") + :group "+"} + :popup_mappings {:scroll_down : :scroll_up :} + :window {:border :rounded :position :bottom :winblend 0} + :layout {:height {:min 4 :max 25} + :width {:min 20 :max 50} + :spacing 3 + :align :left} + :hidden [: : : : :call :lua "^:" "^ "] + :show_help true + :triggers :auto + :disable {:filetypes [:netrw]} + :triggers_blacklist {:i [:j :k] :v [:j :k]}}) + +(local groups {:mode [:n :v] + :d {:name :+db} + :f {:name :+find} + :g {:name :+git} + :i {:name :+diffview} + :j {:name :+diagnostics} + :l {:name :+lsp} + :o {:name :+orgmode} + :r {:name :+replace} + :s {:name :+session} + :w {:name :+worktree}}) + +(fn config [] + (let [which-key (require :which-key)] + (which-key.setup opts) + (which-key.register groups))) + +{1 :folke/which-key.nvim :event :VeryLazy : config} diff --git a/fnl/plugins/window-picker.fnl b/fnl/plugins/window-picker.fnl new file mode 100644 index 0000000..e396ce1 --- /dev/null +++ b/fnl/plugins/window-picker.fnl @@ -0,0 +1,19 @@ +;; Trim whitespaces on save. + +(local opts {:other_win_hl_color "#171717" + :fg_color "#E1E1E1" + :selection_chars :MNEIOARSTG}) + +(fn pick-window [] + (let [window-picker (require :window-picker)] + (let [win (window-picker.pick_window)] + (if (not= win nil) + (vim.api.nvim_set_current_win win))))) + +(fn config [] + (let [window-picker (require :window-picker)] + (window-picker.setup opts) + (vim.keymap.set :n : (fn [] + (pick-window)) {}))) + +{1 :s1n7ax/nvim-window-picker :event :BufReadPost :version :2.0.0 : config} diff --git a/fnl/plugins/zen.fnl b/fnl/plugins/zen.fnl new file mode 100644 index 0000000..e9a1576 --- /dev/null +++ b/fnl/plugins/zen.fnl @@ -0,0 +1,15 @@ +;; Zen mode. + +(local opts {:window {:backdrop 1 + :height 1 + :width 120 + :options {:signcolumn :no + :number false + :relativenumber false}} + :plugins {:gitsigns {:enabled false} + :tmux {:enabled true} + :twilight {:enabled true}}}) + +(local keys [{1 :gy 2 :ZenMode :desc "Zen Mode"}]) + +{1 :folke/zen-mode.nvim :cmd :ZenMode : keys : opts} -- cgit v1.2.3-70-g09d2