From df211fae51faddd7b47b78806660e21f6ec1a694 Mon Sep 17 00:00:00 2001 From: Gustaf Rydholm Date: Wed, 12 Jul 2023 21:46:07 +0200 Subject: Debloat loading of plugins --- fnl/plugins/compiler/hotpot.fnl | 3 -- fnl/plugins/core/hotpot.fnl | 3 ++ fnl/plugins/editor/alpha.fnl | 49 ++++++++++++++++++++++ fnl/plugins/editor/bqf.fnl | 3 ++ fnl/plugins/editor/diffview.fnl | 8 ++++ fnl/plugins/editor/easyread.fnl | 5 +++ fnl/plugins/editor/lualine.fnl | 91 +++++++++++++++++++++++++++++++++++++++++ fnl/plugins/editor/minibar.fnl | 31 ++++++++++++++ fnl/plugins/editor/neogit.fnl | 7 ++++ fnl/plugins/editor/orgmode.fnl | 27 ++++++++++++ fnl/plugins/init.fnl | 25 ++++------- fnl/plugins/tools/diffview.fnl | 8 ---- fnl/plugins/tools/neogit.fnl | 7 ---- fnl/plugins/tools/orgmode.fnl | 27 ------------ fnl/plugins/ui/alpha.fnl | 49 ---------------------- fnl/plugins/ui/bqf.fnl | 3 -- fnl/plugins/ui/easyread.fnl | 5 --- fnl/plugins/ui/lualine.fnl | 91 ----------------------------------------- fnl/plugins/ui/minibar.fnl | 31 -------------- fnl/util/cursorline.fnl | 6 +-- 20 files changed, 236 insertions(+), 243 deletions(-) delete mode 100644 fnl/plugins/compiler/hotpot.fnl create mode 100644 fnl/plugins/core/hotpot.fnl create mode 100644 fnl/plugins/editor/alpha.fnl create mode 100644 fnl/plugins/editor/bqf.fnl create mode 100644 fnl/plugins/editor/diffview.fnl create mode 100644 fnl/plugins/editor/easyread.fnl create mode 100644 fnl/plugins/editor/lualine.fnl create mode 100644 fnl/plugins/editor/minibar.fnl create mode 100644 fnl/plugins/editor/neogit.fnl create mode 100644 fnl/plugins/editor/orgmode.fnl delete mode 100644 fnl/plugins/tools/diffview.fnl delete mode 100644 fnl/plugins/tools/neogit.fnl delete mode 100644 fnl/plugins/tools/orgmode.fnl delete mode 100644 fnl/plugins/ui/alpha.fnl delete mode 100644 fnl/plugins/ui/bqf.fnl delete mode 100644 fnl/plugins/ui/easyread.fnl delete mode 100644 fnl/plugins/ui/lualine.fnl delete mode 100644 fnl/plugins/ui/minibar.fnl (limited to 'fnl') diff --git a/fnl/plugins/compiler/hotpot.fnl b/fnl/plugins/compiler/hotpot.fnl deleted file mode 100644 index eba8083..0000000 --- a/fnl/plugins/compiler/hotpot.fnl +++ /dev/null @@ -1,3 +0,0 @@ -;; Transpiler for fnl. - -{1 :rktjmp/hotpot.nvim} diff --git a/fnl/plugins/core/hotpot.fnl b/fnl/plugins/core/hotpot.fnl new file mode 100644 index 0000000..eba8083 --- /dev/null +++ b/fnl/plugins/core/hotpot.fnl @@ -0,0 +1,3 @@ +;; Transpiler for fnl. + +{1 :rktjmp/hotpot.nvim} diff --git a/fnl/plugins/editor/alpha.fnl b/fnl/plugins/editor/alpha.fnl new file mode 100644 index 0000000..c9dce50 --- /dev/null +++ b/fnl/plugins/editor/alpha.fnl @@ -0,0 +1,49 @@ +;; 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 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 :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 (fn [] + (setup))} diff --git a/fnl/plugins/editor/bqf.fnl b/fnl/plugins/editor/bqf.fnl new file mode 100644 index 0000000..e2b0791 --- /dev/null +++ b/fnl/plugins/editor/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/editor/diffview.fnl b/fnl/plugins/editor/diffview.fnl new file mode 100644 index 0000000..c004199 --- /dev/null +++ b/fnl/plugins/editor/diffview.fnl @@ -0,0 +1,8 @@ +;; Inspect commits. + +{1 :sindrets/diffview.nvim + :cmd [:DiffviewFileHistory :DiffviewOpen] + :config true + :keys [{1 :md 2 :DiffviewFileHistory :desc :DiffviewFileHistory} + {1 :mx 2 "DiffviewOpen -uno" :desc :DiffviewOpen} + {1 :mz 2 :DiffviewClose :desc :DiffviewClose}]} diff --git a/fnl/plugins/editor/easyread.fnl b/fnl/plugins/editor/easyread.fnl new file mode 100644 index 0000000..c456726 --- /dev/null +++ b/fnl/plugins/editor/easyread.fnl @@ -0,0 +1,5 @@ +;; Bionic like reading. + +{1 :JellyApple102/easyread.nvim + :keys [{1 "," 2 :EasyreadToggle :desc :Easyread}] + :config true} diff --git a/fnl/plugins/editor/lualine.fnl b/fnl/plugins/editor/lualine.fnl new file mode 100644 index 0000000..80adf55 --- /dev/null +++ b/fnl/plugins/editor/lualine.fnl @@ -0,0 +1,91 @@ +;; 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)] + (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 (.. (. 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 []}) + +{1 :nvim-lualine/lualine.nvim + :event :BufReadPost + : opts + :dependencies [:nvim-tree/nvim-web-devicons :arkav/lualine-lsp-progress]} diff --git a/fnl/plugins/editor/minibar.fnl b/fnl/plugins/editor/minibar.fnl new file mode 100644 index 0000000..ed80330 --- /dev/null +++ b/fnl/plugins/editor/minibar.fnl @@ -0,0 +1,31 @@ +;; 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 + :lazy + :netrw + :Outline + :neo-tree + :neo-tree-popup + :NeogitStatus + :NeogitCommitMessage + :NeogitNotification + :NeogitCommitView + :spectre_panel + ""] + :events [:CursorMoved + :TermOpen + :DirChanged + :BufWinEnter + :BufFilePost + :InsertEnter + :BufWritePost]}} diff --git a/fnl/plugins/editor/neogit.fnl b/fnl/plugins/editor/neogit.fnl new file mode 100644 index 0000000..e9c6235 --- /dev/null +++ b/fnl/plugins/editor/neogit.fnl @@ -0,0 +1,7 @@ +;; Git ui. + +{1 :TimUntersberger/neogit + :cmd :Neogit + :config true + :dependencies [:nvim-lua/plenary.nvim] + :keys [{1 :mn 2 :Neogit :desc :Neogit}]} diff --git a/fnl/plugins/editor/orgmode.fnl b/fnl/plugins/editor/orgmode.fnl new file mode 100644 index 0000000..bb67b88 --- /dev/null +++ b/fnl/plugins/editor/orgmode.fnl @@ -0,0 +1,27 @@ +;; 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)] + (orgmode.setup_ts_grammar) + (orgmode.setup opts))) + +{1 :nvim-orgmode/orgmode + :config (fn [] + (setup)) + :event :BufReadPost + :keys [{1 :ga 2 :OrgAgendaPrompt :desc "Open agenda prompt"} + {1 :gc 2 :OrgCapturePrompt :desc "Open capture prompt"} + {1 :gm + 2 "Telescope orgmode search_headings theme=dropdown" + :desc "Search headings"}]} diff --git a/fnl/plugins/init.fnl b/fnl/plugins/init.fnl index 00be90b..2ab9d99 100644 --- a/fnl/plugins/init.fnl +++ b/fnl/plugins/init.fnl @@ -1,21 +1,14 @@ ;; Load all plugins. -(fn get-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) + 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))))) + (table.insert plugins (require :plugins.lsp)) plugins)) -(let [lazy (require :plugins.core.lazy) - plugins (get-plugins :compiler :editor :lsp :tools :ui)] - (lazy.setup plugins)) +(let [_ (require :plugins.core.hotpot) + lazy (require :plugins.core.lazy)] + (lazy.setup (get-plugins))) diff --git a/fnl/plugins/tools/diffview.fnl b/fnl/plugins/tools/diffview.fnl deleted file mode 100644 index c004199..0000000 --- a/fnl/plugins/tools/diffview.fnl +++ /dev/null @@ -1,8 +0,0 @@ -;; Inspect commits. - -{1 :sindrets/diffview.nvim - :cmd [:DiffviewFileHistory :DiffviewOpen] - :config true - :keys [{1 :md 2 :DiffviewFileHistory :desc :DiffviewFileHistory} - {1 :mx 2 "DiffviewOpen -uno" :desc :DiffviewOpen} - {1 :mz 2 :DiffviewClose :desc :DiffviewClose}]} diff --git a/fnl/plugins/tools/neogit.fnl b/fnl/plugins/tools/neogit.fnl deleted file mode 100644 index e9c6235..0000000 --- a/fnl/plugins/tools/neogit.fnl +++ /dev/null @@ -1,7 +0,0 @@ -;; Git ui. - -{1 :TimUntersberger/neogit - :cmd :Neogit - :config true - :dependencies [:nvim-lua/plenary.nvim] - :keys [{1 :mn 2 :Neogit :desc :Neogit}]} diff --git a/fnl/plugins/tools/orgmode.fnl b/fnl/plugins/tools/orgmode.fnl deleted file mode 100644 index bb67b88..0000000 --- a/fnl/plugins/tools/orgmode.fnl +++ /dev/null @@ -1,27 +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)] - (orgmode.setup_ts_grammar) - (orgmode.setup opts))) - -{1 :nvim-orgmode/orgmode - :config (fn [] - (setup)) - :event :BufReadPost - :keys [{1 :ga 2 :OrgAgendaPrompt :desc "Open agenda prompt"} - {1 :gc 2 :OrgCapturePrompt :desc "Open capture prompt"} - {1 :gm - 2 "Telescope orgmode search_headings theme=dropdown" - :desc "Search headings"}]} diff --git a/fnl/plugins/ui/alpha.fnl b/fnl/plugins/ui/alpha.fnl deleted file mode 100644 index c9dce50..0000000 --- a/fnl/plugins/ui/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 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 :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 (fn [] - (setup))} diff --git a/fnl/plugins/ui/bqf.fnl b/fnl/plugins/ui/bqf.fnl deleted file mode 100644 index e2b0791..0000000 --- a/fnl/plugins/ui/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/ui/easyread.fnl b/fnl/plugins/ui/easyread.fnl deleted file mode 100644 index c456726..0000000 --- a/fnl/plugins/ui/easyread.fnl +++ /dev/null @@ -1,5 +0,0 @@ -;; Bionic like reading. - -{1 :JellyApple102/easyread.nvim - :keys [{1 "," 2 :EasyreadToggle :desc :Easyread}] - :config true} diff --git a/fnl/plugins/ui/lualine.fnl b/fnl/plugins/ui/lualine.fnl deleted file mode 100644 index 80adf55..0000000 --- a/fnl/plugins/ui/lualine.fnl +++ /dev/null @@ -1,91 +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)] - (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 (.. (. 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 []}) - -{1 :nvim-lualine/lualine.nvim - :event :BufReadPost - : opts - :dependencies [:nvim-tree/nvim-web-devicons :arkav/lualine-lsp-progress]} diff --git a/fnl/plugins/ui/minibar.fnl b/fnl/plugins/ui/minibar.fnl deleted file mode 100644 index ed80330..0000000 --- a/fnl/plugins/ui/minibar.fnl +++ /dev/null @@ -1,31 +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 - :lazy - :netrw - :Outline - :neo-tree - :neo-tree-popup - :NeogitStatus - :NeogitCommitMessage - :NeogitNotification - :NeogitCommitView - :spectre_panel - ""] - :events [:CursorMoved - :TermOpen - :DirChanged - :BufWinEnter - :BufFilePost - :InsertEnter - :BufWritePost]}} diff --git a/fnl/util/cursorline.fnl b/fnl/util/cursorline.fnl index e094a4a..cec76f2 100644 --- a/fnl/util/cursorline.fnl +++ b/fnl/util/cursorline.fnl @@ -1,12 +1,12 @@ -;; Functions for showing and hiding the cursorline. +;; Shows (hides) the cursorline in the (un)focused window. -(local ignore-filetypes [:neo-tree]) +(local ignored [:neo-tree]) (fn filetype [] vim.bo.filetype) (fn ignore [] - (vim.tbl_contains ignore-filetypes (filetype))) + (vim.tbl_contains ignored (filetype))) (fn show [] (let [(ok cl) (pcall vim.api.nvim_win_get_var 0 :auto-cursorline)] -- cgit v1.2.3-70-g09d2