summaryrefslogtreecommitdiff
path: root/fnl
diff options
context:
space:
mode:
authorGustaf Rydholm <gustaf.rydholm@gmail.com>2023-01-13 01:35:12 +0100
committerGustaf Rydholm <gustaf.rydholm@gmail.com>2023-01-13 01:35:12 +0100
commit8d8cf86821d7cc1b093d149389baf5272e8033ca (patch)
tree793346b35c1ce6c60e0f7ee96c7e9696c3a2a36d /fnl
parentac8af14d5137de52ce12f432d61b1c3f9f8c185b (diff)
Refactor settings and plugins
Diffstat (limited to 'fnl')
-rw-r--r--fnl/plugins/init.fnl25
-rw-r--r--fnl/plugins/lazy.fnl58
-rw-r--r--fnl/plugins/lir.fnl2
-rw-r--r--fnl/plugins/lsp/keymaps.fnl36
-rw-r--r--fnl/settings/autocmds.fnl79
-rw-r--r--fnl/settings/keymaps.fnl94
-rw-r--r--fnl/settings/options.fnl162
-rw-r--r--fnl/settings/usercmds.fnl172
8 files changed, 313 insertions, 315 deletions
diff --git a/fnl/plugins/init.fnl b/fnl/plugins/init.fnl
index d767506..6b0bde8 100644
--- a/fnl/plugins/init.fnl
+++ b/fnl/plugins/init.fnl
@@ -1,11 +1,16 @@
-;; Returns a list of all plugins.
+;; Load all plugins.
-(let [plugins (require :plugins.lsp)
- path (.. (vim.fn.stdpath :config) :/fnl/plugins)]
- (if (vim.loop.fs_stat path)
- (do
- (each [fname (vim.fs.dir path)]
- (let [fname (fname:match "^(.*)%.fnl$")]
- (if (and (not= fname nil) (not= fname :init) (not= fname :lazy))
- (table.insert plugins (require (.. :plugins. fname))))))))
- plugins)
+(local plugins (let [plugins (require :plugins.lsp)
+ path (.. (vim.fn.stdpath :config) :/fnl/plugins)]
+ (if (vim.loop.fs_stat path)
+ (do
+ (each [fname (vim.fs.dir path)]
+ (let [fname (fname:match "^(.*)%.fnl$")]
+ (if (and (not= fname nil) (not= fname :init)
+ (not= fname :lazy))
+ (table.insert plugins
+ (require (.. :plugins. fname))))))))
+ plugins))
+
+(let [lazy (require :plugins.lazy)]
+ (lazy.setup plugins))
diff --git a/fnl/plugins/lazy.fnl b/fnl/plugins/lazy.fnl
index 25e374b..9c28a95 100644
--- a/fnl/plugins/lazy.fnl
+++ b/fnl/plugins/lazy.fnl
@@ -1,28 +1,34 @@
;; Lazy opts.
-{:install {:colorscheme [:no-clown-fiesta]}
- :performance {:cache {:enabled true}
- :rtp {:disabled_plugins [:gzip
- :matchit
- :matchparen
- :netrwPlugin
- :tarPlugin
- :tohtml
- :tutor
- :zipPlugin]}}
- :ui {:icons {:cmd " "
- :config " "
- :event " "
- :ft " "
- :init " "
- :import " "
- :keys " "
- :lazy "鈴 "
- :loaded "● "
- :not_loaded "○ "
- :plugin " "
- :runtime " "
- :source " "
- :start " "
- :task " "
- :list ["● " " " " " "‒ "]}}}
+(local opts {:install {:colorscheme [:no-clown-fiesta]}
+ :performance {:cache {:enabled true}
+ :rtp {:disabled_plugins [:gzip
+ :matchit
+ :matchparen
+ :netrwPlugin
+ :tarPlugin
+ :tohtml
+ :tutor
+ :zipPlugin]}}
+ :ui {:icons {:cmd " "
+ :config " "
+ :event " "
+ :ft " "
+ :init " "
+ :import " "
+ :keys " "
+ :lazy "鈴 "
+ :loaded "● "
+ :not_loaded "○ "
+ :plugin " "
+ :runtime " "
+ :source " "
+ :start " "
+ :task " "
+ :list ["● " " " " " "‒ "]}}})
+
+(fn setup [plugins]
+ (let [lazy (require :lazy)]
+ (lazy.setup plugins opts)))
+
+{: setup}
diff --git a/fnl/plugins/lir.fnl b/fnl/plugins/lir.fnl
index b23d439..8caa8e4 100644
--- a/fnl/plugins/lir.fnl
+++ b/fnl/plugins/lir.fnl
@@ -2,7 +2,7 @@
(fn opts [actions mark-actions clipboard-actions]
{:show_hidden_files false
- :devicons_enable true
+ :devicons {:enable true :highlight_dirname false}
:mappings {:l actions.edit
:<C-s> actions.split
:v actions.vsplit
diff --git a/fnl/plugins/lsp/keymaps.fnl b/fnl/plugins/lsp/keymaps.fnl
index a7fac89..9b95140 100644
--- a/fnl/plugins/lsp/keymaps.fnl
+++ b/fnl/plugins/lsp/keymaps.fnl
@@ -1,23 +1,21 @@
;; Key mappings for lsp.
-(fn on-attach [bufnr] (let [opts {:noremap true :silent true}]
- (vim.api.nvim_buf_set_keymap bufnr :n :gD
- "<cmd>lua vim.lsp.buf.declaration()<CR>"
- opts)
- (vim.api.nvim_buf_set_keymap bufnr :n :gd
- "<cmd>lua vim.lsp.buf.definition()<CR>"
- opts)
- (vim.api.nvim_buf_set_keymap bufnr :n :gI
- "<cmd>lua vim.lsp.buf.implementation()<CR>"
- opts)
- (vim.api.nvim_buf_set_keymap bufnr :n :gr
- "<cmd>lua vim.lsp.buf.references()<CR>"
- opts)
- (vim.api.nvim_buf_set_keymap bufnr :n :gl
- "<cmd>lua vim.diagnostic.open_float()<CR>"
- opts)
- (vim.api.nvim_buf_set_keymap bufnr :n :gs
- "<cmd>lua vim.lsp.buf.signature_help()<CR>"
- opts)))
+(local opts {:noremap true :silent true})
+
+(local mappings
+ [[:n :gD "<cmd>lua vim.lsp.buf.declaration()<CR>"]
+ [:n :gd "<cmd>lua vim.lsp.buf.definition()<CR>"]
+ [:n :gI "<cmd>lua vim.lsp.buf.implementation()<CR>"]
+ [:n :gr "<cmd>lua vim.lsp.buf.references()<CR>"]
+ [:n :gl "<cmd>lua vim.diagnostic.open_float()<CR>"]
+ [:n :gs "<cmd>lua vim.lsp.buf.signature_help()<CR>"]])
+
+(fn buf-set-keymap [bufnr mode key cmd opts]
+ (vim.api.nvim_buf_set_keymap bufnr mode key cmd opts))
+
+(fn on-attach [bufnr]
+ (each [_ mapping (ipairs mappings)]
+ (match mapping
+ [mode key cmd] (buf-set-keymap bufnr mode key cmd opts))))
{: on-attach}
diff --git a/fnl/settings/autocmds.fnl b/fnl/settings/autocmds.fnl
index 5ae8b8c..ca361b3 100644
--- a/fnl/settings/autocmds.fnl
+++ b/fnl/settings/autocmds.fnl
@@ -3,46 +3,39 @@
(fn create-autocmd [event opts]
(vim.api.nvim_create_autocmd event opts))
-(create-autocmd :FileType
- {:pattern [:qf :help :man :lspinfo :spectre_panel]
- :command "nnoremap <silent> <buffer> q :close<CR>"})
-
-(create-autocmd :TextYankPost
- {:callback (lambda []
- (vim.highlight.on_yank {:higroup :Visual
- :timeout 200}))})
-
-(create-autocmd :FileType {:pattern :lir
- :callback (fn []
- (tset vim.opt_local :number false)
- (tset vim.opt_local :relativenumber
- false))})
-
-(create-autocmd :BufWinEnter {:command "setlocal formatoptions-=cro"})
-
-(create-autocmd :FileType {:pattern :qf :command "set nobuflisted"})
-
-(create-autocmd :FileType {:pattern [:gitcommit :markdown]
- :command "setlocal wrap"})
-
-(create-autocmd :FileType
- {:pattern [:NeogitStatus
- :NeogitCommitMessage
- :NeogitNotification
- :NeogitCommitView]
- :command "setlocal spell!"})
-
-(create-autocmd :TermOpen
- {:pattern ["term://*toggleterm#*"] :command "setlocal spell!"})
-
-(create-autocmd :VimResized {:command "tabdo wincmd ="})
-
-(create-autocmd :FocusGained {:command :checktime})
-
-(create-autocmd :TermOpen
- {:pattern "term://*toggleterm#*"
- :callback (fn []
- (vim.keymap.set :t :<C-h> "<Cmd>wincmd h<CR>" {})
- (vim.keymap.set :t :<C-j> "<Cmd>wincmd j<CR>" {})
- (vim.keymap.set :t :<C-k> "<Cmd>wincmd k<CR>" {})
- (vim.keymap.set :t :<C-l> "<Cmd>wincmd l<CR>" {}))})
+(local autocmds
+ [[:FileType
+ {:pattern [:qf :help :man :lspinfo :spectre_panel]
+ :command "nnoremap <silent> <buffer> q :close<CR>"}]
+ [:TextYankPost
+ {:callback (lambda []
+ (vim.highlight.on_yank {:higroup :Visual :timeout 200}))}]
+ [:FileType
+ {:pattern :lir
+ :callback (fn []
+ (tset vim.opt_local :number false)
+ (tset vim.opt_local :relativenumber false))}]
+ [:BufWinEnter {:command "setlocal formatoptions-=cro"}]
+ [:FileType {:pattern :qf :command "set nobuflisted"}]
+ [:FileType {:pattern [:gitcommit :markdown] :command "setlocal wrap"}]
+ [:FileType
+ {:pattern [:NeogitStatus
+ :NeogitCommitMessage
+ :NeogitNotification
+ :NeogitCommitView]
+ :command "setlocal spell!"}]
+ [:TermOpen
+ {:pattern ["term://*toggleterm#*"] :command "setlocal spell!"}]
+ [:VimResized {:command "tabdo wincmd ="}]
+ [:FocusGained {:command :checktime}]
+ [:TermOpen
+ {:pattern "term://*toggleterm#*"
+ :callback (fn []
+ (vim.keymap.set :t :<C-h> "<Cmd>wincmd h<CR>" {})
+ (vim.keymap.set :t :<C-j> "<Cmd>wincmd j<CR>" {})
+ (vim.keymap.set :t :<C-k> "<Cmd>wincmd k<CR>" {})
+ (vim.keymap.set :t :<C-l> "<Cmd>wincmd l<CR>" {}))}]])
+
+(each [_ autocmd (ipairs autocmds)]
+ (match autocmd
+ [event opts] (create-autocmd event opts)))
diff --git a/fnl/settings/keymaps.fnl b/fnl/settings/keymaps.fnl
index 1af9a0d..b59f68f 100644
--- a/fnl/settings/keymaps.fnl
+++ b/fnl/settings/keymaps.fnl
@@ -1,51 +1,51 @@
;; Custom keymappings.
-(local opts {:noremap true :silent true})
-(fn map [mode lhs rhs opt] (vim.api.nvim_set_keymap mode lhs rhs opt))
-
-;;Remap space as leader key
-(map "" :<Space> :<Nop> opts)
-
-;; Normal ;;
-;; Better window navigation
-(map :n :<C-h> :<C-w>h opts)
-(map :n :<C-j> :<C-w>j opts)
-(map :n :<C-k> :<C-w>k opts)
-(map :n :<C-l> :<C-w>l opts)
-
-;; Resize with arrows
-(map :n :<C-Up> ":resize -2<CR>" opts)
-(map :n :<C-Down> ":resize +2<CR>" opts)
-(map :n :<C-Left> ":vertical resize -2<CR>" opts)
-(map :n :<C-Right> ":vertical resize +2<CR>" opts)
-
-;; Visual ;;
-;; Stay in indent mode
-(map :v "<" :<gv opts)
-(map :v ">" :>gv opts)
-
-;; Visual Block ;;
-;; Move text up and down
-(map :x :J ":move '>+1<CR>gv-gv" opts)
-(map :x :K ":move '<-2<CR>gv-gv" opts)
+(fn map [mode lhs rhs opt]
+ (vim.api.nvim_set_keymap mode lhs rhs opt))
-;; Move text up and down
-(map :v :<m-j> ":m .+1<CR>==" opts)
-(map :v :<m-k> ":m .-2<CR>==" opts)
-(map :v :p "\"_dP" opts)
-
-;; Splits
-(map :n :<m-s> :<cmd>split<CR> opts)
-(map :n :<m-t> :<cmd>vsplit<CR> opts)
-
-;; Nav
-(map :n :<m-m> :<cmd>bprev<CR> opts)
-(map :n :<m-i> :<cmd>bnext<CR> opts)
-
-(map :n :<c-d> :<c-d>zz opts)
-(map :n :<c-u> :<c-u>zz opts)
-
-(map :n :<m-n> :<cmd>nohlsearch<CR> opts)
+(local opts {:noremap true :silent true})
-(map :n :Q "<cmd>:q<CR>" opts)
-(map :n :mj "<cmd>:e<CR>" opts)
+(local mappings [;;Remap space as leader key
+ ["" :<Space> :<Nop>]
+ ;; Normal ;;
+ ;; Better window navigation
+ [:n :<C-h> :<C-w>h]
+ [:n :<C-j> :<C-w>j]
+ [:n :<C-k> :<C-w>k]
+ [:n :<C-l> :<C-w>l]
+ ;; Resize with arrows
+ [:n :<C-Up> ":resize -2<CR>"]
+ [:n :<C-Down> ":resize +2<CR>"]
+ [:n :<C-Left> ":vertical resize -2<CR>"]
+ [:n :<C-Right> ":vertical resize +2<CR>"]
+ ;; Visual ;;
+ ;; Stay in indent mode
+ [:v "<" :<gv]
+ [:v ">" :>gv]
+ ;; Visual Block ;;
+ ;; Move text up and down
+ [:x :J ":move '>+1<CR>gv-gv"]
+ [:x :K ":move '<-2<CR>gv-gv"]
+ ;; Move text up and down
+ [:v :<m-j> ":m .+1<CR>=="]
+ [:v :<m-k> ":m .-2<CR>=="]
+ [:v :p "\"_dP"]
+ ;; Splits
+ [:n :<m-s> :<cmd>split<CR>]
+ [:n :<m-t> :<cmd>vsplit<CR>]
+ ;; Buf navigation
+ [:n :<m-m> :<cmd>bprev<CR>]
+ [:n :<m-i> :<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-n> :<cmd>nohlsearch<CR>]
+ ;; Close window
+ [:n :Q "<cmd>:q<CR>"]
+ ;; Force refresh
+ [:n :mj "<cmd>:e<CR>"]])
+
+(each [_ mapping (ipairs mappings)]
+ (match mapping
+ [mode key cmd] (map mode key cmd opts)))
diff --git a/fnl/settings/options.fnl b/fnl/settings/options.fnl
index 303185a..cb86307 100644
--- a/fnl/settings/options.fnl
+++ b/fnl/settings/options.fnl
@@ -1,88 +1,92 @@
;; Sets options in neovim
-(fn apply-opts [opts] (each [k v (pairs opts)]
- (tset vim.opt k v)))
+(fn apply-opts [opts]
+ (each [k v (pairs opts)]
+ (tset vim.opt k v)))
(local spellfile (.. (os.getenv :XDG_CONFIG_HOME) :/nvim/spell/en.utf-8.add))
(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 100
- ;; 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})
+ :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 100
+ ;; 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})
+
+;; Move to new line when reaching the beginning or end.
+(vim.opt.whichwrap:append "<,>,[,],h,l")
(apply-opts opts)
(set vim.g.mapleader " ")
diff --git a/fnl/settings/usercmds.fnl b/fnl/settings/usercmds.fnl
index da842cc..14020af 100644
--- a/fnl/settings/usercmds.fnl
+++ b/fnl/settings/usercmds.fnl
@@ -1,98 +1,90 @@
;; Commands for plugins.
-(vim.api.nvim_create_user_command :OrgAgendaPrompt
- (lambda []
- (let [orgmode (require :orgmode)]
- (orgmode.action :agenda.prompt)))
- {:nargs 0})
-
-(vim.api.nvim_create_user_command :OrgCapturePrompt
- (lambda []
- (let [orgmode (require :orgmode)]
- (orgmode.action :capture.prompt)))
- {:nargs 0})
-
-(vim.api.nvim_create_user_command :CommentNormal
- (lambda []
- (let [comment-api (require :Comment.api)]
- (comment-api.toggle.linewise.current)))
- {:nargs 0})
-
-(vim.api.nvim_create_user_command :CommentVisual
- (lambda []
- (let [comment-api (require :Comment.api)]
- (comment-api.toggle.linewise (vim.fn.visualmode))))
- {:nargs 0})
-
-(vim.api.nvim_create_user_command :HarpoonAdd
- (lambda []
- (let [harpoon (require :harpoon.mark)]
- (harpoon.add_file)))
- {:nargs 0})
-
-(vim.api.nvim_create_user_command :HarpoonNext
- (lambda []
- (let [harpoon (require :harpoon.ui)]
- (harpoon.nav_next)))
- {:nargs 0})
-
-(vim.api.nvim_create_user_command :HarpoonPrev
- (lambda []
- (let [harpoon (require :harpoon.ui)]
- (harpoon.nav_prev)))
- {:nargs 0})
-
-(vim.api.nvim_create_user_command :HarpoonUI
- (lambda []
- (let [harpoon (require :harpoon.ui)]
- (harpoon.toggle_quick_menu)))
- {:nargs 0})
-
-(vim.api.nvim_create_user_command :Replace
- (lambda []
- (let [spectre (require :spectre)]
- (spectre.open)))
- {:nargs 0})
-
-(vim.api.nvim_create_user_command :ReplaceWord
- (lambda []
- (let [spectre (require :spectre)]
- (spectre.open_visual {:select_word true})))
- {:nargs 0})
-
-(vim.api.nvim_create_user_command :ReplaceInBuf
- (lambda []
- (let [spectre (require :spectre)]
- (spectre.open_file_search)))
- {:nargs 0})
-
-(vim.api.nvim_create_user_command :RestoreSession
- (lambda []
- (let [persistence (require :persistence)]
- (persistence.load)))
- {:nargs 0})
-
-(vim.api.nvim_create_user_command :RestoreLastSession
- (lambda []
- (let [persistence (require :persistence)]
- (persistence.load {:last true})))
- {:nargs 0})
-
-(vim.api.nvim_create_user_command :IgnoreSession
- (lambda []
- (let [persistence (require :persistence)]
- (persistence.stop)))
- {:nargs 0})
-
(fn telescope-builtin [builtin opts]
(let [telescope (require :telescope.builtin)
themes (require :telescope.themes)
theme (. opts :theme)]
((. telescope builtin) ((. themes theme) opts))))
-(vim.api.nvim_create_user_command :FindFiles
- (lambda []
- (telescope-builtin :find_files
- {:theme :get_dropdown
- :previewer false}))
- {:nargs 0})
+(fn create-usercmd [event cmd opts]
+ (vim.api.nvim_create_user_command event cmd opts))
+
+(local usercmds [[:OrgAgendaPrompt
+ (lambda []
+ (let [orgmode (require :orgmode)]
+ (orgmode.action :agenda.prompt)))
+ {:nargs 0}]
+ [:OrgCapturePrompt
+ (lambda []
+ (let [orgmode (require :orgmode)]
+ (orgmode.action :capture.prompt)))
+ {:nargs 0}]
+ [:CommentNormal
+ (lambda []
+ (let [comment-api (require :Comment.api)]
+ (comment-api.toggle.linewise.current)))
+ {:nargs 0}]
+ [:CommentVisual
+ (lambda []
+ (let [comment-api (require :Comment.api)]
+ (comment-api.toggle.linewise (vim.fn.visualmode))))
+ {:nargs 0}]
+ [:HarpoonAdd
+ (lambda []
+ (let [harpoon (require :harpoon.mark)]
+ (harpoon.add_file)))
+ {:nargs 0}]
+ [:HarpoonNext
+ (lambda []
+ (let [harpoon (require :harpoon.ui)]
+ (harpoon.nav_next)))
+ {:nargs 0}]
+ [:HarpoonPrev
+ (lambda []
+ (let [harpoon (require :harpoon.ui)]
+ (harpoon.nav_prev)))
+ {:nargs 0}]
+ [:HarpoonUI
+ (lambda []
+ (let [harpoon (require :harpoon.ui)]
+ (harpoon.toggle_quick_menu)))
+ {:nargs 0}]
+ [:Replace
+ (lambda []
+ (let [spectre (require :spectre)]
+ (spectre.open)))
+ {:nargs 0}]
+ [:ReplaceWord
+ (lambda []
+ (let [spectre (require :spectre)]
+ (spectre.open_visual {:select_word true})))
+ {:nargs 0}]
+ [:ReplaceInBuf
+ (lambda []
+ (let [spectre (require :spectre)]
+ (spectre.open_file_search)))
+ {:nargs 0}]
+ [:RestoreSession
+ (lambda []
+ (let [persistence (require :persistence)]
+ (persistence.load)))
+ {:nargs 0}]
+ [:RestoreLastSession
+ (lambda []
+ (let [persistence (require :persistence)]
+ (persistence.load {:last true})))
+ {:nargs 0}]
+ [:IgnoreSession
+ (lambda []
+ (let [persistence (require :persistence)]
+ (persistence.stop)))
+ {:nargs 0}]
+ [:FindFiles
+ (lambda []
+ (telescope-builtin :find_files
+ {:theme :get_dropdown :previewer false}))
+ {:nargs 0}]])
+
+(each [_ usercmd (ipairs usercmds)]
+ (match usercmd
+ [event cmd opts] (create-usercmd event cmd opts)))