From 10b175f252104458d7478d8a2822818850cfdf92 Mon Sep 17 00:00:00 2001 From: Gustaf Rydholm Date: Sun, 15 Jan 2023 22:47:30 +0100 Subject: Refactor file structure --- fnl/plugins/alpha.fnl | 47 --------- fnl/plugins/autopairs.fnl | 20 ---- fnl/plugins/better-escape.fnl | 8 -- fnl/plugins/bqf.fnl | 3 - fnl/plugins/bufdel.fnl | 3 - fnl/plugins/cmp.fnl | 65 ------------- fnl/plugins/colorizer.fnl | 3 - fnl/plugins/colorscheme.fnl | 8 -- fnl/plugins/comment.fnl | 20 ---- fnl/plugins/compiler/hotpot.fnl | 3 + fnl/plugins/core/lazy.fnl | 33 +++++++ fnl/plugins/diffview.fnl | 5 - fnl/plugins/editor/autopairs.fnl | 20 ++++ fnl/plugins/editor/better-escape.fnl | 8 ++ fnl/plugins/editor/bufdel.fnl | 3 + fnl/plugins/editor/cmp.fnl | 65 +++++++++++++ fnl/plugins/editor/colorizer.fnl | 3 + fnl/plugins/editor/colorscheme.fnl | 8 ++ fnl/plugins/editor/comment.fnl | 20 ++++ fnl/plugins/editor/gitsigns.fnl | 48 ++++++++++ fnl/plugins/editor/harpoon.fnl | 25 +++++ fnl/plugins/editor/leap.fnl | 17 ++++ fnl/plugins/editor/lir.fnl | 52 ++++++++++ fnl/plugins/editor/persistence.fnl | 5 + fnl/plugins/editor/spectre.fnl | 54 +++++++++++ fnl/plugins/editor/stay-in-place.fnl | 3 + fnl/plugins/editor/surround.fnl | 3 + fnl/plugins/editor/symbols-outline.fnl | 3 + fnl/plugins/editor/telescope.fnl | 113 ++++++++++++++++++++++ fnl/plugins/editor/toggleterm.fnl | 5 + fnl/plugins/editor/treesitter.fnl | 39 ++++++++ fnl/plugins/editor/trim.fnl | 3 + fnl/plugins/editor/trouble.fnl | 81 ++++++++++++++++ fnl/plugins/editor/undotree.fnl | 3 + fnl/plugins/editor/vim-slash.fnl | 6 ++ fnl/plugins/editor/which-key.fnl | 168 +++++++++++++++++++++++++++++++++ fnl/plugins/editor/window-picker.fnl | 19 ++++ fnl/plugins/editor/zen.fnl | 11 +++ fnl/plugins/gitsigns.fnl | 48 ---------- fnl/plugins/harpoon.fnl | 25 ----- fnl/plugins/hotpot.fnl | 2 - fnl/plugins/init.fnl | 29 +++--- fnl/plugins/lazy.fnl | 33 ------- fnl/plugins/leap.fnl | 17 ---- fnl/plugins/lir.fnl | 52 ---------- fnl/plugins/lualine.fnl | 87 ----------------- fnl/plugins/minibar.fnl | 30 ------ fnl/plugins/neogit.fnl | 6 -- fnl/plugins/orgmode.fnl | 24 ----- fnl/plugins/persistence.fnl | 5 - fnl/plugins/spectre.fnl | 54 ----------- fnl/plugins/stay-in-place.fnl | 3 - fnl/plugins/surround.fnl | 3 - fnl/plugins/symbols-outline.fnl | 3 - fnl/plugins/telescope.fnl | 113 ---------------------- fnl/plugins/toggleterm.fnl | 5 - fnl/plugins/tools/diffview.fnl | 5 + fnl/plugins/tools/neogit.fnl | 6 ++ fnl/plugins/tools/orgmode.fnl | 24 +++++ fnl/plugins/treesitter.fnl | 39 -------- fnl/plugins/trim.fnl | 3 - fnl/plugins/trouble.fnl | 81 ---------------- fnl/plugins/ui/alpha.fnl | 47 +++++++++ fnl/plugins/ui/bqf.fnl | 3 + fnl/plugins/ui/lualine.fnl | 87 +++++++++++++++++ fnl/plugins/ui/minibar.fnl | 30 ++++++ fnl/plugins/undotree.fnl | 3 - fnl/plugins/vim-slash.fnl | 6 -- fnl/plugins/which-key.fnl | 168 --------------------------------- fnl/plugins/window-picker.fnl | 19 ---- fnl/plugins/zen.fnl | 11 --- fnl/settings/options.fnl | 1 + 72 files changed, 1041 insertions(+), 1034 deletions(-) delete mode 100644 fnl/plugins/alpha.fnl delete mode 100644 fnl/plugins/autopairs.fnl delete mode 100644 fnl/plugins/better-escape.fnl delete mode 100644 fnl/plugins/bqf.fnl delete mode 100644 fnl/plugins/bufdel.fnl delete mode 100644 fnl/plugins/cmp.fnl delete mode 100644 fnl/plugins/colorizer.fnl delete mode 100644 fnl/plugins/colorscheme.fnl delete mode 100644 fnl/plugins/comment.fnl create mode 100644 fnl/plugins/compiler/hotpot.fnl create mode 100644 fnl/plugins/core/lazy.fnl delete mode 100644 fnl/plugins/diffview.fnl create mode 100644 fnl/plugins/editor/autopairs.fnl create mode 100644 fnl/plugins/editor/better-escape.fnl create mode 100644 fnl/plugins/editor/bufdel.fnl create mode 100644 fnl/plugins/editor/cmp.fnl create mode 100644 fnl/plugins/editor/colorizer.fnl create mode 100644 fnl/plugins/editor/colorscheme.fnl create mode 100644 fnl/plugins/editor/comment.fnl create mode 100644 fnl/plugins/editor/gitsigns.fnl create mode 100644 fnl/plugins/editor/harpoon.fnl create mode 100644 fnl/plugins/editor/leap.fnl create mode 100644 fnl/plugins/editor/lir.fnl create mode 100644 fnl/plugins/editor/persistence.fnl create mode 100644 fnl/plugins/editor/spectre.fnl create mode 100644 fnl/plugins/editor/stay-in-place.fnl create mode 100644 fnl/plugins/editor/surround.fnl create mode 100644 fnl/plugins/editor/symbols-outline.fnl create mode 100644 fnl/plugins/editor/telescope.fnl create mode 100644 fnl/plugins/editor/toggleterm.fnl create mode 100644 fnl/plugins/editor/treesitter.fnl create mode 100644 fnl/plugins/editor/trim.fnl create mode 100644 fnl/plugins/editor/trouble.fnl create mode 100644 fnl/plugins/editor/undotree.fnl create mode 100644 fnl/plugins/editor/vim-slash.fnl create mode 100644 fnl/plugins/editor/which-key.fnl create mode 100644 fnl/plugins/editor/window-picker.fnl create mode 100644 fnl/plugins/editor/zen.fnl delete mode 100644 fnl/plugins/gitsigns.fnl delete mode 100644 fnl/plugins/harpoon.fnl delete mode 100644 fnl/plugins/hotpot.fnl delete mode 100644 fnl/plugins/lazy.fnl delete mode 100644 fnl/plugins/leap.fnl delete mode 100644 fnl/plugins/lir.fnl delete mode 100644 fnl/plugins/lualine.fnl delete mode 100644 fnl/plugins/minibar.fnl delete mode 100644 fnl/plugins/neogit.fnl delete mode 100644 fnl/plugins/orgmode.fnl delete mode 100644 fnl/plugins/persistence.fnl delete mode 100644 fnl/plugins/spectre.fnl delete mode 100644 fnl/plugins/stay-in-place.fnl delete mode 100644 fnl/plugins/surround.fnl delete mode 100644 fnl/plugins/symbols-outline.fnl delete mode 100644 fnl/plugins/telescope.fnl delete mode 100644 fnl/plugins/toggleterm.fnl create mode 100644 fnl/plugins/tools/diffview.fnl create mode 100644 fnl/plugins/tools/neogit.fnl create mode 100644 fnl/plugins/tools/orgmode.fnl delete mode 100644 fnl/plugins/treesitter.fnl delete mode 100644 fnl/plugins/trim.fnl delete mode 100644 fnl/plugins/trouble.fnl create mode 100644 fnl/plugins/ui/alpha.fnl create mode 100644 fnl/plugins/ui/bqf.fnl create mode 100644 fnl/plugins/ui/lualine.fnl create mode 100644 fnl/plugins/ui/minibar.fnl delete mode 100644 fnl/plugins/undotree.fnl delete mode 100644 fnl/plugins/vim-slash.fnl delete mode 100644 fnl/plugins/which-key.fnl delete mode 100644 fnl/plugins/window-picker.fnl delete mode 100644 fnl/plugins/zen.fnl (limited to 'fnl') diff --git a/fnl/plugins/alpha.fnl b/fnl/plugins/alpha.fnl deleted file mode 100644 index 87c45e0..0000000 --- a/fnl/plugins/alpha.fnl +++ /dev/null @@ -1,47 +0,0 @@ -;; A customizable greeter. - -(local ascii-art [" ##############..... ############## " - " ##############......############## " - " ##########..........########## " - " ##########........########## " - " ##########.......########## " - " ##########.....##########.. " - " ##########....##########..... " - " ..##########..##########......... " - " ....##########.#########............. " - " ..################JJJ............ " - " ################............. " - " ##############.JJJ.JJJJJJJJJJ " - " ############...JJ...JJ..JJ JJ " - " ##########....JJ...JJ..JJ JJ " - " ########......JJJ..JJJ JJJ JJJ " - " ###### ......... " - " ..... " - " . "]) - -(fn setup [] - (let [alpha (require :alpha)] - (let [dashboard (require :alpha.themes.dashboard)] - (set dashboard.section.header.val ascii-art) - (set dashboard.section.buttons.val - [(dashboard.button :e " New file" ":ene startinsert ") - (dashboard.button :f " Find file" - ":Telescope find_files theme=dropdown") - (dashboard.button :t " Find text" - ":Telescope live_grep theme=dropdown") - (dashboard.button :p " Find project" - ":Telescope projects theme=dropdown") - (dashboard.button :r " Recently used files" - ":Telescope oldfiles theme=dropdown") - (dashboard.button :c " Configuration" - ":e ~/.config/nvim/init.lua ") - (dashboard.button :q " Quit Neovim" ":qa")]) - (set dashboard.section.header.opts.hl :AlphaHeader) - (set dashboard.section.buttons.opts.hl :AlphaButtons) - (set dashboard.opts.opts.noautocmd true) - (alpha.setup dashboard.opts)))) - -{1 :goolord/alpha-nvim - :event :VimEnter - :config (fn [] - (setup))} diff --git a/fnl/plugins/autopairs.fnl b/fnl/plugins/autopairs.fnl deleted file mode 100644 index d1aabf6..0000000 --- a/fnl/plugins/autopairs.fnl +++ /dev/null @@ -1,20 +0,0 @@ -;; Autopairs for brackets and quote symbols. - -{1 :windwp/nvim-autopairs - :event :InsertEnter - :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}}} diff --git a/fnl/plugins/better-escape.fnl b/fnl/plugins/better-escape.fnl deleted file mode 100644 index cde61bc..0000000 --- a/fnl/plugins/better-escape.fnl +++ /dev/null @@ -1,8 +0,0 @@ -;; Better escape without nasty delay. - -{1 :max397574/better-escape.nvim - :event :BufReadPost - :opts {:mapping [:kk :jj] - :timeout vim.o.timeoutlen - :clear_empty_lines false - :keys :}} diff --git a/fnl/plugins/bqf.fnl b/fnl/plugins/bqf.fnl deleted file mode 100644 index e2b0791..0000000 --- a/fnl/plugins/bqf.fnl +++ /dev/null @@ -1,3 +0,0 @@ -;; Make Neovim's quickfix window better. - -{1 :kevinhwang91/nvim-bqf :event :BufReadPost :config true} diff --git a/fnl/plugins/bufdel.fnl b/fnl/plugins/bufdel.fnl deleted file mode 100644 index 4719a53..0000000 --- a/fnl/plugins/bufdel.fnl +++ /dev/null @@ -1,3 +0,0 @@ -;; Delete buffers. - -{1 :ojroques/nvim-bufdel :cmd :BufDel} diff --git a/fnl/plugins/cmp.fnl b/fnl/plugins/cmp.fnl deleted file mode 100644 index a062d92..0000000 --- a/fnl/plugins/cmp.fnl +++ /dev/null @@ -1,65 +0,0 @@ -;; Configuration for completion plugin. - -(fn setup [] - (let [cmp (require :cmp) - lspkind (require :lspkind) - luasnip (require :luasnip) - luasnip-vscode (require :luasnip.loaders.from_vscode)] - (luasnip-vscode.lazy_load) - (lspkind.init) - (cmp.setup {:snippet {:expand (fn [args] - (luasnip.lsp_expand args.body))} - :completion {:completopt "menu,menuone,noinsert"} - :mapping (cmp.mapping.preset.insert {: (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}) - : (cmp.mapping.confirm {:select true})}) - :sources [{:name :nvim_lsp} - {:name :nvim_lua} - {:name :luasnip} - {:name :spell} - {:name :orgmode} - {:name :buffer :keyword_length 4} - {:name :path :keyword_length 6}] - :formatting {:format (lspkind.cmp_format {:with_text true - :menu {:buffer "" - :nvim_lsp "" - :nvim_lua "" - :path "" - :luasnip ""}})} - :window {:documentation {:border ["╭" - "─" - "╮" - "│" - "╯" - "─" - "╰" - "│"]}} - :confirm_opts {:behavior cmp.ConfirmBehavior.Replace - :select false} - :experimental {:ghost_text false :native_menu false}}))) - -{1 :hrsh7th/nvim-cmp - :dependencies [:hrsh7th/cmp-buffer - :onsails/lspkind-nvim - :hrsh7th/cmp-nvim-lsp - :hrsh7th/cmp-cmdline - :L3MON4D3/LuaSnip - :rafamadriz/friendly-snippets - :hrsh7th/cmp-path - :saadparwaiz1/cmp_luasnip - :f3fora/cmp-spell] - :event :InsertEnter - :config (fn [] - (setup))} diff --git a/fnl/plugins/colorizer.fnl b/fnl/plugins/colorizer.fnl deleted file mode 100644 index 553024b..0000000 --- a/fnl/plugins/colorizer.fnl +++ /dev/null @@ -1,3 +0,0 @@ -;; Display colors of hex numbers. - -{1 :norcalli/nvim-colorizer.lua :cmd :ColorizerToggle :config true} diff --git a/fnl/plugins/colorscheme.fnl b/fnl/plugins/colorscheme.fnl deleted file mode 100644 index 40802a6..0000000 --- a/fnl/plugins/colorscheme.fnl +++ /dev/null @@ -1,8 +0,0 @@ -;; Load neovim colorscheme. - -{1 :aktersnurra/no-clown-fiesta.nvim - :opts {:styles {:type {:bold true}}} - :config (lambda [_ opts] - (let [plugin (require :no-clown-fiesta)] - (plugin.setup opts) - (plugin.load)))} diff --git a/fnl/plugins/comment.fnl b/fnl/plugins/comment.fnl deleted file mode 100644 index 63401a0..0000000 --- a/fnl/plugins/comment.fnl +++ /dev/null @@ -1,20 +0,0 @@ -;; Language aware commenting. - -{1 :numToStr/Comment.nvim - :event :BufReadPost - :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}}} diff --git a/fnl/plugins/compiler/hotpot.fnl b/fnl/plugins/compiler/hotpot.fnl new file mode 100644 index 0000000..eba8083 --- /dev/null +++ b/fnl/plugins/compiler/hotpot.fnl @@ -0,0 +1,3 @@ +;; Transpiler for fnl. + +{1 :rktjmp/hotpot.nvim} diff --git a/fnl/plugins/core/lazy.fnl b/fnl/plugins/core/lazy.fnl new file mode 100644 index 0000000..f7b8371 --- /dev/null +++ b/fnl/plugins/core/lazy.fnl @@ -0,0 +1,33 @@ +;; Lazy opts. + +(local opts {:install {:colorscheme [:no-clown-fiesta]} + :performance {:cache {:enabled true} + :rtp {:disabled_plugins [:gzip + :matchit + :netrwPlugin + :tarPlugin + :tohtml + :tutor + :zipPlugin]}} + :ui {:icons {:cmd " " + :config " " + :event " " + :ft " " + :init " " + :import " " + :keys " " + :lazy "鈴 " + :loaded "● " + :not_loaded "○ " + :plugin " " + :runtime " " + :source " " + :start " " + :task " " + :list ["● " " " " " "‒ "]}}}) + +(fn setup [plugins] + (let [lazy (require :lazy)] + (lazy.setup plugins opts))) + +{: setup} diff --git a/fnl/plugins/diffview.fnl b/fnl/plugins/diffview.fnl deleted file mode 100644 index 9978c2e..0000000 --- a/fnl/plugins/diffview.fnl +++ /dev/null @@ -1,5 +0,0 @@ -;; Inspect commits. - -{1 :sindrets/diffview.nvim - :cmd [:DiffviewFileHistory :DiffviewOpen] - :config true} diff --git a/fnl/plugins/editor/autopairs.fnl b/fnl/plugins/editor/autopairs.fnl new file mode 100644 index 0000000..d1aabf6 --- /dev/null +++ b/fnl/plugins/editor/autopairs.fnl @@ -0,0 +1,20 @@ +;; Autopairs for brackets and quote symbols. + +{1 :windwp/nvim-autopairs + :event :InsertEnter + :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}}} diff --git a/fnl/plugins/editor/better-escape.fnl b/fnl/plugins/editor/better-escape.fnl new file mode 100644 index 0000000..cde61bc --- /dev/null +++ b/fnl/plugins/editor/better-escape.fnl @@ -0,0 +1,8 @@ +;; Better escape without nasty delay. + +{1 :max397574/better-escape.nvim + :event :BufReadPost + :opts {:mapping [:kk :jj] + :timeout vim.o.timeoutlen + :clear_empty_lines false + :keys :}} diff --git a/fnl/plugins/editor/bufdel.fnl b/fnl/plugins/editor/bufdel.fnl new file mode 100644 index 0000000..4719a53 --- /dev/null +++ b/fnl/plugins/editor/bufdel.fnl @@ -0,0 +1,3 @@ +;; Delete buffers. + +{1 :ojroques/nvim-bufdel :cmd :BufDel} diff --git a/fnl/plugins/editor/cmp.fnl b/fnl/plugins/editor/cmp.fnl new file mode 100644 index 0000000..a062d92 --- /dev/null +++ b/fnl/plugins/editor/cmp.fnl @@ -0,0 +1,65 @@ +;; Configuration for completion plugin. + +(fn setup [] + (let [cmp (require :cmp) + lspkind (require :lspkind) + luasnip (require :luasnip) + luasnip-vscode (require :luasnip.loaders.from_vscode)] + (luasnip-vscode.lazy_load) + (lspkind.init) + (cmp.setup {:snippet {:expand (fn [args] + (luasnip.lsp_expand args.body))} + :completion {:completopt "menu,menuone,noinsert"} + :mapping (cmp.mapping.preset.insert {: (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}) + : (cmp.mapping.confirm {:select true})}) + :sources [{:name :nvim_lsp} + {:name :nvim_lua} + {:name :luasnip} + {:name :spell} + {:name :orgmode} + {:name :buffer :keyword_length 4} + {:name :path :keyword_length 6}] + :formatting {:format (lspkind.cmp_format {:with_text true + :menu {:buffer "" + :nvim_lsp "" + :nvim_lua "" + :path "" + :luasnip ""}})} + :window {:documentation {:border ["╭" + "─" + "╮" + "│" + "╯" + "─" + "╰" + "│"]}} + :confirm_opts {:behavior cmp.ConfirmBehavior.Replace + :select false} + :experimental {:ghost_text false :native_menu false}}))) + +{1 :hrsh7th/nvim-cmp + :dependencies [:hrsh7th/cmp-buffer + :onsails/lspkind-nvim + :hrsh7th/cmp-nvim-lsp + :hrsh7th/cmp-cmdline + :L3MON4D3/LuaSnip + :rafamadriz/friendly-snippets + :hrsh7th/cmp-path + :saadparwaiz1/cmp_luasnip + :f3fora/cmp-spell] + :event :InsertEnter + :config (fn [] + (setup))} diff --git a/fnl/plugins/editor/colorizer.fnl b/fnl/plugins/editor/colorizer.fnl new file mode 100644 index 0000000..553024b --- /dev/null +++ b/fnl/plugins/editor/colorizer.fnl @@ -0,0 +1,3 @@ +;; Display colors of hex numbers. + +{1 :norcalli/nvim-colorizer.lua :cmd :ColorizerToggle :config true} diff --git a/fnl/plugins/editor/colorscheme.fnl b/fnl/plugins/editor/colorscheme.fnl new file mode 100644 index 0000000..40802a6 --- /dev/null +++ b/fnl/plugins/editor/colorscheme.fnl @@ -0,0 +1,8 @@ +;; Load neovim colorscheme. + +{1 :aktersnurra/no-clown-fiesta.nvim + :opts {:styles {:type {:bold true}}} + :config (lambda [_ opts] + (let [plugin (require :no-clown-fiesta)] + (plugin.setup opts) + (plugin.load)))} diff --git a/fnl/plugins/editor/comment.fnl b/fnl/plugins/editor/comment.fnl new file mode 100644 index 0000000..63401a0 --- /dev/null +++ b/fnl/plugins/editor/comment.fnl @@ -0,0 +1,20 @@ +;; Language aware commenting. + +{1 :numToStr/Comment.nvim + :event :BufReadPost + :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}}} diff --git a/fnl/plugins/editor/gitsigns.fnl b/fnl/plugins/editor/gitsigns.fnl new file mode 100644 index 0000000..1ef8cbc --- /dev/null +++ b/fnl/plugins/editor/gitsigns.fnl @@ -0,0 +1,48 @@ +;; Add git signs to source files. + +(local signs {:add {:hl :GitSignsAdd + :text "|" + :numhl :GitSignsAddNr + :linehl :GitSignsAddLn} + :change {:hl :GitSignsChange + :text "|" + :numhl :GitSignsChangeNr + :linehl :GitSignsChangeLn} + :delete {:hl :GitSignsDelete + :text "_" + :numhl :GitSignsDeleteNr + :linehl :GitSignsDeleteLn} + :topdelete {:hl :GitSignsDelete + :text "‾" + :numhl :GitSignsDeleteNr + :linehl :GitSignsDeleteLn} + :changedelete {:hl :GitSignsChange + :text "~" + :numhl :GitSignsChangeNr + :linehl :GitSignsChangeLn}}) + +(local opts {: signs + :signcolumn true + :numhl false + :linehl false + :word_diff false + :watch_gitdir {:interval 1000 :follow_files true} + :attach_to_untracked true + :current_line_blame false + :current_line_blame_opts {:virt_text true + :virt_text_pos :eol + :delay 1000 + :ignore_whitespace false} + :current_line_blame_formatter_opts {:relative_time false} + :sign_priority 6 + :update_debounce 100 + :status_formatter nil + :max_file_length 40000 + :preview_config {:border :single + :style :minimal + :relative :cursor + :row 0 + :col 1} + :yadm {:enable false}}) + +{1 :lewis6991/gitsigns.nvim :event :BufReadPost : opts} diff --git a/fnl/plugins/editor/harpoon.fnl b/fnl/plugins/editor/harpoon.fnl new file mode 100644 index 0000000..7674f0b --- /dev/null +++ b/fnl/plugins/editor/harpoon.fnl @@ -0,0 +1,25 @@ +;; Harpoon files for navigation. + +(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 setup [] + (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" + {})) + +{1 :ThePrimeagen/harpoon + :event :BufReadPost + :config (fn [] + (setup))} diff --git a/fnl/plugins/editor/leap.fnl b/fnl/plugins/editor/leap.fnl new file mode 100644 index 0000000..6c2eb53 --- /dev/null +++ b/fnl/plugins/editor/leap.fnl @@ -0,0 +1,17 @@ +;; Leap through text. + +(fn setup [] + (let [leap (require :leap)] + (leap.setup {}) + (leap.set_default_keymaps))) + +{1 :ggandor/leap.nvim + :dependencies {1 :ggandor/flit.nvim + :event :BufReadPost + :opts {:keys {:f :f :F :F :t :t :T :T} + :labeled_modes :v + :multiline true + :opts {}}} + :event :BufReadPost + :config (fn [] + (setup))} diff --git a/fnl/plugins/editor/lir.fnl b/fnl/plugins/editor/lir.fnl new file mode 100644 index 0000000..8caa8e4 --- /dev/null +++ b/fnl/plugins/editor/lir.fnl @@ -0,0 +1,52 @@ +;; Simple file manager. + +(fn opts [actions mark-actions clipboard-actions] + {:show_hidden_files false + :devicons {:enable true :highlight_dirname false} + :mappings {:l actions.edit + : actions.split + :v actions.vsplit + : actions.tabedit + :h actions.up + :q actions.quit + :A actions.mkdir + :a actions.newfile + :r actions.rename + "@" actions.cd + :Y actions.yank_path + :i actions.toggle_show_hidden + :d actions.delete + :J (fn [] + (mark-actions.toggle_mark) + (vim.cmd "normal! j")) + :c clipboard-actions.copy + :x clipboard-actions.cut + :p clipboard-actions.paste} + :float {:winblend 0 + :curdir_window {:enable false :highlight_dirname true} + :win_opts (fn [] + (let [width (math.floor (* vim.o.columns 0.7)) + height (math.floor (* vim.o.lines 0.7))] + {:border :rounded : width : height}))} + :hide_cursor false + :on_init (fn [] + (vim.api.nvim_buf_set_keymap 0 :x :J + ":lua require(\"lir.mark.actions\").toggle_mark(\"v\")" + {:noremap true :silent true}))}) + +(fn setup [] + (let [actions (require :lir.actions) + clipboard-actions (require :lir.clipboard.actions) + mark-actions (require :lir.mark.actions) + lir (require :lir)] + (tset vim.g :loaded_netrw 1) + (tset vim.g :loaded_netrwPlugin 1) + (lir.setup (opts actions mark-actions clipboard-actions)) + (vim.keymap.set :n "-" ":lua require'lir.float'.toggle()" + {:noremap true :silent true}))) + +{1 :tamago324/lir.nvim + :keys "-" + :config (fn [] + (setup)) + :dependencies [:kyazdani42/nvim-web-devicons]} diff --git a/fnl/plugins/editor/persistence.fnl b/fnl/plugins/editor/persistence.fnl new file mode 100644 index 0000000..4cde73e --- /dev/null +++ b/fnl/plugins/editor/persistence.fnl @@ -0,0 +1,5 @@ +;; Session manager. + +{1 :folke/persistence.nvim + :event :VeryLazy + :opts {:options [:buffers :curdir :tabpages :winsize :help]}} diff --git a/fnl/plugins/editor/spectre.fnl b/fnl/plugins/editor/spectre.fnl new file mode 100644 index 0000000..92a33ba --- /dev/null +++ b/fnl/plugins/editor/spectre.fnl @@ -0,0 +1,54 @@ +;; Find and replace. + +(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}) + +{1 :windwp/nvim-spectre :event :BufReadPost : opts} diff --git a/fnl/plugins/editor/stay-in-place.fnl b/fnl/plugins/editor/stay-in-place.fnl new file mode 100644 index 0000000..b264a05 --- /dev/null +++ b/fnl/plugins/editor/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/editor/surround.fnl b/fnl/plugins/editor/surround.fnl new file mode 100644 index 0000000..e8fda32 --- /dev/null +++ b/fnl/plugins/editor/surround.fnl @@ -0,0 +1,3 @@ +;; Surround selections. + +{1 :kylechui/nvim-surround :event :InsertEnter :config true} diff --git a/fnl/plugins/editor/symbols-outline.fnl b/fnl/plugins/editor/symbols-outline.fnl new file mode 100644 index 0000000..4195de0 --- /dev/null +++ b/fnl/plugins/editor/symbols-outline.fnl @@ -0,0 +1,3 @@ +;; List tree of symbols. + +{1 :simrat39/symbols-outline.nvim :cmd :SymbolsOutline :config true} diff --git a/fnl/plugins/editor/telescope.fnl b/fnl/plugins/editor/telescope.fnl new file mode 100644 index 0000000..df8c031 --- /dev/null +++ b/fnl/plugins/editor/telescope.fnl @@ -0,0 +1,113 @@ +;; Telescope a highly extendable fuzzy finder over lists. + +(fn setup [] + (let [telescope (require :telescope) + actions (require :telescope.actions)] + (telescope.setup {:defaults {:prompt_prefix "  " + :selection_caret "> " + :path_display [:smart] + :color_devicons false + :vimgrep_arguments [:rg + :--color=never + :--no-heading + :--with-filename + :--line-number + :--column + :--smart-case + :--hidden] + :mappings {:i {: 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}}}) + (telescope.load_extension :fzf) + (telescope.load_extension :frecency) + (telescope.load_extension :orgmode) + (telescope.load_extension :projects) + (telescope.load_extension :harpoon))) + +{1 :nvim-telescope/telescope.nvim + :cmd :Telescope + :dependencies [:nvim-lua/popup.nvim + :nvim-telescope/telescope-frecency.nvim + {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] + :config (fn [] + (setup))} diff --git a/fnl/plugins/editor/toggleterm.fnl b/fnl/plugins/editor/toggleterm.fnl new file mode 100644 index 0000000..d75aea1 --- /dev/null +++ b/fnl/plugins/editor/toggleterm.fnl @@ -0,0 +1,5 @@ +;; Terminal inside nvim. + +{1 :akinsho/toggleterm.nvim + :cmd :ToggleTerm + :opts {:size 16 :shade_terminals false}} diff --git a/fnl/plugins/editor/treesitter.fnl b/fnl/plugins/editor/treesitter.fnl new file mode 100644 index 0000000..1d96a13 --- /dev/null +++ b/fnl/plugins/editor/treesitter.fnl @@ -0,0 +1,39 @@ +;; Treesitter is a tool for building syntax trees for source files. +;; In the neovim context it helps with better coloring. + +(local opts {:ensure_installed [:c + :rust + :lua + :hcl + :org + :haskell + :python + :fennel + :make + :go + :ocaml + :erlang + :vim + :yaml + :html + :toml + :dockerfile + :markdown + :latex] + :sync_install false + :ignore_install [""] + :autopairs {:enable true} + :highlight {:enable true :disable [:org]} + :context_commentstring {:enable true :enable_autocmd false} + :indent {:enable true :disable [:yaml :python :css]} + :playground {:enable true}}) + +(fn setup [] + (let [treesitter (require :nvim-treesitter.configs)] + (treesitter.setup opts))) + +{1 :nvim-treesitter/nvim-treesitter + :build ":TSUpdate" + :event :BufReadPost + :config (fn [] + (setup))} diff --git a/fnl/plugins/editor/trim.fnl b/fnl/plugins/editor/trim.fnl new file mode 100644 index 0000000..7f224bc --- /dev/null +++ b/fnl/plugins/editor/trim.fnl @@ -0,0 +1,3 @@ +;; Trim whitespaces on save. + +{1 :cappyzawa/trim.nvim :event :BufFilePre :opts {:disable [:python]}} diff --git a/fnl/plugins/editor/trouble.fnl b/fnl/plugins/editor/trouble.fnl new file mode 100644 index 0000000..3f736bb --- /dev/null +++ b/fnl/plugins/editor/trouble.fnl @@ -0,0 +1,81 @@ +;; Pretty diagnostics. + +(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 + :signs {;; icons / text used for a diagnostic + :error "" + :warning "" + :hint "" + :information "" + :other "﫠"} + :use_diagnostic_signs false + ;; enabling this will use the signs defined in your lsp client + }) + +{1 :folke/trouble.nvim :cmd :TroubleToggle : opts} diff --git a/fnl/plugins/editor/undotree.fnl b/fnl/plugins/editor/undotree.fnl new file mode 100644 index 0000000..9aa8114 --- /dev/null +++ b/fnl/plugins/editor/undotree.fnl @@ -0,0 +1,3 @@ +;; Tree of undo history. + +{1 :mbbill/undotree :cmd :UndotreeToggle} diff --git a/fnl/plugins/editor/vim-slash.fnl b/fnl/plugins/editor/vim-slash.fnl new file mode 100644 index 0000000..6f50ae4 --- /dev/null +++ b/fnl/plugins/editor/vim-slash.fnl @@ -0,0 +1,6 @@ +;; Provides a set of mappings for enhancing in-buffer search experience. + +{1 :junegunn/vim-slash + :event :BufReadPost + :config (fn [] + (vim.cmd "noremap (slash-after) zz"))} diff --git a/fnl/plugins/editor/which-key.fnl b/fnl/plugins/editor/which-key.fnl new file mode 100644 index 0000000..0b6389c --- /dev/null +++ b/fnl/plugins/editor/which-key.fnl @@ -0,0 +1,168 @@ +;; Which-key provides a pop-up menu for some key mappings. + +(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 "»" :separator "" :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} + :ignore_missing true + :hidden [: : : : :call :lua "^:" "^ "] + :show_help true + :triggers :auto + :disable {:filetypes [:netrw]} + :triggers_blacklist {:i [:j :k] :v [:j :k]}}) + +(local mopts {:mode :n + :prefix :m + :buffer nil + :silent true + :noremap true + :nowait true}) + +(local mmappings {:a [:HarpoonAdd :Harpoon] + :d [:DiffviewFileHistory :DiffviewFileHistory] + :f [:FindFiles "Find files"] + :g ["Telescope live_grep theme=dropdown" + "Find text"] + :n [:Neogit :Neogit] + :q ["Gitsigns diffthis HEAD" "Gitsigns diff"] + :r [:HarpoonUI "Harpoon UI"] + :s [:HarpoonPrev "Harpoon Prev"] + :t [:HarpoonNext "Harpoon Next"] + :v ["lua vim.lsp.buf.rename()" :Rename] + :x ["DiffviewOpen -uno" :DiffviewOpen] + :z [:DiffviewClose :DiffviewClose]}) + +(local nopts {:mode :n + :prefix : + :buffer nil + :silent true + :noremap true + :nowait true}) + +(local find + {:name :find + :C ["Telescope commands theme=dropdown" :Commands] + :H ["Telescope highlights" :Highlights] + :R ["Telescope registers theme=dropdown" :Registers] + :S ["Telescope grep_string theme=dropdown" "Find String"] + :b ["Telescope git_branches theme=dropdown" "Checkout branch"] + :c ["Telescope colorscheme theme=dropdown" :Colorscheme] + :f [:FindFiles "Find files"] + :h ["Telescope help_tags theme=dropdown" :Help] + :k ["Telescope keymaps theme=dropdown" :Keymaps] + :l ["Telescope resume theme=dropdown" "Last Search"] + :p ["Telescope projects theme=dropdown" "Find project"] + :r ["Telescope oldfiles theme=dropdown" "Recent File"] + :t ["Telescope live_grep theme=dropdown" "Find text"]}) + +(local diagnostics {:name :diagnostics + :t [:TroubleToggle :Trouble] + :g ["Telescope diagnostics theme=dropdown" + "Telescope diagnostics"]}) + +(local git {:name :git + :R ["lua require 'gitsigns'.reset_buffer()" + "Reset Buffer"] + :b ["Telescope git_branches theme=dropdown" + "Checkout branch"] + :c ["Telescope git_commits theme=dropdown" + "Checkout commit"] + :d ["Gitsigns diffthis HEAD" :Diff] + :j ["lua require 'gitsigns'.next_hunk()" "Next Hunk"] + :k ["lua require 'gitsigns'.prev_hunk()" "Prev Hunk"] + :l ["lua require 'gitsigns'.blame_line()" :Blame] + :o ["Telescope git_status theme=dropdown" + "Open changed file"] + :p ["lua require 'gitsigns'.preview_hunk()" + "Preview Hunk"] + :r ["lua require 'gitsigns'.reset_hunk()" "Reset Hunk"] + :s ["lua require 'gitsigns'.stage_hunk()" "Stage Hunk"] + :u ["lua require 'gitsigns'.undo_stage_hunk()" + "Undo Stage Hunk"]}) + +(local lsp + {:name :lsp + :S ["Telescope lsp_dynamic_workspace_symbols" + "Workspace Symbols"] + :a ["lua vim.lsp.buf.code_action()" "Code Action"] + :f ["lua vim.lsp.buf.format { async = true }" :Format] + :i [:LspInfo :Info] + :l ["lua vim.lsp.codelens.run()" "CodeLens Action"] + :r ["lua vim.lsp.buf.rename()" :Rename] + :s ["Telescope lsp_document_symbols" "Document Symbols"]}) + +(local replace {:name :replace + :m [:ReplaceInBuf "Replace in Buffer"] + :n [:Replace :Replace] + :e [:ReplaceWord "Replace Word"]}) + +(local session + {:name :session + :m [:RestoreSession "Restore session"] + :n [:RestoreLastSession "Restore last session"] + :e [:IgnoreSession "Ignore current session"]}) + +(local treesitter + {:name :Treesitter :p [:TSPlaygroundToggle :Playground]}) + +(local nmappings {:a ["Telescope lsp_document_symbols theme=dropdown" + "Document Symbols"] + :T treesitter + : [:BufDel "Close Buffer"] + :j diagnostics + :f find + :g git + :h [:ColorizerToggle :Colorizer] + :l lsp + :m [:Mason :Mason] + :n [:SymbolsOutline "Symbols outline"] + :r replace + :s session + :t [:ToggleTerm :Terminal] + :u [:UndotreeToggle :Undotree] + :y ["Lazy home" :Home] + :z [:ZenMode "Zen Mode"]}) + +(local vopts {:mode :v + :prefix : + :buffer nil + :silent true + :noremap true + :nowait true}) + +(local gopts {:mode :n + :prefix :g + :buffer nil + :silent true + :noremap true + :nowait true}) + +(local gmappings {:a [:OrgAgendaPrompt "Open agenda prompt"] + :c [:OrgCapturePrompt "Open capture prompt"] + :m ["Telescope orgmode search_headings theme=dropdown" + "Search headings"]}) + +(fn setup [] + (let [which-key (require :which-key)] + (which-key.setup opts) + (which-key.register mmappings mopts) + (which-key.register nmappings nopts) + (which-key.register gmappings gopts))) + +{1 :folke/which-key.nvim + :event :VeryLazy + :config (fn [] + (setup))} diff --git a/fnl/plugins/editor/window-picker.fnl b/fnl/plugins/editor/window-picker.fnl new file mode 100644 index 0000000..2820409 --- /dev/null +++ b/fnl/plugins/editor/window-picker.fnl @@ -0,0 +1,19 @@ +;; Trim whitespaces on save. + +(fn pick-window [opts] + (let [window-picker (require :window-picker)] + (let [win (window-picker.pick_window)] + (if (not= win nil) + (vim.api.nvim_set_current_win win))))) + +{1 :s1n7ax/nvim-window-picker + :event :BufReadPost + :opts {:other_win_hl_color "#171717" + :fg_color "#E1E1E1" + :selection_chars :MNEIOARSTG} + :config (lambda [_ opts] + (let [window-picker (require :window-picker)] + (window-picker.setup opts) + (vim.keymap.set :n : + (fn [] + (pick-window)) {})))} diff --git a/fnl/plugins/editor/zen.fnl b/fnl/plugins/editor/zen.fnl new file mode 100644 index 0000000..6e9bee7 --- /dev/null +++ b/fnl/plugins/editor/zen.fnl @@ -0,0 +1,11 @@ +;; Zen mode. + +{1 :folke/zen-mode.nvim + :cmd :ZenMode + :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}}}} diff --git a/fnl/plugins/gitsigns.fnl b/fnl/plugins/gitsigns.fnl deleted file mode 100644 index 1ef8cbc..0000000 --- a/fnl/plugins/gitsigns.fnl +++ /dev/null @@ -1,48 +0,0 @@ -;; Add git signs to source files. - -(local signs {:add {:hl :GitSignsAdd - :text "|" - :numhl :GitSignsAddNr - :linehl :GitSignsAddLn} - :change {:hl :GitSignsChange - :text "|" - :numhl :GitSignsChangeNr - :linehl :GitSignsChangeLn} - :delete {:hl :GitSignsDelete - :text "_" - :numhl :GitSignsDeleteNr - :linehl :GitSignsDeleteLn} - :topdelete {:hl :GitSignsDelete - :text "‾" - :numhl :GitSignsDeleteNr - :linehl :GitSignsDeleteLn} - :changedelete {:hl :GitSignsChange - :text "~" - :numhl :GitSignsChangeNr - :linehl :GitSignsChangeLn}}) - -(local opts {: signs - :signcolumn true - :numhl false - :linehl false - :word_diff false - :watch_gitdir {:interval 1000 :follow_files true} - :attach_to_untracked true - :current_line_blame false - :current_line_blame_opts {:virt_text true - :virt_text_pos :eol - :delay 1000 - :ignore_whitespace false} - :current_line_blame_formatter_opts {:relative_time false} - :sign_priority 6 - :update_debounce 100 - :status_formatter nil - :max_file_length 40000 - :preview_config {:border :single - :style :minimal - :relative :cursor - :row 0 - :col 1} - :yadm {:enable false}}) - -{1 :lewis6991/gitsigns.nvim :event :BufReadPost : opts} diff --git a/fnl/plugins/harpoon.fnl b/fnl/plugins/harpoon.fnl deleted file mode 100644 index 7674f0b..0000000 --- a/fnl/plugins/harpoon.fnl +++ /dev/null @@ -1,25 +0,0 @@ -;; Harpoon files for navigation. - -(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 setup [] - (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" - {})) - -{1 :ThePrimeagen/harpoon - :event :BufReadPost - :config (fn [] - (setup))} diff --git a/fnl/plugins/hotpot.fnl b/fnl/plugins/hotpot.fnl deleted file mode 100644 index 9c2dbce..0000000 --- a/fnl/plugins/hotpot.fnl +++ /dev/null @@ -1,2 +0,0 @@ -;; Transpiler for fnl. -{1 :rktjmp/hotpot.nvim} diff --git a/fnl/plugins/init.fnl b/fnl/plugins/init.fnl index 6b0bde8..00be90b 100644 --- a/fnl/plugins/init.fnl +++ b/fnl/plugins/init.fnl @@ -1,16 +1,21 @@ ;; Load all plugins. -(local plugins (let [plugins (require :plugins.lsp) - path (.. (vim.fn.stdpath :config) :/fnl/plugins)] - (if (vim.loop.fs_stat path) - (do - (each [fname (vim.fs.dir path)] - (let [fname (fname:match "^(.*)%.fnl$")] - (if (and (not= fname nil) (not= fname :init) - (not= fname :lazy)) - (table.insert plugins - (require (.. :plugins. fname)))))))) - plugins)) +(fn get-plugins [...] + (let [plugins [] + path (.. (vim.fn.stdpath :config) :/fnl/plugins)] + (each [_ m (ipairs [...])] + (let [module-path (.. path "/" m)] + (if (vim.loop.fs_stat module-path) + (do + (if (= :lsp m) + (table.insert plugins (require (.. :plugins. m))) + (each [fname (vim.fs.dir module-path)] + (let [fname (fname:match "^(.*)%.fnl$")] + (table.insert plugins + (require (.. :plugins. m "." fname)))))))))) + (vim.tbl_flatten plugins) + plugins)) -(let [lazy (require :plugins.lazy)] +(let [lazy (require :plugins.core.lazy) + plugins (get-plugins :compiler :editor :lsp :tools :ui)] (lazy.setup plugins)) diff --git a/fnl/plugins/lazy.fnl b/fnl/plugins/lazy.fnl deleted file mode 100644 index f7b8371..0000000 --- a/fnl/plugins/lazy.fnl +++ /dev/null @@ -1,33 +0,0 @@ -;; Lazy opts. - -(local opts {:install {:colorscheme [:no-clown-fiesta]} - :performance {:cache {:enabled true} - :rtp {:disabled_plugins [:gzip - :matchit - :netrwPlugin - :tarPlugin - :tohtml - :tutor - :zipPlugin]}} - :ui {:icons {:cmd " " - :config " " - :event " " - :ft " " - :init " " - :import " " - :keys " " - :lazy "鈴 " - :loaded "● " - :not_loaded "○ " - :plugin " " - :runtime " " - :source " " - :start " " - :task " " - :list ["● " " " " " "‒ "]}}}) - -(fn setup [plugins] - (let [lazy (require :lazy)] - (lazy.setup plugins opts))) - -{: setup} diff --git a/fnl/plugins/leap.fnl b/fnl/plugins/leap.fnl deleted file mode 100644 index 6c2eb53..0000000 --- a/fnl/plugins/leap.fnl +++ /dev/null @@ -1,17 +0,0 @@ -;; Leap through text. - -(fn setup [] - (let [leap (require :leap)] - (leap.setup {}) - (leap.set_default_keymaps))) - -{1 :ggandor/leap.nvim - :dependencies {1 :ggandor/flit.nvim - :event :BufReadPost - :opts {:keys {:f :f :F :F :t :t :T :T} - :labeled_modes :v - :multiline true - :opts {}}} - :event :BufReadPost - :config (fn [] - (setup))} diff --git a/fnl/plugins/lir.fnl b/fnl/plugins/lir.fnl deleted file mode 100644 index 8caa8e4..0000000 --- a/fnl/plugins/lir.fnl +++ /dev/null @@ -1,52 +0,0 @@ -;; Simple file manager. - -(fn opts [actions mark-actions clipboard-actions] - {:show_hidden_files false - :devicons {:enable true :highlight_dirname false} - :mappings {:l actions.edit - : actions.split - :v actions.vsplit - : actions.tabedit - :h actions.up - :q actions.quit - :A actions.mkdir - :a actions.newfile - :r actions.rename - "@" actions.cd - :Y actions.yank_path - :i actions.toggle_show_hidden - :d actions.delete - :J (fn [] - (mark-actions.toggle_mark) - (vim.cmd "normal! j")) - :c clipboard-actions.copy - :x clipboard-actions.cut - :p clipboard-actions.paste} - :float {:winblend 0 - :curdir_window {:enable false :highlight_dirname true} - :win_opts (fn [] - (let [width (math.floor (* vim.o.columns 0.7)) - height (math.floor (* vim.o.lines 0.7))] - {:border :rounded : width : height}))} - :hide_cursor false - :on_init (fn [] - (vim.api.nvim_buf_set_keymap 0 :x :J - ":lua require(\"lir.mark.actions\").toggle_mark(\"v\")" - {:noremap true :silent true}))}) - -(fn setup [] - (let [actions (require :lir.actions) - clipboard-actions (require :lir.clipboard.actions) - mark-actions (require :lir.mark.actions) - lir (require :lir)] - (tset vim.g :loaded_netrw 1) - (tset vim.g :loaded_netrwPlugin 1) - (lir.setup (opts actions mark-actions clipboard-actions)) - (vim.keymap.set :n "-" ":lua require'lir.float'.toggle()" - {:noremap true :silent true}))) - -{1 :tamago324/lir.nvim - :keys "-" - :config (fn [] - (setup)) - :dependencies [:kyazdani42/nvim-web-devicons]} diff --git a/fnl/plugins/lualine.fnl b/fnl/plugins/lualine.fnl deleted file mode 100644 index 7373704..0000000 --- a/fnl/plugins/lualine.fnl +++ /dev/null @@ -1,87 +0,0 @@ -;; Statusbar. - -(local disable [:neogitstatus - :netrw - :lir - :lazy - :alpha - :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)] - (if (not= client.name :null-ls) - (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 " " :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 " " - :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 []}) - -{1 :nvim-lualine/lualine.nvim - :event :BufReadPost - : opts - :dependencies [:kyazdani42/nvim-web-devicons :arkav/lualine-lsp-progress]} diff --git a/fnl/plugins/minibar.fnl b/fnl/plugins/minibar.fnl deleted file mode 100644 index 0dff6d6..0000000 --- a/fnl/plugins/minibar.fnl +++ /dev/null @@ -1,30 +0,0 @@ -;; Show the filename in the top left corner. - -{1 :aktersnurra/minibar.nvim - :event :BufReadPre - :opts {:ignore-filetypes [:help - :harpoon - :startify - :dashboard - :lir - :alpha - :packer - :neogitstatus - :Trouble - :org - :lazy - :netrw - :Outline - :NeogitStatus - :NeogitCommitMessage - :NeogitNotification - :NeogitCommitView - :spectre_panel - ""] - :events [:CursorMoved - :TermOpen - :DirChanged - :BufWinEnter - :BufFilePost - :InsertEnter - :BufWritePost]}} diff --git a/fnl/plugins/neogit.fnl b/fnl/plugins/neogit.fnl deleted file mode 100644 index b7c1633..0000000 --- a/fnl/plugins/neogit.fnl +++ /dev/null @@ -1,6 +0,0 @@ -;; Git ui. - -{1 :TimUntersberger/neogit - :cmd :Neogit - :dependencies [:nvim-lua/plenary.nvim] - :config true} diff --git a/fnl/plugins/orgmode.fnl b/fnl/plugins/orgmode.fnl deleted file mode 100644 index 99e55be..0000000 --- a/fnl/plugins/orgmode.fnl +++ /dev/null @@ -1,24 +0,0 @@ -;; Orgmode for nvim. - -(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 setup [] - (let [orgmode (require :orgmode)] - (tset vim.opt :conceallevel 2) - (tset vim.opt :concealcursor :nc) - (orgmode.setup_ts_grammar) - (orgmode.setup opts))) - -{1 :nvim-orgmode/orgmode - :event :BufReadPost - :config (fn [] - (setup))} diff --git a/fnl/plugins/persistence.fnl b/fnl/plugins/persistence.fnl deleted file mode 100644 index 4cde73e..0000000 --- a/fnl/plugins/persistence.fnl +++ /dev/null @@ -1,5 +0,0 @@ -;; Session manager. - -{1 :folke/persistence.nvim - :event :VeryLazy - :opts {:options [:buffers :curdir :tabpages :winsize :help]}} diff --git a/fnl/plugins/spectre.fnl b/fnl/plugins/spectre.fnl deleted file mode 100644 index 92a33ba..0000000 --- a/fnl/plugins/spectre.fnl +++ /dev/null @@ -1,54 +0,0 @@ -;; Find and replace. - -(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}) - -{1 :windwp/nvim-spectre :event :BufReadPost : opts} diff --git a/fnl/plugins/stay-in-place.fnl b/fnl/plugins/stay-in-place.fnl deleted file mode 100644 index b264a05..0000000 --- a/fnl/plugins/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/surround.fnl b/fnl/plugins/surround.fnl deleted file mode 100644 index e8fda32..0000000 --- a/fnl/plugins/surround.fnl +++ /dev/null @@ -1,3 +0,0 @@ -;; Surround selections. - -{1 :kylechui/nvim-surround :event :InsertEnter :config true} diff --git a/fnl/plugins/symbols-outline.fnl b/fnl/plugins/symbols-outline.fnl deleted file mode 100644 index 4195de0..0000000 --- a/fnl/plugins/symbols-outline.fnl +++ /dev/null @@ -1,3 +0,0 @@ -;; List tree of symbols. - -{1 :simrat39/symbols-outline.nvim :cmd :SymbolsOutline :config true} diff --git a/fnl/plugins/telescope.fnl b/fnl/plugins/telescope.fnl deleted file mode 100644 index df8c031..0000000 --- a/fnl/plugins/telescope.fnl +++ /dev/null @@ -1,113 +0,0 @@ -;; Telescope a highly extendable fuzzy finder over lists. - -(fn setup [] - (let [telescope (require :telescope) - actions (require :telescope.actions)] - (telescope.setup {:defaults {:prompt_prefix "  " - :selection_caret "> " - :path_display [:smart] - :color_devicons false - :vimgrep_arguments [:rg - :--color=never - :--no-heading - :--with-filename - :--line-number - :--column - :--smart-case - :--hidden] - :mappings {:i {: 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}}}) - (telescope.load_extension :fzf) - (telescope.load_extension :frecency) - (telescope.load_extension :orgmode) - (telescope.load_extension :projects) - (telescope.load_extension :harpoon))) - -{1 :nvim-telescope/telescope.nvim - :cmd :Telescope - :dependencies [:nvim-lua/popup.nvim - :nvim-telescope/telescope-frecency.nvim - {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] - :config (fn [] - (setup))} diff --git a/fnl/plugins/toggleterm.fnl b/fnl/plugins/toggleterm.fnl deleted file mode 100644 index d75aea1..0000000 --- a/fnl/plugins/toggleterm.fnl +++ /dev/null @@ -1,5 +0,0 @@ -;; Terminal inside nvim. - -{1 :akinsho/toggleterm.nvim - :cmd :ToggleTerm - :opts {:size 16 :shade_terminals false}} diff --git a/fnl/plugins/tools/diffview.fnl b/fnl/plugins/tools/diffview.fnl new file mode 100644 index 0000000..9978c2e --- /dev/null +++ b/fnl/plugins/tools/diffview.fnl @@ -0,0 +1,5 @@ +;; Inspect commits. + +{1 :sindrets/diffview.nvim + :cmd [:DiffviewFileHistory :DiffviewOpen] + :config true} diff --git a/fnl/plugins/tools/neogit.fnl b/fnl/plugins/tools/neogit.fnl new file mode 100644 index 0000000..b7c1633 --- /dev/null +++ b/fnl/plugins/tools/neogit.fnl @@ -0,0 +1,6 @@ +;; Git ui. + +{1 :TimUntersberger/neogit + :cmd :Neogit + :dependencies [:nvim-lua/plenary.nvim] + :config true} diff --git a/fnl/plugins/tools/orgmode.fnl b/fnl/plugins/tools/orgmode.fnl new file mode 100644 index 0000000..99e55be --- /dev/null +++ b/fnl/plugins/tools/orgmode.fnl @@ -0,0 +1,24 @@ +;; Orgmode for nvim. + +(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 setup [] + (let [orgmode (require :orgmode)] + (tset vim.opt :conceallevel 2) + (tset vim.opt :concealcursor :nc) + (orgmode.setup_ts_grammar) + (orgmode.setup opts))) + +{1 :nvim-orgmode/orgmode + :event :BufReadPost + :config (fn [] + (setup))} diff --git a/fnl/plugins/treesitter.fnl b/fnl/plugins/treesitter.fnl deleted file mode 100644 index 1d96a13..0000000 --- a/fnl/plugins/treesitter.fnl +++ /dev/null @@ -1,39 +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 [:c - :rust - :lua - :hcl - :org - :haskell - :python - :fennel - :make - :go - :ocaml - :erlang - :vim - :yaml - :html - :toml - :dockerfile - :markdown - :latex] - :sync_install false - :ignore_install [""] - :autopairs {:enable true} - :highlight {:enable true :disable [:org]} - :context_commentstring {:enable true :enable_autocmd false} - :indent {:enable true :disable [:yaml :python :css]} - :playground {:enable true}}) - -(fn setup [] - (let [treesitter (require :nvim-treesitter.configs)] - (treesitter.setup opts))) - -{1 :nvim-treesitter/nvim-treesitter - :build ":TSUpdate" - :event :BufReadPost - :config (fn [] - (setup))} diff --git a/fnl/plugins/trim.fnl b/fnl/plugins/trim.fnl deleted file mode 100644 index 7f224bc..0000000 --- a/fnl/plugins/trim.fnl +++ /dev/null @@ -1,3 +0,0 @@ -;; Trim whitespaces on save. - -{1 :cappyzawa/trim.nvim :event :BufFilePre :opts {:disable [:python]}} diff --git a/fnl/plugins/trouble.fnl b/fnl/plugins/trouble.fnl deleted file mode 100644 index 3f736bb..0000000 --- a/fnl/plugins/trouble.fnl +++ /dev/null @@ -1,81 +0,0 @@ -;; Pretty diagnostics. - -(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 - :signs {;; icons / text used for a diagnostic - :error "" - :warning "" - :hint "" - :information "" - :other "﫠"} - :use_diagnostic_signs false - ;; enabling this will use the signs defined in your lsp client - }) - -{1 :folke/trouble.nvim :cmd :TroubleToggle : opts} diff --git a/fnl/plugins/ui/alpha.fnl b/fnl/plugins/ui/alpha.fnl new file mode 100644 index 0000000..87c45e0 --- /dev/null +++ b/fnl/plugins/ui/alpha.fnl @@ -0,0 +1,47 @@ +;; A customizable greeter. + +(local ascii-art [" ##############..... ############## " + " ##############......############## " + " ##########..........########## " + " ##########........########## " + " ##########.......########## " + " ##########.....##########.. " + " ##########....##########..... " + " ..##########..##########......... " + " ....##########.#########............. " + " ..################JJJ............ " + " ################............. " + " ##############.JJJ.JJJJJJJJJJ " + " ############...JJ...JJ..JJ JJ " + " ##########....JJ...JJ..JJ JJ " + " ########......JJJ..JJJ JJJ JJJ " + " ###### ......... " + " ..... " + " . "]) + +(fn setup [] + (let [alpha (require :alpha)] + (let [dashboard (require :alpha.themes.dashboard)] + (set dashboard.section.header.val ascii-art) + (set dashboard.section.buttons.val + [(dashboard.button :e " New file" ":ene startinsert ") + (dashboard.button :f " Find file" + ":Telescope find_files theme=dropdown") + (dashboard.button :t " Find text" + ":Telescope live_grep theme=dropdown") + (dashboard.button :p " Find project" + ":Telescope projects theme=dropdown") + (dashboard.button :r " Recently used files" + ":Telescope oldfiles theme=dropdown") + (dashboard.button :c " Configuration" + ":e ~/.config/nvim/init.lua ") + (dashboard.button :q " Quit Neovim" ":qa")]) + (set dashboard.section.header.opts.hl :AlphaHeader) + (set dashboard.section.buttons.opts.hl :AlphaButtons) + (set dashboard.opts.opts.noautocmd true) + (alpha.setup dashboard.opts)))) + +{1 :goolord/alpha-nvim + :event :VimEnter + :config (fn [] + (setup))} diff --git a/fnl/plugins/ui/bqf.fnl b/fnl/plugins/ui/bqf.fnl new file mode 100644 index 0000000..e2b0791 --- /dev/null +++ b/fnl/plugins/ui/bqf.fnl @@ -0,0 +1,3 @@ +;; Make Neovim's quickfix window better. + +{1 :kevinhwang91/nvim-bqf :event :BufReadPost :config true} diff --git a/fnl/plugins/ui/lualine.fnl b/fnl/plugins/ui/lualine.fnl new file mode 100644 index 0000000..7373704 --- /dev/null +++ b/fnl/plugins/ui/lualine.fnl @@ -0,0 +1,87 @@ +;; Statusbar. + +(local disable [:neogitstatus + :netrw + :lir + :lazy + :alpha + :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)] + (if (not= client.name :null-ls) + (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 " " :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 " " + :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 []}) + +{1 :nvim-lualine/lualine.nvim + :event :BufReadPost + : opts + :dependencies [:kyazdani42/nvim-web-devicons :arkav/lualine-lsp-progress]} diff --git a/fnl/plugins/ui/minibar.fnl b/fnl/plugins/ui/minibar.fnl new file mode 100644 index 0000000..0dff6d6 --- /dev/null +++ b/fnl/plugins/ui/minibar.fnl @@ -0,0 +1,30 @@ +;; Show the filename in the top left corner. + +{1 :aktersnurra/minibar.nvim + :event :BufReadPre + :opts {:ignore-filetypes [:help + :harpoon + :startify + :dashboard + :lir + :alpha + :packer + :neogitstatus + :Trouble + :org + :lazy + :netrw + :Outline + :NeogitStatus + :NeogitCommitMessage + :NeogitNotification + :NeogitCommitView + :spectre_panel + ""] + :events [:CursorMoved + :TermOpen + :DirChanged + :BufWinEnter + :BufFilePost + :InsertEnter + :BufWritePost]}} diff --git a/fnl/plugins/undotree.fnl b/fnl/plugins/undotree.fnl deleted file mode 100644 index 9aa8114..0000000 --- a/fnl/plugins/undotree.fnl +++ /dev/null @@ -1,3 +0,0 @@ -;; Tree of undo history. - -{1 :mbbill/undotree :cmd :UndotreeToggle} diff --git a/fnl/plugins/vim-slash.fnl b/fnl/plugins/vim-slash.fnl deleted file mode 100644 index 6f50ae4..0000000 --- a/fnl/plugins/vim-slash.fnl +++ /dev/null @@ -1,6 +0,0 @@ -;; Provides a set of mappings for enhancing in-buffer search experience. - -{1 :junegunn/vim-slash - :event :BufReadPost - :config (fn [] - (vim.cmd "noremap (slash-after) zz"))} diff --git a/fnl/plugins/which-key.fnl b/fnl/plugins/which-key.fnl deleted file mode 100644 index 0b6389c..0000000 --- a/fnl/plugins/which-key.fnl +++ /dev/null @@ -1,168 +0,0 @@ -;; Which-key provides a pop-up menu for some key mappings. - -(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 "»" :separator "" :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} - :ignore_missing true - :hidden [: : : : :call :lua "^:" "^ "] - :show_help true - :triggers :auto - :disable {:filetypes [:netrw]} - :triggers_blacklist {:i [:j :k] :v [:j :k]}}) - -(local mopts {:mode :n - :prefix :m - :buffer nil - :silent true - :noremap true - :nowait true}) - -(local mmappings {:a [:HarpoonAdd :Harpoon] - :d [:DiffviewFileHistory :DiffviewFileHistory] - :f [:FindFiles "Find files"] - :g ["Telescope live_grep theme=dropdown" - "Find text"] - :n [:Neogit :Neogit] - :q ["Gitsigns diffthis HEAD" "Gitsigns diff"] - :r [:HarpoonUI "Harpoon UI"] - :s [:HarpoonPrev "Harpoon Prev"] - :t [:HarpoonNext "Harpoon Next"] - :v ["lua vim.lsp.buf.rename()" :Rename] - :x ["DiffviewOpen -uno" :DiffviewOpen] - :z [:DiffviewClose :DiffviewClose]}) - -(local nopts {:mode :n - :prefix : - :buffer nil - :silent true - :noremap true - :nowait true}) - -(local find - {:name :find - :C ["Telescope commands theme=dropdown" :Commands] - :H ["Telescope highlights" :Highlights] - :R ["Telescope registers theme=dropdown" :Registers] - :S ["Telescope grep_string theme=dropdown" "Find String"] - :b ["Telescope git_branches theme=dropdown" "Checkout branch"] - :c ["Telescope colorscheme theme=dropdown" :Colorscheme] - :f [:FindFiles "Find files"] - :h ["Telescope help_tags theme=dropdown" :Help] - :k ["Telescope keymaps theme=dropdown" :Keymaps] - :l ["Telescope resume theme=dropdown" "Last Search"] - :p ["Telescope projects theme=dropdown" "Find project"] - :r ["Telescope oldfiles theme=dropdown" "Recent File"] - :t ["Telescope live_grep theme=dropdown" "Find text"]}) - -(local diagnostics {:name :diagnostics - :t [:TroubleToggle :Trouble] - :g ["Telescope diagnostics theme=dropdown" - "Telescope diagnostics"]}) - -(local git {:name :git - :R ["lua require 'gitsigns'.reset_buffer()" - "Reset Buffer"] - :b ["Telescope git_branches theme=dropdown" - "Checkout branch"] - :c ["Telescope git_commits theme=dropdown" - "Checkout commit"] - :d ["Gitsigns diffthis HEAD" :Diff] - :j ["lua require 'gitsigns'.next_hunk()" "Next Hunk"] - :k ["lua require 'gitsigns'.prev_hunk()" "Prev Hunk"] - :l ["lua require 'gitsigns'.blame_line()" :Blame] - :o ["Telescope git_status theme=dropdown" - "Open changed file"] - :p ["lua require 'gitsigns'.preview_hunk()" - "Preview Hunk"] - :r ["lua require 'gitsigns'.reset_hunk()" "Reset Hunk"] - :s ["lua require 'gitsigns'.stage_hunk()" "Stage Hunk"] - :u ["lua require 'gitsigns'.undo_stage_hunk()" - "Undo Stage Hunk"]}) - -(local lsp - {:name :lsp - :S ["Telescope lsp_dynamic_workspace_symbols" - "Workspace Symbols"] - :a ["lua vim.lsp.buf.code_action()" "Code Action"] - :f ["lua vim.lsp.buf.format { async = true }" :Format] - :i [:LspInfo :Info] - :l ["lua vim.lsp.codelens.run()" "CodeLens Action"] - :r ["lua vim.lsp.buf.rename()" :Rename] - :s ["Telescope lsp_document_symbols" "Document Symbols"]}) - -(local replace {:name :replace - :m [:ReplaceInBuf "Replace in Buffer"] - :n [:Replace :Replace] - :e [:ReplaceWord "Replace Word"]}) - -(local session - {:name :session - :m [:RestoreSession "Restore session"] - :n [:RestoreLastSession "Restore last session"] - :e [:IgnoreSession "Ignore current session"]}) - -(local treesitter - {:name :Treesitter :p [:TSPlaygroundToggle :Playground]}) - -(local nmappings {:a ["Telescope lsp_document_symbols theme=dropdown" - "Document Symbols"] - :T treesitter - : [:BufDel "Close Buffer"] - :j diagnostics - :f find - :g git - :h [:ColorizerToggle :Colorizer] - :l lsp - :m [:Mason :Mason] - :n [:SymbolsOutline "Symbols outline"] - :r replace - :s session - :t [:ToggleTerm :Terminal] - :u [:UndotreeToggle :Undotree] - :y ["Lazy home" :Home] - :z [:ZenMode "Zen Mode"]}) - -(local vopts {:mode :v - :prefix : - :buffer nil - :silent true - :noremap true - :nowait true}) - -(local gopts {:mode :n - :prefix :g - :buffer nil - :silent true - :noremap true - :nowait true}) - -(local gmappings {:a [:OrgAgendaPrompt "Open agenda prompt"] - :c [:OrgCapturePrompt "Open capture prompt"] - :m ["Telescope orgmode search_headings theme=dropdown" - "Search headings"]}) - -(fn setup [] - (let [which-key (require :which-key)] - (which-key.setup opts) - (which-key.register mmappings mopts) - (which-key.register nmappings nopts) - (which-key.register gmappings gopts))) - -{1 :folke/which-key.nvim - :event :VeryLazy - :config (fn [] - (setup))} diff --git a/fnl/plugins/window-picker.fnl b/fnl/plugins/window-picker.fnl deleted file mode 100644 index 2820409..0000000 --- a/fnl/plugins/window-picker.fnl +++ /dev/null @@ -1,19 +0,0 @@ -;; Trim whitespaces on save. - -(fn pick-window [opts] - (let [window-picker (require :window-picker)] - (let [win (window-picker.pick_window)] - (if (not= win nil) - (vim.api.nvim_set_current_win win))))) - -{1 :s1n7ax/nvim-window-picker - :event :BufReadPost - :opts {:other_win_hl_color "#171717" - :fg_color "#E1E1E1" - :selection_chars :MNEIOARSTG} - :config (lambda [_ opts] - (let [window-picker (require :window-picker)] - (window-picker.setup opts) - (vim.keymap.set :n : - (fn [] - (pick-window)) {})))} diff --git a/fnl/plugins/zen.fnl b/fnl/plugins/zen.fnl deleted file mode 100644 index 6e9bee7..0000000 --- a/fnl/plugins/zen.fnl +++ /dev/null @@ -1,11 +0,0 @@ -;; Zen mode. - -{1 :folke/zen-mode.nvim - :cmd :ZenMode - :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}}}} diff --git a/fnl/settings/options.fnl b/fnl/settings/options.fnl index cb86307..df71c8c 100644 --- a/fnl/settings/options.fnl +++ b/fnl/settings/options.fnl @@ -91,3 +91,4 @@ (apply-opts opts) (set vim.g.mapleader " ") (set vim.g.maplocalleader " ") +(set vim.g.markdown_recommended_style 0) -- cgit v1.2.3-70-g09d2