You can use echo()
in moe. But, need to exit ncurses before echo()
.
Exit using exitUi()
or ncurses.endwin()
.
And, ncurses UI is auto restart when printing ncurses UI (You don't need to execute startUI()
).
Example
proc initEditor(): EditorStatus =
let parsedList = parseCommandLineOption(commandLineParams())
defer: exitUi()
startUi()
##### Important! #####
exitUi()
echo "debug"
result = initEditorStatus()
result.loadConfigurationFile
result.timeConfFileLastReloaded = now()
result.changeTheme
Please use :! or quit moe to check the output.
You can use the logger.
Log files are written to the temp dir (/tmp/moe/logs
).
You have to import srd/logger
.
Example
import std/[os, times, logging]
import moepkg/[ui, bufferstatus, editorstatus, cmdlineoption, mainloop]
##### Important #####
import std/logging
.
.
.
proc initEditor(): EditorStatus =
let parsedList = parseCommandLineOption(commandLineParams())
defer: exitUi()
startUi()
##### Important! #####
debug "debug"
result = initEditorStatus()
result.loadConfigurationFile
result.timeConfFileLastReloaded = now()
result.changeTheme
cat /tmp/moe/logs/2023-10-24T05:42:17+09:00/moe.log
DEBUG debug
You can use the log in moe. This is not written to a file.
Example
proc normalMode*(status: var EditorStatus) =
if not status.settings.disableChangeCursor:
changeCursorType(status.settings.normalModeCursor)
##### Write to log #####
status.messageLog.add(($status.settings.normalModeCursor).toRunes)
You can check log in Log viewer (:log
command).
moe is build in Debug mode. Debug mode can be start with :debug
command.
When moe start, Start ncurses. Next, Initialize settings and load the configuration file if existing. And load the text file if got an argument. At last, Starting editor main loop.
Editor main loops for main window and command line window.
Editor initializing, add a buffer, update highlighting and create, remove, resize and update view and window, etc...
Update and move editor view.
Control the terminal (console).
Define BufferStatus, Mode and SelectArea.
Implementation of Gap buffer.
Many editor movement procs (Ex. move right, move to the end of the line, move to the next word, etc...). theses procs are used in many modes.
Many procs for editing text (Ex. Insert/delete characters, undo/redo, delete a word, etc...).
Define EditorSettings, load and validate the configuration file.
Define Color, EditorColorPair, Theme.
Create syntax highlighting in some languages.
Utils for files.
Extend unicode module of Nim.
Messages displayed in the command line window.
Management of the main window node.
Write Tab line.
Main module for the Normal mode.
Main module for the insert mode.
Main module for the Ex (command line) mode.
Help in moe (:help
command).
A sentence for the help.
Main module for Visual and Visual block modes.
undo/redo utils
Suggestion (pop-up) window for general auto-complete in insert mode.
Make dictonaly for general auto-complete in insert mode.
Write Status line
Search utils for normal mode.
Main module for the QuickRun mode.
Main module for the replace mode.
Main module for the log mode (Log viewer).
The log mode can be started with :log
command.
Main module for the backup mode (Backup manger).
Backup manger is the manager of the auto-backup files.
The backup mode can be started with :backup
command.
Main module for the diff mode. Diff mode can start in History mode. And, it shows the difference between the backup file and the current buffer.
Main module for the recent mode.
Recent mode is can select recently opened files.
This mode is GNU/Linux only supported.
The configuration mode can be started with :recent
command.
Update syntax highlighting.
Main module for the filer mode.
Tools for the filer mode.
Main module for the debug mode.
Tools for the debug mode.
Update cursor position.
Main module for the configuration mode.
The configuration mode can be started with :conf
command.
Parse command line arguments and write help in command line.
Implementation of Build on save.
Tools for the command line (window).
Helper for the command line (window).
Implementation of Automatic backups.
Main module for the buffer mode (Buffer manager).
The buffer mode can be started with :buf
command.
Definition of the registers and utils for the register.
Utils for the clipboard.
Check and definition the platform.
Popup window.
Highlighting tools for buffers. (Current words, search results, etc...)
Utils for log messages displayed on the command line.