mirror of
https://github.com/jbranchaud/til
synced 2026-01-04 23:58:01 +00:00
Add Add Bindings To Split Panes To Current Directory as a tmux 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://crafty-builder-6996.ck.page/e169c61186).
|
For a steady stream of TILs, [sign up for my newsletter](https://crafty-builder-6996.ck.page/e169c61186).
|
||||||
|
|
||||||
_1672 TILs and counting..._
|
_1673 TILs and counting..._
|
||||||
|
|
||||||
See some of the other learning resources I work on:
|
See some of the other learning resources I work on:
|
||||||
|
|
||||||
@@ -1503,6 +1503,7 @@ If you've learned something here, support my efforts writing daily TILs by
|
|||||||
### tmux
|
### tmux
|
||||||
|
|
||||||
- [Access Past Copy Buffer History](tmux/access-past-copy-buffer-history.md)
|
- [Access Past Copy Buffer History](tmux/access-past-copy-buffer-history.md)
|
||||||
|
- [Add Bindings To Split Panes To Current Directory](tmux/add-bindings-to-split-panes-to-current-directory.md)
|
||||||
- [Adjusting Window Pane Size](tmux/adjusting-window-pane-size.md)
|
- [Adjusting Window Pane Size](tmux/adjusting-window-pane-size.md)
|
||||||
- [Break Current Pane Out To Separate Window](tmux/break-current-pane-out-to-separate-window.md)
|
- [Break Current Pane Out To Separate Window](tmux/break-current-pane-out-to-separate-window.md)
|
||||||
- [Change Base Directory Of Existing Session](tmux/change-base-directory-of-existing-session.md)
|
- [Change Base Directory Of Existing Session](tmux/change-base-directory-of-existing-session.md)
|
||||||
|
|||||||
19
tmux/add-bindings-to-split-panes-to-current-directory.md
Normal file
19
tmux/add-bindings-to-split-panes-to-current-directory.md
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
# Add Bindings To Split Panes To Current Directory
|
||||||
|
|
||||||
|
When I am vertically or horizontally splitting a pane or opening another window,
|
||||||
|
I generally want it to open to the same directory as I'm currently in. The
|
||||||
|
default behavior in tmux is for those commands to open to the starting directory
|
||||||
|
of the session.
|
||||||
|
|
||||||
|
Looking through the [tmux.conf in
|
||||||
|
dkarter/dotfiles](https://github.com/dkarter/dotfiles/blob/master/config/tmux/tmux.conf#L109-L111),
|
||||||
|
I found a good way to achieve the behavior I want.
|
||||||
|
|
||||||
|
```
|
||||||
|
bind-key - split-window -v -c '#{pane_current_path}'
|
||||||
|
bind-key \\ split-window -h -c '#{pane_current_path}'
|
||||||
|
bind-key c new-window -c '#{pane_current_path}'
|
||||||
|
```
|
||||||
|
|
||||||
|
What I like about this is that `-` (vertical) and `\` (horizontal) look visually
|
||||||
|
like the splits they represent. Meanwhile, I leave `%` and `"` intact.
|
||||||
Reference in New Issue
Block a user