Author: Eiko

Tags: Online-Editor, Markdown, Tutorial, Vim

Before writing notes, you can check our Note Writing Guide.

Using the Online Editor

We have kindly provided an online editor in order to make (some of your) lives easier! owo, simply head to a notes directory or a note file, and click ‘New File’ or ‘Edit’ to start editing. You can create new directories by clicking ‘New Directory’. For safety reasons we currently have no online delete options.

If you cannot see these buttons, you are not logged in.

The editor

  • Support highlighting for Markdown and LaTeX

  • Supports Vim keybindings. You can be familiar with them by reading the next section. But this is not necessary, you can press i to enter insert mode and treat it as a normal text editor.

Vim Keybindings

These might be a bit overwhelming at first, but they are very powerful and efficient once you get used to them. Remember you can learn by doing, and don’t try to learn all of them at once, you can start with the basics and gradually add more keybindings to your arsenal owo! I’m sure you will eventually experience its power!

The following covers basics in a concise form, for a more verbose and complete introduction, see Vim Magic.

Basics

  • use i or a to enter insert mode. i will insert text before the cursor, a will insert text after the cursor.

  • use ESC to exit insert mode (and enter normal mode).

  • in normal mode, you can use h, j, k, l to move the cursor left, down, up, and right (LDUR) respectively. This is one of the key features of Vim.

  • use w, b, e to move the cursor word by word.

    • w moves the cursor to the beginning of the next word

    • b moves the cursor to the beginning of the previous word

    • e moves the cursor to the end of the current word

    • W, B, E are similar to w, b, e, but they move over any non-whitespace characters.

  • use x to delete the character under the cursor, X to delete the character before the cursor.

  • use o to insert a new line below the current line, O to insert a new line above the current line.

  • use ^, $ to move the cursor to the beginning and end of the line respectively. Alternatively, 0 will move you to the beginning of the line (ignoring whitespace or indentation).

  • use gg, G to move the cursor to the beginning and end of the file respectively.

  • use u to undo, Ctrl + r to redo.

  • use v to enter visual mode, where you can move and select text.

  • use y to copy (yank) selected text, p to paste.

  • use % to jump between the matching parenthesis, bracket, or brace.

  • use f to find the next occurrence of a character, F to find backwards.

    For example, fa will move the cursor to the next occurrence of the character a, and now you can press ; to find the next occurrence.

  • t is similar to f but it moves the cursor to the character before the occurrence. For example, ta will move the cursor to the character before a.

Essential Modifications

I also added the following essential key-bindings which are not standard vim keybinds (but they are really important)

  • use J, K to move the cursor down or up by 4 lines, this is very useful if you want to move around quickly. Similarly for H and L.

  • I bind U to Ctrl + r, you can use U to redo the last undo instead of pressing Ctrl + r.

Advanced

  • use ciw to mean “change in word”, this will delete the current word and enter insert mode.

  • use dd to delete the current line, dw to delete the current word, diw to delete the current word without the surrounding whitespace. daw will delete the current word with the surrounding whitespace.

  • use { and } to move the cursor to the beginning of the previous or next paragraph, a paragraph is defined as a block of continues text, they are separated by empty lines.

  • use / to enter searching, type a pattern and press Enter to search. Press n to find the next occurrence, N to find backwards.

  • use :%s/pattern/replace/g to replace all occurrences of pattern with replace. You can also use :%s/pattern/replace/gc to confirm each replacement.

  • use q to record a macro, the process is as follows

    1. press q followed by a letter, for example q a to start recording a macro to register a.

    2. perform the actions you want to record.

    3. press q again to stop recording.

    4. press @ a to replay the macro in register a, or 100@ a to replay the macro 100 times.

    5. press @@ to replay the last macro you have played, or 100@@ to replay the last macro 100 times.

  • use Ctrl+v to enter visual block mode, where you can select a block of text and perform block magic!

Note

Some functions are missing in the online editor, for example zz and Ctrl + d, Ctrl + u unfortunately does not work.