Jeff Roberts
RHCE #804006066322833
Vim-Fu is now iPhone and Android friendly

Check out the Vim-Fu Store!


split screen editing

I came across yet another really handy feature in VIM today. I needed to start a new script and I already had some code in my perl scraps folder that I wanted to include. Normally I would open up a couple of windows and start VIM in each, one blank and one with code I want to pull from. This doesn’t take much time, but it means that I have to first be in X-windows and second not be in full screen, which I prefer to work in.

Enter the “:new” and “:vnew” commands or you can also use “:sp” or “:vsp”.
Kind of a cool use of “:vsp” is to open a second copy of the file that you are currently editing. You could use this if you are editing a very long file and want to search for something that is way down the file without loosing your place (you could also use bookmarks to come right back to the current spot).

:[N]new [++opt] [+cmd]                                  *:new*
Create a new window and start editing an empty file in it.
Make new window N high (default is to use half the existing

:[N]vne[w] [++opt] [+cmd] [file]                        *:vne* *:vnew*
Like |:new|, but split vertically.

You can also use CTRL-W S instead of “:sp” and CTRL-W V instead of “:vsp”

To move from frame to frame use:

Ctrl-W and then h,j,k,l or Ctrl-WW or you can press ctrl-w twice, i.e., ctrl-w ctrl-w to cycle between all the open windows.

You can open up multiple windows, splitting then in halves, thirds, fourths, etc. You can use another VIM command “:Explore” to locate and open files in these “splits”. The synthesis of these commands makes the mouse look less and less efficient.

2 comments to split screen editing

Leave a Reply




You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>