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

How to load a file into a tab with 'vim '

Expand Messages
  • Meino Christian Cramer
    Hi, The subject says it all :) I want to load a file into a tab when starting vim from the console (termulator under X) with that file given on the
    Message 1 of 3 , Oct 31, 2006
      Hi,

      The subject says it all :)

      I want to load a file into a tab when starting vim from the console
      (termulator under X) with that file given on the commandline.

      Another thing (not included in the subject :O)))
      When starting vim as above but without an argument and loading
      a file into vim with

      :e tab sp <filename>

      then, I always get a tab called [No Name] and the second one is the
      tab of the file I want to edit.

      Is there a way to avoid the "No Name" buffer...it make the option
      "showtabline" a little superflous (only my two cents...), because
      there is alway an additional buffer ("No Name") even when loading
      only one file into a tab...

      Thank you very much in advance for any :h ! :))

      Keep :hacking!
      mcc
    • Bill McCarthy
      ... You always get a tab. If there s only one tab, the little tabs don t show (unless stal is set to 2. If you want to load several files into separate
      Message 2 of 3 , Oct 31, 2006
        On Tue 31-Oct-06 9:47pm -0600, Meino Christian Cramer wrote:

        > I want to load a file into a tab when starting vim from the console
        > (termulator under X) with that file given on the commandline.

        You always get a tab. If there's only one tab, the little
        tabs don't show (unless 'stal' is set to 2. If you want to
        load several files into separate tabs:

        vim -p file1 file2 ...

        If you want 4 tabs but only want to specify one file:

        vim -p4 file

        See :help -p
        :help 'stal'

        > Another thing (not included in the subject :O)))
        > When starting vim as above but without an argument and loading
        > a file into vim with
        >
        > :e tab sp <filename>
        >
        > then, I always get a tab called [No Name] and the second one is the
        > tab of the file I want to edit.

        Hmm, I get one file named "tab sp filename". If you want to
        load file into its own tab:

        :tabedit file

        > Is there a way to avoid the "No Name" buffer...it make the option
        > "showtabline" a little superflous (only my two cents...), because
        > there is alway an additional buffer ("No Name") even when loading
        > only one file into a tab...

        I don't follow. If I wanted to load one file and see the
        tab, I would start with:

        vim --cmd "set stal=2" filename

        No "No Name" stuff.

        --
        Best regards,
        Bill
      • A.J.Mechelynck
        ... Files are _always_ loaded into tabs in Vim 7 with +windows (i.e. in any Vim 7 executable except tiny versions); however if showtabline is 0 the tab bar
        Message 3 of 3 , Oct 31, 2006
          Meino Christian Cramer wrote:
          > Hi,
          >
          > The subject says it all :)

          Files are _always_ loaded into tabs in Vim 7 with +windows (i.e. in any Vim 7
          executable except "tiny" versions); however if 'showtabline' is 0 the tab bar
          is never shown (but you can still switch tabs), and if it is 1 (the default)
          the tab bar is displayed only if there are at least two tabs. To _always_
          display the tab bar, use ":set showtabline=2".

          >
          > I want to load a file into a tab when starting vim from the console
          > (termulator under X) with that file given on the commandline.
          >
          > Another thing (not included in the subject :O)))
          > When starting vim as above but without an argument and loading
          > a file into vim with
          >
          > :e tab sp <filename>

          When I give that command, I get "E172: only one file name allowed".

          ":tab sp filename.txt", or, when written in full, ":tab split filename.txt",
          would keep the current tab (even if there is only a [No Name] file in it) and
          edit filename.txt in a new tab. To replace the current display by that of
          filename.txt, use ":e filename.txt". To display the tab bar even if there is
          only one tab, use ":set showtabline=2". Try it just after loading Vim with no
          filenames on the command-line, you'll see a tab for your current [No Name] buffer.

          >
          > then, I always get a tab called [No Name] and the second one is the
          > tab of the file I want to edit.
          >
          > Is there a way to avoid the "No Name" buffer...it make the option
          > "showtabline" a little superflous (only my two cents...), because
          > there is alway an additional buffer ("No Name") even when loading
          > only one file into a tab...
          >
          > Thank you very much in advance for any :h ! :))
          >
          > Keep :hacking!
          > mcc
          >

          For a single file:

          vim "+set showtabline=2" foo.txt

          If your vimrc sets 'showtabline' to 2 you can even use just "vim foo.txt".

          For two or more files:

          vim -p foo.txt bar.txt


          Best regards,
          Tony.
        Your message has been successfully submitted and would be delivered to recipients shortly.