Friday, May 29, 2015

quotation text object consternation

One of the oddball frustrations I find with vim is that the
outer-quotation objects eats leading space.

To demonstrate the inconsistency, use the following document

(parens)
[square brackets]
{braces}
"double quotes"
'single quotes"

and indent it (unless you copied the leading whitespace too)

:%>

then, on each line, use the associated outer-text-object to change it:

ca(xxx<esc>
ca[xxx<esc>
ca{xxx<esc>
ca"xxx<esc>
ca'xxx<esc>

Note how the ones with quotes also get un-indented while the others
don't. I encounter this most frequently when coding in Python where
I have something like

my_map = {
"foo": "bar",
"baz": "whinge",
"fred": "barney",
}

and I want to change the keys to constants:

FOO = "foo"
my_map = {
FOO: "bar",
# ...
}

so I go to the quote object and do

ca"FOO<esc>

only to then need to re-indent it back to the original level (not so
bad if it's single indent, but when it's multiple levels, it's a
pain). I've *never* had the eating-of-leading-whitespace as a desired
behavior.

Is there a way to make this consistent with the other "a" text
objects? Some option I've missed?

-tim







--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments: