Skip to content

[mini.ai] Trim extra whitespace between words? #1042

Closed Answered by echasnovski
pkazmier asked this question in Q&A
Discussion options

You must be logged in to vote

So, is this overkill for my original task at hand? Thanks!

I would say so, yes. I tend yo use ciw<Space><Esc>, as iw works on whitespace too. So if you're fine with changing mode (twice) in a mapping, I'd go with vim.keymap.set({"i", "n"}, "<A-Space>", "<Cmd>normal ciw <CR>", { desc = "Just one space" }). If not, then custom function which executes :normal diw and then adds single space at cursor seems more understandable to me.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@pkazmier
Comment options

Answer selected by pkazmier
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
2 participants