Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

statusline: reimplement default, include LSP progress #28809

Open
justinmk opened this issue May 17, 2024 · 3 comments · May be fixed by #29389
Open

statusline: reimplement default, include LSP progress #28809

justinmk opened this issue May 17, 2024 · 3 comments · May be fixed by #29389
Labels
defaults issues or PRs involving changing the defaults enhancement feature request lsp statusline tabline, winbar, statuscolumn
Milestone

Comments

@justinmk
Copy link
Member

justinmk commented May 17, 2024

Problem

the default 'statusline' is implemented in C, it doesn't use the 'statusline' DSL. And it isn't readable as a 'statusline' expression, so user configs/plugins can't augment it.

Expected behavior

Related

@justinmk justinmk added enhancement feature request defaults issues or PRs involving changing the defaults statusline tabline, winbar, statuscolumn labels May 17, 2024
@justinmk justinmk added this to the backlog milestone May 17, 2024
@github-actions github-actions bot added the lsp label May 17, 2024
@yochem
Copy link
Contributor

yochem commented Jun 13, 2024

I would like to have a go with this, but I have a couple questions.

  1. I'm unsure where I can find the current C implementation of the default statusline. I'm guessing it's src/nvim/statusline.c, but thus far I haven't found the part where the default is defined. Could someone give me a primer on this? here
  2. Should the default statusline be defined in runtime/lua/vim/_defaults.lua by setting vim.o.statusline?
  3. What should be the result of set statusline=? Current behaviour is showing the default statusline.
  4. What would fall under "other useful things we can add"? Are there current discussions on possible components to add to the default statusline?

Current components (according to :h statusline)

  • Relative file path (%f)
  • Help flag (%h)
  • Modified flag (%m)
  • Readonly flag (%r)
  • Left-right split (%=)
  • line,col-VIRT (%l,%c%V)
  • % of file / Top / Bot (%P)

Possible additions:

  • Mode
  • Filetype
  • LspProgress
  • Treesitter enabled for buf
  • Diagnostics (only when there are any diagnostics)
  • ...

Possible changes:

  • line,colline:col has been widely adopted as line + col representation. Could be line-line for V-line and line:col-line:col for V-block (or , instead of -)
  • I do like the left-right split, but would also be possible to do three parts with filename centered in the midddle
  • ...

Thanks in advance!

@yochem
Copy link
Contributor

yochem commented Jun 13, 2024

Rough example with components mode, filename, diagnostics, filetype, line:col, %file:

vim.o.statusline = '  %{luaeval("Mode()")} │ %f%m %=│ %{luaeval("Dia()")}│ %{&filetype} │ %l:%c │ %03(%p%)%%  '
image

Not sure if lua components can be made/used, and if so, how to do that without luaeval.

@justinmk
Copy link
Member Author

justinmk commented Jun 17, 2024

Could be line-line for V-line and line:col-line:col for V-block (or , instead of -)

That is interesting because it avoids the need for 'ruler'.

The current example you showed looks like a good start. I wouldn't add anything else, it's better to start small, because the first major step is to move to a Lua/Vimscript impl and elminate the C impl. In fact, the first PR should look identical to the current default statusline, to avoid tons of churn in the tests. Then in a followup we can discuss how to offer an improved statusline.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
defaults issues or PRs involving changing the defaults enhancement feature request lsp statusline tabline, winbar, statuscolumn
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants