Remove sh as script opener, use vi

This commit is contained in:
Arun Prakash Jana 2017-03-31 23:35:48 +05:30
parent aeeeed0bce
commit 584a5f90f3
No known key found for this signature in database
GPG key ID: A75979F35C080412
4 changed files with 27 additions and 28 deletions

View file

@ -23,7 +23,7 @@ nnn.o: util.h config.h
strlcat.o: util.h strlcat.o: util.h
strlcpy.o: util.h strlcpy.o: util.h
config.h: config.h: config.def.h
cp config.def.h $@ cp config.def.h $@
install: all install: all

View file

@ -39,7 +39,7 @@ I chose to fork because:
- Filter contents in current directory - Filter contents in current directory
- Show/hide hidden files - Show/hide hidden files
- Sort entries by modification time (newest to oldest) - Sort entries by modification time (newest to oldest)
- Spawn a shell in current directory - Spawn a `SHELL` in current directory (fallback sh)
- Run `top` - Run `top`
- Edit a file with `EDITOR` (fallback vi) - Edit a file with `EDITOR` (fallback vi)
- Page through a file in `PAGER` (fallback less) - Page through a file in `PAGER` (fallback less)
@ -114,7 +114,7 @@ Start nnn (default: current directory):
| `.` | toggle hide dot files | | `.` | toggle hide dot files |
| `s` | toggle sort by file size | | `s` | toggle sort by file size |
| `t` | toggle sort by modified time | | `t` | toggle sort by modified time |
| `!` | spawn a shell in current dir | | `!` | spawn `SHELL` in `PWD` (fallback sh) |
| `z` | run `top` | | `z` | run `top` |
| `e` | edit entry in `EDITOR` (fallback vi) | | `e` | edit entry in `EDITOR` (fallback vi) |
| `p` | open entry with `PAGER` (fallback less) | | `p` | open entry with `PAGER` (fallback less) |

View file

@ -12,12 +12,12 @@ char *idlecmd = "rain"; /* The screensaver program */
struct assoc assocs[] = { struct assoc assocs[] = {
//{ "\\.(avi|mp4|mkv|mp3|ogg|flac|mov)$", "mpv" }, //{ "\\.(avi|mp4|mkv|mp3|ogg|flac|mov)$", "mpv" },
{ "\\.(c|cpp|h|txt|log)$", "vi" }, { "\\.(c|cpp|h|txt|log|sh)$", "vi" },
{ "\\.(wma|mp3|ogg|flac)$", "fmedia" }, { "\\.(wma|mp3|ogg|flac)$", "fmedia" },
//{ "\\.(png|jpg|gif)$", "feh" }, //{ "\\.(png|jpg|gif)$", "feh" },
//{ "\\.(html|svg)$", "firefox" }, //{ "\\.(html|svg)$", "firefox" },
{ "\\.pdf$", "zathura" }, { "\\.pdf$", "zathura" },
{ "\\.sh$", "sh" }, //{ "\\.sh$", "sh" },
//{ ".", "less" }, //{ ".", "less" },
}; };

45
nnn.1
View file

@ -22,49 +22,49 @@ configuration. The default key bindings are listed below.
.Pp .Pp
.Bl -tag -width "l, [Right], [Return] or C-mXXXX" -offset indent -compact .Bl -tag -width "l, [Right], [Return] or C-mXXXX" -offset indent -compact
.It Ic k, [Up] or C-p .It Ic k, [Up] or C-p
Move to previous entry. Move to previous entry
.It Ic j, [Down] or C-n .It Ic j, [Down] or C-n
Move to next entry. Move to next entry
.It Ic [Pgup] or C-u .It Ic [Pgup] or C-u
Scroll up half a page. Scroll up half a page
.It Ic [Pgdown] or C-d .It Ic [Pgdown] or C-d
Scroll down half a page. Scroll down half a page
.It Ic [Home], ^ or C-a .It Ic [Home], ^ or C-a
Move to the first entry. Move to the first entry
.It Ic [End], $ or C-e .It Ic [End], $ or C-e
Move to the last entry. Move to the last entry
.It Ic l, [Right], [Return] or C-m .It Ic l, [Right], [Return] or C-m
Open file or enter directory. Open file or enter directory
.It Ic h, C-h, [Left] or [Backspace] .It Ic h, C-h, [Left] or [Backspace]
Back up one directory level. Back up one directory level
.It Ic ~ .It Ic ~
Change to the HOME directory. Change to the HOME directory
.It Ic / or & .It Ic / or &
Change filter (see below for more information). Change filter (more information below)
.It Ic c .It Ic c
Change into the given directory. Change into the given directory
.It Ic d .It Ic d
Toggle detail view. Toggle detail view
.It Ic \&. .It Ic \&.
Toggle hide .dot files. Toggle hide .dot files
.It Ic s .It Ic s
Toggle sort by file size. Toggle sort by file size
.It Ic t .It Ic t
Toggle sort by time modified. Toggle sort by time modified
.It Ic \&! .It Ic \&!
Spawn a shell in current directory. Spawn SHELL in PWD (fallback sh)
.It Ic z .It Ic z
Run the system top utility. Run the system top utility.
.It Ic e .It Ic e
Open selected entry with EDITOR (fallback vi). Open current entry in EDITOR (fallback vi)
.It Ic p .It Ic p
Open selected entry with PAGER (fallback less). Open current entry in PAGER (fallback less)
.It Ic C-k .It Ic C-k
Invoke file name copier. Invoke file name copier
.It Ic C-l .It Ic C-l
Force a redraw. Force a redraw
.It Ic q .It Ic q
Quit. Quit
.El .El
.Pp .Pp
Backing up one directory level will set the cursor position at the Backing up one directory level will set the cursor position at the
@ -127,10 +127,9 @@ variable NNN_OPENER is not set:
.Bd -literal .Bd -literal
----------------------------------------------- -----------------------------------------------
struct assoc assocs[] = { struct assoc assocs[] = {
{ "\\.(c|cpp|h|txt|log)$", "vi" }, { "\\.(c|cpp|h|txt|log|sh)$", "vi" },
{ "\\.(wma|mp3|ogg|flac)$", "fmedia" }, { "\\.(wma|mp3|ogg|flac)$", "fmedia" },
{ "\\.pdf$", "zathura" }, { "\\.pdf$", "zathura" },
{ "\\.sh$", "sh" },
}; };
----------------------------------------------- -----------------------------------------------
Plain text files are opened with vi. Plain text files are opened with vi.