LinuxQuestions.org
Help answer threads with 0 replies.
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


View Poll Results: Would you prefer to use EMACS or VIM ?
EMACS ! 11 31.43%
VIM ! 24 68.57%
Voters: 35. You may not vote on this poll

Reply
  Search this Thread
Old 03-28-2017, 02:41 AM   #16
camp0
Member
 
Registered: Dec 2016
Location: Dublin
Distribution: Fedora
Posts: 70

Rep: Reputation: 4

Sorry but this reminds me this video https://www.youtube.com/watch?v=GwP2vnQCoho
 
Old 03-29-2017, 01:20 PM   #17
cyent
Member
 
Registered: Aug 2001
Location: ChristChurch New Zealand
Distribution: Ubuntu
Posts: 398

Rep: Reputation: 87
Quote:
Originally Posted by Xeratul View Post
I prefer the hjkl since you do not need 2 hands. With a single hand you can fly all through a document.
I use 'n' to scroll down/page down and 'u' for page up
So use spacemacs and you can still do so.

Quote:
besides 44 Mb, so much:
Code:
# apt-get install emacs --no-install-recommends
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following extra packages will be installed:
  adwaita-icon-theme emacs24 emacs24-bin-common emacs24-common
  imagemagick-common libatk-bridge2.0-0 libatspi2.0-0 libcolord2
  libfftw3-double3 libgtk-3-0 libgtk-3-bin libgtk-3-common libjson-glib-1.0-0
  libjson-glib-1.0-common liblqr-1-0 libm17n-0 libmagickcore-6.q16-2
  libmagickwand-6.q16-2 libotf0 librest-0.7-0 libsoup-gnome2.4-1
  libwayland-cursor0 m17n-db
Suggested packages:
  emacs24-common-non-dfsg emacs24-el libfftw3-bin libfftw3-dev gvfs m17n-docs
  libmagickcore-6.q16-2-extra gawk
Recommended packages:
  at-spi2-core colord
The following NEW packages will be installed:
  adwaita-icon-theme emacs emacs24 emacs24-bin-common emacs24-common
  imagemagick-common libatk-bridge2.0-0 libatspi2.0-0 libcolord2
  libfftw3-double3 libgtk-3-0 libgtk-3-bin libgtk-3-common libjson-glib-1.0-0
  libjson-glib-1.0-common liblqr-1-0 libm17n-0 libmagickcore-6.q16-2
  libmagickwand-6.q16-2 libotf0 librest-0.7-0 libsoup-gnome2.4-1
  libwayland-cursor0 m17n-db
0 upgraded, 24 newly installed, 0 to remove and 0 not upgraded.
Need to get 37.2 MB of archives.
After this operation, 144 MB of additional disk space will be used.
Do you want to continue? [Y/n]

So you have all that functionality sitting there awaiting your fingertips.... always available at a keystroke.
 
Old 03-30-2017, 03:15 PM   #18
KenJackson
Member
 
Registered: Jul 2006
Location: Maryland, USA
Distribution: Fedora and others
Posts: 757

Rep: Reputation: 145Reputation: 145
Quote:
Originally Posted by cynwulf View Post
There is no substitute for knowing vi basics. If you install a base system of any *BSD, you will usually only have the vi editor. If you need to configure, loader tunables, rc.conf, etc then you need a text editor from the start, possibly with no network access or X server.
Very wise words.

I've been stuck a bunch of times on a system with nothing but vi. Very frustrating. So of course, the first order of business is to get emacs installed so I can breath.

Actually, my favorite is emn. Never heard of it? OK, I'll provide a copy:
Code:
#!/bin/sh
test -x /usr/bin/emacs-nox  &&  EMACS=emacs-nox  ||  EMACS='emacs -nw'
exec $EMACS ${1+"$@"}
 
Old 03-30-2017, 03:24 PM   #19
cyent
Member
 
Registered: Aug 2001
Location: ChristChurch New Zealand
Distribution: Ubuntu
Posts: 398

Rep: Reputation: 87
Quote:
There is no substitute for knowing vi basics.
For those who don't know them....

Code:
ESC :q!
...gets you out if you make the mistake of venturing in. :-D
 
Old 03-31-2017, 08:57 AM   #20
linustalman
LQ Guru
 
Registered: Mar 2010
Location: Ireland
Distribution: Debian 12 Bookworm
Posts: 5,715

