remove parinfer for vim-sexp only

This commit is contained in:
2026-05-09 08:11:24 -04:00
parent c7f111312e
commit c94b2c205e
3 changed files with 9 additions and 101 deletions
+8 -54
View File
@@ -46,60 +46,15 @@
(fn [] (vim.cmd "ConjureLogTab"))
{:desc "Conjure log tab"})))}
;; nvim-parinfer - Automatic parenthesis balancing
;; See fnl/config/parinfer.fnl for default-enabled flag and toggle logic
{repo "gpanders/nvim-parinfer"
:ft ["fennel" "clojure" "lisp" "scheme" "racket" "carp" "timl"]
:init (fn []
(let [par (require :config.parinfer)]
(set vim.g.parinfer_enabled par.default-enabled)))
:keys [{lhs "<leader>tpi"
rhs (fn [] (let [par (require :config.parinfer)] (par.toggle)))
:desc "Toggle Parinfer"}]}
;; vim-sexp - Structural editing for S-expressions
;; with tpope's vim-sexp-mappings-for-regular-people
{repo "guns/vim-sexp"
:ft ["fennel" "clojure" "lisp" "scheme" "racket"]
;; vim-sexp + tpope's mappings - Structural editing for S-expressions
;; Loaded eagerly so VimEnter fires before plugin sources, letting
;; vim-sexp-mappings-for-regular-people register its FileType autocmds.
{repo "tpope/vim-sexp-mappings-for-regular-people" :lazy false
:dependencies ["tpope/vim-repeat"
"tpope/vim-sexp-mappings-for-regular-people"]
:init (fn []
(set vim.g.sexp_filetypes "clojure,scheme,lisp,timl,fennel,racket")
;; Sync sexp auto-insert with parinfer default
(let [par (require :config.parinfer)]
(set vim.g.sexp_enable_insert_mode_mappings
(if par.default-enabled 0 1))))
"guns/vim-sexp"]
:config (fn []
;; vim-sexp-mappings-for-regular-people's setup is VimEnter-gated.
;; Under lazy.nvim :ft loading, VimEnter has already fired by the
;; time the plugin sources, so its FileType autocmd never registers
;; and the slurp/barf/swap mappings never attach. Register our own
;; FileType autocmd that maps the <Plug>s directly.
(let [fts (or vim.g.sexp_filetypes "clojure,scheme,lisp,timl,fennel,racket")
attach (fn []
(let [m (fn [lhs rhs]
(vim.keymap.set :n lhs rhs
{:buffer 0 :silent true :remap true}))]
(m "<I" "<Plug>(sexp_insert_at_list_head)")
(m ">I" "<Plug>(sexp_insert_at_list_tail)")
(m "<f" "<Plug>(sexp_swap_list_backward)")
(m ">f" "<Plug>(sexp_swap_list_forward)")
(m "<e" "<Plug>(sexp_swap_element_backward)")
(m ">e" "<Plug>(sexp_swap_element_forward)")
(m ">(" "<Plug>(sexp_emit_head_element)")
(m "<)" "<Plug>(sexp_emit_tail_element)")
(m "<(" "<Plug>(sexp_capture_prev_element)")
(m ">)" "<Plug>(sexp_capture_next_element)")
(m "dsf" "<Plug>(sexp_splice_list)")))]
(vim.api.nvim_create_augroup "sexp_regular_people_fix" {:clear true})
(vim.api.nvim_create_autocmd "FileType"
{:group "sexp_regular_people_fix"
:pattern (vim.split fts ",")
:callback attach})
;; Attach to current buffer (the FileType that triggered lazy load
;; already fired before this autocmd was registered).
(when (vim.tbl_contains (vim.split fts ",") vim.bo.filetype)
(attach))))}
(set vim.g.sexp_filetypes "clojure,scheme,lisp,timl,fennel,racket")
(set vim.g.sexp_enable_insert_mode_mappings 0))}
;; vim-surround - Add/change/delete surrounding pairs (quotes, brackets, tags)
{repo "tpope/vim-surround"
@@ -191,8 +146,7 @@
:opts {:keymap {:preset "super-tab"
"<C-Space>" [(fn [cmp] (cmp.show {:providers ["supermaven"]})) :fallback]
"<Tab>" [:select_and_accept :snippet_forward :fallback]
"<CR>" [:select_and_accept :fallback]
"<Esc>" [:cancel :fallback]}
"<Esc>" [(fn [cmp] (cmp.cancel) false) :fallback]}
:completion {:list {:selection {:preselect true :auto_insert false}}
:documentation {:auto_show true}}
:sources {:default ["lsp" "path" "buffer"]