You are not logged in.

#1 2009-04-30 06:09:59

halhen
Member
From: Gothenburg, Sweden
Registered: 2009-04-08
Posts: 56
Website

Best way for multiple files in vim?

I've been trying out vim for a couple of weeks now, and I must say that I like it. I use it mostly for programming at work (a couple of hours per day).

One thing I haven't settled on is how to use a single vim instance to edit multiple files. I've tried tabs and have been reading about vim+screen (how does yank + paste work between vim instances under screen, btw?).

Which method would you recommend?


statnot - status text manager and notification-daemon for dwm, wmii and the like
shic - SHellscript Irc Client

Offline

#2 2009-04-30 06:16:48

Ramses de Norre
Member
From: Leuven - Belgium
Registered: 2007-03-27
Posts: 1,289

Re: Best way for multiple files in vim?

A combination of tabnew, split and vsplit smile

Offline

#3 2009-04-30 08:13:28

ArchArael
Member
Registered: 2005-06-14
Posts: 504

Re: Best way for multiple files in vim?

Ramses de Norre wrote:

A combination of tabnew, split and vsplit smile

That's also my case. I also prefer gvim over vim because of better font rendering and major amount of colors. I don't use screen proficiently but suppose you can use "+y for copying and "+gp for pasting.
You could map these combination to some keyboard shortcut.

By the way...sorry if offtopic.

I can see why many of users use screen. I use it only if I have to keep active a job over a ssh session. Locally I prefer tabs or multiple terminal windows instead.

Last edited by ArchArael (2009-04-30 08:20:17)

Offline

#4 2009-04-30 09:05:08

robmaloy
Member
From: Germany
Registered: 2008-05-14
Posts: 263

Re: Best way for multiple files in vim?

ArchArael wrote:
Ramses de Norre wrote:

A combination of tabnew, split and vsplit smile

That's also my case. I also prefer gvim over vim because of better font rendering and major amount of colors. I don't use screen proficiently but suppose you can use "+y for copying and "+gp for pasting.
You could map these combination to some keyboard shortcut.

By the way...sorry if offtopic.

I can see why many of users use screen. I use it only if I have to keep active a job over a ssh session. Locally I prefer tabs or multiple terminal windows instead.

when you're connected to a remote computer, you don't want to reconnect for each terminal tab. so you use screen and get used to the shortcuts and use it at your local pc too.


☃ Snowman ☃

Offline

#5 2009-04-30 09:11:49

ArchArael
Member
Registered: 2005-06-14
Posts: 504

Re: Best way for multiple files in vim?

robmaloy wrote:

when you're connected to a remote computer, you don't want to reconnect for each terminal tab. so you use screen and get used to the shortcuts and use it at your local pc too.

Right. I know that in these cases screen is a must. Maybe because I usually can do all job in the login shell, when I login remotely, I don't use screen. Locally, IMHO, tabs are much more simpler.

By the way, halhen, did you checked vim-minibufexpl extension? It is in the extra repository and could be useful.

Last edited by ArchArael (2009-04-30 09:17:32)

Offline

#6 2009-05-01 14:01:28

scio
Member
From: Buffalo, NY
Registered: 2008-08-05
Posts: 366

Re: Best way for multiple files in vim?

vsplit and plain old e and ls for me.  Tabs seem silly in vim to me but, if it works for you, why not!  Usually I have one screen open for each section I am working on (Model/View style code) each with 10-15 files open vsplitting when needed.

Offline

#7 2009-05-01 23:14:33

alexandrite
Member
Registered: 2009-03-27
Posts: 326

Re: Best way for multiple files in vim?

I didn't even know about tabbing in VIM... I had just been using urxvt's tabs.  Not gonna lie, the vim tabs are a lot better, imo.

As for how yanking and putting works between Vim instances, the answer is using the tabnew or sp commands, you can just put stuff between tabs with no effort.

If you want to go between two distinct windows (or copy/paste from stuff in X) then you can use the "+" register, which is mapped to the X clipboard.  When in normal (not command, visual or insert) mode, type a double quote and a number key, -, or +, to select registers 1 through +.  + is the X clipboard.

Edit: I guess someone already said this, so consider this a more detailed explanation?

Last edited by alexandrite (2009-05-01 23:25:37)

Offline

#8 2009-05-02 06:49:50

halhen
Member
From: Gothenburg, Sweden
Registered: 2009-04-08
Posts: 56
Website

Re: Best way for multiple files in vim?

Thanks all.

Obivousy, these decisions are rarely best made upfront, but often needs a bit of experimentation. Based on my preferences (98% local work, prefer full y/p - powers between files, tiling window manager) I'll try running a single vim instance "full screen" with tabs and add the sp's.


statnot - status text manager and notification-daemon for dwm, wmii and the like
shic - SHellscript Irc Client

Offline

#9 2009-05-02 12:13:18

N30N
Member
Registered: 2007-04-08
Posts: 273

Re: Best way for multiple files in vim?

Buffers (with set hidden) works best for me.

Offline

#10 2009-05-02 14:57:56

Ramses de Norre
Member
From: Leuven - Belgium
Registered: 2007-03-27
Posts: 1,289

Re: Best way for multiple files in vim?

alexandrite wrote:

If you want to go between two distinct windows (or copy/paste from stuff in X) then you can use the "+" register, which is mapped to the X clipboard.  When in normal (not command, visual or insert) mode, type a double quote and a number key, -, or +, to select registers 1 through +.  + is the X clipboard.

+ gives the clipboard in which you explicitly copy stuff in X. The * register contains the last selected text (_the_ way to copy!).

Offline

Board footer

Powered by FluxBB