.. _a_kb:

******************
Keyboard Shortcuts
******************

Most features in novelWriter are available as keyboard shortcuts. This is a reference list if these
shortcuts. Most of them are also listed in the application's user interface.

.. note::
   On MacOS, replace :kbd:`Ctrl` with :kbd:`Cmd`.


.. _a_kb_main:

Main Window Shortcuts
=====================

.. csv-table::
   :header: "Shortcut", "Description"

   ":kbd:`F1`",           "Open the online user manual"
   ":kbd:`F5`",           "Open the :guilabel:`Build Manuscript` tool"
   ":kbd:`F6`",           "Open the :guilabel:`Writing Statistics` tool"
   ":kbd:`F8`",           "Toggle :guilabel:`Focus Mode`"
   ":kbd:`F9`",           "Re-build the project index"
   ":kbd:`F11`",          "Toggle full screen mode"
   ":kbd:`Alt+1`",        "Switch focus to the project tree (Windows :kbd:`Ctrl+Alt+1`)"
   ":kbd:`Alt+2`",        "Switch focus to document editor (Windows :kbd:`Ctrl+Alt+2`)"
   ":kbd:`Alt+3`",        "Switch focus to document viewer (Windows :kbd:`Ctrl+Alt+3`)"
   ":kbd:`Alt+4`",        "Switch focus to outline view (Windows :kbd:`Ctrl+Alt+4`)"
   ":kbd:`Ctrl+,`",       "Open the :guilabel:`Preferences` dialog"
   ":kbd:`Ctrl+Q`",       "Exit novelWriter"
   ":kbd:`Ctrl+Shift+,`", "Open the :guilabel:`Project Settings` dialog"
   ":kbd:`Ctrl+Shift+O`", "Open a project"
   ":kbd:`Ctrl+Shift+S`", "Save the current project"
   ":kbd:`Ctrl+Shift+W`", "Close the current project"
   ":kbd:`Shift+F1`",     "Open the local user manual (PDF) if it is available"
   ":kbd:`Shift+F6`",     "Open the :guilabel:`Project Details` dialog"

.. _a_kb_tree:

Project Tree Shortcuts
======================

.. csv-table::
   :header: "Shortcut", "Description"

   ":kbd:`F2`",             "Edit the label of the selected item"
   ":kbd:`Return`",         "Open the selected document in the editor"
   ":kbd:`Alt+Up`",         "Jump or go to the previous item at same level in the tree"
   ":kbd:`Alt+Down`",       "Jump or go to the next item at same level in the tree"
   ":kbd:`Alt+Left`",       "Jump to the parent item in the tree"
   ":kbd:`Alt+Right`",      "Jump to the first child item in the project tree"
   ":kbd:`Ctrl+.`",         "Open the context menu on the selected item"
   ":kbd:`Ctrl+L`",         "Open the :guilabel:`Quick Links` menu"
   ":kbd:`Ctrl+N`",         "Open the :guilabel:`Create New Item` menu"
   ":kbd:`Ctrl+O`",         "Open selected document"
   ":kbd:`Ctrl+R`",         "Open the selected document in the viewer"
   ":kbd:`Ctrl+Up`",        "Move selected item one step up in the tree"
   ":kbd:`Ctrl+Down`",      "Move selected item one step down in the tree"
   ":kbd:`Ctrl+Shift+Z`",   "Undo the last move of a project item, if possible"
   ":kbd:`Ctrl+Shift+Del`", "Move the selected item to Trash"


.. _a_kb_editor:

Document Editor Shortcuts
=========================


Text Search Shortcuts
---------------------

.. csv-table::
   :header: "Shortcut", "Description"

   ":kbd:`F3`",           "Find the next occurrence of the search word"
   ":kbd:`Ctrl+F`",       "Open the search bar and search for the selected word, if any is selected"
   ":kbd:`Ctrl+G`",       "Find next occurrence of search word in current document"
   ":kbd:`Ctrl+H`",       "Open the search tool and populate with the selected word (Mac :kbd:`Cmd+=`)"
   ":kbd:`Ctrl+Shift+1`", "Replace selected occurrence of the search word, and move to the next"
   ":kbd:`Ctrl+Shift+G`", "Find previous occurrence of the search word"
   ":kbd:`Shift+F3`",     "Find the previous occurrence of the search word"


