Today, I really got a nice little reward. Basically, the company I work for was getting people together to go over the renewals with our medical insurance provider, and of course, eh, I’d rather be at  my work station getting something done. So this provided me with the impetus to setup my phone as  an impromptu in-building terminal.

Problemo is, I usually use VIM. While I’m stubborn enough to give that a go on a small screen with a virtual keyboard, my phones virtual keyboard doesn’t provide the *PC* keys: namely escape, control, and alt. It’s also not the most convenient to use the programs methods of side stepping this. So I got to thinking for a moment, what is an editor that is light and small enough to use over a text terminal, yet powerful enough to service a programmer without a lot of special keys? –> I found the solution right in my own skills repertoire, or as some say: the default text editor! Some years back, I took the trouble to learn how to use /bin/ed out of an interest in learning how to use vi/vim better.

After a couple minutes of thinking on this, it occurred to me: ed was designed in an era when terminals were SLOW, so slow in fact, that you could probably piss off someone by trying to print to much to standard output, which could be connected to a roll of paper and a true TTY >_>.

So it seems that learning /bin/ed was well worth it, because it makes one hell of a file text editor when using your phone as a terminal 🙂

Chuckle of the day, 2009-04-13 in #vim

   viking | "Viper, an emacs package providing Vi
emulation on top of Emacs." i don't know what
to say
jamessan | Vimacs : Vim-Improved eMACS: Emacs emulation
for Vim
SAS_Spidey01 | HAHAHA
SAS_Spidey01 | thank you jamessan, I haven't laughed like
that in a while xD

Flitations with /bin/ed

lately, I’ve been developing a strange affection for the old ed(1) text editor. Because tpsh defaults the value of EDITOR to ed on unix, and edit on windows; I’ve had to deal with ed quite a lot whilst working on my shells ‘fc’ built-in (fc is the command for listing and editing/re-executing commands through the shells history).

Of course once support for ENV was worked out, I changed it to ex >_>

atm I’m reading the ed tutorial in ed, via ssh to my OpenBSD machine; it actually makes a nice pager :-/. All in all, I don’t think I would take ed over vi for coding but it’s a rather interesting program; after starting vim it’s also possible to drop into extended ex mode with gQ, effectively giving a modernized line editor.

My interest in ed atm is for short editing tasks, the kind where vi and other screen editors are not often necessary for the task. Some times, I can’t help but wonder if I’m secretly older then my birth date suggests lol.

mmm.

Vim rules text editing !

An interesting thing to come up in #vim, Why, oh WHY, do those #?@! nutheads use vi?. Which reminds me a lot of why vim has ruined me for all other editors, except vi.

When I first took up programming, I had started with C++ (probably not a good choice), and I selected an IDE so I could concentrate on C++, not the compiler and debugger. When I started to learn other languages, which my C++ focused IDE didn’t give a flying flub about, So I quickly came to the conclusion, that since I would never _stop_ learning, I would do best to find a general purpose code editor. Because if I kept using IDEs, I would spend more time learning to use Integrated Development Environment XYZ then programming something meaningful in language XYZ.

I knew that the most widely used (read if the machine supports text, it probably runs this editor) would likely be Emacs and Vim. I’m the kinda guy, I like to use the same tools without caring about the OS ‘too much’. Although I don’t mind if a program changes widget styles to match, I hate things like Firefox that change from Microsoft ‘Tools->Preferences” and Unix “Edit->Preferences” instead of just creating a damn “Settings” entry in the file menu. So obviously, an editor that works that way, can suck my **** lol. Emacs and Vim are fairly consistent.

At that point in time, text editing consisted of Left, Right, Up, Down, Delete, Backspace, Page Up, Page Down, Home, and End… nothing else (I had yet to learn the control modifier to them). Currently, the number of actions I know in Vi and Vim, far exceed that by the size of the death star, hell… I know more emacs then that, and I haven’t “really” used emacs in years. But I didn’t really care about that kind of stuff at the time, I just wanted something with syntax highlighting and extreme portability.

I knew full well, that Vim and Emacs were extremely powerful tools; but they would take learning to use that effectively. A knife is a simple weapon, using it ain’t. (And admitidly, if emacs was a pocket knife, it would be the “swiss army knife” to existing Swiss Army Knifes, as swiss army knifes are to classic pocket knifes.) The main thing that attracted me to Vim and Emacs, was hat they support many languages out of the box (vim 7.2 supports around ~500 by now, for syntax highlighting alone.), and could be extended with support for more.

