summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoraktersnurra <gustaf@gustafrydholm.xyz>2026-04-16 15:10:52 +0200
committeraktersnurra <gustaf@gustafrydholm.xyz>2026-04-17 00:02:28 +0200
commit99a7ff44cdf70d028ef6aab26224f26f69ee528d (patch)
tree3bac13281fe000f0cc9a1823b6ccac856b0acf88
parent83a7f3505a441f1c152229d50a3d6011951a82fc (diff)
Add fff and other nice things such as macrosHEADmaster
-rw-r--r--fnl/config.fnl6
-rw-r--r--fnl/macros.fnlm36
-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
-rw-r--r--fnl/settings/autocmds.fnl54
-rw-r--r--fnl/settings/options.fnl131
-rw-r--r--fnl/util/cmds.fnl11
-rw-r--r--fnl/util/load.fnl8
-rw-r--r--lazy-lock.json3
22 files changed, 238 insertions, 290 deletions
diff --git a/fnl/config.fnl b/fnl/config.fnl
index 478bae2..80ed508 100644
--- a/fnl/config.fnl
+++ b/fnl/config.fnl
@@ -5,8 +5,6 @@
(local icons (require :settings.icons))
-(local {: apply-to-files} (require :util.load))
-
(local api (require :hotpot.api))
(local context (assert (api.context (vim.fn.stdpath :config))))
@@ -49,7 +47,9 @@
(require :settings)
(let [lazy (require :lazy)
plugins {}]
- (apply-to-files :/fnl/plugins (partial load-plugin plugins))
+ (each [fname type (vim.fs.dir (.. (vim.fn.stdpath :config) :/fnl/plugins))]
+ (when (= type :file)
+ (load-plugin plugins (fname:match "^(.*)%.fnl$"))))
(vim.keymap.set :n :<leader>y "<cmd>Lazy home<cr>" {:desc :Home})
(lazy.setup plugins opts)))
diff --git a/fnl/macros.fnlm b/fnl/macros.fnlm
new file mode 100644
index 0000000..8267518
--- /dev/null
+++ b/fnl/macros.fnlm
@@ -0,0 +1,36 @@
+;; Fennel macros for compile-time expansion.
+
+(fn autocmd [event opts]
+ `(vim.api.nvim_create_autocmd ,event ,opts))
+
+(fn autocmds [...]
+ (let [out `(do)]
+ (each [_ cmd (ipairs [...])]
+ (table.insert out (autocmd (. cmd 1) (. cmd 2))))
+ out))
+
+(fn user-cmd [name cmd opts]
+ `(vim.api.nvim_create_user_command ,name ,cmd ,opts))
+
+(fn user-cmds [...]
+ (let [out `(do)]
+ (each [_ cmd (ipairs [...])]
+ (table.insert out (user-cmd (. cmd 1) (. cmd 2) (. cmd 3))))
+ out))
+
+(fn keymap [mode lhs rhs opts]
+ `(vim.keymap.set ,mode ,lhs ,rhs ,opts))
+
+(fn keymaps [...]
+ (let [out `(do)]
+ (each [_ mapping (ipairs [...])]
+ (table.insert out (keymap (. mapping 1) (. mapping 2) (. mapping 3) (. mapping 4))))
+ out))
+
+(fn set-opts [opts]
+ (let [out `(do)]
+ (each [k v (pairs opts)]
+ (table.insert out `(tset vim.opt ,k ,v)))
+ out))
+
+{: autocmd : autocmds : user-cmd : user-cmds : keymap : keymaps : set-opts}
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}
diff --git a/fnl/settings/autocmds.fnl b/fnl/settings/autocmds.fnl
index 9b5eac5..2f0a3cd 100644
--- a/fnl/settings/autocmds.fnl
+++ b/fnl/settings/autocmds.fnl
@@ -1,30 +1,30 @@
;; Autocommands for nvim.
-(local auto-cmds [[:FileType
- {:pattern [:qf :help :man :lspinfo]
- :command "nnoremap <silent> <buffer> q :close<CR>"}]
- [:TextYankPost
- {:callback (λ []
- (vim.highlight.on_yank {:higroup :Visual
- :timeout 200}))}]
- [:BufWinEnter {:command "setlocal formatoptions-=cro"}]
- [:FileType {:pattern :qf :command "set nobuflisted"}]
- [:FileType
- {:pattern [:gitcommit :markdown] :command "setlocal wrap"}]
- [:VimResized {:command "tabdo wincmd ="}]
- [[:FocusGained :BufEnter :CursorHold :CursorHoldI]
- {:pattern "*"
- :callback (fn []
- (when (= (vim.fn.mode) :n)
- (vim.cmd :checktime)))}]
- [[:InsertLeave :WinEnter]
- {:callback (λ []
- (let [cursorline (require :settings.cursorline)]
- cursorline.show))}]
- [[:InsertEnter :WinLeave]
- {:callback (λ []
- (let [cursorline (require :settings.cursorline)]
- cursorline.hide))}]])
+(import-macros {: autocmds} :macros)
-(let [{: create-auto-cmds} (require :util.cmds)]
- (create-auto-cmds auto-cmds))
+(autocmds
+ [:FileType
+ {:pattern [:qf :help :man :lspinfo]
+ :command "nnoremap <silent> <buffer> q :close<CR>"}]
+ [:TextYankPost
+ {:callback (λ []
+ (vim.highlight.on_yank {:higroup :Visual
+ :timeout 200}))}]
+ [:BufWinEnter {:command "setlocal formatoptions-=cro"}]
+ [:FileType {:pattern :qf :command "set nobuflisted"}]
+ [:FileType
+ {:pattern [:gitcommit :markdown] :command "setlocal wrap"}]
+ [:VimResized {:command "tabdo wincmd ="}]
+ [[:FocusGained :BufEnter :CursorHold :CursorHoldI]
+ {:pattern "*"
+ :callback (fn []
+ (when (= (vim.fn.mode) :n)
+ (vim.cmd :checktime)))}]
+ [[:InsertLeave :WinEnter]
+ {:callback (λ []
+ (let [cursorline (require :settings.cursorline)]
+ cursorline.show))}]
+ [[:InsertEnter :WinLeave]
+ {:callback (λ []
+ (let [cursorline (require :settings.cursorline)]
+ cursorline.hide))}])
diff --git a/fnl/settings/options.fnl b/fnl/settings/options.fnl
index e7ece5f..a659aae 100644
--- a/fnl/settings/options.fnl
+++ b/fnl/settings/options.fnl
@@ -1,91 +1,54 @@
;; Sets options in neovim
-(local spellfile (.. (os.getenv :XDG_CONFIG_HOME) :/nvim/spell/en.utf-8.add))
+(import-macros {: set-opts} :macros)
-(local opts {;; creates a backup file
- :backup false
- ;; allows neovim to access the system clipboard
- :clipboard :unnamedplus
- ;; more space in the neovim command line for displaying messages
- :cmdheight 1
- ;; mostly just for cmp
- :completeopt {:menuone :noselect}
- ;; so that `` is visible in markdown files
- :conceallevel 0
- ;; the encoding written to a file
- :fileencoding :utf-8
- ;; highlight all matches on previous search pattern
- :hlsearch true
- ;; ignore case in search patterns
- :ignorecase true
- ;; disable the mouse to be used in neovim
- :mouse ""
- ;; pop up menu height
- :pumheight 10
- ;; we don't need to see things like ;; INSERT ;; anymore
- :showmode false
- ;; never show tabs
- :showtabline 0
- ;; smart case
- :smartcase true
- ;; make indenting smarter again
- :smartindent true
- ;; force all horizontal splits to go below current window
- :splitbelow true
- ;; force all vertical splits to go to the right of current window
- :splitright true
- ;; creates a swapfile
- :swapfile false
- ;; set term gui colors (most terminals support this)
- :termguicolors true
- ;; time to wait for a mapped sequence to complete (in milliseconds)
- :timeoutlen 1000
- ;; enable persistent undo
- :undofile true
- ;; faster completion (4000ms default)
- :updatetime 1000
- ;; if a file is being edited by another program (or was written
- ;; to file while editing with another program), it is not allowed
- ;; to be edited
- :writebackup false
- ;; convert tabs to spaces
- :expandtab true
- ;; the number of spaces inserted for each indentation
- :shiftwidth 2
- ;; insert 2 spaces for a tab
- :tabstop 2
- ;; highlight the current line
- :cursorline true
- ;; set numbered lines
- :number true
- ;; set relative numbered lines
- :relativenumber true
- ;; set number column width to 2 {default 4}
- :numberwidth 2
- ;; always show the sign column, otherwise it would shift the text
- ;; each time
- :signcolumn :yes
- ;; display lines as one long line
- :wrap false
- :laststatus 3
- :autoread true
- ;; is one of my fav
- :scrolloff 8
- :sidescrolloff 8
- :colorcolumn :88
- :shortmess :filnxtToOFWIcC
- :spell true
- : spellfile
- :spelllang [:en_us]
- ;; the font used in graphical neovim applications
- :guifont "monospace:h17"
- :splitkeep :screen
- :inccommand :split
- :winborder :single
- :shada ["'10" :<0 :s10 :h]})
+(local spellfile (.. (os.getenv :XDG_CONFIG_HOME) :/nvim/spell/en.utf-8.add))
-(each [k v (pairs opts)]
- (tset vim.opt k v))
+(set-opts {:backup false
+ :clipboard :unnamedplus
+ :cmdheight 1
+ :completeopt {:menuone :noselect}
+ :conceallevel 0
+ :fileencoding :utf-8
+ :hlsearch true
+ :ignorecase true
+ :mouse ""
+ :pumheight 10
+ :showmode false
+ :showtabline 0
+ :smartcase true
+ :smartindent true
+ :splitbelow true
+ :splitright true
+ :swapfile false
+ :termguicolors true
+ :timeoutlen 1000
+ :undofile true
+ :updatetime 1000
+ :writebackup false
+ :expandtab true
+ :shiftwidth 2
+ :tabstop 2
+ :cursorline true
+ :number true
+ :relativenumber true
+ :numberwidth 2
+ :signcolumn :yes
+ :wrap false
+ :laststatus 3
+ :autoread true
+ :scrolloff 8
+ :sidescrolloff 8
+ :colorcolumn :88
+ :shortmess :filnxtToOFWIcC
+ :spell true
+ : spellfile
+ :spelllang [:en_us]
+ :guifont "monospace:h17"
+ :splitkeep :screen
+ :inccommand :split
+ :winborder :single
+ :shada ["'10" :<0 :s10 :h]})
(vim.opt.jumpoptions:append :stack)
diff --git a/fnl/util/cmds.fnl b/fnl/util/cmds.fnl
deleted file mode 100644
index 5881634..0000000
--- a/fnl/util/cmds.fnl
+++ /dev/null
@@ -1,11 +0,0 @@
-(λ create-user-cmds [user-cmds]
- (each [_ user-cmd (ipairs user-cmds)]
- (match user-cmd
- [event cmd opts] (vim.api.nvim_create_user_command event cmd opts))))
-
-(λ create-auto-cmds [auto-cmds]
- (each [_ auto-cmd (ipairs auto-cmds)]
- (match auto-cmd
- [event opts] (vim.api.nvim_create_autocmd event opts))))
-
-{: create-user-cmds : create-auto-cmds}
diff --git a/fnl/util/load.fnl b/fnl/util/load.fnl
deleted file mode 100644
index afc6cf1..0000000
--- a/fnl/util/load.fnl
+++ /dev/null
@@ -1,8 +0,0 @@
-;; Load file with function
-
-(λ apply-to-files [path f]
- (each [fname type (vim.fs.dir (.. (vim.fn.stdpath :config) path))]
- (when (= type :file)
- (f (fname:match "^(.*)%.fnl$")))))
-
-{: apply-to-files}
diff --git a/lazy-lock.json b/lazy-lock.json
index 2c11cae..00158a9 100644
--- a/lazy-lock.json
+++ b/lazy-lock.json
@@ -1,12 +1,12 @@
{
"LuaSnip": { "branch": "master", "commit": "642b0c595e11608b4c18219e93b88d7637af27bc" },
- "alpha-nvim": { "branch": "main", "commit": "7563da4a861ee6b3ed674d0ee5c5c0bd19383a38" },
"blink.cmp": { "branch": "main", "commit": "78336bc89ee5365633bcf754d93df01678b5c08f" },
"compile-mode.nvim": { "branch": "main", "commit": "ce34ad9e69cb6a2d9f71017f4cb090195fb9fc09" },
"conform.nvim": { "branch": "master", "commit": "086a40dc7ed8242c03be9f47fbcee68699cc2395" },
"dial.nvim": { "branch": "master", "commit": "f2634758455cfa52a8acea6f142dcd6271a1bf57" },
"diffview.nvim": { "branch": "main", "commit": "4516612fe98ff56ae0415a259ff6361a89419b0a" },
"easyread.nvim": { "branch": "main", "commit": "0b07e315a4cd7d700c4a794bdddbec79fdc2628b" },
+ "fff.nvim": { "branch": "main", "commit": "7de55be63d725d94944e5e89206284a67b8baa08" },
"flit.nvim": { "branch": "main", "commit": "ef18183b22377741e154cffb5b914516381d3870" },
"friendly-snippets": { "branch": "main", "commit": "6cd7280adead7f586db6fccbd15d2cac7e2188b9" },
"git-worktree.nvim": { "branch": "master", "commit": "666f84ba8dd9172f0a7b45c9f7c24bc5e55f6fc2" },
@@ -30,6 +30,7 @@
"nvim-lspconfig": { "branch": "master", "commit": "4b7fbaa239c5db6b36f424a4521ca9f1a401be33" },
"nvim-surround": { "branch": "main", "commit": "1098d7b3c34adcfa7feb3289ee434529abd4afd1" },
"nvim-treesitter": { "branch": "master", "commit": "cf12346a3414fa1b06af75c79faebe7f76df080a" },
+ "nvim-treesitter-context": { "branch": "master", "commit": "b0c45cefe2c8f7b55fc46f34e563bc428ef99636" },
"nvim-treesitter-textobjects": { "branch": "master", "commit": "5ca4aaa6efdcc59be46b95a3e876300cfead05ef" },
"nvim-various-textobjs": { "branch": "main", "commit": "ad78e9d925c95d675b32dd7ba6d253f96ce063fe" },
"nvim-web-devicons": { "branch": "master", "commit": "c72328a5494b4502947a022fe69c0c47e53b6aa6" },