How-to Install Notepad++ in Ubuntu with Wine

image

Notepad++ is a free source code editor and Notepad replacement that supports several languages. Running in the MS Windows environment, its use is governed by GPL License.

Based on the powerful editing component Scintilla, Notepad++ is written in C++ and uses pure Win32 API and STL which ensures a higher execution speed and smaller program size.

Notepad++ is no doubt one of the most preferred editor for developers. Unfortunately there isn’t a Linux version. And there is a good reason why it wasn’t ported over to Linux, since it would probably require an entire rewrite of everything to do it. This tutorial is on how to setup Notepad++ in Linux and write a script to run or edit a file from the Linux terminal directly. If you want something that is native to linux then you may want to check out gedit over here.

The steps you will need to follow can be briefly broken into two tasks:

  • Install notepad++ in Linux (I use Ubuntu) using wine
  • Write a Linux script that can invoke notepad++ from any directory in the terminal.

For reference, here is the WineHQ write-up on Notepad++ 5.xx.xx:

http://appdb.winehq.org/objectManager.php?sClass=version&iId=13036

image

How to install Notepad++ in Ubuntu

Drop this doobly-do in your Terminal to install Wine Emulator PPA

sudo add-apt-repository ppa:ubuntu-wine/ppa
sudo apt-get update
sudo apt-get install wine winetricks

Ok, now close out of terminal. And reopen terminal.

export WINEPREFIX=~/.wine/notepad++
winetricks winxp corefonts gecko gecko-dbg vcrun2005
wget http://download.tuxfamily.org/notepadplus/5.9/npp.5.9.Installer.exe
wine npp.5.9.Installer.exe

There may be other ‘winetricks’ components that you can install later that may help with functionality regarding some of the plugins for notepad++ editor. I haven’t had the time to explore all of them yet. Just a ‘heads up’ about that, in case you find a plugin that doesn’t work in Wine.

Here is where where Notepad++ was installed:

image

Create a .sh empty bash script file:

touch notepad++.sh

Open it gedit:

gedit notepad++.sh

Paste this into your newly created script file:

#!/bin/sh
wine ~/.wine/notepad++/drive_c/Program\ Files/Notepad++/notepad++.exe $1

Save it.

The $1 represents the first argument. If you run the script with a filename as the argument notepad++ will open the particular file. The file path of $1 is by default the present working directory. However you can state the full path there to edit any file which is not the same directory from where you call the script. If the file name does not exist, notepad++ will prompt you to create a new file with that name. If you don’t specify any argument, notepad++ will open normally.

Now we want to make this script file executable from any directory:

sudo chmod 755 notepad++.sh

Open terminal and type:

echo $PATH

This will display the list of common path directories. Copy notepad++.sh to any of those common path directories. (You might need root privileges to copy. So open nautilus as root user)

sudo nautilus

Or you can just try this to copy this file to a normally available common path directory instead:

sudo cp notepad++.sh  /usr/local/sbin/notepad++.sh

How to create a icon on your desktop for notepad++.sh:

Right click anywhere on the desktop, and select “Create Launcher”.

Input the notepad++.sh command and name it whatever you want.

Usage

notepad++.sh
  • notepad++.sh -> open notepad++ normally
  • notepad++.sh document.php -> opens document.php to edit.
  • image

    Special Notes: Test to make sure everything works, and after testing it out please feel free to leave a comment below to relate with other users your personal experience running Notepad++ and its overall functionality emulated in Wine. It should be able to handle most work, but probably not everything it did under native Windows. If you do receive errors or problems using Notepad++ in Wine make sure you read the WineHQ write-up and “Known Bugs” from other users first.

     

    原链接:http://cinderbox.net/2011/05/18/how-to-install-notepad-in-ubuntu-with-wine/

    2 Responses to “ubuntu中用wine安装nodepad++”

    1. 赞,学习了。正好需要这个

    2. [...] 转自:ubuntu中用wine安装nodepad++ » 进化…. [...]

    Leave a Reply

    (required)

    (required)

    You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

    © 2011 进化... Suffusion theme by Sayontan Sinha