neovim

Neovim text editor
git clone https://git.dasho.dev/neovim.git
Log | Files | Refs | README

mouse.vim (2506B)


      1 " Helper functions for generating mouse events
      2 
      3 let g:Ttymouse_values = ['sgr']
      4 let g:Ttymouse_dec = []
      5 let g:Ttymouse_netterm = []
      6 
      7 func MouseLeftClick(row, col)
      8  call nvim_input_mouse('left', 'press', '', 0, a:row - 1, a:col - 1)
      9  call getchar(1)
     10  call feedkeys('', 'x!')
     11 endfunc
     12 
     13 func MouseMiddleClick(row, col)
     14  call nvim_input_mouse('middle', 'press', '', 0, a:row - 1, a:col - 1)
     15  call getchar(1)
     16  call feedkeys('', 'x!')
     17 endfunc
     18 
     19 func MouseRightClick(row, col)
     20  call nvim_input_mouse('right', 'press', '', 0, a:row - 1, a:col - 1)
     21  call getchar(1)
     22  call feedkeys('', 'x!')
     23 endfunc
     24 
     25 func MouseCtrlLeftClick(row, col)
     26  call nvim_input_mouse('left', 'press', 'C', 0, a:row - 1, a:col - 1)
     27  call getchar(1)
     28  call feedkeys('', 'x!')
     29 endfunc
     30 
     31 func MouseCtrlRightClick(row, col)
     32  call nvim_input_mouse('right', 'press', 'C', 0, a:row - 1, a:col - 1)
     33  call getchar(1)
     34  call feedkeys('', 'x!')
     35 endfunc
     36 
     37 func MouseAltLeftClick(row, col)
     38  call nvim_input_mouse('left', 'press', 'A', 0, a:row - 1, a:col - 1)
     39  call getchar(1)
     40  call feedkeys('', 'x!')
     41 endfunc
     42 
     43 func MouseAltRightClick(row, col)
     44  call nvim_input_mouse('right', 'press', 'A', 0, a:row - 1, a:col - 1)
     45  call getchar(1)
     46  call feedkeys('', 'x!')
     47 endfunc
     48 
     49 func MouseLeftRelease(row, col)
     50  call nvim_input_mouse('left', 'release', '', 0, a:row - 1, a:col - 1)
     51  call getchar(1)
     52  call feedkeys('', 'x!')
     53 endfunc
     54 
     55 func MouseMiddleRelease(row, col)
     56  call nvim_input_mouse('middle', 'release', '', 0, a:row - 1, a:col - 1)
     57  call getchar(1)
     58  call feedkeys('', 'x!')
     59 endfunc
     60 
     61 func MouseRightRelease(row, col)
     62  call nvim_input_mouse('right', 'release', '', 0, a:row - 1, a:col - 1)
     63  call getchar(1)
     64  call feedkeys('', 'x!')
     65 endfunc
     66 
     67 func MouseLeftDrag(row, col)
     68  call nvim_input_mouse('left', 'drag', '', 0, a:row - 1, a:col - 1)
     69  call getchar(1)
     70  call feedkeys('', 'x!')
     71 endfunc
     72 
     73 func MouseWheelUp(row, col)
     74  call nvim_input_mouse('wheel', 'up', '', 0, a:row - 1, a:col - 1)
     75  call getchar(1)
     76  call feedkeys('', 'x!')
     77 endfunc
     78 
     79 func MouseWheelDown(row, col)
     80  call nvim_input_mouse('wheel', 'down', '', 0, a:row - 1, a:col - 1)
     81  call getchar(1)
     82  call feedkeys('', 'x!')
     83 endfunc
     84 
     85 func MouseWheelLeft(row, col)
     86  call nvim_input_mouse('wheel', 'left', '', 0, a:row - 1, a:col - 1)
     87  call getchar(1)
     88  call feedkeys('', 'x!')
     89 endfunc
     90 
     91 func MouseWheelRight(row, col)
     92  call nvim_input_mouse('wheel', 'right', '', 0, a:row - 1, a:col - 1)
     93  call getchar(1)
     94  call feedkeys('', 'x!')
     95 endfunc
     96 
     97 " vim: shiftwidth=2 sts=2 expandtab