GithubHelp home page GithubHelp logo

shortcuts / no-neck-pain.nvim Goto Github PK

View Code? Open in Web Editor NEW
452.0 5.0 12.0 580 KB

☕ Dead simple yet super extensible plugin to center the currently focused buffer to the middle of the screen.

License: MIT License

Lua 98.73% Makefile 1.27%
lua neovim nvim plugin neovim-plugin neovim-ui zenmode layout scratchpad ui

no-neck-pain.nvim's People

Contributors

alphakeks avatar berkeleytrue avatar embe221ed avatar github-actions[bot] avatar primamateria avatar shortcuts avatar tomdeneire avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

no-neck-pain.nvim's Issues

Highlights groups not cleared

Description

Steps to reproduce

  1. Enable
  2. Close NNP side buffer with bd
  3. See new buffer created with side buffer highlight group

Expected behavior

Highlight groups are cleared when the plugin is disabled

Side Buffers get disabled when switching tabs

Description

When creating new tabs, or switching between existing ones, the side buffers disappear. They can be re-enabled manually but I don't think this behavior is intended.

Steps to reproduce

  1. Open nvim
  2. run :tabnew
  3. switch back to the original tab
  4. the side buffers are gone

Note: if you close all extra tabs, they re-appear again.

Expected behavior

They should not disappear.

Environment

  • Neovim: 0.8.1

Screenshot at 18-35-17
Screenshot at 18-35-25

Content is shifted as diagnostics plugin shows a warning

Description

The content of main buffer is shifted as diagnostics plugin shows a warning.

Steps to reproduce

  1. open nvim
  2. run :set signcolumn=auto
  3. make sure you're using at least one diagnostics plugin
  4. make an error, so your diagnostics plugin shows a warning sign
  5. the content of main buffer is shifted

Expected behavior

Left empty buffer shrinks for the size of signcolumn. The content of main buffer stays still.

Environment

  • Neovim: 0.8.1
    unshifted
    shifted

feat: provide pre/post `enable` and pre/post `disable` callback methods

Describe the problem

Suggested here

Providing such methods would allow user to customize the behavior of the plugin, disable/enable other plugins, but also some easy escape hatch.

Describe the solution

  • Provide callback methods defined at the config level
    • (do nothing by default)
  • methods should provide some cool parameters like the internal state

Using plugin in nix configuration

Hi, I was trying to build this plugin with nix. During the build, the test phase in Makefile fails with error that module mini.test is missing.
I have noticed that in scripts/minimal_init.lua the runtime path is extended with deps/mini.nvim. Deps directory is now git-ignored.

I am not very familiar with Makefile principles, but in NPM before you execute test you usually need to install all dependencies. Would it be possible to add some prepare stage that would first clone the mini.nvim?

[Question] Border highlighting and hiding lua line

Ref. https://old.reddit.com/r/vimplugins/comments/zxndcz/update_noneckpainnvim_dead_simple_plugin_to/j24owce/

image

Few things here:

  1. The border at right appears correctly (is grey, takes in WinSeparator as highlight) but the left one is white, which probably infers it from Normal
  2. I just updated nvim to latest nightly and :NoNeckPain is unable to hide statusline anymore. I'm using lualine.

For 1, I'd prefer it to use WinSeparator too. For 2, I have no idea what caused this.

Allow enabling NoNeckPain per buffer

Describe the problem

Currently, running :NoNeckPain will enable it for every opened and new buffers.

Describe the solution

It would be nice to be able to choose whether to enable the NoNeckPain mode for every opened and new buffers or only for the current buffer. We could then be able to enable it on selected buffers rather than all of them by default. This would also, as a consequence, allow users to enable the plugin for specific filetypes using autocmd.

Jumps around when being used with nvim-tree

Description

When using this plugin with pseudo buffers like nvim-tree, the focused buffer jumps around.

Steps to reproduce

  1. Install this plugin and nvim-tree
  2. Run :NoNeckPain
  3. Run :NvimTreeToggle
  4. The focused buffer jumps around

Without nvim-tree

Screenshot 2022-12-19 at 12 10 13

With nvim-tree

Screenshot 2022-12-19 at 12 10 32

Expected behavior

I would expect the focused buffer to stay in place when the only other buffer opened is a pseudo buffer like nvim-tree and they both fit next to each other without any jumping around.

