Skip to content

lee2sman/yvi

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

yvi

This is a fairly minimal Vi-like text editor built in Yabasic (Yet Another Basic).

yvi is the binary compiled along with Yabasic.

Install

  1. Download yvi
  2. Make executable chmod +x yvi
  3. and place in your system path. For example: mv yvi /usr/local/bin/

Alternatively, download vi.bas or clone the git repo and run. Requires Yabasic.

yabasic vi.bas

Screenshot

yvi text editor

Notes:

This is a minimal vi clone in a few hundred lines of BASIC! It is not full-featured by any means! If you need more functionality, try Busybox Vi :) Or implement your own features.

Files can be opened via command line argument.

yvi file.txt

Lines longer than 80 chars have their display clipped. The status bar shows C:N so you can see your true column position.

WARNING: Resizing your terminal will likely cause errors/forced exit! And no error handling is built-in.

Be sure to save your work often!

u is limited to a single level of undo - one step back. It undoes the last insert session or last deletion.

rem vi.bas -- tiny Vi-like editor in yabasic
rem ==========================================
rem Normal mode keys:
rem   h/j/k/l      move left/down/up/right
rem   i            insert before cursor
rem   a            append after cursor
rem   o            open new line below, enter insert mode
rem   O            open new line above, enter insert mode
rem   yy           yank current line to buffer
rem   p            paste copied line below current line
rem   x            delete character under cursor
rem   r            replace character under cursor
rem   d            delete + direction (add w, e, b, 0, $, gg, G)
rem   dd           delete current line
rem   c            cut + direction (add w, e, b)
rem   S            delete line and switch to insert
rem   w            jump to next word
rem   e            jump to end of word
rem   b            jump back to most recent beginning of word
rem   0            jump to start of line
rem   $            jump to end of line
rem   gg           jump to first line
rem   G            jump to last line
rem   <number>     number of times to execute following key
rem   :            enter command mode
rem   /word<ENTER> search for 1st instance of word
rem   n            find next
rem Command mode (:)
rem   :w           save file
rem   :w filename  save to new filename
rem   :q           quit (refuses if unsaved changes)
rem   :q!          quit without saving
rem   :wq          save and quit
rem   :<line_num>  jump to line number
rem Insert mode:
rem   type normally to insert text
rem   backspace    delete character to left
rem   enter        split line at cursor
rem   esc          return to normal mode
rem ==========================================
rem Display: lines longer than 80 chars are clipped at the right edge.
rem The status bar shows C:N so you can see your true column position.

About

A minimal implementation of Vi in BASIC (YaBasic dialect)

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Contributors