Table of Contents

Interface INotepadPPGateway

Namespace
Npp.DotNet.Plugin
Assembly
Npp.DotNet.Plugin.dll
public interface INotepadPPGateway

Methods

AddToolbarIcon(int, ToolbarIcon)

[Obsolete("Use AddToolbarIcon(System.Int32, Npp.DotNet.Plugin.ToolbarIconDarkMode) instead")]
void AddToolbarIcon(int funcItemsIndex, ToolbarIcon icon)

Parameters

funcItemsIndex int
icon ToolbarIcon

AddToolbarIcon(int, ToolbarIconDarkMode)

void AddToolbarIcon(int funcItemsIndex, ToolbarIconDarkMode icon)

Parameters

funcItemsIndex int
icon ToolbarIconDarkMode

AddToolbarIcon(int, Bitmap)

[Obsolete("Use AddToolbarIcon(System.Int32, Npp.DotNet.Plugin.ToolbarIconDarkMode) instead")]
void AddToolbarIcon(int funcItemsIndex, Bitmap icon)

Parameters

funcItemsIndex int
icon Bitmap

DefaultModificationFlagsChanged()

Returns true if the active SCN_MODIFIED event mask has been changed from NPP_DEFAULT_SC_MOD_MASK.

bool DefaultModificationFlagsChanged()

Returns

bool

Remarks

Added in 8.7.7

FileNew()

void FileNew()

GetConfigDirectory()

Figure out default N++ config file path
Path is usually %UserProfile%\AppData\Roaming\Notepad++\plugins\config

string GetConfigDirectory()

Returns

string

GetCurrentFilePath()

Gets the path of the current document.

string GetCurrentFilePath()

Returns

string

GetCurrentLine()

Gets the text of the currently active line.

string GetCurrentLine()

Returns

string

The text of the active line.

GetCurrentWord()

Gets the word currently under the caret.

string GetCurrentWord()

Returns

string

The word under the caret.

GetFilePath(UIntPtr)

Gets the path of the current document.

string GetFilePath(UIntPtr bufferId)

Parameters

bufferId UIntPtr

Returns

string

GetNativeLanguage()

Get the name of the active localization file.

string GetNativeLanguage()

Returns

string

N++ 8.7 and later

The name of the active localization file, without the .xml extension.

Older versions

"english"

GetNppPath()

string GetNppPath()

Returns

string

The path to the Notepad++ executable.

GetNppVersion()

(int, int, int) GetNppVersion()

Returns

(int, int, int)

3-int tuple: (major, minor, bugfix)
Thus GetNppVersion() would return (8, 5, 0) for version 8.5.0 and (7, 7, 1) for version 7.7.1

GetOpenFileNames()

string[] GetOpenFileNames()

Returns

string[]

GetPluginConfigPath()

string GetPluginConfigPath()

Returns

string

The path to the Config folder for plugins.

GetPluginsHomePath()

string GetPluginsHomePath()

Returns

string

The path to the top directory of all installed plugins.

GetSessionFilePath()

string GetSessionFilePath()

Returns

string

IsDarkModeEnabled()

Checks the return value of the NPPM_ISDARKMODEENABLED message.

bool IsDarkModeEnabled()

Returns

bool

true if NPPM_ISDARKMODEENABLED returns 1, otherwise false.

Remarks

Added in 8.4.1

OpenFile(string)

Open a file for editing in Notepad++, pretty much like using the app's File - Open menu.

bool OpenFile(string path)

Parameters

path string

The path to the file to open.

Returns

bool

true on success, otherwise false.

SaveCurrentFile()

Open a standard save file dialog to save the current file.

bool SaveCurrentFile()

Returns

bool

true if the file was saved, otherwise false.

SetCurrentLanguage(LangType)

void SetCurrentLanguage(LangType language)

Parameters

language LangType

SetModificationFlags(ModificationFlags)

Sends NPPM_ADDSCNMODIFIEDFLAGS with the given flags.

void SetModificationFlags(ModificationFlags flags)

Parameters

flags ModificationFlags

The additional ModificationFlags to monitor.

Remarks

Added in 8.7.7

SetStatusBarSection(string, StatusBarSection)

The status bar is the bar at the bottom with the document type, EOL type, current position, line, etc.
Set the message for one of the sections of that bar.

void SetStatusBarSection(string message, StatusBarSection section)

Parameters

message string

Text to display.

section StatusBarSection

A StatusBarSection value.