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

Re: rename and edit renamed file

Expand Messages
  • Gary Johnson
    ... Since you can execute shell commands from within vim, yes, this is already possible. For example, you could: $vim ofilename ... or $vim ofilename ... See
    Message 1 of 3 , Nov 30, 2003
    • 0 Attachment
      On 2003-12-01, Neil Zanella <nzanella@...> wrote:
      > Hello,
      >
      > I think it would be quite useful to have a command in such that the
      > user could issue:
      >
      > :rename filename
      >
      > What this command would do is the analogous of :sav but instead of
      > keeping the old file intact the old file goes. So the effect is the
      > same as
      >
      > $ vi ofilename
      > ... commands ...
      > :q
      > $ mv ofilename nfilename
      > $ vi nfilename
      >
      > I often find the need to rename source files to something more intuitive
      > but do not want to leave the text editor. Is this already possible?

      Since you can execute shell commands from within vim, yes, this is
      already possible. For example, you could:

      $vim ofilename
      ... commands ...
      :sav nfilename
      :!rm #

      or

      $vim ofilename
      ... commands ...
      :f nfilename
      :!mv # %

      See

      :help :!

      HTH,
      Gary

      --
      Gary Johnson | Agilent Technologies
      garyjohn@... | Wireless Division
      | Spokane, Washington, USA
    • Keith Roberts
      ... Also, you can create your own rename command to do the above for you (see ... explorer-rename).
      Message 2 of 3 , Dec 2, 2003
      • 0 Attachment
        >-----Original Message-----
        >From: Gary Johnson [mailto:garyjohn@...]
        >Sent: Sunday, November 30, 2003 10:52 PM
        >To: Vim Mailing List
        >Subject: Re: rename and edit renamed file
        >
        >On 2003-12-01, Neil Zanella <nzanella@...> wrote:
        >> Hello,
        >>
        >> I think it would be quite useful to have a command in such that the
        >> user could issue:
        >>
        >> :rename filename
        >>
        >> What this command would do is the analogous of :sav but instead of
        >> keeping the old file intact the old file goes. So the effect is the
        >> same as
        >>
        >> $ vi ofilename
        >> ... commands ...
        >> :q
        >> $ mv ofilename nfilename
        >> $ vi nfilename
        >>
        >> I often find the need to rename source files to something more intuitive
        >> but do not want to leave the text editor. Is this already possible?
        >
        >Since you can execute shell commands from within vim, yes, this is
        >already possible. For example, you could:
        >
        > $vim ofilename
        > ... commands ...
        > :sav nfilename
        > :!rm #
        >
        >or
        >
        > $vim ofilename
        > ... commands ...
        > :f nfilename
        > :!mv # %
        >
        >See :help :!

        Also, you can create your own 'rename' command to do the above for you (see
        :h command). Besides, you can already do this in Explore mode (see :h
        explorer-rename).
      Your message has been successfully submitted and would be delivered to recipients shortly.