Switch between the beginning/end of line or code

Alex Kost dc1b5c358e Update version to 0.2 10 years ago
.gitignore 4562c4396a Initial commit 10 years ago
README.org 84cc9f4c36 Add some badges 10 years ago
demo.gif 4562c4396a Initial commit 10 years ago
mwim.el dc1b5c358e Update version to 0.2 10 years ago

README.org

file:https://img.shields.io/badge/license-GPL_3-orange.svg file:http://melpa.org/packages/mwim-badge.svg file:http://stable.melpa.org/packages/mwim-badge.svg

About

This Emacs package provides commands for moving to the beginning/end of code or line. It is inspired by this EmacsWiki page (some code from this page is used). mwim stands for Move Where I Mean.

https://raw.github.com/alezost/mwim.el/master/demo.gif

Installation

Automatic

This package can be installed from MELPA (with M-x package-install or =M-x list-packages=).

Manual

For the manual installation, clone the repo, add the directory to =load-path= and add autoloads for the commands for moving:


(add-to-list 'load-path "/path/to/mwim-dir")
(autoload 'mwim-beginning-of-code-or-line "mwim" nil t)
(autoload 'mwim-beginning-of-line-or-code "mwim" nil t)
(autoload 'mwim-end-of-code-or-line "mwim" nil t)
(autoload 'mwim-end-of-line-or-code "mwim" nil t)

Usage

As you can see in the gif demonstration:

  • M-x mwim-beginning-of-code-or-line moves the point between a first
  • non-space character and a first character of the line.
  • M-x mwim-end-of-code-or-line moves the point between the end of code
  • (not counting a trailing comment) and the end of the line.

M-x mwim-beginning-of-line-or-code and =M-x mwim-end-of-line-or-code= do the same but in a reverse order.

You may bind some keys to some of those commands in a usual manner, for example:


(global-set-key (kbd "C-a") 'mwim-beginning-of-code-or-line)
(global-set-key (kbd "C-e") 'mwim-end-of-code-or-line)