Rep: Reputation: 479Reputation: 479Reputation: 479Reputation: 479Reputation: 479
Neither.
 
Old 03-31-2017, 12:36 PM   #21
Shadow_7
Senior Member
 
Registered: Feb 2003
Distribution: debian
Posts: 4,137
Blog Entries: 1

Rep: Reputation: 874Reputation: 874Reputation: 874Reputation: 874Reputation: 874Reputation: 874Reputation: 874
I "wanted" to be an emacs user. But if your xterm has > 256 $LINES, then emacs hangs. A fatal flaw IMO. So I've been learning vim. But mostly I know how to exit both.

^X^C

<ESC>:q!<ENTER>

I've been using the cwm window manager for a while now, and a lot of it's default key bindings are those for vim.
 
Old 03-31-2017, 04:40 PM   #22
KenJackson
Member
 
Registered: Jul 2006
Location: Maryland, USA
Distribution: Fedora and others
Posts: 757

Rep: Reputation: 145Reputation: 145
Quote:
Originally Posted by Shadow_7 View Post
But if your xterm has > 256 $LINES, then emacs hangs.
More that 256 lines in an xterm?? The most I can get in a reasonable font on my monitor is 88. You must have either a really really big monitor or really really good eyesight!

Quote:
Originally Posted by Shadow_7 View Post
I've been using the cwm window manager for a while now, and a lot of it's default key bindings are those for vim.
The bindings probably aren't connected to the WM, but to the shell. Try this command to get emacs bindings:
Code:
set -o emacs
Or this to get vi bindings:
Code:
set -o vi
 
Old 03-31-2017, 05:37 PM   #23
Shadow_7
Senior Member
 
Registered: Feb 2003
Distribution: debian
Posts: 4,137
Blog Entries: 1

Rep: Reputation: 874Reputation: 874Reputation: 874Reputation: 874Reputation: 874Reputation: 874Reputation: 874
Quote:
Originally Posted by KenJackson View Post
More that 256 lines in an xterm?? The most I can get in a reasonable font on my monitor is 88. You must have either a really really big monitor or really really good eyesight!
Or I use Xdmx to combine a couple Xephyr windows. The neep font has a 6x13 option.

$ echo $(( 1920 / 6 ))
320
$ echo $(( 1080 / 13 ))
83
$ echo $(( 320 / 4 ))
80
$ echo $(( 83 * 4 ))
332

So an 80x332 xterm is possible on a 1080p screen with the neep 6x13 font. With an 8x8 bitmap font you can do 80x405. Or if Xephyr and Xdmx isn't your thing you can have a virtual desktop bigger than your visible screen. Even my hp stream 11's will do a 4096x4096 px X environment.

$ echo $(( 4096 / 13 ))
315

$ xrandr --output HDMI-0 --mode 1920x1080 --panning 1920x4096

$ urxvt -b 0 -w 0 +sb -fg rgb:99/99/99 -bg rgb:00/00/00 -cr rgb:ff/ff/00 \
-fn -*-neep-medium-r-semicondensed-*-13-* \
-fb -*-neep-bold-r-semicondensed-*-13-* -geometry 120x310+0+0 &

Allows $(( 5 * 13 )) for window decorations. With a 32" 8k display, it's not an uncommon thing these days. Granted that I'd probably have to be 12" away to actual read the thing, but I'm near sited and wouldn't need glasses at that distance.

Last edited by Shadow_7; 03-31-2017 at 05:44 PM.
 
Old 04-01-2017, 05:31 AM   #24
Shadow_7
Senior Member
 
Registered: Feb 2003
Distribution: debian
Posts: 4,137
Blog Entries: 1

Rep: Reputation: 874Reputation: 874Reputation: 874Reputation: 874Reputation: 874Reputation: 874Reputation: 874
For a practical demonstration:

$ sudo apt-get install xfonts-jmk

FILE: n_xdmx_1x4_6x13.xdmx
Code:
virtual tiled1x4 {
  display ":11" 480x1066  @0x0;
  display ":12" 480x1066  @0x1066;
  display ":13" 480x1066  @0x2132;
  display ":14" 480x1066  @0x3198;
}
FILE: n_xephyr_xdmx.sh
Code:
#!/bin/bash

