July 13, 2017

Using VS Code and Linux

Using VS Code and Linux

I edit a lot of files in Linux lately. Here at Microsoft, we love Linux so much we plaster it on everything these days, which is awesome!

One thing I am not too terribly fond of, however, is VI, VIM, NANO, EMACS, etc. I just really like VS Code though, and you should too. Even when I'm on my Raspberry Pi, I use VSCode there instead. Don't hate me, I was born this way.

So, when I'm editing my files, I like to use a great feature that I learned about from this guy to open my remote Linux files directly into VSCode on my workstation. In this post, I take his instructions and make them a bit easier for me to understand. Perhaps they will help you too.

  1. Open up VS Code and install the Remote-VSCode extension:
    cmd+p then ext install remote-vscode

  2. Turn the extension on. In VSCode, type ctl+comma

  3. On the right hand side, put this stuff in to your User Settings:

  4. Restart VSCode just for giggles.

  5. Head on over to Putty. This works for other console programs but I figured this was the most common and it is also the one I use. In Putty, you need to do your normal connecting stuff, but also you set up a tunnel like this:

    Double triple check that the radio box is set for REMOTE, not LOCAL.

Now, open up your session and log in. Once there, we need to set up the Linux box to send text editing over the tunnel we just set up.

sudo wget -O /usr/local/bin/rcode \ https://raw.github.com/aurora/rmate/master/rmate

Then: chmod a+x /usr/local/bin/rcode

That's it! Now you are ready to make magic happen.

sudo rcode himom.txt


When you make changes, just hit save or ctl+s and the file writes back to Linux:

A few notes:

  1. sudo may not be needed in running rcode, depends on where the file is as to whether you get +w rights.
  2. Hi there, been a while since I got to blog. Miss you!
  3. Life is crazy, lots of fun summer activities with the kids (all five of them). And it's hot. And I got reorged but still get to do what I love - Azure!
  4. We really do love Linux at Microsoft. Don't believe me? Check out the Windows 10 Store and feel free to install Ubuntu. Like freaking lasers man: