diff options
-rw-r--r-- | runtime/doc/eval.txt | 6 | ||||
-rw-r--r-- | runtime/doc/quickref.txt | 1 | ||||
-rw-r--r-- | runtime/doc/starting.txt | 80 | ||||
-rw-r--r-- | runtime/doc/usr_90.txt | 18 | ||||
-rw-r--r-- | runtime/doc/vi_diff.txt | 5 | ||||
-rw-r--r-- | runtime/syntax/dirpager.vim | 2 | ||||
-rw-r--r-- | src/nvim/buffer.c | 2 | ||||
-rw-r--r-- | src/nvim/ex_cmds.c | 6 | ||||
-rw-r--r-- | src/nvim/ex_docmd.c | 4 | ||||
-rw-r--r-- | src/nvim/globals.h | 2 | ||||
-rw-r--r-- | src/nvim/main.c | 82 |
11 files changed, 36 insertions, 172 deletions
diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt index b303ad61b1..8994c313b3 100644 --- a/runtime/doc/eval.txt +++ b/runtime/doc/eval.txt @@ -1551,9 +1551,9 @@ v:profiling Normally zero. Set to one after using ":profile start". See |profiling|. *v:progname* *progname-variable* -v:progname Contains the name (with path removed) with which Vim was - invoked. Allows you to do special initialisations for |view|, - |rview|, or any other name you might symlink to Vim. +v:progname Contains the name (with path removed) with which Nvim was + invoked. Allows you to do special initialisations for any + other name you might symlink to Nvim. Read-only. *v:progpath* *progpath-variable* diff --git a/runtime/doc/quickref.txt b/runtime/doc/quickref.txt index 0e4418ba6a..5d251e7b68 100644 --- a/runtime/doc/quickref.txt +++ b/runtime/doc/quickref.txt @@ -1128,7 +1128,6 @@ Context-sensitive completion on the command-line: |-+| +[num] put the cursor at line [num] (default: last line) |-+c| +{command} execute {command} after loading the file |-+/| +/{pat} {file} .. put the cursor at the first occurrence of {pat} -|-v| -v Vi mode, start ex in Normal mode |-e| -e Ex mode, start vim in Ex mode |-R| -R Read-only mode, implies -n |-m| -m modifications not allowed (resets 'write' option) diff --git a/runtime/doc/starting.txt b/runtime/doc/starting.txt index 39cb522002..bb555e1666 100644 --- a/runtime/doc/starting.txt +++ b/runtime/doc/starting.txt @@ -19,11 +19,11 @@ Starting Vim *starting* Most often, Vim is started to edit a single file with the command - vim filename *-vim* + nvim filename *-vim* More generally, Vim is started with: - vim [option | filename] .. + nvim [option | filename] .. Option arguments and file name arguments can be mixed, and any number of them can be given. However, watch out for options that take an argument. @@ -39,7 +39,7 @@ filename One or more file names. The first one will be the current on the first line of the buffer. To avoid a file name starting with a '-' being interpreted as an option, precede the arglist with "--", e.g.: > - vim -- -filename + nvim -- -filename < All arguments after the "--" will be interpreted as file names, no other options or "+command" argument can follow. @@ -48,22 +48,18 @@ filename One or more file names. The first one will be the current mode is to be used. Starting in Normal mode: > - vim - - ex -v - + nvim - < Start editing a new buffer, which is filled with text that is read from stdin. The commands that would normally be read from stdin will now be read from stderr. Example: > - find . -name "*.c" -print | vim - + find . -name "*.c" -print | nvim - < The buffer will be marked modified, because it contains text that needs to be saved. Except when in readonly mode, then the buffer is not marked modified. Example: > - ls | view - -< + ls | nvim -R - Starting in Ex mode: > - ex - - vim -e - - exim - - vim -E + nvim -e - + nvim -E < Start editing in silent mode. See |-s-ex|. *-t* *-tag* @@ -85,32 +81,6 @@ filename One or more file names. The first one will be the current (nothing) Without one of the four items above, Vim will start editing a new buffer. It's empty and doesn't have a file name. - -The startup mode can be changed by using another name instead of "vim", which -is equal to giving options: -ex vim -e Start in Ex mode (see |Ex-mode|). *ex* -exim vim -E Start in improved Ex mode (see |Ex-mode|). *exim* - (normally not installed) -view vim -R Start in read-only mode (see |-R|). *view* -gvim vim -g Start the GUI (see |gui|). *gvim* -gex vim -eg Start the GUI in Ex mode. *gex* -gview vim -Rg Start the GUI in read-only mode. *gview* -rvim vim -Z Like "vim", but in restricted mode (see |-Z|) *rvim* -rview vim -RZ Like "view", but in restricted mode. *rview* -rgvim vim -gZ Like "gvim", but in restricted mode. *rgvim* -rgview vim -RgZ Like "gview", but in restricted mode. *rgview* - -Additional characters may follow, they are ignored. For example, you can have -"gvim-5" to start the GUI. You must have an executable by that name then, of -course. - -On Unix, you would normally have one executable called Vim, and links from the -different startup-names to that executable. If your system does not support -links and you do not want to have several copies of the executable, you could -use an alias instead. For example: > - alias view vim -R - alias gvim vim -g -< *startup-options* The option arguments may be given in any order. Single-letter options can be combined after one dash. There can be no option arguments after the "--" @@ -245,28 +215,20 @@ argument. -g Start Vim in GUI mode. See |gui|. For the opposite see |-v|. {not in Vi} - *-v* --v Start Ex in Vi mode. Only makes a difference when the - executable is called "ex" or "gvim". For gvim the GUI is not - started if possible. - *-e* --e Start Vim in Ex mode |Q|. Only makes a difference when the - executable is not called "ex". +-e Start Vim in Ex mode |Q|. *-E* --E Start Vim in improved Ex mode |gQ|. Only makes a difference - when the executable is not called "exim". - {not in Vi} +-E Start Vim in improved Ex mode |gQ|. *-s-ex* --s Silent or batch mode. Only when Vim was started as "ex" or - when preceded with the "-e" argument. Otherwise see |-s|, - which does take an argument while this use of "-s" doesn't. - To be used when Vim is used to execute Ex commands from a file - instead of a terminal. Switches off most prompts and - informative messages. Also warnings and error messages. - The output of these commands is displayed (to stdout): +-s Silent or batch mode. Only when "-s" is preceded by the "-e" + argument. Otherwise see |-s|, which does take an argument + while this use of "-s" doesn't. To be used when Vim is used + to execute Ex commands from a file instead of a terminal. + Switches off most prompts and informative messages. Also + warnings and error messages. The output of these commands is + displayed (to stdout): :print :list :number @@ -561,14 +523,6 @@ argument. Note that the implementation is still primitive. It won't work with all applications and the menu doesn't work. -If the executable is called "view", Vim will start in Readonly mode. This is -useful if you can make a hard or symbolic link from "view" to "vim". -Starting in Readonly mode can also be done with "vim -R". - -If the executable is called "ex", Vim will start in "Ex" mode. This means it -will accept only ":" commands. But when the "-v" argument is given, Vim will -start in Normal mode anyway. - Additional arguments are available on unix like systems when compiled with X11 GUI support. See |gui-resources|. diff --git a/runtime/doc/usr_90.txt b/runtime/doc/usr_90.txt index 4be0e93718..ab0b8156f8 100644 --- a/runtime/doc/usr_90.txt +++ b/runtime/doc/usr_90.txt @@ -434,27 +434,9 @@ someone supplied, you can't do this. Do delete the files manually, here is an example for when "/usr/local" was used as the root: > rm -rf /usr/local/share/vim/vim61 - rm /usr/local/bin/ex - rm /usr/local/bin/gview - rm /usr/local/bin/gvim - rm /usr/local/bin/gvim - rm /usr/local/bin/rgview - rm /usr/local/bin/rgvim - rm /usr/local/bin/rview - rm /usr/local/bin/rvim - rm /usr/local/bin/rvim - rm /usr/local/bin/view rm /usr/local/bin/vim rm /usr/local/bin/vimtutor rm /usr/local/bin/xxd - rm /usr/local/man/man1/ex.1 - rm /usr/local/man/man1/gview.1 - rm /usr/local/man/man1/gvim.1 - rm /usr/local/man/man1/rgview.1 - rm /usr/local/man/man1/rgvim.1 - rm /usr/local/man/man1/rview.1 - rm /usr/local/man/man1/rvim.1 - rm /usr/local/man/man1/view.1 rm /usr/local/man/man1/vim.1 rm /usr/local/man/man1/vimtutor.1 rm /usr/local/man/man1/xxd.1 diff --git a/runtime/doc/vi_diff.txt b/runtime/doc/vi_diff.txt index b4e621e516..919002cffd 100644 --- a/runtime/doc/vi_diff.txt +++ b/runtime/doc/vi_diff.txt @@ -830,10 +830,9 @@ Only Vim is able to accept options in between and after the file names. -D Vim: debug mode. --e Elvis, Nvi, Vim: Start in Ex mode, as if the executable is - called "ex". +-e Elvis, Nvi, Vim: Start in Ex mode. --E Vim: Start in improved Ex mode |gQ|, like "exim". +-E Vim: Start in improved Ex mode |gQ|. -f Vim: Run GUI in foreground. -f {session} Elvis: Use {session} as the session file. diff --git a/runtime/syntax/dirpager.vim b/runtime/syntax/dirpager.vim index 1a60063798..40137e4936 100644 --- a/runtime/syntax/dirpager.vim +++ b/runtime/syntax/dirpager.vim @@ -14,7 +14,7 @@ " License: VIM License " Vim is Charityware, see ":help Uganda" " -" Usage: $ ls -la | view -c "set ft=dirpager" - +" Usage: $ ls -la | nvim -R -c "set ft=dirpager" - " " ",----[ ls(1posix) ]-------------------------------------------------- diff --git a/src/nvim/buffer.c b/src/nvim/buffer.c index c4abcd77b1..c0b688e6ef 100644 --- a/src/nvim/buffer.c +++ b/src/nvim/buffer.c @@ -213,7 +213,7 @@ open_buffer ( * So the modelines have priority over auto commands. */ /* When reading stdin, the buffer contents always needs writing, so set - * the changed flag. Unless in readonly mode: "ls | gview -". + * the changed flag. Unless in readonly mode: "ls | nvim -R -". * When interrupted and 'cpoptions' contains 'i' set changed flag. */ if ((got_int && vim_strchr(p_cpo, CPO_INTMOD) != NULL) || modified_was_set /* ":set modified" used in autocmd */ diff --git a/src/nvim/ex_cmds.c b/src/nvim/ex_cmds.c index e98032da5c..a47b303a4a 100644 --- a/src/nvim/ex_cmds.c +++ b/src/nvim/ex_cmds.c @@ -853,7 +853,7 @@ void do_bang(int addr_count, exarg_T *eap, int forceit, int do_in, int do_out) int scroll_save = msg_scroll; /* - * Disallow shell commands for "rvim". + * Disallow shell commands in restricted mode (-Z) * Disallow shell commands from .exrc and .vimrc in current directory for * security reasons. */ @@ -1217,7 +1217,7 @@ do_shell ( int save_nwr; /* - * Disallow shell commands for "rvim". + * Disallow shell commands in restricted mode (-Z) * Disallow shell commands from .exrc and .vimrc in current directory for * security reasons. */ @@ -3378,7 +3378,7 @@ void ex_z(exarg_T *eap) int check_restricted(void) { if (restricted) { - EMSG(_("E145: Shell commands not allowed in rvim")); + EMSG(_("E145: Shell commands not allowed in restricted mode")); return TRUE; } return FALSE; diff --git a/src/nvim/ex_docmd.c b/src/nvim/ex_docmd.c index 4e835cc43a..fa6021075d 100644 --- a/src/nvim/ex_docmd.c +++ b/src/nvim/ex_docmd.c @@ -5375,9 +5375,7 @@ static void ex_hide(exarg_T *eap) */ static void ex_stop(exarg_T *eap) { - /* - * Disallow suspending for "rvim". - */ + // Disallow suspending in restricted mode (-Z) if (!check_restricted()) { if (!eap->forceit) { autowrite_all(); diff --git a/src/nvim/globals.h b/src/nvim/globals.h index b15db61f99..d7087ee928 100644 --- a/src/nvim/globals.h +++ b/src/nvim/globals.h @@ -601,7 +601,7 @@ EXTERN volatile int full_screen INIT(= FALSE); * otherwise only writing some messages */ EXTERN int restricted INIT(= FALSE); -/* TRUE when started as "rvim" */ +// TRUE when started in restricted mode (-Z) EXTERN int secure INIT(= FALSE); /* non-zero when only "safe" commands are * allowed, e.g. when sourcing .exrc or .vimrc diff --git a/src/nvim/main.c b/src/nvim/main.c index 897f251bb3..a4f430e811 100644 --- a/src/nvim/main.c +++ b/src/nvim/main.c @@ -204,11 +204,9 @@ int main(int argc, char **argv) // Check if we have an interactive window. check_and_set_isatty(¶ms); - /* - * Figure out the way to work from the command name argv[0]. - * "view" sets "readonlymode", "rvim" sets "restricted", etc. - */ - parse_command_name(¶ms); + // Get the name with which Nvim was invoked, with and without path. + set_vim_var_string(VV_PROGPATH, (char_u *)argv[0], -1); + set_vim_var_string(VV_PROGNAME, path_tail((char_u *)argv[0]), -1); /* * Process the command line arguments. File names are put in the global @@ -820,69 +818,8 @@ static void init_locale(void) } TIME_MSG("locale set"); } - #endif -/* - * Check for: [r][g][vi|vim|view][ex[im]] - * If the executable name starts with "r" we disable shell commands. - * If the next character is "g" we run the GUI version. - * If the next characters are "view" we start in readonly mode. - * If the next characters are "ex" we start in Ex mode. If it's followed - * by "im" use improved Ex mode. - */ -static void parse_command_name(mparm_T *parmp) -{ - char_u *initstr; - - initstr = path_tail((char_u *)parmp->argv[0]); - - set_vim_var_string(VV_PROGNAME, initstr, -1); - set_vim_var_string(VV_PROGPATH, (char_u *)parmp->argv[0], -1); - - if (parse_string(&initstr, "editor", 6)) - return; - - if (parse_char_i(&initstr, 'r')) - restricted = TRUE; - - /* "gvim" starts the GUI. Also accept "Gvim" for MS-Windows. */ - if (parse_char_i(&initstr, 'g')) - main_start_gui(); - - if (parse_string(&initstr, "view", 4)) { - readonlymode = TRUE; - curbuf->b_p_ro = TRUE; - p_uc = 10000; /* don't update very often */ - } else { - parse_string(&initstr, "vim", 3); /* consume "vim" if it's there */ - } - - if (parse_string(&initstr, "ex", 2)) { - if (parse_string(&initstr, "im", 2)) - exmode_active = EXMODE_VIM; - else - exmode_active = EXMODE_NORMAL; - } -} - -static bool parse_char_i(char_u **input, char val) -{ - if (TOLOWER_ASC(**input) == val) { - *input += 1; /* or (*input)++ WITH parens */ - return true; - } - return false; -} - -static bool parse_string(char_u **input, char *val, int len) -{ - if (STRNICMP(*input, val, len) == 0) { - *input += len; - return true; - } - return false; -} /* * Scan the command line arguments. @@ -1134,10 +1071,6 @@ static void command_line_scan(mparm_T *parmp) } break; - case 'v': /* "-v" Vi-mode (as if called "vi") */ - exmode_active = 0; - break; - case 'w': /* "-w{number}" set window height */ /* "-w {scriptout}" write to script */ if (vim_isdigit(((char_u *)argv[0])[argv_idx])) { @@ -2034,13 +1967,12 @@ static void usage(void) #if !defined(UNIX) mch_msg(_(" --literal Don't expand wildcards\n")); #endif - mch_msg(_(" -v Vi mode (like \"vi\")\n")); - mch_msg(_(" -e Ex mode (like \"ex\")\n")); + mch_msg(_(" -e Ex mode\n")); mch_msg(_(" -E Improved Ex mode\n")); - mch_msg(_(" -s Silent (batch) mode (only for \"ex\")\n")); + mch_msg(_(" -s Silent (batch) mode (only for ex mode)\n")); mch_msg(_(" -d Diff mode\n")); - mch_msg(_(" -R Readonly mode (like \"view\")\n")); - mch_msg(_(" -Z Restricted mode (like \"rvim\")\n")); + mch_msg(_(" -R Readonly mode\n")); + mch_msg(_(" -Z Restricted mode\n")); mch_msg(_(" -m Modifications (writing files) not allowed\n")); mch_msg(_(" -M Modifications in text not allowed\n")); mch_msg(_(" -b Binary mode\n")); |