no-neck-pain.nvim
no-neck-pain.nvim copied to clipboard
[bug]: Outline plugin does not work with NoNeckPain
Description
Here's what happens when I toggle NoNeckPain (left buffer is disabled).
https://github.com/user-attachments/assets/ba950721-a26f-4a65-b863-5a0bd0850ec4
Here is my config:
local M = {}
function M.setup()
local nnp = require("no-neck-pain")
-- Function to get the current year and week number
local function get_current_week_file()
local year = os.date("%Y")
local week = os.date("%V")
-- Format the path with the current year and week
return "/Users/nshv/Library/Mobile\\ Documents/iCloud~md~obsidian/Documents/NSHV/Journal/" ..
year .. "-W" .. week .. ".md"
end
nnp.bufferOptionsScratchPad = {
enabled = true, -- Enable scratchPad functionality
pathToFile = get_current_week_file(), -- File path where the scratchPad contents are saved
}
nnp.bufferOptionsColors = {
-- Hexadecimal color code to override the current background color of the buffer. (e.g. #24273A)
-- Transparent backgrounds are supported by default.
-- popular theme are supported by their name:
-- - catppuccin-frappe
-- - catppuccin-frappe-dark
-- - catppuccin-latte
-- - catppuccin-latte-dark
-- - catppuccin-macchiato
-- - catppuccin-macchiato-dark
-- - catppuccin-mocha
-- - catppuccin-mocha-dark
-- - github-nvim-theme-dark
-- - github-nvim-theme-dimmed
-- - github-nvim-theme-light
-- - rose-pine
-- - rose-pine-dawn
-- - rose-pine-moon
-- - tokyonight-day
-- - tokyonight-moon
-- - tokyonight-night
-- - tokyonight-storm
---@type string?
background = nil,
-- Brighten (positive) or darken (negative) the side buffers background color. Accepted values are [-1..1].
---@type integer
blend = 0,
-- Hexadecimal color code to override the current text color of the buffer. (e.g. #7480c2)
---@type string?
text = nil,
}
nnp.setup({
-- Prints useful logs about triggered events, and reasons actions are executed.
---@type boolean
debug = false,
-- The width of the focused window that will be centered. When the terminal width is less than the `width` option, the side buffers won't be created.
---@type integer|"textwidth"|"colorcolumn"
width = 150,
-- Represents the lowest width value a side buffer should be.
-- This option can be useful when switching window size frequently, example:
-- in full screen screen, width is 210, you define an NNP `width` of 100, which creates each side buffer with a width of 50. If you resize your terminal to the half of the screen, each side buffer would be of width 5 and thereforce might not be useful and/or add "noise" to your workflow.
---@type integer
minSideBufferWidth = 10,
-- Disables the plugin if the last valid buffer in the list have been closed.
---@type boolean
disableOnLastBuffer = false,
-- When `true`, disabling the plugin closes every other windows except the initially focused one.
---@usage: this parameter will be renamed `killAllWindowsOnDisable` in the next major release (^2.x.y).
---@type boolean
killAllBuffersOnDisable = false,
-- When `true`, deleting the main no-neck-pain buffer with `:bd`, `:bdelete` does not disable the plugin, it fallbacks on the newly focused window and refreshes the state by re-creating side-windows if necessary.
---@type boolean
fallbackOnBufferDelete = true,
-- Adds autocmd (@see `:h autocmd`) which aims at automatically enabling the plugin.
---@type table
autocmds = {
-- When `true`, enables the plugin when you start Neovim.
-- If the main window is a side tree (e.g. NvimTree) or a dashboard, the command is delayed until it finds a valid window.
-- The command is cleaned once it has successfuly ran once.
---@type boolean
enableOnVimEnter = false,
-- When `true`, enables the plugin when you enter a new Tab.
-- note: it does not trigger if you come back to an existing tab, to prevent unwanted interfer with user's decisions.
---@type boolean
enableOnTabEnter = true,
-- When `true`, reloads the plugin configuration after a colorscheme change.
---@type boolean
reloadOnColorSchemeChange = false,
-- When `true`, entering one of no-neck-pain side buffer will automatically skip it and go to the next available buffer.
---@type boolean
skipEnteringNoNeckPainBuffer = false,
},
-- Creates mappings for you to easily interact with the exposed commands.
---@type table
mappings = {
-- When `true`, creates all the mappings that are not set to `false`.
---@type boolean
enabled = false,
-- Sets a global mapping to Neovim, which allows you to toggle the plugin.
-- When `false`, the mapping is not created.
---@type string
-- toggle = "<leader>np<cr>",
-- Sets a global mapping to Neovim, which allows you to toggle the left side buffer.
-- When `false`, the mapping is not created.
---@type string
toggleLeftSide = "<leader>nql<cr>",
-- Sets a global mapping to Neovim, which allows you to toggle the right side buffer.
-- When `false`, the mapping is not created.
---@type string
toggleRightSide = "<leader>nqr<cr>",
-- Sets a global mapping to Neovim, which allows you to increase the width (+5) of the main window.
-- When `false`, the mapping is not created.
---@type string | { mapping: string, value: number }
widthUp = "<Leader>n=",
-- Sets a global mapping to Neovim, which allows you to decrease the width (-5) of the main window.
-- When `false`, the mapping is not created.
---@type string | { mapping: string, value: number }
-- widthDown = "<leader>n-",
-- Sets a global mapping to Neovim, which allows you to toggle the scratchPad feature.
-- When `false`, the mapping is not created.
---@type string
-- scratchPad = "<Leader>ns",
},
--- Common options that are set to both side buffers.
--- See |NoNeckPain.bufferOptions| for option scoped to the `left` and/or `right` buffer.
---@type table
buffers = {
-- When `true`, the side buffers will be named `no-neck-pain-left` and `no-neck-pain-right` respectively.
---@type boolean
setNames = false,
-- Leverages the side buffers as notepads, which work like any Neovim buffer and automatically saves its content at the given `location`.
-- note: quitting an unsaved scratchPad buffer is non-blocking, and the content is still saved.
--- see |NoNeckPain.bufferOptionsScratchPad|
scratchPad = NoNeckPain.bufferOptionsScratchPad,
-- colors to apply to both side buffers, for buffer scopped options @see |NoNeckPain.bufferOptions|
--- see |NoNeckPain.bufferOptionsColors|
colors = NoNeckPain.bufferOptionsColors,
-- Vim buffer-scoped options: any `vim.bo` options is accepted here.
---@see NoNeckPain.bufferOptionsBo `:h NoNeckPain.bufferOptionsBo`
bo = NoNeckPain.bufferOptionsBo,
-- Vim window-scoped options: any `vim.wo` options is accepted here.
---@see NoNeckPain.bufferOptionsWo `:h NoNeckPain.bufferOptionsWo`
wo = NoNeckPain.bufferOptionsWo,
--- Options applied to the `left` buffer, options defined here overrides the `buffers` ones.
---@see NoNeckPain.bufferOptions `:h NoNeckPain.bufferOptions`
left = {
enabled = false
},
--- Options applied to the `right` buffer, options defined here overrides the `buffers` ones.
---@see NoNeckPain.bufferOptions `:h NoNeckPain.bufferOptions`
right = NoNeckPain.bufferOptions,
},
-- Supported integrations that might clash with `no-neck-pain.nvim`'s behavior.
--
-- The `position` is used when the plugin scans the layout in order to compute the width that should be added
-- on each side. For example, if you were supposed to have a padding of 100 columns on each side, but an
-- integration takes 42, only 58 will be added so your layout is still centered.
--
-- If `reopen` is set to `false`, we won't account the width but close the integration when encountered.
---@type table
integrations = {
-- @link https://github.com/nvim-tree/nvim-tree.lua
---@type table
NvimTree = {
-- The position of the tree.
---@type "left"|"right"
position = "left",
-- When `true`, if the tree was opened before enabling the plugin, we will reopen it.
---@type boolean
reopen = true,
},
-- @link https://github.com/nvim-neo-tree/neo-tree.nvim
NeoTree = {
-- The position of the tree.
---@type "left"|"right"
position = "left",
-- When `true`, if the tree was opened before enabling the plugin, we will reopen it.
reopen = true,
},
-- @link https://github.com/mbbill/undotree
undotree = {
-- The position of the tree.
---@type "left"|"right"
position = "left",
},
-- @link https://github.com/nvim-neotest/neotest
neotest = {
-- The position of the tree.
---@type "right"
position = "right",
-- When `true`, if the tree was opened before enabling the plugin, we will reopen it.
reopen = true,
},
-- @link https://github.com/nvim-treesitter/playground
TSPlayground = {
-- The position of the tree.
---@type "right"|"left"
position = "right",
-- When `true`, if the tree was opened before enabling the plugin, we will reopen it.
reopen = true,
},
-- @link https://github.com/rcarriga/nvim-dap-ui
NvimDAPUI = {
-- The position of the tree.
---@type "none"
position = "none",
-- When `true`, if the tree was opened before enabling the plugin, we will reopen it.
reopen = true,
},
-- @link https://github.com/hedyhli/outline.nvim
outline = {
-- The position of the tree.
---@type "left"|"right"
position = "left",
-- When `true`, if the tree was opened before enabling the plugin, we will reopen it.
reopen = true,
},
-- @link https://github.com/stevearc/aerial.nvim
aerial = {
-- The position of the tree.
---@type "left"|"right"
position = "right",
-- When `true`, if the tree was opened before enabling the plugin, we will reopen it.
reopen = true,
},
},
})
end
function M.get_plugin_config()
return {
{
"shortcuts/no-neck-pain.nvim",
version = "*", -- recommended, use latest release instead of latest commit
config = M.setup,
},
}
end
return M
Neovim version
0.10.x
Steps to reproduce
- Open NoNeckPain
- Try open outline with
Outlinecommand - See broken UI
Relevant log output
nothing is shown on `:message<CR>` ...
Self-service
- [ ] I'd be willing to fix this bug myself.