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>

What is conceptually wrong with yi[[ or yi[m when it works with
other motions like yis or yi{? 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?

Marco

Attachment: signature.asc
Description: Digital signature

Reply via email to