[keymap] add a french keymap

pull/759/head
Timothy Stack 4 years ago
parent 3438ad1da9
commit f3d172c831

@ -29,7 +29,7 @@ format2csv.main(["",
import re
from pygments.lexer import RegexLexer, words
from pygments.token import Punctuation, Whitespace, Text, Comment, Operator, \
Keyword, Name, String, Number, Generic
Keyword, Name, String, Literal, Number, Generic
from sphinx.highlighting import lexers
class CustSqliteLexer(RegexLexer):
@ -224,6 +224,7 @@ class LnavCommandLexer(RegexLexer):
'root': [
(r'\s+', Whitespace),
(r':[\w\-]+', Keyword),
(r'\<[\w\-]+\>', Literal.String.Doc),
(r'.', Text),
]
}

@ -24,10 +24,16 @@ The configuration for **lnav** is stored in the following JSON files in
directly. See the :ref:`Log Formats<log_formats>` chapter for more
information.
Options
-------
The following high-level configuration options are available:
The following configuration options can be used to customize **lnav** to
your liking. The options can be changed using the :code:`:config` command.
.. jsonschema:: ../../src/internals/config-v1.schema.json#/properties/ui/properties/keymap
.. jsonschema:: ../../src/internals/config-v1.schema.json#/properties/ui/properties/theme
.. jsonschema:: ../../src/internals/config-v1.schema.json#/properties/ui/properties/clock-format
@ -35,9 +41,8 @@ The following high-level configuration options are available:
.. jsonschema:: ../../src/internals/config-v1.schema.json#/properties/ui/properties/default-colors
.. jsonschema:: ../../src/internals/config-v1.schema.json#/properties/ui/properties/theme
.. jsonschema:: ../../src/internals/config-v1.schema.json#/properties/ui/properties/keymap
.. _themes:
Theme Definitions
-----------------
@ -50,6 +55,7 @@ User interface themes are also defined through the JSON configuration files.
.. jsonschema:: ../../src/internals/config-v1.schema.json#/definitions/style
.. _keymaps:
Keymap Definitions

@ -9,7 +9,7 @@ incompatible changes in the future.
Log messages contain a good deal of useful data, but it's not always easy to get
at. The log parser built into **lnav** is able to extract data as described by
:ref:`log-formats` as well as discovering data in plain text messages. This data
:ref:`log_formats` as well as discovering data in plain text messages. This data
can then be queried and processed using the SQLite front-end that is also
incorporated into **lnav**. As an example, the following Syslog message from
:code:`sudo` can be processed to extract several key/value pairs::

@ -1,4 +1,5 @@
.. include:: kbd.rst
Introduction
============
@ -6,7 +7,7 @@ Introduction
The Log File Navigator, **lnav**, is an advanced log file viewer for the
terminal. It provides an :ref:`easy-to-use interface<ui>` for monitoring and
analyzing your log files with little to no setup. Simply point **lnav** at
your log files and it will automatically detect the :ref:`log-formats`, index
your log files and it will automatically detect the :ref:`log_formats`, index
their contents, and display a combined view of all log messages. You can
navigate through your logs using a variety of :ref:`hotkeys<hotkeys>`.
:ref:`Commands<commands>` give you additional control over **lnav**'s behavior
@ -25,7 +26,7 @@ When compiling from source, the following dependencies are required:
* `ZLib <http://wwww.zlib.net>`_
* `Bzip2 <http://www.bzip.org>`_
* `Readline <http://www.gnu.org/s/readline>`_
* `curl <https://curl.haxx.se>`_
* `libcurl <https://curl.haxx.se>`_
Installation
------------
@ -40,6 +41,7 @@ doing:
make
sudo make install
Viewing Logs
------------
@ -51,7 +53,7 @@ For example, to view all of the CUPS logs on your system:
lnav /var/log/cups
The formats of the logs are determined automatically and indexed on-the-fly.
See :ref:`log-formats` for a listing of the predefined formats and how to
See :ref:`log_formats` for a listing of the predefined formats and how to
define your own.
If no arguments are given, **lnav** will try to open the syslog file on your
@ -60,3 +62,70 @@ system:
.. prompt:: bash
lnav
Setup
-----
After starting **lnav**, you might want to set the
:ref:`configuration options<Configuration>` mentioned below. Configuration in
**lnav** is done using the :code:`:config` command. To change a configuration
option, start by pressing |ks|:|ke| to enter the command prompt. Then,
type "config" followed by the option name and value.
.. note::
Tab-completion is available for these configuration options and, in some
cases, their values as well.
Keymap
^^^^^^
The keymap defines the mapping from :ref:`hotkeys<hotkeys>` to commands to
execute. The default mapping is for "U.S." keyboards. The following command
can be used to change the keymap:
.. code-block:: lnav
:config /ui/keymap <keymap-name>
The builtin keymaps are:
:fr: French
:uk: United Kingdom
:us: United States
To create or customize a keymap, consult the :ref:`keymaps` section.
Theme
^^^^^
The visual styling of **lnav** can be customized using a theme. The following
command can be used to the change the theme:
.. code-block:: lnav
:config /ui/theme <theme-name>
The builtin themes are:
`default <https://github.com/tstack/lnav/blob/master/src/themes/default-theme.json>`_,
`eldar <https://github.com/tstack/lnav/blob/master/src/themes/eldar.json>`_,
`monocai <https://github.com/tstack/lnav/blob/master/src/themes/monocai.json>`_,
`night-owl <https://github.com/tstack/lnav/blob/master/src/themes/night-owl.json>`_,
`solarized-dark <https://github.com/tstack/lnav/blob/master/src/themes/solarized-dark.json>`_,
and
`solarized-light <https://github.com/tstack/lnav/blob/master/src/themes/default-theme.json>`_.
To create or customize a theme, consult the :ref:`themes` section.
Log Formats
^^^^^^^^^^^
In order for **lnav** to understand your log files, it needs to told how to
parse the log messages using a log format definition. There are many log
formats builtin and **lnav** will automatically determine the best format to
use. In case your log file is not recognized, consult the :ref:`log_formats`
section for information on how to .

@ -164,7 +164,9 @@ list(APPEND GEN_SRCS default-formats.h default-formats.c)
set(CONFIG_FILES
root-config.json
keymaps/default-keymap.json
keymaps/fr-keymap.json
keymaps/uk-keymap.json
keymaps/us-keymap.json
themes/default-theme.json
themes/eldar.json
themes/monocai.json

@ -62,7 +62,9 @@ default-formats.h default-formats.c: bin2c $(FORMAT_FILES)
CONFIG_FILES = \
$(srcdir)/root-config.json \
$(srcdir)/keymaps/default-keymap.json \
$(srcdir)/keymaps/fr-keymap.json \
$(srcdir)/keymaps/uk-keymap.json \
$(srcdir)/keymaps/us-keymap.json \
$(srcdir)/themes/default-theme.json \
$(srcdir)/themes/eldar.json \
$(srcdir)/themes/monocai.json \

@ -17,6 +17,48 @@
"ui": {
"keymap-defs": {
"default": {
"x31": {
"command": ":goto next 10 minutes after the hour"
},
"x32": {
"command": ":goto next 20 minutes after the hour"
},
"x33": {
"command": ":goto next 30 minutes after the hour"
},
"x34": {
"command": ":goto next 40 minutes after the hour"
},
"x35": {
"command": ":goto next 50 minutes after the hour"
},
"x36": {
"command": ":goto next hour"
},
"x37": {
"command": ":goto previous minute"
},
"x38": {
"command": ":goto next minute"
},
"x21": {
"command": ":goto last 10 minutes after the hour"
},
"x40": {
"command": ":goto last 20 minutes after the hour"
},
"x23": {
"command": ":goto last 30 minutes after the hour"
},
"x24": {
"command": ":goto last 40 minutes after the hour"
},
"x25": {
"command": ":goto last 50 minutes after the hour"
},
"x5e": {
"command": ":goto last hour"
},
"x06": {
"command": ";UPDATE lnav_view_filters SET enabled = 1 - enabled WHERE view_name = (SELECT name FROM lnav_view_stack WHERE name in ('log', 'text') ORDER BY rowid DESC LIMIT 1)"
},
@ -81,48 +123,6 @@
"command": ":prev-location",
"alt-msg": "${keymap_def_next_location}"
},
"x31": {
"command": ":goto next 10 minutes after the hour"
},
"x32": {
"command": ":goto next 20 minutes after the hour"
},
"x33": {
"command": ":goto next 30 minutes after the hour"
},
"x34": {
"command": ":goto next 40 minutes after the hour"
},
"x35": {
"command": ":goto next 50 minutes after the hour"
},
"x36": {
"command": ":goto next hour"
},
"x37": {
"command": ":goto previous minute"
},
"x38": {
"command": ":goto next minute"
},
"x21": {
"command": ":goto last 10 minutes after the hour"
},
"x40": {
"command": ":goto last 20 minutes after the hour"
},
"x23": {
"command": ":goto last 30 minutes after the hour"
},
"x24": {
"command": ":goto last 40 minutes after the hour"
},
"x25": {
"command": ":goto last 50 minutes after the hour"
},
"x5e": {
"command": ":goto last hour"
},
"x3f": {
"command": ":toggle-view help"
},

@ -0,0 +1,51 @@
{
"$schema": "https://lnav.org/schemas/config-v1.schema.json",
"ui": {
"keymap-defs": {
"fr": {
"x26": {
"command": ":goto next 10 minutes after the hour"
},
"xc3xa9": {
"command": ":goto next 20 minutes after the hour"
},
"x22": {
"command": ":goto next 30 minutes after the hour"
},
"x27": {
"command": ":goto next 40 minutes after the hour"
},
"x28": {
"command": ":goto next 50 minutes after the hour"
},
"x2d": {
"command": ":goto next hour"
},
"xc3xa8": {
"command": ":goto next minute"
},
"x31": {
"command": ":goto last 10 minutes after the hour"
},
"x32": {
"command": ":goto last 20 minutes after the hour"
},
"x33": {
"command": ":goto last 30 minutes after the hour"
},
"x34": {
"command": ":goto last 40 minutes after the hour"
},
"x35": {
"command": ":goto last 50 minutes after the hour"
},
"x36": {
"command": ":goto last hour"
},
"x37": {
"command": ":goto previous minute"
}
}
}
}
}

@ -0,0 +1,51 @@
{
"$schema": "https://lnav.org/schemas/config-v1.schema.json",
"ui": {
"keymap-defs": {
"us": {
"x31": {
"command": ":goto next 10 minutes after the hour"
},
"x32": {
"command": ":goto next 20 minutes after the hour"
},
"x33": {
"command": ":goto next 30 minutes after the hour"
},
"x34": {
"command": ":goto next 40 minutes after the hour"
},
"x35": {
"command": ":goto next 50 minutes after the hour"
},
"x36": {
"command": ":goto next hour"
},
"x37": {
"command": ":goto previous minute"
},
"x38": {
"command": ":goto next minute"
},
"x21": {
"command": ":goto last 10 minutes after the hour"
},
"x40": {
"command": ":goto last 20 minutes after the hour"
},
"x23": {
"command": ":goto last 30 minutes after the hour"
},
"x24": {
"command": ":goto last 40 minutes after the hour"
},
"x25": {
"command": ":goto last 50 minutes after the hour"
},
"x5e": {
"command": ":goto last hour"
}
}
}
}
}

@ -1503,6 +1503,7 @@ static void looper()
auto enc_len = lnav_config.lc_ui_keymap.size() * 2;
auto encoded_name = (char *) alloca(enc_len);
log_info("unbound keyseq: %s", keyseq);
json_ptr::encode(encoded_name, enc_len, lnav_config.lc_ui_keymap.c_str());
// XXX we should have a hotkey for opening a prompt that is
// pre-filled with a suggestion that the user can complete.

@ -213,6 +213,9 @@ json_ptr::encode(char *dst, size_t dst_len, const char *src, size_t src_len)
}
retval += 1;
}
if (retval < dst_len) {
dst[retval] = '\0';
}
return retval;
}

Loading…
Cancel
Save