Giter Site home page Giter Site logo

defrepeater.el's Introduction

defrepeater.el

https://melpa.org/packages/defrepeater-badge.svg https://stable.melpa.org/packages/defrepeater-badge.svg

This package lets you easily define “repeating commands,” which are commands that can be repeated by pressing the last key of the sequence bound to it.

For example, let’s say that you use winner-mode, and you have C-c C-w p bound to winner-undo. Obviously, pressing that whole sequence repeatedly is tiresome when you want to go several steps back. But using this macro, you can press C-c C-w p once, and then keep pressing p to repeat winner-undo, until you press a different key (you could press C-g if you needed to stop the repetition so you could press p normally).

Usage

First, define repeating commands:

;; Automatically defines `winner-redo-repeat' command:
(defrepeater #'winner-redo)

;; Optionally specify the name of the repeater, like using `defalias':
(defrepeater 'winner-undo-repeat #'winner-undo)

Then bind keys to the new commands (example using general):

(general-def
  [remap winner-redo] #'winner-redo-repeat
  [remap winner-undo] #'winner-undo-repeat)

For example, M-SPC w p was bound to winner-undo, so now M-SPC w p p p can be pressed to call winner-undo 3 times.

defrepeater can also be used directly in a key-binding expression:

(global-set-key (kbd "C-x o") (defrepeater #'other-window))

Installation

MELPA

If you installed from MELPA, you’re done.

Manual

Put defrepeater.el in your load-path, and (require 'defrepeater) in your init file.

Changelog

1.0

Initial release.

Credits

This was inspired by this answer by Drew Adams. Thanks also to Fox Keister for his feedback.

Development

Bug reports, feature requests, suggestions — oh my!

License

GPLv3

defrepeater.el's People

Contributors

alphapapa avatar

Watchers

James Cloos avatar

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.