Comments (9)
Also, the position and the height of a scrollbar is determined by the actual line number (not fully aware of folding). This makes the movement of the scrollbar not uniform and very awkward (it suddenly makes a huge jump) around folded lines.
UPDATE: NVM, sorry. This is configurable as let g:scrollview_mode = 'virtual'
.
from nvim-scrollview.
Thanks @wookayin!
In addition to the 'virtual'
option for scrollview_mode
, which you mentioned above, the 'flexible'
mode also accounts for folds.
If there were autocmd
events that corresponded to fold opening and closing, the plugin would be able to refresh the scrollbars when those events are triggered, but as far as I know there are no such events.
This problem is now documented under :help scrollview-issues
(057ec56), along with the following proposed workaround, which could be used with zM
and zR
(based on your comment above):
- Remap the problematic fold command key sequences accordingly, depending on the fold commands you use.
nnoremap <silent> zo zo:silent! ScrollViewRefresh<cr>
nnoremap <silent> zc zc:silent! ScrollViewRefresh<cr>
from nvim-scrollview.
Thanks. We would need an autocmd event for fold updates for this. As a side note, how about providing <Plug>
mappings to make custom keymaps much easier?
from nvim-scrollview.
"As a side note, how about providing mappings to make custom keymaps much easier?"
My interpretation is that the request is so that something like:
nnoremap <silent> zM zM:silent! ScrollViewRefresh<cr>
can be replaced with:
nmap <silent> zM zM<Plug>ScrollViewRefresh
(where I changed nnoremap
to nmap
, since a recursive mapping is required to expand <Plug>ScrollViewRefresh
)
That example would have zM
on the right-hand-side, so this would presumably cause an infinite recursion, as the right-hand-side includes the left-hand-side. However, in my experiments there is no infinite recursion, for reasons that aren't clear to me (my expectation is that zM
on the right-hand-side would infinitely expand, since the mapping is recursive). I didn't see anything in Vim's documentation on any special-case handling that would prevent an infinite recursion in this type of scenario (e.g., some handling to prevent expansion if the right-hand-side begins with the left-hand-side).
@wookayin, can you provide more details on the usage you are thinking of?
from nvim-scrollview.
@wookayin, I've added the following <Plug>
mappings (64de102). Thanks for the idea!
Left-hand-side | Right-hand-side |
---|---|
<Plug>(ScrollViewDisable) |
<cmd>ScrollViewDisable<cr> |
<Plug>(ScrollViewEnable) |
<cmd>ScrollViewEnable<cr> |
<Plug>(ScrollViewRefresh) |
<cmd>ScrollViewRefresh<cr> |
Instead of:
nnoremap <silent> zM zM:silent! ScrollViewRefresh<cr>
it's now possible to use:
nmap zM zM<Plug>(ScrollViewRefresh)
My earlier confusion about why this doesn't result in an infinite recursion was resolved by an answer to a question I asked on vi.stackexchange.com. As documented in :help recursive_mapping
, there is an exception to recursive expansion when the right-hand-side starts with the left-hand-side.
from nvim-scrollview.
Thank you @dstein64! That was exactly I was figuring. For now, I will need to use this keymap-based workaround to trigger the refresh command for folding-related actions.
from nvim-scrollview.
Upstream neovim issue for "fold" update events: neovim/neovim#8538
from nvim-scrollview.
As of 79797a0, an assortment of workarounds are automatically applied, including refreshing the scrollbars after z
fold commands (currently excluding zf
in normal mode). This doesn't fully address the issue, as :
fold commands (e.g., :fold
) and zf
in normal mode could still lead to the scrollbars being out-of-sync.
The workarounds can be disabled with let g:scrollview_auto_workarounds = 0
.
from nvim-scrollview.
"This doesn't fully address the issue, as
:
fold commands (e.g.,:fold
) andzf
in normal mode could still lead to the scrollbars being out-of-sync."
Scrollbars are now refreshed after zf
is used in normal mode.
:
fold commands will still result in scrollbars temporarily out-of-sync (until the next refresh).
from nvim-scrollview.
Related Issues (20)
- [question] disabling keybinds HOT 19
- Error related to Mappings. HOT 3
- Refresh mappings conflict with buffer-local mappings HOT 2
- Bug: E5108: Error executing lua [string ":lua"]:1: attempt to call field 'set_state' (a nil value) HOT 3
- Bug: Scrollview signs+null-ls causes nvim crash on ":set nu" or ":%s" replace HOT 1
- Issues with Winblend and Transparent Terminal Background HOT 6
- Feature Request: set some sign inside the scrollbars HOT 9
- `winblend` is not respected on hovering signs HOT 2
- Changing `list/nolist` or `listchars` crashes nvim with `trail` sign enabled at startup config HOT 3
- Add support for gitsigns HOT 4
- Pointer position is not adjusted when `winbar` is set HOT 1
- Signs won't go away HOT 4
- Search sign colors HOT 3
- opening a large file with a lot of error slows down nvim HOT 4
- [Question] How to add a horizontal scrollbar ? HOT 2
- nvim-scrollview not seeing diagnostics from coc.nvim HOT 2
- Compatibility with 0.10 extmark sign HOT 2
- Cursor positions changes undeterminably while scrolling past it HOT 4
- Cursor moves to bottom left of window when dragging scrollbar with wrapped lines
- gitsigns spacing and colour HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nvim-scrollview.