So for one reason or another, I gave vim the first try. I couldn’t even figure out how to open or save files with it; as I had elected not to use the graphical editing interface. I basically chucked Vim in the corner and started looking at emacs, choosing XEmacs over GNU Emacs. XEmacs proved to be a quite a nice editor and very useful to me. In fact, I think my user account on Josephine still has XEmacs for Windows as my default text editor. Later on down the road, I was reading a skit, using pico, gnu emacs, and vi. Reading the part on lowly Vi, it all looked pretty darn logical all of a sudden lol. So I started to play around with Vim, using the :help system to learn to use Vi. In a short period of time, I became much more effective at editing text then Iw as under XEmacs or Wordpad; in my case vi commands were also much easier to remember before muscle memory caught up.

Why do I use Vim, and utterly hate all other editors? (Except for vi and microemacs.) Most typical editors are week in the knees, trying to ‘edit’ text with them after living with vi/vim, just feels like dancing with a cement kimono, I work with textural information non stop, be it books, web browsing, television, instant messengering, e-mail, games, etc; even the operating systems command line interface, let alone editing text files lol.

*Actually* learning how to use vim the right way, quickly lead to editing smoothly and learning how to learn more ;-). One thing I like about vim, it is modal like vi, and my brain is essentially modal as well! And unlike emacs, it doesn’t seem to slow my down when exercising my “ten fingered typist” style of using a keyboard. With vim, the only limit is you mind. Tonight, I’ve actually learned 4-6 new things (most of which are vi compatible hehe) tonight, that allow me to edit even more effectively then I have been. Which if I had to compare to the best offerings of notepad.exe or MS Word, Vim has allowed me to be 1,000,000,000,000,000,000^256 times more effective. And yesterday, I spent what, like 16 hours editing code?

If I had to use something like notepad for that, I would go out of my fucking mind !!!!!

Just for the heck of it, 1,000,000,000,000,000,000^256 is the equivalent of:

1,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000

But I don’t think I know how to count that high in written English LOL.

You know, the more I try to give IDEs a fair chance, the more I find. That in the end, THEY ALL SUCK !!! Either that, or it has proven impossible to find something with even so much as a decent editor that’s worth more then notepad or /bin/ed, is it really to much to ask; a decent editor?

Even on Windows XP, where cmd.exe has proven to be the worst damn CLI I’ve used, *my way* still seems to beat any IDE I’ve tried, and that is pretty damn sad lol. And so far I have found nothing that bests my personal combo of term+zsh+vim+tools, and tending to the more ‘IDE like’ features myself >_>. The only bad thing about cmd.exe, is it doesn’t have emacs based line editing out of box lol, that and the tab completion works like a kinder garden program compared to bash/tcsh/zsh/pdksh.

I hate word processing

Hmm, a small dilemma unfolds itself.

To view files in .doc, .odt, .rtf, et. al. formats I need a word processor that supports them.

To create one, I would generally use Google Docs — normally I use TeX /w LaTeX or XHTML+CSS instead though and skip WYSIWYG word processor crap 🙂

And I’m not about to upload every flib’n file I have to look at to Google Docs either… Nore do I want to bother with programs like anti-word.

But which do I install?

Microsoft Word is arguably the word processor by which all others are judged, much like GNU Emacs is when looking at emacsen.

But when you combine that it is closed source, only supports WinNT, and costs an arm & a leg it is just not worth the extra features unless you need them enough to run Windows for them lol.

Abiword is apart of Gnome Office and light & fast while keeping to a MS Word (pre 2k7) style. The only problems I’ve had with it is it forced me into using MS Word .doc files as the lowest common denominator between word processors! The choice was either .rtf or .doc because Word wouldn’t take any of the other files each of the others could handle.

The only problem is that Abiword couldn’t (and still couldn’t last I looked at it’s dev version) lay out our pages right like the other programs did. So we had to use .doc which worked fine in Abiword 🙁

