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

editing multiple files

Expand Messages
  • Steve Joiner
    Hello, I ve been using emacs for several years and am now trying to learn vi because I m tired of the resource bloat. I have a simple question that I ve been
    Message 1 of 17 , Feb 21, 2001
    • 0 Attachment
      Hello,

      I've been using emacs for several years and am now trying to learn vi
      because I'm tired of the resource bloat. I have a simple question that
      I've been unable to find the answer to:

      In emacs you can have multiple files open and freely edit and switch
      between them. I haven't been able to figure out how to do this in vi.
      I know about the :e and :n commands, but they all tell me I have to
      save my file before they will work. What am I missing?

      I hope this is not a RTFM, I've looked through several FAQs, tutorials,
      and docs and haven't been able to figure it out.

      Thanks,
      Steve


      __________________________________________________
      Do You Yahoo!?
      Yahoo! Auctions - Buy the things you want at great prices! http://auctions.yahoo.com/
    • David Olbersen
      On Wed, 21 Feb 2001, Steve Joiner wrote: - In emacs you can have multiple files open and freely edit and switch - between them. I haven t been able to figure
      Message 2 of 17 , Feb 21, 2001
      • 0 Attachment
        On Wed, 21 Feb 2001, Steve Joiner wrote:

        ->In emacs you can have multiple files open and freely edit and switch
        ->between them. I haven't been able to figure out how to do this in vi.
        ->I know about the :e and :n commands, but they all tell me I have to
        ->save my file before they will work. What am I missing?

        Try ':split <file>' and then C-w j to move down a window and C-w k to move up
        one. For more info try ':he windows'

        -- Dave
      • Pritesh Mistry
        I think, if you ... you should be able to switch between files without saving them every time. Finally, you could use :wa to save all files. HTHs! ... From:
        Message 3 of 17 , Feb 21, 2001
        • 0 Attachment
          I think, if you

          :se hidden

          you should be able to switch between files without saving them every time.
          Finally, you could use :wa to save all files.

          HTHs!


          -----Original Message-----
          From: Steve Joiner [mailto:gt1058c@...]
          Sent: Wednesday, February 21, 2001 7:58 pm
          To: vim@...
          Subject: editing multiple files


          Hello,

          I've been using emacs for several years and am now trying to learn vi
          because I'm tired of the resource bloat. I have a simple question that
          I've been unable to find the answer to:

          In emacs you can have multiple files open and freely edit and switch
          between them. I haven't been able to figure out how to do this in vi.
          I know about the :e and :n commands, but they all tell me I have to
          save my file before they will work. What am I missing?

          I hope this is not a RTFM, I've looked through several FAQs, tutorials,
          and docs and haven't been able to figure it out.

          Thanks,
          Steve


          __________________________________________________
          Do You Yahoo!?
          Yahoo! Auctions - Buy the things you want at great prices!
          http://auctions.yahoo.com/
        • Benji Fisher
          ... It all depends on what you want to happen when you switch to another buffer: write changes to a file, abandon the changes, or just wait and see. If there
          Message 4 of 17 , Feb 21, 2001
          • 0 Attachment
            Steve Joiner wrote:
            >
            > Hello,
            >
            > I've been using emacs for several years and am now trying to learn vi
            > because I'm tired of the resource bloat. I have a simple question that
            > I've been unable to find the answer to:
            >
            > In emacs you can have multiple files open and freely edit and switch
            > between them. I haven't been able to figure out how to do this in vi.
            > I know about the :e and :n commands, but they all tell me I have to
            > save my file before they will work. What am I missing?
            >
            > I hope this is not a RTFM, I've looked through several FAQs, tutorials,
            > and docs and haven't been able to figure it out.
            >
            > Thanks,
            > Steve

            :help hidden
            :help autowrite
            :help windows-intro
            :help buffer-hidden

            It all depends on what you want to happen when you switch to
            another buffer: write changes to a file, abandon the changes, or just
            wait and see. If there is an option you are trying to find, try

            :options

            It is often easier to do this than to browse the docs.

            HTH --Benji Fisher
          • Steve Joiner
            ... Thanks! This is exactly what I was looking for. -Steve __________________________________________________ Do You Yahoo!? Yahoo! Auctions - Buy the things
            Message 5 of 17 , Feb 21, 2001
            • 0 Attachment
              --- Benji Fisher <fisherbb@...> wrote:
              > Steve Joiner wrote:
              > >
              > > In emacs you can have multiple files open and freely edit and
              > switch
              > > between them. I haven't been able to figure out how to do this in
              > vi.
              > > I know about the :e and :n commands, but they all tell me I have to
              > > save my file before they will work. What am I missing?
              >
              > :help hidden
              > :help autowrite
              > :help windows-intro
              > :help buffer-hidden
              >
              > It all depends on what you want to happen when you switch to
              > another buffer: write changes to a file, abandon the changes, or
              > just
              > wait and see. If there is an option you are trying to find, try
              >
              > :options
              >
              > It is often easier to do this than to browse the docs.
              >
              > HTH --Benji Fisher


              Thanks! This is exactly what I was looking for.

              -Steve


              __________________________________________________
              Do You Yahoo!?
              Yahoo! Auctions - Buy the things you want at great prices! http://auctions.yahoo.com/
            • Jean-Raymond.Chauviere
              ... split the main window in sub windows, one for each file JRC ... -- Nur der Kleingeist hält Ordnung, das Genie beherrscht das Chaos. Seuls les petits
              Message 6 of 17 , Feb 21, 2001
              • 0 Attachment
                :ball
                split the main window in sub windows, one for each file
                JRC
                David Olbersen wrote:
                >
                > On Wed, 21 Feb 2001, Steve Joiner wrote:
                >
                > ->In emacs you can have multiple files open and freely edit and switch
                > ->between them. I haven't been able to figure out how to do this in vi.
                > ->I know about the :e and :n commands, but they all tell me I have to
                > ->save my file before they will work. What am I missing?
                >
                > Try ':split <file>' and then C-w j to move down a window and C-w k to move up
                > one. For more info try ':he windows'
                >
                > -- Dave

                --
                Nur der Kleingeist hält Ordnung, das Genie beherrscht das Chaos.
                Seuls les petits esprits aiment l'ordre, le génie maitrîse le chaos.
                (anonyme)
              • Michael P. Soulier
                People, In an already running vim session, it is possible to edit load multiple additional buffers? ... ...fails with too many file names Mike -- Michael P.
                Message 7 of 17 , Mar 30, 2003
                • 0 Attachment
                  People,

                  In an already running vim session, it is possible to edit load
                  multiple additional buffers?

                  :e *.html

                  ...fails with "too many file names"

                  Mike

                  --
                  Michael P. Soulier <msoulier@...>, GnuPG pub key: 5BC8BE08
                  "...the word HACK is used as a verb to indicate a massive amount
                  of nerd-like effort." -Harley Hahn, A Student's Guide to Unix
                  HTML Email Considered Harmful: http://expita.com/nomime.html
                • Michael Naumann
                  ... try ... Mike
                  Message 8 of 17 , Mar 30, 2003
                  • 0 Attachment
                    On Sunday 30 March 2003 17:44, you wrote:
                    > People,
                    >
                    > In an already running vim session, it is possible to edit load
                    > multiple additional buffers?
                    >
                    > :e *.html
                    >
                    > ...fails with "too many file names"

                    try
                    :n *.html

                    >
                    > Mike

                    Mike
                  • Michael P. Soulier
                    ... Cool, thanks. The whole files vs. args thing is still a bit whacked though. If I want to iterate through my buffers with :n, it only uses the args list,
                    Message 9 of 17 , Mar 30, 2003
                    • 0 Attachment
                      On 30/03/03 Michael Naumann did speaketh:

                      > try
                      > :n *.html

                      Cool, thanks.

                      The whole files vs. args thing is still a bit whacked though. If I
                      want to iterate through my buffers with :n, it only uses the args list,
                      which is not equal to the files list.

                      Mike

                      --
                      Michael P. Soulier <msoulier@...>, GnuPG pub key: 5BC8BE08
                      "...the word HACK is used as a verb to indicate a massive amount
                      of nerd-like effort." -Harley Hahn, A Student's Guide to Unix
                      HTML Email Considered Harmful: http://expita.com/nomime.html
                    • Pavel Tavoda
                      ... you can go through buffers with
                      Message 10 of 17 , Apr 1, 2003
                      • 0 Attachment
                        :help buffer-list

                        you can go through buffers with
                        :bnext

                        Michael P. Soulier wrote:

                        >On 30/03/03 Michael Naumann did speaketh:
                        >
                        >
                        >
                        >>try
                        >>:n *.html
                        >>
                        >>
                        >
                        > Cool, thanks.
                        >
                        > The whole files vs. args thing is still a bit whacked though. If I
                        >want to iterate through my buffers with :n, it only uses the args list,
                        >which is not equal to the files list.
                        >
                        > Mike
                        >
                        >
                        >
                      • Lonnie Percent
                        hi all, i am a newbie to vim but have used vi for a long time. when i use :e filename to edit another file from within a file i want to return to the original
                        Message 11 of 17 , Jun 20, 2003
                        • 0 Attachment
                          hi all,

                          i am a newbie to vim but have used vi for a long time.

                          when i use :e filename to edit another file from within a file
                          i want to return to the original file. it allows me to open
                          multiple files but not exit out of one with out quitting entirely.

                          in vi i have always used :!vi somefile then from there :q brings me
                          back to original. but i notice with vim when i come back my scrolling
                          on the original file is messed up - that is why i started with the :e.

                          what should i be doing?

                          TIA

                          lonnie percent
                        • Tim Chase
                          ... There are various options. One is using hidden buffers, and using :bn (and it s companions). see :he :bn and :he hidden . This allows you to keep
                          Message 12 of 17 , Jun 20, 2003
                          • 0 Attachment
                            > when i use :e filename to edit another file from within a file
                            > i want to return to the original file. it allows me to open
                            > multiple files but not exit out of one with out quitting entirely.

                            There are various options. One is using hidden buffers, and using :bn
                            (and it's companions). see ":he :bn" and ":he hidden". This allows you
                            to keep changes even when you leave a buffer. The main section of
                            interest is found in the help at ":he buffer-hidden"

                            Another popular option is to make use of vim's windowing functions. You
                            can split the screen into multiple windows (now, both horizontally and
                            vertically, since something like v6). See ":he ctrl-w" to learn more
                            about the nice power available here. You can jump between the windows as
                            well as resize each of them which is quite handy when editing code in
                            multiple files.

                            > TIA

                            HTH :)

                            -tim
                          • Antoine J. Mechelynck
                            Tim Chase wrote: [...] ... Two variations on this (I use both, depending on the project) are to either have all windows the same size ...
                            Message 13 of 17 , Jun 20, 2003
                            • 0 Attachment
                              Tim Chase <gumnos@...> wrote:
                              [...]
                              > Another popular option is to make use of vim's windowing functions.
                              > You can split the screen into multiple windows (now, both
                              > horizontally and vertically, since something like v6). See ":he
                              > ctrl-w" to learn more about the nice power available here. You can
                              > jump between the windows as well as resize each of them which is
                              > quite handy when editing code in multiple files.
                              >
                              > > TIA
                              >
                              > HTH :)
                              >
                              > -tim

                              Two variations on this (I use both, depending on the project) are to either
                              have all windows the same size

                              :set equalalways

                              or, contrariwise, to have all windows but the active one reduced to just a
                              status bar

                              :set noequalalways winheight=9999 winminheight=0

                              In all cases, you can open a file in a new window using

                              :new filename

                              where filename is, of course, the name of the file. (:new without a filename
                              opens [NoFile] in a new window.)

                              See also the options 'splitright' and 'splitbelow', and the command prefix
                              :vertical, about how you want to split.

                              Happy Vimming,
                              Tony.
                            • Tim Chase
                              ... This (from my understanding) is the way official vi behaves. Vim works around this by providing the option hidden . To use it, simply ... (see the help
                              Message 14 of 17 , Jun 20, 2003
                              • 0 Attachment
                                > what you are saying is that with the :e you can not quit out
                                > of any buffer without loosing all? i tried the bdelete but my
                                > vim says it doesnt support it (vim-common-6.0)

                                This (from my understanding) is the way official vi behaves. Vim works
                                around this by providing the option "hidden". To use it, simply

                                :set hidden

                                (see the help ":he hidden" for further caveats)

                                You can now use :e to edit other files, and then return to the original
                                file without the need to save, using :bn and similar commands

                                :bN
                                :br
                                :bl
                                etc.

                                > how can i find out if vim was compiled with the +listcmds
                                > as the doc says buffer-hidden wont work if not compiled with
                                > this flag?

                                :version

                                will spit back the options used when compiling, sorted alpha, so you can
                                just scan for +listcmds.

                                > i tried "set hid" from my .vimrc but it didnt work
                                > if i :q all is lost

                                If hidden was set (just do ":set all" to check if "hidden" or "nohidden"
                                is set), then :q should not lose any changes made to that buffer. The
                                exception that comes to mind is if you have the "confirm" option turned
                                off (beware of a ":set nocf" or ":set noconfirm" option, the state of
                                which should be evident when you do that ":set all"). In which case it's
                                yer own dumb fault if you turn off confirmations on quitting, quit, and
                                then lose stuff--that's the whole point of "confirm" :*)

                                > say i am doing some analysis - i may opening many files from with in
                                > a file to follow the logic and i dont want to keep them open and
                                > have to remember which buffer i am backing up to to continue to
                                > follow the logic. i may never want to look at a certain file again.
                                > i want to quit out back to the file i am investigating to continue to
                                follow
                                > the logic
                                > in the file i called it from.

                                This is where windows can be awfully handy. Especially the ability to use
                                either the control+w followed by control+f (to split a window to the file
                                name under the cursor), or control+w followed by control+] to jump (to the
                                definition of the tag under the cursor, if you have a tagfile set up).; I
                                confess I've grown addicted to the windowing commands, rarely using the
                                buffer commands (":bn", et. al.). Quite handy for editing code.

                                -tim

                                ps: if you "reply-all", the list benefits from evesdropping on dialog and
                                troubleshooting :)
                              • Lonnie Percent
                                it was compiled with -listcmd so that explains a few things. i am calling rh. many thanks! ... From: Tim Chase To: Lonnie Percent
                                Message 15 of 17 , Jun 20, 2003
                                • 0 Attachment
                                  it was compiled with -listcmd so that explains a few things.
                                  i am calling rh.

                                  many thanks!

                                  ----- Original Message -----
                                  From: "Tim Chase" <gumnos@...>
                                  To: "Lonnie Percent" <lpercent@...>; <vim@...>
                                  Sent: Friday, June 20, 2003 1:02 PM
                                  Subject: Re: editing multiple files


                                  > > what you are saying is that with the :e you can not quit out
                                  > > of any buffer without loosing all? i tried the bdelete but my
                                  > > vim says it doesnt support it (vim-common-6.0)
                                  >
                                  > This (from my understanding) is the way official vi behaves. Vim works
                                  > around this by providing the option "hidden". To use it, simply
                                  >
                                  > :set hidden
                                  >
                                  > (see the help ":he hidden" for further caveats)
                                  >
                                  > You can now use :e to edit other files, and then return to the original
                                  > file without the need to save, using :bn and similar commands
                                  >
                                  > :bN
                                  > :br
                                  > :bl
                                  > etc.
                                  >
                                  > > how can i find out if vim was compiled with the +listcmds
                                  > > as the doc says buffer-hidden wont work if not compiled with
                                  > > this flag?
                                  >
                                  > :version
                                  >
                                  > will spit back the options used when compiling, sorted alpha, so you can
                                  > just scan for +listcmds.
                                  >
                                  > > i tried "set hid" from my .vimrc but it didnt work
                                  > > if i :q all is lost
                                  >
                                  > If hidden was set (just do ":set all" to check if "hidden" or "nohidden"
                                  > is set), then :q should not lose any changes made to that buffer. The
                                  > exception that comes to mind is if you have the "confirm" option turned
                                  > off (beware of a ":set nocf" or ":set noconfirm" option, the state of
                                  > which should be evident when you do that ":set all"). In which case it's
                                  > yer own dumb fault if you turn off confirmations on quitting, quit, and
                                  > then lose stuff--that's the whole point of "confirm" :*)
                                  >
                                  > > say i am doing some analysis - i may opening many files from with in
                                  > > a file to follow the logic and i dont want to keep them open and
                                  > > have to remember which buffer i am backing up to to continue to
                                  > > follow the logic. i may never want to look at a certain file again.
                                  > > i want to quit out back to the file i am investigating to continue to
                                  > follow
                                  > > the logic
                                  > > in the file i called it from.
                                  >
                                  > This is where windows can be awfully handy. Especially the ability to use
                                  > either the control+w followed by control+f (to split a window to the file
                                  > name under the cursor), or control+w followed by control+] to jump (to the
                                  > definition of the tag under the cursor, if you have a tagfile set up).; I
                                  > confess I've grown addicted to the windowing commands, rarely using the
                                  > buffer commands (":bn", et. al.). Quite handy for editing code.
                                  >
                                  > -tim
                                  >
                                  > ps: if you "reply-all", the list benefits from evesdropping on dialog and
                                  > troubleshooting :)
                                  >
                                  >
                                  >
                                  >
                                  >
                                  >
                                  >
                                  >
                                  >
                                  >
                                  >
                                • Charles E. Campbell
                                  ... As mentioned, you probably want to at least try the hidden option. As an alternative, you could use s ... o if you had . ZoomWin
                                  Message 16 of 17 , Jun 20, 2003
                                  • 0 Attachment
                                    On Fri, Jun 20, 2003 at 10:41:44AM -0400, Lonnie Percent wrote:
                                    > when i use :e filename to edit another file from within a file
                                    > i want to return to the original file. it allows me to open
                                    > multiple files but not exit out of one with out quitting entirely.
                                    ---------------------------------------------------------------------

                                    As mentioned, you probably want to at least try the "hidden" option.

                                    As an alternative, you could use

                                    <c-w>s
                                    :e newfile
                                    <c-w>o

                                    if you had <ZoomWin.vim>. ZoomWin is available via

                                    http://vim.sourceforge.net/scripts/script.php?script_id=508

                                    Regards,
                                    Chip Campbell

                                    --
                                    Charles E Campbell, Jr, PhD _ __ __
                                    Goddard Space Flight Center / /_/\_\_/ /
                                    cec@... /_/ \/_//_/
                                    PGP public key: http://www.erols.com/astronaut/pgp.html
                                  • beKryptic
                                    Hi, My installation of GVim is from the official gvim73_46.exe installer from vim.org. Calling :version reveals that it was compiled with
                                    Message 17 of 17 , Dec 10, 2010
                                    • 0 Attachment
                                      Hi,

                                      My installation of GVim is from the official gvim73_46.exe installer
                                      from vim.org. Calling ":version" reveals that it was compiled with
                                      +multi_byte_ime/dyn. In my _vimrc is the following addition: "set
                                      guifontwide=MS\ Gothic".

                                      I created a new file using GVim, called "set encoding=utf-8", then
                                      copied + pasted these 3 lines into the file:

                                      12345
                                      新宋体
                                      abcde


                                      At this point, GVim displayed the text as it should. I saved the file,
                                      and confirmed that the data was saved correctly by opening it in
                                      Notepad. However, when I re-opened the file in GVim and called ":e +
                                      +enc=utf-8", the middle line became 3 upside-down question marks and
                                      the status bar reads:

                                      <t" [converted][CONVERSION ERROR in line 2] 4L, 21C

                                      How do I read UTF-8 encoded files? Thanks

                                      --
                                      You received this message from the "vim_use" maillist.
                                      Do not top-post! Type your reply below the text you are replying to.
                                      For more information, visit http://www.vim.org/maillist.php
                                    Your message has been successfully submitted and would be delivered to recipients shortly.