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

close file but not the tab

Expand Messages
  • rameo
    1) I would like to know if it is possible to close the last tab but keep the empty tab without closing vim. 2) I would also like to know if it is possible to
    Message 1 of 8 , Feb 26, 2010
    • 0 Attachment
      1)
      I would like to know if it is possible to close the last tab but keep
      the empty tab without closing vim.


      2)
      I would also like to know if it is possible to reopen the last files
      (the last tabs) when I reopen vim.

      Tnx.

      --
      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
    • Ben Fritz
      ... But, why do you want this? Wouldn t it be easier to just go ahead and edit the next file you want? ... I ve found this doesn t work well (for me) if I have
      Message 2 of 8 , Feb 26, 2010
      • 0 Attachment
        On Feb 26, 7:46 am, rameo <rai...@...> wrote:
        > 1)
        > I would like to know if it is possible to close the last tab but keep
        > the empty tab without closing vim.
        >

        :help :bdelete
        :help :enew

        But, why do you want this? Wouldn't it be easier to just go ahead and
        edit the next file you want?

        > 2)
        > I would also like to know if it is possible to reopen the last files
        > (the last tabs) when I reopen vim.
        >

        :help :mksession

        I've found this doesn't work well (for me) if I have TagList windows
        open in any of the tab pages. I have not yet investigated the problem,
        it may have something to do with my setup. So, I do a ":tabdo
        TListClose" before I make a session on the rare occasions I do so.

        --
        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
      • rameo
        I have read the help pieces you ve mentioned but not found the answer to my questions. What do I have to do? ... -- You received this message from the
        Message 3 of 8 , Feb 26, 2010
        • 0 Attachment
          I have read the help pieces you've mentioned but not found the answer
          to my questions.

          What do I have to do?

          On Feb 26, 7:08 pm, Ben Fritz <fritzophre...@...> wrote:
          > On Feb 26, 7:46 am, rameo <rai...@...> wrote:
          >
          > > 1)
          > > I would like to know if it is possible to close the last tab but keep
          > > the empty tab without closing vim.
          >
          > :help :bdelete
          > :help :enew
          >
          > But, why do you want this? Wouldn't it be easier to just go ahead and
          > edit the next file you want?
          >
          > > 2)
          > > I would also like to know if it is possible to reopen the last files
          > > (the last tabs) when I reopen vim.
          >
          > :help :mksession
          >
          > I've found this doesn't work well (for me) if I have TagList windows
          > open in any of the tab pages. I have not yet investigated the problem,
          > it may have something to do with my setup. So, I do a ":tabdo
          > TListClose" before I make a session on the rare occasions I do so.

          --
          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
        • Gary Johnson
          ... Vim does not have the notion of empty tabs or empty windows. A window is a view into a buffer. A tab must contain at least one window. Vim itself must
          Message 4 of 8 , Feb 26, 2010
          • 0 Attachment
            On 2010-02-26, rameo wrote:
            > 1)
            > I would like to know if it is possible to close the last tab but keep
            > the empty tab without closing vim.

            Vim does not have the notion of empty tabs or empty windows. A
            window is a view into a buffer. A tab must contain at least one
            window. Vim itself must contain at least one buffer while it is
            running. The closest you can get to an empty tab is to have that
            tab contain an empty buffer, hence the :enew suggestion from Ben.

            Regards,
            Gary

            --
            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
          • Jan Larres
            ... Put this into your .vimrc: delete buffer without closing window function! Bclose() let l:currentBufNum = bufnr( % ) let l:alternateBufNum = bufnr( # ) if
            Message 5 of 8 , Feb 27, 2010
            • 0 Attachment
              rameo <raiwil@...>:
              > I have read the help pieces you've mentioned but not found the answer
              > to my questions.
              >
              > What do I have to do?

              Put this into your .vimrc:

              " delete buffer without closing window
              function! Bclose()
              let l:currentBufNum = bufnr("%")
              let l:alternateBufNum = bufnr("#")

              if buflisted(l:alternateBufNum)
              buffer #
              else
              bnext
              endif

              if bufnr("%") == l:currentBufNum
              new
              endif

              if buflisted(l:currentBufNum)
              execute("bdelete! ".l:currentBufNum)
              endif
              endfunction

              and assign a mapping to it:

              nmap <F8> :call Bclose()<cr>


              Jan

              --
              OpenPGP Key-ID: 00A0FD5F
              "Religion is regarded by the common people as true, by the wise as false,
              and by the rulers as useful." -- Seneca

              --
              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
            • rameo
              Jan, Have you seen my 2nd question also? When I close Vim with 1 or 2 open documents I would like to reopen these documents open. Is that possible? ... -- You
              Message 6 of 8 , Feb 27, 2010
              • 0 Attachment
                Jan,

                Have you seen my 2nd question also?

                When I close Vim with 1 or 2 open documents I would like to reopen
                these documents open.

                Is that possible?



                On Feb 27, 10:51 am, Jan Larres <li...@...> wrote:
                > rameo <rai...@...>:
                >
                > > I have read the help pieces you've mentioned but not found the answer
                > > to my questions.
                >
                > > What do I have to do?
                >
                > Put this into your .vimrc:
                >
                > " delete buffer without closing window
                > function! Bclose()
                >     let l:currentBufNum = bufnr("%")
                >     let l:alternateBufNum = bufnr("#")
                >
                >     if buflisted(l:alternateBufNum)
                >         buffer #
                >     else
                >         bnext
                >     endif
                >
                >     if bufnr("%") == l:currentBufNum
                >         new
                >     endif
                >
                >     if buflisted(l:currentBufNum)
                >         execute("bdelete! ".l:currentBufNum)
                >     endif
                > endfunction
                >
                > and assign a mapping to it:
                >
                > nmap <F8> :call Bclose()<cr>
                >
                >         Jan
                >
                > --
                > OpenPGP Key-ID: 00A0FD5F
                > "Religion is regarded by the common people as true, by the wise as false,
                > and by the rulers as useful."  -- Seneca

                --
                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
              • Jan Larres
                ... Use :mksession, just like Ben said. Jan -- OpenPGP Key-ID: 00A0FD5F The surest way to corrupt a youth is to instruct him to hold in higher esteem those
                Message 7 of 8 , Feb 27, 2010
                • 0 Attachment
                  rameo <raiwil@...>:
                  > When I close Vim with 1 or 2 open documents I would like to reopen
                  > these documents open.
                  >
                  > Is that possible?

                  Use :mksession, just like Ben said.

                  Jan

                  --
                  OpenPGP Key-ID: 00A0FD5F
                  "The surest way to corrupt a youth is to instruct him to hold in higher
                  esteem those who think alike than those who think differently." --
                  Nietzsche, "The Dawn" (1881)

                  --
                  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
                • Ben Fritz
                  ... Vim script that will restore your current editing session. The option sessionoptions controls which portions of the editing session are restored. To
                  Message 8 of 8 , Mar 1 6:40 AM
                  • 0 Attachment
                    On Feb 28, 12:07 am, Jan Larres <li...@...> wrote:
                    > rameo <rai...@...>:
                    >
                    > > When I close Vim with 1 or 2 open documents I would like to reopen
                    > > these documents open.
                    >
                    > > Is that possible?
                    >
                    > Use :mksession, just like Ben said.
                    >
                    >         Jan
                    >

                    To clarify:

                    :mksession will create a file (which you can specify) that contains a
                    Vim script that will restore your current editing session. The option
                    'sessionoptions' controls which portions of the editing session are
                    restored.

                    To resume a session, either launch Vim with "vim -S {session file}"
                    or, from within Vim, use ":source {session file}".

                    See :help :mksession for details.

                    --
                    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.