2017-11-02 03:03:24 +01:00
|
|
|
= FAQ
|
2016-09-23 12:50:10 +02:00
|
|
|
|
2020-06-06 09:34:52 +02:00
|
|
|
== The project
|
|
|
|
|
|
|
|
=== How to pronounce the name of the project and what does it mean ?
|
2016-09-22 20:01:46 +02:00
|
|
|
|
2016-09-23 12:50:10 +02:00
|
|
|
The name of the project is pronounced "Kak-oon", and is a word taken from a
|
2020-05-28 18:37:26 +02:00
|
|
|
New Caledonian dialect based on French. It means a hard blow, usually a punch,
|
2020-06-10 11:38:54 +02:00
|
|
|
but generally refers to a strike into which all of one's strength went.
|
2016-09-22 20:01:46 +02:00
|
|
|
|
2020-06-06 09:34:52 +02:00
|
|
|
=== Is there going to be a Windows port of Kakoune ?
|
2016-08-23 06:47:07 +02:00
|
|
|
|
2020-06-11 09:30:46 +02:00
|
|
|
As many features provided by UNIX systems are missing or less efficient on
|
|
|
|
a Windows system, the incentive to porting the project to this operating
|
|
|
|
system is low.
|
2016-08-23 06:47:07 +02:00
|
|
|
|
2020-06-10 11:38:54 +02:00
|
|
|
Moreover, you can achieve pretty decent performance by using Kakoune on
|
|
|
|
Cygwin (which is officially supported).
|
2016-08-23 06:47:07 +02:00
|
|
|
|
2020-06-06 09:34:52 +02:00
|
|
|
== Interfacing
|
|
|
|
|
|
|
|
=== Can I use Kakoune as a pager ?
|
2016-08-23 06:47:07 +02:00
|
|
|
|
2017-06-22 11:43:46 +02:00
|
|
|
Kakoune can be used as a pager, either by setting the `PAGER` environment
|
2016-10-11 13:40:20 +02:00
|
|
|
variable to `kak`, or by writing data directly to its standard input using a
|
2017-11-01 07:15:11 +01:00
|
|
|
shell pipeline.
|
2016-08-23 06:47:07 +02:00
|
|
|
|
2020-06-11 09:17:10 +02:00
|
|
|
=== Are there any non-console based frontends available?
|
2016-08-23 06:47:07 +02:00
|
|
|
|
2016-09-22 20:01:46 +02:00
|
|
|
No graphical frontend is currently officially maintained, you can however
|
|
|
|
try experimental community-developed ones.
|
2016-08-23 06:47:07 +02:00
|
|
|
|
2020-06-11 09:17:10 +02:00
|
|
|
=== Why are colors misrendered in my Kakoune clients?
|
2016-10-12 08:36:42 +02:00
|
|
|
|
2020-06-10 11:38:54 +02:00
|
|
|
The most probable cause for colors being misrendered is a widespread practice
|
|
|
|
that consists in setting the `TERM` environment variable in the shell's
|
|
|
|
configuration file. This variable should be set by the terminal emulator,
|
|
|
|
and not overridden with an arbitrary value, otherwise it might interfere
|
|
|
|
with general UI rendering on the terminal's window.
|
2016-10-12 08:36:42 +02:00
|
|
|
|
2020-06-06 09:34:52 +02:00
|
|
|
=== I'm using `tmux` and colors look weird
|
2018-02-23 09:19:54 +01:00
|
|
|
|
|
|
|
If you're using a tool that doesn't support "palette switching", colors will
|
|
|
|
still be slightly off: they are being rounded down to values supported by the
|
2020-06-10 11:38:54 +02:00
|
|
|
regular color palette of Kakoune. Fortunately, on recent versions of `tmux`
|
2018-02-23 09:19:54 +01:00
|
|
|
(>=2.6), you can work around that by using the following configuration
|
|
|
|
settings:
|
|
|
|
|
2019-02-27 22:39:15 +01:00
|
|
|
.~/.tmux.conf
|
|
|
|
----
|
2018-02-23 09:19:54 +01:00
|
|
|
set -g default-terminal "tmux-256color"
|
|
|
|
set -ga terminal-overrides ",*col*:Tc"
|
2019-02-27 22:39:15 +01:00
|
|
|
----
|
2018-02-23 09:19:54 +01:00
|
|
|
|
|
|
|
Note: `\*col*` is a regular expression that matches your terminal's `$TERM`
|
|
|
|
value, modify it if necessary, e.g. `xterm-termite`.
|
|
|
|
|
|
|
|
Next, run the following command to create a local `terminfo` override:
|
|
|
|
|
2019-02-27 22:39:15 +01:00
|
|
|
----
|
2018-02-23 09:19:54 +01:00
|
|
|
$ tic /path/to/kakoune/contrib/tmux-256color.terminfo
|
2019-02-27 22:39:15 +01:00
|
|
|
----
|
2018-02-23 09:19:54 +01:00
|
|
|
|
|
|
|
Finally, quit all existing sessions (`tmux kill-server`), and restart `tmux`.
|
2016-10-12 08:36:42 +02:00
|
|
|
|
2020-06-06 09:44:10 +02:00
|
|
|
=== Why do I see weird special characters (~T~@~U) around Clippy?
|
|
|
|
|
|
|
|
You need a UTF-8 compliant locale, in order to render special characters.
|
|
|
|
|
|
|
|
The way to do so might vary from distribution to another, but an easy way
|
|
|
|
to verify that your locale is set correctly is to run the following command:
|
|
|
|
|
|
|
|
----
|
|
|
|
$ locale
|
|
|
|
----
|
|
|
|
|
2020-06-10 11:38:54 +02:00
|
|
|
The output should look similar to the following (with your own
|
|
|
|
language/country code set, instead of `en_US`):
|
2020-06-06 09:44:10 +02:00
|
|
|
|
|
|
|
----
|
|
|
|
LANG=en_US.UTF-8
|
|
|
|
LC_CTYPE="en_US.UTF-8"
|
|
|
|
LC_NUMERIC="en_US.UTF-8"
|
|
|
|
LC_TIME="en_US.UTF-8"
|
|
|
|
LC_COLLATE="en_US.UTF-8"
|
|
|
|
LC_MONETARY="en_US.UTF-8"
|
|
|
|
LC_MESSAGES="en_US.UTF-8"
|
|
|
|
LC_PAPER="en_US.UTF-8"
|
|
|
|
LC_NAME="en_US.UTF-8"
|
|
|
|
LC_ADDRESS="en_US.UTF-8"
|
|
|
|
LC_TELEPHONE="en_US.UTF-8"
|
|
|
|
LC_MEASUREMENT="en_US.UTF-8"
|
|
|
|
LC_IDENTIFICATION="en_US.UTF-8"
|
|
|
|
LC_ALL=
|
|
|
|
----
|
|
|
|
|
|
|
|
You can also run the project's test suite, which should display errors if
|
|
|
|
your locale doesn't support UTF-8 rendering:
|
|
|
|
|
|
|
|
----
|
|
|
|
$ cd kakoune
|
|
|
|
$ make test
|
|
|
|
----
|
|
|
|
|
2020-06-11 09:17:10 +02:00
|
|
|
=== Why does leaving insert mode take more than half a second in `tmux`?
|
2017-09-11 20:59:21 +02:00
|
|
|
|
|
|
|
Upon hitting the escape key, `tmux` waits for a short period of time to
|
|
|
|
determine whether it's part of a function or a meta key sequence. In order
|
|
|
|
to fix this "lag", set the waiting period in your `tmux` configuration file
|
|
|
|
to a short time, e.g. 25ms: `set -sg escape-time 25`
|
|
|
|
|
2020-06-11 09:17:10 +02:00
|
|
|
=== Can I split the window to display different buffers in them?
|
2020-06-06 09:34:52 +02:00
|
|
|
|
|
|
|
As a fairly compliant follower of the UNIX philosophy, Kakoune does not
|
|
|
|
try to implement features that are best handled by separate, dedicated
|
|
|
|
tools. Window splitting in terminals is a prime example of that
|
2020-06-11 09:30:46 +02:00
|
|
|
concept, where the editor provides commands to interact with several
|
2020-06-06 09:34:52 +02:00
|
|
|
terminal multiplexers (e.g. `tmux`), as opposed to emulating their
|
|
|
|
functionalities.
|
|
|
|
|
|
|
|
In order to open buffers in the same window simultaneously using `tmux`
|
|
|
|
(or one of the supported multiplexers), run Kakoune in a `tmux` session,
|
|
|
|
and simply use the `:new` command to spawn new clients as you would
|
|
|
|
have otherwise in an X11 environment.
|
|
|
|
|
|
|
|
== Generic functionalities
|
|
|
|
|
2020-06-06 10:18:19 +02:00
|
|
|
=== Something is wrong, how can I get more debug information?
|
|
|
|
|
|
|
|
You can get quite a lot of information out of the editor at runtime. One
|
|
|
|
way is through the `:debug` command, which will print out statistics and
|
|
|
|
state data into the `\*debug*` buffer:
|
|
|
|
|
|
|
|
----
|
|
|
|
:debug <command>
|
|
|
|
----
|
|
|
|
|
|
|
|
Another way is to set flags on the `debug` option:
|
|
|
|
|
|
|
|
----
|
|
|
|
:set global debug <flags>
|
|
|
|
----
|
|
|
|
|
|
|
|
Make sure to read all possible values suggested by the completion engine,
|
|
|
|
as you type out both commands in a prompt.
|
|
|
|
|
|
|
|
If you want to troubleshoot a crash, you need to compile the editor with
|
|
|
|
debug symbols enabled:
|
|
|
|
|
|
|
|
----
|
|
|
|
$ make debug=yes
|
|
|
|
----
|
|
|
|
|
|
|
|
The resulting binary should produce a stacktrace that you can, afterwards,
|
|
|
|
post in an issue in unmangled form (c.f. `c++filt`).
|
|
|
|
|
2020-06-11 09:17:10 +02:00
|
|
|
=== How can I explore the filesystem the way Vim's NerdTree does?
|
2020-06-06 09:34:52 +02:00
|
|
|
|
|
|
|
The builtin file completion engine used when opening a file for editing
|
2020-06-11 09:30:46 +02:00
|
|
|
(using the `:edit` command and letting the suggestions pop up in the menu
|
2020-06-10 11:38:54 +02:00
|
|
|
beneath) is more convenient than Vim's, which should suit basic needs.
|
2020-06-06 09:34:52 +02:00
|
|
|
|
|
|
|
However, if you need an actual explorer to interact with the editor,
|
|
|
|
you can create a Kakoune script that will spawn the tool in question,
|
|
|
|
which should in return send an "edit" command followed by the path of the
|
|
|
|
file you selected to the current Kakoune session (e.g. `echo "eval -client
|
|
|
|
$kak_client edit /path/to/file" | kak -p $kak_session`).
|
|
|
|
|
2020-06-11 09:17:10 +02:00
|
|
|
=== How do I automatically indent code, as Vim does with `=`?
|
2016-08-23 06:47:07 +02:00
|
|
|
|
2016-09-23 12:50:10 +02:00
|
|
|
As `Kakoune` doesn't parse the contents of the buffers, there is no builtin
|
|
|
|
equivalent for this Vim feature. Use a formatter/prettifier dedicated to
|
|
|
|
the language you're using with the help of the `|` key.
|
2016-09-22 20:01:46 +02:00
|
|
|
|
|
|
|
Example: `%|indent<ret>` to indent an entire buffer with C code.
|
|
|
|
|
2020-06-11 09:30:46 +02:00
|
|
|
You can also set the `formatcmd` option and use the `:format` command to
|
|
|
|
format the entire buffer.
|
2016-08-23 06:47:07 +02:00
|
|
|
|
2020-06-11 09:17:10 +02:00
|
|
|
=== Can Kakoune automatically complete the parameters of my functions?
|
2016-08-23 06:47:07 +02:00
|
|
|
|
2016-09-23 12:50:10 +02:00
|
|
|
As mentioned in the above question about Vim's `=` key, Kakoune does not
|
|
|
|
parse the contents of a buffer by itself, which makes it impossible for
|
|
|
|
the editor to propose candidates upon completion.
|
2016-08-23 06:47:07 +02:00
|
|
|
|
2016-09-23 12:50:10 +02:00
|
|
|
However, support for such a feature can be achieved through the use of a
|
|
|
|
dedicated tool, as is the case with `clang` and C code: you can use the
|
|
|
|
`clang-enable-autocomplete` and `clang-complete` builtin commands whenever
|
|
|
|
editing a C/C++ file, and completion will work on function parameters.
|
2016-09-22 20:01:46 +02:00
|
|
|
|
2020-06-10 11:29:52 +02:00
|
|
|
Other language-support scripts implement this functionality in a similar way,
|
|
|
|
for example the `jedi` script for Python buffers.
|
|
|
|
|
|
|
|
Another way to get automatic parameter completion that doesn't depend on
|
|
|
|
built-in support in Kakoune is through the
|
|
|
|
https://microsoft.github.io/language-server-protocol/[Language Server Protocol],
|
|
|
|
for which you can find implementations that interact with the editor.
|
2016-08-23 06:47:07 +02:00
|
|
|
|
2020-06-11 09:17:10 +02:00
|
|
|
=== Why aren't widely known command line shortcuts such as <c-w> or <c-u> available in Kakoune?
|
2016-08-23 06:47:07 +02:00
|
|
|
|
2016-09-23 12:50:10 +02:00
|
|
|
Despite their widespread availability in multiple tools, those shortcuts do
|
|
|
|
not fit the paradigm that Kakoune implements, which is based on selections
|
|
|
|
first.
|
2016-08-23 06:47:07 +02:00
|
|
|
|
2016-09-23 12:50:10 +02:00
|
|
|
However, you can easily declare key mappings in your configuration file
|
2017-11-06 10:08:59 +01:00
|
|
|
to be able to use those control-based shortcuts in insert mode.
|
|
|
|
(See <<mapping#,`:doc mapping`>>)
|
2016-08-23 06:47:07 +02:00
|
|
|
|
2020-06-10 11:32:06 +02:00
|
|
|
Also note that a subset of "readline shortcuts" is implemented for command
|
|
|
|
prompts.
|
|
|
|
|
2020-06-11 09:17:10 +02:00
|
|
|
=== Can I disable auto-indentation completely?
|
2016-09-22 20:01:46 +02:00
|
|
|
|
|
|
|
All the indentation hooks are conventionally named `<lang>-indent`, which
|
2016-09-23 12:50:10 +02:00
|
|
|
allows us to use the `disabled_hooks` variable to disable indentation
|
|
|
|
globally with the following command: `set global disabled_hooks '.+-indent'`
|
2016-09-22 20:01:46 +02:00
|
|
|
|
2020-06-11 09:17:10 +02:00
|
|
|
=== How to enable syntax highlighting?
|
2017-05-26 17:15:08 +02:00
|
|
|
|
2020-06-10 11:38:54 +02:00
|
|
|
The MIME type of the files opened in new buffers is detected using the
|
2017-05-26 17:15:08 +02:00
|
|
|
`file` command, and syntax highlighting enabled automatically when
|
|
|
|
possible.
|
|
|
|
|
2020-06-11 09:17:10 +02:00
|
|
|
=== My file seems to be highlighted with the wrong colors, I thought syntax highlighting was detected automatically?
|
2017-05-26 17:15:08 +02:00
|
|
|
|
2020-05-28 18:37:26 +02:00
|
|
|
The `file` utility has several shortcomings, such as detecting the
|
2020-06-10 11:38:54 +02:00
|
|
|
wrong MIME type for a file containing data with different syntax, e.g.
|
2017-05-26 17:15:08 +02:00
|
|
|
a Python script containing hardcoded HTML templates detected as an HTML
|
|
|
|
file.
|
|
|
|
|
2020-06-10 11:38:54 +02:00
|
|
|
Kakoune does its best to detect file types (using known extensions for a
|
|
|
|
given format for instance), but not much can be done about those ambiguous
|
|
|
|
cases. You might consider writing a custom `$HOME/.magic` file if needed.
|
2017-05-26 17:15:08 +02:00
|
|
|
|
2020-06-11 09:17:10 +02:00
|
|
|
=== Can I disable syntax highlighting completely?
|
2016-09-22 20:01:46 +02:00
|
|
|
|
2016-09-23 12:50:10 +02:00
|
|
|
Similarly to the indentation hooks, the name format followed by the
|
|
|
|
highlighting hooks is `<lang>-highlight`. You can thus disable syntax
|
|
|
|
highlighting using the following command: `set global disabled_hooks
|
|
|
|
'.+-highlight'`
|
2017-05-26 17:15:08 +02:00
|
|
|
|
2020-07-21 08:08:35 +02:00
|
|
|
=== Can the cursor be rendered as a beam?
|
|
|
|
|
|
|
|
Rendering the cursor as a beam is a common feature of other modal editors,
|
|
|
|
it however doesn't fit within Kakoune's selection-first paradigm.
|
|
|
|
|
|
|
|
There is a selection on screen at all times, containing either data selected
|
|
|
|
by the user, or a newline character when the buffer is empty.
|
|
|
|
|
|
|
|
A selection is bound by an anchor and a cursor. They can overlap, but
|
|
|
|
ultimately must both be placed *over* a character. A beam cursor placed
|
|
|
|
*between* two characters doesn't fulfil that requirement, and is thus
|
|
|
|
not allowed.
|
|
|
|
|
2020-06-06 09:34:52 +02:00
|
|
|
== The editing language
|
|
|
|
|
2020-08-10 11:23:35 +02:00
|
|
|
=== The scripting language lacks keywords, when are you going to expand it?
|
|
|
|
|
|
|
|
The scripting language is the smallest subset of statements/keywords that
|
|
|
|
allows users to write plugins, commands, mappings.
|
|
|
|
|
|
|
|
It's not intended to be a one-stop generic interface, but rather a glue
|
|
|
|
between core Kakoune instructions and complex logic.
|
|
|
|
|
|
|
|
Other editors generally come up with their own language or leverage existing
|
|
|
|
ones (for example, VimL, LUA), whereas Kakoune interacts with the shell,
|
|
|
|
through `%sh{…}` scopes.
|
|
|
|
|
|
|
|
As arbitrary Kakoune data (options, selection etc.) can be shared with
|
|
|
|
shell scopes through environment variables, users are free to process this
|
|
|
|
data with pure shell scripting, or whatever interpreter they desire.
|
|
|
|
|
2020-06-11 09:17:10 +02:00
|
|
|
=== Why aren't there other scopes similar to `%sh{}` e.g. python?
|
2020-06-06 09:34:52 +02:00
|
|
|
|
|
|
|
Supporting custom scopes would add hard dependencies to the project, which
|
|
|
|
is too much of a drawback when balanced against the low cost of using
|
|
|
|
an interpreter in a regular shell scope (e.g. `%sh{ python -c "..." }`).
|
|
|
|
The shell scope allows users to spawn any interpreter they want, for a minimal
|
|
|
|
cost in terms of performance, it is therefore the reason why it's the only
|
|
|
|
one available by default.
|
|
|
|
|
2020-06-11 09:17:10 +02:00
|
|
|
=== What shell is used to expand `%sh{}` scopes?
|
2020-06-06 09:34:52 +02:00
|
|
|
|
2020-06-10 11:38:54 +02:00
|
|
|
The server expands shell scopes using the `sh` binary, located in one of
|
|
|
|
the directories containing all the POSIX standard utilities. This list of
|
|
|
|
directories is stored in a system configuration variable, and queried by
|
|
|
|
Kakoune at startup.
|
2020-06-06 09:34:52 +02:00
|
|
|
|
|
|
|
In most distributions, `/bin/sh` will end up being used.
|
|
|
|
|
2020-06-11 09:17:10 +02:00
|
|
|
=== Why does a dot `.` in a regex select newline characters?
|
2017-05-26 17:15:08 +02:00
|
|
|
|
|
|
|
Data in buffers is a stream of characters, and newlines do not receive special
|
|
|
|
treatment compared to other characters, with regards to regex matching. In
|
|
|
|
order to select data in a line without any trailing newline characters, one could
|
|
|
|
use the `[^\n]+` pattern, which is arguably a good compromise when
|
|
|
|
balanced against the ability to select data over several lines.
|
|
|
|
|
2020-06-10 11:37:43 +02:00
|
|
|
You can instruct the regex engine to stop matching newline characters with
|
|
|
|
`.` by disabling the appropriate flag (`(?S)`).
|
|
|
|
|
2020-06-11 09:17:10 +02:00
|
|
|
=== Why does `a` extend the current selection, but `i` leaves it untouched?
|
2017-06-22 11:44:47 +02:00
|
|
|
|
|
|
|
Selections are ranges of characters whose delimiters are an "anchor" and
|
2020-07-21 16:36:45 +02:00
|
|
|
a "cursor", and inserting characters is always done before the cursor in
|
2017-06-22 11:44:47 +02:00
|
|
|
insert mode.
|
|
|
|
|
|
|
|
Consequently, using the append primitive (`a`) nudges the cursor forward to
|
|
|
|
make room for characters, effectively extending the current selection since
|
|
|
|
the anchor remains immobile, even when the anchor and the cursor are at the
|
|
|
|
same location. By opposition, using the insert primitive (`i`) merely adds
|
|
|
|
characters before the cursor, which never modifies the current selection.
|
2020-06-10 13:49:46 +02:00
|
|
|
|
|
|
|
=== How to apply changes to all open buffers?
|
|
|
|
|
|
|
|
The `:exec` and `:eval` commands can apply changes to a comma-separated
|
|
|
|
list of buffers, passed as argument to the `-buffer` flag.
|
|
|
|
|
2020-06-11 09:30:46 +02:00
|
|
|
In order to let the editor figure out which buffers are open, the special
|
|
|
|
value `*` is accepted as a wildcard. For example, in order to reload all
|
|
|
|
open buffers:
|
2020-06-10 13:49:46 +02:00
|
|
|
|
|
|
|
----
|
|
|
|
:eval -buffer * e!
|
|
|
|
----
|
2020-06-26 10:12:25 +02:00
|
|
|
|
|
|
|
=== Why is the text I pasted into a buffer completely mangled?
|
|
|
|
|
|
|
|
In order to assist users with writing code, some buffers come with hooks that
|
|
|
|
automatically indent the text inserted. Pasting the contents of the clipboard
|
|
|
|
into a buffer in insert mode triggers this indentation functionality,
|
|
|
|
resulting into mangled text.
|
|
|
|
|
|
|
|
To prevent that from happening:
|
|
|
|
|
|
|
|
* disable hooks and enter insert mode with `\i`
|
|
|
|
* insert text into the buffer (e.g. paste the clipboard's contents)
|
|
|
|
* exit insert-mode, restoring hooks with `<esc>`
|