Skip to content

Edit Markdown Tables from Neovim using Treesitter

License

Notifications You must be signed in to change notification settings

kiran94/edit-markdown-table.nvim

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

edit-markdown-table.nvim

main

Edit Markdown Tables from Neovim

edit-markdown-table.nvim is a simple plugin which makes updating markdown tables a breeze, even for tables with lengthy strings. See the preview for a demo.

Install

Using lazy.nvim:

{
    'kiran94/edit-markdown-table.nvim',
    config = true,
    dependencies = { "nvim-treesitter/nvim-treesitter" },
    cmd = "EditMarkdownTable",
},

Dependencies

  • Neovim 0.9+
  • The Treesitter markdown parser installed (:TSInstall markdown)

Usage

Place your cursor on the cell of the markdown table that you want to edit.

:lua require('edit-markdown-table').edit_cell() -- or :EditMarkdownTable

Preview

asciicast

In this example, we are editing this example. You can see that especially when wrap is turned on, it can be difficult to get a clear view of what you are editing. This plugin simplifies this process by opening a dialog with the text of the current cell so you can make your changes and apply them back to the table.

This plugin uses vim.ui.input for the input dialog. In this preview, I am using dressing.nvim to provide the UI with the following configuration:

require("dressing").setup({
    input = {
        enabled = true,
        start_in_insert = false,
        win_options = {
            winblend = 0,
            wrap = true,
        },
    }
})