Editor survival [Was: Recommended editor for novice programmers?]
On 06.09.17 05:31, Nick Boyce wrote:
> I don't like to confess to my august and more sophisticated colleagues
> here how much code I've written using joe - albeit in the simpler
> languages (a variety of Bash scripts, Perl, C, HTML and similar).
> There is some syntax highlighting, but no code-completion or compiler
> integration or the other trinkets that come with proper IDEs. It is
> however, small, fast and reliable - it hasn't had a new feature in
> *years* because for it's intended use-cases it's *feature-complete* !
> It's one of the first things I install on any Linux or *BSD system.
In my decades of leading software teams, one thing I did not do is ask
"What editor do you use?", even in employment interviews. In my
experience, a programmer is most productive using the editor with which
he's most proficient. End of story.
> ... and vi's power makes light work of many tasks but it's
> as user-friendly as a cornered rat ... novices usually remember their
> first time trying to find out how to exit with a genuine shudder.
On the three occasions I've had to extract a marsupial possum from our
chimney (they're like a cat on steroids), I've armed myself with thick
leather gloves and grim determination. For vim, a cheat-sheet suffices,
and :help xxxx" or google do explain.
> A frequent vi moment for those familiar with modeless editors is to
> enter 'insert mode' (when you figure out how), type some text, and
> then try to use the arrow keys to move to a different line without
> remembering to first exit insert mode - depending on vi version,
> terminal emulation, Un*x flavour, phase of the Moon etc., the effect
> of this is that a whole bunch of weird character sequences get entered
> instead of cursor control, which you then spend the next 10 minutes
> removing again. Ugh.
That's an xterm error, as the arrows simply produce motion even in
Insert-mode, if that's properly set up.
But Vim's Insert-mode/Normal-mode modality still requires user
awareness, either through memory or looking at the status line, with a
"set showmode" in ~/.vimrc - unless you also add something like:
" These days I expect to be out of insert mode, after a vertical move:
inoremap <Up> ^[<Up>
inoremap <Down> ^[<Down>
(The ^[ is <Escape>, entered as <Control-V><Escape> in insert mode.)
Now the Insert-mode exit is automated, so long as you use the arrow keys
for moves. (If you use hjkl for speed, then you're not a novice, by
definition.) I've left <Left> and <Right>, so I stay in Insert-mode
while on the line. It works for me, but you could remap them too.
To avoid the need to glance to the bottom of the window to check mode, I
" Cursor Appearance and behaviour:
" (Insert_Mode == Green, Normal_Mode == Red)
if &term =~ "xterm"
let &t_SI = "\<Esc>]12;yellow\x7"
let &t_EI = "\<Esc>]12;green\x7"
So the cursor itself is a reminder. (I haven't yet found a way to have
it make coffee though, so that I always have my eyes open.)
(Colours chosen for yellow text on darkslategrey background, set in the
> (Yes, I do use more sophisticated GUI IDEs for anything serious, but
> that's not what OP asked for. Also, I do realise vim is much better
> than vi.)
Even without integration in an editor, in *nix you can Control-Z out to
the command line, run make, and fg back in. I too would use whatever
editor my fingers remember.