[lldb-dev] Command history line editing
Greg Clayton via lldb-dev
lldb-dev at lists.llvm.org
Mon Mar 5 08:45:01 PST 2018
> On Mar 4, 2018, at 12:03 PM, William Schmidt via lldb-dev <lldb-dev at lists.llvm.org> wrote:
> Hello lldb devs,
> Hacking away at my lldb command history on macOS Darwin 10.13.3
> lldb -v =>
> I discovered that ESC-b moves the cursor one word to the left, while ESC-f moves the cursor one word to the right; word in the regular expression sense. However, lldb does not remember that ESC switches the mode, as it does in bash. Each movement of the cursor must use that ESC sequence, such that to move, say 8 words left to get to the beginning of an 8-word line requires 8 separate ESC-b keyboard events. This is better than using the left arrow to move one char at a time but lldb deserves an editing mode functionally equivalent to what bash offers. And since bash is open-source, it should just be a matter of grabbing the bash source that implements command line editing and going from there.
> Am I missing any other ESC sequences that have been implemented but not documented?
If you want to see the exact configuration of LLDB's command interpreter see the Editline::ConfigureEditor() function in Editline.cpp. You can edit your ~/.editrc and override anything you want, so it is highly configurable.
$ cat ~/Dropbox/.editrc
lldb:bind '^[[5C' vi-next-word
lldb:bind '^[[5D' vi-prev-word
lldb:bind '^D' ed-delete-next-char
lldb:bind '^B' ed-command
lldb:bind '^P' ed-search-prev-history
lldb:bind '^N' ed-search-next-history
.editrc is for all apps, but you can bind "lldb" specific bindings as shown above.
> Will Schmidt
> T. William Schmidt
> Ola, AR 72853
> t.william.schmidt at gmail.com <mailto:t.william.schmidt at gmail.com>
> lldb-dev mailing list
> lldb-dev at lists.llvm.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the lldb-dev