Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

On my laptop with Ubuntu I'm able to have just one instance of vim, launched with

vim --servername VIM

After this I'm able to open files from console with

vim --remote-silent filename

I use short aliases for both of them.

Also I do some computation on another computer (I'll call it workhorse). It has Debian x64 (without gui) installed. I usually access it using multiple instances of Putty from a Windows PC. Actually workhorse is a virtual machine and I pay for resource usage, so I don't want to overload it too much. However after usual installation of vim (apt-get install vim) I'm unable to run vim with --servername option. It says

Unknown option argument: "--servername"
More info with: vim -h

Indeed, documentation says that vim should be compiled with +client-server option to run it as "a command server". I know two other options: apt-get install vim-gtk and apt-get install vim-gnome, but they ask for huge installation (136Mb and 245Mb respectively). As far as I understand this is somehow related with installation of graphical interface.

I don't have any preferences for any particular workaround. Probably, I will be happy with any workable solution. But I do want to load files to vim from console, like I'm doing it from Ubuntu, or otherwise I do want to know any other way to effectively use vim for editing multiple files. So the question remains

How to install light-weight vim and to be able to efficiently load files into one instance vim?

share|improve this question
add comment

2 Answers

up vote 3 down vote accepted

The client-server capabilities of vim depend on X11, citing from its help:

The communication between client and server goes through the X server. The display of the Vim server must be specified. The usual protection of the X server is used, you must be able to open a window on the X server for the communication to work.

[...]

A non GUI Vim with access to the X11 display (xterm-clipboard enabled), can also act as a command server if a server name is explicitly given with the --servername argument.

This mailing list post is clearer on what is needed:

Except on Windows, communication between server and client goes through X11, so in that case you need both the --with-x configuration option (or default) at compile-time (which, in turn, requires one or more X11 "development" packages to be installed) and an available X server at run-time.

Thus, if you're concerned with resources on your "workhorse", it might be better to just fire up vim instances when needed.

Edit: You could get away with "less than gvim" by building vim yourself (e.g. by rebuilding the Debian package (packaging tutorial PDF)) such that while still needing X11, you could do without GTK etc.

share|improve this answer
    
Thanks a lot for answering my question. It clarified things I was trying to read from help a lot. Mostly I'm concerned with RAM usage. So I don't actually worry about HDD usage, so even 400Mb installation would be probably ok, if it doesn't use RAM every day. So X server as far as I understand, requires about 30Mb of RAM, so it's not very "cheap". –  fiktor Oct 30 '11 at 17:24
    
Although it's not an answer to your question, you might be interested in this approach: utilizing a SSH session's "back-channel" to use a feature-full local gvim for editing remote files. (I guess it also works with a local vim; also I don't know anything about this approaches memory usage, I merely suspect it could be rather low.) –  sr_ Oct 30 '11 at 18:36
    
I am accessing "workhorse" from Windows, using putty. Do you think this approach is possible with putty? –  fiktor Oct 30 '11 at 23:24
    
Oh, I forgot that. Hm, ` bcvi` is written in Perl, but it needs some listener script running locally (i.e., on the windows machine); it could be possible but, I'm sorry, I'm not sure. –  sr_ Oct 31 '11 at 7:44
add comment

Frankly, this is the first time I've heard about the client-server mode of vim. And to me, it does not look useful in your scenario, since you can edit as many files as you want in one vim instance using tabs. When in vim, just enter :tabedit somefile and a new tab will open with the selected file. Simple tab switching is done using gt command.

For more on tabs, see help tabs (from within vim). Also have a look at help split if you'd like to see more than one file at the same time.

share|improve this answer
    
Yes, I know that I can open multiple files in vim. I just wanted to be able to open them without typing full path in vim. –  fiktor Oct 30 '11 at 23:26
1  
You can make it easier using copy-paste (realpath might come in handy to display full path to a file). And the vim command line has also Tab-completion functionality similar to your shell. –  rozcietrzewiacz Oct 31 '11 at 7:45
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.