Skip to content

alphapapa/mosey.el

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

46 Commits
 
 
 
 
 
 
 
 

Repository files navigation

mosey.el

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

Howdy. Why don’t ya mosey on in here. Have yourself a sit-down.

mosey makes it easy to mosey back and forth in your buffers. Just pass mosey a list of functions that move the point to certain places, and it’ll mosey the point between those places. Tell it :backward t if you want to mosey on back, otherwise it’ll mosey on ahead. Tell it to :bounce t if you want it to bounce back a notch when it hits the end, and tell it to :cycle t if you want it to loop around when it gets to one end or the other.

To make it easier for ya, just pass a list of point-moving functions to defmosey, and it’ll cook up six functions: mosey-forward, mosey-backward, mosey-forward-bounce, mosey-backward-bounce, mosey-forward-cycle, and mosey-backward-cycle. Then you can pick your fav-o-rite ones and forget about the rest!


Installation

Best thing to do is just mosey on over to MELPA and install the package called mosey.

But if you like gettin’ your hands dirty, all you need to do is put mosey.el in your load-path and then put this in your init file:

(require 'mosey)

Then you’re all set!

Usage

You can use these commands right off the bat to move within the current line:

  • mosey-forward
  • mosey-backward
  • mosey-forward-bounce
  • mosey-backward-bounce
  • mosey-forward-cycle
  • mosey-backward-cycle

You might even want to rebind your keys to ‘em, maybe like this:

(global-set-key (kbd "C-a") 'mosey-backward)
(global-set-key (kbd "C-e") 'mosey-forward)

…but that’d be even easier with use-package and its handy-dandy :bind form:

(use-package mosey
  :bind (
         ;; My personal favorites
         ("C-a" . mosey-backward-bounce)
         ("C-e" . mosey-forward-bounce)
         ))

Make your own moseys

It’s easy to make your own moseys with defmosey, somethin’ like this (this example uses functions from smartparens):

(defmosey '(beginning-of-line
            back-to-indentation
            sp-backward-sexp  ; Moves across lines
            sp-forward-sexp   ; Moves across lines
            mosey-goto-end-of-code
            mosey-goto-beginning-of-comment-text)
  :prefix "lisp")

That’ll cook up six functions for ya:

  • mosey-lisp-forward
  • mosey-lisp-backward
  • mosey-lisp-forward-bounce
  • mosey-lisp-backward-bounce
  • mosey-lisp-forward-cycle
  • mosey-lisp-backward-cycle

Then maybe you’d want to use ‘em in your emacs-lisp-mode, somethin’ like this:

(bind-keys :map emacs-lisp-mode-map
           ("C-a" . mosey-lisp-backward-bounce)
           ("C-e" . mosey-lisp-forward-bounce))

Changelog

0.2

  • Add :bounce option to mosey and associated -bounce functions in defmosey.
  • Minor optimizations.

0.1

  • We’re just gettin’ started here! We’re moseyin’ forward, backward, and cyclin’ all the way ‘round!

Credits

  • This package was inspired by Alex Kost’s fantastic mwim.el package. It has even more features, so check it out!

Development

Comments, questions, suggestions, and pull requests are welcome!

I can’t recommend Outorg enough. If you edit source code and use Emacs, check it out! Also try outline-minor-mode!

Bugs

None at the moment. Bug reporter z…I mean, bug zapper, standing by…

Ideas

MAYBE Laundry

It sure would be handy if mosey could do the laundry…

License

GPLv3

About

Mosey around inside your Emacs buffer

Resources

License

Stars

Watchers

Forks

Packages

No packages published