blob: 2a71e3914791548133084dfa347a0618be9b6d29 [file] [log] [blame]
Skyler Grey3d1b4502022-10-31 00:11:11 +00001-- venn.nvim: enable or disable keymappings
2function _G.Toggle_venn()
3 local venn_enabled = vim.inspect(vim.b.venn_enabled)
4 if venn_enabled == "nil" then
5 vim.b.venn_enabled = true
6 vim.cmd[[setlocal ve=all]]
7 -- draw a line on HJKL keystokes
8 vim.cmd("call HardTimeOff()")
9 vim.api.nvim_buf_set_keymap(0, "n", "J", "<C-v>j:VBox<CR>", {noremap = true})
10 vim.api.nvim_buf_set_keymap(0, "n", "K", "<C-v>k:VBox<CR>", {noremap = true})
11 vim.api.nvim_buf_set_keymap(0, "n", "L", "<C-v>l:VBox<CR>", {noremap = true})
12 vim.api.nvim_buf_set_keymap(0, "n", "H", "<C-v>h:VBox<CR>", {noremap = true})
13 -- draw a box by pressing "f" with visual selection
14 vim.api.nvim_buf_set_keymap(0, "v", "f", ":VBox<CR>", {noremap = true})
15 print("Enabled draw-mode")
16 else
17 vim.cmd("call HardTimeOn()")
18 vim.cmd[[setlocal ve=]]
19 vim.cmd[[mapclear <buffer>]]
20 vim.b.venn_enabled = nil
21 print("Disabled draw-mode")
22 end
23end
24-- toggle keymappings for venn using <leader>v
25vim.api.nvim_set_keymap('n', '<leader>d', ":lua Toggle_venn()<CR>", { noremap = true})
26vim.api.nvim_set_keymap('n', '<leader>v', ":lua Toggle_venn()<CR>", { noremap = true})
27