ANNOUNCEMENT: Exciting news about our acquisition by VIM [PATCH]
Chris Allegretta <[email protected]> Mon, 1 Apr 2013 04:20:33 -0400
| Newsgroups | gmane.editors.nano.announce |
|---|---|
| Message-ID | <CAJqk+=MWGy4dcRkmmyWfwTX_XLL5pfm2zHZjah=KakCAR8Q94g__6139.96332181177$1364804547$gmane$org@mail.gmail.com> |
Hello, First, I want to give a hearty thank you to all our users and developers who have been using nano all this time. I wanted you let you know that I received word from the FSF legal offices that we have been acquired by VIM, hopefully putting to rest a lot of bad blood between the text editor factions. For those of you who have been keeping up with development, the key bindings code and vim-style locking were probably dead giveaways that this was going to happen soon, and congrats to everyone who figured this out before today. For those of you who have contributed to the code base, the details of this deal are as follows: - All right, likenesses and the nano domain become the property of the VIM Development Corporation LLC OMG WTF BBQ - Our recursive acronym Nano's Another Editor, is being changed to the classic vi tagline, "What Mode Am I In Again??" In exchange, the following compensation is being offered: - One thousand "vim rules" bumper stickers (FCFS on these!) - At least 150 coupons for a free KFC Double Down. Must give your name as "vim" when you order. No free refills. - We will be recognized on a special plaque, near home plate at a to-be-announced vim-owned sports stadium (once a few more tech companies go under or are bought by Google). - That happy feeling that we didn't end up owned by emacs The attached patch is a sneak peak at the transition plan we will be using in the development versions of nano. Please see the following timetable for transition: - Starting today with this patch, through versions 2.4.99pl47-omg[ac]1, nano will continue to default to what is effectively vim's Insert Mode. You can get into insert mode via Esc, or the usual method of pressing random keys until it works. - As of version 2.5.0, Command Mode will become the default, but we will retain backward compatibility with legacy nano commands - In version 2.7.0, we will all be dead by then so don't worry about it. Have you seen how long just point releases take me? :P Thank you again for using our editor, and I'm looking forward to seeing all those bumper stickers in the KFC parking lot. Eat up friends, we've all earned it! _______________________________________________ Info-nano mailing list [email protected] https://lists.gnu.org/mailman/listinfo/info-nano
vim.diff
(application/octet-stream, 12.2 KB)
Index: nano.h
===================================================================
--- nano.h (revision 4572)
+++ nano.h (working copy)
@@ -530,6 +530,7 @@
#define MWHEREISFILE (1<<11)
#define MGOTODIR (1<<12)
#define MYESNO (1<<13)
+#define MCOMMAND (1<<14)
/* This really isnt all but close enough */
#define MALL (MMAIN|MWHEREIS|MREPLACE|MREPLACE2|MGOTOLINE|MWRITEFILE|MINSERTFILE|MEXTCMD|MSPELL|MBROWSER|MWHEREISFILE|MGOTODIR|MHELP)
Index: global.c
===================================================================
--- global.c (revision 4572)
+++ global.c (working copy)
@@ -546,6 +546,8 @@
const char *insert_file_msg = N_("Insert File");
#endif
const char *go_to_line_msg = N_("Go To Line");
+ const char *command_mode_msg = N_("Command Mode");
+ const char *insert_mode_msg = N_("Insert Mode");
#ifndef DISABLE_JUSTIFY
const char *nano_justify_msg = N_("Justify the current paragraph");
@@ -693,6 +695,9 @@
const char *nano_backfile_msg = N_("Go to the previous file in the list");
const char *nano_gotodir_msg = N_("Go to directory");
#endif
+ const char *nano_insert_mode_msg = N_("Switch to Insert Mode");
+ const char *nano_command_mode_msg = N_("Switch to Command Mode");
+ const char *nano_last_line_mode_msg = N_("Switch to Last Line Mode");
#endif /* !DISABLE_HELP */
#ifndef DISABLE_HELP
@@ -708,14 +713,14 @@
}
add_to_funcs(do_help_void,
- (MMAIN|MWHEREIS|MREPLACE|MREPLACE2|MGOTOLINE|MWRITEFILE|MINSERTFILE|MEXTCMD|MSPELL|MBROWSER|MWHEREISFILE|MGOTODIR),
+ (MMAIN|MWHEREIS|MREPLACE|MREPLACE2|MGOTOLINE|MWRITEFILE|MINSERTFILE|MEXTCMD|MSPELL|MBROWSER|MWHEREISFILE|MGOTODIR|MCOMMAND),
get_help_msg, IFSCHELP(nano_help_msg), FALSE, VIEW);
add_to_funcs( do_cancel,
(MWHEREIS|MREPLACE|MREPLACE2|MGOTOLINE|MWRITEFILE|MINSERTFILE|MEXTCMD|MSPELL|MWHEREISFILE|MGOTODIR|MYESNO),
cancel_msg, IFSCHELP(nano_cancel_msg), FALSE, VIEW);
- add_to_funcs(do_exit, MMAIN,
+ add_to_funcs(do_exit, (MMAIN|MCOMMAND),
#ifdef ENABLE_MULTIBUFFER
/* TRANSLATORS: Try to keep this at most 10 characters. */
openfile != NULL && openfile != openfile->next ? N_("Close") :
@@ -727,12 +732,12 @@
#endif
/* TRANSLATORS: Try to keep this at most 10 characters. */
- add_to_funcs(do_writeout_void, MMAIN, N_("WriteOut"),
+ add_to_funcs(do_writeout_void, (MMAIN|MCOMMAND), N_("WriteOut"),
IFSCHELP(nano_writeout_msg), FALSE, NOVIEW);
#ifndef DISABLE_JUSTIFY
/* TRANSLATORS: Try to keep this at most 10 characters. */
- add_to_funcs(do_justify_void, MMAIN, N_("Justify"),
+ add_to_funcs(do_justify_void, (MMAIN|MCOMMAND), N_("Justify"),
nano_justify_msg, TRUE, NOVIEW);
#endif
@@ -751,7 +756,7 @@
NOVIEW);
#endif
- add_to_funcs(do_search, MMAIN|MBROWSER, whereis_msg,
+ add_to_funcs(do_search, MMAIN|MBROWSER|MCOMMAND, whereis_msg,
IFSCHELP(nano_whereis_msg), FALSE, VIEW);
add_to_funcs(do_page_up, MMAIN|MHELP|MBROWSER,
@@ -761,7 +766,7 @@
/* TRANSLATORS: Try to keep this at most 10 characters. */
- add_to_funcs(do_cut_text_void, MMAIN, N_("Cut Text"), IFSCHELP(nano_cut_msg),
+ add_to_funcs(do_cut_text_void, (MMAIN|MCOMMAND), N_("Cut Text"), IFSCHELP(nano_cut_msg),
FALSE, NOVIEW);
if (unjustify)
@@ -771,12 +776,12 @@
else
/* TRANSLATORS: Try to keep this at most 10 characters. */
- add_to_funcs(do_uncut_text, MMAIN, N_("UnCut Text"), IFSCHELP(nano_uncut_msg),
+ add_to_funcs(do_uncut_text, (MMAIN|MCOMMAND), N_("UnCut Text"), IFSCHELP(nano_uncut_msg),
FALSE, NOVIEW);
#ifndef NANO_TINY
/* TRANSLATORS: Try to keep this at most 10 characters. */
- add_to_funcs(do_cursorpos_void, MMAIN, N_("Cur Pos"), IFSCHELP(nano_cursorpos_msg),
+ add_to_funcs(do_cursorpos_void, (MMAIN|MCOMMAND), N_("Cur Pos"), IFSCHELP(nano_cursorpos_msg),
FALSE, VIEW);
#endif
@@ -785,7 +790,7 @@
* on the command line. */
#ifndef DISABLE_SPELLER
/* TRANSLATORS: Try to keep this at most 10 characters. */
- add_to_funcs(do_spell, MMAIN, N_("To Spell"), IFSCHELP(nano_spell_msg),
+ add_to_funcs(do_spell, (MMAIN|MCOMMAND), N_("To Spell"), IFSCHELP(nano_spell_msg),
TRUE, NOVIEW);
#endif
@@ -797,13 +802,12 @@
(MMAIN|MWHEREIS|MREPLACE|MREPLACE2|MGOTOLINE),
last_line_msg, IFSCHELP(nano_lastline_msg), TRUE, VIEW);
-
add_to_funcs(do_gotolinecolumn_void, (MMAIN|MWHEREIS),
go_to_line_msg, IFSCHELP(nano_gotoline_msg), FALSE, VIEW);
#ifdef NANO_TINY
/* TRANSLATORS: Try to keep this at most 10 characters. */
- add_to_funcs(do_cursorpos_void, MMAIN, N_("Cur Pos"), IFSCHELP(nano_cursorpos_msg),
+ add_to_funcs(do_cursorpos_void, (MMAIN|MCOMMAND), N_("Cur Pos"), IFSCHELP(nano_cursorpos_msg),
FALSE, VIEW);
#endif
@@ -844,7 +848,7 @@
#endif
- add_to_funcs(do_right, MMAIN, N_("Forward"), IFSCHELP(nano_forward_msg),
+ add_to_funcs(do_right, (MMAIN|MCOMMAND), N_("Forward"), IFSCHELP(nano_forward_msg),
FALSE, VIEW);
#ifndef DISABLE_BROWSER
@@ -854,7 +858,7 @@
add_to_funcs(do_right, MALL, "", "", FALSE, VIEW);
- add_to_funcs(do_left, MMAIN, N_("Back"), IFSCHELP(nano_back_msg),
+ add_to_funcs(do_left, (MMAIN|MCOMMAND), N_("Back"), IFSCHELP(nano_back_msg),
FALSE, VIEW);
#ifndef DISABLE_BROWSER
@@ -878,10 +882,10 @@
add_to_funcs(do_down_void, (MMAIN|MHELP|MBROWSER), N_("Next Line"),
IFSCHELP(nano_nextline_msg), TRUE, VIEW);
- add_to_funcs(do_home, MMAIN, N_("Home"), IFSCHELP(nano_home_msg),
+ add_to_funcs(do_home, (MMAIN|MCOMMAND), N_("Home"), IFSCHELP(nano_home_msg),
FALSE, VIEW);
- add_to_funcs(do_end, MMAIN, N_("End"), IFSCHELP(nano_end_msg),
+ add_to_funcs(do_end, (MMAIN|MCOMMAND), N_("End"), IFSCHELP(nano_end_msg),
FALSE, VIEW);
#ifndef DISABLE_JUSTIFY
@@ -1078,6 +1082,13 @@
goto_dir_msg, IFSCHELP(nano_gotodir_msg), FALSE, VIEW);
#endif
+ add_to_funcs(do_command_mode, MMAIN, insert_mode_msg,
+ IFSCHELP(nano_command_mode_msg), FALSE, VIEW);
+
+ add_to_funcs(do_insert_mode, MCOMMAND, insert_mode_msg,
+ IFSCHELP(nano_insert_mode_msg), FALSE, VIEW);
+
+
currmenu = MMAIN;
add_to_sclist(MMAIN|MWHEREIS|MREPLACE|MREPLACE2|MGOTOLINE|MWRITEFILE|MINSERTFILE|MEXTCMD|MSPELL|MBROWSER|MWHEREISFILE|MGOTODIR,
@@ -1085,36 +1096,46 @@
add_to_sclist(MMAIN|MWHEREIS|MREPLACE|MREPLACE2|MGOTOLINE|MWRITEFILE|MINSERTFILE|MEXTCMD|MSPELL|MBROWSER|MWHEREISFILE|MGOTODIR,
"F1", do_help_void, 0, TRUE);
add_to_sclist(MMAIN|MHELP|MBROWSER, "^X", do_exit, 0, TRUE);
+ add_to_sclist(MCOMMAND, ":q", do_exit, 0, TRUE);
add_to_sclist(MMAIN|MHELP|MBROWSER, "F2", do_exit, 0, TRUE);
add_to_sclist(MMAIN, "^_", do_gotolinecolumn_void, 0, TRUE);
add_to_sclist(MMAIN, "F13", do_gotolinecolumn_void, 0, TRUE);
add_to_sclist(MMAIN, "M-G", do_gotolinecolumn_void, 0, TRUE);
add_to_sclist(MMAIN, "^O", do_writeout_void, 0, TRUE);
add_to_sclist(MMAIN, "F3", do_writeout_void, 0, TRUE);
+ add_to_sclist(MCOMMAND, ":w", do_writeout_void, 0, TRUE);
#ifndef DISABLE_JUSTIFY
add_to_sclist(MMAIN, "^J", do_justify_void, 0, TRUE);
add_to_sclist(MMAIN, "F4", do_justify_void, 0, TRUE);
#endif
add_to_sclist(MMAIN, "^R", do_insertfile_void, 0, TRUE);
add_to_sclist(MMAIN, "F5", do_insertfile_void, 0, TRUE);
+ add_to_sclist(MCOMMAND, ":r", do_insertfile_void, 0, TRUE);
add_to_sclist(MMAIN, "kinsert", do_insertfile_void, 0, TRUE);
add_to_sclist(MMAIN|MBROWSER, "^W", do_search, 0, TRUE);
+ add_to_sclist(MCOMMAND, "/", do_search, 0, TRUE);
add_to_sclist(MMAIN|MBROWSER, "F6", do_search, 0, TRUE);
add_to_sclist(MMAIN|MBROWSER|MHELP|MWHEREISFILE, "^Y", do_page_up, 0, TRUE);
add_to_sclist(MMAIN|MBROWSER|MHELP|MWHEREISFILE, "F7", do_page_up, 0, TRUE);
add_to_sclist(MMAIN|MBROWSER|MHELP|MWHEREISFILE, "kpup", do_page_up, 0, TRUE);
+ add_to_sclist(MCOMMAND, "^B", do_page_up, 0, TRUE);
add_to_sclist(MMAIN|MBROWSER|MHELP|MWHEREISFILE, "^V", do_page_down, 0, TRUE);
add_to_sclist(MMAIN|MBROWSER|MHELP|MWHEREISFILE, "F8", do_page_down, 0, TRUE);
add_to_sclist(MMAIN|MBROWSER|MHELP|MWHEREISFILE, "kpdown", do_page_down, 0, TRUE);
+ add_to_sclist(MCOMMAND, "^F", do_page_down, 0, TRUE);
add_to_sclist(MMAIN, "^K", do_cut_text_void, 0, TRUE);
+ add_to_sclist(MCOMMAND, "d", do_cut_text_void, 0, TRUE);
add_to_sclist(MMAIN, "F9", do_cut_text_void, 0, TRUE);
add_to_sclist(MMAIN, "^U", do_uncut_text, 0, TRUE);
+ add_to_sclist(MCOMMAND, "p", do_uncut_text, 0, TRUE);
add_to_sclist(MMAIN, "F10", do_uncut_text, 0, TRUE);
add_to_sclist(MMAIN, "^C", do_cursorpos_void, 0, TRUE);
add_to_sclist(MMAIN, "F11", do_cursorpos_void, 0, TRUE);
+ add_to_sclist(MCOMMAND, "^G", do_cursorpos_void, 0, TRUE);
#ifndef DISABLE_SPELLER
add_to_sclist(MMAIN, "^T", do_spell, 0, TRUE);
add_to_sclist(MMAIN, "F12", do_spell, 0, TRUE);
+ add_to_sclist(MMAIN, "WTF?", do_spell, 0, TRUE);
#endif
add_to_sclist(MMAIN, "^\\", do_replace, 0, TRUE);
add_to_sclist(MMAIN, "F14", do_replace, 0, TRUE);
@@ -1143,12 +1164,18 @@
#endif
add_to_sclist(MALL, "kright", do_right, 0, TRUE);
add_to_sclist(MALL, "kleft", do_left, 0, TRUE);
+ add_to_sclist(MCOMMAND, "l", do_right, 0, TRUE);
+ add_to_sclist(MCOMMAND, "h", do_left, 0, TRUE);
add_to_sclist(MMAIN, "^Q", xon_complaint, 0, TRUE);
add_to_sclist(MMAIN, "^S", xoff_complaint, 0, TRUE);
add_to_sclist(MMAIN|MHELP|MBROWSER, "^P", do_up_void, 0, TRUE);
add_to_sclist(MMAIN|MHELP|MBROWSER, "kup", do_up_void, 0, TRUE);
add_to_sclist(MMAIN|MHELP|MBROWSER, "^N", do_down_void, 0, TRUE);
add_to_sclist(MMAIN|MHELP|MBROWSER, "kdown", do_down_void, 0, TRUE);
+ add_to_sclist(MCOMMAND, "j", do_down_void, 0, TRUE);
+ add_to_sclist(MCOMMAND, "k", do_up_void, 0, TRUE);
+ add_to_sclist(MCOMMAND, "^", do_home, 0, TRUE);
+ add_to_sclist(MCOMMAND, "$", do_end, 0, TRUE);
add_to_sclist(MALL, "^A", do_home, 0, TRUE);
add_to_sclist(MALL, "khome", do_home, 0, TRUE);
add_to_sclist(MALL, "^E", do_end, 0, TRUE);
@@ -1253,6 +1280,11 @@
add_to_sclist(MINSERTFILE, "^X", ext_cmd_void, 0, FALSE);
add_to_sclist(MMAIN, "^Z", do_suspend_void, 0, FALSE);
add_to_sclist(MMAIN, "^L", total_refresh, 0, TRUE);
+ add_to_sclist(MCOMMAND, "i", do_insert_mode, 0, TRUE);
+ add_to_sclist(MCOMMAND, "a", do_insert_mode, 0, TRUE);
+ add_to_sclist(MMAIN, "M-Q", do_command_mode, 0, TRUE);
+ add_to_sclist(MCOMMAND, "h", do_left, 0, TRUE);
+
add_to_sclist(MALL, "^I", do_tab, 0, TRUE);
add_to_sclist(MALL, "^M", do_enter_void, 0, TRUE);
add_to_sclist(MALL, "kenter", do_enter_void, 0, TRUE);
Index: proto.h
===================================================================
--- proto.h (revision 4572)
+++ proto.h (working copy)
@@ -863,6 +863,8 @@
void goto_dir_void(void);
void no_replace_void(void);
void ext_cmd_void(void);
+void do_insert_mode(void);
+void do_command_mode(void);
#endif /* !PROTO_H */
Index: winio.c
===================================================================
--- winio.c (revision 4572)
+++ winio.c (working copy)
@@ -349,7 +349,9 @@
escapes++;
switch (escapes) {
case 1:
- /* One escape: wait for more input. */
+ /* One escape: Go to command mode */
+ do_command_mode();
+ break;
case 2:
/* Two escapes: wait for more input. */
case 3:
Index: nano.c
===================================================================
--- nano.c (revision 4572)
+++ nano.c (working copy)
@@ -1352,6 +1352,21 @@
}
#endif /* !NANO_TINY */
+void do_command_mode(void)
+{
+ currmenu = MCOMMAND;
+ bottombars(currmenu);
+ return;
+}
+
+void do_insert_mode(void)
+{
+ currmenu = MMAIN;
+ bottombars(currmenu);
+ return;
+}
+
+
#ifndef NANO_TINY
/* Handle the global toggle specified in which. */
void do_toggle(int flag)
@@ -1562,7 +1577,7 @@
#endif
/* Check for a shortcut in the main list. */
- s = get_shortcut(MMAIN, &input, meta_key, func_key);
+ s = get_shortcut(currmenu, &input, meta_key, func_key);
/* If we got a shortcut from the main list, or a "universal"
* edit window shortcut, set have_shortcut to TRUE. */
@@ -2735,7 +2750,8 @@
if (ISSET(CONST_UPDATE) && get_key_buffer_len() == 0)
do_cursorpos(TRUE);
- currmenu = MMAIN;
+ if (currmenu != MCOMMAND)
+ currmenu = MMAIN;
/* Read in and interpret characters. */
do_input(&meta_key, &func_key, &s_or_t, &ran_func, &finished,