How do I set Notepad++ as an editor on Ubuntu?

You can use the mimeopen command

Using a terminal go to a folder containing some extension you want to open with notpadd++(here i'm testing for txt files)

mimeopen -d file.txt

You will get a popup menu, where you can see some options, if you don't find notepad++ with them choose other and indicate your notepad++ .

Also you may interested in reading Change all associations from gedit to another application


I guess the best advanced option gives you Ubuntu Tweak tool.

enter image description here

Here you can set your default (desired) app to any format/extension.

More detailed described here


Instead of using Notepad++ through Wine, you can directly install Notepadqq in Ubuntu. You can consider it as Ubuntu version of Notepad++. Notepadqq can be installed as follows:

sudo add-apt-repository ppa:notepadqq-team/notepadqq
sudo apt-get update
sudo apt-get install notepadqq
sudo apt-get install notepadqq-gtk

I have followed the below steps and that exactly made me to fix this issue and made Notepad++ as the default editor in Ubuntu.

  1. Once after installing Notepad++ using WINE, copy the file "Notepad++.desktop" under, "/.local/share/applications/wine/programs/Notepad++"

  2. We need to paste the copied file "Notepad++.desktop" in the below path "/usr/share/applications"

NOTE: The applications folder is write protected by default. So open the terminal and navigate to "/usr/share" path and execute the following command.

sudo chmod -R 777 applications

Once after copying the "Notepad++.Desktop" file, revert back this permission change made by the following command.

sudo chmod -R 555 applications

  1. Now, we need to make changes in the configuration file that exists in the gnome folder [which is a subfolder inside "etc" folder]

Note: Again here, the gnome folder is write protected by default so, open the terminal and navigate to "/usr/share" path and execute the following command.

sudo chmod -R 777 gnome

  1. Now open the "defaults.list" file inside gnome folder and replace gedit by Notepad++. You can also individually set Notepad++ as default application for certain type of file.

For example, if you want to edit only plain text files in Notepad++, n the "defaults.list" file find for "text/plain" and you will get a line as follows,

text/plain=gedit.desktop

Now replace the gedit bu Notepad++ so that, it would set the Notepad++ as default application for the plain text. The modified line should look like,

text/plain=Notepad++.desktop

Now, SAVE the file once this change is done and close the file.

[You can find a new file name defaults.list.xxxx has been created, which is nothing but the backup of old settings and you can very well delete it. Please make sure you are not deleting the other two files namely : "defaults.list.dpkg-old" and "menus.blacklist" ]

Once doing the required changes, revert back the permission change made earlier for the gnome folder by the following command.

sudo chmod -R 555 gnome

  1. That's it... You have made Notepad++ as the default editor in Ubuntu. It worked for me and I hope this post helps.