Text Formatting Shortcuts
-------------------------

.. csv-table::
   :header: "Shortcut", "Description"

   ":kbd:`Ctrl+/`",       "Toggle block format as comment"
   ":kbd:`Ctrl+0`",       "Remove block formatting for block under cursor"
   ":kbd:`Ctrl+1`",       "Change block format to header level 1"
   ":kbd:`Ctrl+2`",       "Change block format to header level 2"
   ":kbd:`Ctrl+3`",       "Change block format to header level 3"
   ":kbd:`Ctrl+4`",       "Change block format to header level 4"
   ":kbd:`Ctrl+5`",       "Change block alignment to left-aligned"
   ":kbd:`Ctrl+6`",       "Change block alignment to centred"
   ":kbd:`Ctrl+7`",       "Change block alignment to right-aligned"
   ":kbd:`Ctrl+8`",       "Add a left margin to the block"
   ":kbd:`Ctrl+9`",       "Add a right margin to the block"
   ":kbd:`Ctrl+B`",       "Format selected text, or word under cursor, with strong emphasis (bold)"
   ":kbd:`Ctrl+D`",       "Strikethrough selected text, or word under cursor"
   ":kbd:`Ctrl+I`",       "Format selected text, or word under cursor, with emphasis (italic)"
   ":kbd:`Ctrl+'`",       "Wrap selected text, or word under cursor, in single quotes"
   ":kbd:`Ctrl+""`",      "Wrap selected text, or word under cursor, in double quotes"
   ":kbd:`Ctrl+Shift+/`", "Remove block formatting for block under cursor"


Other Editor Shortcuts
----------------------

.. csv-table::
   :header: "Shortcut", "Description"

   ":kbd:`F7`",             "Re-run the spell checker"
   ":kbd:`Ctrl+.`",         "Open the context menu at the current cursor location"
   ":kbd:`Ctrl+A`",         "Select all text in the document"
   ":kbd:`Ctrl+C`",         "Copy selected text to clipboard"
   ":kbd:`Ctrl+K`",         "Activate the insert commands (see list in :ref:`a_kb_ins`)"
   ":kbd:`Ctrl+R`",         "Open or reload the current document in the viewer"
   ":kbd:`Ctrl+S`",         "Save the current document"
   ":kbd:`Ctrl+V`",         "Paste text from clipboard to cursor position"
   ":kbd:`Ctrl+W`",         "Close the current document"
   ":kbd:`Ctrl+X`",         "Cut selected text to clipboard"
   ":kbd:`Ctrl+Y`",         "Redo latest undo"
   ":kbd:`Ctrl+Z`",         "Undo latest changes"
   ":kbd:`Ctrl+Del`",       "Delete the word after the cursor"
   ":kbd:`Ctrl+Backspace`", "Delete the word before the cursor"
   ":kbd:`Ctrl+Return`",    "Open the tag or reference under the cursor in the viewer"
   ":kbd:`Ctrl+F7`",        "Toggle spell checking"
   ":kbd:`Ctrl+Shift+A`",   "Select all text in the current paragraph"
   ":kbd:`Ctrl+Shift+I`",   "Import text to the current document from a text file"

.. _a_kb_ins:

Insert Shortcuts
----------------

A set of insert features are also available through shortcuts, but they require a double
combination of key sequences. The insert feature is activated with :kbd:`Ctrl+K`, followed by
a key or key combination for the inserted content.

