]> Sergey Matveev's repositories - nnn.git/commitdiff
Change vim to vi
authorArun Prakash Jana <engineerarun@gmail.com>
Fri, 31 Mar 2017 16:55:56 +0000 (22:25 +0530)
committerArun Prakash Jana <engineerarun@gmail.com>
Fri, 31 Mar 2017 16:55:56 +0000 (22:25 +0530)
README.md
config.def.h
nnn.1
nnn.c

index 348ea0ac841dc9228aedb82e2611ddb3b0be1feb..ca472239d009d4b1eeda07d516ca1c1ab6f4fc3a 100644 (file)
--- 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.
index 7ec98effbdebcc153a02bb5613185975cdfc8b8e..8c2144cbd754c13ab7042677f2b8830a6cc7005c 100644 (file)
@@ -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 d389d4c5678cc27b5e8321fa6eb625e20140ac2a..774d8c578b9b6ed48548e2caa0197540c8856272 100644 (file)
--- 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 7234af84ab68d43f6f7bc2c21ea02e3cde0aba80..9b42219a600f8884b03b39fc4e65a195a92aea4a 100644 (file)
--- 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);