|
| 1 | +---@brief [[ |
| 2 | +---*navigator-nvim.txt* For Neovim version 0.7 Last change: 2020 Dec 16 |
| 3 | +--- |
| 4 | +--- |
| 5 | +--- |\ | _. o _ _. _|_ _ ._ ._ o ._ _ |
| 6 | +--- | \| (_| \/ | (_| (_| |_ (_) | o | | \/ | | | | |
| 7 | +--- _| |
| 8 | +--- |
| 9 | +--- · Smoothly navigate between neovim and multipexers · |
| 10 | +--- |
| 11 | +---@brief ]] |
| 12 | + |
| 13 | +---@toc navigator.contents |
| 14 | + |
| 15 | +---@mod navigator-nvim Introduction |
| 16 | +---@brief [[ |
| 17 | +---Navigator.nvim provides set of functions and commands that allows you to seemlessly |
| 18 | +---navigate between neovim and different terminal multiplexers. It also allows you to |
| 19 | +---integrate your own custom multipexer. |
| 20 | +---@brief ]] |
| 21 | + |
| 22 | +---@mod navigator.commands Commands |
| 23 | +---@brief [[ |
| 24 | +---This plugin provides the following commands: |
| 25 | +--- |
| 26 | +--- *NavigatorLeft* - Go to left split/pane |
| 27 | +--- *NavigatorRight* - Go to right split/pane |
| 28 | +--- *NavigatorUp* - Go to upper split/pane |
| 29 | +--- *NavigatorDown* - Go to down split/pane |
| 30 | +--- *NavigatorPrevious* - Go to previous split/pane |
| 31 | +---@brief ]] |
| 32 | + |
| 33 | +---@mod navigator.api API and Config |
1 | 34 | local n = require('Navigator.navigate') |
| 35 | +local Nav = {} |
2 | 36 |
|
3 | | -local N = { |
4 | | - setup = n.setup, |
5 | | -} |
| 37 | +---@class Config |
| 38 | +---Save modified buffer(s) when moving |
| 39 | +---to mux from neovim (default: `nil`) |
| 40 | +---@field auto_save? '"current"'|'"all"' |
| 41 | +---Disable navigation when the current |
| 42 | +---mux pane is zoomed in (default: `false`) |
| 43 | +---@field disable_on_zoom boolean |
| 44 | +---@field mux '"auto"'|Vi Multiplexer to use (default: "auto") |
| 45 | + |
| 46 | +---Enum of navigation direction analogous of neovim window movement |
| 47 | +---@alias Direction |
| 48 | +---| '"p"' # Previous Pane |
| 49 | +---| '"h"' # Left Pane |
| 50 | +---| '"j"' # Lower Pane |
| 51 | +---| '"k"' # Upper Pane |
| 52 | +---| '"l"' # Right Pane |
| 53 | + |
| 54 | +---Configure the plugin |
| 55 | +---@param opts Config |
| 56 | +---@usage [[ |
| 57 | +----- With default config |
| 58 | +---require('Navigator').setup() |
| 59 | +--- |
| 60 | +----- With custom config |
| 61 | +---require('Navigator').setup({ |
| 62 | +--- auto_save = 'current' |
| 63 | +--- disable_on_zoom = true |
| 64 | +---}) |
| 65 | +---@usage ]] |
| 66 | +function Nav.setup(opts) |
| 67 | + n.setup(opts) |
| 68 | +end |
6 | 69 |
|
7 | 70 | ---Go to left split/pane |
8 | | -function N.left() |
| 71 | +---@usage [[ |
| 72 | +---require('Navigator').left() |
| 73 | +--- |
| 74 | +----- With keybinding |
| 75 | +---vim.keymap.set({'n', 't'}, '<A-h>', require('Navigator').left) |
| 76 | +---@usage ]] |
| 77 | +function Nav.left() |
9 | 78 | n.navigate('h') |
10 | 79 | end |
11 | 80 |
|
12 | | ----Go to above split/pane |
13 | | -function N.up() |
| 81 | +---Go to upper split/pane |
| 82 | +---@usage [[ |
| 83 | +---require('Navigator').up() |
| 84 | +--- |
| 85 | +----- With keybinding |
| 86 | +---vim.keymap.set({'n', 't'}, '<A-k>', require('Navigator').up) |
| 87 | +---@usage ]] |
| 88 | +function Nav.up() |
14 | 89 | n.navigate('k') |
15 | 90 | end |
16 | 91 |
|
17 | 92 | ---Go to right split/pane |
18 | | -function N.right() |
| 93 | +---@usage [[ |
| 94 | +---require('Navigator').right() |
| 95 | +--- |
| 96 | +----- With keybinding |
| 97 | +---vim.keymap.set({'n', 't'}, '<A-l>', require('Navigator').right) |
| 98 | +---@usage ]] |
| 99 | +function Nav.right() |
19 | 100 | n.navigate('l') |
20 | 101 | end |
21 | 102 |
|
22 | | ----Go to below split/pane |
23 | | -function N.down() |
| 103 | +---Go to down split/pane |
| 104 | +---@usage [[ |
| 105 | +---require('Navigator').down() |
| 106 | +--- |
| 107 | +----- With keybinding |
| 108 | +---vim.keymap.set({'n', 't'}, '<A-j>', require('Navigator').down) |
| 109 | +---@usage ]] |
| 110 | +function Nav.down() |
24 | 111 | n.navigate('j') |
25 | 112 | end |
26 | 113 |
|
27 | 114 | ---Go to previous split/pane |
28 | | -function N.previous() |
| 115 | +---@usage [[ |
| 116 | +---require('Navigator').previous() |
| 117 | +--- |
| 118 | +----- With keybinding |
| 119 | +---vim.keymap.set({'n', 't'}, '<A-p>', require('Navigator').previous) |
| 120 | +---@usage ]] |
| 121 | +function Nav.previous() |
29 | 122 | n.navigate('p') |
30 | 123 | end |
31 | 124 |
|
32 | | -return N |
| 125 | +return Nav |
0 commit comments