Is there an editor which has the option to "split the screen" into two or more parts, accessing more than one file (possibly with a file tree) without opening more editor windows at once, and how would one do this (what are the commands).

I don't know if I made myself clear, but "split screen" is the only way to describe what I want to achieve. I want to use it to program, having more than one file open for editing. Note that I'm pretty new to both vi and emacs, if these are capable of doing this. Also, if this has to be done through a terminal editor, can it be done in the same terminal, regardless of the screen size?

I know you asked specifically about editors and not terminals, but I think it is worth to note for future visitors: the terminal emulator terminator also has the feature of split screen: ctrl + shift + e will split vertically and ctrl + shift + o will split horizontally (and also ctrl + shift + t will open a new tab)
–
Carlos CampderrósAug 2 '12 at 14:55

@CarlosCampderrós: You can also use a multiplexer like screen or tmux to achieve that in other terminal emulators. Disadvantage, of course, is that you have to remember to run them first, but the flexibility is probably worth it.
–
PhoshiAug 3 '12 at 0:19

I would create a mapping like map <C-left> <C-W><left> for each of the directions to ease switching windows. I use a mapping lie that except with the hjkl keys for movement but if you do pick vim it might be some time before you're ready to use those.
–
MattAug 3 '12 at 1:41

1

@Eve - you can also use :vsplit to create a vertical split, and as with :split it accepts a filename or command
–
UselessAug 3 '12 at 10:43

This can be done using Emacs. It works in GUI and in terminal mode. You can even split multiple times. Here are some basic key combinations:

C-x 2
Split the selected window into two windows, one above the other (split-window-below).C-x 3
Split the selected window into two windows, positioned side by side (split-window-right).C-Mouse-2
In the mode line of a window, split that window.

For anyone unfamiliar with Emacs terminology, it is worth noting that an Emacs window is what many other editors call a screen or a panel. An Emacs frame is what others call a window (it is called a frame because the windows within it are framed either by the desktop decoration (title-bar and borders) or by the terminal... Windows contain buffers (some text; usually a file).
–
Peter.OAug 2 '12 at 3:34

1

@Peter.O - Not just for those unfamiliar with Emacs... I have been using Emacs for over 5 years and would not have been able to explain the differences. I just use it.
–
jordanmAug 2 '12 at 3:37

Regarding file trees, I personally use NERDtree with Vim. It requires Pathogen. I found the command to open the tree (:NERDtree toggle, iirc) to be a bit long, so I remapped it to <F2>.
If you're working on a project with lots of files in lots of directories (think Rails projects), it's a really nice.

I use tmux and vim for split-screen editing in a terminal-based environment, though you could use any command-line based text editor for this (e.g. nano, emacs etc.).

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 tmux and vim.

First open a terminal. In the below commands written after $ are issued from the command line. This uses the default key-bindings in tmux.

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, e.g.

$ 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.

i personally would use screen or tmux. both allow you to open multiple panels though i think tmux is better at recovering a multi panel session than screen. you also get the added benefit of being able to attach to the session if you disconnect from you local desktop session and then SSH in. You even have the ability to share the session with other users as well for collaboration.