How Can I Close the Leftmost Window in Vim?

Posted by msutherl on Super User See other posts from Super User or by msutherl
Published on 2011-01-10T01:09:29Z Indexed on 2011/01/10 1:55 UTC
Read the original article Hit count: 242

Filed under:
|

I'm trying to write a command that will close a tree-browser (vim-tree) window and resize the other windows.

,to opens the window and adjusts the window size so that all open windows retain a normal size (using :set columns+=30CTRL-W =).

,tc should close the tree window (full-length, far left) and resize the main window (:set columns-=30).

How can I write a command that closes the leftmost window so that I can type ,tc to close the window and resize in one shot?

  • I can navigate to it with CTRL-W h, but it is inelegant and potentially annoying (audible bell!) to use 10CTRL-W h in the command.
  • :topleft c unfortunately doesn't work.

Can you think of an elegant way to do this?

© Super User or respective owner

Related posts about vim

Related posts about nerdtree