.. csv-table::
   :header: "Shortcut", "Description"

   ":kbd:`Ctrl+K`, :kbd:`−`",           "Insert a short dash (en dash)"
   ":kbd:`Ctrl+K`, :kbd:`_`",           "Insert a long dash (em dash)"
   ":kbd:`Ctrl+K`, :kbd:`Ctrl+_`",      "Insert a horizontal bar (quotation dash)"
   ":kbd:`Ctrl+K`, :kbd:`~`",           "Insert a figure dash (same width as a number)"
   ":kbd:`Ctrl+K`, :kbd:`1`",           "Insert a left single quote"
   ":kbd:`Ctrl+K`, :kbd:`2`",           "Insert a right single quote"
   ":kbd:`Ctrl+K`, :kbd:`3`",           "Insert a left double quote"
   ":kbd:`Ctrl+K`, :kbd:`4`",           "Insert a right double quote"
   ":kbd:`Ctrl+K`, :kbd:`'`",           "Insert a modifier apostrophe"
   ":kbd:`Ctrl+K`, :kbd:`.`",           "Insert an ellipsis"
   ":kbd:`Ctrl+K`, :kbd:`Ctrl+'`",      "Insert a prime"
   ":kbd:`Ctrl+K`, :kbd:`Ctrl+""`",     "Insert a double prime"
   ":kbd:`Ctrl+K`, :kbd:`Space`",       "Insert a non-breaking space"
   ":kbd:`Ctrl+K`, :kbd:`Shift+Space`", "Insert a thin space"
   ":kbd:`Ctrl+K`, :kbd:`Ctrl+Space`",  "Insert a thin non-breaking space"
   ":kbd:`Ctrl+K`, :kbd:`*`",           "Insert a list bullet"
   ":kbd:`Ctrl+K`, :kbd:`Ctrl+−`",      "Insert a hyphen bullet (alternative bullet)"
   ":kbd:`Ctrl+K`, :kbd:`Ctrl+*`",      "Insert a flower mark (alternative bullet)"
   ":kbd:`Ctrl+K`, :kbd:`%`",           "Insert a per mille symbol"
   ":kbd:`Ctrl+K`, :kbd:`Ctrl+O`",      "Insert a degree symbol"
   ":kbd:`Ctrl+K`, :kbd:`Ctrl+X`",      "Insert a times sign"
   ":kbd:`Ctrl+K`, :kbd:`Ctrl+D`",      "Insert a division sign"
   ":kbd:`Ctrl+K`, :kbd:`G`",           "Insert a ``@tag`` keyword"
   ":kbd:`Ctrl+K`, :kbd:`V`",           "Insert a ``@pov`` keyword"
   ":kbd:`Ctrl+K`, :kbd:`F`",           "Insert a ``@focus`` keyword"
   ":kbd:`Ctrl+K`, :kbd:`C`",           "Insert a ``@char`` keyword"
   ":kbd:`Ctrl+K`, :kbd:`P`",           "Insert a ``@plot`` keyword"
   ":kbd:`Ctrl+K`, :kbd:`S`",           "Insert a synopsis comment"
   ":kbd:`Ctrl+K`, :kbd:`T`",           "Insert a ``@time`` keyword"
   ":kbd:`Ctrl+K`, :kbd:`L`",           "Insert a ``@location`` keyword"
   ":kbd:`Ctrl+K`, :kbd:`O`",           "Insert an ``@object`` keyword"
   ":kbd:`Ctrl+K`, :kbd:`E`",           "Insert an ``@entity`` keyword"
   ":kbd:`Ctrl+K`, :kbd:`X`",           "Insert a ``@custom`` keyword"


.. _a_kb_viewer:

Document Viewer Shortcuts
=========================

.. csv-table::
   :header: "Shortcut", "Description"

   ":kbd:`Alt+Left`",     "Move backward in the view history"
   ":kbd:`Alt+Right`",    "Move forward in the view history"
   ":kbd:`Ctrl+C`",       "Copy selected text to clipboard"
   ":kbd:`Ctrl+Shift+A`", "Select all text in the current paragraph"
   ":kbd:`Ctrl+Shift+R`", "Close the document viewer"
