Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mateuszwieloch/automkdir.nvim
Automatically creates non-existent parent directories when writing a file
https://github.com/mateuszwieloch/automkdir.nvim
lua neovim neovim-plugin plugin
Last synced: about 1 month ago
JSON representation
Automatically creates non-existent parent directories when writing a file
- Host: GitHub
- URL: https://github.com/mateuszwieloch/automkdir.nvim
- Owner: mateuszwieloch
- License: gpl-3.0
- Created: 2023-12-13T14:05:50.000Z (9 months ago)
- Default Branch: main
- Last Pushed: 2023-12-13T14:44:46.000Z (9 months ago)
- Last Synced: 2024-04-12T11:17:17.521Z (5 months ago)
- Topics: lua, neovim, neovim-plugin, plugin
- Language: Lua
- Homepage:
- Size: 17.6 KB
- Stars: 11
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-neovim - mateuszwieloch/automkdir.nvim - Automatically create non-existent parent directories when writing a file. (Utility / Cursorline)
README
# automkdir.nvim
Automatically creates non-existent parent directories when writing a file.Pure lua. Single file.
## Usage
1. Edit a file.
2. Write with `:write /foo/bar/file.txt`.
3. Let's assume the `bar` directory doesn't exist.
* Without this plugin, you'd get the "E212: Can't open file for writing: no such file or directory" error.
* With this plugin, the `bar` directory will be silently created and the write command will succeed.## Installation
Use your favorite package manager.lazy.nvim
```
require("lazy").setup({
"mateuszwieloch/automkdir.nvim"
})
```vim-plug
```
Plug "mateuszwieloch/automkdir.nvim"
```## See also
* Since Neovim 0.9+ you can create non-existent parent directories when writing a file by adding `++p` flag to `:write`, for example `:write ++p /path/to/file.txt`. However, that's still some extra keystrokes that I prefer to avoid.
* [mkdir.nvim](https://github.com/jghauser/mkdir.nvim) accomplishes the same goal, but uses Vimscript inside of Lua code.