vim-among_HML provides a set of motions, extending H/M/L motion.
(In demo, edluffy/specs.nvim flashes cursor.)
Install the plugin using your favorite package manager:
Plug 'aileot/vim-among_HML'
use "aileot/vim-among_HML"
dein.vim in toml
[[plugin]]
repo = 'aileot/vim-among_HML'
" 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
or3/4
results in0
. 1/4.0
results in0.25
,3.0/4
results in0.75
.
require("among_HML").jump(1/8)
require("among_HML").scroll(0.25)
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)