Vim touchscreen scrolling support.

Use the environment variable to turn it on.
This commit is contained in:
ADAM David Alan Martin
2022-04-15 15:10:18 -04:00
parent 5174b9bee6
commit 7758c2b961
2 changed files with 45 additions and 0 deletions

View File

@ -23,5 +23,9 @@ source ~/.vim/vimrc.functions
source ~/.vim/vimrc.fileprefs source ~/.vim/vimrc.fileprefs
source ~/.vim/vimrc.statusline source ~/.vim/vimrc.statusline
if exists('$CSHENV_TOUCHSCREEN')
source ~/.vim/vimrc.mousescroll
endif
set shell=/bin/tcsh set shell=/bin/tcsh
"set t_Co=1 "set t_Co=1

41
vim/vimrc.mousescroll Normal file
View File

@ -0,0 +1,41 @@
function! MouseScrollTouch()
"mark b is the current cursor position
"mark a is the previous cursor position
norm mb
let currPos= line('.')
norm `a
let prevPos= line('.')
let amt= 1 + abs(currPos - prevPos) / 2
"norm `bma
while amt > 0
if currPos>prevPos
norm 
elseif currPos<prevPos
"norm `bma
norm 
endif
let amt= amt - 1
endwhile
endfunction
function! MouseScrollClick()
"mark b is the current cursor position
"mark a is the previous cursor position
norm mb
let currPos= line('.')
norm `a
let prevPos= line('.')
let amt= 1 + abs(currPos - prevPos) / 2
norm `bma
while amt > 0
if currPos>prevPos
norm 
elseif currPos<prevPos
"norm `bma
norm 
endif
let amt= amt - 1
endwhile
endfunction
map <LeftDrag> ma<LeftMouse>:call MouseScrollTouch()<cr>