Terminal Split Windows

17 risposte [Ultimo contenuto]
awauk

I am a member!

Offline
Iscritto: 07/09/2015

I do a lot of html coding and was wondering if there was a way to split the terminal windows horizontally. It only seems to allow a minimize/maximize function.

Magic Banana

I am a member!

I am a translator!

Offline
Iscritto: 07/24/2010

You can use 'screen' or 'byobu' or 'tmux' or ... or you can edit your HTML with GNU Emacs that can horizontally split the window with C-x 2.

jbar
Offline
Iscritto: 01/22/2011

It depends on the terminal emulator. For example, 'terminator' has that option.

hack and hack
Offline
Iscritto: 04/02/2015

Also, there should be a snapping program that should exist for assigning a window on one side of the screen and another on the other (or up or down). I didn't do my research on that though, but if you're using GNOME Shell, there is such a function, at the very least for vertical snapping.

Binh-Khoi Nguyen
Offline
Iscritto: 01/22/2015

On Sun, Aug 16, 2015 at 08:05:12PM +0200, name at domain wrote:
>I do a lot of html coding and was wondering if there was a way to
>split the terminal windows horizontally. It only seems to allow a
>minimize/maximize function.
What text editor are you using? From your question, I feel like you are
using a text editor in the terminal, most of which have that
functionality.

The others below have suggested terminator, so I'm not going to suggest
it. I personally use tmux for that.

--
Binh-Khoi NGUYEN
name at domain
name at domain

awauk

I am a member!

Offline
Iscritto: 07/09/2015

Yes, I am using nano. So I guess the question refers to terminal window splitting.

Binh-Khoi Nguyen
Offline
Iscritto: 01/22/2015

On Mon, Aug 17, 2015 at 12:49:42AM +0200, name at domain wrote:
>Yes, I am using nano. So I guess the question refers to terminal
>window splitting.
Then I really recommend tmux.

I'll give you the very basic commands to get start

tmux new -s session -- to start a session in a terminal
Ctrl-b % -- to create a vertical split
Ctrl-b " -- to create a horizontal split

The advantage of tmux is that if you ever close your terminal, you can
get your session back via:

tmux attach -t session

--
Binh-Khoi NGUYEN
name at domain
name at domain

J.B. Nicholson-Owens
Offline
Iscritto: 06/09/2014

You wrote:
> I do a lot of html coding and was wondering if there was a way to split
> the terminal windows horizontally. It only seems to allow a
> minimize/maximize function.

KDE's Konsole terminal program will do what you're looking for if you
really want the terminal split so you can look at the same terminal
session with multiple views. This will not split the editor in which
you're editing code where the editor is aware of the split view.

awauk

I am a member!

Offline
Iscritto: 07/09/2015

I installed tmux and created a new session, but the ctrl-b % doesn't seem to work for me...

Binh-Khoi Nguyen
Offline
Iscritto: 01/22/2015

On Mon, Aug 17, 2015 at 03:24:18AM +0200, name at domain wrote:
>I installed tmux and created a new session, but the ctrl-b % doesn't
>seem to work for me...

Are you in the tmux session? Is there a green bar at the bottom?

awauk

I am a member!

Offline
Iscritto: 07/09/2015

Yes. I have the green bar at the bottom and i press Ctrl+b+% and it doesn't split the screen. Am I doing something wrong?

Binh-Khoi Nguyen
Offline
Iscritto: 01/22/2015

On Mon, Aug 17, 2015 at 05:30:12AM +0200, name at domain wrote:
>Yes. I have the green bar at the bottom and i press Ctrl+b+% and it
>doesn't split the screen. Am I doing something wrong?
Are you doing Ctrl-b together followed by % on its own? Are you
pressing % without the Ctrl key? What about Ctrl-b " for a horizontal
split?

Maybe Trisquel has different defaults than Parabola (what I'm using).
Or has someone changed the configuration file?

Have a look at ~/.tmux.conf and see if the prefix combination has
been changed.

--
Binh-Khoi NGUYEN
name at domain
name at domain

doolio
Offline
Iscritto: 12/31/2013

I would second Magic Banana and suggest you try emacs. Yes, screen, tmux and byobu (which is a really front end to either screen or tmux) will achieve what you want but emacs offers more to you as a programming environment (and probably anything else you can think of). In particular, I've read many times the emacs org mode is extremely useful for (literate) programming of html particularly how it creates and manipulates tables.

A sample of what emacs can do for you ...

Working with HTML -> http://emacsrocks.com/e12.html

Multiple cursors -> http://emacsrocks.com/e13.html

Binh-Khoi Nguyen
Offline
Iscritto: 01/22/2015

On Mon, Aug 17, 2015 at 02:25:34PM +0200, name at domain wrote:
>I would second Magic Banana and suggest you try emacs.
He is talking about splitting a terminal, not about editing files in
different panes. Can Emacs do that? I'm asking that as a question, I
know for a fact that Vim can't but Neovim can.

As a vim user, I do sometimes envy the feature set of Emacs, and indeed
wish vim had org-mode.

I do believe however that learning to use tmux is an important and
valuable skill to learn, regardless of how what editor you use.

--
Binh-Khoi NGUYEN
name at domain
name at domain

doolio
Offline
Iscritto: 12/31/2013

> He is talking about splitting a terminal, not about editing files in different panes. Can Emacs do that? I'm asking that as a question, I know for a fact that Vim can't but Neovim can.

Well, it depends if you want to have a terminal session in each window (read pane). You can use emacs in a termianl session with

emacs -nw

and then split the frame (read terminal window) horizontally (as MB said)

C-x 2

or vertically (side-by-side)

C-x 3

Then you can make the newly created window a termianl session within emacs. I assumed s/he wanted to edit code (in a terminal editor) and still have a terminal session without having to open a new terminal window. I agree screen or tmux are really what s/he is looking for when wanting to work with mutliple terminals. I thought s/he may want to consider another more powerful editor such as emacs that can achieve what s/he wants but also offer so much more.

I also agree with your point about investing the time to learn tmux (or screen) but would add that if one is to program a lot then they should also invest the time to learn vim or emacs.

I'm only beginning on this path and currently investing the time to learn emacs.

Binh-Khoi Nguyen
Offline
Iscritto: 01/22/2015

On Mon, Aug 17, 2015 at 03:33:58PM +0200, name at domain wrote:
>I also agree with your point about investing the time to learn tmux (or
>screen) but would add that if one is to program a lot then they should
>also invest the time to learn vim or emacs.
I totally agree! I didn't mean to sound like you weren't answering OP's
question, I was genuinely wondering if you could do that with emacs.

Thanks for your reply! :)

--
Binh-Khoi NGUYEN
name at domain
name at domain

moxalt
Offline
Iscritto: 06/19/2015

Try GNU Screen. It's a terminal multiplexer- with a simple set of keyboard
shortcuts, you can create multiple tabbed terminal instances, name and rename
them, and split and display multiple terminal instances on the screen at once,
horizontally or vertically ad infinitum. I believe it comes preinstalled- if
not, apt-get install screen.

tdlnx

I am a member!

Offline
Iscritto: 04/09/2014

I personally use dvtm (from official repos).

I like doing a lot of work in the terminal and dvtm works exactly like a tiling window manager within the terminal. The controls are similar to the window manager dwm (which is my favorite tiling manager).