= Commands Some commands take an exclamation mark (*!*), which can be used to force the execution of the command (i.e. to quit a modified buffer, the command *q!* has to be used). Aliases are mentioned below each command. *doc* :: *alias* help + display documentation about a topic. The completion list displays the available topics == Files and Buffers For the following *write* commands, the *-sync* switch forces the synchronization of the file onto the filesystem *arrange-buffers* ...:: Reorder the buffers in the buffers list. The named buffers will be moved to the front of the buffer list, in the order given. Buffers that do not appear in the parameters will remain at the end of the list, keeping their current order. *change-directory* []:: *alias* cd + change the current directory to *directory*, or the home directory if unspecified *edit[!]* [] [ []]:: *alias* e + 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 *-debug*::: The new buffer (if any) will be created as a debug buffer. (See <>) *-existing*::: If the named file does not exist, fail instead of creating a new buffer. *-readonly*::: The new buffer (if any) will be set read-only. *-fifo* ::: Creates a new scratch buffer named , and continually appends data from the fifo (named pipe) as it arrives. (See <>) *-scratch*::: Creates a new buffer named , which doesn't correspond to any file on disk. If no filename is given, the buffer name will be generated based on format `\*scratch-$ID*`, where `$ID` is an integer automatically incremented for new buffers. (See <>) *-scroll*::: If used with `-fifo`, when new data arrives Kakoune will scroll the buffer down to make the new data visible. Otherwise, does nothing. *write[!]* [-force] [-sync] [-method ] []:: *alias* w + write buffer to or use its name if filename is not given. If the file is write-protected, its permissions are temporarily changed to allow saving the buffer and restored afterwards when the write! command is used. *-force*::: Equivalent to `!`, allow overwiting existing files if `` is given and set permissions temporarily if necessary. *-sync*::: Synchronise the filesystem after the write *-method *::: Enforce write method instead of relying on the `writemethod` option `replace`:::: Write to a temporary file then rename to the target file so that the modification appears atomically. `overwrite`:::: Open the existing file and overwrite its content with the new content. (See <>) *write-all* [-sync] [-method ]:: *alias* wa + write all changed buffers that are associated with a file *quit[!]* []:: *alias* q + exit Kakoune, use quit! to force quitting even if there is some unsaved buffer remaining. If specified, the client exit status will be set to *write-quit[!]* [-sync] [-method ] []:: *alias* wq + write current buffer and quit current client. If specified, the client exit status will be set to *write-all-quit* [-sync] [-method ] []:: *alias* waq + write all buffers and quit. If specified, the client exit status will be set to *buffer* :: *alias* b + switch to buffer *buffer-next*:: *alias* bn + switch to the next buffer. Debug buffers are skipped. (See <>) *buffer-previous*:: *alias* bp + switch to the previous buffer. Debug buffers are skipped. (See <>) *delete-buffer[!]* []:: *alias* db + delete current buffer or the buffer if specified *rename-buffer* [-file|-scratch] :: set current buffer name, if *-scratch* or *-file* is given, ensure the buffer is set to the corresponding type. *source* ...:: execute commands in parameters are available in the sourced script as `%arg{0}`, `%arg{1}`, … == Clients and Sessions *rename-client* :: set current client name *rename-session* :: set current session name *kill[!]* []:: terminate the current session, all the clients as well as the server. If specified, the server and clients exit status will be set to == Options *declare-option* [] []:: *alias* decl + declare a new option, the -hidden switch hides the option in completion suggestions (See <>) *set-option* [] :: *alias* set + change the value of an option in *scope* (See <> and <>) *unset-option* :: *alias* unset + unset the value of an option in *scope*, so the value from an outer scope is used (See <> and <>) *update-option* :: update the value of an option if its type supports that operation (See <> and <>) == Commands and Keys *define-command* [] :: *alias* def + define a new command (See <>) *alias* :: define a new alias named *name* in *scope* (See <> and <>) *complete-command* [] []:: *alias* compl + configure how a command completion works (See <>) *unalias* []:: remove an alias if its current value is the same as the one passed as an optional parameter, remove it unconditionally otherwise (See <> and <>) *evaluate-commands* [] ...:: *alias* eval + evaluate commands, as if they were entered in the command prompt (See <>) *execute-keys* [] ...:: *alias* exec + execute a series of keys, as if they were hit (See <>) *map* [] :: bind a list of keys to a combination (See <> and <>) *unmap* []:: unbind a key combination (See <> and <>) *declare-user-mode* :: declare a new user keymap mode *enter-user-mode* [] :: enable keymap mode for next key *-lock*::: stay in mode until `` is pressed == Hooks *hook* [] :: execute *command* whenever a *hook_name* is triggered in *scope* (See <> and <>) *-group *::: Add this hook to the *groupname* group, so it can be removed by the `remove-hooks` command (below) or disabled with the `disabled_hooks` option (see <>). *-once*::: This hook will be automatically removed after it has been executed. *-always*::: This hook will run even while hooks are disabled. See <>. *remove-hooks* :: *alias* rmhooks + remove every hook in *scope* whose group matches the regex *group* (See <> and <>) *trigger-user-hook* :: trigger the `User` hook with the given *param* as filter string in the current context. (See <>) == Display *echo* [] :: show *text* in status line, with the following *switches*: *-markup*::: expand the markup strings in *text* (See <>) *-debug*::: print the given text to the `\*debug*` buffer *-to-file* ::: write the given text to the given file on the host filesystem. *-to-shell-script*