Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

HOWTO - my favorite editor: Joe

Share your HowTo, Documentation, Tips and Tricks. Not for support questions!.
Message
Author
Lou
Posts: 1739
Joined: 2006-05-08 02:15

HOWTO - my favorite editor: Joe

#1 Post by Lou »

Here's another subjective matter: editors.

This is the type of application that you will use a lot, so might as well choose
one that is like second nature when you use it. It has to be one of the
most important application in your arsenal. So why learn the CLI when you
got gedit and kate? Because if you're in a situation in which you
cannot enter the X system and have to operate from the console, those
gui editors won't work.

A superficial check on forums and IRC channels will render all kinds of
asinine remarks, for example :

nano is for chumps
vim is for punks, vi is for real men
vi is better than emacs, emacs is for real geeks
and so forth... I use Joe, sorry for living.

I started with nano, it was easy and did the job, didn't have to
memorize too much. As i began to distro-hop and began to understand
what i was doing, i realize that vi was ubiquitous, you could find it
in whatever distro you used in Linux or BSD; worse yet, sometimes it
was the ONLY editor around. I had tried it and detested it, i found it
archaic and not friendly at all, but i HAD to learn it, it was a matter
of surviving. So my friend Google gave me tons of vi howtos to learn
from. In Debian it comes by default (nvi).

it should take a day to get the hang of it :)

So, learn to use these two, you don't want to be caught downtown
Baghdad in front of some exotic flavor of UNIX, boring everybody to
tears with your whining about where is Kedit, Kate, or Gedit.

$ apt-cache search editors

will give more editors you can shake a stick at. I like Joe, is pretty
light, it weighs half of vim, and the version i use, 'jpico', is just
like nano, same emacs keybindings.

Now my needs are basic, editing configuration files and using it as my
wordprocessor. I don't program or do complex things. After configuring
it, i ended up with this type of keybindings for editing:

C = Control

F1 takes me to the beginning of the file
F2 takes me to the end of the file
F10 saves/exit or just exits if the file has not been edited.
C-a will take me to the beginning of the line.
C-e will take me to the end of the line
C-j will format the paragraphs in blocks when used as
a wordprocessor (.txt).
C-k will delete the line
C-u undo
Backspace to erase backwards
Delete to erase forward

Simple.

Here's a section of Joe's manual
$ man joe

JOE also emulates several other editors.
JSTAR is a close imitation of WordStar
JPICO is a close imitation of the PICO editor (think nano)
JMACS is a GNU-EMACS imitation.
RJOE is a restricted version of JOE, which allows you to edit only the files
specified on the command line."

$ sudo updatedb
$ locate joe

Then i copy the global jpicorc to my /home and start editing so my
personal needs are met:

$ cp /etc/joe/jpicorc .jpicorc

$ nano .jpicorc

