delve icon indicating copy to clipboard operation
delve copied to clipboard

[Feature Request] Vim mode in debugger interface

Open erikw opened this issue 2 years ago • 9 comments

It would be great if fingers used to Vim-like navigation could command the delve debugger TUI e.g. like <esc>kki which would go up to lines in the history and enter insert mode again.

I'm used to this with other repl/debuggers like iPython, IRB, ghci etc.

Is delve using readline for the debugger TUI input? Then this would come for free when having set editing-mode vi in ~/.inputrc (did not work though so I assume not).

erikw avatar May 24 '23 09:05 erikw

This was brought up before #2515

aarzilli avatar May 24 '23 10:05 aarzilli

This would be great, but I don't think delve uses readline (that's what reads .inputrc). My guess is that this would require to be implemented from scratch.

Another alternative would be to write a custom client.

itaranto avatar Sep 19 '24 13:09 itaranto

I was taking a look at liner which is the library used by delve to implement the prompt.

Like @aarzilli already mentioned, there's an open issue for this. I took a look at the code and it seems implementing a Vi/Vim mode in liner would be huge pain in the ass.

So, I came across this library, which it seems to be a re-implementation of readline but in Go. It looks like it supports a Vim mode.

@aarzilli Have you considered using a different "liner" library?

itaranto avatar Oct 18 '24 15:10 itaranto

I just remembered you guys at Delve use a mailing list, I'll try using readline for a bit and maybe I can create a proposal later.

itaranto avatar Oct 18 '24 15:10 itaranto

We need ^C and ^Z to deliver signals in a specific way, these aren't tested automatically because we don't know how to write automated tests for it so it would have to be tested manually on every operating system we support (windows, macOS, linux and freebsd) and bugs there can be subtle. That is to say: switching to a different readline library starts at a severe penalty and this issue isn't exactly bustling.

aarzilli avatar Oct 18 '24 18:10 aarzilli

PS the library you are proposing has no tagged versions, a single importer and no activity for the past 3 years.

aarzilli avatar Oct 18 '24 18:10 aarzilli

PS the library you are proposing has no tagged versions, a single importer and no activity for the past 3 years.

Yes, I know. But I looked at the code at it seems to be well structured compared to liner. Also, the author seems to have "extracted" this code from another project of his (murex) which seems to be active.

To be fair, liner hasn't been updated in 3 years either.

itaranto avatar Oct 18 '24 18:10 itaranto

Oh, and BTW. The library actually has tagged versions.

I think they don't show up in https://pkg.go.dev/ because of the Go version present in go.mod.

itaranto avatar Oct 18 '24 18:10 itaranto

Well, I asked some questions to the Murex developer and it seems https://github.com/lmorg/readline it's not actually being maintained. Not outside Murex anyway.

I found another promising "readline" library which is actively maintained: https://github.com/reeflective/readline. It supports reading form .inputrc , Vim mode, Emacs mode and some other features.

I did a PoC using that one and some (very) basic testing and it seems to work.

itaranto avatar Oct 25 '24 13:10 itaranto