aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Arun Prakash Jana <engineerarun@gmail.com>2017-03-31 22:25:56 +0530
committerGravatar Arun Prakash Jana <engineerarun@gmail.com>2017-03-31 22:25:56 +0530
commitaeeeed0bceee9429caf770d0908ffcaf348a3f12 (patch)
treee8359edb10d8ed75e9b7401cd7bafdebd4107a64
parent8563ec5cb28f43060eacac0d7b0f27ecee78c9fc (diff)
downloadnnn-aeeeed0bceee9429caf770d0908ffcaf348a3f12.tar.gz
Change vim to vi
-rw-r--r--README.md11
-rw-r--r--config.def.h2
-rw-r--r--nnn.18
-rw-r--r--nnn.c6
4 files changed, 14 insertions, 13 deletions
diff --git a/README.md b/README.md
index 348ea0a..ca47223 100644
--- a/README.md
+++ b/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.
diff --git a/config.def.h b/config.def.h
index 7ec98ef..8c2144c 100644
--- a/config.def.h
+++ b/config.def.h
@@ -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" },
diff --git a/nnn.1 b/nnn.1
index d389d4c..774d8c5 100644
--- a/nnn.1
+++ b/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
diff --git a/nnn.c b/nnn.c
index 7234af8..9b42219 100644
--- a/nnn.c
+++ b/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);