diff --git a/.gitignore b/.gitignore index 61b96c158f..ddbcc9c60d 100644 --- a/.gitignore +++ b/.gitignore @@ -5,7 +5,6 @@ /.deps/ /tmp/ -*.orig *.mo .*.sw? *~ diff --git a/CMakeLists.txt b/CMakeLists.txt index e0daea5969..cad3ea6786 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -64,13 +64,13 @@ set_property(CACHE CMAKE_BUILD_TYPE PROPERTY # version string, else they are combined with the result of `git describe`. set(NVIM_VERSION_MAJOR 0) set(NVIM_VERSION_MINOR 2) -set(NVIM_VERSION_PATCH 1) +set(NVIM_VERSION_PATCH 3) set(NVIM_VERSION_PRERELEASE "-dev") # for package maintainers # API level set(NVIM_API_LEVEL 3) # Bump this after any API change. set(NVIM_API_LEVEL_COMPAT 0) # Adjust this after a _breaking_ API change. -set(NVIM_API_PRERELEASE true) +set(NVIM_API_PRERELEASE false) file(TO_CMAKE_PATH ${CMAKE_CURRENT_LIST_DIR}/.git FORCED_GIT_DIR) include(GetGitRevisionDescription) diff --git a/runtime/CMakeLists.txt b/runtime/CMakeLists.txt index f81d8541b5..6dbe049232 100644 --- a/runtime/CMakeLists.txt +++ b/runtime/CMakeLists.txt @@ -137,6 +137,7 @@ endforeach() file(GLOB_RECURSE RUNTIME_FILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} + rgb.txt *.vim *.dict *.py *.rb *.ps *.tutor) foreach(F ${RUNTIME_FILES}) diff --git a/runtime/autoload/ada.vim b/runtime/autoload/ada.vim index ce3a19369a..d04feb9250 100644 --- a/runtime/autoload/ada.vim +++ b/runtime/autoload/ada.vim @@ -591,7 +591,7 @@ function ada#Map_Menu (Text, Keys, Command) \" :" . a:Command execute \ "inoremap " . - \ " a" . a:Keys . + \ " a" . a:Keys . \" :" . a:Command endif return diff --git a/runtime/autoload/health.vim b/runtime/autoload/health.vim index b076f2456b..53d45afc2e 100644 --- a/runtime/autoload/health.vim +++ b/runtime/autoload/health.vim @@ -3,20 +3,20 @@ function! s:enhance_syntax() abort syntax keyword healthError ERROR[:] \ containedin=markdownCodeBlock,mkdListItemLine - highlight link healthError Error + highlight default link healthError Error syntax keyword healthWarning WARNING[:] \ containedin=markdownCodeBlock,mkdListItemLine - highlight link healthWarning WarningMsg + highlight default link healthWarning WarningMsg syntax keyword healthSuccess OK[:] \ containedin=markdownCodeBlock,mkdListItemLine - highlight healthSuccess guibg=#5fff00 guifg=#080808 ctermbg=82 ctermfg=232 + highlight default healthSuccess guibg=#5fff00 guifg=#080808 ctermbg=82 ctermfg=232 syntax match healthHelp "|.\{-}|" contains=healthBar \ containedin=markdownCodeBlock,mkdListItemLine syntax match healthBar "|" contained conceal - highlight link healthHelp Identifier + highlight default link healthHelp Identifier " We do not care about markdown syntax errors in :checkhealth output. highlight! link markdownError Normal diff --git a/runtime/autoload/health/nvim.vim b/runtime/autoload/health/nvim.vim index 7f6e943dc9..58033f0405 100644 --- a/runtime/autoload/health/nvim.vim +++ b/runtime/autoload/health/nvim.vim @@ -58,7 +58,7 @@ function! s:check_rplugin_manifest() abort let contents = join(readfile(script)) if contents =~# '\<\%(from\|import\)\s\+neovim\>' if script =~# '[\/]__init__\.py$' - let script = fnamemodify(script, ':h') + let script = tr(fnamemodify(script, ':h'), '\', '/') endif if !has_key(existing_rplugins, script) @@ -173,6 +173,11 @@ function! s:check_terminal() abort call health#report_info('key_dc (kdch1) terminfo entry: ' \ .(empty(kbs_entry) ? '? (not found)' : kdch1_entry)) endif + for env_var in ['XTERM_VERSION', 'VTE_VERSION', 'TERM_PROGRAM', 'COLORTERM', 'SSH_TTY'] + if !exists('$'.env_var) + call health#report_info(printf("$%s='%s'", env_var, eval('$'.env_var))) + endif + endfor endfunction function! health#nvim#check() abort diff --git a/runtime/autoload/health/provider.vim b/runtime/autoload/health/provider.vim index 0eaa678459..0201ed8062 100644 --- a/runtime/autoload/health/provider.vim +++ b/runtime/autoload/health/provider.vim @@ -487,9 +487,71 @@ function! s:check_ruby() abort endif endfunction +function! s:check_node() abort + call health#report_start('Node provider (optional)') + + let loaded_var = 'g:loaded_node_provider' + if exists(loaded_var) && !exists('*provider#node#Call') + call health#report_info('Disabled. '.loaded_var.'='.eval(loaded_var)) + return + endif + + if !executable('node') || !executable('npm') + call health#report_warn( + \ '`node` and `npm` must be in $PATH.', + \ ['Install Node.js and verify that `node` and `npm` commands work.']) + return + endif + call health#report_info('Node: '. s:system('node -v')) + + let host = provider#node#Detect() + if empty(host) + call health#report_warn('Missing "neovim" npm package.', + \ ['Run in shell: npm install -g neovim', + \ 'Is the npm bin directory in $PATH?']) + return + endif + call health#report_info('Host: '. host) + + let latest_npm_cmd = has('win32') ? 'cmd /c npm info neovim --json' : 'npm info neovim --json' + let latest_npm = s:system(split(latest_npm_cmd)) + if s:shell_error || empty(latest_npm) + call health#report_error('Failed to run: '. latest_npm_cmd, + \ ["Make sure you're connected to the internet.", + \ 'Are you behind a firewall or proxy?']) + return + endif + if !empty(latest_npm) + try + let pkg_data = json_decode(latest_npm) + catch /E474/ + return 'error: '.latest_npm + endtry + let latest_npm = get(get(pkg_data, 'dist-tags', {}), 'latest', 'unable to parse') + endif + + let current_npm_cmd = host .' --version' + let current_npm = s:system(current_npm_cmd) + if s:shell_error + call health#report_error('Failed to run: '. current_npm_cmd, + \ ['Report this issue with the output of: ', current_npm_cmd]) + return + endif + + if s:version_cmp(current_npm, latest_npm) == -1 + call health#report_warn( + \ printf('Package "neovim" is out-of-date. Installed: %s, latest: %s', + \ current_npm, latest_npm), + \ ['Run in shell: npm update neovim']) + else + call health#report_ok('Latest "neovim" npm is installed: '. current_npm) + endif +endfunction + function! health#provider#check() abort call s:check_clipboard() call s:check_python(2) call s:check_python(3) call s:check_ruby() + call s:check_node() endfunction diff --git a/runtime/autoload/paste.vim b/runtime/autoload/paste.vim index fcf06ecdf9..dd7b3ae54a 100644 --- a/runtime/autoload/paste.vim +++ b/runtime/autoload/paste.vim @@ -1,6 +1,6 @@ " Vim support file to help with paste mappings and menus " Maintainer: Bram Moolenaar -" Last Change: 2006 Jun 23 +" Last Change: 2017 Aug 30 " Define the string to use for items that are present both in Edit, Popup and " Toolbar menu. Also used in mswin.vim and macmap.vim. @@ -12,7 +12,7 @@ if has("virtualedit") let paste#paste_cmd = {'n': ":call paste#Paste()"} let paste#paste_cmd['v'] = '"-c' . paste#paste_cmd['n'] - let paste#paste_cmd['i'] = 'x' . paste#paste_cmd['n'] . 'gi' + let paste#paste_cmd['i'] = "\\\"+gP" func! paste#Paste() let ove = &ve diff --git a/runtime/autoload/provider/node.vim b/runtime/autoload/provider/node.vim new file mode 100644 index 0000000000..b08ad4f316 --- /dev/null +++ b/runtime/autoload/provider/node.vim @@ -0,0 +1,80 @@ +if exists('g:loaded_node_provider') + finish +endif +let g:loaded_node_provider = 1 + +let s:job_opts = {'rpc': v:true, 'on_stderr': function('provider#stderr_collector')} + +function! provider#node#Detect() abort + return has('win32') ? exepath('neovim-node-host.cmd') : exepath('neovim-node-host') +endfunction + +function! provider#node#Prog() + return s:prog +endfunction + +function! provider#node#Require(host) abort + if s:err != '' + echoerr s:err + return + endif + + if has('win32') + let args = provider#node#Prog() + else + let args = ['node'] + + if !empty($NVIM_NODE_HOST_DEBUG) + call add(args, '--inspect-brk') + endif + + call add(args , provider#node#Prog()) + endif + + try + let channel_id = jobstart(args, s:job_opts) + if rpcrequest(channel_id, 'poll') ==# 'ok' + return channel_id + endif + catch + echomsg v:throwpoint + echomsg v:exception + for row in provider#get_stderr(channel_id) + echomsg row + endfor + endtry + finally + call provider#clear_stderr(channel_id) + endtry + throw remote#host#LoadErrorForHost(a:host.orig_name, '$NVIM_NODE_LOG_FILE') +endfunction + +function! provider#node#Call(method, args) + if s:err != '' + echoerr s:err + return + endif + + if !exists('s:host') + try + let s:host = remote#host#Require('node') + catch + let s:err = v:exception + echohl WarningMsg + echomsg v:exception + echohl None + return + endtry + endif + return call('rpcrequest', insert(insert(a:args, 'node_'.a:method), s:host)) +endfunction + + +let s:err = '' +let s:prog = provider#node#Detect() + +if empty(s:prog) + let s:err = 'Cannot find the "neovim" node package. Try :CheckHealth' +endif + +call remote#host#RegisterPlugin('node-provider', 'node', []) diff --git a/runtime/autoload/provider/ruby.vim b/runtime/autoload/provider/ruby.vim index 7df3500267..518a9dc793 100644 --- a/runtime/autoload/provider/ruby.vim +++ b/runtime/autoload/provider/ruby.vim @@ -19,7 +19,7 @@ function! provider#ruby#Detect() abort if exists("g:ruby_host_prog") return g:ruby_host_prog else - return exepath('neovim-ruby-host') + return has('win32') ? exepath('neovim-ruby-host.cmd') : exepath('neovim-ruby-host') end endfunction diff --git a/runtime/autoload/remote/host.vim b/runtime/autoload/remote/host.vim index e695fb7df7..dfaab7d246 100644 --- a/runtime/autoload/remote/host.vim +++ b/runtime/autoload/remote/host.vim @@ -199,3 +199,7 @@ call remote#host#Register('python3', '*', " Ruby call remote#host#Register('ruby', '*.rb', \ function('provider#ruby#Require')) + +" nodejs +call remote#host#Register('node', '*', + \ function('provider#node#Require')) diff --git a/runtime/autoload/rust.vim b/runtime/autoload/rust.vim new file mode 100644 index 0000000000..34a3b41773 --- /dev/null +++ b/runtime/autoload/rust.vim @@ -0,0 +1,415 @@ +" Author: Kevin Ballard +" Description: Helper functions for Rust commands/mappings +" Last Modified: May 27, 2014 +" For bugs, patches and license go to https://github.com/rust-lang/rust.vim + +" Jump {{{1 + +function! rust#Jump(mode, function) range + let cnt = v:count1 + normal! m' + if a:mode ==# 'v' + norm! gv + endif + let foldenable = &foldenable + set nofoldenable + while cnt > 0 + execute "call Jump_" . a:function . "()" + let cnt = cnt - 1 + endwhile + let &foldenable = foldenable +endfunction + +function! s:Jump_Back() + call search('{', 'b') + keepjumps normal! w99[{ +endfunction + +function! s:Jump_Forward() + normal! j0 + call search('{', 'b') + keepjumps normal! w99[{% + call search('{') +endfunction + +" Run {{{1 + +function! rust#Run(bang, args) + let args = s:ShellTokenize(a:args) + if a:bang + let idx = index(l:args, '--') + if idx != -1 + let rustc_args = idx == 0 ? [] : l:args[:idx-1] + let args = l:args[idx+1:] + else + let rustc_args = l:args + let args = [] + endif + else + let rustc_args = [] + endif + + let b:rust_last_rustc_args = l:rustc_args + let b:rust_last_args = l:args + + call s:WithPath(function("s:Run"), rustc_args, args) +endfunction + +function! s:Run(dict, rustc_args, args) + let exepath = a:dict.tmpdir.'/'.fnamemodify(a:dict.path, ':t:r') + if has('win32') + let exepath .= '.exe' + endif + + let relpath = get(a:dict, 'tmpdir_relpath', a:dict.path) + let rustc_args = [relpath, '-o', exepath] + a:rustc_args + + let rustc = exists("g:rustc_path") ? g:rustc_path : "rustc" + + let pwd = a:dict.istemp ? a:dict.tmpdir : '' + let output = s:system(pwd, shellescape(rustc) . " " . join(map(rustc_args, 'shellescape(v:val)'))) + if output != '' + echohl WarningMsg + echo output + echohl None + endif + if !v:shell_error + exe '!' . shellescape(exepath) . " " . join(map(a:args, 'shellescape(v:val)')) + endif +endfunction + +" Expand {{{1 + +function! rust#Expand(bang, args) + let args = s:ShellTokenize(a:args) + if a:bang && !empty(l:args) + let pretty = remove(l:args, 0) + else + let pretty = "expanded" + endif + call s:WithPath(function("s:Expand"), pretty, args) +endfunction + +function! s:Expand(dict, pretty, args) + try + let rustc = exists("g:rustc_path") ? g:rustc_path : "rustc" + + if a:pretty =~? '^\%(everybody_loops$\|flowgraph=\)' + let flag = '--xpretty' + else + let flag = '--pretty' + endif + let relpath = get(a:dict, 'tmpdir_relpath', a:dict.path) + let args = [relpath, '-Z', 'unstable-options', l:flag, a:pretty] + a:args + let pwd = a:dict.istemp ? a:dict.tmpdir : '' + let output = s:system(pwd, shellescape(rustc) . " " . join(map(args, 'shellescape(v:val)'))) + if v:shell_error + echohl WarningMsg + echo output + echohl None + else + new + silent put =output + 1 + d + setl filetype=rust + setl buftype=nofile + setl bufhidden=hide + setl noswapfile + " give the buffer a nice name + let suffix = 1 + let basename = fnamemodify(a:dict.path, ':t:r') + while 1 + let bufname = basename + if suffix > 1 | let bufname .= ' ('.suffix.')' | endif + let bufname .= '.pretty.rs' + if bufexists(bufname) + let suffix += 1 + continue + endif + exe 'silent noautocmd keepalt file' fnameescape(bufname) + break + endwhile + endif + endtry +endfunction + +function! rust#CompleteExpand(lead, line, pos) + if a:line[: a:pos-1] =~ '^RustExpand!\s*\S*$' + " first argument and it has a ! + let list = ["normal", "expanded", "typed", "expanded,identified", "flowgraph=", "everybody_loops"] + if !empty(a:lead) + call filter(list, "v:val[:len(a:lead)-1] == a:lead") + endif + return list + endif + + return glob(escape(a:lead, "*?[") . '*', 0, 1) +endfunction + +" Emit {{{1 + +function! rust#Emit(type, args) + let args = s:ShellTokenize(a:args) + call s:WithPath(function("s:Emit"), a:type, args) +endfunction + +function! s:Emit(dict, type, args) + try + let output_path = a:dict.tmpdir.'/output' + + let rustc = exists("g:rustc_path") ? g:rustc_path : "rustc" + + let relpath = get(a:dict, 'tmpdir_relpath', a:dict.path) + let args = [relpath, '--emit', a:type, '-o', output_path] + a:args + let pwd = a:dict.istemp ? a:dict.tmpdir : '' + let output = s:system(pwd, shellescape(rustc) . " " . join(map(args, 'shellescape(v:val)'))) + if output != '' + echohl WarningMsg + echo output + echohl None + endif + if !v:shell_error + new + exe 'silent keepalt read' fnameescape(output_path) + 1 + d + if a:type == "llvm-ir" + setl filetype=llvm + let extension = 'll' + elseif a:type == "asm" + setl filetype=asm + let extension = 's' + endif + setl buftype=nofile + setl bufhidden=hide + setl noswapfile + if exists('l:extension') + " give the buffer a nice name + let suffix = 1 + let basename = fnamemodify(a:dict.path, ':t:r') + while 1 + let bufname = basename + if suffix > 1 | let bufname .= ' ('.suffix.')' | endif + let bufname .= '.'.extension + if bufexists(bufname) + let suffix += 1 + continue + endif + exe 'silent noautocmd keepalt file' fnameescape(bufname) + break + endwhile + endif + endif + endtry +endfunction + +" Utility functions {{{1 + +" Invokes func(dict, ...) +" Where {dict} is a dictionary with the following keys: +" 'path' - The path to the file +" 'tmpdir' - The path to a temporary directory that will be deleted when the +" function returns. +" 'istemp' - 1 if the path is a file inside of {dict.tmpdir} or 0 otherwise. +" If {istemp} is 1 then an additional key is provided: +" 'tmpdir_relpath' - The {path} relative to the {tmpdir}. +" +" {dict.path} may be a path to a file inside of {dict.tmpdir} or it may be the +" existing path of the current buffer. If the path is inside of {dict.tmpdir} +" then it is guaranteed to have a '.rs' extension. +function! s:WithPath(func, ...) + let buf = bufnr('') + let saved = {} + let dict = {} + try + let saved.write = &write + set write + let dict.path = expand('%') + let pathisempty = empty(dict.path) + + " Always create a tmpdir in case the wrapped command wants it + let dict.tmpdir = tempname() + call mkdir(dict.tmpdir) + + if pathisempty || !saved.write + let dict.istemp = 1 + " if we're doing this because of nowrite, preserve the filename + if !pathisempty + let filename = expand('%:t:r').".rs" + else + let filename = 'unnamed.rs' + endif + let dict.tmpdir_relpath = filename + let dict.path = dict.tmpdir.'/'.filename + + let saved.mod = &mod + set nomod + + silent exe 'keepalt write! ' . fnameescape(dict.path) + if pathisempty + silent keepalt 0file + endif + else + let dict.istemp = 0 + update + endif + + call call(a:func, [dict] + a:000) + finally + if bufexists(buf) + for [opt, value] in items(saved) + silent call setbufvar(buf, '&'.opt, value) + unlet value " avoid variable type mismatches + endfor + endif + if has_key(dict, 'tmpdir') | silent call s:RmDir(dict.tmpdir) | endif + endtry +endfunction + +function! rust#AppendCmdLine(text) + call setcmdpos(getcmdpos()) + let cmd = getcmdline() . a:text + return cmd +endfunction + +" Tokenize the string according to sh parsing rules +function! s:ShellTokenize(text) + " states: + " 0: start of word + " 1: unquoted + " 2: unquoted backslash + " 3: double-quote + " 4: double-quoted backslash + " 5: single-quote + let l:state = 0 + let l:current = '' + let l:args = [] + for c in split(a:text, '\zs') + if l:state == 0 || l:state == 1 " unquoted + if l:c ==# ' ' + if l:state == 0 | continue | endif + call add(l:args, l:current) + let l:current = '' + let l:state = 0 + elseif l:c ==# '\' + let l:state = 2 + elseif l:c ==# '"' + let l:state = 3 + elseif l:c ==# "'" + let l:state = 5 + else + let l:current .= l:c + let l:state = 1 + endif + elseif l:state == 2 " unquoted backslash + if l:c !=# "\n" " can it even be \n? + let l:current .= l:c + endif + let l:state = 1 + elseif l:state == 3 " double-quote + if l:c ==# '\' + let l:state = 4 + elseif l:c ==# '"' + let l:state = 1 + else + let l:current .= l:c + endif + elseif l:state == 4 " double-quoted backslash + if stridx('$`"\', l:c) >= 0 + let l:current .= l:c + elseif l:c ==# "\n" " is this even possible? + " skip it + else + let l:current .= '\'.l:c + endif + let l:state = 3 + elseif l:state == 5 " single-quoted + if l:c == "'" + let l:state = 1 + else + let l:current .= l:c + endif + endif + endfor + if l:state != 0 + call add(l:args, l:current) + endif + return l:args +endfunction + +function! s:RmDir(path) + " sanity check; make sure it's not empty, /, or $HOME + if empty(a:path) + echoerr 'Attempted to delete empty path' + return 0 + elseif a:path == '/' || a:path == $HOME + echoerr 'Attempted to delete protected path: ' . a:path + return 0 + endif + return system("rm -rf " . shellescape(a:path)) +endfunction + +" Executes {cmd} with the cwd set to {pwd}, without changing Vim's cwd. +" If {pwd} is the empty string then it doesn't change the cwd. +function! s:system(pwd, cmd) + let cmd = a:cmd + if !empty(a:pwd) + let cmd = 'cd ' . shellescape(a:pwd) . ' && ' . cmd + endif + return system(cmd) +endfunction + +" Playpen Support {{{1 +" Parts of gist.vim by Yasuhiro Matsumoto reused +" gist.vim available under the BSD license, available at +" http://github.com/mattn/gist-vim +function! s:has_webapi() + if !exists("*webapi#http#post") + try + call webapi#http#post() + catch + endtry + endif + return exists("*webapi#http#post") +endfunction + +function! rust#Play(count, line1, line2, ...) abort + redraw + + let l:rust_playpen_url = get(g:, 'rust_playpen_url', 'https://play.rust-lang.org/') + let l:rust_shortener_url = get(g:, 'rust_shortener_url', 'https://is.gd/') + + if !s:has_webapi() + echohl ErrorMsg | echomsg ':RustPlay depends on webapi.vim (https://github.com/mattn/webapi-vim)' | echohl None + return + endif + + let bufname = bufname('%') + if a:count < 1 + let content = join(getline(a:line1, a:line2), "\n") + else + let save_regcont = @" + let save_regtype = getregtype('"') + silent! normal! gvy + let content = @" + call setreg('"', save_regcont, save_regtype) + endif + + let body = l:rust_playpen_url."?code=".webapi#http#encodeURI(content) + + if strlen(body) > 5000 + echohl ErrorMsg | echomsg 'Buffer too large, max 5000 encoded characters ('.strlen(body).')' | echohl None + return + endif + + let payload = "format=simple&url=".webapi#http#encodeURI(body) + let res = webapi#http#post(l:rust_shortener_url.'create.php', payload, {}) + let url = res.content + + redraw | echomsg 'Done: '.url +endfunction + +" }}}1 + +" vim: set noet sw=8 ts=8: diff --git a/runtime/autoload/rustfmt.vim b/runtime/autoload/rustfmt.vim new file mode 100644 index 0000000000..a689b5e00d --- /dev/null +++ b/runtime/autoload/rustfmt.vim @@ -0,0 +1,107 @@ +" Author: Stephen Sugden +" +" Adapted from https://github.com/fatih/vim-go +" For bugs, patches and license go to https://github.com/rust-lang/rust.vim + +if !exists("g:rustfmt_autosave") + let g:rustfmt_autosave = 0 +endif + +if !exists("g:rustfmt_command") + let g:rustfmt_command = "rustfmt" +endif + +if !exists("g:rustfmt_options") + let g:rustfmt_options = "" +endif + +if !exists("g:rustfmt_fail_silently") + let g:rustfmt_fail_silently = 0 +endif + +let s:got_fmt_error = 0 + +function! s:RustfmtCommandRange(filename, line1, line2) + let l:arg = {"file": shellescape(a:filename), "range": [a:line1, a:line2]} + return printf("%s %s --write-mode=overwrite --file-lines '[%s]'", g:rustfmt_command, g:rustfmt_options, json_encode(l:arg)) +endfunction + +function! s:RustfmtCommand(filename) + return g:rustfmt_command . " --write-mode=overwrite " . g:rustfmt_options . " " . shellescape(a:filename) +endfunction + +function! s:RunRustfmt(command, curw, tmpname) + if exists("*systemlist") + let out = systemlist(a:command) + else + let out = split(system(a:command), '\r\?\n') + endif + + if v:shell_error == 0 || v:shell_error == 3 + " remove undo point caused via BufWritePre + try | silent undojoin | catch | endtry + + " Replace current file with temp file, then reload buffer + call rename(a:tmpname, expand('%')) + silent edit! + let &syntax = &syntax + + " only clear location list if it was previously filled to prevent + " clobbering other additions + if s:got_fmt_error + let s:got_fmt_error = 0 + call setloclist(0, []) + lwindow + endif + elseif g:rustfmt_fail_silently == 0 + " otherwise get the errors and put them in the location list + let errors = [] + + for line in out + " src/lib.rs:13:5: 13:10 error: expected `,`, or `}`, found `value` + let tokens = matchlist(line, '^\(.\{-}\):\(\d\+\):\(\d\+\):\s*\(\d\+:\d\+\s*\)\?\s*error: \(.*\)') + if !empty(tokens) + call add(errors, {"filename": @%, + \"lnum": tokens[2], + \"col": tokens[3], + \"text": tokens[5]}) + endif + endfor + + if empty(errors) + % | " Couldn't detect rustfmt error format, output errors + endif + + if !empty(errors) + call setloclist(0, errors, 'r') + echohl Error | echomsg "rustfmt returned error" | echohl None + endif + + let s:got_fmt_error = 1 + lwindow + " We didn't use the temp file, so clean up + call delete(a:tmpname) + endif + + call winrestview(a:curw) +endfunction + +function! rustfmt#FormatRange(line1, line2) + let l:curw = winsaveview() + let l:tmpname = expand("%:p:h") . "/." . expand("%:p:t") . ".rustfmt" + call writefile(getline(1, '$'), l:tmpname) + + let command = s:RustfmtCommandRange(l:tmpname, a:line1, a:line2) + + call s:RunRustfmt(command, l:curw, l:tmpname) +endfunction + +function! rustfmt#Format() + let l:curw = winsaveview() + let l:tmpname = expand("%:p:h") . "/." . expand("%:p:t") . ".rustfmt" + call writefile(getline(1, '$'), l:tmpname) + + let command = s:RustfmtCommand(l:tmpname) + + call s:RunRustfmt(command, l:curw, l:tmpname) +endfunction diff --git a/runtime/autoload/spellfile.vim b/runtime/autoload/spellfile.vim index fe7113b9a4..84584c6e29 100644 --- a/runtime/autoload/spellfile.vim +++ b/runtime/autoload/spellfile.vim @@ -197,7 +197,7 @@ function! spellfile#WritableSpellDir() " Always use the $XDG_DATA_HOME/nvim/site directory if exists('$XDG_DATA_HOME') return $XDG_DATA_HOME . "/nvim/site/spell" - else + elseif !(has('win32') || has('win64')) return $HOME . "/.local/share/nvim/site/spell" endif for dir in split(&rtp, ',') diff --git a/runtime/autoload/sqlcomplete.vim b/runtime/autoload/sqlcomplete.vim index e80729add4..ea0d8c2de9 100644 --- a/runtime/autoload/sqlcomplete.vim +++ b/runtime/autoload/sqlcomplete.vim @@ -2,7 +2,7 @@ " Language: SQL " Maintainer: David Fishburn " Version: 16.0 -" Last Change: 2015 Dec 29 +" Last Change: 2017 Oct 15 " Homepage: http://www.vim.org/scripts/script.php?script_id=1572 " Usage: For detailed help " ":help sql.txt" diff --git a/runtime/compiler/cargo.vim b/runtime/compiler/cargo.vim new file mode 100644 index 0000000000..bd48666bc9 --- /dev/null +++ b/runtime/compiler/cargo.vim @@ -0,0 +1,35 @@ +" Vim compiler file +" Compiler: Cargo Compiler +" Maintainer: Damien Radtke +" Latest Revision: 2014 Sep 24 +" For bugs, patches and license go to https://github.com/rust-lang/rust.vim + +if exists('current_compiler') + finish +endif +runtime compiler/rustc.vim +let current_compiler = "cargo" + +let s:save_cpo = &cpo +set cpo&vim + +if exists(':CompilerSet') != 2 + command -nargs=* CompilerSet setlocal +endif + +if exists('g:cargo_makeprg_params') + execute 'CompilerSet makeprg=cargo\ '.escape(g:cargo_makeprg_params, ' \|"').'\ $*' +else + CompilerSet makeprg=cargo\ $* +endif + +" Ignore general cargo progress messages +CompilerSet errorformat+= + \%-G%\\s%#Downloading%.%#, + \%-G%\\s%#Compiling%.%#, + \%-G%\\s%#Finished%.%#, + \%-G%\\s%#error:\ Could\ not\ compile\ %.%#, + \%-G%\\s%#To\ learn\ more\\,%.%# + +let &cpo = s:save_cpo +unlet s:save_cpo diff --git a/runtime/compiler/rst.vim b/runtime/compiler/rst.vim index c34bd3ba81..392bea6ae0 100644 --- a/runtime/compiler/rst.vim +++ b/runtime/compiler/rst.vim @@ -1,7 +1,8 @@ " Vim compiler file -" Compiler: reStructuredText Documentation Format +" Compiler: sphinx >= 1.0.8, http://www.sphinx-doc.org +" Description: reStructuredText Documentation Format " Previous Maintainer: Nikolai Weibull -" Latest Revision: 2006-04-19 +" Latest Revision: 2017-03-31 if exists("current_compiler") finish @@ -11,12 +12,18 @@ let current_compiler = "rst" let s:cpo_save = &cpo set cpo&vim -setlocal errorformat= - \%f:%l:\ (%tEBUG/0)\ %m, - \%f:%l:\ (%tNFO/1)\ %m, - \%f:%l:\ (%tARNING/2)\ %m, - \%f:%l:\ (%tRROR/3)\ %m, - \%f:%l:\ (%tEVERE/3)\ %m, +if exists(":CompilerSet") != 2 + command -nargs=* CompilerSet setlocal +endif + +CompilerSet errorformat= + \%f\\:%l:\ %tEBUG:\ %m, + \%f\\:%l:\ %tNFO:\ %m, + \%f\\:%l:\ %tARNING:\ %m, + \%f\\:%l:\ %tRROR:\ %m, + \%f\\:%l:\ %tEVERE:\ %m, + \%f\\:%s:\ %tARNING:\ %m, + \%f\\:%s:\ %tRROR:\ %m, \%D%*\\a[%*\\d]:\ Entering\ directory\ `%f', \%X%*\\a[%*\\d]:\ Leaving\ directory\ `%f', \%DMaking\ %*\\a\ in\ %f diff --git a/runtime/compiler/rustc.vim b/runtime/compiler/rustc.vim new file mode 100644 index 0000000000..c27bdc9c0c --- /dev/null +++ b/runtime/compiler/rustc.vim @@ -0,0 +1,46 @@ +" Vim compiler file +" Compiler: Rust Compiler +" Maintainer: Chris Morgan +" Latest Revision: 2013 Jul 12 +" For bugs, patches and license go to https://github.com/rust-lang/rust.vim + +if exists("current_compiler") + finish +endif +let current_compiler = "rustc" + +let s:cpo_save = &cpo +set cpo&vim + +if exists(":CompilerSet") != 2 + command -nargs=* CompilerSet setlocal +endif + +if exists("g:rustc_makeprg_no_percent") && g:rustc_makeprg_no_percent != 0 + CompilerSet makeprg=rustc +else + CompilerSet makeprg=rustc\ \% +endif + +" Old errorformat (before nightly 2016/08/10) +CompilerSet errorformat= + \%f:%l:%c:\ %t%*[^:]:\ %m, + \%f:%l:%c:\ %*\\d:%*\\d\ %t%*[^:]:\ %m, + \%-G%f:%l\ %s, + \%-G%*[\ ]^, + \%-G%*[\ ]^%*[~], + \%-G%*[\ ]... + +" New errorformat (after nightly 2016/08/10) +CompilerSet errorformat+= + \%-G, + \%-Gerror:\ aborting\ %.%#, + \%-Gerror:\ Could\ not\ compile\ %.%#, + \%Eerror:\ %m, + \%Eerror[E%n]:\ %m, + \%Wwarning:\ %m, + \%Inote:\ %m, + \%C\ %#-->\ %f:%l:%c + +let &cpo = s:cpo_save +unlet s:cpo_save diff --git a/runtime/doc/arabic.txt b/runtime/doc/arabic.txt index 3f30d7b5bc..07350083c6 100644 --- a/runtime/doc/arabic.txt +++ b/runtime/doc/arabic.txt @@ -36,7 +36,7 @@ the user interface remains the standard Vi interface. Highlights ---------- -o Editing left-to-right files as in the original VIM hasn't changed. +o Editing left-to-right files as in the original Vim hasn't changed. o Viewing and editing files in right-to-left windows. File orientation is per window, so it is possible to view the same @@ -46,7 +46,7 @@ o No special terminal with right-to-left capabilities is required. The right-to-left changes are completely hardware independent. Only Arabic fonts are necessary. -o Compatible with the original VIM. Almost all features work in +o Compatible with the original Vim. Almost all features work in right-to-left mode (there are liable to be bugs). o Changing keyboard mapping and reverse insert modes using a single @@ -60,14 +60,14 @@ o While in Arabic mode, numbers are entered from left to right. Upon o Arabic keymapping on the command line in reverse insert mode. -o Proper Bidirectional functionality is possible given VIM is +o Proper Bidirectional functionality is possible given Vim is started within a Bidi capable terminal emulator. Arabic Fonts *arabicfonts* ------------ -VIM requires monospaced fonts of which there are many out there. +Vim requires monospaced fonts of which there are many out there. Arabic requires ISO-8859-6 as well as Presentation Form-B fonts (without Form-B, Arabic will _NOT_ be usable). It is highly recommended that users search for so-called 'ISO-10646-1' fonts. @@ -90,13 +90,13 @@ o Installation of fonts for X Window systems (Unix/Linux) Usage ----- -Prior to the actual usage of Arabic within VIM, a number of settings +Prior to the actual usage of Arabic within Vim, a number of settings need to be accounted for and invoked. o Setting the Arabic fonts - + For VIM GUI set the 'guifont' to your_ARABIC_FONT. This is done - by entering the following command in the VIM window. + + For Vim GUI set the 'guifont' to your_ARABIC_FONT. This is done + by entering the following command in the Vim window. > :set guifont=your_ARABIC_FONT < @@ -109,7 +109,7 @@ o Setting the Arabic fonts you can include ':set guifont=your_ARABIC_FONT' to your vimrc file. - + Under the X Window environment, you can also start VIM with + + Under the X Window environment, you can also start Vim with '-fn your_ARABIC_FONT' option. o Setting the appropriate character Encoding @@ -131,11 +131,11 @@ o Setting the appropriate character Encoding o Enable Arabic settings [short-cut] In order to simplify and streamline things, you can either invoke - VIM with the command-line option, + Vim with the command-line option, % vim -A my_utf8_arabic_file ... - or enable 'arabic' via the following command within VIM + or enable 'arabic' via the following command within Vim > :set arabic < @@ -196,7 +196,7 @@ o Enable Arabic settings [short-cut] + Arabic deletion of a combined pair character - By default VIM has the 'delcombine' option disabled. This option + By default Vim has the 'delcombine' option disabled. This option allows the deletion of ALEF in a LAM_ALEF (LAA) combined character and still retain the LAM (i.e. it reverts to treating the combined character as its natural two characters form -- this also pertains @@ -255,7 +255,7 @@ o Enable Arabic settings [short-cut] Keymap/Keyboard *arabickeymap* --------------- -The character/letter encoding used in VIM is the standard UTF-8. +The character/letter encoding used in Vim is the standard UTF-8. It is widely discouraged that any other encoding be used or even attempted. @@ -288,7 +288,7 @@ o Keyboard Restrictions ------------ -o VIM in its GUI form does not currently support Bi-directionality +o Vim in its GUI form does not currently support Bi-directionality (i.e. the ability to see both Arabic and Latin intermixed within the same line). diff --git a/runtime/doc/autocmd.txt b/runtime/doc/autocmd.txt index 2850c8058f..6cffbf4cb6 100644 --- a/runtime/doc/autocmd.txt +++ b/runtime/doc/autocmd.txt @@ -55,7 +55,14 @@ Note: The ":autocmd" command can only be followed by another command when the '|' appears before {cmd}. This works: > :augroup mine | au! BufRead | augroup END But this sees "augroup" as part of the defined command: > + :augroup mine | au! BufRead * | augroup END :augroup mine | au BufRead * set tw=70 | augroup END +Instead you can put the group name into the command: > + :au! mine BufRead * + :au mine BufRead * set tw=70 +Or use `:execute`: > + :augroup mine | exe "au! BufRead *" | augroup END + :augroup mine | exe "au BufRead * set tw=70" | augroup END Note that special characters (e.g., "%", "") in the ":autocmd" arguments are not expanded when the autocommand is defined. These will be @@ -605,7 +612,7 @@ FileChangedShell When Vim notices that the modification time of |timestamp| Mostly triggered after executing a shell command, but also with a |:checktime| command - or when Gvim regains input focus. + or when gvim regains input focus. This autocommand is triggered for each changed file. It is not used when 'autoread' is set and the buffer was not changed. If a @@ -616,7 +623,7 @@ FileChangedShell When Vim notices that the modification time of to tell Vim what to do next. NOTE: When this autocommand is executed, the current buffer "%" may be different from the - buffer that was changed "". + buffer that was changed, which is in "". NOTE: The commands must not change the current buffer, jump to another buffer or delete a buffer. *E246* *E811* @@ -643,7 +650,8 @@ FileType When the 'filetype' option has been set. The pattern is matched against the filetype. can be used for the name of the file where this option was set, and for - the new value of 'filetype'. + the new value of 'filetype'. Navigating to + another window or buffer is not allowed. See |filetypes|. *FileWriteCmd* FileWriteCmd Before writing to a file, when not writing the diff --git a/runtime/doc/cmdline.txt b/runtime/doc/cmdline.txt index 4222a5b6f7..4956b9e6fe 100644 --- a/runtime/doc/cmdline.txt +++ b/runtime/doc/cmdline.txt @@ -361,7 +361,7 @@ These are the commands that can be used: *c_CTRL-D* CTRL-D List names that match the pattern in front of the cursor. When showing file names, directories are highlighted (see - 'highlight' option). Names where 'suffixes' matches are moved + |highlight-groups|). Names where 'suffixes' matches are moved to the end. The 'wildoptions' option can be set to "tagfile" to list the file of matching tags. @@ -420,6 +420,9 @@ matches exactly one character. The 'wildignorecase' option can be set to ignore case in filenames. +The 'wildmenu' option can be set to show the matches just above the command +line. + If you like tcsh's autolist completion, you can use this mapping: :cnoremap X (Where X is the command key to use, is CTRL-L and is CTRL-D) @@ -778,6 +781,7 @@ Also see |`=|. *:* *:* *:* ** *:* ** *:* ** *:* ** *:* ** + *:* ** ** *E495* *E496* *E497* *E499* *E500* Note: these are typed literally, they are not special keys! is replaced with the word under the cursor (like |star|) @@ -785,7 +789,8 @@ Note: these are typed literally, they are not special keys! is replaced with the path name under the cursor (like what |gf| uses) When executing autocommands, is replaced with the file name - for a file read or write. + of the buffer being manipulated, or the file for a read or + write. When executing autocommands, is replaced with the currently effective buffer number (for ":r file" and ":so file" it is the current buffer, the file being read/sourced is not in a diff --git a/runtime/doc/deprecated.txt b/runtime/doc/deprecated.txt index b3e2f7a92f..f3d4f16244 100644 --- a/runtime/doc/deprecated.txt +++ b/runtime/doc/deprecated.txt @@ -47,6 +47,7 @@ Modifiers ~ Options ~ *'fe'* 'fenc'+'enc' before Vim 6.0; no longer used. +*'highlight'* *'hl'* Names of builtin |highlight-groups| cannot be changed. *'langnoremap'* Deprecated alias to 'nolangremap'. *'vi'* *'viminfo'* Deprecated alias to 'shada' option. diff --git a/runtime/doc/diff.txt b/runtime/doc/diff.txt index 8cb049584a..b9dccc42a8 100644 --- a/runtime/doc/diff.txt +++ b/runtime/doc/diff.txt @@ -13,7 +13,7 @@ The basics are explained in section |08.7| of the user manual. Type |gO| to see the table of contents. ============================================================================== -1. Starting diff mode +1. Starting diff mode *start-vimdiff* To start editing in diff mode, run "nvim -d". This starts Nvim as usual, and additionally sets up for viewing the differences between the arguments. > @@ -214,8 +214,8 @@ The diffs are highlighted with these groups: (searching from the end of the line). The text in between is highlighted. This means that parts in the middle that are still the - same are highlighted anyway. Only "iwhite" of - 'diffopt' is used here. + same are highlighted anyway. The 'diffopt' + flags "iwhite" and "icase" are used here. |hl-DiffDelete| DiffDelete Deleted lines. Also called filler lines, because they don't really exist in this buffer. @@ -314,7 +314,7 @@ g:diff_translations to zero: > let g:diff_translations = 0 < -After setting this variable, Reload the syntax script: > +After setting this variable, reload the syntax script: > set syntax=diff < diff --git a/runtime/doc/editing.txt b/runtime/doc/editing.txt index 0099d14822..1b9a1b38fb 100644 --- a/runtime/doc/editing.txt +++ b/runtime/doc/editing.txt @@ -1032,6 +1032,7 @@ The names can be in upper- or lowercase. window in the current tab page the current tab page is closed |tab-page|. Triggers the |QuitPre| autocommand event. + See |CTRL-W_q| for quitting another window. :conf[irm] q[uit] Quit, but give prompt when changes have been made, or the last file in the argument list has not been @@ -1265,7 +1266,7 @@ Commands for changing the working directory can be suffixed with a bang "!" *:lc* *:lcd* :lc[d][!] {path} Like |:cd|, but only set the current directory for the current window. The current directory for other - windows or any tabs is not changed. + windows or tabs is not changed. *:lch* *:lchdir* :lch[dir][!] Same as |:lcd|. @@ -1364,6 +1365,13 @@ If you want to automatically reload a file when it has been changed outside of Vim, set the 'autoread' option. This doesn't work at the moment you write the file though, only when the file wasn't changed inside of Vim. +If you do not want to be asked or automatically reload the file, you can use +this: > + set buftype=nofile + +Or, when starting gvim from a shell: > + gvim file.log -c "set buftype=nofile" + Note that if a FileChangedShell autocommand is defined you will not get a warning message or prompt. The autocommand is expected to handle this. @@ -1534,7 +1542,7 @@ There are three different types of searching: This searches the same directories, but in a different order. Note that completion for ":find", ":sfind", and ":tabfind" commands do not - currently work with 'path' items that contain a url or use the double star + currently work with 'path' items that contain a URL or use the double star with depth limiter (/usr/**2) or upward search (;) notations. vim:tw=78:ts=8:ft=help:norl: diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt index 7bf148a833..b752667d9a 100644 --- a/runtime/doc/eval.txt +++ b/runtime/doc/eval.txt @@ -94,9 +94,8 @@ To test for a non-empty string, use empty(): > Function arguments often behave slightly different from |TRUE|: If the argument is present and it evaluates to a non-zero Number, |v:true| or a non-empty String, then the value is considered to be TRUE. -Note that " " and "0" are also non-empty strings, thus cause the mode to be -cleared. A List, Dictionary or Float is not a Number or String, thus -evaluates to FALSE. +Note that " " and "0" are also non-empty strings, thus considered to be TRUE. +A List, Dictionary or Float is not a Number or String, thus evaluate to FALSE. *E745* *E728* *E703* *E729* *E730* *E731* List, Dictionary and Funcref types are not automatically converted. @@ -782,14 +781,15 @@ Examples: "abc" == "Abc" evaluates to 1 if 'ignorecase' is set, 0 otherwise *E691* *E692* -A |List| can only be compared with a |List| and only "equal", "not equal" and -"is" can be used. This compares the values of the list, recursively. -Ignoring case means case is ignored when comparing item values. +A |List| can only be compared with a |List| and only "equal", "not equal", +"is" and "isnot" can be used. This compares the values of the list, +recursively. Ignoring case means case is ignored when comparing item values. *E735* *E736* A |Dictionary| can only be compared with a |Dictionary| and only "equal", "not -equal" and "is" can be used. This compares the key/values of the |Dictionary| -recursively. Ignoring case means case is ignored when comparing item values. +equal", "is" and "isnot" can be used. This compares the key/values of the +|Dictionary| recursively. Ignoring case means case is ignored when comparing +item values. *E694* A |Funcref| can only be compared with a |Funcref| and only "equal", "not @@ -1016,7 +1016,7 @@ When expr8 is a |Funcref| type variable, invoke the function it refers to. *expr9* number ------ -number number constant *expr-number* +number number constant *expr-number* *hex-number* *octal-number* *binary-number* Decimal, Hexadecimal (starting with 0x or 0X), Binary (starting with 0b or 0B) @@ -1474,7 +1474,6 @@ v:count The count given for the last Normal mode command. Can be used When there are two counts, as in "3d2w", they are multiplied, just like what happens in the command, "d6w" for the example. Also used for evaluating the 'formatexpr' option. - "count" also works, for backwards compatibility. *v:count1* *count1-variable* v:count1 Just like "v:count", but defaults to one when no count is @@ -1789,7 +1788,7 @@ v:servername Default Nvim server address. Equivalent to |$NVIM_LISTEN_ADDRESS| on startup. |serverstop()| Read-only. - + v:searchforward *v:searchforward* *searchforward-variable* Search direction: 1 after a forward search, 0 after a backward search. It is reset to forward when directly setting @@ -1871,7 +1870,7 @@ v:termresponse The escape sequence returned by the terminal for the DA *v:testing* *testing-variable* v:testing Must be set before using `test_garbagecollect_now()`. Also, when set certain error messages won't be shown for 2 - seconds. (e.g. "'dictionary' option is empty") + seconds. (e.g. "'dictionary' option is empty") *v:this_session* *this_session-variable* v:this_session Full filename of the last loaded or saved session file. See @@ -2031,9 +2030,9 @@ filereadable({file}) Number |TRUE| if {file} is a readable file filewritable({file}) Number |TRUE| if {file} is a writable file filter({expr1}, {expr2}) List/Dict remove items from {expr1} where {expr2} is 0 -finddir({name}[, {path}[, {count}]]) +finddir({name} [, {path} [, {count}]]) String find directory {name} in {path} -findfile({name}[, {path}[, {count}]]) +findfile({name} [, {path} [, {count}]]) String find file {name} in {path} float2nr({expr}) Number convert Float {expr} to a Number floor({expr}) Float round {expr} down @@ -2077,7 +2076,7 @@ getftime({fname}) Number last modification time of file getftype({fname}) String description of type of file {fname} getline({lnum}) String line {lnum} of current buffer getline({lnum}, {end}) List lines {lnum} to {end} of current buffer -getloclist({nr}[, {what}]) List list of location list items +getloclist({nr} [, {what}]) List list of location list items getmatches() List list of current matches getpid() Number process ID of Vim getpos({expr}) List position of cursor, mark, etc. @@ -2119,7 +2118,8 @@ index({list}, {expr} [, {start} [, {ic}]]) Number index in {list} where {expr} appears input({prompt} [, {text} [, {completion}]]) String get input from the user -inputdialog({p} [, {t} [, {c}]]) String like input() but in a GUI dialog +inputdialog({prompt} [, {text} [, {completion}]]) + String like input() but in a GUI dialog inputlist({textlist}) Number let the user pick from a choice list inputrestore() Number restore typeahead inputsave() Number save and clear typeahead @@ -2201,12 +2201,13 @@ readfile({fname} [, {binary} [, {max}]]) reltime([{start} [, {end}]]) List get time value reltimefloat({time}) Float turn the time value into a Float reltimestr({time}) String turn time value into a String -remote_expr({server}, {string} [, {idvar}]) +remote_expr({server}, {string} [, {idvar} [, {timeout}]]) String send expression remote_foreground({server}) Number bring Vim server to the foreground remote_peek({serverid} [, {retvar}]) Number check for reply string -remote_read({serverid}) String read reply string +remote_read({serverid} [, {timeout}]) + String read reply string remote_send({server}, {string} [, {idvar}]) String send key sequence remove({list}, {idx} [, {end}]) any remove items {idx}-{end} from {list} @@ -2274,22 +2275,22 @@ sqrt({expr}) Float square root of {expr} str2float({expr}) Float convert String to Float str2nr({expr} [, {base}]) Number convert String to Number strchars({expr} [, {skipcc}]) Number character length of the String {expr} -strcharpart({str}, {start}[, {len}]) +strcharpart({str}, {start} [, {len}]) String {len} characters of {str} at {start} strdisplaywidth({expr} [, {col}]) Number display length of the String {expr} -strftime({format}[, {time}]) String time in specified format +strftime({format} [, {time}]) String time in specified format strgetchar({str}, {index}) Number get char {index} from {str} -stridx({haystack}, {needle}[, {start}]) +stridx({haystack}, {needle} [, {start}]) Number index of {needle} in {haystack} string({expr}) String String representation of {expr} value strlen({expr}) Number length of the String {expr} -strpart({str}, {start}[, {len}]) +strpart({str}, {start} [, {len}]) String {len} characters of {str} at {start} strridx({haystack}, {needle} [, {start}]) Number last index of {needle} in {haystack} strtrans({expr}) String translate string to make it printable strwidth({expr}) Number display cell length of the String {expr} -submatch({nr}[, {list}]) String or List +submatch({nr} [, {list}]) String or List specific match in ":s" or substitute() substitute({expr}, {pat}, {sub}, {flags}) String all {pat} in {expr} replaced with {sub} @@ -2755,7 +2756,7 @@ changenr() *changenr()* redo it is the number of the redone change. After undo it is one less than the number of the undone change. -char2nr({expr}[, {utf8}]) *char2nr()* +char2nr({expr} [, {utf8}]) *char2nr()* Return number value of the first char in {expr}. Examples: > char2nr(" ") returns 32 char2nr("ABC") returns 65 @@ -3108,6 +3109,7 @@ did_filetype() Returns |TRUE| when autocommands are being executed and the FileType event has been triggered at least once. Can be used to avoid triggering the FileType event again in the scripts that detect the file type. |FileType| + Returns |FALSE| when `:setf FALLBACK` was used. When editing another file, the counter is reset, thus this really checks if the FileType event has been triggered for the current buffer. This allows an autocommand that starts @@ -3530,7 +3532,7 @@ filter({expr1}, {expr2}) *filter()* defined with the "abort" flag. -finddir({name}[, {path}[, {count}]]) *finddir()* +finddir({name} [, {path} [, {count}]]) *finddir()* Find directory {name} in {path}. Supports both downwards and upwards recursive directory searches. See |file-searching| for the syntax of {path}. @@ -3545,7 +3547,7 @@ finddir({name}[, {path}[, {count}]]) *finddir()* {only available when compiled with the |+file_in_path| feature} -findfile({name}[, {path}[, {count}]]) *findfile()* +findfile({name} [, {path} [, {count}]]) *findfile()* Just like |finddir()|, but find a file instead of a directory. Uses 'suffixesadd'. Example: > @@ -3712,7 +3714,7 @@ function({name} [, {arglist}] [, {dict}]) When {arglist} or {dict} is present this creates a partial. That mans the argument list and/or the dictionary is stored in the Funcref and will be used when the Funcref is called. - + The arguments are passed to the function in front of other arguments. Example: > func Callback(arg1, arg2, name) @@ -4077,13 +4079,16 @@ getcompletion({pat}, {type} [, {filtered}]) *getcompletion()* getcurpos() Get the position of the cursor. This is like getpos('.'), but includes an extra item in the list: [bufnum, lnum, col, off, curswant] ~ - The "curswant" number is the preferred column when moving the - cursor vertically. - This can be used to save and restore the cursor position: > - let save_cursor = getcurpos() - MoveTheCursorAround - call setpos('.', save_cursor) -< + The "curswant" number is the preferred column when moving the + cursor vertically. Also see |getpos()|. + + This can be used to save and restore the cursor position: > + let save_cursor = getcurpos() + MoveTheCursorAround + call setpos('.', save_cursor) +< Note that this only works within the window. See + |winrestview()| for restoring more state. + getcwd([{winnr}[, {tabnr}]]) *getcwd()* With no arguments the result is a String, which is the name of the current effective working directory. With {winnr} or @@ -4381,11 +4386,13 @@ gettabwinvar({tabnr}, {winnr}, {varname} [, {def}]) *gettabwinvar()* getwinposx() The result is a Number, which is the X coordinate in pixels of the left hand side of the GUI Vim window. The result will be -1 if the information is not available. + The value can be used with `:winpos`. *getwinposy()* getwinposy() The result is a Number, which is the Y coordinate in pixels of the top of the GUI Vim window. The result will be -1 if the information is not available. + The value can be used with `:winpos`. getwininfo([{winid}]) *getwininfo()* Returns information about windows as a List with Dictionaries. @@ -4399,7 +4406,9 @@ getwininfo([{winid}]) *getwininfo()* Each List item is a Dictionary with the following entries: bufnr number of buffer in the window - height window height + height window height (excluding winbar) + winbar 1 if the window has a toolbar, 0 + otherwise loclist 1 if showing a location list quickfix 1 if quickfix or location list window tabnr tab page number @@ -5150,7 +5159,10 @@ line({expr}) The result is a Number, which is the line number of the file < *last-position-jump* This autocommand jumps to the last known position in a file just after opening it, if the '" mark is set: > - :au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g`\"" | endif + :au BufReadPost * + \ if line("'\"") > 1 && line("'\"") <= line("$") && &ft !~# 'commit' + \ | exe "normal! g`\"" + \ | endif line2byte({lnum}) *line2byte()* Return the byte count from the start of the buffer for line @@ -5245,12 +5257,12 @@ map({expr1}, {expr2}) *map()* defined with the "abort" flag. -maparg({name}[, {mode} [, {abbr} [, {dict}]]]) *maparg()* +maparg({name} [, {mode} [, {abbr} [, {dict}]]]) *maparg()* When {dict} is omitted or zero: Return the rhs of mapping {name} in mode {mode}. The returned String has special characters translated like in the output of the ":map" command listing. - + When there is no mapping for {name}, an empty String is returned. @@ -5266,6 +5278,7 @@ maparg({name}[, {mode} [, {abbr} [, {dict}]]]) *maparg()* "s" Select "x" Visual "l" langmap |language-mapping| + "t" Terminal "" Normal, Visual and Operator-pending When {mode} is omitted, the modes for "" are used. @@ -5299,7 +5312,7 @@ maparg({name}[, {mode} [, {abbr} [, {dict}]]]) *maparg()* exe 'nnoremap ==' . maparg('', 'n') -mapcheck({name}[, {mode} [, {abbr}]]) *mapcheck()* +mapcheck({name} [, {mode} [, {abbr}]]) *mapcheck()* Check if there is a mapping that matches with {name} in mode {mode}. See |maparg()| for {mode} and special names in {name}. @@ -5331,7 +5344,7 @@ mapcheck({name}[, {mode} [, {abbr}]]) *mapcheck()* < This avoids adding the "_vv" mapping when there already is a mapping for "_v" or for "_vvv". -match({expr}, {pat}[, {start}[, {count}]]) *match()* +match({expr}, {pat} [, {start} [, {count}]]) *match()* When {expr} is a |List| then this returns the index of the first item where {pat} matches. Each item is used as a String, |Lists| and |Dictionaries| are used as echoed. @@ -5440,7 +5453,7 @@ matchadd({group}, {pattern}[, {priority}[, {id} [, {dict}]]]) one operation by |clearmatches()|. *matchaddpos()* -matchaddpos({group}, {pos}[, {priority}[, {id}[, {dict}]]]) +matchaddpos({group}, {pos} [, {priority} [, {id} [, {dict}]]]) Same as |matchadd()|, but requires a list of positions {pos} instead of a pattern. This command is faster than |matchadd()| because it does not require to handle regular expressions and @@ -5460,7 +5473,7 @@ matchaddpos({group}, {pos}[, {priority}[, {id}[, {dict}]]]) be highlighted. - A list with three numbers, e.g., [23, 11, 3]. As above, but the third number gives the length of the highlight in bytes. - + The maximum number of positions is 8. Example: > @@ -5493,7 +5506,7 @@ matchdelete({id}) *matchdelete()* *E802* *E803* otherwise -1. See example for |matchadd()|. All matches can be deleted in one operation by |clearmatches()|. -matchend({expr}, {pat}[, {start}[, {count}]]) *matchend()* +matchend({expr}, {pat} [, {start} [, {count}]]) *matchend()* Same as |match()|, but return the index of first character after the match. Example: > :echo matchend("testing", "ing") @@ -5512,7 +5525,7 @@ matchend({expr}, {pat}[, {start}[, {count}]]) *matchend()* < result is "-1". When {expr} is a |List| the result is equal to |match()|. -matchlist({expr}, {pat}[, {start}[, {count}]]) *matchlist()* +matchlist({expr}, {pat} [, {start} [, {count}]]) *matchlist()* Same as |match()|, but return a |List|. The first item in the list is the matched string, same as what matchstr() would return. Following items are submatches, like "\1", "\2", etc. @@ -5522,7 +5535,7 @@ matchlist({expr}, {pat}[, {start}[, {count}]]) *matchlist()* < Results in: ['acd', 'a', '', 'c', 'd', '', '', '', '', ''] When there is no match an empty list is returned. -matchstr({expr}, {pat}[, {start}[, {count}]]) *matchstr()* +matchstr({expr}, {pat} [, {start} [, {count}]]) *matchstr()* Same as |match()|, but return the matched string. Example: > :echo matchstr("testing", "ing") < results in "ing". @@ -5535,7 +5548,7 @@ matchstr({expr}, {pat}[, {start}[, {count}]]) *matchstr()* When {expr} is a |List| then the matching item is returned. The type isn't changed, it's not necessarily a String. -matchstrpos({expr}, {pat}[, {start}[, {count}]]) *matchstrpos()* +matchstrpos({expr}, {pat} [, {start} [, {count}]]) *matchstrpos()* Same as |matchstr()|, but return the matched string, the start position and the end position of the match. Example: > :echo matchstrpos("testing", "ing") @@ -5647,16 +5660,20 @@ mode([expr]) Return a string that indicates the current mode. S Select by line CTRL-S Select blockwise i Insert + ic Insert mode completion |compl-generic| + ix Insert mode |i_CTRL-X| completion R Replace |R| + Rc Replace mode completion |compl-generic| Rv Virtual Replace |gR| - t Terminal - c Command-line + Rx Replace mode |i_CTRL-X| completion + c Command-line editing cv Vim Ex mode |gQ| ce Normal Ex mode |Q| r Hit-enter prompt rm The -- more -- prompt r? A |:confirm| query of some sort ! Shell or external command is executing + t Terminal mode: keys go to the job This is useful in the 'statusline' option or when used with |remote_expr()| In most other places it always returns "c" or "n". @@ -5760,7 +5777,7 @@ nextnonblank({lnum}) *nextnonblank()* below it, zero is returned. See also |prevnonblank()|. -nr2char({expr}[, {utf8}]) *nr2char()* +nr2char({expr} [, {utf8}]) *nr2char()* Return a string with a single character, which has the number value {expr}. Examples: > nr2char(64) returns "@" @@ -5798,7 +5815,7 @@ pathshorten({expr}) *pathshorten()* components in the path are reduced to single letters. Leading '~' and '.' characters are kept. Example: > :echo pathshorten('~/.config/nvim/autoload/file1.vim') -< ~/.v/a/file1.vim ~ +< ~/.c/n/a/file1.vim ~ It doesn't matter if the path exists or not. pow({x}, {y}) *pow()* @@ -5969,7 +5986,7 @@ printf({fmt}, {expr1} ...) *printf()* feature works just like 's'. *printf-f* *E807* - f F The Float argument is converted into a string of the + f F The Float argument is converted into a string of the form 123.456. The precision specifies the number of digits after the decimal point. When the precision is zero the decimal point is omitted. When the precision @@ -6035,10 +6052,10 @@ py3eval({expr}) *py3eval()* pyeval({expr}) *pyeval()* Evaluate Python expression {expr} and return its result converted to Vim data structures. - Numbers and strings are returned as they are (strings are + Numbers and strings are returned as they are (strings are copied though). Lists are represented as Vim |List| type. - Dictionaries are represented as Vim |Dictionary| type, + Dictionaries are represented as Vim |Dictionary| type, non-string keys result in error. {only available when compiled with the |+python| feature} @@ -6149,6 +6166,12 @@ remote_expr({server}, {string} [, {idvar}]) {only available when compiled with the |+clientserver| feature} Note: Any errors will cause a local error message to be issued and the result will be the empty string. + + Variables will be evaluated in the global namespace, + independent of a function currently being active. Except + when in debug mode, then local function variables and + arguments can be evaluated. + Examples: > :echo remote_expr("gvim", "2+2") :echo remote_expr("gvim1", "b:current_syntax") @@ -6308,12 +6331,12 @@ rpcstop({channel}) {Nvim} *rpcstop()* Closes the socket connection if the channel was opened by connecting to |v:servername|. -screenattr(row, col) *screenattr()* +screenattr({row}, {col}) *screenattr()* Like |screenchar()|, but return the attribute. This is a rather arbitrary number that can only be used to compare to the attribute at other positions. -screenchar(row, col) *screenchar()* +screenchar({row}, {col}) *screenchar()* The result is a Number, which is the character at position [row, col] on the screen. This works for every possible screen position, also status lines, window separators and the @@ -6369,7 +6392,7 @@ search({pattern} [, {flags} [, {stopline} [, {timeout}]]]) *search()* flag. 'ignorecase', 'smartcase' and 'magic' are used. - + When the 'z' flag is not given, searching always starts in column zero and then matches before the cursor are skipped. When the 'c' flag is present in 'cpo' the next search starts @@ -6837,13 +6860,13 @@ setqflist({list} [, {action}[, {what}]]) *setqflist()* This function can be used to create a quickfix list independent of the 'errorformat' setting. Use a command like - ":cc 1" to jump to the first position. + `:cc 1` to jump to the first position. *setreg()* setreg({regname}, {value} [, {options}]) Set the register {regname} to {value}. - {value} may be any value returned by |getreg()|, including + {value} may be any value returned by |getreg()|, including a |List|. If {options} contains "a" or {regname} is upper case, then the value is appended. @@ -6859,14 +6882,14 @@ setreg({regname}, {value} [, {options}]) set to point to register {regname}. If {options} contains no register settings, then the default - is to use character mode unless {value} ends in a for - string {value} and linewise mode for list {value}. Blockwise + is to use character mode unless {value} ends in a for + string {value} and linewise mode for list {value}. Blockwise mode is never selected automatically. Returns zero for success, non-zero for failure. *E883* - Note: you may not use |List| containing more than one item to - set search and expression registers. Lists containing no + Note: you may not use |List| containing more than one item to + set search and expression registers. Lists containing no items act like empty strings. Examples: > @@ -7019,7 +7042,7 @@ sockconnect({mode}, {address}, {opts}) *sockconnect()* sort({list} [, {func} [, {dict}]]) *sort()* *E702* Sort the items in {list} in-place. Returns {list}. - + If you want a list to remain unmodified make a copy first: > :let sortedlist = sort(copy(mylist)) @@ -7030,7 +7053,7 @@ sort({list} [, {func} [, {dict}]]) *sort()* *E702* When {func} is given and it is '1' or 'i' then case is ignored. - + When {func} is given and it is 'n' then all items will be sorted numerical (Implementation detail: This uses the strtod() function to parse numbers, Strings, Lists, Dicts and @@ -7200,7 +7223,7 @@ strchars({expr} [, {skipcc}]) *strchars()* counted separately. When {skipcc} set to 1, Composing characters are ignored. Also see |strlen()|, |strdisplaywidth()| and |strwidth()|. - + {skipcc} is only available after 7.4.755. For backward compatibility, you can define a wrapper function: > if has("patch-7.4.755") @@ -7217,7 +7240,7 @@ strchars({expr} [, {skipcc}]) *strchars()* endfunction endif < -strcharpart({src}, {start}[, {len}]) *strcharpart()* +strcharpart({src}, {start} [, {len}]) *strcharpart()* Like |strpart()| but using character index and length instead of byte index and length. When a character index is used where a character does not @@ -7225,7 +7248,7 @@ strcharpart({src}, {start}[, {len}]) *strcharpart()* strcharpart('abc', -1, 2) < results in 'a'. -strdisplaywidth({expr}[, {col}]) *strdisplaywidth()* +strdisplaywidth({expr} [, {col}]) *strdisplaywidth()* The result is a Number, which is the number of display cells String {expr} occupies on the screen when it starts at {col}. When {col} is omitted zero is used. Otherwise it is the @@ -7314,7 +7337,7 @@ strlen({expr}) The result is a Number, which is the length of the String |strchars()|. Also see |len()|, |strdisplaywidth()| and |strwidth()|. -strpart({src}, {start}[, {len}]) *strpart()* +strpart({src}, {start} [, {len}]) *strpart()* The result is a String, which is part of {src}, starting from byte {start}, with the byte length {len}. To count characters instead of bytes use |strcharpart()|. @@ -7366,7 +7389,7 @@ strwidth({expr}) *strwidth()* Ambiguous, this function's return value depends on 'ambiwidth'. Also see |strlen()|, |strdisplaywidth()| and |strchars()|. -submatch({nr}[, {list}]) *submatch()* *E935* +submatch({nr} [, {list}]) *submatch()* *E935* Only for an expression in a |:substitute| command or substitute() function. Returns the {nr}'th submatch of the matched text. When {nr} @@ -7375,8 +7398,8 @@ submatch({nr}[, {list}]) *submatch()* *E935* multi-line match or a NUL character in the text. Also see |sub-replace-expression|. - If {list} is present and non-zero then submatch() returns - a list of strings, similar to |getline()| with two arguments. + If {list} is present and non-zero then submatch() returns + a list of strings, similar to |getline()| with two arguments. NL characters in the text represent NUL characters in the text. Only returns more than one item for |:substitute|, inside @@ -7396,7 +7419,7 @@ substitute({expr}, {pat}, {sub}, {flags}) *substitute()* the first match of {pat} is replaced with {sub}. When {flags} is "g", all matches of {pat} in {expr} are replaced. Otherwise {flags} should be "". - + This works like the ":substitute" command (without any flags). But the matching with {pat} is always done like the 'magic' option is set and 'cpoptions' is empty (to make scripts @@ -7630,7 +7653,7 @@ tagfiles() Returns a |List| with the file names used to search for tags for the current buffer. This is the 'tags' option expanded. -taglist({expr}[, {filename}]) *taglist()* +taglist({expr} [, {filename}]) *taglist()* Returns a list of tags matching the regular expression {expr}. If {filename} is passed it is used to prioritize the results @@ -7878,7 +7901,7 @@ undotree() *undotree()* "save_last" Number of the last file write. Zero when no write yet. "save_cur" Number of the current position in the undo - tree. + tree. "synced" Non-zero when the last undo block was synced. This happens when waiting from input from the user. See |undo-blocks|. @@ -8037,6 +8060,7 @@ winheight({nr}) *winheight()* When {nr} is zero, the height of the current window is returned. When window {nr} doesn't exist, -1 is returned. An existing window always has a height of zero or more. + This excludes any window toolbar line. Examples: > :echo "The current window has " . winheight(0) . " lines." < @@ -8270,7 +8294,7 @@ lispindent Compiled with support for lisp indenting. listcmds Compiled with commands for the buffer list |:files| and the argument list |arglist|. localmap Compiled with local mappings and abbr. |:map-local| -mac macOS version of Vim. +mac macOS version of Nvim. menu Compiled with support for |:menu|. mksession Compiled with support for |:mksession|. modify_fname Compiled with file name modifiers. |filename-modifiers| @@ -8314,6 +8338,8 @@ termresponse Compiled with support for |t_RV| and |v:termresponse|. textobjects Compiled with support for |text-objects|. timers Compiled with |timer_start()| support. title Compiled with window title support |'title'|. +ttyin input is a terminal (tty) +ttyout output is a terminal (tty) unix Unix version of Vim. unnamedplus Compiled with support for "unnamedplus" in 'clipboard' user_commands User-defined commands. @@ -8401,13 +8427,16 @@ See |:verbose-cmd| for more information. *E124* *E125* *E853* *E884* :fu[nction][!] {name}([arguments]) [range] [abort] [dict] [closure] - Define a new function by the name {name}. The name - must be made of alphanumeric characters and '_', and - must start with a capital or "s:" (see above). Note - that using "b:" or "g:" is not allowed. (since patch - 7.4.260 E884 is given if the function name has a colon - in the name, e.g. for "foo:bar()". Before that patch - no error was given). + Define a new function by the name {name}. The body of + the function follows in the next lines, until the + matching |:endfunction|. + + The name must be made of alphanumeric characters and + '_', and must start with a capital or "s:" (see + above). Note that using "b:" or "g:" is not allowed. + (since patch 7.4.260 E884 is given if the function + name has a colon in the name, e.g. for "foo:bar()". + Before that patch no error was given). {name} can also be a |Dictionary| entry that is a |Funcref|: > @@ -8522,9 +8551,10 @@ to the number of named arguments. When using "...", the number of arguments may be larger. It is also possible to define a function without any arguments. You must -still supply the () then. The body of the function follows in the next lines, -until the matching |:endfunction|. It is allowed to define another function -inside a function body. +still supply the () then. + +It is allowed to define another function inside a function +body. *local-variables* Inside a function local variables can be used. These will disappear when the @@ -10379,7 +10409,7 @@ code can be used: > redir => scriptnames_output silent scriptnames redir END - + " Split the output into lines and parse each line. Add an entry to the " "scripts" dictionary. let scripts = {} @@ -10416,6 +10446,22 @@ missing: > : echo "You will _never_ see this message" :endif +To execute a command only when the |+eval| feature is disabled requires a trick, +as this example shows: > + if 1 + nnoremap : :" + endif + normal :set history=111 + if 1 + nunmap : + endif + +The "" here is a real CR character, type CTRL-V Enter to get it. + +When the |+eval| feature is available the ":" is remapped to add a double +quote, which has the effect of commenting-out the command. without the +|+eval| feature the nnoremap command is skipped and the command is executed. + ============================================================================== 11. The sandbox *eval-sandbox* *sandbox* *E48* diff --git a/runtime/doc/filetype.txt b/runtime/doc/filetype.txt index 7f1e98fed4..78402b47fe 100644 --- a/runtime/doc/filetype.txt +++ b/runtime/doc/filetype.txt @@ -32,7 +32,7 @@ Detail: The ":filetype on" command will load one of these files: BufNewFile and BufRead events. If the file type is not found by the name, the file $VIMRUNTIME/scripts.vim is used to detect it from the contents of the file. - When the GUI is running or will start soon, the menu.vim script is + When the GUI is running or will start soon, the |menu.vim| script is also sourced. See |'go-M'| about avoiding that. To add your own file types, see |new-filetype| below. To search for help on a @@ -309,12 +309,12 @@ define yourself. There are a few ways to avoid this: You need to define your own mapping before the plugin is loaded (before editing a file of that type). The plugin will then skip installing the default mapping. - + *no_mail_maps* 3. Disable defining mappings for a specific filetype by setting a variable, which contains the name of the filetype. For the "mail" filetype this would be: > :let no_mail_maps = 1 - +< *no_plugin_maps* 4. Disable defining mappings for all filetypes by setting a variable: > :let no_plugin_maps = 1 < @@ -724,6 +724,12 @@ Format description: not recognized here as well. +RUST *ft-rust* + +Since the text for this plugin is rather long it has been put in a separate +file: |ft_rust.txt|. + + SQL *ft-sql* Since the text for this plugin is rather long it has been put in a separate diff --git a/runtime/doc/fold.txt b/runtime/doc/fold.txt index fc8484b741..c644d63280 100644 --- a/runtime/doc/fold.txt +++ b/runtime/doc/fold.txt @@ -73,7 +73,7 @@ This will call a function to compute the fold level: > :set foldexpr=MyFoldLevel(v:lnum) This will make a fold out of paragraphs separated by blank lines: > :set foldexpr=getline(v:lnum)=~'^\\s*$'&&getline(v:lnum+1)=~'\\S'?'<1':1 -this does the same: > +This does the same: > :set foldexpr=getline(v:lnum-1)=~'^\\s*$'&&getline(v:lnum)=~'\\S'?'>1':1 Note that backslashes must be used to escape characters that ":set" handles @@ -197,7 +197,7 @@ and the level given by the marker: 1. If a marker with the same fold level is encountered, the previous fold ends and another fold with the same level starts. 2. If a marker with a higher fold level is found, a nested fold is started. -3. if a marker with a lower fold level is found, all folds up to and including +3. If a marker with a lower fold level is found, all folds up to and including this level end and a fold with the specified level starts. The number indicates the fold level. A zero cannot be used (a marker with diff --git a/runtime/doc/ft_ada.txt b/runtime/doc/ft_ada.txt index 94d97b481a..c1aa0904c4 100644 --- a/runtime/doc/ft_ada.txt +++ b/runtime/doc/ft_ada.txt @@ -116,7 +116,7 @@ NOTE: "gnat xref -v" is very tricky to use as it has almost no diagnostic then "gnat xref -v *.ad?" 4) Project manager support is completely broken - don't even try "gnat xref -Padacl.gpr". -5) VIM is faster when the tags file is sorted - use "sort --unique +5) Vim is faster when the tags file is sorted - use "sort --unique --ignore-case --output=tags tags" . 6) Remember to insert "!_TAG_FILE_SORTED 2 %sort ui" as first line to mark the file assorted. diff --git a/runtime/doc/ft_rust.txt b/runtime/doc/ft_rust.txt new file mode 100644 index 0000000000..750ba76afc --- /dev/null +++ b/runtime/doc/ft_rust.txt @@ -0,0 +1,237 @@ +*ft_rust.txt* Filetype plugin for Rust + +============================================================================== +CONTENTS *rust* + +1. Introduction |rust-intro| +2. Settings |rust-settings| +3. Commands |rust-commands| +4. Mappings |rust-mappings| + +============================================================================== +INTRODUCTION *rust-intro* + +This plugin provides syntax and supporting functionality for the Rust +filetype. + +============================================================================== +SETTINGS *rust-settings* + +This plugin has a few variables you can define in your vimrc that change the +behavior of the plugin. + + *g:rustc_path* +g:rustc_path~ + Set this option to the path to rustc for use in the |:RustRun| and + |:RustExpand| commands. If unset, "rustc" will be located in $PATH: > + let g:rustc_path = $HOME."/bin/rustc" +< + + *g:rustc_makeprg_no_percent* +g:rustc_makeprg_no_percent~ + Set this option to 1 to have 'makeprg' default to "rustc" instead of + "rustc %": > + let g:rustc_makeprg_no_percent = 1 +< + + *g:rust_conceal* +g:rust_conceal~ + Set this option to turn on the basic |conceal| support: > + let g:rust_conceal = 1 +< + + *g:rust_conceal_mod_path* +g:rust_conceal_mod_path~ + Set this option to turn on |conceal| for the path connecting token + "::": > + let g:rust_conceal_mod_path = 1 +< + + *g:rust_conceal_pub* +g:rust_conceal_pub~ + Set this option to turn on |conceal| for the "pub" token: > + let g:rust_conceal_pub = 1 +< + + *g:rust_recommended_style* +g:rust_recommended_style~ + Set this option to enable vim indentation and textwidth settings to + conform to style conventions of the rust standard library (i.e. use 4 + spaces for indents and sets 'textwidth' to 99). This option is enabled + by default. To disable it: > + let g:rust_recommended_style = 0 +< + + *g:rust_fold* +g:rust_fold~ + Set this option to turn on |folding|: > + let g:rust_fold = 1 +< + Value Effect ~ + 0 No folding + 1 Braced blocks are folded. All folds are open by + default. + 2 Braced blocks are folded. 'foldlevel' is left at the + global value (all folds are closed by default). + + *g:rust_bang_comment_leader* +g:rust_bang_comment_leader~ + Set this option to 1 to preserve the leader on multi-line doc comments + using the /*! syntax: > + let g:rust_bang_comment_leader = 1 +< + + *g:ftplugin_rust_source_path* +g:ftplugin_rust_source_path~ + Set this option to a path that should be prepended to 'path' for Rust + source files: > + let g:ftplugin_rust_source_path = $HOME.'/dev/rust' +< + + *g:rustfmt_command* +g:rustfmt_command~ + Set this option to the name of the 'rustfmt' executable in your $PATH. If + not specified it defaults to 'rustfmt' : > + let g:rustfmt_command = 'rustfmt' +< + *g:rustfmt_autosave* +g:rustfmt_autosave~ + Set this option to 1 to run |:RustFmt| automatically when saving a + buffer. If not specified it defaults to 0 : > + let g:rustfmt_autosave = 0 +< + *g:rustfmt_fail_silently* +g:rustfmt_fail_silently~ + Set this option to 1 to prevent 'rustfmt' from populating the + |location-list| with errors. If not specified it defaults to 0: > + let g:rustfmt_fail_silently = 0 +< + *g:rustfmt_options* +g:rustfmt_options~ + Set this option to a string of options to pass to 'rustfmt'. The + write-mode is already set to 'overwrite'. If not specified it + defaults to '' : > + let g:rustfmt_options = '' +< + + *g:rust_playpen_url* +g:rust_playpen_url~ + Set this option to override the URL for the playpen to use: > + let g:rust_playpen_url = 'https://play.rust-lang.org/' +< + + *g:rust_shortener_url* +g:rust_shortener_url~ + Set this option to override the URL for the URL shortener: > + let g:rust_shortener_url = 'https://is.gd/' +< + + +============================================================================== +COMMANDS *rust-commands* + +:RustRun [args] *:RustRun* +:RustRun! [rustc-args] [--] [args] + Compiles and runs the current file. If it has unsaved changes, + it will be saved first using |:update|. If the current file is + an unnamed buffer, it will be written to a temporary file + first. The compiled binary is always placed in a temporary + directory, but is run from the current directory. + + The arguments given to |:RustRun| will be passed to the + compiled binary. + + If ! is specified, the arguments are passed to rustc instead. + A "--" argument will separate the rustc arguments from the + arguments passed to the binary. + + If |g:rustc_path| is defined, it is used as the path to rustc. + Otherwise it is assumed rustc can be found in $PATH. + +:RustExpand [args] *:RustExpand* +:RustExpand! [TYPE] [args] + Expands the current file using --pretty and displays the + results in a new split. If the current file has unsaved + changes, it will be saved first using |:update|. If the + current file is an unnamed buffer, it will be written to a + temporary file first. + + The arguments given to |:RustExpand| will be passed to rustc. + This is largely intended for specifying various --cfg + configurations. + + If ! is specified, the first argument is the expansion type to + pass to rustc --pretty. Otherwise it will default to + "expanded". + + If |g:rustc_path| is defined, it is used as the path to rustc. + Otherwise it is assumed rustc can be found in $PATH. + +:RustEmitIr [args] *:RustEmitIr* + Compiles the current file to LLVM IR and displays the results + in a new split. If the current file has unsaved changes, it + will be saved first using |:update|. If the current file is an + unnamed buffer, it will be written to a temporary file first. + + The arguments given to |:RustEmitIr| will be passed to rustc. + + If |g:rustc_path| is defined, it is used as the path to rustc. + Otherwise it is assumed rustc can be found in $PATH. + +:RustEmitAsm [args] *:RustEmitAsm* + Compiles the current file to assembly and displays the results + in a new split. If the current file has unsaved changes, it + will be saved first using |:update|. If the current file is an + unnamed buffer, it will be written to a temporary file first. + + The arguments given to |:RustEmitAsm| will be passed to rustc. + + If |g:rustc_path| is defined, it is used as the path to rustc. + Otherwise it is assumed rustc can be found in $PATH. + +:RustPlay *:RustPlay* + This command will only work if you have web-api.vim installed + (available at https://github.com/mattn/webapi-vim). It sends the + current selection, or if nothing is selected, the entirety of the + current buffer to the Rust playpen, and emits a message with the + shortened URL to the playpen. + + |g:rust_playpen_url| is the base URL to the playpen, by default + "https://play.rust-lang.org/". + + |g:rust_shortener_url| is the base URL for the shortener, by + default "https://is.gd/" + +:RustFmt *:RustFmt* + Runs |g:rustfmt_command| on the current buffer. If + |g:rustfmt_options| is set then those will be passed to the + executable. + + If |g:rustfmt_fail_silently| is 0 (the default) then it + will populate the |location-list| with the errors from + |g:rustfmt_command|. If |g:rustfmt_fail_silently| is set to 1 + then it will not populate the |location-list|. + +:RustFmtRange *:RustFmtRange* + Runs |g:rustfmt_command| with selected range. See + |:RustFmt| for any other information. + +============================================================================== +MAPPINGS *rust-mappings* + +This plugin defines mappings for |[[| and |]]| to support hanging indents. + +It also has a few other mappings: + + *rust_* + Executes |:RustRun| with no arguments. + Note: This binding is only available in MacVim. + + *rust_* + Populates the command line with |:RustRun|! using the + arguments given to the last invocation, but does not + execute it. + Note: This binding is only available in MacVim. + +============================================================================== + vim:tw=78:sw=4:noet:ts=8:ft=help:norl: diff --git a/runtime/doc/gui.txt b/runtime/doc/gui.txt index fb05f178ad..904c4be19c 100644 --- a/runtime/doc/gui.txt +++ b/runtime/doc/gui.txt @@ -46,7 +46,8 @@ When the GUI starts up initializations are carried out, in this order: already set. NOTE: All but the first one are not carried out if Vim was started with -"-u NONE" and no "-U" argument was given, or when started with "-U NONE". +"-u NONE" or "-u DEFAULTS" and no "-U" argument was given, or when started +with "-U NONE". All this happens AFTER the normal Vim initializations, like reading your vimrc file. See |initialization|. @@ -382,6 +383,7 @@ menus and menu items. They are most useful for things that you can't remember what the key sequence was. For creating menus in a different language, see |:menutrans|. +If you don't want to use menus at all, see |'go-M'|. *menu.vim* The default menus are read from the file "$VIMRUNTIME/menu.vim". See @@ -398,7 +400,11 @@ in the menu (which can take a bit of time to load). If you want to have all filetypes already present at startup, add: > :let do_syntax_sel_menu = 1 -< +Note that the menu.vim is sourced when `:syntax on` or `:filetype on` is +executed or after your .vimrc file is sourced. This means that the 'encoding' +option and the language of messages (`:language messages`) must be set before +that (if you want to change them). + *console-menus* Although this documentation is in the GUI section, you can actually use menus in console mode too. You will have to load |menu.vim| explicitly then, it is @@ -648,6 +654,8 @@ nr Name Normal action ~ In the Win32 GUI, starting a menu name with ']' excludes that menu from the main menu bar. You must then use the |:popup| command to display it. +When splitting the window the window toolbar is not copied to the new window. + *popup-menu* You can define the special menu "PopUp". This is the menu that is displayed when the right mouse button is pressed, if 'mousemodel' is set to popup or diff --git a/runtime/doc/help.txt b/runtime/doc/help.txt index 1eda111297..8a83cbc79c 100644 --- a/runtime/doc/help.txt +++ b/runtime/doc/help.txt @@ -30,7 +30,7 @@ Get specific help: It is possible to go directly to whatever you want help help entries for "word". Or use ":helpgrep word". |:helpgrep| -VIM stands for Vi IMproved. Most of VIM was made by Bram Moolenaar, but only +Vim stands for Vi IMproved. Most of Vim was made by Bram Moolenaar, but only through the help of many others. See |credits|. ------------------------------------------------------------------------------ *doc-file-list* *Q_ct* @@ -93,7 +93,6 @@ General subjects ~ |helphelp.txt| about using the help files |index.txt| alphabetical index of all commands |help-tags| all the tags you can jump to (index of tags) -|howto.txt| how to do the most common editing tasks |tips.txt| various tips on using Vim |message.txt| (error) messages and explanations |develop.txt| development of Nvim @@ -142,6 +141,7 @@ Special issues ~ |hebrew.txt| Hebrew language support and editing |russian.txt| Russian language support and editing |ft_ada.txt| Ada (the programming language) support +|ft_rust.txt| Filetype plugin for Rust |ft_sql.txt| about the SQL filetype plugin |rileft.txt| right-to-left editing mode @@ -162,6 +162,7 @@ Standard plugins ~ |pi_gzip.txt| Reading and writing compressed files |pi_netrw.txt| Reading and writing files over a network |pi_paren.txt| Highlight matching parens +|pi_spec.txt| Filetype plugin to work with rpm spec files |pi_tar.txt| Tar file explorer |pi_zip.txt| Zip archive explorer diff --git a/runtime/doc/helphelp.txt b/runtime/doc/helphelp.txt index f8164a6982..adc72d1835 100644 --- a/runtime/doc/helphelp.txt +++ b/runtime/doc/helphelp.txt @@ -140,7 +140,8 @@ Help on help files *helphelp* already opened, then the location list for that window is used. Otherwise, a new help window is opened and the location list for that window is set. The - location list for the current window is not changed. + location list for the current window is not changed + then. *:exu* *:exusage* :exu[sage] Show help on Ex commands. Added to simulate the Nvi diff --git a/runtime/doc/howto.txt b/runtime/doc/howto.txt deleted file mode 100644 index 33c8552463..0000000000 --- a/runtime/doc/howto.txt +++ /dev/null @@ -1,96 +0,0 @@ -*howto.txt* Nvim - - - VIM REFERENCE MANUAL by Bram Moolenaar - - -How to ... *howdoi* *how-do-i* *howto* *how-to* - -|tutor| get started -|:quit| exit? I'm trapped, help me! -|initialization| initialize Vim -|vimrc-intro| write a Vim script file (vimrc) -|suspend| suspend Vim -|usr_11.txt| recover after a crash -|07.4| keep a backup of my file when writing over it - -|usr_07.txt| edit files -|23.4| edit binary files -|usr_24.txt| insert text -|deleting| delete text -|usr_04.txt| change text -|04.5| copy and move text -|usr_25.txt| format text -|30.6| format comments -|30.2| indent C programs -|25.3| automatically set indent - -|usr_26.txt| repeat commands -|02.5| undo and redo - -|usr_03.txt| move around -|word-motions| word motions -|left-right-motions| left-right motions -|up-down-motions| up-down motions -|object-motions| text-object motions -|various-motions| various motions -|object-select| text-object selection -|'whichwrap'| move over line breaks -|'virtualedit'| move to where there is no text -|usr_27.txt| specify pattern for searches -|tags-and-searches| do tags and special searches -|29.4| search in include'd files used to find - variables, functions, or macros -|K| look up manual for the keyword under cursor - -|03.7| scroll -|'sidescroll'| scroll horizontally/sideways -|'scrolloff'| set visible context lines - -|mode-switching| change modes -|04.4| use Visual mode -|'insertmode'| start Vim in Insert mode - -|40.1| map keys -|24.7| create abbreviations - -|ins-expandtab| expand a tab to spaces in Insert mode -|i_CTRL-R| insert contents of a register in Insert mode -|24.3| complete words in Insert mode -|25.1| break a line before it gets too long - -|20.1| do command-line editing -|20.3| do command-line completion -|'cmdheight'| increase the height of command-line -|10.3| specify command-line ranges -|40.3| specify commands to be executed automatically - before/after reading/writing entering/leaving a - buffer/window - -|'autowrite'| write automatically -|30.1| speedup edit-compile-edit cycle or compile and fix - errors within Vim - -|options| set options -|auto-setting| set options automatically -|term-dependent-settings| set options depending on terminal name -|save-settings| save settings -|:quote| comment my .vim files -|'helpheight'| change the default help height -|'highlight'| set various highlighting modes -|'title'| set the window title -|'icon'| set window icon title -|'report'| avoid seeing the change messages on every line -|'shortmess'| avoid |hit-enter| prompts - -|mouse-using| use mouse with Vim -|usr_08.txt| manage multiple windows and buffers -|gui.txt| use the gui - -|You can't! (yet)| do dishes using Vim - -|usr_06.txt| switch on syntax highlighting -|2html.vim| convert a colored file to HTML -|less| use Vim like less or more with syntax highlighting - - vim:tw=78:ts=8:ft=help:norl: diff --git a/runtime/doc/if_cscop.txt b/runtime/doc/if_cscop.txt index e359f2144c..ac3d7a9ed8 100644 --- a/runtime/doc/if_cscop.txt +++ b/runtime/doc/if_cscop.txt @@ -82,9 +82,10 @@ suggested use.) 2. Cscope related commands *cscope-commands* *:cscope* *:cs* *:scs* *:scscope* *E259* *E262* *E561* *E560* -All cscope commands are accessed through suboptions to the main cscope -command ":cscope". The shortest abbreviation is ":cs". The ":scscope" -command does the same and also splits the window (short: "scs"). +All cscope commands are accessed through suboptions to the cscope commands. + `:cscope` or `:cs` is the main command + `:scscope` or `:scs` does the same and splits the window + `:lcscope` or `:lcs` uses the location list, see |:lcscope| The available subcommands are: diff --git a/runtime/doc/index.txt b/runtime/doc/index.txt index bde4bcb630..f4f43aeac2 100644 --- a/runtime/doc/index.txt +++ b/runtime/doc/index.txt @@ -298,10 +298,10 @@ tag char note action in Normal mode ~ |B| B 1 cursor N WORDS backward |C| ["x]C 2 change from the cursor position to the end of the line, and N-1 more lines [into - buffer x]; synonym for "c$" + register x]; synonym for "c$" |D| ["x]D 2 delete the characters under the cursor until the end of the line and N-1 more - lines [into buffer x]; synonym for "d$" + lines [into register x]; synonym for "d$" |E| E 1 cursor forward to the end of WORD N |F| F{char} 1 cursor to the Nth occurrence of {char} to the left @@ -318,13 +318,13 @@ tag char note action in Normal mode ~ opposite direction |O| O 2 begin a new line above the cursor and insert text, repeat N times -|P| ["x]P 2 put the text [from buffer x] before the +|P| ["x]P 2 put the text [from register x] before the cursor N times |Q| Q switch to "Ex" mode |R| R 2 enter replace mode: overtype existing characters, repeat the entered text N-1 times -|S| ["x]S 2 delete N lines [into buffer x] and start +|S| ["x]S 2 delete N lines [into register x] and start insert; synonym for "cc". |T| T{char} 1 cursor till after Nth occurrence of {char} to the left @@ -332,8 +332,8 @@ tag char note action in Normal mode ~ |V| V start linewise Visual mode |W| W 1 cursor N WORDS forward |X| ["x]X 2 delete N characters before the cursor [into - buffer x] -|Y| ["x]Y yank N lines [into buffer x]; synonym for + register x] +|Y| ["x]Y yank N lines [into register x]; synonym for "yy" |ZZ| ZZ store current file if modified, and exit |ZQ| ZQ exit current file always @@ -356,12 +356,12 @@ tag char note action in Normal mode ~ |`}| `} 1 cursor to the end of the current paragraph |a| a 2 append text after the cursor N times |b| b 1 cursor N words backward -|c| ["x]c{motion} 2 delete Nmove text [into buffer x] and start +|c| ["x]c{motion} 2 delete Nmove text [into register x] and + start insert +|cc| ["x]cc 2 delete N lines [into register x] and start insert -|cc| ["x]cc 2 delete N lines [into buffer x] and start - insert -|d| ["x]d{motion} 2 delete Nmove text [into buffer x] -|dd| ["x]dd 2 delete N lines [into buffer x] +|d| ["x]d{motion} 2 delete Nmove text [into register x] +|dd| ["x]dd 2 delete N lines [into register x] |do| do 2 same as ":diffget" |dp| dp 2 same as ":diffput" |e| e 1 cursor forward to the end of word N @@ -387,16 +387,16 @@ tag char note action in Normal mode ~ |q?| q? edit ? command-line in command-line window |r| r{char} 2 replace N chars with {char} |s| ["x]s 2 (substitute) delete N characters [into - buffer x] and start insert + register x] and start insert |t| t{char} 1 cursor till before Nth occurrence of {char} to the right |u| u 2 undo changes |v| v start characterwise Visual mode |w| w 1 cursor N words forward |x| ["x]x 2 delete N characters under and after the - cursor [into buffer x] -|y| ["x]y{motion} yank Nmove text [into buffer x] -|yy| ["x]yy yank N lines [into buffer x] + cursor [into register x] +|y| ["x]y{motion} yank Nmove text [into register x] +|yy| ["x]yy yank N lines [into register x] |z| z{char} commands starting with 'z', see |z| below |{| { 1 cursor N paragraphs backward |bar| | 1 cursor to column N @@ -1542,13 +1542,17 @@ tag command action ~ |:tjump| :tj[ump] like ":tselect", but jump directly when there is only one match |:tlast| :tl[ast] jump to last matching tag +|:tmapclear| :tmapc[lear] remove all mappings for Terminal-Job mode +|:tmap| :tma[p] like ":map" but for Terminal-Job mode |:tmenu| :tm[enu] define menu tooltip |:tnext| :tn[ext] jump to next matching tag +|:tnoremap| :tno[remap] like ":noremap" but for Terminal-Job mode |:topleft| :to[pleft] make split window appear at top or far left |:tprevious| :tp[revious] jump to previous matching tag |:trewind| :tr[ewind] jump to first matching tag |:try| :try execute commands, abort on error or exception |:tselect| :ts[elect] list matching tags and select one +|:tunmap| :tunma[p] like ":unmap" but for Terminal-Job mode |:tunmenu| :tu[nmenu] remove menu tooltip |:undo| :u[ndo] undo last change(s) |:undojoin| :undoj[oin] join next change with previous undo block diff --git a/runtime/doc/insert.txt b/runtime/doc/insert.txt index f3bde9d8d2..b6cc18ab1b 100644 --- a/runtime/doc/insert.txt +++ b/runtime/doc/insert.txt @@ -146,7 +146,8 @@ CTRL-R CTRL-R {0-9a-z"%#*+/:.-=} *i_CTRL-R_CTRL-R* CTRL-R CTRL-O {0-9a-z"%#*+/:.-=} *i_CTRL-R_CTRL-O* Insert the contents of a register literally and don't auto-indent. Does the same as pasting with the mouse - ||. + ||. When the register is linewise this will + insert the text above the current line, like with `P`. Does not replace characters! The '.' register (last inserted text) is still inserted as typed. @@ -607,13 +608,13 @@ Completion can be done for: 10. User defined completion |i_CTRL-X_CTRL-U| 11. omni completion |i_CTRL-X_CTRL-O| 12. Spelling suggestions |i_CTRL-X_s| -13. keywords in 'complete' |i_CTRL-N| +13. keywords in 'complete' |i_CTRL-N| |i_CTRL-P| -All these (except 2) are done in CTRL-X mode. This is a sub-mode of Insert -and Replace modes. You enter CTRL-X mode by typing CTRL-X and one of the -CTRL-X commands. You exit CTRL-X mode by typing a key that is not a valid -CTRL-X mode command. Valid keys are the CTRL-X command itself, CTRL-N (next), -and CTRL-P (previous). +All these, except CTRL-N and CTRL-P, are done in CTRL-X mode. This is a +sub-mode of Insert and Replace modes. You enter CTRL-X mode by typing CTRL-X +and one of the CTRL-X commands. You exit CTRL-X mode by typing a key that is +not a valid CTRL-X mode command. Valid keys are the CTRL-X command itself, +CTRL-N (next), and CTRL-P (previous). Also see the 'infercase' option if you want to adjust the case of the match. diff --git a/runtime/doc/intro.txt b/runtime/doc/intro.txt index 30524fb6aa..6c40264d86 100644 --- a/runtime/doc/intro.txt +++ b/runtime/doc/intro.txt @@ -68,8 +68,8 @@ The Vim pages contain the most recent information about Vim. They also contain links to the most recent version of Vim. The FAQ is a list of Frequently Asked Questions. Read this if you have problems. - VIM home page: http://www.vim.org/ - VIM FAQ: http://vimdoc.sf.net/ + Vim home page: http://www.vim.org/ + Vim FAQ: http://vimdoc.sf.net/ Downloading: ftp://ftp.vim.org/pub/vim/MIRRORS @@ -120,9 +120,14 @@ Report bugs on GitHub: https://github.com/neovim/neovim/issues Please be brief; all the time that is spent on answering mail is subtracted from the time that is spent on improving Vim! Always give a reproducible -example and try to find out which settings or other things influence the -appearance of the bug. Try different machines, if possible. Send me patches -if you can! +example and try to find out which settings or other things trigger the bug. + +Preferably start Vim with: > + vim --clean -u reproduce.vim +Where reproduce.vim is a script that reproduces the problem. Try different +machines, if relevant (is this an MS-Windows specific bug perhaps?). + +Send me patches if you can! It will help to include information about the version of Vim you are using and your setup. You can get the information with this command: > @@ -236,6 +241,10 @@ Vim would never have become what it is now, without the help of these people! Juergen Weigert Lattice version, AUX improvements, Unix and MS-DOS ports, autoconf Stefan 'Sec' Zehl Maintainer of vim.org + Yasuhiro Matsumoto many MS-Windows improvements + Ken Takata fixes and features + Kazunobu Kuriyama GTK 3 + Christian Brabandt many fixes, features, user support, etc. I wish to thank all the people that sent me bug reports and suggestions. The list is too long to mention them all here. Vim would not be the same without @@ -713,9 +722,9 @@ special situation. Vim will show only part of the line, around where the cursor is. There are no special characters shown, so that you can edit all parts of this line. -The '@' occasion in the 'highlight' option can be used to set special -highlighting for the '@' and '~' characters. This makes it possible to -distinguish them from real characters in the buffer. +The |hl-NonText| highlight group can be used to set special highlighting +for the '@' and '~' characters. This makes it possible to distinguish them +from real characters in the buffer. The 'showbreak' option contains the string to put in front of wrapped lines. @@ -782,10 +791,12 @@ by Vim. ============================================================================== 8. Definitions *definitions* + buffer Contains lines of text, usually read from a file. screen The whole area that Vim uses to work in. This can be a terminal emulator window. Also called "the Vim window". - window A view on a buffer. + window A view on a buffer. There can be multiple windows for + one buffer. A screen contains one or more windows, separated by status lines and with the command line at the bottom. diff --git a/runtime/doc/map.txt b/runtime/doc/map.txt index fa7d01aa5f..9b61fa6527 100644 --- a/runtime/doc/map.txt +++ b/runtime/doc/map.txt @@ -15,7 +15,7 @@ manual. 1. Key mapping *key-mapping* *mapping* *macro* Key mapping is used to change the meaning of typed keys. The most common use -is to define a sequence commands for a function key. Example: > +is to define a sequence of commands for a function key. Example: > :map a=strftime("%c") @@ -41,7 +41,7 @@ modes. :im[ap] {lhs} {rhs} |mapmode-i| *:im* *:imap* :lm[ap] {lhs} {rhs} |mapmode-l| *:lm* *:lmap* :cm[ap] {lhs} {rhs} |mapmode-c| *:cm* *:cmap* -:tm[ap] {lhs} {rhs} |mapmode-t| *:tm* *:tmap* +:tma[p] {lhs} {rhs} |mapmode-t| *:tma* *:tmap* Map the key sequence {lhs} to {rhs} for the modes where the map command applies. The result, including {rhs}, is then further scanned for mappings. This @@ -75,7 +75,7 @@ modes. :iu[nmap] {lhs} |mapmode-i| *:iu* *:iunmap* :lu[nmap] {lhs} |mapmode-l| *:lu* *:lunmap* :cu[nmap] {lhs} |mapmode-c| *:cu* *:cunmap* -:tu[nmap] {lhs} |mapmode-t| *:tu* *:tunmap* +:tunma[p] {lhs} |mapmode-t| *:tunma* *:tunmap* Remove the mapping of {lhs} for the modes where the map command applies. The mapping may remain defined for other modes where it applies. @@ -111,7 +111,7 @@ modes. :im[ap] |mapmode-i| :lm[ap] |mapmode-l| :cm[ap] |mapmode-c| -:tm[ap] |mapmode-t| +:tma[p] |mapmode-t| List all key mappings for the modes where the map command applies. Note that ":map" and ":map!" are used most often, because they include the other modes. @@ -126,7 +126,7 @@ modes. :im[ap] {lhs} |mapmode-i| *:imap_l* :lm[ap] {lhs} |mapmode-l| *:lmap_l* :cm[ap] {lhs} |mapmode-c| *:cmap_l* -:tm[ap] {lhs} |mapmode-t| *:tmap_l* +:tma[p] {lhs} |mapmode-t| *:tmap_l* List the key mappings for the key sequences starting with {lhs} in the modes where the map command applies. @@ -175,7 +175,7 @@ that starts with ",". Then you need to type another character for Vim to know whether to use the "," mapping or the longer one. To avoid this add the argument. Then the mapping will be used when it matches, Vim does not wait for more characters to be typed. However, if the characters were -already type they are used. +already typed they are used. *:map-* *:map-silent* To define a mapping which will not be echoed on the command line, add @@ -653,7 +653,7 @@ option). After that it assumes that the 'q' is to be interpreted as such. If you type slowly, or your system is slow, reset the 'timeout' option. Then you might want to set the 'ttimeout' option. - *map-precedence* + *map-precedence* Buffer-local mappings (defined using |:map-|) take precedence over global mappings. When a buffer-local mapping is the same as a global mapping, Vim will use the buffer-local mapping. In addition, Vim will use a complete diff --git a/runtime/doc/message.txt b/runtime/doc/message.txt index 904b9dfce4..96c28009c4 100644 --- a/runtime/doc/message.txt +++ b/runtime/doc/message.txt @@ -625,6 +625,9 @@ starts. It can be fixed in one of these ways: - Just write the file again the next day. Or set your clock to the next day, write the file twice and set the clock back. +If you get W11 all the time, you may need to disable "Acronis Active +Protection" or register Vim as a trusted service/application. + *W12* > Warning: File "{filename}" has changed and the buffer was changed in Vim as well @@ -744,6 +747,13 @@ a user-defined command. You tried to set an option after startup that only allows changes during startup. + *E943* > + Command table needs to be updated, run 'make cmdidxs' + +This can only happen when changing the source code, when adding a command in +src/ex_cmds.h. The lookup table then needs to be updated, by running: > + make cmdidxs + ============================================================================== 3. Messages *messages* diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt index 433b083942..8a8ad58efd 100644 --- a/runtime/doc/options.txt +++ b/runtime/doc/options.txt @@ -311,7 +311,7 @@ Note: In the future more global options can be made global-local. Using Setting the filetype -:setf[iletype] {filetype} *:setf* *:setfiletype* +:setf[iletype] [FALLBACK] {filetype} *:setf* *:setfiletype* Set the 'filetype' option to {filetype}, but only if not done yet in a sequence of (nested) autocommands. This is short for: > @@ -322,6 +322,12 @@ Setting the filetype setting the 'filetype' option twice, causing different settings and syntax files to be loaded. + When the optional FALLBACK argument is present, a + later :setfiletype command will override the + 'filetype'. This is to used for filetype detections + that are just a guess. |did_filetype()| will return + false after this command. + *option-window* *optwin* :bro[wse] se[t] *:set-browse* *:browse-set* *:opt* *:options* :opt[ions] Open a window for viewing and setting all options. @@ -348,12 +354,23 @@ On Unix systems the form "${HOME}" can be used too. The name between {} can contain non-id characters then. Note that if you want to use this for the "gf" command, you need to add the '{' and '}' characters to 'isfname'. -On MS-Windows, if $HOME is not defined as an environment variable, then -at runtime Vim will set it to the expansion of $HOMEDRIVE$HOMEPATH. - NOTE: expanding environment variables and "~/" is only done with the ":set" command, not when assigning a value to an option with ":let". + *$HOME-windows* +On MS-Windows, if $HOME is not defined as an environment variable, then +at runtime Vim will set it to the expansion of $HOMEDRIVE$HOMEPATH. +If $HOMEDRIVE is not set then $USERPROFILE is used. + +This expanded value is not exported to the environment, this matters when +running an external command: > + :echo system('set | findstr ^HOME=') +and > + :echo luaeval('os.getenv("HOME")') +should echo nothing (an empty string) despite exists('$HOME') being true. +When setting $HOME to a non-empty string it will be exported to the +subprocesses. + Note the maximum length of an expanded option is limited. How much depends on the system, mostly it is something like 256 or 1024 characters. @@ -711,6 +728,13 @@ A jump table for the options with a short description can be found at |Q_op|. < Vim will guess the value. In the GUI this should work correctly, in other cases Vim might not be able to guess the right value. + When the |t_RB| option is set, Vim will use it to request the background + color from the terminal. If the returned RGB value is dark/light and + 'background' is not dark/light, 'background' will be set and the + screen is redrawn. This may have side effects, make t_BG empty in + your .vimrc if you suspect this problem. The response to |t_RB| can + be found in |v:termrbgresp|. + When starting the GUI, the default value for 'background' will be "light". When the value is not set in the gvimrc, and Vim detects that the background is actually quite dark, 'background' is set to @@ -1295,27 +1319,6 @@ A jump table for the options with a short description can be found at |Q_op|. will additionally copy the text into register '*'. See |clipboard|. - *clipboard-autoselect* - autoselect Works like the 'a' flag in 'guioptions': If present, - then whenever Visual mode is started, or the Visual - area extended, Vim tries to become the owner of the - windowing system's global selection or put the - selected text on the clipboard used by the selection - register "*. See |guioptions_a| and |quotestar| for - details. When the GUI is active, the 'a' flag in - 'guioptions' is used, when the GUI is not active, this - "autoselect" flag is used. - Also applies to the modeless selection. - - *clipboard-autoselectplus* - autoselectplus Like "autoselect" but using the + register instead of - the * register. Compare to the 'P' flag in - 'guioptions'. - - *clipboard-autoselectml* - autoselectml Like "autoselect", but for the modeless selection - only. Compare to the 'A' flag in 'guioptions'. - *'cmdheight'* *'ch'* 'cmdheight' 'ch' number (default 1) global @@ -2967,7 +2970,7 @@ A jump table for the options with a short description can be found at |Q_op|. that this flag must be added in the vimrc file, before switching on syntax or filetype recognition (when the |gvimrc| file is sourced the system menu has already been loaded; the - ":syntax on" and ":filetype on" commands load the menu too). + `:syntax on` and `:filetype on` commands load the menu too). *'go-g'* 'g' Grey menu items: Make menu items that are not active grey. If 'g' is not included inactive menu items are not shown at all. @@ -3094,11 +3097,6 @@ A jump table for the options with a short description can be found at |Q_op|. WARNING: It's easy to forget that you have changes in hidden buffers. Think twice when using ":q!" or ":qa!". - *'highlight'* *'hl'* -'highlight' 'hl' Removed. |vim-differences| - global - The builtin |highlight-groups| cannot be changed. - *'history'* *'hi'* 'history' 'hi' number (Vim default: 10000, Vi default: 0) global @@ -3127,10 +3125,8 @@ A jump table for the options with a short description can be found at |Q_op|. {not available when compiled without the |+extra_search| feature} When there is a previous search pattern, highlight all its matches. - The type of highlighting used can be set with the 'l' occasion in the - 'highlight' option. This uses the "Search" highlight group by - default. Note that only the matching text is highlighted, any offsets - are not applied. + The |hl-Search| highlight group determines the highlighting. Note that + only the matching text is highlighted, any offsets are not applied. See also: 'incsearch' and |:match|. When you get bored looking at the highlighted matches, you can turn it off with |:nohlsearch|. This does not change the option value, as @@ -3298,7 +3294,7 @@ A jump table for the options with a short description can be found at |Q_op|. Vim only searches for about half a second. With a complicated pattern and/or a lot of text the match may not be found. This is to avoid that Vim hangs while you are typing the pattern. - The highlighting can be set with the 'i' flag in 'highlight'. + The |hl-IncSearch| highlight group determines the highlighting. See also: 'hlsearch'. CTRL-L can be used to add one character from after the current match to the command line. If 'ignorecase' and 'smartcase' are set and the @@ -3843,7 +3839,7 @@ A jump table for the options with a short description can be found at |Q_op|. :au FileType c,cpp,java set mps+==:; < For a more advanced way of using "%", see the matchit.vim plugin in - the $VIMRUNTIME/macros directory. |add-local-help| + the $VIMRUNTIME/plugin directory. |add-local-help| *'matchtime'* *'mat'* 'matchtime' 'mat' number (default 5) @@ -4793,7 +4789,7 @@ A jump table for the options with a short description can be found at |Q_op|. height with ":set scroll=0". *'scrollback'* *'scbk'* -'scrollback' 'scbk' number (default: 1000 +'scrollback' 'scbk' number (default: 10000 in normal buffers: -1) local to buffer Maximum number of lines kept beyond the visible screen. Lines at the @@ -5346,8 +5342,7 @@ A jump table for the options with a short description can be found at |Q_op|. < Only printable single-cell characters are allowed, excluding and comma (in a future version the comma might be used to separate the part that is shown at the end and at the start of a line). - The characters are highlighted according to the '@' flag in - 'highlight'. + The |hl-NonText| highlight group determines the highlighting. Note that tabs after the showbreak will be displayed differently. If you want the 'showbreak' to appear in between line numbers, add the "n" flag to 'cpoptions'. @@ -5402,10 +5397,7 @@ A jump table for the options with a short description can be found at |Q_op|. 'showmode' 'smd' boolean (Vim default: on, Vi default: off) global If in Insert, Replace or Visual mode put a message on the last line. - Use the 'M' flag in 'highlight' to set the type of highlighting for - this message. - When |XIM| may be used the message will include "XIM". But this - doesn't mean XIM is really active. + The |hl-ModeMsg| highlight group determines the highlighting. *'showtabline'* *'stal'* 'showtabline' 'stal' number (default 1) @@ -6388,7 +6380,7 @@ A jump table for the options with a short description can be found at |Q_op|. Save the whole buffer for undo when reloading it. This applies to the ":e!" command and reloading for when the buffer changed outside of Vim. |FileChangedShell| - The save only happens when this options is negative or when the number + The save only happens when this option is negative or when the number of lines is smaller than the value of this option. Set this option to zero to disable undo for a reload. @@ -6461,7 +6453,7 @@ A jump table for the options with a short description can be found at |Q_op|. security reasons. *'viewoptions'* *'vop'* -'viewoptions' 'vop' string (default: "folds,options,cursor") +'viewoptions' 'vop' string (default: "folds,options,cursor,curdir") global {not available when compiled without the |+mksession| feature} @@ -6469,6 +6461,7 @@ A jump table for the options with a short description can be found at |Q_op|. list of words. Each word enables saving and restoring something: word save and restore ~ cursor cursor position in file and in window + curdir local current directory, if set with |:lcd| folds manually created folds, opened/closed folds and local fold options options options and mappings local to a window or buffer (not diff --git a/runtime/doc/pattern.txt b/runtime/doc/pattern.txt index b7025c8e7e..ab78b8b71c 100644 --- a/runtime/doc/pattern.txt +++ b/runtime/doc/pattern.txt @@ -1058,12 +1058,16 @@ x A single character, with no special meaning, matches itself ":s/[/x/" searches for "[/x" and replaces it with nothing. It does not search for "[" and replaces it with "x"! + *E944* *E945* If the sequence begins with "^", it matches any single character NOT in the collection: "[^xyz]" matches anything but 'x', 'y' and 'z'. - If two characters in the sequence are separated by '-', this is shorthand for the full list of ASCII characters between them. E.g., - "[0-9]" matches any decimal digit. Non-ASCII characters can be - used, but the character values must not be more than 256 apart. + "[0-9]" matches any decimal digit. If the starting character exceeds + the ending character, e.g. [c-a], E944 occurs. Non-ASCII characters + can be used, but the character values must not be more than 256 apart + in the old regexp engine. For example, searching by [\u3000-\u4000] + after setting re=1 emits a E945 error. Prepending \%#=2 will fix it. - A character class expression is evaluated to the set of characters belonging to that character class. The following character classes are supported: diff --git a/runtime/doc/pi_health.txt b/runtime/doc/pi_health.txt index 99ff519bb9..bb688770fc 100644 --- a/runtime/doc/pi_health.txt +++ b/runtime/doc/pi_health.txt @@ -23,11 +23,11 @@ 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. + Nvim depends on |$VIMRUNTIME| and 'runtimepath' to find + the standard "runtime files" for syntax highlighting, + filetype-specific behavior, and standard plugins + (including :checkhealth). If the runtime files cannot + be found then those features will not work. :checkhealth {plugins} Run healthcheck(s) for one or more plugins. E.g. to run diff --git a/runtime/doc/pi_matchit.txt b/runtime/doc/pi_matchit.txt index c711cd588f..652734f7bb 100644 --- a/runtime/doc/pi_matchit.txt +++ b/runtime/doc/pi_matchit.txt @@ -1,6 +1,6 @@ *pi_matchit.txt* Extended "%" matching -For Vim version 6.3. Last change: 2015 May 21 +For Vim version 6.3. Last change: 2017 May 14 *matchit* *matchit.vim* @@ -211,7 +211,7 @@ Examples: In LaTeX, since "%" is used as the comment character, you can > :let b:match_skip = 'r:%' < Unfortunately, this will skip anything after "\%", an escaped "%". To - allow for this, and also "\\%" (an excaped backslash followed by the + allow for this, and also "\\%" (an escaped backslash followed by the comment character) you can > :let b:match_skip = 'r:\(^\|[^\\]\)\(\\\\\)*%' < @@ -356,7 +356,8 @@ The back reference '\'.d refers to the same thing as '\'.b:match_table[d] in The various |:vmap|s defined in the script (%, |g%|, |[%|, |]%|, |a%|) may have undesired effects in Select mode |Select-mode-mapping|. At least, if you want to replace the selection with any character in "ag%[]" there will be a -pause of |'updatetime'| first. +pause of |'updatetime'| first. E.g., "yV%" would normally work linewise, but +the plugin mapping makes it characterwise. It would be nice if "\0" were recognized as the entire pattern. That is, it would be nice if "foo:\end\0" had the same effect as "\(foo\):\end\1". diff --git a/runtime/doc/print.txt b/runtime/doc/print.txt index 72625a450a..3ffb52b5ae 100644 --- a/runtime/doc/print.txt +++ b/runtime/doc/print.txt @@ -87,25 +87,25 @@ If the option is empty, then vim will use the system default printer for Macintosh: mac-roman, HPUX: hp-roman8) global -Sets the character encoding used when printing. This option tells VIM which +Sets the character encoding used when printing. This option tells Vim which print character encoding file from the "print" directory in 'runtimepath' to use. This option will accept any value from |encoding-names|. Any recognized names -are converted to VIM standard names - see 'encoding' for more details. Names -not recognized by VIM will just be converted to lower case and underscores +are converted to Vim standard names - see 'encoding' for more details. Names +not recognized by Vim will just be converted to lower case and underscores replaced with '-' signs. -If 'printencoding' is empty or VIM cannot find the file then it will use -'encoding' (if VIM is compiled with |+multi_byte| and it is set an 8-bit -encoding) to find the print character encoding file. If VIM is unable to find +If 'printencoding' is empty or Vim cannot find the file then it will use +'encoding' (if Vim is compiled with |+multi_byte| and it is set an 8-bit +encoding) to find the print character encoding file. If Vim is unable to find a character encoding file then it will use the "latin1" print character encoding file. -When 'encoding' is set to a multi-byte encoding, VIM will try to convert +When 'encoding' is set to a multi-byte encoding, Vim will try to convert characters to the printing encoding for printing (if 'printencoding' is empty then the conversion will be to latin1). Conversion to a printing encoding -other than latin1 will require VIM to be compiled with the |+iconv| feature. +other than latin1 will require Vim to be compiled with the |+iconv| feature. If no conversion is possible then printing will fail. Any characters that cannot be converted will be replaced with upside down question marks. @@ -186,7 +186,7 @@ header is used when this option is empty. 'printmbcharset' 'pmbcs' string (default "") global Sets the CJK character set to be used when generating CJK output from -|:hardcopy|. The following predefined values are currently recognised by VIM: +|:hardcopy|. The following predefined values are currently recognised by Vim: Value Description ~ Chinese GB_2312-80 @@ -253,7 +253,7 @@ Japanese text you would do the following; > If 'printmbcharset' is not one of the above values then it is assumed to specify a custom multi-byte character set and no check will be made that it is -compatible with the value for 'printencoding'. VIM will look for a file +compatible with the value for 'printencoding'. Vim will look for a file defining the character set in the "print" directory in 'runtimepath'. *pmbfn-option* @@ -403,10 +403,10 @@ There are currently a number of limitations with PostScript printing: possible to get all the characters in an encoding to print by installing a new version of the Courier font family. -- Multi-byte support - Currently VIM will try to convert multi-byte characters +- Multi-byte support - Currently Vim will try to convert multi-byte characters to the 8-bit encoding specified by 'printencoding' (or latin1 if it is empty). Any characters that are not successfully converted are shown as - unknown characters. Printing will fail if VIM cannot convert the multi-byte + unknown characters. Printing will fail if Vim cannot convert the multi-byte to the 8-bit encoding. ============================================================================== @@ -417,11 +417,11 @@ you need to define your own PostScript font encoding vector. Details on how to define a font encoding vector is beyond the scope of this help file, but you can find details in the PostScript Language Reference Manual, 3rd Edition, published by Addison-Wesley and available in PDF form at -http://www.adobe.com/. The following describes what you need to do for VIM to +http://www.adobe.com/. The following describes what you need to do for Vim to locate and use your print character encoding. i. Decide on a unique name for your encoding vector, one that does not clash - with any of the recognized or standard encoding names that VIM uses (see + with any of the recognized or standard encoding names that Vim uses (see |encoding-names| for a list), and that no one else is likely to use. ii. Copy $VIMRUNTIME/print/latin1.ps to the print subdirectory in your 'runtimepath' and rename it with your unique name. @@ -429,23 +429,23 @@ iii. Edit your renamed copy of latin1.ps, replacing all occurrences of latin1 with your unique name (don't forget the line starting %%Title:), and modify the array of glyph names to define your new encoding vector. The array must have exactly 256 entries or you will not be able to print! -iv. Within VIM, set 'printencoding' to your unique encoding name and then - print your file. VIM will now use your custom print character encoding. +iv. Within Vim, set 'printencoding' to your unique encoding name and then + print your file. Vim will now use your custom print character encoding. -VIM will report an error with the resource file if you change the order or +Vim will report an error with the resource file if you change the order or content of the first 3 lines, other than the name of the encoding on the line starting %%Title: or the version number on the line starting %%Version:. -[Technical explanation for those that know PostScript - VIM looks for a file +[Technical explanation for those that know PostScript - Vim looks for a file with the same name as the encoding it will use when printing. The file defines a new PostScript Encoding resource called /VIM-name, where name is the -print character encoding VIM will use.] +print character encoding Vim will use.] ============================================================================== 5. PostScript CJK Printing *postscript-cjk-printing* *E673* *E674* *E675* -VIM supports printing of Chinese, Japanese, and Korean files. Setting up VIM +Vim supports printing of Chinese, Japanese, and Korean files. Setting up Vim to correctly print CJK files requires setting up a few more options. Each of these countries has many standard character sets and encodings which @@ -466,7 +466,7 @@ option allows you to specify different fonts to use when printing characters which are syntax highlighted with the font styles normal, italic, bold and bold-italic. -No CJK fonts are supplied with VIM. There are some free Korean, Japanese, and +No CJK fonts are supplied with Vim. There are some free Korean, Japanese, and Traditional Chinese fonts available at: http://examples.oreilly.com/cjkvinfo/adobe/samples/ @@ -481,7 +481,7 @@ CJK fonts can be large containing several thousand glyphs, and it is not uncommon to find that they only contain a subset of a national standard. It is not unusual to find the fonts to not include characters for codes in the ASCII code range. If you find half-width Roman characters are not appearing -in your printout then you should configure VIM to use the Courier font the +in your printout then you should configure Vim to use the Courier font the half-width ASCII characters with 'printmbfont'. If your font does not include other characters then you will need to find another font that does. @@ -489,7 +489,7 @@ Another issue with ASCII characters, is that the various national character sets specify a couple of different glyphs in the ASCII code range. If you print ASCII text using the national character set you may see some unexpected characters. If you want true ASCII code printing then you need to configure -VIM to output ASCII characters for the ASCII code range with 'printmbfont'. +Vim to output ASCII characters for the ASCII code range with 'printmbfont'. It is possible to define your own multi-byte character set although this should not be attempted lightly. A discussion on the process if beyond the @@ -508,13 +508,13 @@ print job completing. There are a number of possible causes as to why the printing may have failed: - Wrong version of the prolog resource file. The prolog resource file - contains some PostScript that VIM needs to be able to print. Each version - of VIM needs one particular version. Make sure you have correctly installed + contains some PostScript that Vim needs to be able to print. Each version + of Vim needs one particular version. Make sure you have correctly installed the runtime files, and don't have any old versions of a file called prolog in the print directory in your 'runtimepath' directory. - Paper size. Some PostScript printers will abort printing a file if they do - not support the requested paper size. By default VIM uses A4 paper. Find + not support the requested paper size. By default Vim uses A4 paper. Find out what size paper your printer normally uses and set the appropriate paper size with 'printoptions'. If you cannot find the name of the paper used, measure a sheet and compare it with the table of supported paper sizes listed @@ -645,7 +645,7 @@ complex print document creation. N-UP PRINTING -The psnup utility takes an existing PostScript file generated from VIM and +The psnup utility takes an existing PostScript file generated from Vim and convert it to an n-up version. The simplest way to create a 2-up printout is to first create a PostScript file with: > @@ -701,16 +701,16 @@ There are a couple of points to bear in mind: ============================================================================== 8. Formfeed Characters *printing-formfeed* -By default VIM does not do any special processing of |formfeed| control -characters. Setting the 'printoptions' formfeed item will make VIM recognize +By default Vim does not do any special processing of |formfeed| control +characters. Setting the 'printoptions' formfeed item will make Vim recognize formfeed characters and continue printing the current line at the beginning of the first line on a new page. The use of formfeed characters provides rudimentary print control but there are certain things to be aware of. -VIM will always start printing a line (including a line number if enabled) +Vim will always start printing a line (including a line number if enabled) containing a formfeed character, even if it is the first character on the line. This means if a line starting with a formfeed character is the first -line of a page then VIM will print a blank page. +line of a page then Vim will print a blank page. Since the line number is printed at the start of printing the line containing the formfeed character, the remainder of the line printed on the new page @@ -719,7 +719,7 @@ lines of a long line when wrap in 'printoptions' is enabled). If the formfeed character is the last character on a line, then printing will continue on the second line of the new page, not the first. This is due to -VIM processing the end of the line after the formfeed character and moving +Vim processing the end of the line after the formfeed character and moving down a line to continue printing. Due to the points made above it is recommended that when formfeed character diff --git a/runtime/doc/quickfix.txt b/runtime/doc/quickfix.txt index 4c9a68fa63..da167c0f5b 100644 --- a/runtime/doc/quickfix.txt +++ b/runtime/doc/quickfix.txt @@ -31,6 +31,13 @@ From inside Vim an easy way to run a command and handle the output is with the The 'errorformat' option should be set to match the error messages from your compiler (see |errorformat| below). + *quickfix-ID* +Each quickfix list has a unique identifier called the quickfix ID and this +number will not change within a Vim session. The getqflist() function can be +used to get the identifier assigned to a list. There is also a quickfix list +number which may change whenever more than ten lists are added to a quickfix +stack. + *location-list* *E776* A location list is a window-local quickfix list. You get one after commands like `:lvimgrep`, `:lgrep`, `:lhelpgrep`, `:lmake`, etc., which create a diff --git a/runtime/doc/quickref.txt b/runtime/doc/quickref.txt index c4c3dcad88..b22d2afa7e 100644 --- a/runtime/doc/quickref.txt +++ b/runtime/doc/quickref.txt @@ -721,7 +721,6 @@ Short explanation of each option: *option-list* 'helpheight' 'hh' minimum height of a new help window 'helplang' 'hlg' preferred help languages 'hidden' 'hid' don't unload buffer when it is |abandon|ed -'highlight' 'hl' sets highlighting mode for various occasions 'hlsearch' 'hls' highlight matches with last search pattern 'history' 'hi' number of command-lines that are remembered 'hkmap' 'hk' Hebrew keyboard mapping @@ -1254,6 +1253,7 @@ Context-sensitive completion on the command-line: |:sfind| :sf[ind] {file} split window, find {file} in 'path' and edit it +|:terminal| :terminal {cmd} open a terminal window |CTRL-W_]| CTRL-W ] split window and jump to tag under cursor |CTRL-W_f| CTRL-W f split window and edit file name under diff --git a/runtime/doc/remote.txt b/runtime/doc/remote.txt index 67bfb0b48e..039d8b582e 100644 --- a/runtime/doc/remote.txt +++ b/runtime/doc/remote.txt @@ -87,7 +87,7 @@ Tell the remote server "BLA" to write all files and exit: > vim --servername BLA --remote-send ':wqa' -SERVER NAME +SERVER NAME *client-server-name* By default Vim will try to register the name under which it was invoked (gvim, egvim ...). This can be overridden with the --servername argument. If the @@ -137,6 +137,7 @@ the description in |eval.txt| or use CTRL-] on the function name to jump to the full explanation. synopsis explanation ~ + remote_startserver( name) run a server remote_expr( server, string, idvar) send expression remote_send( server, string, idvar) send key sequence serverlist() get a list of available servers diff --git a/runtime/doc/spell.txt b/runtime/doc/spell.txt index f2be25097c..718b5d4c1f 100644 --- a/runtime/doc/spell.txt +++ b/runtime/doc/spell.txt @@ -459,7 +459,7 @@ Vim uses a binary file format for spelling. This greatly speeds up loading the word list and keeps it small. *.aff* *.dic* *Myspell* You can create a Vim spell file from the .aff and .dic files that Myspell -uses. Myspell is used by OpenOffice.org and Mozilla. The OpenOffice .oxt +uses. Myspell is used by OpenOffice.org and Mozilla. The OpenOffice .oxt files are zip files which contain the .aff and .dic files. You should be able to find them here: http://extensions.services.openoffice.org/dictionary @@ -704,7 +704,7 @@ Additionally the following items are recognized: = Case must match exactly. ? Rare word. ! Bad (wrong) word. - digit A region in which the word is valid. If no regions are + 1 to 9 A region in which the word is valid. If no regions are specified the word is valid in all regions. Example: @@ -1594,7 +1594,7 @@ COMPOUNDSYLLABLE (Hunspell) *spell-COMPOUNDSYLLABLE* KEY (Hunspell) *spell-KEY* Define characters that are close together on the keyboard. Used to give better suggestions. Not supported. - + LANG (Hunspell) *spell-LANG* This specifies language-specific behavior. This actually moves part of the language knowledge into the program, diff --git a/runtime/doc/starting.txt b/runtime/doc/starting.txt index 7aba84b454..05e3f72b8d 100644 --- a/runtime/doc/starting.txt +++ b/runtime/doc/starting.txt @@ -885,7 +885,7 @@ The output of ":mkview" contains these items: 5. The scroll position and the cursor position in the file. Doesn't work very well when there are closed folds. 6. The local current directory, if it is different from the global current - directory. + directory and 'viewoptions' contains "curdir". Note that Views and Sessions are not perfect: - They don't restore everything. For example, defined functions, autocommands diff --git a/runtime/doc/syntax.txt b/runtime/doc/syntax.txt index d87825e489..85330f3dec 100644 --- a/runtime/doc/syntax.txt +++ b/runtime/doc/syntax.txt @@ -39,10 +39,12 @@ fine. If it doesn't, try setting the VIM environment variable to the directory where the Vim stuff is located. For example, if your syntax files are in the "/usr/vim/vim50/syntax" directory, set $VIMRUNTIME to "/usr/vim/vim50". You must do this in the shell, before starting Vim. +This command also sources the |menu.vim| script when the GUI is running or +will start soon. See |'go-M'| about avoiding that. *:syn-on* *:syntax-on* -The ":syntax enable" command will keep your current color settings. This -allows using ":highlight" commands to set your preferred colors before or +The `:syntax enable` command will keep your current color settings. This +allows using `:highlight` commands to set your preferred colors before or after using this command. If you want Vim to overrule your settings with the defaults, use: > :syntax on @@ -788,12 +790,9 @@ See |mysyntaxfile-add| for installing script languages permanently. APACHE *apache.vim* *ft-apache-syntax* -The apache syntax file provides syntax highlighting depending on Apache HTTP -server version, by default for 1.3.x. Set "apache_version" to Apache version -(as a string) to get highlighting for another version. Example: > +The apache syntax file provides syntax highlighting for Apache HTTP server +version 2.2.3. - :let apache_version = "2.0" -< *asm.vim* *asmh8300.vim* *nasm.vim* *masm.vim* *asm68k* ASSEMBLY *ft-asm-syntax* *ft-asmh8300-syntax* *ft-nasm-syntax* @@ -2108,6 +2107,16 @@ set "msql_minlines" to the value you desire. Example: > :let msql_minlines = 200 +N1QL *n1ql.vim* *ft-n1ql-syntax* + +N1QL is a SQL-like declarative language for manipulating JSON documents in +Couchbase Server databases. + +Vim syntax highlights N1QL statements, keywords, operators, types, comments, +and special values. Vim ignores syntactical elements specific to SQL or its +many dialects, like COLUMN or CHAR, that don't exist in N1QL. + + NCF *ncf.vim* *ft-ncf-syntax* There is one option for NCF syntax highlighting. @@ -4543,12 +4552,11 @@ is mostly used, because it looks better. ============================================================================== 12. Highlight command *:highlight* *:hi* *E28* *E411* *E415* -There are three types of highlight groups: +There are two types of highlight groups: +- The built-in |highlight-groups|. - The ones used for specific languages. For these the name starts with the name of the language. Many of these don't have any attributes, but are linked to a group of the second type. -- The ones used for all syntax languages. -- The ones used for the 'highlight' option. *hitest.vim* You can see all the groups currently active with this command: > :so $VIMRUNTIME/syntax/hitest.vim @@ -4758,10 +4766,11 @@ ctermbg={color-nr} *highlight-ctermbg* Example: > :highlight Normal ctermfg=grey ctermbg=darkblue < When setting the "ctermbg" color for the Normal group, the - 'background' option will be adjusted automatically. This causes the - highlight groups that depend on 'background' to change! This means - you should set the colors for Normal first, before setting other - colors. + 'background' option will be adjusted automatically, under the + condition that the color is recognized and 'background' was not set + explicitly. This causes the highlight groups that depend on + 'background' to change! This means you should set the colors for + Normal first, before setting other colors. When a colorscheme is being used, changing 'background' causes it to be reloaded, which may reset all colors (including Normal). First delete the "g:colors_name" variable when you don't want this. @@ -4920,7 +4929,7 @@ NonText '@' at the end of the window, characters from 'showbreak' *hl-Normal* Normal normal text *hl-NormalNC* -NormalNC normal text in non-current window +NormalNC normal text in non-current windows *hl-Pmenu* Pmenu Popup menu: normal item. *hl-PmenuSel* @@ -5080,8 +5089,6 @@ defaults back: > It is a bit of a wrong name, since it does not reset any syntax items, it only affects the highlighting. -This doesn't change the colors for the 'highlight' option. - Note that the syntax colors that you set in your vimrc file will also be reset back to their Vim default. Note that if you are using a color scheme, the colors defined by the color diff --git a/runtime/doc/tagsrch.txt b/runtime/doc/tagsrch.txt index 1ceb602512..f0ad2cfd43 100644 --- a/runtime/doc/tagsrch.txt +++ b/runtime/doc/tagsrch.txt @@ -189,6 +189,7 @@ the same entry. information in the tags file(s). When [ident] is not given, the last tag name from the tag stack is used. + See |tag-!| for [!]. With a '>' in the first column is indicated which is the current position in the list (if there is one). [ident] can be a regexp pattern, see |tag-regexp|. diff --git a/runtime/doc/usr_03.txt b/runtime/doc/usr_03.txt index 5a7f0cb0e5..989914687f 100644 --- a/runtime/doc/usr_03.txt +++ b/runtime/doc/usr_03.txt @@ -353,7 +353,7 @@ The "?" command works like "/" but searches backwards: > ?word The "N" command repeats the last search the opposite direction. Thus using -"N" after a "/" command search backwards, using "N" after "?" searches +"N" after a "/" command searches backwards, using "N" after "?" searches forward. @@ -508,7 +508,7 @@ only if it is at the beginning of a line. The $ character matches the end of a line. Therefore, "was$" matches the word was only if it is at the end of a line. -Let's mark the places where "the" matches in this example line with "x"s: +Let's mark the places where "/the" matches in this example line with "x"s: the solder holding one of the chips melted and the ~ xxx xxx xxx diff --git a/runtime/doc/usr_07.txt b/runtime/doc/usr_07.txt index 3fc600d977..683c9879a7 100644 --- a/runtime/doc/usr_07.txt +++ b/runtime/doc/usr_07.txt @@ -221,7 +221,7 @@ and write the file with ":w". You edit several other files, and then use ":edit one.txt" to come back to "one.txt". If you now use `" Vim jumps to the last line of the file. Using `. takes you to the position where you deleted the character. Even when you move around in the file `" and `. will take you -to the remembered position, at least until you make another change or leave +to the remembered position. At least until you make another change or leave the file. @@ -233,8 +233,8 @@ another file and place marks there, these are specific for that file. Thus each file has its own set of marks, they are local to the file. So far we were using marks with a lowercase letter. There are also marks with an uppercase letter. These are global, they can be used from any file. -For example suppose that we are editing the file "foo.txt". Go to halfway of -the file ("50%") and place the F mark there (F for foo): > +For example suppose that we are editing the file "foo.txt". Go to halfway +down the file ("50%") and place the F mark there (F for foo): > 50%mF @@ -355,7 +355,7 @@ a sentence to the f register (f for First): > "fyas The "yas" command yanks a sentence like before. It's the "f that tells Vim -the text should be place in the f register. This must come just before the +the text should be placed in the f register. This must come just before the yank command. Now yank three whole lines to the l register (l for line): > diff --git a/runtime/doc/usr_08.txt b/runtime/doc/usr_08.txt index 575921fc4f..ef91bf9c0a 100644 --- a/runtime/doc/usr_08.txt +++ b/runtime/doc/usr_08.txt @@ -45,7 +45,7 @@ top one: +----------------------------------+ What you see here is two windows on the same file. The line with "====" is -that status line. It displays information about the window above it. (In +the status line. It displays information about the window above it. (In practice the status line will be in reverse video.) The two windows allow you to view two parts of the same file. For example, you could make the top window show the variable declarations of a program, and diff --git a/runtime/doc/usr_09.txt b/runtime/doc/usr_09.txt index 1ff3d93329..f53076a2ec 100644 --- a/runtime/doc/usr_09.txt +++ b/runtime/doc/usr_09.txt @@ -21,7 +21,7 @@ Table of contents: |usr_toc.txt| ============================================================================== *09.1* Parts of the GUI -You might have an icon on your desktop that starts gVim. Otherwise, one of +You might have an icon on your desktop that starts gvim. Otherwise, one of these commands should do it: > gvim file.txt @@ -60,7 +60,7 @@ THE WINDOW TITLE At the very top is the window title. This is drawn by your window system. Vim will set the title to show the name of the current file. First comes the name of the file. Then some special characters and the directory of the file -in parens. These special character can be present: +in parens. These special characters can be present: - The file cannot be modified (e.g., a help file) + The file contains changes @@ -180,14 +180,14 @@ currently highlighted. In Vim this is the Visual area (this assumes you are using the default option settings). You can paste this selection in another application without any further action. For example, in this text select a few words with the mouse. Vim will -switch to Visual mode and highlight the text. Now start another gVim, without +switch to Visual mode and highlight the text. Now start another gvim, without a file name argument, so that it displays an empty window. Click the middle mouse button. The selected text will be inserted. The "current selection" will only remain valid until some other text is -selected. After doing the paste in the other gVim, now select some characters +selected. After doing the paste in the other gvim, now select some characters in that window. You will notice that the words that were previously selected -in the other gVim window are displayed differently. This means that it no +in the other gvim window are displayed differently. This means that it no longer is the current selection. You don't need to select text with the mouse, using the keyboard commands for @@ -200,10 +200,10 @@ Now for the other place with which text can be exchanged. We call this the "real clipboard", to avoid confusion. Often both the "current selection" and the "real clipboard" are called clipboard, you'll have to get used to that. To put text on the real clipboard, select a few different words in one of -the gVims you have running. Then use the Edit/Copy menu entry. Now the text +the gvims you have running. Then use the Edit/Copy menu entry. Now the text has been copied to the real clipboard. You can't see this, unless you have -some application that shows the clipboard contents (e.g., KDE's klipper). - Now select the other gVim, position the cursor somewhere and use the +some application that shows the clipboard contents (e.g., KDE's Klipper). + Now select the other gvim, position the cursor somewhere and use the Edit/Paste menu. You will see the text from the real clipboard is inserted. @@ -211,7 +211,7 @@ USING BOTH This use of both the "current selection" and the "real clipboard" might sound a bit confusing. But it is very useful. Let's show this with an example. -Use one gVim with a text file and perform these actions: +Use one gvim with a text file and perform these actions: - Select two words in Visual mode. - Use the Edit/Copy menu to get these words onto the clipboard. diff --git a/runtime/doc/usr_12.txt b/runtime/doc/usr_12.txt index 9078f4748a..e87ed81c97 100644 --- a/runtime/doc/usr_12.txt +++ b/runtime/doc/usr_12.txt @@ -278,7 +278,7 @@ command: > The line range "%" is used, thus this works on the whole file. The pattern that the ":substitute" command matches with is "\s\+$". This finds white space characters (\s), 1 or more of them (\+), before the end-of-line ($). -Later will be explained how you write patterns like this |usr_27.txt|. +Later will be explained how you write patterns like this, see |usr_27.txt|. The "to" part of the substitute command is empty: "//". Thus it replaces with nothing, effectively deleting the matched white space. diff --git a/runtime/doc/usr_41.txt b/runtime/doc/usr_41.txt index 4f6a5aa5ab..51d8143440 100644 --- a/runtime/doc/usr_41.txt +++ b/runtime/doc/usr_41.txt @@ -888,6 +888,7 @@ GUI: *gui-functions* Vim server: *server-functions* serverlist() return the list of server names + remote_startserver() run a server remote_send() send command characters to a Vim server remote_expr() evaluate an expression in a Vim server server2client() send a reply to a client of a Vim server @@ -2226,8 +2227,8 @@ plugin for the mail filetype: > endif Two global variables are used: -no_plugin_maps disables mappings for all filetype plugins -no_mail_maps disables mappings for a specific filetype +|no_plugin_maps| disables mappings for all filetype plugins +|no_mail_maps| disables mappings for the "mail" filetype USER COMMANDS diff --git a/runtime/doc/usr_44.txt b/runtime/doc/usr_44.txt index fcd6b71219..b06557b950 100644 --- a/runtime/doc/usr_44.txt +++ b/runtime/doc/usr_44.txt @@ -686,7 +686,7 @@ that included files do this too, you might have to reset "b:current_syntax" if you include two files. If you want your syntax file to work with Vim 5.x, add a check for v:version. -See yacc.vim for an example. +Find an syntax file in the Vim 7.2 distribution for an example. Do not include anything that is a user preference. Don't set 'tabstop', 'expandtab', etc. These belong in a filetype plugin. diff --git a/runtime/doc/various.txt b/runtime/doc/various.txt index 9150f3a809..baac72c106 100644 --- a/runtime/doc/various.txt +++ b/runtime/doc/various.txt @@ -102,8 +102,7 @@ g8 Print the hex values of the bytes used in the *:nu* *:number* :[range]nu[mber] [count] [flags] Same as :print, but precede each line with its line - number. (See also 'highlight' and 'numberwidth' - option). + number. (See also |hl-LineNr| and 'numberwidth'). See |ex-flags| for [flags]. *:#* @@ -325,7 +324,7 @@ N *+cindent* |'cindent'|, C indenting N *+clientserver* Unix and Win32: Remote invocation |clientserver| *+clipboard* |clipboard| support N *+cmdline_compl* command line completion |cmdline-completion| -N *+cmdline_hist* command line history |cmdline-history| +S *+cmdline_hist* command line history |cmdline-history| N *+cmdline_info* |'showcmd'| and |'ruler'| N *+comments* |'comments'| support B *+conceal* "conceal" support, see |conceal| |:syn-conceal| etc. @@ -348,7 +347,7 @@ N *+gettext* message translations |multi-lang| *+iconv* Compiled with the |iconv()| function *+iconv/dyn* Likewise |iconv-dynamic| |/dyn| N *+insert_expand* |insert_expand| Insert mode completion -N *+jumplist* |jumplist| +S *+jumplist* |jumplist| B *+keymap* |'keymap'| N *+lambda* |lambda| and |closure| B *+langmap* |'langmap'| @@ -397,14 +396,14 @@ N *+timers* the |timer_start()| function N *+title* Setting the window 'title' and 'icon' N *+toolbar* |gui-toolbar| N *+user_commands* User-defined commands. |user-commands| -N *+vertsplit* Vertically split windows |:vsplit| + *+vertsplit* Vertically split windows |:vsplit| N *+virtualedit* |'virtualedit'| S *+visual* Visual mode |Visual-mode| Always enabled since 7.4.200. N *+visualextra* extra Visual mode commands |blockwise-operators| N *+vreplace* |gR| and |gr| N *+wildignore* |'wildignore'| N *+wildmenu* |'wildmenu'| -S *+windows* more than one window + *+windows* more than one window m *+writebackup* |'writebackup'| is default on m *+xim* X input method |xim| *+xfontset* X fontset support |xfontset| diff --git a/runtime/doc/vim_diff.txt b/runtime/doc/vim_diff.txt index 6959d64989..026ff6a0fb 100644 --- a/runtime/doc/vim_diff.txt +++ b/runtime/doc/vim_diff.txt @@ -159,6 +159,7 @@ Events: |TextYankPost| Highlight groups: + |hl-NormalNC| highlights non-current windows |hl-QuickFixLine| |hl-Substitute| |hl-TermCursor| @@ -298,6 +299,8 @@ Highlight groups: |hl-ColorColumn|, |hl-CursorColumn| are lower priority than most other groups +The variable name "count" is no fallback for |v:count| anymore. + ============================================================================== 5. Missing legacy features *nvim-features-missing* @@ -377,7 +380,7 @@ Other options: 'esckeys' 'guioptions' "t" flag was removed *'guipty'* (Nvim uses pipes and PTYs consistently on all platforms.) - 'highlight' (the builtin |highlight-groups| cannot be changed) + 'highlight' (Names of builtin |highlight-groups| cannot be changed.) *'imactivatefunc'* *'imaf'* *'imactivatekey'* *'imak'* *'imstatusfunc'* *'imsf'* diff --git a/runtime/doc/visual.txt b/runtime/doc/visual.txt index 6c4d44edb6..176ce562d8 100644 --- a/runtime/doc/visual.txt +++ b/runtime/doc/visual.txt @@ -25,8 +25,7 @@ Using Visual mode consists of three parts: 3. Type an operator command. The highlighted characters will be operated upon. -The 'highlight' option can be used to set the display mode to use for -highlighting in Visual mode. +The |hl-Visual| group determines the highlighting of the visual selection. The 'virtualedit' option can be used to allow positioning the cursor to positions where there is no actual character. diff --git a/runtime/doc/windows.txt b/runtime/doc/windows.txt index c37362a497..e83377471c 100644 --- a/runtime/doc/windows.txt +++ b/runtime/doc/windows.txt @@ -106,18 +106,10 @@ This option can be local to the window, so that you can have a different status line in each window. Normally, inversion is used to display the status line. This can be changed -with the 's' character in the 'highlight' option. For example, "sb" sets it to -bold characters. If no highlighting is used for the status line ("sn"), the -'^' character is used for the current window, and '=' for other windows. If -the mouse is supported and enabled with the 'mouse' option, a status line can -be dragged to resize windows. - -Note: If you expect your status line to be in reverse video and it isn't, -check if the 'highlight' option contains "si". In version 3.0, this meant to -invert the status line. Now it should be "sr", reverse the status line, as -"si" now stands for italic! If italic is not available on your terminal, the -status line is inverted anyway; you will only see this problem on terminals -that have |terminfo| capabilities for italics. +with the |hl-StatusLine| highlight group. If no highlighting is used for the +status line, the '^' character is used for the current window, and '=' for +other windows. If 'mouse' is enabled, a status line can be dragged to resize +windows. ============================================================================== 3. Opening and closing a window *opening-window* *E36* @@ -319,8 +311,9 @@ CTRL-W CTRL-C *CTRL-W_CTRL-C* *:hide* :hid[e] :{count}hid[e] - Quit the current window, unless it is the last window on the - screen. For {count} see |:quit|. + Without {count}: Quit the current window, unless it is the + last window on the screen. + If {count} is given quit the {count} window. The buffer becomes hidden (unless there is another window editing it or 'bufhidden' is `unload`, `delete` or `wipe`). @@ -594,7 +587,8 @@ The minimal height and width of a window is set with 'winminheight' and 41. :buffers list of buffers The meaning of [N] depends on the command: - [N] is number of buffers to go forward/backward on ?2, ?3, and ?4 + [N] is the number of buffers to go forward/backward on 2/12/22/32, + 3/13/23/33, and 4/14/24/34 [N] is an argument number, defaulting to current argument, for 1 and 21 [N] is a buffer number, defaulting to current buffer, for 11 and 31 [N] is a count for 19 and 39 @@ -1002,6 +996,9 @@ list of buffers. |unlisted-buffer| displayed in a window |hidden-buffer| - a buffer with 'modifiable' off = a readonly buffer + R a terminal buffer with a running job + F a terminal buffer with a finished job + ? a terminal buffer without a job: `:terminal NONE` + a modified buffer x a buffer with read errors @@ -1246,6 +1243,9 @@ help Contains a help file. Will only be created with the |:help| and can't be changed. The 'buflisted' option will be reset for a help buffer. +terminal A terminal window buffer, see |terminal|. The contents cannot + be read or changed until the job ends. + directory Displays directory contents. Can be used by a file explorer plugin. The buffer is created with these settings: > :setlocal buftype=nowrite diff --git a/runtime/filetype.vim b/runtime/filetype.vim index 79fbcbca00..76f76af345 100644 --- a/runtime/filetype.vim +++ b/runtime/filetype.vim @@ -1,7 +1,7 @@ " Vim support file to detect file types " " Maintainer: Bram Moolenaar -" Last Change: 2017 Mar 13 +" Last Change: 2017 Nov 02 " Listen very carefully, I will say this only once if exists("did_load_filetypes") @@ -284,14 +284,15 @@ au BufNewFile,BufRead *.bib setf bib au BufNewFile,BufRead *.bst setf bst " BIND configuration -au BufNewFile,BufRead named.conf,rndc.conf setf named +" sudoedit uses namedXXXX.conf +au BufNewFile,BufRead named*.conf,rndc*.conf,rndc*.key setf named " BIND zone au BufNewFile,BufRead named.root setf bindzone au BufNewFile,BufRead *.db call s:BindzoneCheck('') func! s:BindzoneCheck(default) - if getline(1).getline(2).getline(3).getline(4) =~ '^; <<>> DiG [0-9.]\+ <<>>\|BIND.*named\|$ORIGIN\|$TTL\|IN\s\+SOA' + if getline(1).getline(2).getline(3).getline(4) =~ '^; <<>> DiG [0-9.]\+.* <<>>\|$ORIGIN\|$TTL\|IN\s\+SOA' setf bindzone elseif a:default != '' exe 'setf ' . a:default @@ -626,7 +627,13 @@ au BufNewFile,BufRead dict.conf,.dictrc setf dictconf au BufNewFile,BufRead dictd.conf setf dictdconf " Diff files -au BufNewFile,BufRead *.diff,*.rej,*.patch setf diff +au BufNewFile,BufRead *.diff,*.rej setf diff +au BufNewFile,BufRead *.patch + \ if getline(1) =~ '^From [0-9a-f]\{40\} Mon Sep 17 00:00:00 2001$' | + \ setf gitsendemail | + \ else | + \ setf diff | + \ endif " Dircolors au BufNewFile,BufRead .dir_colors,.dircolors,*/etc/DIR_COLORS setf dircolors @@ -795,6 +802,7 @@ if !empty($XDG_CONFIG_HOME) au BufNewFile,BufRead $XDG_CONFIG_HOME/git/config setf gitconfig endif au BufNewFile,BufRead git-rebase-todo setf gitrebase +au BufRead,BufNewFile .gitsendemail.msg.?????? setf gitsendemail au BufNewFile,BufRead .msg.[0-9]* \ if getline(1) =~ '^From.*# This line is ignored.$' | \ setf gitsendemail | @@ -975,7 +983,7 @@ au BufNewFile,BufRead */etc/initng/*/*.i,*.ii setf initng " Innovation Data Processing au BufRead,BufNewFile upstream.dat\c,upstream.*.dat\c,*.upstream.dat\c setf upstreamdat -au BufRead,BufNewFile upstream.log\c,upstream.*.log\c,*.upstream.log\c setf upstreamlog +au BufRead,BufNewFile fdrupstream.log,upstream.log\c,upstream.*.log\c,*.upstream.log\c,UPSTREAM-*.log\c setf upstreamlog au BufRead,BufNewFile upstreaminstall.log\c,upstreaminstall.*.log\c,*.upstreaminstall.log\c setf upstreaminstalllog au BufRead,BufNewFile usserver.log\c,usserver.*.log\c,*.usserver.log\c setf usserverlog au BufRead,BufNewFile usw2kagt.log\c,usw2kagt.*.log\c,*.usw2kagt.log\c setf usw2kagtlog @@ -1139,8 +1147,8 @@ au BufNewFile,BufRead *.m4 " MaGic Point au BufNewFile,BufRead *.mgp setf mgp -" Mail (for Elm, trn, mutt, muttng, rn, slrn) -au BufNewFile,BufRead snd.\d\+,.letter,.letter.\d\+,.followup,.article,.article.\d\+,pico.\d\+,mutt{ng,}-*-\w\+,mutt[[:alnum:]_-]\\\{6\},ae\d\+.txt,/tmp/SLRN[0-9A-Z.]\+,*.eml setf mail +" Mail (for Elm, trn, mutt, muttng, rn, slrn, neomutt) +au BufNewFile,BufRead snd.\d\+,.letter,.letter.\d\+,.followup,.article,.article.\d\+,pico.\d\+,mutt{ng,}-*-\w\+,mutt[[:alnum:]_-]\\\{6\},neomutt-*-\w\+,neomutt[[:alnum:]_-]\\\{6\},ae\d\+.txt,/tmp/SLRN[0-9A-Z.]\+,*.eml setf mail " Mail aliases au BufNewFile,BufRead */etc/mail/aliases,*/etc/aliases setf mailaliases @@ -1316,6 +1324,9 @@ au BufNewFile,BufRead */etc/nanorc,*.nanorc setf nanorc " Natural au BufNewFile,BufRead *.NS[ACGLMNPS] setf natural +" Noemutt setup file +au BufNewFile,BufRead Neomuttrc setf neomuttrc + " Netrc au BufNewFile,BufRead .netrc setf netrc @@ -1407,14 +1418,17 @@ au BufNewFile,BufRead *.dpr setf pascal " PDF au BufNewFile,BufRead *.pdf setf pdf +" PCMK - HAE - crm configure edit +au BufNewFile,BufRead *.pcmk setf pcmk + " Perl if has("fname_case") au BufNewFile,BufRead *.pl,*.PL call s:FTpl() else au BufNewFile,BufRead *.pl call s:FTpl() endif -au BufNewFile,BufRead *.plx,*.al setf perl -au BufNewFile,BufRead *.p6,*.pm6,*.pl6 setf perl6 +au BufNewFile,BufRead *.plx,*.al,*.psgi setf perl +au BufNewFile,BufRead *.p6,*.pm6,*.pl6 setf perl6 func! s:FTpl() if exists("g:filetype_pl") @@ -1801,6 +1815,9 @@ au BufNewFile,BufRead *.sa setf sather " Scala au BufNewFile,BufRead *.scala setf scala +" SBT - Scala Build Tool +au BufNewFile,BufRead *.sbt setf sbt + " Scilab au BufNewFile,BufRead *.sci,*.sce setf scilab @@ -2127,7 +2144,10 @@ au BufNewFile,BufRead ssh_config,*/.ssh/config setf sshconfig au BufNewFile,BufRead sshd_config setf sshdconfig " Stata -au BufNewFile,BufRead *.ado,*.class,*.do,*.imata,*.mata setf stata +au BufNewFile,BufRead *.ado,*.do,*.imata,*.mata setf stata +" Also *.class, but not when it's a Java bytecode file +au BufNewFile,BufRead *.class + \ if getline(1) !~ "^\xca\xfe\xba\xbe" | setf stata | endif " SMCL au BufNewFile,BufRead *.hlp,*.ihlp,*.smcl setf smcl @@ -2222,6 +2242,8 @@ func! s:FTtex() let format = tolower(matchstr(firstline, '\a\+')) let format = substitute(format, 'pdf', '', '') if format == 'tex' + let format = 'latex' + elseif format == 'plaintex' let format = 'plain' endif else @@ -2392,6 +2414,9 @@ au BufNewFile,BufRead *.wbt setf winbatch " WSML au BufNewFile,BufRead *.wsml setf wsml +" WPL +au BufNewFile,BufRead *.wpl setf xml + " WvDial au BufNewFile,BufRead wvdial.conf,.wvdialrc setf wvdial @@ -2667,7 +2692,7 @@ au BufNewFile,BufRead [mM]akefile* call s:StarSetf('make') au BufNewFile,BufRead [rR]akefile* call s:StarSetf('ruby') " Mail (also matches muttrc.vim, so this is below the other checks) -au BufNewFile,BufRead mutt[[:alnum:]._-]\\\{6\} setf mail +au BufNewFile,BufRead {neo,}mutt[[:alnum:]._-]\\\{6\} setf mail au BufNewFile,BufRead reportbug-* call s:StarSetf('mail') @@ -2682,6 +2707,10 @@ au BufNewFile,BufRead */etc/modprobe.* call s:StarSetf('modconf') au BufNewFile,BufRead .mutt{ng,}rc*,*/.mutt{ng,}/mutt{ng,}rc* call s:StarSetf('muttrc') au BufNewFile,BufRead mutt{ng,}rc*,Mutt{ng,}rc* call s:StarSetf('muttrc') +" Neomutt setup file +au BufNewFile,BufRead .neomuttrc*,*/.neomutt/neomuttrc* call s:StarSetf('neomuttrc') +au BufNewFile,BufRead neomuttrc*,Neomuttrc* call s:StarSetf('neomuttrc') + " Nroff macros au BufNewFile,BufRead tmac.* call s:StarSetf('nroff') diff --git a/runtime/ftplugin/c.vim b/runtime/ftplugin/c.vim index 3717ea92a9..6047f9f863 100644 --- a/runtime/ftplugin/c.vim +++ b/runtime/ftplugin/c.vim @@ -1,7 +1,7 @@ " Vim filetype plugin file " Language: C " Maintainer: Bram Moolenaar -" Last Change: 2016 Jun 12 +" Last Change: 2017 Sep 28 " Only do this when not done yet for this buffer if exists("b:did_ftplugin") @@ -30,8 +30,8 @@ endif setlocal comments=sO:*\ -,mO:*\ \ ,exO:*/,s1:/*,mb:*,ex:*/,:// " When the matchit plugin is loaded, this makes the % command skip parens and -" braces in comments. -let b:match_words = &matchpairs . ',^\s*#\s*if\(\|def\|ndef\)\>:^\s*#\s*elif\>:^\s*#\s*else\>:^\s*#\s*endif\>' +" braces in comments properly. +let b:match_words = '^\s*#\s*if\(\|def\|ndef\)\>:^\s*#\s*elif\>:^\s*#\s*else\>:^\s*#\s*endif\>' let b:match_skip = 's:comment\|string\|character\|special' " Win32 can filter files in the browse dialog diff --git a/runtime/ftplugin/gdb.vim b/runtime/ftplugin/gdb.vim new file mode 100644 index 0000000000..2473b13af0 --- /dev/null +++ b/runtime/ftplugin/gdb.vim @@ -0,0 +1,12 @@ +" Vim filetype plugin file +" Language: gdb +" Maintainer: MichaĂ«l Peeters +" Last Changed: 26 Oct 2017 + +if exists("b:did_ftplugin") | finish | endif +let b:did_ftplugin = 1 + +setlocal commentstring=#%s + +" Undo the stuff we changed. +let b:undo_ftplugin = "setlocal cms<" diff --git a/runtime/ftplugin/hamster.vim b/runtime/ftplugin/hamster.vim index 29711fb093..6c0630fe04 100644 --- a/runtime/ftplugin/hamster.vim +++ b/runtime/ftplugin/hamster.vim @@ -2,7 +2,7 @@ " Language: Hamster Script " Version: 2.0.6.0 " Maintainer: David Fishburn -" Last Change: 2017 Mar 07 +" Last Change: 2017 Mar 18 " Only do this when not done yet for this buffer if exists("b:did_ftplugin") @@ -14,7 +14,6 @@ let b:did_ftplugin = 1 let s:cpo_save = &cpo set cpo&vim -set cpo-=C let b:undo_ftplugin = "setl fo< com< tw< commentstring<" \ . "| unlet! b:match_ignorecase b:match_words b:match_skip" diff --git a/runtime/ftplugin/neomuttrc.vim b/runtime/ftplugin/neomuttrc.vim new file mode 100644 index 0000000000..86f1cded63 --- /dev/null +++ b/runtime/ftplugin/neomuttrc.vim @@ -0,0 +1,23 @@ +" Vim filetype plugin file +" Language: NeoMutt RC File +" Previous Maintainer: Guillaume Brogi +" Latest Revision: 2017-09-17 +" Original version copied from ftplugin/muttrc.vim + +if exists("b:did_ftplugin") + finish +endif +let b:did_ftplugin = 1 + +let s:cpo_save = &cpo +set cpo&vim + +let b:undo_ftplugin = "setl com< cms< inc< fo<" + +setlocal comments=:# commentstring=#\ %s +setlocal formatoptions-=t formatoptions+=croql + +let &l:include = '^\s*source\>' + +let &cpo = s:cpo_save +unlet s:cpo_save diff --git a/runtime/ftplugin/perl.vim b/runtime/ftplugin/perl.vim index 741cfae047..e7acf654f3 100644 --- a/runtime/ftplugin/perl.vim +++ b/runtime/ftplugin/perl.vim @@ -3,7 +3,7 @@ " Maintainer: vim-perl " Homepage: http://github.com/vim-perl/vim-perl " Bugs/requests: http://github.com/vim-perl/vim-perl/issues -" Last Change: 2013-07-21 +" Last Change: 2015-02-09 if exists("b:did_ftplugin") | finish | endif let b:did_ftplugin = 1 @@ -33,14 +33,14 @@ endif setlocal include=\\<\\(use\\\|require\\)\\> setlocal includeexpr=substitute(substitute(substitute(v:fname,'::','/','g'),'->\*','',''),'$','.pm','') setlocal define=[^A-Za-z_] +setlocal iskeyword+=: " The following line changes a global variable but is necessary to make -" gf and similar commands work. The change to iskeyword was incorrect. -" Thanks to Andrew Pimlott for pointing out the problem. If this causes a -" problem for you, add an after/ftplugin/perl.vim file that contains +" gf and similar commands work. Thanks to Andrew Pimlott for pointing +" out the problem. If this causes a problem for you, add an +" after/ftplugin/perl.vim file that contains " set isfname-=: set isfname+=: -set iskeyword+=: " Set this once, globally. if !exists("perlpath") @@ -77,11 +77,12 @@ endif "--------------------------------------------- " Undo the stuff we changed. -let b:undo_ftplugin = "setlocal fo< com< cms< inc< inex< def< isf< kp< path<" . +let b:undo_ftplugin = "setlocal fo< com< cms< inc< inex< def< isk< isf< kp< path<" . \ " | unlet! b:browsefilter" " proper matching for matchit plugin let b:match_skip = 's:comment\|string\|perlQQ\|perlShellCommand\|perlHereDoc\|perlSubstitution\|perlTranslation\|perlMatch\|perlFormatField' +let b:match_words = '\:\:\' " Restore the saved compatibility options. let &cpo = s:save_cpo diff --git a/runtime/ftplugin/python.vim b/runtime/ftplugin/python.vim index 546e3bd560..d52a338b5b 100644 --- a/runtime/ftplugin/python.vim +++ b/runtime/ftplugin/python.vim @@ -1,9 +1,10 @@ " Vim filetype plugin file " Language: python -" Maintainer: James Sully +" Maintainer: Tom Picton +" Previous Maintainer: James Sully " Previous Maintainer: Johannes Zellner -" Last Change: Tue, 09 October 2016 -" https://github.com/sullyj3/vim-ftplugin-python +" Last Change: Fri, 20 October 2017 +" https://github.com/tpict/vim-ftplugin-python if exists("b:did_ftplugin") | finish | endif let b:did_ftplugin = 1 @@ -24,31 +25,51 @@ set wildignore+=*.pyc let b:next_toplevel='\v%$\|^(class\|def\|async def)>' let b:prev_toplevel='\v^(class\|def\|async def)>' +let b:next_endtoplevel='\v%$\|\S.*\n+(def\|class)' +let b:prev_endtoplevel='\v\S.*\n+(def\|class)' let b:next='\v%$\|^\s*(class\|def\|async def)>' let b:prev='\v^\s*(class\|def\|async def)>' +let b:next_end='\v\S\n*(%$\|^\s*(class\|def\|async def)\|^\S)' +let b:prev_end='\v\S\n*(^\s*(class\|def\|async def)\|^\S)' execute "nnoremap ]] :call Python_jump('n', '". b:next_toplevel."', 'W')" execute "nnoremap [[ :call Python_jump('n', '". b:prev_toplevel."', 'Wb')" +execute "nnoremap ][ :call Python_jump('n', '". b:next_endtoplevel."', 'W', 0)" +execute "nnoremap [] :call Python_jump('n', '". b:prev_endtoplevel."', 'Wb', 0)" execute "nnoremap ]m :call Python_jump('n', '". b:next."', 'W')" execute "nnoremap [m :call Python_jump('n', '". b:prev."', 'Wb')" +execute "nnoremap ]M :call Python_jump('n', '". b:next_end."', 'W', 0)" +execute "nnoremap [M :call Python_jump('n', '". b:prev_end."', 'Wb', 0)" execute "onoremap ]] :call Python_jump('o', '". b:next_toplevel."', 'W')" execute "onoremap [[ :call Python_jump('o', '". b:prev_toplevel."', 'Wb')" +execute "onoremap ][ :call Python_jump('n', '". b:next_endtoplevel."', 'W', 0)" +execute "onoremap [] :call Python_jump('n', '". b:prev_endtoplevel."', 'Wb', 0)" execute "onoremap ]m :call Python_jump('o', '". b:next."', 'W')" execute "onoremap [m :call Python_jump('o', '". b:prev."', 'Wb')" +execute "onoremap ]M :call Python_jump('o', '". b:next_end."', 'W', 0)" +execute "onoremap [M :call Python_jump('o', '". b:prev_end."', 'Wb', 0)" execute "xnoremap ]] :call Python_jump('x', '". b:next_toplevel."', 'W')" execute "xnoremap [[ :call Python_jump('x', '". b:prev_toplevel."', 'Wb')" +execute "xnoremap ][ :call Python_jump('n', '". b:next_endtoplevel."', 'W', 0)" +execute "xnoremap [] :call Python_jump('n', '". b:prev_endtoplevel."', 'Wb', 0)" execute "xnoremap ]m :call Python_jump('x', '". b:next."', 'W')" execute "xnoremap [m :call Python_jump('x', '". b:prev."', 'Wb')" +execute "xnoremap ]M :call Python_jump('x', '". b:next_end."', 'W', 0)" +execute "xnoremap [M :call Python_jump('x', '". b:prev_end."', 'Wb', 0)" if !exists('*Python_jump') - fun! Python_jump(mode, motion, flags) range + fun! Python_jump(mode, motion, flags, ...) range + let l:startofline = (a:0 >= 1) ? a:1 : 1 + if a:mode == 'x' normal! gv endif - normal! 0 + if l:startofline == 1 + normal! 0 + endif let cnt = v:count1 mark ' @@ -57,7 +78,9 @@ if !exists('*Python_jump') let cnt = cnt - 1 endwhile - normal! ^ + if l:startofline == 1 + normal! ^ + endif endfun endif diff --git a/runtime/ftplugin/rust.vim b/runtime/ftplugin/rust.vim new file mode 100644 index 0000000000..7efca5985b --- /dev/null +++ b/runtime/ftplugin/rust.vim @@ -0,0 +1,197 @@ +" Language: Rust +" Description: Vim ftplugin for Rust +" Maintainer: Chris Morgan +" Maintainer: Kevin Ballard +" Last Change: June 08, 2016 +" For bugs, patches and license go to https://github.com/rust-lang/rust.vim + +if exists("b:did_ftplugin") + finish +endif +let b:did_ftplugin = 1 + +let s:save_cpo = &cpo +set cpo&vim + +augroup rust.vim +autocmd! + +" Variables {{{1 + +" The rust source code at present seems to typically omit a leader on /*! +" comments, so we'll use that as our default, but make it easy to switch. +" This does not affect indentation at all (I tested it with and without +" leader), merely whether a leader is inserted by default or not. +if exists("g:rust_bang_comment_leader") && g:rust_bang_comment_leader != 0 + " Why is the `,s0:/*,mb:\ ,ex:*/` there, you ask? I don't understand why, + " but without it, */ gets indented one space even if there were no + " leaders. I'm fairly sure that's a Vim bug. + setlocal comments=s1:/*,mb:*,ex:*/,s0:/*,mb:\ ,ex:*/,:///,://!,:// +else + setlocal comments=s0:/*!,m:\ ,ex:*/,s1:/*,mb:*,ex:*/,:///,://!,:// +endif +setlocal commentstring=//%s +setlocal formatoptions-=t formatoptions+=croqnl +" j was only added in 7.3.541, so stop complaints about its nonexistence +silent! setlocal formatoptions+=j + +" smartindent will be overridden by indentexpr if filetype indent is on, but +" otherwise it's better than nothing. +setlocal smartindent nocindent + +if !exists("g:rust_recommended_style") || g:rust_recommended_style != 0 + setlocal tabstop=4 shiftwidth=4 softtabstop=4 expandtab + setlocal textwidth=99 +endif + +" This includeexpr isn't perfect, but it's a good start +setlocal includeexpr=substitute(v:fname,'::','/','g') + +setlocal suffixesadd=.rs + +if exists("g:ftplugin_rust_source_path") + let &l:path=g:ftplugin_rust_source_path . ',' . &l:path +endif + +if exists("g:loaded_delimitMate") + if exists("b:delimitMate_excluded_regions") + let b:rust_original_delimitMate_excluded_regions = b:delimitMate_excluded_regions + endif + + let s:delimitMate_extra_excluded_regions = ',rustLifetimeCandidate,rustGenericLifetimeCandidate' + + " For this buffer, when delimitMate issues the `User delimitMate_map` + " event in the autocommand system, add the above-defined extra excluded + " regions to delimitMate's state, if they have not already been added. + autocmd User + \ if expand('') ==# 'delimitMate_map' && match( + \ delimitMate#Get("excluded_regions"), + \ s:delimitMate_extra_excluded_regions) == -1 + \| let b:delimitMate_excluded_regions = + \ delimitMate#Get("excluded_regions") + \ . s:delimitMate_extra_excluded_regions + \|endif + + " For this buffer, when delimitMate issues the `User delimitMate_unmap` + " event in the autocommand system, delete the above-defined extra excluded + " regions from delimitMate's state (the deletion being idempotent and + " having no effect if the extra excluded regions are not present in the + " targeted part of delimitMate's state). + autocmd User + \ if expand('') ==# 'delimitMate_unmap' + \| let b:delimitMate_excluded_regions = substitute( + \ delimitMate#Get("excluded_regions"), + \ '\C\V' . s:delimitMate_extra_excluded_regions, + \ '', 'g') + \|endif +endif + +if has("folding") && exists('g:rust_fold') && g:rust_fold != 0 + let b:rust_set_foldmethod=1 + setlocal foldmethod=syntax + if g:rust_fold == 2 + setlocal foldlevel< + else + setlocal foldlevel=99 + endif +endif + +if has('conceal') && exists('g:rust_conceal') && g:rust_conceal != 0 + let b:rust_set_conceallevel=1 + setlocal conceallevel=2 +endif + +" Motion Commands {{{1 + +" Bind motion commands to support hanging indents +nnoremap [[ :call rust#Jump('n', 'Back') +nnoremap ]] :call rust#Jump('n', 'Forward') +xnoremap [[ :call rust#Jump('v', 'Back') +xnoremap ]] :call rust#Jump('v', 'Forward') +onoremap [[ :call rust#Jump('o', 'Back') +onoremap ]] :call rust#Jump('o', 'Forward') + +" Commands {{{1 + +" See |:RustRun| for docs +command! -nargs=* -complete=file -bang -buffer RustRun call rust#Run(0, ) + +" See |:RustExpand| for docs +command! -nargs=* -complete=customlist,rust#CompleteExpand -bang -buffer RustExpand call rust#Expand(0, ) + +" See |:RustEmitIr| for docs +command! -nargs=* -buffer RustEmitIr call rust#Emit("llvm-ir", ) + +" See |:RustEmitAsm| for docs +command! -nargs=* -buffer RustEmitAsm call rust#Emit("asm", ) + +" See |:RustPlay| for docs +command! -range=% RustPlay :call rust#Play(, , , ) + +" See |:RustFmt| for docs +command! -buffer RustFmt call rustfmt#Format() + +" See |:RustFmtRange| for docs +command! -range -buffer RustFmtRange call rustfmt#FormatRange(, ) + +" Mappings {{{1 + +" Bind ⌘R in MacVim to :RustRun +nnoremap :RustRun +" Bind ⌘⇧R in MacVim to :RustRun! pre-filled with the last args +nnoremap :RustRun! =join(b:rust_last_rustc_args)erust#AppendCmdLine(' -- ' . join(b:rust_last_args)) + +if !exists("b:rust_last_rustc_args") || !exists("b:rust_last_args") + let b:rust_last_rustc_args = [] + let b:rust_last_args = [] +endif + +" Cleanup {{{1 + +let b:undo_ftplugin = " + \ setlocal formatoptions< comments< commentstring< includeexpr< suffixesadd< + \|setlocal tabstop< shiftwidth< softtabstop< expandtab< textwidth< + \|if exists('b:rust_original_delimitMate_excluded_regions') + \|let b:delimitMate_excluded_regions = b:rust_original_delimitMate_excluded_regions + \|unlet b:rust_original_delimitMate_excluded_regions + \|else + \|unlet! b:delimitMate_excluded_regions + \|endif + \|if exists('b:rust_set_foldmethod') + \|setlocal foldmethod< foldlevel< + \|unlet b:rust_set_foldmethod + \|endif + \|if exists('b:rust_set_conceallevel') + \|setlocal conceallevel< + \|unlet b:rust_set_conceallevel + \|endif + \|unlet! b:rust_last_rustc_args b:rust_last_args + \|delcommand RustRun + \|delcommand RustExpand + \|delcommand RustEmitIr + \|delcommand RustEmitAsm + \|delcommand RustPlay + \|nunmap + \|nunmap + \|nunmap [[ + \|nunmap ]] + \|xunmap [[ + \|xunmap ]] + \|ounmap [[ + \|ounmap ]] + \|set matchpairs-=<:> + \" + +" }}}1 + +" Code formatting on save +if get(g:, "rustfmt_autosave", 0) + autocmd BufWritePre *.rs silent! call rustfmt#Format() +endif + +augroup END + +let &cpo = s:save_cpo +unlet s:save_cpo + +" vim: set noet sw=8 ts=8: diff --git a/runtime/ftplugin/sbt.vim b/runtime/ftplugin/sbt.vim new file mode 100644 index 0000000000..309d30e503 --- /dev/null +++ b/runtime/ftplugin/sbt.vim @@ -0,0 +1,15 @@ +" Vim filetype plugin file +" Language: sbt +" Maintainer: Steven Dobay +" License: Same as Vim +" Last Change: 2017.04.30 +" ---------------------------------------------------------------------------- + +if exists('b:did_ftplugin') || &cp + finish +endif + +let b:did_ftplugin = 1 + +runtime! ftplugin/scala.vim + diff --git a/runtime/ftplugin/verilog.vim b/runtime/ftplugin/verilog.vim index 6594f2ea90..cbf30a3185 100644 --- a/runtime/ftplugin/verilog.vim +++ b/runtime/ftplugin/verilog.vim @@ -1,8 +1,12 @@ " Vim filetype plugin file " Language: Verilog HDL -" Maintainer: Chih-Tsun Huang -" Last Change: Wed Sep 3 15:24:49 CST 2008 -" URL: http://larc.ee.nthu.edu.tw/~cthuang/vim/ftplugin/verilog.vim +" Maintainer: Chih-Tsun Huang +" Last Change: 2017 Aug 25 by Chih-Tsun Huang +" URL: http://www.cs.nthu.edu.tw/~cthuang/vim/ftplugin/verilog.vim +" +" Credits: +" Suggestions for improvement, bug reports by +" Shao " Only do this when not done yet for this buffer if exists("b:did_ftplugin") @@ -45,11 +49,16 @@ if exists("loaded_matchit") \ '\:\,' . \ '\\|\\|\:\,' . \ '\:\,' . - \ '\:\,' . + \ '\:`\@,' . \ '\:\,' . - \ '`ifdef\>:`else\>:`endif\>,' . + \ '`ifn\?def\>:`elsif\>:`else\>:`endif\>,' . \ '\:\,' . - \ '\:\' + \ '\:\,' . + \ '\:\,' . + \ '\:\,' . + \ '\:\,' . + \ '\:\,' . + \ '\:\' endif " Reset 'cpoptions' back to the user's setting diff --git a/runtime/ftplugin/zsh.vim b/runtime/ftplugin/zsh.vim index 6cbc380dc3..c03a9466a1 100644 --- a/runtime/ftplugin/zsh.vim +++ b/runtime/ftplugin/zsh.vim @@ -1,10 +1,10 @@ " Vim filetype plugin file -" Language: Zsh shell script -" Maintainer: Christian Brabandt -" Previous Maintainer: Nikolai Weibull -" Latest Revision: 2015-05-29 -" License: Vim (see :h license) -" Repository: https://github.com/chrisbra/vim-zsh +" Language: Zsh shell script +" Maintainer: Christian Brabandt +" Previous Maintainer: Nikolai Weibull +" Latest Revision: 2015-05-29 +" License: Vim (see :h license) +" Repository: https://github.com/chrisbra/vim-zsh if exists("b:did_ftplugin") finish diff --git a/runtime/indent/ada.vim b/runtime/indent/ada.vim index 575f326454..1ca7fbacbe 100644 --- a/runtime/indent/ada.vim +++ b/runtime/indent/ada.vim @@ -87,7 +87,7 @@ function s:MainBlockIndent (prev_indent, prev_lnum, blockstart, stop_at) endwhile endwhile " Fallback - just move back one - return a:prev_indent - &sw + return a:prev_indent - shiftwidth() endfunction MainBlockIndent " Section: s:EndBlockIndent {{{1 @@ -131,7 +131,7 @@ function s:EndBlockIndent( prev_indent, prev_lnum, blockstart, blockend ) endwhile endwhile " Fallback - just move back one - return a:prev_indent - &sw + return a:prev_indent - shiftwidth() endfunction EndBlockIndent " Section: s:StatementIndent {{{1 @@ -213,15 +213,15 @@ function GetAdaIndent() endif " Move indent in if ! false_match - let ind = ind + &sw + let ind = ind + shiftwidth() endif elseif line =~ '^\s*\(case\|exception\)\>' " Move indent in twice (next 'when' will move back) - let ind = ind + 2 * &sw + let ind = ind + 2 * shiftwidth() elseif line =~ '^\s*end\s*record\>' - " Move indent back to tallying 'type' preceding the 'record'. + " Move indent back to tallying 'type' preceeding the 'record'. " Allow indent to be equal to 'end record's. - let ind = s:MainBlockIndent( ind+&sw, lnum, 'type\>', '' ) + let ind = s:MainBlockIndent( ind+shiftwidth(), lnum, 'type\>', '' ) elseif line =~ '\(^\s*new\>.*\)\@' " Multiple line generic instantiation ('package blah is\nnew thingy') - let ind = s:StatementIndent( ind - &sw, lnum ) + let ind = s:StatementIndent( ind - shiftwidth(), lnum ) elseif line =~ ';\s*$' " Statement end (but not 'end' ) - try to find current statement-start indent let ind = s:StatementIndent( ind, lnum ) @@ -256,17 +256,17 @@ function GetAdaIndent() elseif continuation && line =~ '^\s*(' " Don't do this if we've already indented due to the previous line if ind == initind - let ind = ind + &sw + let ind = ind + shiftwidth() endif elseif line =~ '^\s*\(begin\|is\)\>' let ind = s:MainBlockIndent( ind, lnum, '\(procedure\|function\|declare\|package\|task\)\>', 'begin\>' ) elseif line =~ '^\s*record\>' - let ind = s:MainBlockIndent( ind, lnum, 'type\>\|for\>.*\', '' ) + &sw + let ind = s:MainBlockIndent( ind, lnum, 'type\>\|for\>.*\', '' ) + shiftwidth() elseif line =~ '^\s*\(else\|elsif\)\>' let ind = s:MainBlockIndent( ind, lnum, 'if\>', '' ) elseif line =~ '^\s*when\>' " Align 'when' one /in/ from matching block start - let ind = s:MainBlockIndent( ind, lnum, '\(case\|exception\)\>', '' ) + &sw + let ind = s:MainBlockIndent( ind, lnum, '\(case\|exception\)\>', '' ) + shiftwidth() elseif line =~ '^\s*end\>\s*\' " End of if statements let ind = s:EndBlockIndent( ind, lnum, 'if\>', 'end\>\s*\' ) diff --git a/runtime/indent/awk.vim b/runtime/indent/awk.vim index 6f6b70cc4e..aad73ee71f 100644 --- a/runtime/indent/awk.vim +++ b/runtime/indent/awk.vim @@ -60,7 +60,7 @@ function! GetAwkIndent() " 'pattern { action }' (simple check match on /{/ increases the indent then) if s:Get_brace_balance( prev_data, '{', '}' ) > 0 - return ind + &sw + return ind + shiftwidth() endif let brace_balance = s:Get_brace_balance( prev_data, '(', ')' ) @@ -99,7 +99,7 @@ function! GetAwkIndent() return s:Safe_indent( ind, s:First_word_len(prev_data), getline(v:lnum)) else " if/for/while without '{' - return ind + &sw + return ind + shiftwidth() endif endif endif @@ -140,7 +140,7 @@ function! GetAwkIndent() " Decrease indent if this line contains a '}'. if getline(v:lnum) =~ '^\s*}' - let ind = ind - &sw + let ind = ind - shiftwidth() endif return ind diff --git a/runtime/indent/bst.vim b/runtime/indent/bst.vim index be1f63e8e9..47e3058810 100644 --- a/runtime/indent/bst.vim +++ b/runtime/indent/bst.vim @@ -69,7 +69,7 @@ function! GetBstIndent(lnum) abort endif let fakeline = substitute(line,'^}','','').matchstr(cline,'^}') let ind = indent(lnum) - let ind = ind + &sw * s:count(line,'{') - let ind = ind - &sw * s:count(fakeline,'}') + let ind = ind + shiftwidth() * s:count(line,'{') + let ind = ind - shiftwidth() * s:count(fakeline,'}') return ind endfunction diff --git a/runtime/indent/bzl.vim b/runtime/indent/bzl.vim index 24e5b870cd..6904bfdedb 100644 --- a/runtime/indent/bzl.vim +++ b/runtime/indent/bzl.vim @@ -1,7 +1,7 @@ " Vim indent file " Language: Bazel (http://bazel.io) " Maintainer: David Barnett (https://github.com/google/vim-ft-bzl) -" Last Change: 2015 Aug 11 +" Last Change: 2017 Jun 13 if exists('b:did_indent') finish @@ -41,11 +41,8 @@ function GetBzlIndent(lnum) abort if exists('g:pyindent_open_paren') let l:pyindent_open_paren = g:pyindent_open_paren endif - " Vim 7.3.693 and later defines a shiftwidth() function to get the effective - " shiftwidth value. Fall back to &shiftwidth if the function doesn't exist. - let l:sw_expr = exists('*shiftwidth') ? 'shiftwidth()' : '&shiftwidth' - let g:pyindent_nested_paren = l:sw_expr . ' * 2' - let g:pyindent_open_paren = l:sw_expr . ' * 2' + let g:pyindent_nested_paren = 'shiftwidth() * 2' + let g:pyindent_open_paren = 'shiftwidth() * 2' endif let l:indent = -1 diff --git a/runtime/indent/cdl.vim b/runtime/indent/cdl.vim index 5ec2a7b21a..5fae7b9046 100644 --- a/runtime/indent/cdl.vim +++ b/runtime/indent/cdl.vim @@ -47,7 +47,7 @@ fun! CdlGetIndent(lnum) let thisline = getline(a:lnum) if match(thisline, '^\s*\(\k\+\|\[[^]]*]\)\s*\(,\|;\s*$\)') >= 0 " it's an attributes line - return &sw + return shiftwidth() elseif match(thisline, '^\c\s*\([{}]\|\/[*/]\|dimension\|schedule\|group\|hierarchy\|class\)') >= 0 " it's a header or '{' or '}' or a comment return 0 @@ -71,13 +71,13 @@ fun! CdlGetIndent(lnum) let c = line[inicio-1] " ')' and '=' don't change indent and are useless to set 'f' if c == '{' - return &sw + return shiftwidth() elseif c != ')' && c != '=' let f = 1 " all but 'elseif' are followed by a formula if c ==? 'n' || c ==? 'e' " 'then', 'else' - let ind = ind + &sw + let ind = ind + shiftwidth() elseif strpart(line, inicio-6, 6) ==? 'elseif' " elseif, set f to conditional - let ind = ind + &sw + let ind = ind + shiftwidth() let f = 0 end end @@ -98,16 +98,16 @@ fun! CdlGetIndent(lnum) let ind = 0 let f = 1 elseif c == ')' || c== ';' || strpart(line, inicio-5, 5) ==? 'endif' - let ind = ind - &sw + let ind = ind - shiftwidth() elseif c == '(' || c ==? 'f' " '(' or 'if' - let ind = ind + &sw + let ind = ind + shiftwidth() else " c == '=' " if it is an asignment increase indent if f == -1 " we don't know yet, find out let f = CdlAsignment(lnum, strpart(line, 0, inicio)) end if f == 1 " formula increase it - let ind = ind + &sw + let ind = ind + shiftwidth() end end endw @@ -115,13 +115,13 @@ fun! CdlGetIndent(lnum) " CURRENT LINE, if it starts with a closing element, decrease indent " or if it starts with '=' (asignment), increase indent if match(thisline, '^\c\s*\(else\|then\|endif\|[);]\)') >= 0 - let ind = ind - &sw + let ind = ind - shiftwidth() elseif match(thisline, '^\s*=') >= 0 if f == -1 " we don't know yet if is an asignment, find out let f = CdlAsignment(lnum, "") end if f == 1 " formula increase it - let ind = ind + &sw + let ind = ind + shiftwidth() end end diff --git a/runtime/indent/chaiscript.vim b/runtime/indent/chaiscript.vim index 247e1a6e4c..445281cc46 100644 --- a/runtime/indent/chaiscript.vim +++ b/runtime/indent/chaiscript.vim @@ -31,19 +31,19 @@ function! GetChaiScriptIndent() let flag = 0 let prevline = getline(lnum) if prevline =~ '^.*{.*' - let ind = ind + &shiftwidth + let ind = ind + shiftwidth() let flag = 1 endif " Subtract a 'shiftwidth' after lines containing a { followed by a } " to keep it balanced if flag == 1 && prevline =~ '.*{.*}.*' - let ind = ind - &shiftwidth + let ind = ind - shiftwidth() endif " Subtract a 'shiftwidth' on lines ending with } if getline(v:lnum) =~ '^\s*\%(}\)' - let ind = ind - &shiftwidth + let ind = ind - shiftwidth() endif return ind diff --git a/runtime/indent/clojure.vim b/runtime/indent/clojure.vim index 7592b10d7d..7c4186e29b 100644 --- a/runtime/indent/clojure.vim +++ b/runtime/indent/clojure.vim @@ -261,7 +261,7 @@ if exists("*searchpairpos") call cursor(paren) if s:is_method_special_case(paren) - return [paren[0], paren[1] + &shiftwidth - 1] + return [paren[0], paren[1] + shiftwidth() - 1] endif if s:is_reader_conditional_special_case(paren) @@ -299,19 +299,19 @@ if exists("*searchpairpos") let ww = s:strip_namespace_and_macro_chars(w) if &lispwords =~# '\V\<' . ww . '\>' - return [paren[0], paren[1] + &shiftwidth - 1] + return [paren[0], paren[1] + shiftwidth() - 1] endif if g:clojure_fuzzy_indent \ && !s:match_one(g:clojure_fuzzy_indent_blacklist, ww) \ && s:match_one(g:clojure_fuzzy_indent_patterns, ww) - return [paren[0], paren[1] + &shiftwidth - 1] + return [paren[0], paren[1] + shiftwidth() - 1] endif call search('\v\_s', 'cW') call search('\v\S', 'W') if paren[0] < line(".") - return [paren[0], paren[1] + (g:clojure_align_subforms ? 0 : &shiftwidth - 1)] + return [paren[0], paren[1] + (g:clojure_align_subforms ? 0 : shiftwidth() - 1)] endif call search('\v\S', 'bW') diff --git a/runtime/indent/cmake.vim b/runtime/indent/cmake.vim index 421afcb6d7..845bdd7655 100644 --- a/runtime/indent/cmake.vim +++ b/runtime/indent/cmake.vim @@ -1,14 +1,12 @@ " Vim indent file -" Program: CMake - Cross-Platform Makefile Generator -" Module: $RCSfile: cmake-indent.vim,v $ " Language: CMake (ft=cmake) " Author: Andy Cedilnik -" Maintainer: Karthik Krishnan -" Last Change: $Date: 2008-01-16 16:53:53 $ -" Version: $Revision: 1.9 $ +" Maintainer: Dimitri Merejkowsky +" Former Maintainer: Karthik Krishnan +" Last Change: 2017 Sep 24 " " Licence: The CMake license applies to this file. See -" http://www.cmake.org/HTML/Copyright.html +" https://cmake.org/licensing " This implies that distribution with Vim is allowed if exists("b:did_indent") @@ -68,19 +66,19 @@ fun! CMakeGetIndent(lnum) let ind = ind else if previous_line =~? cmake_indent_begin_regex - let ind = ind + &sw + let ind = ind + shiftwidth() endif if previous_line =~? cmake_indent_open_regex - let ind = ind + &sw + let ind = ind + shiftwidth() endif endif " Subtract if this_line =~? cmake_indent_end_regex - let ind = ind - &sw + let ind = ind - shiftwidth() endif if previous_line =~? cmake_indent_close_regex - let ind = ind - &sw + let ind = ind - shiftwidth() endif return ind diff --git a/runtime/indent/cobol.vim b/runtime/indent/cobol.vim index 8dce3cd014..c08444ac40 100644 --- a/runtime/indent/cobol.vim +++ b/runtime/indent/cobol.vim @@ -52,11 +52,11 @@ function! s:optionalblock(lnum,ind,blocks,clauses) if getline(lastclause) =~? clauses && s:stripped(lastclause) !~? '^'.begin let ind = indent(lastclause) elseif lastclause > 0 - let ind = indent(lastclause) + &sw - "let ind = ind + &sw + let ind = indent(lastclause) + shiftwidth() + "let ind = ind + shiftwidth() endif elseif line =~? clauses && cline !~? end - let ind = ind + &sw + let ind = ind + shiftwidth() endif return ind endfunction @@ -98,8 +98,8 @@ function! GetCobolIndent(lnum) abort let num = matchstr(line,'^\s*\zs\d\+\>') if 0+cnum == num return lindent - elseif 0+cnum > num && default < lindent + &sw - let default = lindent + &sw + elseif 0+cnum > num && default < lindent + shiftwidth() + let default = lindent + shiftwidth() endif elseif lindent < bshft && lindent >= ashft break @@ -135,13 +135,13 @@ function! GetCobolIndent(lnum) abort if line =~? '^PERFORM\>' let perfline = substitute(line, '\c^PERFORM\s*', "", "") if perfline =~? '^\%(\k\+\s\+TIMES\)\=\s*$' - let ind = ind + &sw + let ind = ind + shiftwidth() elseif perfline =~? '^\%(WITH\s\+TEST\|VARYING\|UNTIL\)\>.*[^.]$' - let ind = ind + &sw + let ind = ind + shiftwidth() endif endif if line =~? '^\%(IF\|THEN\|ELSE\|READ\|EVALUATE\|SEARCH\|SELECT\)\>' - let ind = ind + &sw + let ind = ind + shiftwidth() endif let ind = s:optionalblock(a:lnum,ind,'ADD\|COMPUTE\|DIVIDE\|MULTIPLY\|SUBTRACT','ON\s\+SIZE\s\+ERROR') let ind = s:optionalblock(a:lnum,ind,'STRING\|UNSTRING\|ACCEPT\|DISPLAY\|CALL','ON\s\+OVERFLOW\|ON\s\+EXCEPTION') @@ -157,10 +157,10 @@ function! GetCobolIndent(lnum) abort "&& s:stripped(lastclause) !~? '^\%(SEARCH\|EVALUATE\|READ\)\>' let ind = indent(lastclause) elseif lastclause > 0 - let ind = indent(lastclause) + &sw + let ind = indent(lastclause) + shiftwidth() endif elseif line =~? '^WHEN\>' - let ind = ind + &sw + let ind = ind + shiftwidth() endif "I'm not sure why I had this "if line =~? '^ELSE\>-\@!' && line !~? '\.$' @@ -168,7 +168,7 @@ function! GetCobolIndent(lnum) abort "endif if cline =~? '^\(END\)\>-\@!' " On lines with just END, 'guess' a simple shift left - let ind = ind - &sw + let ind = ind - shiftwidth() elseif cline =~? '^\(END-IF\|THEN\|ELSE\)\>-\@!' call cursor(a:lnum,indent(a:lnum)) let match = searchpair('\c-\@','\c-\@','\c-\@\zs','bnW',s:skip) @@ -209,7 +209,7 @@ function! GetCobolIndent(lnum) abort if match > 0 let ind = indent(match) elseif cline =~? '^\(END-\(READ\|EVALUATE\|SEARCH\|PERFORM\)\)\>' - let ind = ind - &sw + let ind = ind - shiftwidth() endif endif return ind < bshft ? bshft : ind diff --git a/runtime/indent/cucumber.vim b/runtime/indent/cucumber.vim index 999b8d6a76..ad28a67a0d 100644 --- a/runtime/indent/cucumber.vim +++ b/runtime/indent/cucumber.vim @@ -1,7 +1,7 @@ " Vim indent file " Language: Cucumber " Maintainer: Tim Pope -" Last Change: 2016 Aug 29 +" Last Change: 2017 Jun 13 if exists("b:did_indent") finish @@ -27,7 +27,7 @@ function! GetCucumberIndent() let line = getline(prevnonblank(v:lnum-1)) let cline = getline(v:lnum) let nline = getline(nextnonblank(v:lnum+1)) - let sw = exists('*shiftwidth') ? shiftwidth() : &sw + let sw = exists('*shiftwidth') ? shiftwidth() : shiftwidth() let syn = s:syn(prevnonblank(v:lnum-1)) let csyn = s:syn(v:lnum) let nsyn = s:syn(nextnonblank(v:lnum+1)) diff --git a/runtime/indent/dylan.vim b/runtime/indent/dylan.vim index 0afcbeada7..6811ec4af5 100644 --- a/runtime/indent/dylan.vim +++ b/runtime/indent/dylan.vim @@ -1,7 +1,7 @@ " Vim indent file " Language: Dylan " Version: 0.01 -" Last Change: 2003 Feb 04 +" Last Change: 2017 Jun 13 " Maintainer: Brent A. Fulgham " Only load this indent file when no other was loaded. @@ -45,13 +45,13 @@ function DylanGetIndent() " If previous line was a 'define', indent if prevline =~? '\(^\s*\(begin\|block\|case\|define\|else\|elseif\|for\|finally\|if\|select\|unless\|while\)\|\s*\S*\s*=>$\)' - let chg = &sw + let chg = shiftwidth() " local methods indent the shift-width, plus 6 for the 'local' elseif prevline =~? '^\s*local' - let chg = &sw + 6 + let chg = shiftwidth() + 6 " If previous line was a let with no closing semicolon, indent elseif prevline =~? '^\s*let.*[^;]\s*$' - let chg = &sw + let chg = shiftwidth() " If previous line opened a parenthesis, and did not close it, indent elseif prevline =~ '^.*(\s*[^)]*\((.*)\)*[^)]*$' return = match( prevline, '(.*\((.*)\|[^)]\)*.*$') + 1 @@ -75,13 +75,13 @@ function DylanGetIndent() " line doesn't start with an indentable command: let curr_str = getline(curr_line) if curr_str =~? '^\s*\(begin\|block\|case\|define\|else\|elseif\|for\|finally\|if\|select\|unless\|while\)' - let chg = &sw + let chg = shiftwidth() endif endif " If a line starts with end, un-indent (even if we just indented!) if cline =~? '^\s*\(cleanup\|end\|else\|elseif\|exception\|finally\|otherwise\)' - let chg = chg - &sw + let chg = chg - shiftwidth() endif return ind + chg diff --git a/runtime/indent/erlang.vim b/runtime/indent/erlang.vim index 7569fe9106..9228f18683 100644 --- a/runtime/indent/erlang.vim +++ b/runtime/indent/erlang.vim @@ -669,7 +669,7 @@ function! s:BeginningOfClauseFound(stack, token, stored_vcol) call s:Pop(a:stack) if empty(a:stack) call s:Log(' Stack is ["when"], so LTI is in a guard -> return') - return [1, a:stored_vcol + &sw + 2] + return [1, a:stored_vcol + shiftwidth() + 2] else return [1, s:UnexpectedToken(a:token, a:stack)] endif @@ -678,7 +678,7 @@ function! s:BeginningOfClauseFound(stack, token, stored_vcol) call s:Pop(a:stack) if empty(a:stack) call s:Log(' Stack is ["->"], so LTI is in function body -> return') - return [1, a:stored_vcol + &sw] + return [1, a:stored_vcol + shiftwidth()] elseif a:stack[0] ==# ';' call s:Pop(a:stack) if empty(a:stack) @@ -797,7 +797,7 @@ function! s:ErlangCalcIndent2(lnum, stack) elseif token ==# 'begin' let [ret, res] = s:BeginElementFound(stack, token, curr_vcol, - \stored_vcol, 'end', &sw) + \stored_vcol, 'end', shiftwidth()) if ret | return res | endif " case EXPR of BRANCHES end @@ -848,11 +848,11 @@ function! s:ErlangCalcIndent2(lnum, stack) elseif stack == ['->'] call s:Log(' LTI is in a branch after ' . \'"of/receive/after/if/catch" -> return') - return stored_vcol + &sw + return stored_vcol + shiftwidth() elseif stack == ['when'] call s:Log(' LTI is in a guard after ' . \'"of/receive/after/if/catch" -> return') - return stored_vcol + &sw + return stored_vcol + shiftwidth() else return s:UnexpectedToken(token, stack) endif @@ -888,7 +888,7 @@ function! s:ErlangCalcIndent2(lnum, stack) if empty(stack) call s:Log(' LTI is in a condition; matching ' . \'"case/if/try/receive" found') - let stored_vcol = curr_vcol + &sw + let stored_vcol = curr_vcol + shiftwidth() elseif stack[0] ==# 'align_to_begin_element' call s:Pop(stack) let stored_vcol = curr_vcol @@ -897,23 +897,23 @@ function! s:ErlangCalcIndent2(lnum, stack) \'"case/if/try/receive" found') call s:Pop(stack) call s:Pop(stack) - let stored_vcol = curr_vcol + &sw + let stored_vcol = curr_vcol + shiftwidth() elseif stack[0] ==# '->' call s:Log(' LTI is in a branch; matching ' . \'"case/if/try/receive" found') call s:Pop(stack) - let stored_vcol = curr_vcol + 2 * &sw + let stored_vcol = curr_vcol + 2 * shiftwidth() elseif stack[0] ==# 'when' call s:Log(' LTI is in a guard; matching ' . \'"case/if/try/receive" found') call s:Pop(stack) - let stored_vcol = curr_vcol + 2 * &sw + 2 + let stored_vcol = curr_vcol + 2 * shiftwidth() + 2 endif endif let [ret, res] = s:BeginElementFound(stack, token, curr_vcol, - \stored_vcol, 'end', &sw) + \stored_vcol, 'end', shiftwidth()) if ret | return res | endif elseif token ==# 'fun' @@ -930,7 +930,7 @@ function! s:ErlangCalcIndent2(lnum, stack) " stack = ['when'] => LTI is in a guard if empty(stack) call s:Log(' LTI is in a condition; matching "fun" found') - let stored_vcol = curr_vcol + &sw + let stored_vcol = curr_vcol + shiftwidth() elseif len(stack) > 1 && stack[0] ==# '->' && stack[1] ==# ';' call s:Log(' LTI is in a condition; matching "fun" found') call s:Pop(stack) @@ -938,15 +938,15 @@ function! s:ErlangCalcIndent2(lnum, stack) elseif stack[0] ==# '->' call s:Log(' LTI is in a branch; matching "fun" found') call s:Pop(stack) - let stored_vcol = curr_vcol + 2 * &sw + let stored_vcol = curr_vcol + 2 * shiftwidth() elseif stack[0] ==# 'when' call s:Log(' LTI is in a guard; matching "fun" found') call s:Pop(stack) - let stored_vcol = curr_vcol + 2 * &sw + 2 + let stored_vcol = curr_vcol + 2 * shiftwidth() + 2 endif let [ret, res] = s:BeginElementFound(stack, token, curr_vcol, - \stored_vcol, 'end', &sw) + \stored_vcol, 'end', shiftwidth()) if ret | return res | endif else " Pass: we have a function reference (e.g. "fun f/0") @@ -1220,7 +1220,7 @@ function! s:ErlangCalcIndent2(lnum, stack) " when A, " LTI let [ret, res] = s:BeginElementFoundIfEmpty(stack, token, curr_vcol, - \stored_vcol, &sw) + \stored_vcol, shiftwidth()) if ret | return res | endif else " Example: @@ -1252,7 +1252,7 @@ function! s:ErlangCalcIndent2(lnum, stack) " If LTI is between an 'after' and the corresponding " 'end', then let's return let [ret, res] = s:BeginElementFoundIfEmpty(stack, token, curr_vcol, - \stored_vcol, &sw) + \stored_vcol, shiftwidth()) if ret | return res | endif endif diff --git a/runtime/indent/eruby.vim b/runtime/indent/eruby.vim index afabd4fe5b..5058325495 100644 --- a/runtime/indent/eruby.vim +++ b/runtime/indent/eruby.vim @@ -47,11 +47,7 @@ set cpo&vim function! GetErubyIndent(...) " The value of a single shift-width - if exists('*shiftwidth') - let sw = shiftwidth() - else - let sw = &sw - endif + let sw = shiftwidth() if a:0 && a:1 == '.' let v:lnum = line('.') diff --git a/runtime/indent/falcon.vim b/runtime/indent/falcon.vim index 84b16d55f0..b34e7cfd47 100644 --- a/runtime/indent/falcon.vim +++ b/runtime/indent/falcon.vim @@ -339,7 +339,7 @@ function FalconGetIndent(...) " If the previous line ended with a block opening, add a level of indent. if s:Match(lnum, s:block_regex) - return indent(s:GetMSL(lnum)) + &sw + return indent(s:GetMSL(lnum)) + shiftwidth() endif " If it contained hanging closing brackets, find the rightmost one, find its @@ -350,20 +350,20 @@ function FalconGetIndent(...) if opening.pos != -1 if opening.type == '(' && searchpair('(', '', ')', 'bW', s:skip_expr) > 0 if col('.') + 1 == col('$') - return ind + &sw + return ind + shiftwidth() else return virtcol('.') endif else let nonspace = matchend(line, '\S', opening.pos + 1) - 1 - return nonspace > 0 ? nonspace : ind + &sw + return nonspace > 0 ? nonspace : ind + shiftwidth() endif elseif closing.pos != -1 call cursor(lnum, closing.pos + 1) normal! % if s:Match(line('.'), s:falcon_indent_keywords) - return indent('.') + &sw + return indent('.') + shiftwidth() else return indent('.') endif @@ -392,7 +392,7 @@ function FalconGetIndent(...) let col = s:Match(lnum, s:falcon_indent_keywords) if col > 0 call cursor(lnum, col) - let ind = virtcol('.') - 1 + &sw + let ind = virtcol('.') - 1 + shiftwidth() " TODO: make this better (we need to count them) (or, if a searchpair " fails, we know that something is lacking an end and thus we indent a " level @@ -422,9 +422,9 @@ function FalconGetIndent(...) " TODO: this does not take into account contrived things such as " module Foo; class Bar; end if s:Match(lnum, s:falcon_indent_keywords) - let ind = msl_ind + &sw + let ind = msl_ind + shiftwidth() if s:Match(lnum, s:end_end_regex) - let ind = ind - &sw + let ind = ind - shiftwidth() endif return ind endif @@ -433,7 +433,7 @@ function FalconGetIndent(...) " closing bracket, indent one extra level. if s:Match(lnum, s:non_bracket_continuation_regex) && !s:Match(lnum, '^\s*\([\])}]\|end\)') if lnum == p_lnum - let ind = msl_ind + &sw + let ind = msl_ind + shiftwidth() else let ind = msl_ind endif diff --git a/runtime/indent/gitconfig.vim b/runtime/indent/gitconfig.vim index 480c96d1b9..6a670ee271 100644 --- a/runtime/indent/gitconfig.vim +++ b/runtime/indent/gitconfig.vim @@ -1,7 +1,7 @@ " Vim indent file " Language: git config file " Maintainer: Tim Pope -" Last Change: 2016 Aug 29 +" Last Change: 2017 Jun 13 if exists("b:did_indent") finish @@ -20,7 +20,7 @@ if exists("*GetGitconfigIndent") endif function! GetGitconfigIndent() - let sw = exists('*shiftwidth') ? shiftwidth() : &sw + let sw = shiftwidth() let line = getline(prevnonblank(v:lnum-1)) let cline = getline(v:lnum) if line =~ '\\\@ -" Last Change: 2011-12-24 +" URL: https://github.com/sitaramc/gitolite/blob/master/contrib/vim/indent/gitolite.vim +" (https://raw.githubusercontent.com/sitaramc/gitolite/master/contrib/vim/indent/gitolite.vim) +" Maintainer: Sitaram Chamarty +" (former Maintainer: Teemu Matilainen ) +" Last Change: 2017 Oct 05 if exists("b:did_indent") finish @@ -27,11 +29,13 @@ function! GetGitoliteIndent() let cline = getline(v:lnum) if cline =~ '^\s*\(C\|R\|RW\|RW+\|RWC\|RW+C\|RWD\|RW+D\|RWCD\|RW+CD\|-\)[ \t=]' - return &sw + return shiftwidth() elseif cline =~ '^\s*config\s' - return &sw + return shiftwidth() + elseif cline =~ '^\s*option\s' + return shiftwidth() elseif pline =~ '^\s*repo\s' && cline =~ '^\s*\(#.*\)\?$' - return &sw + return shiftwidth() elseif cline =~ '^\s*#' return indent(prevln) elseif cline =~ '^\s*$' diff --git a/runtime/indent/go.vim b/runtime/indent/go.vim index 412ac871c4..bf9ff75e6c 100644 --- a/runtime/indent/go.vim +++ b/runtime/indent/go.vim @@ -1,7 +1,7 @@ " Vim indent file " Language: Go " Maintainer: David Barnett (https://github.com/google/vim-ft-go) -" Last Change: 2014 Aug 16 +" Last Change: 2017 Jun 13 " " TODO: " - function invocations split across lines @@ -23,18 +23,6 @@ if exists('*GoIndent') finish endif -" The shiftwidth() function is relatively new. -" Don't require it to exist. -if exists('*shiftwidth') - function s:sw() abort - return shiftwidth() - endfunction -else - function s:sw() abort - return &shiftwidth - endfunction -endif - function! GoIndent(lnum) let l:prevlnum = prevnonblank(a:lnum-1) if l:prevlnum == 0 @@ -51,17 +39,17 @@ function! GoIndent(lnum) if l:prevl =~ '[({]\s*$' " previous line opened a block - let l:ind += s:sw() + let l:ind += shiftwidth() endif if l:prevl =~# '^\s*\(case .*\|default\):$' " previous line is part of a switch statement - let l:ind += s:sw() + let l:ind += shiftwidth() endif " TODO: handle if the previous line is a label. if l:thisl =~ '^\s*[)}]' " this line closed a block - let l:ind -= s:sw() + let l:ind -= shiftwidth() endif " Colons are tricky. @@ -69,7 +57,7 @@ function! GoIndent(lnum) " We ignore trying to deal with jump labels because (a) they're rare, and " (b) they're hard to disambiguate from a composite literal key. if l:thisl =~# '^\s*\(case .*\|default\):$' - let l:ind -= s:sw() + let l:ind -= shiftwidth() endif return l:ind diff --git a/runtime/indent/haml.vim b/runtime/indent/haml.vim index c3935af9e9..e6416e6f53 100644 --- a/runtime/indent/haml.vim +++ b/runtime/indent/haml.vim @@ -1,7 +1,7 @@ " Vim indent file " Language: Haml " Maintainer: Tim Pope -" Last Change: 2016 Aug 29 +" Last Change: 2017 Jun 13 if exists("b:did_indent") finish @@ -37,7 +37,7 @@ function! GetHamlIndent() let line = substitute(line,'^\s\+','','') let indent = indent(lnum) let cindent = indent(v:lnum) - let sw = exists('*shiftwidth') ? shiftwidth() : &sw + let sw = shiftwidth() if cline =~# '\v^-\s*%(elsif|else|when)>' let indent = cindent < indent ? cindent : indent - sw endif diff --git a/runtime/indent/hamster.vim b/runtime/indent/hamster.vim index 93e7db486e..b27a173924 100644 --- a/runtime/indent/hamster.vim +++ b/runtime/indent/hamster.vim @@ -27,13 +27,13 @@ function HamGetIndent(lnum) " Add a shiftwidth to statements following if, else, elseif, " case, select, default, do, until, while, for, start if prevline =~? '^\s*\<\(if\|else\%(if\)\?\|for\|repeat\|do\|while\|sub\)\>' - let ind = ind + &sw + let ind = ind + shiftwidth() endif " Subtract a shiftwidth from else, elseif, end(if|while|for), until let line = getline(v:lnum) if line =~? '^\s*\(else\|elseif\|loop\|until\|end\%(if\|while\|for\|sub\)\)\>' - let ind = ind - &sw + let ind = ind - shiftwidth() endif return ind diff --git a/runtime/indent/hog.vim b/runtime/indent/hog.vim index 02ac7d4d1b..ece587d46f 100644 --- a/runtime/indent/hog.vim +++ b/runtime/indent/hog.vim @@ -47,7 +47,7 @@ function GetHogIndent() " Continuation of a line that wasn't indented let prevline = getline(prevlnum) if prevline =~ '^\k\+.*\\\s*$' - return &sw + return shiftwidth() endif " Continuation of a line that was indented @@ -58,13 +58,13 @@ function GetHogIndent() " Indent the next line if previous line contained a start of a block " definition ('{' or '('). if prevline =~ '^\k\+[^#]*{}\@!\s*$' " TODO || prevline =~ '^\k\+[^#]*()\@!\s*$' - return &sw + return shiftwidth() endif " Match inside of a block if s:IsInBlock(v:lnum) if prevline =~ "^\k\+.*$" - return &sw + return shiftwidth() else return indent(prevlnum) endif diff --git a/runtime/indent/html.vim b/runtime/indent/html.vim index 57ba53ecd4..37697841fd 100644 --- a/runtime/indent/html.vim +++ b/runtime/indent/html.vim @@ -2,7 +2,7 @@ " Header: "{{{ " Maintainer: Bram Moolenaar " Original Author: Andy Wokula -" Last Change: 2017 Jan 17 +" Last Change: 2017 Jun 13 " Version: 1.0 " Description: HTML indent script with cached state for faster indenting on a " range of lines. @@ -51,15 +51,6 @@ if exists("*HtmlIndent") && !exists('g:force_reload_html') finish endif -" shiftwidth() exists since patch 7.3.694 -if exists('*shiftwidth') - let s:ShiftWidth = function('shiftwidth') -else - func! s:ShiftWidth() - return &shiftwidth - endfunc -endif - " Allow for line continuation below. let s:cpo_save = &cpo set cpo-=C @@ -123,7 +114,7 @@ func! HtmlIndent_CheckUserSettings() let indone = {"zero": 0 \,"auto": "indent(prevnonblank(v:lnum-1))" - \,"inc": "b:hi_indent.blocktagind + s:ShiftWidth()"} + \,"inc": "b:hi_indent.blocktagind + shiftwidth()"} let script1 = '' if exists("b:html_indent_script1") @@ -358,7 +349,7 @@ func! s:CheckBlockTag(blocktag, ind) endif let b:hi_newstate.blocklnr = v:lnum " save allover indent for the endtag - let b:hi_newstate.blocktagind = b:hi_indent.baseindent + (s:nextrel + s:curind) * s:ShiftWidth() + let b:hi_newstate.blocktagind = b:hi_indent.baseindent + (s:nextrel + s:curind) * shiftwidth() if a:ind == 3 return "SCRIPT" " all except this must be lowercase " line is to be checked again for the type attribute @@ -480,7 +471,7 @@ func! s:FreshState(lnum) let state.blocklnr = stopline " check preceding tags in the line: call s:CountITags(tagline[: stopcol-2]) - let state.blocktagind = indent(stopline) + (s:curind + s:nextrel) * s:ShiftWidth() + let state.blocktagind = indent(stopline) + (s:curind + s:nextrel) * shiftwidth() return state elseif stopline == state.lnum " handle special case: previous line (= state.lnum) contains a @@ -490,7 +481,7 @@ func! s:FreshState(lnum) if !swendtag let [bline, bcol] = searchpos('<'.blocktag[1:].'\>', "bnW") call s:CountITags(tolower(getline(bline)[: bcol-2])) - let state.baseindent = indent(bline) + (s:curind + s:nextrel) * s:ShiftWidth() + let state.baseindent = indent(bline) + (s:curind + s:nextrel) * shiftwidth() return state endif endif @@ -511,7 +502,7 @@ func! s:FreshState(lnum) if found == 2 let state.baseindent = b:hi_indent.baseindent endif - let state.blocktagind = indent(comlnum) + (s:curind + s:nextrel) * s:ShiftWidth() + let state.blocktagind = indent(comlnum) + (s:curind + s:nextrel) * shiftwidth() return state endif @@ -530,7 +521,7 @@ func! s:FreshState(lnum) let text = tolower(getline(comlnum)[: comcol-2]) endif call s:CountITags(text) - let state.baseindent = indent(comlnum) + (s:curind + s:nextrel) * s:ShiftWidth() + let state.baseindent = indent(comlnum) + (s:curind + s:nextrel) * shiftwidth() " TODO check tags that follow "-->" return state endif @@ -550,9 +541,9 @@ func! s:FreshState(lnum) let text = getline(start_lnum) let swendtag = match(text, '^\s*= 0 call s:CountITags(text[: col('.') - 2]) - let state.baseindent += s:nextrel * s:ShiftWidth() + let state.baseindent += s:nextrel * shiftwidth() if !swendtag - let state.baseindent += s:curind * s:ShiftWidth() + let state.baseindent += s:curind * shiftwidth() endif endif return state @@ -565,9 +556,9 @@ func! s:FreshState(lnum) let text = getline(state.lnum) let swendtag = match(text, '^\s*= 0 call s:CountITags(tolower(text)) - let state.baseindent = indent(state.lnum) + s:nextrel * s:ShiftWidth() + let state.baseindent = indent(state.lnum) + s:nextrel * shiftwidth() if !swendtag - let state.baseindent += s:curind * s:ShiftWidth() + let state.baseindent += s:curind * shiftwidth() endif return state endfunc "}}} @@ -646,7 +637,7 @@ func! s:CSSIndent() " add indent after { let brace_counts = HtmlIndent_CountBraces(prev_lnum) - let extra = brace_counts.c_open * s:ShiftWidth() + let extra = brace_counts.c_open * shiftwidth() let prev_text = getline(prev_lnum) let below_end_brace = prev_text =~ '}\s*$' @@ -663,7 +654,7 @@ func! s:CSSIndent() " if the current line is not a comment or starts with @ (used by template " systems) reduce indent if previous line is a continuation line if !prev_hasfield && !prev_special - let extra = -s:ShiftWidth() + let extra = -shiftwidth() endif else let cur_hasfield = curtext =~ '^\s*[a-zA-Z0-9-]\+:' @@ -671,14 +662,14 @@ func! s:CSSIndent() if !cur_hasfield && (prev_hasfield || prev_unfinished) " Continuation line has extra indent if the previous line was not a " continuation line. - let extra = s:ShiftWidth() + let extra = shiftwidth() " Align with @if if prev_text =~ '^\s*@if ' let extra = 4 endif elseif cur_hasfield && !prev_hasfield && !prev_special " less indent below a continuation line - let extra = -s:ShiftWidth() + let extra = -shiftwidth() endif endif endif @@ -699,10 +690,10 @@ func! s:CSSIndent() if special " do not reduce indent below @{ ... } if extra < 0 - let extra += s:ShiftWidth() + let extra += shiftwidth() endif else - let extra -= (brace_counts.c_close - (prev_text =~ '^\s*}')) * s:ShiftWidth() + let extra -= (brace_counts.c_close - (prev_text =~ '^\s*}')) * shiftwidth() endif endif @@ -710,10 +701,10 @@ func! s:CSSIndent() if extra == 0 if brace_counts.p_open > brace_counts.p_close " previous line has more ( than ): add a shiftwidth - let extra = s:ShiftWidth() + let extra = shiftwidth() elseif brace_counts.p_open < brace_counts.p_close " previous line has more ) than (: subtract a shiftwidth - let extra = -s:ShiftWidth() + let extra = -shiftwidth() endif endif @@ -816,7 +807,7 @@ func! s:Alien5() let idx = match(prevtext, '^\s*\zs