summaryrefslogtreecommitdiff
path: root/fnl/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'fnl/plugins')
-rw-r--r--fnl/plugins/alpha.fnl49
-rw-r--r--fnl/plugins/cmp.fnl13
-rw-r--r--fnl/plugins/fff.fnl32
-rw-r--r--fnl/plugins/grug-far.fnl16
-rw-r--r--fnl/plugins/harpoon.fnl26
-rw-r--r--fnl/plugins/leap.fnl1
-rw-r--r--fnl/plugins/lsp/diagnostics.fnl2
-rw-r--r--fnl/plugins/lsp/mason-lspconfig.fnl7
-rw-r--r--fnl/plugins/lsp/servers.fnl6
-rw-r--r--fnl/plugins/neogit.fnl18
-rw-r--r--fnl/plugins/orgmode.fnl46
-rw-r--r--fnl/plugins/persistence.fnl36
-rw-r--r--fnl/plugins/snippets.fnl6
-rw-r--r--fnl/plugins/telescope.fnl8
-rw-r--r--fnl/plugins/treesitter-context.fnl13
15 files changed, 123 insertions, 156 deletions
diff --git a/fnl/plugins/alpha.fnl b/fnl/plugins/alpha.fnl
deleted file mode 100644
index 4011bcd..0000000
--- a/fnl/plugins/alpha.fnl
+++ /dev/null
@@ -1,49 +0,0 @@
-;; A customizable greeter.
-
-(local icons (require :settings.icons))
-
-(local ascii-art [" ##############..... ############## "
- " ##############......############## "
- " ##########..........########## "
- " ##########........########## "
- " ##########.......########## "
- " ##########.....##########.. "
- " ##########....##########..... "
- " ..##########..##########......... "
- " ....##########.#########............. "
- " ..################JJJ............ "
- " ################............. "
- " ##############.JJJ.JJJJJJJJJJ "
- " ############...JJ...JJ..JJ JJ "
- " ##########....JJ...JJ..JJ JJ "
- " ########......JJJ..JJJ JJJ JJJ "
- " ###### ......... "
- " ..... "
- " . "])
-
-(λ config []
- (let [alpha (require :alpha)]
- (let [dashboard (require :alpha.themes.dashboard)]
- (set dashboard.section.header.val ascii-art)
- (set dashboard.section.buttons.val
- [(dashboard.button :f (.. (. icons :search-files) " Find file")
- ":Telescope find_files theme=dropdown previewer=false<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 previewer=false<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}
diff --git a/fnl/plugins/cmp.fnl b/fnl/plugins/cmp.fnl
index a979633..46efbc5 100644
--- a/fnl/plugins/cmp.fnl
+++ b/fnl/plugins/cmp.fnl
@@ -20,18 +20,7 @@
:dadbod {:name :Dadbod
:module :vim_dadbod_completion.blink
:score_offset 2}}}
- :snippets {:preset :luasnip
- :expand (λ [snippet]
- (let [luasnip (require :luasnip)]
- (luasnip.lsp_expand snippet)))
- :active (fn [filter]
- (let [luasnip (require :luasnip)]
- (when (and filter filter.direction)
- (luasnip.jumpable filter.direction))
- (luasnip.in_snippet)))
- :jump (λ [direction]
- (let [luasnip (require :luasnip)]
- (luasnip.jump direction)))}})
+ :snippets {:preset :luasnip}})
(local dependencies [:rafamadriz/friendly-snippets
{1 :L3MON4D3/LuaSnip :version :v2.*}])
diff --git a/fnl/plugins/fff.fnl b/fnl/plugins/fff.fnl
new file mode 100644
index 0000000..3939408
--- /dev/null
+++ b/fnl/plugins/fff.fnl
@@ -0,0 +1,32 @@
+;; Freakin fast fuzzy file finder.
+
+(import-macros {: autocmd} :macros)
+
+(λ init []
+ (autocmd :VimEnter
+ {:callback (λ []
+ (when (= (. (vim.fn.argv) 1) nil)
+ (vim.schedule
+ (λ [] ((. (require :fff) :find_files))))))
+ :once true}))
+
+(local opts {:layout {:height 0.8
+ :width 0.7
+ :prompt_position :bottom
+ :preview_position :top
+ :preview_size 0.8
+ :flex {:size 130 :wrap :top}
+ :show_scrollbar false
+ :path_shorten_strategy :middle_number}})
+
+{1 :dmtrKovalenko/fff.nvim
+ :build (λ []
+ ((. (require :fff.download) :build_binary)
+ (λ [ok err]
+ (vim.schedule
+ (λ [] (vim.notify (if ok "fff.nvim built!" err)))))))
+ : opts
+ :lazy false
+ : init
+ :keys [{1 :mf 2 (λ [] ((. (require :fff) :find_files))) :desc "Find Files"}
+ {1 :mg 2 (λ [] ((. (require :fff) :live_grep))) :desc "Live Grep"}]}
diff --git a/fnl/plugins/grug-far.fnl b/fnl/plugins/grug-far.fnl
index fdcf897..ebd1835 100644
--- a/fnl/plugins/grug-far.fnl
+++ b/fnl/plugins/grug-far.fnl
@@ -1,9 +1,6 @@
;; Find and replace plugin.
-(local auto-cmds
- [[:FileType
- {:pattern [:grug-far]
- :command "nnoremap <silent> <buffer> q :close<CR>"}]
- [:FileType {:pattern [:grug-far] :command "setlocal spell!"}]])
+
+(import-macros {: autocmds} :macros)
(λ replace [?cword ?file]
(let [grug (require :grug-far)]
@@ -19,9 +16,12 @@
(grug.with_visual_selection {:prefills {:paths (vim.fn.expand "%")}})))
(λ config []
- (let [{: create-auto-cmds} (require :util.cmds)
- grug (require :grug-far)]
- (create-auto-cmds auto-cmds)
+ (let [grug (require :grug-far)]
+ (autocmds
+ [:FileType
+ {:pattern [:grug-far]
+ :command "nnoremap <silent> <buffer> q :close<CR>"}]
+ [:FileType {:pattern [:grug-far] :command "setlocal spell!"}])
(grug.setup)))
(local keys [{1 :<m-w> 2 :<cmd>GrugFar<cr> :desc "Find and Replace"}
diff --git a/fnl/plugins/harpoon.fnl b/fnl/plugins/harpoon.fnl
index 3f8f7ac..29f41d0 100644
--- a/fnl/plugins/harpoon.fnl
+++ b/fnl/plugins/harpoon.fnl
@@ -1,28 +1,28 @@
;; Harpoon files for navigation.
+(import-macros {: user-cmds} :macros)
+
(local opts
{:ui_max_width 64
:title " ⇁ "
:settings {:save_on_toggle true :sync_on_ui_close true}})
-(local user-cmds [[:HarpoonAdd
- (λ []
- (let [harpoon (require :harpoon)]
- (: (harpoon:list) :add)))
- {:nargs 0}]
- [:HarpoonUI
- (λ []
- (let [harpoon (require :harpoon)]
- (harpoon.ui:toggle_quick_menu (harpoon:list) opts)))
- {:nargs 0}]])
-
(λ select [nr]
(let [harpoon (require :harpoon)]
(: (harpoon:list) :select nr)))
(λ init []
- (let [{: create-user-cmds} (require :util.cmds)]
- (create-user-cmds user-cmds)))
+ (user-cmds
+ [:HarpoonAdd
+ (λ []
+ (let [harpoon (require :harpoon)]
+ (: (harpoon:list) :add)))
+ {:nargs 0}]
+ [:HarpoonUI
+ (λ []
+ (let [harpoon (require :harpoon)]
+ (harpoon.ui:toggle_quick_menu (harpoon:list) opts)))
+ {:nargs 0}]))
(local keys [{1 :ma 2 :<cmd>HarpoonAdd<cr> :desc :Harpoon}
{1 :mr 2 :<cmd>HarpoonUI<cr> :desc "Harpoon UI"}
diff --git a/fnl/plugins/leap.fnl b/fnl/plugins/leap.fnl
index 397b873..3c846c5 100644
--- a/fnl/plugins/leap.fnl
+++ b/fnl/plugins/leap.fnl
@@ -40,7 +40,6 @@
(vim.keymap.set [:n] :gs "<Plug>(leap-from-window)")))
{:url "https://codeberg.org/andyg/leap.nvim"
-:name :leap.nvim
: dependencies
:event :VeryLazy
: config}
diff --git a/fnl/plugins/lsp/diagnostics.fnl b/fnl/plugins/lsp/diagnostics.fnl
index b4aefa6..b8bf5cc 100644
--- a/fnl/plugins/lsp/diagnostics.fnl
+++ b/fnl/plugins/lsp/diagnostics.fnl
@@ -15,7 +15,7 @@
:float {:focusable false
:style :minimal
:border :single
- :source :always
+ :source true
:header ""
:prefix ""}})
diff --git a/fnl/plugins/lsp/mason-lspconfig.fnl b/fnl/plugins/lsp/mason-lspconfig.fnl
index 48ea0b5..36b98c2 100644
--- a/fnl/plugins/lsp/mason-lspconfig.fnl
+++ b/fnl/plugins/lsp/mason-lspconfig.fnl
@@ -1,10 +1,6 @@
-;; A bridge plugin between mason and lspconfig, handles installation of lsp and
+;; A bridge plugin between mason and lspconfig, handles installation of lsp and
;; setup hooks for client configurations.
-(local textDocument-handlers
- {:textDocument/hover (vim.lsp.with vim.lsp.handlers.hover)
- :textDocument/signatureHelp (vim.lsp.with vim.lsp.handlers.signature_help)})
-
(λ capabilities []
(let [blink-cmp (require :blink.cmp)]
(blink-cmp.get_lsp_capabilities)))
@@ -15,7 +11,6 @@
(let [lspconfig (. lspconfigs server)
server-config (or (. servers server) {})]
(tset server-config :capabilities (capabilities))
- (tset server-config :handlers textDocument-handlers)
(lspconfig.setup server-config))))
(λ setup []
diff --git a/fnl/plugins/lsp/servers.fnl b/fnl/plugins/lsp/servers.fnl
index 7d213a8..13c6c9e 100644
--- a/fnl/plugins/lsp/servers.fnl
+++ b/fnl/plugins/lsp/servers.fnl
@@ -10,11 +10,7 @@
:jsonls {:init_options {:providerFormatter false}
:settings {:json {:schemas (let [schemastore (require :schemastore)]
(schemastore.json.schemas))
- :validate {:enable true}}}
- :setup {:commands {:Format [(λ []
- (vim.lsp.buf.range_formatting [] [0 0]
- [(vim.fn.line "$"
- 0)]))]}}}
+ :validate {:enable true}}}}
:ocamllsp {}
:rust_analyzer {:settings {:rust-analyzer {:lens {:enable true}
:checkOnSave {:command :clippy}}}}
diff --git a/fnl/plugins/neogit.fnl b/fnl/plugins/neogit.fnl
index 9b0c24b..143699d 100644
--- a/fnl/plugins/neogit.fnl
+++ b/fnl/plugins/neogit.fnl
@@ -1,19 +1,19 @@
;; Git ui.
+(import-macros {: autocmds} :macros)
+
(local dependencies [:nvim-lua/plenary.nvim])
(local keys [{1 :<leader>gm 2 :<cmd>Neogit<cr> :desc :Neogit}])
-(local auto-cmds [[:FileType
- {:pattern [:NeogitStatus
- :NeogitCommitMessage
- :NeogitNotification
- :NeogitCommitView]
- :command "setlocal spell!"}]])
-
(λ init []
- (let [{: create-auto-cmds} (require :util.cmds)]
- (create-auto-cmds auto-cmds)))
+ (autocmds
+ [:FileType
+ {:pattern [:NeogitStatus
+ :NeogitCommitMessage
+ :NeogitNotification
+ :NeogitCommitView]
+ :command "setlocal spell!"}]))
(local opts {:integrations {:diffview true :telescope true}})
diff --git a/fnl/plugins/orgmode.fnl b/fnl/plugins/orgmode.fnl
index 04cd3b4..60bc15c 100644
--- a/fnl/plugins/orgmode.fnl
+++ b/fnl/plugins/orgmode.fnl
@@ -1,5 +1,7 @@
;; Orgmode for nvim.
+(import-macros {: autocmds : user-cmds} :macros)
+
(local icons (require :settings.icons))
(local keys [{1 :<leader>oa
@@ -15,31 +17,27 @@
2 "<cmd>Telescope orgmode search_headings theme=dropdown<cr>"
:desc "Search headings"}])
-(local user-cmds [[:OrgAgendaPrompt
- (λ []
- (let [orgmode (require :orgmode)]
- (orgmode.action :agenda.prompt)))
- {:nargs 0}]
- [:OrgCapturePrompt
- (λ []
- (let [orgmode (require :orgmode)]
- (orgmode.action :capture.prompt)))
- {:nargs 0}]])
-
-(local auto-cmds
- [[:FileType
- {:pattern :org
- :callback (λ []
- (tset vim.opt_local :foldenable false)
- (tset vim.opt_local :foldlevelstart 0)
- (tset vim.opt_local :foldlevel 0)
- (tset vim.opt_local :concealcursor :nc)
- (tset vim.opt_local :conceallevel 2))}]])
-
(λ init []
- (let [{: create-auto-cmds : create-user-cmds} (require :util.cmds)]
- (create-user-cmds user-cmds)
- (create-auto-cmds auto-cmds)))
+ (user-cmds
+ [:OrgAgendaPrompt
+ (λ []
+ (let [orgmode (require :orgmode)]
+ (orgmode.action :agenda.prompt)))
+ {:nargs 0}]
+ [:OrgCapturePrompt
+ (λ []
+ (let [orgmode (require :orgmode)]
+ (orgmode.action :capture.prompt)))
+ {:nargs 0}])
+ (autocmds
+ [:FileType
+ {:pattern :org
+ :callback (λ []
+ (tset vim.opt_local :foldenable false)
+ (tset vim.opt_local :foldlevelstart 0)
+ (tset vim.opt_local :foldlevel 0)
+ (tset vim.opt_local :concealcursor :nc)
+ (tset vim.opt_local :conceallevel 2))}]))
(local templates
{:t {:description :Todo :template "* TODO %?\n %u\n DEADLINE: %T\n"}
diff --git a/fnl/plugins/persistence.fnl b/fnl/plugins/persistence.fnl
index e84ec58..2e81e78 100644
--- a/fnl/plugins/persistence.fnl
+++ b/fnl/plugins/persistence.fnl
@@ -1,5 +1,7 @@
;; Session manager.
+(import-macros {: user-cmds} :macros)
+
(local keys [{1 :<leader>sn 2 :<cmd>RestoreSession<cr> :desc "Restore session"}
{1 :<leader>se
2 :<cmd>RestoreLastSession<cr>
@@ -8,25 +10,23 @@
2 :<cmd>IgnoreSession<cr>
:desc "Ignore current session"}])
-(local user-cmds [[:RestoreSession
- (λ []
- (let [persistence (require :persistence)]
- (persistence.load)))
- {:nargs 0}]
- [:RestoreLastSession
- (λ []
- (let [persistence (require :persistence)]
- (persistence.load {:last true})))
- {:nargs 0}]
- [:IgnoreSession
- (λ []
- (let [persistence (require :persistence)]
- (persistence.stop)))
- {:nargs 0}]])
-
(λ init []
- (let [{: create-user-cmds} (require :util.cmds)]
- (create-user-cmds user-cmds)))
+ (user-cmds
+ [:RestoreSession
+ (λ []
+ (let [persistence (require :persistence)]
+ (persistence.load)))
+ {:nargs 0}]
+ [:RestoreLastSession
+ (λ []
+ (let [persistence (require :persistence)]
+ (persistence.load {:last true})))
+ {:nargs 0}]
+ [:IgnoreSession
+ (λ []
+ (let [persistence (require :persistence)]
+ (persistence.stop)))
+ {:nargs 0}]))
(local opts {:options [:buffers :curdir :tabpages :winsize :help]})
diff --git a/fnl/plugins/snippets.fnl b/fnl/plugins/snippets.fnl
index fbfaeac..c45d220 100644
--- a/fnl/plugins/snippets.fnl
+++ b/fnl/plugins/snippets.fnl
@@ -6,13 +6,13 @@
(let [snippets (require (.. :plugins.snippets. name))]
(snippets.add-snippets)))
-(local {: apply-to-files} (require :util.load))
-
(λ config []
(let [ls (require :luasnip)
luasnip-vscode (require :luasnip.loaders.from_vscode)]
(luasnip-vscode.lazy_load)
- (apply-to-files :/fnl/plugins/snippets add-snippets)
+ (each [fname type (vim.fs.dir (.. (vim.fn.stdpath :config) :/fnl/plugins/snippets))]
+ (when (= type :file)
+ (add-snippets (fname:match "^(.*)%.fnl$"))))
(ls.config.set_config {:history true
:updateevents "TextChanged,TextChangedI"})
(vim.keymap.set [:i :s] :<c-u>
diff --git a/fnl/plugins/telescope.fnl b/fnl/plugins/telescope.fnl
index 0facab9..ca1b947 100644
--- a/fnl/plugins/telescope.fnl
+++ b/fnl/plugins/telescope.fnl
@@ -36,13 +36,7 @@
(each [_ extension (ipairs extensions)]
(telescope.load_extension extension)))
-(local keys [{1 :mf
- 2 "<cmd>Telescope find_files theme=dropdown previewer=false disable_devicons=true<cr>"
- :desc "Find Files"}
- {1 :mg
- 2 "<cmd>Telescope live_grep theme=dropdown<cr>"
- :desc "Find Text"}
- {1 :mb
+(local keys [{1 :mb
2 "<cmd>Telescope buffers theme=dropdown previewer=true initial_mode=normal<cr>"
:desc "Switch Buffer"}
{1 :<leader>fC
diff --git a/fnl/plugins/treesitter-context.fnl b/fnl/plugins/treesitter-context.fnl
new file mode 100644
index 0000000..f7730bd
--- /dev/null
+++ b/fnl/plugins/treesitter-context.fnl
@@ -0,0 +1,13 @@
+;; Sticky context headers while scrolling.
+
+(local opts {:enable true
+ :max_lines 3
+ :min_window_height 0
+ :line_numbers true
+ :multiline_threshold 20
+ :trim_scope :outer
+ :mode :cursor
+ :separator nil
+ :zindex 20})
+
+{1 :nvim-treesitter/nvim-treesitter-context :event [:BufReadPre :BufNewFile] : opts}