4

I would like a command that I can put in my ~/.vimrc file that will make vim always open in tabbed pages mode without having to pass the -p on the command line.

Is there such a command? If not, is there a better way to do this. Currently, I'm using

alias vi='vim -p'

in my bash profile.

Thanks.....

dlmeetei
  • 9,905
  • 3
  • 31
  • 38
user2179204
  • 207
  • 2
  • 5
  • Do you want all your buffers to always open in a new tab? – Atri Jan 16 '16 at 02:27
  • 1
    Your alias is the best solution. That said, [you are probably misusing tab pages](http://stackoverflow.com/questions/26708822/why-do-vim-experts-prefer-buffers-over-tabs/26710166#26710166). – romainl Jan 16 '16 at 10:58

2 Answers2

3

You need to add :au BufAdd,BufNewFile * nested tab sball to your vimrc as per this.

Edit:

:au BufAdd,BufNewFile,BufRead * nested tab sball

This will always open all buffers in a new tab if that is what you are looking for.

Atri
  • 5,511
  • 5
  • 30
  • 40
  • Sorry but this isn't what I'm looking for. With this, if I run 'vim file1 file2' it only opens file1. It doesn't open each file in it's own tab. I'm looking for a vimrc substitute for 'vim -p'. – user2179204 Jan 16 '16 at 03:34
  • This one (the edited version) opens the first file once and each additional file twice. – user2179204 Jan 16 '16 at 16:47
2

Setting the following in ~/.vimrc and source ~/.vimrc

au VimEnter * if !&diff | tab all | tabfirst | endif

works as being mentioned here


or set an alias in you rc file e.g. ~/.bashrc. This is the approach I take.

alias vim='vim -p'
alias vi='vim -p'
dlmeetei
  • 9,905
  • 3
  • 31
  • 38