What is the meaning of semantic_escape_chars?

196 views Asked by At

I believe I have done an extensive google for semantic_escape_chars, but i have failed to find what the meaning of that config is. When are semantic_escape_chars used?

1

There are 1 answers

0
Zaidhaan Hussain On BEST ANSWER

The sample configuration says the semantic_escape_chars configuration option is used to specify a string of characters that are used to separate "semantic words". These are words that are seen as a single unit when you perform any actions on them, similar to the concept of words in vim.

This is used by the vi binding actions (SemanticLeft, SemanticRight, SemanticLeftEnd, etc.) which under allow the cursor to be moved semantically based on boundaries specified by semantic_escape_chars.

More concretely, in your alacritty.yml, if you have

selection:
  semantic_escape_chars: " ,:;()[]{}"

key_bindings:
  - { key: B, mode: Vi|~Search, action: SemanticLeft  }
  - { key: W, mode: Vi|~Search, action: SemanticRight }

And you enter vi mode (Ctrl+Shift+Space) with the following in your prompt

foo.png bar,baz

Assuming your cursor is at the first character, hitting "w" would take you to the beginning of the next semantic word, which would be the "b" in "bar".

If instead, you included an . in the semantic_escape_chars, pressing "w" would take you to the "o" at the end of "foo" since that is the end of the boundary for that semantic word as it is followed by the semantic escape character ..