Loading ...
Sorry, an error occurred while loading the content.
 

Re: VIM, History and Readline.

Expand Messages
  • 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
    Message 1 of 2 , Aug 2, 2005
      On 2005-08-02, Ayoub890 <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. The other history files are probably stored in temporary files.
      > Can I open them with VIM and grab commands and edit them and thus not be
      > limited by the inadequate readline support for vi?
      >
      > 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. Also,
      > the history file must be updated with the new executed command. Does
      > there exist a way of doing this?

      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

      --
      Gary Johnson | Agilent Technologies
      garyjohn@... | Wireless Division
      | Spokane, Washington, USA
    Your message has been successfully submitted and would be delivered to recipients shortly.