shortcuts / no-neck-pain.nvim Goto Github PK
View Code? Open in Web Editor NEW☕ Dead simple yet super extensible plugin to center the currently focused buffer to the middle of the screen.
License: MIT License
☕ Dead simple yet super extensible plugin to center the currently focused buffer to the middle of the screen.
License: MIT License
motivated by #18
seems to be when the target buffer contains a float window
The content of main buffer is shifted as diagnostics plugin shows a warning.
:set signcolumn=auto
Left empty buffer shrinks for the size of signcolumn
. The content of main buffer stays still.
Error executing vim.schedule lua callback: ...packer/start/no-neck-pain.nvim/lua/no-neck-pain/util.lua:111: Vim:E444: Cannot close last window
will investigate for reproduction steps
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>
:NoNeckPain
)The error should not appear.
The goal is to explain why this plugin exists although there is existing ones
When using this plugin with pseudo buffers like nvim-tree, the focused buffer jumps around.
nvim-tree
:NoNeckPain
:NvimTreeToggle
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.
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.
:NoNeckPain
:split
I would expect the plugin to remain in "centered" mode until I run :vsplit
.
we use only
when disabling NNP, which kills splits etc. this should be configurable
First I'd like to thank you for writing this plugin, I've been wanting this kind of feature for so long!
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.
:e buffer1
, :e buffer2
:NoNeckPain
:bdelete
Only buffer buffer2
should have been closed.
https://github.com/shortcuts/no-neck-pain.nvim/blob/main/lua/no-neck-pain/config.lua#L17-L20
those could accept a table with a width
property, which would allow more customization
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?
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.
buffers.background.colorCode
does not support everforest
support color codes for https://github.com/sainnhe/everforest
killing buffers should only be done when there's not enough space on the screen, even in vsplit.
something like this: winwidth > ((padding * 2) + widthmain + (widthvsplit * nbvsplit))
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
no install snippet for https://github.com/folke/lazy.nvim
install snippet for https://github.com/folke/lazy.nvim is in the README.md
note: less than 3 buffers only if leftPaddingOnly
is failed, otherwise it's only 1 buffer.
which provide:
The values are not validated
We can leverage assert
to validate the provided options
Similarly to what have been done for dashboard-nvim, we can provide a snippet for nvim-tree: https://github.com/shortcuts/no-neck-pain.nvim/wiki/Automate-%60no-neck-pain.nvim%60-enabling
also, start
should still be exposed, under the enable
name like internally.
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.
it would be rewarding for anyone contributing to have their name in the changelogs
No double quotes allowed in vim-plug install commands
correct version =
-- stable version
Plug 'shortcuts/no-neck-pain.nvim', { 'tag': '*' }
-- dev version
Plug 'shortcuts/no-neck-pain.nvim'
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.
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.
Currently, running :NoNeckPain
will enable it for every opened and new buffers.
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
.
motivated by @nullchilly's comment, see https://github.com/nullchilly/fsread.nvim
we could provide the toggle :NoNeckPain
on the package import directly e.g. use "shortcuts/no-neck-pain.nvim"
Lets see if it works well
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.
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.
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.
:tabnew
Note: if you close all extra tabs, they re-appear again.
They should not disappear.
Few things here:
WinSeparator
as highlight) but the left one is white, which probably infers it from Normal
: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.
to prevent introducing regressions, more test cases should be added.
our callback functions (https://github.com/shortcuts/no-neck-pain.nvim/blob/main/lua/no-neck-pain/main.lua#L92) does not leverage the parameters provided, which make some of our calls to the vim api redundant
leverage the parameter
Open scratch pad buffer like norg file
it would create a side left buffer but not the right one
there might be overlapping condition, or high complexity events for unwanted reasons
It would be great to define some dim values for the background of the side buffers
Highlight groups are cleared when the plugin is disabled
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.