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

Add vterm-dabbrev-expand #401

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

wigust
Copy link

@wigust wigust commented Sep 16, 2020

This commit add dabbrev-expand as requested in #362

@Sbozzolo
Copy link
Collaborator

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?

@wigust
Copy link
Author

wigust commented Sep 17, 2020

Thanks for the review. I applied your suggestions. Now vterm-dabbrev-expand works greats in Fish shell with autocompletion.

@Sbozzolo
Copy link
Collaborator

Sbozzolo commented Sep 27, 2020

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?

@okamsn
Copy link

okamsn commented Sep 27, 2020

Could this be generalized to work with completion-at-point?

@wigust
Copy link
Author

wigust commented Sep 29, 2020

@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
Copy link

okamsn commented Oct 1, 2020

@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.

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.

@wigust
Copy link
Author

wigust commented Oct 1, 2020

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants