Jason Heppler
Jason Heppler

Reputation: 716

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!

Upvotes: 2

Views: 2234

Answers (1)

dan
dan

Reputation: 45632

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://[email protected]/.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.

Upvotes: 10

Related Questions