Suggestion for ne

51 views
Skip to first unread message

Xavier

unread,
Dec 25, 2011, 4:44:54 PM12/25/11
to niceeditor
Hi,

First of all, I would to thank that you made ne. It's very cool.
Before ne, I use vim or nano for necessity when I have to edit files
in console (for ssh sessions for example). The features I like very
much of ne are:
* it consumes few memory (it's more lightweight than nano and vim)
* it has menus. So if you don't remember de shortcuts, dont worry,
only see the menú.
* the shortcuts are _standard_: for example CTR-X is cut (at least all
word processors have this shortcut ;)


For the other hand, I suggest some things to improve:

* In the menu bar, in Prefs, could you add [X] for item selected and
[ ] for item not selected? Now I have to press two times for deselect
the item and we have no idea if item is selected or not.
* Could you change Prefs to Preferences? Better for non-english users.
* Could you i18n ne? I have LC_ALL=ca_ES.UTF-8 in env bash, and nano
displays me in catalan, but ne does not. Is i18n avaliable? I could
translate english sentences to catalan and spanish if you want.

Thanks a lot,
Xan,

Sebastiano Vigna

unread,
Dec 25, 2011, 5:13:01 PM12/25/11
to nicee...@googlegroups.com
On Dec 25, 2011, at 1:44 PM, Xavier wrote:

> * In the menu bar, in Prefs, could you add [X] for item selected and
> [ ] for item not selected? Now I have to press two times for deselect
> the item and we have no idea if item is selected or not.

The status bar has letter for essentially everything--what are you missing, specifically?

> * Could you change Prefs to Preferences? Better for non-english users.

mmmhhh... a bit to long.

> * Could you i18n ne? I have LC_ALL=ca_ES.UTF-8 in env bash, and nano
> displays me in catalan, but ne does not. Is i18n avaliable? I could
> translate english sentences to catalan and spanish if you want.


No, we are willingly keeping it simple...

Ciao,

seba


ToniBat

unread,
Jan 14, 2012, 4:20:52 PM1/14/12
to niceeditor
Is it possible to have abbreviations, in the style of vi or emacs ? I
just have browsed through the manual, I supposse it could be done with
macros, but maybe not as fast as an abbreviate utility does need.
It's the only thing I miss in ne...

Otherwise, from what I've seen, I'd call it 'ene' (extremely nice
editor). And it looks more stable than Joe. On par with Vi in this
regard.
Thanks.

Toni

Sebastiano Vigna

unread,
Jan 14, 2012, 6:04:10 PM1/14/12
to nicee...@googlegroups.com
On Jan 14, 2012, at 10:20 PM, ToniBat wrote:

> Is it possible to have abbreviations, in the style of vi or emacs ? I
> just have browsed through the manual, I supposse it could be done with
> macros, but maybe not as fast as an abbreviate utility does need.
> It's the only thing I miss in ne...


Have you tried completion? It's ESC-TAB. It uses the words currently existing in the document.

Ciao,

seba


ToniBat

unread,
Jan 15, 2012, 10:03:52 AM1/15/12
to niceeditor
Hi, thanks for your quick reply.
Yes, completion works well, but limited to one word only. If you are
introducing many times something like "London, May 4th, 2011. Mr and
Mrs Smith, Representatives at Court..." or anything like that that
includes several words, completion doesn't work. You wish you could
just enter 'MM' and get it done. What you can do in a need is just
write down 'MM', and later do a find-and-change post-processing.
But abbreviations are quite practical for some people. Maybe in a
later version. ;-))

Thanks again for your time and for this little excellent soft.

ToniBat

utoddl

unread,
Jan 16, 2012, 3:02:17 PM1/16/12
to nicee...@googlegroups.com
For something like you describe, macros are definitely the way to go. Start recording a macro (^T), type the text you want, stop recording (^T again), then save the macro to your ~/.ne directory as "mm"  ("^ksavemacro ~/.ne/mm"). Later when you want to insert that text again, invoke the macro via "^kmm".

Macros are just text files which happen to contain ne commands, so they are easy to edit. If you do edit one you've already invoked in this session, be sure to unload the cached macros with the UnloadMacros command; otherwise ne will continue to use its cached copy of the old version.

John Gabriele

