Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/niuiic/part-edit.nvim
Edit a part of a file individually
https://github.com/niuiic/part-edit.nvim
Last synced: about 2 months ago
JSON representation
Edit a part of a file individually
- Host: GitHub
- URL: https://github.com/niuiic/part-edit.nvim
- Owner: niuiic
- License: mit
- Created: 2023-01-17T02:46:21.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-05-11T04:36:21.000Z (4 months ago)
- Last Synced: 2024-05-11T05:27:55.658Z (4 months ago)
- Language: Lua
- Homepage:
- Size: 23.4 KB
- Stars: 12
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-neovim - niuiic/part-edit.nvim - Edit a part of a file individually. (Editing Support / Scrollbar)
README
# part-edit.nvim
Edit a part of a file individually.
[More neovim plugins](https://github.com/niuiic/awesome-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
- [niuiic/core.nvim](https://github.com/niuiic/core.nvim)
## Config
```lua
-- 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,
}
``````lua
-- keymap example
vim.keymap.set("v", "p", "PartEdit", { silent = true, mode = "v"})
```