Flashback 2003: vim + screen trick
Posted Tue, 02 Mar 2010
Matt Simmons suggested
that this week be a flashback
week. That's easy enough to do, so I'm doing one per year starting in 2003.
A common feature request of vim is to be able to split window and have a shell be there. Well, as it turns out, that's easy to do if you run vim inside screen (gvim not applicable here).
The original post details a simple vim keybinding that will split the screen and attach a shell and close the split when the shell exits.
August 2003: Neat vim/screen trick
However, I've got a better version now. You'll want this script, "screener.sh":
#!/bin/sh screen -X split screen -X focus down screen -X screen sh -c "cd $PWD; $SHELL; screen -X remove"Then in your .vimrc:
:map \s :silent !screener.sh<CR>The new version mostly puts the screen invocations into a shell script. Another improvement is to change to $PWD so the new shell will be in the same working directory as vim started in.