unread,
Jan 16, 2012, 3:54:31 PM1/16/12
to nicee...@googlegroups.com
On Mon, Jan 16, 2012 at 3:02 PM, utoddl <todd_...@unc.edu> wrote:
> For something like you describe, macros are definitely the way to go. Start
> recording a macro (^T), type the text you want, stop recording (^T again),
> then save the macro to your ~/.ne directory as "mm"  ("^ksavemacro
> ~/.ne/mm"). Later when you want to insert that text again, invoke the macro
> via "^kmm".

I think there's some good reasons why real abbreviations would be
nicer than using macros:

For one, since the point is to save typing, it's nice to be able to
just type a few characters, hit a keyboard shortcut, and have ne
figure out what abbrev to use based on the characters immediately
behind the cursor. (Preferable to entering command mode, typing the
abbrev, and then hitting Return.) There's also something nice about
seeing the abbrev get expanded into its replacement text while you
type (and without having to take your eyes off the text you're
typing).

Another reason real abbrevs would be preferable to using macros is
that they could all be kept in their own ~/.ne/.abbreviations file --
such that, perhaps ne could have a feature to display all available
abbrevs (for times when you can't recall the exact one you're looking
for). This would also help keep your ~/.ne directory from filling up
with a bunch of tiny abbreviation macros.

---John

utoddl

unread,
Feb 15, 2012, 4:24:46 PM2/15/12
to nicee...@googlegroups.com
Toni,

I've been playing around with a macro that gives you the effect you've been looking for. It's a little involved, but you'll learn a lot about macros in ne, so stick with me. I'm calling this macro "ExpandAbbr", and it'll live as the file ~/.ne/ExpandAbbr. Also, I'm mapping it to the Alt-. key combination by adding the following line to my ~/.ne/.keys file:

KEY 1ae ExpandAbbr

Okay, here's the text of the macro ExpandAbbr:

UnloadMacros
Mark 1
PrevWord
PushPrefs
ClipNumber 9
Cut
SaveClip ~/.ne/abbr
PopPrefs
Through echo $(cat ~/.ne/abbr) > ~/.ne/abbrnl
abbrnl

Let's say you've just entered "mm" into your document, and you want it to expand to "Merry Mermaid". You'd need a macro called "mm" that contains the following text:

InsertString Merry Mermaid

Now, you're sitting just to the right of "mm", and hit "Atl-." This invokes the ExpandAbbr command, which loads the macro above. Let me step you through how that macro actually works. The "UnloadMacro" command ensures we forget whatever the "abbrnl" macro used to contain. "Mark 1" starts marking a block. "PrevWord" moves us to the beginning of "mm". "PushPrefs" saves (among other things) the current clip number (which probably isn't 9). "ClipNumber 9" sets or current clip number, so if you have something already in your default clip (probably clip 0) we don't mess that up. "Cut" removes the "mm" from our document and puts in clip 9, which "SaveClip ~/.ne/abbr" saves as a new macro. "PopPrefs" restores the default clip number.

We'd like to just invoke the new "abbr" macro at this point. Unfortunately, there's a flaw (which will be fixed in the next release) in which the last command of a macro that doesn't end with a new-line fails to work properly, and "abbr" contains just "mm" with no new-line. So we need to a version of "abbr" that has a new-line on the end, and the command "Through echo $(cat ~/.ne/abbr) > ~/.ne/abbrnl" does exactly that.

Finally, we execute the new macro "abbrnl", which contains the "mm" command we cut from the document plus the requisite new-line. That "mm" command invokes the "mm" macro, which can do whatever you can get macros to do; inserting text as shown above is easy enough.

Note that file names are case-sensitive, so it really matters whether you call your macro "mm" vs. "MM". Also, the key mapping to "ExpandAbbr" means you really have to name that macro to match. Cache macro names are not case-sensitive, but because we "UnloadMacros" at the top of "ExpandAbbr", that doesn't help in this case.

[BTW, be careful not to create any macros that try to invoke themselves, either directly or through another macro. Another flaw (again, to be fixed in the next release) causes ne to crash in that case as the macros attempt to nest infinitely.]

This should go a long way toward giving you "abbreviations" (there really should be a shorter word for that). Let us know how that works for you.
Cheers,


Reply all
Reply to author
Forward
0 new messages