Skip to content

aileot/vim-among_HML

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

vim-among_HML

vim-among_HML provides a set of motions, extending H/M/L motion.

Demo

among_HML#jump

(In demo, edluffy/specs.nvim flashes cursor.)

Installation

Install the plugin using your favorite package manager:

vim-plug

Plug 'aileot/vim-among_HML'

packer.nvim

use "aileot/vim-among_HML"

dein.vim in toml

[[plugin]]
repo = 'aileot/vim-among_HML'

Examples

Vim script

" Assign a ratio (0.0 ~ 1.0) to jump within window.
:call among_HML#jump(1/8.0)  " Jump to 1/8 height in window.
:call among_HML#scroll(0.25) " Drag cursor line to 1/4 height in window.

If you prefer fraction to decimal, either numerator or denominator must be a decimal in Vim script; otherwise, you would get an integer there.

  • Either 1/4 or 3/4 results in 0.
  • 1/4.0 results in 0.25, 3.0/4 results in 0.75.

Lua

require("among_HML").jump(1/8)
require("among_HML").scroll(0.25)

Configuration

This plugin defines no default keymappings so that you should map keys by yourself in your vimrc.

set scrolloff=0 " recommended (default)

" Jump into the line at 1/4 or 3/4 height of window (i.e., 25% or 75% height);
noremap K <Cmd>call among_HML#jump(0.25)<CR>
noremap J <Cmd>call among_HML#jump(0.75)<CR>

" Optional mappings with mnemonics:
" Get the Keyword
nnoremap gK K
xnoremap gK K
" <Space>-leaving Join in contrast to the default `gJ`
nnoremap <space>J J
xnoremap <space>J J

For more examples and information, please read documentation, or :h among_HML in your Vim/Neovim)

About

Extend H/M/L motions and move in ratio

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published