docs/source/hotkeys.rst
.. _hotkeys:
This reference covers the keys used to control lnav. Consult the built-in help <https://github.com/tstack/lnav/blob/master/src/help.md>_ in lnav for
a more detailed explanation of each key.
.. list-table:: :header-rows: 1 :widths: 6 20
Ctrl + :kbd:CCtrl + :kbd:C three
times will trigger an abort exit.The majority of these hotkeys should be available in all views.
.. list-table:: :header-rows: 1 :widths: 6 6 6 20
SpacePgDnCtrl + :kbd:dbBackspacePgUpShift + :kbd:bCtrl + :kbd:uj↓k↑h←Shift + :kbd:hShift + :kbd:←l→/ui/views/log/time-column<config_log_time_column> setting.Shift + :kbd:lShift + :kbd:→HomegEndGeShift + :kbd:ewShift + :kbd:wnShift + :kbd:n><fShift + :kbd:fuShift + :kbd:uoShift + :kbd:osShift + :kbd:s{}partition<partitions>. For the TEXT view,
the following document types have recognizable sections: JSON, man,
diff, and Markdown.F7F8CTRL + :kbd:bThese hotkeys are only functional on views that are time-based, like the log view or the histogram view.
.. list-table:: :header-rows: 1 :widths: 5 5 20
dShift + :kbd:d1 - :kbd:6Shift + :kbd:1 - :kbd:6780Shift + :kbd:0rShift + :kbd:rThe following hotkeys are related to the breadcrumb bar that is below the top status bar.
.. list-table:: :header-rows: 1 :widths: 5 20
ENTEREscape←→Ctrl + :kbd:aCtrl + :kbd:e↓↑HomeEndWhile a crumb is selected, you can perform a fuzzy search on the possible values by typing in the value you are interested in.
.. _hotkeys_bookmarks:
.. list-table:: :header-rows: 1 :widths: 5 20
mShift + :kbd:mShift + :kbd:jShift + :kbd:kcShift + :kbd:cCtrl + :kbd:s.. _hotkeys_display:
.. list-table:: :header-rows: 1 :widths: 5 20
? or :kbd:F1qShift + :kbd:qaShift + :kbd:aShift + :kbd:pShift + :kbd:t:sh
command.tiShift + :kbd:izShift + :kbd:ZvShift + :kbd:vpTabCtrl + :kbd:lCtrl + :kbd:wCtrl + :kbd:pCtrl + :kbd:fxCtrl + :kbd:x=XF2.. list-table:: :header-rows: 1 :widths: 5 20
Ctrl + :kbd:Rsession<sessions> state. The session state
includes things like filters, bookmarks, and hidden fields... list-table:: :header-rows: 1 :widths: 5 20
/;sql-ext to execute SQL statements/queries:commands for more information\|Ctrl + :kbd:]After activating the prompt, the following shortcuts are available for editing:
.. list-table:: :header-rows: 1 :widths: 6 6 20
* - Keypress
-
- Command
* - :kbd:`Escape`
-
- Depending on the mode: close the completion popup; exit search
mode; cancel the prompt
* - :kbd:`Enter`
-
- In single line mode, exit the prompt and perform the operation.
In multi-line mode, insert a new line.
* - :kbd:`Ctrl` + :kbd:`X`
-
- Exit the prompt and perform the operation
* - :kbd:`F1`
-
- Open the help text for the prompt
* - :kbd:`←`
-
- Move left one character
* - :kbd:`→`
-
- Move right one character
* - :kbd:`Shift` + :kbd:`←`
-
- Move left one character and include it in the selection
* - :kbd:`Shift` + :kbd:`→`
-
- Move right one character and include it in the selection
* - :kbd:`↑`
- :kbd:`Ctrl` + :kbd:`P`
- In single-line mode, search the history with the current contents.
In multi-line mode, move the cursor up a line. If a popup is open,
move the selection up.
* - :kbd:`↓`
- :kbd:`Ctrl` + :kbd:`N`
- In multi-line mode, move the cursor down a line. If a popup is open,
move the selection down.
* - :kbd:`Ctrl` + :kbd:`A`
-
- Move to the beginning of the line
* - :kbd:`Ctrl` + :kbd:`E`
-
- Move to the end of the line
* - :kbd:`Ctrl` + :kbd:`K`
-
- Cut to the end of the line into the clipboard
* - :kbd:`Ctrl` + :kbd:`U`
-
- Cut from the beginning of the line to the cursor into the clipboard
* - :kbd:`Ctrl` + :kbd:`W`
-
- Cut from the beginning of the previous word into the clipboard
* - :kbd:`Ctrl` + :kbd:`Y`
-
- Paste the clipboard contents
* - :kbd:`Tab`
- :kbd:`Enter`
- Accept a completion suggestion
* - :kbd:`Ctrl` + :kbd:`_`
-
- Undo a change
* - :kbd:`Ctrl` + :kbd:`L`
-
- In the SQL prompt, reformat the contents of the prompt and switch
to multi-line mode
* - :kbd:`Ctrl` + :kbd:`O`
-
- Save the contents of the prompt in a script file named
:code:`saved-prompt` and, if available, open the file in
the :ref:`configured external editor <config_external_editor>`
* - :kbd:`Ctrl` + :kbd:`S`
-
- In multi-line mode, switch to search mode. If already in search
mode, find the next occurrence.
* - :kbd:`Ctrl` + :kbd:`R`
-
- In search mode, search for the previous occurrence. Otherwise,
search history using current contents of the prompt
New hotkeys can be defined and existing behaviors changed by updating lnav's
configuration. Since most of lnav's functionality is exposed through
:ref:SQLite functions<sql-ext> and :ref:SQLite virtual tables<sql-tab>,
quite a lot is possible. For example, if you regularly want to find a log
message with a particular pattern, like "Starting execution". The following
command will find the next occurrence after the currently focused message:
.. code-block:: custsqlite
;SELECT log_line FROM all_logs WHERE log_line > log_msg_line() AND log_body LIKE '%Starting execution%' LIMIT 1
To then move the focus in the log view to the line found by the above command, you can run the following:
.. code-block:: custsqlite
;UPDATE lnav_views SET selection = (SELECT log_line FROM all_logs WHERE log_line > log_msg_line() AND log_body LIKE '%Starting execution%' LIMIT 1) WHERE name = 'log'
To bind that command to a key, like F9, you can run the following
:code::config command:
.. code-block:: lnav
:config /ui/keymap-defs/default/f9/command ;UPDATE lnav_views SET selection = (SELECT log_line FROM all_logs WHERE log_line > log_msg_line() AND log_body LIKE '%Starting execution%' LIMIT 1) WHERE name = 'log'
Consult the :ref:Keymaps<keymaps> configuration section for more information.