A five-minute exploration of how I use splits in vim to navigate between production or test code and how I move up and down through layers of abstractions. Spoiler: I use vertical splits to put test and production code side-by-side; horizontal splits come into play when I’m navigating through the layers of a web app or something with a client/server aspect to it. I haven’t customized vim to make this work; I just use the normal window keybindings and a bunch of commands from vim-rails.
I seriously heart this setup. It’s worth taking thirty minutes to figure out how you can approximate it with whatever editor setup you enjoy most. Hint: splits are really fantastic.
6 thoughts on “How I use vim splits”
I always find it interesting to see other developers workflows. I’m currently splitting a tmux window into 3 80-column wide panes (and one < 80 wide pane) and work within those three areas (I have other tmux windows doing other stuff: logs, DB cli, console, etc.). about the only time I split in Vim is when the file and test file are relatively small. I prefer using tabs rather than splitting.
One of the cool things with splitting is when you are working within a large file. You can type ":sp" and split the same file. So you can keep looking at one method in one pane, and then move about in the same file in the other pane.
Thanks for sharing.
I’ve just started down the tmux path. Do you have anything custom around split layouts? I’d love to have something closer to vim’s binary splitting behavior.
@adam I do in my my github dotfiles: https://github.com/samullen/dotfiles/blob/master/.tmux.conf
I just purchased the tmux e-book from pragprog (http://pragprog.com/book/bhtmux/tmux); that went a long way towards helping me get up and running.
I just went through the tmux book too. Great book, quick and makes me feel like I leveled up every chapter. And, I’m totally stealing what you’re doing with the window-layout-in-a-script business.
Adam, nice use of splits. I’m mostly a tab guy, but still trying to find what’s optimal for me.
That being said, now I’m gonna be that guy you probably don’t want to hear from. What are you using for your status bar? I’ve never seen any like that. Also, is it your own customizations or a plugin that makes the currently selected split larger than the unselected ones within a given column?
The statusline is powerline. The splits are stolen from Gary Bernhardt’s vimrc.
Comments are closed.