OpenOffice.org has a good enough word processor, swriter — not as feature full as MS Word but heavier then Abiword. It’s a great program and I’ve used it often in the past for School but for my laptops 512MB of RAM it is a little *to heavy* for my tastes. To be honest, I don’t want to wait forever for a word processor to startup — because it reminds me if some idiot didn’t send me {.rtf,.doc,.odt,.abw,} files I would be using a pager to read the text instead.

KWord is actually quite nice even if it is probably not the best word processor out there. I like very much that despite the similarity in name that KWord tries to be it’s *own* program rather then another imitator.

The problem is like swriter, kword comes with an entire office suite :. I don’t need a Office Gfx app, I use GIMP and a few others when needed. Don’t need a presentation system — I wouldn’t touch one without a pay check! Don’t need a database client because I’d probably use some thing like mysql’s client. And I rarely use either word processors or spreadsheets beyond viewing files.

Hmm… well there’s 17gb of disk space to spare just for installing software so no harm in having both KOffice and most of Gnome Office I suppose.

Now if only they could lift even a finger nail to TeX !

MicroMac

Been playing a bit, installed editors/ uemacs, qemacs, em, mg, jove, and emacs.

uemacs is a simple MicroEMACS 4.0 set up, looks good for learning. I.e. a Pico/Nano style shortcut buffer on top.

qemacs wouldn’t start, so much for quick emacs

em is a modified MicroEMACS 3.x/4.0 with an ID of uEmacs/PK-TOY 4.0.17

jove is Johnatons Own Version of Emacs, looks like my favorite so far. It asks “Some buffers haven’t been saved; leave anyway? ” rather then a save y/n, modified buffers exist still leave yes or no and please say exactly yes or no blah blah like GNU Emacs. em & uemacs share joves trate here as well but mg takes after emacs proper. Only mg won’t ask before exit if its the stratch buffer.

emacs, well is GNU Emacs. Slow loading bukly bastard with a 4.5MB binary !! Compare to the others which are smaller then nvi/nex but bigger then ed. I suppose the fact that its the only emacsen in this list that has X11/GUI support warrents its bulk… maybe

Terry@Dixie$ du -ch /usr/local/bin/emacs                                   8:04
4.5M /usr/local/bin/emacs

Terry@Dixie$ du -ch /usr/local/bin/jove 8:05
148K /usr/local/bin/jove

Terry@Dixie$ du -ch /usr/bin/nex 8:05
304K /usr/bin/nex

Terry@Dixie$ du -ch /usr/bin/vi 8:05
304K /usr/bin/vi

Terry@Dixie$ du -ch /usr/local/bin/uemacs 8:06
124K /usr/local/bin/uemacs

Terry@Dixie$ du -ch /usr/local/bin/em 8:06
84K /usr/local/bin/em

Terry@Dixie$ du -ch /usr/local/bin/mg 8:06
98K /usr/local/bin/mg

Terry@Dixie$ du -ch /usr/local/bin/vim 8:06
1.4M /usr/local/bin/vim

As you can see, em is the smallest and emacs the fatest. So far, I think I like Jove but they all seem to lack GNU/X Emacs self-documentational nature. Personally I prefer nVi or Vim, but Jove is pretty nice. All of these emacsen do support multiple editing buffers, which is one thing I did like ’bout emacs back when I used to use XEmacs as my primary editor.

mg is a variant of MicroEMACS maintained by the OpenBSD people, nice little editor. I’ve never used OpenBSD and have little expirence with NetBSD so I don’t know if they have an easyeditor like FreeBSD’s ee but I’d reckon mg could serve the same purpose. I generally use ‘vi’ on systems lacking vim though, so I dunno. So far in my travels the only editor I can’t use well, has got to be ed and emacs. Why? Because ed’s ‘?’ error message annoys me and GNU Emacs just pisses me off by its very nature.I can use Emacs pretty well, I just choose not to (again I prever Vi)

Vi, Macs, and Shells

I’ve so got to get or make a Vim plug in or some thing for this.

