Beruflich Dokumente
Kultur Dokumente
Don Ho <don.h@free.fr>
Adrien Sales <prslump@msn.com>
Matt Sicking <matt@sickingfamily.com>
Georg Dembowski <schoSchi@gmx.de>
.:: The Notepad++ (Doc) Book ::.
by Don Ho, Adrien Sales, Matt Sicking, and Georg Dembowski
Published 2005
Copyright © 2005, 2006
Table of Contents
1. About N++ ............................................................................................................................. 1
Syntax Highlighting and Syntax Folding .................................................................................. 1
WYSIWYG ....................................................................................................................... 1
User Defined Syntax Highlighting .......................................................................................... 1
Auto-completion ................................................................................................................. 1
Multi-Document ................................................................................................................. 2
Multi-View ........................................................................................................................ 2
Regular Expressions ............................................................................................................ 2
Regular Expression Search/Replace supported .................................................................. 2
Notepad++ RegExp List ............................................................................................... 2
Notepad++ RegExp Examples ....................................................................................... 3
Drag and Drop .................................................................................................................... 5
Dynamic View Positioning ................................................................................................... 5
File Status Auto-detection ..................................................................................................... 5
Zoom in and zoom out ......................................................................................................... 5
Multi-Language environments ............................................................................................... 5
Bookmarks ........................................................................................................................ 5
Parenthesis and Indent guideline Highlighting .......................................................................... 5
Macro recording and playback ............................................................................................... 5
2. How to ... ............................................................................................................................... 6
Shortcuts ........................................................................................................................... 6
General ............................................................................................................................. 7
Fonts ........................................................................................................................ 7
Open Files ................................................................................................................. 7
Column Mode Selection ............................................................................................... 7
Sharing Defined Language ............................................................................................ 8
Explorer context menu ................................................................................................. 8
Auto Completion ................................................................................................................ 9
Plugins ............................................................................................................................ 10
How to install a plugin ............................................................................................... 10
How to develop a plugin ............................................................................................. 10
User Language Define System Manual .................................................................................. 12
Overview of the User Define Language dialog ................................................................ 13
Folder & Default panel ............................................................................................... 16
Keywords lists panel .................................................................................................. 17
Comment & Numbers panel ........................................................................................ 18
Operators Panel ........................................................................................................ 19
Translation ...................................................................................................................... 20
Theme ............................................................................................................................ 21
Context Menu ................................................................................................................... 22
Command Line Argument .................................................................................................. 25
Run External Tools ............................................................................................................ 26
3. More Notepad++ ................................................................................................................... 28
Help Notepad++ ............................................................................................................... 28
Downloads ...................................................................................................................... 28
Logos ..................................................................................................................... 28
Plugins .................................................................................................................... 29
Language Files ......................................................................................................... 29
Api Files ................................................................................................................. 31
User Defined Language files ....................................................................................... 31
Theme Package ........................................................................................................ 32
4. Document creation ................................................................................................................. 34
iv
List of Tables
2.1. Keyboard shortcuts: ............................................................................................................... 6
2.2. Supported Languages: ............................................................................................................ 9
2.3. Notepad++ messages: .......................................................................................................... 11
v
Chapter 1. About N++
Notepad++ is a free source code editor which supports several programming languages running under
the MS Windows environment.
This project, based on the powerful Scintilla [http://www.scintilla.org/] edit component, and written in
C++ with pure win32 api and STL, ensuring higher execution speed and smaller program size, is offered
under the GPL [http://www.gnu.org/copyleft/gpl.html] Licence.
This project is mature. However, as you can see, it's a one-man project, and there are still some bugs and
missing features. If you have any questions or suggestions about this project, please drop me an email. I
would love to hear from you. Also, feel free to send me any feature requests you might have. Although,
I can't guarantee that I'll implement them.
WYSIWYG
If using a colour printer, your document, incuding line numbers, will be printed in colour as shown on
the screen.
Auto-completion
For most supported languages, api files may be downloaded from the Notepad++ download section
[http://notepad-plus.sourceforge.net/uk/download.php]). Furthermore, the user can create or augment the
API list for a given language. Type Ctrl+Space to launch this action (see screenshot
[./img/scrsh_autocomplete.gif]). For more information about Auto-completion, refer to the the section
called “Auto Completion” section.
1
About N++
Multi-Document
Multiple documents may be simultaneously opened and edited within the same Notepad++ application.
Multi-View
It is possible to display two views simultaneously. This may be either separate views of two distinct doc-
uments (screenshot [./img/scrsh_multiView.gif]), or two views of the same document. In this second
case, any modifications performed on the document in one view will also be applied in the second view
(screenshot [./img/scrsh_multiViewCloneMode.gif]).
Regular Expressions
Regular Expression Search/Replace supported
Regular expressions may be used as the search criteria in all search and replace options.
• .
• (
This marks the start of a region for tagging a match; so what's inside ( ) you can use in "replace
with" using \1, \2 etc.
• )
• \n
Where n is 1 through 9 refers to the first through ninth tagged region when replacing. For example, if
the search string was Fred([1-9])XXX and the replace string was Sam\1YYY, when applied to
Fred2XXX this would generate Sam2YYY.
• \<
• \>
• \x
This allows you to use a character x that would otherwise have a special meaning. For example, \[
would be interpreted as [ and not as the start of a character set.
• [...]
2
About N++
This indicates a set of characters, for example, [abc] means any of the characters a, b or c. You can
also use ranges, for example [a-z] for any lower case character.
• [^...]
The complement of the characters in the set. For example, [^A-Za-z] means any character except an
alphabetic character.
• ^
This matches the start of a line (unless used inside a set, see above).
• $
• *
This matches 0 or more times. For example, Sa*m matches Sm, Sam, Saam, Saaam and so on.
• +
This matches 1 or more times. For example, Sa+m matches Sam, Saam, Saaam and so on.
• You have to check the box "regular expression" in search & replace dialog
• When copying the strings out of here, pay close attention not to have additional spaces in front of
them ! Then the RegExp will not work!
1.
• # Search ^=(=)
• Replace with \1
• Click "Replace all" to find all headings2...9 (two equal sign characters are required) which be-
gin at line beginning (^) and to replace the two equal sign characters by only the last of the two,
so eleminating one and having one remaining.
2.
• # Search =(=)$
• Replace with \1
• Click "Replace all" to find all headings2...9 (two equal sign characters are required) which end
at line ending ($) and to replace the two equal sign characters by only the last of the two, so
3
About N++
You have a document with a lot of dates, which are in German date format (dd.mm.yy) and you'd like to
transform them to sortable format (yy-mm-dd). Don't be afraid by the length of the search term - it's
long, but consiting of pretty easy and short parts :
1.
• Search ([^0-9])([0123][0-9])\.([01][0-9])\.([0-9][0-9])([^0-9])
•
• the day, whose first number can only be 0, 1, 2 or 3
• but only if no numbers are sourrounding the date, as then it might be an IP address instead
of a date and to write all of this in the opposite order, except for the surroundings. Pay atten-
tion: Whatever SEARCH matches will be deleted and only replaced by the stuff in the RE-
PLACE field, thus it is mandtory to have the surroundings in the REPLACE field as well!
2. 31.12.97 became 97-12-31 and 14.08.05 became 05-08-14 and the IP address 14.13.14.14 did not
change, you're done :-)
You have printed in windows a file list using dir /b/s > filelist.txt to the file filelist.txt and want to make
local URLs out of them :
2.
• Search \\
• Replace with /
• Click "Replace all" to change windows path separator char \ into URL path separator char /
3.
• Search ^(.*)$
4. Depended on your requirements, preceed to escape some characters like space to %20 etc.
4
About N++
Multi-Language environments
Chinese, Japanese, Korean, Arabic, and Hebrew Windows environments are supported. See Notepad++
in action under the Chinese Windows [./img/scrsh_underChineseSys.gif] , Arabic Windows
[./img/scrsh_underArabicWin.gif] and Hebrew [./img/scrsh_underHebrewWin.gif] Windows screen-
shots.
Bookmarks
Clicking on the bookmark margin (located on the right side of the line number margin) or typing
Ctrl+F2 will toggle a book mark on that line. To return to a saved bookmark, type just F2 (Next book-
mark) or Shift+F2 (Previous bookmark). To clear all bookmarks, click "Search" -> "Clear All book-
marks". See screenshot [./img/scrsh_bookmark.gif].
5
Chapter 2. How to ...
Shortcuts
6
How to ...
General
Fonts
How can I set all the fonts under Notepad++ to a mono-space font ?
All the styles (colour & font) are configurable via the Styler Configurator Dialog (menu: Language-
>Styler Configurator...). To apply the same font (ex: Fixedsys) to all the styles, choose Global Styles in
the Language column and Default Style in the Styles column. Then set your favorite font.
Open Files
I attempted to open a file whose pathname contains white space. It appears that this is not supported by
Notepad++.
Notepad++ does indeed support long filenames with white space. There shouldn't be a problem if you
open such a file via the internal File Open dialog (from menu: File->Open), via Drag N' Drop, or via the
context menu (right click mouse, installed by Notepad++ Installer) under Explorer.
However, if you attempt to manually associate Notepad++ with certain file extensions, there may be a
problem. It has been my experience, if you want to add a registry key yourself, that you should do
something like this:
(including the double quotes) to make sure the shell correctely interprets the string.
As of v2.6, Notepad++ is integrated with the File Associations Manager which allows user to associate/
disassociate all the desired file extensions with Notepad++. Note that Administrator's rights are required
to perform this operation.
7
How to ...
Yes. Alt + left mouse click will turn on column mode selection. See the section called “Shortcuts” to get
all Notepad++ shortcuts.
The language definition file is named userDefineLang.xml. It is located in the “Application Data”
subfolder in the user's Documents and Settings folder. To locate this file open a command window
(START->Run) and key in
%APPDATA%\Notepad++
A folder window will open containing the userDefineLang.xml file. To copy this file onto another
user's system, follow the same process as above to access the Application Data folder, and paste the
userDefineLang.xml file into the folder.
To share the syntax highlighting definition file, follow this same process, substituting stylers.xml
for userDefineLang.xml.
Due to numerous file association bugs in the Notepad++ context menu entry, this feature is no lnger sup-
ported by the Notepad++ installer.
However, you can add this entry to the registry manually to make the Notepad++ context menu entry
work. There are two methods of doing this:
• Method 1:
1. Launch regedit.exe
</listitem>
A screenshot ilustrating this method follows:
8
How to ...
• Method 2:
REGEDIT4
[HKEY_CLASSES_ROOT\*\Shell\n++]
[HKEY_CLASSES_ROOT\*\Shell\n++\Command]
@="\"C:\\Program Files\\Notepad++\\Notepad++.exe\" %1"
• Note that you should modify "C:\Program Files\Notepad++\Notepad++.exe" to indicate the actu-
al path to Notepad++ on your system.
• No need to say all the blah blah about "backup your registry before you modify it" and "do this at
your own risk".
Auto Completion
How to implement and customize Auto-completion:
Type Ctrl-Space to trigger the autocomplete list box (see screenshot). You may add your own api file in
the directory YOUR_NPP_DIR\plugins\APIs where YOUR_NPP_DIR is the directory in which you in-
stalled Notepad++. Note that the extension of the api file is “.api”. Below is a list of the required api file
names that should be created for each supported language.
9
How to ...
As indicated, three common languages, HTML, SQL, and RC, are hard coded, eliminating the need for
an api file.
The api files are simple text files, which you can create with any text editor - including, of course your
favorite - Notepad++ :-) . You can find an example php.api file in the YOUR_NPP_DIR\plugins\APIs
directory . Note that the api list should be created in alphabetic order.
As of v2.7, Auto-Completion for User Defined Languages is supported. Just give the api file as your
defined language name. E.g., if your defined language name is "My Lang", create an api file named "My
Lang.api" in order to perform Auto-Completion operation.
Plugins
How to install a plugin
The plugin (in the DLL form) should be placed in the Notepad++\plugins directory. Once you
have installed the plugin, you may use and configure it via the Plugins menu.
To implement your plugin, just send the appropriate message to the appropriate handle.
• You can start your project from the NppPluginDemo project which is the basic skeleton ( VC++7
version [./files/NppPluginDemo.zip] and Dev-C++ & Code::Blocks version
[./files/NppPluginDemo.Dev-C++.zip] ).
10
How to ...
• A complete working project can be examined in NppInsertPlugin. This may give you a better idea
how it works ( VC++7 version [./files/NppInsertPlugin.zip] and Dev-C++ & Code::Blocks version
[./files/NppInsertPlugin.Dev-C++.zip] ).
Note that the Dev-C++ & Code::Blocks packages (contributed by Chris Severance) support the follow-
ing IDE/Compiler in both C and C++:
• Code::Blocks / MSVC++
The interface (header file) of plugins is written in C for both C and C++ programmers. If you translate
this interface into another development language, please contact the author. I'll include it in future re-
leases.
11
How to ...
Since some natural languages are not supported by Notepad++, the User Language Define System al-
lows the user to define his own. This includes syntax highlighting keywords, syntax folding keywords,
comment keywords, and operators.
12
How to ...
In this example, syntax highlighting and the syntax folding are applied to the userDefineLang.myl docu-
ment (on the left) as a result of the definition in the User Define Language dialog (on the right).
The global functionalities are for global operations: such as choosing / creating / renaming / removing a
user define language. The definition part is to define the folder symbols / keywords / comments symbols
/ operators for a chosen user define language.
13
How to ...
You can define keywords, folding blocks, and comments under the default User Define Language. In or-
der to take effect, you must define your current document as a User Define Language document by
clicking:
14
How to ...
However, all the definitions you make will be temporary under the User Define Language (ie. they will
disappear in the next session). If you want to keep your definitions, you must save them by clicking the
Save as... button. Once saved, you can use it or modify it further in future sessions.
You can also associate one file extension with your defined language - so every time you open the files
with this extension, the highlighting of your defined language will be applied on the document automat-
ically.
15
How to ...
Of course, you can rename your language, use it as a model (Save as...), or remove it.
The default style applies to all undefined styles (i.e. all undefined keywords).
The folder definition consists of two parts: the open folder definition and the close folder definition.
These work together as a pair.
16
How to ...
In the above figure, two blocks are defined by the keywords: "blockBegin", "blockEnd", "if", and "fi".
With the keywords defined, the User Define Language System is able to form the block(s) that the user
can fold or unfold. Notice that if you define several keywords in the open folder definition or in the
close folder definition, any of those close folder symbols will form a block with any preceding open
folder symbol. For instance, in the given example, either BlockEnd or fi may be used to close a block
starting with blockBegin.
17
How to ...
18
How to ...
Two types of comments can be defined in the User Define Language System - comment line and com-
ment block. In contrast to the other styles, the comment style applies the style not only to the defined
symbols, but also to the comment block or the comment line.
Operators Panel
There are two rules for the User Define Language System that must be kept in mind:
1. An elementary unit (token) is always terminated by white space, a TAB symbol ('\t'), a new line
symbols ('\n') or a user defined operator.
2. All the symbol characters are a part of the elementary unit (token), unless they are defined as oper-
ators.
With these two principles in mind, it is easy to understand the following example:
19
How to ...
The token "INTEGER" is recognized thanks to keyword definition (i.e. "INTEGER" is in the keywords
lists). If '(' were not defined as an operator, the second "INTEGER" would not be recognized, because
"(INTEGER" would be treated as a distinct unit (token) which is not in the keyword list.
Translation
You can teach Notepad++ to speak your mother tongue: Just download english.xml [./files/english.xml]
and translate it into your language.
Notes on translation:
• Any numbers not in the Attribute name (the Attribute id, order, posX and posY) should NOT be
changed.
• & in the Tag Menu is &. It is used to define accelerator keys. It displays an underline beneath
the following letter, and when the Alt key is pressed in combination with that letter, the correspond-
ing menu item is executed. It is up to the user to define its position on translated words, depending n
20
How to ...
• Do not remove the TAB character between the name to be translated and the shortcut, or change the
TAB to white space.
• Do not change the shortcuts (ex: Ctrl-C) even if they are not equivalent in your language.
• Make your translations as brief as possible. The controls in dialogs won't be resized dynamically.
Here is an example:
The translation of Paste in French is Coller, so the XML Tag Translation from English to French should
be from:
to:
Contact me (Don Ho in the author section), if you want your translation included in future releases.
Theme
Starting from version 2.4, user can customize the toolbar icons by using toolbarIcons.xml. The aim of
this xml file is to define the path where icons reside that you want to use instead of the default icons
offered by Notepad++. The toolbarsindex.xml file should be located in the %APPDATA%\Notepad++
directory in order to take effect.
21
How to ...
There are 20 items in the Notepad++ toolbar, so 20 icon tags are present in the toolbarIcons.xml file. As
shown, each Icon tag has its own name and its own id. The name is used as an identifier, in order that
you know which icon you're modifying. The id is the essential element for the program, so don't modify
this value.
To customize the toolbar icons, enter the path (1) where your icons are ;located, and the name of your
icons (2). If you leave these fields blank (3), the item will be ignored (ie. the default icons will remain in
force).
Each item contains at least two icons: the default (normal) icon and the hover icon. For some items,
there is a third "disabled" icon. However you could associate the same icon file with the normal icon, the
hovered icon and the disabled icon. In this case, there will be no change to the icon when it is disabled
or when the mouse hovers over it.
Don't forget to check the menu item "View->Tool Bar->Enlarge me". Otherwise you custom icon defini-
tions will not take effect.
Context Menu
The Notepad++ context menu is the menu that appears on a right click of the edit zone:
22
How to ...
23
How to ...
User can change the context menu by adding/ modifying the file
%APPDATA%\Notepad++\contextMenu.xml.
The rule is very simple: For the item that you wish to add, find its name (1) and corresponding id (2) in
the english.xml [./files/english.xml] file between the <Commands> and </Commands> tags Then add,
delete, or modify it in the contextMenu.xml file using the form <Item id="idToAdd">. Notice that an id
of 0 will insert a separtor in the context menu.
24
How to ...
English.xml preview
Syntax::
25
How to ...
Description:
• -multiInst: Notepad++ executes as a unique instance by default. This option allows you to launch
several instances of Notepad++.
• -l: This option applies the Language to the fullFilePathName to open. E.g.:
In this example, the file proj.vcproj will be opened as an xml file, even though its extension vcproj is
not recognized as an xml file extension. Valid languages include: c, cpp, java, cs, objc, rc, html,
javascript, php, vb, sql, xml, asp, perl, pascal, python, css, lua, batch, ini, nfo, tex, fortran, bash, ac-
tionscript, and nsis.
• -n: This option locvates the specified line number upon opening u want after opening. E.g.,
This will open the file Notepad_plus.cpp then scroll the view and place the cursor on line 150.
$(ENVIRONMENT_VARIABLE)
FOr example, say the current file you are editing in Notepad++ is:
E:\my Web\main\welcome.html
It is recommended that you surround the environment variable reference with double quotes in case your
pathname includes white space.
26
How to ...
• firefox "$(FULL_CURRENT_PATH)"
• iexplore "$(FULL_CURRENT_PATH)"
These two user commands are also included in npp.3.0.installer.exe (or later version), and can be
launched using Ctrl+Alt+Shit+X and Ctrl+Alt+Shit+I respectively.
27
Chapter 3. More Notepad++
Help Notepad++
To help defray the costs of Notepad++ development, you can make a donation via: ht-
tp://sourceforge.net/donate/index.php?group_id=95717.
Too much of a skinflint to make a donation? Not to worry. You can still contribute to Notepad++ project
in the following ways:
1. Translate the application to your native language. See the section called “Translation” .
2. Translate pages of the Notepad++ official webite to your native language. Click here
[./files/pagesToTranslate.zip] , or here
[http://notepad-plus.sourceforge.net/commun/misc/pagesToTranslate.zip] to download the pages to
translate.
3. Tell your friends, neighbors, spouse, clergyman, boss, co-workers, minions, government officials,
grand-mom or three year old son Chapter 1, About N++ Notepad++, and encourage them to down-
load and use it.
Downloads
Logos
28
More Notepad++
Plugins
Since the v3.1 release, Notepad++ has been able to be extended using a plugin system. Details of in-
stalling and developing plugins are in the the section called “Plugins” section.
Language Files
As of v2.3 Notepad++ supports the multilanguage functionality by means of a translated xml file (from
english.xml [./files/english.xml]). Normally you don't need the language file if you install Notepad++ by
its installer, but you may need it if you install it from zip format binary or if your language is not suppor-
ted by the NSIS installer.
2. Launch the Run Dialog by clicking Start->Run and type %APPDATA%\Notepad++ into the text
field of Run Dialog.
4. Launch Notepad++
29
More Notepad++
• German [./files/german.zip] by Dominik Geyer & Heinz Hemker & Meinrad Schwamborn
30
More Notepad++
Api Files
Notepad++ has supported auto-completion since v2.0. Please see the auto-completion HOWTO for com-
plete details.
5. If this is the first user defined language you are adding, copy/paste the entire file (which you down-
loaded) into userDefineLang.xml, replacing the entire contents. If this is not the first language be-
ing added, simply copy the entire downloaded file, from <UserLang...> through </UserLang> , and
paste it at the end of the userDefineLang.xml immediately before </NotepadPlus>
31
More Notepad++
Please see the section called “User Language Define System Manual” for complete details.
Theme Package
Requires v2.4 or later.
Installation:
3. Open toolbarIcon.xml which comes with this package in your favourite editor (Notepad++, of
course ;) ).
4. Replace
E:\Sources\Notepad++\PowerEditor\bin\newIcons\
with
C:\foo\
6. Type
%APPDATA%\Notepad++
into the text field of the Run dialog. A folder named Notepad++ will appear.
8. Close Notepad++ and re-launch it. You will now see the Crystal icon set instead of the default
icons.
Important: The "View->Tool Bar->Enlarge me" option must be checked in order to view the Crystal
theme.
32
More Notepad++
Below is an image of the Crystal Theme Package, a set of high quality icons created by Alican Toprak:
33
Chapter 4. Document creation
As I (Adrien Sales) found this tool very useful, and I think that an online help doc is useful, i decided to
donate time to Notepad++ by creating and offering this document to Notepad++. As you will probably
see, i've tried to reproduce the content of the official website
[http://notepad-plus.sourceforge.net/uk/site.htm]. For now it's in english (to make it readable by the
largest number of people), but if someone is interested in translating this doc in his own laguage, I'll
provide the sources used to build this document which has been created thanks to docbook stylesheets,
xalan, and of course Notepad++ ;-p.
I want to thank Matt Sicking and Georg Dembowski for having provided me new content to add to the
tutorial, making it more useful after each update (see Revision History).
34