Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ten3roberts/window-picker.nvim
Easily jump, pick and swap vim windows by annotated letters
https://github.com/ten3roberts/window-picker.nvim
Last synced: about 2 months ago
JSON representation
Easily jump, pick and swap vim windows by annotated letters
- Host: GitHub
- URL: https://github.com/ten3roberts/window-picker.nvim
- Owner: ten3roberts
- License: mit
- Created: 2021-06-28T07:17:07.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2023-01-02T14:38:40.000Z (about 2 years ago)
- Last Synced: 2024-11-25T00:33:49.358Z (about 2 months ago)
- Language: Lua
- Size: 26.4 KB
- Stars: 21
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# window-picker.nvim
A Neovim plugin for quickly navigating between, swapping, and closing windows.
## Motivation
Vim's window movement commands work fine when navigating to adjacent windows.
However, they quickly become tedious when navigating further and often causes
you to end up at the wrong split when there are two adjacent ones.window-picker.nvim allows you to quickly jump to any window by annotating each
window with a letter.It also allows you to swap the contents of two windows without disturbing your
layout, something which is almost impossible in normal vim.If a number is given instead of a key, the winnr is used, similar to ``
If `swap_shift == true` the windows will be swapped if the shift key is held
when swapping windows.If there are only two windows, the user won't be prompted as there are no other
windows to select.The labels for each window are layed out in the middle row, left to right (using
qwerty).As such, the screen position of windows follow the order of the keys upon which your
fingers rest on.## Usage
Configuration is done by passing a table to the setup function. All keys are
optional and will be set to their default value if left out. If you are only
using the default values, `setup` is not necessary.```lua
require'window-picker'.setup{
-- Default keys to annotate, keys will be used in order. The default uses the
-- most accessible keys from the home row and then top row.
keys = 'alskdjfhgwoeiruty',
-- Swap windows by holding shift + letter
swap_shift = true,
-- Windows containing filetype to exclude
exclude = { qf = true, NvimTree = true, aerial = true },
-- Flash the cursor line of the newly focused window for 300ms.
-- Set to 0 or false to disable.
flash_duration = 300,
}-- Example keymaps
-- Move to window, or swap by using shift + letter
vim.api.nvim_set_keymap('n', 'ww', "WindowPick")-- Swap with any window
vim.api.nvim_set_keymap('n', 'ws', "WindowSwap")
vim.api.nvim_set_keymap('n', 'wq', "WindowZap")
```## Custom commands
`window-picker.select(opts, callback(winid, upper))` is exported and allows easy prompting of
windows, similar to `ui.select`## Colors
window-picker uses the highlight groups `WindowPicker`, `WindowPickerSwap`
and `WindowPickerZap`.
To customize the colors, simple define these groups yourself with `hi!`