LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 02-03-2009, 05:32 PM   #1
jhwilliams
Senior Member
 
Registered: Apr 2007
Location: Portland, OR
Distribution: Debian, Android, LFS
Posts: 1,168

Rep: Reputation: 211Reputation: 211Reputation: 211
Emacs: Open two files in horizontal windows from command line


Hi, I'm a VIM user trying to get familiar with you other guys' methods of evil.

In vimlandia, we have a -O flag which will cause subsequent files specified on the command line to open in side-by-side horizontal windows within VIM.

...Can your editor do that? I've seen no mention of it online or in the man page.

Thanks,
Jameson
 
Old 02-03-2009, 07:17 PM   #2
rnturn
Senior Member
 
Registered: Jan 2003
Location: Illinois (SW Chicago 'burbs)
Distribution: openSUSE, Raspbian, Slackware. Previous: MacOS, Red Hat, Coherent, Consensys SVR4.2, Tru64, Solaris
Posts: 2,818

Rep: Reputation: 550Reputation: 550Reputation: 550Reputation: 550Reputation: 550Reputation: 550
Quote:
Originally Posted by jhwilliams View Post
... subsequent files specified on the command line to open in side-by-side horizontal windows within VIM.
The command "xemacs file1.txt file2.txt" or "emacs -nw file1.txt file2.txt" will open an editor window with two edit buffers organized like:
Code:
+---------------------------------+
|                                 |
|                                 |
|                                 |
+--file1.txt----------------------+
|                                 |
|                                 |
|                                 |
+--file2.txt----------------------+
I haven't seen an Emacs configuration with the side-by-side vertical windows that "vim -O" gives you. That's not to say it's impossible; I'm sure some Lisp guru has gotten Emacs to do this. Personally, I'm not sure how useful it is. In the 24+ years I've been using Emacs (it was the basis for the Perfect software packages back in the Jurassic days of the PC) and a slew of other editors, I can't say that I've ever lusted for that particular window configuration.

Not that it answers your question but I seem to recall that the "Point" editor that Logitech shipped with its mice back in the '80s could use side-by-side windows. (Cool editor. It could edit immense files. I used to be able to help WordPerfect users recover corrupted files that WP refused to open after a bad block turned up on a floppy.)

Go ahead... feel superior that Vim can do this. It won't bother me at all.

Cheers...

Rick
 
Old 02-03-2009, 07:36 PM   #3
jhwilliams
Senior Member
 
Registered: Apr 2007
Location: Portland, OR
Distribution: Debian, Android, LFS
Posts: 1,168

Original Poster
Rep: Reputation: 211Reputation: 211Reputation: 211
:-). Hey Rick, thanks for the reply. The side-by-side window feature seems almost necessary on my 13.3" laptop widescreen. Mileage tends to the city driving rates when I go for the up/down stacked windows. Emacs does have the feature when you get in there, Meta-X-3 opens a new one. I've been surprised that Emacs with all of its fan fare does not have some of the basic features of VIM to which I've grown accustomed (such as the aforementioned), but I also recognize that I don't have enough practice using it yet to state that it's an inferior editor versus simply not knowing my way around it.
 
Old 02-05-2009, 11:11 PM   #4
rnturn
Senior Member
 
Registered: Jan 2003
Location: Illinois (SW Chicago 'burbs)
Distribution: openSUSE, Raspbian, Slackware. Previous: MacOS, Red Hat, Coherent, Consensys SVR4.2, Tru64, Solaris
Posts: 2,818

Rep: Reputation: 550Reputation: 550Reputation: 550Reputation: 550Reputation: 550Reputation: 550
Quote:
Originally Posted by jhwilliams View Post
I've been surprised that Emacs with all of its fan fare does not have some of the basic features of VIM to which I've grown accustomed (such as the aforementioned) ...
And Emacs has, I'm sure, a few features that vi/vim users can only dream about. I recall when I was using microemacs regularly and having a real simple method of compiling my source code and being able to immediately jump into a new buffer containing any compiler diagnostics. I've never seen that available in vi-related editor though that's not to say such a thing is unavailable. I can remember being impressed by some real vi pros who knew how to do some fairly magical things. (I've never seen vi run its own adventure game though.)

Quote:
... but I also recognize that I don't have enough practice using it yet to state that it's an inferior editor versus simply not knowing my way around it.
Whew. I was afraid we might be in danger of reviving one of the oldest Holy Wars on the Internet. Just to be safe let's keep it down lest we attract the real fanatics.

Later...

Rick
 
Old 02-06-2009, 12:32 AM   #5
indeliblestamp
Member
 
Registered: Feb 2006
Distribution: Fedora
Posts: 341
Blog Entries: 3

Rep: Reputation: 40
Well as an emacs fan, I just couldn't let this one pass
I got this link after a quick search: http://tsdh.wordpress.com/2007/03/09...s-wide-enough/
It splits the window vertically if the current window is > 165 columns. I changed it to 80 just to be sure, and it works: when the terminal is normal sized, the files are stacked one below the other (as usual). When I retry with a maximized terminal, the files are side by side.
I don't understand a word of lisp, but it does seem to work decent. Put it in your .emacs and give it a try too.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Horizontal Line Across My Screen MooseMagnet Linux - Newbie 9 11-05-2008 08:23 AM
filename ends in '\' won't open in emacs or with cat command - why? tardo0807 Linux - Newbie 2 02-14-2008 10:11 AM
How to copy files via command line from Redhat to windows chris28 Linux - Networking 5 01-23-2006 11:55 PM
Horizontal line across screen. Tarts Linux - Laptop and Netbook 5 11-01-2003 01:02 PM
EMACS won't work on unix from command line! jcrapps Programming 2 02-03-2003 10:06 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 06:18 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration