DarkMatter in Cyberspace
  • Home
  • Categories
  • Tags
  • Archives

moe Notes


moe is vim written in nim.

Code analysis

Functions in procedure startUi (in file src/moepkg/ui.nim), such as initscr, cbreak, etc are mainly defined in ncurses.nim from library nim-ncurses. This dependency is defined in file moe.nimble.

Goto Definition

Install neovim plugin "alaviss/nim.nvim", then use gd to go to definition of a function.

Rune

Rune is a Type that can hold a single Unicode code point.

Debugging

# in terminal #1:
sudo apt install gdbserver
nim c --debugger:native src/moe.nim  # compile binary in folder 'src'
gdbserver :12345 src/moe
# in terminal #2:
gdb src/moe
(gdb) target remote localhost:12345

Now you can use (interact with application) moe in terminal #1, debug (set breakpoint, step, print variable ...) moe in #2.

Or in terminal #2:

cat << EOF > debug.gdb
target remote localhost:12345
b src/moe.nim:35
b src/moepkg/editorstatus.nim:49
b src/moepkg/normalmode.nim:205
b src/moepkg/normalmode.nim:427
EOF

gdb -x debug.gdb
(gdb) c


Published

Feb 4, 2021

Last Updated

Feb 15, 2021

Category

Tech

Tags

  • editor 6
  • moe 1
  • terminal 8

Contact

  • Powered by Pelican. Theme: Elegant by Talha Mansoor