On 11/20/11 14:58, porphyry5 wrote:
In a script, how can I get repeated searches always to begin
at the start of the buffer? If I precede the search with gg
or :cursor(1, 1) I get E492, with 1G I get E464.
:map p$ ggdd:while @" != ""<CR>:b#<CR>:cursor (1,
1)<CR>:silent! /^R"<CR>0i$<Space><Esc>:b#<CR>dd:endwhile
At least in my 7.2, there's no Ex ":cursor" command, so it's
pretty obvious why you get the E492. My guess on the latter is
that you're issuing ":1G" which is trying to execute "1G" as an
Ex command rather than a normal-mode command, and as such, there
is more than one ex-command that begins with "G", and thus you
get the E464. It sounds like you want to change that to
...:b#<cr>:0sil! /<c-r>0i
and just prefix the search/silent command with the line number
from which you want to start (either "0" in my example, or
possibly "1"; difference being what happens when a match occurs
on the first line of the file and subsequent lines of the file).
-tim
--
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