Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back > Forums > Linux Forums > Linux - Desktop
User Name
Linux - Desktop This forum is for the discussion of all Linux Software used in a desktop context.


  Search this Thread
Old 09-01-2006, 02:35 PM   #1
LQ Newbie
Registered: Jul 2006
Posts: 13

Rep: Reputation: 0
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?
Old 09-01-2006, 04:31 PM   #2
Registered: Jul 2003
Location: Miami, Florida, USA
Distribution: Debian
Posts: 848
Blog Entries: 1

Rep: Reputation: 47
It's called 'ex' command. Run 'man ex'.
Old 09-01-2006, 05:00 PM   #3
Registered: Jul 2005
Location: France
Distribution: Arch Linux
Posts: 540

Rep: Reputation: Disabled
Here is an example:
I wrote a file 'script.vim' containing vim commands:
aSome text
another line of text
yet another one^[:wq
To use it run :
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.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
how to run a shell script in the perl script sharad Linux - General 1 05-24-2006 04:23 AM
'cannot stat' script in /etc/rc.d/, try to run script at startup quintan Linux - Software 1 11-21-2005 03:53 AM
Shell script to run pl/sql script. colly Linux - General 1 09-09-2004 07:49 AM
on Network Up Script run? On Battery power run script? v2-ncl Linux - General 0 12-08-2003 10:34 AM
can't run a script script from icon in konqueror scottsteibel Linux - Software 1 08-02-2003 08:59 PM

All times are GMT -5. The time now is 08:03 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration