vim for split-screen editing in a terminal-based environment, though you could use any command-line based text editor for this (e.g.
tmux is short for "terminal multiplexer" and it allows you to create sessions with multiple terminals, running in separate "windows" and also "panes" within these windows, which are what allow you to split the screen.
tmux is included in the repositories of many Linux and BSD distributions. I find this to be the most flexible option for coding, as I can also add splits and windows that contain terminals where I can compile code and use a version control system, like
git alongside my code editing.
Here is an example of how I would create a split screen editing session using
First open a terminal. In the below commands written after
$ are issued from the command line. This uses the default key-bindings in
Start a new tmux session. Here we make one called "coding":
$ tmux new -s coding
Press Ctrl+b followed by either % for a vertical split or " for a horizontal split.
You can move between the splits (or in
tmux parlance, the "panes") by pressing Ctrl+b followed by o.
Now open up a text editor with whatever files you want to edit in each pane. Here I have just opened two text files using
$ vim file1.txt
Switch panes:Ctrl+b followed by o.
$ vim file2.txt
tmux is extremely advanced, allowing for multiple panes in a single window arranged in various ways and
vim allows you to open multiple text files at once in tabs. I tend to use both the tabbing in
vim and the panes in
tmux to allow me to edit, version control and debug code simultaneously. If you have time to invest in learning the keyboard shortcuts and features of
tmux it can be a very powerful development environment.
tmux cheat sheet for starting out: dayid's screen and tmux cheat sheet
A tutorial on tabs in
vim: Vim tips: Using tabs