ORIGIN_X=6
ORIGIN_Y=13
COLUMNS_X=$(( 1920 / $ORIGIN_X ))
COLUMNS_4X=$(( $COLUMNS_X / 4 ))
MOST_Y=$(( 1080 / $ORIGIN_Y ))
ROWS_Y=$(( $MOST_Y - $(( $MOST_Y % 2 )) ))
RES_X=$(( $COLUMNS_4X * $ORIGIN_X ))
RES_Y=$(( $ROWS_Y * $ORIGIN_Y ))
OFFSET_X0=$(( $RES_X * 0 ))
OFFSET_X1=$(( $RES_X * 1 ))
OFFSET_X2=$(( $RES_X * 2 ))
OFFSET_X3=$(( $RES_X * 3 ))
echo -n "COL: "$COLUMNS_4X" ROW: "$ROWS_Y" "
echo -n "px_X: "$RES_X" px_Y: "$RES_Y" "
echo    "OFFSET: "$OFFSET_X0" "$OFFSET_X1" "$OFFSET_X2" "$OFFSET_X3
#exit 0

Xephyr :11 -resizeable -title Xephyr11 &
sleep 0.5; wmctrl -r Xephyr11 -e 0,$OFFSET_X0,0,$RES_X,$RES_Y
Xephyr :12 -resizeable -title Xephyr12 &
sleep 0.5; wmctrl -r Xephyr12 -e 0,$OFFSET_X1,0,$RES_X,$RES_Y
Xephyr :13 -resizeable -title Xephyr13 &
sleep 0.5; wmctrl -r Xephyr13 -e 0,$OFFSET_X2,0,$RES_X,$RES_Y
Xephyr :14 -resizeable -title Xephyr14 &
sleep 0.5; wmctrl -r Xephyr14 -e 0,$OFFSET_X3,0,$RES_X,$RES_Y
Xdmx :1 -configfile /home/user1/n_xdmx_1x4_"$ORIGIN_X"x"$ORIGIN_Y".xdmx \
        -config tiled1x4 -depth 24 -ignorebadfontpaths +xinerama &

sleep 5
urxvt -display :1 -b 0 -w 0 +sb \
      -fg rgb:99/99/99 -bg rgb:00/00/00 -cr rgb:ff/ff/00 \
      -fn -*-neep-medium-r-semicondensed-*-13-* \
      -fb -*-neep-bold-r-semicondensed-*-13-* \
      -geometry 80x328+0+0 &

exit 0
$ ./n_xephyr_xdmx.sh

In the case of emacs "-geometry 80x328+0+0" would fail, but "-geometry 80x256+0+0" would work. In this case I limit it to 82 ROWS (largest even multiple that fits the space) in 4x Xephyr windows of 80 COLUMNS. Although cwm, and "ignore Xephyr" in the .cwmrc so there's no window decorations on the Xephyr windows. And quirky as Xdmx hasn't really been updated since 2004, so your focus needs to be on the 1st Xephyr window to have your keyboard input work. And when things get odd you might need to minimize and restore a couple times to regain usability. The syntax for xterm is identical, except that "-w 0" would be "-bw 0". And this is 80x328 on a 1080p display. Someday I'll have a 4k display, 3840x2160 which could handle over 1k lines of code on screen. Although the 10x20 neep option is a LOT more readable IMO, but only 96x108 $COLUMNS x $LINES on a 1080p screen with Xdmx and two Xephyr windows.
 
Old 04-01-2017, 10:28 AM   #25
KenJackson
Member
 
Registered: Jul 2006
Location: Maryland, USA
Distribution: Fedora and others
Posts: 757

Rep: Reputation: 145Reputation: 145
Quote:
Originally Posted by Shadow_7 View Post
For a practical demonstration:
...
In the case of emacs "-geometry 80x328+0+0" would fail, but "-geometry 80x256+0+0" would work.
You're abusing the word "practical".

This demonstrates a clever way to stress test emacs. It appears you've found a genuine bug. You should report it. But it's not a bug that will affect 1 in 10,000 users.

