1
1
mirror of https://github.com/mawww/kakoune.git synced 2024-10-05 17:18:00 +03:00
6 Regex
Bruno Heridet edited this page 2020-06-16 19:23:53 +02:00

In kakoune, many prompts or commands require a regex:

  • search /, ?
  • select s
  • split S
  • keep <a-k>
  • not keep <a-K>

The regex engine used by kakoune is a custom one, based on an ECMAScript standard. More info in the documentation

This page lists common patterns you may need to better express your intent.

You can set user mappings to pre-fill prompts with the ones you need often. Here's an example with search and the \Q\E mentioned below:

map global user / ':exec /<ret>\Q\E<left><left>'

(<left><left> move the cursor back where you need it to be)

It is possible to make case insensitive regex by prefixing the expression with (?i).

Use the Quote flags, by surrounding your query with \Q and \E. Everything in between will be treated literally.

Remove non-ASCII characters from a buffer

%s[^\x00-\x7F]<ret>d

See also