Thanks, that solves the first half of the question.
Any inputs on how to set something like "set -o vi" within the vim shell?
Thanks.
On Sat, 24 Feb 2007 12:58:28 -0500, Yakov Lerner <[EMAIL PROTECTED]> wrote:
On 2/24/07, Subramanian Ramaswamy <[EMAIL PROTECTED]> wrote:
Hi all,
I have two questions regarding the shell (invoked using "!") in vim:
(1) Is it possible for the shell to remember what commands I executed in
the original shell window in addition to the commands executed within
the
vim shell window?
e.g.
I open up a terminal and type
$asdfasfasd.....long command
Now, I open up vim
$ vim main.c
Within vim when I invoke the shell, can I make it remember
"asdfasfasd.....long command", in addition to all the vim shell commands
that were previously executed?
(2) My terminal is in vi mode, since that makes me the most productive
i.e. I have set set -o vi in my .bashrc.
How can one enable this mode within vim's ":" or shell "!" commands -
this will be very useful, if I can navigate that with vi commands...
This is possible as I describe below. But you'll need to write
some amount of vimscript code.
You'll need to impement the following sequence:
1. define the 'vim' as following bash alias:
alias vim='history | tail -20 >~/.cmds; vim' # save shell command
history so
# that
vim can access it later
2. put this alias into your ~/.bashrc
3. In your .vimrc, check that file ~/.cmds exist.
Read the file line-by-line, and add the lines into vim
command history using function
histadd(). See :help histadd()
You'll probably be the only user of this trick( when I need something
like this, I use
cut-end-paste, or storing commands to 1-liner temp files).
Yakov