I have this snippet in my ~/.emacs file:
Code:
(if window-system (progn
  (setq default-frame-alist
      '(...
        (width . 81) (height . 43)
        ...
I find that 81x43 is a very pleasing size to use for practical use. The 80-column width is based on an anachronism, but it turns out to be a extremely good ergonomic maximum width for text and source code files. I enforce it religiously. (I add one column for convenience.) The 43 height was based on my smallest old monitor, which is gone now, but it's still a reasonable size.
 
Old 04-10-2017, 12:22 AM   #26
Xeratul
Senior Member
 
Registered: Jun 2006
Location: UNIX
Distribution: FreeBSD
Posts: 2,657

Original Poster
Rep: Reputation: 255Reputation: 255Reputation: 255
I have installed EMACS and use it, without the mouse, and trying to understand it. $ emacs on terminal.

The key shortcuts of emacs are summarized here:
https://www.gnu.org/software/emacs/r...df/refcard.pdf
F10 gives a nice, useful, menu. Nice.
However, the motion c-b, with meta,... I am not understanding the concept. This motion is different of the original, most common, ones of machines:

Quote:
Ctrl+S moves the text cursor one position to the left.
Ctrl+D moves the text cursor one position to the right.
Ctrl+E moves the text cursor one line upward.
Ctrl+X moves the text cursor one line downward.
Ctrl+A moves the text cursor to the start of the previous word or the end of the previous line, whichever is closer.
Ctrl+F moves the text cursor to the start of the next line or the end of the current line, whichever is closer.
Ctrl+R moves the text cursor up an entire screen.
Ctrl+C moves the text cursor down an entire screen.
Ctrl+W scrolls down one line. Cursor moves up one line unless it is already at the top
 
Old 04-10-2017, 01:02 AM   #27
KenJackson
Member
 
Registered: Jul 2006
Location: Maryland, USA
Distribution: Fedora and others
Posts: 757

Rep: Reputation: 145Reputation: 145
Quote:
Originally Posted by Xeratul View Post
However, the motion c-b, with meta,... I am not understanding the concept.
Do you mean C-M-b (<CTRL><ALT>b)?

You can get help on any keystroke by typing C-h k <keystroke>, so C-h k C-M-b.

It's probably only useful when writing source code. Emacs has oddball names for a lot of things due to it's lisp heritage. So C-M-b goes backward to the start to the last "sexp".
 
Old 04-10-2017, 10:20 AM   #28
Xeratul
Senior Member
 
Registered: Jun 2006
Location: UNIX
Distribution: FreeBSD
Posts: 2,657

Original Poster
Rep: Reputation: 255Reputation: 255Reputation: 255
You can Really work with that combination of keys??? Kinda terrific key shortcut gymnastics with the keyboard ...
Quote:
Originally Posted by KenJackson View Post
Do you mean C-M-b (<CTRL><ALT>b)?

Last edited by Xeratul; 04-10-2017 at 10:21 AM.
 
Old 04-10-2017, 12:56 PM   #29
KenJackson
Member
 
Registered: Jul 2006
Location: Maryland, USA
Distribution: Fedora and others
Posts: 757

Rep: Reputation: 145Reputation: 145
Quote:
Originally Posted by Xeratul View Post
You can Really work with that combination of keys??? Kinda terrific key shortcut gymnastics with the keyboard ...
The irony is that I have many emacs key sequence programmed into my fingers such that if someone asks me how I do something I can't tell them. But I can do it. The muscle memory in my fingers knows.

This has a great advantage and a disadvantage. The great advantage is that as I work with a concept that I want to implement, I don't have to think about how to move the cursor around or delete a column or straighten my code. I just think about what I want to happen and it happens.

The disadvantage is that when I am forced to work with any other editor, I have to focus on NOT allowing my fingers to automatically pressing emacs keys. I have to carefully think through how to get the cursor where I want it, etc. This is very distracting and frustrating.
 
Old 04-10-2017, 01:00 PM   #30
MensaWater
LQ Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 7,831
Blog Entries: 15

Rep: Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669
Quote:
Originally Posted by KenJackson View Post
The muscle memory in my fingers knows.
A couple of years ago Canadian Border Patrol made me give them the password to my laptop. I had to "type" it in mid-air with an imaginary keyboard to "remember" the keys. I'm sure I looked a bit bonkers to them.
 
  


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
[SOLVED] vim&emacs khw_2003 Red Hat 4 02-03-2014 05:19 PM
Emacs vs Vim splintercdo General 19 11-20-2011 09:10 AM
Quitting emacs and vim xeon123 Linux - General 2 08-25-2011 06:13 PM
regarding colors in vim and emacs pranith Linux - Newbie 0 02-10-2005 03:10 AM
Emacs or Vim? Whats best for me? wiggywag Linux - Software 19 10-15-2003 06:22 PM

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

All times are GMT -5. The time now is 03:13 PM.

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