Monday, May 13, 2013

Re: evaluating vim functions in search mappings

Thanks Marc.

Unfortunately, I couldn't get your suggestion to work:

:map ]0 /^^R=repeat(' ', indent(line('.')))\S

=repeat(' ', indent(line('.')))\S
E15: Invalid expression: repeat(' ', indent(line('.')))\S

and using the original mapping, modified to use the indent() function

:map ]0 /^\s\{0,^R=indent(line('.'))}\S

=indent(line('.'))}\S
E15: Invalid expression: indent(line('.'))}\S




On May 13, 12:03 pm, Marc Weber <marco-owe...@gmx.de> wrote:
> :h indent()
> returns indentation of current line.
> Thus
>
> :map <X> /^<c-r>=repeat(' ', indent(line('.')))<cr>\S<cr>
> or such might do it.
>
> A second solution would be using folding.
>
> In the end - you should try using better search terms.
>
> Eg googling for "indendation based movement vim"http://stackoverflow.com/questions/896145/more-efficient-movements-ed...http://vim.wikia.com/wiki/Move_to_next/previous_line_with_same_indent...http://vim.wikia.com/wiki/Indenting_source_code
> [...]
>
> I didn't read them, but they might be helpful.
>
> Try to rethink about the way you're looking for information.
>
> Marc Weber

--
--
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/groups/opt_out.

No comments: