mirror of
https://github.com/jarun/nnn.git
synced 2024-11-24 20:01:27 +00:00
Change vim to vi
This commit is contained in:
parent
8563ec5cb2
commit
aeeeed0bce
11
README.md
11
README.md
|
@ -41,7 +41,8 @@ I chose to fork because:
|
||||||
- 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
|
||||||
- Run `top`
|
- Run `top`
|
||||||
- Open a file with `vim` or `less`
|
- Edit a file with `EDITOR` (fallback vi)
|
||||||
|
- Page through a file in `PAGER` (fallback less)
|
||||||
|
|
||||||
### nnn toppings
|
### nnn toppings
|
||||||
|
|
||||||
|
@ -65,7 +66,7 @@ I chose to fork because:
|
||||||
export NNN_OPENER=gnome-open
|
export NNN_OPENER=gnome-open
|
||||||
export NNN_OPENER=gvfs-open
|
export NNN_OPENER=gvfs-open
|
||||||
- Selective file associations (ignored if `NNN_OPENER` is set):
|
- Selective file associations (ignored if `NNN_OPENER` is set):
|
||||||
- Associate plain text files with vim (using `file` command)
|
- Associate plain text files with vi (using `file` command)
|
||||||
- Remove video file associations (to each his own favourite video player)
|
- Remove video file associations (to each his own favourite video player)
|
||||||
- Associate common audio mimes with lightweight [fmedia](http://fmedia.firmdev.com/)
|
- Associate common audio mimes with lightweight [fmedia](http://fmedia.firmdev.com/)
|
||||||
- Associate PDF files with [zathura](https://pwmt.org/projects/zathura/)
|
- Associate PDF files with [zathura](https://pwmt.org/projects/zathura/)
|
||||||
|
@ -115,8 +116,8 @@ Start nnn (default: current directory):
|
||||||
| `t` | toggle sort by modified time |
|
| `t` | toggle sort by modified time |
|
||||||
| `!` | spawn a shell in current dir |
|
| `!` | spawn a shell in current dir |
|
||||||
| `z` | run `top` |
|
| `z` | run `top` |
|
||||||
| `e` | edit entry in `vim` |
|
| `e` | edit entry in `EDITOR` (fallback vi) |
|
||||||
| `p` | open entry with `less` pager |
|
| `p` | open entry with `PAGER` (fallback less) |
|
||||||
| `^K` | invoke file name copier |
|
| `^K` | invoke file name copier |
|
||||||
| `^L` | redraw window |
|
| `^L` | redraw window |
|
||||||
| `q` | quit |
|
| `q` | quit |
|
||||||
|
@ -165,4 +166,4 @@ Start nnn and use `Ctrl-k` to copy the absolute path (from `/`) of the file unde
|
||||||
|
|
||||||
### Change file associations
|
### Change file associations
|
||||||
|
|
||||||
If you want to set custom applications for certain mime types, or change the ones set already (e.g. vim, fmedia, zathura), modify the `assocs` structure in [config.def.h](https://github.com/jarun/nnn/blob/master/config.def.h) (it's easy). Then re-compile and install.
|
If you want to set custom applications for certain mime types, or change the ones set already (e.g. vi, fmedia, zathura), modify the `assocs` structure in [config.def.h](https://github.com/jarun/nnn/blob/master/config.def.h) (it's easy). Then re-compile and install.
|
||||||
|
|
|
@ -12,7 +12,7 @@ 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)$", "vim" },
|
{ "\\.(c|cpp|h|txt|log)$", "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" },
|
||||||
|
|
8
nnn.1
8
nnn.1
|
@ -56,9 +56,9 @@ Spawn a shell in current directory.
|
||||||
.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 the vi editor.
|
Open selected entry with EDITOR (fallback vi).
|
||||||
.It Ic p
|
.It Ic p
|
||||||
Open selected entry with the less pager.
|
Open selected entry with 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
|
||||||
|
@ -127,13 +127,13 @@ variable NNN_OPENER is not set:
|
||||||
.Bd -literal
|
.Bd -literal
|
||||||
-----------------------------------------------
|
-----------------------------------------------
|
||||||
struct assoc assocs[] = {
|
struct assoc assocs[] = {
|
||||||
{ "\\.(c|cpp|h|txt|log)$", "vim" },
|
{ "\\.(c|cpp|h|txt|log)$", "vi" },
|
||||||
{ "\\.(wma|mp3|ogg|flac)$", "fmedia" },
|
{ "\\.(wma|mp3|ogg|flac)$", "fmedia" },
|
||||||
{ "\\.pdf$", "zathura" },
|
{ "\\.pdf$", "zathura" },
|
||||||
{ "\\.sh$", "sh" },
|
{ "\\.sh$", "sh" },
|
||||||
};
|
};
|
||||||
-----------------------------------------------
|
-----------------------------------------------
|
||||||
Plain text files are opened with vim.
|
Plain text files are opened with vi.
|
||||||
.br
|
.br
|
||||||
Any other file types are opened with the 'xdg-open' command.
|
Any other file types are opened with the 'xdg-open' command.
|
||||||
.Ed
|
.Ed
|
||||||
|
|
6
nnn.c
6
nnn.c
|
@ -748,11 +748,11 @@ nochange:
|
||||||
|
|
||||||
/* Try custom applications */
|
/* Try custom applications */
|
||||||
bin = openwith(newpath);
|
bin = openwith(newpath);
|
||||||
char *execvim = "vim";
|
char *execvi = "vi";
|
||||||
|
|
||||||
if (bin == NULL) {
|
if (bin == NULL) {
|
||||||
/* If a custom handler application is not set, open
|
/* If a custom handler application is not set, open
|
||||||
plain text files with vim, then try fallback_opener */
|
plain text files with vi, then try fallback_opener */
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
char cmd[MAX_LEN];
|
char cmd[MAX_LEN];
|
||||||
int status;
|
int status;
|
||||||
|
@ -768,7 +768,7 @@ nochange:
|
||||||
pclose(fp);
|
pclose(fp);
|
||||||
|
|
||||||
if (strstr(cmd, "ASCII text") != NULL)
|
if (strstr(cmd, "ASCII text") != NULL)
|
||||||
bin = execvim;
|
bin = execvi;
|
||||||
else if (fallback_opener) {
|
else if (fallback_opener) {
|
||||||
snprintf(cmd, MAX_LEN, "%s \"%s\" > /dev/null 2>&1",
|
snprintf(cmd, MAX_LEN, "%s \"%s\" > /dev/null 2>&1",
|
||||||
fallback_opener, newpath);
|
fallback_opener, newpath);
|
||||||
|
|
Loading…
Reference in a new issue