diff options
Diffstat (limited to 'runtime')
71 files changed, 624 insertions, 493 deletions
diff --git a/runtime/CMakeLists.txt b/runtime/CMakeLists.txt index a9efc90b87..f81d8541b5 100644 --- a/runtime/CMakeLists.txt +++ b/runtime/CMakeLists.txt @@ -71,6 +71,7 @@ foreach(DF ${DOCFILES}) endforeach() add_custom_target(helptags + COMMAND ${CMAKE_COMMAND} -E remove_directory ${GENERATED_RUNTIME_DIR}/doc COMMAND ${CMAKE_COMMAND} -E copy_directory ${PROJECT_SOURCE_DIR}/runtime/doc ${GENERATED_RUNTIME_DIR}/doc COMMAND "${PROJECT_BINARY_DIR}/bin/nvim" diff --git a/runtime/autoload/health.vim b/runtime/autoload/health.vim index f875c8b797..b076f2456b 100644 --- a/runtime/autoload/health.vim +++ b/runtime/autoload/health.vim @@ -1,15 +1,15 @@ function! s:enhance_syntax() abort syntax case match - syntax keyword healthError ERROR + syntax keyword healthError ERROR[:] \ containedin=markdownCodeBlock,mkdListItemLine highlight link healthError Error - syntax keyword healthWarning WARNING + syntax keyword healthWarning WARNING[:] \ containedin=markdownCodeBlock,mkdListItemLine highlight link healthWarning WarningMsg - syntax keyword healthSuccess SUCCESS + syntax keyword healthSuccess OK[:] \ containedin=markdownCodeBlock,mkdListItemLine highlight healthSuccess guibg=#5fff00 guifg=#080808 ctermbg=82 ctermfg=232 @@ -18,7 +18,7 @@ function! s:enhance_syntax() abort syntax match healthBar "|" contained conceal highlight link healthHelp Identifier - " We do not care about markdown syntax errors in :CheckHealth output. + " We do not care about markdown syntax errors in :checkhealth output. highlight! link markdownError Normal endfunction @@ -90,27 +90,27 @@ endfunction " Changes ':h clipboard' to ':help |clipboard|'. function! s:help_to_link(s) abort - return substitute(a:s, '\v:h%[elp] ([^|][^"\r\n]+)', ':help |\1|', 'g') + return substitute(a:s, '\v:h%[elp] ([^|][^"\r\n ]+)', ':help |\1|', 'g') endfunction " Format a message for a specific report item function! s:format_report_message(status, msg, ...) abort " {{{ let output = ' - ' . a:status . ': ' . s:indent_after_line1(a:msg, 4) - let suggestions = [] + let advice = [] " Optional parameters if a:0 > 0 - let suggestions = type(a:1) == type("") ? [a:1] : a:1 - if type(suggestions) != type([]) - echoerr "Expected String or List" + let advice = type(a:1) == type("") ? [a:1] : a:1 + if type(advice) != type([]) + throw "Expected String or List" endif endif " Report each suggestion - if len(suggestions) > 0 - let output .= "\n - SUGGESTIONS:" + if len(advice) > 0 + let output .= "\n - ADVICE:" endif - for suggestion in suggestions + for suggestion in advice let output .= "\n - " . s:indent_after_line1(suggestion, 10) endfor @@ -124,7 +124,7 @@ endfunction " }}} " Reports a successful healthcheck. function! health#report_ok(msg) abort " {{{ - echo s:format_report_message('SUCCESS', a:msg) + echo s:format_report_message('OK', a:msg) endfunction " }}} " Reports a health warning. @@ -159,7 +159,10 @@ endfunction " Translates a list of plugin names to healthcheck function names. function! s:to_fn_names(plugin_names) abort let healthchecks = [] - for p in a:plugin_names + let plugin_names = type('') ==# type(a:plugin_names) + \ ? split(a:plugin_names, '', v:false) + \ : a:plugin_names + for p in plugin_names call add(healthchecks, 'health#'.p.'#check') endfor return healthchecks diff --git a/runtime/autoload/health/nvim.vim b/runtime/autoload/health/nvim.vim index 3834cbd054..7f6e943dc9 100644 --- a/runtime/autoload/health/nvim.vim +++ b/runtime/autoload/health/nvim.vim @@ -4,6 +4,12 @@ function! s:check_config() abort let ok = v:true call health#report_start('Configuration') + " If $VIM is empty we don't care. Else make sure it is valid. + if !empty($VIM) && !filereadable($VIM.'/runtime/doc/nvim.txt') + let ok = v:false + call health#report_error("$VIM is invalid: ".$VIM) + endif + if exists('$NVIM_TUI_ENABLE_CURSOR_SHAPE') let ok = v:false call health#report_warn("$NVIM_TUI_ENABLE_CURSOR_SHAPE is ignored in Nvim 0.2+", @@ -11,6 +17,13 @@ function! s:check_config() abort \ 'https://github.com/neovim/neovim/wiki/Following-HEAD#20170402' ]) endif + if &paste + let ok = v:false + call health#report_error("'paste' is enabled. This option is only for pasting text.\nIt should not be set in your config.", + \ [ 'Remove `set paste` from your init.vim, if applicable.', + \ 'Check `:verbose set paste?` to see if a plugin or script set the option.', ]) + endif + if ok call health#report_ok('no issues found') endif diff --git a/runtime/autoload/health/provider.vim b/runtime/autoload/health/provider.vim index ec20615f69..0eaa678459 100644 --- a/runtime/autoload/health/provider.vim +++ b/runtime/autoload/health/provider.vim @@ -121,14 +121,14 @@ function! s:check_clipboard() abort call health#report_start('Clipboard (optional)') let clipboard_tool = provider#clipboard#Executable() - if empty(clipboard_tool) + if exists('g:clipboard') && empty(clipboard_tool) + call health#report_error( + \ provider#clipboard#Error(), + \ ["Use the example in :help g:clipboard as a template, or don't set g:clipboard at all."]) + elseif empty(clipboard_tool) call health#report_warn( - \ 'No clipboard tool found. Clipboard registers will not work.', + \ 'No clipboard tool found. Clipboard registers (`"+` and `"*`) will not work.', \ [':help clipboard']) - elseif exists('g:clipboard') && (type({}) != type(g:clipboard) - \ || !has_key(g:clipboard, 'copy') || !has_key(g:clipboard, 'paste')) - call health#report_error( - \ 'g:clipboard exists but is malformed. It must be a dictionary with the keys documented at :help g:clipboard') else call health#report_ok('Clipboard tool found: '. clipboard_tool) endif @@ -239,7 +239,7 @@ function! s:check_python(version) abort let pyname = 'python'.(a:version == 2 ? '' : '3') let pyenv = resolve(exepath('pyenv')) - let pyenv_root = exists('$PYENV_ROOT') ? resolve($PYENV_ROOT) : 'n' + let pyenv_root = exists('$PYENV_ROOT') ? resolve($PYENV_ROOT) : '' let venv = exists('$VIRTUAL_ENV') ? resolve($VIRTUAL_ENV) : '' let host_prog_var = pyname.'_host_prog' let loaded_var = 'g:loaded_'.pyname.'_provider' @@ -251,6 +251,19 @@ function! s:check_python(version) abort return endif + if !empty(pyenv) + if empty(pyenv_root) + call health#report_warn( + \ 'pyenv was found, but $PYENV_ROOT is not set.', + \ ['Did you follow the final install instructions?', + \ 'If you use a shell "framework" like Prezto or Oh My Zsh, try without.', + \ 'Try a different shell (bash).'] + \ ) + else + call health#report_ok(printf('pyenv found: "%s"', pyenv)) + endif + endif + if exists('g:'.host_prog_var) call health#report_info(printf('Using: g:%s = "%s"', host_prog_var, get(g:, host_prog_var))) endif @@ -282,15 +295,6 @@ function! s:check_python(version) abort endif if !empty(pyenv) - if empty(pyenv_root) - call health#report_warn( - \ 'pyenv was found, but $PYENV_ROOT is not set.', - \ ['Did you follow the final install instructions?'] - \ ) - else - call health#report_ok(printf('pyenv found: "%s"', pyenv)) - endif - let python_bin = s:trim(s:system([pyenv, 'which', pyname], '', 1)) if empty(python_bin) @@ -320,9 +324,8 @@ function! s:check_python(version) abort if python_bin =~# '\<shims\>' call health#report_warn(printf('`%s` appears to be a pyenv shim.', python_bin), [ - \ 'The `pyenv` executable is not in $PATH,', - \ 'Your pyenv installation is broken. You should set ' - \ . '`g:'.host_prog_var.'` to avoid surprises.', + \ '`pyenv` is not in $PATH, your pyenv installation is broken. ' + \ .'Set `g:'.host_prog_var.'` to avoid surprises.', \ ]) endif endif @@ -335,7 +338,7 @@ function! s:check_python(version) abort call health#report_warn('pyenv is not set up optimally.', [ \ printf('Create a virtualenv specifically ' \ . 'for Neovim using pyenv, and set `g:%s`. This will avoid ' - \ . 'the need to install Neovim''s Python module in each ' + \ . 'the need to install the Neovim Python module in each ' \ . 'version/virtualenv.', host_prog_var) \ ]) elseif !empty(venv) && exists('g:'.host_prog_var) diff --git a/runtime/autoload/provider.vim b/runtime/autoload/provider.vim index a4d5241b57..e6514f5ba8 100644 --- a/runtime/autoload/provider.vim +++ b/runtime/autoload/provider.vim @@ -2,7 +2,7 @@ let s:stderr = {} -function! provider#stderr_collector(chan_id, data, event) dict +function! provider#stderr_collector(chan_id, data, event) let stderr = get(s:stderr, a:chan_id, ['']) let stderr[-1] .= a:data[0] call extend(stderr, a:data[1:]) @@ -10,7 +10,9 @@ function! provider#stderr_collector(chan_id, data, event) dict endfunction function! provider#clear_stderr(chan_id) - silent! call delete(s:stderr, a:chan_id) + if has_key(s:stderr, a:chan_id) + call remove(s:stderr, a:chan_id) + endif endfunction function! provider#get_stderr(chan_id) diff --git a/runtime/autoload/provider/clipboard.vim b/runtime/autoload/provider/clipboard.vim index 8eb694e9fa..6454a01c2a 100644 --- a/runtime/autoload/provider/clipboard.vim +++ b/runtime/autoload/provider/clipboard.vim @@ -3,6 +3,7 @@ " available. let s:copy = {} let s:paste = {} +let s:clipboard = {} " When caching is enabled, store the jobid of the xclip/xsel process keeping " ownership of the selection, so we know how long the cache is valid. @@ -23,7 +24,7 @@ function! s:selection.on_exit(jobid, data, event) abort call provider#clear_stderr(a:jobid) endfunction -let s:selections = { '*': s:selection, '+': copy(s:selection)} +let s:selections = { '*': s:selection, '+': copy(s:selection) } function! s:try_cmd(cmd, ...) abort let argv = split(a:cmd, " ") @@ -31,7 +32,7 @@ function! s:try_cmd(cmd, ...) abort if v:shell_error if !exists('s:did_error_try_cmd') echohl WarningMsg - echomsg "clipboard: error: ".(len(out) ? out[0] : '') + echomsg "clipboard: error: ".(len(out) ? out[0] : v:shell_error) echohl None let s:did_error_try_cmd = 1 endif @@ -55,9 +56,15 @@ endfunction function! provider#clipboard#Executable() abort if exists('g:clipboard') + if type({}) isnot# type(g:clipboard) + \ || type({}) isnot# type(get(g:clipboard, 'copy', v:null)) + \ || type({}) isnot# type(get(g:clipboard, 'paste', v:null)) + let s:err = 'clipboard: invalid g:clipboard' + return '' + endif let s:copy = get(g:clipboard, 'copy', { '+': v:null, '*': v:null }) let s:paste = get(g:clipboard, 'paste', { '+': v:null, '*': v:null }) - let s:cache_enabled = get(g:clipboard, 'cache_enabled', 1) + let s:cache_enabled = get(g:clipboard, 'cache_enabled', 0) return get(g:clipboard, 'name', 'g:clipboard') elseif has('mac') && executable('pbcopy') let s:copy['+'] = 'pbcopy' @@ -104,16 +111,17 @@ function! provider#clipboard#Executable() abort return 'tmux' endif - let s:err = 'clipboard: No clipboard tool available. :help clipboard' + let s:err = 'clipboard: No clipboard tool. :help clipboard' return '' endfunction if empty(provider#clipboard#Executable()) + " provider#clipboard#Call() *must not* be defined if the provider is broken. + " Otherwise eval_has_provider() thinks the clipboard provider is + " functioning, and eval_call_provider() will happily call it. finish endif -let s:clipboard = {} - function! s:clipboard.get(reg) abort if s:selections[a:reg].owner > 0 return s:selections[a:reg].data @@ -154,9 +162,19 @@ function! s:clipboard.set(lines, regtype, reg) abort echohl WarningMsg echomsg 'clipboard: failed to execute: '.(s:copy[a:reg]) echohl None + return 0 endif + return 1 endfunction function! provider#clipboard#Call(method, args) abort - return call(s:clipboard[a:method],a:args,s:clipboard) + if get(s:, 'here', v:false) " Clipboard provider must not recurse. #7184 + return 0 + endif + let s:here = v:true + try + return call(s:clipboard[a:method],a:args,s:clipboard) + finally + let s:here = v:false + endtry endfunction diff --git a/runtime/autoload/provider/ruby.vim b/runtime/autoload/provider/ruby.vim index 91b7fb9f2c..7df3500267 100644 --- a/runtime/autoload/provider/ruby.vim +++ b/runtime/autoload/provider/ruby.vim @@ -75,7 +75,7 @@ let s:prog = provider#ruby#Detect() let s:plugin_path = expand('<sfile>:p:h') . '/script_host.rb' if empty(s:prog) - let s:err = 'Cannot find the neovim RubyGem. Try :CheckHealth' + let s:err = 'Cannot find the neovim RubyGem. Try :checkhealth' endif call remote#host#RegisterClone('legacy-ruby-provider', 'ruby') diff --git a/runtime/autoload/remote/define.vim b/runtime/autoload/remote/define.vim index b04a5d2280..b5c976c823 100644 --- a/runtime/autoload/remote/define.vim +++ b/runtime/autoload/remote/define.vim @@ -89,7 +89,8 @@ endfunction function! remote#define#AutocmdOnHost(host, method, sync, name, opts) let group = s:GetNextAutocmdGroup() - let forward = '"doau '.group.' '.a:name.' ".'.'expand("<amatch>")' + let forward = '"doau '.group.' '.a:name.' ".' + \ . 'fnameescape(expand("<amatch>"))' let a:opts.group = group let bootstrap_def = s:GetAutocmdPrefix(a:name, a:opts) \ .' call remote#define#AutocmdBootstrap("'.a:host.'"' diff --git a/runtime/doc/api.txt b/runtime/doc/api.txt index 7c6b8a3c1a..8aead087db 100644 --- a/runtime/doc/api.txt +++ b/runtime/doc/api.txt @@ -11,7 +11,7 @@ via |msgpack-rpc|, Lua and VimL (|eval-api|). Applications can also embed libnvim to work with the C API directly. - Type <M-]> to see the table of contents. + Type |gO| to see the table of contents. ============================================================================== API Types *api-types* @@ -171,8 +171,8 @@ nvim_replace_termcodes({str}, {from_part}, {do_lt}, {special}) Parameters:~ {str} String to be converted. {from_part} Legacy Vim parameter. Usually true. - {do_lt} Also translate <lt>. Does nothing if - `special` is false. + {do_lt} Also translate <lt>. Ignored if `special` is + false. {special} Replace |keycodes|, e.g. <CR> becomes a "\n" char. @@ -309,20 +309,24 @@ nvim_set_option({name}, {value}) *nvim_set_option()* {value} New option value nvim_out_write({str}) *nvim_out_write()* - Writes a message to vim output buffer + Writes a message to the Vim output buffer. Does not append + "\n", the message is buffered (won't display) until a linefeed + is written. Parameters:~ {str} Message nvim_err_write({str}) *nvim_err_write()* - Writes a message to vim error buffer + Writes a message to the Vim error buffer. Does not append + "\n", the message is buffered (won't display) until a linefeed + is written. Parameters:~ {str} Message nvim_err_writeln({str}) *nvim_err_writeln()* - Writes a message to vim error buffer. Appends a linefeed to - ensure all contents are written. + Writes a message to the Vim error buffer. Appends "\n", so the + buffer is flushed (and displayed). Parameters:~ {str} Message diff --git a/runtime/doc/autocmd.txt b/runtime/doc/autocmd.txt index fd2a7c2641..2850c8058f 100644 --- a/runtime/doc/autocmd.txt +++ b/runtime/doc/autocmd.txt @@ -8,7 +8,7 @@ Automatic commands *autocommand* For a basic explanation, see section |40.3| in the user manual. - Type <M-]> to see the table of contents. + Type |gO| to see the table of contents. ============================================================================== 1. Introduction *autocmd-intro* diff --git a/runtime/doc/change.txt b/runtime/doc/change.txt index f82d61370c..9610d7359f 100644 --- a/runtime/doc/change.txt +++ b/runtime/doc/change.txt @@ -11,7 +11,7 @@ commands with the "." command. For inserting text see |insert.txt|. - Type <M-]> to see the table of contents. + Type |gO| to see the table of contents. ============================================================================== 1. Deleting text *deleting* *E470* @@ -648,6 +648,7 @@ g& Synonym for `:%s//~/&` (repeat last substitute with *:s_flags* The flags that you can use for the substitute commands: + *:&&* [&] Must be the first one: Keep the flags from the previous substitute command. Examples: > :&& diff --git a/runtime/doc/cmdline.txt b/runtime/doc/cmdline.txt index 652487d8ab..4222a5b6f7 100644 --- a/runtime/doc/cmdline.txt +++ b/runtime/doc/cmdline.txt @@ -13,7 +13,7 @@ Command-line mode is used to enter Ex commands (":"), search patterns Basic command line editing is explained in chapter 20 of the user manual |usr_20.txt|. - Type <M-]> to see the table of contents. + Type |gO| to see the table of contents. ============================================================================== 1. Command-line editing *cmdline-editing* diff --git a/runtime/doc/debug.txt b/runtime/doc/debug.txt index fd2c4fa54e..422255fa02 100644 --- a/runtime/doc/debug.txt +++ b/runtime/doc/debug.txt @@ -9,7 +9,7 @@ Debugging Vim *debug-vim* This is for debugging Vim itself, when it doesn't work properly. For debugging Vim scripts, functions, etc. see |debug-scripts| - Type <M-]> to see the table of contents. + Type |gO| to see the table of contents. ============================================================================== diff --git a/runtime/doc/develop.txt b/runtime/doc/develop.txt index 5d5523e73f..298f64bbee 100644 --- a/runtime/doc/develop.txt +++ b/runtime/doc/develop.txt @@ -11,7 +11,7 @@ Nvim is open source software. Everybody is encouraged to contribute. See src/nvim/README.md for an overview of the source code. - Type <M-]> to see the table of contents. + Type |gO| to see the table of contents. ============================================================================== Design goals *design-goals* diff --git a/runtime/doc/diff.txt b/runtime/doc/diff.txt index 74a3d183a3..8cb049584a 100644 --- a/runtime/doc/diff.txt +++ b/runtime/doc/diff.txt @@ -10,7 +10,7 @@ eight versions of the same file. The basics are explained in section |08.7| of the user manual. - Type <M-]> to see the table of contents. + Type |gO| to see the table of contents. ============================================================================== 1. Starting diff mode diff --git a/runtime/doc/digraph.txt b/runtime/doc/digraph.txt index 43f8ccab06..d3b03c6ef6 100644 --- a/runtime/doc/digraph.txt +++ b/runtime/doc/digraph.txt @@ -14,7 +14,7 @@ with CTRL-V (see |i_CTRL-V|). There is a brief introduction on digraphs in the user manual: |24.9| An alternative is using the 'keymap' option. - Type <M-]> to see the table of contents. + Type |gO| to see the table of contents. ============================================================================== 1. Defining digraphs *digraphs-define* diff --git a/runtime/doc/editing.txt b/runtime/doc/editing.txt index 9fe815ea9c..a747058991 100644 --- a/runtime/doc/editing.txt +++ b/runtime/doc/editing.txt @@ -6,7 +6,7 @@ Editing files *edit-files* - Type <M-]> to see the table of contents. + Type |gO| to see the table of contents. ============================================================================== 1. Introduction *edit-intro* @@ -901,11 +901,12 @@ WRITING WITH MULTIPLE BUFFERS *buffer-write* *:wa* *:wall* :wa[ll] Write all changed buffers. Buffers without a file - name or which are readonly are not written. + name cause an error message. Buffers which are + readonly are not written. :wa[ll]! Write all changed buffers, even the ones that are readonly. Buffers without a file name are not - written. + written and cause an error message. Vim will warn you if you try to overwrite a file that has been changed @@ -1271,7 +1272,7 @@ Commands for changing the working directory can be suffixed with a bang "!" *:lcd-* :lcd[!] - Change to the previous current directory (before the - previous ":tcd {path}" command). + previous ":lcd {path}" command). *:pw* *:pwd* *E187* :pw[d] Print the current directory name. diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt index dd8aec895d..300bdd061e 100644 --- a/runtime/doc/eval.txt +++ b/runtime/doc/eval.txt @@ -12,7 +12,7 @@ Note: Expression evaluation can be disabled at compile time. If this has been done, the features in this document are not available. See |+eval| and |no-eval-feature|. - Type <M-]> to see the table of contents. + Type |gO| to see the table of contents. ============================================================================== 1. Variables *variables* @@ -1522,14 +1522,16 @@ v:errors Errors found by assert functions, such as |assert_true()|. *v:event* *event-variable* v:event Dictionary of event data for the current |autocommand|. Valid - only during the autocommand lifetime: storing or passing - `v:event` is invalid. Copy it instead: > + only during the event lifetime; storing or passing v:event is + invalid! Copy it instead: > au TextYankPost * let g:foo = deepcopy(v:event) < Keys vary by event; see the documentation for the specific - event, e.g. |TextYankPost|. + event, e.g. |DirChanged| or |TextYankPost|. KEY DESCRIPTION ~ - operator The current |operator|. Also set for - Ex commands (unlike |v:operator|). For + cwd Current working directory + scope Event-specific scope name. + operator Current |operator|. Also set for Ex + commands (unlike |v:operator|). For example if |TextYankPost| is triggered by the |:yank| Ex command then `v:event['operator']` is "y". @@ -4703,6 +4705,7 @@ input({opts}) cancelreturn "" Same as {cancelreturn} from |inputdialog()|. Also works with input(). + highlight nothing Highlight handler: |Funcref|. The highlighting set with |:echohl| is used for the prompt. The input is entered just like a command-line, with the same @@ -4725,7 +4728,60 @@ input({opts}) "-complete=" argument. Refer to |:command-completion| for more information. Example: > let fname = input("File: ", "", "file") + +< *input()-highlight* *E5400* *E5402* + The optional `highlight` key allows specifying function which + will be used for highlighting user input. This function + receives user input as its only argument and must return + a list of 3-tuples [hl_start_col, hl_end_col + 1, hl_group] + where + hl_start_col is the first highlighted column, + hl_end_col is the last highlighted column (+ 1!), + hl_group is |:hl| group used for highlighting. + *E5403* *E5404* *E5405* *E5406* + Both hl_start_col and hl_end_col + 1 must point to the start + of the multibyte character (highlighting must not break + multibyte characters), hl_end_col + 1 may be equal to the + input length. Start column must be in range [0, len(input)), + end column must be in range (hl_start_col, len(input)], + sections must be ordered so that next hl_start_col is greater + then or equal to previous hl_end_col. + + Example (try some input with parentheses): > + highlight RBP1 guibg=Red ctermbg=red + highlight RBP2 guibg=Yellow ctermbg=yellow + highlight RBP3 guibg=Green ctermbg=green + highlight RBP4 guibg=Blue ctermbg=blue + let g:rainbow_levels = 4 + function! RainbowParens(cmdline) + let ret = [] + let i = 0 + let lvl = 0 + while i < len(a:cmdline) + if a:cmdline[i] is# '(' + call add(ret, [i, i + 1, 'RBP' . ((lvl % g:rainbow_levels) + 1)]) + let lvl += 1 + elseif a:cmdline[i] is# ')' + let lvl -= 1 + call add(ret, [i, i + 1, 'RBP' . ((lvl % g:rainbow_levels) + 1)]) + endif + let i += 1 + endwhile + return ret + endfunction + call input({'prompt':'>','highlight':'RainbowParens'}) < + Highlight function is called at least once for each new + displayed input string, before command-line is redrawn. It is + expected that function is pure for the duration of one input() + call, i.e. it produces the same output for the same input, so + output may be memoized. Function is run like under |:silent| + modifier. If the function causes any errors, it will be + skipped for the duration of the current input() call. + + Currently coloring is disabled when command-line contains + arabic characters. + NOTE: This function must not be used in a startup file, for the versions that only run in GUI mode (e.g., the Win32 GUI). Note: When input() is called from within a mapping it will diff --git a/runtime/doc/filetype.txt b/runtime/doc/filetype.txt index 64d9c6daa9..7f1e98fed4 100644 --- a/runtime/doc/filetype.txt +++ b/runtime/doc/filetype.txt @@ -8,7 +8,7 @@ Filetypes *filetype* *file-type* Also see |autocmd.txt|. - Type <M-]> to see the table of contents. + Type |gO| to see the table of contents. ============================================================================== 1. Filetypes *filetypes* *file-types* @@ -540,7 +540,7 @@ K or CTRL-] Jump to the manpage for the <cWORD> under the cursor. Takes a count for the section. CTRL-T Jump back to the location that the manpage was opened from. -META-] Show the manpage outline in the |location-list|. +gO Show the manpage outline. |gO| q :quit if invoked as $MANPAGER, otherwise :close. Variables: diff --git a/runtime/doc/fold.txt b/runtime/doc/fold.txt index 88dde9f61d..42efb04d7a 100644 --- a/runtime/doc/fold.txt +++ b/runtime/doc/fold.txt @@ -9,7 +9,7 @@ Folding *Folding* *folding* *folds* You can find an introduction on folding in chapter 28 of the user manual. |usr_28.txt| - Type <M-]> to see the table of contents. + Type |gO| to see the table of contents. ============================================================================== 1. Fold methods *fold-methods* diff --git a/runtime/doc/gui.txt b/runtime/doc/gui.txt index b66a60c860..fb05f178ad 100644 --- a/runtime/doc/gui.txt +++ b/runtime/doc/gui.txt @@ -6,7 +6,7 @@ Vim's Graphical User Interface *gui* *GUI* - Type <M-]> to see the table of contents. + Type |gO| to see the table of contents. ============================================================================== 1. Starting the GUI *gui-start* *E229* *E233* diff --git a/runtime/doc/helphelp.txt b/runtime/doc/helphelp.txt index 5948b24667..d86a95e854 100644 --- a/runtime/doc/helphelp.txt +++ b/runtime/doc/helphelp.txt @@ -6,7 +6,7 @@ Help on help files *helphelp* - Type <M-]> to see the table of contents. + Type |gO| to see the table of contents. ============================================================================== 1. Help commands *online-help* @@ -23,7 +23,7 @@ Help on help files *helphelp* The 'helplang' option is used to select a language, if the main help file is available in several languages. - Type <M-]> to see the table of contents. + Type |gO| to see the table of contents. *{subject}* *E149* *E661* :h[elp] {subject} Like ":help", additionally jump to the tag {subject}. diff --git a/runtime/doc/if_cscop.txt b/runtime/doc/if_cscop.txt index 831b2c9840..e359f2144c 100644 --- a/runtime/doc/if_cscop.txt +++ b/runtime/doc/if_cscop.txt @@ -12,7 +12,7 @@ a cscope query is just like jumping to any tag; it is saved on the tag stack so that with the right keyboard mappings, you can jump back and forth between functions as you normally would with |tags|. - Type <M-]> to see the table of contents. + Type |gO| to see the table of contents. ============================================================================== 1. Cscope introduction *cscope-intro* diff --git a/runtime/doc/if_lua.txt b/runtime/doc/if_lua.txt index 49b4c6dce1..a123041866 100644 --- a/runtime/doc/if_lua.txt +++ b/runtime/doc/if_lua.txt @@ -1,26 +1,26 @@ *if_lua.txt* Nvim - VIM REFERENCE MANUAL by Luis Carvalho + NVIM REFERENCE MANUAL Lua Interface to Nvim *lua* *Lua* - Type <M-]> to see the table of contents. + Type |gO| to see the table of contents. ============================================================================== -1. Importing modules *lua-require* +Importing modules *lua-require* -Neovim lua interface automatically adjusts `package.path` and `package.cpath` -according to effective &runtimepath value. Adjustment happens after -'runtimepath' is changed. `package.path` is adjusted by simply appending -`/lua/?.lua` and `/lua/?/init.lua` to each directory from 'runtimepath' (`/` -is actually the first character of `package.config`). +Nvim automatically adjusts `package.path` and `package.cpath` according to +effective 'runtimepath' value. Adjustment happens whenever 'runtimepath' is +changed. `package.path` is adjusted by simply appending `/lua/?.lua` and +`/lua/?/init.lua` to each directory from 'runtimepath' (`/` is actually the +first character of `package.config`). -Similarly to `package.path`, modified directories from `runtimepath` are also -added to `package.cpath`. In this case, instead of appending `/lua/?.lua` and -`/lua/?/init.lua` to each runtimepath, all unique `?`-containing suffixes of -the existing `package.cpath` are used. Here is an example: +Similarly to `package.path`, modified directories from 'runtimepath' are also +added to `package.cpath`. In this case, instead of appending `/lua/?.lua` and +`/lua/?/init.lua` to each runtimepath, all unique `?`-containing suffixes of +the existing `package.cpath` are used. Example: 1. Given that - 'runtimepath' contains `/foo/bar,/xxx;yyy/baz,/abc`; @@ -61,7 +61,7 @@ paths when path is removed from 'runtimepath', adding paths when they are added and reordering `package.path`/`package.cpath` content if 'runtimepath' was reordered. -Note 2: even though adjustments happens automatically Neovim does not track +Note 2: even though adjustments happens automatically Nvim does not track current values of `package.path` or `package.cpath`. If you happened to delete some paths from there you need to reset 'runtimepath' to make them readded. Just running `let &runtimepath = &runtimepath` should work. @@ -72,7 +72,7 @@ badly written plugins using shell which will not work with paths containing semicolons it is better to not have them in 'runtimepath' at all. ------------------------------------------------------------------------------ -1.1. Example of the plugin which uses lua modules: *lua-require-example* +Example of a plugin that uses lua modules *lua-require-example* The following example plugin adds a command `:MakeCharBlob` which transforms current buffer into a long `unsigned char` array. Lua contains transformation @@ -149,7 +149,7 @@ lua/charblob.lua: > } ============================================================================== -2. Commands *lua-commands* +Commands *lua-commands* *:lua* :[range]lua {chunk} @@ -157,7 +157,7 @@ lua/charblob.lua: > Examples: > - :lua vim.api.nvim_command('echo "Hello, Neovim!"') + :lua vim.api.nvim_command('echo "Hello, Nvim!"') < :[range]lua << {endmarker} @@ -230,22 +230,34 @@ All these commands execute a Lua chunk from either the command line (:lua and :luado) or a file (:luafile) with the given line [range]. Similarly to the Lua interpreter, each chunk has its own scope and so only global variables are shared between command calls. All Lua default libraries are available. In -addition, Lua "print" function has its output redirected to the Vim message +addition, Lua "print" function has its output redirected to the Nvim message area, with arguments separated by a white space instead of a tab. -Lua uses the "vim" module (see |lua-vim|) to issue commands to Neovim +Lua uses the "vim" module (see |lua-vim|) to issue commands to Nvim and manage buffers (|lua-buffer|) and windows (|lua-window|). However, procedures that alter buffer content, open new buffers, and change cursor position are restricted when the command is executed in the |sandbox|. ============================================================================== -2. The vim module *lua-vim* +The vim module *lua-vim* -Lua interfaces Vim through the "vim" module. Currently it only has `api` -submodule and some Neovim-specific utility values which is a table with all -API functions. Descriptions of the API functions may be found in |api.txt|. -Description of other utilities is below: +Lua interfaces Nvim through the "vim" module. Currently it has the `api` +submodule and some Nvim-specific utilities. + +------------------------------------------------------------------------------ +vim.api.* functions + +`vim.api` exposes the Nvim |API| as a table of Lua functions. All functions +are available. + +For example, to use the "nvim_get_current_line()" API function, call +"vim.api.nvim_get_current_line()": > + + print(tostring(vim.api.nvim_get_current_line())) + +------------------------------------------------------------------------------ +vim.* utility functions vim.stricmp(a, b) *lua-vim.stricmp* Function used for case-insensitive string comparison. Takes two @@ -263,8 +275,8 @@ vim.val_idx *lua-vim.val_idx* Value index for tables representing |Float|s. A table representing floating-point value 1.0 looks like this: > { - [vim.type_idx] = vim.types.float, - [vim.val_idx] = 1.0, + [vim.type_idx] = vim.types.float, + [vim.val_idx] = 1.0, } < See also |lua-vim.type_idx| and |lua-special-tbl|. @@ -288,10 +300,10 @@ vim.types *lua-vim.types* only contain values for these three types. ============================================================================== -3. The luaeval function *lua-luaeval* *lua-eval* +The luaeval function *lua-luaeval* *lua-eval* *luaeval()* -The (dual) equivalent of "vim.eval" for passing Lua values to Vim is +The (dual) equivalent of "vim.eval" for passing Lua values to Nvim is "luaeval". "luaeval" takes an expression string and an optional argument used for _A inside expression and returns the result of the expression. It is semantically equivalent in Lua to: @@ -303,7 +315,7 @@ semantically equivalent in Lua to: end Note that "_A" receives the argument to "luaeval". Lua nils, numbers, strings, -tables and booleans are converted to their Vim respective types. An error is +tables and booleans are converted to their respective VimL types. An error is thrown if conversion of any of the remaining Lua types is attempted. Note 2: lua tables are used as both dictionaries and lists, thus making it diff --git a/runtime/doc/if_pyth.txt b/runtime/doc/if_pyth.txt index 8baa2d309b..8940e69092 100644 --- a/runtime/doc/if_pyth.txt +++ b/runtime/doc/if_pyth.txt @@ -8,7 +8,7 @@ The Python Interface to Vim *python* *Python* See |provider-python| for more information. {Nvim} - Type <M-]> to see the table of contents. + Type |gO| to see the table of contents. ============================================================================== 1. Commands *python-commands* diff --git a/runtime/doc/if_ruby.txt b/runtime/doc/if_ruby.txt index 54d81a958d..a657d88a44 100644 --- a/runtime/doc/if_ruby.txt +++ b/runtime/doc/if_ruby.txt @@ -10,7 +10,7 @@ The Ruby Interface to Vim *ruby* *Ruby* The home page for ruby is http://www.ruby-lang.org/. You can find links for downloading Ruby there. - Type <M-]> to see the table of contents. + Type |gO| to see the table of contents. ============================================================================== 1. Commands *ruby-commands* diff --git a/runtime/doc/indent.txt b/runtime/doc/indent.txt index 8e17de3fb0..cf45ec4f38 100644 --- a/runtime/doc/indent.txt +++ b/runtime/doc/indent.txt @@ -6,7 +6,7 @@ This file is about indenting C programs and other files. - Type <M-]> to see the table of contents. + Type |gO| to see the table of contents. ============================================================================== 1. Indenting C style programs *C-indenting* diff --git a/runtime/doc/index.txt b/runtime/doc/index.txt index c15587cffd..ad93dcb000 100644 --- a/runtime/doc/index.txt +++ b/runtime/doc/index.txt @@ -15,7 +15,7 @@ For an overview of built-in functions see |functions|. For a list of Vim variables see |vim-variable|. For a complete listing of all help items see |help-tags|. - Type <M-]> to see the table of contents. + Type |gO| to see the table of contents. ============================================================================== 1. Insert mode *insert-index* diff --git a/runtime/doc/insert.txt b/runtime/doc/insert.txt index 9219f45c83..9ef58fa54c 100644 --- a/runtime/doc/insert.txt +++ b/runtime/doc/insert.txt @@ -16,7 +16,7 @@ user manual |usr_24.txt|. Also see 'virtualedit', for moving the cursor to positions where there is no character. Useful for editing a table. - Type <M-]> to see the table of contents. + Type |gO| to see the table of contents. ============================================================================== 1. Special keys *ins-special-keys* diff --git a/runtime/doc/intro.txt b/runtime/doc/intro.txt index b9cc94ce5f..90b0ff7da3 100644 --- a/runtime/doc/intro.txt +++ b/runtime/doc/intro.txt @@ -6,7 +6,7 @@ Introduction to Vim *ref* *reference* - Type <M-]> to see the table of contents. + Type |gO| to see the table of contents. ============================================================================== 1. Introduction *intro* diff --git a/runtime/doc/job_control.txt b/runtime/doc/job_control.txt index edbc1bca81..2cf48f0f4f 100644 --- a/runtime/doc/job_control.txt +++ b/runtime/doc/job_control.txt @@ -6,7 +6,7 @@ Nvim's facilities for job control *job-control* - Type <M-]> to see the table of contents. + Type |gO| to see the table of contents. ============================================================================== 1. Introduction *job-control-intro* diff --git a/runtime/doc/map.txt b/runtime/doc/map.txt index 944f7474be..e78b4cc942 100644 --- a/runtime/doc/map.txt +++ b/runtime/doc/map.txt @@ -9,7 +9,7 @@ Key mapping, abbreviations and user-defined commands. This subject is introduced in sections |05.3|, |24.7| and |40.1| of the user manual. - Type <M-]> to see the table of contents. + Type |gO| to see the table of contents. ============================================================================== 1. Key mapping *key-mapping* *mapping* *macro* diff --git a/runtime/doc/mbyte.txt b/runtime/doc/mbyte.txt index 2e2ca92656..531629fddc 100644 --- a/runtime/doc/mbyte.txt +++ b/runtime/doc/mbyte.txt @@ -14,7 +14,7 @@ For an introduction to the most common features, see |usr_45.txt| in the user manual. For changing the language of messages and menus see |mlang.txt|. - Type <M-]> to see the table of contents. + Type |gO| to see the table of contents. ============================================================================== Getting started *mbyte-first* diff --git a/runtime/doc/message.txt b/runtime/doc/message.txt index c6c6f49026..904b9dfce4 100644 --- a/runtime/doc/message.txt +++ b/runtime/doc/message.txt @@ -8,7 +8,7 @@ This file contains an alphabetical list of messages and error messages that Vim produces. You can use this if you don't understand what the message means. It is not complete though. - Type <M-]> to see the table of contents. + Type |gO| to see the table of contents. ============================================================================== 1. Old messages *:messages* *:mes* *message-history* @@ -449,12 +449,6 @@ changed. To avoid the message reset the 'warn' option. Something inside Vim went wrong and resulted in a NULL pointer. If you know how to reproduce this problem, please report it. |bugs| - *E172* > - Only one file name allowed - -The ":edit" command only accepts one file name. When you want to specify -several files for editing use ":next" |:next|. - *E41* *E82* *E83* *E342* > Out of memory! Out of memory! (allocating {number} bytes) diff --git a/runtime/doc/mlang.txt b/runtime/doc/mlang.txt index 717ec9530c..6453a96877 100644 --- a/runtime/doc/mlang.txt +++ b/runtime/doc/mlang.txt @@ -11,7 +11,7 @@ multi-byte text see |multibyte|. The basics are explained in the user manual: |usr_45.txt|. - Type <M-]> to see the table of contents. + Type |gO| to see the table of contents. ============================================================================== 1. Messages *multilang-messages* diff --git a/runtime/doc/motion.txt b/runtime/doc/motion.txt index 99aa76bfe5..81137b6069 100644 --- a/runtime/doc/motion.txt +++ b/runtime/doc/motion.txt @@ -26,7 +26,7 @@ The 'virtualedit' option can be set to make it possible to move the cursor to positions where there is no character or within a multi-column character (like a tab). - Type <M-]> to see the table of contents. + Type |gO| to see the table of contents. ============================================================================== 1. Motions and operators *operator* @@ -886,6 +886,7 @@ was made yet in the current file. then the position can be near the end of what the command changed. For example when inserting a word, the position will be on the last character. + To jump to older changes use |g;|. *'(* *`(* '( `( To the start of the current sentence, like the |(| diff --git a/runtime/doc/msgpack_rpc.txt b/runtime/doc/msgpack_rpc.txt index 856476c6ae..98a74ccfd6 100644 --- a/runtime/doc/msgpack_rpc.txt +++ b/runtime/doc/msgpack_rpc.txt @@ -6,7 +6,7 @@ RPC API for Nvim *RPC* *rpc* *msgpack-rpc* - Type <M-]> to see the table of contents. + Type |gO| to see the table of contents. ============================================================================== 1. Introduction *rpc-intro* diff --git a/runtime/doc/nvim.txt b/runtime/doc/nvim.txt index f3f4305ad5..2420227f6c 100644 --- a/runtime/doc/nvim.txt +++ b/runtime/doc/nvim.txt @@ -15,7 +15,7 @@ Nvim is emphatically a fork of Vim, not a clone: compatibility with Vim is maintained where possible. See |vim_diff.txt| for the complete reference of differences from Vim. - Type <M-]> to see the table of contents. + Type |gO| to see the table of contents. ============================================================================== Transitioning from Vim *nvim-from-vim* diff --git a/runtime/doc/nvim_terminal_emulator.txt b/runtime/doc/nvim_terminal_emulator.txt index 4527a14710..9dae69ae26 100644 --- a/runtime/doc/nvim_terminal_emulator.txt +++ b/runtime/doc/nvim_terminal_emulator.txt @@ -18,7 +18,7 @@ Terminal buffers behave like normal buffers, except: closing the terminal buffer. - 'bufhidden' defaults to "hide". - Type <M-]> to see the table of contents. + Type |gO| to see the table of contents. ============================================================================== Start *terminal-start* diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt index c6965648ef..4df08ca5fb 100644 --- a/runtime/doc/options.txt +++ b/runtime/doc/options.txt @@ -14,7 +14,7 @@ achieve special effects. These options come in three forms: number has a numeric value string has a string value - Type <M-]> to see the table of contents. + Type |gO| to see the table of contents. ============================================================================== 1. Setting options *set-option* *E764* @@ -187,7 +187,7 @@ opt+=val" the expansion is done before the adding or removing. Handling of local options *local-options* Some of the options only apply to a window or buffer. Each window or buffer -has its own copy of this option, thus can each have their own value. This +has its own copy of this option, thus each can have its own value. This allows you to set 'list' in one window but not in another. And set 'shiftwidth' to 3 in one buffer and 4 in another. @@ -3017,6 +3017,8 @@ A jump table for the options with a short description can be found at |Q_op|. The format of this option is like that of 'statusline'. 'guitabtooltip' is used for the tooltip, see below. + The expression will be evaluated in the |sandbox| when set from a + modeline, see |sandbox-option|. Only used when the GUI tab pages line is displayed. 'e' must be present in 'guioptions'. For the non-GUI tab pages line 'tabline' is @@ -4482,6 +4484,8 @@ A jump table for the options with a short description can be found at |Q_op|. and |+postscript| features} Expression used to print the PostScript produced with |:hardcopy|. See |pexpr-option|. + This option cannot be set from a |modeline| or in the |sandbox|, for + security reasons. *'printfont'* *'pfn'* 'printfont' 'pfn' string (default "courier") @@ -6267,11 +6271,11 @@ A jump table for the options with a short description can be found at |Q_op|. when part of a command has been typed. *'title'* *'notitle'* -'title' boolean (default off, on when title can be restored) +'title' boolean (default off) global When on, the title of the window will be set to the value of 'titlestring' (if it is not empty), or to: - filename [+=-] (path) - VIM + filename [+=-] (path) - NVIM Where: filename the name of the file being edited - indicates the file cannot be modified, 'ma' off @@ -6279,7 +6283,7 @@ A jump table for the options with a short description can be found at |Q_op|. = indicates the file is read-only =+ indicates the file is read-only and modified (path) is the path of the file being edited - - VIM the server name |v:servername| or "VIM" + - NVIM the server name |v:servername| or "NVIM" *'titlelen'* 'titlelen' number (default 85) @@ -6295,11 +6299,10 @@ A jump table for the options with a short description can be found at |Q_op|. 'titlelen' is also used for the 'titlestring' option. *'titleold'* -'titleold' string (default "Thanks for flying Vim") +'titleold' string (default "") global - This option will be used for the window title when exiting Vim if the - original title cannot be restored. Only happens if 'title' is on or - 'titlestring' is not empty. + If not empty, this option will be used to set the window title when + exiting. Only if 'title' is enabled. This option cannot be set from a |modeline| or in the |sandbox|, for security reasons. *'titlestring'* @@ -6748,19 +6751,19 @@ A jump table for the options with a short description can be found at |Q_op|. *'winhighlight'* *'winhl'* 'winhighlight' 'winhl' string (default empty) local to window - Window-local highlights. Comma-delimited list of |group-name| pairs - "{hl-builtin}:{hl-group},..." where each {hl-builtin} is a group (from - |highlight-groups|) to be overridden by {hl-group} in the window where - this option was set. Only builting ui highlights are supported, not - syntax highlighting. For that purpose, use |:ownsyntax|. + Window-local highlights. Comma-delimited list of highlight + |group-name| pairs "{hl-builtin}:{hl},..." where each {hl-builtin} is + a built-in |highlight-groups| item to be overridden by {hl} group in + the window. Only built-in |highlight-groups| are supported, not + syntax highlighting (use |:ownsyntax| for that). - Most highlights occuring within the frame of a window are supported. Highlights of vertical separators are determined by the window to the left of the separator. The highlight of a tabpage in |tabline| is - determined by the last focused window in the tabpage. Highlights of + determine by the last-focused window of the tabpage. Highlights of the popupmenu are determined by the current window. Highlights in the - message area are not overridable. Example for overriding the - backgrond color: > + message area cannot be overridden. + + Example: show a different color for non-current windows: > set winhighlight=Normal:MyNormal,NormalNC:MyNormalNC < *'winfixheight'* *'wfh'* *'nowinfixheight'* *'nowfh'* diff --git a/runtime/doc/pattern.txt b/runtime/doc/pattern.txt index f7f561dfa5..8243a3ca7d 100644 --- a/runtime/doc/pattern.txt +++ b/runtime/doc/pattern.txt @@ -9,7 +9,7 @@ Patterns and search commands *pattern-searches* The very basics can be found in section |03.9| of the user manual. A few more explanations are in chapter 27 |usr_27.txt|. - Type <M-]> to see the table of contents. + Type |gO| to see the table of contents. ============================================================================== 1. Search commands *search-commands* diff --git a/runtime/doc/pi_health.txt b/runtime/doc/pi_health.txt index 8354c0470f..99ff519bb9 100644 --- a/runtime/doc/pi_health.txt +++ b/runtime/doc/pi_health.txt @@ -2,53 +2,45 @@ Author: TJ DeVries <devries.timothyj@gmail.com> - Type <M-]> to see the table of contents. + Type |gO| to see the table of contents. ============================================================================== -Introduction *healthcheck* *health.vim-intro* +Introduction *health* -Troubleshooting user configuration problems is a time-consuming task that -developers want to minimize. health.vim provides a simple framework for plugin -authors to hook into, and for users to invoke, to check and report the user's -configuration and environment. Type this command to try it: > +health.vim is a minimal framework to help with troubleshooting user +configuration. Nvim ships with healthchecks for configuration, performance, +python support, ruby support, clipboard support, and more. - :CheckHealth -< -For example, some users have broken or unusual Python setups, which breaks the -|:python| command. |:CheckHealth| detects several common Python configuration -problems and reports them. If the Neovim Python module is not installed, it -shows a warning: > +To run the healthchecks, use this command: > - You have not installed the Neovim Python module - You might want to try `pip install Neovim` -< -Plugin authors are encouraged to add healthchecks, see |health.vim-dev|. + :checkhealth +< +Plugin authors are encouraged to write new healthchecks. |health-dev| ============================================================================== -Commands and functions *health.vim-manual* - -Commands ------------------------------------------------------------------------------- - *:CheckHealth* -:CheckHealth Run all healthchecks and show the output in a new - tabpage. These healthchecks are included by default: - - python2 - - python3 - - ruby - - remote plugin - -:CheckHealth {plugins} - Run healthchecks for one or more plugins. E.g. to run +Commands *health-commands* + + *:checkhealth* *:CheckHealth* +:checkhealth Run all healthchecks. + *E5009* + Nvim depends on the |$VIMRUNTIME| environment variable + to find the standard "runtime files" for syntax + highlighting, filetype-specific behavior, and standard + plugins such as :checkhealth. If $VIMRUNTIME is invalid + then those features will not work. + +:checkhealth {plugins} + Run healthcheck(s) for one or more plugins. E.g. to run only the standard Nvim healthcheck: > - :CheckHealth nvim + :checkhealth nvim < To run the healthchecks for the "foo" and "bar" plugins (assuming these plugins are on your 'runtimepath' and they have implemented health#foo#check() and health#bar#check(), respectively): > - :CheckHealth foo bar + :checkhealth foo bar < -Functions ------------------------------------------------------------------------------- +============================================================================== +Functions *health-functions* health.vim functions are for creating new healthchecks. They mostly just do some layout and formatting, to give users a consistent presentation. @@ -59,51 +51,49 @@ health#report_start({name}) *health#report_start* per section. health#report_info({msg}) *health#report_info* - Displays an informational message. + Reports an informational message. health#report_ok({msg}) *health#report_ok* - Displays a "success" message. + Reports a "success" message. -health#report_warn({msg}, [{suggestions}]) *health#report_warn* - Displays a warning. {suggestions} is an optional List of suggestions. +health#report_warn({msg}, [{advice}]) *health#report_warn* + Reports a warning. {advice} is an optional List of suggestions. -health#report_error({msg}, [{suggestions}]) *health#report_error* - Displays an error. {suggestions} is an optional List of suggestions. +health#report_error({msg}, [{advice}]) *health#report_error* + Reports an error. {advice} is an optional List of suggestions. health#{plugin}#check() *health.user_checker* - This is the form of a healthcheck definition. Call the above functions - from this function, then |:CheckHealth| does the rest. Example: > + Healthcheck function for {plugin}. Called by |:checkhealth| + automatically. Example: > function! health#my_plug#check() abort silent call s:check_environment_vars() silent call s:check_python_configuration() endfunction < - The function will be found and called automatically when the user - invokes |:CheckHealth|. - All output will be captured from the healthcheck. Use the health#report_* functions so that your healthcheck has a format consistent with the standard healthchecks. ============================================================================== -Create a healthcheck *health.vim-dev* +Create a healthcheck *health-dev* -Healthchecks are functions that check the health of the system. Neovim has -built-in checkers, found in $VIMRUNTIME/autoload/health/. +Healthchecks are functions that check the user environment, configuration, +etc. Nvim has built-in healthchecks in $VIMRUNTIME/autoload/health/. -To add a new checker for your own plugin, simply define a +To add a new healthcheck for your own plugin, simply define a health#{plugin}#check() function in autoload/health/{plugin}.vim. -|:CheckHealth| automatically finds and invokes such functions. +|:checkhealth| automatically finds and invokes such functions. -If your plugin is named "jslint", then its healthcheck function must be > - health#jslint#check() +If your plugin is named "foo", then its healthcheck function must be > + health#foo#check() defined in this file on 'runtimepath': > - autoload/health/jslint.vim + autoload/health/foo.vim -Here's a sample to get started: > - function! health#jslint#check() abort +Copy this sample code into autoload/health/foo.vim and replace "foo" with your +plugin name: > + function! health#foo#check() abort call health#report_start('sanity checks') " perform arbitrary checks " ... @@ -111,8 +101,8 @@ Here's a sample to get started: > if looks_good call health#report_ok('found required dependencies') else - call health#report_error('cannot find jslint', - \ ['npm install --save jslint']) + call health#report_error('cannot find foo', + \ ['npm install --save foo']) endif endfunction diff --git a/runtime/doc/print.txt b/runtime/doc/print.txt index 01de3a5290..72625a450a 100644 --- a/runtime/doc/print.txt +++ b/runtime/doc/print.txt @@ -6,7 +6,7 @@ Printing *printing* - Type <M-]> to see the table of contents. + Type |gO| to see the table of contents. ============================================================================== 1. Introduction *print-intro* diff --git a/runtime/doc/provider.txt b/runtime/doc/provider.txt index 50307ccbf3..02f3fcab6c 100644 --- a/runtime/doc/provider.txt +++ b/runtime/doc/provider.txt @@ -8,7 +8,7 @@ Providers *provider* Nvim delegates some features to dynamic "providers". - Type <M-]> to see the table of contents. + Type |gO| to see the table of contents. ============================================================================== Python integration *provider-python* @@ -20,7 +20,7 @@ Note: Only the Vim 7.3 API is supported; bindeval (Vim 7.4) is not. PYTHON QUICKSTART ~ If you used a package manager to install Nvim, you might already have the -required `neovim` Python package. Run |:CheckHealth| to see if your system is +required `neovim` Python package. Run |:checkhealth| to see if your system is up-to-date. Following are steps to install the package with Python's `pip` tool. @@ -88,7 +88,7 @@ Ruby integration *provider-ruby* Nvim supports the Vim legacy |ruby-vim| interface via external Ruby interpreters connected via |RPC|. -Run |:CheckHealth| to see if your system is up-to-date. +Run |:checkhealth| to see if your system is up-to-date. RUBY QUICKSTART ~ diff --git a/runtime/doc/quickfix.txt b/runtime/doc/quickfix.txt index cad5bf98b5..a647318347 100644 --- a/runtime/doc/quickfix.txt +++ b/runtime/doc/quickfix.txt @@ -6,7 +6,7 @@ This subject is introduced in section |30.1| of the user manual. - Type <M-]> to see the table of contents. + Type |gO| to see the table of contents. ============================================================================= 1. Using QuickFix commands *quickfix* *Quickfix* *E42* @@ -138,11 +138,15 @@ processing a quickfix or location list command, it will be aborted. current window is used instead of the quickfix list. *:cq* *:cquit* -:cq[uit][!] Quit Vim with an error code, so that the compiler - will not compile the same file again. - WARNING: All changes in files are lost! Also when the - [!] is not used. It works like ":qall!" |:qall|, - except that Vim returns a non-zero exit code. +:[count]cq[uit] Quit Nvim with an error code, or the code specified in + [count]. Useful when Nvim is called from another + program: e.g. `git commit` will abort the comitting + process, `fc` (built-in for shells like bash and zsh) + will not execute the command. + + WARNING: All changes in files are lost. It works like + ":qall!" |:qall|, except that Nvim exits non-zero or + [count]. *:cf* *:cfile* :cf[ile][!] [errorfile] Read the error file and jump to the first error. @@ -1534,4 +1538,4 @@ by Vim. - vim:tw=78:ts=8:ft=help:norl: + vim:noet:tw=78:ts=8:ft=help:norl: diff --git a/runtime/doc/recover.txt b/runtime/doc/recover.txt index 2b49af1c96..0533157072 100644 --- a/runtime/doc/recover.txt +++ b/runtime/doc/recover.txt @@ -15,7 +15,7 @@ You can recover most of your changes from the files that Vim uses to store the contents of the file. Mostly you can recover your work with one command: vim -r filename - Type <M-]> to see the table of contents. + Type |gO| to see the table of contents. ============================================================================== 1. The swap file *swap-file* diff --git a/runtime/doc/remote.txt b/runtime/doc/remote.txt index bdc763b85f..67bfb0b48e 100644 --- a/runtime/doc/remote.txt +++ b/runtime/doc/remote.txt @@ -6,7 +6,7 @@ Vim client-server communication *client-server* - Type <M-]> to see the table of contents. + Type |gO| to see the table of contents. ============================================================================== 1. Common functionality *clientserver* diff --git a/runtime/doc/remote_plugin.txt b/runtime/doc/remote_plugin.txt index cc2efd3d1f..eeb9cf8150 100644 --- a/runtime/doc/remote_plugin.txt +++ b/runtime/doc/remote_plugin.txt @@ -6,7 +6,7 @@ Nvim support for remote plugins *remote-plugin* - Type <M-]> to see the table of contents. + Type |gO| to see the table of contents. ============================================================================== 1. Introduction *remote-plugin-intro* diff --git a/runtime/doc/repeat.txt b/runtime/doc/repeat.txt index 0b3edc9bba..421ebab100 100644 --- a/runtime/doc/repeat.txt +++ b/runtime/doc/repeat.txt @@ -8,7 +8,7 @@ Repeating commands, Vim scripts and debugging *repeating* Chapter 26 of the user manual introduces repeating |usr_26.txt|. - Type <M-]> to see the table of contents. + Type |gO| to see the table of contents. ============================================================================== 1. Single repeats *single-repeat* diff --git a/runtime/doc/russian.txt b/runtime/doc/russian.txt index e2c44ce54f..8c6076146c 100644 --- a/runtime/doc/russian.txt +++ b/runtime/doc/russian.txt @@ -6,7 +6,7 @@ Russian language localization and support in Vim *russian* *Russian* - Type <M-]> to see the table of contents. + Type |gO| to see the table of contents. =============================================================================== 1. Introduction *russian-intro* diff --git a/runtime/doc/scroll.txt b/runtime/doc/scroll.txt index 52e5cc9f0c..56af9ab75e 100644 --- a/runtime/doc/scroll.txt +++ b/runtime/doc/scroll.txt @@ -16,7 +16,7 @@ upwards in the buffer, the text in the window moves downwards on your screen. See section |03.7| of the user manual for an introduction. - Type <M-]> to see the table of contents. + Type |gO| to see the table of contents. ============================================================================== 1. Scrolling downwards *scroll-down* diff --git a/runtime/doc/sign.txt b/runtime/doc/sign.txt index ced0608e8a..977d73b7b2 100644 --- a/runtime/doc/sign.txt +++ b/runtime/doc/sign.txt @@ -7,7 +7,7 @@ Sign Support Features *sign-support* - Type <M-]> to see the table of contents. + Type |gO| to see the table of contents. ============================================================================== 1. Introduction *sign-intro* *signs* diff --git a/runtime/doc/spell.txt b/runtime/doc/spell.txt index 5c99db42ba..f2be25097c 100644 --- a/runtime/doc/spell.txt +++ b/runtime/doc/spell.txt @@ -6,7 +6,7 @@ Spell checking *spell* - Type <M-]> to see the table of contents. + Type |gO| to see the table of contents. ============================================================================== 1. Quick start *spell-quickstart* *E756* diff --git a/runtime/doc/starting.txt b/runtime/doc/starting.txt index 4cfc98d5b6..7aba84b454 100644 --- a/runtime/doc/starting.txt +++ b/runtime/doc/starting.txt @@ -6,7 +6,7 @@ Starting Vim *starting* - Type <M-]> to see the table of contents. + Type |gO| to see the table of contents. ============================================================================== 1. Vim arguments *vim-arguments* @@ -633,54 +633,40 @@ though. ============================================================================== 3. $VIM and $VIMRUNTIME *$VIM* -The environment variable "$VIM" is used to locate various user files for Vim, +The environment variable "$VIM" is used to locate various user files for Nvim, such as the user startup script |init.vim|. This depends on the system, see |startup|. -To avoid the need for every user to set the $VIM environment variable, Vim -will try to get the value for $VIM in this order: -1. The value defined by the $VIM environment variable. You can use this to - make Vim look in a specific directory for its support files. Example: > - setenv VIM /home/paul/vim -2. The path from 'helpfile' is used, unless it contains some environment - variable too (the default is "$VIMRUNTIME/doc/help.txt": chicken-egg - problem). The file name ("help.txt" or any other) is removed. Then - trailing directory names are removed, in this order: "doc", "runtime" and - "vim{version}" (e.g., "vim54"). -3. For MSDOS and Win32 Vim tries to use the directory name of the - executable. If it ends in "/src", this is removed. This is useful if you - unpacked the .zip file in some directory, and adjusted the search path to - find the vim executable. Trailing directory names are removed, in this - order: "runtime" and "vim{version}" (e.g., "vim54"). -4. For Unix the compile-time defined installation directory is used (see the - output of ":version"). - -Once Vim has done this once, it will set the $VIM environment variable. To -change it later, use a ":let" command like this: > - :let $VIM = "/home/paul/vim/" -< +Nvim will try to get the value for $VIM in this order: + +1. Environment variable $VIM, if it is set. +2. Path derived from the 'helpfile' option, unless it contains some + environment variable too (default is "$VIMRUNTIME/doc/help.txt"). File + name ("help.txt", etc.) is removed. Trailing directory names are removed, + in this order: "doc", "runtime". +3. Path derived from the location of the `nvim` executable. +4. Compile-time defined installation directory (see output of ":version"). + +After doing this once, Nvim sets the $VIM environment variable. + *$VIMRUNTIME* The environment variable "$VIMRUNTIME" is used to locate various support -files, such as the on-line documentation and files used for syntax -highlighting. For example, the main help file is normally -"$VIMRUNTIME/doc/help.txt". -You don't normally set $VIMRUNTIME yourself, but let Vim figure it out. This -is the order used to find the value of $VIMRUNTIME: -1. If the environment variable $VIMRUNTIME is set, it is used. You can use - this when the runtime files are in an unusual location. -2. If "$VIM/vim{version}" exists, it is used. {version} is the version - number of Vim, without any '-' or '.'. For example: "$VIM/vim54". This is - the normal value for $VIMRUNTIME. -3. If "$VIM/runtime" exists, it is used. -4. The value of $VIM is used. This is for backwards compatibility with older - versions. +files, such as the documentation and syntax-highlighting files. For example, +the main help file is normally "$VIMRUNTIME/doc/help.txt". + +Nvim will try to get the value for $VIMRUNTIME in this order: + +1. Environment variable $VIMRUNTIME, if it is set. +2. Directory path "$VIM/vim{version}", if it exists, where {version} is the + Vim version number without '-' or '.'. For example: "$VIM/vim54". +3. Directory path "$VIM/runtime", if it exists. +4. Value of $VIM environment variable. This is for backwards compatibility + with older Vim versions. 5. If "../share/nvim/runtime" exists relative to |v:progpath|, it is used. -6. When the 'helpfile' option is set and doesn't contain a '$', its value is - used, with "doc/help.txt" removed from the end. +6. Path derived from the 'helpfile' option (if it doesn't contain '$') with + "doc/help.txt" removed from the end. -Once Vim has done this once, it will set the $VIMRUNTIME environment variable. -To change it later, use a ":let" command like this: > - :let $VIMRUNTIME = "/home/piet/vim/vim54" +After doing this once, Nvim sets the $VIMRUNTIME environment variable. In case you need the value of $VIMRUNTIME in a shell (e.g., for a script that greps in the help files) you might be able to use this: > diff --git a/runtime/doc/syntax.txt b/runtime/doc/syntax.txt index fd17e3b381..cbaa2916e6 100644 --- a/runtime/doc/syntax.txt +++ b/runtime/doc/syntax.txt @@ -20,7 +20,7 @@ In the User Manual: |usr_06.txt| introduces syntax highlighting. |usr_44.txt| introduces writing a syntax file. - Type <M-]> to see the table of contents. + Type |gO| to see the table of contents. ============================================================================== 1. Quick start *:syn-qstart* @@ -3270,11 +3270,10 @@ improve screen updating rates (see |:syn-sync| for more on this). > The g:vimsyn_embed option allows users to select what, if any, types of embedded script highlighting they wish to have. > - g:vimsyn_embed == 0 : don't embed any scripts - g:vimsyn_embed =~ 'P' : support embedded python + g:vimsyn_embed == 0 : disable (don't embed any scripts) + g:vimsyn_embed == 'lPr' : support embedded lua, python and ruby < -By default, g:vimsyn_embed is a string supporting interpreters that your vim -itself supports. +This option is disabled by default. *g:vimsyn_folding* Some folding is now supported with syntax/vim.vim: > diff --git a/runtime/doc/tabpage.txt b/runtime/doc/tabpage.txt index 8f1eb9d8cd..6be7cf9746 100644 --- a/runtime/doc/tabpage.txt +++ b/runtime/doc/tabpage.txt @@ -10,7 +10,7 @@ The commands which have been added to use multiple tab pages are explained here. Additionally, there are explanations for commands that work differently when used in combination with more than one tab page. - Type <M-]> to see the table of contents. + Type |gO| to see the table of contents. ============================================================================== 1. Introduction *tab-page-intro* diff --git a/runtime/doc/tagsrch.txt b/runtime/doc/tagsrch.txt index d5a4f4e627..1ceb602512 100644 --- a/runtime/doc/tagsrch.txt +++ b/runtime/doc/tagsrch.txt @@ -8,7 +8,7 @@ Tags and special searches *tags-and-searches* See section |29.1| of the user manual for an introduction. - Type <M-]> to see the table of contents. + Type |gO| to see the table of contents. ============================================================================== 1. Jump to a tag *tag-commands* diff --git a/runtime/doc/term.txt b/runtime/doc/term.txt index d99f9b7160..a694185fc9 100644 --- a/runtime/doc/term.txt +++ b/runtime/doc/term.txt @@ -10,7 +10,7 @@ Nvim (except in |--headless| mode) uses information about the terminal you are using to present a built-in UI. If that information is not correct, the screen may be messed up or keys may not be recognized. - Type <M-]> to see the table of contents. + Type |gO| to see the table of contents. ============================================================================== Startup *startup-terminal* @@ -41,16 +41,17 @@ $TERM is also important because it is mirrored by SSH to the remote session, unlike other common client-end environment variables ($COLORTERM, $XTERM_VERSION, $VTE_VERSION, $KONSOLE_PROFILE_NAME, $TERM_PROGRAM, ...). - For this terminal Set $TERM to |builtin-terms|? - - iTerm.app "iterm" or "iTerm.app" Y - anything libvte based "vte" or "vte-256color" Y - (e.g. GNOME Terminal) (aliases: "gnome", "gnome-256color") - tmux "tmux" or "tmux-256color" Y - screen "screen" or "screen-256color" Y - PuTTY "putty" or "putty-256color" Y - Terminal.app "nsterm" N - Linux virtual terminal "linux" or "linux-256color" Y + For this terminal Set $TERM to |builtin-terms| + ------------------------------------------------------------------------- + iTerm (original) iterm, iTerm.app N + iTerm2 (new capabilities) iterm2, iTerm2.app Y + anything libvte-based vte, vte-256color Y + (e.g. GNOME Terminal) (aliases: gnome, gnome-256color) + tmux tmux, tmux-256color Y + screen screen, screen-256color Y + PuTTY putty, putty-256color Y + Terminal.app nsterm N + Linux virtual terminal linux, linux-256color Y *builtin-terms* *builtin_terms* If a |terminfo| database is not available, or no entry for the terminal type is diff --git a/runtime/doc/tips.txt b/runtime/doc/tips.txt index 0ac9a8303d..011e0f0565 100644 --- a/runtime/doc/tips.txt +++ b/runtime/doc/tips.txt @@ -13,7 +13,7 @@ http://www.vim.org Don't forget to browse the user manual, it also contains lots of useful tips |usr_toc.txt|. - Type <M-]> to see the table of contents. + Type |gO| to see the table of contents. ============================================================================== Editing C programs *C-editing* diff --git a/runtime/doc/undo.txt b/runtime/doc/undo.txt index cbce868cec..f8f6049119 100644 --- a/runtime/doc/undo.txt +++ b/runtime/doc/undo.txt @@ -8,7 +8,7 @@ Undo and redo *undo-redo* The basics are explained in section |02.5| of the user manual. - Type <M-]> to see the table of contents. + Type |gO| to see the table of contents. ============================================================================== 1. Undo and redo commands *undo-commands* diff --git a/runtime/doc/various.txt b/runtime/doc/various.txt index f06c062ee3..9150f3a809 100644 --- a/runtime/doc/various.txt +++ b/runtime/doc/various.txt @@ -6,7 +6,7 @@ Various commands *various* - Type <M-]> to see the table of contents. + Type |gO| to see the table of contents. ============================================================================== 1. Various commands *various-cmds* @@ -212,7 +212,6 @@ g8 Print the hex values of the bytes used in the Equivalent to: > :enew :call termopen('{cmd}') - :startinsert < See |termopen()|. @@ -609,6 +608,13 @@ which it was defined is reported. the keyword. Only works when the highlighted text is not more than one line. + *gO* +gO Show a filetype-specific, navigable "outline" of the + current buffer. For example, in a |help| buffer this + shows the table of contents. + + Currently works in |help| and |:Man| buffers. + [N]gs *gs* *:sl* *:sleep* :[N]sl[eep] [N] [m] Do nothing for [N] seconds. When [m] is included, sleep for [N] milliseconds. The count for "gs" always @@ -647,4 +653,4 @@ LessInitFunc in your vimrc, for example: > endfunc < - vim:tw=78:ts=8:ft=help:norl: + vim:noet:tw=78:ts=8:ft=help:norl: diff --git a/runtime/doc/vi_diff.txt b/runtime/doc/vi_diff.txt index b8bfcaa586..917e0e6f80 100644 --- a/runtime/doc/vi_diff.txt +++ b/runtime/doc/vi_diff.txt @@ -6,7 +6,7 @@ Differences between Vim and Vi *vi-differences* - Type <M-]> to see the table of contents. + Type |gO| to see the table of contents. ============================================================================== 1. Limits *limits* diff --git a/runtime/doc/vim_diff.txt b/runtime/doc/vim_diff.txt index 7f1e5ce543..c92fcd8994 100644 --- a/runtime/doc/vim_diff.txt +++ b/runtime/doc/vim_diff.txt @@ -6,11 +6,10 @@ Differences between Nvim and Vim *vim-differences* -Throughout the help files, differences between Nvim and Vim are indicated via -the "{Nvim}" tag. This document is a complete and centralized list of all -these differences. +Nvim differs from Vim in many ways, big and small. This document is +a complete and centralized reference of those differences. - Type <M-]> to see the table of contents. + Type |gO| to see the table of contents. ============================================================================== 1. Configuration *nvim-configuration* @@ -72,12 +71,18 @@ Clipboard integration |provider-clipboard| USER EXPERIENCE ~ -Working intuitively and consistently is a major goal of Nvim. Examples: +Working intuitively and consistently is a major goal of Nvim. -- Nvim does not have `-X`, a platform-specific option "sometimes" available in - Vim (with potential surprises: http://stackoverflow.com/q/14635295). Nvim - avoids features that cannot be provided on all platforms--instead that is - delegated to external plugins/extensions. + *feature-compile* +- Nvim always includes ALL features, in contrast to Vim (which ships with + various combinations of 100+ optional features). Think of it as a leaner + version of Vim's "HUGE" build. This reduces surface area for bugs, and + removes a common source of confusion and friction for users. + +- Nvim avoids features that cannot be provided on all platforms; instead that + is delegated to external plugins/extensions. E.g. the `-X` platform-specific + option is "sometimes" available in Vim (with potential surprises: + http://stackoverflow.com/q/14635295). - Vim's internal test functions (test_autochdir(), test_settime(), etc.) are not exposed (nor implemented); instead Nvim has a robust API. @@ -95,7 +100,7 @@ by Nvim developers. FEATURES ~ -"Outline": Type <M-]> in |:Man| and |:help| pages to see a document outline. +"Outline": Type |gO| in |:Man| and |:help| pages to see a document outline. |META| (ALT) chords are recognized, even in the terminal. Any |<M-| mapping will work. Some examples: <M-1>, <M-2>, <M-BS>, <M-Del>, <M-Ins>, <M-/>, @@ -122,14 +127,13 @@ Variables: |v:windowid| is always available (for use by external UIs) Commands: - |:CheckHealth| + |:checkhealth| |:drop| is available on all platforms |:Man| is available by default, with many improvements such as completion Functions: |dictwatcheradd()| notifies a callback whenever a |Dict| is modified |dictwatcherdel()| - |execute()| works with |:redir| |menu_get()| |msgpackdump()|, |msgpackparse()| provide msgpack de/serialization @@ -147,6 +151,14 @@ Highlight groups: |hl-TermCursorNC| |hl-Whitespace| highlights 'listchars' whitespace +UI: + *E5408* *E5409* *g:Nvim_color_expr* *g:Nvim_color_cmdline* + Command-line coloring is supported. Only |input()| and |inputdialog()| may + be colored. For testing purposes expressions (e.g. |i_CTRL-R_=|) and regular + command-line (|:|) are colored by callbacks defined in `g:Nvim_color_expr` + and `g:Nvim_color_cmdline` respectively (these callbacks are for testing + only, and will be removed in a future version). + ============================================================================== 4. Changed features *nvim-features-changed* @@ -174,6 +186,8 @@ one. It does not attempt to mix data from the two. |system()| does not support writing/reading "backgrounded" commands. |E5677| +|:redir| nested in |execute()| works. + Nvim may throttle (skip) messages from shell commands (|:!|, |:grep|, |:make|) if there is too much output. No data is lost, this only affects display and makes things faster. |:terminal| output is never throttled. @@ -259,19 +273,24 @@ Lua interface (|if_lua.txt|): - Lua has direct access to Nvim |API| via `vim.api`. - Lua package.path and package.cpath are automatically updated according to 'runtimepath': |lua-require|. -- Currently, most legacy Vim features are missing. -|input()| and |inputdialog()| gained support for each other’s features (return -on cancel and completion respectively) via dictionary argument (replaces all +|input()| and |inputdialog()| support for each other’s features (return on +cancel and completion respectively) via dictionary argument (replaces all other arguments if used). +|input()| and |inputdialog()| support user-defined cmdline highlighting. + +Highlight groups: + |hl-ColorColumn|, |hl-CursorColumn| are lower priority than most other + groups + ============================================================================== 5. Missing legacy features *nvim-features-missing* Some legacy Vim features are not implemented: - |if_py|: vim.bindeval() and vim.Function() are not supported -- |if_lua|: the `vim` object currently only supports `vim.api` +- |if_lua|: the `vim` object is missing most legacy methods - *if_perl* - *if_mzscheme* - *if_tcl* @@ -279,7 +298,7 @@ Some legacy Vim features are not implemented: ============================================================================== 6. Removed features *nvim-features-removed* -These features are in Vim, but have been intentionally removed from Nvim. +These Vim features were intentionally removed from Nvim. *'cp'* *'nocompatible'* *'nocp'* *'compatible'* Nvim is always "non-compatible" with Vi. diff --git a/runtime/doc/visual.txt b/runtime/doc/visual.txt index cf804444e5..6c4d44edb6 100644 --- a/runtime/doc/visual.txt +++ b/runtime/doc/visual.txt @@ -11,7 +11,7 @@ operator. It is the only way to select a block of text. This is introduced in section |04.4| of the user manual. - Type <M-]> to see the table of contents. + Type |gO| to see the table of contents. ============================================================================== 1. Using Visual mode *visual-use* diff --git a/runtime/doc/windows.txt b/runtime/doc/windows.txt index f5d5321a5e..c37362a497 100644 --- a/runtime/doc/windows.txt +++ b/runtime/doc/windows.txt @@ -13,7 +13,7 @@ differently when used in combination with more than one window. The basics are explained in chapter 7 and 8 of the user manual |usr_07.txt| |usr_08.txt|. - Type <M-]> to see the table of contents. + Type |gO| to see the table of contents. ============================================================================== 1. Introduction *windows-intro* *window* @@ -677,6 +677,8 @@ can also get to them with the buffer list commands, like ":bnext". - If the file is not open in a window edit the file in the current window. If the current buffer can't be |abandon|ed, the window is split first. + - Windows that are not in the argument list or are not full + width will be closed if possible. The |argument-list| is set, like with the |:next| command. The purpose of this command is that it can be used from a program that wants Vim to edit another file, e.g., a debugger. diff --git a/runtime/ftplugin/help.vim b/runtime/ftplugin/help.vim index 9d2361b413..e6d48454d9 100644 --- a/runtime/ftplugin/help.vim +++ b/runtime/ftplugin/help.vim @@ -90,7 +90,7 @@ if !exists('g:no_plugin_maps') let w:qf_toc = bufname endfunction - nnoremap <silent><buffer> <M-]> :call <sid>show_toc()<cr> + nnoremap <silent><buffer> gO :call <sid>show_toc()<cr> endif let &cpo = s:cpo_save diff --git a/runtime/ftplugin/man.vim b/runtime/ftplugin/man.vim index 27c8b88e44..e36dfc5a90 100644 --- a/runtime/ftplugin/man.vim +++ b/runtime/ftplugin/man.vim @@ -31,7 +31,7 @@ setlocal nolist setlocal nofoldenable if !exists('g:no_plugin_maps') && !exists('g:no_man_maps') - nnoremap <silent> <buffer> <M-]> :call man#show_toc()<CR> + nnoremap <silent> <buffer> gO :call man#show_toc()<CR> nnoremap <silent> <buffer> <C-]> :Man<CR> nnoremap <silent> <buffer> K :Man<CR> nnoremap <silent> <buffer> <C-T> :call man#pop_tag()<CR> diff --git a/runtime/syntax/c.vim b/runtime/syntax/c.vim index cc99f674a1..16c7ce4d92 100644 --- a/runtime/syntax/c.vim +++ b/runtime/syntax/c.vim @@ -1,7 +1,7 @@ " Vim syntax file " Language: C " Maintainer: Bram Moolenaar <Bram@vim.org> -" Last Change: 2016 Nov 17 +" Last Change: 2016 Nov 18 " Quit when a (custom) syntax file was already loaded if exists("b:current_syntax") @@ -363,23 +363,23 @@ syn match cPreConditMatch display "^\s*\zs\(%:\|#\)\s*\(else\|endif\)\>" if !exists("c_no_if0") syn cluster cCppOutInGroup contains=cCppInIf,cCppInElse,cCppInElse2,cCppOutIf,cCppOutIf2,cCppOutElse,cCppInSkip,cCppOutSkip syn region cCppOutWrapper start="^\s*\zs\(%:\|#\)\s*if\s\+0\+\s*\($\|//\|/\*\|&\)" end=".\@=\|$" contains=cCppOutIf,cCppOutElse,@NoSpell fold - syn region cCppOutIf contained start="0\+" matchgroup=cCppOutWrapper end="^\s*\zs\(%:\|#\)\s*endif\>" contains=cCppOutIf2,cCppOutElse + syn region cCppOutIf contained start="0\+" matchgroup=cCppOutWrapper end="^\s*\(%:\|#\)\s*endif\>" contains=cCppOutIf2,cCppOutElse if !exists("c_no_if0_fold") syn region cCppOutIf2 contained matchgroup=cCppOutWrapper start="0\+" end="^\s*\(%:\|#\)\s*\(else\>\|elif\s\+\(0\+\s*\($\|//\|/\*\|&\)\)\@!\|endif\>\)"me=s-1 contains=cSpaceError,cCppOutSkip,@Spell fold else syn region cCppOutIf2 contained matchgroup=cCppOutWrapper start="0\+" end="^\s*\(%:\|#\)\s*\(else\>\|elif\s\+\(0\+\s*\($\|//\|/\*\|&\)\)\@!\|endif\>\)"me=s-1 contains=cSpaceError,cCppOutSkip,@Spell endif - syn region cCppOutElse contained matchgroup=cCppOutWrapper start="^\s*\zs\(%:\|#\)\s*\(else\|elif\)" end="^\s*\zs\(%:\|#\)\s*endif\>"me=s-1 contains=TOP,cPreCondit + syn region cCppOutElse contained matchgroup=cCppOutWrapper start="^\s*\(%:\|#\)\s*\(else\|elif\)" end="^\s*\(%:\|#\)\s*endif\>"me=s-1 contains=TOP,cPreCondit syn region cCppInWrapper start="^\s*\zs\(%:\|#\)\s*if\s\+0*[1-9]\d*\s*\($\|//\|/\*\||\)" end=".\@=\|$" contains=cCppInIf,cCppInElse fold - syn region cCppInIf contained matchgroup=cCppInWrapper start="\d\+" end="^\s*\zs\(%:\|#\)\s*endif\>" contains=TOP,cPreCondit + syn region cCppInIf contained matchgroup=cCppInWrapper start="\d\+" end="^\s*\(%:\|#\)\s*endif\>" contains=TOP,cPreCondit if !exists("c_no_if0_fold") - syn region cCppInElse contained start="^\s*\zs\(%:\|#\)\s*\(else\>\|elif\s\+\(0*[1-9]\d*\s*\($\|//\|/\*\||\)\)\@!\)" end=".\@=\|$" containedin=cCppInIf contains=cCppInElse2 fold + syn region cCppInElse contained start="^\s*\(%:\|#\)\s*\(else\>\|elif\s\+\(0*[1-9]\d*\s*\($\|//\|/\*\||\)\)\@!\)" end=".\@=\|$" containedin=cCppInIf contains=cCppInElse2 fold else - syn region cCppInElse contained start="^\s*\zs\(%:\|#\)\s*\(else\>\|elif\s\+\(0*[1-9]\d*\s*\($\|//\|/\*\||\)\)\@!\)" end=".\@=\|$" containedin=cCppInIf contains=cCppInElse2 + syn region cCppInElse contained start="^\s*\(%:\|#\)\s*\(else\>\|elif\s\+\(0*[1-9]\d*\s*\($\|//\|/\*\||\)\)\@!\)" end=".\@=\|$" containedin=cCppInIf contains=cCppInElse2 endif - syn region cCppInElse2 contained matchgroup=cCppInWrapper start="^\s*\zs\(%:\|#\)\s*\(else\|elif\)\([^/]\|/[^/*]\)*" end="^\s*\zs\(%:\|#\)\s*endif\>"me=s-1 contains=cSpaceError,cCppOutSkip,@Spell - syn region cCppOutSkip contained start="^\s*\zs\(%:\|#\)\s*\(if\>\|ifdef\>\|ifndef\>\)" skip="\\$" end="^\s*\zs\(%:\|#\)\s*endif\>" contains=cSpaceError,cCppOutSkip - syn region cCppInSkip contained matchgroup=cCppInWrapper start="^\s*\zs\(%:\|#\)\s*\(if\s\+\(\d\+\s*\($\|//\|/\*\||\|&\)\)\@!\|ifdef\>\|ifndef\>\)" skip="\\$" end="^\s*\zs\(%:\|#\)\s*endif\>" containedin=cCppOutElse,cCppInIf,cCppInSkip contains=TOP,cPreProc + syn region cCppInElse2 contained matchgroup=cCppInWrapper start="^\s*\(%:\|#\)\s*\(else\|elif\)\([^/]\|/[^/*]\)*" end="^\s*\(%:\|#\)\s*endif\>"me=s-1 contains=cSpaceError,cCppOutSkip,@Spell + syn region cCppOutSkip contained start="^\s*\(%:\|#\)\s*\(if\>\|ifdef\>\|ifndef\>\)" skip="\\$" end="^\s*\(%:\|#\)\s*endif\>" contains=cSpaceError,cCppOutSkip + syn region cCppInSkip contained matchgroup=cCppInWrapper start="^\s*\(%:\|#\)\s*\(if\s\+\(\d\+\s*\($\|//\|/\*\||\|&\)\)\@!\|ifdef\>\|ifndef\>\)" skip="\\$" end="^\s*\(%:\|#\)\s*endif\>" containedin=cCppOutElse,cCppInIf,cCppInSkip contains=TOP,cPreProc endif syn region cIncluded display contained start=+"+ skip=+\\\\\|\\"+ end=+"+ syn match cIncluded display contained "<[^>]*>" diff --git a/runtime/syntax/vim.vim b/runtime/syntax/vim.vim index 7025ee5369..26eea03a3c 100644 --- a/runtime/syntax/vim.vim +++ b/runtime/syntax/vim.vim @@ -3,8 +3,8 @@ " ############################################################################# " ############################################################################# " Note: Be careful when merging the upstream version of this file. -" Much of this is generated by scripts/genvimvim.lua (result is installed -" to: $VIMRUNTIME/syntax/vim/generated.vim) +" Much of this is generated by scripts/genvimvim.lua +" (installs to $VIMRUNTIME/syntax/vim/generated.vim) " ############################################################################# " ############################################################################# @@ -128,6 +128,13 @@ if exists("g:vimsyntax_noerror") let g:vimsyn_noerror= g:vimsyntax_noerror endif +" Variable options {{{2 +if exists("g:vim_maxlines") + let s:vimsyn_maxlines= g:vim_maxlines +else + let s:vimsyn_maxlines= 60 +endif + " Numbers {{{2 " ======= syn match vimNumber "\<\d\+\%(\.\d\+\%([eE][+-]\=\d\+\)\=\)\=" skipwhite nextgroup=vimGlobal,vimSubst,vimCommand @@ -601,7 +608,7 @@ syn region vimGlobal matchgroup=Statement start='\<v\%[global]!\=/' skip='\\.' e " g:vimsyn_embed =~# 'r' : embed ruby " g:vimsyn_embed =~# 't' : embed tcl if !exists("g:vimsyn_embed") - let g:vimsyn_embed= "lpPr" + let g:vimsyn_embed= 0 endif " [-- lua --] {{{3 @@ -744,9 +751,10 @@ if !filereadable(s:mzschemepath) endif if g:vimsyn_embed =~# 'm' && filereadable(s:mzschemepath) unlet! b:current_syntax - let iskKeep= &isk + let s:iskKeep= &isk exe "syn include @vimMzSchemeScript ".s:mzschemepath - let &isk= iskKeep + let &isk= s:iskKeep + unlet s:iskKeep VimFoldm syn region vimMzSchemeRegion matchgroup=vimScriptDelim start=+mz\%[scheme]\s*<<\s*\z(.*\)$+ end=+^\z1$+ contains=@vimMzSchemeScript VimFoldm syn region vimMzSchemeRegion matchgroup=vimScriptDelim start=+mz\%[scheme]\s*<<\s*$+ end=+\.$+ contains=@vimMzSchemeScript syn cluster vimFuncBodyList add=vimMzSchemeRegion @@ -761,11 +769,7 @@ unlet s:mzschemepath if exists("g:vimsyn_minlines") exe "syn sync minlines=".g:vimsyn_minlines endif -if exists("g:vimsyn_maxlines") - exe "syn sync maxlines=".g:vimsyn_maxlines -else - syn sync maxlines=60 -endif +exe "syn sync maxlines=".s:vimsyn_maxlines syn sync linecont "^\s\+\\" syn sync match vimAugroupSyncA groupthere NONE "\<aug\%[roup]\>\s\+[eE][nN][dD]" @@ -778,7 +782,7 @@ if !exists("skip_vim_syntax_inits") hi def link vimBehaveError vimError hi def link vimCollClassErr vimError hi def link vimErrSetting vimError - hi def link vimEmbedError vimError + hi def link vimEmbedError Normal hi def link vimFTError vimError hi def link vimFunctionError vimError hi def link vimFunc vimError @@ -935,6 +939,11 @@ if !exists("skip_vim_syntax_inits") hi def link vimUserFunc Normal hi def link vimVar Identifier hi def link vimWarn WarningMsg + + hi def link nvimAutoEvent vimAutoEvent + hi def link nvimHLGroup vimHLGroup + hi def link nvimMap vimMap + hi def link nvimUnmap vimUnmap endif " Current Syntax Variable: {{{2 diff --git a/runtime/tutor/en/vim-01-beginner.tutor b/runtime/tutor/en/vim-01-beginner.tutor index fee7de21d2..6364b201d5 100644 --- a/runtime/tutor/en/vim-01-beginner.tutor +++ b/runtime/tutor/en/vim-01-beginner.tutor @@ -23,7 +23,7 @@ relevant help (hopefully), and pressing K over any word will try to do so too. Sometimes you will be required to modify text like this here Once you have done the changes correctly, the ✗ sign at the left will change -to ✓. I imagine you can already see how neat Vim can be ;) +to ✓. I imagine you can already see how neat Vim can be. ;) Other times, you'll be prompted to run a command (I'll explain this later): ~~~ cmd :help <Enter> @@ -36,30 +36,30 @@ or press a sequence of keys Text within <'s and >'s (like `<Enter>`{normal}) describes a key to press instead of text to type. -Now, move to the next lesson (remember, use j). +Now, move to the next lesson (remember, use the `j`{normal} key to scroll down). ## Lesson 1.1: MOVING THE CURSOR ** To move the cursor, press the `h`, `j`, `k`, `l` keys as indicated. ** ↑ - k Hint: The h key is at the left and moves left. - ← h l → The l key is at the right and moves right. - j The j key looks like a down arrow. + k Hint: The `h`{normal} key is at the left and moves left. + ← h l → The `l`{normal} key is at the right and moves right. + j The `j`{normal} key looks like a down arrow. ↓ 1. Move the cursor around the screen until you are comfortable. - 2. Hold down the down key (j) until it repeats. + 2. Hold down the down key (`j`{normal}) until it repeats. Now you know how to move to the next lesson. 3. Using the down key, move to Lesson 1.2. NOTE: If you are ever unsure about something you typed, press <Esc> to place - you in Normal mode. Then retype the command you wanted. + you in Normal mode. Then retype the command you wanted. -NOTE: The cursor keys should also work. But using hjkl you will be able to - move around much faster, once you get used to it. Really! +NOTE: The cursor keys should also work. But using hjkl you will be able to + move around much faster, once you get used to it. Really! # Lesson 1.2: EXITING VIM @@ -81,7 +81,7 @@ NOTE: The cursor keys should also work. But using hjkl you will be able to 4. If you have these steps memorized and are confident, execute steps 1 through 3 to exit and re-enter the editor. -NOTE: [:q!](:q) <Enter> discards any changes you made. In a few lessons you +NOTE: [:q!](:q) <Enter> discards any changes you made. In a few lessons you will learn how to save the changes to a file. 5. Move the cursor down to Lesson 1.3. @@ -90,18 +90,18 @@ NOTE: [:q!](:q) <Enter> discards any changes you made. In a few lessons you ** Press `x`{normal} to delete the character under the cursor. ** -1. Move the cursor to the line below marked --->. + 1. Move the cursor to the line below marked --->. -2. To fix the errors, move the cursor until it is on top of the - character to be deleted. + 2. To fix the errors, move the cursor until it is on top of the + character to be deleted. -3. Press [the x key](x) to delete the unwanted character. + 3. Press [the x key](x) to delete the unwanted character. -4. Repeat steps 2 through 4 until the sentence is correct. + 4. Repeat steps 2 through 4 until the sentence is correct. The ccow jumpedd ovverr thhe mooon. -5. Now that the line is correct, go on to Lesson 1.4. + 5. Now that the line is correct, go on to Lesson 1.4. NOTE: As you go through this tutor, do not try to memorize, learn by usage. @@ -114,15 +114,15 @@ NOTE: As you go through this tutor, do not try to memorize, learn by usage. 2. To make the first line the same as the second, move the cursor on top of the first character AFTER where the text is to be inserted. - 3. Press i and type in the necessary additions. + 3. Press `i`{normal} and type in the necessary additions. - 4. As each error is fixed press <Esc> to return to Normal mode. + 4. As each error is fixed press `<Esc>`{normal} to return to Normal mode. Repeat steps 2 through 4 to correct the sentence. There is text misng this . There is some text missing from this line. - 5. When you are comfortable inserting text move to lesson 1.5. + 5. When you are comfortable inserting text move to Lesson 1.5. # Lesson 1.5: TEXT EDITING: APPENDING @@ -131,9 +131,9 @@ There is some text missing from this line. 1. Move the cursor to the first line below marked --->. It does not matter on what character the cursor is in that line. - 2. Press [A](A) and type in the necessary additions. + 2. Press [A](A) and type in the necessary additions. - 3. As the text has been appended press <Esc> to return to Normal mode. + 3. As the text has been appended press `<Esc>`{normal} to return to Normal mode. 4. Move the cursor to the second line marked ---> and repeat steps 2 and 3 to correct this sentence. @@ -143,7 +143,7 @@ There is some text missing from this line. There is also some text miss There is also some text missing here. - 5. When you are comfortable appending text move to lesson 1.6. + 5. When you are comfortable appending text move to Lesson 1.6. # Lesson 1.6: EDITING A FILE @@ -151,7 +151,7 @@ There is also some text missing here. !! NOTE: Before executing any of the steps below, read this entire lesson !! - 1. Exit this tutor as you did in lesson 1.2: :q! + 1. Exit this tutor as you did in Lesson 1.2: `:q!`{vim} Or, if you have access to another terminal, do the following there. 2. At the shell prompt type this command: @@ -159,7 +159,7 @@ There is also some text missing here. $ vim tutor ~~~ 'vim' is the command to start the Vim editor, 'tutor' is the name of the - file you wish to edit. Use a file that may be changed. + file you wish to edit. Use a file that may be changed. 3. Insert and delete text as you learned in the previous lessons. @@ -186,14 +186,14 @@ There is also some text missing here. $ vim FILENAME ~~~ - 3. To exit Vim type: <Esc> :q! <Enter> to trash all changes. - OR type: <Esc> :wq <Enter> to save the changes. + 3. To exit Vim type: `<Esc>`{normal} `:q!`{vim} `<Enter>`{normal} to trash all changes. + OR type: `<Esc>`{normal} `:wq`{vim} `<Enter>`{normal} to save the changes. - 4. To delete the character at the cursor type: `x`{normal} + 4. To delete the character at the cursor type: `x`{normal} 5. To insert or append text type: - `i`{normal} type inserted text `<Esc>`{normal} insert before the cursor - `A`{normal} type appended text `<Esc>`{normal} append after the line + `i`{normal} insert text `<Esc>`{normal} insert before the cursor. + `A`{normal} append text `<Esc>`{normal} append after the line. NOTE: Pressing `<Esc>`{normal} will place you in Normal mode or will cancel an unwanted and partially completed command. @@ -210,7 +210,7 @@ Now continue with Lesson 2. 3. Move the cursor to the beginning of a word that needs to be deleted. - 4. Type [d](d)[w](w) to make the word disappear. + 4. Type [d](d)[w](w) to make the word disappear. There are a some words fun that don't belong paper in this sentence. @@ -218,9 +218,9 @@ There are a some words fun that don't belong paper in this sentence. # Lesson 2.2: MORE DELETION COMMANDS -** Type `d$`{normal} to delete to the end of the line. ** +** Type `d$`{normal} to delete to the end of the line. ** - 1. Press <Esc> to make sure you are in Normal mode. + 1. Press `<Esc>`{normal} to make sure you are in Normal mode. 2. Move the cursor to the line below marked --->. @@ -236,7 +236,7 @@ Somebody typed the end of this line twice. end of this line twice. Many commands that change text are made from an [operator](operator) and a [motion](navigation). -The format for a delete command with the [d](d) delete operator is as follows: +The format for a delete command with the [d](d) delete operator is as follows: d motion @@ -249,7 +249,7 @@ The format for a delete command with the [d](d) delete operator is as follows: [e](e) - to the end of the current word, INCLUDING the last character. [$]($) - to the end of the line, INCLUDING the last character. - Thus typing `de`{normal} will delete from the cursor to the end of the word. + Thus typing `de`{normal} will delete from the cursor to the end of the word. NOTE: Pressing just the motion while in Normal mode without an operator will move the cursor as specified. @@ -260,11 +260,11 @@ NOTE: Pressing just the motion while in Normal mode without an operator will 1. Move the cursor to the start of the line marked ---> below. - 2. Type `2w`{normal} to move the cursor two words forward. + 2. Type `2w`{normal} to move the cursor two words forward. - 3. Type `3e`{normal} to move the cursor to the end of the third word forward. + 3. Type `3e`{normal} to move the cursor to the end of the third word forward. - 4. Type `0`{normal} ([zero](0)) to move to the start of the line. + 4. Type `0`{normal} ([zero](0)) to move to the start of the line. 5. Repeat steps 2 and 3 with different numbers. @@ -282,22 +282,22 @@ insert a count before the motion to delete more: 1. Move the cursor to the first UPPER CASE word in the line marked --->. - 2. Type `d2w`{normal} to delete the two UPPER CASE words + 2. Type `d2w`{normal} to delete the two UPPER CASE words 3. Repeat steps 1 and 2 with a different count to delete the consecutive UPPER CASE words with one command -this ABC DE line FGHI JK LMN OP of words is Q RS TUV cleaned up. +This ABC DE line FGHI JK LMN OP of words is Q RS TUV cleaned up. # Lesson 2.6: OPERATING ON LINES -** Type dd to delete a whole line. ** +** Type `dd`{normal} to delete a whole line. ** Due to the frequency of whole line deletion, the designers of Vi decided it would be easier to simply type two d's to delete a line. 1. Move the cursor to the second line in the phrase below. - 2. Type [dd](dd) to delete the line. + 2. Type [dd](dd) to delete the line. 3. Now move to the fourth line. 4. Type `2dd`{normal} to delete two lines. @@ -311,20 +311,20 @@ this ABC DE line FGHI JK LMN OP of words is Q RS TUV cleaned up. # Lesson 2.7: THE UNDO COMMAND -** Press u to undo the last commands, U to fix a whole line. ** +** Press `u`{normal} to undo the last commands, `U`{normal} to fix a whole line. ** 1. Move the cursor to the line below marked ---> and place it on the first error. - 2. Type `x`{normal} to delete the first unwanted character. - 3. Now type `u`{normal} to undo the last command executed. - 4. This time fix all the errors on the line using the `x`{normal} command. - 5. Now type a capital `U`{normal} to return the line to its original state. - 6. Now type `u`{normal} a few times to undo the U and preceding commands. - 7. Now type `<Ctrl-r>`{normal} a few times to redo the commands (undo the undo's). + 2. Type `x`{normal} to delete the first unwanted character. + 3. Now type `u`{normal} to undo the last command executed. + 4. This time fix all the errors on the line using the `x`{normal} command. + 5. Now type a capital `U`{normal} to return the line to its original state. + 6. Now type `u`{normal} a few times to undo the `U`{normal} and preceding commands. + 7. Now type `<Ctrl-r>`{normal} a few times to redo the commands (undo the undo's). Fiix the errors oon thhis line and reeplace them witth undo. - 8. These are very useful commands. Now move on to the Lesson 2 Summary. + 8. These are very useful commands. Now move on to the Lesson 2 Summary. # Lesson 2 SUMMARY @@ -336,13 +336,13 @@ Fiix the errors oon thhis line and reeplace them witth undo. 5. The format for a change command is: operator [number] motion where: - operator - is what to do, such as [d](d) for delete + operator - is what to do, such as [d](d) for delete [number] - is an optional count to repeat the motion motion - moves over the text to operate on, such as: [w](w) (word), [$]($) (to the end of line), etc. - 6. To move to the start of the line use a zero: [0](0) + 6. To move to the start of the line use a zero: [0](0) 7. To undo previous actions, type: `u`{normal} (lowercase u) To undo all the changes on a line, type: `U`{normal} (capital U) @@ -350,15 +350,15 @@ Fiix the errors oon thhis line and reeplace them witth undo. # Lesson 3.1: THE PUT COMMAND -** Type p to put previously deleted text after the cursor. ** +** Type `p`{normal} to put previously deleted text after the cursor. ** 1. Move the cursor to the first ---> line below. - 2. Type `dd`{normal} to delete the line and store it in a Vim register. + 2. Type `dd`{normal} to delete the line and store it in a Vim register. 3. Move the cursor to the c) line, ABOVE where the deleted line should go. - 4. Type `p`{normal} to put the line below the cursor. + 4. Type `p`{normal} to put the line below the cursor. 5. Repeat steps 2 through 4 to put all the lines in correct order. @@ -388,11 +388,11 @@ NOTE: Remember that you should be learning by doing, not memorization. # Lesson 3.3: THE CHANGE OPERATOR -** To change until the end of a word, type `ce`{normal} ** +** To change until the end of a word, type `ce`{normal}. ** 1. Move the cursor to the first line below marked --->. - 2. Place the cursor on the "u" in "lubw". + 2. Place the cursor on the "u" in "lubw". 3. Type `ce`{normal} and the correct word (in this case, type "ine" ). @@ -405,11 +405,11 @@ This line has a few words that need changing using the change operator. Notice that [c](c)e deletes the word and places you in Insert mode. -# Lesson 3.4: MORE CHANGES USING c +# Lesson 3.4: MORE CHANGES USING `c`{normal} ** The change operator is used with the same motions as delete. ** - 1. The change operator works in the same way as delete. The format is: + 1. The change operator works in the same way as delete. The format is: c [number] motion @@ -422,13 +422,13 @@ Notice that [c](c)e deletes the word and places you in Insert mode. 5. Type `c$`{normal} and type the rest of the line like the second and press `<Esc>`{normal}. The end of this line needs some help to make it like the second. -The end of this line needs to be corrected using the c$ command. +The end of this line needs to be corrected using the `c$`{normal} command. -NOTE: You can use the Backspace key to correct mistakes while typing. +NOTE: You can use the Backspace key to correct mistakes while typing. # Lesson 3 SUMMARY - 1. To put back text that has just been deleted, type [p](p). This puts the + 1. To put back text that has just been deleted, type [p](p). This puts the deleted text AFTER the cursor (if a line was deleted it will go on the line below the cursor). @@ -436,8 +436,8 @@ NOTE: You can use the Backspace key to correct mistakes while typing. character you want to have there. 3. The [change operator](c) allows you to change from the cursor to where the - motion takes you. eg. Type `ce`{normal} to change from the cursor to the end of - the word, `c$`{normal} to change to the end of a line. + motion takes you. Type `ce`{normal} to change from the cursor to the end of + the word, `c$`{normal} to change to the end of a line. 4. The format for change is: @@ -448,21 +448,21 @@ Now go on to the next lesson. # Lesson 4.1: CURSOR LOCATION AND FILE STATUS ** Type `<Ctrl-g>`{normal} to show your location in the file and the file status. - Type `G`{normal} to move to a line in the file. ** + Type `G`{normal} to move to a line in the file. ** NOTE: Read this entire lesson before executing any of the steps!! - 1. Hold down the `<Ctrl>`{normal} key and press `g`{normal}. We call this `<Ctrl-g>`{normal}. + 1. Hold down the `<Ctrl>`{normal} key and press `g`{normal}. We call this `<Ctrl-g>`{normal}. A message will appear at the bottom of the page with the filename and the - position in the file. Remember the line number for Step 3. + position in the file. Remember the line number for Step 3. -NOTE: You may see the cursor position in the lower right corner of the screen - This happens when the ['ruler']('ruler') option is set (see :help 'ruler' ) +NOTE: You may see the cursor position in the lower right corner of the screen + This happens when the ['ruler']('ruler') option is set (see `:help 'ruler'`{vim} ). - 2. Press [G](G) to move you to the bottom of the file. - Type [gg](gg) to move you to the start of the file. + 2. Press [G](G) to move you to the bottom of the file. + Type [gg](gg) to move you to the start of the file. - 3. Type the number of the line you were on and then `G`{normal} . This will + 3. Type the number of the line you were on and then `G`{normal}. This will return you to the line you were on when you first pressed `<Ctrl-g>`{normal}. 4. If you feel confident to do this, execute steps 1 through 3. @@ -471,20 +471,20 @@ NOTE: You may see the cursor position in the lower right corner of the screen ** Type `/`{normal} followed by a phrase to search for the phrase. ** - 1. In Normal mode type the `/`{normal} character. Notice that it and the cursor - appear at the bottom of the screen as with the : command. + 1. In Normal mode type the `/`{normal} character. Notice that it and the cursor + appear at the bottom of the screen as with the `:`{normal} command. - 2. Now type 'errroor' `<Enter>`{normal}. This is the word you want to search for. + 2. Now type 'errroor' `<Enter>`{normal}. This is the word you want to search for. - 3. To search for the same phrase again, simply type [n](n) . - To search for the same phrase in the opposite direction, type [N](N) . + 3. To search for the same phrase again, simply type [n](n). + To search for the same phrase in the opposite direction, type [N](N). - 4. To search for a phrase in the backward direction, use [?](?) instead of / . + 4. To search for a phrase in the backward direction, use [?](?) instead of `/`{normal}. - 5. To go back to where you came from press `<Ctrl-o>`{normal} (Keep Ctrl down while - pressing the letter o). Repeat to go back further. `<Ctrl-i>`{normal} goes forward. + 5. To go back to where you came from press `<Ctrl-o>`{normal} (keep `<Ctrl>`{normal} pressed down while + pressing the letter `o`{normal}). Repeat to go back further. `<Ctrl-i>`{normal} goes forward. -"errroor" is not the way to spell error; errroor is an error. +"errroor" is not the way to spell error; errroor is an error. NOTE: When the search reaches the end of the file it will continue at the start, unless the ['wrapscan']('wrapscan') option has been reset. @@ -495,7 +495,7 @@ NOTE: When the search reaches the end of the file it will continue at the 1. Place the cursor on any (, [, or { in the line below marked --->. - 2. Now type the [%](%) character. + 2. Now type the [%](%) character. 3. The cursor will move to the matching parenthesis or bracket. @@ -528,7 +528,7 @@ NOTE: This is very useful in debugging a program with unmatched parentheses! Adding the g [flag](:s_flags) means to substitute globally in the line, change all occurrences of "thee" in the line. -thee best time to see thee flowers is in thee spring. +Usually thee best time to see thee flowers is in thee spring. 4. To change every occurrence of a character string between two lines, type ~~~ cmd @@ -589,20 +589,20 @@ thee best time to see thee flowers is in thee spring. ** Type `:!`{vim} followed by an external command to execute that command. ** 1. Type the familiar command `:`{normal} to set the cursor at the bottom of the - screen. This allows you to enter a command-line command. + screen. This allows you to enter a command-line command. - 2. Now type the [!](!cmd) (exclamation point) character. This allows you to + 2. Now type the [!](!cmd) (exclamation point) character. This allows you to execute any external shell command. - 3. As an example type "ls" following the "!" and then hit `<Enter>`{normal}. This + 3. As an example type "ls" following the "!" and then hit `<Enter>`{normal}. This will show you a listing of your directory, just as if you were at the shell prompt. -NOTE: It is possible to execute any external command this way, also with - arguments. +NOTE: It is possible to execute any external command this way, also with + arguments. -NOTE: All : commands must be finished by hitting <Enter> - From here on we will not always mention it. +NOTE: All `:`{vim} commands must be finished by hitting `<Enter>`{normal}. + From here on we will not always mention it. # Lesson 5.2: MORE ON WRITING FILES @@ -622,7 +622,7 @@ NOTE: All : commands must be finished by hitting <Enter> 4. This saves the whole file (the Vim Tutor) under the name TEST. To verify this, type `:!ls`{vim} again to see your directory. -NOTE: If you were to exit Vim and start it again with vim TEST , the file +NOTE: If you were to exit Vim and start it again with `nvim TEST`, the file would be an exact copy of the tutor when you saved it. 5. Now remove the file by typing: @@ -632,14 +632,14 @@ NOTE: If you were to exit Vim and start it again with vim TEST , the file # Lesson 5.3: SELECTING TEXT TO WRITE -** To save part of the file, type `v`{normal} motion `:w FILENAME`{vim} ** +** To save part of the file, type `v`{normal} motion `:w FILENAME`{vim}. ** 1. Move the cursor to this line. - 2. Press [v](v) and move the cursor to the fifth item below. Notice that the + 2. Press [v](v) and move the cursor to the fifth item below. Notice that the text is highlighted. - 3. Press the `:`{normal} character. At the bottom of the screen + 3. Press the `:`{normal} character. At the bottom of the screen :'<,'> @@ -649,27 +649,27 @@ NOTE: If you were to exit Vim and start it again with vim TEST , the file `:w TEST`{vim} - where TEST is a filename that does not exist yet. Verify that you see + where TEST is a filename that does not exist yet. Verify that you see `:'<,'>w TEST`{vim} before you press `<Enter>`{normal}. - 5. Vim will write the selected lines to the file TEST. Use `:!ls`{vim} to see it. - Do not remove it yet! We will use it in the next lesson. + 5. Vim will write the selected lines to the file TEST. Use `:!ls`{vim} to see it. + Do not remove it yet! We will use it in the next lesson. -NOTE: Pressing [v](v) starts [Visual selection](visual-mode). You can move - the cursor around to make the selection bigger or smaller. Then you can - use an operator to do something with the text. For example, `d`{normal} deletes - the text. +NOTE: Pressing [v](v) starts [Visual selection](visual-mode). You can move + the cursor around to make the selection bigger or smaller. Then you can + use an operator to do something with the text. For example, `d`{normal} deletes + the text. # Lesson 5.4: RETRIEVING AND MERGING FILES -** To insert the contents of a file, type `:r FILENAME`{vim} ** +** To insert the contents of a file, type `:r FILENAME`{vim}. ** 1. Place the cursor just above this line. -NOTE: After executing Step 2 you will see text from Lesson 5.3. Then move +NOTE: After executing Step 2 you will see text from Lesson 5.3. Then move DOWN to see this lesson again. 2. Now retrieve your TEST file using the command @@ -682,31 +682,31 @@ NOTE: After executing Step 2 you will see text from Lesson 5.3. Then move 3. To verify that a file was retrieved, cursor back and notice that there are now two copies of Lesson 5.3, the original and the file version. -NOTE: You can also read the output of an external command. For example, +NOTE: You can also read the output of an external command. For example, - `:r !ls`{vim} + `:r !ls`{vim} - reads the output of the `ls` command and puts it below the cursor. + reads the output of the `ls` command and puts it below the cursor. # Lesson 5 SUMMARY - 1. [:!command](:!cmd) executes an external command. + 1. [:!command](:!cmd) executes an external command. - Some useful examples are: - `:!ls`{vim} - shows a directory listing - `:!rm FILENAME`{vim} - removes file FILENAME + Some useful examples are: + `:!ls`{vim} - shows a directory listing + `:!rm FILENAME`{vim} - removes file FILENAME - 2. [:w](:w) FILENAME writes the current Vim file to disk with - name FILENAME. + 2. [:w](:w) FILENAME writes the current Vim file to disk with + name FILENAME. - 3. [v](v) motion :w FILENAME saves the Visually selected lines in file - FILENAME. + 3. [v](v) motion :w FILENAME saves the Visually selected lines in file + FILENAME. - 4. [:r](:r) FILENAME retrieves disk file FILENAME and puts it - below the cursor position. + 4. [:r](:r) FILENAME retrieves disk file FILENAME and puts it + below the cursor position. - 5. [:r !dir](:r!) reads the output of the dir command and - puts it below the cursor position. + 5. [:r !dir](:r!) reads the output of the dir command and + puts it below the cursor position. # Lesson 6.1: THE OPEN COMMAND @@ -719,10 +719,10 @@ NOTE: You can also read the output of an external command. For example, 3. Now type some text and press `<Esc>`{normal} to exit Insert mode. -After typing o the cursor is placed on the open line in Insert mode. +After typing `o`{normal} the cursor is placed on the open line in Insert mode. 4. To open up a line ABOVE the cursor, simply type a [capital O](O), rather - than a lowercase `o`{normal}. Try this on the line below. + than a lowercase `o`{normal}. Try this on the line below. Open up a line above this by typing O while the cursor is on this line. @@ -734,9 +734,9 @@ Open up a line above this by typing O while the cursor is on this line. 2. Press `e`{normal} until the cursor is on the end of "li". - 3. Type an `a`{normal} (lowercase) to [append](a) text AFTER the cursor. + 3. Type the lowercase letter `a`{normal} to [append](a) text AFTER the cursor. - 4. Complete the word like the line below it. Press `<Esc>`{normal} to exit Insert + 4. Complete the word like the line below it. Press `<Esc>`{normal} to exit Insert mode. 5. Use `e`{normal} to move to the next incomplete word and repeat steps 3 and 4. @@ -744,20 +744,20 @@ Open up a line above this by typing O while the cursor is on this line. This li will allow you to pract appendi text to a line. This line will allow you to practice appending text to a line. -NOTE: [a](a), [i](i) and [A](A) all go to the same Insert mode, the only difference is where - the characters are inserted. +NOTE: [a](a), [i](i) and [A](A) all go to the same Insert mode, the only difference is where + the characters are inserted. # Lesson 6.3: ANOTHER WAY TO REPLACE ** Type a capital `R`{normal} to replace more than one character. ** - 1. Move the cursor to the first line below marked --->. Move the cursor to + 1. Move the cursor to the first line below marked --->. Move the cursor to the beginning of the first "xxx". 2. Now press `R`{normal} ([capital R](R)) and type the number below it in the second line, so that it replaces the "xxx". - 3. Press `<Esc>`{normal} to leave [Replace mode](mode-replace). Notice that the rest of the line + 3. Press `<Esc>`{normal} to leave [Replace mode](mode-replace). Notice that the rest of the line remains unmodified. 4. Repeat the steps to replace the remaining "xxx". @@ -765,12 +765,12 @@ NOTE: [a](a), [i](i) and [A](A) all go to the same Insert mode, the only differ Adding 123 to xxx gives you xxx. Adding 123 to 456 gives you 579. -NOTE: Replace mode is like Insert mode, but every typed character deletes an - existing character. +NOTE: Replace mode is like Insert mode, but every typed character deletes an + existing character. # Lesson 6.4: COPY AND PASTE TEXT -** Use the `y`{normal} operator to copy text and `p`{normal} to paste it ** +** Use the `y`{normal} operator to copy text and `p`{normal} to paste it. ** 1. Go to the line marked with ---> below and place the cursor after "a)". @@ -780,35 +780,37 @@ NOTE: Replace mode is like Insert mode, but every typed character deletes an 4. Move the cursor to the end of the next line: `j$`{normal} - 5. Type `p`{normal} to [put](put) (paste) the text. Then type: "a second"`<Esc>`{normal}. + 5. Type `p`{normal} to [put](put) (paste) the text. + + 6. Press `a`{normal} and then type "second". Press `<Esc>`{normal} to leave Insert mode. - 6. Use Visual mode to select " item.", yank it with `y`{normal}, move to the end of + 7. Use Visual mode to select " item.", yank it with `y`{normal}, move to the end of the next line with `j$`{normal} and put the text there with `p`{normal}. -a) this is the first item. - b) +a) This is the first item. + b) - NOTE: you can also use `y`{normal} as an operator; `yw`{normal} yanks one word. +NOTE: you can also use `y`{normal} as an operator; `yw`{normal} yanks one word. # Lesson 6.5: SET OPTION -** Set an option so a search or substitute ignores case ** +** Set an option so a search or substitute ignores case. ** - 1. Search for 'ignore' by entering: `/ignore` + 1. Search for 'ignore' by entering: `/ignore` Repeat several times by pressing `n`{normal}. 2. Set the 'ic' (Ignore case) option by entering: ~~~ cmd :set ic ~~~ - 3. Now search for 'ignore' again by pressing n + 3. Now search for 'ignore' again by pressing `n`{normal}. Notice that Ignore and IGNORE are now also found. 4. Set the 'hlsearch' and 'incsearch' options: ~~~ cmd :set hls is ~~~ - 5. Now type the search command again and see what happens: /ignore <Enter> + 5. Now type the search command again and see what happens: /ignore <Enter> 6. To disable ignoring case enter: ~~~ cmd @@ -818,12 +820,12 @@ a) this is the first item. ~~~ cmd :set invic ~~~ -NOTE: To remove the highlighting of matches enter: +NOTE: To remove the highlighting of matches enter: ~~~ cmd :nohlsearch ~~~ -NOTE: If you want to ignore case for just one search command, use [\c](/\c) - in the phrase: /ignore\c <Enter> +NOTE: If you want to ignore case for just one search command, use [\c](/\c) + in the phrase: /ignore\c <Enter> # Lesson 6 SUMMARY @@ -839,7 +841,7 @@ NOTE: If you want to ignore case for just one search command, use [\c](/\c) 5. Typing a capital `R`{normal} enters Replace mode until `<Esc>`{normal} is pressed. - 6. Typing "[:set](:set) xxx" sets the option "xxx". Some options are: + 6. Typing "[:set](:set) xxx" sets the option "xxx". Some options are: 'ic' 'ignorecase' ignore upper/lower case when searching 'is' 'incsearch' show partial matches for a search phrase @@ -858,9 +860,9 @@ NOTE: If you want to ignore case for just one search command, use [\c](/\c) # Lesson 7.1: GETTING HELP -** Use the on-line help system ** +** Use the on-line help system. ** -Vim has a comprehensive on-line help system. To get started, try one of +Vim has a comprehensive on-line help system. To get started, try one of these three: - press the `<HELP>`{normal} key (if you have one) - press the `<F1>`{normal} key (if you have one) @@ -872,7 +874,7 @@ Type `<Ctrl-w><Ctrl-w>`{normal} to jump from one window to another. Type `:q`{vim} to close the help window. You can find help on just about any subject, by giving an argument to the -":help" command. Try these (don't forget pressing <Enter>): +":help" command. Try these (don't forget pressing <Enter>): ~~~ cmd :help w :help c_CTRL-D @@ -881,13 +883,13 @@ You can find help on just about any subject, by giving an argument to the ~~~ # Lesson 7.2: CREATE A STARTUP SCRIPT -** Enable Vim features ** +** Enable Vim features. ** Vim has many more features than Vi, but most of them are disabled by -default. To start using more features you have to create a "vimrc" file. +default. To start using more features you have to create a "vimrc" file. - 1. Start editing the "vimrc" file. This depends on your system: - `:e ~/.config/nvim/init.vim`{vim} for Unix-like systems + 1. Start editing the "vimrc" file. This depends on your system: + `:e ~/.config/nvim/init.vim`{vim} for Unix-like systems 2. Now read the example "vimrc" file contents: `:r $VIMRUNTIME/vimrc_example.vim`{vim} @@ -897,15 +899,15 @@ default. To start using more features you have to create a "vimrc" file. The next time you start Vim it will use syntax highlighting. You can add all your preferred settings to this "vimrc" file. - For more information type :help vimrc-intro + For more information type `:help vimrc-intro`{vim}. # Lesson 7.3: COMPLETION -** Command line completion with `<Ctrl-d>`{normal} and `<Tab>`{normal} ** +** Command line completion with `<Ctrl-d>`{normal} and `<Tab>`{normal}. ** - 1. Look what files exist in the directory: `:!ls`{vim} + 1. Look what files exist in the directory: `:!ls`{vim} - 2. Type the start of a command: `:e`{vim} + 2. Type the start of a command: `:e`{vim} 3. Press `<Ctrl-d>`{normal} and Vim will show a list of commands that start with "e". @@ -913,20 +915,20 @@ default. To start using more features you have to create a "vimrc" file. 5. Now add a space and the start of an existing file name: `:edit FIL`{vim} - 6. Press `<Tab>`{normal}. Vim will complete the name (if it is unique). + 6. Press `<Tab>`{normal}. Vim will complete the name (if it is unique). -NOTE: Completion works for many commands. It is especially useful for `:help`{vim}. +NOTE: Completion works for many commands. It is especially useful for `:help`{vim}. # Lesson 7 SUMMARY 1. Type `:help`{vim} or press `<F1>`{normal} or `<Help>`{normal} to open a help window. - 2. Type `:help TOPIC`{vim} to find help on TOPIC. + 2. Type `:help TOPIC`{vim} to find help on TOPIC. - 3. Type `<Ctrl-w><Ctrl-w>`{normal} to jump to another window + 3. Type `<Ctrl-w><Ctrl-w>`{normal} to jump to another window - 4. Type `:q`{vim} to close the help window + 4. Type `:q`{vim} to close the help window 5. Create a vimrc startup script to keep your preferred settings. @@ -937,24 +939,24 @@ NOTE: Completion works for many commands. It is especially useful for `:help`{v This was intended to give a brief overview of the Vim editor, just enough to allow you to use the editor fairly easily. It is far from complete as Vim has -many many more commands. Consult the help often. +many many more commands. Consult the help often. There are many resources online to learn more about vim. Here's a bunch of them: - *Learn Vim Progressively*: http://yannesposito.com/Scratch/en/blog/Learn-Vim-Progressively/ - *Learning Vim in 2014*: http://benmccormick.org/learning-vim-in-2014/ -- Vimcasts: http://vimcasts.org/ -- Vim Video-Tutorials by Derek Wyatt: http://derekwyatt.org/vim/tutorials/ +- *Vimcasts*: http://vimcasts.org/ +- *Vim Video-Tutorials by Derek Wyatt*: http://derekwyatt.org/vim/tutorials/ - *Learn Vimscript the Hard Way*: http://learnvimscriptthehardway.stevelosh.com/ - *7 Habits of Effective Text Editing*: http://www.moolenaar.net/habits.html - *vim-galore*: https://github.com/mhinz/vim-galore If you prefer a book, *Practical Vim* by Drew Neil is recommended often (the sequel, *Modern -Vim*, includes material specific to nvim!). +Vim*, includes material specific to nvim). This tutorial was written by Michael C. Pierce and Robert K. Ware, Colorado School of Mines using ideas supplied by Charles Smith, Colorado State -University. E-mail: bware@mines.colorado.edu. +University. E-mail: bware@mines.colorado.edu. Modified for Vim by Bram Moolenaar. Modified for vim-tutor-mode by Felipe Morales. diff --git a/runtime/tutor/en/vim-01-beginner.tutor.json b/runtime/tutor/en/vim-01-beginner.tutor.json index 3f55971a09..444bd7c4b7 100644 --- a/runtime/tutor/en/vim-01-beginner.tutor.json +++ b/runtime/tutor/en/vim-01-beginner.tutor.json @@ -11,7 +11,7 @@ "215": "There are some words that don't belong in this sentence.", "231": "Somebody typed the end of this line twice.", "271": -1, - "290": "this line of words is cleaned up.", + "290": "This line of words is cleaned up.", "304": -1, "305": -1, "306": -1, @@ -32,14 +32,14 @@ "425": "The end of this line needs to be corrected using the c$ command.", "487": -1, "506": -1, - "531": "the best time to see the flowers is in the spring.", + "531": "Usually the best time to see the flowers is in the spring.", "722": -1, "727": -1, "744": "This line will allow you to practice appending text to a line.", "745": "This line will allow you to practice appending text to a line.", "765": "Adding 123 to 456 gives you 579.", "766": "Adding 123 to 456 gives you 579.", - "788": "a) this is the first item.", - "789": " b) this is the second item." + "790": "a) This is the first item.", + "791": " b) This is the second item." } } |