summaryrefslogtreecommitdiff
path: root/fnl/plugins/editor
diff options
context:
space:
mode:
authorGustaf Rydholm <gustaf.rydholm@gmail.com>2023-07-12 21:46:07 +0200
committerGustaf Rydholm <gustaf.rydholm@gmail.com>2023-07-12 21:46:07 +0200
commitdf211fae51faddd7b47b78806660e21f6ec1a694 (patch)
tree9884c4945a1e60f19c52e4746953f0212b7fc8a7 /fnl/plugins/editor
parent9ccdc18b7926ed5e069e7f305ac5ec304f87a65f (diff)
Debloat loading of plugins
Diffstat (limited to 'fnl/plugins/editor')
-rw-r--r--fnl/plugins/editor/alpha.fnl49
-rw-r--r--fnl/plugins/editor/bqf.fnl3
-rw-r--r--fnl/plugins/editor/diffview.fnl8
-rw-r--r--fnl/plugins/editor/easyread.fnl5
-rw-r--r--fnl/plugins/editor/lualine.fnl91
-rw-r--r--fnl/plugins/editor/minibar.fnl31
-rw-r--r--fnl/plugins/editor/neogit.fnl7
-rw-r--r--fnl/plugins/editor/orgmode.fnl27
8 files changed, 221 insertions, 0 deletions
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<CR>")
+ (dashboard.button :g (.. (. icons :search-text) " Find text")
+ ":Telescope live_grep theme=dropdown<CR>")
+ (dashboard.button :p (.. (. icons :search-project) " Find project")
+ ":Telescope projects theme=dropdown<CR>")
+ (dashboard.button :r (.. (. icons :recent-files) " Recently used files")
+ ":Telescope oldfiles theme=dropdown<CR>")
+ (dashboard.button :t (.. (. icons :cog) " Configuration")
+ ":e ~/.config/nvim/init.lua <CR>")
+ (dashboard.button :o (.. (. icons :org) " Org")
+ ":Telescope find_files theme=dropdown cwd=~/.local/share/org<CR>")])
+ (set dashboard.section.header.opts.hl :AlphaHeader)
+ (set dashboard.section.buttons.opts.hl :AlphaButtons)
+ (set dashboard.opts.opts.noautocmd true)
+ (alpha.setup dashboard.opts))))
+
+{1 :goolord/alpha-nvim
+ :event :VimEnter
+ :config (fn []
+ (setup))}
diff --git a/fnl/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 :<cmd>DiffviewFileHistory<cr> :desc :DiffviewFileHistory}
+ {1 :mx 2 "<cmd>DiffviewOpen -uno<cr>" :desc :DiffviewOpen}
+ {1 :mz 2 :<cmd>DiffviewClose<cr> :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 "<leader>," 2 :<cmd>EasyreadToggle<cr> :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 :<cmd>Neogit<cr> :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 :<cmd>OrgAgendaPrompt<cr> :desc "Open agenda prompt"}
+ {1 :gc 2 :<cmd>OrgCapturePrompt<cr> :desc "Open capture prompt"}
+ {1 :gm
+ 2 "<cmd>Telescope orgmode search_headings theme=dropdown<cr>"
+ :desc "Search headings"}]}