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



Question:

I use notepad++ from Wine.

I want to set Notepad++ as one of the default editors. I tried to set it by right-clicking on a file, then Open With. But I did not see Notepad++ in the resulting list (even after clicking on Choose Other Programs).


Solution:1

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


Solution:2

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


Solution:3

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  


Solution:4

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.


Solution:5

Right click filetype in question (e.g. txt), and do Open With > Other Application...

Click in the Enter a custom command field below the usual list of applications. Enter:

wine C:\\windows\\command\\start.exe /Unix /home/linuxusername/.wine/dosdevices/c:/users/Public/Desktop/Notepad++.lnk

...Now click button Set as default.

Alternatively instead of Open With etc. you can use mimeopen -d yourfile.txt in Terminal, and you will get similar Use command: prompt into which you can past the above command.

You should now be able to double-click the filetype in question to open it - yay!

Notes:

  • This assumes you installed Notepad++ in wine with desktop shortcut, otherwise adapt your path.

  • linuxusername is of course to be replaced with your user name.

  • Public appears to be the default Windows user name created by the Wine install.

  • This works under pure Debian also.

Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »