Jean-Rene David wrote:
* Robert Cussons [2006.10.18 06:30]:
I did notice that between the if and else there
are " which just act as comments as they are on
newlines,
Sorry, I should have known that wouldn't come out
right. There's a literal newline between the
quotes. You can enter it by pressing
<CTRL-V><CTRL-M>.
Here's that section of code with the literal
newline entered as two separate characters:
if a:direction == 'b'
execute "normal ?" . l:pattern . "^M"
else
execute "normal /" . l:pattern . "^M"
endif
I was selecting text in visual mode, then
pressing / or ? and I just get the normal action
of pressing / or ?
I agree with what you say below completely, I just didn't express myself
clearly enough in the paragraph above, I was just telling you the
actions I had performed and it appears I should have been pressing * or
# not / or ? as I originally thought, but the lack of the literal
newline was causing it not to work too.
Well you could do it with "/" and "?" but I like
to keep their behavior intact as it is useful to
extend the visual region.
I remapped "*" and "#" instead, as shown in these
lines:
vnoremap <silent> * :call VisualSearch('f')<CR>
vnoremap <silent> # :call VisualSearch('b')<CR>
I prefer that because these don't have any special
meaning in visual mode and it ties in nicely with
the "search next/previous word" function they have
in normal mode.
Thanks for your help,
Rob.