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

X more files to edit

Expand Messages
  • Timothy Grant
    Hi all, I am all the time working on more than one source file at a time: gvim file1.py file2.py file3.py Often times when I m doing this one or two of them
    Message 1 of 19 , Mar 1, 2001
    • 0 Attachment
      Hi all,

      I am all the time working on more than one source file at a
      time:

      gvim file1.py file2.py file3.py

      Often times when I'm doing this one or two of them are for
      reference purposes and I'm really only editing one of them.

      When I do a

      :wq

      I get the following message:

      2 more files to edit

      Now, if I do

      :n
      :n

      I don't get that message.

      Is there a way to eliminate it?


      --
      Stand Fast,
      tjg.

      Timothy Grant tjg@...
      Red Hat Certified Engineer www.exceptionalminds.com
      Avalon Technology Group, Inc. <>< (503) 246-3630
      >>>>>>>>>>>>>Linux, because rebooting is *NOT* normal<<<<<<<<<
      >>>>This machine was last rebooted: 44 days 6:13 hours ago<<
    • Janakiraman .S
      ... *arglist-quit* You are protected from leaving Vim if you have not been editing the last file in the argument list. This prevents you from forgetting
      Message 2 of 19 , Mar 1, 2001
      • 0 Attachment
        * Timothy Grant (tjg@...) wrote thusly :

        > Hi all,
        >
        > I am all the time working on more than one source file at a
        > time:
        >
        > gvim file1.py file2.py file3.py
        >
        > Often times when I'm doing this one or two of them are for
        > reference purposes and I'm really only editing one of them.
        >
        > When I do a
        >
        > :wq
        >
        > I get the following message:
        >
        > 2 more files to edit
        >
        > Now, if I do
        >
        > :n
        > :n
        >
        > I don't get that message.
        >
        > Is there a way to eliminate it?

        :help arglist-quit
        *arglist-quit*
        You are protected from leaving Vim if you have not been editing the last
        file in the argument list. This prevents you from forgetting that you
        were editing one out of several files. To exit anyway try to exit
        twice. If there are changes in the current buffer this will fail. You
        can exit anyway, and save any changes, with the ":wq!" command. To lose
        any changes use the ":q!" command.
      • Benji Fisher
        ... Also see ... for :qa[ll] and related commands. --Benji Fisher
        Message 3 of 19 , Mar 1, 2001
        • 0 Attachment
          "Janakiraman .S" wrote:
          >
          > * Timothy Grant (tjg@...) wrote thusly :
          >
          > > Hi all,
          > >
          > > I am all the time working on more than one source file at a
          > > time:
          > >
          > > gvim file1.py file2.py file3.py
          > >
          > > Often times when I'm doing this one or two of them are for
          > > reference purposes and I'm really only editing one of them.
          > >
          > > When I do a
          > >
          > > :wq
          > >
          > > I get the following message:
          > >
          > > 2 more files to edit
          > >
          > > Now, if I do
          > >
          > > :n
          > > :n
          > >
          > > I don't get that message.
          > >
          > > Is there a way to eliminate it?
          >
          > :help arglist-quit
          > *arglist-quit*
          > You are protected from leaving Vim if you have not been editing the last
          > file in the argument list. This prevents you from forgetting that you
          > were editing one out of several files. To exit anyway try to exit
          > twice. If there are changes in the current buffer this will fail. You
          > can exit anyway, and save any changes, with the ":wq!" command. To lose
          > any changes use the ":q!" command.

          Also see

          :help window-exit

          for :qa[ll] and related commands.

          --Benji Fisher
        • Wilhelm Wienemann
          Hello Timothy! ... What about gvim -o file1.py file2.py file3.py bye - Wilhelm -- I like VIM because, when I ask a question in this NG, I get a one-line
          Message 4 of 19 , Mar 2, 2001
          • 0 Attachment
            Hello Timothy!

            On Thu, 01 Mar 2001, Timothy Grant wrote:

            >
            > I am all the time working on more than one source file at a
            > time:
            >
            > gvim file1.py file2.py file3.py

            What about 'gvim -o file1.py file2.py file3.py'

            bye - Wilhelm

            --
            I like VIM because, when I ask a question in this NG, I get a one-line
            answer. With xemacs, I get a 1Kb lisp script with bugs in it ;-)
            wroot <wroot@...> Tue, 13 Feb 2001 23:56:47 -0500 in comp.editors
          • Josifovski Ljubomir-BLJ01Z
            Even worse, when the files are visited with :bn (but not :n - I have set hidden as well), the annoying message still appears. I bump into this few times a
            Message 5 of 19 , Mar 5, 2001
            • 0 Attachment
              Even worse, when the files are visited with :bn (but not :n - I have 'set
              hidden' as well), the annoying message still appears. I bump into this few
              times a day, every day.

              IMHO, arglist-quit is out of touch with the, koh-koh :-)), 'general vim
              principles' :-)) - if I wanted an editor that holds my hand, I wouldn't have
              been using vim (Re: help
              arglist-quit; "YOU ARE PROTECTED from leaving Vim if you have..." - caps
              mine). I wish very much that this was optional.

              With thanks to Wilhelm for the -o tip, :-)

              --
              Ljubomir Josifovski
              mailto:L.Josifovski@...,blj01z@...
              http://www.dcs.shef.ac.uk/~ljupco
            • Benji Fisher
              ... If you want to use :bn instead of :n then perhaps you should figure out a way to add your files to the buffer list (a.k.a. file list) and not the argument
              Message 6 of 19 , Mar 5, 2001
              • 0 Attachment
                Josifovski Ljubomir-BLJ01Z wrote:
                >
                > Even worse, when the files are visited with :bn (but not :n - I have 'set
                > hidden' as well), the annoying message still appears. I bump into this few
                > times a day, every day.
                >
                > IMHO, arglist-quit is out of touch with the, koh-koh :-)), 'general vim
                > principles' :-)) - if I wanted an editor that holds my hand, I wouldn't have
                > been using vim (Re: help
                > arglist-quit; "YOU ARE PROTECTED from leaving Vim if you have..." - caps
                > mine). I wish very much that this was optional.
                >
                > With thanks to Wilhelm for the -o tip, :-)

                If you want to use :bn instead of :n then perhaps you should figure
                out a way to add your files to the buffer list (a.k.a. file list) and not
                the argument list. If you do not want vim to give you warnings, you could
                get in the habit of :qa! when you are ready to quit vim. (You could
                always use a mapping to make this more convenient.) Personally, I
                recognize that I sometimes make mistakes, and I appreciate a little
                protection from them.

                --Benji Fisher
              • Josifovski Ljubomir-BLJ01Z
                ... Doesn t the fact that I can :bn after vim *.{cpp,hh} mean that the files have been added to the buffer list already? ... I regularly edit dozens of
                Message 7 of 19 , Mar 6, 2001
                • 0 Attachment
                  > -----Original Message-----
                  > From: Benji Fisher [mailto:benji@...]
                  > Sent: 05 March 2001 15:54
                  >
                  > If you want to use :bn instead of :n then perhaps you
                  > should figure
                  > out a way to add your files to the buffer list (a.k.a. file
                  > list) and not
                  > the argument list. If you do not want vim to give you

                  Doesn't the fact that I can ':bn' after 'vim *.{cpp,hh}' mean that the files
                  have been added to the buffer list already?

                  > warnings, you could
                  > get in the habit of :qa! when you are ready to quit vim. (You could

                  I regularly edit dozens of files. The possibility of loosing hours work
                  sprinkled among dozen files makes this "cure" worse then the "problem". Nah,
                  thanks, I'll stick to ':q -- XXX more files -- ?$%^&* (that's me :-))) --
                  :qa' routine for now. Maybe in time switch to Wilhelm's 'vim -o' and 'ctrl-w
                  o'.

                  In long term, I wish vim shifted fully towards the file-buffer-window
                  paradigm. The whole 'set hidden' thingy looks a bit archaic.

                  --
                  Ljubomir Josifovski
                  mailto:L.Josifovski@...,blj01z@...
                  http://www.dcs.shef.ac.uk/~ljupco
                • Janakiraman .S
                  * Josifovski Ljubomir-BLJ01Z (BLJ01Z@motorola.com) wrote thusly : [...] ... You could also use the -c command line option to do this. vim *.{cpp,hh} -c last
                  Message 8 of 19 , Mar 6, 2001
                  • 0 Attachment
                    * Josifovski Ljubomir-BLJ01Z (BLJ01Z@...) wrote thusly :

                    [...]

                    > I regularly edit dozens of files. The possibility of loosing hours
                    > work sprinkled among dozen files makes this "cure" worse then the
                    > "problem". Nah, thanks, I'll stick to ':q -- XXX more files -- ?$%^&*
                    > (that's me :-))) -- :qa' routine for now. Maybe in time switch to
                    > Wilhelm's 'vim -o' and 'ctrl-w o'.

                    You could also use the -c command line option to do this.
                    vim *.{cpp,hh} -c 'last' -c 'rew'

                    Note that with the -o option all files will be loaded, which can slow
                    you down a *lot*.

                    > In long term, I wish vim shifted fully towards the file-buffer-window
                    > paradigm. The whole 'set hidden' thingy looks a bit archaic.

                    What exactly is the "file-buffer-window paradigm" ?

                    --
                    Mission Statement for vim (2001):
                    We will produce the highest quality editor, using empowered team
                    dynamics in a new file-buffer-window paradigm until we become the
                    industry leader in text editing.
                  • Benji Fisher
                    ... [snip] ... They are on both the buffer list and the argument list. If there are files on the arg list that you have not yet visited then vim warns you
                    Message 9 of 19 , Mar 6, 2001
                    • 0 Attachment
                      Josifovski Ljubomir-BLJ01Z wrote:
                      >
                      [snip]
                      > Doesn't the fact that I can ':bn' after 'vim *.{cpp,hh}' mean that the files
                      > have been added to the buffer list already?

                      They are on both the buffer list and the argument list. If there are
                      files on the arg list that you have not yet visited then vim warns you
                      when you try to quit.

                      > > warnings, you could
                      > > get in the habit of :qa! when you are ready to quit vim. (You could
                      >
                      > I regularly edit dozens of files. The possibility of loosing hours work
                      > sprinkled among dozen files makes this "cure" worse then the "problem". Nah,
                      > thanks, I'll stick to ':q -- XXX more files -- ?$%^&* (that's me :-))) --
                      > :qa' routine for now. Maybe in time switch to Wilhelm's 'vim -o' and 'ctrl-w
                      > o'.

                      I agree. I thought your complaint was that Vim was "protecting" you
                      too much.

                      > In long term, I wish vim shifted fully towards the file-buffer-window
                      > paradigm. The whole 'set hidden' thingy looks a bit archaic.

                      Have you checked out the 'hidden' and 'autowrite' options? It may be
                      possible to configure vim to suit you better.

                      :help abandon

                      HTH --Benji Fisher
                    • Josifovski Ljubomir-BLJ01Z
                      ... But the files *have been* visited - although not via the argument list, but via the buffer list. ... Thanks - yes, I have them both on. -- Ljubomir
                      Message 10 of 19 , Mar 6, 2001
                      • 0 Attachment
                        > -----Original Message-----
                        > From: Benji Fisher [mailto:benji@...]
                        > Sent: 06 March 2001 13:53
                        >
                        > They are on both the buffer list and the argument list.
                        > If there are
                        > files on the arg list that you have not yet visited then vim warns you
                        > when you try to quit.

                        But the files *have been* visited - although not via the argument list, but
                        via the buffer list.

                        > Have you checked out the 'hidden' and 'autowrite'
                        > options? It may be

                        Thanks - yes, I have them both on.

                        --
                        Ljubomir Josifovski
                        mailto:L.Josifovski@...,blj01z@...
                        http://www.dcs.shef.ac.uk/~ljupco
                      • Josifovski Ljubomir-BLJ01Z
                        ... This works like a charm - great, thanks! ... Yeah, usage/user dependent. I edit multi-GB log files once in a while. But on a daily basis the total length
                        Message 11 of 19 , Mar 6, 2001
                        • 0 Attachment
                          > You could also use the -c command line option to do this.
                          > vim *.{cpp,hh} -c 'last' -c 'rew'

                          This works like a charm - great, thanks!

                          > Note that with the -o option all files will be loaded,
                          > which can slow
                          > you down a *lot*.

                          Yeah, usage/user dependent. I edit multi-GB log files once in a while. But
                          on a daily basis the total length is most often less then couple of hundred
                          KB.

                          --
                          Ljubomir Josifovski
                          mailto:L.Josifovski@...,blj01z@...
                          http://www.dcs.shef.ac.uk/~ljupco
                        • Benji Fisher
                          ... That doesn t count. Sorry. That is why my first suggestion was to come up with a way to put *.cpp or whatever on the buffer list instead of the arg list.
                          Message 12 of 19 , Mar 6, 2001
                          • 0 Attachment
                            Josifovski Ljubomir-BLJ01Z wrote:
                            >
                            > > -----Original Message-----
                            > > From: Benji Fisher [mailto:benji@...]
                            > > Sent: 06 March 2001 13:53
                            > >
                            > > They are on both the buffer list and the argument list.
                            > > If there are
                            > > files on the arg list that you have not yet visited then vim warns you
                            > > when you try to quit.
                            >
                            > But the files *have been* visited - although not via the argument list, but
                            > via the buffer list.

                            That doesn't count. Sorry. That is why my first suggestion was to
                            come up with a way to put *.cpp or whatever on the buffer list instead of
                            the arg list. Maybe a shell script?

                            --Benji Fisher
                          • Timothy Grant
                            ... This was an excellent idea! Thanks. I put the following in my .vimrc... autocmd VimEnter * last|rewind Now things behave as I would
                            Message 13 of 19 , Mar 6, 2001
                            • 0 Attachment
                              On Tue, Mar 06, 2001 at 05:02:56PM +0530, Janakiraman .S wrote:
                              > * Josifovski Ljubomir-BLJ01Z (BLJ01Z@...) wrote thusly :
                              >
                              > [...]
                              >
                              > > I regularly edit dozens of files. The possibility of loosing hours
                              > > work sprinkled among dozen files makes this "cure" worse then the
                              > > "problem". Nah, thanks, I'll stick to ':q -- XXX more files -- ?$%^&*
                              > > (that's me :-))) -- :qa' routine for now. Maybe in time switch to
                              > > Wilhelm's 'vim -o' and 'ctrl-w o'.
                              >
                              > You could also use the -c command line option to do this.
                              > vim *.{cpp,hh} -c 'last' -c 'rew'

                              This was an excellent idea! Thanks.

                              I put the following in my .vimrc...

                              autocmd VimEnter * last|rewind

                              Now things behave as I would have expected. If I load multiple
                              files...

                              vim file1 file2 file3

                              and then quit without doing anything...

                              :q!

                              vim behaves as I would have expected it too.

                              However, if I do the following...

                              :b2
                              [Make some changes]
                              :b1
                              :q

                              vim reports to me that I have changes in file2 that have not
                              been saved and won't let me exit.

                              Now things behave the way I think they should behave.

                              Thank you very much!


                              --
                              Stand Fast,
                              tjg.

                              Timothy Grant tjg@...
                              Red Hat Certified Engineer www.exceptionalminds.com
                              Avalon Technology Group, Inc. <>< (503) 246-3630
                              >>>>>>>>>>>>>Linux, because rebooting is *NOT* normal<<<<<<<<<
                              >>>>This machine was last rebooted: 48 days 21:23 hours ago<<
                            • Josifovski Ljubomir-BLJ01Z
                              ... Excellent - this completely sums up the whole thread. :-))) -- Ljubomir Josifovski mailto:L.Josifovski@dcs.shef.ac.uk,blj01z@motorola.com
                              Message 14 of 19 , Mar 6, 2001
                              • 0 Attachment
                                > I put the following in my .vimrc...
                                >
                                > autocmd VimEnter * last|rewind

                                Excellent - this completely sums up the whole thread. :-)))

                                --
                                Ljubomir Josifovski
                                mailto:L.Josifovski@...,blj01z@...
                                http://www.dcs.shef.ac.uk/~ljupco
                              • Janakiraman .S
                                ... That s perfect but for giving you a warning when you start vim without any filename arguments. I suppose one can refine this to au! VimEnter * call
                                Message 15 of 19 , Mar 6, 2001
                                • 0 Attachment
                                  * Timothy Grant (tjg@...) wrote thusly :

                                  > On Tue, Mar 06, 2001 at 05:02:56PM +0530, Janakiraman .S wrote:
                                  >
                                  > > * Josifovski Ljubomir-BLJ01Z (BLJ01Z@...) wrote thusly :
                                  > >
                                  > > [...]
                                  > >
                                  > > > I regularly edit dozens of files. The possibility of loosing hours
                                  > > > work sprinkled among dozen files makes this "cure" worse then the
                                  > > > "problem". Nah, thanks, I'll stick to ':q -- XXX more files -- ?$%^&*
                                  > > > (that's me :-))) -- :qa' routine for now. Maybe in time switch to
                                  > > > Wilhelm's 'vim -o' and 'ctrl-w o'.
                                  > >
                                  > > You could also use the -c command line option to do this.
                                  > > vim *.{cpp,hh} -c 'last' -c 'rew'
                                  >
                                  > This was an excellent idea! Thanks.
                                  >
                                  > I put the following in my .vimrc...
                                  >
                                  > autocmd VimEnter * last|rewind

                                  That's perfect but for giving you a warning when you start vim without
                                  any filename arguments. I suppose one can refine this to

                                  au! VimEnter * call VisitLastBuffer()
                                  func! VisitLastBuffer()
                                  if ( argc() > 1 )
                                  last
                                  rew
                                  endif
                                  endfunction

                                  I noticed that syntax highlighting breaks with this. Any thoughts ???
                                • Benji Fisher
                                  ... [snip] ... Try au! VimEnter * nested call VisitLastBuffer() ... Also, the au! will save you from defining this autocommand many times if you happen to
                                  Message 16 of 19 , Mar 7, 2001
                                  • 0 Attachment
                                    "Janakiraman .S" wrote:
                                    >
                                    > * Timothy Grant (tjg@...) wrote thusly :
                                    >
                                    [snip]
                                    > > I put the following in my .vimrc...
                                    > >
                                    > > autocmd VimEnter * last|rewind
                                    >
                                    > That's perfect but for giving you a warning when you start vim without
                                    > any filename arguments. I suppose one can refine this to
                                    >
                                    > au! VimEnter * call VisitLastBuffer()
                                    > func! VisitLastBuffer()
                                    > if ( argc() > 1 )
                                    > last
                                    > rew
                                    > endif
                                    > endfunction
                                    >
                                    > I noticed that syntax highlighting breaks with this. Any thoughts ???

                                    Try

                                    au! VimEnter * nested call VisitLastBuffer()

                                    :help nested

                                    Also, the au! will save you from defining this autocommand many times if
                                    you happen to :source your vimrc file after starting vim, but it will also
                                    wipe out any other VimEnter autocommands you might have. I think it is
                                    safer to have a single

                                    :au! " Remove all autocommands

                                    near the top of your vimrc file, as suggested under :help :autocmd or to
                                    make an augroup:

                                    augroup Foo
                                    au! VimEnter * nested call VisitLastBuffer()
                                    augroup END

                                    HTH --Benji Fisher
                                  • David Reviejo
                                    ... Hey! This work very, very well :) And if you don t want those Hit return... messages, you can do something like: au VimEnter * nested call
                                    Message 17 of 19 , Mar 7, 2001
                                    • 0 Attachment
                                      * Benji Fisher <benji@...> [010307 13:13]:
                                      > "Janakiraman .S" wrote:
                                      > >
                                      > > * Timothy Grant (tjg@...) wrote thusly :
                                      > >
                                      > [snip]
                                      > > > I put the following in my .vimrc...
                                      > > >
                                      > > > autocmd VimEnter * last|rewind
                                      > >
                                      > > That's perfect but for giving you a warning when you start vim without
                                      > > any filename arguments. I suppose one can refine this to
                                      > >
                                      > > au! VimEnter * call VisitLastBuffer()
                                      > > func! VisitLastBuffer()
                                      > > if ( argc() > 1 )
                                      > > last
                                      > > rew
                                      > > endif
                                      > > endfunction
                                      > >
                                      > > I noticed that syntax highlighting breaks with this. Any thoughts ???
                                      >
                                      > Try
                                      >
                                      > au! VimEnter * nested call VisitLastBuffer()
                                      >
                                      > :help nested
                                      >

                                      Hey! This work very, very well :)
                                      And if you don't want those "Hit return..." messages, you can do
                                      something like:

                                      au VimEnter * nested call VisitLastBuffer()
                                      fun! VisitLastBuffer()
                                      if (argc() > 1)
                                      let ch_bak=&cmdheight
                                      set cmdheight=10
                                      last
                                      let &cmdheight=ch_bak
                                      rew
                                      endif
                                      endfun

                                      Cheers,
                                      --
                                      David
                                    • Timothy Grant
                                      ... For some reason I have had to change the above to last|rewind|syn on . I don t know why, but the last file in the buffer was not getting highlighted. With
                                      Message 18 of 19 , Mar 8, 2001
                                      • 0 Attachment
                                        On Tue, Mar 06, 2001 at 05:29:22PM -0000, Josifovski Ljubomir-BLJ01Z wrote:
                                        >
                                        > > I put the following in my .vimrc...
                                        > >
                                        > > autocmd VimEnter * last|rewind
                                        >
                                        > Excellent - this completely sums up the whole thread. :-)))
                                        >
                                        For some reason I have had to change the above to
                                        "last|rewind|syn on".

                                        I don't know why, but the last file in the buffer was not
                                        getting highlighted. With the syn on the problem goes away,
                                        though I'm curious as to why it is needed.

                                        --
                                        Stand Fast,
                                        tjg.

                                        Timothy Grant tjg@...
                                        Red Hat Certified Engineer www.exceptionalminds.com
                                        Avalon Technology Group, Inc. <>< (503) 246-3630
                                        >>>>>>>>>>>>>Linux, because rebooting is *NOT* normal<<<<<<<<<
                                        >>>>This machine was last rebooted: 51 days 2:13 hours ago<<
                                      • Janakiraman .S
                                        * Timothy Grant (tjg@exceptionalminds.com) wrote thusly : [...] ... We ve already discussed that in this thread. I suppose you missed it. Anyway, The
                                        Message 19 of 19 , Mar 8, 2001
                                        • 0 Attachment
                                          * Timothy Grant (tjg@...) wrote thusly :

                                          [...]
                                          > > > autocmd VimEnter * last|rewind
                                          > >
                                          > For some reason I have had to change the above to
                                          > "last|rewind|syn on".
                                          >
                                          > I don't know why, but the last file in the buffer was not getting
                                          > highlighted. With the syn on the problem goes away, though I'm curious
                                          > as to why it is needed.

                                          We've already discussed that in this thread. I suppose you missed
                                          it. Anyway, The reason is that the autocommands for events BufRead and
                                          BufWrite donot get triggered if those events are caused by another
                                          autocommand. [:he nested]

                                          Use this.
                                          au VimEnter * nested call VisitLastBuffer()
                                          fun! VisitLastBuffer()
                                          if (argc() > 1)
                                          last
                                          rew
                                          endif
                                          endfun

                                          * David Reviejo (dreviejo@...) wrote thusly :

                                          > Hey! This work very, very well :)
                                          > And if you don't want those "Hit return..." messages, you can do
                                          > something like:
                                          > [...]
                                          > let ch_bak=&cmdheight
                                          > set cmdheight=10
                                          > [...]
                                          > let &cmdheight=ch_bak

                                          That is not necessary if you :se nocp. I dont know which flag in the
                                          compatibility options controls this.
                                        Your message has been successfully submitted and would be delivered to recipients shortly.