From 043f742ec3f7c18d10275beb56599dc8d2ba9534 Mon Sep 17 00:00:00 2001 From: Frank LENORMAND Date: Tue, 2 Feb 2016 21:13:25 +0200 Subject: [PATCH 1/8] Add a basic man page --- doc/kakoune.1 | 147 ++++++++++++++++++++++++++++++++++++++++++++++++++ src/Makefile | 6 ++- 2 files changed, 152 insertions(+), 1 deletion(-) create mode 100644 doc/kakoune.1 diff --git a/doc/kakoune.1 b/doc/kakoune.1 new file mode 100644 index 00000000..d5f6a919 --- /dev/null +++ b/doc/kakoune.1 @@ -0,0 +1,147 @@ +'\" t +.\" ** The above line should force tbl to be a preprocessor ** +.\" Man page for kakoune +.\" +.pc +.TH KAKOUNE 1 "" "1.0" "editor" + +.SH NAME +kakoune \- a vim inspired, selection oriented code editor + +.SH SYNOPSIS + +.B kak +.RB [\| \-q \|] +.RB [\| \-u \|] +.RB [\| \-n \|] +.RB [\| \-l \|] +.RB [\| \-e +.IR command \|] +.RB [\| \-f +.IR command \|] +.RB [\| \-p +.IR session_id \|] +.RB [\| \-c +.IR session_id \||\c +.RB [\| [\| \-d \|]\c +.RB \ \-s +.IR session_id \|] +.IR file \ .\|.\|.\| + +.SH DESCRIPTION + +Kakoune is a code editor heavily inspired by Vim, as such most of its commands are similar to vi’s ones, and it shares \ +Vi’s "keystrokes as a text editing language" model. + +Kakoune can operate in two modes, normal and insertion. In insertion mode, keys are directly inserted into the current \ +buffer. In normal mode, keys are used to manipulate the current selection and to enter insertion mode. + +Kakoune has a strong focus on interactivity, most commands provide immediate and incremental results, while still being \ +competitive (as in keystroke count) with Vim. + +Kakoune works on selections, which are oriented, inclusive range of characters, selections have an anchor and a cursor \ +character. Most commands move both of them, except when extending selection where the anchor character stays fixed and \ +the cursor one moves around. + +.SH OPTIONS +.TP +.BR -q +in filter mode, be quiet about errors applying keys +.TP +.BR -u +use a dummy user interface, for testing purposes +.TP +.BR -n +do not source kakrc files on startup +.TP +.BR -l +list existing sessions +.TP +.BR -d +run as a headless session (requires -s) +.TP +.BR -e " " +execute argument on initialisation +.TP +.BR -f " " +act as a filter, executing given keys on given files +.TP +.BR -p " " +just send stdin as commands to the given session +.TP +.BR -c " " +connect to given session +.TP +.BR -s " " +set session name +.TP +.BR file +one or more files to edit +.RE + +At startup, if -n is not specified, Kakoune will try to source the file +.IB ../share/kak/kakrc +relative to the kak binary. \ +This kak file will then try to recursively source any files in +.BR $XDG_CONFIG_HOME/kak/autoload +(with +.BR $XDG_CONFIG_HOME +defaulting to +.BR $HOME/.config "," +and falling back to +.IB ../share/kak/autoload +if that autoload directory does not exist), and finally +.BR $XDG_CONFIG_HOME/kak/kakrc "." + +That leads to the following behaviour: by default, with no user autoload directory, the system wide autoload directory is used, once the user \ +wants control on autoloading, they can create an autoload directory and eventually symlink individual scripts, or the whole system wide autoload \ +directory. They can as well add any new scripts not provided with Kakoune. + +.SH EXAMPLES + +.TP +.BR kak " /path/to/file" +Edit a file +.RE + +.TP +.BR kak " ./file1.txt /path/to/file2.c" +Edit multiple files (multiple buffers will be created) +.RE + +.TP +.BR kak " -f 'ggO// kak: tabstop=8' *.c" +Insert a modeline that sets the +.IR tabstop +variable at the beginning of several source code files +.RE + +.TP +.BR kak " -e 'man dup2'" +Use Kakoune as a man pager +.RE + +.SH FILES + +If not started with the +.BR -n +switch, Kakoune will source the +.BR ../share/kak/kakrc +file relative to the kak binary, which will source additional files: + +\[bu] if the +.BR $XDG_CONFIG_HOME/kak/autoload +directory exists, load every +.IR *.kak +files in it, and load recursively any subdirectory + +\[bu] if it does not exists, fall back to the system wide autoload directory in +.BR ../share/kak/autoload + +After that, if it exists, source the +.BR $XDG_CONFIG_HOME/kak/kakrc +file which should be used for user configuration. + +In order to continue autoloading site-wide files with a local autoload directory, just add a symbolic link to +.BR ../share/kak/autoload/ +into your local autoload directory. diff --git a/src/Makefile b/src/Makefile index d74bf368..d995bdb1 100644 --- a/src/Makefile +++ b/src/Makefile @@ -29,6 +29,7 @@ NCURSESW_INCLUDE ?= /usr/include/ncursesw bindir := $(DESTDIR)$(PREFIX)/bin sharedir := $(DESTDIR)$(PREFIX)/share/kak docdir := $(DESTDIR)$(PREFIX)/share/doc/kak +mandir := $(DESTDIR)$(PREFIX)/man/man1 os := $(shell uname) @@ -66,13 +67,15 @@ test: cd ../test && ./run tags: ctags -R +man: + gzip -fk ../doc/kakoune.1 clean: rm -f .*.o .*.d kak tags XDG_CONFIG_HOME ?= $(HOME)/.config -install: kak +install: kak man mkdir -p $(bindir) install -m 0755 kak $(bindir) mkdir -p $(sharedir)/rc @@ -84,5 +87,6 @@ install: kak mkdir -p $(docdir) install -m 0644 ../README.asciidoc $(docdir) install -m 0644 ../doc/* $(docdir) + install -m 0644 ../doc/kakoune.1.gz $(mandir) .PHONY: tags install From 33008f9ea7407cbd5ed9dec07bdf4f63ea3c6e2a Mon Sep 17 00:00:00 2001 From: Frank LENORMAND Date: Tue, 2 Feb 2016 21:15:12 +0200 Subject: [PATCH 2/8] Add a `doc` command, as well as several themed documentation pages --- doc/manpages/commands | 185 ++++++++++++ doc/manpages/execeval | 53 ++++ doc/manpages/expansions | 115 ++++++++ doc/manpages/faces | 100 +++++++ doc/manpages/highlighters | 195 +++++++++++++ doc/manpages/hooks | 127 +++++++++ doc/manpages/options | 181 ++++++++++++ doc/manpages/registers | 56 ++++ doc/manpages/shortcuts | 571 ++++++++++++++++++++++++++++++++++++++ rc/doc.kak | 49 ++++ 10 files changed, 1632 insertions(+) create mode 100644 doc/manpages/commands create mode 100644 doc/manpages/execeval create mode 100644 doc/manpages/expansions create mode 100644 doc/manpages/faces create mode 100644 doc/manpages/highlighters create mode 100644 doc/manpages/hooks create mode 100644 doc/manpages/options create mode 100644 doc/manpages/registers create mode 100644 doc/manpages/shortcuts create mode 100644 rc/doc.kak diff --git a/doc/manpages/commands b/doc/manpages/commands new file mode 100644 index 00000000..3a04ac72 --- /dev/null +++ b/doc/manpages/commands @@ -0,0 +1,185 @@ +.TH KAKOUNE 1 "" "" "COMMANDS" + +.SS Primitives +.TP +.BR e[dit] " [ []]" +open buffer on file, go to given line and column. If file is already opened, just switch to this file. Use edit! to force reloading +.TP +.BR w[rite] " []" +write buffer to or use it's name if filename is not given +.TP +.BR w[rite]a[ll] +write all buffers that are associated to a file +.TP +.BR q[uit] +exit Kakoune, use quit! to force quitting even if there is some unsaved buffers remaining +.TP +.BR wq +write current buffer and quit +.TP +.BR b[uffer] " " +switch to buffer +.TP +.BR d[el]b[uf] " []" +delete the buffer , use d[el]b[uf]! to force deleting a modified buffer +.TP +.BR source " " +execute commands in +.TP +.BR runtime " " +execute commands in , is relative to kak executable path +.TP +.BR colorscheme " " +load named colorscheme +.TP +.BR nameclient " " +set current client name +.TP +.BR namebuf " " +set current buffer name +.TP +.BR echo " " +show in status line +.TP +.BR nop +does nothing, but arguments will be evaluated (e.g. shell expansion) +.TP +.BR set " " +change the value of an option (c.f. the 'options' documentation page) +.TP +.BR alias " " +define a new alias, within the context of a scope +.TP +.BR unalias " []" +remove an alias if its current value is the same as the one passed as an optional parameter, remove it unconditionally otherwise +.TP +.BR decl " [-hidden] []" +declare a new option, the -hidden hides the option in completion suggestions (c.f. the 'options' documentation page) +.TP +.BR face " " +define a face (c.f. the 'faces' documentation page) +.TP +.BR exec " [] …" +execute a series of keys, as if they were hit (c.f. the 'execeval' documentation page) +.TP +.BR eval " [] …" +execute commands, as if they were entered in the command prompt (c.f. the 'execeval' documentation page) +.TP +.BR def " [] " +define a new command (c.f. the 'Declaring new commands' section below) +.TP +.BR map " " +bind a combination of keys to another one (c.f. the 'commands' documentation page) +.TP +.BR hook " [-group ] " +execute a command whenever an event is triggered (c.f. the 'hooks' documentation page) +.TP +.BR rmhooks " " +remove every hooks in +.IR +that are part of the given +.IR +(c.f. the 'hooks' documentation page) +.TP +.BR addhl " [] …" +add a highlighter to the current window (c.f. the 'highlighters' documentation page) +.TP +.BR rmhl " " +remove the highlighter whose id is +.IR highlighter_id +(c.f. the 'highlighters' documentation page) + +.SS Helpers +Kakoune provides some helper commands that can be used to define composite commands: +.TP +.BR prompt " " +prompt the user for a string, when the user validates, store the result in given +.IR " and run " "." +the +.IR -init +switch allows setting initial content +.TP +.BR onkey " " +wait for next key from user, writes it into given and execute commands +.TP +.BR menu " …" +display a menu using labels, the selected label’s commands are executed. menu can take an +.IR -auto-single +argument, to automatically run commands when only one choice is provided, and a +.IR -select-cmds +argument, in which case menu takes three argument per item, the last one being a command to execute when the item is selected (but not validated) +.TP +.BR info " " +display text in an information box, at can take an +.IR -anchor +option, which accepts left, right and cursor as value, in order to specify where the info box should be anchored relative to the main selection +.TP +.BR try " catch " +prevent an error in +.IR +from aborting the whole commands execution, execute +.IR +instead. If nothing is to be done on error, the catch part can be ommitted +.TP +.BR reg " " +set register +.IR " to " +.RE + +Note that those commands are also available in the interactive mode, but are not really useful in that context. + +.SS Multiple commands +Commands (c.f. previous sections) can be chained, by being separated either by new lines or by semicolons, as such a +semicolon must be escaped with a backslash (\;) to be considered as a literal semicolon argument + +.SS Declaring new commands + +New commands can be defined using the +.IR def +command: + +.RS 3 +.TP +.BR def " [flags] " +.RE + +.IR +is a string containing the commands to execute, and +.IR flags +can be any combination of the following parameters: + +.RS 3 +.TP +.BR -params " " +the command accepts a +.IR +parameter, which can be either a number, or of the form .., with both and omittable +.TP +.BR -file-completion +try file completion on any parameter passed to this command +.TP +.BR -client-completion +try client name completion on any parameter passed to this command +.TP +.BR -buffer-completion +try buffer name completion on any parameter passed to this command +.TP +.BR -shell-completion +following string is a shell command which takes parameters as positional params and output one completion candidate per line +.TP +.BR -allow-override +allow the new command to replace an exisiting one with the same name +.TP +.BR -hidden +do not show the command in command name completions +.TP +.BR -docstring +define the documentation string for the command +.RE + +Using shell expansion allows to define complex commands or to access Kakoune state: + +.RS 3 +.TP +.BR def " print_selection %{ echo %sh{ ${kak_selection} } }" +.RE diff --git a/doc/manpages/execeval b/doc/manpages/execeval new file mode 100644 index 00000000..1ffdcbd7 --- /dev/null +++ b/doc/manpages/execeval @@ -0,0 +1,53 @@ +.TH KAKOUNE 1 "" "" "EXEC & EVAL" + +.TP +The +.IR exec " and " eval +commands can be used to run Kakoune commands, and should be used as follows: + +.RS 3 +.TP +.BR exec " [] …" +.TP +.BR eval " [] …" +.RE + +.IR exec +runs keys as if they were pressed, whereas +.IR eval +executes its given paremeters as if they were entered in the command prompt. \ +By default, their execution happens within the context of the current client, \ +and stops when the last key/command is reached, or an error is raised. + +.SS Optional flags +.TP +.BR -client " " +execute in the context of the client named +.IR +.TP +.BR -try-client " " +execute in the context of the client named +.IR +if such client exists, or else in the current context +.TP +.BR -draft +execute in a copy of the context of the selected client modifications to the selections or input state will not affect the client. This permits to make some modification to the buffer without modifying the user’s selection +.TP +.BR -itersel " (requires -draft)" +execute once per selection, in a context with only the considered selection. This permits to avoid cases where the selections may get merged +.TP +.BR -buffer " " +execute in the context of each buffers in the comma separated list +.IR ", " * +as a name can be used to iterate on all buffers +.TP +.BR -no-hooks +disable hook execution while executing the keys/commands +.TP +.BR -with-maps +use user key mapping in +.IR exec +instead of built in keys +.TP +.BR -save-regs " " +regs is a string of registers to be restored after execution diff --git a/doc/manpages/expansions b/doc/manpages/expansions new file mode 100644 index 00000000..a12d37af --- /dev/null +++ b/doc/manpages/expansions @@ -0,0 +1,115 @@ +.TH KAKOUNE 1 "" "" "EXPANSIONS" + +.SS Strings +.TP +.BR 'strings' +uninterpreted strings, use a backslash (\\') to escape the separator +.TP +.BR "strings" +expanded strings, % strings (c.f. next section) contained are expended, use a backslash (\\%) to escape the separator +.TP +.BR %{strings} +these strings are very useful when entering commands the +.IR { " and " } +delimiters are configurable, you can use any non alphanumeric character +e.g. %[string], %, %(string), %~string~, %!string! +if the character following '%' is one of '{[(<', then the closing one is the matching '}])>' and the delimiters are not escapable but are nestable +e.g. +.IR %{\ roger\ {};\ } " is a valid string + +.SS Typed expansions +.TP +.BR sh +shell expansion, similar to posix shell $(…) construct (c.f. next section) +.TP +.BR reg +register expansion, will be replaced by the content of the given register +.TP +.BR opt +option expansion, will be replaced with the value of the given option +.TP +.BR val +value expansion, gives access to the environment variable available to the Shell expansion. The kak_ prefix is not used there +.TP +.BR arg +argument expansion, gives access to the arguments of the current command, the content can be a number, or @ for all arguments + +.SS Shell expansions +The +.IR %sh{…} +expansion replaces its content with the output of the shell commands in it. The following environment variables are used to pass informations about Kakoune's state: + +.TP +.BR kak_selection +content of the main selection +.TP +.BR kak_selections +content of the selection separated by colons, colons in the selection contents are escapted with a backslash. +.TP +.BR kak_selection_desc +range of the main selection, represented as anchor,cursor; anchor and cursor are in this format: line.column +.TP +.BR kak_selections_desc +range of the selecations separated by colons +.TP +.BR kak_bufname +name of the current buffer +.TP +.BR kak_buffile +full path of the file or same as kak_bufname when there’s no associated file +.TP +.BR kak_buflist +the current buffer list, each buffer seperated by a colon +.TP +.BR kak_timestamp +timestamp of the current buffer, the timestamp is an integer value which is incremented each time the buffer is modified. +.TP +.BR kak_runtime +directory containing the kak binary +.TP +.BR kak_opt_ +value of option +.IR +.TP +.BR kak_reg_ +value of register +.IR +.TP +.BR kak_socket +filename of session socket (/tmp/kak-) +.TP +.BR kak_session +name of the current session +.TP +.BR kak_client +name of current client +.TP +.BR kak_cursor_line +line of the end of the main selection +.TP +.BR kak_cursor_column +column of the end of the main selection (in byte) +.TP +.BR kak_cursor_char_column +column of the end of the main selection (in character) +.TP +.BR kak_window_width +width of the current kakoune window +.TP +.BR kak_window_height +height of the current kakoune window +.TP +.BR kak_hook_param +filtering text passed to the currently executing hook +.TP +.BR kak_client_env_ +value of the +.IR +variable in the client environment (e.g. $kak_client_env_SHELL is the SHELL variable) + +Note that in order for Kakoune to pass a value in the environment, the variable has to be spelled out within the body of the expansion + +.SS Markup strings +In certain contexts, Kakoune can take a markup string, which is a string containing formatting informations. +In these strings, the {facename} syntax will enable the face facename until another face gets activated, or the end of the string is reached. +Literal '{' characters shall be written '\\{', and a literal backslash ('\\') that preceeds a '{' character shall be escaped as well ('\\\\') diff --git a/doc/manpages/faces b/doc/manpages/faces new file mode 100644 index 00000000..4d06a897 --- /dev/null +++ b/doc/manpages/faces @@ -0,0 +1,100 @@ +.TH KAKOUNE 1 "" "" "FACES" + +.SS Declaration +.TP +A "face" refers how the specified text is displayed, it has a foreground color, a background color, and some attributes. The value of a face has the following format: +.IR fg_color[,bg_color][+attributes] + +.TP +.BR fg_color ", " bg_color +a color whose value can be expressed in the following formats: +.RS 7 +.TP +.BR black ", " red ", " green ", " yellow ", " blue ", " magenta ", " cyan ", " white +a named color +.TP +.BR default +keep the existing color +.TP +.BR rgb:RRGGBB +hexadecimal value +.RE +.TP +.BR attributes +string whose individual letters set an attribute: +.RS 7 +.TP +.BR u +underline +.TP +.BR r +reverse +.TP +.BR b +bold +.TP +.BR B +blink +.TP +.BR d +dim +.TP +.BR i +italic +.TP +.BR e +exclusive, override previous faces instead of merging with them +.RE + +.SS Builtin faces +.TP +The following default faces are used by color schemes to highlight certains areas of the user interface: + +.TP +.BR Default +default colors +.TP +.BR PrimarySelection +main selection face for every selected character except the cursor +.TP +.BR SecondarySelection +secondary selection face for every selected character except the cursor +.TP +.BR PrimaryCursor +cursor of the primary selection +.TP +.BR SecondaryCursor +cursor of the secondary selection +.TP +.BR LineNumbers +face used by the number_lines highlighter +.TP +.BR LineNumberAbsolute +face used to highlight the line number of the main selection +.TP +.BR MenuForeground +face for the selected element in menus +.TP +.BR MenuBackground +face for the not selected elements in menus +.TP +.BR Information +face for the informations windows and information messages +.TP +.BR Error +face of error messages +.TP +.BR StatusLine +face used for the status line +.TP +.BR StatusCursor +face used for the status line cursor +.TP +.BR Prompt +face used prompt displayed on the status line +.TP +.BR MatchingChar +face used by the show_matching highlighter +.TP +.BR Search +face used to highlight search results diff --git a/doc/manpages/highlighters b/doc/manpages/highlighters new file mode 100644 index 00000000..9fda0599 --- /dev/null +++ b/doc/manpages/highlighters @@ -0,0 +1,195 @@ +.TH KAKOUNE 1 "" "" "HIGHLIGHTERS" + +.TP +Manipulation of the displayed text is done through highlighters, which can be added or removed with the following commands: + +.RS 3 +.TP +.BR addhl " …" +.RE + +and + +.RS 3 +.TP +.BR rmhl " " +.RE + +.IR highlighter_id +is a name generated by the highlighter specified with +.IR highlighter_name "," +possibly dependent on the parameters. Use command completion in a prompt on the +.IR rmhl +command to see the existing highlighters ids. + +.SH General highlighters +.TP +.BR regex " : …" +highlight a regex, takes the regex as first parameter, followed by any number of face parameters. For example: +.IR addhl regex //(\h`TODO:)?[^\n] 0:cyan 1:yellow,red` +will highlight C++ style comments in cyan, with an eventual 'TODO:' in yellow on red background +.TP +.BR dynregex +Similar to regex, but expand (like a command paramater would) the given expression before building a regex from the result +.TP +.BR flag_lines " " +add a column in front of text, and display the given flag in it for everly line contained in the int-list option named +.TP +.BR show_matching +highlight matching char of the character under the selections cursor using MatchingChar face +.TP +.BR number_lines " <-relative> <-hlcursor> <-separator >" +show line numbers, with the following options: +.RS 7 +.TP +.BR -relative +show line numbers relative to the main cursor line +.TP +.BR -hlcursor +highlight the cursor line with a separate face +.TP +.BR -separator +specify a string to separate the line numbers column with the rest of the buffer (default is +.IR | ")" +.RE +.TP +.BR fill " " +fill using the given +.IR face "," +mostly useful with regions highlighters + +.SH Highlighting Groups + +The group highlighter is a container for other highlighters. You can add a group to the current window using + +.RS 3 +.TP +.BR addhl " group " +.RE + +The +.IR -group +switch of the +.IR addhl +command provides a mean to add highlighters inside this group: + +.RS 3 +.TP +.BR addhl " -group ..." +.RE + +Groups can contain other groups, the +.IR -group +switch can be used to define a path as follows: + +.RS 3 +.TP +.BR addhl " -group group " +.TP +.BR addhl " -group / …" +.RE + +.SH Regions highlighters + +A special highlighter provides a way to segment the buffer into regions, which are to be highlighted differently. + +A region is defined by 4 parameters: +.TP +.BR name +user defined, used to identify the region +.TP +.BR opening +regex that defines the region start text +.TP +.BR closing +regex that defines the region end text +.TP +.BR recurse +regex that defines the text that matches recursively an end token into the region +.RE + +The +.IR recurse +option is useful for regions that can be nested, for example the +.IR %sh{\ …\ } +construct in kakoune accept nested +.IR {\ …\ } " so " %sh{\ …\ {\ …\ }\ …\ } +is valid. This region can be defined with: +.IR shell_expand\ %sh\\{\ \\}\ \\{ + +Regions are used in the regions highlighter which can take any number of regions. + +The command: +.RS 3 +.TP +.BR addhl " regions " + … +.RE + +defines multiple regions in which other highlighters can be added as follows: + +.RS 3 +.TP +.BR addhl " -group / …" +.RE + +Regions are matched using the left-most rule: the left-most region opening starts a new region. When a region closes, the closest next opening start another region. + +That matches the rule governing most programming language parsing. + +Regions also supports a +.IR -default +switch to define the default region, when no other region matches the current buffer range: +.RS 3 +.TP +.BR -default " " +.RE + +Most programming languages can then be properly highlighted using a regions highlighter as root: + +.RS 3 +.TP +.BR addhl " regions -default code " + string \ + comment + +.TP +.BR addhl " -group /code …" +.TP +.BR addhl " -group /string …" +.TP +.BR addhl " -group /comment …" +.RE + +.SH Shared Highlighters + +Highlighters are often defined for a specific filetype, and it makes then sense to share the highlighters between all the windows on the same filetypes. + +A shared highlighter can be defined with the following command: + +.RS 3 +.TP +.BR addhl " -group / …" +.RE + +When the group switch values starts with a +.IR / "," +it references a group in the shared highlighters, rather than the window highlighters. + +The common case would be to create a named shared group, and then fill it with highlighters: + +.RS 3 +.TP +.BR addhl " -group / group " +.TP +.BR addhl " -group /name regex …" +.RE + +It can then be referenced in a window using the ref highlighter. + +.RS 3 +.TP +.BR addhl " ref " +.RE + +The ref can reference any named highlighter in the shared namespace. diff --git a/doc/manpages/hooks b/doc/manpages/hooks new file mode 100644 index 00000000..ae24acf9 --- /dev/null +++ b/doc/manpages/hooks @@ -0,0 +1,127 @@ +.TH KAKOUNE 1 "" "" "HOOKS" + +.TP +Commands can be registred to be executed when certain events arise. To register a hook use the following command: + +.RS 3 +.TP +.BR hook " [-group ] " +.RE + +.IR +can be one of +.IR global ", " buffer " or " window + +.IR +is a string containing the commands to execute when the hook is called + +For example to automatically use line numbering with .cc files, use the following command: + +.RS 3 +.TP +.BR hook " global WinCreate .*\.cc %{ addhl number_lines }" +.RE + +if +.IR +is given, make this hook part of the named group. Groups are used for removing hooks with the following command: + +.RS 3 +.TP +.BR rmhooks " " +.RE + +A call to the command above will remove every hooks in +.IR +that are part of the given group. + +.SS Default hooks +.TP +.BR NormalIdle +a certain duration has passed since last key was pressed in normal mode +.TP +.BR NormalBegin +entering normal mode +.TP +.BR NormalEnd +leaving normal mode +.TP +.BR NormalKey +a key is received in normal mode, the key is used for filtering +.TP +.BR InsertIdle +a certain duration has passed since last key was pressed in insert mode +.TP +.BR InsertBegin +entering insert mode +.TP +.BR InsertEnd +leaving insert mode +.TP +.BR InsertKey +a key is received in insert mode, the key is used for filtering +.TP +.BR InsertMove +the cursor moved (without inserting) in insert mode, the key that triggered the move is used for filtering +.TP +.BR WinCreate +a window was created, the filtering text is the buffer name +.TP +.BR WinClose +a window was detroyed, the filtering text is the buffer name +.TP +.BR WinDisplay +a window was bound a client, the filtering text is the buffer name +.TP +.BR WinSetOption +an option was set in a window context, the filtering text is +.IR = +.TP +.BR BufSetOption +an option was set in a buffer context, the filtering text is +.IR = +.TP +.BR BufNew +a buffer for a new file has been created, filename is used for filtering +.TP +.BR BufOpen +a buffer for an existing file has been created, filename is used for filtering +.TP +.BR BufCreate +a buffer has been created, filename is used for filtering +.TP +.BR BufWritePre +executed just before a buffer is written, filename is used for filtering +.TP +.BR BufWritePost +executed just after a buffer is written, filename is used for filtering +.TP +.BR BufClose +executed when a buffer is deleted, while it is still valid +.TP +.BR BufOpenFifo +executed when a buffer opens a fifo +.TP +.BR BufReadFifo +executed after some data has been red from a fifo and inserted in the buffer +.TP +.BR BufCloseFifo +executed when a fifo buffer closes its fifo file descriptor either because the buffer is being deleted, or because the writing end has been closed +.TP +.BR RuntimeError +an error was encountered while executing an user command the error message is used for filtering +.TP +.BR KakBegin +kakoune has started, this hook is called just after reading the user configuration files +.TP +.BR KakEnd +kakoune is quitting +.TP +.BR FocusIn +on supported clients, triggered when the client gets focused. the filtering text is the client name +.TP +.BR FocusOut +on supported clients, triggered when the client gets unfocused. the filtering text is the client name +.RE + +When not specified, the filtering text is an empty string. diff --git a/doc/manpages/options b/doc/manpages/options new file mode 100644 index 00000000..22d7c164 --- /dev/null +++ b/doc/manpages/options @@ -0,0 +1,181 @@ +.TH KAKOUNE 1 "" "" "OPTIONS" + +.SS Types +.TP +.BR int +an integer number +.TP +.BR bool +a boolean value, yes/true or no/false +.TP +.BR str +a string, some freeform text +.TP +.BR coord +a line, column pair (separated by comma) +.TP +.BR regex +as a string but the set commands will complain if the entered text is not a valid regex +.TP +.BR int-list,\ str-list +a list, elements are separated by a colon (:) if an element needs to contain a colon, it can be escaped with a backslash +.TP +.BR enum(value1|value2|…) +an enum, taking one of the given values +.TP +.BR flags(value1|value2|…) +a set of flags, taking a combination of the given values joined by a '|' character + +.SS Scopes +.TP +.BR window +context linked to the window displaying a buffer +.TP +.BR buffer +context linked directly to the buffer +.TP +.BR global +global context linked to the instance of Kakoune +.RE + +Options can have individual values that change from one scope to the other, which will be considered one after another in the following order: +.IR window " → " +.IR buffer " → " +.IR global "." +That means that two windows on the same buffer can use different options (e.g. different +.IR filetype ")." +However some options might end up being ignored if their scope is not in the command context. +For example, writing a file never uses the +.IR window +scope when considering options, so any option related to writing won't be taken into account if set in the +.IR window +scope (e.g. +.IR BOM ", " +.IR eolformat ")." + +.SS Builtin options +.TP +.BR tabstop +.IR int +width of a tab character +.TP +.BR indentwidth +.IR int +width (in spaces) used for indentation, 0 means a tab character +.TP +.BR scrolloff +.IR coord +number of lines, columns to keep visible around the cursor when scrolling +.TP +.BR eolformat +.IR enum(lf|crlf) +the format of end of lines when writing a buffer, this is autodetected on load +.TP +.BR BOM +.IR enum(none|utf8) +define if the file should be written with an unicode byte order mark +.TP +.BR complete_prefix +.IR bool +when completing in command line, and multiple candidates exist, enable completion with common prefix +.TP +.BR incsearch +.IR bool +execute search as it is typed +.TP +.BR aligntab +.IR bool +use tabs for alignement command +.TP +.BR autoinfo +.IR flags(command|onkey|normal) +display automatic information box in the enabled contexts +.TP +.BR autoshowcompl +.IR bool +automatically display possible completions when editing a prompt +.TP +.BR ignored_files +.IR regex +filenames matching this regex wont be considered as candidates on filename completion (except if the text being completed already matches it) +.TP +.BR disabled_hooks +.IR regex +hooks whose group matches this regex wont be executed. For example indentation hooks can be disabled with '.*-indent' +.TP +.BR filetype +.IR str +arbitrary string defining the type of the file filetype dependant actions should hook on this option changing for activation/deactivation +.TP +.BR path +.IR str-list +directories to search for gf command +.TP +.BR completers +.IR str-list +completion engines to use for insert mode completion (they are tried in order until one generates candidates). Existing completers are: +.TP +.BR word=all,\ word=buffer +which complete using words in all buffers ( +.IR word=all " )" +or only the current one ( +.IR word=buffer " )" +.TP +.BR filename +which tries to detect when a filename is being entered and provides completion based on local filesystem +.TP +.BR option= +where +.IR +is a +.IR str-list +option. The first element of the list should follow the format: +.IR .[+]@ +to define where the completion apply in the buffer, and the other strings are the candidates +.TP +.BR static_words +.IR str-list +list of words that are always added to completion candidates when completing words in insert mode +.TP +.BR autoreload +.IR enum(yes|no|ask) +auto reload the buffers when an external modification is detected +.TP +.BR debug +.IR flags(hooks|shell|profile) +dump various debug information in the `*debug*` buffer +.TP +.BR modelinefmt +.IR string +A format string used to generate the mode line, that string is first expanded as a command line would be (expanding +.IR %...{...} +strings), then markup tags are applied (c.f. Expansions documentation page) +.TP +.BR ui_options +colon separated list of key=value pairs that are forwarded to the user interface implementation. The NCurses UI support the following options: + +.RS 7 +.BR ncurses_set_title +if +.IR yes +or +.IR true "," +the terminal emulator title will be changed +.TP +.BR ncurses_status_on_top +if +.IR yes "," +or +.IR true +the status line will be placed at the top of the terminal rather than at the bottom +.TP +.BR ncurses_assistant +specify the nice assistant you get in info boxes, can be +.IR clippy +(the default), +.IR cat +or +.IR none +.TP +.BR ncurses_wheel_down_button,\ ncurses_wheel_up_button +specify which button send for wheel down/up events diff --git a/doc/manpages/registers b/doc/manpages/registers new file mode 100644 index 00000000..3f2c8e81 --- /dev/null +++ b/doc/manpages/registers @@ -0,0 +1,56 @@ +.TH KAKOUNE 1 "" "" "REGISTERS" + +.SS Registers +.TP +Registers are named lists of text -instead of simply text- in order to interact well with multiselection. \ +They are used for various purposes, like storing the last yanked test, or the captured groups associated with the selections. + +.SS Interacting +.TP +.BR +when in insert mode or in a prompt, insert the value stored in the +.IR +register (single character) +.TP +.BR """ +in normal mode, select the +.IR +register (single character) + +.SS Default registers +.TP +Most commands using a register default to a specific one if not specified: + +.RS 7 +.TP +.BR """ +default yank, used by yanking and pasting commands like +.IR y ", " p " and " R +.TP +.BR / +default search register, used by regex based commands like +.IR s ", " * " or " / +.TP +.BR @ +default macro register, used by +.IR q " and " Q +.TP +.BR ^ +default mark register, used by +.IR z " and " Z + +.SS Special registers +.TP +Some registers are not general purposes, they cannot be written to, but they contain some special dat + +.RS 7 +.TP +.BR % +current buffer name +.TP +.BR . +current selection contents +.TP +.BR # +selection indices (first selection has 1, second has 2, …) +.RE diff --git a/doc/manpages/shortcuts b/doc/manpages/shortcuts new file mode 100644 index 00000000..93d51731 --- /dev/null +++ b/doc/manpages/shortcuts @@ -0,0 +1,571 @@ +.TH KAKOUNE 1 "" "" "SHORTCUTS" + +.SS Insert mode +.TP +.BR +leave insert mode +.TP +.BR +delete characters before cursors +.TP +.BR +delete characters under cursors +.TP +.BR ,\ ,\ ,\ +move the cursors in given direction +.TP +.BR +move cursors to line begin +.TP +.BR +move cursors to end of line +.TP +.BR +select next completion candidate +.TP +.BR +select previous completion candidate +.TP +.BR +explicit insert completion query, followed by: +.RS 7 +.TP +.BR f +explicit file completion +.TP +.BR w +explicit word completion +.TP +.BR l +explicit line completion +.RE +.TP +.BR +disable automatic completion for this insert session +.TP +.BR +insert contents of the register given by next key +.TP +.BR +insert next keystroke directly into the buffer, without interpreting it +.TP +.BR +commit changes up to now as a single undo group +.TP +.BR +escape to normal mode for a single command + +.SS Movement +"word" is a sequence of alphanumeric characters or underscore, and "WORD" is a sequence of non whitespace characters + +.TP +.BR h +select the character on the left of selection end +.TP +.BR j +select the character below the selection end +.TP +.BR k +select the character above the selection end +.TP +.BR l +select the character on the right of selection end +.TP +.BR w +select the word and following whitespaces on the right of selection end +.TP +.BR b +select preceding whitespaces and the word on the left of selection end +.TP +.BR e +select preceding whitespaces and the word on the right of selection end +.TP +.BR +same as [wbe] but select WORD instead of word +.TP +.BR m +select to matching character +.TP +.BR M +extend selection to matching character +.TP +.BR x +select line on which selection end lies (or next line when end lies on an end-of-line) +.TP +.BR +expand selections to contain full lines (including end-of-lines) +.TP +.BR +trim selections to only contain full lines (not including last end-of-line) +.TP +.BR % +select whole buffer +.TP +.BR +select to line begin +.TP +.BR +select to line end +.TP +.BR / +search (select next match) +.TP +.BR +search (select previous match) +.TP +.BR ? +search (extend to next match) +.TP +.BR +search (extend to previous match) +.TP +.BR n +select next match +.TP +.BR N +add a new selection with next match +.TP +.BR +select previous match +.TP +.BR +add a new selection with previous match +.TP +.BR pageup +scroll up +.TP +.BR pagedown +scroll down +.TP +.BR ' +rotate selections (the main selection becomes the next one) +.TP +.BR ; +reduce selections to their cursor +.TP +.BR +flip the selections direction +.TP +.BR +ensure selections are in forward direction (cursor after anchor) + +.SS Changes +.TP +.BR i +enter insert mode before current selection +.TP +.BR a +enter insert mode after current selection +.TP +.BR d +yank and delete current selection +.TP +.BR c +yank and delete current selection and enter insert mode +.TP +.BR . +repeat last insert mode change (`i`, `a`, or `c, including the inserted text) +.TP +.BR I +enter insert mode at current selection begin line start +.TP +.BR A +enter insert mode at current selection end line end +.TP +.BR o +enter insert mode in a new line below current selection end +.TP +.BR O +enter insert mode in a new line above current selection begin +.TP +.BR y +yank selections +.TP +.BR p +paste after current selection end +.TP +.BR P +paste before current selection begin +.TP +.BR +paste all after current selection end, and select each pasted string +.TP +.BR +paste all before current selection begin, and select each pasted string +.TP +.BR R +replace current selection with yanked text +.TP +.BR r +replace each character with the next entered one +.TP +.BR +join selected lines +.TP +.BR +join selected lines and select spaces inserted in place of line breaks +.TP +.BR > +indent selected lines +.TP +.BR > +indent selected lines, including empty lines +.TP +.BR < +deindent selected lines +.TP +.BR +deindent selected lines, do not remove incomplete indent (3 leading spaces when indent is 4) +.TP +.BR ! +insert command output before selection +.TP +.BR a-! +append command output after selection +.TP +.BR u +undo last change +.TP +.BR U +redo last change +.TP +.BR & +align selection, align the cursor of selections by inserting spaces before the first character of the selection +.TP +.BR +copy indent, copy the indentation of the main selection (or the count one if a count is given) to all other ones +.TP +.BR ` +to lower case +.TP +.BR ~ +to upper case +.TP +.BR +swap case +.TP +.BR @ +convert tabs to spaces in current selections, uses the buffer tabstop option or the count parameter for tabstop +.TP +.BR +convert spaces to tabs in current selections, uses the buffer tabstop option or the count parameter for tabstop +.TP +.BR +rotate selections content, if specified, the count groups selections, so +.IR 3 +rotate (1, 2, 3) and (3, 4, 6) independently + +.SS Goto Commands +If a count is given prior to hitting `g`, `g` will jump to the given line + +.TP +.BR gh +select to line begin +.TP +.BR gl +select to line end +.TP +.BR gg,\ gk +go to the first line +.TP +.BR gj +go to the last line +.TP +.BR ge +go to last char of last line +.TP +.BR gt +go to the first displayed line +.TP +.BR gc +go to the middle displayed line +.TP +.BR gb +go to the last displayed line +.TP +.BR ga +go to the previous (alternate) buffer +.TP +.BR gf +open the file whose name is selected +.TP +.BR g. +go to last buffer modifiction position + +.SS View commands +.TP +.BR V +lock view mode until is hit +.TP +.BR vv,\ vc +center the main selection in the window +.TP +.BR vt +scroll to put the main selection on the top line of the window +.TP +.BR vb +scroll to put the main selection on the bottom line of the window +.TP +.BR vh +scroll the window count columns left +.TP +.BR vj +scroll the window count line downward +.TP +.BR vk +scroll the window count line upward +.TP +.BR vl +scroll the window count columns right + + +.SS Marks +Marks use the +.IR ^ +register by default +.TP +.BR Z +will save the current selections to the register +.TP +.BR z +will restore the selections from the register +.TP +.BR +will add the selections from the register to the existing ones + +.SS Macros +Macros use the +.IR @ +register by default +.TP +.BR Q +record a macro +.TP +.BR q +play a recorded macro + +.SS Searching +Searches use the +.IR / +register by default +.TP +.BR * +set the search pattern to the current selection (automatically detects word boundaries) +.TP +.BR +set the search pattern to the current selection (verbatim, no smart detection) + +.SS Jump list +.TP +.BR +Jump forward +.TP +.BR +Jump backward +.TP +.BR +save current selections + +.SS Multiple selections +.TP +.BR s +create a selection +.TP +.BR +split the current selections on line boundaries +.TP +.BR S +split the current selection +.TP +.BR C +copy the current selection to the next line +.TP +.BR +copy the current selection to the previous line +.TP +.BR +clear a multiple selection +.TP +.BR +clear the current selection +.TP +.BR +keep the selections that match the given regex +.TP +.BR +clear selections that match the given regex +.TP +.BR | +pipe each selection through the given external filter program and replace the selection with its output +.TP +.BR +pipe each selection through the given external filter program and ignore its output +.TP +.BR $ +pipe each selection to the given shell command + +.SS Object Selection +.TP +.BR +selects the whole object +.TP +.BR +selects the inner object, that is the object excluding it's surrounder +.TP +.BR [ +selects to object start +.TP +.BR ] +selects to object end +.TP +.BR { +extends selections to object start +.TP +.BR } +extends selections to object end +.RE + +After this key, you need to enter a second key in order to specify which object you want +.TP +.BR b,\ (,\ ) +select the enclosing parenthesis +.TP +.BR B,\ {,\ } +select the enclosing {} block +.TP +.BR r,\ [,\ ] +select the enclosing [] block +.TP +.BR a,\ <,\ > +select the enclosing <> block +.TP +.BR " +select the enclosing double quoted string +.TP +.BR ' +select the enclosing single quoted string +.TP +.BR ` +select the enclosing grave quoted string +.TP +.BR w +select the whole word +.TP +.BR W +select the whole WORD +.TP +.BR s +select the sentence +.TP +.BR p +select the paragraph +.TP +.BR ␣ +select the whitespaces +.TP +.BR i +select the current indentation block +.TP +.BR n +select the number +.TP +.BR : +select user defined object, will prompt for open and close text + +.SS Prompt Commands +.TP +.BR +validate prompt +.TP +.BR +abandon without +.TP +.BR ,\ +move cursor to previous character +.TP +.BR ,\ +move cursor to previous character +.TP +.BR +move cursor to first character +.TP +.BR +move cursor to passed last character +.TP +.BR ,\ +erase character before cursor +.TP +.BR ,\ +erase character under cursor +.TP +.BR +avance to next word begin +.TP +.BR +advance to next WORD begin +.TP +.BR +go back to previous word begin +.TP +.BR +go back to previous WORD begin +.TP +.BR +advance to next word end +.TP +.BR +advance to next word end +.TP +.BR ,\ +select previous entry in history +.TP +.BR ,\ +select next entry in history +.TP +.BR +select next completion candidate +.TP +.BR +select previous completion candidate +.TP +.BR +insert then content of the register given by next key +.TP +.BR +insert next keystroke without interpretting it +.TP +.BR +disable auto completion for this prompt + +.SS Key mapping +Mapping a combination of keys to another one (a.k.a. key mapping or binding) can be done with the following command: + +.TP +.BR map " " +.RS 3 +.TP +.BR scope +can be one of +.IR global ", " window " or " buffer +.TP +.BR mode +can be one of +.IR insert ", " normal ", " prompt ", " menu ", " user +or a one character long arbitrary prefix (the +.IR user +mode uses the +.IR , +prefix) +.TP +.BR key +the key to which the combination will be bound +.TP +.BR keys +string that lists the keys that will be executed when +.IR key +is hit +.RE + +Keys are always executed within the +.IR normal +mode diff --git a/rc/doc.kak b/rc/doc.kak new file mode 100644 index 00000000..41c341f2 --- /dev/null +++ b/rc/doc.kak @@ -0,0 +1,49 @@ + +decl str doc_path "/usr/share/doc/kak/manpages" + +def -hidden -params 1..2 _doc-open %{ + %sh{ + manout=$(mktemp /tmp/kak-man-XXXXXX) + colout=$(mktemp /tmp/kak-man-XXXXXX) + + MANWIDTH=${kak_window_width} man -l "$1" > $manout + retval=$? + + col -b -x > ${colout} < ${manout} + rm ${manout} + + if [ "${retval}" -eq 0 ]; then + echo " + edit! -scratch '*doc*' + exec |cat${colout}gg + nop %sh{rm ${colout}} + set buffer filetype man + " + + if [ $# -gt 1 ]; then + echo "try %{ exec '%^\s+\S*\Q${2}\E\'' } catch %{ exec gg }" + fi + else + echo "echo -color Error %{doc '$@' failed: see *debug* buffer for details}" + rm ${colout} + fi + } +} + +def -params 1..2 \ + -shell-completion %{ + find "${kak_opt_doc_path}" -type f -iname "*$@*" -printf '%f\n' + } \ + doc -docstring "Open a buffer containing the documentation about a given subject" %{ + %sh{ + readonly PATH_DOC="${kak_opt_doc_path}/${1}" + + shift + if [ ! -f "${PATH_DOC}" ]; then + echo "echo -color Error No such doc file: ${PATH_DOC}" + exit + fi + + echo "eval -try-client %opt{docsclient} _doc-open ${PATH_DOC} $@" + } +} From caa87608d446aa22cf95f3a2a651f67c89274b8c Mon Sep 17 00:00:00 2001 From: Frank LENORMAND Date: Wed, 3 Feb 2016 11:39:58 +0200 Subject: [PATCH 3/8] Document the `t` and `f` bindings --- doc/manpages/shortcuts | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/doc/manpages/shortcuts b/doc/manpages/shortcuts index 93d51731..40c878a5 100644 --- a/doc/manpages/shortcuts +++ b/doc/manpages/shortcuts @@ -72,7 +72,7 @@ select the character above the selection end select the character on the right of selection end .TP .BR w -select the word and following whitespaces on the right of selection end +select the word and following whitespaces on the right of selection end .TP .BR b select preceding whitespaces and the word on the left of selection end @@ -83,6 +83,15 @@ select preceding whitespaces and the word on the right of selection end .BR same as [wbe] but select WORD instead of word .TP +.BR f +select to the next occurence of given character +.TP +.BR t +select until the next occurence of given character +.TP +.BR +same as [ft] but in the other direction +.TP .BR m select to matching character .TP From b6e930a57d6a8dc25c797956c118b252699d0bb1 Mon Sep 17 00:00:00 2001 From: Frank LENORMAND Date: Wed, 3 Feb 2016 14:51:32 +0200 Subject: [PATCH 4/8] Migrate the raw troff `kakoune` man page to the asciidoc format --- doc/kakoune.1 | 147 ---------------------------------------------- doc/kakoune.1.txt | 90 ++++++++++++++++++++++++++++ src/Makefile | 5 +- 3 files changed, 93 insertions(+), 149 deletions(-) delete mode 100644 doc/kakoune.1 create mode 100644 doc/kakoune.1.txt diff --git a/doc/kakoune.1 b/doc/kakoune.1 deleted file mode 100644 index d5f6a919..00000000 --- a/doc/kakoune.1 +++ /dev/null @@ -1,147 +0,0 @@ -'\" t -.\" ** The above line should force tbl to be a preprocessor ** -.\" Man page for kakoune -.\" -.pc -.TH KAKOUNE 1 "" "1.0" "editor" - -.SH NAME -kakoune \- a vim inspired, selection oriented code editor - -.SH SYNOPSIS - -.B kak -.RB [\| \-q \|] -.RB [\| \-u \|] -.RB [\| \-n \|] -.RB [\| \-l \|] -.RB [\| \-e -.IR command \|] -.RB [\| \-f -.IR command \|] -.RB [\| \-p -.IR session_id \|] -.RB [\| \-c -.IR session_id \||\c -.RB [\| [\| \-d \|]\c -.RB \ \-s -.IR session_id \|] -.IR file \ .\|.\|.\| - -.SH DESCRIPTION - -Kakoune is a code editor heavily inspired by Vim, as such most of its commands are similar to vi’s ones, and it shares \ -Vi’s "keystrokes as a text editing language" model. - -Kakoune can operate in two modes, normal and insertion. In insertion mode, keys are directly inserted into the current \ -buffer. In normal mode, keys are used to manipulate the current selection and to enter insertion mode. - -Kakoune has a strong focus on interactivity, most commands provide immediate and incremental results, while still being \ -competitive (as in keystroke count) with Vim. - -Kakoune works on selections, which are oriented, inclusive range of characters, selections have an anchor and a cursor \ -character. Most commands move both of them, except when extending selection where the anchor character stays fixed and \ -the cursor one moves around. - -.SH OPTIONS -.TP -.BR -q -in filter mode, be quiet about errors applying keys -.TP -.BR -u -use a dummy user interface, for testing purposes -.TP -.BR -n -do not source kakrc files on startup -.TP -.BR -l -list existing sessions -.TP -.BR -d -run as a headless session (requires -s) -.TP -.BR -e " " -execute argument on initialisation -.TP -.BR -f " " -act as a filter, executing given keys on given files -.TP -.BR -p " " -just send stdin as commands to the given session -.TP -.BR -c " " -connect to given session -.TP -.BR -s " " -set session name -.TP -.BR file -one or more files to edit -.RE - -At startup, if -n is not specified, Kakoune will try to source the file -.IB ../share/kak/kakrc -relative to the kak binary. \ -This kak file will then try to recursively source any files in -.BR $XDG_CONFIG_HOME/kak/autoload -(with -.BR $XDG_CONFIG_HOME -defaulting to -.BR $HOME/.config "," -and falling back to -.IB ../share/kak/autoload -if that autoload directory does not exist), and finally -.BR $XDG_CONFIG_HOME/kak/kakrc "." - -That leads to the following behaviour: by default, with no user autoload directory, the system wide autoload directory is used, once the user \ -wants control on autoloading, they can create an autoload directory and eventually symlink individual scripts, or the whole system wide autoload \ -directory. They can as well add any new scripts not provided with Kakoune. - -.SH EXAMPLES - -.TP -.BR kak " /path/to/file" -Edit a file -.RE - -.TP -.BR kak " ./file1.txt /path/to/file2.c" -Edit multiple files (multiple buffers will be created) -.RE - -.TP -.BR kak " -f 'ggO// kak: tabstop=8' *.c" -Insert a modeline that sets the -.IR tabstop -variable at the beginning of several source code files -.RE - -.TP -.BR kak " -e 'man dup2'" -Use Kakoune as a man pager -.RE - -.SH FILES - -If not started with the -.BR -n -switch, Kakoune will source the -.BR ../share/kak/kakrc -file relative to the kak binary, which will source additional files: - -\[bu] if the -.BR $XDG_CONFIG_HOME/kak/autoload -directory exists, load every -.IR *.kak -files in it, and load recursively any subdirectory - -\[bu] if it does not exists, fall back to the system wide autoload directory in -.BR ../share/kak/autoload - -After that, if it exists, source the -.BR $XDG_CONFIG_HOME/kak/kakrc -file which should be used for user configuration. - -In order to continue autoloading site-wide files with a local autoload directory, just add a symbolic link to -.BR ../share/kak/autoload/ -into your local autoload directory. diff --git a/doc/kakoune.1.txt b/doc/kakoune.1.txt new file mode 100644 index 00000000..d245e550 --- /dev/null +++ b/doc/kakoune.1.txt @@ -0,0 +1,90 @@ +kakoune(1) +========== + +NAME +---- +kakoune - a vim inspired, selection oriented code editor + +SYNOPSIS +-------- +*kak* [-q] [-u] [-n] [-l] [-e command] [-f command] [-p session_id] [-c session_id|[[-d] -s session_id] file ... + +DESCRIPTION +----------- + +Kakoune is a code editor heavily inspired by Vim, as such most of its commands are similar to Vi's ones, and it shares Vi's "keystrokes as a text editing language" model. + +Kakoune can operate in two modes, normal and insertion. In insertion mode, keys are directly inserted into the current buffer. In normal mode, keys are used to manipulate the current selection and to enter insertion mode. + +Kakoune has a strong focus on interactivity, most commands provide immediate and incremental results, while still being competitive (as in keystroke count) with Vim. + +Kakoune works on selections, which are oriented, inclusive range of characters, selections have an anchor and a cursor character. Most commands move both of them, except when extending selection where the anchor character stays fixed and the cursor one moves around. + +OPTIONS +------- + +-q:: + in filter mode, be quiet about errors applying keys + +-u:: + use a dummy user interface, for testing purposes + +-n:: + do not source kakrc files on startup + +-l:: + list existing sessions + +-d:: + run as a headless session (requires -s) + +-e :: + execute argument on initialisation + +-f :: + act as a filter, executing given keys on given files + +-p :: + just send stdin as commands to the given session + +-c :: + connect to given session + +-s :: + set session name + +file:: + one or more files to edit + +At startup, if -n is not specified, Kakoune will try to source the file '../share/kak/kakrc' relative to the kak binary. This kak file will then try to recursively source any files in +*$XDG_CONFIG_HOME*'/kak/autoload' (with *$XDG_CONFIG_HOME* defaulting to *$HOME*'/.config', and falling back to '../share/kak/autoload' if that autoload directory does not exist), and finally +*$XDG_CONFIG_HOME*'/kak/kakrc'. + +That leads to the following behaviour: by default, with no user autoload directory, the system wide autoload directory is used, once the user wants control on autoloading, they can +create an autoload directory and eventually symlink individual scripts, or the whole system wide autoload directory. They can as well add any new scripts not provided with Kakoune. + +EXAMPLES +-------- + +kak /path/to/file:: + Edit a file + +kak ./file1.txt /path/to/file2.c:: + Edit multiple files (multiple buffers will be created) + +kak -f "ggO// kak: tabstop=8" *.c:: + Insert a modeline that sets the tabstop variable at the beginning of several source code files + +kak -e "man dup2":: + Use Kakoune as a man pager + +FILES +----- + +If not started with the -n switch, Kakoune will source the '../share/kak/kakrc' file relative to the kak binary, which will source additional files: + + * if the *$XDG_CONFIG_HOME*'/kak/autoload' directory exists, load every '*.kak' files in it, and load recursively any subdirectory + * if it does not exists, fall back to the system wide autoload directory in '../share/kak/autoload' + +After that, if it exists, source the *$XDG_CONFIG_HOME*'/kak/kakrc' file which should be used for user configuration. +In order to continue autoloading site-wide files with a local autoload directory, just add a symbolic link to '../share/kak/autoload' into your local autoload directory. diff --git a/src/Makefile b/src/Makefile index d995bdb1..11b1fd36 100644 --- a/src/Makefile +++ b/src/Makefile @@ -67,8 +67,9 @@ test: cd ../test && ./run tags: ctags -R -man: - gzip -fk ../doc/kakoune.1 +man: ../doc/kakoune.1.txt + a2x -f manpage $< + gzip -fk $(basename $<) clean: rm -f .*.o .*.d kak tags From 6951f3f2d9de44d60a31ba0d73222b6b4bffe471 Mon Sep 17 00:00:00 2001 From: Frank LENORMAND Date: Wed, 3 Feb 2016 17:04:20 +0200 Subject: [PATCH 5/8] Wrap long lines --- doc/kakoune.1.txt | 41 ++++++++++++++++++++++++----------------- 1 file changed, 24 insertions(+), 17 deletions(-) diff --git a/doc/kakoune.1.txt b/doc/kakoune.1.txt index d245e550..86f64a0b 100644 --- a/doc/kakoune.1.txt +++ b/doc/kakoune.1.txt @@ -11,18 +11,21 @@ SYNOPSIS DESCRIPTION ----------- +Kakoune is a code editor heavily inspired by Vim, as such most of its commands are similar to Vi's ones, and it +shares Vi's "keystrokes as a text editing language" model. -Kakoune is a code editor heavily inspired by Vim, as such most of its commands are similar to Vi's ones, and it shares Vi's "keystrokes as a text editing language" model. +Kakoune can operate in two modes, normal and insertion. In insertion mode, keys are directly inserted into the +current buffer. In normal mode, keys are used to manipulate the current selection and to enter insertion mode. -Kakoune can operate in two modes, normal and insertion. In insertion mode, keys are directly inserted into the current buffer. In normal mode, keys are used to manipulate the current selection and to enter insertion mode. +Kakoune has a strong focus on interactivity, most commands provide immediate and incremental results, while still +being competitive (as in keystroke count) with Vim. -Kakoune has a strong focus on interactivity, most commands provide immediate and incremental results, while still being competitive (as in keystroke count) with Vim. - -Kakoune works on selections, which are oriented, inclusive range of characters, selections have an anchor and a cursor character. Most commands move both of them, except when extending selection where the anchor character stays fixed and the cursor one moves around. +Kakoune works on selections, which are oriented, inclusive range of characters, selections have an anchor and +a cursor character. Most commands move both of them, except when extending selection where the anchor character +stays fixed and the cursor one moves around. OPTIONS ------- - -q:: in filter mode, be quiet about errors applying keys @@ -56,16 +59,18 @@ OPTIONS file:: one or more files to edit -At startup, if -n is not specified, Kakoune will try to source the file '../share/kak/kakrc' relative to the kak binary. This kak file will then try to recursively source any files in -*$XDG_CONFIG_HOME*'/kak/autoload' (with *$XDG_CONFIG_HOME* defaulting to *$HOME*'/.config', and falling back to '../share/kak/autoload' if that autoload directory does not exist), and finally -*$XDG_CONFIG_HOME*'/kak/kakrc'. +At startup, if -n is not specified, Kakoune will try to source the file '../share/kak/kakrc' relative to the +kak binary. This kak file will then try to recursively source any files in *$XDG_CONFIG_HOME*'/kak/autoload' +(with *$XDG_CONFIG_HOME* defaulting to *$HOME*'/.config', and falling back to '../share/kak/autoload' if that +autoload directory does not exist), and finally *$XDG_CONFIG_HOME*'/kak/kakrc'. -That leads to the following behaviour: by default, with no user autoload directory, the system wide autoload directory is used, once the user wants control on autoloading, they can -create an autoload directory and eventually symlink individual scripts, or the whole system wide autoload directory. They can as well add any new scripts not provided with Kakoune. +That leads to the following behaviour: by default, with no user autoload directory, the system wide autoload +directory is used, once the user wants control on autoloading, they can create an autoload directory and eventually +symlink individual scripts, or the whole system wide autoload directory. They can as well add any new scripts not +provided with Kakoune. EXAMPLES -------- - kak /path/to/file:: Edit a file @@ -80,11 +85,13 @@ kak -e "man dup2":: FILES ----- +If not started with the -n switch, Kakoune will source the '../share/kak/kakrc' file relative to the kak binary, +which will source additional files: -If not started with the -n switch, Kakoune will source the '../share/kak/kakrc' file relative to the kak binary, which will source additional files: - - * if the *$XDG_CONFIG_HOME*'/kak/autoload' directory exists, load every '*.kak' files in it, and load recursively any subdirectory + * if the *$XDG_CONFIG_HOME*'/kak/autoload' directory exists, load every '*.kak' files in it, and load + recursively any subdirectory * if it does not exists, fall back to the system wide autoload directory in '../share/kak/autoload' -After that, if it exists, source the *$XDG_CONFIG_HOME*'/kak/kakrc' file which should be used for user configuration. -In order to continue autoloading site-wide files with a local autoload directory, just add a symbolic link to '../share/kak/autoload' into your local autoload directory. +After that, if it exists, source the *$XDG_CONFIG_HOME*'/kak/kakrc' file which should be used for user +configuration. In order to continue autoloading site-wide files with a local autoload directory, just add a symbolic +link to '../share/kak/autoload' into your local autoload directory. From 77beeaf9b9854cf15ab5ab009c4605b9316125b3 Mon Sep 17 00:00:00 2001 From: Frank LENORMAND Date: Wed, 3 Feb 2016 19:15:35 +0200 Subject: [PATCH 6/8] Rewrote the documentation pages in `asciidoc` format --- doc/manpages/commands | 311 +++++------ doc/manpages/execeval | 94 ++-- doc/manpages/expansions | 201 ++++--- doc/manpages/faces | 183 +++--- doc/manpages/highlighters | 268 ++++----- doc/manpages/hooks | 222 ++++---- doc/manpages/options | 304 +++++----- doc/manpages/registers | 89 ++- doc/manpages/shortcuts | 1114 ++++++++++++++++++------------------- 9 files changed, 1325 insertions(+), 1461 deletions(-) diff --git a/doc/manpages/commands b/doc/manpages/commands index 3a04ac72..d5c599da 100644 --- a/doc/manpages/commands +++ b/doc/manpages/commands @@ -1,185 +1,154 @@ -.TH KAKOUNE 1 "" "" "COMMANDS" +KAKOUNE(1) +========== -.SS Primitives -.TP -.BR e[dit] " [ []]" -open buffer on file, go to given line and column. If file is already opened, just switch to this file. Use edit! to force reloading -.TP -.BR w[rite] " []" -write buffer to or use it's name if filename is not given -.TP -.BR w[rite]a[ll] -write all buffers that are associated to a file -.TP -.BR q[uit] -exit Kakoune, use quit! to force quitting even if there is some unsaved buffers remaining -.TP -.BR wq -write current buffer and quit -.TP -.BR b[uffer] " " -switch to buffer -.TP -.BR d[el]b[uf] " []" -delete the buffer , use d[el]b[uf]! to force deleting a modified buffer -.TP -.BR source " " -execute commands in -.TP -.BR runtime " " -execute commands in , is relative to kak executable path -.TP -.BR colorscheme " " -load named colorscheme -.TP -.BR nameclient " " -set current client name -.TP -.BR namebuf " " -set current buffer name -.TP -.BR echo " " -show in status line -.TP -.BR nop -does nothing, but arguments will be evaluated (e.g. shell expansion) -.TP -.BR set " " -change the value of an option (c.f. the 'options' documentation page) -.TP -.BR alias " " -define a new alias, within the context of a scope -.TP -.BR unalias " []" -remove an alias if its current value is the same as the one passed as an optional parameter, remove it unconditionally otherwise -.TP -.BR decl " [-hidden] []" -declare a new option, the -hidden hides the option in completion suggestions (c.f. the 'options' documentation page) -.TP -.BR face " " -define a face (c.f. the 'faces' documentation page) -.TP -.BR exec " [] …" -execute a series of keys, as if they were hit (c.f. the 'execeval' documentation page) -.TP -.BR eval " [] …" -execute commands, as if they were entered in the command prompt (c.f. the 'execeval' documentation page) -.TP -.BR def " [] " -define a new command (c.f. the 'Declaring new commands' section below) -.TP -.BR map " " -bind a combination of keys to another one (c.f. the 'commands' documentation page) -.TP -.BR hook " [-group ] " -execute a command whenever an event is triggered (c.f. the 'hooks' documentation page) -.TP -.BR rmhooks " " -remove every hooks in -.IR -that are part of the given -.IR -(c.f. the 'hooks' documentation page) -.TP -.BR addhl " [] …" -add a highlighter to the current window (c.f. the 'highlighters' documentation page) -.TP -.BR rmhl " " -remove the highlighter whose id is -.IR highlighter_id -(c.f. the 'highlighters' documentation page) +NAME +---- +commands - a -.SS Helpers +Primitives +---------- +*e[dit]* [ []]:: + open buffer on file, go to given line and column. If file is already opened, just switch to this file. Use edit! to force reloading + +*w[rite]* []:: + write buffer to or use it's name if filename is not given + +*w[rite]a[ll]*:: + write all buffers that are associated to a file + +*q[uit]*:: + exit Kakoune, use quit! to force quitting even if there is some unsaved buffers remaining + +*wq*:: + write current buffer and quit + +*b[uffer]* :: + switch to buffer + +*d[el]b[uf]* []:: + delete the buffer , use d[el]b[uf]! to force deleting a modified buffer + +*source* :: + execute commands in + +*runtime* :: + execute commands in , is relative to kak executable path + +*colorscheme* :: + load named colorscheme + +*nameclient* :: + set current client name + +*namebuf* :: + set current buffer name + +*echo* :: + show in status line + +*nop*:: + does nothing, but arguments will be evaluated (e.g. shell expansion) + +*set* :: + change the value of an option (c.f. the 'options' documentation page) + +*alias* :: + define a new alias, within the context of a scope + +*unalias* []:: + remove an alias if its current value is the same as the one passed as an optional parameter, remove it unconditionally otherwise + +*decl* [-hidden] []:: + declare a new option, the -hidden hides the option in completion suggestions (c.f. the 'options' documentation page) + +*face* :: + define a face (c.f. the 'faces' documentation page) + +*exec* [] ...:: + execute a series of keys, as if they were hit (c.f. the 'execeval' documentation page) + +*eval* [] ...:: + execute commands, as if they were entered in the command prompt (c.f. the 'execeval' documentation page) + +*def* [] :: + define a new command (c.f. the 'Declaring new commands' section below) + +*map* :: + bind a combination of keys to another one (c.f. the 'commands' documentation page) + +*hook* [-group ] :: + execute a command whenever an event is triggered (c.f. the 'hooks' documentation page) + +*rmhooks* :: + remove every hooks in *scope* that are part of the given *group* (c.f. the 'hooks' documentation page) + +*addhl* [] ...:: + add a highlighter to the current window (c.f. the 'highlighters' documentation page) + +*rmhl* :: + remove the highlighter whose id is *highlighter_id* (c.f. the 'highlighters' documentation page) + +Helpers +------- Kakoune provides some helper commands that can be used to define composite commands: -.TP -.BR prompt " " -prompt the user for a string, when the user validates, store the result in given -.IR " and run " "." -the -.IR -init -switch allows setting initial content -.TP -.BR onkey " " -wait for next key from user, writes it into given and execute commands -.TP -.BR menu " …" -display a menu using labels, the selected label’s commands are executed. menu can take an -.IR -auto-single -argument, to automatically run commands when only one choice is provided, and a -.IR -select-cmds -argument, in which case menu takes three argument per item, the last one being a command to execute when the item is selected (but not validated) -.TP -.BR info " " -display text in an information box, at can take an -.IR -anchor -option, which accepts left, right and cursor as value, in order to specify where the info box should be anchored relative to the main selection -.TP -.BR try " catch " -prevent an error in -.IR -from aborting the whole commands execution, execute -.IR -instead. If nothing is to be done on error, the catch part can be ommitted -.TP -.BR reg " " -set register -.IR " to " -.RE + +*prompt* :: + prompt the user for a string, when the user validates, store the result in given *register* and run *commmand*. the *-init * switch allows setting initial content + +*onkey* :: + wait for next key from user, writes it into given and execute commands + +*menu* ...:: + display a menu using labels, the selected label’s commands are executed. menu can take an *-auto-single* argument, to automatically run commands when only one choice is provided, and a *-select-cmds* argument, in which case menu takes three argument per item, the last one being a command to execute when the item is selected (but not validated) + +*info* :: + display text in an information box, at can take an *-anchor* option, which accepts left, right and cursor as value, in order to specify where the info box should be anchored relative to the main selection + +*try* catch :: + prevent an error in *commands* from aborting the whole commands execution, execute *on_error_commands* instead. If nothing is to be done on error, the catch part can be ommitted + +*reg* :: + set register *name* to *content* Note that those commands are also available in the interactive mode, but are not really useful in that context. -.SS Multiple commands -Commands (c.f. previous sections) can be chained, by being separated either by new lines or by semicolons, as such a -semicolon must be escaped with a backslash (\;) to be considered as a literal semicolon argument +Multiple commands +----------------- +Commands (c.f. previous sections) can be chained, by being separated either by new lines or by semicolons, as such a semicolon must be escaped with a backslash (\;) to be considered as a literal semicolon argument -.SS Declaring new commands +Declaring new commands +---------------------- +New commands can be defined using the *def* command: -New commands can be defined using the -.IR def -command: +*def* [flags] :: + *commands* is a string containing the commands to execute, and *flags* can be any combination of the following parameters: -.RS 3 -.TP -.BR def " [flags] " -.RE +*-params* :: + the command accepts a *num* parameter, which can be either a number, or of the form .., with both and omittable -.IR -is a string containing the commands to execute, and -.IR flags -can be any combination of the following parameters: +*-file-completion*:: + try file completion on any parameter passed to this command -.RS 3 -.TP -.BR -params " " -the command accepts a -.IR -parameter, which can be either a number, or of the form .., with both and omittable -.TP -.BR -file-completion -try file completion on any parameter passed to this command -.TP -.BR -client-completion -try client name completion on any parameter passed to this command -.TP -.BR -buffer-completion -try buffer name completion on any parameter passed to this command -.TP -.BR -shell-completion -following string is a shell command which takes parameters as positional params and output one completion candidate per line -.TP -.BR -allow-override -allow the new command to replace an exisiting one with the same name -.TP -.BR -hidden -do not show the command in command name completions -.TP -.BR -docstring -define the documentation string for the command -.RE +*-client-completion*:: + try client name completion on any parameter passed to this command + +*-buffer-completion*:: + try buffer name completion on any parameter passed to this command + +*-shell-completion*:: + following string is a shell command which takes parameters as positional params and output one completion candidate per line + +*-allow-override*:: + allow the new command to replace an exisiting one with the same name + +*-hidden*:: + do not show the command in command name completions + +*-docstring*:: + define the documentation string for the command Using shell expansion allows to define complex commands or to access Kakoune state: -.RS 3 -.TP -.BR def " print_selection %{ echo %sh{ ${kak_selection} } }" -.RE +-------------------------------------------------------- +def " print_selection %{ echo %sh{ ${kak_selection} } }" +-------------------------------------------------------- diff --git a/doc/manpages/execeval b/doc/manpages/execeval index 1ffdcbd7..fb2144fc 100644 --- a/doc/manpages/execeval +++ b/doc/manpages/execeval @@ -1,53 +1,49 @@ -.TH KAKOUNE 1 "" "" "EXEC & EVAL" +KAKOUNE(1) +========== -.TP -The -.IR exec " and " eval -commands can be used to run Kakoune commands, and should be used as follows: +NAME +---- +execeval - a -.RS 3 -.TP -.BR exec " [] …" -.TP -.BR eval " [] …" -.RE +Description +----------- +The *exec* and *eval* commands can be used to run Kakoune commands, and should be used as follows: -.IR exec -runs keys as if they were pressed, whereas -.IR eval -executes its given paremeters as if they were entered in the command prompt. \ -By default, their execution happens within the context of the current client, \ -and stops when the last key/command is reached, or an error is raised. +---------------------------- +exec [] ... +eval [] ... +---------------------------- -.SS Optional flags -.TP -.BR -client " " -execute in the context of the client named -.IR -.TP -.BR -try-client " " -execute in the context of the client named -.IR -if such client exists, or else in the current context -.TP -.BR -draft -execute in a copy of the context of the selected client modifications to the selections or input state will not affect the client. This permits to make some modification to the buffer without modifying the user’s selection -.TP -.BR -itersel " (requires -draft)" -execute once per selection, in a context with only the considered selection. This permits to avoid cases where the selections may get merged -.TP -.BR -buffer " " -execute in the context of each buffers in the comma separated list -.IR ", " * -as a name can be used to iterate on all buffers -.TP -.BR -no-hooks -disable hook execution while executing the keys/commands -.TP -.BR -with-maps -use user key mapping in -.IR exec -instead of built in keys -.TP -.BR -save-regs " " -regs is a string of registers to be restored after execution +*exec* runs keys as if they were pressed, whereas *eval* executes its given paremeters as if they were entered in +the command prompt. By default, their execution happens within the context of the current client, and stops when +the last key/command is reached, or an error is raised. + +Optional flags +-------------- +*-client* :: + execute in the context of the client named *name* + +*-try-client* :: + execute in the context of the client named *name* if such client exists, or else in the current context + +*-draft*:: + execute in a copy of the context of the selected client modifications to the selections or input state + will not affect the client. This permits to make some modification to the buffer without modifying the + user’s selection + +*-itersel* (requires -draft):: + execute once per selection, in a context with only the considered selection. This permits to avoid cases + where the selections may get merged + +*-buffer* :: + execute in the context of each buffers in the comma separated list *names*, as a name can be used to + iterate on all buffers + +*-no-hooks*:: + disable hook execution while executing the keys/commands + +*-with-maps*:: + use user key mapping in instead of built in keys (*exec* only) + +*-save-regs* :: + regs is a string of registers to be restored after execution diff --git a/doc/manpages/expansions b/doc/manpages/expansions index a12d37af..1f48462c 100644 --- a/doc/manpages/expansions +++ b/doc/manpages/expansions @@ -1,115 +1,102 @@ -.TH KAKOUNE 1 "" "" "EXPANSIONS" +KAKOUNE(1) +========== -.SS Strings -.TP -.BR 'strings' -uninterpreted strings, use a backslash (\\') to escape the separator -.TP -.BR "strings" -expanded strings, % strings (c.f. next section) contained are expended, use a backslash (\\%) to escape the separator -.TP -.BR %{strings} -these strings are very useful when entering commands the -.IR { " and " } -delimiters are configurable, you can use any non alphanumeric character +NAME +---- +expansions - a + +Strings +------- +\'strings':: + uninterpreted strings, use a backslash (\\') to escape the separator +"strings":: + expanded strings, % strings (c.f. next section) contained are expended, use a backslash (\\%) to escape the separator +%\{strings\}:: + these strings are very useful when entering commands ++ + * the '{' and '}' delimiters are configurable, you can use any non alphanumeric character ++ +---------------------------------------------------------- e.g. %[string], %, %(string), %~string~, %!string! -if the character following '%' is one of '{[(<', then the closing one is the matching '}])>' and the delimiters are not escapable but are nestable -e.g. -.IR %{\ roger\ {};\ } " is a valid string +---------------------------------------------------------- + * if the character following '%' is one of '{[(<', then the closing one is the matching '}])>' and the + delimiters are not escapable but are nestable ++ +----------------------------------------------------------- +e.g. %{ roger {}; } is a valid string, %{ marcel \} as well +----------------------------------------------------------- -.SS Typed expansions -.TP -.BR sh -shell expansion, similar to posix shell $(…) construct (c.f. next section) -.TP -.BR reg -register expansion, will be replaced by the content of the given register -.TP -.BR opt -option expansion, will be replaced with the value of the given option -.TP -.BR val -value expansion, gives access to the environment variable available to the Shell expansion. The kak_ prefix is not used there -.TP -.BR arg -argument expansion, gives access to the arguments of the current command, the content can be a number, or @ for all arguments +Typed expansions +---------------- +*sh*:: + shell expansion, similar to posix shell '$(...)' construct (c.f. next section) +*reg*:: + register expansion, will be replaced by the content of the given register +*opt*:: + option expansion, will be replaced with the value of the given option +*val*:: + value expansion, gives access to the environment variable available to the Shell expansion. The 'kak_' + prefix is not used there +*arg*:: + argument expansion, gives access to the arguments of the current command, the content can be a number, + or @ for all arguments -.SS Shell expansions -The -.IR %sh{…} -expansion replaces its content with the output of the shell commands in it. The following environment variables are used to pass informations about Kakoune's state: +Shell expansions +---------------- +The '%sh{...}' expansion replaces its content with the output of the shell commands in it. The following environment +variables are used to pass informations about Kakoune's state: -.TP -.BR kak_selection -content of the main selection -.TP -.BR kak_selections -content of the selection separated by colons, colons in the selection contents are escapted with a backslash. -.TP -.BR kak_selection_desc -range of the main selection, represented as anchor,cursor; anchor and cursor are in this format: line.column -.TP -.BR kak_selections_desc -range of the selecations separated by colons -.TP -.BR kak_bufname -name of the current buffer -.TP -.BR kak_buffile -full path of the file or same as kak_bufname when there’s no associated file -.TP -.BR kak_buflist -the current buffer list, each buffer seperated by a colon -.TP -.BR kak_timestamp -timestamp of the current buffer, the timestamp is an integer value which is incremented each time the buffer is modified. -.TP -.BR kak_runtime -directory containing the kak binary -.TP -.BR kak_opt_ -value of option -.IR -.TP -.BR kak_reg_ -value of register -.IR -.TP -.BR kak_socket -filename of session socket (/tmp/kak-) -.TP -.BR kak_session -name of the current session -.TP -.BR kak_client -name of current client -.TP -.BR kak_cursor_line -line of the end of the main selection -.TP -.BR kak_cursor_column -column of the end of the main selection (in byte) -.TP -.BR kak_cursor_char_column -column of the end of the main selection (in character) -.TP -.BR kak_window_width -width of the current kakoune window -.TP -.BR kak_window_height -height of the current kakoune window -.TP -.BR kak_hook_param -filtering text passed to the currently executing hook -.TP -.BR kak_client_env_ -value of the -.IR -variable in the client environment (e.g. $kak_client_env_SHELL is the SHELL variable) +*kak_selection*:: + content of the main selection +*kak_selections*:: + content of the selection separated by colons, colons in the selection contents are escapted with a backslash +*kak_selection_desc*:: + range of the main selection, represented as anchor,cursor; anchor and cursor are in this format: line.column +*kak_selections_desc*:: + range of the selecations separated by colons +*kak_bufname*:: + name of the current buffer +*kak_buffile*:: + full path of the file or same as kak_bufname when there’s no associated file +*kak_buflist*:: + the current buffer list, each buffer seperated by a colon +*kak_timestamp*:: + timestamp of the current buffer, the timestamp is an integer value which is incremented each time the + buffer is modified +*kak_runtime*:: + directory containing the kak binary +*kak_opt_*:: + value of option *name* +*kak_reg_*:: + value of register *r* +*kak_socket*:: + filename of session socket ('/tmp/kak-') +*kak_session*:: + name of the current session +*kak_client*:: + name of current client +*kak_cursor_line*:: + line of the end of the main selection +*kak_cursor_column*:: + column of the end of the main selection (in byte) +*kak_cursor_char_column*:: + column of the end of the main selection (in character) +*kak_window_width*:: + width of the current kakoune window +*kak_window_height*:: + height of the current kakoune window +*kak_hook_param*:: + filtering text passed to the currently executing hook +*kak_client_env_*:: + value of the *name* variable in the client environment (e.g. *$kak_client_env_SHELL* is the SHELL variable) -Note that in order for Kakoune to pass a value in the environment, the variable has to be spelled out within the body of the expansion +Note that in order for Kakoune to pass a value in the environment, the variable has to be spelled out within the +body of the expansion -.SS Markup strings +Markup strings +-------------- In certain contexts, Kakoune can take a markup string, which is a string containing formatting informations. -In these strings, the {facename} syntax will enable the face facename until another face gets activated, or the end of the string is reached. -Literal '{' characters shall be written '\\{', and a literal backslash ('\\') that preceeds a '{' character shall be escaped as well ('\\\\') +In these strings, the {facename} syntax will enable the face facename until another face gets activated, or the +end of the string is reached. +Literal '{' characters shall be written '\{', and a literal backslash ('\') that preceeds a '{' character shall +be escaped as well ('\\'). diff --git a/doc/manpages/faces b/doc/manpages/faces index 4d06a897..b3a43b1d 100644 --- a/doc/manpages/faces +++ b/doc/manpages/faces @@ -1,100 +1,93 @@ -.TH KAKOUNE 1 "" "" "FACES" +KAKOUNE(1) +========== -.SS Declaration -.TP -A "face" refers how the specified text is displayed, it has a foreground color, a background color, and some attributes. The value of a face has the following format: -.IR fg_color[,bg_color][+attributes] +NAME +---- +faces - a -.TP -.BR fg_color ", " bg_color -a color whose value can be expressed in the following formats: -.RS 7 -.TP -.BR black ", " red ", " green ", " yellow ", " blue ", " magenta ", " cyan ", " white -a named color -.TP -.BR default -keep the existing color -.TP -.BR rgb:RRGGBB -hexadecimal value -.RE -.TP -.BR attributes -string whose individual letters set an attribute: -.RS 7 -.TP -.BR u -underline -.TP -.BR r -reverse -.TP -.BR b -bold -.TP -.BR B -blink -.TP -.BR d -dim -.TP -.BR i -italic -.TP -.BR e -exclusive, override previous faces instead of merging with them -.RE +Declaration +----------- +A 'face' refers how the specified text is displayed, it has a foreground color, a background color, and some +attributes. The value of a face has the following format: -.SS Builtin faces -.TP +-------------------------------- +fg_color[,bg_color][+attributes] +-------------------------------- + +'fg_color', 'bg_color':: + a color whose value can be expressed in the following formats: + *black*, *red*, *green*, *yellow*, *blue*, *magenta*, *cyan*, *white*::: + a named color + *default*::: + keep the existing color + *rgb:RRGGBB*::: + hexadecimal value + +'attributes':: + string whose individual letters set an attribute: + *u*::: + underline + *r*::: + reverse + *b*::: + bold + *B*::: + blink + *d*::: + dim + *i*::: + italic + *e*::: + exclusive, override previous faces instead of merging with them + +Builtin faces +------------- The following default faces are used by color schemes to highlight certains areas of the user interface: -.TP -.BR Default -default colors -.TP -.BR PrimarySelection -main selection face for every selected character except the cursor -.TP -.BR SecondarySelection -secondary selection face for every selected character except the cursor -.TP -.BR PrimaryCursor -cursor of the primary selection -.TP -.BR SecondaryCursor -cursor of the secondary selection -.TP -.BR LineNumbers -face used by the number_lines highlighter -.TP -.BR LineNumberAbsolute -face used to highlight the line number of the main selection -.TP -.BR MenuForeground -face for the selected element in menus -.TP -.BR MenuBackground -face for the not selected elements in menus -.TP -.BR Information -face for the informations windows and information messages -.TP -.BR Error -face of error messages -.TP -.BR StatusLine -face used for the status line -.TP -.BR StatusCursor -face used for the status line cursor -.TP -.BR Prompt -face used prompt displayed on the status line -.TP -.BR MatchingChar -face used by the show_matching highlighter -.TP -.BR Search -face used to highlight search results +*Default*:: + default colors + +*PrimarySelection*:: + main selection face for every selected character except the cursor + +*SecondarySelection*:: + secondary selection face for every selected character except the cursor + +*PrimaryCursor*:: + cursor of the primary selection + +*SecondaryCursor*:: + cursor of the secondary selection + +*LineNumbers*:: + face used by the number_lines highlighter + +*LineNumberAbsolute*:: + face used to highlight the line number of the main selection + +*MenuForeground*:: + face for the selected element in menus + +*MenuBackground*:: + face for the not selected elements in menus + +*Information*:: + face for the informations windows and information messages + +*Error*:: + face of error messages + +*StatusLine*:: + face used for the status line + +*StatusCursor*:: + face used for the status line cursor + +*Prompt*:: + face used prompt displayed on the status line + +*MatchingChar*:: + face used by the show_matching highlighter + +*Search*:: + face used to highlight search results diff --git a/doc/manpages/highlighters b/doc/manpages/highlighters index 9fda0599..344504fa 100644 --- a/doc/manpages/highlighters +++ b/doc/manpages/highlighters @@ -1,195 +1,173 @@ -.TH KAKOUNE 1 "" "" "HIGHLIGHTERS" +KAKOUNE(1) +========== -.TP -Manipulation of the displayed text is done through highlighters, which can be added or removed with the following commands: +NAME +---- +highlighters - a -.RS 3 -.TP -.BR addhl " …" -.RE +Description +----------- + +Manipulation of the displayed text is done through highlighters, which can be added or removed with the following +commands: + +------------------------------------------------------- +addhl ... +------------------------------------------------------- and -.RS 3 -.TP -.BR rmhl " " -.RE +----------------------- +*rmhl* +----------------------- -.IR highlighter_id -is a name generated by the highlighter specified with -.IR highlighter_name "," -possibly dependent on the parameters. Use command completion in a prompt on the -.IR rmhl -command to see the existing highlighters ids. +*highlighter_id* is a name generated by the highlighter specified with *highlighter_name*, possibly dependent on +the parameters. Use command completion in a prompt on the *rmhl* command to see the existing highlighters ids. -.SH General highlighters -.TP -.BR regex " : …" -highlight a regex, takes the regex as first parameter, followed by any number of face parameters. For example: -.IR addhl regex //(\h`TODO:)?[^\n] 0:cyan 1:yellow,red` -will highlight C++ style comments in cyan, with an eventual 'TODO:' in yellow on red background -.TP -.BR dynregex -Similar to regex, but expand (like a command paramater would) the given expression before building a regex from the result -.TP -.BR flag_lines " " -add a column in front of text, and display the given flag in it for everly line contained in the int-list option named -.TP -.BR show_matching -highlight matching char of the character under the selections cursor using MatchingChar face -.TP -.BR number_lines " <-relative> <-hlcursor> <-separator >" -show line numbers, with the following options: -.RS 7 -.TP -.BR -relative -show line numbers relative to the main cursor line -.TP -.BR -hlcursor -highlight the cursor line with a separate face -.TP -.BR -separator -specify a string to separate the line numbers column with the rest of the buffer (default is -.IR | ")" -.RE -.TP -.BR fill " " -fill using the given -.IR face "," -mostly useful with regions highlighters +General highlighters +-------------------- +*regex* : ...:: + highlight a regex, takes the regex as first parameter, followed by any number of face parameters. For example: -.SH Highlighting Groups + addhl regex //(\hTODO:)?[^\n] 0:cyan 1:yellow,red + + will highlight C++ style comments in cyan, with an eventual 'TODO:' in yellow on red background + +*dynregex*:: + Similar to regex, but expand (like a command paramater would) the given expression before building a regex from the result + +*flag_lines* :: + add a column in front of text, and display the given flag in it for everly line contained in the int-list option named + +*show_matching*:: + highlight matching char of the character under the selections cursor using MatchingChar face + +*number_lines* [options]:: + show line numbers, with the following *options*: + + *-relative*::: + show line numbers relative to the main cursor line + + *-hlcursor*::: + highlight the cursor line with a separate face + + *-separator* ::: + specify a string to separate the line numbers column with the rest of the buffer (default is '|') + +*fill* :: + fill using the given *face*, mostly useful with regions highlighters + +Highlighting Groups +------------------- The group highlighter is a container for other highlighters. You can add a group to the current window using -.RS 3 -.TP -.BR addhl " group " -.RE +-------------------- +addhl group +-------------------- -The -.IR -group -switch of the -.IR addhl -command provides a mean to add highlighters inside this group: +The *-group* switch of the *addhl* command provides a mean to add highlighters inside this group: -.RS 3 -.TP -.BR addhl " -group ..." -.RE +---------------------------------------- +addhl -group ... +---------------------------------------- -Groups can contain other groups, the -.IR -group -switch can be used to define a path as follows: +Groups can contain other groups, the *-group* switch can be used to define a path as follows: -.RS 3 -.TP -.BR addhl " -group group " -.TP -.BR addhl " -group / …" -.RE +-------------------------------------------------- +addhl -group group +addhl -group / ... +-------------------------------------------------- -.SH Regions highlighters +Regions highlighters +-------------------- A special highlighter provides a way to segment the buffer into regions, which are to be highlighted differently. -A region is defined by 4 parameters: -.TP -.BR name -user defined, used to identify the region -.TP -.BR opening -regex that defines the region start text -.TP -.BR closing -regex that defines the region end text -.TP -.BR recurse -regex that defines the text that matches recursively an end token into the region -.RE +*name*:: + user defined, used to identify the region +*opening*:: + regex that defines the region start text +*closing*:: + regex that defines the region end text +*recurse*:: + regex that defines the text that matches recursively an end token into the region -The -.IR recurse -option is useful for regions that can be nested, for example the -.IR %sh{\ …\ } -construct in kakoune accept nested -.IR {\ …\ } " so " %sh{\ …\ {\ …\ }\ …\ } -is valid. This region can be defined with: -.IR shell_expand\ %sh\\{\ \\}\ \\{ +The *recurse* option is useful for regions that can be nested, for example the following contruct: + +---------- +%sh{ ... } +---------- + +accepts nested braces scopes ('{ ... }') so the following string is valid: + +---------------------- +%sh{ ... { ... } ... } +---------------------- + +This region can be defined with: + +------------------------ +shell_expand %sh\{ \} \{ +------------------------ Regions are used in the regions highlighter which can take any number of regions. -The command: -.RS 3 -.TP -.BR addhl " regions " - … -.RE +The following command: + +----------------------------------------------------------------------- +addhl regions + ... +----------------------------------------------------------------------- defines multiple regions in which other highlighters can be added as follows: -.RS 3 -.TP -.BR addhl " -group / …" -.RE +--------------------------------------- +addhl -group / ... +--------------------------------------- Regions are matched using the left-most rule: the left-most region opening starts a new region. When a region closes, the closest next opening start another region. That matches the rule governing most programming language parsing. -Regions also supports a -.IR -default -switch to define the default region, when no other region matches the current buffer range: -.RS 3 -.TP -.BR -default " " -.RE +Regions also supports a *-default * switch to define the default region, when no other region matches the current buffer range. Most programming languages can then be properly highlighted using a regions highlighter as root: -.RS 3 -.TP -.BR addhl " regions -default code " - string \ - comment +----------------------------------------------------------------- +addhl regions -default code \ + string \ + comment -.TP -.BR addhl " -group /code …" -.TP -.BR addhl " -group /string …" -.TP -.BR addhl " -group /comment …" -.RE +addhl -group /code ... +addhl -group /string ... +addhl -group /comment ... +----------------------------------------------------------------- -.SH Shared Highlighters +Shared Highlighters +------------------- Highlighters are often defined for a specific filetype, and it makes then sense to share the highlighters between all the windows on the same filetypes. A shared highlighter can be defined with the following command: -.RS 3 -.TP -.BR addhl " -group / …" -.RE +-------------------------------- +addhl -group / ... +-------------------------------- -When the group switch values starts with a -.IR / "," -it references a group in the shared highlighters, rather than the window highlighters. +When the group switch values starts with a '/', it references a group in the shared highlighters, rather than the window highlighters. The common case would be to create a named shared group, and then fill it with highlighters: -.RS 3 -.TP -.BR addhl " -group / group " -.TP -.BR addhl " -group /name regex …" -.RE +------------------------------ +addhl -group / group +addhl -group /name regex ... +------------------------------ It can then be referenced in a window using the ref highlighter. -.RS 3 -.TP -.BR addhl " ref " -.RE +------------------ +addhl ref +------------------ The ref can reference any named highlighter in the shared namespace. diff --git a/doc/manpages/hooks b/doc/manpages/hooks index ae24acf9..a7dd6e63 100644 --- a/doc/manpages/hooks +++ b/doc/manpages/hooks @@ -1,127 +1,123 @@ -.TH KAKOUNE 1 "" "" "HOOKS" +KAKOUNE(1) +========== + +NAME +---- +hooks - a + +Description +----------- -.TP Commands can be registred to be executed when certain events arise. To register a hook use the following command: -.RS 3 -.TP -.BR hook " [-group ] " -.RE +---------------------------------------------------------------------- +hook [-group ] +---------------------------------------------------------------------- -.IR -can be one of -.IR global ", " buffer " or " window +*scope* can be one of *global*, *buffer* or *window*. -.IR -is a string containing the commands to execute when the hook is called +*command* is a string containing the commands to execute when the hook is called. For example to automatically use line numbering with .cc files, use the following command: -.RS 3 -.TP -.BR hook " global WinCreate .*\.cc %{ addhl number_lines }" -.RE +---------------------------------------------------- +hook global WinCreate .*\.cc %{ addhl number_lines } +---------------------------------------------------- -if -.IR -is given, make this hook part of the named group. Groups are used for removing hooks with the following command: +if *group* is given, make this hook part of the named group. Groups are used for removing hooks with the following +command: -.RS 3 -.TP -.BR rmhooks " " -.RE +----------------------- +rmhooks +----------------------- -A call to the command above will remove every hooks in -.IR -that are part of the given group. +A call to the command above will remove every hooks in *scope* that are part of the given *group*. -.SS Default hooks -.TP -.BR NormalIdle -a certain duration has passed since last key was pressed in normal mode -.TP -.BR NormalBegin -entering normal mode -.TP -.BR NormalEnd -leaving normal mode -.TP -.BR NormalKey -a key is received in normal mode, the key is used for filtering -.TP -.BR InsertIdle -a certain duration has passed since last key was pressed in insert mode -.TP -.BR InsertBegin -entering insert mode -.TP -.BR InsertEnd -leaving insert mode -.TP -.BR InsertKey -a key is received in insert mode, the key is used for filtering -.TP -.BR InsertMove -the cursor moved (without inserting) in insert mode, the key that triggered the move is used for filtering -.TP -.BR WinCreate -a window was created, the filtering text is the buffer name -.TP -.BR WinClose -a window was detroyed, the filtering text is the buffer name -.TP -.BR WinDisplay -a window was bound a client, the filtering text is the buffer name -.TP -.BR WinSetOption -an option was set in a window context, the filtering text is -.IR = -.TP -.BR BufSetOption -an option was set in a buffer context, the filtering text is -.IR = -.TP -.BR BufNew -a buffer for a new file has been created, filename is used for filtering -.TP -.BR BufOpen -a buffer for an existing file has been created, filename is used for filtering -.TP -.BR BufCreate -a buffer has been created, filename is used for filtering -.TP -.BR BufWritePre -executed just before a buffer is written, filename is used for filtering -.TP -.BR BufWritePost -executed just after a buffer is written, filename is used for filtering -.TP -.BR BufClose -executed when a buffer is deleted, while it is still valid -.TP -.BR BufOpenFifo -executed when a buffer opens a fifo -.TP -.BR BufReadFifo -executed after some data has been red from a fifo and inserted in the buffer -.TP -.BR BufCloseFifo -executed when a fifo buffer closes its fifo file descriptor either because the buffer is being deleted, or because the writing end has been closed -.TP -.BR RuntimeError -an error was encountered while executing an user command the error message is used for filtering -.TP -.BR KakBegin -kakoune has started, this hook is called just after reading the user configuration files -.TP -.BR KakEnd -kakoune is quitting -.TP -.BR FocusIn -on supported clients, triggered when the client gets focused. the filtering text is the client name -.TP -.BR FocusOut -on supported clients, triggered when the client gets unfocused. the filtering text is the client name -.RE +Default hooks +------------- +*NormalIdle*:: + a certain duration has passed since last key was pressed in normal mode + +*NormalBegin*:: + entering normal mode + +*NormalEnd*:: + leaving normal mode + +*NormalKey*:: + a key is received in normal mode, the key is used for filtering + +*InsertIdle*:: + a certain duration has passed since last key was pressed in insert mode + +*InsertBegin*:: + entering insert mode + +*InsertEnd*:: + leaving insert mode + +*InsertKey*:: + a key is received in insert mode, the key is used for filtering + +*InsertMove*:: + the cursor moved (without inserting) in insert mode, the key that triggered the move is used for filtering + +*WinCreate*:: + a window was created, the filtering text is the buffer name + +*WinClose*:: + a window was detroyed, the filtering text is the buffer name + +*WinDisplay*:: + a window was bound a client, the filtering text is the buffer name + +*WinSetOption*:: + an option was set in a window context, the filtering text is *=* + +*BufSetOption*:: + an option was set in a buffer context, the filtering text is *=* + +*BufNew*:: + a buffer for a new file has been created, filename is used for filtering + +*BufOpen*:: + a buffer for an existing file has been created, filename is used for filtering + +*BufCreate*:: + a buffer has been created, filename is used for filtering + +*BufWritePre*:: + executed just before a buffer is written, filename is used for filtering + +*BufWritePost*:: + executed just after a buffer is written, filename is used for filtering + +*BufClose*:: + executed when a buffer is deleted, while it is still valid + +*BufOpenFifo*:: + executed when a buffer opens a fifo + +*BufReadFifo*:: + executed after some data has been red from a fifo and inserted in the buffer + +*BufCloseFifo*:: + executed when a fifo buffer closes its fifo file descriptor either because the buffer is being deleted, + or because the writing end has been closed + +*RuntimeError*:: + an error was encountered while executing an user command the error message is used for filtering + +*KakBegin*:: + kakoune has started, this hook is called just after reading the user configuration files + +*KakEnd*:: + kakoune is quitting + +*FocusIn*:: + on supported clients, triggered when the client gets focused. the filtering text is the client name + +*FocusOut*:: + on supported clients, triggered when the client gets unfocused. the filtering text is the client name When not specified, the filtering text is an empty string. diff --git a/doc/manpages/options b/doc/manpages/options index 22d7c164..483c2fc0 100644 --- a/doc/manpages/options +++ b/doc/manpages/options @@ -1,181 +1,135 @@ -.TH KAKOUNE 1 "" "" "OPTIONS" +KAKOUNE(1) +========== -.SS Types -.TP -.BR int -an integer number -.TP -.BR bool -a boolean value, yes/true or no/false -.TP -.BR str -a string, some freeform text -.TP -.BR coord -a line, column pair (separated by comma) -.TP -.BR regex -as a string but the set commands will complain if the entered text is not a valid regex -.TP -.BR int-list,\ str-list -a list, elements are separated by a colon (:) if an element needs to contain a colon, it can be escaped with a backslash -.TP -.BR enum(value1|value2|…) -an enum, taking one of the given values -.TP -.BR flags(value1|value2|…) -a set of flags, taking a combination of the given values joined by a '|' character +NAME +---- +options - a -.SS Scopes -.TP -.BR window -context linked to the window displaying a buffer -.TP -.BR buffer -context linked directly to the buffer -.TP -.BR global -global context linked to the instance of Kakoune -.RE +Types +----- +*int*:: + an integer number +*bool*:: + a boolean value, yes/true or no/false +*str*:: + a string, some freeform text +*coord*:: + a line, column pair (separated by comma) +*regex*:: + as a string but the set commands will complain if the entered text is not a valid regex +*int-list*, *str-list*:: + a list, elements are separated by a colon (:) if an element needs to contain a colon, it can be escaped + with a backslash +*enum(value1|value2|...)*:: + an enum, taking one of the given values +*flags(value1|value2|...)*:: + a set of flags, taking a combination of the given values joined by a '|' character -Options can have individual values that change from one scope to the other, which will be considered one after another in the following order: -.IR window " → " -.IR buffer " → " -.IR global "." -That means that two windows on the same buffer can use different options (e.g. different -.IR filetype ")." +Scopes +------ +*window*:: + context linked to the window displaying a buffer +*buffer*:: + context linked directly to the buffer +*global*:: + global context linked to the instance of Kakoune + +Options can have individual values that change from one scope to the other, which will be considered one after +another in the following order: *window* → *buffer* → *global*. +That means that two windows on the same buffer can use different options (e.g. different *filetype*). However some options might end up being ignored if their scope is not in the command context. -For example, writing a file never uses the -.IR window -scope when considering options, so any option related to writing won't be taken into account if set in the -.IR window -scope (e.g. -.IR BOM ", " -.IR eolformat ")." +For example, writing a file never uses the *window* scope when considering options, so any option related to +writing won't be taken into account if set in the *window* scope (e.g. *BOM*, *eolformat*). -.SS Builtin options -.TP -.BR tabstop -.IR int -width of a tab character -.TP -.BR indentwidth -.IR int -width (in spaces) used for indentation, 0 means a tab character -.TP -.BR scrolloff -.IR coord -number of lines, columns to keep visible around the cursor when scrolling -.TP -.BR eolformat -.IR enum(lf|crlf) -the format of end of lines when writing a buffer, this is autodetected on load -.TP -.BR BOM -.IR enum(none|utf8) -define if the file should be written with an unicode byte order mark -.TP -.BR complete_prefix -.IR bool -when completing in command line, and multiple candidates exist, enable completion with common prefix -.TP -.BR incsearch -.IR bool -execute search as it is typed -.TP -.BR aligntab -.IR bool -use tabs for alignement command -.TP -.BR autoinfo -.IR flags(command|onkey|normal) -display automatic information box in the enabled contexts -.TP -.BR autoshowcompl -.IR bool -automatically display possible completions when editing a prompt -.TP -.BR ignored_files -.IR regex -filenames matching this regex wont be considered as candidates on filename completion (except if the text being completed already matches it) -.TP -.BR disabled_hooks -.IR regex -hooks whose group matches this regex wont be executed. For example indentation hooks can be disabled with '.*-indent' -.TP -.BR filetype -.IR str -arbitrary string defining the type of the file filetype dependant actions should hook on this option changing for activation/deactivation -.TP -.BR path -.IR str-list -directories to search for gf command -.TP -.BR completers -.IR str-list -completion engines to use for insert mode completion (they are tried in order until one generates candidates). Existing completers are: -.TP -.BR word=all,\ word=buffer -which complete using words in all buffers ( -.IR word=all " )" -or only the current one ( -.IR word=buffer " )" -.TP -.BR filename -which tries to detect when a filename is being entered and provides completion based on local filesystem -.TP -.BR option= -where -.IR -is a -.IR str-list -option. The first element of the list should follow the format: -.IR .[+]@ -to define where the completion apply in the buffer, and the other strings are the candidates -.TP -.BR static_words -.IR str-list -list of words that are always added to completion candidates when completing words in insert mode -.TP -.BR autoreload -.IR enum(yes|no|ask) -auto reload the buffers when an external modification is detected -.TP -.BR debug -.IR flags(hooks|shell|profile) -dump various debug information in the `*debug*` buffer -.TP -.BR modelinefmt -.IR string -A format string used to generate the mode line, that string is first expanded as a command line would be (expanding -.IR %...{...} -strings), then markup tags are applied (c.f. Expansions documentation page) -.TP -.BR ui_options -colon separated list of key=value pairs that are forwarded to the user interface implementation. The NCurses UI support the following options: +Builtin options +--------------- -.RS 7 -.BR ncurses_set_title -if -.IR yes -or -.IR true "," -the terminal emulator title will be changed -.TP -.BR ncurses_status_on_top -if -.IR yes "," -or -.IR true -the status line will be placed at the top of the terminal rather than at the bottom -.TP -.BR ncurses_assistant -specify the nice assistant you get in info boxes, can be -.IR clippy -(the default), -.IR cat -or -.IR none -.TP -.BR ncurses_wheel_down_button,\ ncurses_wheel_up_button -specify which button send for wheel down/up events +*tabstop* 'int':: + width of a tab character + +*indentwidth* 'int':: + width (in spaces) used for indentation, 0 means a tab character + +*scrolloff* 'coord':: + number of lines, columns to keep visible around the cursor when scrolling + +*eolformat* 'enum(lf|crlf)':: + the format of end of lines when writing a buffer, this is autodetected on load + +*BOM* 'enum(none|utf8)':: + define if the file should be written with an unicode byte order mark + +*complete_prefix* 'bool':: + when completing in command line, and multiple candidates exist, enable completion with common prefix + +*incsearch* 'bool':: + execute search as it is typed + +*aligntab* 'bool':: + use tabs for alignement command + +*autoinfo* 'flags(command|onkey|normal)':: + display automatic information box in the enabled contexts + +*autoshowcompl* 'bool':: + automatically display possible completions when editing a prompt + +*ignored_files* 'regex':: + filenames matching this regex wont be considered as candidates on filename completion (except if the text + being completed already matches it) + +*disabled_hooks* 'regex':: + hooks whose group matches this regex wont be executed. For example indentation hooks can be disabled with '.*-indent' + +*filetype* 'str':: + arbitrary string defining the type of the file filetype dependant actions should hook on this option + changing for activation/deactivation + +*path* 'str-list':: + directories to search for gf command + +*completers* 'str-list':: + completion engines to use for insert mode completion (they are tried in order until one generates + candidates). Existing completers are: + + *word=all*, *word=buffer*::: + which complete using words in all buffers (*word=all*) or only the current one (*word=buffer*) + + *filename*::: + which tries to detect when a filename is being entered and provides completion based on local filesystem + + *option=*::: + where *opt-name* is a 'str-list' option. The first element of the list should follow the format: + + .[+]@ + + to define where the completion apply in the buffer, and the other strings are the candidates + + *static_words* 'str-list'::: + list of words that are always added to completion candidates when completing words in insert mode + +*autoreload* 'enum(yes|no|ask)':: + auto reload the buffers when an external modification is detected + +*debug* 'flags(hooks|shell|profile)':: + dump various debug information in the '\*debug*' buffer + +*modelinefmt* 'string':: + A format string used to generate the mode line, that string is first expanded as a command line would be + (expanding '%...{...}' strings), then markup tags are applied (c.f. the 'Expansions' documentation page) + +*ui_options*:: + colon separated list of key=value pairs that are forwarded to the user interface implementation. The + NCurses UI support the following options: + + *ncurses_set_title*::: + if *yes* or *true*, the terminal emulator title will be changed + + *ncurses_status_on_top*::: + if *yes*, or *true* the status line will be placed at the top of the terminal rather than at the bottom + + *ncurses_assistant*::: + specify the nice assistant you get in info boxes, can be *clippy* (the default), *cat* or *none* + + *ncurses_wheel_down_button*, *ncurses_wheel_up_button*::: + specify which button send for wheel down/up events diff --git a/doc/manpages/registers b/doc/manpages/registers index 3f2c8e81..445c8476 100644 --- a/doc/manpages/registers +++ b/doc/manpages/registers @@ -1,56 +1,49 @@ -.TH KAKOUNE 1 "" "" "REGISTERS" +KAKOUNE(1) +========== -.SS Registers -.TP -Registers are named lists of text -instead of simply text- in order to interact well with multiselection. \ -They are used for various purposes, like storing the last yanked test, or the captured groups associated with the selections. +NAME +---- +registers - a -.SS Interacting -.TP -.BR -when in insert mode or in a prompt, insert the value stored in the -.IR -register (single character) -.TP -.BR """ -in normal mode, select the -.IR -register (single character) +Description +----------- +Registers are named lists of text -instead of simply text- in order to interact well with multiselection. +They are used for various purposes, like storing the last yanked test, or the captured groups associated with +the selections. -.SS Default registers -.TP +Interacting +----------- +**:: + when in insert mode or in a prompt, insert the value stored in the *c* register (single character) + +*"*:: + in normal mode, select the ** register (single character) + +Default registers +----------------- Most commands using a register default to a specific one if not specified: -.RS 7 -.TP -.BR """ -default yank, used by yanking and pasting commands like -.IR y ", " p " and " R -.TP -.BR / -default search register, used by regex based commands like -.IR s ", " * " or " / -.TP -.BR @ -default macro register, used by -.IR q " and " Q -.TP -.BR ^ -default mark register, used by -.IR z " and " Z +*"*:: + default yank, used by yanking and pasting commands like *y*, *p* and *R* -.SS Special registers -.TP +*/*:: + default search register, used by regex based commands like *s*, *\** or */* + +*@*:: + default macro register, used by *q* and *Q* + +*^*:: + default mark register, used by *z* and *Z* + +Special registers +----------------- Some registers are not general purposes, they cannot be written to, but they contain some special dat -.RS 7 -.TP -.BR % -current buffer name -.TP -.BR . -current selection contents -.TP -.BR # -selection indices (first selection has 1, second has 2, …) -.RE +*%*:: + current buffer name + +*.*:: + current selection contents + +*#*:: + selection indices (first selection has 1, second has 2, ...) diff --git a/doc/manpages/shortcuts b/doc/manpages/shortcuts index 40c878a5..b47f5a94 100644 --- a/doc/manpages/shortcuts +++ b/doc/manpages/shortcuts @@ -1,580 +1,578 @@ -.TH KAKOUNE 1 "" "" "SHORTCUTS" +KAKOUNE(1) +========== -.SS Insert mode -.TP -.BR -leave insert mode -.TP -.BR -delete characters before cursors -.TP -.BR -delete characters under cursors -.TP -.BR ,\ ,\ ,\ -move the cursors in given direction -.TP -.BR -move cursors to line begin -.TP -.BR -move cursors to end of line -.TP -.BR -select next completion candidate -.TP -.BR -select previous completion candidate -.TP -.BR -explicit insert completion query, followed by: -.RS 7 -.TP -.BR f -explicit file completion -.TP -.BR w -explicit word completion -.TP -.BR l -explicit line completion -.RE -.TP -.BR -disable automatic completion for this insert session -.TP -.BR -insert contents of the register given by next key -.TP -.BR -insert next keystroke directly into the buffer, without interpreting it -.TP -.BR -commit changes up to now as a single undo group -.TP -.BR -escape to normal mode for a single command +NAME +---- +shortcuts - a -.SS Movement -"word" is a sequence of alphanumeric characters or underscore, and "WORD" is a sequence of non whitespace characters +Insert mode +----------- +**:: + leave insert mode -.TP -.BR h -select the character on the left of selection end -.TP -.BR j -select the character below the selection end -.TP -.BR k -select the character above the selection end -.TP -.BR l -select the character on the right of selection end -.TP -.BR w -select the word and following whitespaces on the right of selection end -.TP -.BR b -select preceding whitespaces and the word on the left of selection end -.TP -.BR e -select preceding whitespaces and the word on the right of selection end -.TP -.BR -same as [wbe] but select WORD instead of word -.TP -.BR f -select to the next occurence of given character -.TP -.BR t -select until the next occurence of given character -.TP -.BR -same as [ft] but in the other direction -.TP -.BR m -select to matching character -.TP -.BR M -extend selection to matching character -.TP -.BR x -select line on which selection end lies (or next line when end lies on an end-of-line) -.TP -.BR -expand selections to contain full lines (including end-of-lines) -.TP -.BR -trim selections to only contain full lines (not including last end-of-line) -.TP -.BR % -select whole buffer -.TP -.BR -select to line begin -.TP -.BR -select to line end -.TP -.BR / -search (select next match) -.TP -.BR -search (select previous match) -.TP -.BR ? -search (extend to next match) -.TP -.BR -search (extend to previous match) -.TP -.BR n -select next match -.TP -.BR N -add a new selection with next match -.TP -.BR -select previous match -.TP -.BR -add a new selection with previous match -.TP -.BR pageup -scroll up -.TP -.BR pagedown -scroll down -.TP -.BR ' -rotate selections (the main selection becomes the next one) -.TP -.BR ; -reduce selections to their cursor -.TP -.BR -flip the selections direction -.TP -.BR -ensure selections are in forward direction (cursor after anchor) +**:: + delete characters before cursors -.SS Changes -.TP -.BR i -enter insert mode before current selection -.TP -.BR a -enter insert mode after current selection -.TP -.BR d -yank and delete current selection -.TP -.BR c -yank and delete current selection and enter insert mode -.TP -.BR . -repeat last insert mode change (`i`, `a`, or `c, including the inserted text) -.TP -.BR I -enter insert mode at current selection begin line start -.TP -.BR A -enter insert mode at current selection end line end -.TP -.BR o -enter insert mode in a new line below current selection end -.TP -.BR O -enter insert mode in a new line above current selection begin -.TP -.BR y -yank selections -.TP -.BR p -paste after current selection end -.TP -.BR P -paste before current selection begin -.TP -.BR -paste all after current selection end, and select each pasted string -.TP -.BR -paste all before current selection begin, and select each pasted string -.TP -.BR R -replace current selection with yanked text -.TP -.BR r -replace each character with the next entered one -.TP -.BR -join selected lines -.TP -.BR -join selected lines and select spaces inserted in place of line breaks -.TP -.BR > -indent selected lines -.TP -.BR > -indent selected lines, including empty lines -.TP -.BR < -deindent selected lines -.TP -.BR -deindent selected lines, do not remove incomplete indent (3 leading spaces when indent is 4) -.TP -.BR ! -insert command output before selection -.TP -.BR a-! -append command output after selection -.TP -.BR u -undo last change -.TP -.BR U -redo last change -.TP -.BR & -align selection, align the cursor of selections by inserting spaces before the first character of the selection -.TP -.BR -copy indent, copy the indentation of the main selection (or the count one if a count is given) to all other ones -.TP -.BR ` -to lower case -.TP -.BR ~ -to upper case -.TP -.BR -swap case -.TP -.BR @ -convert tabs to spaces in current selections, uses the buffer tabstop option or the count parameter for tabstop -.TP -.BR -convert spaces to tabs in current selections, uses the buffer tabstop option or the count parameter for tabstop -.TP -.BR -rotate selections content, if specified, the count groups selections, so -.IR 3 -rotate (1, 2, 3) and (3, 4, 6) independently +**:: + delete characters under cursors -.SS Goto Commands -If a count is given prior to hitting `g`, `g` will jump to the given line +**, **, **, **:: + move the cursors in given direction -.TP -.BR gh -select to line begin -.TP -.BR gl -select to line end -.TP -.BR gg,\ gk -go to the first line -.TP -.BR gj -go to the last line -.TP -.BR ge -go to last char of last line -.TP -.BR gt -go to the first displayed line -.TP -.BR gc -go to the middle displayed line -.TP -.BR gb -go to the last displayed line -.TP -.BR ga -go to the previous (alternate) buffer -.TP -.BR gf -open the file whose name is selected -.TP -.BR g. -go to last buffer modifiction position +**:: + move cursors to line begin -.SS View commands -.TP -.BR V -lock view mode until is hit -.TP -.BR vv,\ vc -center the main selection in the window -.TP -.BR vt -scroll to put the main selection on the top line of the window -.TP -.BR vb -scroll to put the main selection on the bottom line of the window -.TP -.BR vh -scroll the window count columns left -.TP -.BR vj -scroll the window count line downward -.TP -.BR vk -scroll the window count line upward -.TP -.BR vl -scroll the window count columns right +**:: + move cursors to end of line + +**:: + select next completion candidate + +**:: + select previous completion candidate + +**:: + explicit insert completion query, followed by: + + *f*::: + explicit file completion + + *w*::: + explicit word completion + + *l*::: + explicit line completion + +**:: + disable automatic completion for this insert session + +**:: + insert contents of the register given by next key + +**:: + insert next keystroke directly into the buffer, without interpreting it + +**:: + commit changes up to now as a single undo group + +**:: + escape to normal mode for a single command + +Movement +-------- +'word' is a sequence of alphanumeric characters or underscore, and 'WORD' is a sequence of non whitespace characters + +*h*:: + select the character on the left of selection end + +*j*:: + select the character below the selection end + +*k*:: + select the character above the selection end + +*l*:: + select the character on the right of selection end + +*w*:: + select the word and following whitespaces on the right of selection end + +*b*:: + select preceding whitespaces and the word on the left of selection end + +*e*:: + select preceding whitespaces and the word on the right of selection end + +**:: + same as [wbe] but select WORD instead of word + +*f*:: + select to the next occurence of given character + +*t*:: + select until the next occurence of given character + +**:: + same as [ft] but in the other direction + +*m*:: + select to matching character + +*M*:: + extend selection to matching character + +*x*:: + select line on which selection end lies (or next line when end lies on an end-of-line) + +**:: + expand selections to contain full lines (including end-of-lines) + +**:: + trim selections to only contain full lines (not including last end-of-line) + +*%*:: + select whole buffer + +**:: + select to line begin + +**:: + select to line end + +*/*:: + search (select next match) + +**:: + search (select previous match) + +*?*:: + search (extend to next match) + +**:: + search (extend to previous match) + +*n*:: + select next match + +*N*:: + add a new selection with next match + +**:: + select previous match + +**:: + add a new selection with previous match + +*pageup*:: + scroll up + +*pagedown*:: + scroll down + +*'*:: + rotate selections (the main selection becomes the next one) + +*;*:: + reduce selections to their cursor + +**:: + flip the selections direction + +**:: + ensure selections are in forward direction (cursor after anchor) + +Changes +------- + +*i*:: + enter insert mode before current selection + +*a*:: + enter insert mode after current selection + +*d*:: + yank and delete current selection + +*c*:: + yank and delete current selection and enter insert mode + +*.*:: + repeat last insert mode change (*i*, *a*, or *c*, including the inserted text) + +*I*:: + enter insert mode at current selection begin line start + +*A*:: + enter insert mode at current selection end line end + +*o*:: + enter insert mode in a new line below current selection end + +*O*:: + enter insert mode in a new line above current selection begin + +*y*:: + yank selections + +*p*:: + paste after current selection end + +*P*:: + paste before current selection begin + +**:: + paste all after current selection end, and select each pasted string + +**:: + paste all before current selection begin, and select each pasted string + +*R*:: + replace current selection with yanked text + +*r*:: + replace each character with the next entered one + +**:: + join selected lines + +**:: + join selected lines and select spaces inserted in place of line breaks + +*>*:: + indent selected lines + +*>*:: + indent selected lines, including empty lines + +*<*:: + deindent selected lines + +**:: + deindent selected lines, do not remove incomplete indent (3 leading spaces when indent is 4) + +*!*:: + insert command output before selection + +*a-!*:: + append command output after selection + +*u*:: + undo last change + +*U*:: + redo last change + +*&*:: + align selection, align the cursor of selections by inserting spaces before the first character of the selection + +**:: + copy indent, copy the indentation of the main selection (or the count one if a count is given) to all other ones + +*`*:: + to lower case + +*~*:: + to upper case + +**:: + swap case + +*@*:: + convert tabs to spaces in current selections, uses the buffer tabstop option or the count parameter for tabstop + +**:: + convert spaces to tabs in current selections, uses the buffer tabstop option or the count parameter for tabstop + +**:: + rotate selections content, if specified, the count groups selections, so the following command + + 3 + + rotate (1, 2, 3) and (3, 4, 6) independently + +Goto Commands +------------- +If a count is given prior to hitting *g*, *g* will jump to the given line + +*gh*:: + select to line begin + +*gl*:: + select to line end + +*gg*, *gk*:: + go to the first line + +*gj*:: + go to the last line + +*ge*:: + go to last char of last line + +*gt*:: + go to the first displayed line + +*gc*:: + go to the middle displayed line + +*gb*:: + go to the last displayed line + +*ga*:: + go to the previous (alternate) buffer + +*gf*:: + open the file whose name is selected + +*g.*:: + go to last buffer modifiction position + +View commands +------------- + +*V*:: + lock view mode until is hit + +*vv*, *vc*:: + center the main selection in the window + +*vt*:: + scroll to put the main selection on the top line of the window + +*vb*:: + scroll to put the main selection on the bottom line of the window + +*vh*:: + scroll the window count columns left + +*vj*:: + scroll the window count line downward + +*vk*:: + scroll the window count line upward + +*vl*:: + scroll the window count columns right -.SS Marks -Marks use the -.IR ^ -register by default -.TP -.BR Z -will save the current selections to the register -.TP -.BR z -will restore the selections from the register -.TP -.BR -will add the selections from the register to the existing ones +Marks +----- +Marks use the *^* register by default. -.SS Macros -Macros use the -.IR @ -register by default -.TP -.BR Q -record a macro -.TP -.BR q -play a recorded macro +*Z*:: + will save the current selections to the register -.SS Searching -Searches use the -.IR / -register by default -.TP -.BR * -set the search pattern to the current selection (automatically detects word boundaries) -.TP -.BR -set the search pattern to the current selection (verbatim, no smart detection) +*z*:: + will restore the selections from the register -.SS Jump list -.TP -.BR -Jump forward -.TP -.BR -Jump backward -.TP -.BR -save current selections +**:: + will add the selections from the register to the existing ones -.SS Multiple selections -.TP -.BR s -create a selection -.TP -.BR -split the current selections on line boundaries -.TP -.BR S -split the current selection -.TP -.BR C -copy the current selection to the next line -.TP -.BR -copy the current selection to the previous line -.TP -.BR -clear a multiple selection -.TP -.BR -clear the current selection -.TP -.BR -keep the selections that match the given regex -.TP -.BR -clear selections that match the given regex -.TP -.BR | -pipe each selection through the given external filter program and replace the selection with its output -.TP -.BR -pipe each selection through the given external filter program and ignore its output -.TP -.BR $ -pipe each selection to the given shell command +Macros +------ +Macros use the *@* register by default -.SS Object Selection -.TP -.BR -selects the whole object -.TP -.BR -selects the inner object, that is the object excluding it's surrounder -.TP -.BR [ -selects to object start -.TP -.BR ] -selects to object end -.TP -.BR { -extends selections to object start -.TP -.BR } -extends selections to object end +*Q*:: + record a macro + +*q*:: + play a recorded macro + +Searching +--------- +Searches use the */* register by default + +***:: + set the search pattern to the current selection (automatically detects word boundaries) + +**:: + set the search pattern to the current selection (verbatim, no smart detection) + +Jump list +--------- + +**:: + Jump forward + +**:: + Jump backward + +**:: + save current selections + +Multiple selections +------------------- + +*s*:: + create a selection + +**:: + split the current selections on line boundaries + +*S*:: + split the current selection + +*C*:: + copy the current selection to the next line + +**:: + copy the current selection to the previous line + +**:: + clear a multiple selection + +**:: + clear the current selection + +**:: + keep the selections that match the given regex + +**:: + clear selections that match the given regex + +*|*:: + pipe each selection through the given external filter program and replace the selection with its output + +**:: + pipe each selection through the given external filter program and ignore its output + +*$*:: + pipe each selection to the given shell command + +Object Selection +---------------- + +**:: + selects the whole object + +**:: + selects the inner object, that is the object excluding it's surrounder + +*[*:: + selects to object start + +*]*:: + selects to object end + +*{*:: + extends selections to object start + +*}*:: + extends selections to object end .RE After this key, you need to enter a second key in order to specify which object you want -.TP -.BR b,\ (,\ ) -select the enclosing parenthesis -.TP -.BR B,\ {,\ } -select the enclosing {} block -.TP -.BR r,\ [,\ ] -select the enclosing [] block -.TP -.BR a,\ <,\ > -select the enclosing <> block -.TP -.BR " -select the enclosing double quoted string -.TP -.BR ' -select the enclosing single quoted string -.TP -.BR ` -select the enclosing grave quoted string -.TP -.BR w -select the whole word -.TP -.BR W -select the whole WORD -.TP -.BR s -select the sentence -.TP -.BR p -select the paragraph -.TP -.BR ␣ -select the whitespaces -.TP -.BR i -select the current indentation block -.TP -.BR n -select the number -.TP -.BR : -select user defined object, will prompt for open and close text -.SS Prompt Commands -.TP -.BR -validate prompt -.TP -.BR -abandon without -.TP -.BR ,\ -move cursor to previous character -.TP -.BR ,\ -move cursor to previous character -.TP -.BR -move cursor to first character -.TP -.BR -move cursor to passed last character -.TP -.BR ,\ -erase character before cursor -.TP -.BR ,\ -erase character under cursor -.TP -.BR -avance to next word begin -.TP -.BR -advance to next WORD begin -.TP -.BR -go back to previous word begin -.TP -.BR -go back to previous WORD begin -.TP -.BR -advance to next word end -.TP -.BR -advance to next word end -.TP -.BR ,\ -select previous entry in history -.TP -.BR ,\ -select next entry in history -.TP -.BR -select next completion candidate -.TP -.BR -select previous completion candidate -.TP -.BR -insert then content of the register given by next key -.TP -.BR -insert next keystroke without interpretting it -.TP -.BR -disable auto completion for this prompt +*b*, *(*, *)*:: + select the enclosing parenthesis -.SS Key mapping +*B*, *{*, *}*:: + select the enclosing {} block + +*r*, *[*, *]*:: + select the enclosing [] block + +*a*, *<*, *>*:: + select the enclosing <> block + +*"*:: + select the enclosing double quoted string + +*'*:: + select the enclosing single quoted string + +*`*:: + select the enclosing grave quoted string + +*w*:: + select the whole word + +*W*:: + select the whole WORD + +*s*:: + select the sentence + +*p*:: + select the paragraph + +*␣*:: + select the whitespaces + +*i*:: + select the current indentation block + +*n*:: + select the number + +*:*:: + select user defined object, will prompt for open and close text + +Prompt Commands +--------------- + +**:: + validate prompt + +**:: + abandon without + +**, **:: + move cursor to previous character + +**, **:: + move cursor to previous character + +**:: + move cursor to first character + +**:: + move cursor to passed last character + +**, **:: + erase character before cursor + +**, **:: + erase character under cursor + +**:: + avance to next word begin + +**:: + advance to next WORD begin + +**:: + go back to previous word begin + +**:: + go back to previous WORD begin + +**:: + advance to next word end + +**:: + advance to next word end + +**, **:: + select previous entry in history + +**, **:: + select next entry in history + +**:: + select next completion candidate + +**:: + select previous completion candidate + +**:: + insert then content of the register given by next key + +**:: + insert next keystroke without interpretting it + +**:: + disable auto completion for this prompt + +Key mapping +----------- Mapping a combination of keys to another one (a.k.a. key mapping or binding) can be done with the following command: -.TP -.BR map " " -.RS 3 -.TP -.BR scope -can be one of -.IR global ", " window " or " buffer -.TP -.BR mode -can be one of -.IR insert ", " normal ", " prompt ", " menu ", " user -or a one character long arbitrary prefix (the -.IR user -mode uses the -.IR , -prefix) -.TP -.BR key -the key to which the combination will be bound -.TP -.BR keys -string that lists the keys that will be executed when -.IR key -is hit -.RE +------------------------------- +map +------------------------------- -Keys are always executed within the -.IR normal -mode +*scope*:: + can be one of *global*, *window* or *buffer* + +*mode*:: + can be one of *insert*, *normal*, *prompt*, *menu*, *user* or a one character long arbitrary prefix (the + *user* mode uses the *,* prefix) + +*key*:: + the key to which the combination will be bound + +*keys*:: + string that lists the keys that will be executed when *key* is hit + +Keys are always executed within the *normal* mode. From 79abe585999024f866a6a1b236ff31fee71e72d6 Mon Sep 17 00:00:00 2001 From: Frank LENORMAND Date: Wed, 3 Feb 2016 21:09:17 +0200 Subject: [PATCH 7/8] Fix the pattern detection regex, take compression into account when suggesting doc pages --- rc/doc.kak | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/rc/doc.kak b/rc/doc.kak index 41c341f2..97811145 100644 --- a/rc/doc.kak +++ b/rc/doc.kak @@ -21,7 +21,7 @@ def -hidden -params 1..2 _doc-open %{ " if [ $# -gt 1 ]; then - echo "try %{ exec '%^\s+\S*\Q${2}\E\'' } catch %{ exec gg }" + echo "try %{ exec '%(?i)^\h+[^\n]*?\Q${2}\E\'' } catch %{ exec gg }" fi else echo "echo -color Error %{doc '$@' failed: see *debug* buffer for details}" @@ -32,11 +32,13 @@ def -hidden -params 1..2 _doc-open %{ def -params 1..2 \ -shell-completion %{ - find "${kak_opt_doc_path}" -type f -iname "*$@*" -printf '%f\n' + find "${kak_opt_doc_path}" -type f -iname "*$@*.gz" -printf '%f\n' | while read l; do + echo "${l%.*}" + done } \ doc -docstring "Open a buffer containing the documentation about a given subject" %{ %sh{ - readonly PATH_DOC="${kak_opt_doc_path}/${1}" + readonly PATH_DOC="${kak_opt_doc_path}/${1}.gz" shift if [ ! -f "${PATH_DOC}" ]; then From 985b7a188ad3a9b325eb50f4bee437c9263845f7 Mon Sep 17 00:00:00 2001 From: Frank LENORMAND Date: Wed, 3 Feb 2016 21:09:41 +0200 Subject: [PATCH 8/8] Generate the documentation pages in the troff format This commit introduces the `doc` target in the Makefile, which generates man pages from the `asciidoc`-formatted documentation in the `doc/manpages` directory. Before being installed into the `$(sharedir)/doc` directory, the generated raw man pages have to be striped of a few sections without which `a2x` won't convert the `asciidoc` data: the shady block of shell script in the `doc` target does just that, along with compressing the resulting man page. New dependency hereby introduced: `asciidoc`. --- src/Makefile | 30 ++++++++++++++++++++++++++---- 1 file changed, 26 insertions(+), 4 deletions(-) diff --git a/src/Makefile b/src/Makefile index 11b1fd36..c0de3aa7 100644 --- a/src/Makefile +++ b/src/Makefile @@ -20,6 +20,15 @@ endif sources := $(wildcard *.cc) objects := $(addprefix ., $(sources:.cc=$(suffix).o)) deps := $(addprefix ., $(sources:.cc=$(suffix).d)) +docs := commands \ + execeval \ + expansions \ + faces \ + highlighters \ + hooks \ + options \ + registers \ + shortcuts \ PREFIX ?= /usr/local DESTDIR ?= # root dir @@ -63,20 +72,33 @@ kak : $(objects) .%$(suffix).o: %.cc $(CXX) $(CPPFLAGS) $(CXXFLAGS) -MD -MP -MF $(addprefix ., $(<:.cc=$(suffix).d)) -c -o $@ $< +%.1: % + a2x -f manpage $< +%.1.gz: %.1.txt + a2x -f manpage $< + gzip -f $(basename $<) + test: cd ../test && ./run tags: ctags -R -man: ../doc/kakoune.1.txt - a2x -f manpage $< - gzip -fk $(basename $<) + +man: ../doc/kakoune.1.gz +doc: $(addsuffix .1,$(addprefix ../doc/manpages/,$(docs))) + @for f in $^; do \ + pagename="$${f##*/}"; pagename="$${pagename%.*}"; \ + sed -i -r -e "s,^\.TH .+,.TH KAKOUNE 1 \"\" \"\" \"$${pagename^^}\"," \ + -e "/^\.SH \"NAME\"/,+1d" $$f; \ + gzip -f "$$f"; \ + mv "$${f}.gz" "$${f/.1/}.gz"; \ + done clean: rm -f .*.o .*.d kak tags XDG_CONFIG_HOME ?= $(HOME)/.config -install: kak man +install: kak man doc mkdir -p $(bindir) install -m 0755 kak $(bindir) mkdir -p $(sharedir)/rc