Simple vim-like editor
date: 2025-11-29 13:37:51
categories: programming
firstPublishDate: 2025-11-29 13:37:51
I have a TUI widget library with a basic editbox which similar to the basic editbox in the web browsers. This editbox widget is used in my `ink` markdown editor.
Lately I thought I want something more advanced than a simple editbox and I created the `viBox` widget and the `vink` markdown editor. This `viBox` widget is vim-like and I didn't implement registers, scripting and many other things.
`vink` is built and installed with my `sheepy` build system:
spm -g install vink
Sheepy is a build system for using C as a scripting language like python. Install `sheepy` with these commands:
apt-get install gcc git git clone https://spartatek.se/git/sheepy.git cd sheepy sudo -H ./install.sh
In my ssh kiosk, I have a chat program and it is updated to use the `viBox` instead of the `edtiBox`.
Connect to the ssh kiosk like this:
ssh kiosk@apps.noulin.net yes
The vim commands implemented in `viBox` are:
esc - cancel or switch to command mode or deselect widget
enter - switch to command mode
insert - switch to command mode
del - delete character in insert and command mode
backspace - move left in command mode, delete left character in insert mode
x - delete character in command mode
ctrl+w - delete word (insert mode)
ctrl+n - search forward completion (insert mode)
ctrl+o - search backward completion (insert mode)
ctrl+r - redo
ctrl+u - page up
ctrl+d - page down
^ - home
$ - end
m* - m+any key create a mark (command mode)
'* - '+any key go to mark (command mode)
'' - last insert position
i - insert mode
I - insert at line start
a - insert right
A - insert at line end
C - clear end of line and switch to insert mode
o - create a new line and insert
O - create a new line before current line and insert
* - search word under cursor
z - cancel search
n - next match
N - previous match
/ - search forward input in search field
? - search backward input in search field
v - switch to visual mode
V - switch to visual line mode
g - go to first line
G - to to last line
h - left
j - down
k - up
l - right
w - move to next word start
W - move to next word start
e - move to next word end
E - move to next word end
b - move to previous word start
B - move to previous word start
p - paste
P - paste on previous position
{ - move to previous empty line
} - move to next empty line
D - delete line
dd - delete line
dw - delete word
u - undo
q - deselect widget (command mode)
x - cut selection (visual mode)
y - yank selection (visual mode)
d - delete selection (visual mode)
> - (indent) shift right 2 spaces selection (visual mode)
< - (indent) shift left 2 spaces selection (visual mode)
Completion box ctrl+n - next match
Completion box ctrl+o - previous match
Completion box esc - cancel completion
Completion box other keys - cancel completion
Completion box enter - replace with selected match
Completion box space - replace with selected match