summaryrefslogtreecommitdiff
path: root/fnl
diff options
context:
space:
mode:
authoraktersnurra <gustaf@gustafrydholm.xyz>2026-04-17 23:34:22 +0200
committeraktersnurra <gustaf@gustafrydholm.xyz>2026-04-18 00:50:44 +0200
commitac8edfb0db52efe65e01f73ef44133a86571ba02 (patch)
tree928d8f0d5ce0520d5acf782c4fdfd452f8f8470f /fnl
parent152fd9d787c7433cad95795992e444250cb83216 (diff)
More based fixes
Diffstat (limited to 'fnl')
-rw-r--r--fnl/plugins/cmp.fnl4
-rw-r--r--fnl/plugins/conform.fnl16
-rw-r--r--fnl/plugins/fff.fnl45
-rw-r--r--fnl/plugins/grug-far.fnl9
-rw-r--r--fnl/plugins/harpoon.fnl21
-rw-r--r--fnl/plugins/leap.fnl2
-rw-r--r--fnl/plugins/lsp/keymaps.fnl68
-rw-r--r--fnl/plugins/lsp/servers.fnl2
-rw-r--r--fnl/plugins/lualine.fnl21
-rw-r--r--fnl/plugins/markdown.fnl6
-rw-r--r--fnl/plugins/neogit.fnl13
-rw-r--r--fnl/plugins/nvim-lint.fnl11
-rw-r--r--fnl/plugins/orgmode.fnl38
-rw-r--r--fnl/plugins/persistence.fnl31
-rw-r--r--fnl/plugins/snippets.fnl3
-rw-r--r--fnl/plugins/telescope.fnl40
-rw-r--r--fnl/plugins/treesitter-context.fnl4
-rw-r--r--fnl/plugins/treesitter.fnl278
-rw-r--r--fnl/plugins/which-key.fnl25
-rw-r--r--fnl/plugins/window-picker.fnl2
-rw-r--r--fnl/settings/autocmds.fnl50
-rw-r--r--fnl/settings/init.fnl14
-rw-r--r--fnl/settings/keymaps.fnl46
-rw-r--r--fnl/settings/terminal.fnl6
24 files changed, 416 insertions, 339 deletions
diff --git a/fnl/plugins/cmp.fnl b/fnl/plugins/cmp.fnl
index 46efbc5..78f7522 100644
--- a/fnl/plugins/cmp.fnl
+++ b/fnl/plugins/cmp.fnl
@@ -15,8 +15,8 @@
:buffer]
:score_offset 3}
:snippets {:name :Snippets
- :module :blink.cmp.sources.snippets
- :score_offset 4}
+ :module :blink.cmp.sources.snippets
+ :score_offset 4}
:dadbod {:name :Dadbod
:module :vim_dadbod_completion.blink
:score_offset 2}}}
diff --git a/fnl/plugins/conform.fnl b/fnl/plugins/conform.fnl
index b84627d..5995635 100644
--- a/fnl/plugins/conform.fnl
+++ b/fnl/plugins/conform.fnl
@@ -1,11 +1,13 @@
;; Formatting
+(import-macros {: keymap} :macros)
+
(λ init []
- (vim.keymap.set [:n :v] :<leader>e
- (λ []
- (let [conform (require :conform)]
- (conform.format {:lsp_fallback true :async true})))
- {:desc :Format}))
+ (keymap [:n :v] :<leader>e
+ (λ []
+ (let [conform (require :conform)]
+ (conform.format {:lsp_fallback true :async true})))
+ {:desc :Format}))
(local opts {:formatters {:fnlfmt {:command :fnlfmt
:args [:--fix :$FILENAME]
@@ -22,7 +24,9 @@
:lua [:stylua]
:markdown [:prettierd]
:ocaml [:ocamlformat]
- :python [:ruff_format :ruff_fix :ruff_organize_imports]
+ :python [:ruff_format
+ :ruff_fix
+ :ruff_organize_imports]
:rust [:rustfmt]
:sh [:shfmt :shellharden]
:sql [:pg_format :sqlfmt]
diff --git a/fnl/plugins/fff.fnl b/fnl/plugins/fff.fnl
index 3939408..e92e358 100644
--- a/fnl/plugins/fff.fnl
+++ b/fnl/plugins/fff.fnl
@@ -3,30 +3,37 @@
(import-macros {: autocmd} :macros)
(λ init []
- (autocmd :VimEnter
- {:callback (λ []
- (when (= (. (vim.fn.argv) 1) nil)
- (vim.schedule
- (λ [] ((. (require :fff) :find_files))))))
- :once true}))
+ (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}})
+ :width 0.7
+ :prompt_position :top
+ :preview_position :bottom
+ :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)))))))
+ ((. (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"}]}
+ :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 ebd1835..342d266 100644
--- a/fnl/plugins/grug-far.fnl
+++ b/fnl/plugins/grug-far.fnl
@@ -17,11 +17,10 @@
(λ config []
(let [grug (require :grug-far)]
- (autocmds
- [:FileType
- {:pattern [:grug-far]
- :command "nnoremap <silent> <buffer> q :close<CR>"}]
- [:FileType {:pattern [:grug-far] :command "setlocal spell!"}])
+ (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 29f41d0..c4c7975 100644
--- a/fnl/plugins/harpoon.fnl
+++ b/fnl/plugins/harpoon.fnl
@@ -12,17 +12,16 @@
(: (harpoon:list) :select nr)))
(λ init []
- (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}]))
+ (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 0526109..d6ec18e 100644
--- a/fnl/plugins/leap.fnl
+++ b/fnl/plugins/leap.fnl
@@ -26,7 +26,7 @@
(λ config []
(let [leap (require :leap)]
- (tset leap.opts.vim_opts "go.ignorecase" false)
+ (tset leap.opts.vim_opts :go.ignorecase false)
(vim.keymap.set [:n :x :o] :s "<Plug>(leap-forward)")
(vim.keymap.set [:n :x :o] :S "<Plug>(leap-backward)")
(vim.keymap.set [:x :o] :x "<Plug>(leap-forward-till)")
diff --git a/fnl/plugins/lsp/keymaps.fnl b/fnl/plugins/lsp/keymaps.fnl
index 3477f0a..1b97668 100644
--- a/fnl/plugins/lsp/keymaps.fnl
+++ b/fnl/plugins/lsp/keymaps.fnl
@@ -3,20 +3,58 @@
(import-macros {: keymaps} :macros)
(λ on-attach [buffer]
- (keymaps
- [:n :gD "<cmd>lua vim.lsp.buf.declaration()<CR>" {:desc :Declaration :buffer buffer}]
- [:n :gd "<cmd>Telescope lsp_definitions theme=get_dropdown<cr>" {:desc :Definition :buffer buffer}]
- [:n :gI "<cmd>Telescope lsp_implementations theme=get_dropdown<cr>" {:desc :Implementation :buffer buffer}]
- [:n :gr "<cmd>Telescope lsp_references theme=get_dropdown<cr>" {:desc :References :buffer buffer}]
- [:n :gl "<cmd>lua vim.diagnostic.open_float()<CR>" {:desc :Diagnostics :buffer buffer}]
- [:n :gj "<cmd>Telescope diagnostics theme=get_dropdown<cr>" {:desc "Telescope Diagnostics" :buffer buffer}]
- [:n :gw "<cmd>Telescope lsp_dynamic_workspace_symbols theme=get_dropdown<cr>" {:desc "Workspace Symbols" :buffer buffer}]
- [:n :gE "<cmd>Telescope lsp_type_definitions theme=get_dropdown<cr>" {:desc "Type Definitions" :buffer buffer}]
- [:n :gm "<cmd>lua vim.lsp.buf.signature_help()<CR>" {:desc :Signature :buffer buffer}]
- [:n :gM "<cmd>Telescope lsp_document_symbols theme=get_dropdown<cr>" {:desc "Document Symbols" :buffer buffer}]
- [:n :gh "<cmd>lua vim.lsp.buf.code_action()<cr>" {:desc "Code Action" :buffer buffer}]
- [:n :gb "<cmd>lua vim.lsp.codelens.run()<cr>" {:desc "Code Lens" :buffer buffer}]
- [:n :K "<cmd>lua vim.lsp.buf.hover()<cr>" {:desc "Hover documentation" :buffer buffer}]
- [:n :<leader>li :<cmd>LspInfo<cr> {:desc "Lsp Info" :buffer buffer}]))
+ (keymaps [:n
+ :gD
+ "<cmd>lua vim.lsp.buf.declaration()<CR>"
+ {:desc :Declaration : buffer}]
+ [:n
+ :gd
+ "<cmd>Telescope lsp_definitions theme=get_dropdown<cr>"
+ {:desc :Definition : buffer}]
+ [:n
+ :gI
+ "<cmd>Telescope lsp_implementations theme=get_dropdown<cr>"
+ {:desc :Implementation : buffer}]
+ [:n
+ :gr
+ "<cmd>Telescope lsp_references theme=get_dropdown<cr>"
+ {:desc :References : buffer}]
+ [:n
+ :gl
+ "<cmd>lua vim.diagnostic.open_float()<CR>"
+ {:desc :Diagnostics : buffer}]
+ [:n
+ :gj
+ "<cmd>Telescope diagnostics theme=get_dropdown<cr>"
+ {:desc "Telescope Diagnostics" : buffer}]
+ [:n
+ :gw
+ "<cmd>Telescope lsp_dynamic_workspace_symbols theme=get_dropdown<cr>"
+ {:desc "Workspace Symbols" : buffer}]
+ [:n
+ :gE
+ "<cmd>Telescope lsp_type_definitions theme=get_dropdown<cr>"
+ {:desc "Type Definitions" : buffer}]
+ [:n
+ :gm
+ "<cmd>lua vim.lsp.buf.signature_help()<CR>"
+ {:desc :Signature : buffer}]
+ [:n
+ :gM
+ "<cmd>Telescope lsp_document_symbols theme=get_dropdown<cr>"
+ {:desc "Document Symbols" : buffer}]
+ [:n
+ :gh
+ "<cmd>lua vim.lsp.buf.code_action()<cr>"
+ {:desc "Code Action" : buffer}]
+ [:n
+ :gb
+ "<cmd>lua vim.lsp.codelens.run()<cr>"
+ {:desc "Code Lens" : buffer}]
+ [:n
+ :K
+ "<cmd>lua vim.lsp.buf.hover()<cr>"
+ {:desc "Hover documentation" : buffer}]
+ [:n :<leader>li :<cmd>LspInfo<cr> {:desc "Lsp Info" : buffer}]))
{: on-attach}
diff --git a/fnl/plugins/lsp/servers.fnl b/fnl/plugins/lsp/servers.fnl
index 13c6c9e..bd7c3e4 100644
--- a/fnl/plugins/lsp/servers.fnl
+++ b/fnl/plugins/lsp/servers.fnl
@@ -20,8 +20,8 @@
:path (vim.split package.path ";")}}}}
:taplo {}
:texlab {}
+ :basedpyright {:settings {:basedpyright {:analysis {:typeCheckingMode :standard}}}}
:ty {}
- :vale_ls {:filetypes [:markdown :text :org]}
:sqls {}
:yamlls {:settings {:yaml {:schemastore {:enable false :url ""}
:schemas (let [schemastore (require :schemastore)]
diff --git a/fnl/plugins/lualine.fnl b/fnl/plugins/lualine.fnl
index b331e79..93a2f94 100644
--- a/fnl/plugins/lualine.fnl
+++ b/fnl/plugins/lualine.fnl
@@ -42,18 +42,8 @@
(local branch {1 "b:gitsigns_head" :icon (. icons :git) :cond hide-in-width})
-(local filetype {1 :filetype
- :icon_only true
- :colored false
- :cond hide-in-width})
-
(local language-server {1 active-clients :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 :no-clown-fiesta
:component_separators ""
@@ -65,8 +55,8 @@
:sections {:lualine_a [:mode]
:lualine_b [:filename branch diff]
:lualine_c {}
- :lualine_x [lsp-progress language-server diagnostics]
- :lualine_y [filetype]
+ :lualine_x [language-server diagnostics]
+ :lualine_y {}
:lualine_z [:location :progress]}
:inactive_sections {:lualine_a [:mode]
:lualine_b {}
@@ -76,9 +66,4 @@
:lualine_z [:location :progress]}
:extensions [:oil :mason]})
-(local dependencies [:arkav/lualine-lsp-progress])
-
-{1 :nvim-lualine/lualine.nvim
- :event :VeryLazy
- : opts
- : dependencies}
+{1 :nvim-lualine/lualine.nvim :event :VeryLazy : opts}
diff --git a/fnl/plugins/markdown.fnl b/fnl/plugins/markdown.fnl
index 1d6a2c7..03a6e24 100644
--- a/fnl/plugins/markdown.fnl
+++ b/fnl/plugins/markdown.fnl
@@ -1,7 +1,5 @@
;; Markdown renderer plugin.
-{1 :MeanderingProgrammer/markdown.nvim
- :main :render-markdown
+{1 :MeanderingProgrammer/render-markdown.nvim
:opts {}
- :name :render-markdown
- :dependencies [ :nvim-treesitter/nvim-treesitter :nvim-tree/nvim-web-devicons ]}
+ :dependencies [:nvim-treesitter/nvim-treesitter :nvim-tree/nvim-web-devicons]}
diff --git a/fnl/plugins/neogit.fnl b/fnl/plugins/neogit.fnl
index 143699d..b8ee757 100644
--- a/fnl/plugins/neogit.fnl
+++ b/fnl/plugins/neogit.fnl
@@ -7,13 +7,12 @@
(local keys [{1 :<leader>gm 2 :<cmd>Neogit<cr> :desc :Neogit}])
(λ init []
- (autocmds
- [:FileType
- {:pattern [:NeogitStatus
- :NeogitCommitMessage
- :NeogitNotification
- :NeogitCommitView]
- :command "setlocal spell!"}]))
+ (autocmds [:FileType
+ {:pattern [:NeogitStatus
+ :NeogitCommitMessage
+ :NeogitNotification
+ :NeogitCommitView]
+ :command "setlocal spell!"}]))
(local opts {:integrations {:diffview true :telescope true}})
diff --git a/fnl/plugins/nvim-lint.fnl b/fnl/plugins/nvim-lint.fnl
index 2d1887d..040bcc4 100644
--- a/fnl/plugins/nvim-lint.fnl
+++ b/fnl/plugins/nvim-lint.fnl
@@ -1,20 +1,19 @@
;; Linting
+(import-macros {: autocmd} :macros)
+
(λ callback []
(let [lint (require :lint)]
(lint.try_lint)))
(λ init []
(let [lint-augroup (vim.api.nvim_create_augroup :lint {:clear true})]
- (vim.api.nvim_create_autocmd [:BufEnter
- :BufWritePost
- :InsertLeave
- :TextChangedI]
- {:group lint-augroup : callback})))
+ (autocmd [:BufEnter :BufWritePost :InsertLeave :TextChangedI]
+ {:group lint-augroup : callback})))
(λ config []
(let [lint (require :lint)]
- (set lint.linters_by_ft {:* [:codespell :write_good]
+ (set lint.linters_by_ft {:* [:codespell]
:dockerfile [:hadolint]
:fennel [:fennel]
:gitcommit [:gitlint :codespell]
diff --git a/fnl/plugins/orgmode.fnl b/fnl/plugins/orgmode.fnl
index 60bc15c..e945ae9 100644
--- a/fnl/plugins/orgmode.fnl
+++ b/fnl/plugins/orgmode.fnl
@@ -18,26 +18,24 @@
:desc "Search headings"}])
(λ init []
- (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))}]))
+ (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 2e81e78..8c2ff55 100644
--- a/fnl/plugins/persistence.fnl
+++ b/fnl/plugins/persistence.fnl
@@ -11,22 +11,21 @@
:desc "Ignore current session"}])
(λ init []
- (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}]))
+ (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 c45d220..70917ba 100644
--- a/fnl/plugins/snippets.fnl
+++ b/fnl/plugins/snippets.fnl
@@ -10,7 +10,8 @@
(let [ls (require :luasnip)
luasnip-vscode (require :luasnip.loaders.from_vscode)]
(luasnip-vscode.lazy_load)
- (each [fname type (vim.fs.dir (.. (vim.fn.stdpath :config) :/fnl/plugins/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
diff --git a/fnl/plugins/telescope.fnl b/fnl/plugins/telescope.fnl
index 3932d84..dedaaea 100644
--- a/fnl/plugins/telescope.fnl
+++ b/fnl/plugins/telescope.fnl
@@ -1,30 +1,9 @@
;; Telescope a highly extendable fuzzy finder over lists.
(local dependencies
- [{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 (λ [_ opts]
- (let [project (require :project_nvim)]
- (project.setup opts)))}
- :nvim-lua/plenary.nvim
- {1 :nvim-orgmode/telescope-orgmode.nvim}])
+ [:nvim-lua/plenary.nvim {1 :nvim-orgmode/telescope-orgmode.nvim}])
-(local extensions [:orgmode :projects :git_worktree :harpoon])
+(local extensions [:orgmode :git_worktree :harpoon])
(λ load-extensions [telescope]
(each [_ extension (ipairs extensions)]
@@ -42,15 +21,9 @@
{1 :<leader>fR
2 "<cmd>Telescope registers theme=dropdown<cr>"
:desc :Registers}
- {1 :<leader>fS
- 2 "<cmd>Telescope grep_string theme=dropdown<cr>"
- :desc "Find String"}
{1 :<leader>gb
2 "<cmd>Telescope git_branches theme=dropdown<cr>"
:desc "Checkout Branch"}
- {1 :<leader>ff
- 2 "<cmd>Telescope find_files theme=dropdown<cr>"
- :desc "Find files"}
{1 :<leader>fh
2 "<cmd>Telescope help_tags theme=dropdown<cr>"
:desc :Help}
@@ -60,15 +33,6 @@
{1 :<leader>fl
2 "<cmd>Telescope resume theme=dropdown<cr>"
:desc "Last Search"}
- {1 :<leader>fp
- 2 "<cmd>Telescope projects theme=dropdown<cr>"
- :desc "Find Project"}
- {1 :<leader>fr
- 2 "<cmd>Telescope oldfiles theme=dropdown previewer=false<cr>"
- :desc "Recent File"}
- {1 :<leader>ft
- 2 "<cmd>Telescope live_grep theme=dropdown<cr>"
- :desc "Find Text"}
{1 :<leader>gc
2 "<cmd>Telescope git_commits theme=dropdown<cr>"
:desc "Checkout Commit"}])
diff --git a/fnl/plugins/treesitter-context.fnl b/fnl/plugins/treesitter-context.fnl
index f7730bd..900889a 100644
--- a/fnl/plugins/treesitter-context.fnl
+++ b/fnl/plugins/treesitter-context.fnl
@@ -10,4 +10,6 @@
:separator nil
:zindex 20})
-{1 :nvim-treesitter/nvim-treesitter-context :event [:BufReadPre :BufNewFile] : opts}
+{1 :nvim-treesitter/nvim-treesitter-context
+ :event [:BufReadPre :BufNewFile]
+ : opts}
diff --git a/fnl/plugins/treesitter.fnl b/fnl/plugins/treesitter.fnl
index b75eba3..cc0b6cc 100644
--- a/fnl/plugins/treesitter.fnl
+++ b/fnl/plugins/treesitter.fnl
@@ -1,98 +1,196 @@
-;; Treesitter is a tool for building syntax trees for source files.
-;; In the neovim context it helps with better coloring.
+;; Treesitter parser installation and built-in feature configuration.
-(local opts
- {:ensure_installed [:bash
- :c
- :comment
- :dockerfile
- :elixir
- :erlang
- :fennel
- :graphql
- :haskell
- :hcl
- :html
- :http
- :json
- :latex
- :lua
- :make
- :markdown
- :ocaml
- :ocaml_interface
- :python
- :rust
- :sql
- :toml
- :unison
- :vim
- :vimdoc
- :xml
- :yaml]
- :sync_install false
- :ignore_install [""]
- :autopairs {:enable true}
- :highlight {:enable true :additional_vim_regex_highlighting [:org]}
- :context_commentstring {:enable true :enable_autocmd false}
- :indent {:enable true :disable [:yaml :python :css]}
- :playground {:enable true}
- :textobjects {:select {:enable true
- :lookahead true
- :keymaps {:aa "@parameter.outer"
- :ia "@parameter.inner"
- :af "@function.outer"
- :if "@function.inner"
- :ii "@conditional.outer"
- :ai "@conditional.inner"
- :il "@loop.outer"
- :al "@loop.inner"
- :ac "@class.outer"
- :at "@comment.outer"
- :ic {:query "@class.inner"
- :desc "Select inner part of a class region"}
- :as {:query "@scope"
- :query_group :locals
- :desc "Select language scope"}}
- :selection_modes {"@parameter.outer" :v
- "@function.outer" :V
- "@class.outer" :<c-v>}
- :include_surrounding_whitespace true}
- :swap {:enable true
- :swap_next {:<leader>a "@parameter.inner"}
- :swap_previous {:<leader>A "@parameter.inner"}}
- :move {:enable true
- :set_jumps true
- :goto_next_start {"]m" "@function.outer"
- "]]" {:query "@class.outer"
- :desc "Next class start"}
- "]o" "@loop.*"
- "]s" {:query "@scope"
- :query_group :locals
- :desc "Next scope"}
- "]z" {:query "@fold"
- :query_group :folds
- :desc "Next fold"}}
- :goto_next_end {"]M" "@function.outer"
- "][" "@class.outer"}
- :goto_previous_start {"[m" "@function.outer"
- "[[" "@class.outer"}
- :goto_previous_end {"[M" "@function.outer"
- "[]" "@class.outer"}
- :goto_next {"]i" "@conditional.outer"}
- :goto_previous {"[i" "@conditional.outer"}}
- :lsp_interop {:enable true
- :border :single
- :floating_preview_opts {}
- :peek_definition_code {:md "@function.outer"
- :mD "@class.outer"}}}})
+(import-macros {: autocmd : keymaps} :macros)
+
+(local parsers [:bash
+ :c
+ :comment
+ :dockerfile
+ :elixir
+ :erlang
+ :fennel
+ :graphql
+ :haskell
+ :hcl
+ :html
+ :http
+ :json
+ :latex
+ :lua
+ :make
+ :markdown
+ :markdown_inline
+ :ocaml
+ :ocaml_interface
+ :python
+ :rust
+ :sql
+ :toml
+ :unison
+ :vim
+ :vimdoc
+ :xml
+ :yaml])
+
+(λ setup-textobjects []
+ (let [textobjects (require :nvim-treesitter-textobjects)
+ select (require :nvim-treesitter-textobjects.select)
+ swap (require :nvim-treesitter-textobjects.swap)
+ move (require :nvim-treesitter-textobjects.move)]
+ (textobjects.setup {:select {:lookahead true
+ :selection_modes {"@parameter.outer" :v
+ "@function.outer" :V
+ "@class.outer" :<c-v>}
+ :include_surrounding_whitespace true}
+ :move {:set_jumps true}})
+ (keymaps [[:x :o]
+ :aa
+ (λ []
+ (select.select_textobject "@parameter.outer" :textobjects))
+ {}] [[:x :o]
+ :ia
+ (λ []
+ (select.select_textobject "@parameter.inner"
+ :textobjects))
+ {}]
+ [[:x :o]
+ :af
+ (λ []
+ (select.select_textobject "@function.outer" :textobjects))
+ {}] [[:x :o]
+ :if
+ (λ []
+ (select.select_textobject "@function.inner"
+ :textobjects))
+ {}]
+ [[:x :o]
+ :ii
+ (λ []
+ (select.select_textobject "@conditional.outer" :textobjects))
+ {}] [[:x :o]
+ :ai
+ (λ []
+ (select.select_textobject "@conditional.inner"
+ :textobjects))
+ {}]
+ [[:x :o]
+ :il
+ (λ []
+ (select.select_textobject "@loop.outer" :textobjects))
+ {}] [[:x :o]
+ :al
+ (λ []
+ (select.select_textobject "@loop.inner"
+ :textobjects))
+ {}]
+ [[:x :o]
+ :ac
+ (λ []
+ (select.select_textobject "@class.outer" :textobjects))
+ {}] [[:x :o]
+ :at
+ (λ []
+ (select.select_textobject "@comment.outer"
+ :textobjects))
+ {}]
+ [[:x :o]
+ :ic
+ (λ []
+ (select.select_textobject "@class.inner" :textobjects))
+ {}] [[:x :o]
+ :as
+ (λ []
+ (select.select_textobject "@local.scope"
+ :locals))
+ {}] ;; Swap
+ [:n
+ :<leader>a
+ (λ []
+ (swap.swap_next "@parameter.inner"))
+ {}] [:n
+ :<leader>A
+ (λ []
+ (swap.swap_previous "@parameter.inner"))
+ {}] ;; Move
+ [[:n :x :o]
+ "]m"
+ (λ []
+ (move.goto_next_start "@function.outer" :textobjects))
+ {}] [[:n :x :o]
+ "]]"
+ (λ []
+ (move.goto_next_start "@class.outer"
+ :textobjects))
+ {}]
+ [[:n :x :o]
+ "]o"
+ (λ []
+ (move.goto_next_start ["@loop.inner" "@loop.outer"]
+ :textobjects))
+ {}] [[:n :x :o]
+ "]s"
+ (λ []
+ (move.goto_next_start "@local.scope" :locals))
+ {}]
+ [[:n :x :o]
+ "]z"
+ (λ []
+ (move.goto_next_start "@fold" :folds))
+ {}] [[:n :x :o]
+ "]M"
+ (λ []
+ (move.goto_next_end "@function.outer"
+ :textobjects))
+ {}]
+ [[:n :x :o]
+ "]["
+ (λ []
+ (move.goto_next_end "@class.outer" :textobjects))
+ {}] [[:n :x :o]
+ "[m"
+ (λ []
+ (move.goto_previous_start "@function.outer"
+ :textobjects))
+ {}]
+ [[:n :x :o]
+ "[["
+ (λ []
+ (move.goto_previous_start "@class.outer" :textobjects))
+ {}] [[:n :x :o]
+ "[M"
+ (λ []
+ (move.goto_previous_end "@function.outer"
+ :textobjects))
+ {}]
+ [[:n :x :o]
+ "[]"
+ (λ []
+ (move.goto_previous_end "@class.outer" :textobjects))
+ {}] [[:n :x :o]
+ "]i"
+ (λ []
+ (move.goto_next "@conditional.outer"
+ :textobjects))
+ {}]
+ [[:n :x :o]
+ "[i"
+ (λ []
+ (move.goto_previous "@conditional.outer" :textobjects))
+ {}])))
(λ config []
- (let [treesitter (require :nvim-treesitter.configs)]
- (treesitter.setup opts)))
+ (let [treesitter (require :nvim-treesitter)]
+ (treesitter.install parsers))
+ (autocmd :FileType
+ {:callback (λ [args]
+ (pcall vim.treesitter.start args.buf)
+ (tset vim.bo args.buf :indentexpr
+ "v:lua.require'nvim-treesitter'.indentexpr()"))})
+ (setup-textobjects))
{1 :nvim-treesitter/nvim-treesitter
- :dependencies [{1 :nvim-treesitter/nvim-treesitter-textobjects :lazy true}]
+ :branch :main
+ :dependencies [{1 :nvim-treesitter/nvim-treesitter-textobjects :branch :main}]
:build ":TSUpdate"
:event [:VeryLazy]
: config}
diff --git a/fnl/plugins/which-key.fnl b/fnl/plugins/which-key.fnl
index 189a4a4..8b66834 100644
--- a/fnl/plugins/which-key.fnl
+++ b/fnl/plugins/which-key.fnl
@@ -37,18 +37,19 @@
:show_help true
:disable {:filetypes [:netrw]}})
-(local groups [{:mode [:n :v]
- 1 {1 :<leader>d :group :+diff}
- 2 {1 :<leader>f :group :+find}
- 3 {1 :<leader>g :group :+git}
- 4 {1 :<leader>i :group :+db}
- 5 {1 :<leader>j :group :+diagnostics}
- 6 {1 :<leader>l :group :+lsp}
- 7 {1 :<leader>o :group :+orgmode}
- 8 {1 :<leader>r :group :+replace}
- 9 {1 :<leader>s :group :+session}
- 10 {1 :<leader>w :group :+worktree}}
- {1 :<leader><BS> 2 "<cmd>bdelete<cr>" :desc "Close Buffer"}])
+(local groups
+ [{:mode [:n :v]
+ 1 {1 :<leader>d :group :+diff}
+ 2 {1 :<leader>f :group :+find}
+ 3 {1 :<leader>g :group :+git}
+ 4 {1 :<leader>i :group :+db}
+ 5 {1 :<leader>j :group :+diagnostics}
+ 6 {1 :<leader>l :group :+lsp}
+ 7 {1 :<leader>o :group :+orgmode}
+ 8 {1 :<leader>r :group :+replace}
+ 9 {1 :<leader>s :group :+session}
+ 10 {1 :<leader>w :group :+worktree}}
+ {1 :<leader><BS> 2 :<cmd>bdelete<cr> :desc "Close Buffer"}])
(λ config []
(let [which-key (require :which-key)]
diff --git a/fnl/plugins/window-picker.fnl b/fnl/plugins/window-picker.fnl
index 68b7786..fa03722 100644
--- a/fnl/plugins/window-picker.fnl
+++ b/fnl/plugins/window-picker.fnl
@@ -14,6 +14,6 @@
(let [window-picker (require :window-picker)]
(window-picker.setup opts)
(vim.keymap.set :n :mw (λ []
- (pick-window)) {})))
+ (pick-window)) {})))
{1 :s1n7ax/nvim-window-picker :event :VeryLazy :version :2.0.0 : config}
diff --git a/fnl/settings/autocmds.fnl b/fnl/settings/autocmds.fnl
index 2f0a3cd..2dd0c71 100644
--- a/fnl/settings/autocmds.fnl
+++ b/fnl/settings/autocmds.fnl
@@ -2,29 +2,27 @@
(import-macros {: autocmds} :macros)
-(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))}])
+(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/init.fnl b/fnl/settings/init.fnl
index d01d848..4bb0e4c 100644
--- a/fnl/settings/init.fnl
+++ b/fnl/settings/init.fnl
@@ -1,12 +1,12 @@
;; Load nvim settings
+(import-macros {: autocmd} :macros)
+
(require :settings.options)
(require :settings.terminal)
-(vim.api.nvim_create_autocmd :User
- {:group (vim.api.nvim_create_augroup :Lazy
- {:clear true})
- :pattern :VeryLazy
- :callback (λ []
- (require :settings.autocmds)
- (require :settings.keymaps))})
+(autocmd :User {:group (vim.api.nvim_create_augroup :Lazy {:clear true})
+ :pattern :VeryLazy
+ :callback (λ []
+ (require :settings.autocmds)
+ (require :settings.keymaps))})
diff --git a/fnl/settings/keymaps.fnl b/fnl/settings/keymaps.fnl
index fcc7511..d10b34e 100644
--- a/fnl/settings/keymaps.fnl
+++ b/fnl/settings/keymaps.fnl
@@ -2,33 +2,19 @@
(import-macros {: keymaps} :macros)
-(keymaps
- ;; Resize with arrows
- [:n :<m-f> :<c-w>+ {}]
- [:n :<m-p> :<c-w>- {}]
- [:n "<m-,>" :<c-w>5< {}]
- [:n :<m-.> :<c-w>5> {}]
- ;; Stay in indent mode
- [:v "<" :<gv {}]
- [:v ">" :>gv {}]
- ;; Move text up and down
- [:x :J ":move '>+1<CR>gv-gv" {}]
- [:x :K ":move '<-2<CR>gv-gv" {}]
- [:v :<c-n> ":m .+1<CR>==" {}]
- [:v :<c-e> ":m .-2<CR>==" {}]
- [:v :p "\"_dP" {}]
- ;; Splits
- [:n :<m-s> :<cmd>split<CR> {}]
- [:n :<m-t> :<cmd>vsplit<CR> {}]
- ;; Buf navigation
- [:n :<c-n> :<cmd>bprev<CR> {}]
- [:n :<c-e> :<cmd>bnext<CR> {}]
- ;; Jump half a page and centralize the view
- [:n :<c-d> :<c-d>zz {}]
- [:n :<c-u> :<c-u>zz {}]
- ;; Remove highlighted search
- [:n :<m-h> :<cmd>nohlsearch<CR> {}]
- ;; Jump to eol in insert mode
- [:i :<c-e> :<c-o>$ {}]
- ;; Force refresh
- [:n :mj "<cmd>:e<CR>" {:desc :Refresh}])
+(keymaps ;; Resize with arrows
+ [:n :<m-f> :<c-w>+ {}] [:n :<m-p> :<c-w>- {}] [:n "<m-,>" :<c-w>5< {}]
+ [:n :<m-.> :<c-w>5> {}] ;; Stay in indent mode
+ [:v "<" :<gv {}] [:v ">" :>gv {}] ;; Move text up and down
+ [:x :J ":move '>+1<CR>gv-gv" {}] [:x :K ":move '<-2<CR>gv-gv" {}]
+ [:v :<c-n> ":m .+1<CR>==" {}] [:v :<c-e> ":m .-2<CR>==" {}]
+ [:v :p "\"_dP" {}] ;; Splits
+ [:n :<m-s> :<cmd>split<CR> {}] [:n :<m-t> :<cmd>vsplit<CR> {}]
+ ;; Buf navigation
+ [:n :<c-n> :<cmd>bprev<CR> {}] [:n :<c-e> :<cmd>bnext<CR> {}]
+ ;; Jump half a page and centralize the view
+ [:n :<c-d> :<c-d>zz {}] [:n :<c-u> :<c-u>zz {}]
+ ;; Remove highlighted search
+ [:n :<m-h> :<cmd>nohlsearch<CR> {}] ;; Jump to eol in insert mode
+ [:i :<c-e> :<c-o>$ {}] ;; Force refresh
+ [:n :mj "<cmd>:e<CR>" {:desc :Refresh}])
diff --git a/fnl/settings/terminal.fnl b/fnl/settings/terminal.fnl
index 16464ee..ca18327 100644
--- a/fnl/settings/terminal.fnl
+++ b/fnl/settings/terminal.fnl
@@ -1,3 +1,5 @@
+(import-macros {: keymap} :macros)
+
(local state {:buf -1 :win -1})
(fn hide-term []
@@ -10,7 +12,7 @@
(if (not (vim.api.nvim_buf_is_valid state.buf))
(do
(set state.buf (vim.api.nvim_get_current_buf))
- (vim.fn.termopen vim.o.shell)
+ (vim.cmd.terminal)
(set vim.opt_local.number false)
(set vim.opt_local.relativenumber false)
(set vim.opt_local.signcolumn :no))
@@ -22,4 +24,4 @@
(hide-term)
(open-term)))
-(vim.keymap.set [:n :t] :<c-_> toggle-term {:desc "Toggle terminal"})
+(keymap [:n :t] :<c-_> toggle-term {:desc "Toggle terminal"})