Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: gg fast-scrolls to the top #1

Closed
benwoodward opened this issue Nov 18, 2019 · 4 comments
Closed

Feature request: gg fast-scrolls to the top #1

benwoodward opened this issue Nov 18, 2019 · 4 comments

Comments

@benwoodward
Copy link

benwoodward commented Nov 18, 2019

Not a super-necessary feature, but sublime text does this and it gives you a sense of how long the file is when you see it scroll past.

@psliwka
Copy link
Owner

psliwka commented Dec 1, 2019

This is a reasonable feature request indeed. It does, however, pose several implementation challenges:

  1. Currently, the plugin mechanics rely on scrolling, i.e. moving the window over the buffer. The cursor follows the window as a side effect, being subject to various modifiers such as scrolloff and startofpage. Commands such as gg work the other way around - they move the cursor itself, which is being followed by the window. To handle them reliably, the plugin will need to learn this difference, probably by switching between different scrolling styles depending on what command triggered movement.
  2. Cursor movement commands are frequently used to operate on ranges, f.ex. gggqG. The plugin will need to detect such cases, and either skip the animation, or delay executing further commands until the animation ends. Otherwise, subsequent commands would be applied to incorrect ranges.
  3. Any command replaced by vim-smoothie should be 100% compatible with the original one. In case of gg, that means supporting [count] and 'startofline' at least.

Similar issues apply to implementing other cursor movement commands, such as f.ex. [[ and {.

subnut added a commit to subnut/vim-smoothie that referenced this issue Nov 16, 2020
subnut added a commit to subnut/vim-smoothie that referenced this issue Nov 16, 2020
subnut added a commit to subnut/vim-smoothie that referenced this issue Nov 16, 2020
subnut added a commit to subnut/vim-smoothie that referenced this issue Nov 16, 2020
subnut added a commit to subnut/vim-smoothie that referenced this issue Nov 16, 2020
subnut added a commit to subnut/vim-smoothie that referenced this issue Nov 16, 2020
subnut added a commit to subnut/vim-smoothie that referenced this issue Nov 16, 2020
subnut added a commit to subnut/vim-smoothie that referenced this issue Nov 17, 2020
subnut added a commit to subnut/vim-smoothie that referenced this issue Nov 17, 2020
subnut added a commit to subnut/vim-smoothie that referenced this issue Nov 17, 2020
@subnut
Copy link
Contributor

subnut commented Nov 18, 2020

@benwoodward @hendry3k

Try #21 with the following configuration -

silent! map <unique> gg         <Plug>(Smoothie_gg)
silent! map <unique> G          <Plug>(Smoothie_G)

and please report bugs, if any

@benwoodward
Copy link
Author

@subnut Works well! Great work.

subnut added a commit to subnut/vim-smoothie that referenced this issue Nov 22, 2020
subnut added a commit to subnut/vim-smoothie that referenced this issue Nov 22, 2020
subnut added a commit to subnut/vim-smoothie that referenced this issue Nov 22, 2020
subnut added a commit to subnut/vim-smoothie that referenced this issue Nov 22, 2020
subnut added a commit to subnut/vim-smoothie that referenced this issue Nov 23, 2020
subnut added a commit to subnut/vim-smoothie that referenced this issue Nov 23, 2020
subnut added a commit to subnut/vim-smoothie that referenced this issue Nov 23, 2020
psliwka added a commit that referenced this issue Dec 13, 2020
@psliwka
Copy link
Owner

psliwka commented Dec 13, 2020

gg and G support has landed on master 🎉 To enable it, you can either set up custom mappings in your vimrc (as @subnut described above), or you can let g:smoothie_experimental_mappings=v:true and have them defined automatically along with the rest of default mappings.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants