mirror of
git://git.sv.gnu.org/nano.git
synced 2024-11-26 06:39:43 +03:00
bindings: make ^Q and ^S do something useful by default
^S will be the first thing people will try for saving a file, and ^Q is somewhat mnemonic because it is to the left of ^W: it searches backward. Make these keystrokes available also in the tiny version.
This commit is contained in:
parent
c7eecd74de
commit
ba65cd48cc
@ -269,9 +269,8 @@
|
|||||||
## Key bindings.
|
## Key bindings.
|
||||||
## See nanorc(5) (section REBINDING KEYS) for more details on this.
|
## See nanorc(5) (section REBINDING KEYS) for more details on this.
|
||||||
##
|
##
|
||||||
## The following three functions are not bound to any key by default.
|
## The following two functions are not bound to any key by default.
|
||||||
## You may wish to choose different keys than the ones suggested here.
|
## You may wish to choose other keys than the ones suggested here.
|
||||||
# bind ^S savefile main
|
|
||||||
# bind M-B cutwordleft main
|
# bind M-B cutwordleft main
|
||||||
# bind M-N cutwordright main
|
# bind M-N cutwordright main
|
||||||
|
|
||||||
|
@ -2272,14 +2272,12 @@ void do_writeout_void(void)
|
|||||||
close_and_go();
|
close_and_go();
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef NANO_TINY
|
|
||||||
/* If it has a name, write the current file to disk without prompting. */
|
/* If it has a name, write the current file to disk without prompting. */
|
||||||
void do_savefile(void)
|
void do_savefile(void)
|
||||||
{
|
{
|
||||||
if (do_writeout(FALSE, FALSE) == 2)
|
if (do_writeout(FALSE, FALSE) == 2)
|
||||||
close_and_go();
|
close_and_go();
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Return a malloc()ed string containing the actual directory, used to
|
/* Return a malloc()ed string containing the actual directory, used to
|
||||||
* convert ~user/ and ~/ notation. */
|
* convert ~user/ and ~/ notation. */
|
||||||
|
@ -1079,11 +1079,13 @@ void shortcut_init(void)
|
|||||||
add_to_sclist(MMOST & ~MFINDINHELP, "F1", 0, do_help_void, 0);
|
add_to_sclist(MMOST & ~MFINDINHELP, "F1", 0, do_help_void, 0);
|
||||||
add_to_sclist(MMAIN|MHELP|MBROWSER, "^X", 0, do_exit, 0);
|
add_to_sclist(MMAIN|MHELP|MBROWSER, "^X", 0, do_exit, 0);
|
||||||
add_to_sclist(MMAIN|MHELP|MBROWSER, "F2", 0, do_exit, 0);
|
add_to_sclist(MMAIN|MHELP|MBROWSER, "F2", 0, do_exit, 0);
|
||||||
|
add_to_sclist(MMAIN, "^S", 0, do_savefile, 0);
|
||||||
add_to_sclist(MMAIN, "^O", 0, do_writeout_void, 0);
|
add_to_sclist(MMAIN, "^O", 0, do_writeout_void, 0);
|
||||||
add_to_sclist(MMAIN, "F3", 0, do_writeout_void, 0);
|
add_to_sclist(MMAIN, "F3", 0, do_writeout_void, 0);
|
||||||
add_to_sclist(MMAIN, "^R", 0, do_insertfile_void, 0);
|
add_to_sclist(MMAIN, "^R", 0, do_insertfile_void, 0);
|
||||||
add_to_sclist(MMAIN, "F5", 0, do_insertfile_void, 0);
|
add_to_sclist(MMAIN, "F5", 0, do_insertfile_void, 0);
|
||||||
add_to_sclist(MMAIN, "Ins", 0, do_insertfile_void, 0);
|
add_to_sclist(MMAIN, "Ins", 0, do_insertfile_void, 0);
|
||||||
|
add_to_sclist(MMAIN, "^Q", 0, do_search_backward, 0);
|
||||||
add_to_sclist(MMAIN|MHELP|MBROWSER, "^W", 0, do_search, 0);
|
add_to_sclist(MMAIN|MHELP|MBROWSER, "^W", 0, do_search, 0);
|
||||||
add_to_sclist(MMAIN|MHELP|MBROWSER, "F6", 0, do_search, 0);
|
add_to_sclist(MMAIN|MHELP|MBROWSER, "F6", 0, do_search, 0);
|
||||||
add_to_sclist(MMAIN, "^\\", 0, do_replace, 0);
|
add_to_sclist(MMAIN, "^\\", 0, do_replace, 0);
|
||||||
@ -1258,9 +1260,6 @@ void shortcut_init(void)
|
|||||||
add_to_sclist(MMAIN, "M-Z", 0, do_toggle_void, SUSPEND);
|
add_to_sclist(MMAIN, "M-Z", 0, do_toggle_void, SUSPEND);
|
||||||
#endif /* !NANO_TINY */
|
#endif /* !NANO_TINY */
|
||||||
|
|
||||||
add_to_sclist(MMAIN, "^Q", 0, xon_complaint, 0);
|
|
||||||
add_to_sclist(MMAIN, "^S", 0, xoff_complaint, 0);
|
|
||||||
|
|
||||||
add_to_sclist(((MMOST & ~MMAIN & ~MBROWSER) | MYESNO), "^C", 0, do_cancel, 0);
|
add_to_sclist(((MMOST & ~MMAIN & ~MBROWSER) | MYESNO), "^C", 0, do_cancel, 0);
|
||||||
|
|
||||||
add_to_sclist(MWHEREIS|MREPLACE, "M-C", 0, case_sens_void, 0);
|
add_to_sclist(MWHEREIS|MREPLACE, "M-C", 0, case_sens_void, 0);
|
||||||
|
11
src/nano.c
11
src/nano.c
@ -1731,17 +1731,6 @@ int do_input(bool allow_funcs)
|
|||||||
return input;
|
return input;
|
||||||
}
|
}
|
||||||
|
|
||||||
void xon_complaint(void)
|
|
||||||
{
|
|
||||||
statusbar(_("XON ignored, mumble mumble"));
|
|
||||||
}
|
|
||||||
|
|
||||||
void xoff_complaint(void)
|
|
||||||
{
|
|
||||||
statusbar(_("XOFF ignored, mumble mumble"));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef ENABLE_MOUSE
|
#ifdef ENABLE_MOUSE
|
||||||
/* Handle a mouse click on the edit window or the shortcut list. */
|
/* Handle a mouse click on the edit window or the shortcut list. */
|
||||||
int do_mouse(void)
|
int do_mouse(void)
|
||||||
|
@ -309,9 +309,7 @@ bool write_marked_file(const char *name, FILE *f_open, bool tmp,
|
|||||||
#endif
|
#endif
|
||||||
int do_writeout(bool exiting, bool withprompt);
|
int do_writeout(bool exiting, bool withprompt);
|
||||||
void do_writeout_void(void);
|
void do_writeout_void(void);
|
||||||
#ifndef NANO_TINY
|
|
||||||
void do_savefile(void);
|
void do_savefile(void);
|
||||||
#endif
|
|
||||||
char *real_dir_from_tilde(const char *buf);
|
char *real_dir_from_tilde(const char *buf);
|
||||||
#if defined(ENABLE_TABCOMP) || defined(ENABLE_BROWSER)
|
#if defined(ENABLE_TABCOMP) || defined(ENABLE_BROWSER)
|
||||||
int diralphasort(const void *va, const void *vb);
|
int diralphasort(const void *va, const void *vb);
|
||||||
@ -691,8 +689,6 @@ void spotlight(bool active, size_t from_col, size_t to_col);
|
|||||||
#ifndef NANO_TINY
|
#ifndef NANO_TINY
|
||||||
void spotlight_softwrapped(bool active, size_t from_col, size_t to_col);
|
void spotlight_softwrapped(bool active, size_t from_col, size_t to_col);
|
||||||
#endif
|
#endif
|
||||||
void xon_complaint(void);
|
|
||||||
void xoff_complaint(void);
|
|
||||||
void do_suspend_void(void);
|
void do_suspend_void(void);
|
||||||
void disable_waiting(void);
|
void disable_waiting(void);
|
||||||
void enable_waiting(void);
|
void enable_waiting(void);
|
||||||
|
Loading…
Reference in New Issue
Block a user