Nice idea, certainly useful! I'm not sure whether this should be implemented in
the C code, though, as it could also be done with Vimscript.
One suggestion: How about changing 'ii' so that it excludes empty lines at the
beginning and end of the buffer, similar to what the other text objects do? I
don't like it when outer and inner text object versions are identical.
-- regards, ingo
It may as well be in the C code alongside all of the other text
objects. Notice the cases just below his patch which are waiting to
be implemented.
> One suggestion: How about changing 'ii' so that it excludes empty lines at the
> beginning and end of the buffer, similar to what the other text objects do? I
> don't like it when outer and inner text object versions are identical.
I agree with Ingo here. The 'ii' object should trim leading and
trailing whitespace.
--
Erik Falor
Registered Linux User #445632 http://counter.li.org
I agree that it should be done in the same place as the rest of the text
objects. However, I'm curious how it would be implemented in vimscript?
I didn't know it was even possible to implement something like text
objects in vimscript.
> One suggestion: How about changing 'ii' so that it excludes empty
> lines at the beginning and end of the buffer, similar to what the
> other text objects do? I don't like it when outer and inner text
> object versions are identical.
I guess consistency would be nice. I've attached an updated patch.
I believe the following are relevant:
:help omap-info
:help v:operator
Best regards,
Tony.
--
login: yes
password: I don't know, please tell me
password is incorrect
login: yes
password: incorrect
" these text objects are linewise
noremap <silent> aa :<C-U>norm! ggVG<CR>
noremap <silent> ii :<C-U>call InnerBuf()<CR>
nunmap aa
sunmap aa
nunmap ii
sunmap ii
func! InnerBuf()
let line1 = nextnonblank(1)
if line1 == 0
" the buffer is blank, select it like with aa
norm! ggVG
return
endif
exec "norm!" line1."ggV". prevnonblank("$")."G"
endfunc
--
Andy
I've given this some more thought, and I would like to propose different keys
for this feature. First off, 'aa' and 'ii' look like suitable keys, but all
other Vim text objects use the same second key to describe the object, and
prepend 'a' / 'i' to mean "a" or "inner" scope, respectively. (E.g. 'ap' / 'ip'
: a / inner paragraph. )
Secondly, I have a script (posted long ago as a vimtip) that defines 'ai' / 'ii'
text objects for selection of outer / inner indent. I think that something like
"inner indent" is a better fit for the 'ii' mnemonic than "entire buffer,
excluding leading / trailing empty lines".
How about using 'b' for buffer, resulting in 'ab' and 'ib' keys? 'b' already
stands for "buffer" in commands like :bnext, the resulting mnemonics would fit
into the existing naming scheme for text object, they're still free, and only
slightly more awkward to type.
As always, users who want 'aa' / 'ii' or any other keys can define a simple
mapping to remap 'ab' / 'ib'; but IMO the default keys should be consistent with
the other text objects.
-- regards, ingo
As memorizable keys become scarce, maybe it would be best to just take the
Vimscript implementation that Matt has posted, and just define <Plug> mappings,
so that everyone is free to select whatever keys suit him/her.
-- regards, ingo
-- regards, ingo
I use af/if for text objects to select a function.
So, how about ae/ie as alternatives?
Because the text objects are to select the *E*ntire buffer.
Anyhow, for some reason, my previous post to this thread
seemed not to be sent as an e-mail. How about this?
http://groups.google.com/group/vim_dev/msg/36535509c06564c1
--
To Vim, or not to Vim.
http://whileimautomaton.net/
> Anyhow, for some reason, my previous post to this thread
> seemed not to be sent as an e-mail. How about this?
> http://groups.google.com/group/vim_dev/msg/36535509c06564c1
I received your email; Matt later posted a very short Vimscript that seems to
achieve the same with less dependencies.
-- regards, ingo
What about iG
because G goes to the end of the buffer (linewise to the last line), and
1G (or gg) to its beginning.
I've checked that there's no iG help tag.
Best regards,
Tony.
--
Has your family tried 'em?
POWDERMILK BISCUITS
Heavens, they're tasty and expeditious!
They're made from whole wheat, to give shy persons the
strength to get up and do what needs to be done.
POWDERMILK BISCUITS
Buy them ready-made in the big blue box with the picture of the
biscuit on the front, or in the brown bag with the dark stains
that indicate freshness.