mirror of
https://github.com/jarun/nnn.git
synced 2024-11-28 05:41:31 +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)
|
||||
- Spawn a shell in current directory
|
||||
- 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
|
||||
|
||||
|
@ -65,7 +66,7 @@ I chose to fork because:
|
|||
export NNN_OPENER=gnome-open
|
||||
export NNN_OPENER=gvfs-open
|
||||
- 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)
|
||||
- Associate common audio mimes with lightweight [fmedia](http://fmedia.firmdev.com/)
|
||||
- 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 |
|
||||
| `!` | spawn a shell in current dir |
|
||||
| `z` | run `top` |
|
||||
| `e` | edit entry in `vim` |
|
||||
| `p` | open entry with `less` pager |
|
||||
| `e` | edit entry in `EDITOR` (fallback vi) |
|
||||
| `p` | open entry with `PAGER` (fallback less) |
|
||||
| `^K` | invoke file name copier |
|
||||
| `^L` | redraw window |
|
||||
| `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
|
||||
|
||||
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[] = {
|
||||
//{ "\\.(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" },
|
||||
//{ "\\.(png|jpg|gif)$", "feh" },
|
||||
//{ "\\.(html|svg)$", "firefox" },
|
||||
|
|
8
nnn.1
8
nnn.1
|
@ -56,9 +56,9 @@ Spawn a shell in current directory.
|
|||
.It Ic z
|
||||
Run the system top utility.
|
||||
.It Ic e
|
||||
Open selected entry with the vi editor.
|
||||
Open selected entry with EDITOR (fallback vi).
|
||||
.It Ic p
|
||||
Open selected entry with the less pager.
|
||||
Open selected entry with PAGER (fallback less).
|
||||
.It Ic C-k
|
||||
Invoke file name copier.
|
||||
.It Ic C-l
|
||||
|
@ -127,13 +127,13 @@ variable NNN_OPENER is not set:
|
|||
.Bd -literal
|
||||
-----------------------------------------------
|
||||
struct assoc assocs[] = {
|
||||
{ "\\.(c|cpp|h|txt|log)$", "vim" },
|
||||
{ "\\.(c|cpp|h|txt|log)$", "vi" },
|
||||
{ "\\.(wma|mp3|ogg|flac)$", "fmedia" },
|
||||
{ "\\.pdf$", "zathura" },
|
||||
{ "\\.sh$", "sh" },
|
||||
};
|
||||
-----------------------------------------------
|
||||
Plain text files are opened with vim.
|
||||
Plain text files are opened with vi.
|
||||
.br
|
||||
Any other file types are opened with the 'xdg-open' command.
|
||||
.Ed
|
||||
|
|
6
nnn.c
6
nnn.c
|
@ -748,11 +748,11 @@ nochange:
|
|||
|
||||
/* Try custom applications */
|
||||
bin = openwith(newpath);
|
||||
char *execvim = "vim";
|
||||
char *execvi = "vi";
|
||||
|
||||
if (bin == NULL) {
|
||||
/* 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;
|
||||
char cmd[MAX_LEN];
|
||||
int status;
|
||||
|
@ -768,7 +768,7 @@ nochange:
|
|||
pclose(fp);
|
||||
|
||||
if (strstr(cmd, "ASCII text") != NULL)
|
||||
bin = execvim;
|
||||
bin = execvi;
|
||||
else if (fallback_opener) {
|
||||
snprintf(cmd, MAX_LEN, "%s \"%s\" > /dev/null 2>&1",
|
||||
fallback_opener, newpath);
|
||||
|
|
Loading…
Reference in a new issue