https://github.com/aileot/vim-among_hml
Extend H/M/L motions and move in ratio
https://github.com/aileot/vim-among_hml
motion neovim nvim vim vim-plugin
Last synced: about 2 months ago
JSON representation
Extend H/M/L motions and move in ratio
- Host: GitHub
- URL: https://github.com/aileot/vim-among_hml
- Owner: aileot
- License: mit
- Created: 2019-10-06T12:23:36.000Z (over 6 years ago)
- Default Branch: main
- Last Pushed: 2022-10-05T13:58:08.000Z (over 3 years ago)
- Last Synced: 2025-04-03T12:16:06.543Z (about 1 year ago)
- Topics: motion, neovim, nvim, vim, vim-plugin
- Language: Vim Script
- Homepage:
- Size: 72.3 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# vim-among_HML
vim-among_HML provides a set of motions, extending H/M/L motion.
## Demo

(In demo, [edluffy/specs.nvim](https://github.com/edluffy/specs.nvim) flashes
cursor.)
## Installation
Install the plugin using your favorite package manager:
[vim-plug](https://github.com/junegunn/vim-plug)
```vim
Plug 'aileot/vim-among_HML'
```
[packer.nvim](https://github.com/wbthomason/packer.nvim)
```lua
use "aileot/vim-among_HML"
```
[dein.vim](https://github.com/Shougo/dein.vim) in toml
```toml
[[plugin]]
repo = 'aileot/vim-among_HML'
```
## Examples
### Vim script
```vim
" 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
```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.
```vim
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 call among_HML#jump(0.25)
noremap J call among_HML#jump(0.75)
" Optional mappings with mnemonics:
" Get the Keyword
nnoremap gK K
xnoremap gK K
" -leaving Join in contrast to the default `gJ`
nnoremap J J
xnoremap J J
```
For more examples and information, please read
[documentation](https://github.com/aileot/vim-among_HML/blob/master/doc/among_HML.txt),
or `:h among_HML` in your Vim/Neovim)