Skip to content

naens/zwsh

Repository files navigation

zwsh — WordStar keybindings for zsh

Description

zwsh is a zsh mode that replaces the default line editor with WordStar/Zpm3-style keybindings. If you grew up with WordStar, Turbo Pascal, or Borland IDEs, you’ll feel right at home.

Features:

  • Classic WordStar cursor movement (^E~/~^X~/~^S~/~^D, words, lines, document)
  • Block select, copy, move, delete, write-to-file (^KB~/~^KK~/~^KC~/~^KV~/~^KY~/~^KW)
  • Multiline command editing with a built-in editor mode (^KE~/~^KS)
  • File import and export (^KR~/~^KX) with sudo support
  • Incremental history search (^QF, ^L repeat, ^W~/~^Z prefix search)
  • Paste from clipboard (^KC~/~^KV when no block selected)
  • Unerase last deleted text (^U)
  • Special folder shortcuts in prompt and on the command line
  • User configuration via ~/.zwrc

Requirements

  • Zsh 5.0 or later

Installation

git clone <repository-url> zwsh
cd zwsh
sudo ./zwshinst.sh

The installer copies files to /opt/zwsh and adds the startup line to ~/.zshrc. To update an existing installation:

sudo ./zwshupd.sh

To uninstall, remove the source line from ~/.zshrc and delete /opt/zwsh.

Quick start

Once installed, open a new terminal. You are now in WordStar mode.

Cursor movement

KeyAction
^Scharacter left
^Dcharacter right
^Eline up / history ↑
^Xline down / hist ↓
^Aword left
^Fword right
^QSbeginning of line
^QDend of line
^Rstart of document
^Cend of document

Delete keys

KeyAction
^Gdelete char right
^Hdelete char left
^Tdelete word right
^Ydelete entire line
^QYdelete to end of line
^Q^Hdelete to begin of line

Block operations

KeyAction
^KBmark block begin
^KKmark block end
^KCcopy block (or paste)
^KVmove block (or paste)
^KYdelete block
^KWwrite block to file
^KHhide/show block
^QBgo to block begin
^QKgo to block end

File operations

KeyAction
^KRimport text from file
^KSsave buffer to file + edit
^KXsave buffer to file
^KEopen file in editor mode
^KDexit editor, text → buffer
^KQquit zsh (with confirmation)

Search / History

KeyAction
^QFincremental history search
^Lrepeat last search
^Whistory search backward
^Zhistory search forward
^QRbeginning of history
^QCend of history

Editor mode

KeyAction
^Rpage up
^Cpage down
^Wscroll up one line
^Zscroll down one line
^QEgo to top of screen
^QXgo to bottom of screen
^QRgo to start of document
^QCgo to end of document
^KFtoggle fullscreen

Other keys

KeyAction
^Uunerase (paste last deleted text)
^Pinsert control character
^Vtoggle insert/overwrite mode
^Nsplit line (insert newline)
^Jhelp (run-help)
^Itab completion
^KMexecute buffer, result → buffer
Escsend break

Configuration

Create ~/.zwrc to define special folders and other settings. This file is sourced after zwsh loads.

typeset -A zw_special_folders
zw_special_folders[PROJ]=~/projects
zw_special_folders[DOC]=~/Documents
zw_special_folders[TMP]=/tmp

With these defined, you can type PROJ:subdir on the command line and it will expand to ~/projects/subdir. The prompt also shows the short folder name.

Sudo support

When opening a file with ^KE or ^KR that requires root access, zwsh will prompt for a sudo password and read/write via sudo.

Known limitations

  • Column block mode (^KN) is not yet implemented
  • Undo/redo is not available
  • Find/replace within the editor is not implemented
  • Tab characters in fullscreen editor are not properly handled

Documentation

Detailed module documentation is in the doc/ directory:

  • wskeys — key reference and binding scheme
  • wsblock — block operations
  • wsedit — editor mode
  • wsfind — find / history search
  • wsdialog — dialog framework
  • wsline — single-line input
  • wstext — text variable abstraction
  • wstxtfun — pure text navigation functions

License

GPLv3 — see LICENSE.

About

A Zpm3/Wordstar mode/theme for zsh

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages