Pair with tmux but use our own vimrc files - vim

I'm looking to pair with people over tmux with Vim, but I've run into a snag. I've become so used to my Vim setup that I do not know how to navigate without some of my basic mappings that I've setup. That being said, if I SSH into somebody else's box, I don't really know my way around.
Is there a way to load some of my vimrc config when ssh-ing into someone else's box?

I suggest CoVim https://github.com/FredKSchott/CoVim
This is not depend on tmux.

If it's just your .vimrc file, you could :source that:
:source scp://myhost/.vimrc
Thanks to the netrw plugin, this transparently accesses the file from your system; of course, you could also explicitly mount your home directory and then use a normal filespec to the mounted files.
In theory, you could even add your remote ~/.vim directory to 'runtimepath', so that all of your customizations and plugins are loaded, but that probably leads to greatly increased startup times (due to the network accesses), potential conflict with the host's plugins, and is therefore not recommended.

Related

How can I use local vim setting on AWS server?

Is there a faster way to edit AWS EC2 config file using my local env vimrc?
I found that it is very hard to edit file in remote server using default vim settings
Any one has good solution to make ourself better?
Remote editing
I suppose you're using ssh to log into your AWS server and launch Vim there. An alternative is to launch Vim on your local system, and open the remote file in there, e.g. via the built-in netrw plugin:
$ vim scp://hostname/path/to/file
or within Vim:
:edit scp://hostname/path/to/file
Sharing Vim configuration across machines
There are many different approaches for sharing your .vimrc and plugins across multiple machines. Possible solutions were recently collected at What is the best way to deal with vim plugins on multiple machines?

VIM support to upload via SFTP

I am used to Sublime's plugin that let's you do a mapping between your local project and a remote project. By doing so, when you are done editing a file, you can do a right click and "Upload file" action which automatically updates the file in the remote server.
I am wondering what would be the best way to do this while programming with VIM. I am looking for an easy way to be able to map a local project to a remote one and be able to upload the file easily.
Thanks
If all you want is to edit files on a remote server,
try vim's netrw feature:
vim scp://you#yourserver//path/to/directory/
Edit a file directly:
vim scp://you#yourserver//path/to/directory/somefile.txt
Or if you are already in vim, hit ESC, then type:
:e scp://you#yourserver//path/to/directory/
This assumes that:
you have ssh installed (usually the case for Linux or OSX; if you are on Windows then it depends).
you have ssh access to the server via some convenient method (sshagent and keys)
Most serious FTP clients let you edit remote files locally. Filezilla, gFTP, Transmit, Cyberduck, YummyFTP… they all have their own "Edit in…" button. GUI FTP clients may not be sexy hacker tools but they work very well.
Some of those serious FTP clients have synchronisation features or folder watchers. It might be worth your time to look around for such a feature.
Of course, you can also use Vim itself to edit a remote file via FTP or SFTP:
$ vim sftp://user#machine/filename
$ vim ftp://user#machne/filename
and list remote files:
$ vim sftp://user#machine/directory/
See :help netrw for more info.
Did you consider using a VCS like Subversion, Git or Mercurial?

Automated Context Switching Between Projects via SSH and Multiple Terminals

I'm looking for some guidance on an approach to automate the process of quickly switching between projects.
Putty Windows (2 of them):
Vim with project.session open (multiple tabs)
IPython open to the working directory of the project
What I want to automate in its respective windows:
Save all files, save session, close vim, change working directory of vim to next project, open related project session.
Close ipython (as I often restart it during development and want a fresh instance), change directory to next project'ss location, open a new ipython
A magic solution would be a single command that would change the state of both putty windows. However, since I have no idea how that would be done my current approach would be:
Attempt to figure out how to bind all that Vim stuff to a key press or a custom vim script that is used like: :SwitchProj "projectName"
Write a bash script or find a bash command that will allow me to type as little as possible to perform the directory switch and open new ipython interpreter.
As I have very little experience on Linux and SSH I would be interested to know how other's have solved this problem or would approach it!
I believe that the Linux screen command should satisfy you. Google gives you many tutorials, like this one.
I sadly confess that I am not very familiar with screen. Learning it is in my todo list
If you use the Gnu Emacs editor, you can also open many shell buffers inside (and other interactive buffers, like gdb sessions, compilations, grep search) and edit many files. I do that very often. You can use emacs thru a tty interface, such as provided by ssh.
You could also use ssh with e.g. -X to also redirect X11 windowing. For you, that means that you'll need to run an X11 server on your local Windows machine.

Open MacVim via Terminal when SSH'ed to a server

I'm wondering if there is a way to have MacVim become my default editor when I've SSH'ed into a server. Is there any way for the server's .vimrc file to launch a program on my Mac?
I ask because occasionally I'll be getting some help from our programmer on a project, and if he logs into my account from his computer and opens vim using my configuration the color scheme is usually pretty harsh since he isn't using a terminal that supports 256 colors. Would it be easier to have my .vimrc file set up so if it detects a gui (e.g., I'm using iTerm instead of Terminal.app) it loads the colorscheme I prefer?
Thanks for any advice!
Here's a way to use MacVim to edit files on your server, but it requires you to start MacVim on your local computer first.
First make sure you have netrw installed. Check :help netrw to confirm that it is.
Then after you start MacVim, you can type something like this:
:e scp://username#yourserverdomain.com/.bash_profile
And you should see the file open up in your MacVim vim session. Edit it and save.
Having ssh keys set up to automatically authenticate you into the server will help.

Vim FTP Plugin for IDE-like behavior

I have gVim (with: NERDTree, minibufexpl). Right now, I can edit files locally with IDE-like feel with NERDTree for a file explorer and minibuf for tabs.
However, I am used to editing files on dummy server I have set up at home. I use Zend Studio to edit files through FTP. Is this feature available in Vim? If so, does it "integrate" well with NERDTree? I would like to browse my FTP directory using NERDTree.
Thank you,
Wenbert
You can edit files remotely over ftp or sftp or scp or whatnot with vim:
vim ftp://user#host/some/file
Of course, this also works with tabs. Don't know about minibuf, though.
Unfortunately, the NERDTree plugin does not seem to support this. However, the :Explore command plays along just nicely.
Of course, you could simply use FTPFS to mount a remote directory and work with that as if it was local storage.

Resources