1
0
Fork 0
mirror of synced 2024-12-21 22:41:06 -05:00

Removed comfortable-motion.vim

It's isn't worth the hacks and issues.

Ref: https://github.com/amix/vimrc/issues/470
This commit is contained in:
Amir Salihefendic 2019-11-18 09:42:59 +01:00
parent fe5d99ff00
commit c30a27a14d
6 changed files with 0 additions and 279 deletions

View file

@ -90,7 +90,6 @@ I recommend reading the docs of these plugins to understand them better. Each pl
* [ack.vim](https://github.com/mileszs/ack.vim): Vim plugin for `the_silver_searcher` (ag) or ack -- a wicked fast grep
* [bufexplorer.zip](https://github.com/vim-scripts/bufexplorer.zip): Quickly and easily switch between buffers. This plugin can be opened with `<leader+o>`
* [ctrlp.vim](https://github.com/ctrlpvim/ctrlp.vim): Fuzzy file, buffer, mru and tag finder. It's mapped to `<Ctrl+F>`
* [comfortable-motion.vim](https://github.com/yuttie/comfortable-motion.vim): Brings physics-based smooth scrolling to the Vim world!
* [goyo.vim](https://github.com/junegunn/goyo.vim) and [vim-zenroom2](https://github.com/amix/vim-zenroom2):
* [lightline.vim](https://github.com/itchyny/lightline.vim): A light and configurable statusline/tabline for Vim
* [NERD Tree](https://github.com/scrooloose/nerdtree): A tree explorer plugin for vim

View file

@ -1,21 +0,0 @@
MIT License
Copyright (c) 2016 Yuta Taniguchi
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View file

@ -1,136 +0,0 @@
# comfortable-motion.vim
Brings physics-based smooth scrolling to the Vim/Neovim world!
This is highly motivated by the lack of a plugin similar to my favorite Emacs package [emacs-inertial-scroll](https://github.com/kiwanami/emacs-inertial-scroll).
Scroll with `C-d`/`C-u`:
![Scroll with `C-d`/`C-u`](https://cloud.githubusercontent.com/assets/158553/21579969/841ab468-d013-11e6-8ce6-aa5442d52b6b.gif)
Scroll with `C-f`/`C-b`:
![Scroll with `C-f`/`C-b`](https://cloud.githubusercontent.com/assets/158553/21579968/841929ea-d013-11e6-82fb-e0f3d3e8e896.gif)
## Requirements
This plugin depends on the timer API, which requires Vim/Neovim to be at least the following version:
- Vim 7.4.1578 or above
- Neovim 0.1.5 or above
However, currently, this plugin is only tested on Vim 8.0 and Neovim 0.1.7, i.e. my current development environment.
## Installation
For example, with [vim-plug](https://github.com/junegunn/vim-plug):
```vim
Plug 'yuttie/comfortable-motion.vim'
```
## Configuration
Please note that the following mappings for `<C-d>` and `<C-u>` are not ones for you if you expect they scroll a buffer just half a window.
### Scrolling Method
This plugin relies on `<C-e>` and `<C-y>` by default to actually scroll a window.
You can customize these keys to other combinations like `j` and `k` as follows:
```vim
let g:comfortable_motion_scroll_down_key = "j"
let g:comfortable_motion_scroll_up_key = "k"
```
This results in:
![Different scrolling method](https://cloud.githubusercontent.com/assets/158553/24331179/ebc5b106-1269-11e7-90c2-747a68dec44b.gif)
Please note that you cannot choose complex keys consisting of multiple motions, e.g. `$j`.
This is because the current implementation prepends the number of scroll amount to the keys, e.g. `5$j`, and executes it once per simulation tick.
### Keys and Mouse Wheel
By default, the following key mappings are defined.
```vim
nnoremap <silent> <C-d> :call comfortable_motion#flick(100)<CR>
nnoremap <silent> <C-u> :call comfortable_motion#flick(-100)<CR>
nnoremap <silent> <C-f> :call comfortable_motion#flick(200)<CR>
nnoremap <silent> <C-b> :call comfortable_motion#flick(-200)<CR>
```
To prevent the plugin from defining those default key mappings,
you can set `g:comfortable_motion_no_default_key_mappings` to 1.
```vim
let g:comfortable_motion_no_default_key_mappings = 1
```
Additionally, if your Vim/NeoVim has mouse support, you can get mouse wheel to scroll a window by the following mappings:
```vim
noremap <silent> <ScrollWheelDown> :call comfortable_motion#flick(40)<CR>
noremap <silent> <ScrollWheelUp> :call comfortable_motion#flick(-40)<CR>
```
You may need to enable the `mouse` option for the above to work, for example, by `set mouse=a`.
### Simulation Parameters
There are three configurable parameters:
* `g:comfortable_motion_interval` [default: 1000.0 / 60]
* `g:comfortable_motion_friction` [default: 80.0]
* `g:comfortable_motion_air_drag` [default: 2.0]
For example, with any of the following configurations, you can get `<C-u>`/`<C-d>` (with the
default impulse value of `-100`/`100`) to scroll a window about 25 lines, but
tastes are different.
### Friction & Air Resistance
```vim
let g:comfortable_motion_friction = 80.0
let g:comfortable_motion_air_drag = 2.0
```
### Friction Only
```vim
let g:comfortable_motion_friction = 200.0
let g:comfortable_motion_air_drag = 0.0
```
### Air Resistance Only
```vim
let g:comfortable_motion_friction = 0.0
let g:comfortable_motion_air_drag = 4.0
```
## Advanced Configurations
If you would like to use scrolling proportional to the window height,
you may use settings such as these:
```vim
let g:comfortable_motion_no_default_key_mappings = 1
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>
```
## License
MIT License

View file

@ -1,91 +0,0 @@
"=============================================================================
" File: comfortable_motion.vim
" Author: Yuta Taniguchi
" Created: 2016-10-02
"=============================================================================
scriptencoding utf-8
if !exists('g:loaded_comfortable_motion')
finish
endif
let g:loaded_comfortable_motion = 1
let s:save_cpo = &cpo
set cpo&vim
" Default parameter values
if !exists('g:comfortable_motion_interval')
let g:comfortable_motion_interval = 1000.0 / 60
endif
if !exists('g:comfortable_motion_friction')
let g:comfortable_motion_friction = 80.0
endif
if !exists('g:comfortable_motion_air_drag')
let g:comfortable_motion_air_drag = 2.0
endif
if !exists('g:comfortable_motion_scroll_down_key')
let g:comfortable_motion_scroll_down_key = "\<C-e>"
endif
if !exists('g:comfortable_motion_scroll_up_key')
let g:comfortable_motion_scroll_up_key = "\<C-y>"
endif
" The state
let s:comfortable_motion_state = {
\ 'impulse': 0.0,
\ 'velocity': 0.0,
\ 'delta': 0.0,
\ }
function! s:tick(timer_id)
let l:st = s:comfortable_motion_state " This is just an alias for the global variable
if abs(l:st.velocity) >= 1 || l:st.impulse != 0 " short-circuit if velocity is less than one
let l:dt = g:comfortable_motion_interval / 1000.0 " Unit conversion: ms -> s
" Compute resistance forces
let l:vel_sign = l:st.velocity == 0
\ ? 0
\ : l:st.velocity / abs(l:st.velocity)
let l:friction = -l:vel_sign * g:comfortable_motion_friction * 1 " The mass is 1
let l:air_drag = -l:st.velocity * g:comfortable_motion_air_drag
let l:additional_force = l:friction + l:air_drag
" Update the state
let l:st.delta += l:st.velocity * l:dt
let l:st.velocity += l:st.impulse + (abs(l:additional_force * l:dt) > abs(l:st.velocity) ? -l:st.velocity : l:additional_force * l:dt)
let l:st.impulse = 0
" Scroll
let l:int_delta = float2nr(l:st.delta >= 0 ? floor(l:st.delta) : ceil(l:st.delta))
let l:st.delta -= l:int_delta
if l:int_delta > 0
execute "normal! " . string(abs(l:int_delta)) . g:comfortable_motion_scroll_down_key
elseif l:int_delta < 0
execute "normal! " . string(abs(l:int_delta)) . g:comfortable_motion_scroll_up_key
else
" Do nothing
endif
redraw
else
" Stop scrolling and the thread
let l:st.velocity = 0
let l:st.delta = 0
call timer_stop(s:timer_id)
unlet s:timer_id
endif
endfunction
function! comfortable_motion#flick(impulse)
if !exists('s:timer_id')
" There is no thread, start one
let l:interval = float2nr(round(g:comfortable_motion_interval))
let s:timer_id = timer_start(l:interval, function("s:tick"), {'repeat': -1})
endif
let s:comfortable_motion_state.impulse += a:impulse
endfunction
let &cpo = s:save_cpo
unlet s:save_cpo

View file

@ -1,29 +0,0 @@
"=============================================================================
" File: comfortable_motion.vim
" Author: Yuta Taniguchi
" Created: 2016-10-02
"=============================================================================
scriptencoding utf-8
if exists('g:loaded_comfortable_motion')
finish
endif
let g:loaded_comfortable_motion = 1
let s:save_cpo = &cpo
set cpo&vim
if !exists('g:comfortable_motion_no_default_key_mappings') ||
\ !g:comfortable_motion_no_default_key_mappings
nnoremap <silent> <C-d> :call comfortable_motion#flick(100)<CR>
nnoremap <silent> <C-u> :call comfortable_motion#flick(-100)<CR>
nnoremap <silent> <C-f> :call comfortable_motion#flick(200)<CR>
nnoremap <silent> <C-b> :call comfortable_motion#flick(-200)<CR>
endif
let &cpo = s:save_cpo
unlet s:save_cpo

View file

@ -55,7 +55,6 @@ vim-abolish https://github.com/tpope/tpope-vim-abolish
mru.vim https://github.com/vim-scripts/mru.vim
rust.vim https://github.com/rust-lang/rust.vim
vim-markdown https://github.com/plasticboy/vim-markdown
comfortable-motion.vim https://github.com/yuttie/comfortable-motion.vim
gist-vim https://github.com/mattn/gist-vim
vim-ruby https://github.com/vim-ruby/vim-ruby
typescript-vim https://github.com/leafgarland/typescript-vim