There is a command option when you run vim to open a file with command-line that i found when i was searching. here it is:

vim "+ normal G" textfile

When you use the command + normal G vim opens the file and presses G in normal mode. I wanted this in my custom script. Now I need to pgdn when I start the file automatically. Its editor command in vim is CTRL+F. I test options like vim "+ normal ^f" textfile and vim "+ normal CTRL-f" textfile but it didn't work. Anyone know how can I state CTRL in it?

  • Use vim "+20" filename instead.
    – Ravexina
    Jun 15 '20 at 19:53
  • 1
    Consider using Vi and Vim for questions on Vim!
    – filbranden
    Jul 9 '20 at 10:03

You can use Vim's :execute command, which executes an Ex command from a string, and that allows you to enter a special key using a \<...> inside a double quoted string.

$ vim '+ execute "normal \<C-f>"' textfile

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.