DEV Community

Cover image for Easily center content in vim

Easily center content in vim

vinney cavallo on March 28, 2017

Finding your center This was originally posted on my programming blog. I use vim for absolutely everything that I reasonably can. When...
Collapse
 
rafanonas profile image
Rafael Nonato

That's a great little piece of .vimrc that substitutes Goyo. On the other hand, as soon as you feel like making it more complicated, like, adding another window on the top and on the bottom and hiding the existence of the phantom windows, then Goyo is a better solution.

Collapse
 
vinneycavallo profile image
vinney cavallo

Ah, I've never heard of Goyo - thanks! That looks great. (along with Limelight, maybe :) )

Collapse
 
n0kit31 profile image
Marcin Krzyżanowski

Nice one! :)

Collapse
 
oyagci profile image
Oguzhan Yagci

To center my window with iTerm2, I split my terminal with Cmd+D. I find that way of doing it more useful. Because I usualy always need to use the command line at some point.

Collapse
 
vinneycavallo profile image
vinney cavallo

I use tmux for splits and panes (and more) in my terminal. If you haven't looked into it I'd recommend checking it out.

One downside I could see to creating this very narrow, centered experience by using terminal splits (rather than doing it in vim) is that everything else you'd be doing in vim would be constrained to that narrow pane as well - like anything in the vim command line, or the quickfix window or anything else.

Another sort of tangential but maybe helpful thing: if you find yourself needing to use the command line briefly but don't want to open up a terminal split you can hit Ctrl-Z to 'background' the current process (vim, in this case), use the prompt as much as you need and then enter the command fg to foreground the last process again (vim). While you're operating in this backgrounded mode you can enter jobs to see the list of backgrounded processes.

I hope that helps!