Skip to content

niuiic/part-edit.nvim

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

part-edit.nvim

Edit a part of a file individually.

More neovim plugins

Usage

This plugin is designed mostly for editing code in markdown file.

For example, if you enable dotls in markdown file, you will get these errors.

To avoid the errors above, the plugin creates a new buffer for editing selected code.

  1. select code in virtual mode (only support "v" mode)
  2. use PartEdit to create new buffer
  3. save new buffer and the original file will also be updated.

Dependencies

Config

-- default config
{
    -- float | tab
    open_in = "tab",
    float = {
        win = {
            -- the ratio of the floating window width to the editor width
            width_ratio = 1,
            -- the ratio of the floating window height to the editor height
            height_ratio = 1,
        },
    },
    -- whether to delete the buffer when leave
    -- notice: you have to delete previous buffer before you run 'PartEdit' again
    delete_buf_on_leave = false,
    -- path to the swap file of the new buffer
    swap_path = function()
        return ".swap"
    end,
    -- default file suffix of selected code (for example, markdown code -> md)
    -- this plugin will ask you to input file suffix if no default file suffix specified
    default_file_suffix = nil,
    -- whether to save original file when update
    save_original_file = true,
}
-- keymap example
vim.keymap.set("v", "<space>p", "<cmd>PartEdit<CR>", { silent = true, mode = "v"})

About

Edit a part of a file individually

Topics

Resources

License

Stars

Watchers

Forks

Languages