Code Monkey home page Code Monkey logo

lightning-keymap-mode's Introduction

general-key-layout cheatsheet

This minor mode intends to provide a faster handling of Emacs during actual file editing.

Motivation

Let's face it, the navigation in plain Emacs is not that sophisticated. Actually, it's almost unusable. The approach of Evil-mode, on the other hand, is not a bad idea but I never really liked the way VI is doing things. Context switches are just not my style. I definitely prefer the key combination approach of Emacs.

So what can be done instead? Well, why not creating a mixture of both worlds?

Usage

In the lightning-keymap-mode a keymap tailored for fast navigation and editing is superimposed on top of your regular keymaps using a minor mode. Since this might shadow some essential key bindings you use on a regular basis, you can turn the mode on and off using F5.

There are two basic ideas to this package:

  1. Navigation happens using the j, k, l, and ; keys and there are a bunch of useful and frequently used commands placed on the surrounding keys (like killing (cutting), yanking (pasting), copying, line breaks etc.)
  2. There are several different 'layers' invoked by the Ctrl, Meta, and Shift key (and combinations of these). While the Ctrl key is invoking basic (slow) navigation, like moving forward or backward one line or character, the Meta key speeds things up by moving forward or backward a word or paragraph. The combination of both features the most fast behaviour (e.g. Ctrl + Meta + ; will move the point to the end of a line and Ctrl + Meta + l to the beginning of the buffer). A notable exception is Meta + Shift, which is used to navigate between buffers.

The second idea is also applied on most of the additional key bindings: Ctrl + , deletes backwards a character, Meta + , deletes backwards a word, and Ctrl + Meta + , deletes the current line (apart from this, those commands are also sensitive towards marked regions).

The evaluation of code chunks bound to the n key are currently just supported for ESS and python-mode.

Installation

Make sure you have an Emacs 25.1 or newer installed.

In order to use the lightning-keymap-mode, you have to clone this repository to your local device

git clone [email protected]:theGreatWhiteShark/lightning-keymap-mode.git

and add the following lines to your .emacs file in your home folder.

(add-to-list 'load-path "~/PATH-YOU-CLONED-LIGHTNING-KEYMAP-MODE-TO")
(require 'lightning-keymap-mode)
(lightning-keymap-mode 1)

Customization

By setting the lightning-basic-keymap variable to non-nil, the user can decide whether she wants to use just the basic navigation and line breaking instead of the full keybindings offered by the lightning-keymap-mode.

If the variable lightning-keymap-mode-modifies-string-replacement is set to non-nil, not the internal string-replace function, but a customized version lightning-keymap-mode-replace-string will be used. Within this function the default option of the FROM argument of the replacement function (what to replace) will be set according to word at point (at the current position). Therefore, it loses the ability to perform the last replacement as the default. You are free to decide on your own which functionality you find more useful.

For additional information and customization please refer to the customization group Editing > Lightning or the comment section in the beginning of lightning-keymap-mode.el.

Notes

If you plan to use YASnippet in combination with lightning-keymap-mode, be sure to use a YASnippet version >= 0.12.0!


License

This package is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License, version 3, as published by the Free Software Foundation.

This program is distributed in the hope that it will be useful, but without any warranty; without even the implied warranty of merchantability or fitness for a particular purpose. See the GNU General Public License for more details.

A copy of the GNU General Public License, version 3, is available at http://www.r-project.org/Licenses/GPL-3

lightning-keymap-mode's People

Contributors

thegreatwhiteshark avatar

Watchers

 avatar  avatar  avatar

lightning-keymap-mode's Issues

Iedit keybindings

The keybindings of iedit do not work anymore ( to go to the next match and S- to go to the previous one. This is more of a feature than a bug, since iedit used the overlay property of the text.

But since lightning-keymap-mode also features an explicit shortcut for the iedit mode, I also should think about how to use it without disabling the mode.

M-n evaluate block in ESS

Pressing M-n results in the message M-n is not defined.

Instead it would be great to automatically recognize the region the point is in and to send it to the interpreter.

(something like this is already implemented in the mode specific part. Maybe it's just a mapping bug)

Return mapping in string-replace minibuffer

When entering words in the string-replace minibuffer the <return> key is translated into a line break instead of the command to execute the replacement.

Changing point into another buffer and back fixes this issue

remapping faster navigation

For now the faster navigation in the fifth and sixth layer is based on a while loops over commands like next-line and right-char.

Instead it would be more appropriate to also base it on remapping to activate the arrow keys e.g. lightning-jump-lines-fast times.

Console support

Up to now the navigation inside Emacs when invoked in a terminal is not working that well.

Either enhance or disable it.

[develop] custom mode toggling handling key-translation-map

On commit c0fcbd9 the simple directional movements C-j, C-k, C-l, and C-; have already been mapped to the arrow keys. This way they even can be used inside helm minibuffers.

But toggling the mode does only remove the lightning-keymap-mode-map. The mappings in the key-translation-map are still present.

Since it's a minor mode and doesn't feature a clean-up hook, the only way to fix the issue I see right now is to customize the lightning-keymap-mode function. When toggling to the disabled state the mappings have to be set to nil

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.