Giter Club home page Giter Club logo

vim-easyescape's Introduction

vim-easyescape

_____                  _____                          
 | ____|__ _ ___ _   _  | ____|___  ___ __ _ _ __   ___ 
 |  _| / _` / __| | | | |  _| / __|/ __/ _` | '_ \ / _ \
 | |__| (_| \__ \ |_| | | |___\__ \ (_| (_| | |_) |  __/
 |_____\__,_|___/\__, | |_____|___/\___\__,_| .__/ \___|
                 |___/                      |_|

Pull out your Escape key!

<ESC>/<C-[>/<C-C> is hard to press? Try vim-easyescape! vim-easyescape makes exiting insert mode easy and distraction free.

Problems

Traditionally, we need to use

inoremap jk <Esc>
inoremap kj <Esc>

or

inoremap jj <Esc>

so that we can press jk simultaneously (in arbitrary order since we have two maps) or press j twice to exit the insert mode. However, a problem with such map sequence is that Vim will pause whenever you type j or k in insert mode (it is waiting for the next key to determine whether to apply the mapping). The pause causes visual distraction which you may or may not notice.

vim-easyescape does not have such problem and supports custom timeout.

Installation

Use your favourite plugin manager, e.g., vim-plug:

Plug "zhou13/vim-easyescape"

Usage

Configuration 1: map of jk and kj (recommended)

The unit of timeout is in ms. A very small timeout makes an input of real jk or kj possible (Python3 is required for this feature)!

let g:easyescape_chars = { "j": 1, "k": 1 }
let g:easyescape_timeout = 100
cnoremap jk <ESC>
cnoremap kj <ESC>

Configuration 2: map of jj

let g:easyescape_chars = { "j": 2 }
let g:easyescape_timeout = 100
cnoremap jj <ESC>

Dependency

Python3 is required if timeout (g:easyescape_timeout) is less than 2000 ms because vim does not provide a way to fetch sub-second time.

Known problems

  1. Maps of keys in g:easyescape_chars need to be created.
  2. Does not work in command/visual mode due to lack of InsertCharPre in vim/nvim.

vim-easyescape's People

Contributors

zhou13 avatar orenhecht avatar arnaumas avatar

Watchers

James Cloos avatar  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.