emacs-libvterm
emacs-libvterm copied to clipboard
Add vterm-dabbrev-expand
This commit add dabbrev-expand as requested in #362
Thanks for this PR. I am not sure if this is the best way to solve the problem. One issue I can see is that if one has autocompletion (e.g. in fish, or zsh with autocompletion) the thing at the point will be the entire command (even if part of it will be greyed out).
I suspect that what will happen is: say one wants to autocomplete "python", having typed "py", vterm-dabbrev-expand
will yield pythonthon
.
Possible ingredients we can use: dabbrev--last-expansion
(where dabbrev is run in a cloned buffer), vterm-undo
, vterm-send-C-w
.
I don't have the solution, but I think we can find something more robust than your counting the number of characters and deleting them.
Can you please test vterm-dabbrev-expand
on a terminal with autocompletion?
Thanks for the review. I applied your suggestions. Now vterm-dabbrev-expand
works greats in Fish shell with autocompletion.
Thanks, I see some room for improvement, but overall I think the general strategy is good. Can you please explain why you need the check on thing-at-point
in the second function?
Could this be generalized to work with completion-at-point
?
@Sbozzolo thing-at-point
is required in case you have a cursor after space, in which case vterm-dabbrev-expand
completes a word after a matching word as dabbrev-expand
, e.g. after space after "This" word the vterm-dabbrev-expand
will complete buffer
.
;; This buffer is for text that is not saved, and for Lisp evaluation.
...
@okamsn i don't see how completion-at-point
could be used, because it only shows completion in a separate window. Maybe we could have a completion-at-point-functions
, but I don't see the point to do so to replace current implementation.
@okamsn i don't see how
completion-at-point
could be used, because it only shows completion in a separate window. Maybe we could have acompletion-at-point-functions
, but I don't see the point to do so to replace current implementation.
What I mean to ask is whether there is a way to make this insertion of text generally work for other commands too, such as completion-at-point
? I found code to complete file names at point, and it would be nice to use in Vterm.
What I mean to ask is whether there is a way to make this insertion of text generally work for other commands too, such as completion-at-point? I found code to complete file names at point, and it would be nice to use in Vterm.
completion-at-point and file name completion has nothing to do with dabbrev-expand and vterm-dabbrev-expand which tries to mimic dabbrev-expand.