Comments (2)
Hi,
Thanks for the list of ideas! I don't think I'll have time to think them through in detail, but some quick comments:
I intuitively want to hit arrow keys and return to select a completion from the popup window instead of tab
I major reason for writing fancy-dabbrev in the first place was that I didn't find a completion package that supported "one key does it all" behavior just like plain dabbrev-expand
works. Here's a more detailed discussion. I'm spontaneously not interested in making fancy-dabbrev work like e.g. company-mode where you select candidates with arrow keys since that would just duplicate functionality and make things more complex. Perhaps there is a way for you to customize company-mode instead, using dabbrev as a backend?
Alternative considered: users can use add-hook to change the fancy-dabbrev-indent-command variable on a per-mode basis.
That's what I would suggest to keep things simple.
from fancy-dabbrev.
Hello, after experimenting with this package for a while, I reached the following solution:
(defcustom fancy-dabbrev-expansion-key "TAB"
""
:type 'string)
(defun fancy-dabbrev-remap (map)
(let* ((mode-cmd (keymap-lookup map fancy-dabbrev-expansion-key))
(remapped-cmd (or mode-cmd
(with-temp-buffer
(keymap-lookup global-map fancy-dabbrev-expansion-key))))
(fallback-cmd (or mode-cmd
(command-remapping remapped-cmd nil map)))
(wrapper-cmd (intern (concat "fancy-dabbrev-expand-or-" (symbol-name fallback-cmd)))))
(fset wrapper-cmd
`(lambda ()
(interactive)
(let ((fancy-dabbrev-indent-command ',fallback-cmd))
(fancy-dabbrev-expand-or-indent))))
(define-key map (vector 'remap remapped-cmd) wrapper-cmd)))
With this function, you can remap the key on each map (see below), which would be suitable for use in one's init.el:
(with-eval-after-load 'org-keys
(fancy-dabbrev-remap org-mode-map))
This seems to work for both major and minor mode maps.
I personally prefer the following wrapper definition. I am using C-e as the expansion key:
;;; Expand the dabbrev only after a self-insertion command, only once
`(lambda ()
(interactive)
(if (memq last-command fancy-dabbrev-self-insert-commands)
(let ((fancy-dabbrev-indent-command ',fallback-cmd))
(fancy-dabbrev-expand-or-indent))
(call-interactively ',fallback-cmd)))
What do you think?
from fancy-dabbrev.
Related Issues (13)
- Is it possible to do expansion for "." HOT 4
- Request/Suggestion: support for limiting completion to when the preview is visible HOT 1
- Request/Suggestion: support a customizable tab function
- Message suppression isn't working for `*Messages*` HOT 3
- TAB: using fancy-dabbrev-expand-or-indent breaks TAB on Magit HOT 4
- Feature request support for vterm HOT 2
- It doesn't work in orgmode HOT 14
- Ability to preview and expand next word HOT 3
- Making sure case matches the sentence HOT 1
- dabbrev--substitute-expansion: Wrong type argument: arrayp, nil HOT 1
- Add minor mode keymap so that tab & shift-tab are bound by default when fancy-dabbrev is active.
- [Q] Do you know how to use dabbrev with a completion framework such as ivy-counsel? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from fancy-dabbrev.