Skip to content
Snippets Groups Projects
help.txt 4.26 KiB
Newer Older
Ticki's avatar
Ticki committed
Sodium: A modern editor for the Redox OS
========================================
Ticki's avatar
Ticki committed
by Ticki et al.
Ticki's avatar
Ticki committed

Sodium is a editor inspired by a various
console based, keyboard-centric editor.
The keybindings are loosly based on Vim.

This is a small guide for using Sodium.

Sodium consists of three different types
of command sets.

1) Global commands. These are possible to
   use anywhere, in any mode.
2) Mode-specific commands. These are
   specific to a given mode.
3) Namespaces. Commands that can be
   invoked as input (after) certain
   commands.

The modes are of two types:
- Command mode: In command mode a command
  can be preceeded by a numeral. This
  numeral is called a parameter, and can
  mean various things for the command.
- Primitive mode: In this type of mode
  the keys are given directly to the
  handler without any form of parsing.

Global commands
---------------

- [alt][space]: Go to the next cursor.
- [alt]<motion>: Move a given motion.
- [shift][space]: Go back to normal mode.

Modes
-----

# Normal

This is the default mode. Normal mode
provides various commands. Normal mode
is intended for doing commands which
are often invoked and commands used to
change modes.

The following commands are valid in
normal mode:

Ticki's avatar
Ticki committed
NOTE: <numeral> means repeat command
      <numeral> times, unless otherwise
      stated.
Ticki's avatar
Ticki committed
Basic motion:
- <numeral>h : Go right
- <numeral>j : Go down
- <numeral>k : Go up
- <numeral>l : Go left
- <numeral>J : Go 15 down
- <numeral>K : Go 15 up
- <numeral>H : Go to the start of
               the line
- <numeral>L : Go to the end of the
               line
Ticki's avatar
Ticki committed
Navigation:
- <numeral>g : Go to <numeral> line
- g<motion> : Do <motion>
- G : Go to the end of the document
- <numeral>t<char> : Go to the next occurence
                     of <char>
- <numeral>f<char> : Go to the previous occurence
                     of <char>
Ticki's avatar
Ticki committed

Scrolling:
- z<motion> : Scroll <motion>
- <numeral>z : Scroll to line <numeral>
- Z : Scroll to cursor

Ticki's avatar
Ticki committed
Cursor management:
- b : Branch the cursor
- B : Delete the current cursor
Ticki's avatar
Ticki committed
- [space] : Go to the next cursor
Ticki's avatar
Ticki committed

Editing:
- i : Go to insert mode
Ticki's avatar
Ticki committed
- a : Go to insert (append) mode
Ticki's avatar
Ticki committed
- r<char> : Replace the current char
            with <char>
- R : Go to replace mode
- x : Delete char
- X : Backspace char
- d<motion> : Delete a given selection
              (given by <motion>)
- o : Insert a new line
Ticki's avatar
Ticki committed
- ~ : Switch the character under the cursor
      with its counterpart (if it has one).
      For example a -> A
                  ( -> )
                  / -> \
Ticki's avatar
Ticki committed
- ; : Go to prompt mode
- . : Repeat the previous command
Ticki's avatar
Ticki committed

Ticki's avatar
Ticki committed
# Insert

Insert text before the cursor.

# Replace

Replace the text under the cursor.

# Prompt

Prompt mode is a mode where you can
invoke commands like in Vi(m). In this
mode you can for example set/unset options.

Following commands are valid:

- set <option> : Set <option>
- unset <option> : Unset <option>
- toggle <option> : Toggle <option>
Ticki's avatar
Ticki committed
- get <option> : Get the state of <option>
Ticki's avatar
Ticki committed
- o <filename> : Open <filename>
- help : Open this guide.
Ticki's avatar
Ticki committed
- w <filename> : Write the buffer to <filename>
- q : Quit Sodium.
Ticki's avatar
Ticki committed

Following option exists:

- highlight or hl : Highlight the text
                    (useful for coding)
  default: on
- autoindent or ai : Automatically indent
                     newlines.
  default: on
- line_marker or lm : Slightly dim the
                      background of the
                      current line
  default: on
Ticki's avatar
Ticki committed

To leave prompt press enter and the command
will be invoked. To leave the prompt without
invoking the command use the usual
shift-space command.

Namespaces
----------

A namespace is a set of commands which is
not dependent to any mode.

# <motion>

<numeral> means repeat unless otherwise
stated.

- <numeral>h : Go right
- <numeral>j : Go down
- <numeral>k : Go up
- <numeral>l : Go left
- <numeral>J : Go 15 down
- <numeral>K : Go 15 up
- <numeral>H : Go to the start of
               the line
- <numeral>L : Go to the end of the
               line
- <numeral>g : Go to <numeral> line
- G : Go to the end of the document
- <numeral>t<char> : Go to the next occurence
                     of <char>
- <numeral>f<char> : Go to the previous occurence
                     of <char>
Ticki's avatar
Ticki committed

Tips'n'tricks
-------------

- gg : Go to the start of the document
- dL : Delete the rest of the line
TODO: Extend