mirror of
https://github.com/jbranchaud/til
synced 2026-01-06 16:48:01 +00:00
Add Make Directories For The Current File as a Vim til
This commit is contained in:
@@ -10,7 +10,7 @@ pairing with smart people at Hashrocket.
|
|||||||
|
|
||||||
For a steady stream of TILs, [sign up for my newsletter](https://tinyletter.com/jbranchaud).
|
For a steady stream of TILs, [sign up for my newsletter](https://tinyletter.com/jbranchaud).
|
||||||
|
|
||||||
_1092 TILs and counting..._
|
_1093 TILs and counting..._
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -1171,6 +1171,7 @@ _1092 TILs and counting..._
|
|||||||
- [List All Buffers](vim/list-all-buffers.md)
|
- [List All Buffers](vim/list-all-buffers.md)
|
||||||
- [List Of Plugins](vim/list-of-plugins.md)
|
- [List Of Plugins](vim/list-of-plugins.md)
|
||||||
- [Load A Directory Of Files Into The Buffer List](vim/load-a-directory-of-files-into-the-buffer-list.md)
|
- [Load A Directory Of Files Into The Buffer List](vim/load-a-directory-of-files-into-the-buffer-list.md)
|
||||||
|
- [Make Directories For The Current File](vim/make-directories-for-the-current-file.md)
|
||||||
- [Marks Across Vim Sessions](vim/marks-across-vim-sessions.md)
|
- [Marks Across Vim Sessions](vim/marks-across-vim-sessions.md)
|
||||||
- [Match The Beginning And End Of Words](vim/match-the-beginning-and-end-of-words.md)
|
- [Match The Beginning And End Of Words](vim/match-the-beginning-and-end-of-words.md)
|
||||||
- [Moving To A Specific Line](vim/moving-to-a-specific-line.md)
|
- [Moving To A Specific Line](vim/moving-to-a-specific-line.md)
|
||||||
|
|||||||
23
vim/make-directories-for-the-current-file.md
Normal file
23
vim/make-directories-for-the-current-file.md
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
# Make Directories For The Current File
|
||||||
|
|
||||||
|
The [`vim-eunuch` plugin](https://github.com/tpope/vim-eunuch) provides Vim
|
||||||
|
commands that correspond to many common Unix shell commands. One such command
|
||||||
|
is an equivalent to the `mkdir` command.
|
||||||
|
|
||||||
|
The `mkdir` command creates the given directory if it doesn't already exist. If
|
||||||
|
multiples levels of new directories are specified, the `-p` flag can be
|
||||||
|
included to create each successive level.
|
||||||
|
|
||||||
|
The `vim-eunuch` equivalents are `Mkdir` and `Mkdir!`.
|
||||||
|
|
||||||
|
Let's say I'm working within a project that doesn't currently have a `docs`
|
||||||
|
directory. When I open up a buffer to `docs/setup.md`, before I can write that
|
||||||
|
new file, I need to create the `docs` directory. Running `:Mkdir` will do that.
|
||||||
|
|
||||||
|
Now let's say I open up a buffer to `src/api/util/base.js`. The `src` directory
|
||||||
|
already exists, but neither `/api` nor `util/` nested under it exist. Before I
|
||||||
|
can write the buffer, I need to create both of those directories. `:Mkdir` on
|
||||||
|
its own won't create these nested directories. Instead I need to reach for the
|
||||||
|
`-p` equivalent which is `:Mkdir!`.
|
||||||
|
|
||||||
|
See `:h eunuch-:Mkdir` for more details.
|
||||||
Reference in New Issue
Block a user