Skip to content

Commit

Permalink
Merge pull request #591 from judaew/feat/helo
Browse files Browse the repository at this point in the history
feat: Add option to toggle greetings (helo) in the statusline
  • Loading branch information
ms-jpq authored Jul 19, 2023
2 parents c667521 + 00d811e commit 694ee23
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 10 deletions.
3 changes: 3 additions & 0 deletions config/defaults.yml
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,9 @@ display:

time_fmt: "%Y-%m-%d %H:%M"

statusline:
helo: True

keymap:
bigger_preview: <c-k>
eval_snips: null
Expand Down
21 changes: 11 additions & 10 deletions coq/server/registrants/noop.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,14 @@ async def now(stack: Stack, args: Sequence[str]) -> None:
except ArgparseError as e:
await Nvim.write(e, error=True)
else:
if not ns.shut_up:
lo, hi = _HELO.chars
chars = choice(range(lo, hi))
star = (choice(_HELO.stars),)
birds = " ".join(chain(star, sample(_HELO.cocks, k=chars), star))
helo = choice(_HELO.helo)
msg = f"{birds} {helo}{linesep}"
encoded = encode(msg)
stdout.buffer.write(encoded)
stdout.buffer.flush()
if stack.settings.display.statusline.helo:
if not ns.shut_up:
lo, hi = _HELO.chars
chars = choice(range(lo, hi))
star = (choice(_HELO.stars),)
birds = " ".join(chain(star, sample(_HELO.cocks, k=chars), star))
helo = choice(_HELO.helo)
msg = f"{birds} {helo}{linesep}"
encoded = encode(msg)
stdout.buffer.write(encoded)
stdout.buffer.flush()
6 changes: 6 additions & 0 deletions coq/shared/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,11 @@ class Icons:
mappings: Mapping[str, str]


@dataclass(frozen=True)
class Statusline:
helo: bool


@dataclass(frozen=True)
class Display:
ghost_text: GhostText
Expand All @@ -78,6 +83,7 @@ class Display:
icons: Icons
time_fmt: str
mark_highlight_group: str
statusline: Statusline


@dataclass(frozen=True)
Expand Down
14 changes: 14 additions & 0 deletions docs/DISPLAY.md
Original file line number Diff line number Diff line change
Expand Up @@ -278,3 +278,17 @@ For a (mostly exhaustive) list of `kind` keys: `:lua print(vim.inspect(vim.lsp.p
For `ctags` do `ctags --list-kinds-full`.

The defaults do not cover `ctags`, as there are too many to find unique icons for.

#### coq_settings.display.statusline

Used for the statusline.

##### `coq_settings.display.statusline.helo`

Displays a greeting in the statusline.

**default:**

```json
true
```

0 comments on commit 694ee23

Please sign in to comment.