6. Snippets in Notepad - AlSchemist/GimpLambdaLib GitHub Wiki
A snippet is a piece of source code designed to input more easily a program: it is the call of a function with its parameters that must be replaced.
Before browsing the Gimp lambda library from the Notepad++ text editor, let’s install the free GNU-licensed Snippets
plugin powered by Frank.
The Snippets plugin displays in Notepad++ a new window on the right offering the list of keywords or functions of a language according to the edited source code.
🟩 Notepad++ plugin manager
Notepad++ menu Plugins
> Plugins Admin...
@ffes NppSnippets:
🟩 Selection of Snippets 1.7 then installation
In the first Available
tab of the Notepad++ plugin manager, scroll and check ✔️ Snippets 1.7
📀 Download Notepad++ zipped snippets 66 Kb containing PDB’s and GimpλLib’s snippets SQLite databases.
Once NotePadPlus.zip
is downloaded, unzip the zipped archive with 7-zip
> Extract to NotePadPlus
or directly the Windows File Manager:
In the Windows File Manager, you should retrieve two .sqlite files.
🟩 Gimp Lambda Library snippets in an SQLite database
🟩 Import snippets from GimpλLib and the Procedure DataBase of Gimp
In Notepad++:
- Right click on the default library above for example
ANSI-characters
underSnippets
on the right. - Click contextual menu
Import Library…
- Select
GimpLambdaLib\NotepadPlus\GimpScript-Fu-PDB.sqlite
where you have unzipped GimpLambdaLib.zip
=> this SQLite database contains 1069 snippets. - Click Open button to load GimpScript-Fu-PDB.sqlite
- Click Import button
- Repeat the same procedure to import the 618 snippets from
GimpλLib.sqlite
In Notepad++, click New
to create an empty source code.
🟩 Create empty text in (S)cheme language
Notepad++ menu Language
> S
> Scheme
indicates that it is a TinyScheme source code also called Script-Fu.
🟩 Using Gimp λLib and PDB snippets
- In the GimpScript-Fu PDB snippets, scroll and double-click on
gimp-version
=> This Gimp function is displayed between parenthesis as the first line of the source code. - Press ENTER at the end of line 1 to create the second line, which is still empty.
- Change snippets by selecting
GimpλLib
snippets on the right. - Scroll and double-click on the function
show
=>(show firstPrm lstOtherPrm)
is displayed in the second line of the source code. - Double-click firstPrm to replace the 1st parameter with the string of characters
"pi: "
- Double-click lstOtherPrm to replace the second parameter with the constant
*pi*
The new code source in Notepad++ should be populated with the two following calls of functions:
(gimp-version) ; function of the PDB
(show "pi: " *pi*) ; function of the GimpλLib
After selecting line 1 or 2 or both, copy the line to the clipboard by Ctrl+C in Windows.
Paste by Ctrl+V in the input area of the Script-Fu console.
Validate with the Enter key to read the result.
Traditionally, reading the PDB is done by clicking the Browse button from the Script-Fu console in particular for details on the parameters of call and the expected return.
Snippets of GimpScript Fu-PDB.sqlite from Notepad++ are equivalent to the PDB in the Script-Fu console. Only deprecated functions have been removed.
In summary, the developer can scroll in the Snippets window to find a function of the GimpλLib and its calling parameters.