diff options
Diffstat (limited to 'runtime')
| -rw-r--r-- | runtime/autoload/health/provider.vim | 12 | ||||
| -rw-r--r-- | runtime/autoload/provider/node.vim | 32 | ||||
| -rw-r--r-- | runtime/doc/intro.txt | 21 | ||||
| -rw-r--r-- | runtime/doc/starting.txt | 14 | ||||
| -rw-r--r-- | runtime/doc/vim_diff.txt | 7 |
5 files changed, 50 insertions, 36 deletions
diff --git a/runtime/autoload/health/provider.vim b/runtime/autoload/health/provider.vim index 69f0b711fc..55fa1ff65e 100644 --- a/runtime/autoload/health/provider.vim +++ b/runtime/autoload/health/provider.vim @@ -502,10 +502,10 @@ function! s:check_node() abort return endif - if !executable('node') || !executable('npm') + if !executable('node') || (!executable('npm') && !executable('yarn')) call health#report_warn( - \ '`node` and `npm` must be in $PATH.', - \ ['Install Node.js and verify that `node` and `npm` commands work.']) + \ '`node` and `npm` (or `yarn`) must be in $PATH.', + \ ['Install Node.js and verify that `node` and `npm` (or `yarn`) commands work.']) return endif let node_v = get(split(s:system('node -v'), "\n"), 0, '') @@ -521,9 +521,9 @@ function! s:check_node() abort let host = provider#node#Detect() if empty(host) - call health#report_warn('Missing "neovim" npm package.', + call health#report_warn('Missing "neovim" npm (or yarn) package.', \ ['Run in shell: npm install -g neovim', - \ 'Is the npm bin directory in $PATH?']) + \ 'Run in shell (if you use yarn): yarn global add neovim']) return endif call health#report_info('Neovim node.js host: '. host) @@ -559,7 +559,7 @@ function! s:check_node() abort \ current_npm, latest_npm), \ ['Run in shell: npm install -g neovim']) else - call health#report_ok('Latest "neovim" npm package is installed: '. current_npm) + call health#report_ok('Latest "neovim" npm/yarn package is installed: '. current_npm) endif endfunction diff --git a/runtime/autoload/provider/node.vim b/runtime/autoload/provider/node.vim index 39b5dc63b8..bdc21514da 100644 --- a/runtime/autoload/provider/node.vim +++ b/runtime/autoload/provider/node.vim @@ -22,6 +22,28 @@ function! s:is_minimum_version(version, min_major, min_minor) abort \ && str2nr(v_list[1]) >= str2nr(a:min_minor))) endfunction +function! s:find_node_client(package_manager) abort + if !executable(a:package_manager) + return '' + endif + let is_yarn = a:package_manager ==# 'yarn' + let cmd = is_yarn ? 'yarn global dir' : 'npm root -g' + let global_modules_dir = get(split(system(cmd), "\n"), 0, '') + if v:shell_error || !isdirectory(global_modules_dir) + return '' + endif + " `yarn global dir` returns the parent of '/node_modules'. + let global_modules_dir = is_yarn ? global_modules_dir . '/node_modules' : global_modules_dir + if !isdirectory(global_modules_dir) + return '' + endif + let entry_point = global_modules_dir . '/neovim/bin/cli.js' + if !filereadable(entry_point) + return '' + endif + return entry_point +endfunction + " Support for --inspect-brk requires node 6.12+ or 7.6+ or 8+ " Return 1 if it is supported " Return 0 otherwise @@ -41,17 +63,11 @@ function! provider#node#Detect() abort if exists('g:node_host_prog') return g:node_host_prog endif - let global_modules = get(split(system('npm root -g'), "\n"), 0, '') - if v:shell_error || !isdirectory(global_modules) - return '' - endif if !s:is_minimum_version(v:null, 6, 0) return '' endif - let entry_point = glob(global_modules . '/neovim/bin/cli.js') - if !filereadable(entry_point) - return '' - endif + let entry_point = s:find_node_client('npm') + let entry_point = !empty(entry_point) ? entry_point : s:find_node_client('yarn') return entry_point endfunction diff --git a/runtime/doc/intro.txt b/runtime/doc/intro.txt index e7fb632de8..5c63d9e5e2 100644 --- a/runtime/doc/intro.txt +++ b/runtime/doc/intro.txt @@ -642,25 +642,12 @@ The command CTRL-\ CTRL-G or <C-\><C-G> can be used to go to Insert mode when make sure Vim is in the mode indicated by 'insertmode', without knowing in what mode Vim currently is. - *Q* *mode-Ex* *Ex-mode* *Ex* *EX* *E501* -Q Switch to "Ex" mode. This is a bit like typing ":" - commands one after another, except: + *gQ* *Q* *mode-Ex* *Ex-mode* *Ex* *EX* *E501* +Q or gQ Switch to Ex mode. This is like typing ":" commands + one after another, except: - You don't have to keep pressing ":". - The screen doesn't get updated after each command. - - There is no normal command-line editing. - - Mappings and abbreviations are not used. - In fact, you are editing the lines with the "standard" - line-input editing commands (<Del> or <BS> to erase, - CTRL-U to kill the whole line). - Vim will enter this mode by default if it's invoked as - "ex" on the command-line. - Use the ":vi" command |:visual| to exit "Ex" mode. - - *gQ* -gQ Switch to "Ex" mode like with "Q", but really behave - like typing ":" commands after another. All command - line editing, completion etc. is available. - Use the ":vi" command |:visual| to exit "Ex" mode. + Use the ":vi" command |:visual| to exit this mode. ============================================================================== 7. The window contents *window-contents* diff --git a/runtime/doc/starting.txt b/runtime/doc/starting.txt index e89d72bce3..ad1077bcab 100644 --- a/runtime/doc/starting.txt +++ b/runtime/doc/starting.txt @@ -185,11 +185,12 @@ argument. delete(), rename(), mkdir(), writefile(), libcall(), jobstart(), etc. - *-e* --e Start Vim in Ex mode |Q|. +-e *-e* *-E* +-E Start Nvim in Ex mode |gQ|. - *-E* --E Start Vim in improved Ex mode |gQ|. + If stdin is not a TTY: + -e reads stdin as Ex commands. + -E reads stdin as text (into buffer 1). *-es* *-Es* -es *-s-ex* *silent-mode* @@ -207,6 +208,11 @@ argument. < User |init.vim| is skipped (unless given with |-u|). |$TERM| is not used. + + If stdin is not a TTY: + -es reads stdin as Ex commands. + -Es reads stdin as text (into buffer 1). + Example: > printf "put ='foo'\n%%print\n" | nvim -es < diff --git a/runtime/doc/vim_diff.txt b/runtime/doc/vim_diff.txt index 5394414947..0035e15be1 100644 --- a/runtime/doc/vim_diff.txt +++ b/runtime/doc/vim_diff.txt @@ -315,10 +315,15 @@ Macro/|recording| behavior macros and 'keymap' at the same time. This also means you can use |:imap| on the results of keys from 'keymap'. +Normal commands: + |Q| is the same as |gQ| + Options: 'ttimeout', 'ttimeoutlen' behavior was simplified Startup: + |-e| and |-es| invoke the same "improved Ex mode" as -E and -Es. + |-E| and |-Es| reads stdin as text (into buffer 1). |-s| reads Normal commands from stdin if the script name is "-". Reading text (instead of commands) from stdin |--|: - works by default: "-" file is optional @@ -465,4 +470,4 @@ TUI: always uses 7-bit control sequences. ============================================================================== - vim:tw=78:ts=8:noet:ft=help:norl: + vim:tw=78:ts=8:sw=2:noet:ft=help:norl: |