Skip to content

General editing

Luke edited this page Sep 19, 2024 · 8 revisions

Quick reference

Ox is not modal, and is controlled by various key bindings by default, which are listed in the table below.

You can type straight into the document and use the backspace, return, tab and delete keys to also help modify text.

Keybinding What it does
Ctrl + Q Exits the current tab or the editor if only one tab open.
Ctrl + S Saves the open file to the disk.
Alt + S Prompts you for a file name and saves it to disk as that file name.
Alt + A Saves all the currently open files to the disk.
Ctrl + N Creates a new tab with a blank document.
Ctrl + O Prompts you for a file and opens that file in a new tab.
Ctrl + F Searches the document for a search query. Allows pressing of to move the cursor to the previous occurance fof the query and to move to the next occurance of the query. Press Return or Esc to leave the search. Note: you can use regular expressions for search queries.
Ctrl + Z Undoes your last action. The changes are committed to the undo stack every time you press the space bar, create / destroy a new line and when there is no activity after a certain period of time which can be used to capture points where you pause for thought or grab a coffee etc...
Ctrl + Y Redoes your last action. The changes are committed to the undo stack every time you press the space bar, create / destroy a new line and when there is no activity after a certain period of time which can be used to capture points where you pause for thought or grab a coffee etc...
Ctrl + R Allows replacing of occurances in the document. Uses the same keybindings as the search feature: to move the cursor to the previous occurance of the query and to move to the next occurance of the query. You can also press Return to carry out the replace action. To exit replace mode once you're finished, you can press Esc. You can also use Space to replace every instance in the document at once. Note: you can use regular expressions for search queries.
Ctrl + K Opens the command line.
Alt + Left Navigates to the previous tab.
Alt + Right Navigates to the next tab.
Ctrl + C Copy text from document.
Ctrl + V Paste text from clipboard. Note this might be Ctrl + Shift + V on certain systems.
Ctrl + A Select all text in the document.
Up Move the cursor up.
Down Move the cursor down.
Left Move the cursor left.
Right Move the cursor right.
Shift + Up Move the cursor up whilst selecting.
Shift + Down Move the cursor down whilst selecting.
Shift + Left Move the cursor left whilst selecting.
Shift + Right Move the cursor right whilst selecting.
Ctrl + Up Move to the top of the document.
Ctrl + Down Move to the bottom of the document.
Ctrl + Left Move to the previous word.
Ctrl + Right Move to the next word.
Home Go to the beginning of the current line.
End Go to the end of the current line.
PageUp Move one whole viewport up.
PageDown Move one whole viewport down.
Alt + Up Move the current line up one.
Alt + Down Move the current line down one.
Ctrl + D Delete the current line.
Ctrl + W A shortcut to quickly delete a word (the one to the left of the cursor).

Feel free to play around with these command shortcuts to get familiar with them.

You can also use the mouse to move between tabs and navigate to a part of the document.

The Command Line

This is a neat feature of ox that lets you modify the state of the editor while the editor is open.

To access the command line, use the keyboard shortcut Ctrl + K

You will be greeting with a prompt, where you can type in a command and press enter to run it.

At this prompt, you can use some of the following commands:

  • help - This will toggle a help message to the right hand side to provide a handy reference if you are just starting out. Run this command once to turn it on, and run it again to turn it off.
  • readonly [boolean] - This will change the read only status of the document. If you want the document that is currently open to be resistant to modification and saving, then you can run the command readonly true, and if you don't, you can run readonly false.
  • filetype [ext] - This will set the filetype of the document. If you have open a file that contains python code, for example, but the editor has not realised it is python code, then you can force it with the command filetype py, the parameter to this command is the file type extension, e.g. rs for rust, lua for lua, etc etc.
Clone this wiki locally