Reputation: 1419
I know /dog<CR>
will place my cursor at the first instance of dog
, however I'm not getting the same effect when using a command.
I've tried the following:
:command FindDog /dog
:command FindDog exec '/dog'
:command FindDog :normal /dog<CR>
(this one seems to just hang until I Ctrl-C)
Something tells me I'm doing this wrong.
Upvotes: 0
Views: 118
Reputation: 195289
Perhaps you want to know that, :/dog<cr>
works too. It does the same as /dog
. You don't have to call the search()
function. If you would like to create your own command, you can just do for example:
:command FindDog :/dog
Upvotes: 2
Reputation: 1419
Ugh. call search('dog')
did the trick. I will let someone with more than a week of vim decide if this question would help anyone else or not.
Upvotes: 0