remove parinfer for vim-sexp only
This commit is contained in:
@@ -1,45 +0,0 @@
|
||||
;; config/parinfer.fnl - Parinfer + vim-sexp insert mode coordination
|
||||
;;
|
||||
;; Single source of truth for whether parinfer is on/off by default
|
||||
;; and what that means for vim-sexp's auto-insert bracket mappings.
|
||||
;;
|
||||
;; When parinfer is ON: it manages closing parens via indentation,
|
||||
;; so vim-sexp auto-insert is disabled.
|
||||
;; When parinfer is OFF: vim-sexp auto-insert is re-enabled so you
|
||||
;; get closing brackets when typing openers.
|
||||
|
||||
;; ── Configuration ────────────────────────────────────────────────
|
||||
;; Change this single flag to flip the default for all sexp filetypes.
|
||||
|
||||
(local default-enabled false)
|
||||
|
||||
;; ── Implementation ───────────────────────────────────────────────
|
||||
|
||||
(local sexp-insert-keys ["(" ")" "[" "]" "{" "}" "\"" "<BS>"])
|
||||
|
||||
(fn enable-sexp-insert []
|
||||
"Restore vim-sexp insert-mode bracket mappings in the current buffer."
|
||||
(vim.cmd "imap <silent><buffer> ( <Plug>(sexp_insert_opening_round)")
|
||||
(vim.cmd "imap <silent><buffer> ) <Plug>(sexp_insert_closing_round)")
|
||||
(vim.cmd "imap <silent><buffer> [ <Plug>(sexp_insert_opening_square)")
|
||||
(vim.cmd "imap <silent><buffer> ] <Plug>(sexp_insert_closing_square)")
|
||||
(vim.cmd "imap <silent><buffer> { <Plug>(sexp_insert_opening_curly)")
|
||||
(vim.cmd "imap <silent><buffer> } <Plug>(sexp_insert_closing_curly)")
|
||||
(vim.cmd "imap <silent><buffer> \" <Plug>(sexp_insert_double_quote)")
|
||||
(vim.cmd "imap <silent><buffer> <BS> <Plug>(sexp_insert_backspace)"))
|
||||
|
||||
(fn disable-sexp-insert []
|
||||
"Remove vim-sexp insert-mode bracket mappings from the current buffer."
|
||||
(each [_ key (ipairs sexp-insert-keys)]
|
||||
(pcall vim.api.nvim_buf_del_keymap 0 "i" key)))
|
||||
|
||||
(fn toggle []
|
||||
"Toggle parinfer in the current buffer and sync vim-sexp insert mappings."
|
||||
(vim.cmd "ParinferToggle")
|
||||
(let [on (= (vim.api.nvim_buf_get_var 0 "parinfer_enabled") 1)]
|
||||
(if on
|
||||
(disable-sexp-insert)
|
||||
(enable-sexp-insert))))
|
||||
|
||||
{:default-enabled default-enabled
|
||||
:toggle toggle}
|
||||
+8
-54
@@ -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"]
|
||||
|
||||
+1
-2
@@ -1,14 +1,13 @@
|
||||
{
|
||||
"blink.cmp": { "branch": "main", "commit": "78336bc89ee5365633bcf754d93df01678b5c08f" },
|
||||
"claudecode.nvim": { "branch": "main", "commit": "102d835c964069c9c5e37abaf05ae4f9c3ee6f00" },
|
||||
"conjure": { "branch": "main", "commit": "2ddd752d43b35d72aa3e339c3ae051b8dbad8549" },
|
||||
"conjure": { "branch": "main", "commit": "f7a375995a19fbf085707ea0fdb1f9c167e27e27" },
|
||||
"gitsigns.nvim": { "branch": "main", "commit": "dd3f588bacbeb041be6facf1742e42097f62165d" },
|
||||
"hop.nvim": { "branch": "master", "commit": "08ddca799089ab96a6d1763db0b8adc5320bf050" },
|
||||
"lazy.nvim": { "branch": "main", "commit": "306a05526ada86a7b30af95c5cc81ffba93fef97" },
|
||||
"mason-tool-installer.nvim": { "branch": "main", "commit": "443f1ef8b5e6bf47045cb2217b6f748a223cf7dc" },
|
||||
"mason.nvim": { "branch": "main", "commit": "e54f5bf5f12c560da31c17eee5b3e1bd369f3ff9" },
|
||||
"nfnl": { "branch": "main", "commit": "ac0177c5549df7abba7a19554c18a7765386c894" },
|
||||
"nvim-parinfer": { "branch": "master", "commit": "3968e669d9f02589aa311d33cb475b16b27c5fbb" },
|
||||
"nvim-treesitter": { "branch": "main", "commit": "4916d6592ede8c07973490d9322f187e07dfefac" },
|
||||
"plenary.nvim": { "branch": "master", "commit": "74b06c6c75e4eeb3108ec01852001636d85a932b" },
|
||||
"roslyn.nvim": { "branch": "main", "commit": "b62d1a588765f0aa1b46ed260252c9e456408835" },
|
||||
|
||||
Reference in New Issue
Block a user