Vim: moving the cursor to a string in a source file without error messages if it doesn't exist -


When I have a file *. I use vi to open C, so I want to move the cursor to the "main" string. If there is no "main", then I want the cursor to go to "zero" without an error prompt.

I have set up my .vimrc

 : autocmd BufRead * .c 1; / Main  

But it can not apply all of my requirements, especially if there is no "main" in some opened source file, "error can not be found in main Is .... "I want to remove what I am dealing with.

I have also tried to add & lt; Silent & gt; or : silent that autocmd is on the line, but this is not what I want. Can somebody help me out? Thank you.

Just use : Quiet! Messages, but errors too

Anyway, I recommend you use BufReadPost ( run your command later will load a buffer) and do the search < As a whole word for code> main

Then try this:

 : autocmd BufReadPost * .c: Quiet! 1; / \ & LT; Main \ & gt;  

Comments

Popular posts from this blog

oracle - The fastest way to check if some records in a database table? -

php - multilevel menu with multilevel array -

jQuery UI: Datepicker month format -