SANDY(1)

NAME
sandy - simple ncurses text editor

SYNOPSIS
sandy [-adhruS] [-t tabstop] [-s syntax] [file|-]

DESCRIPTION
sandy is a simple modeless ncurses text editor. It loads and saves files and lets you perform basic editing and pipe the selection through arbitrary commands. A small degree of external control can be achieved by writing to a named pipe. Sandy can also capture text from the standard input and edit it instead of a file as well as dump the buffer to the standard output instead of writing it to a file.

OPTIONS

-a  Autoindents text while editing.

-d  Dumps to stdout instead of writing to a file; causes saving to exit immediately.

-h  Prints usage information to stderr, then exits.

-r  Opens the selected file read-only.

-s syntax
    Manually choose the syntax colors.

-S  Use no syntax colors at all.

-t tabstop
    Use selected tabstop in characters.

-v  Prints version information to stderr, then exits.

USAGE
The default key-bindings try to stick to the "emacs-mode" present in modern shells (specifically mksh(1)), which actually differs a bit from what emacs(1) does. Text is selected manually with the mouse or keyboard, or automtically when you search, pipe, undo or enter new text. External input is handled using dmenu(1) if the DISPLAY environment variable is set, read using sh(1) otherwise. Similarly, X11 clipboard interaction occurs through xsel(1) if DISPLAY is set, using a hidden file in the /tmp directory otherwise.

  Cursor movement
Cursor movement bindings are used to move the text insertion point and optionally to select text. Special keys (such as arrows, Home/End, Prev/Next) move the cursor and cancel any selection; they can be used to browse the text. Control or Meta keybindings extend or shrink the selection by moving the end at the insertion point; they are useful to perform minor changes without taking your fingers off the home row. Remember to cancel the selection with Ctrl-g before moving to select a new piece of text.

Ctrl-f or Right
    Move cursor to next char.

Ctrl-b or Left
    Move cursor to previous char.

Ctrl-n or Down
    Move cursor to next line.

Ctrl-p or Up
    Move cursor to previous line.

Meta-f or Shift-Right
    Move cursor to the end of this or next word.

Meta-b or Shift-Left
    Move cursor to the start of this or previous word.

Ctrl-a or Home
    Move cursor to the beginning of the current line.

Ctrl-e or End
    Move cursor to the end of the current line.

Ctrl-v or Prev
    Move cursor one full screen up.

Meta-v or Next
    Move cursor one full screen down.

Meta-, or Shift-Home
    Move cursor to the beginning of the file.

Meta-. or Shift-End
    Move cursor to the end of the file.

Ctrl-Space or Ctrl-`
    Set mark in current position, then go to mark.

Meta-Space or Meta-`
    Manually set mark in current position.

  Finding and selecting
Text is searched (and selected) using POSIX regular expressions. Every time your search matches anything, the mark is set to your previous position so you can return there easily with Ctrl-space.

Ctrl-s
    Prompt for a search regex forward or if there is a selection, repeat search forward.

Meta-s
    Repeat search forward.

Ctrl-r
    Prompt for a search regex backwards or if there is a selection, repeat search backwards.

Meta-r
    Repeat search backwards.

Ctrl-]
    Extend selection to word, line or full file from current.

Ctrl-g
    Cancel current selection.

Ctrl-o
    Move to the opposite size of the selection, usually to modify it.

  Deleting
Unlike in most other text editors, inserting text while a selection is active does not delete its content.

Ctrl-d
    Kill the current selection and put it in the clipboard. If there is no selection, delete next character.

Delete or Shift-Delete
    Delete the current selection if any. Otherwise delete next character.

Backspace
    Delete previous character.

Ctrl-u
    Delete to beginning of line or join with previous line.

Ctrl-k
    Delete to end of line or join with next line.

Ctrl-w
    Delete to beginning of word or previous word.

Meta-d
    Delete to end of word or next word.

  File operations

Ctrl-c
    Quit if the file has not been modified. Repeat to quit unconditionally.

Ctrl-x
    Quit if the file is not modified. Otherwise write changes to disk.

  Text operations
These operations affect the selected text if any.

Ctrl-\
    Prompt for a command to pipe text through.

Meta-\
    Prompt for a sed command to pipe text through.

Meta-5
    Prompt for a literal string to replace the text.

Meta-6
    Delete newline characters, joining lines.

Meta-c
    Capitalize selection.

Meta-l
    Lowercase selection.

Meta-u
    Uppercase selection.

Ctrl-y or Shift-Insert
    Add (paste, yank) text from the clipboard.

Ctrl-t or Insert
    Copy to the clipboard.

(Again)Ctrl-d or Shift-Delete
    If there is any selection, cut to the clipboard.

  Other

Ctrl-l
    Center screen in current line, refresh.

Ctrl-q
    Insert next character as-is. This is modal and sucks, but there simply was no other way.

Ctrl-_
    Undo the last action.

Ctrl-^
    Redo or repeat the previous action.

Ctrl-z
    Suspend editor to shell.

Meta-x or Ctrl-[ or Esc
    Prompt for command.

SEE ALSO
dmenu(1), xsel(1)

BUGS
Please report them!