Add shortcut ^G to quit and cd

This commit is contained in:
Arun Prakash Jana 2018-02-24 21:43:41 +05:30
parent bd1d9e3b6d
commit 11dac5e3db
No known key found for this signature in database
GPG key ID: A75979F35C080412
5 changed files with 9 additions and 4 deletions

View file

@ -13,6 +13,7 @@ What's in?
- <kbd>^J</kbd> - toggle du mode - <kbd>^J</kbd> - toggle du mode
- <kbd>R</kbd> - batch rename files in vidir - <kbd>R</kbd> - batch rename files in vidir
- <kbd>^F</kbd> - extract archive (replaces <kbd>^X</kbd>) - <kbd>^F</kbd> - extract archive (replaces <kbd>^X</kbd>)
- <kbd>^G</kbd> - quit nnn and change dir
- <kbd>^X</kbd> - quit nnn (replaces <kbd>^Q</kbd>) - <kbd>^X</kbd> - quit nnn (replaces <kbd>^Q</kbd>)
- Extra shortcuts enabled in nav-as-you-type mode: - Extra shortcuts enabled in nav-as-you-type mode:
- <kbd>^K</kbd>, <kbd>^Y</kbd> (file path copy) - <kbd>^K</kbd>, <kbd>^Y</kbd> (file path copy)
@ -25,6 +26,7 @@ What's in?
- <kbd>^/</kbd> (open desktop opener) - <kbd>^/</kbd> (open desktop opener)
- <kbd>^F</kbd> (extract archive) - <kbd>^F</kbd> (extract archive)
- <kbd>^L</kbd> (refresh) - <kbd>^L</kbd> (refresh)
- <kbd>^G</kbd> (quit nnn and change dir)
- <kbd>^X</kbd> (quit nnn) - <kbd>^X</kbd> (quit nnn)
------------------------------------------------------------------------------- -------------------------------------------------------------------------------

View file

@ -119,7 +119,6 @@ Have fun with it! PRs are welcome. Check out [#1](https://github.com/jarun/nnn/i
- Terminal screensaver (default vlock, customizable) integration - Terminal screensaver (default vlock, customizable) integration
- Unicode support - Unicode support
- Highly optimized code, minimal resource usage - Highly optimized code, minimal resource usage
- Minimal dependencies
### Performance ### Performance
@ -254,7 +253,7 @@ optional arguments:
^T | Toggle path quote ^T | Toggle path quote
^L | Redraw, clear prompt ^L | Redraw, clear prompt
? | Help, settings ? | Help, settings
Q | Quit and cd Q, ^G | Quit and cd
q, ^X | Quit q, ^X | Quit
``` ```
@ -331,6 +330,8 @@ Add the following to your shell's rc file for the best experience:
5. Set `NNN_NOWAIT`, if nnn [blocks on your desktop environment](#nnn-blocks-on-opening-files) when a file is open. 5. Set `NNN_NOWAIT`, if nnn [blocks on your desktop environment](#nnn-blocks-on-opening-files) when a file is open.
6. Press <kbd>?</kbd> for help on keyboard shortcuts anytime.
### How to ### How to
#### add bookmarks #### add bookmarks

2
nnn.1
View file

@ -112,7 +112,7 @@ Toggle path quote
Force a redraw, clear rename or filter prompt Force a redraw, clear rename or filter prompt
.It Ic \&? .It Ic \&?
Toggle help and settings screen Toggle help and settings screen
.It Ic Q .It Ic Q, ^G
Quit and change directory Quit and change directory
.It Ic q, ^X .It Ic q, ^X
Quit Quit

3
nnn.c
View file

@ -1141,6 +1141,7 @@ filterentries(char *path)
case CONTROL('B'): // fallthrough case CONTROL('B'): // fallthrough
case CONTROL('V'): // fallthrough case CONTROL('V'): // fallthrough
case CONTROL('J'): // fallthrough case CONTROL('J'): // fallthrough
case CONTROL('G'): // fallthrough
case CONTROL('X'): // fallthrough case CONTROL('X'): // fallthrough
case CONTROL('F'): // fallthrough case CONTROL('F'): // fallthrough
case CONTROL('T'): case CONTROL('T'):
@ -1891,7 +1892,7 @@ show_help(char *path)
"d^T | Toggle path quote\n" "d^T | Toggle path quote\n"
"d^L | Redraw, clear prompt\n" "d^L | Redraw, clear prompt\n"
"e? | Help, settings\n" "e? | Help, settings\n"
"eQ | Quit and cd\n" "aQ, ^G | Quit and cd\n"
"aq, ^X | Quit\n\n"); "aq, ^X | Quit\n\n");
if (fd == -1) if (fd == -1)

1
nnn.h
View file

@ -170,6 +170,7 @@ static struct key bindings[] = {
{ 'p', SEL_RUNARG, "less", "PAGER" }, { 'p', SEL_RUNARG, "less", "PAGER" },
/* Change dir on quit */ /* Change dir on quit */
{ 'Q', SEL_CDQUIT, "", "" }, { 'Q', SEL_CDQUIT, "", "" },
{ CONTROL('G'), SEL_CDQUIT, "", "" },
/* Quit */ /* Quit */
{ 'q', SEL_QUIT, "", "" }, { 'q', SEL_QUIT, "", "" },
{ CONTROL('X'), SEL_QUIT, "", "" }, { CONTROL('X'), SEL_QUIT, "", "" },