Skip to content

Commit

Permalink
perf(cookbook): ViMode
Browse files Browse the repository at this point in the history
use escape sequences instead of control characters
  • Loading branch information
rebelot committed Feb 24, 2022
1 parent ed12e0f commit 0b93d18
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions cookbook.md
Original file line number Diff line number Diff line change
Expand Up @@ -320,9 +320,6 @@ No statusline is worth its weight in _fancyness_ :star2: without an appropriate
mode indicator. So let's cook ours! Also, this snippet will introduce you to a
lot of heirline advanced capabilities.

**Attention**: `^V` and `^S` characters are real special characters. Type
`<C-v><C-v>` or `<C-v><C-s>` in insert mode to write them!

```lua
local ViMode = {
-- get vim current mode, this information will be required by the provider
Expand All @@ -340,7 +337,7 @@ local ViMode = {
no = "N?",
nov = "N?",
noV = "N?",
["no^V"] = "N?",
["no\22"] = "N?",
niI = "Ni",
niR = "Nr",
niV = "Nv",
Expand All @@ -349,11 +346,11 @@ local ViMode = {
vs = "Vs",
V = "V_",
Vs = "Vs",
["^V"] = "^V",
["^Vs"] = "^V",
["\22"] = "^V",
["\22s"] = "^V",
s = "S",
S = "S_",
["^S"] = "^S",
["\19"] = "^S",
i = "I",
ic = "Ic",
ix = "Ix",
Expand All @@ -376,11 +373,11 @@ local ViMode = {
i = colors.green,
v = colors.cyan,
V = colors.cyan,
["^V"] = colors.cyan,
["\22"] = colors.cyan,
c = colors.orange,
s = colors.purple,
S = colors.purple,
["^S"] = colors.purple,
["\19"] = colors.purple,
R = colors.orange,
r = colors.orange,
["!"] = colors.red,
Expand Down

0 comments on commit 0b93d18

Please sign in to comment.