Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jbyuki/venn.nvim
Draw ASCII diagrams in Neovim
https://github.com/jbyuki/venn.nvim
ascii-art ascii-graphics diagrams neovim nvim
Last synced: about 2 months ago
JSON representation
Draw ASCII diagrams in Neovim
- Host: GitHub
- URL: https://github.com/jbyuki/venn.nvim
- Owner: jbyuki
- License: mit
- Created: 2021-06-01T15:00:41.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2023-11-05T19:46:48.000Z (7 months ago)
- Last Synced: 2024-01-24T10:39:55.351Z (4 months ago)
- Topics: ascii-art, ascii-graphics, diagrams, neovim, nvim
- Language: Lua
- Homepage:
- Size: 52.7 KB
- Stars: 835
- Watchers: 9
- Forks: 13
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Lists
- awesome-neovim - jbyuki/venn.nvim - Draw ASCII diagrams. (Note Taking / Cursorline)
- awesome-stars - venn.nvim
- awesome-stars - jbyuki/venn.nvim - Draw ASCII diagrams in Neovim (Lua)
- awesome-stars - jbyuki/venn.nvim - Draw ASCII diagrams in Neovim (Lua)
- awesome-stars - jbyuki/venn.nvim - Draw ASCII diagrams in Neovim (Lua)
- awesome-neovim - jbyuki/venn.nvim - Draw ASCII diagrams. (Note Taking / Cursorline)
- awesome-neovim - jbyuki/venn.nvim - Draw ASCII diagrams. (Note Taking / Cursorline)
- my-neovim-pluginlist - jbyuki/venn.nvim - commit/jbyuki/venn.nvim) ![](https://img.shields.io/github/commit-activity/y/jbyuki/venn.nvim) (New features / Diagram)
README
venn.nvim
=========![](https://github.com/jbyuki/gifs/blob/main/Untitled%20Project.gif?raw=true)
Draw ASCII diagrams in Neovim.
Installation
------------Install using your prefered method:
- [vim-plug](https://github.com/junegunn/vim-plug).
```vim
Plug 'jbyuki/venn.nvim'
```- [packer.nvim](https://github.com/wbthomason/packer.nvim)
```lua
use "jbyuki/venn.nvim"
```Usage
-----* `set virtualedit=all` or `set ve=all`. This will allow you to freely move the cursor in the buffer. (see `help virtualedit`).
* Enter in Visual Block mode using ``. Select the region where the box should be.
* Invoke `:VBox`. This will draw a rectangle. In case, it has a width or a height of 1, it will draw a line.
Key Mapping
-----------### Using [hydra.nvim](https://github.com/anuvyklack/hydra.nvim)
[Draw diagrams](https://github.com/anuvyklack/hydra.nvim/wiki/Draw-diagrams)For a more in-depth configuration: [#27](../../issues/27)
### Using toggle command
You can map `:VBox` commands to allow different ways of drawing lines.Use the following function in your neovim config to toggle drawing lines on `HJKL` directional keys to allow for faster creation of diagrams:
```lua
-- venn.nvim: enable or disable keymappings
function _G.Toggle_venn()
local venn_enabled = vim.inspect(vim.b.venn_enabled)
if venn_enabled == "nil" then
vim.b.venn_enabled = true
vim.cmd[[setlocal ve=all]]
-- draw a line on HJKL keystokes
vim.api.nvim_buf_set_keymap(0, "n", "J", "j:VBox", {noremap = true})
vim.api.nvim_buf_set_keymap(0, "n", "K", "k:VBox", {noremap = true})
vim.api.nvim_buf_set_keymap(0, "n", "L", "l:VBox", {noremap = true})
vim.api.nvim_buf_set_keymap(0, "n", "H", "h:VBox", {noremap = true})
-- draw a box by pressing "f" with visual selection
vim.api.nvim_buf_set_keymap(0, "v", "f", ":VBox", {noremap = true})
else
vim.cmd[[setlocal ve=]]
vim.cmd[[mapclear ]]
vim.b.venn_enabled = nil
end
end
-- toggle keymappings for venn using v
vim.api.nvim_set_keymap('n', 'v', ":lua Toggle_venn()", { noremap = true})
```
![veenDemo](https://user-images.githubusercontent.com/36175703/130246504-d559f66b-3e2a-4065-90f7-d73bf8147397.gif)