Ayoub890 wrote:
Mikkel L. Ellertson wrote:
Ayoub890 wrote:
Hi,
I want to use readline in vi mode but support for vi appears to be
rather limited. It has better support for emacs and I do not want to go
back to using emacs.
Because of its limited support for vi, I want to try and circumvent the
readline and open the command history file directly with VIM. I am
using
several xwindows but my login directory has only one ".bash_history"
file. Each of the xwindows sessions should have its own history but I
found only one history file in the login directory. Where are the other
history files kept? Can I open them with VIM and grab commands and edit
them and thus not be limited by the inadequate readline support for vi?
Thanx,
Ayoub890
There is only one history file. What happens is that you end up with the
same file being opened more then once. I am not sure what copy gets
written to disk, but I think it is the first one opened. The other with
the other coppies, they are in memory, but the disk file has not been
updated. I was never interested enough to play around and find out what
happens if you log out of the first secession, while you still have a
second secession open, or what happens with the history of the second
secession when you log out. Something for you to play with...
Mikkel
Great piece info. Is there a way to access those un-saved temporary
history files?
The silly and incomplete way of doing it is:
$ history > temporaryfile
$ vim temporaryfile
Shell and Vim gurus can help here. We need Vim to pull the history
file, allow editing/composing of a new command (in full screen mode,
not just in line mode), exiting, issuing the new command to the shell
CLI. The history file must be updated with the new executed command also.
If Vim can do that it would probably be more powerful than the
existing readline; don't yo think?
Ayoub890
This came from Gary Johnson:
From the shell, the fc command will open a $VISUAL or $EDITOR window
(I forget which--I have both set to vi which really points to vim)
containing the last shell command you executed. You can then
execute
:r !history
to load the last n lines of command history into the vim buffer,
edit the buffer to get the command you want, then write the buffer
and quit vim and the shell will execute the command.
HTH,
Gary
____________________________________________________
Want to buy your Pack or Services from Mandriva?
Go to http://store.mandriva.com
Join the Club : http://www.mandrivaclub.com
____________________________________________________