DEV Community

Cover image for Add shortcut to VS Code in File Manager on Linux Mint
Tom Benevides
Tom Benevides

Posted on

Add shortcut to VS Code in File Manager on Linux Mint

My programming job forces me to improve myself in many skills. One of them is managing multiples projects at the same time. As a web developer at a Brazilian university, I have to do many things to compensate for the low human and financial resources, very common at Brazilian government departments. So, I'm the guy who implements new services, maintain them and research/test new techs that maybe can help us.

So, because of that, I usually have a few instances of my IDE opened for doing such things. Something very annoying (at least for me), is open a project with an IDE. You open your favorite IDE, then go to open project and choose the project folder. Now, imagine doing that 3 or 4 times. Sometimes, I want some agility and this process is not that fast.

Lucky me, I use Linux. So, I can do many things in that OS and customization is one of them (I don't know if I can customize Windows, I just say: I can do it on Linux). Anyway, the idea is very simple:

  • You just right-click on the project folder you want to open

  • select the "Open on IDE"

  • Happy life, easy-peasy.

Tools and Steps

For this "feature", I used an IDE, specifically the Visual Studio Code (aka VS Code) and the Linux Mint Cinnamon OS. I will not argue here about why I use VS Code + Mint and why YOU guys should use it because is not the purpose, now.

Now the big work! Pay attention!

You just need to create a file at ~/.local/share/nemo/actions named open-vscode.nemo_actions and paste this code on it:

[Nemo Action]

Name=Open on VS Code...

Comment=Open a Folder into Visual Studio Code

Exec=< %F>




Name[en]=Open on VS Code
Enter fullscreen mode Exit fullscreen mode

This little piece of code is telling us:

  • [Nemo Action] Name: "Create a command named Open on VS Code"

  • Exec: "execute this script when someone uses the new command"

  • Icon: "Show the command option with this icon"

  • Selection: "Allow the command for this number of selected items"

  • Extensions: "Allow the command for items with these extensions"

  • Name[x]: "The message will appear like this in that language"

Besides that, you have to implement the script, who actually makes the magic. So, create at the same folder a file named and paste this code on it:


DIR="$(cd "$(dirname "$1")"; pwd -P)/$(basename "$1")"

cd $DIR && code .
Enter fullscreen mode Exit fullscreen mode

This code is even more simple: the first line gets the absolute path of your selected item and the second line flows into your item folder running the VS Code. Now, just run on terminal nemo -q to reload the file manager and.. Ta-da! pom-pom pom-pom \o/.

vs Code - nemo option

Oh! Don't forget to give execute permission to the script or none of this will work.

So, that's it. You can add more commands (or actions as Nemo calls) just creating other .nemo_actions files as you wish. These customize commands will work only in your account once they're in your home folder. If you want to make these commands global on your Linux Mint, copy the .nemo_actions file to /usr/share/nemo/actions and then reload the file manager.

If you liked the post, react or comment on it. And don't forget to share with other people who might enjoy this tip. So .. See you soon!

Discussion (0)