shortcuts / no-neck-pain.nvim

☕ Dead simple yet super extensible plugin to center the currently focused buffer to the middle of the screen.
MIT License
552 stars 13 forks source link

Lualine not expanding across whole window, showing "dummy" buffers #342

Closed avastmick closed 5 months ago

avastmick commented 5 months ago

Description

Firstly, this plugin may be a lifesaver. I am suffering from a sore shoulder, which I think is due to using a wide-screen monitor. Thanks!

Next, this may not be a bug, just a 'feature' of my Nvim usage... :smile:

In the showcase, your examples show the status line across the window, covering the no-neck-pain, un-focused buffers.

I get:

image

I have no experience in using tabs for buffers, so it may be from that..? The only other issue may be due to me using Noice, which removes the command line at the bottom.

Steps to reproduce

  1. I installed using Lazy
  2. I set the config:

    
    return {
    "shortcuts/no-neck-pain.nvim",
    version = "*",
    opts = {},
    config = function()
        require("no-neck-pain").setup({
            width = 160,
            autocmds = {
                -- When `true`, enables the plugin when you start Neovim.
                enableOnVimEnter = true,
                -- When `true`, enables the plugin when you enter a new Tab.
                enableOnTabEnter = true,
                -- When `true`, reloads the plugin configuration after a colorscheme change.
                reloadOnColorSchemeChange = false,
                -- When `true`, entering one of no-neck-pain side buffer will automatically skip it and go to the next available buffer.
                skipEnteringNoNeckPainBuffer = true,
            },
            mappings = {
                -- When `true`, creates all the mappings that are not set to `false`.
                --- @type boolean
                enabled = true,
                -- Sets a global mapping to Neovim, which allows you to toggle the plugin.
                -- When `false`, the mapping is not created.
                --- @type string
                toggle = "<Leader>zn",
                -- 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>zql",
                -- 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>zqr",
                -- 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>z=",
                -- 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>z-",
                -- 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>zs",
            },
            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,
                    fillchars = "eob: ",
                },
                --- Options applied to the `left` buffer, options defined here overrides the `buffers` ones.
                --- @see NoNeckPain.bufferOptions `:h NoNeckPain.bufferOptions`
                left = NoNeckPain.bufferOptions,
                --- Options applied to the `right` buffer, options defined here overrides the `buffers` ones.
                --- @see NoNeckPain.bufferOptions `:h NoNeckPain.bufferOptions`
                right = NoNeckPain.bufferOptions,
    
            },
        })
        NoNeckPain.bufferOptions = {
            -- When `false`, the buffer won't be created.
            --- @type boolean
            enabled = true,
            --- @see NoNeckPain.bufferOptionsColors `:h NoNeckPain.bufferOptionsColors`
            colors = NoNeckPain.bufferOptionsColors,
            --- @see NoNeckPain.bufferOptionsBo `:h NoNeckPain.bufferOptionsBo`
            bo = NoNeckPain.bufferOptionsBo,
            --- @see NoNeckPain.bufferOptionsWo `:h NoNeckPain.bufferOptionsWo`
            wo = NoNeckPain.bufferOptionsWo,
            --- @see NoNeckPain.bufferOptionsScratchPad `:h NoNeckPain.bufferOptionsScratchPad`
            scratchPad = NoNeckPain.bufferOptionsScratchPad,
        }
    
        NoNeckPain.bufferOptionsWo = {
            --- @type boolean
            cursorline = false,
            --- @type boolean
            cursorcolumn = false,
            --- @type string
            colorcolumn = "0",
            --- @type boolean
            number = false,
            --- @type boolean
            relativenumber = false,
            --- @type boolean
            foldenable = false,
            --- @type boolean
            list = false,
            --- @type boolean
            wrap = true,
            --- @type boolean
            linebreak = true,
        }
    
        NoNeckPain.bufferOptionsBo = {
            --- @type string
            filetype = "no-neck-pain",
            --- @type string
            buftype = "nofile",
            --- @type string
            bufhidden = "hide",
            --- @type boolean
            buflisted = false,
            --- @type boolean
            swapfile = false,
        }
    
        --- NoNeckPain's scratchPad buffer options.
        ---
        --- 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.
        ---
        ---@type table
        ---Default values:
        ---@eval return MiniDoc.afterlines_to_code(MiniDoc.current.eval_section)
        NoNeckPain.bufferOptionsScratchPad = {
            -- When `true`, automatically sets the following options to the side buffers:
            -- - `autowriteall`
            -- - `autoread`.
            --- @type boolean
            enabled = false,
            -- The path to the file to save the scratchPad content to and load it in the buffer.
            --- @type string?
            --- @example: `~/notes.norg`
            pathToFile = "",
        }
    end
    }

3. Exit nvim and reenter.

## Expected behavior

I'd expect (perhaps) that the no-neck-pane buffers would not have unfocused status lines and the status line would go across the whole window..?

## Environment

- Neovim version: 0.9.5 (on MacOS via Homebrew)
- no-neck-pain.nvim version: v0.1.2.1
- Plugin clash: Possibly Noice? none obviously
avastmick commented 5 months ago

Sorry, it was my fault. I'd lost the global status setting when I moved to lua from vim. Apologies.

Great plugin

shortcuts commented 5 months ago

Thanks @avastmick for using the plugin and I'm glad it can help you ❤️‍🔥 I've exactly made it for this use case of wide screen neovim setup :D

avastmick commented 5 months ago

Two days of usage and the shoulder pain is gone! Frankly, I'd pay for this my friend! Can't thank you enough for the plugin.