Giter Club home page Giter Club logo

vim-focusmotion's Introduction

Vim-focusmotion

Context-dependent h/j/k/l motions for Vim.

How often have you pressed jjjj or llllll because you already had your fingers on the hjkl keys and it was still faster than reaching for another key(s)?

What if Vim could somehow guess, from the cursor position, than you don't mean to move character-wise or one-line up/down?

Take this (awesome) piece of code:

    console.log(
      Array.apply(null, {length: 100}).map(
        function(val, index) {
          index++;
          if (index % 15 == 0) {return "FizzBuzz";}
          if (index % 3  == 0) {return "Fizz";}
          if (index % 5  == 0) {return "Buzz";}
          return index;
        }
      ).join('\n')
    );

Say the cursor in on the A on the 2nd line. If you press l, is it more likely that you want to move a few chars right within the first word, or that you are trying to reach the {length: map literal, or the 100 value, or some location close to those?

The cursor still on the A, if you press j, how often do you want to move to that space just below, versus the first non-blank of the next line? And don't you want, sometimes, to move directly to the closing line ).join('\n)?

This plugin lets you do so, by remapping h/j/k/l to motions that depend on your cursor position within the current paragraph, indent block, line and word.

"Man, you're looney, just use w/b/f/}/42j, and cut that nonsense"

I use all these motions (except perhaps the 42j). The point is that I want better default motions for some specific cases, given that is what I need most of the time. Once you get used to them, which admittedly can take some time, you suddenly have the most useful motions right under the four keys you so often use in Vim.

Check out the manual for usage and examples.

Installation

Use your favorite method:

  • Pathogen - git clone https://github.com/fcpg/vim-focusmotion ~/.vim/bundle/vim-focusmotion
  • NeoBundle - NeoBundle 'fcpg/vim-focusmotion'
  • Vundle - Plugin 'fcpg/vim-focusmotion'
  • manual - copy all of the files into your ~/.vim directory

Help

Run :helptags (or :Helptags with Pathogen), then :help focusmotion

vim-focusmotion's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

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