Indicator.nvim is a lightweight plugin that displays window numbers on the screen, making it easy to navigate through windows in a tab. It also highlights the window you jump into, enhancing your navigation experience.
neovim >= 0.10
plenary.nvim
- lualine.nvim - (for window and tab stats indication on status bar)
- Neovim 0.10 + required
- Ensure that a Nerd Font is installed and configured in your terminal emulator.
- Install using your preferred plugin manager (e.g.,
lazy.nvim
andpacker.nvim
). - Keymap examples are also provided. Feel free to modify them to suit your preferences.
{
"Antony-AXS/indicator.nvim",
event = "VeryLazy",
dependencies = { "nvim-lua/plenary.nvim" },
config = function()
local Indicator = require("indicator")
Indicator.setup({
indicator_event = true, -- turns ON the Indicator feature by default
window_highlight_event = false,
})
end
}
use {
"Antony-AXS/indicator.nvim",
event = "VimEnter",
requires = { "nvim-lua/plenary.nvim" },
config = function()
local Indicator = require("indicator")
Indicator.setup({
indicator_event = true, -- turns ON the Indicator feature by default
window_highlight_event = false,
})
end
}
Functions | Description |
---|---|
indicateAll |
To Indicate All the Opened Windows in a tab once with their perspective number. |
indicateCurrent |
To Indicate the Current Window number in which the cursor is at that moment Located. |
triggerWindowManager |
Mimics inbuilt neovim window management system, only 'jump' and 'close' feature is avaliable. |
indicator_event_activate |
Triggers an event listener to inidcate the window number of the window you jump into. |
indicator_event_deactivate |
Disables the event listener to inidcate the window number of the window you jump into. |
window_highlight_event_activate |
Triggers an event to Highlight the window you jump into everytime. |
window_highlight_event_deactivate |
Disables the event to Highlight the window you jump into everytime. |
vim.keymap.set("n", "<leader>bx", function()
Indicator.indicateCurrent() -- takes in an integer arugment to extend the indicator display time
end, { silent = true })
vim.keymap.set("n", "<leader>bv", function()
Indicator.indicateAll()
end, { silent = true })
vim.keymap.set("n", "<leader>im", Indicator.triggerWindowManager, {})
vim.keymap.set("n", "<leader>it", Indicator.indicator_event_activate, {})
vim.keymap.set("n", "<leader>ir", Indicator.indicator_event_deactivate, {})
Neovim's in-built window management system is replicated here with added visual indicators, focusing on only the window 'jumping', 'shifting' and 'closing' features.
Set a keymap to trigger the function triggerWindowManager, and then use key commands to perform the following actions:
Action | Keys | Description |
---|---|---|
Shift | number + h | to shift the window to the left. |
number + j | to shift the window to the bottom. | |
number + k | to shift the window to the top. | |
number + l | to shift the window to the right. | |
Close | number + c | to close the desired window only. |
number + o | to keep the desired window and close the rest. | |
number + q | to quit the desired window only. | |
Jump | number + w | to jump to the desired window. |
Here, "number" in the table refers to the window number displayed on the screen.
Note: If a window number is not provided before pressing the valid keys, the following actions will be executed in the current window where the cursor is located.
- Setting 'window_highlight_event = true' in setup function sets the hightlight feature ON by default.
- You can use 'Indicator.window_highlight_event_deactivate' to turn it OFF.
- You can use 'Indicator.window_highlight_event_activate' to turn it ON.
config = function()
local Indicator = require("indicator")
Indicator.setup({
window_highlight_event = true, -- turns ON the window highlight feature by default
})
end
vim.keymap.set("n", "<leader>iq", Indicator.window_highlight_event_activate, {})
vim.keymap.set("n", "<leader>iw", Indicator.window_highlight_event_deactivate, {})
If you have lualine.nvim installed, window and tab count stats can be displayed on the status bar.
- 1st one indicates the current tab you are in.
- 2nd indicates the total number of tabs open in the neovim instance.
- 1st is the window number you cursor is in.
- 2nd is the total number of windows that are open in the current tab.
- 3rd is the total window count across all the open tabs in the neovim instance.
If only one tab is open, the tab stats won't appear, and the 3rd parameter for window stats will also be hidden.
They will only be displayed if more than one tab is open.
Indicator.setup({
window_count_status = {
tab = {
activate = true, -- Displays the tab stats on the status bar.
position = { section = "x", index = 1 }, -- To configure the position of the tab stats.
color = "" -- Sets the color of tab stats. If not set, the default color will be yellow.
},
window = {
activate = true, -- Displays the window stats on the status bar.
position = { section = "x", index = 1 }, -- To configure the position of the window stats.
color = "" -- Sets the color of window stats. If not set, the default color will be yellow.
},
},
})
The indicator.nvim help doc explains the features and functionality of the plugin in detail.
Use the commands below to jump to each specific sections of the document.
Doc Commands | Description |
---|---|
:help indicator.nvim |
to jump to the start of the document |
:help indicator_commands |
to jump to the commands section of the document |
:help indicator_functions |
to jump to the functions section of the document |
:help indicator_configuration |
to jump to the configuration section of the document |
If you have any ideas or suggestions to improve this plugin, I’d love to hear from you! Your feedback is always welcome.