Wednesday, January 18, 2012

Opening vi and command line in same window

One thing I have always liked about emacs is its ability to open a terminal within it. This makes writing programs a lot easier as you can both compile/debug and write a program without leaving your editor. There exists a few plugins to achieve the same in vi, but none of them are stable and platform independent.

Yesterday while going through the gnu screen man page, I found that it supported splitting the screen. Using that functionality, its easy to open vi and terminal in the same window. Here is a screenshot of what I managed to get:

Here is the step by step guide on how to get this:
  1. Open vi in a screen : screen vi
  2. Split the screen by : ctrl+a S remember that the S is in caps, so you might have to press shift+s
  3. Go to the bottom screen by ctrl+a Tab
  4. Create a new screen by ctrl+a ctrl+c
  5. To switch between the split screens, use ctrl+a Tab
Look up the man page on screen in your system for further cool things that you can do. Here is a stort list of commands which I use everyday (other than the ones in top):
  • list all screens : ctrl+a "
  • disconnect a screen : ctrl+a d 
  • reconnect a screen : screen -r screenNumber 
  • list all the running screens from terminal : screen -ls
  • split screen vertically :  ctrl+a |


1 comment:

  1. This is gr888... Since I work in LINUX, this will be of gr888 help.. Thanx a ton!!!!


I'd love to hear from you !