panadestein
panadestein

Reputation: 1291

How to nest commands in -c option of vim

I'm trying to open file with the first line containing foo highlighted, for this I'm using the following command:

vim -c ":execute "normal! gg/foo\<cr>V"" file

Which gives me the output:

Vim: Warning: Output is not to a terminal 

Is there any way to fix it? Thanks in advance.

Upvotes: 1

Views: 118

Answers (1)

Christian Brabandt
Christian Brabandt

Reputation: 8248

The simplest way would be to use 2 different kinds of quotation marks:

vim -c ':exe "norm! gg/foo\<cr>V"' test.txt

However, for your specific usecase it is even simpler:

vim -c ':1' -c '/foo/norm! V' test.txt

Upvotes: 1

Related Questions