On line 20 starts some configuration options, i chose these:
-asis (so my spanish characters are shown)
--exask (it won't ask me if i want to exit)
--help (once i know the commands i don't need them at the top)

There is a description of what each does.

On line 230 under Text File (for my wordprocessing needs)
Text file.
*.txt
-wordwrap
-rmargin 72
-tab 3
-french
-spaces
-asis
-nobackups
--exask

On line 769 i added this:
bof .k1 Goto beginning of file
center .k4 Center line
eof .k2 Goto end of file
exsave .k; Save and exit from editor
markb .k5 Begin highlighting
markk .k6 Close highlighting
blkcpy .k8 Copy block of text
blkmove .k9 Move block of text

saved/exited nano

Then tested it:

$ jpico .jpicorc

pressed F2 - took me to end of file
pressed F1 - took me to the top of the file
pressed F10 - exited

To write an article like this:

$ jpico ~/editors.txt
and start writing, it will be saved in my /home, when i'm thru i press
F10, bye bye.

Reference:
How to Customize Joe
http://ed.asisaid.com/jostrokes.html
Last edited by Lou on 2007-07-26 14:05, edited 1 time in total.
Devuan Jessie - IceWM - vimperator - no DM
KISS - Keep It Simple, Stupid

User avatar
Lux
Posts: 474
Joined: 2006-01-25 13:00
Location: Finland

#2 Post by Lux »

I prefer GNU Emacs as my main text editor, but sometimes I use jmacs (the emacs mode of joe) for simple editing tasks. After installing joe, you can copy the /etc/joe/jmacsrc file to ~/.jmacsrc and then you can modify it to your liking. You can set a command alias in one your startup files (like ~/.bash_profile):

Code: Select all

alias   jm="jmacs"
And then, after you log out and login again, you just need to type "jm" when you want to start jmacs.

Jmacs has an emacs-like "mode line" on top of the screen while the real Emacs has it near the bottom of the screen, but in most aspects jmacs acts more or less like Emacs. I edited the line number 199 in my ~/.jmacsrc file to look like this:

Code: Select all

-rmsg  %p %% %S (%r,%c) \b%u\b Ctrl-X H for help
This makes the mode line in jmacs to look a bit nicer, IMHO.

Here are some basic keybindings that should work both in GNU Emacs and jmacs ("C" means the Control key and "M" means the Meta or Alt key):

Code: Select all

C-x C-c                 Exit jmacs
C-x u                   Undo changes

C-x C-f                 Find & open a file in a new buffer
C-x C-b                 Switch between buffers
C-x b                   Switch between buffers (ask for name)

C-x C-s                 Save changes
C-x C-w                 Save the edited buffer as a different file
C-x k                   Kill buffer (without saving changes)

M-<                     Move the cursor to the beginning of the buffer
M->                     Move the cursor to the end of the buffer
C-l                     Refresh screen

EDIT FILES:
M-d                     Delete text from the cursor to the end of the word
C-k                     Delete text from the cursor to the end of the line

C-Space                 Set mark (to start a text selection)
M-w                     Copy the marked text block to the clipboard
C-w                     Cut the marked text block to the clipboard
C-y                     Paste text from the clipboard

SEARCH:
C-s                     Search forward
C-r                     Search backward
M-%                     Search & replace

SPLIT WINDOW:
C-x 2                   Split the current window vertically
C-x o                   Cycle through the windows
C-x 0                   Close the active window
C-x 1                   Close all but the active window
You can try jmacs first and if you like it, then try the real thing -- the GNU Emacs. ;)
"Hit the philistines three times over the head with the Elisp reference manual."
-- Michael A. Petonic --

User avatar
sleepyEDB
Posts: 97
Joined: 2005-09-11 19:47
Location: Detroit, MI

#3 Post by sleepyEDB »

Nice writeups. Thanks guys...or guy and girl...or girl and girl...or whatever the case may be.

Hmm...thanks persons! :P


sleepy
"The road of life is rocky, and you may stumble too. While you point your finger, someone else is judging you." --Bob Marley

Lou
Posts: 1739
Joined: 2006-05-08 02:15

#4 Post by Lou »

Lux: i added this line to my .bash_profile:

alias jp="jpico"

and it works perfectly as user and root, but NOT when i use sudo. After this, i added it to my .bashrc with the same results. Is there a way?
Devuan Jessie - IceWM - vimperator - no DM
KISS - Keep It Simple, Stupid

User avatar
Lux
Posts: 474
Joined: 2006-01-25 13:00
Location: Finland

#5 Post by Lux »

Possibly you need to add the same command alias also to /root/.bash_profile or /root/.bashrc?

It might make sense to make the /root/.bash_profile to look like this...

Code: Select all

if [ -f /root/.bashrc ]; then
  source  /root/.bashrc
fi
...and then add all the bash configuration stuff in /root/.bashrc

You might also want to copy your ~/.jpicorc to /root/.jpicorc
Last edited by Lux on 2007-07-27 14:43, edited 1 time in total.
"Hit the philistines three times over the head with the Elisp reference manual."
-- Michael A. Petonic --

Lou
Posts: 1739
Joined: 2006-05-08 02:15

#6 Post by Lou »

I tried it, it won't work. Thanks all the same.
Devuan Jessie - IceWM - vimperator - no DM
KISS - Keep It Simple, Stupid

User avatar
Arnie
Posts: 293
Joined: 2006-06-22 16:29
Location: Netherlands

#7 Post by Arnie »

That's funny... I prefer Joe's Own Editor as well. It's just no-nonsense.
Debian Men
Need instant advice? Get BOFH's opinion

User avatar
Lux
Posts: 474
Joined: 2006-01-25 13:00
Location: Finland

#8 Post by Lux »

Lou wrote:I tried it, it won't work. Thanks all the same.
OK. Maybe a slightly different command alias would work better? Try this alias:

Code: Select all

alias   sjp="sudo jpico"
Then you should be able use the "sjp" command to edit files with jpico as the root user.
"Hit the philistines three times over the head with the Elisp reference manual."
-- Michael A. Petonic --

Lou
Posts: 1739
Joined: 2006-05-08 02:15

#9 Post by Lou »

Hehe! it works perfectly, thanks!
Devuan Jessie - IceWM - vimperator - no DM
KISS - Keep It Simple, Stupid

User avatar
canci
Global Moderator
Global Moderator
Posts: 2502
Joined: 2006-09-24 11:28
Has thanked: 136 times
Been thanked: 136 times

#10 Post by canci »

LOL, in Downtown Baghdad they don't use UNIX for sure, since they're
an American colony now, so Windows will be more frequent. ;) Or maybe
Apple?
See: http://www.youtube.com/watch?v=xcjLEwZqcQI

