Marco <[email protected]> a écrit:
> On 2013–03–22 Paul Isambert wrote:
> 
> > You can use an omap to do the same (with linewise visual mode to include the
> > closing brace):
> > 
> >   onoremap af :<C-U>normal! [[{V][<CR>
> > 
> > Then yaf yanks the current function.
> 
> This works, thanks. However, this raises more questions:
> 
> Why does the following implementation of “if” copy one line more
> than necessary? If I run yif it says “8 lines yanked”. If I run yi{
> it says “7 lines yanked”.
> 
>   onoremap if :<C-U>normal! [[vi{<cr>

To me this is simply wrong (and shouldn’t yank a single line) since
you’re outside the braced block once [[ is performed, and i{ selects
the interior of a braced block.

> What is conceptually wrong with yi[[ or yi[m when it works with
> other motions like yis or yi{?

iX and aX selects text object X; there is no selectable text object [[
and [m. The list of existing text objects is in “help text-objects”.

>                                Since vim has an understanding of
> functions (determined by the outermost brace pair probably) why is
> there no built in way to use this information for a motion?

That I don’t know. You can script it, though!

Best,
Paul

-- 
-- 
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 [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to