yuttie / comfortable-motion.vim Goto Github PK
View Code? Open in Web Editor NEWBrings physics-based smooth scrolling to the Vim world!
License: MIT License
Brings physics-based smooth scrolling to the Vim world!
License: MIT License
This is possible if we remove attenuation.
Is there a way to set the scroll speed to be faster? For example, 4x as fast.
I set maps for mouse wheel as in the example from README:
noremap <silent> <ScrollWheelDown> :call comfortable_motion#flick(40)<CR>
noremap <silent> <ScrollWheelUp> :call comfortable_motion#flick(-40)<CR>
GUI: neovim-gtk
Neovim version: v0.3.0-1233-gde7a0bdc3
When I scrolling right window by placing mouse cursor on it, "comfortable" scrolling happens in left window. See this short screencast which demonstrates it: https://youtu.be/SlHV9JrkEq8
Recently I just found out that this plugin didn't scroll exactly half page of the screen when I pressed <c-u>
or <c-d>
. But this weird behavior only happened when I ran vim inside tmux pane.
Here's my vim configuration for this plugin.
" To prevent the plugin from defining those default key mappings
let g:comfortable_motion_no_default_key_mappings = 0
" mouse wheel to scroll a window by the following mappings:
noremap <silent> <ScrollWheelDown> :call comfortable_motion#flick(40)<CR>
noremap <silent> <ScrollWheelUp> :call comfortable_motion#flick(-40)<CR>
" Scrolling proportional to the window height, you may use settings such as these:
let g:comfortable_motion_impulse_multiplier = 1 " Feel free to increase/decrease this value.
nnoremap <silent> <C-d> :call comfortable_motion#flick(g:comfortable_motion_impulse_multiplier * winheight(0) * 2)<CR>
nnoremap <silent> <C-u> :call comfortable_motion#flick(g:comfortable_motion_impulse_multiplier * winheight(0) * -2)<CR>
nnoremap <silent> <C-f> :call comfortable_motion#flick(g:comfortable_motion_impulse_multiplier * winheight(0) * 4)<CR>
nnoremap <silent> <C-b> :call comfortable_motion#flick(g:comfortable_motion_impulse_multiplier * winheight(0) * -4)<CR>
Thank you
<C-f>
など comfortable_motion#flick
が呼ばれるときに上記エラーが出ます.環境は vim 8.0.0134
, Huge version (+timers
)です.
多分 call timer_start(0, function("s:tick"), {'repeat': 0})
で tick
に timer ID が渡される からだと思うのですが,neovim/vim 間で違いがあるのかとかは調べられていません.
It would be great if the wheel events would target the window under the pointer, without need to focus it first.
Right now after installing with pathogen I get the error Error detected while processing function comfortable_motion#flick: E117: Unknown function: timer_start
anyone else see this before?
Some aliases of C-f and C-b are PageDown, Shift-Down and PageUp, Shift-Up respectively
From the Vim documentation:
*z+*
z+ Without [count]: Redraw with the line just below the
window at the top of the window. Put the cursor in
that line, at the first non-blank in the line.
With [count]: just like "z<CR>".
*z^*
z^ Without [count]: Redraw with the line just above the
window at the bottom of the window. Put the cursor in
that line, at the first non-blank in the line.
With [count]: First scroll the text to put the [count]
line at the bottom of the window, then redraw with the
line which is now at the top of the window at the
bottom of the window. Put the cursor in that line, at
the first non-blank in the line.
To reproduce:
Expected behaviour:
I would expect that the scroll continues in the split window it was initiated in.
Right now it's possible to repeatedly press the scroll command in a certain direction. As expected, the scroll commands will happily queue up and you'll find yourself several pages elsewhere. What would be really cool is if you could interrupt the queue. During the scrolling if you attempt to scroll in the opposite direction, the motion will immediately stop. This is very much like how we all intuitively use scroll panes on our touch devices. Give it a flick, and then press your thumb down when see the destination arrive.
Right now what happens is that after all the forward commands finish, the back command then plays out subsequently.
Just as the description says, run set cursorline
orset relativenumber
and use one of the scroll commands to reproduce. It seems that scrolling down becomes slower, but scrolling up is about the same speed.
gg
CTRL-F
The scrolling slows as it nears the final line.
The scrolling does not slow as it nears the final line.
From the Vim documentation:
*CTRL-E*
CTRL-E Scroll window [count] lines downwards in the buffer.
The text moves upwards on the screen.
Mnemonic: Extra lines.
*CTRL-Y*
CTRL-Y Scroll window [count] lines upwards in the buffer.
The text moves downwards on the screen.
Note: When using the MS-Windows key bindings CTRL-Y is
remapped to redo.
How can i set this up to scroll 1 line at a time. i remapped the action keys to j and k.
Hey!
Thanks for the plugin; it's amazing.
I was wondering if support for re-positioning the edit window, i.e zt, zz and zb could be added. In addition, it would also be nice to see support for forward and backward searches(n and N), move to top and bottom(gg and G).
Is it possible to support horizontal scroll?
It looks nice, but works weird. My screen height is 38 lines, when I press CTRL-F, it always over jump to 65 line, not 37 or 38 line.
It seems this plugin does not respect to &scroll value.
You may reference to terryma's implementation, it respect to &scroll value.
Currently, this repository contains GIF images in its gh-pages
branch, which are referenced by README.md
in the master branch. These images are in the repository because I didn't know that cloning the repository also copies git's objects corresponding to files in non-master branches.
As @rawaludin suggested in #5, it would be better to move those images to another place.
I'm using NeoVim and this plugin doesn't seem to be working. I have the scroll keys rebound to j
and k
but doing 50j
in my ~/init.vim
doesn't smooth scroll. I also don't notice a smooth scroll when I'm just holding down j
or k
.
I didn't see an issue about this, and I don't know how easy it would be to fix. This is a really awesome plugin, but in rxvt-unicode, the flicking when pressing <c-b>
or <c-u>
makes the screen flicker every line.
This plugin works superbly in termite
and works pretty well in gnome-terminal
, however. It even works well in xterm
. I just prefer rxvt-unicode most times.
I don't suppose there is anything you can do about this issue, but I thought I would post it.
Cheers,
dylnmc
I am setting up Vim from scratch in a new OS installation and I am running into problems when I enable this plugin.
As soon as I do ctrl-d
to scroll down, Vim freezes and it's flooded with these error messages:
:
line 34:
E121: Undefined variable: s:timer_id
E116: Invalid arguments for function timer_stop
line 35:
E108: No such variable: "s:timer_id"
I am using this plugin in a different machine (different OS, but same Vim configuration and plugins) and it worked okay.
Here are the settings for this plugin:
let g:comfortable_motion_no_default_key_mappings = 1
nnoremap <silent> <C-d> :call comfortable_motion#flick(100)<CR>
nnoremap <silent> <C-u> :call comfortable_motion#flick(-100)<CR>
Here is the list of other plugins:
Plugin 'tpope/vim-sensible'
Plugin 'kien/ctrlp.vim'
Plugin 'FelikZ/ctrlp-py-matcher'
Plugin 'mileszs/ack.vim'
Plugin 'brookhong/cscope.vim'
Plugin 'romainl/vim-qf'
Plugin 'vim-airline/vim-airline'
Plugin 'vim-airline/vim-airline-themes'
Plugin 'vim-scripts/taglist.vim'
Plugin 'majutsushi/tagbar'
Plugin 'ntpeters/vim-better-whitespace'
Plugin 'tpope/vim-fugitive'
Plugin 'christoomey/vim-tmux-navigator'
Plugin 'altercation/vim-colors-solarized'
Plugin 'vim-syntastic/syntastic'
Plugin 'vivien/vim-linux-coding-style'
Plugin 'scrooloose/nerdcommenter'
Plugin 'junegunn/vim-easy-align'
Plugin 'justinmk/vim-sneak'
"Plugin 'yuttie/comfortable-motion.vim'
Plugin 'editorconfig/editorconfig-vim'
Plugin 'AndrewRadev/linediff.vim'
I am running on Ubuntu 16.04 with the following version of Vim:
VIM - Vi IMproved 7.4 (2013 Aug 10, compiled Jun 07 2019 15:35:43)
Included patches: 1-1689
Extra patches: 8.0.0056
Modified by [email protected]
Compiled by [email protected]
Huge version without GUI. Features included (+) or not (-):
+acl +farsi +mouse_netterm +tag_binary
+arabic +file_in_path +mouse_sgr +tag_old_static
+autocmd +find_in_path -mouse_sysmouse -tag_any_white
-balloon_eval +float +mouse_urxvt -tcl
-browse +folding +mouse_xterm +terminfo
++builtin_terms -footer +multi_byte +termresponse
+byte_offset +fork() +multi_lang +textobjects
+channel +gettext -mzscheme +timers
+cindent -hangul_input +netbeans_intg +title
-clientserver +iconv +packages -toolbar
-clipboard +insert_expand +path_extra +user_commands
+cmdline_compl +job -perl +vertsplit
+cmdline_hist +jumplist +persistent_undo +virtualedit
+cmdline_info +keymap +postscript +visual
+comments +langmap +printer +visualextra
+conceal +libcall +profile +viminfo
+cryptv +linebreak -python +vreplace
+cscope +lispindent +python3 +wildignore
+cursorbind +listcmds +quickfix +wildmenu
+cursorshape +localmap +reltime +windows
+dialog_con -lua +rightleft +writebackup
+diff +menu -ruby -X11
+digraphs +mksession +scrollbind -xfontset
-dnd +modify_fname +signs -xim
-ebcdic +mouse +smartindent -xsmp
+emacs_tags -mouseshape +startuptime -xterm_clipboard
+eval +mouse_dec +statusline -xterm_save
+ex_extra +mouse_gpm -sun_workshop -xpm
+extra_search -mouse_jsbterm +syntax
system vimrc file: "$VIM/vimrc"
user vimrc file: "$HOME/.vimrc"
2nd user vimrc file: "~/.vim/vimrc"
user exrc file: "$HOME/.exrc"
fall-back for $VIM: "/usr/share/vim"
Compilation: gcc -c -I. -Iproto -DHAVE_CONFIG_H -Wdate-time -g -O2 -fPIE -fstack-protector-strong -Wformat -Werror=format-security -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1
Linking: gcc -Wl,-Bsymbolic-functions -fPIE -pie -Wl,-z,relro -Wl,-z,now -Wl,--as-needed -o vim -lm -ltinfo -lnsl -lselinux -lacl -lattr -lgpm -ldl -L/usr/lib/python3.5/config-3.5m-x86_64-linux-gnu -lpython3.5m -lpthread -ldl -lutil -lm
Some documentation of the options within vim via :help would be nice.
Hey, great plug-in! I am having one issue with it though, I have this in my vimrc:
let g:comfortable_motion_no_default_key_mappings = 1
nnoremap <silent> <C-d> :call comfortable_motion#flick(100)<CR>
nnoremap <silent> <C-u> :call comfortable_motion#flick(-100)<CR>
Cause I dont want the default mappings of C-b and C-f to interferer with other mappings I have. The problem is that when I do this, C-d and C-u stop working. The only way I can make C-d and C-u work is by removing the let g:comfortable_motion_no_default_key_mappings = 1
line, but then I get the C-b and C-f mapping which I dont want.
Edit: Turns out it was a misconfiguration on my vimrc totally independent from this plug-in. Oops.
When scrolling (for example with ctrl-d or ctrl-u), this plugin changes the vertical position of the cursor on the screen, but the cursor stays on the same linenumber.
Whereas when this plugin is not enabled, while scrolling up or down the vertical position of the cursor on the screen stays the same and the linenumber that the cursor is on will change.
Any reason for this difference? I'd prefer the default behaviour, but with the smooth scrolling that this plugin enables.
Breaks on visual mode.
e.g. vnoremap <silent> <c-d> :call comfortable_motion#flick(100)<cr>
.
I have already offered some work to improve our use of timers in this plugin as part of issue #17 . @yuttie has kindly suggested some additional changes which I agree would offer further improvement.
His relevant notes from the referenced issue:
We need to improve the other change for another issue of this plugin.
Thanks to your patch, I found that my original code redundantly starts a new tick thread whenever comfortable_motion#flick() is called, which causes unnatural acceleration.
The second change actually fixes the problem by maintaining only a single persistent tick thread.
However, it also introduces constant CPU usage even when a user doesn't use a vim.
I think we can improve the patch by stopping a tick thread when it is not needed.
This problem should be discussed in another issue.
My initial idea of how to approach this is to retain a single script-wide reference to a tick thread (represented by a timer ID), initially not started. If comfortable_motion#flick()
is called when the thread is stopped, we will start the thread (call timer_start
). If comfortable_motion#tick()
is called and it discovers that scrolling has stopped, it will stop the thread with timer_stop
.
@yuttie, does this approach seem appropriate to you?
Sometimes, I spam my scroll key to scroll faster. I would be very cool i we could just press a key to instantly stop the scrolling where my cursor is. That way i can set my scroll settings pretty low to be precise and i can just spam 3/4 time the scroll key to scroll faster and just hit a break key to stop de scrolling where i want
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.