Luigit
repositories / dotfiles

dotfiles

bugabingas dorkfiles

owned by admin

neovim/lua/bugabinga/cmdline/PLAN.md

Raw
Rendered preview

Cmdline Feature Plan

Easy Wins

1. Per-format border/icon colors

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

2. Separate search direction icons

  • Add search_up icon to std/icon.lua
  • Use it in format.lua when firstc == '?'
  • Files: std/icon.lua, format.lua

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

  • Add patterns for :! (shell), :h, :help (help), :lua, := (lua)
  • Add icons for each type
  • Files: format.lua, std/icon.lua

4. Virtual-text icon rendering

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

Medium Effort

5. Syntax highlighting in cmdline

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

6. Popupmenu match highlighting

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

7. Kind-specific popupmenu highlights

  • Use standard PmenuKind/PmenuKindSel highlight groups (already defined in nugu/init.lua)
  • 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

  • Right-aligned │ track + ┼ thumb via extmarks on popupmenu buffer
  • Thumb position proportional to selected item within total items
  • Only shown when items overflow viewport (#items > height)
  • Updates on on_select
  • Files: popupmenu.lua
# 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`