aboutsummaryrefslogtreecommitdiff
path: root/runtime
diff options
context:
space:
mode:
Diffstat (limited to 'runtime')
-rw-r--r--runtime/autoload/ccomplete.vim39
-rw-r--r--runtime/autoload/dist/ft.vim2
-rw-r--r--runtime/autoload/tar.vim33
-rw-r--r--runtime/compiler/stack.vim37
-rw-r--r--runtime/doc/if_pyth.txt12
-rw-r--r--runtime/doc/options.txt2
-rw-r--r--runtime/ftplugin/cmake.vim20
-rw-r--r--runtime/indent/dosbatch.vim59
-rw-r--r--runtime/indent/teraterm.vim4
-rw-r--r--runtime/syntax/teraterm.vim17
10 files changed, 200 insertions, 25 deletions
diff --git a/runtime/autoload/ccomplete.vim b/runtime/autoload/ccomplete.vim
index d5bfa076a9..156b3af025 100644
--- a/runtime/autoload/ccomplete.vim
+++ b/runtime/autoload/ccomplete.vim
@@ -1,7 +1,7 @@
" Vim completion script
" Language: C
" Maintainer: Bram Moolenaar <Bram@vim.org>
-" Last Change: 2012 Jun 20
+" Last Change: 2018 Aug 20
let s:cpo_save = &cpo
set cpo&vim
@@ -72,8 +72,10 @@ function! ccomplete#Complete(findstart, base)
" Split item in words, keep empty word after "." or "->".
" "aa" -> ['aa'], "aa." -> ['aa', ''], "aa.bb" -> ['aa', 'bb'], etc.
" We can't use split, because we need to skip nested [...].
+ " "aa[...]" -> ['aa', '[...]'], "aa.bb[...]" -> ['aa', 'bb', '[...]'], etc.
let items = []
let s = 0
+ let arrays = 0
while 1
let e = match(base, '\.\|->\|\[', s)
if e < 0
@@ -107,6 +109,7 @@ function! ccomplete#Complete(findstart, base)
endwhile
let e += 1
call add(items, strpart(base, s, e - s))
+ let arrays += 1
let s = e
endif
endwhile
@@ -161,15 +164,26 @@ function! ccomplete#Complete(findstart, base)
endif
endif
let res = [{'match': match, 'tagline' : '', 'kind' : kind, 'info' : line}]
+ elseif len(items) == arrays + 1
+ " Completing one word and it's a local array variable: build tagline
+ " from declaration line
+ let match = items[0]
+ let kind = 'v'
+ let tagline = "\t/^" . line . '$/'
+ let res = [{'match': match, 'tagline' : tagline, 'kind' : kind, 'info' : line}]
else
" Completing "var.", "var.something", etc.
let res = s:Nextitem(strpart(line, 0, col), items[1:], 0, 1)
endif
endif
- if len(items) == 1
+ if len(items) == 1 || len(items) == arrays + 1
" Only one part, no "." or "->": complete from tags file.
- let tags = taglist('^' . base)
+ if len(items) == 1
+ let tags = taglist('^' . base)
+ else
+ let tags = taglist('^' . items[0] . '$')
+ endif
" Remove members, these can't appear without something in front.
call filter(tags, 'has_key(v:val, "kind") ? v:val["kind"] != "m" : 1')
@@ -516,11 +530,24 @@ function! s:StructMembers(typename, items, all)
endif
endif
+ " Skip over [...] items
+ let idx = 0
+ while 1
+ if idx >= len(a:items)
+ let target = '' " No further items, matching all members
+ break
+ endif
+ if a:items[idx][0] != '['
+ let target = a:items[idx]
+ break
+ endif
+ let idx += 1
+ endwhile
" Put matching members in matches[].
let matches = []
for l in qflist
let memb = matchstr(l['text'], '[^\t]*')
- if memb =~ '^' . a:items[0]
+ if memb =~ '^' . target
" Skip matches local to another file.
if match(l['text'], "\tfile:") < 0 || bufnr('%') == bufnr(matchstr(l['text'], '\t\zs[^\t]*'))
let item = {'match': memb, 'tagline': l['text']}
@@ -540,8 +567,8 @@ function! s:StructMembers(typename, items, all)
endfor
if len(matches) > 0
- " Skip over [...] items
- let idx = 1
+ " Skip over next [...] items
+ let idx += 1
while 1
if idx >= len(a:items)
return matches " No further items, return the result.
diff --git a/runtime/autoload/dist/ft.vim b/runtime/autoload/dist/ft.vim
index 81fdc9d956..160cdcff64 100644
--- a/runtime/autoload/dist/ft.vim
+++ b/runtime/autoload/dist/ft.vim
@@ -632,7 +632,7 @@ endfunc
" Choose context, plaintex, or tex (LaTeX) based on these rules:
" 1. Check the first line of the file for "%&<format>".
" 2. Check the first 1000 non-comment lines for LaTeX or ConTeXt keywords.
-" 3. Default to "latex" or to g:tex_flavor, can be set in user's vimrc.
+" 3. Default to "plain" or to g:tex_flavor, can be set in user's vimrc.
func dist#ft#FTtex()
let firstline = getline(1)
if firstline =~ '^%&\s*\a\+'
diff --git a/runtime/autoload/tar.vim b/runtime/autoload/tar.vim
index 34eab96709..d92fe1b180 100644
--- a/runtime/autoload/tar.vim
+++ b/runtime/autoload/tar.vim
@@ -152,13 +152,16 @@ fun! tar#Browse(tarfile)
" assuming cygwin
let tarfile=substitute(system("cygpath -u ".shellescape(tarfile,0)),'\n$','','e')
endif
+
+ let gzip_command = s:get_gzip_command(tarfile)
+
let curlast= line("$")
if tarfile =~# '\.\(gz\|tgz\)$'
" call Decho("1: exe silent r! gzip -d -c -- ".shellescape(tarfile,1)." | ".g:tar_cmd." -".g:tar_browseoptions." - ")
- exe "sil! r! bzip2 -d -c -- ".shellescape(tarfile,1)." | ".g:tar_cmd." -".g:tar_browseoptions." - "
+ exe "sil! r! " . gzip_command . " -d -c -- ".shellescape(tarfile,1)." | ".g:tar_cmd." -".g:tar_browseoptions." - "
elseif tarfile =~# '\.lrp'
" call Decho("2: exe silent r! cat -- ".shellescape(tarfile,1)."|gzip -d -c -|".g:tar_cmd." -".g:tar_browseoptions." - ")
- exe "sil! r! cat -- ".shellescape(tarfile,1)."|gzip -d -c -|".g:tar_cmd." -".g:tar_browseoptions." - "
+ exe "sil! r! cat -- ".shellescape(tarfile,1)."|" . gzip_command . " -d -c -|".g:tar_cmd." -".g:tar_browseoptions." - "
elseif tarfile =~# '\.\(bz2\|tbz\|tb2\)$'
" call Decho("3: exe silent r! bzip2 -d -c -- ".shellescape(tarfile,1)." | ".g:tar_cmd." -".g:tar_browseoptions." - ")
exe "sil! r! bzip2 -d -c -- ".shellescape(tarfile,1)." | ".g:tar_cmd." -".g:tar_browseoptions." - "
@@ -287,15 +290,18 @@ fun! tar#Read(fname,mode)
else
let tar_secure= " "
endif
+
+ let gzip_command = s:get_gzip_command(tarfile)
+
if tarfile =~# '\.bz2$'
" call Decho("7: exe silent r! bzip2 -d -c ".shellescape(tarfile,1)."| ".g:tar_cmd." -".g:tar_readoptions." - ".tar_secure.shellescape(fname,1).decmp)
exe "sil! r! bzip2 -d -c -- ".shellescape(tarfile,1)."| ".g:tar_cmd." -".g:tar_readoptions." - ".tar_secure.shellescape(fname,1).decmp
elseif tarfile =~# '\.\(gz\|tgz\)$'
" call Decho("5: exe silent r! gzip -d -c -- ".shellescape(tarfile,1)."| ".g:tar_cmd.' -'.g:tar_readoptions.' - '.tar_secure.shellescape(fname,1))
- exe "sil! r! bzip2 -d -c -- ".shellescape(tarfile,1)."| ".g:tar_cmd." -".g:tar_readoptions." - ".tar_secure.shellescape(fname,1).decmp
+ exe "sil! r! " . gzip_command . " -d -c -- ".shellescape(tarfile,1)."| ".g:tar_cmd." -".g:tar_readoptions." - ".tar_secure.shellescape(fname,1).decmp
elseif tarfile =~# '\.lrp$'
" call Decho("6: exe silent r! cat ".shellescape(tarfile,1)." | gzip -d -c - | ".g:tar_cmd." -".g:tar_readoptions." - ".tar_secure.shellescape(fname,1).decmp)
- exe "sil! r! cat -- ".shellescape(tarfile,1)." | gzip -d -c - | ".g:tar_cmd." -".g:tar_readoptions." - ".tar_secure.shellescape(fname,1).decmp
+ exe "sil! r! cat -- ".shellescape(tarfile,1)." | " . gzip_command . " -d -c - | ".g:tar_cmd." -".g:tar_readoptions." - ".tar_secure.shellescape(fname,1).decmp
elseif tarfile =~# '\.lzma$'
" call Decho("7: exe silent r! lzma -d -c ".shellescape(tarfile,1)."| ".g:tar_cmd." -".g:tar_readoptions." - ".tar_secure.shellescape(fname,1).decmp)
exe "sil! r! lzma -d -c -- ".shellescape(tarfile,1)."| ".g:tar_cmd." -".g:tar_readoptions." - ".tar_secure.shellescape(fname,1).decmp
@@ -389,6 +395,8 @@ fun! tar#Write(fname)
let tarfile = substitute(b:tarfile,'tarfile:\(.\{-}\)::.*$','\1','')
let fname = substitute(b:tarfile,'tarfile:.\{-}::\(.*\)$','\1','')
+ let gzip_command = s:get_gzip_command(tarfile)
+
" handle compressed archives
if tarfile =~# '\.bz2'
call system("bzip2 -d -- ".shellescape(tarfile,0))
@@ -396,12 +404,12 @@ fun! tar#Write(fname)
let compress= "bzip2 -- ".shellescape(tarfile,0)
" call Decho("compress<".compress.">")
elseif tarfile =~# '\.gz'
- call system("gzip -d -- ".shellescape(tarfile,0))
+ call system(gzip_command . " -d -- ".shellescape(tarfile,0))
let tarfile = substitute(tarfile,'\.gz','','e')
let compress= "gzip -- ".shellescape(tarfile,0)
" call Decho("compress<".compress.">")
elseif tarfile =~# '\.tgz'
- call system("gzip -d -- ".shellescape(tarfile,0))
+ call system(gzip_command . " -d -- ".shellescape(tarfile,0))
let tarfile = substitute(tarfile,'\.tgz','.tar','e')
let compress= "gzip -- ".shellescape(tarfile,0)
let tgz = 1
@@ -581,7 +589,9 @@ fun! tar#Vimuntar(...)
" if necessary, decompress the tarball; then, extract it
if tartail =~ '\.tgz'
- if executable("gunzip")
+ if executable("bzip2")
+ silent exe "!bzip2 -d ".shellescape(tartail)
+ elseif executable("gunzip")
silent exe "!gunzip ".shellescape(tartail)
elseif executable("gzip")
silent exe "!gzip -d ".shellescape(tartail)
@@ -619,6 +629,15 @@ fun! tar#Vimuntar(...)
" call Dret("tar#Vimuntar")
endfun
+func s:get_gzip_command(file)
+ if a:file =~# 'z$' && executable('bzip2')
+ " Some .tgz files are actually compressed with bzip2. Since bzip2 can
+ " handle the format from gzip, use it if the command exists.
+ return 'bzip2'
+ endif
+ return 'gzip'
+endfunc
+
" =====================================================================
" Modelines And Restoration: {{{1
let &cpo= s:keepcpo
diff --git a/runtime/compiler/stack.vim b/runtime/compiler/stack.vim
new file mode 100644
index 0000000000..4236b4c8b3
--- /dev/null
+++ b/runtime/compiler/stack.vim
@@ -0,0 +1,37 @@
+" Vim compiler file
+" Compiler: Haskell Stack
+" Maintainer: Daniel Campoverde <alx@sillybytes.net>
+" Latest Revision: 2018-08-27
+
+if exists("current_compiler")
+ finish
+endif
+let current_compiler = "stack"
+
+let s:cpo_save = &cpo
+set cpo&vim
+
+
+CompilerSet errorformat=
+ \%-G%.%#:\ build\ %.%#,
+ \%-G%.%#:\ configure\ %.%#,
+ \%-G[%.%#]%.%#,
+ \%-G%.%#preprocessing\ %.%#,
+ \%-G%.%#configuring\ %.%#,
+ \%-G%.%#building\ %.%#,
+ \%-G%.%#linking\ %.%#,
+ \%-G%.%#installing\ %.%#,
+ \%-G%.%#registering\ %.%#,
+ \%-G%.%#:\ copy/register%.%#,
+ \%-G%.%#process\ exited\ %.%#,
+ \%-G%.%#--builddir=%.%#,
+ \%-G--%.%#,
+ \%-G%.%#\|%.%#,
+ \%E%f:%l:%c:\ error:,%+Z\ \ \ \ %m,
+ \%E%f:%l:%c:\ error:\ %m,%-Z,
+ \%W%f:%l:%c:\ warning:,%+Z\ \ \ \ %m,
+ \%W%f:%l:%c:\ warning:\ %m,%-Z,
+
+
+let &cpo = s:cpo_save
+unlet s:cpo_save
diff --git a/runtime/doc/if_pyth.txt b/runtime/doc/if_pyth.txt
index dfa1d6e212..38a78294b7 100644
--- a/runtime/doc/if_pyth.txt
+++ b/runtime/doc/if_pyth.txt
@@ -63,6 +63,18 @@ Examples:
:pydo return "%s\t%d" % (line[::-1], len(line))
:pydo if line: return "%4d: %s" % (linenr, line)
<
+One can use `:pydo` in possible conjunction with `:py` to filter a range using
+python. For example: >
+
+ :py3 << EOF
+ needle = vim.eval('@a')
+ replacement = vim.eval('@b')
+
+ def py_vim_string_replace(str):
+ return str.replace(needle, replacement)
+ EOF
+ :'<,'>py3do return py_vim_string_replace(line)
+<
*:pyfile* *:pyf*
:[range]pyf[ile] {file}
Execute the Python script in {file}. The whole
diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt
index 69bfa44b0a..09e699925d 100644
--- a/runtime/doc/options.txt
+++ b/runtime/doc/options.txt
@@ -691,6 +691,8 @@ A jump table for the options with a short description can be found at |Q_op|.
'{A-Z0-9}, or `{A-Z0-9} command takes one to another file.
Note that for some commands the 'autowrite' option is not used, see
'autowriteall' for that.
+ Some buffers will not be written, specifically when 'buttype' is
+ "nowrite", "nofile", "terminal" or "prompt".
*'autowriteall'* *'awa'* *'noautowriteall'* *'noawa'*
'autowriteall' 'awa' boolean (default off)
diff --git a/runtime/ftplugin/cmake.vim b/runtime/ftplugin/cmake.vim
index e81cd4071c..94c007629b 100644
--- a/runtime/ftplugin/cmake.vim
+++ b/runtime/ftplugin/cmake.vim
@@ -1,16 +1,34 @@
" Vim filetype plugin
" Language: CMake
" Maintainer: Keith Smiley <keithbsmiley@gmail.com>
-" Last Change: 2017 Dec 24
+" Last Change: 2018 Aug 30
" Only do this when not done yet for this buffer
if exists("b:did_ftplugin")
finish
endif
+" save 'cpo' for restoration at the end of this file
+let s:cpo_save = &cpo
+set cpo&vim
+
" Don't load another plugin for this buffer
let b:did_ftplugin = 1
let b:undo_ftplugin = "setl commentstring<"
+if exists('loaded_matchit')
+ let b:match_words = '\<if\>:\<elseif\>\|\<else\>:\<endif\>'
+ \ . ',\<foreach\>\|\<while\>:\<break\>:\<endforeach\>\|\<endwhile\>'
+ \ . ',\<macro\>:\<endmacro\>'
+ \ . ',\<function\>:\<endfunction\>'
+ let b:match_ignorecase = 1
+
+ let b:undo_ftplugin .= "| unlet b:match_words"
+endif
+
setlocal commentstring=#\ %s
+
+" restore 'cpo' and clean up buffer variable
+let &cpo = s:cpo_save
+unlet s:cpo_save
diff --git a/runtime/indent/dosbatch.vim b/runtime/indent/dosbatch.vim
new file mode 100644
index 0000000000..aea2a184d4
--- /dev/null
+++ b/runtime/indent/dosbatch.vim
@@ -0,0 +1,59 @@
+" Vim indent file
+" Language: MSDOS batch file (with NT command extensions)
+" Maintainer: Ken Takata
+" URL: https://github.com/k-takata/vim-dosbatch-indent
+" Last Change: 2017 May 10
+" Filenames: *.bat
+" License: VIM License
+
+if exists("b:did_indent")
+ finish
+endif
+let b:did_indent = 1
+
+setlocal nosmartindent
+setlocal noautoindent
+setlocal indentexpr=GetDosBatchIndent(v:lnum)
+setlocal indentkeys=!^F,o,O
+setlocal indentkeys+=0=)
+
+if exists("*GetDosBatchIndent")
+ finish
+endif
+
+let s:cpo_save = &cpo
+set cpo&vim
+
+function! GetDosBatchIndent(lnum)
+ let l:prevlnum = prevnonblank(a:lnum-1)
+ if l:prevlnum == 0
+ " top of file
+ return 0
+ endif
+
+ " grab the previous and current line, stripping comments.
+ let l:prevl = substitute(getline(l:prevlnum), '\c^\s*\%(@\s*\)\?rem\>.*$', '', '')
+ let l:thisl = getline(a:lnum)
+ let l:previ = indent(l:prevlnum)
+
+ let l:ind = l:previ
+
+ if l:prevl =~? '^\s*@\=if\>.*(\s*$' ||
+ \ l:prevl =~? '\<do\>\s*(\s*$' ||
+ \ l:prevl =~? '\<else\>\s*\%(if\>.*\)\?(\s*$' ||
+ \ l:prevl =~? '^.*\(&&\|||\)\s*(\s*$'
+ " previous line opened a block
+ let l:ind += shiftwidth()
+ endif
+ if l:thisl =~ '^\s*)'
+ " this line closed a block
+ let l:ind -= shiftwidth()
+ endif
+
+ return l:ind
+endfunction
+
+let &cpo = s:cpo_save
+unlet s:cpo_save
+
+" vim: ts=8 sw=2 sts=2
diff --git a/runtime/indent/teraterm.vim b/runtime/indent/teraterm.vim
index 370283c77f..35d7354290 100644
--- a/runtime/indent/teraterm.vim
+++ b/runtime/indent/teraterm.vim
@@ -1,9 +1,9 @@
" Vim indent file
" Language: Tera Term Language (TTL)
-" Based on Tera Term Version 4.92
+" Based on Tera Term Version 4.100
" Maintainer: Ken Takata
" URL: https://github.com/k-takata/vim-teraterm
-" Last Change: 2017 Jun 13
+" Last Change: 2018-08-31
" Filenames: *.ttl
" License: VIM License
diff --git a/runtime/syntax/teraterm.vim b/runtime/syntax/teraterm.vim
index 1924996738..9115320bfb 100644
--- a/runtime/syntax/teraterm.vim
+++ b/runtime/syntax/teraterm.vim
@@ -1,9 +1,9 @@
" Vim syntax file
" Language: Tera Term Language (TTL)
-" Based on Tera Term Version 4.92
+" Based on Tera Term Version 4.100
" Maintainer: Ken Takata
" URL: https://github.com/k-takata/vim-teraterm
-" Last Change: 2016 Aug 17
+" Last Change: 2018-08-31
" Filenames: *.ttl
" License: VIM License
@@ -75,12 +75,13 @@ syn keyword ttlCommunicationCommand contained
\ logrotate logstart logwrite quickvanrecv
\ quickvansend recvln restoresetup scprecv scpsend
\ send sendbreak sendbroadcast sendfile sendkcode
- \ sendln sendlnbroadcast sendmulticast setbaud
- \ setdebug setdtr setecho setmulticastname setrts
- \ setsync settitle showtt testlink unlink wait
- \ wait4all waitevent waitln waitn waitrecv waitregex
- \ xmodemrecv xmodemsend ymodemrecv ymodemsend
- \ zmodemrecv zmodemsend
+ \ sendln sendlnbroadcast sendlnmulticast sendmulticast
+ \ setbaud setdebug setdtr setecho setflowctrl
+ \ setmulticastname setrts setspeed setsync settitle
+ \ showtt testlink unlink wait wait4all waitevent
+ \ waitln waitn waitrecv waitregex xmodemrecv
+ \ xmodemsend ymodemrecv ymodemsend zmodemrecv
+ \ zmodemsend
syn keyword ttlStringCommand contained
\ code2str expandenv int2str regexoption sprintf
\ sprintf2 str2code str2int strcompare strconcat