Skip to content

Commit

Permalink
Update runtime files.
Browse files Browse the repository at this point in the history
  • Loading branch information
brammool committed Sep 2, 2018
1 parent acca8df commit 20aac6c
Show file tree
Hide file tree
Showing 19 changed files with 496 additions and 330 deletions.
39 changes: 33 additions & 6 deletions 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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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')
Expand Down Expand Up @@ -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']}
Expand All @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion runtime/autoload/dist/ft.vim
Expand Up @@ -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\+'
Expand Down
33 changes: 26 additions & 7 deletions runtime/autoload/tar.vim
Expand Up @@ -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." - "
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -389,19 +395,21 @@ 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))
let tarfile = substitute(tarfile,'\.bz2','','e')
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
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down
37 changes: 37 additions & 0 deletions 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
2 changes: 1 addition & 1 deletion runtime/doc/eval.txt
Expand Up @@ -8013,7 +8013,7 @@ substitute({expr}, {pat}, {sub}, {flags}) *substitute()*
|submatch()| returns. Example: >
:echo substitute(s, '%\(\x\x\)', {m -> '0x' . m[1]}, 'g')
swapinfo({fname}) swapinfo()
swapinfo({fname}) *swapinfo()*
The result is a dictionary, which holds information about the
swapfile {fname}. The available fields are:
version VIM version
Expand Down
18 changes: 16 additions & 2 deletions runtime/doc/gui_x11.txt
Expand Up @@ -376,8 +376,8 @@ you might have to use the file ~/.gtkrc-2.0 instead, depending on your
distribution.

For GTK+ 3, an effect similar to the above can be obtained by adding the
following snippet of CSS code to $XDG_HOME_DIR/gtk-3.0/gtk.css (usually,
$HOME/.config/gtk-3.0/gtk.css):
following snippet of CSS code to $XDG_HOME_DIR/gtk-3.0/gtk.css (see the next
section):

For GTK+ 3 < 3.20: >
Expand Down Expand Up @@ -408,6 +408,10 @@ stable support for GTK+ CSS:
GTK+ uses CSS for styling and layout of widgets. In this subsection, we'll
have a quick look at GTK+ CSS through simple, illustrative examples.

You can usually edit the config with: >
vim $HOME/.config/gtk-3.0/gtk.css
Example 1. Empty Space Adjustment ~

By default, the toolbar and the tabline of the GTK+ 3 GUI are somewhat larger
Expand Down Expand Up @@ -492,6 +496,16 @@ unexpectedly less attractive or even deteriorates their usability. Keep this
in mind always when you try improving a theme.


Example 3. border color

To eliminate borders when maximized: >
@define-color bg_color #1B2B34;
#vim-main-window {
background-color: @bg_color;
}
Using Vim as a GTK+ plugin ~
*gui-gtk-socketid*
When the GTK+ version of Vim starts up normally, it creates its own top level
Expand Down
12 changes: 12 additions & 0 deletions runtime/doc/if_pyth.txt
Expand Up @@ -81,6 +81,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}
Expand Down
2 changes: 2 additions & 0 deletions runtime/doc/options.txt
Expand Up @@ -846,6 +846,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

This comment has been minimized.

Copy link
@chrisbra

chrisbra Sep 5, 2018

Member

Some buffers will not be written, specifically when 'buttype' is

Typo: should be 'buftype'

This comment has been minimized.

Copy link
@brammool

brammool via email Sep 6, 2018

Author Contributor
"nowrite", "nofile", "terminal" or "prompt".

*'autowriteall'* *'awa'* *'noautowriteall'* *'noawa'*
'autowriteall' 'awa' boolean (default off)
Expand Down
3 changes: 3 additions & 0 deletions runtime/doc/tags
Expand Up @@ -5408,6 +5408,7 @@ catch-order eval.txt /*catch-order*
catch-text eval.txt /*catch-text*
cc change.txt /*cc*
ceil() eval.txt /*ceil()*
cfilter-plugin quickfix.txt /*cfilter-plugin*
ch.vim syntax.txt /*ch.vim*
ch_canread() eval.txt /*ch_canread()*
ch_close() eval.txt /*ch_close()*
Expand Down Expand Up @@ -8659,6 +8660,7 @@ swap-file recover.txt /*swap-file*
swapchoice-variable eval.txt /*swapchoice-variable*
swapcommand-variable eval.txt /*swapcommand-variable*
swapfile-changed version4.txt /*swapfile-changed*
swapinfo() eval.txt /*swapinfo()*
swapname-variable eval.txt /*swapname-variable*
sybase ft_sql.txt /*sybase*
syn-sync-grouphere syntax.txt /*syn-sync-grouphere*
Expand Down Expand Up @@ -9639,6 +9641,7 @@ windows98 os_win32.txt /*windows98*
windowsme os_win32.txt /*windowsme*
winheight() eval.txt /*winheight()*
winid windows.txt /*winid*
winlayout() eval.txt /*winlayout()*
winline() eval.txt /*winline()*
winnr() eval.txt /*winnr()*
winrestcmd() eval.txt /*winrestcmd()*
Expand Down

0 comments on commit 20aac6c

Please sign in to comment.