Other than that, this is, as always, a great HOWTO as expected from Lou...
Image Stable / Asus VivoBook X421DA / AMD Ryzen 7 3700U / Radeon Vega Mobile Gfx (Picasso) / 8 GB RAM / 512GB NVMe

READ THIS:

* How to Post a Thread Here
* Other Tips and Great Resources

User avatar
regeya
Posts: 11
Joined: 2004-09-18 00:11

Re: HOWTO - my favorite editor: Joe

#11 Post by regeya »

Lou wrote: nano is for chumps
vim is for punks, vi is for real men
vi is better than emacs, emacs is for real geeks
and so forth... I use Joe, sorry for living.
LOL. Not a sentiment I'd seen in a while. :D I used Joe in college; vi was okay, but I'd not messed with UNIX systems until about 11 years ago, and had used PCs for a few years, so something being WordStar-like really floated my boat. :-D There really is a danger to dealing with DOS machines before anything Unixy, I suppose. ;)

I've gone through various fits, Joe, Emacs, Vim, jEdit, etc. I may just have to look at Joe again.

Thanks for this!
But let us not rail about justice as long as we have arms and the freedom to use them.

User avatar
actionM
Posts: 890
Joined: 2007-05-01 02:11

#12 Post by actionM »

I've been struggling to find an editor. I think this may be the one. The only problem is, I can't get syntax highlighting to work for .css files.

I put this in the .jpicorc config file with no luck.

:include /etc/joe/syntax/css.jsf

Weird thing is, .html files highlight just fine.

And really, a CSS file doesn't need much highlighting anyway. If I could just get the ";" to be a different color, that would be enough.

Lou
Posts: 1739
Joined: 2006-05-08 02:15

#13 Post by Lou »

Hi, have you checked their website or googled about it, maybe the solution is obvious, i don't know the answer 'cause i have no need for hilighting, sorry.
Devuan Jessie - IceWM - vimperator - no DM
KISS - Keep It Simple, Stupid

User avatar
actionM
Posts: 890
Joined: 2007-05-01 02:11

#14 Post by actionM »

Yeah I'm still googleing. I googled and read man pages till 3 last night! I also thought about booting up Lenny and seeing if any changes have happened to Joe, but for some reason Lenny don't want to boot. So now I get to fix that as well haha. I'm sure I'll get it worked out soon enough, but if anyone knows anything to speed up my search, I'd appreciate it!

Lou
Posts: 1739
Joined: 2006-05-08 02:15

#15 Post by Lou »

howto
http://www.sysdesign.ca/guides/unixdev/

in google:
joe editor + syntax hightlighting howto
http://tinyurl.com/ywyu72

It's supposed to syntax highlight in 40 languages.
Devuan Jessie - IceWM - vimperator - no DM
KISS - Keep It Simple, Stupid

User avatar
llivv
Posts: 5340
Joined: 2007-02-14 18:10
Location: cold storage

#16 Post by llivv »

'
Last edited by llivv on 2019-02-17 04:46, edited 1 time in total.

User avatar
actionM
Posts: 890
Joined: 2007-05-01 02:11

#17 Post by actionM »

What does these WM's have to do with joe? I'm confused here! I don't even use a WM...yet.

Thanks for all the tips tho. :D

User avatar
llivv
Posts: 5340
Joined: 2007-02-14 18:10
Location: cold storage

#18 Post by llivv »

'
Last edited by llivv on 2019-02-17 04:46, edited 2 times in total.

User avatar
actionM
Posts: 890
Joined: 2007-05-01 02:11

#19 Post by actionM »

I run xfce4. Thats not considered a WM is it? Maybe it is, I dono. I do need to get back on Joe. I've been on Vim for a while. I can't set still. I don't think I would mess with Vim at all if my programming teacher wasn't notorious for forcing it on everyone in almost all of his classes he teaches. I'd rather just stick with Joe. Its so straight forward.


haha, and really I shouldn't be too concerned about highlighting a stylesheet. There pretty simple on the eye.

User avatar
llivv
Posts: 5340
Joined: 2007-02-14 18:10
Location: cold storage

#20 Post by llivv »

'
Last edited by llivv on 2019-02-17 04:46, edited 1 time in total.

Post Reply