Although one could edit ot-snippet-002.sh to customized snippets, its prefered to export current definitions to a custom file and edit snippets there. A custom file contains only snippet definitions and optional additional/private variable definitions (helpers for repeated patterns).
You are in no way forced to use any premade snippets, just empty the custom file and add your own snippets as needed.
On startup ot-snippet checks if there exists a ot-snippet*.txt custom file and loads it.
The snippet definitions of the custom file replace the internal snippet definitions (which are simply not defined in that case); this avoids having to touch ot-snippet itself to deactivate/comment or delete snippet definitions there.
Create a custom file
Use the ot-snippet --new-custom option to create an initial custom file. The custom file will contain an excerpt of all active snippet definitions. It will be named like the name/symbolic-link being used to run ot-snippet and saved at the same location; see symbolic links - custom file for details.
Assuming a default setup for ot-snippet-002.sh - according custom files are named like:
|src used||custom file||mode|
To create a custom file for the stream mode variant you just run:
ot-snippet V. 002#199 2022-01-25 custom = /home/demo/bin/ot-snippet-strm.txt created new custom-file press Shift+PgUp to scroll back press RETURN to close window
Custom file and updates
If you are already using a custom file, you just have to rename it, to match expected V002 custom file names - see above: create custom file - table
As the --new-custom option is available since ot-snippet V001#066 and the supported snippet format is identical, you can keep your previous edits with ot-snippet V002 :
ot-snippet V. 001#66 2019-12-05 custom = /home/demo/bin/ot-snippet.txt created new custom-file press Shift+PgUp to scroll back press RETURN to close window
... to export your V001 edits and rename the created V001 custom-file to match with ot-snippet V002 expected custom file names (see above).
mv ~/bin/ot-snippet.txt ~/bin/ot-snippet-strm.txt
If you are using an older ot-snippet version (not supporting the export feature), or the export feature isn't working for any reason, one can extract snippet definitions manually.
There are two comments defined within ot-snippet.sh (V001) and ot-snippet-002.sh (V002) to mark the begin and end of the relevant custom section:
# ========================================== # for a custom snippet-file >>>>>>>>>>>>>>>> # START COPY HERE
# END COPY HERE # for a custom snippet-file <<<<<<<<<<<<<<<<
A custom file should only contain text from within this section.
To stick with your own snippets entirely, you just create an empty text file, matching the expected naming convention and add snippets; see: create custom file - table
Don'ts - warning
Do not try to just rename V001 ot-snippet.sh and use it instead of a custom file. You are breaking V002 functionality this way.
Background: the custom file is sourced by ot-snippet to make snippet keys (variables), internal snippet variables and snippet helper functions accessible; as an unwanted side effect this reads (old) V001 internal function definitions too, thus replacing/breaking V002 functionality.