Add open with vscode to context menu in Ubuntu

Solution 1:

wget -qO- https://raw.githubusercontent.com/cra0zy/code-nautilus/master/install.sh | bash

Just run this in your terminal and it will add open with VSCode in context menu for Ubuntu 18.04 LTS. Source: Crazy0's GitHub Repository
Edit 1: Works for Ubuntu 20.04 LTS as well.
Edit 2: Works for Ubuntu 20.10 LTS as well.

Solution 2:

What you need to do is install Nautilus Actions

sudo apt install nautilus-actions

and add new action :

Path: code Parameters: %B

command

in menu

NOTE ❗ ❗ Modern version of Nautilus Actions (nautilus-actions package in trusty (14.04 LTS), xenial (16.04 LTS), artful (17.10)) are named as FileManager Actions (filemanager-actions package, it is not yet packaged in Debian and Ubuntu - see at repology.org).

sudo add-apt-repository ppa:daniel-marynicz/filemanager-actions

sudo apt-get install filemanager-actions-nautilus-extension 

NOTE 2 As of Ubuntu 19.04, the package is filemanager-actions.

sudo apt-get install filemanager-actions

orginal post askubuntu.com/a/1031746/843203

Solution 3:

I was able to find this vscode extension for nautilus written by Crazy0 that lets you do this.

The steps can be found in that github gist, which are:

  1. Go to the gist.
  2. And do the following (also found in the head section of that gist):

    • Place me in ~/.local/share/nautilus-python/extensions/, restrart Nautilus, and enjoy :)
    • mkdir -p ~/.local/share/nautilus-python/extensions && cp -f VSCodeExtension.py ~/.local/share/nautilus-python/extensions/VSCodeExtension.py && nautilus -q

Just tested on Ubuntu Bionic and it works great.

Solution 4:

If you're on 20.10 and you're running this script:

wget -qO- https://raw.githubusercontent.com/cra0zy/code-nautilus/master/install.sh | bash`

You'll need to install python3-nautilus because python-nautilus isn't in non-LTS versions of Ubuntu.

Simply install the python3 version of python-nautilus

sudo apt install python3-nautilus

Then restart nautilus (this will close all nautilus folders)

nautilus -q && nautilus &

And it should work should work.