summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--fnl/plugins/venn.fnl33
-rw-r--r--lazy-lock.json1
2 files changed, 34 insertions, 0 deletions
diff --git a/fnl/plugins/venn.fnl b/fnl/plugins/venn.fnl
new file mode 100644
index 0000000..037fcbc
--- /dev/null
+++ b/fnl/plugins/venn.fnl
@@ -0,0 +1,33 @@
+;; Draw ASCII diagrams in Neovim
+
+(lambda enable [win]
+ (tset (. vim.w win) :venn_enabled true)
+ (set vim.wo.virtualedit :all)
+ (vim.api.nvim_buf_set_keymap 0 :n :J "<c-v>j:VBox<cr>" {:noremap true})
+ (vim.api.nvim_buf_set_keymap 0 :n :K "<c-v>k:VBox<cr>" {:noremap true})
+ (vim.api.nvim_buf_set_keymap 0 :n :L "<c-v>l:VBox<cr>" {:noremap true})
+ (vim.api.nvim_buf_set_keymap 0 :n :H "<c-v>h:VBox<cr>" {:noremap true})
+ (vim.api.nvim_buf_set_keymap 0 :v :f ":VBox<cr>" {:noremap true}))
+
+(lambda disable [win]
+ (set vim.wo.virtualedit "")
+ (vim.api.nvim_buf_del_keymap 0 :n :J)
+ (vim.api.nvim_buf_del_keymap 0 :n :K)
+ (vim.api.nvim_buf_del_keymap 0 :n :L)
+ (vim.api.nvim_buf_del_keymap 0 :n :H)
+ (vim.api.nvim_buf_del_keymap 0 :v :f)
+ (tset (. vim.w win) :venn_enabled nil))
+
+(lambda toggle []
+ (let [win (vim.api.nvim_get_current_win)]
+ (let [enabled (vim.inspect (. (. vim.w win) :venn_enabled))]
+ (if (= enabled :nil)
+ (enable win)
+ (disable win)))))
+
+(fn config []
+ (vim.keymap.set :n :<leader>v (fn []
+ (toggle))
+ {:noremap true :desc "Toggle Venn Diagram"}))
+
+{1 :jbyuki/venn.nvim : config}
diff --git a/lazy-lock.json b/lazy-lock.json
index 3fc2f63..c9dfdf6 100644
--- a/lazy-lock.json
+++ b/lazy-lock.json
@@ -62,6 +62,7 @@
"telescope.nvim": { "branch": "master", "commit": "6f6bb8065567b56c42e283b06e8a1c670c0092a1" },
"trouble.nvim": { "branch": "main", "commit": "b9cf677f20bb2faa2dacfa870b084e568dca9572" },
"undotree": { "branch": "master", "commit": "56c684a805fe948936cda0d1b19505b84ad7e065" },
+ "venn.nvim": { "branch": "main", "commit": "b09c2f36ddf70b498281845109bedcf08a7e0de0" },
"vim-dadbod": { "branch": "master", "commit": "37523ffe0849b51db07fa7f48430c2aca5420a0e" },
"vim-dadbod-completion": { "branch": "master", "commit": "c920cb0ba3dff4b1b0ed373e1c0b3007dec696c2" },
"vim-dadbod-ui": { "branch": "master", "commit": "23ed6edb60dcef9b30b741ca4b00ac4637da7d69" },