Giter Club home page Giter Club logo

vertigo's Introduction

Vertigo.vim

Vertigo.vim is a Vim plugin is based on a simple idea: that moving up and down using relative line numbers (e.g., 3j, 15k) is a very simple and precise way of moving around vertically, and shouldn't require your hands to leave home row.

To show how Vertigo works, let's look an example: say you want to go to some line that you can see (with relativenumber) is 14 lines down.

With this plugin, you'd press <Space>j to activate "jump mode." Vim then waits for two home-row keypresses representing a two-digit number, mapping asdfghjkl; to 1234567890. You then press af for 14, and just like that, you're 14 lines down. Easy! For one-digit numbers, just hit shift. (<Space>jF goes four lines down)

If you use a keyboard layout other than QWERTY, that's not a problem! Dvorak users: just add let g:Vertigo_homerow = 'aoeuidhtns' to your .vimrc file. Other keyboards should work too. (see :h vertigo-homerow)

Why?

Can't I just use 4k or 22j when I need to? And doesn't EasyMotion cover this, and more? Well...

  • It's faster.
  • It's more comfortable.
  • You never have to leave home row.
  • It's easy to learn, because your fingers already know where all the numbers are.
  • Why not?

Installation

Important note: Regardless of what installation method you use, Vertigo requires you to add some mappings to your .vimrc file. (see below)

I use Pathogen:

cd ~/.vim
git clone https://github.com/prendradjaja/vim-vertigo.git bundle/vertigo

Alternatively, with Pathogen, using a git submodule:

cd ~/.vim
git submodule add https://github.com/prendradjaja/vim-vertigo.git bundle/vertigo

I haven't personally used other plugin managers, but this should work with any of the ordinary plugin managers.

  • With NeoBundle:
    • NeoBundle 'prendradjaja/vim-vertigo'
  • With Vundle:
    • Bundle 'prendradjaja/vim-vertigo'

For manual installation, copy into ~/.vim, so plugin/teleport.vim goes to ~/.vim/plugin and doc/teleport.txt goes to ~/.vim/doc.

.vimrc mappings

After installing, you'll have to put in a few mappings into your .vimrc. Here's one option: (though of course you can change <Space>j and <Space>k to whatever works for you.

nnoremap <silent> <Space>j :<C-U>VertigoDown n<CR>
vnoremap <silent> <Space>j :<C-U>VertigoDown v<CR>
onoremap <silent> <Space>j :<C-U>VertigoDown o<CR>
nnoremap <silent> <Space>k :<C-U>VertigoUp n<CR>
vnoremap <silent> <Space>k :<C-U>VertigoUp v<CR>
onoremap <silent> <Space>k :<C-U>VertigoUp o<CR>

One last thing. Make sure you've got relativenumber and/or number (while the examples above used relative numbering, Vertigo works just as well with absolute line numbers) turned on, and you're good to go!

set relativenumber

(and/or)

set number

vertigo's People

Contributors

prendradjaja avatar

Watchers

 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.