notomo/gesture.nvim

github github
mouse plugin
star 207
stars
alert-circle 0
open issues
users 5
subscribers
git-branch 1
forks
CREATED

2018-10-27

UPDATED

4 months ago

packer

require('packer').startup(function()
  use 'notomo/gesture.nvim'
end)

paq

require "paq" { 
  'notomo/gesture.nvim'
}

gesture.nvim

ci

gesture.nvim is a mouse gesture plugin for Neovim (nightly).

Usage

set mouse=a

nnoremap <silent> <LeftDrag> <Cmd>lua require("gesture").draw()<CR>
nnoremap <silent> <LeftRelease> <Cmd>lua require("gesture").finish()<CR>

" or if you would like to use right click
nnoremap <RightMouse> <Nop>
nnoremap <silent> <RightDrag> <Cmd>lua require("gesture").draw()<CR>
nnoremap <silent> <RightRelease> <Cmd>lua require("gesture").finish()<CR>

lua << EOF
local gesture = require('gesture')
gesture.register({
  name = "scroll to bottom",
  inputs = { gesture.up(), gesture.down() },
  action = "normal! G"
})
gesture.register({
  name = "next tab",
  inputs = { gesture.right() },
  action = "tabnext"
})
gesture.register({
  name = "previous tab",
  inputs = { gesture.left() },
  action = function(ctx) -- also can use callable
    vim.cmd("tabprevious")
  end,
})
gesture.register({
  name = "go back",
  inputs = { gesture.right(), gesture.left() },
  -- map to `<C-o>` keycode
  action = [[lua vim.api.nvim_feedkeys(vim.api.nvim_replace_termcodes("<C-o>", true, false, true), "n", true)]]
})
EOF