Reply to message «How to close all files opened by different vim instances», sent 23:16:30 22 March 2011, Tuesday by howard Schwartz:
> I thought this would be obvious: If you work in unix/linux with x-windows, > then alias gvim thus: > > alias gvim gvim --remote-tab-silent > > Now `vim filename' will open a single instance of vim, with `filename' in > one tab. Switch files by simply clicking on one of the tabs. No, I can't: 1. gvim --remote-tab-silent is not going to bring gvim to current virtual desktop. 2. With one gvim for all projects I am going to constantly taking gvim from one virtual desktop to another and constantly switching tabs. I do not do this with one-vim-for-one-project. I am not going to close anything because it saves time when I switch from one project to another. 3. I do use some advanced zsh features which help me with writing VCS commands and doing other stuff like renaming (or massive renaming) files. Gvim is going to be another window in desktop's window list and this is not convenient. > Actually, session files and tab functionality were designed, for the most > part, to let users work on projects, using a single instance of vim. Can you prove that? Tabs are for saving window layouts for different tasks (for example, see last paragraph in `:h tab-page-intro') for one vim session. Sessions are to `quickly switch between different projects', here you are right. But there is a thing to consider: session file saves the whole vim session, not only tab, so it was not intended to use one-vim-for-all-projects, but one-vim- for-one-project. > Each tab can handle a collection of files in > several buffers and/or windows. You misunderstood what tabs are: 1. Tabs do not handle buffers, they only make one able to have multiple window layouts. 2. There are no binds between buffers and windows or buffers and tabs, so you may view any buffer in any window located in any tab. > Then you change from one file to another, using buffer commands or a > buffer plugin. Buffer list is not attached to any tab, so I will get a lot more alternatives for `:buffer' command if I do this. > You load a project into vim, by loading a particular > session file. Effectively wiping out everything that I am doing currently. It looks like you have actually never worked with several projects simultaneously in one vim, or have brought a habit (probably from windows) to close tasks that you don't need just now. There is more effective habit: if you don't need an application just now, but will need it later, then leave it on one virtual desktop and switch to another. It is not machine-effective though: for example, I have now above two hundred tabs in Opera which saves my time, but consumes lots of memory (30% of 4 GiB: 1,2 GiB for a single application. Next memory-consuming application takes only 3%). Original message: > ZyX <[email protected]> wrote: > > When I want to edit a file I just type `vim file'. What I am supposed to > > do > > if I > > > want to keep one vim session? Don't suggest me switching to other > > terminal window and typing anything there. > > I thought this would be obvious: If you work in unix/linux with x-windows, > then alias gvim thus: > > alias gvim gvim --remote-tab-silent > > Now `vim filename' will open a single instance of vim, with `filename' in > one tab. Switch files by simply clicking on one of the tabs. > > If you work in a shell, with no graphic windows you can do something > similar by using autocommands and a tiny file to pass commands to one > instance of vim. If desired, I can specify how to do this. > > > Setting vim up to `one vim for one project' is easier than `one vim for > > all projects. > > Actually, session files and tab functionality were designed, for the most > part, to let users work on projects, using a single instance of vim. In > particular, each tab can correspond to a project, with settings saved and > sourced in a session file. Each tab can handle a collection of files in > several buffers and/or windows. You go to a project by selecting a tab. > Then you change from one file to another, using buffer commands or a > buffer plugin. You load a project into vim, by loading a particular > session file. > > I can understand being reluctant to give up one's private system, and learn > all these session, tab, buffer commands. But, they are there for those who > want them. > > > > ================================================ > { PLEASE CHANGE YOUR EMAIL CONTACT LIST! } > { If I am listed as [email protected], change my } > { address to [email protected] } > ================================================
signature.asc
Description: This is a digitally signed message part.
