📄 nppexec_techinfo.txt
字号:
****************************************************************************
* NppExec plugin ver. 0.2 for Notepad++ 4.3 (and above)
* by DV, December 2006 - February 2008
****************************************************************************
***************************
* Technical Information *
***************************
NppExec has advanced "hidden" settings which can be set manually.
You need to edit NppExec's ini-file: "\Plugins\Config\NppExec.ini".
--------------------------------------------------------------
| KEY | DEFAULT VALUE | TYPE |
|--------------------------------------------------------------|
| | | |
| [Console] | | |
| ChildProcess_StartupTimeout_ms | 240 | int |
| ChildProcess_CycleTimeout_ms | 120 | int |
| Path_AutoDblQuotes | 0 (FALSE) | BOOL |
| CmdHistory_MaxItems | 256 | int |
| Exec_MaxCount | 100 | int |
| RichEdit_MaxTextLength | 4194304 (4 MB) | int |
| CommentDelimiter | // | string |
| Visible | 0 (FALSE) | BOOL |
| NoEmptyVars | 1 (TRUE) | BOOL |
| SaveCmdHistory | 1 (TRUE) | BOOL |
| | | |
| [Options] | | |
| HotKey | F6 | string |
| ToolbarBtn | 1 | int |
| WatchScriptFile | 1 (TRUE) | BOOL |
| | | |
--------------------------------------------------------------
The purpose of each key is described below.
You can add specified keys to [Console] or [Options] section of
this ini-file.
For example, you can modify it in the following way:
[Options]
HotKey=F6
ToolbarBtn=1
WatchScriptFile=1
[Console]
Visible=0
OEM=1
CmdHistory=1
ChildProcess_StartupTimeout_ms=240
ChildProcess_CycleTimeout_ms=120
Path_AutoDblQuotes=0
CmdHistory_MaxItems=256
Exec_MaxCount=100
RichEdit_MaxTextLength=4194304
CommentDelimiter=//
NoEmptyVars=1
SaveCmdHistory=1
ChildProcess_StartupTimeout_ms
------------------------------
This parameter is important when a child console process is created.
The child process usually can't be created immediately, therefore
we must give some time to this process to be started.
Here is a general implementation of this part of code:
if ( CreateProcess( ... , &ProcInfo ) )
{
CloseHandle( ProcInfo.hThread );
WaitForSingleObject( ProcInfo.hProcess, STARTUP_TIMEOUT );
...
}
When the process is started, WaitForSingleObject returns.
But, if the value of STARTUP_TIMEOUT is too low, WaitForSingleObject
may return before the process is started.
If default value of ChildProcess_StartupTimeout_ms is not enough for
your PC, you can increase it. IMHO, it can not exceed 400 ms.
ChildProcess_CycleTimeout_ms
----------------------------
The only purpose of this parameter is to decrease the CPU usage.
The bigger value you set, the less CPU usage you get :-)
Here is an implementation of this part of code in outline:
do {
// reading from the process'es pipe
...
} while ( WaitForSingleObject( ProcInfo.hProcess,
CYCLE_TIMEOUT ) == WAIT_TIMEOUT );
Don't forget that actually the value of ChildProcess_CycleTimeout_ms
is a pause between requests to the child console process'es output,
so values > 500 ms are not recommened.
Path_AutoDblQuotes
------------------
If you enable this option (set it to 1), then path to executable
which contains spaces (for example, "my program 1.exe") will be
automatically enclosed in quotes "".
It is disabled by default because of a bug with executables w/o
extension. For example, this line
cmd /c calc.exe
will be modified (if this option is enabled) to this one:
"cmd /c calc.exe"
because "cmd" is given without extension ".exe".
Therefore don't forget to enclose paths with spaces in quotes
manually, when this option is disabled.
CmdHistory_MaxItems
-------------------
Specifies maximum number of items in the console commands history.
Exec_MaxCount
-------------
Specifies maximum number of NPP_EXEC calls within one script.
This value is needed to prevent the infinite loop of several scripts
which call each other, e.g.
::script1
npp_exec script2
::script2
npp_exec script1
RichEdit_MaxTextLength
----------------------
Specifies maximum number of characters which can be stored or
pasted into the Console dialog's rich edit control.
CommentDelimiter
----------------
Specifies a comment delimiter :-) I.e. all characters after
this delimiter are understood as a comment, and the text line
(command) is truncated at the position of this delimiter.
Exception:
- when the comment delimiter is // then :// is not truncated
at the position of // (because :// can be a part of http://).
Note:
- if you specify empty comment delimiter i.e.
CommentDelimiter=
then you can not use comments in your commands/scripts because
there is no comment delimiter in this case.
Visible
-------
If you enable this option (set it to 1), then the Console window
will be visible when Notepad++ starts. Otherwise, when this option
is set to 0 (default value), there will be no Console window opened
when Notepad++ starts.
NoEmptyVars
-----------
When this option is enabled (set to 1), then all unset variables
such as "$(var)" will be replaced with "" (empty string).
If this option is disabled (set to 0), then unset variable "$(var)"
will not be replaced with empty string i.e. it will remain "$(var)".
SaveCmdHistory
--------------
When this option is enabled (set to 1) and "Console Commands History"
is checked, then the console commands history is saved to file
"npec_cmdhistory.txt" when Notepad++ exits. And the commands history
is restored from this file when Notepad++ starts.
If this option is disabled (set to 0), then the console commands
history is not saved and restored.
HotKey
------
Specifies the plugin hotkey which calls the "Execute..." dialog.
Available values are: F1, F2, F3 ... F12.
ToolbarBtn
----------
ToolbarBtn = 0 - no toolbar button;
ToolbarBtn = 1 - the toolbar button shows the Console window;
ToolbarBtn = 2 - the toolbar button calls the "Execute..." dialog.
ToolbarBtn = 3 - the toolbar button directly executes last script.
WatchScriptFile
---------------
When this option is enabled (set to 1), the plugin rereads the file
with saved scripts if its time stamp has been changed. The plugin
checks the file time stamp when you call the "Execute..." dialog.
If this option is disabled (set to 0), the plugin does not check
the file time stamp and does not reread this file.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -