Skip to content

piwvis/nvim-whiteboard

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

nvim-whiteboard

A Neovim plugin that provides a whiteboard functionality for drawing with your mouse and saving/loading drawings.

Features

  • 🎨 Draw on a floating whiteboard canvas
  • 🖱️ Multiple drawing methods:
    • Click and drag with mouse (when supported)
    • Visual mode selection drawing
    • Continuous drawing mode with Space toggle
  • 💾 Save drawings to JSON files
  • 📂 Load previously saved drawings
  • 🗑️ Clear canvas
  • 🎯 Easy-to-use commands and keybindings

Installation

Using packer.nvim

use {
  'your-username/nvim-whiteboard',
  config = function()
    require('whiteboard').setup()
  end
}

Using lazy.nvim

{
  'your-username/nvim-whiteboard',
  config = function()
    require('whiteboard').setup()
  end
}

Manual Installation

Clone this repository into your Neovim config:

git clone https://github.com/your-username/nvim-whiteboard ~/.config/nvim/pack/plugins/start/nvim-whiteboard

Usage

Commands

  • :Whiteboard or :WhiteboardNew - Open a new whiteboard
  • :WhiteboardSave - Save the current whiteboard
  • :WhiteboardLoad - Load a saved whiteboard
  • :WhiteboardList - List all saved whiteboards

Drawing Methods

Method 1: Visual Mode Drawing

  1. Open whiteboard with :Whiteboard
  2. Press v to enter visual mode
  3. Move your cursor to draw
  4. Press Esc to stop drawing

Method 2: Continuous Drawing Mode

  1. Open whiteboard with :Whiteboard
  2. Press Space to start continuous drawing
  3. Move your cursor to draw
  4. Press Space again to stop

Method 3: Mouse Drawing

  1. Open whiteboard with :Whiteboard
  2. Click and drag with your mouse (when supported by your terminal)

Keybindings (in whiteboard buffer)

  • q or Esc - Close whiteboard
  • s - Save whiteboard
  • l - Load whiteboard
  • c - Clear canvas
  • v - Enter visual mode for drawing
  • Space - Toggle continuous drawing mode

File Format

Drawings are saved as JSON files in ~/.local/share/nvim/whiteboard/ with the following structure:

{
  "version": "1.0",
  "strokes": [
    [
      {"row": 5, "col": 10},
      {"row": 5, "col": 11},
      {"row": 6, "col": 12}
    ]
  ],
  "buffer_lines": ["..."],
  "created": "2024-01-01 12:00:00"
}

Configuration

Currently, the plugin uses default settings. Future versions may support:

  • Custom canvas size
  • Drawing color/character
  • Save directory location
  • Keybinding customization

Requirements

  • Neovim 0.7.0 or higher
  • Terminal with mouse support (for mouse drawing)

Limitations

  • Mouse drawing support depends on your terminal's mouse event handling
  • Drawing is done using text characters (█) overlaid on the buffer
  • Large drawings may impact performance

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

MIT License

About

whiteboard plugin for nvim

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages