helix
helix copied to clipboard
Line numbers are now configurable via the gutters setting but apparently can't be changed with the :set command
I'd like to be able to toggle line numbers on and off while editing. #1967 added a gutters setting that allows disabling line numbers by simply not including "line-numbers" in the gutters array, which is great. But :set throws an error if I try to set gutters to the referenced values:
:set gutters ["diagnostics"]
Bad arguments. Usage: ':set key field'
:set gutters ["diagnostics"]
doesn't error for me. If it does for you, you might be using the latest release which doesn't include that functionality, yet.
Apart from that, there seem to be two things happening here:
-
:set
fails to parse the list, if it contains spaces- i.e.
["diagnostics", "line-numbers"]
fails, but["diagnostics","line-numbers"]
works
- i.e.
- the gutter is only updated when the window is created
- opening a split will update it (closing one sometimes updates it?)
I can reproduce this. The error comes from this line: https://github.com/helix-editor/helix/blob/24f5a47ceca5468ef22e21cdbb53e737782ff878/helix-term/src/commands/typed.rs#L1214-L1216
It looks like we're parsing the arguments :set gutters ["diagnostics"]
as ["gutters", "[", "diagnostics", "]"]
.
:set gutters "[\"diagnostics\"]"
is parsed correctly as a workaround but ideally we should be fixing the argument parser
Hmm actually on further investigation this looks like the intended behavior of helix_core::shellwords
based on the tests. You should escape quotes with \"
. Tuning that behavior could be discussed though.
:set gutters
on its own doesn't refresh the gutters as CptPotato says. The helix_view::editor::Editor::refresh_config
function (or maybe something in Application
) will need some extra handling for gutters
Hi there! Sorry to dig up an old issue, but I believe this is the way to do it in 23.10 at least? This is working for me
:set gutters.layout ["line-numbers"]