Skip to content

Commit

Permalink
refactor: use vim.keymap.set instead of nvim_set_keymap
Browse files Browse the repository at this point in the history
  • Loading branch information
monaqa committed Sep 9, 2023
1 parent 23f6d2a commit 7f3f527
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions plugin/dial.vim
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ let s:save_cpo = &cpo " save user coptions
set cpo&vim " reset them to defaults

lua << EOF
vim.api.nvim_set_keymap("n", "<Plug>(dial-increment)", require("dial.map").inc_normal(), {noremap = true})
vim.api.nvim_set_keymap("n", "<Plug>(dial-decrement)", require("dial.map").dec_normal(), {noremap = true})
vim.api.nvim_set_keymap("n", "g<Plug>(dial-increment)", require("dial.map").inc_gnormal(), {noremap = true})
vim.api.nvim_set_keymap("n", "g<Plug>(dial-decrement)", require("dial.map").dec_gnormal(), {noremap = true})
vim.api.nvim_set_keymap("v", "<Plug>(dial-increment)", require("dial.map").inc_visual() .. "gv", {noremap = true})
vim.api.nvim_set_keymap("v", "<Plug>(dial-decrement)", require("dial.map").dec_visual() .. "gv", {noremap = true})
vim.api.nvim_set_keymap("v", "g<Plug>(dial-increment)", require("dial.map").inc_gvisual() .. "gv", {noremap = true})
vim.api.nvim_set_keymap("v", "g<Plug>(dial-decrement)", require("dial.map").dec_gvisual() .. "gv", {noremap = true})
vim.keymap.set("n", "<Plug>(dial-increment)", require("dial.map").inc_normal())
vim.keymap.set("n", "<Plug>(dial-decrement)", require("dial.map").dec_normal())
vim.keymap.set("n", "g<Plug>(dial-increment)", require("dial.map").inc_gnormal())
vim.keymap.set("n", "g<Plug>(dial-decrement)", require("dial.map").dec_gnormal())
vim.keymap.set("v", "<Plug>(dial-increment)", require("dial.map").inc_visual() .. "gv")
vim.keymap.set("v", "<Plug>(dial-decrement)", require("dial.map").dec_visual() .. "gv")
vim.keymap.set("v", "g<Plug>(dial-increment)", require("dial.map").inc_gvisual() .. "gv")
vim.keymap.set("v", "g<Plug>(dial-decrement)", require("dial.map").dec_gvisual() .. "gv")
EOF

command! -range -nargs=? DialIncrement lua require"dial.command".command("increment", {from = <line1>, to = <line2>}, {<f-args>})
Expand Down

0 comments on commit 7f3f527

Please sign in to comment.