2016-02-03 18:15:35 +01:00
|
|
|
KAKOUNE(1)
|
|
|
|
==========
|
|
|
|
|
|
|
|
NAME
|
|
|
|
----
|
|
|
|
hooks - a
|
|
|
|
|
|
|
|
Description
|
|
|
|
-----------
|
2016-02-02 20:15:12 +01:00
|
|
|
|
2016-04-08 18:00:24 +02:00
|
|
|
Commands can be registered to be executed when certain events arise. To
|
2016-02-10 22:03:49 +01:00
|
|
|
register a hook use the following command:
|
2016-02-02 20:15:12 +01:00
|
|
|
|
2016-02-03 18:15:35 +01:00
|
|
|
----------------------------------------------------------------------
|
|
|
|
hook [-group <group>] <scope> <hook_name> <filtering_regex> <commands>
|
|
|
|
----------------------------------------------------------------------
|
2016-02-02 20:15:12 +01:00
|
|
|
|
2016-02-03 18:15:35 +01:00
|
|
|
*scope* can be one of *global*, *buffer* or *window*.
|
2016-02-02 20:15:12 +01:00
|
|
|
|
2016-02-10 22:03:49 +01:00
|
|
|
*command* is a string containing the commands to execute when the hook
|
|
|
|
is called.
|
2016-02-02 20:15:12 +01:00
|
|
|
|
2016-02-10 22:03:49 +01:00
|
|
|
For example to automatically use line numbering with .cc files, use the
|
|
|
|
following command:
|
2016-02-02 20:15:12 +01:00
|
|
|
|
2016-02-03 18:15:35 +01:00
|
|
|
----------------------------------------------------
|
|
|
|
hook global WinCreate .*\.cc %{ addhl number_lines }
|
|
|
|
----------------------------------------------------
|
|
|
|
|
2016-02-10 22:03:49 +01:00
|
|
|
if *group* is given, make this hook part of the named group. Groups are used
|
|
|
|
for removing hooks with the following command:
|
2016-02-03 18:15:35 +01:00
|
|
|
|
|
|
|
-----------------------
|
|
|
|
rmhooks <scope> <group>
|
|
|
|
-----------------------
|
|
|
|
|
2016-02-10 22:03:49 +01:00
|
|
|
A call to the command above will remove every hooks in *scope* that are part
|
|
|
|
of the given *group*.
|
2016-02-03 18:15:35 +01:00
|
|
|
|
|
|
|
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*::
|
2016-02-10 22:03:49 +01:00
|
|
|
the cursor moved (without inserting) in insert mode, the key that
|
|
|
|
triggered the move is used for filtering
|
2016-02-03 18:15:35 +01:00
|
|
|
|
|
|
|
*WinCreate*::
|
|
|
|
a window was created, the filtering text is the buffer name
|
|
|
|
|
|
|
|
*WinClose*::
|
2016-04-08 18:00:24 +02:00
|
|
|
a window was destroyed, the filtering text is the buffer name
|
2016-02-03 18:15:35 +01:00
|
|
|
|
2016-05-13 10:33:11 +02:00
|
|
|
*WinResize*::
|
|
|
|
a window resized, the filtering text is *<line>.<column>*
|
|
|
|
|
2016-02-03 18:15:35 +01:00
|
|
|
*WinDisplay*::
|
|
|
|
a window was bound a client, the filtering text is the buffer name
|
|
|
|
|
|
|
|
*WinSetOption*::
|
2016-02-10 22:03:49 +01:00
|
|
|
an option was set in a window context, the filtering text is
|
|
|
|
*<option_name>=<new_value>*
|
2016-02-03 18:15:35 +01:00
|
|
|
|
|
|
|
*BufSetOption*::
|
2016-02-10 22:03:49 +01:00
|
|
|
an option was set in a buffer context, the filtering text is
|
|
|
|
*<option_name>=<new_value>*
|
2016-02-03 18:15:35 +01:00
|
|
|
|
|
|
|
*BufNew*::
|
2016-02-10 22:03:49 +01:00
|
|
|
a buffer for a new file has been created, filename is used for
|
|
|
|
filtering
|
2016-02-03 18:15:35 +01:00
|
|
|
|
|
|
|
*BufOpen*::
|
2016-02-10 22:03:49 +01:00
|
|
|
a buffer for an existing file has been created, filename is used
|
|
|
|
for filtering
|
2016-02-03 18:15:35 +01:00
|
|
|
|
|
|
|
*BufCreate*::
|
|
|
|
a buffer has been created, filename is used for filtering
|
|
|
|
|
|
|
|
*BufWritePre*::
|
2016-02-10 22:03:49 +01:00
|
|
|
executed just before a buffer is written, filename is used for
|
|
|
|
filtering
|
2016-02-03 18:15:35 +01:00
|
|
|
|
|
|
|
*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*::
|
2016-02-10 22:03:49 +01:00
|
|
|
executed after some data has been red from a fifo and inserted in
|
|
|
|
the buffer
|
2016-02-03 18:15:35 +01:00
|
|
|
|
|
|
|
*BufCloseFifo*::
|
2016-02-10 22:03:49 +01:00
|
|
|
executed when a fifo buffer closes its fifo file descriptor either
|
|
|
|
because the buffer is being deleted,
|
2016-02-03 18:15:35 +01:00
|
|
|
or because the writing end has been closed
|
|
|
|
|
|
|
|
*RuntimeError*::
|
2016-02-10 22:03:49 +01:00
|
|
|
an error was encountered while executing an user command the error
|
|
|
|
message is used for filtering
|
2016-02-03 18:15:35 +01:00
|
|
|
|
|
|
|
*KakBegin*::
|
2016-02-10 22:03:49 +01:00
|
|
|
kakoune has started, this hook is called just after reading the user
|
|
|
|
configuration files
|
2016-02-03 18:15:35 +01:00
|
|
|
|
|
|
|
*KakEnd*::
|
|
|
|
kakoune is quitting
|
|
|
|
|
|
|
|
*FocusIn*::
|
2016-02-10 22:03:49 +01:00
|
|
|
on supported clients, triggered when the client gets focused. the
|
|
|
|
filtering text is the client name
|
2016-02-03 18:15:35 +01:00
|
|
|
|
|
|
|
*FocusOut*::
|
2016-02-10 22:03:49 +01:00
|
|
|
on supported clients, triggered when the client gets unfocused. the
|
|
|
|
filtering text is the client name
|
2016-02-02 20:15:12 +01:00
|
|
|
|
|
|
|
When not specified, the filtering text is an empty string.
|