On 2012-08-01, His Nerdship wrote: > So if I want to start up Vim so that it immediately takes > me to the word ‘haddock’ on line 713 of fish.cpp I would expect to > enter: > gvim +713 -c “/haddock” fish.cpp > However I find this takes me to (or near) line 713, and all instances > of ‘haddock’ are correctly highlighted, but at best it will take me > only to the start of the line, not to the expression itself. I am > trying to emulate as closely as possible the functionality we get when > COM/OLE is working correctly, where the cursor is placed right on the > search expression. > Is there a way I can achieve this level of control from the command > line?
(I assume that the oddball quotation marks are due to your mailer's editor.) The -c option specifies an ex command, not a normal-mode command. The ex search command finds the line matching the patterns, not the column. What you want is something like this: gvim +713 -c 'exe "normal /haddock\<CR>"' fish.cpp The quoting shown works on Unix. It's important that the :normal command be enclosed in double-quotes for the \<CR> to be correctly expanded by :exe. I don't know how to quote that properly on Windows, so I'll leave that to you. See :help -c :help :normal :help :silent " for an example of a :normal search command :help :exe Regards, Gary -- 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