Giter VIP home page Giter VIP logo

Comments (6)

sooheon avatar sooheon commented on September 10, 2024 1

Ah thanks @vyp, I'd read the README when I first installed, but apparently not well enough. Thanks again @noctuid for putting a lot of thought into this!

from general.el.

vyp avatar vyp commented on September 10, 2024

https://github.com/noctuid/general.el#mapping-under-non-prefix-keys ?

from general.el.

noctuid avatar noctuid commented on September 10, 2024

Yeah, does general-key-dispatch meet your requirements? general-define-key doesn't try to automatically rewrite key definitions though; you have to do it manually.

Emacs doesn't have a good way to do this, as you point out, so you have to defer judgement, call the command once a unique key sequence (or timeout) is reached, and then simulate the prior keys. I won't say it works perfectly. There have been problems with repeating, but I've fixed all the ones I'm currently aware of (including for some pretty unlikely cases).

from general.el.

sooheon avatar sooheon commented on September 10, 2024

@noctuid Could you help me out with binding the keys/function pairs of cljr--all-helpers under "cr"?

I want it to work something like this:

(nmap :keymaps 'clj-refactor-map
    "c" (general-key-dispatch (if (bound-and-true-p lispyville-mode)
                                  'lispyville-change
                                'evil-change)
            "r" 'cljr--all-helpers
            "c" 'evil-change-whole-line))

from general.el.

noctuid avatar noctuid commented on September 10, 2024

Right now i just have a separate general-key-dispatch for each, but maybe just create a function for that and set it as the fallback (I haven't tested this):

(defun lispyville-or-evil-change ()
  (interactive)
  (if (bound-and-true-p lispyville-mode)
      (call-interactively #'lispyville-change)
    (call-interactively #'evil-change)))

As for binding r, it seems like those keys are all bound under clj-refactor-map, so try bindiing "r" clj-refactor-map.

from general.el.

noctuid avatar noctuid commented on September 10, 2024

general-key-dispatch will now check to see if the command has been remapped, so there is no longer a need to have a separate general-key-dispatch. For (general-key-dispatch 'evil-change...'), lispyville-change will automatically be used instead of evil-change when lispyville-mode is active (with the latest versions of general and lispyville).

from general.el.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.