The current behavior is even weirder for me when using something like symbols-outline.

Environment

  • Neovim: 0.8.x
  • Plugin clash: nvim-tree

When NoNeckPain mode toggled, running `:bdelete` also close the current window

First I'd like to thank you for writing this plugin, I've been wanting this kind of feature for so long!

Description

After running :NoNeckPain, running :bdelete will close the current window even if there are multiple other opened buffers. This means that running :bdelete will effectively close Neovim if no other windows has been created, even if other buffers are opened.

Steps to reproduce

  1. Open Neovim
  2. :e buffer1, :e buffer2
  3. :NoNeckPain
  4. :bdelete
  5. Neovim closes even if there was still another buffer opened

Expected behavior

Only buffer buffer2 should have been closed.

Environment

  • Neovim: 0.8.1

Doesn't play well with dashboard-nvim

If I open vim without a buffer selected, I should see my dashboard.

Instead I see my dashboard quickly pushed to the right and I'm left with an empty buffer. Further file openings show no NNP.

If I open vim with a file selected, it works fine.

Too long returning to NNP mode

Description

I had shortcut for buffer closing map('n', ',x', ':wq<cr>'). When i open two buffers with vertical split NNP mode is disabled. Then two ways:
1 - i close buffer with :q or :wq and return to NNP mode. It's normal.
2 - i close buffer using shortcut, then nvim returns to NNP mode only after ~5s.

Disables on horizontal split

Description

The plugin shows the expected behavior when running :vsplit (i.e., it exits "centered" mode until I close the second vertical split).
However, I would not expect the plugin to exit "centered" mode, when :split is being run, as that doesn't require any additional horizontal space.

Steps to reproduce

  1. Run :NoNeckPain
  2. Run :split
  3. The plugin exits "centered" mode

Expected behavior

I would expect the plugin to remain in "centered" mode until I run :vsplit.

Environment

  • Neovim: 0.8.x

Feat: Close side buffers if they are the last

Describe the problem

I am used to that nvim quits when I <c-w>q my current window, which is the only one opened. Now, with the side buffers opened, it hangs on them.

Describe the solution

The plugin checks if the only opened windows have the buff IDs which equal to side buffers, and if yes, it automatically closes them, which should result in closing the editor.

I can also try to help to work on the PR if I will have time.

feat: do not kill side buffers in vsplit, if there's enough space

Describe the problem

Suggested here and here

killing buffers should only be done when there's not enough space on the screen, even in vsplit.

Describe the solution

  • side buffers are still present on vsplit with big windows
  • side buffers are disabled when there's not enough space to host more than 2 main windows

something like this: winwidth > ((padding * 2) + widthmain + (widthvsplit * nbvsplit))

Buffers remain open when work buffer is closed

If I open a file to edit, NNP is activated.

If I then close this file, I'm left with the empty side buffers created by NNP.

I'm not sure how hard this is, but it be great if these where the last buffers open, that they'd close themselves.

mkview triggers error when exiting the plugin

Description

When exiting a file while NoNeckPain is toggled, the following error occurs:

Error executing vim.schedule lua callback: ...er/start/no-neck-pain.nvim/lua/no-neck-pain/util/win.lua:122
: Vim(mkview):E32: No file name
stack traceback:
        [C]: in function 'nvim_win_close'
        ...er/start/no-neck-pain.nvim/lua/no-neck-pain/util/win.lua:122: in function 'close'
        ...packer/start/no-neck-pain.nvim/lua/no-neck-pain/main.lua:57: in function 'close'
        ...packer/start/no-neck-pain.nvim/lua/no-neck-pain/main.lua:350: in function <
        ...packer/start/no-neck-pain.nvim/lua/no-neck-pain/main.lua:325>

Steps to reproduce

  1. Open a file
  2. Toggle NoNeckPain on (:NoNeckPain)
  3. Quit neovim

Expected behavior

The error should not appear.

Environment

  • Neovim version: 0.8.2, Release (LuaJIT 2.1.0-beta3)
  • no-neck-pain.nvim version: 0.2.3
  • Might be relevant: my neovim config can be found here

feat: easier dashboard-nvim support

We can move this snippet to an internal check in the enable method

-- do not trigger when opening dashboard (e.g. dashboard-nvim)
if vim.bo.filetype == "dashboard" then
	return
end

the goal is to reduce the snippet length to automate NNP enabling

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.