add :LispSchool
This commit is contained in:
@@ -35,6 +35,9 @@
|
||||
(keymap :n "<leader>bp" ":bprevious<CR>" {:desc "Previous buffer"})
|
||||
(keymap :n "<leader>bd" ":bdelete<CR>" {:desc "Delete buffer"})
|
||||
|
||||
;; Copy to system clipboard
|
||||
(keymap [:n :v] "<leader>y" "\"+y" {:desc "Yank to clipboard"})
|
||||
|
||||
;; Clear search highlight
|
||||
(keymap :n "<Esc>" ":noh<CR>" {:desc "Clear search highlight"})
|
||||
|
||||
@@ -136,4 +139,13 @@
|
||||
(fn [] (vim.cmd (.. "edit " (vim.lsp.get_log_path))))
|
||||
{:desc "Open LSP log file"})
|
||||
|
||||
;; LispSchool - Interactive structural editing tutorial
|
||||
(usercmd "LispSchool"
|
||||
(fn [] (let [ls (require :lisp-school)] (ls.start)))
|
||||
{:desc "Start LispSchool tutorial"})
|
||||
|
||||
(usercmd "LispSchoolNext"
|
||||
(fn [] (let [ls (require :lisp-school)] (ls.next)))
|
||||
{:desc "Next LispSchool lesson"})
|
||||
|
||||
{}
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
;; 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 true)
|
||||
|
||||
;; ── 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}
|
||||
Reference in New Issue
Block a user