使用Vim的fireplace插件时,如何删除引号内换行及解决括号无法删除问题?
Troubleshooting Fireplace.vim Issues in Clojure
Hey there! Those issues you're hitting with Fireplace.vim sound super frustrating—let's break them down and figure out what's going on.
1. Can't delete an orphaned left parenthesis (
This is almost certainly tied to automatic bracket balancing, a common feature in Clojure Vim setups often paired with Fireplace via tools like Parinfer.vim or vim-sexp. Here's the breakdown:
- When you delete the closing
)first, the remaining(becomes an unbalanced syntax element. The plugin (likely Parinfer, not Fireplace itself) blocks you from deleting it because it’s designed to keep your Clojure code structurally valid at all times.
Fixes to try:
- Instead of deleting the closing bracket first, use a text object to remove the entire pair at once:
dap(delete a paragraph, which works for s-expressions) ordi((delete inside the parentheses) to wipe both brackets and their contents in one go. - If you really need to delete that orphaned
(temporarily, toggle off the bracket balancing feature. For Parinfer, this is usually done with a keybinding like<leader>p(check your plugin docs for exact keys), which switches to a more permissive mode or disables auto-balancing briefly. - Double-check your
.vimrcfor settings likeg:parinfer_mode—if it’s set tostrict, it’ll be more aggressive about enforcing balanced brackets.
2. Can't delete the second line of a multi-line string like "first line more on another line"
This is likely related to how Fireplace or companion Clojure plugins handle multi-line string indentation and syntax protection. Some plugins lock down edits in strings to prevent accidental syntax breaks, or have indentation rules that interfere with deleting line content.
Fixes to try:
- Instead of deleting character-by-character, use line-wise or word-wise deletions:
ddwill delete the entire line even inside a multi-line string, whiledw(delete word) removes chunks instead of individual characters without triggering protection. - Temporarily disable buffer-local indentation settings for the file: run
:setlocal nocindent nosmartindentin the buffer and see if you can delete the content then. - Check if you have
vim-clojure-staticinstalled (a common Clojure Vim plugin paired with Fireplace)—it has settings likeg:clojure_fuzzy_indentthat might be interfering with string edits. Try toggling that off with:let g:clojure_fuzzy_indent = 0and test again.
General Troubleshooting Steps
- Isolate the plugin: Disable all other Clojure-related plugins (like Parinfer, vim-sexp, vim-clojure-static) and see if the issue persists with only Fireplace enabled. This will tell you if it’s a conflict between plugins, not Fireplace itself.
- Update Fireplace: Make sure you’re running the latest version of the plugin—old versions might have bugs that’ve been fixed in recent updates.
- Check your keybindings: Sometimes custom keybindings override default delete commands, so verify that
x/dd/dwbehave as expected in non-Clojure files first.
内容的提问来源于stack exchange,提问作者32bits
相关产品推荐
相关产品推荐

