LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (https://www.linuxquestions.org/questions/slackware-14/)
-   -   What is a good command line text editor for Unicode UTF-8? (https://www.linuxquestions.org/questions/slackware-14/what-is-a-good-command-line-text-editor-for-unicode-utf-8-a-4175462519/)

tronayne 05-21-2013 07:49 AM

Here's a vote for vi/vim -- along with a little bit of history...

Linux is the kernel, everything else are utilities, tools and an occasional application or fifty. The utilities; things like vi, sed, ed, etc., etc., are look-work-alike ports of AT&T Bell Labs' Unix system utilities, tools and applications and, in that world, Unix is the kernel.

All of that stuff was written using text editors on text-only terminals -- a lot of Teletypes (you see those in old movies clanking away at 10 CPS), paper tapes for "storage," and the like. Royal PITA, that. Of the editor families, there was the original, ed (you have that on your system by the way) then ex (extended ed, a programmer's editor), plus a few more that have more or less fallen by the wayside. Bill Joy, a whiz-kid at Berkeley, took ex and added a visual mode to it, thus, viual editor; this was when video terminals started coming into use (and the things cost hundreds and in many cases, thousands of 1970's dollars). No paper, no clanking mechanical horrors, just a tube to stare at and no mice -- you moved the cursor around with with the H, J, K and L keys under your fingers (you still do, you do not take your hand of the keyboard). Simple CTRL-something key sequences to do things.

The Unix-based text editors all share the same key sequences to do work (like substituting some pattern of characters with some other pattern of characters, inserting, deleting, all the stuff you typically do with an editor. Learn one, you've pretty much learned 'em all. So, what you can do with the text editor, say vi/vim, you can also do with the streaming editor, sed and ex. They all work with what are known as regular expressions. Those look like gobbledygook when you first encounter them but after a while they start to make sense (and, once learned, your life becomes easier and easier).

Thing is, these programs were all designed to do one thing and do it well (see the bottom of this post) and they were designed to work together as pipes and filters. Brian Kernighan and Dennis Ritchie (R.I.P.) wrote books with vi, incorporating simple, elegant directions for typesetting in the text (The C Programming Language for example). All the manual pages were written with the same tools (and still are). A little learning curve and away you go.

I've been doing this stuff since... oh, hell, the mid 70's (lessons learned during a wasted youth) and still use vi, sed, ex and all the other text manipulation, editing and formatting tools to do useful work quickly and effectively. They work.

Learn vi, you'll never regret it.

[EDIT]
Something I forgot to mention: with a vi-compatible editor; e.g., elvis, vim, if you place a file .exrc in your home directory with this content:
Code:

cat .exrc
set autoindent showmode showmatch

autoindent: if you insert a tab in the first column, the editor will continue to insert a tab on a new line; an additional tab will indent further and so on. To shut it off, you type Ctrl-D which undents one tab level. Mainly useful with indenting code.

showmatch: when you type an opening paren, brace or bracket -- ( { [ -- and then a closing paren, brace or bracket the cursor will jump back to the matching opening one. You can use the % key to jump back and forth to matching open-close pairs. If you don't close an open (or vice versa), you'll get a beep or visual flash to indicate that there isn't a match.

showmode: indicates at the bottom of the screen what mode you're in, command or insert.

All handy for big (or even small) editing.
[/EDIT]

Hope this helps some.

paulb2 05-21-2013 04:35 PM

Quote:

Originally Posted by tronayne (Post 4955717)
Here's a vote for vi/vim -- along with a little bit of history...

-- snip --

All of that stuff was written using text editors on text-only terminals -- a lot of Teletypes (you see those in old movies clanking away at 10 CPS), paper tapes for "storage," and the like. Royal PITA, that.

-- snip --

Hope this helps some.

Thank you, tronayne, for the encouragement. After reading all the responses, I intend to learn vim (or perhaps elvis) along with nano and joe, and see which one (or combination) will serve my purposes best. I will now mark this thread solved.

And thanks for bringing back memories of the good ole' days. In my first real job after graduate school, back in the mid 60's, the company I worked for cleaned out a former janitor's closet and installed two gen-u-wine tty's. One had a dial-up connection to a local (same city) shared computer that used an early version of BASIC; the other to a distant shared computer a few states away that used FORTRAN.
I did a lot of data analysis on the first one, and had lots of rolls of yellow, punched, paper tape as my storage medium. Even wrote my own programs for data input, analysis, and output in the form of tables and graphs. Made report writing much easier.

tronayne 05-22-2013 07:23 AM

All that sounds really familiar -- dial-up (110 BAUD) Teletype, BASIC, FORTRAN. Fortunately the computer was a Honeywell GECOS time sharing which had many of the features of Unix (GE was part of the project including Bell Labs, MIT and other folks, Honeywell bought GE's computer business), nice system to work on, later they did Multics that turned out to be pretty useful too although I never did work on a Multic system. My own transition from GECOS to Unix was pretty painless, actually. I still have box somewhere or other with paper tapes, nothing to read them with, but there they are, all ready to load and run. Sheesh. Still got a couple of boxes of 9-track, too. Why, I don't know.

perbh 05-22-2013 07:41 AM

Ahhhh - brings back tons of memories!
Started on a teletype as well - even had 2 punches so you could copy/edit *chuckles*
As for quick and dirty editing by manually splicing and punching the holes - could read ascii-codes like it was clear-text!
And you could connect to a Univac-1107 with a whopping 64kW memory!
Once I started a job that finished right after midnight - and got a bill for some $150,000 - the stooopid system thought I had used over 24-hours of cpu-time - he, he!
Yeah - we do get a li'l nostalgic at times ... still - nice memories.

By-the-way - Univac was word-addressable, not byte-addressable and each 'word' was 36 bits - so 64kW were 64kx36bits

tronayne 05-22-2013 07:57 AM

Hey! Yeah, Honeywell was a 36-bit box, too. Forgot about that. Never did figure out just what reason/advantage there was to a 36-bit word size, though (maybe being able to use the full 32-bits for numerics? I dunno).

BTW, the Wikipedia article about Multics says that "The last known running Multics installation was shut down on October 30, 2000, at the Canadian Department of National Defence in Halifax, Nova Scotia, Canada." Now, that's some longevity!

Z038 05-22-2013 10:23 AM

Since it hasn't been mentioned in this thread, I'll just add that pico is another basic editor choice available in Slackware. nano is a pico-like editor with more features than pico and with a GPL license, whereas pico has a proprietary license. Of the two, I prefer nano.

nick_th_fury 05-22-2013 11:24 PM

For a new person switching from Windows, Midnight Commander 'mc' is really easy to use.
Fantastic little editor, works on unicode as well and it's also a pretty powerful file manager.
Not to sure about it's language versions though.
When I first started learning Slackware & Suse I used vim. I completely agree it's worth learning if your going to be using it a lot.

perbh 05-23-2013 09:47 AM

Quote:

Originally Posted by tronayne (Post 4956486)
Hey! Yeah, Honeywell was a 36-bit box, too. Forgot about that. Never did figure out just what reason/advantage there was to a 36-bit word size, though (maybe being able to use the full 32-bits for numerics? I dunno).
...

Makes a huuuuge difference for floats. I used to be involved in the ship-building industry - the yards were mostly running ibm mainframes - and where you've got the 'bulb' (double curvature and aw' that, origin at the stern) - 32-bit floats caused welding seams the size of which you have never seen - just to cover the gaps - he he. Using 36-bit floats -> no problems. For the ibm's we had to rewrite large parts using 'double precision'.
Of course, somewhat later was the era of the mini's and the Nord mini used 48-bit floats - a breeze!! (though as slow as walking in treacle)

p.s
My humble apologize to the 'audience' - got carried away with my reminiscence - this has nothing to do with 'command line editor' ...

kikinovak 05-23-2013 10:29 AM

Quote:

Originally Posted by Richard Cranium (Post 4955389)
The most important vi skill is memorizing the key sequence of...

:q!

... :)

No, it's this sequence:

Code:

:r !LANG=C && date
... for the daily ChangeLog.txt :hattip:

digger95 05-23-2013 01:18 PM

When I first started using Slackware (and Linux in general) I had to learn emacs the hard way. I was stuck at the command-line, couldn't get X started, and had to edit some configuration files before I could even reboot my machine. Emacs was the only text editor I could remember the name of, and unfortunately the man page doesn't give you a whole lot of in-program help. I couldn't for the life of me figure out how to save a file and/or quit the program, so I sat here pushing various keys to see what they did. :p

tronayne 05-23-2013 02:50 PM

Quote:

Originally Posted by perbh (Post 4957275)
Makes a huuuuge difference for floats. I used to be involved in the ship-building industry - the yards were mostly running ibm mainframes - and where you've got the 'bulb' (double curvature and aw' that, origin at the stern) - 32-bit floats caused welding seams the size of which you have never seen - just to cover the gaps - he he. Using 36-bit floats -> no problems. For the ibm's we had to rewrite large parts using 'double precision'.
Of course, somewhat later was the era of the mini's and the Nord mini used 48-bit floats - a breeze!! (though as slow as walking in treacle)

Yeah, we were running finite element analysis on that Honeywell mainframe (and all sort of other engineering analytic software too). No problems there. Nice easy-to-use boxes, those.

astrogeek 05-23-2013 03:15 PM

Quote:

Originally Posted by perbh (Post 4956477)
Ahhhh - brings back tons of memories!
Started on a teletype as well - even had 2 punches so you could copy/edit *chuckles*
As for quick and dirty editing by manually splicing and punching the holes - could read ascii-codes like it was clear-text!

HAHA! I too started life on a teletype with paper tape storage and also had a double punch copy system. I built more than one cassette tape interface but never acheived any kind of reliable storage with them.

But it is true, we learned to read the ascii directly from the tape (machine code too!) and at times that could be the quickest access to code when debugging!

Did anyone else use multi-colored magic markers to bookmark sections of tape for easy reference? How about tiny marginal notes? ;)

perbh 05-23-2013 09:00 PM

@astrogeek,
We occasionally used a papertape 'header' in clear-text (using a 5x7 matrix to generate 'readable characters', still using the 8th row for parity).
Many times I have seen guys trying to read what was there (expecting the usual ascii-code) and being completely baffled, not being able to figure out what the heck was on the tape *chuckles* - while anyone 'uninitiated' obviously could read it at a glance.

Papertape output usually was put into a h-u-g-e bucket, later to be wound up. Being on the 6th floor, we usually just threw the head of the tape out the window and let it hang there while carefully winding it up on a spool ... until one day when a guy a couple of floors below saw this 'girlander' hanging outside his window - so opened the window and cut it with scissors .... and thus valuable data slowly floated down to the ground ...

perbh 05-23-2013 09:14 PM

I used to be responsible for a remote-terminal (w/card-reader/punch and line-printer and papertape punch/reader) running a NTR (nine-thousand-remote) emulator against a Univac-1107. It had to be boot-strapped with manual-switches (all 16 of them) on the front-panel - but often, when you finally sent it the final 'jmp'-command it would just hang there ...
Guys working the 'late shift' would call me up at all ridiculous hours to get the beast started again .. I had figured out that when it hung - you could get it going again by giving it a kick on a particular spot on the side panel (which I had marked). So - whenever they called out-of-hours I would command everyone out, bootstrap it and giving it 'the kick' - never failed (and I never told anyone). I guess that today, that is known as 'job security'!!

perbh 05-23-2013 09:28 PM

Often, data would be on punched cards which had to be sent through a card reader/punch so we could 'read' what was on each card and the seq-no would also be punched/printed (the punch on the terminal didn't have a black ribbon). A box of cards was usually about 3000 cards. Once, a friend of mine was walking through to the card-punches with a box full - he stumbled on the threshold and spilled all the cards out on the floor !!
It took him well over a week to get the cards back in their proper sequence!!

Cards, of course, were in EBCDIC - a right pita!!
However, they made good note-pads - always had about 20 of'em in my jacket-pocket!!


All times are GMT -5. The time now is 08:41 PM.