mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
Merge branch 'master' into expression-parser
This commit is contained in:
commit
03a129aacf
1
.gitignore
vendored
1
.gitignore
vendored
@ -5,7 +5,6 @@
|
|||||||
/.deps/
|
/.deps/
|
||||||
/tmp/
|
/tmp/
|
||||||
|
|
||||||
*.orig
|
|
||||||
*.mo
|
*.mo
|
||||||
.*.sw?
|
.*.sw?
|
||||||
*~
|
*~
|
||||||
|
@ -64,13 +64,13 @@ set_property(CACHE CMAKE_BUILD_TYPE PROPERTY
|
|||||||
# version string, else they are combined with the result of `git describe`.
|
# version string, else they are combined with the result of `git describe`.
|
||||||
set(NVIM_VERSION_MAJOR 0)
|
set(NVIM_VERSION_MAJOR 0)
|
||||||
set(NVIM_VERSION_MINOR 2)
|
set(NVIM_VERSION_MINOR 2)
|
||||||
set(NVIM_VERSION_PATCH 1)
|
set(NVIM_VERSION_PATCH 3)
|
||||||
set(NVIM_VERSION_PRERELEASE "-dev") # for package maintainers
|
set(NVIM_VERSION_PRERELEASE "-dev") # for package maintainers
|
||||||
|
|
||||||
# API level
|
# API level
|
||||||
set(NVIM_API_LEVEL 3) # Bump this after any API change.
|
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_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)
|
file(TO_CMAKE_PATH ${CMAKE_CURRENT_LIST_DIR}/.git FORCED_GIT_DIR)
|
||||||
include(GetGitRevisionDescription)
|
include(GetGitRevisionDescription)
|
||||||
|
@ -137,6 +137,7 @@ endforeach()
|
|||||||
|
|
||||||
file(GLOB_RECURSE RUNTIME_FILES
|
file(GLOB_RECURSE RUNTIME_FILES
|
||||||
RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
|
RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
|
||||||
|
rgb.txt
|
||||||
*.vim *.dict *.py *.rb *.ps *.tutor)
|
*.vim *.dict *.py *.rb *.ps *.tutor)
|
||||||
|
|
||||||
foreach(F ${RUNTIME_FILES})
|
foreach(F ${RUNTIME_FILES})
|
||||||
|
@ -591,7 +591,7 @@ function ada#Map_Menu (Text, Keys, Command)
|
|||||||
\" :" . a:Command
|
\" :" . a:Command
|
||||||
execute
|
execute
|
||||||
\ "inoremap <buffer>" .
|
\ "inoremap <buffer>" .
|
||||||
\ " <Learder>a" . a:Keys .
|
\ " <Leader>a" . a:Keys .
|
||||||
\" <C-O>:" . a:Command
|
\" <C-O>:" . a:Command
|
||||||
endif
|
endif
|
||||||
return
|
return
|
||||||
|
@ -3,20 +3,20 @@ function! s:enhance_syntax() abort
|
|||||||
|
|
||||||
syntax keyword healthError ERROR[:]
|
syntax keyword healthError ERROR[:]
|
||||||
\ containedin=markdownCodeBlock,mkdListItemLine
|
\ containedin=markdownCodeBlock,mkdListItemLine
|
||||||
highlight link healthError Error
|
highlight default link healthError Error
|
||||||
|
|
||||||
syntax keyword healthWarning WARNING[:]
|
syntax keyword healthWarning WARNING[:]
|
||||||
\ containedin=markdownCodeBlock,mkdListItemLine
|
\ containedin=markdownCodeBlock,mkdListItemLine
|
||||||
highlight link healthWarning WarningMsg
|
highlight default link healthWarning WarningMsg
|
||||||
|
|
||||||
syntax keyword healthSuccess OK[:]
|
syntax keyword healthSuccess OK[:]
|
||||||
\ containedin=markdownCodeBlock,mkdListItemLine
|
\ 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
|
syntax match healthHelp "|.\{-}|" contains=healthBar
|
||||||
\ containedin=markdownCodeBlock,mkdListItemLine
|
\ containedin=markdownCodeBlock,mkdListItemLine
|
||||||
syntax match healthBar "|" contained conceal
|
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.
|
" We do not care about markdown syntax errors in :checkhealth output.
|
||||||
highlight! link markdownError Normal
|
highlight! link markdownError Normal
|
||||||
|
@ -58,7 +58,7 @@ function! s:check_rplugin_manifest() abort
|
|||||||
let contents = join(readfile(script))
|
let contents = join(readfile(script))
|
||||||
if contents =~# '\<\%(from\|import\)\s\+neovim\>'
|
if contents =~# '\<\%(from\|import\)\s\+neovim\>'
|
||||||
if script =~# '[\/]__init__\.py$'
|
if script =~# '[\/]__init__\.py$'
|
||||||
let script = fnamemodify(script, ':h')
|
let script = tr(fnamemodify(script, ':h'), '\', '/')
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if !has_key(existing_rplugins, script)
|
if !has_key(existing_rplugins, script)
|
||||||
@ -173,6 +173,11 @@ function! s:check_terminal() abort
|
|||||||
call health#report_info('key_dc (kdch1) terminfo entry: '
|
call health#report_info('key_dc (kdch1) terminfo entry: '
|
||||||
\ .(empty(kbs_entry) ? '? (not found)' : kdch1_entry))
|
\ .(empty(kbs_entry) ? '? (not found)' : kdch1_entry))
|
||||||
endif
|
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
|
endfunction
|
||||||
|
|
||||||
function! health#nvim#check() abort
|
function! health#nvim#check() abort
|
||||||
|
@ -487,9 +487,71 @@ function! s:check_ruby() abort
|
|||||||
endif
|
endif
|
||||||
endfunction
|
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
|
function! health#provider#check() abort
|
||||||
call s:check_clipboard()
|
call s:check_clipboard()
|
||||||
call s:check_python(2)
|
call s:check_python(2)
|
||||||
call s:check_python(3)
|
call s:check_python(3)
|
||||||
call s:check_ruby()
|
call s:check_ruby()
|
||||||
|
call s:check_node()
|
||||||
endfunction
|
endfunction
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
" Vim support file to help with paste mappings and menus
|
" Vim support file to help with paste mappings and menus
|
||||||
" Maintainer: Bram Moolenaar <Bram@vim.org>
|
" Maintainer: Bram Moolenaar <Bram@vim.org>
|
||||||
" 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
|
" 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.
|
" Toolbar menu. Also used in mswin.vim and macmap.vim.
|
||||||
@ -12,7 +12,7 @@
|
|||||||
if has("virtualedit")
|
if has("virtualedit")
|
||||||
let paste#paste_cmd = {'n': ":call paste#Paste()<CR>"}
|
let paste#paste_cmd = {'n': ":call paste#Paste()<CR>"}
|
||||||
let paste#paste_cmd['v'] = '"-c<Esc>' . paste#paste_cmd['n']
|
let paste#paste_cmd['v'] = '"-c<Esc>' . paste#paste_cmd['n']
|
||||||
let paste#paste_cmd['i'] = 'x<BS><Esc>' . paste#paste_cmd['n'] . 'gi'
|
let paste#paste_cmd['i'] = "\<c-\>\<c-o>\"+gP"
|
||||||
|
|
||||||
func! paste#Paste()
|
func! paste#Paste()
|
||||||
let ove = &ve
|
let ove = &ve
|
||||||
|
80
runtime/autoload/provider/node.vim
Normal file
80
runtime/autoload/provider/node.vim
Normal file
@ -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', [])
|
@ -19,7 +19,7 @@ function! provider#ruby#Detect() abort
|
|||||||
if exists("g:ruby_host_prog")
|
if exists("g:ruby_host_prog")
|
||||||
return g:ruby_host_prog
|
return g:ruby_host_prog
|
||||||
else
|
else
|
||||||
return exepath('neovim-ruby-host')
|
return has('win32') ? exepath('neovim-ruby-host.cmd') : exepath('neovim-ruby-host')
|
||||||
end
|
end
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
@ -199,3 +199,7 @@ call remote#host#Register('python3', '*',
|
|||||||
" Ruby
|
" Ruby
|
||||||
call remote#host#Register('ruby', '*.rb',
|
call remote#host#Register('ruby', '*.rb',
|
||||||
\ function('provider#ruby#Require'))
|
\ function('provider#ruby#Require'))
|
||||||
|
|
||||||
|
" nodejs
|
||||||
|
call remote#host#Register('node', '*',
|
||||||
|
\ function('provider#node#Require'))
|
||||||
|
415
runtime/autoload/rust.vim
Normal file
415
runtime/autoload/rust.vim
Normal file
@ -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 <SID>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 <mattn.jp@gmail.com> 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:
|
107
runtime/autoload/rustfmt.vim
Normal file
107
runtime/autoload/rustfmt.vim
Normal file
@ -0,0 +1,107 @@
|
|||||||
|
" Author: Stephen Sugden <stephen@stephensugden.com>
|
||||||
|
"
|
||||||
|
" 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
|
@ -197,7 +197,7 @@ function! spellfile#WritableSpellDir()
|
|||||||
" Always use the $XDG_DATA_HOME/nvim/site directory
|
" Always use the $XDG_DATA_HOME/nvim/site directory
|
||||||
if exists('$XDG_DATA_HOME')
|
if exists('$XDG_DATA_HOME')
|
||||||
return $XDG_DATA_HOME . "/nvim/site/spell"
|
return $XDG_DATA_HOME . "/nvim/site/spell"
|
||||||
else
|
elseif !(has('win32') || has('win64'))
|
||||||
return $HOME . "/.local/share/nvim/site/spell"
|
return $HOME . "/.local/share/nvim/site/spell"
|
||||||
endif
|
endif
|
||||||
for dir in split(&rtp, ',')
|
for dir in split(&rtp, ',')
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
" Language: SQL
|
" Language: SQL
|
||||||
" Maintainer: David Fishburn <dfishburn dot vim at gmail dot com>
|
" Maintainer: David Fishburn <dfishburn dot vim at gmail dot com>
|
||||||
" Version: 16.0
|
" Version: 16.0
|
||||||
" Last Change: 2015 Dec 29
|
" Last Change: 2017 Oct 15
|
||||||
" Homepage: http://www.vim.org/scripts/script.php?script_id=1572
|
" Homepage: http://www.vim.org/scripts/script.php?script_id=1572
|
||||||
" Usage: For detailed help
|
" Usage: For detailed help
|
||||||
" ":help sql.txt"
|
" ":help sql.txt"
|
||||||
|
35
runtime/compiler/cargo.vim
Normal file
35
runtime/compiler/cargo.vim
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
" Vim compiler file
|
||||||
|
" Compiler: Cargo Compiler
|
||||||
|
" Maintainer: Damien Radtke <damienradtke@gmail.com>
|
||||||
|
" 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 <args>
|
||||||
|
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
|
@ -1,7 +1,8 @@
|
|||||||
" Vim compiler file
|
" 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 <now@bitwi.se>
|
" Previous Maintainer: Nikolai Weibull <now@bitwi.se>
|
||||||
" Latest Revision: 2006-04-19
|
" Latest Revision: 2017-03-31
|
||||||
|
|
||||||
if exists("current_compiler")
|
if exists("current_compiler")
|
||||||
finish
|
finish
|
||||||
@ -11,12 +12,18 @@ let current_compiler = "rst"
|
|||||||
let s:cpo_save = &cpo
|
let s:cpo_save = &cpo
|
||||||
set cpo&vim
|
set cpo&vim
|
||||||
|
|
||||||
setlocal errorformat=
|
if exists(":CompilerSet") != 2
|
||||||
\%f:%l:\ (%tEBUG/0)\ %m,
|
command -nargs=* CompilerSet setlocal <args>
|
||||||
\%f:%l:\ (%tNFO/1)\ %m,
|
endif
|
||||||
\%f:%l:\ (%tARNING/2)\ %m,
|
|
||||||
\%f:%l:\ (%tRROR/3)\ %m,
|
CompilerSet errorformat=
|
||||||
\%f:%l:\ (%tEVERE/3)\ %m,
|
\%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',
|
\%D%*\\a[%*\\d]:\ Entering\ directory\ `%f',
|
||||||
\%X%*\\a[%*\\d]:\ Leaving\ directory\ `%f',
|
\%X%*\\a[%*\\d]:\ Leaving\ directory\ `%f',
|
||||||
\%DMaking\ %*\\a\ in\ %f
|
\%DMaking\ %*\\a\ in\ %f
|
||||||
|
46
runtime/compiler/rustc.vim
Normal file
46
runtime/compiler/rustc.vim
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
" Vim compiler file
|
||||||
|
" Compiler: Rust Compiler
|
||||||
|
" Maintainer: Chris Morgan <me@chrismorgan.info>
|
||||||
|
" 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 <args>
|
||||||
|
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
|
@ -36,7 +36,7 @@ the user interface remains the standard Vi interface.
|
|||||||
|
|
||||||
Highlights
|
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
|
o Viewing and editing files in right-to-left windows. File
|
||||||
orientation is per window, so it is possible to view the same
|
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.
|
The right-to-left changes are completely hardware independent.
|
||||||
Only Arabic fonts are necessary.
|
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).
|
right-to-left mode (there are liable to be bugs).
|
||||||
|
|
||||||
o Changing keyboard mapping and reverse insert modes using a single
|
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 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.
|
started within a Bidi capable terminal emulator.
|
||||||
|
|
||||||
|
|
||||||
Arabic Fonts *arabicfonts*
|
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
|
Arabic requires ISO-8859-6 as well as Presentation Form-B fonts
|
||||||
(without Form-B, Arabic will _NOT_ be usable). It is highly
|
(without Form-B, Arabic will _NOT_ be usable). It is highly
|
||||||
recommended that users search for so-called 'ISO-10646-1' fonts.
|
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
|
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.
|
need to be accounted for and invoked.
|
||||||
|
|
||||||
o Setting the Arabic fonts
|
o Setting the Arabic fonts
|
||||||
|
|
||||||
+ For VIM GUI set the 'guifont' to your_ARABIC_FONT. This is done
|
+ For Vim GUI set the 'guifont' to your_ARABIC_FONT. This is done
|
||||||
by entering the following command in the VIM window.
|
by entering the following command in the Vim window.
|
||||||
>
|
>
|
||||||
:set guifont=your_ARABIC_FONT
|
: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
|
you can include ':set guifont=your_ARABIC_FONT' to your vimrc
|
||||||
file.
|
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.
|
'-fn your_ARABIC_FONT' option.
|
||||||
|
|
||||||
o Setting the appropriate character Encoding
|
o Setting the appropriate character Encoding
|
||||||
@ -131,11 +131,11 @@ o Setting the appropriate character Encoding
|
|||||||
o Enable Arabic settings [short-cut]
|
o Enable Arabic settings [short-cut]
|
||||||
|
|
||||||
In order to simplify and streamline things, you can either invoke
|
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 ...
|
% 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
|
:set arabic
|
||||||
<
|
<
|
||||||
@ -196,7 +196,7 @@ o Enable Arabic settings [short-cut]
|
|||||||
|
|
||||||
+ Arabic deletion of a combined pair character
|
+ 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
|
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
|
and still retain the LAM (i.e. it reverts to treating the combined
|
||||||
character as its natural two characters form -- this also pertains
|
character as its natural two characters form -- this also pertains
|
||||||
@ -255,7 +255,7 @@ o Enable Arabic settings [short-cut]
|
|||||||
Keymap/Keyboard *arabickeymap*
|
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
|
It is widely discouraged that any other encoding be used or even
|
||||||
attempted.
|
attempted.
|
||||||
|
|
||||||
@ -288,7 +288,7 @@ o Keyboard
|
|||||||
Restrictions
|
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
|
(i.e. the ability to see both Arabic and Latin intermixed within
|
||||||
the same line).
|
the same line).
|
||||||
|
|
||||||
|
@ -55,7 +55,14 @@ Note: The ":autocmd" command can only be followed by another command when the
|
|||||||
'|' appears before {cmd}. This works: >
|
'|' appears before {cmd}. This works: >
|
||||||
:augroup mine | au! BufRead | augroup END
|
:augroup mine | au! BufRead | augroup END
|
||||||
But this sees "augroup" as part of the defined command: >
|
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
|
: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., "%", "<cword>") in the ":autocmd"
|
Note that special characters (e.g., "%", "<cword>") in the ":autocmd"
|
||||||
arguments are not expanded when the autocommand is defined. These will be
|
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|
|
|timestamp|
|
||||||
Mostly triggered after executing a shell
|
Mostly triggered after executing a shell
|
||||||
command, but also with a |:checktime| command
|
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
|
This autocommand is triggered for each changed
|
||||||
file. It is not used when 'autoread' is set
|
file. It is not used when 'autoread' is set
|
||||||
and the buffer was not changed. If a
|
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.
|
to tell Vim what to do next.
|
||||||
NOTE: When this autocommand is executed, the
|
NOTE: When this autocommand is executed, the
|
||||||
current buffer "%" may be different from the
|
current buffer "%" may be different from the
|
||||||
buffer that was changed "<afile>".
|
buffer that was changed, which is in "<afile>".
|
||||||
NOTE: The commands must not change the current
|
NOTE: The commands must not change the current
|
||||||
buffer, jump to another buffer or delete a
|
buffer, jump to another buffer or delete a
|
||||||
buffer. *E246* *E811*
|
buffer. *E246* *E811*
|
||||||
@ -643,7 +650,8 @@ FileType When the 'filetype' option has been set. The
|
|||||||
pattern is matched against the filetype.
|
pattern is matched against the filetype.
|
||||||
<afile> can be used for the name of the file
|
<afile> can be used for the name of the file
|
||||||
where this option was set, and <amatch> for
|
where this option was set, and <amatch> for
|
||||||
the new value of 'filetype'.
|
the new value of 'filetype'. Navigating to
|
||||||
|
another window or buffer is not allowed.
|
||||||
See |filetypes|.
|
See |filetypes|.
|
||||||
*FileWriteCmd*
|
*FileWriteCmd*
|
||||||
FileWriteCmd Before writing to a file, when not writing the
|
FileWriteCmd Before writing to a file, when not writing the
|
||||||
|
@ -361,7 +361,7 @@ These are the commands that can be used:
|
|||||||
*c_CTRL-D*
|
*c_CTRL-D*
|
||||||
CTRL-D List names that match the pattern in front of the cursor.
|
CTRL-D List names that match the pattern in front of the cursor.
|
||||||
When showing file names, directories are highlighted (see
|
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.
|
to the end.
|
||||||
The 'wildoptions' option can be set to "tagfile" to list the
|
The 'wildoptions' option can be set to "tagfile" to list the
|
||||||
file of matching tags.
|
file of matching tags.
|
||||||
@ -420,6 +420,9 @@ matches exactly one character.
|
|||||||
|
|
||||||
The 'wildignorecase' option can be set to ignore case in filenames.
|
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:
|
If you like tcsh's autolist completion, you can use this mapping:
|
||||||
:cnoremap X <C-L><C-D>
|
:cnoremap X <C-L><C-D>
|
||||||
(Where X is the command key to use, <C-L> is CTRL-L and <C-D> is CTRL-D)
|
(Where X is the command key to use, <C-L> is CTRL-L and <C-D> is CTRL-D)
|
||||||
@ -778,6 +781,7 @@ Also see |`=|.
|
|||||||
*:<cword>* *:<cWORD>* *:<cfile>* *<cfile>*
|
*:<cword>* *:<cWORD>* *:<cfile>* *<cfile>*
|
||||||
*:<sfile>* *<sfile>* *:<afile>* *<afile>*
|
*:<sfile>* *<sfile>* *:<afile>* *<afile>*
|
||||||
*:<abuf>* *<abuf>* *:<amatch>* *<amatch>*
|
*:<abuf>* *<abuf>* *:<amatch>* *<amatch>*
|
||||||
|
*:<cexpr>* *<cexpr>*
|
||||||
*<slnum>* *E495* *E496* *E497* *E499* *E500*
|
*<slnum>* *E495* *E496* *E497* *E499* *E500*
|
||||||
Note: these are typed literally, they are not special keys!
|
Note: these are typed literally, they are not special keys!
|
||||||
<cword> is replaced with the word under the cursor (like |star|)
|
<cword> is replaced with the word under the cursor (like |star|)
|
||||||
@ -785,7 +789,8 @@ Note: these are typed literally, they are not special keys!
|
|||||||
<cfile> is replaced with the path name under the cursor (like what
|
<cfile> is replaced with the path name under the cursor (like what
|
||||||
|gf| uses)
|
|gf| uses)
|
||||||
<afile> When executing autocommands, is replaced with the file name
|
<afile> 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.
|
||||||
<abuf> When executing autocommands, is replaced with the currently
|
<abuf> When executing autocommands, is replaced with the currently
|
||||||
effective buffer number (for ":r file" and ":so file" it is
|
effective buffer number (for ":r file" and ":so file" it is
|
||||||
the current buffer, the file being read/sourced is not in a
|
the current buffer, the file being read/sourced is not in a
|
||||||
|
@ -47,6 +47,7 @@ Modifiers ~
|
|||||||
|
|
||||||
Options ~
|
Options ~
|
||||||
*'fe'* 'fenc'+'enc' before Vim 6.0; no longer used.
|
*'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'.
|
*'langnoremap'* Deprecated alias to 'nolangremap'.
|
||||||
*'vi'*
|
*'vi'*
|
||||||
*'viminfo'* Deprecated alias to 'shada' option.
|
*'viminfo'* Deprecated alias to 'shada' option.
|
||||||
|
@ -13,7 +13,7 @@ The basics are explained in section |08.7| of the user manual.
|
|||||||
Type |gO| to see the table of contents.
|
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
|
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. >
|
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
|
(searching from the end of the line). The
|
||||||
text in between is highlighted. This means
|
text in between is highlighted. This means
|
||||||
that parts in the middle that are still the
|
that parts in the middle that are still the
|
||||||
same are highlighted anyway. Only "iwhite" of
|
same are highlighted anyway. The 'diffopt'
|
||||||
'diffopt' is used here.
|
flags "iwhite" and "icase" are used here.
|
||||||
|hl-DiffDelete| DiffDelete Deleted lines. Also called filler lines,
|
|hl-DiffDelete| DiffDelete Deleted lines. Also called filler lines,
|
||||||
because they don't really exist in this
|
because they don't really exist in this
|
||||||
buffer.
|
buffer.
|
||||||
@ -314,7 +314,7 @@ g:diff_translations to zero: >
|
|||||||
|
|
||||||
let g:diff_translations = 0
|
let g:diff_translations = 0
|
||||||
<
|
<
|
||||||
After setting this variable, Reload the syntax script: >
|
After setting this variable, reload the syntax script: >
|
||||||
|
|
||||||
set syntax=diff
|
set syntax=diff
|
||||||
<
|
<
|
||||||
|
@ -1032,6 +1032,7 @@ The names can be in upper- or lowercase.
|
|||||||
window in the current tab page the current tab page is
|
window in the current tab page the current tab page is
|
||||||
closed |tab-page|.
|
closed |tab-page|.
|
||||||
Triggers the |QuitPre| autocommand event.
|
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
|
:conf[irm] q[uit] Quit, but give prompt when changes have been made, or
|
||||||
the last file in the argument list has not been
|
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* *:lcd*
|
||||||
:lc[d][!] {path} Like |:cd|, but only set the current directory for the
|
:lc[d][!] {path} Like |:cd|, but only set the current directory for the
|
||||||
current window. The current directory for other
|
current window. The current directory for other
|
||||||
windows or any tabs is not changed.
|
windows or tabs is not changed.
|
||||||
|
|
||||||
*:lch* *:lchdir*
|
*:lch* *:lchdir*
|
||||||
:lch[dir][!] Same as |:lcd|.
|
: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
|
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.
|
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
|
Note that if a FileChangedShell autocommand is defined you will not get a
|
||||||
warning message or prompt. The autocommand is expected to handle this.
|
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.
|
This searches the same directories, but in a different order.
|
||||||
|
|
||||||
Note that completion for ":find", ":sfind", and ":tabfind" commands do not
|
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.
|
with depth limiter (/usr/**2) or upward search (;) notations.
|
||||||
|
|
||||||
vim:tw=78:ts=8:ft=help:norl:
|
vim:tw=78:ts=8:ft=help:norl:
|
||||||
|
@ -94,9 +94,8 @@ To test for a non-empty string, use empty(): >
|
|||||||
Function arguments often behave slightly different from |TRUE|: If the
|
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
|
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.
|
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
|
Note that " " and "0" are also non-empty strings, thus considered to be TRUE.
|
||||||
cleared. A List, Dictionary or Float is not a Number or String, thus
|
A List, Dictionary or Float is not a Number or String, thus evaluate to FALSE.
|
||||||
evaluates to FALSE.
|
|
||||||
|
|
||||||
*E745* *E728* *E703* *E729* *E730* *E731*
|
*E745* *E728* *E703* *E729* *E730* *E731*
|
||||||
List, Dictionary and Funcref types are not automatically converted.
|
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
|
"abc" == "Abc" evaluates to 1 if 'ignorecase' is set, 0 otherwise
|
||||||
|
|
||||||
*E691* *E692*
|
*E691* *E692*
|
||||||
A |List| can only be compared with a |List| and only "equal", "not equal" and
|
A |List| can only be compared with a |List| and only "equal", "not equal",
|
||||||
"is" can be used. This compares the values of the list, recursively.
|
"is" and "isnot" can be used. This compares the values of the list,
|
||||||
Ignoring case means case is ignored when comparing item values.
|
recursively. Ignoring case means case is ignored when comparing item values.
|
||||||
|
|
||||||
*E735* *E736*
|
*E735* *E736*
|
||||||
A |Dictionary| can only be compared with a |Dictionary| and only "equal", "not
|
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|
|
equal", "is" and "isnot" can be used. This compares the key/values of the
|
||||||
recursively. Ignoring case means case is ignored when comparing item values.
|
|Dictionary| recursively. Ignoring case means case is ignored when comparing
|
||||||
|
item values.
|
||||||
|
|
||||||
*E694*
|
*E694*
|
||||||
A |Funcref| can only be compared with a |Funcref| and only "equal", "not
|
A |Funcref| can only be compared with a |Funcref| and only "equal", "not
|
||||||
@ -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,
|
When there are two counts, as in "3d2w", they are multiplied,
|
||||||
just like what happens in the command, "d6w" for the example.
|
just like what happens in the command, "d6w" for the example.
|
||||||
Also used for evaluating the 'formatexpr' option.
|
Also used for evaluating the 'formatexpr' option.
|
||||||
"count" also works, for backwards compatibility.
|
|
||||||
|
|
||||||
*v:count1* *count1-variable*
|
*v:count1* *count1-variable*
|
||||||
v:count1 Just like "v:count", but defaults to one when no count is
|
v:count1 Just like "v:count", but defaults to one when no count is
|
||||||
@ -2031,9 +2030,9 @@ filereadable({file}) Number |TRUE| if {file} is a readable file
|
|||||||
filewritable({file}) Number |TRUE| if {file} is a writable file
|
filewritable({file}) Number |TRUE| if {file} is a writable file
|
||||||
filter({expr1}, {expr2}) List/Dict remove items from {expr1} where
|
filter({expr1}, {expr2}) List/Dict remove items from {expr1} where
|
||||||
{expr2} is 0
|
{expr2} is 0
|
||||||
finddir({name}[, {path}[, {count}]])
|
finddir({name} [, {path} [, {count}]])
|
||||||
String find directory {name} in {path}
|
String find directory {name} in {path}
|
||||||
findfile({name}[, {path}[, {count}]])
|
findfile({name} [, {path} [, {count}]])
|
||||||
String find file {name} in {path}
|
String find file {name} in {path}
|
||||||
float2nr({expr}) Number convert Float {expr} to a Number
|
float2nr({expr}) Number convert Float {expr} to a Number
|
||||||
floor({expr}) Float round {expr} down
|
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}
|
getftype({fname}) String description of type of file {fname}
|
||||||
getline({lnum}) String line {lnum} of current buffer
|
getline({lnum}) String line {lnum} of current buffer
|
||||||
getline({lnum}, {end}) List lines {lnum} to {end} 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
|
getmatches() List list of current matches
|
||||||
getpid() Number process ID of Vim
|
getpid() Number process ID of Vim
|
||||||
getpos({expr}) List position of cursor, mark, etc.
|
getpos({expr}) List position of cursor, mark, etc.
|
||||||
@ -2119,7 +2118,8 @@ index({list}, {expr} [, {start} [, {ic}]])
|
|||||||
Number index in {list} where {expr} appears
|
Number index in {list} where {expr} appears
|
||||||
input({prompt} [, {text} [, {completion}]])
|
input({prompt} [, {text} [, {completion}]])
|
||||||
String get input from the user
|
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
|
inputlist({textlist}) Number let the user pick from a choice list
|
||||||
inputrestore() Number restore typeahead
|
inputrestore() Number restore typeahead
|
||||||
inputsave() Number save and clear typeahead
|
inputsave() Number save and clear typeahead
|
||||||
@ -2201,12 +2201,13 @@ readfile({fname} [, {binary} [, {max}]])
|
|||||||
reltime([{start} [, {end}]]) List get time value
|
reltime([{start} [, {end}]]) List get time value
|
||||||
reltimefloat({time}) Float turn the time value into a Float
|
reltimefloat({time}) Float turn the time value into a Float
|
||||||
reltimestr({time}) String turn time value into a String
|
reltimestr({time}) String turn time value into a String
|
||||||
remote_expr({server}, {string} [, {idvar}])
|
remote_expr({server}, {string} [, {idvar} [, {timeout}]])
|
||||||
String send expression
|
String send expression
|
||||||
remote_foreground({server}) Number bring Vim server to the foreground
|
remote_foreground({server}) Number bring Vim server to the foreground
|
||||||
remote_peek({serverid} [, {retvar}])
|
remote_peek({serverid} [, {retvar}])
|
||||||
Number check for reply string
|
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}])
|
remote_send({server}, {string} [, {idvar}])
|
||||||
String send key sequence
|
String send key sequence
|
||||||
remove({list}, {idx} [, {end}]) any remove items {idx}-{end} from {list}
|
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
|
str2float({expr}) Float convert String to Float
|
||||||
str2nr({expr} [, {base}]) Number convert String to Number
|
str2nr({expr} [, {base}]) Number convert String to Number
|
||||||
strchars({expr} [, {skipcc}]) Number character length of the String {expr}
|
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}
|
String {len} characters of {str} at {start}
|
||||||
strdisplaywidth({expr} [, {col}]) Number display length of the String {expr}
|
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}
|
strgetchar({str}, {index}) Number get char {index} from {str}
|
||||||
stridx({haystack}, {needle}[, {start}])
|
stridx({haystack}, {needle} [, {start}])
|
||||||
Number index of {needle} in {haystack}
|
Number index of {needle} in {haystack}
|
||||||
string({expr}) String String representation of {expr} value
|
string({expr}) String String representation of {expr} value
|
||||||
strlen({expr}) Number length of the String {expr}
|
strlen({expr}) Number length of the String {expr}
|
||||||
strpart({str}, {start}[, {len}])
|
strpart({str}, {start} [, {len}])
|
||||||
String {len} characters of {str} at {start}
|
String {len} characters of {str} at {start}
|
||||||
strridx({haystack}, {needle} [, {start}])
|
strridx({haystack}, {needle} [, {start}])
|
||||||
Number last index of {needle} in {haystack}
|
Number last index of {needle} in {haystack}
|
||||||
strtrans({expr}) String translate string to make it printable
|
strtrans({expr}) String translate string to make it printable
|
||||||
strwidth({expr}) Number display cell length of the String {expr}
|
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()
|
specific match in ":s" or substitute()
|
||||||
substitute({expr}, {pat}, {sub}, {flags})
|
substitute({expr}, {pat}, {sub}, {flags})
|
||||||
String all {pat} in {expr} replaced with {sub}
|
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
|
redo it is the number of the redone change. After undo it is
|
||||||
one less than the number of the undone change.
|
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: >
|
Return number value of the first char in {expr}. Examples: >
|
||||||
char2nr(" ") returns 32
|
char2nr(" ") returns 32
|
||||||
char2nr("ABC") returns 65
|
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
|
FileType event has been triggered at least once. Can be used
|
||||||
to avoid triggering the FileType event again in the scripts
|
to avoid triggering the FileType event again in the scripts
|
||||||
that detect the file type. |FileType|
|
that detect the file type. |FileType|
|
||||||
|
Returns |FALSE| when `:setf FALLBACK` was used.
|
||||||
When editing another file, the counter is reset, thus this
|
When editing another file, the counter is reset, thus this
|
||||||
really checks if the FileType event has been triggered for the
|
really checks if the FileType event has been triggered for the
|
||||||
current buffer. This allows an autocommand that starts
|
current buffer. This allows an autocommand that starts
|
||||||
@ -3530,7 +3532,7 @@ filter({expr1}, {expr2}) *filter()*
|
|||||||
defined with the "abort" flag.
|
defined with the "abort" flag.
|
||||||
|
|
||||||
|
|
||||||
finddir({name}[, {path}[, {count}]]) *finddir()*
|
finddir({name} [, {path} [, {count}]]) *finddir()*
|
||||||
Find directory {name} in {path}. Supports both downwards and
|
Find directory {name} in {path}. Supports both downwards and
|
||||||
upwards recursive directory searches. See |file-searching|
|
upwards recursive directory searches. See |file-searching|
|
||||||
for the syntax of {path}.
|
for the syntax of {path}.
|
||||||
@ -3545,7 +3547,7 @@ finddir({name}[, {path}[, {count}]]) *finddir()*
|
|||||||
{only available when compiled with the |+file_in_path|
|
{only available when compiled with the |+file_in_path|
|
||||||
feature}
|
feature}
|
||||||
|
|
||||||
findfile({name}[, {path}[, {count}]]) *findfile()*
|
findfile({name} [, {path} [, {count}]]) *findfile()*
|
||||||
Just like |finddir()|, but find a file instead of a directory.
|
Just like |finddir()|, but find a file instead of a directory.
|
||||||
Uses 'suffixesadd'.
|
Uses 'suffixesadd'.
|
||||||
Example: >
|
Example: >
|
||||||
@ -4077,13 +4079,16 @@ getcompletion({pat}, {type} [, {filtered}]) *getcompletion()*
|
|||||||
getcurpos() Get the position of the cursor. This is like getpos('.'), but
|
getcurpos() Get the position of the cursor. This is like getpos('.'), but
|
||||||
includes an extra item in the list:
|
includes an extra item in the list:
|
||||||
[bufnum, lnum, col, off, curswant] ~
|
[bufnum, lnum, col, off, curswant] ~
|
||||||
The "curswant" number is the preferred column when moving the
|
The "curswant" number is the preferred column when moving the
|
||||||
cursor vertically.
|
cursor vertically. Also see |getpos()|.
|
||||||
This can be used to save and restore the cursor position: >
|
|
||||||
let save_cursor = getcurpos()
|
This can be used to save and restore the cursor position: >
|
||||||
MoveTheCursorAround
|
let save_cursor = getcurpos()
|
||||||
call setpos('.', save_cursor)
|
MoveTheCursorAround
|
||||||
<
|
call setpos('.', save_cursor)
|
||||||
|
< Note that this only works within the window. See
|
||||||
|
|winrestview()| for restoring more state.
|
||||||
|
|
||||||
getcwd([{winnr}[, {tabnr}]]) *getcwd()*
|
getcwd([{winnr}[, {tabnr}]]) *getcwd()*
|
||||||
With no arguments the result is a String, which is the name of
|
With no arguments the result is a String, which is the name of
|
||||||
the current effective working directory. With {winnr} or
|
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
|
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
|
the left hand side of the GUI Vim window. The result will be
|
||||||
-1 if the information is not available.
|
-1 if the information is not available.
|
||||||
|
The value can be used with `:winpos`.
|
||||||
|
|
||||||
*getwinposy()*
|
*getwinposy()*
|
||||||
getwinposy() The result is a Number, which is the Y coordinate in pixels of
|
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
|
the top of the GUI Vim window. The result will be -1 if the
|
||||||
information is not available.
|
information is not available.
|
||||||
|
The value can be used with `:winpos`.
|
||||||
|
|
||||||
getwininfo([{winid}]) *getwininfo()*
|
getwininfo([{winid}]) *getwininfo()*
|
||||||
Returns information about windows as a List with Dictionaries.
|
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:
|
Each List item is a Dictionary with the following entries:
|
||||||
bufnr number of buffer in the window
|
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
|
loclist 1 if showing a location list
|
||||||
quickfix 1 if quickfix or location list window
|
quickfix 1 if quickfix or location list window
|
||||||
tabnr tab page number
|
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*
|
< *last-position-jump*
|
||||||
This autocommand jumps to the last known position in a file
|
This autocommand jumps to the last known position in a file
|
||||||
just after opening it, if the '" mark is set: >
|
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()*
|
line2byte({lnum}) *line2byte()*
|
||||||
Return the byte count from the start of the buffer for line
|
Return the byte count from the start of the buffer for line
|
||||||
@ -5245,7 +5257,7 @@ map({expr1}, {expr2}) *map()*
|
|||||||
defined with the "abort" flag.
|
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
|
When {dict} is omitted or zero: Return the rhs of mapping
|
||||||
{name} in mode {mode}. The returned String has special
|
{name} in mode {mode}. The returned String has special
|
||||||
characters translated like in the output of the ":map" command
|
characters translated like in the output of the ":map" command
|
||||||
@ -5266,6 +5278,7 @@ maparg({name}[, {mode} [, {abbr} [, {dict}]]]) *maparg()*
|
|||||||
"s" Select
|
"s" Select
|
||||||
"x" Visual
|
"x" Visual
|
||||||
"l" langmap |language-mapping|
|
"l" langmap |language-mapping|
|
||||||
|
"t" Terminal
|
||||||
"" Normal, Visual and Operator-pending
|
"" Normal, Visual and Operator-pending
|
||||||
When {mode} is omitted, the modes for "" are used.
|
When {mode} is omitted, the modes for "" are used.
|
||||||
|
|
||||||
@ -5299,7 +5312,7 @@ maparg({name}[, {mode} [, {abbr} [, {dict}]]]) *maparg()*
|
|||||||
exe 'nnoremap <Tab> ==' . maparg('<Tab>', 'n')
|
exe 'nnoremap <Tab> ==' . maparg('<Tab>', 'n')
|
||||||
|
|
||||||
|
|
||||||
mapcheck({name}[, {mode} [, {abbr}]]) *mapcheck()*
|
mapcheck({name} [, {mode} [, {abbr}]]) *mapcheck()*
|
||||||
Check if there is a mapping that matches with {name} in mode
|
Check if there is a mapping that matches with {name} in mode
|
||||||
{mode}. See |maparg()| for {mode} and special names in
|
{mode}. See |maparg()| for {mode} and special names in
|
||||||
{name}.
|
{name}.
|
||||||
@ -5331,7 +5344,7 @@ mapcheck({name}[, {mode} [, {abbr}]]) *mapcheck()*
|
|||||||
< This avoids adding the "_vv" mapping when there already is a
|
< This avoids adding the "_vv" mapping when there already is a
|
||||||
mapping for "_v" or for "_vvv".
|
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
|
When {expr} is a |List| then this returns the index of the
|
||||||
first item where {pat} matches. Each item is used as a
|
first item where {pat} matches. Each item is used as a
|
||||||
String, |Lists| and |Dictionaries| are used as echoed.
|
String, |Lists| and |Dictionaries| are used as echoed.
|
||||||
@ -5440,7 +5453,7 @@ matchadd({group}, {pattern}[, {priority}[, {id} [, {dict}]]])
|
|||||||
one operation by |clearmatches()|.
|
one operation by |clearmatches()|.
|
||||||
|
|
||||||
*matchaddpos()*
|
*matchaddpos()*
|
||||||
matchaddpos({group}, {pos}[, {priority}[, {id}[, {dict}]]])
|
matchaddpos({group}, {pos} [, {priority} [, {id} [, {dict}]]])
|
||||||
Same as |matchadd()|, but requires a list of positions {pos}
|
Same as |matchadd()|, but requires a list of positions {pos}
|
||||||
instead of a pattern. This command is faster than |matchadd()|
|
instead of a pattern. This command is faster than |matchadd()|
|
||||||
because it does not require to handle regular expressions and
|
because it does not require to handle regular expressions and
|
||||||
@ -5493,7 +5506,7 @@ matchdelete({id}) *matchdelete()* *E802* *E803*
|
|||||||
otherwise -1. See example for |matchadd()|. All matches can
|
otherwise -1. See example for |matchadd()|. All matches can
|
||||||
be deleted in one operation by |clearmatches()|.
|
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
|
Same as |match()|, but return the index of first character
|
||||||
after the match. Example: >
|
after the match. Example: >
|
||||||
:echo matchend("testing", "ing")
|
:echo matchend("testing", "ing")
|
||||||
@ -5512,7 +5525,7 @@ matchend({expr}, {pat}[, {start}[, {count}]]) *matchend()*
|
|||||||
< result is "-1".
|
< result is "-1".
|
||||||
When {expr} is a |List| the result is equal to |match()|.
|
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
|
Same as |match()|, but return a |List|. The first item in the
|
||||||
list is the matched string, same as what matchstr() would
|
list is the matched string, same as what matchstr() would
|
||||||
return. Following items are submatches, like "\1", "\2", etc.
|
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', '', '', '', '', '']
|
< Results in: ['acd', 'a', '', 'c', 'd', '', '', '', '', '']
|
||||||
When there is no match an empty list is returned.
|
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: >
|
Same as |match()|, but return the matched string. Example: >
|
||||||
:echo matchstr("testing", "ing")
|
:echo matchstr("testing", "ing")
|
||||||
< results in "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.
|
When {expr} is a |List| then the matching item is returned.
|
||||||
The type isn't changed, it's not necessarily a String.
|
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
|
Same as |matchstr()|, but return the matched string, the start
|
||||||
position and the end position of the match. Example: >
|
position and the end position of the match. Example: >
|
||||||
:echo matchstrpos("testing", "ing")
|
:echo matchstrpos("testing", "ing")
|
||||||
@ -5647,16 +5660,20 @@ mode([expr]) Return a string that indicates the current mode.
|
|||||||
S Select by line
|
S Select by line
|
||||||
CTRL-S Select blockwise
|
CTRL-S Select blockwise
|
||||||
i Insert
|
i Insert
|
||||||
|
ic Insert mode completion |compl-generic|
|
||||||
|
ix Insert mode |i_CTRL-X| completion
|
||||||
R Replace |R|
|
R Replace |R|
|
||||||
|
Rc Replace mode completion |compl-generic|
|
||||||
Rv Virtual Replace |gR|
|
Rv Virtual Replace |gR|
|
||||||
t Terminal
|
Rx Replace mode |i_CTRL-X| completion
|
||||||
c Command-line
|
c Command-line editing
|
||||||
cv Vim Ex mode |gQ|
|
cv Vim Ex mode |gQ|
|
||||||
ce Normal Ex mode |Q|
|
ce Normal Ex mode |Q|
|
||||||
r Hit-enter prompt
|
r Hit-enter prompt
|
||||||
rm The -- more -- prompt
|
rm The -- more -- prompt
|
||||||
r? A |:confirm| query of some sort
|
r? A |:confirm| query of some sort
|
||||||
! Shell or external command is executing
|
! Shell or external command is executing
|
||||||
|
t Terminal mode: keys go to the job
|
||||||
This is useful in the 'statusline' option or when used
|
This is useful in the 'statusline' option or when used
|
||||||
with |remote_expr()| In most other places it always returns
|
with |remote_expr()| In most other places it always returns
|
||||||
"c" or "n".
|
"c" or "n".
|
||||||
@ -5760,7 +5777,7 @@ nextnonblank({lnum}) *nextnonblank()*
|
|||||||
below it, zero is returned.
|
below it, zero is returned.
|
||||||
See also |prevnonblank()|.
|
See also |prevnonblank()|.
|
||||||
|
|
||||||
nr2char({expr}[, {utf8}]) *nr2char()*
|
nr2char({expr} [, {utf8}]) *nr2char()*
|
||||||
Return a string with a single character, which has the number
|
Return a string with a single character, which has the number
|
||||||
value {expr}. Examples: >
|
value {expr}. Examples: >
|
||||||
nr2char(64) returns "@"
|
nr2char(64) returns "@"
|
||||||
@ -5798,7 +5815,7 @@ pathshorten({expr}) *pathshorten()*
|
|||||||
components in the path are reduced to single letters. Leading
|
components in the path are reduced to single letters. Leading
|
||||||
'~' and '.' characters are kept. Example: >
|
'~' and '.' characters are kept. Example: >
|
||||||
:echo pathshorten('~/.config/nvim/autoload/file1.vim')
|
: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.
|
It doesn't matter if the path exists or not.
|
||||||
|
|
||||||
pow({x}, {y}) *pow()*
|
pow({x}, {y}) *pow()*
|
||||||
@ -6149,6 +6166,12 @@ remote_expr({server}, {string} [, {idvar}])
|
|||||||
{only available when compiled with the |+clientserver| feature}
|
{only available when compiled with the |+clientserver| feature}
|
||||||
Note: Any errors will cause a local error message to be issued
|
Note: Any errors will cause a local error message to be issued
|
||||||
and the result will be the empty string.
|
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: >
|
Examples: >
|
||||||
:echo remote_expr("gvim", "2+2")
|
:echo remote_expr("gvim", "2+2")
|
||||||
:echo remote_expr("gvim1", "b:current_syntax")
|
: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
|
Closes the socket connection if the channel was opened by
|
||||||
connecting to |v:servername|.
|
connecting to |v:servername|.
|
||||||
|
|
||||||
screenattr(row, col) *screenattr()*
|
screenattr({row}, {col}) *screenattr()*
|
||||||
Like |screenchar()|, but return the attribute. This is a rather
|
Like |screenchar()|, but return the attribute. This is a rather
|
||||||
arbitrary number that can only be used to compare to the
|
arbitrary number that can only be used to compare to the
|
||||||
attribute at other positions.
|
attribute at other positions.
|
||||||
|
|
||||||
screenchar(row, col) *screenchar()*
|
screenchar({row}, {col}) *screenchar()*
|
||||||
The result is a Number, which is the character at position
|
The result is a Number, which is the character at position
|
||||||
[row, col] on the screen. This works for every possible
|
[row, col] on the screen. This works for every possible
|
||||||
screen position, also status lines, window separators and the
|
screen position, also status lines, window separators and the
|
||||||
@ -6837,7 +6860,7 @@ setqflist({list} [, {action}[, {what}]]) *setqflist()*
|
|||||||
|
|
||||||
This function can be used to create a quickfix list
|
This function can be used to create a quickfix list
|
||||||
independent of the 'errorformat' setting. Use a command like
|
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()*
|
||||||
@ -7217,7 +7240,7 @@ strchars({expr} [, {skipcc}]) *strchars()*
|
|||||||
endfunction
|
endfunction
|
||||||
endif
|
endif
|
||||||
<
|
<
|
||||||
strcharpart({src}, {start}[, {len}]) *strcharpart()*
|
strcharpart({src}, {start} [, {len}]) *strcharpart()*
|
||||||
Like |strpart()| but using character index and length instead
|
Like |strpart()| but using character index and length instead
|
||||||
of byte index and length.
|
of byte index and length.
|
||||||
When a character index is used where a character does not
|
When a character index is used where a character does not
|
||||||
@ -7225,7 +7248,7 @@ strcharpart({src}, {start}[, {len}]) *strcharpart()*
|
|||||||
strcharpart('abc', -1, 2)
|
strcharpart('abc', -1, 2)
|
||||||
< results in 'a'.
|
< results in 'a'.
|
||||||
|
|
||||||
strdisplaywidth({expr}[, {col}]) *strdisplaywidth()*
|
strdisplaywidth({expr} [, {col}]) *strdisplaywidth()*
|
||||||
The result is a Number, which is the number of display cells
|
The result is a Number, which is the number of display cells
|
||||||
String {expr} occupies on the screen when it starts at {col}.
|
String {expr} occupies on the screen when it starts at {col}.
|
||||||
When {col} is omitted zero is used. Otherwise it is the
|
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()|.
|
|strchars()|.
|
||||||
Also see |len()|, |strdisplaywidth()| and |strwidth()|.
|
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
|
The result is a String, which is part of {src}, starting from
|
||||||
byte {start}, with the byte length {len}.
|
byte {start}, with the byte length {len}.
|
||||||
To count characters instead of bytes use |strcharpart()|.
|
To count characters instead of bytes use |strcharpart()|.
|
||||||
@ -7366,7 +7389,7 @@ strwidth({expr}) *strwidth()*
|
|||||||
Ambiguous, this function's return value depends on 'ambiwidth'.
|
Ambiguous, this function's return value depends on 'ambiwidth'.
|
||||||
Also see |strlen()|, |strdisplaywidth()| and |strchars()|.
|
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
|
Only for an expression in a |:substitute| command or
|
||||||
substitute() function.
|
substitute() function.
|
||||||
Returns the {nr}'th submatch of the matched text. When {nr}
|
Returns the {nr}'th submatch of the matched text. When {nr}
|
||||||
@ -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.
|
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}.
|
Returns a list of tags matching the regular expression {expr}.
|
||||||
|
|
||||||
If {filename} is passed it is used to prioritize the results
|
If {filename} is passed it is used to prioritize the results
|
||||||
@ -8037,6 +8060,7 @@ winheight({nr}) *winheight()*
|
|||||||
When {nr} is zero, the height of the current window is
|
When {nr} is zero, the height of the current window is
|
||||||
returned. When window {nr} doesn't exist, -1 is returned.
|
returned. When window {nr} doesn't exist, -1 is returned.
|
||||||
An existing window always has a height of zero or more.
|
An existing window always has a height of zero or more.
|
||||||
|
This excludes any window toolbar line.
|
||||||
Examples: >
|
Examples: >
|
||||||
:echo "The current window has " . winheight(0) . " lines."
|
: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|
|
listcmds Compiled with commands for the buffer list |:files|
|
||||||
and the argument list |arglist|.
|
and the argument list |arglist|.
|
||||||
localmap Compiled with local mappings and abbr. |:map-local|
|
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|.
|
menu Compiled with support for |:menu|.
|
||||||
mksession Compiled with support for |:mksession|.
|
mksession Compiled with support for |:mksession|.
|
||||||
modify_fname Compiled with file name modifiers. |filename-modifiers|
|
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|.
|
textobjects Compiled with support for |text-objects|.
|
||||||
timers Compiled with |timer_start()| support.
|
timers Compiled with |timer_start()| support.
|
||||||
title Compiled with window title support |'title'|.
|
title Compiled with window title support |'title'|.
|
||||||
|
ttyin input is a terminal (tty)
|
||||||
|
ttyout output is a terminal (tty)
|
||||||
unix Unix version of Vim.
|
unix Unix version of Vim.
|
||||||
unnamedplus Compiled with support for "unnamedplus" in 'clipboard'
|
unnamedplus Compiled with support for "unnamedplus" in 'clipboard'
|
||||||
user_commands User-defined commands.
|
user_commands User-defined commands.
|
||||||
@ -8401,13 +8427,16 @@ See |:verbose-cmd| for more information.
|
|||||||
|
|
||||||
*E124* *E125* *E853* *E884*
|
*E124* *E125* *E853* *E884*
|
||||||
:fu[nction][!] {name}([arguments]) [range] [abort] [dict] [closure]
|
:fu[nction][!] {name}([arguments]) [range] [abort] [dict] [closure]
|
||||||
Define a new function by the name {name}. The name
|
Define a new function by the name {name}. The body of
|
||||||
must be made of alphanumeric characters and '_', and
|
the function follows in the next lines, until the
|
||||||
must start with a capital or "s:" (see above). Note
|
matching |:endfunction|.
|
||||||
that using "b:" or "g:" is not allowed. (since patch
|
|
||||||
7.4.260 E884 is given if the function name has a colon
|
The name must be made of alphanumeric characters and
|
||||||
in the name, e.g. for "foo:bar()". Before that patch
|
'_', and must start with a capital or "s:" (see
|
||||||
no error was given).
|
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
|
{name} can also be a |Dictionary| entry that is a
|
||||||
|Funcref|: >
|
|Funcref|: >
|
||||||
@ -8522,9 +8551,10 @@ to the number of named arguments. When using "...", the number of arguments
|
|||||||
may be larger.
|
may be larger.
|
||||||
|
|
||||||
It is also possible to define a function without any arguments. You must
|
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,
|
still supply the () then.
|
||||||
until the matching |:endfunction|. It is allowed to define another function
|
|
||||||
inside a function body.
|
It is allowed to define another function inside a function
|
||||||
|
body.
|
||||||
|
|
||||||
*local-variables*
|
*local-variables*
|
||||||
Inside a function local variables can be used. These will disappear when the
|
Inside a function local variables can be used. These will disappear when the
|
||||||
@ -10416,6 +10446,22 @@ missing: >
|
|||||||
: echo "You will _never_ see this message"
|
: echo "You will _never_ see this message"
|
||||||
:endif
|
: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<CR>
|
||||||
|
if 1
|
||||||
|
nunmap :
|
||||||
|
endif
|
||||||
|
|
||||||
|
The "<CR>" 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*
|
11. The sandbox *eval-sandbox* *sandbox* *E48*
|
||||||
|
|
||||||
|
@ -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
|
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
|
name, the file $VIMRUNTIME/scripts.vim is used to detect it from the
|
||||||
contents of the file.
|
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.
|
also sourced. See |'go-M'| about avoiding that.
|
||||||
|
|
||||||
To add your own file types, see |new-filetype| below. To search for help on a
|
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
|
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
|
editing a file of that type). The plugin will then skip installing the
|
||||||
default mapping.
|
default mapping.
|
||||||
|
*no_mail_maps*
|
||||||
3. Disable defining mappings for a specific filetype by setting a variable,
|
3. Disable defining mappings for a specific filetype by setting a variable,
|
||||||
which contains the name of the filetype. For the "mail" filetype this
|
which contains the name of the filetype. For the "mail" filetype this
|
||||||
would be: >
|
would be: >
|
||||||
:let no_mail_maps = 1
|
:let no_mail_maps = 1
|
||||||
|
< *no_plugin_maps*
|
||||||
4. Disable defining mappings for all filetypes by setting a variable: >
|
4. Disable defining mappings for all filetypes by setting a variable: >
|
||||||
:let no_plugin_maps = 1
|
:let no_plugin_maps = 1
|
||||||
<
|
<
|
||||||
@ -724,6 +724,12 @@ Format description:
|
|||||||
not recognized here as well.
|
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*
|
SQL *ft-sql*
|
||||||
|
|
||||||
Since the text for this plugin is rather long it has been put in a separate
|
Since the text for this plugin is rather long it has been put in a separate
|
||||||
|
@ -73,7 +73,7 @@ This will call a function to compute the fold level: >
|
|||||||
:set foldexpr=MyFoldLevel(v:lnum)
|
:set foldexpr=MyFoldLevel(v:lnum)
|
||||||
This will make a fold out of paragraphs separated by blank lines: >
|
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
|
: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
|
: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
|
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
|
1. If a marker with the same fold level is encountered, the previous fold
|
||||||
ends and another fold with the same level starts.
|
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.
|
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.
|
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
|
The number indicates the fold level. A zero cannot be used (a marker with
|
||||||
|
@ -116,7 +116,7 @@ NOTE: "gnat xref -v" is very tricky to use as it has almost no diagnostic
|
|||||||
then "gnat xref -v *.ad?"
|
then "gnat xref -v *.ad?"
|
||||||
4) Project manager support is completely broken - don't even try "gnat xref
|
4) Project manager support is completely broken - don't even try "gnat xref
|
||||||
-Padacl.gpr".
|
-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" .
|
--ignore-case --output=tags tags" .
|
||||||
6) Remember to insert "!_TAG_FILE_SORTED 2 %sort ui" as first line to mark
|
6) Remember to insert "!_TAG_FILE_SORTED 2 %sort ui" as first line to mark
|
||||||
the file assorted.
|
the file assorted.
|
||||||
|
237
runtime/doc/ft_rust.txt
Normal file
237
runtime/doc/ft_rust.txt
Normal file
@ -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_<D-r>*
|
||||||
|
<D-r> Executes |:RustRun| with no arguments.
|
||||||
|
Note: This binding is only available in MacVim.
|
||||||
|
|
||||||
|
*rust_<D-R>*
|
||||||
|
<D-R> 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:
|
@ -46,7 +46,8 @@ When the GUI starts up initializations are carried out, in this order:
|
|||||||
already set.
|
already set.
|
||||||
|
|
||||||
NOTE: All but the first one are not carried out if Vim was started with
|
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
|
All this happens AFTER the normal Vim initializations, like reading your
|
||||||
vimrc file. See |initialization|.
|
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.
|
what the key sequence was.
|
||||||
|
|
||||||
For creating menus in a different language, see |:menutrans|.
|
For creating menus in a different language, see |:menutrans|.
|
||||||
|
If you don't want to use menus at all, see |'go-M'|.
|
||||||
|
|
||||||
*menu.vim*
|
*menu.vim*
|
||||||
The default menus are read from the file "$VIMRUNTIME/menu.vim". See
|
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: >
|
filetypes already present at startup, add: >
|
||||||
:let do_syntax_sel_menu = 1
|
: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*
|
*console-menus*
|
||||||
Although this documentation is in the GUI section, you can actually use 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
|
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
|
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.
|
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*
|
*popup-menu*
|
||||||
You can define the special menu "PopUp". This is the menu that is displayed
|
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
|
when the right mouse button is pressed, if 'mousemodel' is set to popup or
|
||||||
|
@ -30,7 +30,7 @@ Get specific help: It is possible to go directly to whatever you want help
|
|||||||
help entries for "word".
|
help entries for "word".
|
||||||
Or use ":helpgrep word". |:helpgrep|
|
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|.
|
through the help of many others. See |credits|.
|
||||||
------------------------------------------------------------------------------
|
------------------------------------------------------------------------------
|
||||||
*doc-file-list* *Q_ct*
|
*doc-file-list* *Q_ct*
|
||||||
@ -93,7 +93,6 @@ General subjects ~
|
|||||||
|helphelp.txt| about using the help files
|
|helphelp.txt| about using the help files
|
||||||
|index.txt| alphabetical index of all commands
|
|index.txt| alphabetical index of all commands
|
||||||
|help-tags| all the tags you can jump to (index of tags)
|
|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
|
|tips.txt| various tips on using Vim
|
||||||
|message.txt| (error) messages and explanations
|
|message.txt| (error) messages and explanations
|
||||||
|develop.txt| development of Nvim
|
|develop.txt| development of Nvim
|
||||||
@ -142,6 +141,7 @@ Special issues ~
|
|||||||
|hebrew.txt| Hebrew language support and editing
|
|hebrew.txt| Hebrew language support and editing
|
||||||
|russian.txt| Russian language support and editing
|
|russian.txt| Russian language support and editing
|
||||||
|ft_ada.txt| Ada (the programming language) support
|
|ft_ada.txt| Ada (the programming language) support
|
||||||
|
|ft_rust.txt| Filetype plugin for Rust
|
||||||
|ft_sql.txt| about the SQL filetype plugin
|
|ft_sql.txt| about the SQL filetype plugin
|
||||||
|rileft.txt| right-to-left editing mode
|
|rileft.txt| right-to-left editing mode
|
||||||
|
|
||||||
@ -162,6 +162,7 @@ Standard plugins ~
|
|||||||
|pi_gzip.txt| Reading and writing compressed files
|
|pi_gzip.txt| Reading and writing compressed files
|
||||||
|pi_netrw.txt| Reading and writing files over a network
|
|pi_netrw.txt| Reading and writing files over a network
|
||||||
|pi_paren.txt| Highlight matching parens
|
|pi_paren.txt| Highlight matching parens
|
||||||
|
|pi_spec.txt| Filetype plugin to work with rpm spec files
|
||||||
|pi_tar.txt| Tar file explorer
|
|pi_tar.txt| Tar file explorer
|
||||||
|pi_zip.txt| Zip archive explorer
|
|pi_zip.txt| Zip archive explorer
|
||||||
|
|
||||||
|
@ -140,7 +140,8 @@ Help on help files *helphelp*
|
|||||||
already opened, then the location list for that window
|
already opened, then the location list for that window
|
||||||
is used. Otherwise, a new help window is opened and
|
is used. Otherwise, a new help window is opened and
|
||||||
the location list for that window is set. The
|
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* *:exusage*
|
||||||
:exu[sage] Show help on Ex commands. Added to simulate the Nvi
|
:exu[sage] Show help on Ex commands. Added to simulate the Nvi
|
||||||
|
@ -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:
|
|
@ -82,9 +82,10 @@ suggested use.)
|
|||||||
2. Cscope related commands *cscope-commands*
|
2. Cscope related commands *cscope-commands*
|
||||||
|
|
||||||
*:cscope* *:cs* *:scs* *:scscope* *E259* *E262* *E561* *E560*
|
*:cscope* *:cs* *:scs* *:scscope* *E259* *E262* *E561* *E560*
|
||||||
All cscope commands are accessed through suboptions to the main cscope
|
All cscope commands are accessed through suboptions to the cscope commands.
|
||||||
command ":cscope". The shortest abbreviation is ":cs". The ":scscope"
|
`:cscope` or `:cs` is the main command
|
||||||
command does the same and also splits the window (short: "scs").
|
`:scscope` or `:scs` does the same and splits the window
|
||||||
|
`:lcscope` or `:lcs` uses the location list, see |:lcscope|
|
||||||
|
|
||||||
The available subcommands are:
|
The available subcommands are:
|
||||||
|
|
||||||
|
@ -298,10 +298,10 @@ tag char note action in Normal mode ~
|
|||||||
|B| B 1 cursor N WORDS backward
|
|B| B 1 cursor N WORDS backward
|
||||||
|C| ["x]C 2 change from the cursor position to the end
|
|C| ["x]C 2 change from the cursor position to the end
|
||||||
of the line, and N-1 more lines [into
|
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
|
|D| ["x]D 2 delete the characters under the cursor
|
||||||
until the end of the line and N-1 more
|
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
|
|E| E 1 cursor forward to the end of WORD N
|
||||||
|F| F{char} 1 cursor to the Nth occurrence of {char} to
|
|F| F{char} 1 cursor to the Nth occurrence of {char} to
|
||||||
the left
|
the left
|
||||||
@ -318,13 +318,13 @@ tag char note action in Normal mode ~
|
|||||||
opposite direction
|
opposite direction
|
||||||
|O| O 2 begin a new line above the cursor and
|
|O| O 2 begin a new line above the cursor and
|
||||||
insert text, repeat N times
|
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
|
cursor N times
|
||||||
|Q| Q switch to "Ex" mode
|
|Q| Q switch to "Ex" mode
|
||||||
|R| R 2 enter replace mode: overtype existing
|
|R| R 2 enter replace mode: overtype existing
|
||||||
characters, repeat the entered text N-1
|
characters, repeat the entered text N-1
|
||||||
times
|
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".
|
insert; synonym for "cc".
|
||||||
|T| T{char} 1 cursor till after Nth occurrence of {char}
|
|T| T{char} 1 cursor till after Nth occurrence of {char}
|
||||||
to the left
|
to the left
|
||||||
@ -332,8 +332,8 @@ tag char note action in Normal mode ~
|
|||||||
|V| V start linewise Visual mode
|
|V| V start linewise Visual mode
|
||||||
|W| W 1 cursor N WORDS forward
|
|W| W 1 cursor N WORDS forward
|
||||||
|X| ["x]X 2 delete N characters before the cursor [into
|
|X| ["x]X 2 delete N characters before the cursor [into
|
||||||
buffer x]
|
register x]
|
||||||
|Y| ["x]Y yank N lines [into buffer x]; synonym for
|
|Y| ["x]Y yank N lines [into register x]; synonym for
|
||||||
"yy"
|
"yy"
|
||||||
|ZZ| ZZ store current file if modified, and exit
|
|ZZ| ZZ store current file if modified, and exit
|
||||||
|ZQ| ZQ exit current file always
|
|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
|
|`}| `} 1 cursor to the end of the current paragraph
|
||||||
|a| a 2 append text after the cursor N times
|
|a| a 2 append text after the cursor N times
|
||||||
|b| b 1 cursor N words backward
|
|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
|
insert
|
||||||
|cc| ["x]cc 2 delete N lines [into buffer x] and start
|
|d| ["x]d{motion} 2 delete Nmove text [into register x]
|
||||||
insert
|
|dd| ["x]dd 2 delete N lines [into register x]
|
||||||
|d| ["x]d{motion} 2 delete Nmove text [into buffer x]
|
|
||||||
|dd| ["x]dd 2 delete N lines [into buffer x]
|
|
||||||
|do| do 2 same as ":diffget"
|
|do| do 2 same as ":diffget"
|
||||||
|dp| dp 2 same as ":diffput"
|
|dp| dp 2 same as ":diffput"
|
||||||
|e| e 1 cursor forward to the end of word N
|
|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
|
|q?| q? edit ? command-line in command-line window
|
||||||
|r| r{char} 2 replace N chars with {char}
|
|r| r{char} 2 replace N chars with {char}
|
||||||
|s| ["x]s 2 (substitute) delete N characters [into
|
|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}
|
|t| t{char} 1 cursor till before Nth occurrence of {char}
|
||||||
to the right
|
to the right
|
||||||
|u| u 2 undo changes
|
|u| u 2 undo changes
|
||||||
|v| v start characterwise Visual mode
|
|v| v start characterwise Visual mode
|
||||||
|w| w 1 cursor N words forward
|
|w| w 1 cursor N words forward
|
||||||
|x| ["x]x 2 delete N characters under and after the
|
|x| ["x]x 2 delete N characters under and after the
|
||||||
cursor [into buffer x]
|
cursor [into register x]
|
||||||
|y| ["x]y{motion} yank Nmove text [into buffer x]
|
|y| ["x]y{motion} yank Nmove text [into register x]
|
||||||
|yy| ["x]yy yank N lines [into buffer x]
|
|yy| ["x]yy yank N lines [into register x]
|
||||||
|z| z{char} commands starting with 'z', see |z| below
|
|z| z{char} commands starting with 'z', see |z| below
|
||||||
|{| { 1 cursor N paragraphs backward
|
|{| { 1 cursor N paragraphs backward
|
||||||
|bar| | 1 cursor to column N
|
|bar| | 1 cursor to column N
|
||||||
@ -1542,13 +1542,17 @@ tag command action ~
|
|||||||
|:tjump| :tj[ump] like ":tselect", but jump directly when there
|
|:tjump| :tj[ump] like ":tselect", but jump directly when there
|
||||||
is only one match
|
is only one match
|
||||||
|:tlast| :tl[ast] jump to last matching tag
|
|: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
|
|:tmenu| :tm[enu] define menu tooltip
|
||||||
|:tnext| :tn[ext] jump to next matching tag
|
|: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
|
|:topleft| :to[pleft] make split window appear at top or far left
|
||||||
|:tprevious| :tp[revious] jump to previous matching tag
|
|:tprevious| :tp[revious] jump to previous matching tag
|
||||||
|:trewind| :tr[ewind] jump to first matching tag
|
|:trewind| :tr[ewind] jump to first matching tag
|
||||||
|:try| :try execute commands, abort on error or exception
|
|:try| :try execute commands, abort on error or exception
|
||||||
|:tselect| :ts[elect] list matching tags and select one
|
|: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
|
|:tunmenu| :tu[nmenu] remove menu tooltip
|
||||||
|:undo| :u[ndo] undo last change(s)
|
|:undo| :u[ndo] undo last change(s)
|
||||||
|:undojoin| :undoj[oin] join next change with previous undo block
|
|:undojoin| :undoj[oin] join next change with previous undo block
|
||||||
|
@ -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*
|
CTRL-R CTRL-O {0-9a-z"%#*+/:.-=} *i_CTRL-R_CTRL-O*
|
||||||
Insert the contents of a register literally and don't
|
Insert the contents of a register literally and don't
|
||||||
auto-indent. Does the same as pasting with the mouse
|
auto-indent. Does the same as pasting with the mouse
|
||||||
|<MiddleMouse>|.
|
|<MiddleMouse>|. When the register is linewise this will
|
||||||
|
insert the text above the current line, like with `P`.
|
||||||
Does not replace characters!
|
Does not replace characters!
|
||||||
The '.' register (last inserted text) is still inserted as
|
The '.' register (last inserted text) is still inserted as
|
||||||
typed.
|
typed.
|
||||||
@ -607,13 +608,13 @@ Completion can be done for:
|
|||||||
10. User defined completion |i_CTRL-X_CTRL-U|
|
10. User defined completion |i_CTRL-X_CTRL-U|
|
||||||
11. omni completion |i_CTRL-X_CTRL-O|
|
11. omni completion |i_CTRL-X_CTRL-O|
|
||||||
12. Spelling suggestions |i_CTRL-X_s|
|
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
|
All these, except CTRL-N and CTRL-P, are done in CTRL-X mode. This is a
|
||||||
and Replace modes. You enter CTRL-X mode by typing CTRL-X and one of the
|
sub-mode of Insert and Replace modes. You enter CTRL-X mode by typing CTRL-X
|
||||||
CTRL-X commands. You exit CTRL-X mode by typing a key that is not a valid
|
and one of the CTRL-X commands. You exit CTRL-X mode by typing a key that is
|
||||||
CTRL-X mode command. Valid keys are the CTRL-X command itself, CTRL-N (next),
|
not a valid CTRL-X mode command. Valid keys are the CTRL-X command itself,
|
||||||
and CTRL-P (previous).
|
CTRL-N (next), and CTRL-P (previous).
|
||||||
|
|
||||||
Also see the 'infercase' option if you want to adjust the case of the match.
|
Also see the 'infercase' option if you want to adjust the case of the match.
|
||||||
|
|
||||||
|
@ -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
|
contain links to the most recent version of Vim. The FAQ is a list of
|
||||||
Frequently Asked Questions. Read this if you have problems.
|
Frequently Asked Questions. Read this if you have problems.
|
||||||
|
|
||||||
VIM home page: http://www.vim.org/
|
Vim home page: http://www.vim.org/
|
||||||
VIM FAQ: http://vimdoc.sf.net/
|
Vim FAQ: http://vimdoc.sf.net/
|
||||||
Downloading: ftp://ftp.vim.org/pub/vim/MIRRORS
|
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
|
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
|
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
|
example and try to find out which settings or other things trigger the bug.
|
||||||
appearance of the bug. Try different machines, if possible. Send me patches
|
|
||||||
if you can!
|
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
|
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: >
|
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
|
Juergen Weigert Lattice version, AUX improvements, Unix and
|
||||||
MS-DOS ports, autoconf
|
MS-DOS ports, autoconf
|
||||||
Stefan 'Sec' Zehl Maintainer of vim.org
|
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
|
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
|
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
|
cursor is. There are no special characters shown, so that you can edit all
|
||||||
parts of this line.
|
parts of this line.
|
||||||
|
|
||||||
The '@' occasion in the 'highlight' option can be used to set special
|
The |hl-NonText| highlight group can be used to set special highlighting
|
||||||
highlighting for the '@' and '~' characters. This makes it possible to
|
for the '@' and '~' characters. This makes it possible to distinguish them
|
||||||
distinguish them from real characters in the buffer.
|
from real characters in the buffer.
|
||||||
|
|
||||||
The 'showbreak' option contains the string to put in front of wrapped lines.
|
The 'showbreak' option contains the string to put in front of wrapped lines.
|
||||||
|
|
||||||
@ -782,10 +791,12 @@ by Vim.
|
|||||||
==============================================================================
|
==============================================================================
|
||||||
8. Definitions *definitions*
|
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
|
screen The whole area that Vim uses to work in. This can be
|
||||||
a terminal emulator window. Also called "the Vim
|
a terminal emulator window. Also called "the Vim
|
||||||
window".
|
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
|
A screen contains one or more windows, separated by status lines and with the
|
||||||
command line at the bottom.
|
command line at the bottom.
|
||||||
|
@ -15,7 +15,7 @@ manual.
|
|||||||
1. Key mapping *key-mapping* *mapping* *macro*
|
1. Key mapping *key-mapping* *mapping* *macro*
|
||||||
|
|
||||||
Key mapping is used to change the meaning of typed keys. The most common use
|
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 <F2> a<C-R>=strftime("%c")<CR><Esc>
|
:map <F2> a<C-R>=strftime("%c")<CR><Esc>
|
||||||
|
|
||||||
@ -41,7 +41,7 @@ modes.
|
|||||||
:im[ap] {lhs} {rhs} |mapmode-i| *:im* *:imap*
|
:im[ap] {lhs} {rhs} |mapmode-i| *:im* *:imap*
|
||||||
:lm[ap] {lhs} {rhs} |mapmode-l| *:lm* *:lmap*
|
:lm[ap] {lhs} {rhs} |mapmode-l| *:lm* *:lmap*
|
||||||
:cm[ap] {lhs} {rhs} |mapmode-c| *:cm* *:cmap*
|
: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
|
Map the key sequence {lhs} to {rhs} for the modes
|
||||||
where the map command applies. The result, including
|
where the map command applies. The result, including
|
||||||
{rhs}, is then further scanned for mappings. This
|
{rhs}, is then further scanned for mappings. This
|
||||||
@ -75,7 +75,7 @@ modes.
|
|||||||
:iu[nmap] {lhs} |mapmode-i| *:iu* *:iunmap*
|
:iu[nmap] {lhs} |mapmode-i| *:iu* *:iunmap*
|
||||||
:lu[nmap] {lhs} |mapmode-l| *:lu* *:lunmap*
|
:lu[nmap] {lhs} |mapmode-l| *:lu* *:lunmap*
|
||||||
:cu[nmap] {lhs} |mapmode-c| *:cu* *:cunmap*
|
: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
|
Remove the mapping of {lhs} for the modes where the
|
||||||
map command applies. The mapping may remain defined
|
map command applies. The mapping may remain defined
|
||||||
for other modes where it applies.
|
for other modes where it applies.
|
||||||
@ -111,7 +111,7 @@ modes.
|
|||||||
:im[ap] |mapmode-i|
|
:im[ap] |mapmode-i|
|
||||||
:lm[ap] |mapmode-l|
|
:lm[ap] |mapmode-l|
|
||||||
:cm[ap] |mapmode-c|
|
:cm[ap] |mapmode-c|
|
||||||
:tm[ap] |mapmode-t|
|
:tma[p] |mapmode-t|
|
||||||
List all key mappings for the modes where the map
|
List all key mappings for the modes where the map
|
||||||
command applies. Note that ":map" and ":map!" are
|
command applies. Note that ":map" and ":map!" are
|
||||||
used most often, because they include the other modes.
|
used most often, because they include the other modes.
|
||||||
@ -126,7 +126,7 @@ modes.
|
|||||||
:im[ap] {lhs} |mapmode-i| *:imap_l*
|
:im[ap] {lhs} |mapmode-i| *:imap_l*
|
||||||
:lm[ap] {lhs} |mapmode-l| *:lmap_l*
|
:lm[ap] {lhs} |mapmode-l| *:lmap_l*
|
||||||
:cm[ap] {lhs} |mapmode-c| *:cmap_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
|
List the key mappings for the key sequences starting
|
||||||
with {lhs} in the modes where the map command applies.
|
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
|
whether to use the "," mapping or the longer one. To avoid this add the
|
||||||
<nowait> argument. Then the mapping will be used when it matches, Vim does
|
<nowait> 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
|
not wait for more characters to be typed. However, if the characters were
|
||||||
already type they are used.
|
already typed they are used.
|
||||||
|
|
||||||
*:map-<silent>* *:map-silent*
|
*:map-<silent>* *:map-silent*
|
||||||
To define a mapping which will not be echoed on the command line, add
|
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
|
you type slowly, or your system is slow, reset the 'timeout' option. Then you
|
||||||
might want to set the 'ttimeout' option.
|
might want to set the 'ttimeout' option.
|
||||||
|
|
||||||
*map-precedence*
|
*map-precedence*
|
||||||
Buffer-local mappings (defined using |:map-<buffer>|) take precedence over
|
Buffer-local mappings (defined using |:map-<buffer>|) take precedence over
|
||||||
global mappings. When a buffer-local mapping is the same as a global mapping,
|
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
|
Vim will use the buffer-local mapping. In addition, Vim will use a complete
|
||||||
|
@ -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,
|
- 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.
|
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* >
|
*W12* >
|
||||||
Warning: File "{filename}" has changed and the buffer was changed in Vim as well
|
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
|
You tried to set an option after startup that only allows changes during
|
||||||
startup.
|
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*
|
3. Messages *messages*
|
||||||
|
|
||||||
|
@ -311,7 +311,7 @@ Note: In the future more global options can be made global-local. Using
|
|||||||
|
|
||||||
Setting the filetype
|
Setting the filetype
|
||||||
|
|
||||||
:setf[iletype] {filetype} *:setf* *:setfiletype*
|
:setf[iletype] [FALLBACK] {filetype} *:setf* *:setfiletype*
|
||||||
Set the 'filetype' option to {filetype}, but only if
|
Set the 'filetype' option to {filetype}, but only if
|
||||||
not done yet in a sequence of (nested) autocommands.
|
not done yet in a sequence of (nested) autocommands.
|
||||||
This is short for: >
|
This is short for: >
|
||||||
@ -322,6 +322,12 @@ Setting the filetype
|
|||||||
setting the 'filetype' option twice, causing different
|
setting the 'filetype' option twice, causing different
|
||||||
settings and syntax files to be loaded.
|
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*
|
*option-window* *optwin*
|
||||||
:bro[wse] se[t] *:set-browse* *:browse-set* *:opt* *:options*
|
:bro[wse] se[t] *:set-browse* *:browse-set* *:opt* *:options*
|
||||||
:opt[ions] Open a window for viewing and setting all 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
|
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'.
|
"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"
|
NOTE: expanding environment variables and "~/" is only done with the ":set"
|
||||||
command, not when assigning a value to an option with ":let".
|
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
|
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.
|
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,
|
< 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.
|
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
|
When starting the GUI, the default value for 'background' will be
|
||||||
"light". When the value is not set in the gvimrc, and Vim detects
|
"light". When the value is not set in the gvimrc, and Vim detects
|
||||||
that the background is actually quite dark, 'background' is set to
|
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
|
will additionally copy the text into register
|
||||||
'*'. See |clipboard|.
|
'*'. 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'*
|
||||||
'cmdheight' 'ch' number (default 1)
|
'cmdheight' 'ch' number (default 1)
|
||||||
global
|
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
|
that this flag must be added in the vimrc file, before
|
||||||
switching on syntax or filetype recognition (when the |gvimrc|
|
switching on syntax or filetype recognition (when the |gvimrc|
|
||||||
file is sourced the system menu has already been loaded; the
|
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'*
|
*'go-g'*
|
||||||
'g' Grey menu items: Make menu items that are not active grey. If
|
'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.
|
'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.
|
WARNING: It's easy to forget that you have changes in hidden buffers.
|
||||||
Think twice when using ":q!" or ":qa!".
|
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'*
|
||||||
'history' 'hi' number (Vim default: 10000, Vi default: 0)
|
'history' 'hi' number (Vim default: 10000, Vi default: 0)
|
||||||
global
|
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
|
{not available when compiled without the
|
||||||
|+extra_search| feature}
|
|+extra_search| feature}
|
||||||
When there is a previous search pattern, highlight all its matches.
|
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
|
The |hl-Search| highlight group determines the highlighting. Note that
|
||||||
'highlight' option. This uses the "Search" highlight group by
|
only the matching text is highlighted, any offsets are not applied.
|
||||||
default. Note that only the matching text is highlighted, any offsets
|
|
||||||
are not applied.
|
|
||||||
See also: 'incsearch' and |:match|.
|
See also: 'incsearch' and |:match|.
|
||||||
When you get bored looking at the highlighted matches, you can turn it
|
When you get bored looking at the highlighted matches, you can turn it
|
||||||
off with |:nohlsearch|. This does not change the option value, as
|
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
|
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
|
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.
|
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'.
|
See also: 'hlsearch'.
|
||||||
CTRL-L can be used to add one character from after the current match
|
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
|
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+==:;
|
:au FileType c,cpp,java set mps+==:;
|
||||||
|
|
||||||
< For a more advanced way of using "%", see the matchit.vim plugin in
|
< 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'*
|
||||||
'matchtime' 'mat' number (default 5)
|
'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".
|
height with ":set scroll=0".
|
||||||
|
|
||||||
*'scrollback'* *'scbk'*
|
*'scrollback'* *'scbk'*
|
||||||
'scrollback' 'scbk' number (default: 1000
|
'scrollback' 'scbk' number (default: 10000
|
||||||
in normal buffers: -1)
|
in normal buffers: -1)
|
||||||
local to buffer
|
local to buffer
|
||||||
Maximum number of lines kept beyond the visible screen. Lines at the
|
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 <Tab> and
|
< Only printable single-cell characters are allowed, excluding <Tab> and
|
||||||
comma (in a future version the comma might be used to separate the
|
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).
|
part that is shown at the end and at the start of a line).
|
||||||
The characters are highlighted according to the '@' flag in
|
The |hl-NonText| highlight group determines the highlighting.
|
||||||
'highlight'.
|
|
||||||
Note that tabs after the showbreak will be displayed differently.
|
Note that tabs after the showbreak will be displayed differently.
|
||||||
If you want the 'showbreak' to appear in between line numbers, add the
|
If you want the 'showbreak' to appear in between line numbers, add the
|
||||||
"n" flag to 'cpoptions'.
|
"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)
|
'showmode' 'smd' boolean (Vim default: on, Vi default: off)
|
||||||
global
|
global
|
||||||
If in Insert, Replace or Visual mode put a message on the last line.
|
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
|
The |hl-ModeMsg| highlight group determines the highlighting.
|
||||||
this message.
|
|
||||||
When |XIM| may be used the message will include "XIM". But this
|
|
||||||
doesn't mean XIM is really active.
|
|
||||||
|
|
||||||
*'showtabline'* *'stal'*
|
*'showtabline'* *'stal'*
|
||||||
'showtabline' 'stal' number (default 1)
|
'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
|
Save the whole buffer for undo when reloading it. This applies to the
|
||||||
":e!" command and reloading for when the buffer changed outside of
|
":e!" command and reloading for when the buffer changed outside of
|
||||||
Vim. |FileChangedShell|
|
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.
|
of lines is smaller than the value of this option.
|
||||||
Set this option to zero to disable undo for a reload.
|
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.
|
security reasons.
|
||||||
|
|
||||||
*'viewoptions'* *'vop'*
|
*'viewoptions'* *'vop'*
|
||||||
'viewoptions' 'vop' string (default: "folds,options,cursor")
|
'viewoptions' 'vop' string (default: "folds,options,cursor,curdir")
|
||||||
global
|
global
|
||||||
{not available when compiled without the |+mksession|
|
{not available when compiled without the |+mksession|
|
||||||
feature}
|
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:
|
list of words. Each word enables saving and restoring something:
|
||||||
word save and restore ~
|
word save and restore ~
|
||||||
cursor cursor position in file and in window
|
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
|
folds manually created folds, opened/closed folds and local
|
||||||
fold options
|
fold options
|
||||||
options options and mappings local to a window or buffer (not
|
options options and mappings local to a window or buffer (not
|
||||||
|
@ -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
|
":s/[/x/" searches for "[/x" and replaces it with nothing. It does
|
||||||
not search for "[" and replaces it with "x"!
|
not search for "[" and replaces it with "x"!
|
||||||
|
|
||||||
|
*E944* *E945*
|
||||||
If the sequence begins with "^", it matches any single character NOT
|
If the sequence begins with "^", it matches any single character NOT
|
||||||
in the collection: "[^xyz]" matches anything but 'x', 'y' and 'z'.
|
in the collection: "[^xyz]" matches anything but 'x', 'y' and 'z'.
|
||||||
- If two characters in the sequence are separated by '-', this is
|
- If two characters in the sequence are separated by '-', this is
|
||||||
shorthand for the full list of ASCII characters between them. E.g.,
|
shorthand for the full list of ASCII characters between them. E.g.,
|
||||||
"[0-9]" matches any decimal digit. Non-ASCII characters can be
|
"[0-9]" matches any decimal digit. If the starting character exceeds
|
||||||
used, but the character values must not be more than 256 apart.
|
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
|
- A character class expression is evaluated to the set of characters
|
||||||
belonging to that character class. The following character classes
|
belonging to that character class. The following character classes
|
||||||
are supported:
|
are supported:
|
||||||
|
@ -23,11 +23,11 @@ Commands *health-commands*
|
|||||||
*:checkhealth* *:CheckHealth*
|
*:checkhealth* *:CheckHealth*
|
||||||
:checkhealth Run all healthchecks.
|
:checkhealth Run all healthchecks.
|
||||||
*E5009*
|
*E5009*
|
||||||
Nvim depends on the |$VIMRUNTIME| environment variable
|
Nvim depends on |$VIMRUNTIME| and 'runtimepath' to find
|
||||||
to find the standard "runtime files" for syntax
|
the standard "runtime files" for syntax highlighting,
|
||||||
highlighting, filetype-specific behavior, and standard
|
filetype-specific behavior, and standard plugins
|
||||||
plugins such as :checkhealth. If $VIMRUNTIME is invalid
|
(including :checkhealth). If the runtime files cannot
|
||||||
then those features will not work.
|
be found then those features will not work.
|
||||||
|
|
||||||
:checkhealth {plugins}
|
:checkhealth {plugins}
|
||||||
Run healthcheck(s) for one or more plugins. E.g. to run
|
Run healthcheck(s) for one or more plugins. E.g. to run
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
*pi_matchit.txt* Extended "%" matching
|
*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*
|
*matchit* *matchit.vim*
|
||||||
|
|
||||||
@ -211,7 +211,7 @@ Examples:
|
|||||||
In LaTeX, since "%" is used as the comment character, you can >
|
In LaTeX, since "%" is used as the comment character, you can >
|
||||||
:let b:match_skip = 'r:%'
|
:let b:match_skip = 'r:%'
|
||||||
< Unfortunately, this will skip anything after "\%", an escaped "%". To
|
< 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 >
|
comment character) you can >
|
||||||
:let b:match_skip = 'r:\(^\|[^\\]\)\(\\\\\)*%'
|
: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
|
The various |:vmap|s defined in the script (%, |g%|, |[%|, |]%|, |a%|) may
|
||||||
have undesired effects in Select mode |Select-mode-mapping|. At least, if you
|
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
|
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
|
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".
|
would be nice if "foo:\end\0" had the same effect as "\(foo\):\end\1".
|
||||||
|
@ -87,25 +87,25 @@ If the option is empty, then vim will use the system default printer for
|
|||||||
Macintosh: mac-roman,
|
Macintosh: mac-roman,
|
||||||
HPUX: hp-roman8)
|
HPUX: hp-roman8)
|
||||||
global
|
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
|
print character encoding file from the "print" directory in 'runtimepath' to
|
||||||
use.
|
use.
|
||||||
|
|
||||||
This option will accept any value from |encoding-names|. Any recognized names
|
This option will accept any value from |encoding-names|. Any recognized names
|
||||||
are converted to VIM standard names - see 'encoding' for more details. 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
|
not recognized by Vim will just be converted to lower case and underscores
|
||||||
replaced with '-' signs.
|
replaced with '-' signs.
|
||||||
|
|
||||||
If 'printencoding' is empty or VIM cannot find the file then it will use
|
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' (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
|
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
|
a character encoding file then it will use the "latin1" print character
|
||||||
encoding file.
|
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
|
characters to the printing encoding for printing (if 'printencoding' is empty
|
||||||
then the conversion will be to latin1). Conversion to a printing encoding
|
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
|
If no conversion is possible then printing will fail. Any characters that
|
||||||
cannot be converted will be replaced with upside down question marks.
|
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 "")
|
'printmbcharset' 'pmbcs' string (default "")
|
||||||
global
|
global
|
||||||
Sets the CJK character set to be used when generating CJK output from
|
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 ~
|
Value Description ~
|
||||||
Chinese GB_2312-80
|
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
|
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
|
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'.
|
defining the character set in the "print" directory in 'runtimepath'.
|
||||||
|
|
||||||
*pmbfn-option*
|
*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
|
possible to get all the characters in an encoding to print by installing a
|
||||||
new version of the Courier font family.
|
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
|
to the 8-bit encoding specified by 'printencoding' (or latin1 if it is
|
||||||
empty). Any characters that are not successfully converted are shown as
|
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.
|
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
|
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,
|
you can find details in the PostScript Language Reference Manual, 3rd Edition,
|
||||||
published by Addison-Wesley and available in PDF form at
|
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.
|
locate and use your print character encoding.
|
||||||
|
|
||||||
i. Decide on a unique name for your encoding vector, one that does not clash
|
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.
|
|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
|
ii. Copy $VIMRUNTIME/print/latin1.ps to the print subdirectory in your
|
||||||
'runtimepath' and rename it with your unique name.
|
'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
|
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
|
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!
|
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
|
iv. Within Vim, set 'printencoding' to your unique encoding name and then
|
||||||
print your file. VIM will now use your custom print character encoding.
|
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
|
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:.
|
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
|
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
|
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*
|
5. PostScript CJK Printing *postscript-cjk-printing*
|
||||||
*E673* *E674* *E675*
|
*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.
|
to correctly print CJK files requires setting up a few more options.
|
||||||
|
|
||||||
Each of these countries has many standard character sets and encodings which
|
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
|
which are syntax highlighted with the font styles normal, italic, bold and
|
||||||
bold-italic.
|
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:
|
Traditional Chinese fonts available at:
|
||||||
|
|
||||||
http://examples.oreilly.com/cjkvinfo/adobe/samples/
|
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
|
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
|
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
|
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
|
half-width ASCII characters with 'printmbfont'. If your font does not include
|
||||||
other characters then you will need to find another font that does.
|
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
|
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
|
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
|
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
|
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
|
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:
|
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
|
- Wrong version of the prolog resource file. The prolog resource file
|
||||||
contains some PostScript that VIM needs to be able to print. Each version
|
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
|
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
|
the runtime files, and don't have any old versions of a file called prolog
|
||||||
in the print directory in your 'runtimepath' directory.
|
in the print directory in your 'runtimepath' directory.
|
||||||
|
|
||||||
- Paper size. Some PostScript printers will abort printing a file if they do
|
- 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
|
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,
|
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
|
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
|
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
|
convert it to an n-up version. The simplest way to create a 2-up printout is
|
||||||
to first create a PostScript file with: >
|
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*
|
8. Formfeed Characters *printing-formfeed*
|
||||||
|
|
||||||
By default VIM does not do any special processing of |formfeed| control
|
By default Vim does not do any special processing of |formfeed| control
|
||||||
characters. Setting the 'printoptions' formfeed item will make VIM recognize
|
characters. Setting the 'printoptions' formfeed item will make Vim recognize
|
||||||
formfeed characters and continue printing the current line at the beginning
|
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
|
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.
|
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
|
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. 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
|
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
|
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
|
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
|
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.
|
down a line to continue printing.
|
||||||
|
|
||||||
Due to the points made above it is recommended that when formfeed character
|
Due to the points made above it is recommended that when formfeed character
|
||||||
|
@ -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
|
The 'errorformat' option should be set to match the error messages from your
|
||||||
compiler (see |errorformat| below).
|
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*
|
*location-list* *E776*
|
||||||
A location list is a window-local quickfix list. You get one after commands
|
A location list is a window-local quickfix list. You get one after commands
|
||||||
like `:lvimgrep`, `:lgrep`, `:lhelpgrep`, `:lmake`, etc., which create a
|
like `:lvimgrep`, `:lgrep`, `:lhelpgrep`, `:lmake`, etc., which create a
|
||||||
|
@ -721,7 +721,6 @@ Short explanation of each option: *option-list*
|
|||||||
'helpheight' 'hh' minimum height of a new help window
|
'helpheight' 'hh' minimum height of a new help window
|
||||||
'helplang' 'hlg' preferred help languages
|
'helplang' 'hlg' preferred help languages
|
||||||
'hidden' 'hid' don't unload buffer when it is |abandon|ed
|
'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
|
'hlsearch' 'hls' highlight matches with last search pattern
|
||||||
'history' 'hi' number of command-lines that are remembered
|
'history' 'hi' number of command-lines that are remembered
|
||||||
'hkmap' 'hk' Hebrew keyboard mapping
|
'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'
|
|:sfind| :sf[ind] {file} split window, find {file} in 'path'
|
||||||
and edit it
|
and edit it
|
||||||
|
|:terminal| :terminal {cmd} open a terminal window
|
||||||
|CTRL-W_]| CTRL-W ] split window and jump to tag under
|
|CTRL-W_]| CTRL-W ] split window and jump to tag under
|
||||||
cursor
|
cursor
|
||||||
|CTRL-W_f| CTRL-W f split window and edit file name under
|
|CTRL-W_f| CTRL-W f split window and edit file name under
|
||||||
|
@ -87,7 +87,7 @@ Tell the remote server "BLA" to write all files and exit: >
|
|||||||
vim --servername BLA --remote-send '<C-\><C-N>:wqa<CR>'
|
vim --servername BLA --remote-send '<C-\><C-N>:wqa<CR>'
|
||||||
|
|
||||||
|
|
||||||
SERVER NAME
|
SERVER NAME *client-server-name*
|
||||||
|
|
||||||
By default Vim will try to register the name under which it was invoked (gvim,
|
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
|
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.
|
the full explanation.
|
||||||
|
|
||||||
synopsis explanation ~
|
synopsis explanation ~
|
||||||
|
remote_startserver( name) run a server
|
||||||
remote_expr( server, string, idvar) send expression
|
remote_expr( server, string, idvar) send expression
|
||||||
remote_send( server, string, idvar) send key sequence
|
remote_send( server, string, idvar) send key sequence
|
||||||
serverlist() get a list of available servers
|
serverlist() get a list of available servers
|
||||||
|
@ -704,7 +704,7 @@ Additionally the following items are recognized:
|
|||||||
= Case must match exactly.
|
= Case must match exactly.
|
||||||
? Rare word.
|
? Rare word.
|
||||||
! Bad (wrong) 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.
|
specified the word is valid in all regions.
|
||||||
|
|
||||||
Example:
|
Example:
|
||||||
|
@ -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
|
5. The scroll position and the cursor position in the file. Doesn't work very
|
||||||
well when there are closed folds.
|
well when there are closed folds.
|
||||||
6. The local current directory, if it is different from the global current
|
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:
|
Note that Views and Sessions are not perfect:
|
||||||
- They don't restore everything. For example, defined functions, autocommands
|
- They don't restore everything. For example, defined functions, autocommands
|
||||||
|
@ -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
|
directory where the Vim stuff is located. For example, if your syntax files
|
||||||
are in the "/usr/vim/vim50/syntax" directory, set $VIMRUNTIME to
|
are in the "/usr/vim/vim50/syntax" directory, set $VIMRUNTIME to
|
||||||
"/usr/vim/vim50". You must do this in the shell, before starting Vim.
|
"/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*
|
*:syn-on* *:syntax-on*
|
||||||
The ":syntax enable" command will keep your current color settings. This
|
The `:syntax enable` command will keep your current color settings. This
|
||||||
allows using ":highlight" commands to set your preferred colors before or
|
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
|
after using this command. If you want Vim to overrule your settings with the
|
||||||
defaults, use: >
|
defaults, use: >
|
||||||
:syntax on
|
:syntax on
|
||||||
@ -788,12 +790,9 @@ See |mysyntaxfile-add| for installing script languages permanently.
|
|||||||
|
|
||||||
APACHE *apache.vim* *ft-apache-syntax*
|
APACHE *apache.vim* *ft-apache-syntax*
|
||||||
|
|
||||||
The apache syntax file provides syntax highlighting depending on Apache HTTP
|
The apache syntax file provides syntax highlighting for Apache HTTP server
|
||||||
server version, by default for 1.3.x. Set "apache_version" to Apache version
|
version 2.2.3.
|
||||||
(as a string) to get highlighting for another version. Example: >
|
|
||||||
|
|
||||||
:let apache_version = "2.0"
|
|
||||||
<
|
|
||||||
|
|
||||||
*asm.vim* *asmh8300.vim* *nasm.vim* *masm.vim* *asm68k*
|
*asm.vim* *asmh8300.vim* *nasm.vim* *masm.vim* *asm68k*
|
||||||
ASSEMBLY *ft-asm-syntax* *ft-asmh8300-syntax* *ft-nasm-syntax*
|
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
|
: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*
|
NCF *ncf.vim* *ft-ncf-syntax*
|
||||||
|
|
||||||
There is one option for NCF syntax highlighting.
|
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*
|
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
|
- 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
|
name of the language. Many of these don't have any attributes, but are
|
||||||
linked to a group of the second type.
|
linked to a group of the second type.
|
||||||
- The ones used for all syntax languages.
|
|
||||||
- The ones used for the 'highlight' option.
|
|
||||||
*hitest.vim*
|
*hitest.vim*
|
||||||
You can see all the groups currently active with this command: >
|
You can see all the groups currently active with this command: >
|
||||||
:so $VIMRUNTIME/syntax/hitest.vim
|
:so $VIMRUNTIME/syntax/hitest.vim
|
||||||
@ -4758,10 +4766,11 @@ ctermbg={color-nr} *highlight-ctermbg*
|
|||||||
Example: >
|
Example: >
|
||||||
:highlight Normal ctermfg=grey ctermbg=darkblue
|
:highlight Normal ctermfg=grey ctermbg=darkblue
|
||||||
< When setting the "ctermbg" color for the Normal group, the
|
< When setting the "ctermbg" color for the Normal group, the
|
||||||
'background' option will be adjusted automatically. This causes the
|
'background' option will be adjusted automatically, under the
|
||||||
highlight groups that depend on 'background' to change! This means
|
condition that the color is recognized and 'background' was not set
|
||||||
you should set the colors for Normal first, before setting other
|
explicitly. This causes the highlight groups that depend on
|
||||||
colors.
|
'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
|
When a colorscheme is being used, changing 'background' causes it to
|
||||||
be reloaded, which may reset all colors (including Normal). First
|
be reloaded, which may reset all colors (including Normal). First
|
||||||
delete the "g:colors_name" variable when you don't want this.
|
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*
|
*hl-Normal*
|
||||||
Normal normal text
|
Normal normal text
|
||||||
*hl-NormalNC*
|
*hl-NormalNC*
|
||||||
NormalNC normal text in non-current window
|
NormalNC normal text in non-current windows
|
||||||
*hl-Pmenu*
|
*hl-Pmenu*
|
||||||
Pmenu Popup menu: normal item.
|
Pmenu Popup menu: normal item.
|
||||||
*hl-PmenuSel*
|
*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
|
It is a bit of a wrong name, since it does not reset any syntax items, it only
|
||||||
affects the highlighting.
|
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
|
Note that the syntax colors that you set in your vimrc file will also be reset
|
||||||
back to their Vim default.
|
back to their Vim default.
|
||||||
Note that if you are using a color scheme, the colors defined by the color
|
Note that if you are using a color scheme, the colors defined by the color
|
||||||
|
@ -189,6 +189,7 @@ the same entry.
|
|||||||
information in the tags file(s).
|
information in the tags file(s).
|
||||||
When [ident] is not given, the last tag name from the
|
When [ident] is not given, the last tag name from the
|
||||||
tag stack is used.
|
tag stack is used.
|
||||||
|
See |tag-!| for [!].
|
||||||
With a '>' in the first column is indicated which is
|
With a '>' in the first column is indicated which is
|
||||||
the current position in the list (if there is one).
|
the current position in the list (if there is one).
|
||||||
[ident] can be a regexp pattern, see |tag-regexp|.
|
[ident] can be a regexp pattern, see |tag-regexp|.
|
||||||
|
@ -353,7 +353,7 @@ The "?" command works like "/" but searches backwards: >
|
|||||||
?word
|
?word
|
||||||
|
|
||||||
The "N" command repeats the last search the opposite direction. Thus using
|
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.
|
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
|
The $ character matches the end of a line. Therefore, "was$" matches the
|
||||||
word was only if it is at the end of a line.
|
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 ~
|
the solder holding one of the chips melted and the ~
|
||||||
xxx xxx xxx
|
xxx xxx xxx
|
||||||
|
@ -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
|
":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
|
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
|
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.
|
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.
|
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
|
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.
|
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
|
For example suppose that we are editing the file "foo.txt". Go to halfway
|
||||||
the file ("50%") and place the F mark there (F for foo): >
|
down the file ("50%") and place the F mark there (F for foo): >
|
||||||
|
|
||||||
50%mF
|
50%mF
|
||||||
|
|
||||||
@ -355,7 +355,7 @@ a sentence to the f register (f for First): >
|
|||||||
"fyas
|
"fyas
|
||||||
|
|
||||||
The "yas" command yanks a sentence like before. It's the "f that tells Vim
|
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.
|
yank command.
|
||||||
Now yank three whole lines to the l register (l for line): >
|
Now yank three whole lines to the l register (l for line): >
|
||||||
|
|
||||||
|
@ -45,7 +45,7 @@ top one:
|
|||||||
+----------------------------------+
|
+----------------------------------+
|
||||||
|
|
||||||
What you see here is two windows on the same file. The line with "====" is
|
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.)
|
practice the status line will be in reverse video.)
|
||||||
The two windows allow you to view two parts of the same file. For example,
|
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
|
you could make the top window show the variable declarations of a program, and
|
||||||
|
@ -21,7 +21,7 @@ Table of contents: |usr_toc.txt|
|
|||||||
==============================================================================
|
==============================================================================
|
||||||
*09.1* Parts of the GUI
|
*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: >
|
these commands should do it: >
|
||||||
|
|
||||||
gvim file.txt
|
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.
|
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
|
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
|
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 cannot be modified (e.g., a help file)
|
||||||
+ The file contains changes
|
+ 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
|
using the default option settings). You can paste this selection in another
|
||||||
application without any further action.
|
application without any further action.
|
||||||
For example, in this text select a few words with the mouse. Vim will
|
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
|
a file name argument, so that it displays an empty window. Click the middle
|
||||||
mouse button. The selected text will be inserted.
|
mouse button. The selected text will be inserted.
|
||||||
|
|
||||||
The "current selection" will only remain valid until some other text is
|
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 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.
|
longer is the current selection.
|
||||||
|
|
||||||
You don't need to select text with the mouse, using the keyboard commands for
|
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
|
"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.
|
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
|
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
|
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).
|
some application that shows the clipboard contents (e.g., KDE's Klipper).
|
||||||
Now select the other gVim, position the cursor somewhere and use the
|
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.
|
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
|
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.
|
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.
|
- Select two words in Visual mode.
|
||||||
- Use the Edit/Copy menu to get these words onto the clipboard.
|
- Use the Edit/Copy menu to get these words onto the clipboard.
|
||||||
|
@ -278,7 +278,7 @@ command: >
|
|||||||
The line range "%" is used, thus this works on the whole file. The pattern
|
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
|
that the ":substitute" command matches with is "\s\+$". This finds white
|
||||||
space characters (\s), 1 or more of them (\+), before the end-of-line ($).
|
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
|
The "to" part of the substitute command is empty: "//". Thus it replaces
|
||||||
with nothing, effectively deleting the matched white space.
|
with nothing, effectively deleting the matched white space.
|
||||||
|
|
||||||
|
@ -888,6 +888,7 @@ GUI: *gui-functions*
|
|||||||
|
|
||||||
Vim server: *server-functions*
|
Vim server: *server-functions*
|
||||||
serverlist() return the list of server names
|
serverlist() return the list of server names
|
||||||
|
remote_startserver() run a server
|
||||||
remote_send() send command characters to a Vim server
|
remote_send() send command characters to a Vim server
|
||||||
remote_expr() evaluate an expression in a Vim server
|
remote_expr() evaluate an expression in a Vim server
|
||||||
server2client() send a reply to a client of a Vim server
|
server2client() send a reply to a client of a Vim server
|
||||||
@ -2226,8 +2227,8 @@ plugin for the mail filetype: >
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
Two global variables are used:
|
Two global variables are used:
|
||||||
no_plugin_maps disables mappings for all filetype plugins
|
|no_plugin_maps| disables mappings for all filetype plugins
|
||||||
no_mail_maps disables mappings for a specific filetype
|
|no_mail_maps| disables mappings for the "mail" filetype
|
||||||
|
|
||||||
|
|
||||||
USER COMMANDS
|
USER COMMANDS
|
||||||
|
@ -686,7 +686,7 @@ that included files do this too, you might have to reset "b:current_syntax" if
|
|||||||
you include two files.
|
you include two files.
|
||||||
|
|
||||||
If you want your syntax file to work with Vim 5.x, add a check for v:version.
|
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',
|
Do not include anything that is a user preference. Don't set 'tabstop',
|
||||||
'expandtab', etc. These belong in a filetype plugin.
|
'expandtab', etc. These belong in a filetype plugin.
|
||||||
|
@ -102,8 +102,7 @@ g8 Print the hex values of the bytes used in the
|
|||||||
*:nu* *:number*
|
*:nu* *:number*
|
||||||
:[range]nu[mber] [count] [flags]
|
:[range]nu[mber] [count] [flags]
|
||||||
Same as :print, but precede each line with its line
|
Same as :print, but precede each line with its line
|
||||||
number. (See also 'highlight' and 'numberwidth'
|
number. (See also |hl-LineNr| and 'numberwidth').
|
||||||
option).
|
|
||||||
See |ex-flags| for [flags].
|
See |ex-flags| for [flags].
|
||||||
|
|
||||||
*:#*
|
*:#*
|
||||||
@ -325,7 +324,7 @@ N *+cindent* |'cindent'|, C indenting
|
|||||||
N *+clientserver* Unix and Win32: Remote invocation |clientserver|
|
N *+clientserver* Unix and Win32: Remote invocation |clientserver|
|
||||||
*+clipboard* |clipboard| support
|
*+clipboard* |clipboard| support
|
||||||
N *+cmdline_compl* command line completion |cmdline-completion|
|
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 *+cmdline_info* |'showcmd'| and |'ruler'|
|
||||||
N *+comments* |'comments'| support
|
N *+comments* |'comments'| support
|
||||||
B *+conceal* "conceal" support, see |conceal| |:syn-conceal| etc.
|
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* Compiled with the |iconv()| function
|
||||||
*+iconv/dyn* Likewise |iconv-dynamic| |/dyn|
|
*+iconv/dyn* Likewise |iconv-dynamic| |/dyn|
|
||||||
N *+insert_expand* |insert_expand| Insert mode completion
|
N *+insert_expand* |insert_expand| Insert mode completion
|
||||||
N *+jumplist* |jumplist|
|
S *+jumplist* |jumplist|
|
||||||
B *+keymap* |'keymap'|
|
B *+keymap* |'keymap'|
|
||||||
N *+lambda* |lambda| and |closure|
|
N *+lambda* |lambda| and |closure|
|
||||||
B *+langmap* |'langmap'|
|
B *+langmap* |'langmap'|
|
||||||
@ -397,14 +396,14 @@ N *+timers* the |timer_start()| function
|
|||||||
N *+title* Setting the window 'title' and 'icon'
|
N *+title* Setting the window 'title' and 'icon'
|
||||||
N *+toolbar* |gui-toolbar|
|
N *+toolbar* |gui-toolbar|
|
||||||
N *+user_commands* User-defined commands. |user-commands|
|
N *+user_commands* User-defined commands. |user-commands|
|
||||||
N *+vertsplit* Vertically split windows |:vsplit|
|
*+vertsplit* Vertically split windows |:vsplit|
|
||||||
N *+virtualedit* |'virtualedit'|
|
N *+virtualedit* |'virtualedit'|
|
||||||
S *+visual* Visual mode |Visual-mode| Always enabled since 7.4.200.
|
S *+visual* Visual mode |Visual-mode| Always enabled since 7.4.200.
|
||||||
N *+visualextra* extra Visual mode commands |blockwise-operators|
|
N *+visualextra* extra Visual mode commands |blockwise-operators|
|
||||||
N *+vreplace* |gR| and |gr|
|
N *+vreplace* |gR| and |gr|
|
||||||
N *+wildignore* |'wildignore'|
|
N *+wildignore* |'wildignore'|
|
||||||
N *+wildmenu* |'wildmenu'|
|
N *+wildmenu* |'wildmenu'|
|
||||||
S *+windows* more than one window
|
*+windows* more than one window
|
||||||
m *+writebackup* |'writebackup'| is default on
|
m *+writebackup* |'writebackup'| is default on
|
||||||
m *+xim* X input method |xim|
|
m *+xim* X input method |xim|
|
||||||
*+xfontset* X fontset support |xfontset|
|
*+xfontset* X fontset support |xfontset|
|
||||||
|
@ -159,6 +159,7 @@ Events:
|
|||||||
|TextYankPost|
|
|TextYankPost|
|
||||||
|
|
||||||
Highlight groups:
|
Highlight groups:
|
||||||
|
|hl-NormalNC| highlights non-current windows
|
||||||
|hl-QuickFixLine|
|
|hl-QuickFixLine|
|
||||||
|hl-Substitute|
|
|hl-Substitute|
|
||||||
|hl-TermCursor|
|
|hl-TermCursor|
|
||||||
@ -298,6 +299,8 @@ Highlight groups:
|
|||||||
|hl-ColorColumn|, |hl-CursorColumn| are lower priority than most other
|
|hl-ColorColumn|, |hl-CursorColumn| are lower priority than most other
|
||||||
groups
|
groups
|
||||||
|
|
||||||
|
The variable name "count" is no fallback for |v:count| anymore.
|
||||||
|
|
||||||
==============================================================================
|
==============================================================================
|
||||||
5. Missing legacy features *nvim-features-missing*
|
5. Missing legacy features *nvim-features-missing*
|
||||||
|
|
||||||
@ -377,7 +380,7 @@ Other options:
|
|||||||
'esckeys'
|
'esckeys'
|
||||||
'guioptions' "t" flag was removed
|
'guioptions' "t" flag was removed
|
||||||
*'guipty'* (Nvim uses pipes and PTYs consistently on all platforms.)
|
*'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'*
|
*'imactivatefunc'* *'imaf'*
|
||||||
*'imactivatekey'* *'imak'*
|
*'imactivatekey'* *'imak'*
|
||||||
*'imstatusfunc'* *'imsf'*
|
*'imstatusfunc'* *'imsf'*
|
||||||
|
@ -25,8 +25,7 @@ Using Visual mode consists of three parts:
|
|||||||
3. Type an operator command.
|
3. Type an operator command.
|
||||||
The highlighted characters will be operated upon.
|
The highlighted characters will be operated upon.
|
||||||
|
|
||||||
The 'highlight' option can be used to set the display mode to use for
|
The |hl-Visual| group determines the highlighting of the visual selection.
|
||||||
highlighting in Visual mode.
|
|
||||||
The 'virtualedit' option can be used to allow positioning the cursor to
|
The 'virtualedit' option can be used to allow positioning the cursor to
|
||||||
positions where there is no actual character.
|
positions where there is no actual character.
|
||||||
|
|
||||||
|
@ -106,18 +106,10 @@ This option can be local to the window, so that you can have a different
|
|||||||
status line in each window.
|
status line in each window.
|
||||||
|
|
||||||
Normally, inversion is used to display the status line. This can be changed
|
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
|
with the |hl-StatusLine| highlight group. If no highlighting is used for the
|
||||||
bold characters. If no highlighting is used for the status line ("sn"), the
|
status line, the '^' character is used for the current window, and '=' for
|
||||||
'^' character is used for the current window, and '=' for other windows. If
|
other windows. If 'mouse' is enabled, a status line can be dragged to resize
|
||||||
the mouse is supported and enabled with the 'mouse' option, a status line can
|
windows.
|
||||||
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.
|
|
||||||
|
|
||||||
==============================================================================
|
==============================================================================
|
||||||
3. Opening and closing a window *opening-window* *E36*
|
3. Opening and closing a window *opening-window* *E36*
|
||||||
@ -319,8 +311,9 @@ CTRL-W CTRL-C *CTRL-W_CTRL-C*
|
|||||||
*:hide*
|
*:hide*
|
||||||
:hid[e]
|
:hid[e]
|
||||||
:{count}hid[e]
|
:{count}hid[e]
|
||||||
Quit the current window, unless it is the last window on the
|
Without {count}: Quit the current window, unless it is the
|
||||||
screen. For {count} see |:quit|.
|
last window on the screen.
|
||||||
|
If {count} is given quit the {count} window.
|
||||||
|
|
||||||
The buffer becomes hidden (unless there is another window
|
The buffer becomes hidden (unless there is another window
|
||||||
editing it or 'bufhidden' is `unload`, `delete` or `wipe`).
|
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
|
41. :buffers list of buffers
|
||||||
|
|
||||||
The meaning of [N] depends on the command:
|
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 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 buffer number, defaulting to current buffer, for 11 and 31
|
||||||
[N] is a count for 19 and 39
|
[N] is a count for 19 and 39
|
||||||
@ -1002,6 +996,9 @@ list of buffers. |unlisted-buffer|
|
|||||||
displayed in a window |hidden-buffer|
|
displayed in a window |hidden-buffer|
|
||||||
- a buffer with 'modifiable' off
|
- a buffer with 'modifiable' off
|
||||||
= a readonly buffer
|
= 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
|
+ a modified buffer
|
||||||
x a buffer with read errors
|
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
|
and can't be changed. The 'buflisted' option will be reset
|
||||||
for a help buffer.
|
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
|
directory Displays directory contents. Can be used by a file explorer
|
||||||
plugin. The buffer is created with these settings: >
|
plugin. The buffer is created with these settings: >
|
||||||
:setlocal buftype=nowrite
|
:setlocal buftype=nowrite
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
" Vim support file to detect file types
|
" Vim support file to detect file types
|
||||||
"
|
"
|
||||||
" Maintainer: Bram Moolenaar <Bram@vim.org>
|
" Maintainer: Bram Moolenaar <Bram@vim.org>
|
||||||
" Last Change: 2017 Mar 13
|
" Last Change: 2017 Nov 02
|
||||||
|
|
||||||
" Listen very carefully, I will say this only once
|
" Listen very carefully, I will say this only once
|
||||||
if exists("did_load_filetypes")
|
if exists("did_load_filetypes")
|
||||||
@ -284,14 +284,15 @@ au BufNewFile,BufRead *.bib setf bib
|
|||||||
au BufNewFile,BufRead *.bst setf bst
|
au BufNewFile,BufRead *.bst setf bst
|
||||||
|
|
||||||
" BIND configuration
|
" 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
|
" BIND zone
|
||||||
au BufNewFile,BufRead named.root setf bindzone
|
au BufNewFile,BufRead named.root setf bindzone
|
||||||
au BufNewFile,BufRead *.db call s:BindzoneCheck('')
|
au BufNewFile,BufRead *.db call s:BindzoneCheck('')
|
||||||
|
|
||||||
func! s:BindzoneCheck(default)
|
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
|
setf bindzone
|
||||||
elseif a:default != ''
|
elseif a:default != ''
|
||||||
exe 'setf ' . 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
|
au BufNewFile,BufRead dictd.conf setf dictdconf
|
||||||
|
|
||||||
" Diff files
|
" 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
|
" Dircolors
|
||||||
au BufNewFile,BufRead .dir_colors,.dircolors,*/etc/DIR_COLORS setf 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
|
au BufNewFile,BufRead $XDG_CONFIG_HOME/git/config setf gitconfig
|
||||||
endif
|
endif
|
||||||
au BufNewFile,BufRead git-rebase-todo setf gitrebase
|
au BufNewFile,BufRead git-rebase-todo setf gitrebase
|
||||||
|
au BufRead,BufNewFile .gitsendemail.msg.?????? setf gitsendemail
|
||||||
au BufNewFile,BufRead .msg.[0-9]*
|
au BufNewFile,BufRead .msg.[0-9]*
|
||||||
\ if getline(1) =~ '^From.*# This line is ignored.$' |
|
\ if getline(1) =~ '^From.*# This line is ignored.$' |
|
||||||
\ setf gitsendemail |
|
\ setf gitsendemail |
|
||||||
@ -975,7 +983,7 @@ au BufNewFile,BufRead */etc/initng/*/*.i,*.ii setf initng
|
|||||||
|
|
||||||
" Innovation Data Processing
|
" Innovation Data Processing
|
||||||
au BufRead,BufNewFile upstream.dat\c,upstream.*.dat\c,*.upstream.dat\c setf upstreamdat
|
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 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 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
|
au BufRead,BufNewFile usw2kagt.log\c,usw2kagt.*.log\c,*.usw2kagt.log\c setf usw2kagtlog
|
||||||
@ -1139,8 +1147,8 @@ au BufNewFile,BufRead *.m4
|
|||||||
" MaGic Point
|
" MaGic Point
|
||||||
au BufNewFile,BufRead *.mgp setf mgp
|
au BufNewFile,BufRead *.mgp setf mgp
|
||||||
|
|
||||||
" Mail (for Elm, trn, mutt, muttng, rn, slrn)
|
" 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\},ae\d\+.txt,/tmp/SLRN[0-9A-Z.]\+,*.eml setf mail
|
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
|
" Mail aliases
|
||||||
au BufNewFile,BufRead */etc/mail/aliases,*/etc/aliases setf mailaliases
|
au BufNewFile,BufRead */etc/mail/aliases,*/etc/aliases setf mailaliases
|
||||||
@ -1316,6 +1324,9 @@ au BufNewFile,BufRead */etc/nanorc,*.nanorc setf nanorc
|
|||||||
" Natural
|
" Natural
|
||||||
au BufNewFile,BufRead *.NS[ACGLMNPS] setf natural
|
au BufNewFile,BufRead *.NS[ACGLMNPS] setf natural
|
||||||
|
|
||||||
|
" Noemutt setup file
|
||||||
|
au BufNewFile,BufRead Neomuttrc setf neomuttrc
|
||||||
|
|
||||||
" Netrc
|
" Netrc
|
||||||
au BufNewFile,BufRead .netrc setf netrc
|
au BufNewFile,BufRead .netrc setf netrc
|
||||||
|
|
||||||
@ -1407,14 +1418,17 @@ au BufNewFile,BufRead *.dpr setf pascal
|
|||||||
" PDF
|
" PDF
|
||||||
au BufNewFile,BufRead *.pdf setf pdf
|
au BufNewFile,BufRead *.pdf setf pdf
|
||||||
|
|
||||||
|
" PCMK - HAE - crm configure edit
|
||||||
|
au BufNewFile,BufRead *.pcmk setf pcmk
|
||||||
|
|
||||||
" Perl
|
" Perl
|
||||||
if has("fname_case")
|
if has("fname_case")
|
||||||
au BufNewFile,BufRead *.pl,*.PL call s:FTpl()
|
au BufNewFile,BufRead *.pl,*.PL call s:FTpl()
|
||||||
else
|
else
|
||||||
au BufNewFile,BufRead *.pl call s:FTpl()
|
au BufNewFile,BufRead *.pl call s:FTpl()
|
||||||
endif
|
endif
|
||||||
au BufNewFile,BufRead *.plx,*.al setf perl
|
au BufNewFile,BufRead *.plx,*.al,*.psgi setf perl
|
||||||
au BufNewFile,BufRead *.p6,*.pm6,*.pl6 setf perl6
|
au BufNewFile,BufRead *.p6,*.pm6,*.pl6 setf perl6
|
||||||
|
|
||||||
func! s:FTpl()
|
func! s:FTpl()
|
||||||
if exists("g:filetype_pl")
|
if exists("g:filetype_pl")
|
||||||
@ -1801,6 +1815,9 @@ au BufNewFile,BufRead *.sa setf sather
|
|||||||
" Scala
|
" Scala
|
||||||
au BufNewFile,BufRead *.scala setf scala
|
au BufNewFile,BufRead *.scala setf scala
|
||||||
|
|
||||||
|
" SBT - Scala Build Tool
|
||||||
|
au BufNewFile,BufRead *.sbt setf sbt
|
||||||
|
|
||||||
" Scilab
|
" Scilab
|
||||||
au BufNewFile,BufRead *.sci,*.sce setf 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
|
au BufNewFile,BufRead sshd_config setf sshdconfig
|
||||||
|
|
||||||
" Stata
|
" 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
|
" SMCL
|
||||||
au BufNewFile,BufRead *.hlp,*.ihlp,*.smcl setf smcl
|
au BufNewFile,BufRead *.hlp,*.ihlp,*.smcl setf smcl
|
||||||
@ -2222,6 +2242,8 @@ func! s:FTtex()
|
|||||||
let format = tolower(matchstr(firstline, '\a\+'))
|
let format = tolower(matchstr(firstline, '\a\+'))
|
||||||
let format = substitute(format, 'pdf', '', '')
|
let format = substitute(format, 'pdf', '', '')
|
||||||
if format == 'tex'
|
if format == 'tex'
|
||||||
|
let format = 'latex'
|
||||||
|
elseif format == 'plaintex'
|
||||||
let format = 'plain'
|
let format = 'plain'
|
||||||
endif
|
endif
|
||||||
else
|
else
|
||||||
@ -2392,6 +2414,9 @@ au BufNewFile,BufRead *.wbt setf winbatch
|
|||||||
" WSML
|
" WSML
|
||||||
au BufNewFile,BufRead *.wsml setf wsml
|
au BufNewFile,BufRead *.wsml setf wsml
|
||||||
|
|
||||||
|
" WPL
|
||||||
|
au BufNewFile,BufRead *.wpl setf xml
|
||||||
|
|
||||||
" WvDial
|
" WvDial
|
||||||
au BufNewFile,BufRead wvdial.conf,.wvdialrc setf 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')
|
au BufNewFile,BufRead [rR]akefile* call s:StarSetf('ruby')
|
||||||
|
|
||||||
" Mail (also matches muttrc.vim, so this is below the other checks)
|
" 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')
|
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,}/mutt{ng,}rc* call s:StarSetf('muttrc')
|
||||||
au BufNewFile,BufRead mutt{ng,}rc*,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
|
" Nroff macros
|
||||||
au BufNewFile,BufRead tmac.* call s:StarSetf('nroff')
|
au BufNewFile,BufRead tmac.* call s:StarSetf('nroff')
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
" Vim filetype plugin file
|
" Vim filetype plugin file
|
||||||
" Language: C
|
" Language: C
|
||||||
" Maintainer: Bram Moolenaar <Bram@vim.org>
|
" Maintainer: Bram Moolenaar <Bram@vim.org>
|
||||||
" Last Change: 2016 Jun 12
|
" Last Change: 2017 Sep 28
|
||||||
|
|
||||||
" Only do this when not done yet for this buffer
|
" Only do this when not done yet for this buffer
|
||||||
if exists("b:did_ftplugin")
|
if exists("b:did_ftplugin")
|
||||||
@ -30,8 +30,8 @@ endif
|
|||||||
setlocal comments=sO:*\ -,mO:*\ \ ,exO:*/,s1:/*,mb:*,ex:*/,://
|
setlocal comments=sO:*\ -,mO:*\ \ ,exO:*/,s1:/*,mb:*,ex:*/,://
|
||||||
|
|
||||||
" When the matchit plugin is loaded, this makes the % command skip parens and
|
" When the matchit plugin is loaded, this makes the % command skip parens and
|
||||||
" braces in comments.
|
" braces in comments properly.
|
||||||
let b:match_words = &matchpairs . ',^\s*#\s*if\(\|def\|ndef\)\>:^\s*#\s*elif\>:^\s*#\s*else\>:^\s*#\s*endif\>'
|
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'
|
let b:match_skip = 's:comment\|string\|character\|special'
|
||||||
|
|
||||||
" Win32 can filter files in the browse dialog
|
" Win32 can filter files in the browse dialog
|
||||||
|
12
runtime/ftplugin/gdb.vim
Normal file
12
runtime/ftplugin/gdb.vim
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
" Vim filetype plugin file
|
||||||
|
" Language: gdb
|
||||||
|
" Maintainer: Michaël Peeters <NOSPAMm.vim@noekeon.org>
|
||||||
|
" 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<"
|
@ -2,7 +2,7 @@
|
|||||||
" Language: Hamster Script
|
" Language: Hamster Script
|
||||||
" Version: 2.0.6.0
|
" Version: 2.0.6.0
|
||||||
" Maintainer: David Fishburn <dfishburn dot vim at gmail dot com>
|
" Maintainer: David Fishburn <dfishburn dot vim at gmail dot com>
|
||||||
" Last Change: 2017 Mar 07
|
" Last Change: 2017 Mar 18
|
||||||
|
|
||||||
" Only do this when not done yet for this buffer
|
" Only do this when not done yet for this buffer
|
||||||
if exists("b:did_ftplugin")
|
if exists("b:did_ftplugin")
|
||||||
@ -14,7 +14,6 @@ let b:did_ftplugin = 1
|
|||||||
|
|
||||||
let s:cpo_save = &cpo
|
let s:cpo_save = &cpo
|
||||||
set cpo&vim
|
set cpo&vim
|
||||||
set cpo-=C
|
|
||||||
|
|
||||||
let b:undo_ftplugin = "setl fo< com< tw< commentstring<"
|
let b:undo_ftplugin = "setl fo< com< tw< commentstring<"
|
||||||
\ . "| unlet! b:match_ignorecase b:match_words b:match_skip"
|
\ . "| unlet! b:match_ignorecase b:match_words b:match_skip"
|
||||||
|
23
runtime/ftplugin/neomuttrc.vim
Normal file
23
runtime/ftplugin/neomuttrc.vim
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
" Vim filetype plugin file
|
||||||
|
" Language: NeoMutt RC File
|
||||||
|
" Previous Maintainer: Guillaume Brogi <gui-gui@netcourrier.com>
|
||||||
|
" 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
|
@ -3,7 +3,7 @@
|
|||||||
" Maintainer: vim-perl <vim-perl@googlegroups.com>
|
" Maintainer: vim-perl <vim-perl@googlegroups.com>
|
||||||
" Homepage: http://github.com/vim-perl/vim-perl
|
" Homepage: http://github.com/vim-perl/vim-perl
|
||||||
" Bugs/requests: http://github.com/vim-perl/vim-perl/issues
|
" 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
|
if exists("b:did_ftplugin") | finish | endif
|
||||||
let b:did_ftplugin = 1
|
let b:did_ftplugin = 1
|
||||||
@ -33,14 +33,14 @@ endif
|
|||||||
setlocal include=\\<\\(use\\\|require\\)\\>
|
setlocal include=\\<\\(use\\\|require\\)\\>
|
||||||
setlocal includeexpr=substitute(substitute(substitute(v:fname,'::','/','g'),'->\*','',''),'$','.pm','')
|
setlocal includeexpr=substitute(substitute(substitute(v:fname,'::','/','g'),'->\*','',''),'$','.pm','')
|
||||||
setlocal define=[^A-Za-z_]
|
setlocal define=[^A-Za-z_]
|
||||||
|
setlocal iskeyword+=:
|
||||||
|
|
||||||
" The following line changes a global variable but is necessary to make
|
" The following line changes a global variable but is necessary to make
|
||||||
" gf and similar commands work. The change to iskeyword was incorrect.
|
" gf and similar commands work. Thanks to Andrew Pimlott for pointing
|
||||||
" Thanks to Andrew Pimlott for pointing out the problem. If this causes a
|
" out the problem. If this causes a problem for you, add an
|
||||||
" problem for you, add an after/ftplugin/perl.vim file that contains
|
" after/ftplugin/perl.vim file that contains
|
||||||
" set isfname-=:
|
" set isfname-=:
|
||||||
set isfname+=:
|
set isfname+=:
|
||||||
set iskeyword+=:
|
|
||||||
|
|
||||||
" Set this once, globally.
|
" Set this once, globally.
|
||||||
if !exists("perlpath")
|
if !exists("perlpath")
|
||||||
@ -77,11 +77,12 @@ endif
|
|||||||
"---------------------------------------------
|
"---------------------------------------------
|
||||||
|
|
||||||
" Undo the stuff we changed.
|
" 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"
|
\ " | unlet! b:browsefilter"
|
||||||
|
|
||||||
" proper matching for matchit plugin
|
" proper matching for matchit plugin
|
||||||
let b:match_skip = 's:comment\|string\|perlQQ\|perlShellCommand\|perlHereDoc\|perlSubstitution\|perlTranslation\|perlMatch\|perlFormatField'
|
let b:match_skip = 's:comment\|string\|perlQQ\|perlShellCommand\|perlHereDoc\|perlSubstitution\|perlTranslation\|perlMatch\|perlFormatField'
|
||||||
|
let b:match_words = '\<if\>:\<elsif\>:\<else\>'
|
||||||
|
|
||||||
" Restore the saved compatibility options.
|
" Restore the saved compatibility options.
|
||||||
let &cpo = s:save_cpo
|
let &cpo = s:save_cpo
|
||||||
|
@ -1,9 +1,10 @@
|
|||||||
" Vim filetype plugin file
|
" Vim filetype plugin file
|
||||||
" Language: python
|
" Language: python
|
||||||
" Maintainer: James Sully <sullyj3@gmail.com>
|
" Maintainer: Tom Picton <tom@tompicton.co.uk>
|
||||||
|
" Previous Maintainer: James Sully <sullyj3@gmail.com>
|
||||||
" Previous Maintainer: Johannes Zellner <johannes@zellner.org>
|
" Previous Maintainer: Johannes Zellner <johannes@zellner.org>
|
||||||
" Last Change: Tue, 09 October 2016
|
" Last Change: Fri, 20 October 2017
|
||||||
" https://github.com/sullyj3/vim-ftplugin-python
|
" https://github.com/tpict/vim-ftplugin-python
|
||||||
|
|
||||||
if exists("b:did_ftplugin") | finish | endif
|
if exists("b:did_ftplugin") | finish | endif
|
||||||
let b:did_ftplugin = 1
|
let b:did_ftplugin = 1
|
||||||
@ -24,31 +25,51 @@ set wildignore+=*.pyc
|
|||||||
|
|
||||||
let b:next_toplevel='\v%$\|^(class\|def\|async def)>'
|
let b:next_toplevel='\v%$\|^(class\|def\|async def)>'
|
||||||
let b:prev_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:next='\v%$\|^\s*(class\|def\|async def)>'
|
||||||
let b:prev='\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 <silent> <buffer> ]] :call <SID>Python_jump('n', '". b:next_toplevel."', 'W')<cr>"
|
execute "nnoremap <silent> <buffer> ]] :call <SID>Python_jump('n', '". b:next_toplevel."', 'W')<cr>"
|
||||||
execute "nnoremap <silent> <buffer> [[ :call <SID>Python_jump('n', '". b:prev_toplevel."', 'Wb')<cr>"
|
execute "nnoremap <silent> <buffer> [[ :call <SID>Python_jump('n', '". b:prev_toplevel."', 'Wb')<cr>"
|
||||||
|
execute "nnoremap <silent> <buffer> ][ :call <SID>Python_jump('n', '". b:next_endtoplevel."', 'W', 0)<cr>"
|
||||||
|
execute "nnoremap <silent> <buffer> [] :call <SID>Python_jump('n', '". b:prev_endtoplevel."', 'Wb', 0)<cr>"
|
||||||
execute "nnoremap <silent> <buffer> ]m :call <SID>Python_jump('n', '". b:next."', 'W')<cr>"
|
execute "nnoremap <silent> <buffer> ]m :call <SID>Python_jump('n', '". b:next."', 'W')<cr>"
|
||||||
execute "nnoremap <silent> <buffer> [m :call <SID>Python_jump('n', '". b:prev."', 'Wb')<cr>"
|
execute "nnoremap <silent> <buffer> [m :call <SID>Python_jump('n', '". b:prev."', 'Wb')<cr>"
|
||||||
|
execute "nnoremap <silent> <buffer> ]M :call <SID>Python_jump('n', '". b:next_end."', 'W', 0)<cr>"
|
||||||
|
execute "nnoremap <silent> <buffer> [M :call <SID>Python_jump('n', '". b:prev_end."', 'Wb', 0)<cr>"
|
||||||
|
|
||||||
execute "onoremap <silent> <buffer> ]] :call <SID>Python_jump('o', '". b:next_toplevel."', 'W')<cr>"
|
execute "onoremap <silent> <buffer> ]] :call <SID>Python_jump('o', '". b:next_toplevel."', 'W')<cr>"
|
||||||
execute "onoremap <silent> <buffer> [[ :call <SID>Python_jump('o', '". b:prev_toplevel."', 'Wb')<cr>"
|
execute "onoremap <silent> <buffer> [[ :call <SID>Python_jump('o', '". b:prev_toplevel."', 'Wb')<cr>"
|
||||||
|
execute "onoremap <silent> <buffer> ][ :call <SID>Python_jump('n', '". b:next_endtoplevel."', 'W', 0)<cr>"
|
||||||
|
execute "onoremap <silent> <buffer> [] :call <SID>Python_jump('n', '". b:prev_endtoplevel."', 'Wb', 0)<cr>"
|
||||||
execute "onoremap <silent> <buffer> ]m :call <SID>Python_jump('o', '". b:next."', 'W')<cr>"
|
execute "onoremap <silent> <buffer> ]m :call <SID>Python_jump('o', '". b:next."', 'W')<cr>"
|
||||||
execute "onoremap <silent> <buffer> [m :call <SID>Python_jump('o', '". b:prev."', 'Wb')<cr>"
|
execute "onoremap <silent> <buffer> [m :call <SID>Python_jump('o', '". b:prev."', 'Wb')<cr>"
|
||||||
|
execute "onoremap <silent> <buffer> ]M :call <SID>Python_jump('o', '". b:next_end."', 'W', 0)<cr>"
|
||||||
|
execute "onoremap <silent> <buffer> [M :call <SID>Python_jump('o', '". b:prev_end."', 'Wb', 0)<cr>"
|
||||||
|
|
||||||
execute "xnoremap <silent> <buffer> ]] :call <SID>Python_jump('x', '". b:next_toplevel."', 'W')<cr>"
|
execute "xnoremap <silent> <buffer> ]] :call <SID>Python_jump('x', '". b:next_toplevel."', 'W')<cr>"
|
||||||
execute "xnoremap <silent> <buffer> [[ :call <SID>Python_jump('x', '". b:prev_toplevel."', 'Wb')<cr>"
|
execute "xnoremap <silent> <buffer> [[ :call <SID>Python_jump('x', '". b:prev_toplevel."', 'Wb')<cr>"
|
||||||
|
execute "xnoremap <silent> <buffer> ][ :call <SID>Python_jump('n', '". b:next_endtoplevel."', 'W', 0)<cr>"
|
||||||
|
execute "xnoremap <silent> <buffer> [] :call <SID>Python_jump('n', '". b:prev_endtoplevel."', 'Wb', 0)<cr>"
|
||||||
execute "xnoremap <silent> <buffer> ]m :call <SID>Python_jump('x', '". b:next."', 'W')<cr>"
|
execute "xnoremap <silent> <buffer> ]m :call <SID>Python_jump('x', '". b:next."', 'W')<cr>"
|
||||||
execute "xnoremap <silent> <buffer> [m :call <SID>Python_jump('x', '". b:prev."', 'Wb')<cr>"
|
execute "xnoremap <silent> <buffer> [m :call <SID>Python_jump('x', '". b:prev."', 'Wb')<cr>"
|
||||||
|
execute "xnoremap <silent> <buffer> ]M :call <SID>Python_jump('x', '". b:next_end."', 'W', 0)<cr>"
|
||||||
|
execute "xnoremap <silent> <buffer> [M :call <SID>Python_jump('x', '". b:prev_end."', 'Wb', 0)<cr>"
|
||||||
|
|
||||||
if !exists('*<SID>Python_jump')
|
if !exists('*<SID>Python_jump')
|
||||||
fun! <SID>Python_jump(mode, motion, flags) range
|
fun! <SID>Python_jump(mode, motion, flags, ...) range
|
||||||
|
let l:startofline = (a:0 >= 1) ? a:1 : 1
|
||||||
|
|
||||||
if a:mode == 'x'
|
if a:mode == 'x'
|
||||||
normal! gv
|
normal! gv
|
||||||
endif
|
endif
|
||||||
|
|
||||||
normal! 0
|
if l:startofline == 1
|
||||||
|
normal! 0
|
||||||
|
endif
|
||||||
|
|
||||||
let cnt = v:count1
|
let cnt = v:count1
|
||||||
mark '
|
mark '
|
||||||
@ -57,7 +78,9 @@ if !exists('*<SID>Python_jump')
|
|||||||
let cnt = cnt - 1
|
let cnt = cnt - 1
|
||||||
endwhile
|
endwhile
|
||||||
|
|
||||||
normal! ^
|
if l:startofline == 1
|
||||||
|
normal! ^
|
||||||
|
endif
|
||||||
endfun
|
endfun
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
197
runtime/ftplugin/rust.vim
Normal file
197
runtime/ftplugin/rust.vim
Normal file
@ -0,0 +1,197 @@
|
|||||||
|
" Language: Rust
|
||||||
|
" Description: Vim ftplugin for Rust
|
||||||
|
" Maintainer: Chris Morgan <me@chrismorgan.info>
|
||||||
|
" Maintainer: Kevin Ballard <kevin@sb.org>
|
||||||
|
" 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 <buffer>
|
||||||
|
\ if expand('<afile>') ==# '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 <buffer>
|
||||||
|
\ if expand('<afile>') ==# '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 <silent> <buffer> [[ :call rust#Jump('n', 'Back')<CR>
|
||||||
|
nnoremap <silent> <buffer> ]] :call rust#Jump('n', 'Forward')<CR>
|
||||||
|
xnoremap <silent> <buffer> [[ :call rust#Jump('v', 'Back')<CR>
|
||||||
|
xnoremap <silent> <buffer> ]] :call rust#Jump('v', 'Forward')<CR>
|
||||||
|
onoremap <silent> <buffer> [[ :call rust#Jump('o', 'Back')<CR>
|
||||||
|
onoremap <silent> <buffer> ]] :call rust#Jump('o', 'Forward')<CR>
|
||||||
|
|
||||||
|
" Commands {{{1
|
||||||
|
|
||||||
|
" See |:RustRun| for docs
|
||||||
|
command! -nargs=* -complete=file -bang -buffer RustRun call rust#Run(<bang>0, <q-args>)
|
||||||
|
|
||||||
|
" See |:RustExpand| for docs
|
||||||
|
command! -nargs=* -complete=customlist,rust#CompleteExpand -bang -buffer RustExpand call rust#Expand(<bang>0, <q-args>)
|
||||||
|
|
||||||
|
" See |:RustEmitIr| for docs
|
||||||
|
command! -nargs=* -buffer RustEmitIr call rust#Emit("llvm-ir", <q-args>)
|
||||||
|
|
||||||
|
" See |:RustEmitAsm| for docs
|
||||||
|
command! -nargs=* -buffer RustEmitAsm call rust#Emit("asm", <q-args>)
|
||||||
|
|
||||||
|
" See |:RustPlay| for docs
|
||||||
|
command! -range=% RustPlay :call rust#Play(<count>, <line1>, <line2>, <f-args>)
|
||||||
|
|
||||||
|
" See |:RustFmt| for docs
|
||||||
|
command! -buffer RustFmt call rustfmt#Format()
|
||||||
|
|
||||||
|
" See |:RustFmtRange| for docs
|
||||||
|
command! -range -buffer RustFmtRange call rustfmt#FormatRange(<line1>, <line2>)
|
||||||
|
|
||||||
|
" Mappings {{{1
|
||||||
|
|
||||||
|
" Bind ⌘R in MacVim to :RustRun
|
||||||
|
nnoremap <silent> <buffer> <D-r> :RustRun<CR>
|
||||||
|
" Bind ⌘⇧R in MacVim to :RustRun! pre-filled with the last args
|
||||||
|
nnoremap <buffer> <D-R> :RustRun! <C-r>=join(b:rust_last_rustc_args)<CR><C-\>erust#AppendCmdLine(' -- ' . join(b:rust_last_args))<CR>
|
||||||
|
|
||||||
|
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 <buffer> <D-r>
|
||||||
|
\|nunmap <buffer> <D-R>
|
||||||
|
\|nunmap <buffer> [[
|
||||||
|
\|nunmap <buffer> ]]
|
||||||
|
\|xunmap <buffer> [[
|
||||||
|
\|xunmap <buffer> ]]
|
||||||
|
\|ounmap <buffer> [[
|
||||||
|
\|ounmap <buffer> ]]
|
||||||
|
\|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:
|
15
runtime/ftplugin/sbt.vim
Normal file
15
runtime/ftplugin/sbt.vim
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
" Vim filetype plugin file
|
||||||
|
" Language: sbt
|
||||||
|
" Maintainer: Steven Dobay <stevendobay at protonmail.com>
|
||||||
|
" 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
|
||||||
|
|
@ -1,8 +1,12 @@
|
|||||||
" Vim filetype plugin file
|
" Vim filetype plugin file
|
||||||
" Language: Verilog HDL
|
" Language: Verilog HDL
|
||||||
" Maintainer: Chih-Tsun Huang <cthuang@larc.ee.nthu.edu.tw>
|
" Maintainer: Chih-Tsun Huang <cthuang@cs.nthu.edu.tw>
|
||||||
" Last Change: Wed Sep 3 15:24:49 CST 2008
|
" Last Change: 2017 Aug 25 by Chih-Tsun Huang
|
||||||
" URL: http://larc.ee.nthu.edu.tw/~cthuang/vim/ftplugin/verilog.vim
|
" URL: http://www.cs.nthu.edu.tw/~cthuang/vim/ftplugin/verilog.vim
|
||||||
|
"
|
||||||
|
" Credits:
|
||||||
|
" Suggestions for improvement, bug reports by
|
||||||
|
" Shao <shaominghai2005@163.com>
|
||||||
|
|
||||||
" Only do this when not done yet for this buffer
|
" Only do this when not done yet for this buffer
|
||||||
if exists("b:did_ftplugin")
|
if exists("b:did_ftplugin")
|
||||||
@ -45,11 +49,16 @@ if exists("loaded_matchit")
|
|||||||
\ '\<begin\>:\<end\>,' .
|
\ '\<begin\>:\<end\>,' .
|
||||||
\ '\<case\>\|\<casex\>\|\<casez\>:\<endcase\>,' .
|
\ '\<case\>\|\<casex\>\|\<casez\>:\<endcase\>,' .
|
||||||
\ '\<module\>:\<endmodule\>,' .
|
\ '\<module\>:\<endmodule\>,' .
|
||||||
\ '\<if\>:\<else\>,' .
|
\ '\<if\>:`\@<!\<else\>,' .
|
||||||
\ '\<function\>:\<endfunction\>,' .
|
\ '\<function\>:\<endfunction\>,' .
|
||||||
\ '`ifdef\>:`else\>:`endif\>,' .
|
\ '`ifn\?def\>:`elsif\>:`else\>:`endif\>,' .
|
||||||
\ '\<task\>:\<endtask\>,' .
|
\ '\<task\>:\<endtask\>,' .
|
||||||
\ '\<specify\>:\<endspecify\>'
|
\ '\<specify\>:\<endspecify\>,' .
|
||||||
|
\ '\<config\>:\<endconfig\>,' .
|
||||||
|
\ '\<generate\>:\<endgenerate\>,' .
|
||||||
|
\ '\<fork\>:\<join\>,' .
|
||||||
|
\ '\<primitive\>:\<endprimitive\>,' .
|
||||||
|
\ '\<table\>:\<endtable\>'
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" Reset 'cpoptions' back to the user's setting
|
" Reset 'cpoptions' back to the user's setting
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
" Vim filetype plugin file
|
" Vim filetype plugin file
|
||||||
" Language: Zsh shell script
|
" Language: Zsh shell script
|
||||||
" Maintainer: Christian Brabandt <cb@256bit.org>
|
" Maintainer: Christian Brabandt <cb@256bit.org>
|
||||||
" Previous Maintainer: Nikolai Weibull <now@bitwi.se>
|
" Previous Maintainer: Nikolai Weibull <now@bitwi.se>
|
||||||
" Latest Revision: 2015-05-29
|
" Latest Revision: 2015-05-29
|
||||||
" License: Vim (see :h license)
|
" License: Vim (see :h license)
|
||||||
" Repository: https://github.com/chrisbra/vim-zsh
|
" Repository: https://github.com/chrisbra/vim-zsh
|
||||||
|
|
||||||
if exists("b:did_ftplugin")
|
if exists("b:did_ftplugin")
|
||||||
finish
|
finish
|
||||||
|
@ -87,7 +87,7 @@ function s:MainBlockIndent (prev_indent, prev_lnum, blockstart, stop_at)
|
|||||||
endwhile
|
endwhile
|
||||||
endwhile
|
endwhile
|
||||||
" Fallback - just move back one
|
" Fallback - just move back one
|
||||||
return a:prev_indent - &sw
|
return a:prev_indent - shiftwidth()
|
||||||
endfunction MainBlockIndent
|
endfunction MainBlockIndent
|
||||||
|
|
||||||
" Section: s:EndBlockIndent {{{1
|
" Section: s:EndBlockIndent {{{1
|
||||||
@ -131,7 +131,7 @@ function s:EndBlockIndent( prev_indent, prev_lnum, blockstart, blockend )
|
|||||||
endwhile
|
endwhile
|
||||||
endwhile
|
endwhile
|
||||||
" Fallback - just move back one
|
" Fallback - just move back one
|
||||||
return a:prev_indent - &sw
|
return a:prev_indent - shiftwidth()
|
||||||
endfunction EndBlockIndent
|
endfunction EndBlockIndent
|
||||||
|
|
||||||
" Section: s:StatementIndent {{{1
|
" Section: s:StatementIndent {{{1
|
||||||
@ -213,15 +213,15 @@ function GetAdaIndent()
|
|||||||
endif
|
endif
|
||||||
" Move indent in
|
" Move indent in
|
||||||
if ! false_match
|
if ! false_match
|
||||||
let ind = ind + &sw
|
let ind = ind + shiftwidth()
|
||||||
endif
|
endif
|
||||||
elseif line =~ '^\s*\(case\|exception\)\>'
|
elseif line =~ '^\s*\(case\|exception\)\>'
|
||||||
" Move indent in twice (next 'when' will move back)
|
" 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\>'
|
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.
|
" 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\>.*\)\@<!)\s*[;,]\s*$'
|
elseif line =~ '\(^\s*new\>.*\)\@<!)\s*[;,]\s*$'
|
||||||
" Revert to indent of line that started this parenthesis pair
|
" Revert to indent of line that started this parenthesis pair
|
||||||
exe lnum
|
exe lnum
|
||||||
@ -235,10 +235,10 @@ function GetAdaIndent()
|
|||||||
exe v:lnum
|
exe v:lnum
|
||||||
elseif line =~ '[.=(]\s*$'
|
elseif line =~ '[.=(]\s*$'
|
||||||
" A statement continuation - move in one
|
" A statement continuation - move in one
|
||||||
let ind = ind + &sw
|
let ind = ind + shiftwidth()
|
||||||
elseif line =~ '^\s*new\>'
|
elseif line =~ '^\s*new\>'
|
||||||
" Multiple line generic instantiation ('package blah is\nnew thingy')
|
" 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*$'
|
elseif line =~ ';\s*$'
|
||||||
" Statement end (but not 'end' ) - try to find current statement-start indent
|
" Statement end (but not 'end' ) - try to find current statement-start indent
|
||||||
let ind = s:StatementIndent( ind, lnum )
|
let ind = s:StatementIndent( ind, lnum )
|
||||||
@ -256,17 +256,17 @@ function GetAdaIndent()
|
|||||||
elseif continuation && line =~ '^\s*('
|
elseif continuation && line =~ '^\s*('
|
||||||
" Don't do this if we've already indented due to the previous line
|
" Don't do this if we've already indented due to the previous line
|
||||||
if ind == initind
|
if ind == initind
|
||||||
let ind = ind + &sw
|
let ind = ind + shiftwidth()
|
||||||
endif
|
endif
|
||||||
elseif line =~ '^\s*\(begin\|is\)\>'
|
elseif line =~ '^\s*\(begin\|is\)\>'
|
||||||
let ind = s:MainBlockIndent( ind, lnum, '\(procedure\|function\|declare\|package\|task\)\>', 'begin\>' )
|
let ind = s:MainBlockIndent( ind, lnum, '\(procedure\|function\|declare\|package\|task\)\>', 'begin\>' )
|
||||||
elseif line =~ '^\s*record\>'
|
elseif line =~ '^\s*record\>'
|
||||||
let ind = s:MainBlockIndent( ind, lnum, 'type\>\|for\>.*\<use\>', '' ) + &sw
|
let ind = s:MainBlockIndent( ind, lnum, 'type\>\|for\>.*\<use\>', '' ) + shiftwidth()
|
||||||
elseif line =~ '^\s*\(else\|elsif\)\>'
|
elseif line =~ '^\s*\(else\|elsif\)\>'
|
||||||
let ind = s:MainBlockIndent( ind, lnum, 'if\>', '' )
|
let ind = s:MainBlockIndent( ind, lnum, 'if\>', '' )
|
||||||
elseif line =~ '^\s*when\>'
|
elseif line =~ '^\s*when\>'
|
||||||
" Align 'when' one /in/ from matching block start
|
" 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*\<if\>'
|
elseif line =~ '^\s*end\>\s*\<if\>'
|
||||||
" End of if statements
|
" End of if statements
|
||||||
let ind = s:EndBlockIndent( ind, lnum, 'if\>', 'end\>\s*\<if\>' )
|
let ind = s:EndBlockIndent( ind, lnum, 'if\>', 'end\>\s*\<if\>' )
|
||||||
|
@ -60,7 +60,7 @@ function! GetAwkIndent()
|
|||||||
" 'pattern { action }' (simple check match on /{/ increases the indent then)
|
" 'pattern { action }' (simple check match on /{/ increases the indent then)
|
||||||
|
|
||||||
if s:Get_brace_balance( prev_data, '{', '}' ) > 0
|
if s:Get_brace_balance( prev_data, '{', '}' ) > 0
|
||||||
return ind + &sw
|
return ind + shiftwidth()
|
||||||
endif
|
endif
|
||||||
|
|
||||||
let brace_balance = s:Get_brace_balance( prev_data, '(', ')' )
|
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))
|
return s:Safe_indent( ind, s:First_word_len(prev_data), getline(v:lnum))
|
||||||
else
|
else
|
||||||
" if/for/while without '{'
|
" if/for/while without '{'
|
||||||
return ind + &sw
|
return ind + shiftwidth()
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
@ -140,7 +140,7 @@ function! GetAwkIndent()
|
|||||||
|
|
||||||
" Decrease indent if this line contains a '}'.
|
" Decrease indent if this line contains a '}'.
|
||||||
if getline(v:lnum) =~ '^\s*}'
|
if getline(v:lnum) =~ '^\s*}'
|
||||||
let ind = ind - &sw
|
let ind = ind - shiftwidth()
|
||||||
endif
|
endif
|
||||||
|
|
||||||
return ind
|
return ind
|
||||||
|
@ -69,7 +69,7 @@ function! GetBstIndent(lnum) abort
|
|||||||
endif
|
endif
|
||||||
let fakeline = substitute(line,'^}','','').matchstr(cline,'^}')
|
let fakeline = substitute(line,'^}','','').matchstr(cline,'^}')
|
||||||
let ind = indent(lnum)
|
let ind = indent(lnum)
|
||||||
let ind = ind + &sw * s:count(line,'{')
|
let ind = ind + shiftwidth() * s:count(line,'{')
|
||||||
let ind = ind - &sw * s:count(fakeline,'}')
|
let ind = ind - shiftwidth() * s:count(fakeline,'}')
|
||||||
return ind
|
return ind
|
||||||
endfunction
|
endfunction
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
" Vim indent file
|
" Vim indent file
|
||||||
" Language: Bazel (http://bazel.io)
|
" Language: Bazel (http://bazel.io)
|
||||||
" Maintainer: David Barnett (https://github.com/google/vim-ft-bzl)
|
" 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')
|
if exists('b:did_indent')
|
||||||
finish
|
finish
|
||||||
@ -41,11 +41,8 @@ function GetBzlIndent(lnum) abort
|
|||||||
if exists('g:pyindent_open_paren')
|
if exists('g:pyindent_open_paren')
|
||||||
let l:pyindent_open_paren = g:pyindent_open_paren
|
let l:pyindent_open_paren = g:pyindent_open_paren
|
||||||
endif
|
endif
|
||||||
" Vim 7.3.693 and later defines a shiftwidth() function to get the effective
|
let g:pyindent_nested_paren = 'shiftwidth() * 2'
|
||||||
" shiftwidth value. Fall back to &shiftwidth if the function doesn't exist.
|
let g:pyindent_open_paren = 'shiftwidth() * 2'
|
||||||
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'
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
let l:indent = -1
|
let l:indent = -1
|
||||||
|
@ -47,7 +47,7 @@ fun! CdlGetIndent(lnum)
|
|||||||
let thisline = getline(a:lnum)
|
let thisline = getline(a:lnum)
|
||||||
if match(thisline, '^\s*\(\k\+\|\[[^]]*]\)\s*\(,\|;\s*$\)') >= 0
|
if match(thisline, '^\s*\(\k\+\|\[[^]]*]\)\s*\(,\|;\s*$\)') >= 0
|
||||||
" it's an attributes line
|
" it's an attributes line
|
||||||
return &sw
|
return shiftwidth()
|
||||||
elseif match(thisline, '^\c\s*\([{}]\|\/[*/]\|dimension\|schedule\|group\|hierarchy\|class\)') >= 0
|
elseif match(thisline, '^\c\s*\([{}]\|\/[*/]\|dimension\|schedule\|group\|hierarchy\|class\)') >= 0
|
||||||
" it's a header or '{' or '}' or a comment
|
" it's a header or '{' or '}' or a comment
|
||||||
return 0
|
return 0
|
||||||
@ -71,13 +71,13 @@ fun! CdlGetIndent(lnum)
|
|||||||
let c = line[inicio-1]
|
let c = line[inicio-1]
|
||||||
" ')' and '=' don't change indent and are useless to set 'f'
|
" ')' and '=' don't change indent and are useless to set 'f'
|
||||||
if c == '{'
|
if c == '{'
|
||||||
return &sw
|
return shiftwidth()
|
||||||
elseif c != ')' && c != '='
|
elseif c != ')' && c != '='
|
||||||
let f = 1 " all but 'elseif' are followed by a formula
|
let f = 1 " all but 'elseif' are followed by a formula
|
||||||
if c ==? 'n' || c ==? 'e' " 'then', 'else'
|
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
|
elseif strpart(line, inicio-6, 6) ==? 'elseif' " elseif, set f to conditional
|
||||||
let ind = ind + &sw
|
let ind = ind + shiftwidth()
|
||||||
let f = 0
|
let f = 0
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -98,16 +98,16 @@ fun! CdlGetIndent(lnum)
|
|||||||
let ind = 0
|
let ind = 0
|
||||||
let f = 1
|
let f = 1
|
||||||
elseif c == ')' || c== ';' || strpart(line, inicio-5, 5) ==? 'endif'
|
elseif c == ')' || c== ';' || strpart(line, inicio-5, 5) ==? 'endif'
|
||||||
let ind = ind - &sw
|
let ind = ind - shiftwidth()
|
||||||
elseif c == '(' || c ==? 'f' " '(' or 'if'
|
elseif c == '(' || c ==? 'f' " '(' or 'if'
|
||||||
let ind = ind + &sw
|
let ind = ind + shiftwidth()
|
||||||
else " c == '='
|
else " c == '='
|
||||||
" if it is an asignment increase indent
|
" if it is an asignment increase indent
|
||||||
if f == -1 " we don't know yet, find out
|
if f == -1 " we don't know yet, find out
|
||||||
let f = CdlAsignment(lnum, strpart(line, 0, inicio))
|
let f = CdlAsignment(lnum, strpart(line, 0, inicio))
|
||||||
end
|
end
|
||||||
if f == 1 " formula increase it
|
if f == 1 " formula increase it
|
||||||
let ind = ind + &sw
|
let ind = ind + shiftwidth()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
endw
|
endw
|
||||||
@ -115,13 +115,13 @@ fun! CdlGetIndent(lnum)
|
|||||||
" CURRENT LINE, if it starts with a closing element, decrease indent
|
" CURRENT LINE, if it starts with a closing element, decrease indent
|
||||||
" or if it starts with '=' (asignment), increase indent
|
" or if it starts with '=' (asignment), increase indent
|
||||||
if match(thisline, '^\c\s*\(else\|then\|endif\|[);]\)') >= 0
|
if match(thisline, '^\c\s*\(else\|then\|endif\|[);]\)') >= 0
|
||||||
let ind = ind - &sw
|
let ind = ind - shiftwidth()
|
||||||
elseif match(thisline, '^\s*=') >= 0
|
elseif match(thisline, '^\s*=') >= 0
|
||||||
if f == -1 " we don't know yet if is an asignment, find out
|
if f == -1 " we don't know yet if is an asignment, find out
|
||||||
let f = CdlAsignment(lnum, "")
|
let f = CdlAsignment(lnum, "")
|
||||||
end
|
end
|
||||||
if f == 1 " formula increase it
|
if f == 1 " formula increase it
|
||||||
let ind = ind + &sw
|
let ind = ind + shiftwidth()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -31,19 +31,19 @@ function! GetChaiScriptIndent()
|
|||||||
let flag = 0
|
let flag = 0
|
||||||
let prevline = getline(lnum)
|
let prevline = getline(lnum)
|
||||||
if prevline =~ '^.*{.*'
|
if prevline =~ '^.*{.*'
|
||||||
let ind = ind + &shiftwidth
|
let ind = ind + shiftwidth()
|
||||||
let flag = 1
|
let flag = 1
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" Subtract a 'shiftwidth' after lines containing a { followed by a }
|
" Subtract a 'shiftwidth' after lines containing a { followed by a }
|
||||||
" to keep it balanced
|
" to keep it balanced
|
||||||
if flag == 1 && prevline =~ '.*{.*}.*'
|
if flag == 1 && prevline =~ '.*{.*}.*'
|
||||||
let ind = ind - &shiftwidth
|
let ind = ind - shiftwidth()
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" Subtract a 'shiftwidth' on lines ending with }
|
" Subtract a 'shiftwidth' on lines ending with }
|
||||||
if getline(v:lnum) =~ '^\s*\%(}\)'
|
if getline(v:lnum) =~ '^\s*\%(}\)'
|
||||||
let ind = ind - &shiftwidth
|
let ind = ind - shiftwidth()
|
||||||
endif
|
endif
|
||||||
|
|
||||||
return ind
|
return ind
|
||||||
|
@ -261,7 +261,7 @@ if exists("*searchpairpos")
|
|||||||
call cursor(paren)
|
call cursor(paren)
|
||||||
|
|
||||||
if s:is_method_special_case(paren)
|
if s:is_method_special_case(paren)
|
||||||
return [paren[0], paren[1] + &shiftwidth - 1]
|
return [paren[0], paren[1] + shiftwidth() - 1]
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if s:is_reader_conditional_special_case(paren)
|
if s:is_reader_conditional_special_case(paren)
|
||||||
@ -299,19 +299,19 @@ if exists("*searchpairpos")
|
|||||||
let ww = s:strip_namespace_and_macro_chars(w)
|
let ww = s:strip_namespace_and_macro_chars(w)
|
||||||
|
|
||||||
if &lispwords =~# '\V\<' . ww . '\>'
|
if &lispwords =~# '\V\<' . ww . '\>'
|
||||||
return [paren[0], paren[1] + &shiftwidth - 1]
|
return [paren[0], paren[1] + shiftwidth() - 1]
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if g:clojure_fuzzy_indent
|
if g:clojure_fuzzy_indent
|
||||||
\ && !s:match_one(g:clojure_fuzzy_indent_blacklist, ww)
|
\ && !s:match_one(g:clojure_fuzzy_indent_blacklist, ww)
|
||||||
\ && s:match_one(g:clojure_fuzzy_indent_patterns, 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
|
endif
|
||||||
|
|
||||||
call search('\v\_s', 'cW')
|
call search('\v\_s', 'cW')
|
||||||
call search('\v\S', 'W')
|
call search('\v\S', 'W')
|
||||||
if paren[0] < line(".")
|
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
|
endif
|
||||||
|
|
||||||
call search('\v\S', 'bW')
|
call search('\v\S', 'bW')
|
||||||
|
@ -1,14 +1,12 @@
|
|||||||
" Vim indent file
|
" Vim indent file
|
||||||
" Program: CMake - Cross-Platform Makefile Generator
|
|
||||||
" Module: $RCSfile: cmake-indent.vim,v $
|
|
||||||
" Language: CMake (ft=cmake)
|
" Language: CMake (ft=cmake)
|
||||||
" Author: Andy Cedilnik <andy.cedilnik@kitware.com>
|
" Author: Andy Cedilnik <andy.cedilnik@kitware.com>
|
||||||
" Maintainer: Karthik Krishnan <karthik.krishnan@kitware.com>
|
" Maintainer: Dimitri Merejkowsky <d.merej@gmail.com>
|
||||||
" Last Change: $Date: 2008-01-16 16:53:53 $
|
" Former Maintainer: Karthik Krishnan <karthik.krishnan@kitware.com>
|
||||||
" Version: $Revision: 1.9 $
|
" Last Change: 2017 Sep 24
|
||||||
"
|
"
|
||||||
" Licence: The CMake license applies to this file. See
|
" 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
|
" This implies that distribution with Vim is allowed
|
||||||
|
|
||||||
if exists("b:did_indent")
|
if exists("b:did_indent")
|
||||||
@ -68,19 +66,19 @@ fun! CMakeGetIndent(lnum)
|
|||||||
let ind = ind
|
let ind = ind
|
||||||
else
|
else
|
||||||
if previous_line =~? cmake_indent_begin_regex
|
if previous_line =~? cmake_indent_begin_regex
|
||||||
let ind = ind + &sw
|
let ind = ind + shiftwidth()
|
||||||
endif
|
endif
|
||||||
if previous_line =~? cmake_indent_open_regex
|
if previous_line =~? cmake_indent_open_regex
|
||||||
let ind = ind + &sw
|
let ind = ind + shiftwidth()
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" Subtract
|
" Subtract
|
||||||
if this_line =~? cmake_indent_end_regex
|
if this_line =~? cmake_indent_end_regex
|
||||||
let ind = ind - &sw
|
let ind = ind - shiftwidth()
|
||||||
endif
|
endif
|
||||||
if previous_line =~? cmake_indent_close_regex
|
if previous_line =~? cmake_indent_close_regex
|
||||||
let ind = ind - &sw
|
let ind = ind - shiftwidth()
|
||||||
endif
|
endif
|
||||||
|
|
||||||
return ind
|
return ind
|
||||||
|
@ -52,11 +52,11 @@ function! s:optionalblock(lnum,ind,blocks,clauses)
|
|||||||
if getline(lastclause) =~? clauses && s:stripped(lastclause) !~? '^'.begin
|
if getline(lastclause) =~? clauses && s:stripped(lastclause) !~? '^'.begin
|
||||||
let ind = indent(lastclause)
|
let ind = indent(lastclause)
|
||||||
elseif lastclause > 0
|
elseif lastclause > 0
|
||||||
let ind = indent(lastclause) + &sw
|
let ind = indent(lastclause) + shiftwidth()
|
||||||
"let ind = ind + &sw
|
"let ind = ind + shiftwidth()
|
||||||
endif
|
endif
|
||||||
elseif line =~? clauses && cline !~? end
|
elseif line =~? clauses && cline !~? end
|
||||||
let ind = ind + &sw
|
let ind = ind + shiftwidth()
|
||||||
endif
|
endif
|
||||||
return ind
|
return ind
|
||||||
endfunction
|
endfunction
|
||||||
@ -98,8 +98,8 @@ function! GetCobolIndent(lnum) abort
|
|||||||
let num = matchstr(line,'^\s*\zs\d\+\>')
|
let num = matchstr(line,'^\s*\zs\d\+\>')
|
||||||
if 0+cnum == num
|
if 0+cnum == num
|
||||||
return lindent
|
return lindent
|
||||||
elseif 0+cnum > num && default < lindent + &sw
|
elseif 0+cnum > num && default < lindent + shiftwidth()
|
||||||
let default = lindent + &sw
|
let default = lindent + shiftwidth()
|
||||||
endif
|
endif
|
||||||
elseif lindent < bshft && lindent >= ashft
|
elseif lindent < bshft && lindent >= ashft
|
||||||
break
|
break
|
||||||
@ -135,13 +135,13 @@ function! GetCobolIndent(lnum) abort
|
|||||||
if line =~? '^PERFORM\>'
|
if line =~? '^PERFORM\>'
|
||||||
let perfline = substitute(line, '\c^PERFORM\s*', "", "")
|
let perfline = substitute(line, '\c^PERFORM\s*', "", "")
|
||||||
if perfline =~? '^\%(\k\+\s\+TIMES\)\=\s*$'
|
if perfline =~? '^\%(\k\+\s\+TIMES\)\=\s*$'
|
||||||
let ind = ind + &sw
|
let ind = ind + shiftwidth()
|
||||||
elseif perfline =~? '^\%(WITH\s\+TEST\|VARYING\|UNTIL\)\>.*[^.]$'
|
elseif perfline =~? '^\%(WITH\s\+TEST\|VARYING\|UNTIL\)\>.*[^.]$'
|
||||||
let ind = ind + &sw
|
let ind = ind + shiftwidth()
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
if line =~? '^\%(IF\|THEN\|ELSE\|READ\|EVALUATE\|SEARCH\|SELECT\)\>'
|
if line =~? '^\%(IF\|THEN\|ELSE\|READ\|EVALUATE\|SEARCH\|SELECT\)\>'
|
||||||
let ind = ind + &sw
|
let ind = ind + shiftwidth()
|
||||||
endif
|
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,'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')
|
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\)\>'
|
"&& s:stripped(lastclause) !~? '^\%(SEARCH\|EVALUATE\|READ\)\>'
|
||||||
let ind = indent(lastclause)
|
let ind = indent(lastclause)
|
||||||
elseif lastclause > 0
|
elseif lastclause > 0
|
||||||
let ind = indent(lastclause) + &sw
|
let ind = indent(lastclause) + shiftwidth()
|
||||||
endif
|
endif
|
||||||
elseif line =~? '^WHEN\>'
|
elseif line =~? '^WHEN\>'
|
||||||
let ind = ind + &sw
|
let ind = ind + shiftwidth()
|
||||||
endif
|
endif
|
||||||
"I'm not sure why I had this
|
"I'm not sure why I had this
|
||||||
"if line =~? '^ELSE\>-\@!' && line !~? '\.$'
|
"if line =~? '^ELSE\>-\@!' && line !~? '\.$'
|
||||||
@ -168,7 +168,7 @@ function! GetCobolIndent(lnum) abort
|
|||||||
"endif
|
"endif
|
||||||
if cline =~? '^\(END\)\>-\@!'
|
if cline =~? '^\(END\)\>-\@!'
|
||||||
" On lines with just END, 'guess' a simple shift left
|
" On lines with just END, 'guess' a simple shift left
|
||||||
let ind = ind - &sw
|
let ind = ind - shiftwidth()
|
||||||
elseif cline =~? '^\(END-IF\|THEN\|ELSE\)\>-\@!'
|
elseif cline =~? '^\(END-IF\|THEN\|ELSE\)\>-\@!'
|
||||||
call cursor(a:lnum,indent(a:lnum))
|
call cursor(a:lnum,indent(a:lnum))
|
||||||
let match = searchpair('\c-\@<!\<IF\>','\c-\@<!\%(THEN\|ELSE\)\>','\c-\@<!\<END-IF\>\zs','bnW',s:skip)
|
let match = searchpair('\c-\@<!\<IF\>','\c-\@<!\%(THEN\|ELSE\)\>','\c-\@<!\<END-IF\>\zs','bnW',s:skip)
|
||||||
@ -209,7 +209,7 @@ function! GetCobolIndent(lnum) abort
|
|||||||
if match > 0
|
if match > 0
|
||||||
let ind = indent(match)
|
let ind = indent(match)
|
||||||
elseif cline =~? '^\(END-\(READ\|EVALUATE\|SEARCH\|PERFORM\)\)\>'
|
elseif cline =~? '^\(END-\(READ\|EVALUATE\|SEARCH\|PERFORM\)\)\>'
|
||||||
let ind = ind - &sw
|
let ind = ind - shiftwidth()
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
return ind < bshft ? bshft : ind
|
return ind < bshft ? bshft : ind
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
" Vim indent file
|
" Vim indent file
|
||||||
" Language: Cucumber
|
" Language: Cucumber
|
||||||
" Maintainer: Tim Pope <vimNOSPAM@tpope.org>
|
" Maintainer: Tim Pope <vimNOSPAM@tpope.org>
|
||||||
" Last Change: 2016 Aug 29
|
" Last Change: 2017 Jun 13
|
||||||
|
|
||||||
if exists("b:did_indent")
|
if exists("b:did_indent")
|
||||||
finish
|
finish
|
||||||
@ -27,7 +27,7 @@ function! GetCucumberIndent()
|
|||||||
let line = getline(prevnonblank(v:lnum-1))
|
let line = getline(prevnonblank(v:lnum-1))
|
||||||
let cline = getline(v:lnum)
|
let cline = getline(v:lnum)
|
||||||
let nline = getline(nextnonblank(v:lnum+1))
|
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 syn = s:syn(prevnonblank(v:lnum-1))
|
||||||
let csyn = s:syn(v:lnum)
|
let csyn = s:syn(v:lnum)
|
||||||
let nsyn = s:syn(nextnonblank(v:lnum+1))
|
let nsyn = s:syn(nextnonblank(v:lnum+1))
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
" Vim indent file
|
" Vim indent file
|
||||||
" Language: Dylan
|
" Language: Dylan
|
||||||
" Version: 0.01
|
" Version: 0.01
|
||||||
" Last Change: 2003 Feb 04
|
" Last Change: 2017 Jun 13
|
||||||
" Maintainer: Brent A. Fulgham <bfulgham@debian.org>
|
" Maintainer: Brent A. Fulgham <bfulgham@debian.org>
|
||||||
|
|
||||||
" Only load this indent file when no other was loaded.
|
" Only load this indent file when no other was loaded.
|
||||||
@ -45,13 +45,13 @@ function DylanGetIndent()
|
|||||||
|
|
||||||
" If previous line was a 'define', indent
|
" 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*=>$\)'
|
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'
|
" local methods indent the shift-width, plus 6 for the 'local'
|
||||||
elseif prevline =~? '^\s*local'
|
elseif prevline =~? '^\s*local'
|
||||||
let chg = &sw + 6
|
let chg = shiftwidth() + 6
|
||||||
" If previous line was a let with no closing semicolon, indent
|
" If previous line was a let with no closing semicolon, indent
|
||||||
elseif prevline =~? '^\s*let.*[^;]\s*$'
|
elseif prevline =~? '^\s*let.*[^;]\s*$'
|
||||||
let chg = &sw
|
let chg = shiftwidth()
|
||||||
" If previous line opened a parenthesis, and did not close it, indent
|
" If previous line opened a parenthesis, and did not close it, indent
|
||||||
elseif prevline =~ '^.*(\s*[^)]*\((.*)\)*[^)]*$'
|
elseif prevline =~ '^.*(\s*[^)]*\((.*)\)*[^)]*$'
|
||||||
return = match( prevline, '(.*\((.*)\|[^)]\)*.*$') + 1
|
return = match( prevline, '(.*\((.*)\|[^)]\)*.*$') + 1
|
||||||
@ -75,13 +75,13 @@ function DylanGetIndent()
|
|||||||
" line doesn't start with an indentable command:
|
" line doesn't start with an indentable command:
|
||||||
let curr_str = getline(curr_line)
|
let curr_str = getline(curr_line)
|
||||||
if curr_str =~? '^\s*\(begin\|block\|case\|define\|else\|elseif\|for\|finally\|if\|select\|unless\|while\)'
|
if curr_str =~? '^\s*\(begin\|block\|case\|define\|else\|elseif\|for\|finally\|if\|select\|unless\|while\)'
|
||||||
let chg = &sw
|
let chg = shiftwidth()
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" If a line starts with end, un-indent (even if we just indented!)
|
" If a line starts with end, un-indent (even if we just indented!)
|
||||||
if cline =~? '^\s*\(cleanup\|end\|else\|elseif\|exception\|finally\|otherwise\)'
|
if cline =~? '^\s*\(cleanup\|end\|else\|elseif\|exception\|finally\|otherwise\)'
|
||||||
let chg = chg - &sw
|
let chg = chg - shiftwidth()
|
||||||
endif
|
endif
|
||||||
|
|
||||||
return ind + chg
|
return ind + chg
|
||||||
|
@ -669,7 +669,7 @@ function! s:BeginningOfClauseFound(stack, token, stored_vcol)
|
|||||||
call s:Pop(a:stack)
|
call s:Pop(a:stack)
|
||||||
if empty(a:stack)
|
if empty(a:stack)
|
||||||
call s:Log(' Stack is ["when"], so LTI is in a guard -> return')
|
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
|
else
|
||||||
return [1, s:UnexpectedToken(a:token, a:stack)]
|
return [1, s:UnexpectedToken(a:token, a:stack)]
|
||||||
endif
|
endif
|
||||||
@ -678,7 +678,7 @@ function! s:BeginningOfClauseFound(stack, token, stored_vcol)
|
|||||||
call s:Pop(a:stack)
|
call s:Pop(a:stack)
|
||||||
if empty(a:stack)
|
if empty(a:stack)
|
||||||
call s:Log(' Stack is ["->"], so LTI is in function body -> return')
|
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] ==# ';'
|
elseif a:stack[0] ==# ';'
|
||||||
call s:Pop(a:stack)
|
call s:Pop(a:stack)
|
||||||
if empty(a:stack)
|
if empty(a:stack)
|
||||||
@ -797,7 +797,7 @@ function! s:ErlangCalcIndent2(lnum, stack)
|
|||||||
|
|
||||||
elseif token ==# 'begin'
|
elseif token ==# 'begin'
|
||||||
let [ret, res] = s:BeginElementFound(stack, token, curr_vcol,
|
let [ret, res] = s:BeginElementFound(stack, token, curr_vcol,
|
||||||
\stored_vcol, 'end', &sw)
|
\stored_vcol, 'end', shiftwidth())
|
||||||
if ret | return res | endif
|
if ret | return res | endif
|
||||||
|
|
||||||
" case EXPR of BRANCHES end
|
" case EXPR of BRANCHES end
|
||||||
@ -848,11 +848,11 @@ function! s:ErlangCalcIndent2(lnum, stack)
|
|||||||
elseif stack == ['->']
|
elseif stack == ['->']
|
||||||
call s:Log(' LTI is in a branch after ' .
|
call s:Log(' LTI is in a branch after ' .
|
||||||
\'"of/receive/after/if/catch" -> return')
|
\'"of/receive/after/if/catch" -> return')
|
||||||
return stored_vcol + &sw
|
return stored_vcol + shiftwidth()
|
||||||
elseif stack == ['when']
|
elseif stack == ['when']
|
||||||
call s:Log(' LTI is in a guard after ' .
|
call s:Log(' LTI is in a guard after ' .
|
||||||
\'"of/receive/after/if/catch" -> return')
|
\'"of/receive/after/if/catch" -> return')
|
||||||
return stored_vcol + &sw
|
return stored_vcol + shiftwidth()
|
||||||
else
|
else
|
||||||
return s:UnexpectedToken(token, stack)
|
return s:UnexpectedToken(token, stack)
|
||||||
endif
|
endif
|
||||||
@ -888,7 +888,7 @@ function! s:ErlangCalcIndent2(lnum, stack)
|
|||||||
if empty(stack)
|
if empty(stack)
|
||||||
call s:Log(' LTI is in a condition; matching ' .
|
call s:Log(' LTI is in a condition; matching ' .
|
||||||
\'"case/if/try/receive" found')
|
\'"case/if/try/receive" found')
|
||||||
let stored_vcol = curr_vcol + &sw
|
let stored_vcol = curr_vcol + shiftwidth()
|
||||||
elseif stack[0] ==# 'align_to_begin_element'
|
elseif stack[0] ==# 'align_to_begin_element'
|
||||||
call s:Pop(stack)
|
call s:Pop(stack)
|
||||||
let stored_vcol = curr_vcol
|
let stored_vcol = curr_vcol
|
||||||
@ -897,23 +897,23 @@ function! s:ErlangCalcIndent2(lnum, stack)
|
|||||||
\'"case/if/try/receive" found')
|
\'"case/if/try/receive" found')
|
||||||
call s:Pop(stack)
|
call s:Pop(stack)
|
||||||
call s:Pop(stack)
|
call s:Pop(stack)
|
||||||
let stored_vcol = curr_vcol + &sw
|
let stored_vcol = curr_vcol + shiftwidth()
|
||||||
elseif stack[0] ==# '->'
|
elseif stack[0] ==# '->'
|
||||||
call s:Log(' LTI is in a branch; matching ' .
|
call s:Log(' LTI is in a branch; matching ' .
|
||||||
\'"case/if/try/receive" found')
|
\'"case/if/try/receive" found')
|
||||||
call s:Pop(stack)
|
call s:Pop(stack)
|
||||||
let stored_vcol = curr_vcol + 2 * &sw
|
let stored_vcol = curr_vcol + 2 * shiftwidth()
|
||||||
elseif stack[0] ==# 'when'
|
elseif stack[0] ==# 'when'
|
||||||
call s:Log(' LTI is in a guard; matching ' .
|
call s:Log(' LTI is in a guard; matching ' .
|
||||||
\'"case/if/try/receive" found')
|
\'"case/if/try/receive" found')
|
||||||
call s:Pop(stack)
|
call s:Pop(stack)
|
||||||
let stored_vcol = curr_vcol + 2 * &sw + 2
|
let stored_vcol = curr_vcol + 2 * shiftwidth() + 2
|
||||||
endif
|
endif
|
||||||
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
let [ret, res] = s:BeginElementFound(stack, token, curr_vcol,
|
let [ret, res] = s:BeginElementFound(stack, token, curr_vcol,
|
||||||
\stored_vcol, 'end', &sw)
|
\stored_vcol, 'end', shiftwidth())
|
||||||
if ret | return res | endif
|
if ret | return res | endif
|
||||||
|
|
||||||
elseif token ==# 'fun'
|
elseif token ==# 'fun'
|
||||||
@ -930,7 +930,7 @@ function! s:ErlangCalcIndent2(lnum, stack)
|
|||||||
" stack = ['when'] => LTI is in a guard
|
" stack = ['when'] => LTI is in a guard
|
||||||
if empty(stack)
|
if empty(stack)
|
||||||
call s:Log(' LTI is in a condition; matching "fun" found')
|
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] ==# ';'
|
elseif len(stack) > 1 && stack[0] ==# '->' && stack[1] ==# ';'
|
||||||
call s:Log(' LTI is in a condition; matching "fun" found')
|
call s:Log(' LTI is in a condition; matching "fun" found')
|
||||||
call s:Pop(stack)
|
call s:Pop(stack)
|
||||||
@ -938,15 +938,15 @@ function! s:ErlangCalcIndent2(lnum, stack)
|
|||||||
elseif stack[0] ==# '->'
|
elseif stack[0] ==# '->'
|
||||||
call s:Log(' LTI is in a branch; matching "fun" found')
|
call s:Log(' LTI is in a branch; matching "fun" found')
|
||||||
call s:Pop(stack)
|
call s:Pop(stack)
|
||||||
let stored_vcol = curr_vcol + 2 * &sw
|
let stored_vcol = curr_vcol + 2 * shiftwidth()
|
||||||
elseif stack[0] ==# 'when'
|
elseif stack[0] ==# 'when'
|
||||||
call s:Log(' LTI is in a guard; matching "fun" found')
|
call s:Log(' LTI is in a guard; matching "fun" found')
|
||||||
call s:Pop(stack)
|
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,
|
let [ret, res] = s:BeginElementFound(stack, token, curr_vcol,
|
||||||
\stored_vcol, 'end', &sw)
|
\stored_vcol, 'end', shiftwidth())
|
||||||
if ret | return res | endif
|
if ret | return res | endif
|
||||||
else
|
else
|
||||||
" Pass: we have a function reference (e.g. "fun f/0")
|
" Pass: we have a function reference (e.g. "fun f/0")
|
||||||
@ -1220,7 +1220,7 @@ function! s:ErlangCalcIndent2(lnum, stack)
|
|||||||
" when A,
|
" when A,
|
||||||
" LTI
|
" LTI
|
||||||
let [ret, res] = s:BeginElementFoundIfEmpty(stack, token, curr_vcol,
|
let [ret, res] = s:BeginElementFoundIfEmpty(stack, token, curr_vcol,
|
||||||
\stored_vcol, &sw)
|
\stored_vcol, shiftwidth())
|
||||||
if ret | return res | endif
|
if ret | return res | endif
|
||||||
else
|
else
|
||||||
" Example:
|
" Example:
|
||||||
@ -1252,7 +1252,7 @@ function! s:ErlangCalcIndent2(lnum, stack)
|
|||||||
" If LTI is between an 'after' and the corresponding
|
" If LTI is between an 'after' and the corresponding
|
||||||
" 'end', then let's return
|
" 'end', then let's return
|
||||||
let [ret, res] = s:BeginElementFoundIfEmpty(stack, token, curr_vcol,
|
let [ret, res] = s:BeginElementFoundIfEmpty(stack, token, curr_vcol,
|
||||||
\stored_vcol, &sw)
|
\stored_vcol, shiftwidth())
|
||||||
if ret | return res | endif
|
if ret | return res | endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
@ -47,11 +47,7 @@ set cpo&vim
|
|||||||
|
|
||||||
function! GetErubyIndent(...)
|
function! GetErubyIndent(...)
|
||||||
" The value of a single shift-width
|
" The value of a single shift-width
|
||||||
if exists('*shiftwidth')
|
let sw = shiftwidth()
|
||||||
let sw = shiftwidth()
|
|
||||||
else
|
|
||||||
let sw = &sw
|
|
||||||
endif
|
|
||||||
|
|
||||||
if a:0 && a:1 == '.'
|
if a:0 && a:1 == '.'
|
||||||
let v:lnum = line('.')
|
let v:lnum = line('.')
|
||||||
|
@ -339,7 +339,7 @@ function FalconGetIndent(...)
|
|||||||
|
|
||||||
" If the previous line ended with a block opening, add a level of indent.
|
" If the previous line ended with a block opening, add a level of indent.
|
||||||
if s:Match(lnum, s:block_regex)
|
if s:Match(lnum, s:block_regex)
|
||||||
return indent(s:GetMSL(lnum)) + &sw
|
return indent(s:GetMSL(lnum)) + shiftwidth()
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" If it contained hanging closing brackets, find the rightmost one, find its
|
" If it contained hanging closing brackets, find the rightmost one, find its
|
||||||
@ -350,20 +350,20 @@ function FalconGetIndent(...)
|
|||||||
if opening.pos != -1
|
if opening.pos != -1
|
||||||
if opening.type == '(' && searchpair('(', '', ')', 'bW', s:skip_expr) > 0
|
if opening.type == '(' && searchpair('(', '', ')', 'bW', s:skip_expr) > 0
|
||||||
if col('.') + 1 == col('$')
|
if col('.') + 1 == col('$')
|
||||||
return ind + &sw
|
return ind + shiftwidth()
|
||||||
else
|
else
|
||||||
return virtcol('.')
|
return virtcol('.')
|
||||||
endif
|
endif
|
||||||
else
|
else
|
||||||
let nonspace = matchend(line, '\S', opening.pos + 1) - 1
|
let nonspace = matchend(line, '\S', opening.pos + 1) - 1
|
||||||
return nonspace > 0 ? nonspace : ind + &sw
|
return nonspace > 0 ? nonspace : ind + shiftwidth()
|
||||||
endif
|
endif
|
||||||
elseif closing.pos != -1
|
elseif closing.pos != -1
|
||||||
call cursor(lnum, closing.pos + 1)
|
call cursor(lnum, closing.pos + 1)
|
||||||
normal! %
|
normal! %
|
||||||
|
|
||||||
if s:Match(line('.'), s:falcon_indent_keywords)
|
if s:Match(line('.'), s:falcon_indent_keywords)
|
||||||
return indent('.') + &sw
|
return indent('.') + shiftwidth()
|
||||||
else
|
else
|
||||||
return indent('.')
|
return indent('.')
|
||||||
endif
|
endif
|
||||||
@ -392,7 +392,7 @@ function FalconGetIndent(...)
|
|||||||
let col = s:Match(lnum, s:falcon_indent_keywords)
|
let col = s:Match(lnum, s:falcon_indent_keywords)
|
||||||
if col > 0
|
if col > 0
|
||||||
call cursor(lnum, col)
|
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
|
" 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
|
" fails, we know that something is lacking an end and thus we indent a
|
||||||
" level
|
" level
|
||||||
@ -422,9 +422,9 @@ function FalconGetIndent(...)
|
|||||||
" TODO: this does not take into account contrived things such as
|
" TODO: this does not take into account contrived things such as
|
||||||
" module Foo; class Bar; end
|
" module Foo; class Bar; end
|
||||||
if s:Match(lnum, s:falcon_indent_keywords)
|
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)
|
if s:Match(lnum, s:end_end_regex)
|
||||||
let ind = ind - &sw
|
let ind = ind - shiftwidth()
|
||||||
endif
|
endif
|
||||||
return ind
|
return ind
|
||||||
endif
|
endif
|
||||||
@ -433,7 +433,7 @@ function FalconGetIndent(...)
|
|||||||
" closing bracket, indent one extra level.
|
" closing bracket, indent one extra level.
|
||||||
if s:Match(lnum, s:non_bracket_continuation_regex) && !s:Match(lnum, '^\s*\([\])}]\|end\)')
|
if s:Match(lnum, s:non_bracket_continuation_regex) && !s:Match(lnum, '^\s*\([\])}]\|end\)')
|
||||||
if lnum == p_lnum
|
if lnum == p_lnum
|
||||||
let ind = msl_ind + &sw
|
let ind = msl_ind + shiftwidth()
|
||||||
else
|
else
|
||||||
let ind = msl_ind
|
let ind = msl_ind
|
||||||
endif
|
endif
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
" Vim indent file
|
" Vim indent file
|
||||||
" Language: git config file
|
" Language: git config file
|
||||||
" Maintainer: Tim Pope <vimNOSPAM@tpope.org>
|
" Maintainer: Tim Pope <vimNOSPAM@tpope.org>
|
||||||
" Last Change: 2016 Aug 29
|
" Last Change: 2017 Jun 13
|
||||||
|
|
||||||
if exists("b:did_indent")
|
if exists("b:did_indent")
|
||||||
finish
|
finish
|
||||||
@ -20,7 +20,7 @@ if exists("*GetGitconfigIndent")
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
function! GetGitconfigIndent()
|
function! GetGitconfigIndent()
|
||||||
let sw = exists('*shiftwidth') ? shiftwidth() : &sw
|
let sw = shiftwidth()
|
||||||
let line = getline(prevnonblank(v:lnum-1))
|
let line = getline(prevnonblank(v:lnum-1))
|
||||||
let cline = getline(v:lnum)
|
let cline = getline(v:lnum)
|
||||||
if line =~ '\\\@<!\%(\\\\\)*\\$'
|
if line =~ '\\\@<!\%(\\\\\)*\\$'
|
||||||
|
@ -1,8 +1,10 @@
|
|||||||
" Vim indent file
|
" Vim indent file
|
||||||
" Language: gitolite configuration
|
" Language: gitolite configuration
|
||||||
" URL: https://github.com/tmatilai/gitolite.vim
|
" URL: https://github.com/sitaramc/gitolite/blob/master/contrib/vim/indent/gitolite.vim
|
||||||
" Maintainer: Teemu Matilainen <teemu.matilainen@iki.fi>
|
" (https://raw.githubusercontent.com/sitaramc/gitolite/master/contrib/vim/indent/gitolite.vim)
|
||||||
" Last Change: 2011-12-24
|
" Maintainer: Sitaram Chamarty <sitaramc@gmail.com>
|
||||||
|
" (former Maintainer: Teemu Matilainen <teemu.matilainen@iki.fi>)
|
||||||
|
" Last Change: 2017 Oct 05
|
||||||
|
|
||||||
if exists("b:did_indent")
|
if exists("b:did_indent")
|
||||||
finish
|
finish
|
||||||
@ -27,11 +29,13 @@ function! GetGitoliteIndent()
|
|||||||
let cline = getline(v:lnum)
|
let cline = getline(v:lnum)
|
||||||
|
|
||||||
if cline =~ '^\s*\(C\|R\|RW\|RW+\|RWC\|RW+C\|RWD\|RW+D\|RWCD\|RW+CD\|-\)[ \t=]'
|
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'
|
elseif cline =~ '^\s*config\s'
|
||||||
return &sw
|
return shiftwidth()
|
||||||
|
elseif cline =~ '^\s*option\s'
|
||||||
|
return shiftwidth()
|
||||||
elseif pline =~ '^\s*repo\s' && cline =~ '^\s*\(#.*\)\?$'
|
elseif pline =~ '^\s*repo\s' && cline =~ '^\s*\(#.*\)\?$'
|
||||||
return &sw
|
return shiftwidth()
|
||||||
elseif cline =~ '^\s*#'
|
elseif cline =~ '^\s*#'
|
||||||
return indent(prevln)
|
return indent(prevln)
|
||||||
elseif cline =~ '^\s*$'
|
elseif cline =~ '^\s*$'
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
" Vim indent file
|
" Vim indent file
|
||||||
" Language: Go
|
" Language: Go
|
||||||
" Maintainer: David Barnett (https://github.com/google/vim-ft-go)
|
" Maintainer: David Barnett (https://github.com/google/vim-ft-go)
|
||||||
" Last Change: 2014 Aug 16
|
" Last Change: 2017 Jun 13
|
||||||
"
|
"
|
||||||
" TODO:
|
" TODO:
|
||||||
" - function invocations split across lines
|
" - function invocations split across lines
|
||||||
@ -23,18 +23,6 @@ if exists('*GoIndent')
|
|||||||
finish
|
finish
|
||||||
endif
|
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)
|
function! GoIndent(lnum)
|
||||||
let l:prevlnum = prevnonblank(a:lnum-1)
|
let l:prevlnum = prevnonblank(a:lnum-1)
|
||||||
if l:prevlnum == 0
|
if l:prevlnum == 0
|
||||||
@ -51,17 +39,17 @@ function! GoIndent(lnum)
|
|||||||
|
|
||||||
if l:prevl =~ '[({]\s*$'
|
if l:prevl =~ '[({]\s*$'
|
||||||
" previous line opened a block
|
" previous line opened a block
|
||||||
let l:ind += s:sw()
|
let l:ind += shiftwidth()
|
||||||
endif
|
endif
|
||||||
if l:prevl =~# '^\s*\(case .*\|default\):$'
|
if l:prevl =~# '^\s*\(case .*\|default\):$'
|
||||||
" previous line is part of a switch statement
|
" previous line is part of a switch statement
|
||||||
let l:ind += s:sw()
|
let l:ind += shiftwidth()
|
||||||
endif
|
endif
|
||||||
" TODO: handle if the previous line is a label.
|
" TODO: handle if the previous line is a label.
|
||||||
|
|
||||||
if l:thisl =~ '^\s*[)}]'
|
if l:thisl =~ '^\s*[)}]'
|
||||||
" this line closed a block
|
" this line closed a block
|
||||||
let l:ind -= s:sw()
|
let l:ind -= shiftwidth()
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" Colons are tricky.
|
" Colons are tricky.
|
||||||
@ -69,7 +57,7 @@ function! GoIndent(lnum)
|
|||||||
" We ignore trying to deal with jump labels because (a) they're rare, and
|
" 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.
|
" (b) they're hard to disambiguate from a composite literal key.
|
||||||
if l:thisl =~# '^\s*\(case .*\|default\):$'
|
if l:thisl =~# '^\s*\(case .*\|default\):$'
|
||||||
let l:ind -= s:sw()
|
let l:ind -= shiftwidth()
|
||||||
endif
|
endif
|
||||||
|
|
||||||
return l:ind
|
return l:ind
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
" Vim indent file
|
" Vim indent file
|
||||||
" Language: Haml
|
" Language: Haml
|
||||||
" Maintainer: Tim Pope <vimNOSPAM@tpope.org>
|
" Maintainer: Tim Pope <vimNOSPAM@tpope.org>
|
||||||
" Last Change: 2016 Aug 29
|
" Last Change: 2017 Jun 13
|
||||||
|
|
||||||
if exists("b:did_indent")
|
if exists("b:did_indent")
|
||||||
finish
|
finish
|
||||||
@ -37,7 +37,7 @@ function! GetHamlIndent()
|
|||||||
let line = substitute(line,'^\s\+','','')
|
let line = substitute(line,'^\s\+','','')
|
||||||
let indent = indent(lnum)
|
let indent = indent(lnum)
|
||||||
let cindent = indent(v:lnum)
|
let cindent = indent(v:lnum)
|
||||||
let sw = exists('*shiftwidth') ? shiftwidth() : &sw
|
let sw = shiftwidth()
|
||||||
if cline =~# '\v^-\s*%(elsif|else|when)>'
|
if cline =~# '\v^-\s*%(elsif|else|when)>'
|
||||||
let indent = cindent < indent ? cindent : indent - sw
|
let indent = cindent < indent ? cindent : indent - sw
|
||||||
endif
|
endif
|
||||||
|
@ -27,13 +27,13 @@ function HamGetIndent(lnum)
|
|||||||
" Add a shiftwidth to statements following if, else, elseif,
|
" Add a shiftwidth to statements following if, else, elseif,
|
||||||
" case, select, default, do, until, while, for, start
|
" case, select, default, do, until, while, for, start
|
||||||
if prevline =~? '^\s*\<\(if\|else\%(if\)\?\|for\|repeat\|do\|while\|sub\)\>'
|
if prevline =~? '^\s*\<\(if\|else\%(if\)\?\|for\|repeat\|do\|while\|sub\)\>'
|
||||||
let ind = ind + &sw
|
let ind = ind + shiftwidth()
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" Subtract a shiftwidth from else, elseif, end(if|while|for), until
|
" Subtract a shiftwidth from else, elseif, end(if|while|for), until
|
||||||
let line = getline(v:lnum)
|
let line = getline(v:lnum)
|
||||||
if line =~? '^\s*\(else\|elseif\|loop\|until\|end\%(if\|while\|for\|sub\)\)\>'
|
if line =~? '^\s*\(else\|elseif\|loop\|until\|end\%(if\|while\|for\|sub\)\)\>'
|
||||||
let ind = ind - &sw
|
let ind = ind - shiftwidth()
|
||||||
endif
|
endif
|
||||||
|
|
||||||
return ind
|
return ind
|
||||||
|
@ -47,7 +47,7 @@ function GetHogIndent()
|
|||||||
" Continuation of a line that wasn't indented
|
" Continuation of a line that wasn't indented
|
||||||
let prevline = getline(prevlnum)
|
let prevline = getline(prevlnum)
|
||||||
if prevline =~ '^\k\+.*\\\s*$'
|
if prevline =~ '^\k\+.*\\\s*$'
|
||||||
return &sw
|
return shiftwidth()
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" Continuation of a line that was indented
|
" 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
|
" Indent the next line if previous line contained a start of a block
|
||||||
" definition ('{' or '(').
|
" definition ('{' or '(').
|
||||||
if prevline =~ '^\k\+[^#]*{}\@!\s*$' " TODO || prevline =~ '^\k\+[^#]*()\@!\s*$'
|
if prevline =~ '^\k\+[^#]*{}\@!\s*$' " TODO || prevline =~ '^\k\+[^#]*()\@!\s*$'
|
||||||
return &sw
|
return shiftwidth()
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" Match inside of a block
|
" Match inside of a block
|
||||||
if s:IsInBlock(v:lnum)
|
if s:IsInBlock(v:lnum)
|
||||||
if prevline =~ "^\k\+.*$"
|
if prevline =~ "^\k\+.*$"
|
||||||
return &sw
|
return shiftwidth()
|
||||||
else
|
else
|
||||||
return indent(prevlnum)
|
return indent(prevlnum)
|
||||||
endif
|
endif
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
" Header: "{{{
|
" Header: "{{{
|
||||||
" Maintainer: Bram Moolenaar
|
" Maintainer: Bram Moolenaar
|
||||||
" Original Author: Andy Wokula <anwoku@yahoo.de>
|
" Original Author: Andy Wokula <anwoku@yahoo.de>
|
||||||
" Last Change: 2017 Jan 17
|
" Last Change: 2017 Jun 13
|
||||||
" Version: 1.0
|
" Version: 1.0
|
||||||
" Description: HTML indent script with cached state for faster indenting on a
|
" Description: HTML indent script with cached state for faster indenting on a
|
||||||
" range of lines.
|
" range of lines.
|
||||||
@ -51,15 +51,6 @@ if exists("*HtmlIndent") && !exists('g:force_reload_html')
|
|||||||
finish
|
finish
|
||||||
endif
|
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.
|
" Allow for line continuation below.
|
||||||
let s:cpo_save = &cpo
|
let s:cpo_save = &cpo
|
||||||
set cpo-=C
|
set cpo-=C
|
||||||
@ -123,7 +114,7 @@ func! HtmlIndent_CheckUserSettings()
|
|||||||
|
|
||||||
let indone = {"zero": 0
|
let indone = {"zero": 0
|
||||||
\,"auto": "indent(prevnonblank(v:lnum-1))"
|
\,"auto": "indent(prevnonblank(v:lnum-1))"
|
||||||
\,"inc": "b:hi_indent.blocktagind + s:ShiftWidth()"}
|
\,"inc": "b:hi_indent.blocktagind + shiftwidth()"}
|
||||||
|
|
||||||
let script1 = ''
|
let script1 = ''
|
||||||
if exists("b:html_indent_script1")
|
if exists("b:html_indent_script1")
|
||||||
@ -358,7 +349,7 @@ func! s:CheckBlockTag(blocktag, ind)
|
|||||||
endif
|
endif
|
||||||
let b:hi_newstate.blocklnr = v:lnum
|
let b:hi_newstate.blocklnr = v:lnum
|
||||||
" save allover indent for the endtag
|
" 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
|
if a:ind == 3
|
||||||
return "SCRIPT" " all except this must be lowercase
|
return "SCRIPT" " all except this must be lowercase
|
||||||
" line is to be checked again for the type attribute
|
" line is to be checked again for the type attribute
|
||||||
@ -480,7 +471,7 @@ func! s:FreshState(lnum)
|
|||||||
let state.blocklnr = stopline
|
let state.blocklnr = stopline
|
||||||
" check preceding tags in the line:
|
" check preceding tags in the line:
|
||||||
call s:CountITags(tagline[: stopcol-2])
|
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
|
return state
|
||||||
elseif stopline == state.lnum
|
elseif stopline == state.lnum
|
||||||
" handle special case: previous line (= state.lnum) contains a
|
" handle special case: previous line (= state.lnum) contains a
|
||||||
@ -490,7 +481,7 @@ func! s:FreshState(lnum)
|
|||||||
if !swendtag
|
if !swendtag
|
||||||
let [bline, bcol] = searchpos('<'.blocktag[1:].'\>', "bnW")
|
let [bline, bcol] = searchpos('<'.blocktag[1:].'\>', "bnW")
|
||||||
call s:CountITags(tolower(getline(bline)[: bcol-2]))
|
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
|
return state
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
@ -511,7 +502,7 @@ func! s:FreshState(lnum)
|
|||||||
if found == 2
|
if found == 2
|
||||||
let state.baseindent = b:hi_indent.baseindent
|
let state.baseindent = b:hi_indent.baseindent
|
||||||
endif
|
endif
|
||||||
let state.blocktagind = indent(comlnum) + (s:curind + s:nextrel) * s:ShiftWidth()
|
let state.blocktagind = indent(comlnum) + (s:curind + s:nextrel) * shiftwidth()
|
||||||
return state
|
return state
|
||||||
endif
|
endif
|
||||||
|
|
||||||
@ -530,7 +521,7 @@ func! s:FreshState(lnum)
|
|||||||
let text = tolower(getline(comlnum)[: comcol-2])
|
let text = tolower(getline(comlnum)[: comcol-2])
|
||||||
endif
|
endif
|
||||||
call s:CountITags(text)
|
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 "-->"
|
" TODO check tags that follow "-->"
|
||||||
return state
|
return state
|
||||||
endif
|
endif
|
||||||
@ -550,9 +541,9 @@ func! s:FreshState(lnum)
|
|||||||
let text = getline(start_lnum)
|
let text = getline(start_lnum)
|
||||||
let swendtag = match(text, '^\s*</') >= 0
|
let swendtag = match(text, '^\s*</') >= 0
|
||||||
call s:CountITags(text[: col('.') - 2])
|
call s:CountITags(text[: col('.') - 2])
|
||||||
let state.baseindent += s:nextrel * s:ShiftWidth()
|
let state.baseindent += s:nextrel * shiftwidth()
|
||||||
if !swendtag
|
if !swendtag
|
||||||
let state.baseindent += s:curind * s:ShiftWidth()
|
let state.baseindent += s:curind * shiftwidth()
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
return state
|
return state
|
||||||
@ -565,9 +556,9 @@ func! s:FreshState(lnum)
|
|||||||
let text = getline(state.lnum)
|
let text = getline(state.lnum)
|
||||||
let swendtag = match(text, '^\s*</') >= 0
|
let swendtag = match(text, '^\s*</') >= 0
|
||||||
call s:CountITags(tolower(text))
|
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
|
if !swendtag
|
||||||
let state.baseindent += s:curind * s:ShiftWidth()
|
let state.baseindent += s:curind * shiftwidth()
|
||||||
endif
|
endif
|
||||||
return state
|
return state
|
||||||
endfunc "}}}
|
endfunc "}}}
|
||||||
@ -646,7 +637,7 @@ func! s:CSSIndent()
|
|||||||
|
|
||||||
" add indent after {
|
" add indent after {
|
||||||
let brace_counts = HtmlIndent_CountBraces(prev_lnum)
|
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 prev_text = getline(prev_lnum)
|
||||||
let below_end_brace = prev_text =~ '}\s*$'
|
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
|
" if the current line is not a comment or starts with @ (used by template
|
||||||
" systems) reduce indent if previous line is a continuation line
|
" systems) reduce indent if previous line is a continuation line
|
||||||
if !prev_hasfield && !prev_special
|
if !prev_hasfield && !prev_special
|
||||||
let extra = -s:ShiftWidth()
|
let extra = -shiftwidth()
|
||||||
endif
|
endif
|
||||||
else
|
else
|
||||||
let cur_hasfield = curtext =~ '^\s*[a-zA-Z0-9-]\+:'
|
let cur_hasfield = curtext =~ '^\s*[a-zA-Z0-9-]\+:'
|
||||||
@ -671,14 +662,14 @@ func! s:CSSIndent()
|
|||||||
if !cur_hasfield && (prev_hasfield || prev_unfinished)
|
if !cur_hasfield && (prev_hasfield || prev_unfinished)
|
||||||
" Continuation line has extra indent if the previous line was not a
|
" Continuation line has extra indent if the previous line was not a
|
||||||
" continuation line.
|
" continuation line.
|
||||||
let extra = s:ShiftWidth()
|
let extra = shiftwidth()
|
||||||
" Align with @if
|
" Align with @if
|
||||||
if prev_text =~ '^\s*@if '
|
if prev_text =~ '^\s*@if '
|
||||||
let extra = 4
|
let extra = 4
|
||||||
endif
|
endif
|
||||||
elseif cur_hasfield && !prev_hasfield && !prev_special
|
elseif cur_hasfield && !prev_hasfield && !prev_special
|
||||||
" less indent below a continuation line
|
" less indent below a continuation line
|
||||||
let extra = -s:ShiftWidth()
|
let extra = -shiftwidth()
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
@ -699,10 +690,10 @@ func! s:CSSIndent()
|
|||||||
if special
|
if special
|
||||||
" do not reduce indent below @{ ... }
|
" do not reduce indent below @{ ... }
|
||||||
if extra < 0
|
if extra < 0
|
||||||
let extra += s:ShiftWidth()
|
let extra += shiftwidth()
|
||||||
endif
|
endif
|
||||||
else
|
else
|
||||||
let extra -= (brace_counts.c_close - (prev_text =~ '^\s*}')) * s:ShiftWidth()
|
let extra -= (brace_counts.c_close - (prev_text =~ '^\s*}')) * shiftwidth()
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
@ -710,10 +701,10 @@ func! s:CSSIndent()
|
|||||||
if extra == 0
|
if extra == 0
|
||||||
if brace_counts.p_open > brace_counts.p_close
|
if brace_counts.p_open > brace_counts.p_close
|
||||||
" previous line has more ( than ): add a shiftwidth
|
" previous line has more ( than ): add a shiftwidth
|
||||||
let extra = s:ShiftWidth()
|
let extra = shiftwidth()
|
||||||
elseif brace_counts.p_open < brace_counts.p_close
|
elseif brace_counts.p_open < brace_counts.p_close
|
||||||
" previous line has more ) than (: subtract a shiftwidth
|
" previous line has more ) than (: subtract a shiftwidth
|
||||||
let extra = -s:ShiftWidth()
|
let extra = -shiftwidth()
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
@ -816,7 +807,7 @@ func! s:Alien5()
|
|||||||
let idx = match(prevtext, '^\s*\zs<!--')
|
let idx = match(prevtext, '^\s*\zs<!--')
|
||||||
if idx >= 0
|
if idx >= 0
|
||||||
" just below comment start, add a shiftwidth
|
" just below comment start, add a shiftwidth
|
||||||
return idx + s:ShiftWidth()
|
return idx + shiftwidth()
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" Some files add 4 spaces just below a TODO line. It's difficult to detect
|
" Some files add 4 spaces just below a TODO line. It's difficult to detect
|
||||||
@ -837,7 +828,7 @@ func! s:Alien6()
|
|||||||
return indent(lnum)
|
return indent(lnum)
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
return b:hi_indent.baseindent + s:ShiftWidth()
|
return b:hi_indent.baseindent + shiftwidth()
|
||||||
endfunc "}}}
|
endfunc "}}}
|
||||||
|
|
||||||
" When the "lnum" line ends in ">" find the line containing the matching "<".
|
" When the "lnum" line ends in ">" find the line containing the matching "<".
|
||||||
@ -947,7 +938,7 @@ func! HtmlIndent()
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
let curtext = tolower(getline(v:lnum))
|
let curtext = tolower(getline(v:lnum))
|
||||||
let indentunit = s:ShiftWidth()
|
let indentunit = shiftwidth()
|
||||||
|
|
||||||
let b:hi_newstate = {}
|
let b:hi_newstate = {}
|
||||||
let b:hi_newstate.lnum = v:lnum
|
let b:hi_newstate.lnum = v:lnum
|
||||||
@ -1030,9 +1021,9 @@ func! HtmlIndent()
|
|||||||
if col('.') > 2
|
if col('.') > 2
|
||||||
let swendtag = match(text, '^\s*</') >= 0
|
let swendtag = match(text, '^\s*</') >= 0
|
||||||
call s:CountITags(text[: col('.') - 2])
|
call s:CountITags(text[: col('.') - 2])
|
||||||
let indent += s:nextrel * s:ShiftWidth()
|
let indent += s:nextrel * shiftwidth()
|
||||||
if !swendtag
|
if !swendtag
|
||||||
let indent += s:curind * s:ShiftWidth()
|
let indent += s:curind * shiftwidth()
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
else
|
else
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
" IDL (Interactive Data Language) indent file.
|
" IDL (Interactive Data Language) indent file.
|
||||||
" Language: IDL (ft=idlang)
|
" Language: IDL (ft=idlang)
|
||||||
" Last change: 2012 May 18
|
" Last change: 2017 Jun 13
|
||||||
" Maintainer: Aleksandar Jelenak <ajelenak AT yahoo.com>
|
" Maintainer: Aleksandar Jelenak <ajelenak AT yahoo.com>
|
||||||
|
|
||||||
" Only load this indent file when no other was loaded.
|
" Only load this indent file when no other was loaded.
|
||||||
@ -34,25 +34,25 @@ function GetIdlangIndent(lnum)
|
|||||||
" Indenting of continued lines.
|
" Indenting of continued lines.
|
||||||
if getline(pnum) =~ '\$\s*\(;.*\)\=$'
|
if getline(pnum) =~ '\$\s*\(;.*\)\=$'
|
||||||
if getline(pnum2) !~ '\$\s*\(;.*\)\=$'
|
if getline(pnum2) !~ '\$\s*\(;.*\)\=$'
|
||||||
let curind = curind+&sw
|
let curind = curind+shiftwidth()
|
||||||
endif
|
endif
|
||||||
else
|
else
|
||||||
if getline(pnum2) =~ '\$\s*\(;.*\)\=$'
|
if getline(pnum2) =~ '\$\s*\(;.*\)\=$'
|
||||||
let curind = curind-&sw
|
let curind = curind-shiftwidth()
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" Indenting blocks of statements.
|
" Indenting blocks of statements.
|
||||||
if getline(v:lnum) =~? '^\s*\(endif\|endelse\|endwhile\|endfor\|endrep\)\>'
|
if getline(v:lnum) =~? '^\s*\(endif\|endelse\|endwhile\|endfor\|endrep\)\>'
|
||||||
if getline(pnum) =~? 'begin\>'
|
if getline(pnum) =~? 'begin\>'
|
||||||
elseif indent(v:lnum) > curind-&sw
|
elseif indent(v:lnum) > curind-shiftwidth()
|
||||||
let curind = curind-&sw
|
let curind = curind-shiftwidth()
|
||||||
else
|
else
|
||||||
return -1
|
return -1
|
||||||
endif
|
endif
|
||||||
elseif getline(pnum) =~? 'begin\>'
|
elseif getline(pnum) =~? 'begin\>'
|
||||||
if indent(v:lnum) < curind+&sw
|
if indent(v:lnum) < curind+shiftwidth()
|
||||||
let curind = curind+&sw
|
let curind = curind+shiftwidth()
|
||||||
else
|
else
|
||||||
return -1
|
return -1
|
||||||
endif
|
endif
|
||||||
|
@ -50,17 +50,17 @@ fun! GetIshdIndent(lnum)
|
|||||||
|
|
||||||
" Add
|
" Add
|
||||||
if previous_line =~ '^\s*\<\(function\|begin\|switch\|case\|default\|if.\{-}then\|else\|elseif\|while\|repeat\)\>'
|
if previous_line =~ '^\s*\<\(function\|begin\|switch\|case\|default\|if.\{-}then\|else\|elseif\|while\|repeat\)\>'
|
||||||
let ind = ind + &sw
|
let ind = ind + shiftwidth()
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" Subtract
|
" Subtract
|
||||||
if this_line =~ '^\s*\<endswitch\>'
|
if this_line =~ '^\s*\<endswitch\>'
|
||||||
let ind = ind - 2 * &sw
|
let ind = ind - 2 * shiftwidth()
|
||||||
elseif this_line =~ '^\s*\<\(begin\|end\|endif\|endwhile\|else\|elseif\|until\)\>'
|
elseif this_line =~ '^\s*\<\(begin\|end\|endif\|endwhile\|else\|elseif\|until\)\>'
|
||||||
let ind = ind - &sw
|
let ind = ind - shiftwidth()
|
||||||
elseif this_line =~ '^\s*\<\(case\|default\)\>'
|
elseif this_line =~ '^\s*\<\(case\|default\)\>'
|
||||||
if previous_line !~ '^\s*\<switch\>'
|
if previous_line !~ '^\s*\<switch\>'
|
||||||
let ind = ind - &sw
|
let ind = ind - shiftwidth()
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
" Language: Javascript
|
" Language: Javascript
|
||||||
" Maintainer: Chris Paul ( https://github.com/bounceme )
|
" Maintainer: Chris Paul ( https://github.com/bounceme )
|
||||||
" URL: https://github.com/pangloss/vim-javascript
|
" URL: https://github.com/pangloss/vim-javascript
|
||||||
" Last Change: December 31, 2016
|
" Last Change: September 18, 2017
|
||||||
|
|
||||||
" Only load this indent file when no other was loaded.
|
" Only load this indent file when no other was loaded.
|
||||||
if exists('b:did_indent')
|
if exists('b:did_indent')
|
||||||
@ -10,13 +10,28 @@ if exists('b:did_indent')
|
|||||||
endif
|
endif
|
||||||
let b:did_indent = 1
|
let b:did_indent = 1
|
||||||
|
|
||||||
|
" indent correctly if inside <script>
|
||||||
|
" vim/vim@690afe1 for the switch from cindent
|
||||||
|
let b:html_indent_script1 = 'inc'
|
||||||
|
|
||||||
" Now, set up our indentation expression and keys that trigger it.
|
" Now, set up our indentation expression and keys that trigger it.
|
||||||
setlocal indentexpr=GetJavascriptIndent()
|
setlocal indentexpr=GetJavascriptIndent()
|
||||||
setlocal autoindent nolisp nosmartindent
|
setlocal autoindent nolisp nosmartindent
|
||||||
setlocal indentkeys+=0],0)
|
setlocal indentkeys+=0],0)
|
||||||
|
" Testable with something like:
|
||||||
|
" vim -eNs "+filetype plugin indent on" "+syntax on" "+set ft=javascript" \
|
||||||
|
" "+norm! gg=G" '+%print' '+:q!' testfile.js \
|
||||||
|
" | diff -uBZ testfile.js -
|
||||||
|
|
||||||
let b:undo_indent = 'setlocal indentexpr< smartindent< autoindent< indentkeys<'
|
let b:undo_indent = 'setlocal indentexpr< smartindent< autoindent< indentkeys<'
|
||||||
|
|
||||||
|
" Regex of syntax group names that are or delimit string or are comments.
|
||||||
|
let b:syng_strcom = get(b:,'syng_strcom','string\|comment\|regex\|special\|doc\|template\%(braces\)\@!')
|
||||||
|
let b:syng_str = get(b:,'syng_str','string\|template\|special')
|
||||||
|
" template strings may want to be excluded when editing graphql:
|
||||||
|
" au! Filetype javascript let b:syng_str = '^\%(.*template\)\@!.*string\|special'
|
||||||
|
" au! Filetype javascript let b:syng_strcom = '^\%(.*template\)\@!.*string\|comment\|regex\|special\|doc'
|
||||||
|
|
||||||
" Only define the function once.
|
" Only define the function once.
|
||||||
if exists('*GetJavascriptIndent')
|
if exists('*GetJavascriptIndent')
|
||||||
finish
|
finish
|
||||||
@ -32,261 +47,309 @@ if exists('*shiftwidth')
|
|||||||
endfunction
|
endfunction
|
||||||
else
|
else
|
||||||
function s:sw()
|
function s:sw()
|
||||||
return &sw
|
return &l:shiftwidth ? &l:shiftwidth : &l:tabstop
|
||||||
endfunction
|
endfunction
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
" Performance for forwards search(): start search at pos rather than masking
|
||||||
|
" matches before pos.
|
||||||
|
let s:z = has('patch-7.4.984') ? 'z' : ''
|
||||||
|
|
||||||
|
" Expression used to check whether we should skip a match with searchpair().
|
||||||
|
let s:skip_expr = "s:SynAt(line('.'),col('.')) =~? b:syng_strcom"
|
||||||
|
let s:in_comm = s:skip_expr[:-14] . "'comment\\|doc'"
|
||||||
|
|
||||||
|
let s:rel = has('reltime')
|
||||||
" searchpair() wrapper
|
" searchpair() wrapper
|
||||||
if has('reltime')
|
if s:rel
|
||||||
function s:GetPair(start,end,flags,skip,time,...)
|
function s:GetPair(start,end,flags,skip)
|
||||||
return searchpair('\m'.a:start,'','\m'.a:end,a:flags,a:skip,max([prevnonblank(v:lnum) - 2000,0] + a:000),a:time)
|
return searchpair('\m'.a:start,'','\m'.a:end,a:flags,a:skip,s:l1,a:skip ==# 's:SkipFunc()' ? 2000 : 200)
|
||||||
endfunction
|
endfunction
|
||||||
else
|
else
|
||||||
function s:GetPair(start,end,flags,skip,...)
|
function s:GetPair(start,end,flags,skip)
|
||||||
return searchpair('\m'.a:start,'','\m'.a:end,a:flags,a:skip,max([prevnonblank(v:lnum) - 1000,get(a:000,1)]))
|
return searchpair('\m'.a:start,'','\m'.a:end,a:flags,a:skip,s:l1)
|
||||||
endfunction
|
endfunction
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" Regex of syntax group names that are or delimit string or are comments.
|
function s:SynAt(l,c)
|
||||||
let s:syng_strcom = 'string\|comment\|regex\|special\|doc\|template'
|
let byte = line2byte(a:l) + a:c - 1
|
||||||
let s:syng_str = 'string\|template'
|
let pos = index(s:synid_cache[0], byte)
|
||||||
let s:syng_com = 'comment\|doc'
|
if pos == -1
|
||||||
" Expression used to check whether we should skip a match with searchpair().
|
let s:synid_cache[:] += [[byte], [synIDattr(synID(a:l, a:c, 0), 'name')]]
|
||||||
let s:skip_expr = "synIDattr(synID(line('.'),col('.'),0),'name') =~? '".s:syng_strcom."'"
|
|
||||||
|
|
||||||
function s:skip_func()
|
|
||||||
if !s:free || search('\m`\|\*\/','nW',s:looksyn)
|
|
||||||
let s:free = !eval(s:skip_expr)
|
|
||||||
let s:looksyn = s:free ? line('.') : s:looksyn
|
|
||||||
return !s:free
|
|
||||||
endif
|
endif
|
||||||
let s:looksyn = line('.')
|
return s:synid_cache[1][pos]
|
||||||
return (search('\m\/','nbW',s:looksyn) || search('\m[''"]\|\\$','nW',s:looksyn)) && eval(s:skip_expr)
|
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function s:alternatePair(stop)
|
function s:ParseCino(f)
|
||||||
let pos = getpos('.')[1:2]
|
let [divider, n, cstr] = [0] + matchlist(&cino,
|
||||||
while search('\m[][(){}]','bW',a:stop)
|
\ '\%(.*,\)\=\%(\%d'.char2nr(a:f).'\(-\)\=\([.s0-9]*\)\)\=')[1:2]
|
||||||
if !s:skip_func()
|
for c in split(cstr,'\zs')
|
||||||
let idx = stridx('])}',s:looking_at())
|
if c == '.' && !divider
|
||||||
if idx + 1
|
let divider = 1
|
||||||
if !s:GetPair(['\[','(','{'][idx], '])}'[idx],'bW','s:skip_func()',2000,a:stop)
|
elseif c ==# 's'
|
||||||
break
|
if n !~ '\d'
|
||||||
|
return n . s:sw() + 0
|
||||||
|
endif
|
||||||
|
let n = str2nr(n) * s:sw()
|
||||||
|
break
|
||||||
|
else
|
||||||
|
let [n, divider] .= [c, 0]
|
||||||
|
endif
|
||||||
|
endfor
|
||||||
|
return str2nr(n) / max([str2nr(divider),1])
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Optimized {skip} expr, only callable from the search loop which
|
||||||
|
" GetJavascriptIndent does to find the containing [[{(] (side-effects)
|
||||||
|
function s:SkipFunc()
|
||||||
|
if s:top_col == 1
|
||||||
|
throw 'out of bounds'
|
||||||
|
endif
|
||||||
|
let s:top_col = 0
|
||||||
|
if s:check_in
|
||||||
|
if eval(s:skip_expr)
|
||||||
|
return 1
|
||||||
|
endif
|
||||||
|
let s:check_in = 0
|
||||||
|
elseif getline('.') =~ '\%<'.col('.').'c\/.\{-}\/\|\%>'.col('.').'c[''"]\|\\$'
|
||||||
|
if eval(s:skip_expr)
|
||||||
|
let s:looksyn = a:firstline
|
||||||
|
return 1
|
||||||
|
endif
|
||||||
|
elseif search('\m`\|\${\|\*\/','nW'.s:z,s:looksyn) && eval(s:skip_expr)
|
||||||
|
let s:check_in = 1
|
||||||
|
return 1
|
||||||
|
endif
|
||||||
|
let [s:looksyn, s:top_col] = getpos('.')[1:2]
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function s:AlternatePair()
|
||||||
|
let [pat, l:for] = ['[][(){};]', 2]
|
||||||
|
while s:SearchLoop(pat,'bW','s:SkipFunc()')
|
||||||
|
if s:LookingAt() == ';'
|
||||||
|
if !l:for
|
||||||
|
if s:GetPair('{','}','bW','s:SkipFunc()')
|
||||||
|
return
|
||||||
endif
|
endif
|
||||||
|
break
|
||||||
else
|
else
|
||||||
|
let [pat, l:for] = ['[{}();]', l:for - 1]
|
||||||
|
endif
|
||||||
|
else
|
||||||
|
let idx = stridx('])}',s:LookingAt())
|
||||||
|
if idx == -1
|
||||||
return
|
return
|
||||||
|
elseif !s:GetPair(['\[','(','{'][idx],'])}'[idx],'bW','s:SkipFunc()')
|
||||||
|
break
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
endwhile
|
endwhile
|
||||||
call call('cursor',pos)
|
throw 'out of bounds'
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function s:save_pos(f,...)
|
function s:Nat(int)
|
||||||
let l:pos = getpos('.')[1:2]
|
return a:int * (a:int > 0)
|
||||||
let ret = call(a:f,a:000)
|
|
||||||
call call('cursor',l:pos)
|
|
||||||
return ret
|
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function s:syn_at(l,c)
|
function s:LookingAt()
|
||||||
return synIDattr(synID(a:l,a:c,0),'name')
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
function s:looking_at()
|
|
||||||
return getline('.')[col('.')-1]
|
return getline('.')[col('.')-1]
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function s:token()
|
function s:Token()
|
||||||
return s:looking_at() =~ '\k' ? expand('<cword>') : s:looking_at()
|
return s:LookingAt() =~ '\k' ? expand('<cword>') : s:LookingAt()
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function s:b_token()
|
function s:PreviousToken()
|
||||||
if s:looking_at() =~ '\k'
|
let l:col = col('.')
|
||||||
call search('\m\<','cbW')
|
if search('\m\k\{1,}\|\S','ebW')
|
||||||
endif
|
if search('\m\*\%#\/\|\/\/\%<'.a:firstline.'l','nbW',line('.')) && eval(s:in_comm)
|
||||||
return search('\m\S','bW')
|
if s:SearchLoop('\S\ze\_s*\/[/*]','bW',s:in_comm)
|
||||||
endfunction
|
return s:Token()
|
||||||
|
endif
|
||||||
function s:previous_token()
|
call cursor(a:firstline, l:col)
|
||||||
let l:n = line('.')
|
|
||||||
while s:b_token()
|
|
||||||
if (s:looking_at() == '/' || line('.') != l:n && search('\m\/\/','nbW',
|
|
||||||
\ line('.'))) && s:syn_at(line('.'),col('.')) =~? s:syng_com
|
|
||||||
call search('\m\_[^/]\zs\/[/*]','bW')
|
|
||||||
else
|
else
|
||||||
return s:token()
|
return s:Token()
|
||||||
endif
|
endif
|
||||||
endwhile
|
endif
|
||||||
return ''
|
return ''
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function s:others(p)
|
function s:Pure(f,...)
|
||||||
return "((line2byte(line('.')) + col('.')) <= ".(line2byte(a:p[0]) + a:p[1]).") || ".s:skip_expr
|
return eval("[call(a:f,a:000),cursor(a:firstline,".col('.').")][0]")
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function s:tern_skip(p)
|
function s:SearchLoop(pat,flags,expr)
|
||||||
return s:GetPair('{','}','nbW',s:others(a:p),200,a:p[0]) > 0
|
return s:GetPair(a:pat,'\_$.',a:flags,a:expr)
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function s:tern_col(p)
|
function s:ExprCol()
|
||||||
return s:GetPair('?',':\@<!::\@!','nbW',s:others(a:p)
|
let bal = 0
|
||||||
\ .' || s:tern_skip('.string(a:p).')',200,a:p[0]) > 0
|
while s:SearchLoop('[{}?]\|\_[^:]\zs::\@!','bW',s:skip_expr)
|
||||||
endfunction
|
if s:LookingAt() == ':'
|
||||||
|
let bal -= 1
|
||||||
function s:label_col()
|
elseif s:LookingAt() == '?'
|
||||||
let pos = getpos('.')[1:2]
|
let bal += 1
|
||||||
let [s:looksyn,s:free] = pos
|
if bal == 1
|
||||||
call s:alternatePair(0)
|
break
|
||||||
if s:save_pos('s:IsBlock')
|
endif
|
||||||
let poss = getpos('.')[1:2]
|
elseif s:LookingAt() == '{'
|
||||||
return call('cursor',pos) || !s:tern_col(poss)
|
let bal = !s:IsBlock()
|
||||||
elseif s:looking_at() == ':'
|
break
|
||||||
return !s:tern_col([0,0])
|
elseif !s:GetPair('{','}','bW',s:skip_expr)
|
||||||
endif
|
break
|
||||||
|
endif
|
||||||
|
endwhile
|
||||||
|
return s:Nat(bal)
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" configurable regexes that define continuation lines, not including (, {, or [.
|
" configurable regexes that define continuation lines, not including (, {, or [.
|
||||||
let s:opfirst = '^' . get(g:,'javascript_opfirst',
|
let s:opfirst = '^' . get(g:,'javascript_opfirst',
|
||||||
\ '\%([<>=,?^%|*/&]\|\([-.:+]\)\1\@!\|!=\|in\%(stanceof\)\=\>\)')
|
\ '\C\%([<>=,.?^%|/&]\|\([-:+]\)\1\@!\|\*\+\|!=\|in\%(stanceof\)\=\>\)')
|
||||||
let s:continuation = get(g:,'javascript_continuation',
|
let s:continuation = get(g:,'javascript_continuation',
|
||||||
\ '\%([<=,.~!?/*^%|&:]\|+\@<!+\|-\@<!-\|=\@<!>\|\<\%(typeof\|delete\|void\|in\|instanceof\)\)') . '$'
|
\ '\C\%([<=,.~!?/*^%|&:]\|+\@<!+\|-\@<!-\|=\@<!>\|\<\%(typeof\|new\|delete\|void\|in\|instanceof\|await\)\)') . '$'
|
||||||
|
|
||||||
function s:continues(ln,con)
|
function s:Continues(ln,con)
|
||||||
return !cursor(a:ln, match(' '.a:con,s:continuation)) &&
|
let tok = matchstr(a:con[-15:],s:continuation)
|
||||||
\ eval((['s:syn_at(line("."),col(".")) !~? "regex"'] +
|
if tok =~ '[a-z:]'
|
||||||
\ repeat(['s:previous_token() != "."'],5) + [1])[
|
call cursor(a:ln, len(a:con))
|
||||||
\ index(split('/ typeof in instanceof void delete'),s:token())])
|
return tok == ':' ? s:ExprCol() : s:PreviousToken() != '.'
|
||||||
endfunction
|
elseif tok !~ '[/>]'
|
||||||
|
return tok isnot ''
|
||||||
" get the line of code stripped of comments and move cursor to the last
|
endif
|
||||||
" non-comment char.
|
return s:SynAt(a:ln, len(a:con)) !~? (tok == '>' ? 'jsflow\|^html' : 'regex')
|
||||||
function s:Trim(ln)
|
|
||||||
let pline = substitute(getline(a:ln),'\s*$','','')
|
|
||||||
let l:max = max([match(pline,'.*[^/]\zs\/[/*]'),0])
|
|
||||||
while l:max && s:syn_at(a:ln, strlen(pline)) =~? s:syng_com
|
|
||||||
let pline = substitute(strpart(pline, 0, l:max),'\s*$','','')
|
|
||||||
let l:max = max([match(pline,'.*[^/]\zs\/[/*]'),0])
|
|
||||||
endwhile
|
|
||||||
return cursor(a:ln,strlen(pline)) ? pline : pline
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
" Find line above 'lnum' that isn't empty or in a comment
|
|
||||||
function s:PrevCodeLine(lnum)
|
|
||||||
let l:n = prevnonblank(a:lnum)
|
|
||||||
while l:n
|
|
||||||
if getline(l:n) =~ '^\s*\/[/*]'
|
|
||||||
if (stridx(getline(l:n),'`') > 0 || getline(l:n-1)[-1:] == '\') &&
|
|
||||||
\ s:syn_at(l:n,1) =~? s:syng_str
|
|
||||||
return l:n
|
|
||||||
endif
|
|
||||||
let l:n = prevnonblank(l:n-1)
|
|
||||||
elseif s:syn_at(l:n,1) =~? s:syng_com
|
|
||||||
let l:n = s:save_pos('eval',
|
|
||||||
\ 'cursor('.l:n.',1) + search(''\m\/\*'',"bW")')
|
|
||||||
else
|
|
||||||
return l:n
|
|
||||||
endif
|
|
||||||
endwhile
|
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" Check if line 'lnum' has a balanced amount of parentheses.
|
" Check if line 'lnum' has a balanced amount of parentheses.
|
||||||
function s:Balanced(lnum)
|
function s:Balanced(lnum)
|
||||||
let l:open = 0
|
let [l:open, l:line] = [0, getline(a:lnum)]
|
||||||
let l:line = getline(a:lnum)
|
let pos = match(l:line, '[][(){}]')
|
||||||
let pos = match(l:line, '[][(){}]', 0)
|
|
||||||
while pos != -1
|
while pos != -1
|
||||||
if s:syn_at(a:lnum,pos + 1) !~? s:syng_strcom
|
if s:SynAt(a:lnum,pos + 1) !~? b:syng_strcom
|
||||||
let l:open += match(' ' . l:line[pos],'[[({]')
|
let l:open += match(' ' . l:line[pos],'[[({]')
|
||||||
if l:open < 0
|
if l:open < 0
|
||||||
return
|
return
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
let pos = match(l:line, '[][(){}]', pos + 1)
|
let pos = match(l:line, !l:open ? '[][(){}]' : '()' =~ l:line[pos] ?
|
||||||
|
\ '[()]' : '{}' =~ l:line[pos] ? '[{}]' : '[][]', pos + 1)
|
||||||
endwhile
|
endwhile
|
||||||
return !l:open
|
return !l:open
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function s:OneScope(lnum)
|
function s:OneScope()
|
||||||
let pline = s:Trim(a:lnum)
|
if s:LookingAt() == ')' && s:GetPair('(', ')', 'bW', s:skip_expr)
|
||||||
let kw = 'else do'
|
let tok = s:PreviousToken()
|
||||||
if pline[-1:] == ')' && s:GetPair('(', ')', 'bW', s:skip_expr, 100) > 0
|
return (count(split('for if let while with'),tok) ||
|
||||||
call s:previous_token()
|
\ tok =~# '^await$\|^each$' && s:PreviousToken() ==# 'for') &&
|
||||||
let kw = 'for if let while with'
|
\ s:Pure('s:PreviousToken') != '.' && !(tok == 'while' && s:DoWhile())
|
||||||
if index(split('await each'),s:token()) + 1
|
elseif s:Token() =~# '^else$\|^do$'
|
||||||
call s:previous_token()
|
return s:Pure('s:PreviousToken') != '.'
|
||||||
let kw = 'for'
|
|
||||||
endif
|
|
||||||
endif
|
endif
|
||||||
return pline[-2:] == '=>' || index(split(kw),s:token()) + 1 &&
|
return strpart(getline('.'),col('.')-2,2) == '=>'
|
||||||
\ s:save_pos('s:previous_token') != '.'
|
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" returns braceless levels started by 'i' and above lines * &sw. 'num' is the
|
function s:DoWhile()
|
||||||
" lineNr which encloses the entire context, 'cont' if whether line 'i' + 1 is
|
let cpos = searchpos('\m\<','cbW')
|
||||||
" a continued expression, which could have started in a braceless context
|
if s:SearchLoop('\C[{}]\|\<\%(do\|while\)\>','bW',s:skip_expr)
|
||||||
function s:iscontOne(i,num,cont)
|
if s:{s:LookingAt() == '}' && s:GetPair('{','}','bW',s:skip_expr) ?
|
||||||
let [l:i, l:num, bL] = [a:i, a:num + !a:num, 0]
|
\ 'Previous' : ''}Token() ==# 'do' && s:IsBlock()
|
||||||
let pind = a:num ? indent(l:num) + s:W : 0
|
return 1
|
||||||
let ind = indent(l:i) + (a:cont ? 0 : s:W)
|
endif
|
||||||
while l:i >= l:num && (ind > pind || l:i == l:num)
|
call call('cursor',cpos)
|
||||||
if indent(l:i) < ind && s:OneScope(l:i)
|
endif
|
||||||
let bL += s:W
|
endfunction
|
||||||
let l:i = line('.')
|
|
||||||
elseif !a:cont || bL || ind < indent(a:i)
|
" returns total offset from braceless contexts. 'num' is the lineNr which
|
||||||
|
" encloses the entire context, 'cont' if whether a:firstline is a continued
|
||||||
|
" expression, which could have started in a braceless context
|
||||||
|
function s:IsContOne(num,cont)
|
||||||
|
let [l:num, b_l] = [a:num + !a:num, 0]
|
||||||
|
let pind = a:num ? indent(a:num) + s:sw() : 0
|
||||||
|
let ind = indent('.') + !a:cont
|
||||||
|
while line('.') > l:num && ind > pind || line('.') == l:num
|
||||||
|
if indent('.') < ind && s:OneScope()
|
||||||
|
let b_l += 1
|
||||||
|
elseif !a:cont || b_l || ind < indent(a:firstline)
|
||||||
|
break
|
||||||
|
else
|
||||||
|
call cursor(0,1)
|
||||||
|
endif
|
||||||
|
let ind = min([ind, indent('.')])
|
||||||
|
if s:PreviousToken() is ''
|
||||||
break
|
break
|
||||||
endif
|
endif
|
||||||
let ind = min([ind, indent(l:i)])
|
|
||||||
let l:i = s:PrevCodeLine(l:i - 1)
|
|
||||||
endwhile
|
endwhile
|
||||||
return bL
|
return b_l
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function s:Class()
|
||||||
|
return (s:Token() ==# 'class' || s:PreviousToken() =~# '^class$\|^extends$') &&
|
||||||
|
\ s:PreviousToken() != '.'
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function s:IsSwitch()
|
||||||
|
return s:PreviousToken() !~ '[.*]' &&
|
||||||
|
\ (!s:GetPair('{','}','cbW',s:skip_expr) || s:IsBlock() && !s:Class())
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" https://github.com/sweet-js/sweet.js/wiki/design#give-lookbehind-to-the-reader
|
" https://github.com/sweet-js/sweet.js/wiki/design#give-lookbehind-to-the-reader
|
||||||
function s:IsBlock()
|
function s:IsBlock()
|
||||||
if s:looking_at() == '{'
|
let tok = s:PreviousToken()
|
||||||
let l:n = line('.')
|
if join(s:stack) =~? 'xml\|jsx' && s:SynAt(line('.'),col('.')-1) =~? 'xml\|jsx'
|
||||||
let char = s:previous_token()
|
return tok != '{'
|
||||||
let syn = char =~ '[{>/]' ? s:syn_at(line('.'),col('.')-(char == '{')) : ''
|
elseif tok =~ '\k'
|
||||||
if syn =~? 'xml\|jsx'
|
if tok ==# 'type'
|
||||||
return char != '{'
|
return s:Pure('eval',"s:PreviousToken() !~# '^\\%(im\\|ex\\)port$' || s:PreviousToken() == '.'")
|
||||||
elseif char =~ '\k'
|
elseif tok ==# 'of'
|
||||||
return index(split('return const let import export yield default delete var await void typeof throw case new in instanceof')
|
return s:Pure('eval',"!s:GetPair('[[({]','[])}]','bW',s:skip_expr) || s:LookingAt() != '(' ||"
|
||||||
\ ,char) < (line('.') != l:n) || s:previous_token() == '.'
|
\ ."s:{s:PreviousToken() ==# 'await' ? 'Previous' : ''}Token() !=# 'for' || s:PreviousToken() == '.'")
|
||||||
elseif char == '>'
|
|
||||||
return getline('.')[col('.')-2] == '=' || syn =~? '^jsflow'
|
|
||||||
elseif char == ':'
|
|
||||||
return getline('.')[col('.')-2] != ':' && s:label_col()
|
|
||||||
endif
|
endif
|
||||||
return syn =~? 'regex' || char !~ '[-=~!<*+,/?^%|&([]'
|
return index(split('return const let import export extends yield default delete var await void typeof throw case new in instanceof')
|
||||||
|
\ ,tok) < (line('.') != a:firstline) || s:Pure('s:PreviousToken') == '.'
|
||||||
|
elseif tok == '>'
|
||||||
|
return getline('.')[col('.')-2] == '=' || s:SynAt(line('.'),col('.')) =~? 'jsflow\|^html'
|
||||||
|
elseif tok == '*'
|
||||||
|
return s:Pure('s:PreviousToken') == ':'
|
||||||
|
elseif tok == ':'
|
||||||
|
return s:Pure('eval',"s:PreviousToken() =~ '^\\K\\k*$' && !s:ExprCol()")
|
||||||
|
elseif tok == '/'
|
||||||
|
return s:SynAt(line('.'),col('.')) =~? 'regex'
|
||||||
|
elseif tok !~ '[=~!<,.?^%|&([]'
|
||||||
|
return tok !~ '[-+]' || line('.') != a:firstline && getline('.')[col('.')-2] == tok
|
||||||
endif
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function GetJavascriptIndent()
|
function GetJavascriptIndent()
|
||||||
let b:js_cache = get(b:,'js_cache',[0,0,0])
|
let b:js_cache = get(b:,'js_cache',[0,0,0])
|
||||||
" Get the current line.
|
let s:synid_cache = [[],[]]
|
||||||
call cursor(v:lnum,1)
|
let l:line = getline(v:lnum)
|
||||||
let l:line = getline('.')
|
" use synstack as it validates syn state and works in an empty line
|
||||||
let syns = s:syn_at(v:lnum, 1)
|
let s:stack = [''] + map(synstack(v:lnum,1),"synIDattr(v:val,'name')")
|
||||||
|
|
||||||
" start with strings,comments,etc.
|
" start with strings,comments,etc.
|
||||||
if syns =~? s:syng_com
|
if s:stack[-1] =~? 'comment\|doc'
|
||||||
if l:line =~ '^\s*\*'
|
if l:line =~ '^\s*\*'
|
||||||
return cindent(v:lnum)
|
return cindent(v:lnum)
|
||||||
elseif l:line !~ '^\s*\/[/*]'
|
elseif l:line !~ '^\s*\/[/*]'
|
||||||
return -1
|
return -1
|
||||||
endif
|
endif
|
||||||
elseif syns =~? s:syng_str && l:line !~ '^[''"]'
|
elseif s:stack[-1] =~? b:syng_str
|
||||||
if b:js_cache[0] == v:lnum - 1 && s:Balanced(v:lnum-1)
|
if b:js_cache[0] == v:lnum - 1 && s:Balanced(v:lnum-1)
|
||||||
let b:js_cache[0] = v:lnum
|
let b:js_cache[0] = v:lnum
|
||||||
endif
|
endif
|
||||||
return -1
|
return -1
|
||||||
endif
|
endif
|
||||||
let l:lnum = s:PrevCodeLine(v:lnum - 1)
|
|
||||||
if !l:lnum
|
let s:l1 = max([0,prevnonblank(v:lnum) - (s:rel ? 2000 : 1000),
|
||||||
|
\ get(get(b:,'hi_indent',{}),'blocklnr')])
|
||||||
|
call cursor(v:lnum,1)
|
||||||
|
if s:PreviousToken() is ''
|
||||||
return
|
return
|
||||||
endif
|
endif
|
||||||
|
let [l:lnum, pline] = [line('.'), getline('.')[:col('.')-1]]
|
||||||
|
|
||||||
let l:line = substitute(l:line,'^\s*','','')
|
let l:line = substitute(l:line,'^\s*','','')
|
||||||
|
let l:line_raw = l:line
|
||||||
if l:line[:1] == '/*'
|
if l:line[:1] == '/*'
|
||||||
let l:line = substitute(l:line,'^\%(\/\*.\{-}\*\/\s*\)*','','')
|
let l:line = substitute(l:line,'^\%(\/\*.\{-}\*\/\s*\)*','','')
|
||||||
endif
|
endif
|
||||||
@ -295,69 +358,91 @@ function GetJavascriptIndent()
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
" the containing paren, bracket, or curly. Many hacks for performance
|
" the containing paren, bracket, or curly. Many hacks for performance
|
||||||
let idx = strlen(l:line) ? stridx('])}',l:line[0]) : -1
|
call cursor(v:lnum,1)
|
||||||
if b:js_cache[0] >= l:lnum && b:js_cache[0] < v:lnum &&
|
let idx = index([']',')','}'],l:line[0])
|
||||||
\ (b:js_cache[0] > l:lnum || s:Balanced(l:lnum))
|
if b:js_cache[0] > l:lnum && b:js_cache[0] < v:lnum ||
|
||||||
|
\ b:js_cache[0] == l:lnum && s:Balanced(l:lnum)
|
||||||
call call('cursor',b:js_cache[1:])
|
call call('cursor',b:js_cache[1:])
|
||||||
else
|
else
|
||||||
let [s:looksyn, s:free, top] = [v:lnum - 1, 1, (!indent(l:lnum) &&
|
let [s:looksyn, s:top_col, s:check_in, s:l1] = [v:lnum - 1,0,0,
|
||||||
\ s:syn_at(l:lnum,1) !~? s:syng_str) * l:lnum]
|
\ max([s:l1, &smc ? search('\m^.\{'.&smc.',}','nbW',s:l1 + 1) + 1 : 0])]
|
||||||
if idx + 1
|
try
|
||||||
call s:GetPair(['\[','(','{'][idx], '])}'[idx],'bW','s:skip_func()',2000,top)
|
if idx != -1
|
||||||
elseif indent(v:lnum) && syns =~? 'block'
|
call s:GetPair(['\[','(','{'][idx],'])}'[idx],'bW','s:SkipFunc()')
|
||||||
call s:GetPair('{','}','bW','s:skip_func()',2000,top)
|
elseif getline(v:lnum) !~ '^\S' && s:stack[-1] =~? 'block\|^jsobject$'
|
||||||
else
|
call s:GetPair('{','}','bW','s:SkipFunc()')
|
||||||
call s:alternatePair(top)
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
if idx + 1 || l:line[:1] == '|}'
|
|
||||||
if idx == 2 && search('\m\S','bW',line('.')) && s:looking_at() == ')'
|
|
||||||
call s:GetPair('(',')','bW',s:skip_expr,200)
|
|
||||||
endif
|
|
||||||
return indent('.')
|
|
||||||
endif
|
|
||||||
|
|
||||||
let b:js_cache = [v:lnum] + (line('.') == v:lnum ? [0,0] : getpos('.')[1:2])
|
|
||||||
let num = b:js_cache[1]
|
|
||||||
|
|
||||||
let [s:W, isOp, bL, switch_offset] = [s:sw(),0,0,0]
|
|
||||||
if !num || s:IsBlock()
|
|
||||||
let pline = s:save_pos('s:Trim',l:lnum)
|
|
||||||
if num && s:looking_at() == ')' && s:GetPair('(', ')', 'bW', s:skip_expr, 100) > 0
|
|
||||||
let num = line('.')
|
|
||||||
if s:previous_token() ==# 'switch' && s:previous_token() != '.'
|
|
||||||
if &cino !~ ':' || !has('float')
|
|
||||||
let switch_offset = s:W
|
|
||||||
else
|
|
||||||
let cinc = matchlist(&cino,'.*:\(-\)\=\([0-9.]*\)\(s\)\=\C')
|
|
||||||
let switch_offset = float2nr(str2float(cinc[1].(strlen(cinc[2]) ? cinc[2] : strlen(cinc[3])))
|
|
||||||
\ * (strlen(cinc[3]) ? s:W : 1))
|
|
||||||
endif
|
|
||||||
if pline[-1:] != '.' && l:line =~# '^\%(default\|case\)\>'
|
|
||||||
return indent(num) + switch_offset
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
if pline[-1:] !~ '[{;]'
|
|
||||||
if pline =~# ':\@<!:$'
|
|
||||||
call cursor(l:lnum,strlen(pline))
|
|
||||||
let isOp = s:tern_col(b:js_cache[1:2])
|
|
||||||
else
|
else
|
||||||
let isOp = l:line =~# s:opfirst || s:continues(l:lnum,pline)
|
call s:AlternatePair()
|
||||||
|
endif
|
||||||
|
catch /^\Cout of bounds$/
|
||||||
|
call cursor(v:lnum,1)
|
||||||
|
endtry
|
||||||
|
let b:js_cache[1:] = line('.') == v:lnum ? [0,0] : getpos('.')[1:2]
|
||||||
|
endif
|
||||||
|
|
||||||
|
let [b:js_cache[0], num] = [v:lnum, b:js_cache[1]]
|
||||||
|
|
||||||
|
let [num_ind, is_op, b_l, l:switch_offset] = [s:Nat(indent(num)),0,0,0]
|
||||||
|
if !num || s:LookingAt() == '{' && s:IsBlock()
|
||||||
|
let ilnum = line('.')
|
||||||
|
if num && s:LookingAt() == ')' && s:GetPair('(',')','bW',s:skip_expr)
|
||||||
|
if ilnum == num
|
||||||
|
let [num, num_ind] = [line('.'), indent('.')]
|
||||||
|
endif
|
||||||
|
if idx == -1 && s:PreviousToken() ==# 'switch' && s:IsSwitch()
|
||||||
|
let l:switch_offset = &cino !~ ':' ? s:sw() : s:ParseCino(':')
|
||||||
|
if pline[-1:] != '.' && l:line =~# '^\%(default\|case\)\>'
|
||||||
|
return s:Nat(num_ind + l:switch_offset)
|
||||||
|
elseif &cino =~ '='
|
||||||
|
let l:case_offset = s:ParseCino('=')
|
||||||
|
endif
|
||||||
endif
|
endif
|
||||||
let bL = s:iscontOne(l:lnum,num,isOp)
|
|
||||||
let bL -= (bL && l:line[0] == '{') * s:W
|
|
||||||
endif
|
endif
|
||||||
|
if idx == -1 && pline[-1:] !~ '[{;]'
|
||||||
|
let sol = matchstr(l:line,s:opfirst)
|
||||||
|
if sol is '' || sol == '/' && s:SynAt(v:lnum,
|
||||||
|
\ 1 + len(getline(v:lnum)) - len(l:line)) =~? 'regex'
|
||||||
|
if s:Continues(l:lnum,pline)
|
||||||
|
let is_op = s:sw()
|
||||||
|
endif
|
||||||
|
elseif num && sol =~# '^\%(in\%(stanceof\)\=\|\*\)$'
|
||||||
|
call call('cursor',b:js_cache[1:])
|
||||||
|
if s:PreviousToken() =~ '\k' && s:Class()
|
||||||
|
return num_ind + s:sw()
|
||||||
|
endif
|
||||||
|
let is_op = s:sw()
|
||||||
|
else
|
||||||
|
let is_op = s:sw()
|
||||||
|
endif
|
||||||
|
call cursor(l:lnum, len(pline))
|
||||||
|
let b_l = s:Nat(s:IsContOne(b:js_cache[1],is_op) - (!is_op && l:line =~ '^{')) * s:sw()
|
||||||
|
endif
|
||||||
|
elseif idx.s:LookingAt().&cino =~ '^-1(.*(' && (search('\m\S','nbW',num) || s:ParseCino('U'))
|
||||||
|
let pval = s:ParseCino('(')
|
||||||
|
if !pval
|
||||||
|
let [Wval, vcol] = [s:ParseCino('W'), virtcol('.')]
|
||||||
|
if search('\m\S','W',num)
|
||||||
|
return s:ParseCino('w') ? vcol : virtcol('.')-1
|
||||||
|
endif
|
||||||
|
return Wval ? s:Nat(num_ind + Wval) : vcol
|
||||||
|
endif
|
||||||
|
return s:Nat(num_ind + pval + searchpair('\m(','','\m)','nbrmW',s:skip_expr,num) * s:sw())
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" main return
|
" main return
|
||||||
if isOp
|
if l:line =~ '^[])}]\|^|}'
|
||||||
return (num ? indent(num) : -s:W) + (s:W * 2) + switch_offset + bL
|
if l:line_raw[0] == ')' && getline(num)[b:js_cache[2]-1] == '('
|
||||||
|
if s:ParseCino('M')
|
||||||
|
return indent(l:lnum)
|
||||||
|
elseif &cino =~# 'm' && !s:ParseCino('m')
|
||||||
|
return virtcol('.') - 1
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
return num_ind
|
||||||
elseif num
|
elseif num
|
||||||
return indent(num) + s:W + switch_offset + bL
|
return s:Nat(num_ind + get(l:,'case_offset',s:sw()) + l:switch_offset + b_l + is_op)
|
||||||
endif
|
endif
|
||||||
return bL
|
return b_l + is_op
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
let &cpo = s:cpo_save
|
let &cpo = s:cpo_save
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
" Vim indent file
|
" Vim indent file
|
||||||
" Language: JSON
|
" Language: JSON
|
||||||
" Mantainer: Eli Parra <eli@elzr.com> https://github.com/elzr/vim-json
|
" Mantainer: Eli Parra <eli@elzr.com> https://github.com/elzr/vim-json
|
||||||
" Last Change: 2014 Aug 29
|
" Last Change: 2017 Jun 13
|
||||||
" https://github.com/jakar/vim-json/commit/20b650e22aa750c4ab6a66aa646bdd95d7cd548a#diff-e81fc111b2052e306d126bd9989f7b7c
|
" https://github.com/jakar/vim-json/commit/20b650e22aa750c4ab6a66aa646bdd95d7cd548a#diff-e81fc111b2052e306d126bd9989f7b7c
|
||||||
" Original Author: Rogerz Zhang <rogerz.zhang at gmail.com> http://github.com/rogerz/vim-json
|
" Original Author: Rogerz Zhang <rogerz.zhang at gmail.com> http://github.com/rogerz/vim-json
|
||||||
" Acknowledgement: Based off of vim-javascript maintained by Darrick Wiebe
|
" Acknowledgement: Based off of vim-javascript maintained by Darrick Wiebe
|
||||||
@ -141,7 +141,7 @@ function GetJSONIndent()
|
|||||||
|
|
||||||
" If the previous line ended with a block opening, add a level of indent.
|
" If the previous line ended with a block opening, add a level of indent.
|
||||||
" if s:Match(lnum, s:block_regex)
|
" if s:Match(lnum, s:block_regex)
|
||||||
" return indent(lnum) + &sw
|
" return indent(lnum) + shiftwidth()
|
||||||
" endif
|
" endif
|
||||||
|
|
||||||
" If the previous line contained an opening bracket, and we are still in it,
|
" If the previous line contained an opening bracket, and we are still in it,
|
||||||
@ -149,7 +149,7 @@ function GetJSONIndent()
|
|||||||
if line =~ '[[({]'
|
if line =~ '[[({]'
|
||||||
let counts = s:LineHasOpeningBrackets(lnum)
|
let counts = s:LineHasOpeningBrackets(lnum)
|
||||||
if counts[0] == '1' || counts[1] == '1' || counts[2] == '1'
|
if counts[0] == '1' || counts[1] == '1' || counts[2] == '1'
|
||||||
return ind + &sw
|
return ind + shiftwidth()
|
||||||
else
|
else
|
||||||
call cursor(v:lnum, vcol)
|
call cursor(v:lnum, vcol)
|
||||||
end
|
end
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
" Vim indent file
|
" Vim indent file
|
||||||
" Language: Liquid
|
" Language: Liquid
|
||||||
" Maintainer: Tim Pope <vimNOSPAM@tpope.org>
|
" Maintainer: Tim Pope <vimNOSPAM@tpope.org>
|
||||||
" Last Change: 2016 Aug 29
|
" Last Change: 2017 Jun 13
|
||||||
|
|
||||||
if exists('b:did_indent')
|
if exists('b:did_indent')
|
||||||
finish
|
finish
|
||||||
@ -54,7 +54,7 @@ function! GetLiquidIndent(...)
|
|||||||
let line = substitute(line,'\C^\%(\s*{%\s*end\w*\s*%}\)\+','','')
|
let line = substitute(line,'\C^\%(\s*{%\s*end\w*\s*%}\)\+','','')
|
||||||
let line .= matchstr(cline,'\C^\%(\s*{%\s*end\w*\s*%}\)\+')
|
let line .= matchstr(cline,'\C^\%(\s*{%\s*end\w*\s*%}\)\+')
|
||||||
let cline = substitute(cline,'\C^\%(\s*{%\s*end\w*\s*%}\)\+','','')
|
let cline = substitute(cline,'\C^\%(\s*{%\s*end\w*\s*%}\)\+','','')
|
||||||
let sw = exists('*shiftwidth') ? shiftwidth() : &sw
|
let sw = shiftwidth()
|
||||||
let ind += sw * s:count(line,'{%\s*\%(if\|elsif\|else\|unless\|ifchanged\|case\|when\|for\|empty\|tablerow\|capture\)\>')
|
let ind += sw * s:count(line,'{%\s*\%(if\|elsif\|else\|unless\|ifchanged\|case\|when\|for\|empty\|tablerow\|capture\)\>')
|
||||||
let ind -= sw * s:count(line,'{%\s*end\%(if\|unless\|ifchanged\|case\|for\|tablerow\|capture\)\>')
|
let ind -= sw * s:count(line,'{%\s*end\%(if\|unless\|ifchanged\|case\|for\|tablerow\|capture\)\>')
|
||||||
let ind -= sw * s:count(cline,'{%\s*\%(elsif\|else\|when\|empty\)\>')
|
let ind -= sw * s:count(cline,'{%\s*\%(elsif\|else\|when\|empty\)\>')
|
||||||
|
@ -38,24 +38,24 @@ function! GetLogtalkIndent()
|
|||||||
endif
|
endif
|
||||||
" Check for entity opening directive on previous line
|
" Check for entity opening directive on previous line
|
||||||
if pline =~ '^\s*:-\s\(object\|protocol\|category\)\ze(.*,$'
|
if pline =~ '^\s*:-\s\(object\|protocol\|category\)\ze(.*,$'
|
||||||
let ind = ind + &sw
|
let ind = ind + shiftwidth()
|
||||||
" Check for clause head on previous line
|
" Check for clause head on previous line
|
||||||
elseif pline =~ ':-\s*\(%.*\)\?$'
|
elseif pline =~ ':-\s*\(%.*\)\?$'
|
||||||
let ind = ind + &sw
|
let ind = ind + shiftwidth()
|
||||||
" Check for entity closing directive on previous line
|
" Check for entity closing directive on previous line
|
||||||
elseif pline =~ '^\s*:-\send_\(object\|protocol\|category\)\.\(%.*\)\?$'
|
elseif pline =~ '^\s*:-\send_\(object\|protocol\|category\)\.\(%.*\)\?$'
|
||||||
let ind = ind - &sw
|
let ind = ind - shiftwidth()
|
||||||
" Check for end of clause on previous line
|
" Check for end of clause on previous line
|
||||||
elseif pline =~ '\.\s*\(%.*\)\?$'
|
elseif pline =~ '\.\s*\(%.*\)\?$'
|
||||||
let ind = ind - &sw
|
let ind = ind - shiftwidth()
|
||||||
endif
|
endif
|
||||||
" Check for opening conditional on previous line
|
" Check for opening conditional on previous line
|
||||||
if pline =~ '^\s*\([(;]\|->\)' && pline !~ '\.\s*\(%.*\)\?$' && pline !~ '^.*\([)][,]\s*\(%.*\)\?$\)'
|
if pline =~ '^\s*\([(;]\|->\)' && pline !~ '\.\s*\(%.*\)\?$' && pline !~ '^.*\([)][,]\s*\(%.*\)\?$\)'
|
||||||
let ind = ind + &sw
|
let ind = ind + shiftwidth()
|
||||||
endif
|
endif
|
||||||
" Check for closing an unclosed paren, or middle ; or ->
|
" Check for closing an unclosed paren, or middle ; or ->
|
||||||
if line =~ '^\s*\([);]\|->\)'
|
if line =~ '^\s*\([);]\|->\)'
|
||||||
let ind = ind - &sw
|
let ind = ind - shiftwidth()
|
||||||
endif
|
endif
|
||||||
return ind
|
return ind
|
||||||
endfunction
|
endfunction
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user