From bfdf487409ee8ba1135d3fbd3d75867274b4a52c Mon Sep 17 00:00:00 2001 From: jbranchaud Date: Sat, 8 Oct 2016 10:01:36 -0500 Subject: [PATCH] Add Open The Directory Of The Current File as a vim til --- README.md | 3 +- vim/open-the-directory-of-the-current-file.md | 28 +++++++++++++++++++ 2 files changed, 30 insertions(+), 1 deletion(-) create mode 100644 vim/open-the-directory-of-the-current-file.md diff --git a/README.md b/README.md index f7d3f4a..75fc374 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ variety of languages and technologies. These are things that don't really warrant a full blog post. These are mostly things I learn by pairing with smart people at [Hashrocket](http://hashrocket.com/). -_479 TILs and counting..._ +_480 TILs and counting..._ --- @@ -517,6 +517,7 @@ _479 TILs and counting..._ - [Open A Tag In A Split Window](vim/open-a-tag-in-a-split-window.md) - [Open an Unnamed Buffer](vim/open-an-unnamed-buffer.md) - [Open Routes File With vim-rails](vim/open-routes-file-with-vim-rails.md) +- [Open The Directory Of The Current File](vim/open-the-directory-of-the-current-file.md) - [Open The Gemfile](vim/open-the-gemfile.md) - [Open The Latest Rails Migration](vim/open-the-latest-rails-migration.md) - [Open Vim To A Tag Definition](vim/open-vim-to-a-tag-definition.md) diff --git a/vim/open-the-directory-of-the-current-file.md b/vim/open-the-directory-of-the-current-file.md new file mode 100644 index 0000000..c00565c --- /dev/null +++ b/vim/open-the-directory-of-the-current-file.md @@ -0,0 +1,28 @@ +# Open The Directory Of The Current File + +In one of my first TILs ever, [Head Of File +Name](https://github.com/jbranchaud/til/blob/master/vim/head-of-file-name.md), +I wrote about a fancy, archaic way of popping open a netrw view for the +directory of the current file. To this day, I still use it all the time when +I'm curious about the other files co-located with the file I'm editing. + +There are a couple other ways to do this that arguably require less finger +gymnastics. + +``` +:Explore +``` + +This has the same behavior `:e %:h` at the cost of a few extra (easier to +reach) keys. + +There is also + +``` +:Sex +``` + +which opens it up in a split. And as you'd expect, you can also use `:Vex` +for a vertical split. + +[source](http://superuser.com/questions/31677/how-do-i-open-the-directory-of-the-current-open-file)