So far I’ve come to a cross roads, I can keep my editor or I can become more Emacs compatible. On Windows I use PuTTY for a ssh client. I don’t know what the terminal emulator is but it sucks. When working on Vectra I effectively have no insert/home keys e.t.c. or Numpad which is bad because I’m accustomed to using the home and end keys in my line editing. This means ether live with only cursor keys and backspace for line editing or relearn the Emacs navigation commands. Control+key is used, b for back one char, f for forward one char. p for previous command (up) and N for Next command (down). e for end of line while a is used for end and home key replacements. Using the meta key (generally alt) turns this up a notch and uses larger units such as forward a word instead of a char. I’m used to using control+u and control+w in line editing – I don’t know if control+w has effect in Emacs but control+u doesn’t.

Needless to say I don’t like Emacs ! I used XEmacs as my editor at first but I fell in love with Vim after I started getting into shell use. You could say learning the shell helped me learn Vim and vice versa. I didn’t like vim at first and I’m only now starting to use gvim off windows (konsole is better then cmd.exe). I’m very used to Vim so I am also used to Vi. My vimrc file makes it easier to use but since Vectra is very light on the software I didn’t install vim. Vi is good enough and ee for when I’m just pissed.

Vim/Vi is very simple to use once you get the hang of it, Emacs is just wrist strain. So now I ask my self the question: What about Vi editing mode? The Bourne and Korn shells support it as does the Z shell AFAIK. However I use tcsh which does not. So if I want to use this editing mode that means use another shell. Vectra only has sh and tcsh. Being FreeBSD the csh is actually tcsh but not like how bash is commonly GNU/Linuxes sh. FreeBSD uses ash as s, a very light Bourne shell clone. I could install any other shell I want really and a ruby shell would be kind of cool if it could fuse an interactive shell, scripting and ruby into one package. The problem is if I get used to vi line editing in a shell I’ll be ruined for any other shell !. I’ve yet to decide but to be honest with the Vi editing mode I think sh is livable. It nets the use of cursor keys and command history.

nvi/Vim is very simple. Vi is a modal editor, if you press escape you are in a command mode, if you press “i” or insert you are in insert mode and it’s like most text editors. You litterly change the entire keyboard into/out of modes. In insert mode your keys always insert chars, most consoles let you use the arrow keys, home/end/delete/backspace like normal. In normal mode which can be reached by pressing escape. Every key stroke is a command or switches to other modes. You can move the cursor with the h,j,k,and l keys. The h and l keys move left and right while the j and k keys move down and up. I’ve heard that Bill Joys console had arrow keys on these so that’s probably why they are used this way. It was a little weird at first but now I’m getting used to it. I’ve generally used the cursors.You can delete a char using the “x” key.

You can delete directionally by prefixing a movement key with d. So dh and dl deletes one char to the left or right. Pressing dj or dk will delete the current line and the line below or above. To kill the whole line use dd. You can repeat commands by appending a number, example: dd3 will delete 3 lines. You can move to the start or end of line by pressing ^ and $ this also works with d. You might notice ^ and $ from some studies in regular expressions – I do from a bit of sed/grep/awk learning. You can move forward and back a word at a time with the w and b keys. Much faster then control+key combo and easier on the wrists IMHO! Pressing i puts you into insert mode to enter text, pressing v puts you in visual mode. Escape will bring you back to normal mode. I never used visual mode very much at first but now I find it useful. In visual mode most normal mode commands for movement work the same. Yet when you move the cursor you always highlight or “select” text. You can copy it or “yank” it with the y command and put or “paste” it with the p command. If you want to cut it use the c command. Usually after a cut I think Vim puts you in insert. Pressing : gives you a little command line.

Here you can enter commands but internal and external, set options and more. To edit a file type e /file/name after pressing : for speed I bound ; to do the same as : in my vimrc. To save it’s :w also know as write ! To quit it’s :q note that you press the ” : ” you don’t type it as part of the command. You can override it by suffixing it with a !. Example: force a quit by doing a :q!

We can run shell commands by prefixing them with a “!” like this :!ls ~/Documents. File name completion works and a UNIX shell is better at it then cmd.exe (vim is very portable). Vim might seem a bit awkward at first but once your used to it it’s very fast and effeienct. TO get help type :help to get context sensitive help try :help topic_or_cmd

Using vi line editing in a shell works the same was using Vi only you start off in insert mode instead of normal mode. I haven’t decided what to do yet.

Ya know whats funny…. I started out to write a short post about my feelings but I end up trying to knock out a Vi/Vim intro before my batteries run out.

All roads lead to Vi !!!