LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Desktop (https://www.linuxquestions.org/questions/linux-desktop-74/)
-   -   how can i use a script to run in vi ! (https://www.linuxquestions.org/questions/linux-desktop-74/how-can-i-use-a-script-to-run-in-vi-479506/)

z.z! 09-01-2006 01:35 PM

how can i use a script to run in vi !
 
hi all!
what i actually want is to run script containing vi commands (not shell commands)on a text file.
is there any way to do this?

ramram29 09-01-2006 03:31 PM

It's called 'ex' command. Run 'man ex'.

berbae 09-01-2006 04:00 PM

Hi
Here is an example:
I wrote a file 'script.vim' containing vim commands:
Quote:

aSome text
another line of text
yet another one^[:wq
To use it run :
Code:

vim text_file_name -s script.vim
To explain a little the script:
the first 'a' is the ex command to append text,
then the text to write in the file,
the ESC character, to write it use <ctrl-v> <ESC> keys,
':wq' to save and quit the editor.
Hope this will help you.
Have a nice day.


All times are GMT -5. The time now is 04:57 AM.