repositories / dotfiles

dotfiles

bugabingas dorkfiles

owned by bugabinga

neovim/lua/bugabinga/cmdline/PLAN.md

Raw

Cmdline Feature Plan

Easy Wins

1. Per-format border/icon colors

2. Separate search direction icons

3. Additional type detection (!/help/=)

4. Virtual-text icon rendering

Medium Effort

5. Syntax highlighting in cmdline

6. Popupmenu match highlighting

7. Kind-specific popupmenu highlights

Nice to Have

8. Prompt-as-title for input()

9. Popupmenu scrollbar

Markdown source
File outline
# Cmdline Feature Plan

## Easy Wins

### 1. Per-format border/icon colors

- [x] Add highlight groups: `CmdlineBorderSearch`, `CmdlineBorderLua`,
      `CmdlineBorderInput`
- [x] In `render.lua`, set `winhighlight` based on `fmt.type`
- [x] Apply icon highlight via extmark instead of plain text
- Files: `render.lua`, `nugu/init.lua`

### 2. Separate search direction icons

- [x] Add `search_up` icon to `std/icon.lua`
- [x] Use it in `format.lua` when `firstc == '?'`
- Files: `std/icon.lua`, `format.lua`

### 3. Additional type detection (!/help/=)

- [x] Add patterns for `:!` (shell), `:h`, `:help` (help), `:lua`, `:=` (lua)
- [x] Add icons for each type
- Files: `format.lua`, `std/icon.lua`

### 4. Virtual-text icon rendering

- [x] Replace `icon .. ' ' .. text` with extmark-based icon
- [x] Simplify cursor position math (no more icon_bytes offset)
- [x] Remove trailing space hack if no longer needed
- Files: `render.lua`

## Medium Effort

### 5. Syntax highlighting in cmdline

- [x] Add `lang` field to format table entries (`vim`, `lua`, `bash`, `regex`)
- [x] After writing buffer text, apply treesitter highlights to command region
- [x] Fallback to vim syntax if no treesitter parser
- Files: `render.lua`, new `highlight.lua` or inline

### 6. Popupmenu match highlighting

- [x] Compute typed prefix from cmdline text via `render.get_text()` + `col`
      from popupmenu_show
- [x] Apply `PmenuMatch` highlight to matched prefix portion via extmarks after
      `nvim_buf_set_lines`
- [x] Case-insensitive prefix matching
- Files: `popupmenu.lua`, `init.lua`, `render.lua`

### 7. Kind-specific popupmenu highlights

- [x] Use standard `PmenuKind`/`PmenuKindSel` highlight groups (already defined
      in `nugu/init.lua`)
- [x] Apply per-kind highlight to icon portion in popupmenu via extmarks
- Files: `popupmenu.lua`

## Nice to Have

### 8. Prompt-as-title for input()

- [ ] When `prompt` is short, show as border title instead of inline
- [ ] Reconfigure window border dynamically
- Files: `render.lua`

### 9. Popupmenu scrollbar

- [x] Right-aligned `│` track + `┼` thumb via extmarks on popupmenu buffer
- [x] Thumb position proportional to selected item within total items
- [x] Only shown when items overflow viewport (`#items > height`)
- [x] Updates on `on_select`
- Files: `popupmenu.lua`