Compare commits

...

18 Commits

Author SHA1 Message Date
Bram Moolenaar
f31ecce97e updated for version 7.4.166
Problem:    Auto-loading a function for code that won't be executed.
Solution:   Do not auto-load when evaluation is off. (Yasuhiro Matsumoto)
2014-02-05 22:13:05 +01:00
Bram Moolenaar
767568846b updated for version 7.4.165
Problem:    By default, after closing a buffer changes can't be undone.
Solution:   In the example vimrc file set 'undofile'.
2014-02-05 22:02:01 +01:00
Bram Moolenaar
dd415a6c5a updated for version 7.4.164
Problem:    Problem with event handling on Windows 8.
Solution:   Ignore duplicate WINDOW_BUFFER_SIZE_EVENTs. (Nobuhiro Takasaki)
2014-02-05 14:02:27 +01:00
Bram Moolenaar
f50eb7882e updated for version 7.4.163
Problem:    MS-Windows input doesn't work properly on Windows 7 and earlier.
Solution:   Add a check for Windows 8. (Yasuhiro Matsumoto)
2014-02-05 13:36:54 +01:00
Bram Moolenaar
09edc46d01 updated for version 7.4.162
Problem:    Running tests in shadow dir doesn't work.
Solution:   Add testdir/sautest to the shadow target. (James McCoy)
2014-02-05 12:36:42 +01:00
Bram Moolenaar
4315f26500 updated for version 7.4.161
Problem:    Crash in Python exception handling.
Solution:   Only use exception variables if did_throw is set. (ZyX)
2014-01-31 14:54:04 +01:00
Bram Moolenaar
fcc3f46735 updated for version 7.4.160
Problem:    Win32: Crash when executing external command.
Solution:   Only close the handle when it was created. (Yasuhiro Matsumoto)
2014-01-24 19:55:37 +01:00
Bram Moolenaar
361aa50547 updated for version 7.4.159
Problem:    Completion hangs when scanning the current buffer after doing
            keywords. (Christian Brabandt)
Solution:   Set the first match position when starting to scan the current
            buffer.
2014-01-23 22:45:58 +01:00
Bram Moolenaar
8af269186c updated for version 7.4.158
Problem:    Pattern containing \zs is not handled correctly by substitute().
Solution:   Change how an empty match is skipped. (Yukihiro Nakadaira)
2014-01-23 20:09:34 +01:00
Bram Moolenaar
b4d587cbd9 updated for version 7.4.157
Problem:    Error number used twice. (Yukihiro Nakadaira)
Solution:   Change the one not referred in the docs.
2014-01-23 18:12:49 +01:00
Bram Moolenaar
4a36bcf0d8 updated for version 7.4.156
Problem:    Test file missing from distribution.
Solution:   Add new directory to file list.
2014-01-23 14:26:24 +01:00
Bram Moolenaar
8d04317104 Updated runtime files. 2014-01-23 14:24:41 +01:00
Bram Moolenaar
ac8400d483 updated for version 7.4.155
Problem:    ":keeppatterns /pat" does not keep search pattern offset.
Solution:   Restore the offset after doing the search.
2014-01-14 21:31:34 +01:00
Bram Moolenaar
8822a9c367 updated for version 7.4.154
Problem:    Still a problem with auto-loading.
Solution:   Pass no_autoload to deref_func_name(). (Yukihiro Nakadaira)
2014-01-14 19:44:34 +01:00
Bram Moolenaar
5395e7afe9 updated for version 7.4.153
Problem:    Compiler warning for pointer type.
Solution:   Add type cast.
2014-01-14 19:35:56 +01:00
Bram Moolenaar
1028f4d75e updated for version 7.4.152
Problem:    Python: Cannot iterate over options.
Solution:   Add options iterator. (ZyX)
2014-01-14 16:55:00 +01:00
Bram Moolenaar
063a46ba77 updated for version 7.4.151
Problem:    Python: slices with steps are not supported.
Solution:   Support slices in Python vim.List. (ZyX)
2014-01-14 16:36:51 +01:00
Bram Moolenaar
14177b77bf updated for version 7.4.150
Problem:    :keeppatterns is not respected for :s.
Solution:   Check the keeppatterns flag. (Yasuhiro Matsumoto)
2014-01-14 15:53:51 +01:00
42 changed files with 2142 additions and 801 deletions

View File

@@ -80,6 +80,7 @@ SRC_ALL = \
src/main.aap \
src/testdir/main.aap \
src/testdir/*.in \
src/testdir/sautest/autoload/*.vim \
src/testdir/test[0-9]*.ok \
src/testdir/test49.vim \
src/testdir/test60.vim \

View File

@@ -1,8 +1,8 @@
" ---------------------------------------------------------------------
" getscript.vim
" Author: Charles E. Campbell
" Date: Apr 17, 2013
" Version: 35
" Date: Jan 21, 2014
" Version: 36
" Installing: :help glvs-install
" Usage: :help glvs
"
@@ -15,7 +15,7 @@
if exists("g:loaded_getscript")
finish
endif
let g:loaded_getscript= "v35"
let g:loaded_getscript= "v36"
if &cp
echoerr "GetLatestVimScripts is not vi-compatible; not loaded (you need to set nocp)"
finish
@@ -208,8 +208,8 @@ fun! getscript#GetLatestVimScripts()
let lastline = line("$")
" call Decho("lastline#".lastline)
let firstdir = substitute(&rtp,',.*$','','')
let plugins = split(globpath(firstdir,"plugin/*.vim"),'\n')
let plugins = plugins + split(globpath(firstdir,"AsNeeded/*.vim"),'\n')
let plugins = split(globpath(firstdir,"plugin/**/*.vim"),'\n')
let plugins = plugins + split(globpath(firstdir,"AsNeeded/**/*.vim"),'\n')
let foundscript = 0
" this loop updates the GetLatestVimScripts.dat file

File diff suppressed because it is too large Load Diff

View File

@@ -1,7 +1,7 @@
" netrwSettings.vim: makes netrw settings simpler
" Date: May 03, 2013
" Date: Aug 27, 2013
" Maintainer: Charles E Campbell <drchipNOSPAM at campbellfamily dot biz>
" Version: 14a ASTRO-ONLY
" Version: 14
" Copyright: Copyright (C) 1999-2007 Charles E. Campbell {{{1
" Permission is hereby granted to use and distribute this code,
" with or without modifications, provided that this copyright
@@ -19,7 +19,7 @@
if exists("g:loaded_netrwSettings") || &cp
finish
endif
let g:loaded_netrwSettings = "v14a"
let g:loaded_netrwSettings = "v14"
if v:version < 700
echohl WarningMsg
echo "***warning*** this version of netrwSettings needs vim 7.0"
@@ -98,6 +98,11 @@ fun! netrwSettings#NetrwSettings()
put = ''
put ='+ Netrw Browser Control'
if exists("g:netrw_altfile")
put = 'let g:netrw_altfile = '.g:netrw_altfile
else
put = 'let g:netrw_altfile = 0'
endif
put = 'let g:netrw_alto = '.g:netrw_alto
put = 'let g:netrw_altv = '.g:netrw_altv
put = 'let g:netrw_banner = '.g:netrw_banner

View File

@@ -0,0 +1,71 @@
" netrw_gitignore#Hide: gitignore-based hiding
" Function returns a string of comma separated patterns convenient for
" assignment to `g:netrw_list_hide` option.
" Function can take additional filenames as arguments, example:
" netrw_gitignore#Hide('custom_gitignore1', 'custom_gitignore2')
"
" Usage examples:
" let g:netrw_list_hide = netrw_gitignore#Hide()
" let g:netrw_list_hide = netrw_gitignore#Hide() . 'more,hide,patterns'
"
" Copyright: Copyright (C) 2013 Bruno Sutic {{{1
" Permission is hereby granted to use and distribute this code,
" with or without modifications, provided that this copyright
" notice is copied with it. Like anything else that's free,
" netrw_gitignore.vim is provided *as is* and comes with no
" warranty of any kind, either expressed or implied. By using
" this plugin, you agree that in no event will the copyright
" holder be liable for any damages resulting from the use
" of this software.
function! netrw_gitignore#Hide(...)
let additional_files = a:000
let default_files = ['.gitignore', '.git/info/exclude']
" get existing global/system gitignore files
let global_gitignore = expand(substitute(system("git config --global core.excludesfile"), '\n', '', 'g'))
if global_gitignore !=# ''
let default_files = add(default_files, global_gitignore)
endif
let system_gitignore = expand(substitute(system("git config --system core.excludesfile"), '\n', '', 'g'))
if system_gitignore !=# ''
let default_files = add(default_files, system_gitignore)
endif
" append additional files if given as function arguments
if additional_files !=# []
let files = extend(default_files, additional_files)
else
let files = default_files
endif
" keep only existing/readable files
let gitignore_files = []
for file in files
if filereadable(file)
let gitignore_files = add(gitignore_files, file)
endif
endfor
" get contents of gitignore patterns from those files
let gitignore_lines = []
for file in gitignore_files
for line in readfile(file)
" filter empty lines and comments
if line !~# '^#' && line !~# '^$'
let gitignore_lines = add(gitignore_lines, line)
endif
endfor
endfor
" convert gitignore patterns to Netrw/Vim regex patterns
let escaped_lines = []
for line in gitignore_lines
let escaped = line
let escaped = substitute(escaped, '\.', '\\.', 'g')
let escaped = substitute(escaped, '*', '.*', 'g')
let escaped_lines = add(escaped_lines, escaped)
endfor
return join(escaped_lines, ',')
endfunction

View File

@@ -1,4 +1,4 @@
*change.txt* For Vim version 7.4. Last change: 2013 Nov 05
*change.txt* For Vim version 7.4. Last change: 2014 Jan 23
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -824,7 +824,7 @@ either the first or second pattern in parentheses did not match, so either
<
Substitute with an expression *sub-replace-expression*
*sub-replace-\=*
*sub-replace-\=* *:s/\=*
When the substitute string starts with "\=" the remainder is interpreted as an
expression. This does not work recursively: a |substitute()| function inside
the expression cannot use "\=" for the substitute string.

View File

@@ -1,4 +1,4 @@
*eval.txt* For Vim version 7.4. Last change: 2013 Dec 08
*eval.txt* For Vim version 7.4. Last change: 2014 Jan 14
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -1519,6 +1519,7 @@ v:oldfiles List of file names that is loaded from the |viminfo| file on
startup. These are the files that Vim remembers marks for.
The length of the List is limited by the ' argument of the
'viminfo' option (default is 100).
When the |viminfo| file is not used the List is empty.
Also see |:oldfiles| and |c_#<|.
The List can be modified, but this has no effect on what is
stored in the |viminfo| file later. If you use values other
@@ -6639,7 +6640,7 @@ See |:verbose-cmd| for more information.
For the {arguments} see |function-argument|.
*a:firstline* *a:lastline*
*:func-range* *a:firstline* *a:lastline*
When the [range] argument is added, the function is
expected to take care of a range itself. The range is
passed as "a:firstline" and "a:lastline". If [range]
@@ -6648,10 +6649,10 @@ See |:verbose-cmd| for more information.
of each line. See |function-range-example|.
The cursor is still moved to the first line of the
range, as is the case with all Ex commands.
*:func-abort*
When the [abort] argument is added, the function will
abort as soon as an error is detected.
*:func-dict*
When the [dict] argument is added, the function must
be invoked through an entry in a |Dictionary|. The
local variable "self" will then be set to the

View File

@@ -1,4 +1,4 @@
*pi_getscript.txt* For Vim version 7.4. Last change: 2012 Apr 07
*pi_getscript.txt* For Vim version 7.0. Last change: 2013 Nov 29
>
GETSCRIPT REFERENCE MANUAL by Charles E. Campbell
<
@@ -385,6 +385,10 @@ The AutoInstall process will:
==============================================================================
9. GetLatestVimScripts History *getscript-history* *glvs-hist* {{{1
v36 Apr 22, 2013 : * (glts) suggested use of plugin/**/*.vim instead of
plugin/*.vim in globpath() call.
* (Andy Wokula) got warning message when setting
g:loaded_getscriptPlugin
v35 Apr 07, 2012 : * (MengHuan Yu) pointed out that the script url has
changed (somewhat). However, it doesn't work, and
the original one does (under Linux). I'll make it

View File

@@ -1,4 +1,4 @@
*pi_netrw.txt* For Vim version 7.4. Last change: 2013 May 18
*pi_netrw.txt* For Vim version 7.4. Last change: 2014 Jan 21
------------------------------------------------
NETRW REFERENCE MANUAL by Charles E. Campbell
@@ -6,7 +6,7 @@
Author: Charles E. Campbell <NdrOchip@ScampbellPfamily.AbizM>
(remove NOSPAM from Campbell's email first)
Copyright: Copyright (C) 1999-2013 Charles E Campbell *netrw-copyright*
Copyright: Copyright (C) 1999-2014 Charles E Campbell *netrw-copyright*
The VIM LICENSE applies to the files in this package, including
netrw.vim, pi_netrw.txt, netrwFileHandlers.vim, netrwSettings.vim, and
syntax/netrw.vim. Like anything else that's free, netrw.vim and its
@@ -192,21 +192,22 @@ You may do so by placing the following two lines in your <.vimrc>: >
EXTERNAL APPLICATIONS AND PROTOCOLS *netrw-externapp* {{{2
Protocol Variable Default Value
-------- ---------------- -------------
dav: *g:netrw_dav_cmd* = "cadaver" if cadaver is executable
dav: g:netrw_dav_cmd = "curl -o" elseif curl is available
fetch: *g:netrw_fetch_cmd* = "fetch -o" if fetch is available
ftp: *g:netrw_ftp_cmd* = "ftp"
http: *g:netrw_http_cmd* = "elinks" if elinks is available
http: g:netrw_http_cmd = "links" elseif links is available
http: g:netrw_http_cmd = "curl" elseif curl is available
http: g:netrw_http_cmd = "wget" elseif wget is available
http: g:netrw_http_cmd = "fetch" elseif fetch is available
rcp: *g:netrw_rcp_cmd* = "rcp"
rsync: *g:netrw_rsync_cmd* = "rsync -a"
scp: *g:netrw_scp_cmd* = "scp -q"
sftp: *g:netrw_sftp_cmd* = "sftp"
Protocol Variable Default Value
-------- ---------------- -------------
dav: *g:netrw_dav_cmd* = "cadaver" if cadaver is executable
dav: g:netrw_dav_cmd = "curl -o" elseif curl is available
fetch: *g:netrw_fetch_cmd* = "fetch -o" if fetch is available
ftp: *g:netrw_ftp_cmd* = "ftp"
http: *g:netrw_http_cmd* = "elinks" if elinks is available
http: g:netrw_http_cmd = "links" elseif links is available
http: g:netrw_http_cmd = "curl" elseif curl is available
http: g:netrw_http_cmd = "wget" elseif wget is available
http: g:netrw_http_cmd = "fetch" elseif fetch is available
http: *g:netrw_http_put_cmd* = "curl -T"
rcp: *g:netrw_rcp_cmd* = "rcp"
rsync: *g:netrw_rsync_cmd* = "rsync -a"
scp: *g:netrw_scp_cmd* = "scp -q"
sftp: *g:netrw_sftp_cmd* = "sftp"
*g:netrw_http_xcmd* : the option string for http://... protocols are
specified via this variable and may be independently overridden. By
@@ -223,6 +224,9 @@ EXTERNAL APPLICATIONS AND PROTOCOLS *netrw-externapp* {{{2
let g:netrw_http_xcmd= "-dump >"
< in your .vimrc.
g:netrw_http_put_cmd: this option specifies both the executable and
any needed options. This command does a PUT operation to the url.
READING *netrw-read* *netrw-nread* {{{2
@@ -816,8 +820,7 @@ variables listed below, and may be modified by the user.
------------------------
Option Type Setting Meaning
--------- -------- -------------- ---------------------------
<
netrw_ftp variable =doesn't exist userid set by "user userid"
< netrw_ftp variable =doesn't exist userid set by "user userid"
=0 userid set by "user userid"
=1 userid set by "userid"
NetReadFixup function =doesn't exist no change
@@ -825,17 +828,18 @@ variables listed below, and may be modified by the user.
read via ftp automatically
transformed however they wish
by NetReadFixup()
g:netrw_dav_cmd variable ="cadaver" if cadaver is executable
g:netrw_dav_cmd variable ="curl -o" elseif curl is executable
g:netrw_fetch_cmd variable ="fetch -o" if fetch is available
g:netrw_ftp_cmd variable ="ftp"
g:netrw_http_cmd variable ="fetch -o" if fetch is available
g:netrw_http_cmd variable ="wget -O" else if wget is available
g:netrw_list_cmd variable ="ssh USEPORT HOSTNAME ls -Fa"
g:netrw_rcp_cmd variable ="rcp"
g:netrw_rsync_cmd variable ="rsync -a"
g:netrw_scp_cmd variable ="scp -q"
g:netrw_sftp_cmd variable ="sftp" >
g:netrw_dav_cmd var ="cadaver" if cadaver is executable
g:netrw_dav_cmd var ="curl -o" elseif curl is executable
g:netrw_fetch_cmd var ="fetch -o" if fetch is available
g:netrw_ftp_cmd var ="ftp"
g:netrw_http_cmd var ="fetch -o" if fetch is available
g:netrw_http_cmd var ="wget -O" else if wget is available
g:netrw_http_put_cmd var ="curl -T"
g:netrw_list_cmd var ="ssh USEPORT HOSTNAME ls -Fa"
g:netrw_rcp_cmd var ="rcp"
g:netrw_rsync_cmd var ="rsync -a"
g:netrw_scp_cmd var ="scp -q"
g:netrw_sftp_cmd var ="sftp" >
-------------------------------------------------------------------------
<
*netrw-ftp*
@@ -1097,16 +1101,20 @@ QUICK REFERENCE: MAPS *netrw-browse-maps* {{{2
mapping defined before netrw is autoloaded,
then a double clicked leftmouse button will return
to the netrw browser window. See |g:netrw_retmap|.
<s-leftmouse> (gvim only) like mf, will mark files
<s-leftmouse> (gvim only) like mf, will mark files. Dragging
the shifted leftmouse will mark multiple files.
(see |netrw-mf|)
(to disable mouse buttons while browsing: |g:netrw_mousemaps|)
*netrw-quickcom* *netrw-quickcoms*
QUICK REFERENCE: COMMANDS *netrw-explore-cmds* *netrw-browse-cmds* {{{2
:NetrwClean[!] ...........................................|netrw-clean|
:NetrwSettings ...........................................|netrw-settings|
:NetrwClean[!]............................................|netrw-clean|
:NetrwSettings............................................|netrw-settings|
:Ntree....................................................|netrw-ntree|
:Explore[!] [dir] Explore directory of current file......|netrw-explore|
:Hexplore[!] [dir] Horizontal Split & Explore.............|netrw-explore|
:Lexplore [dir] Left Explorer Toggle...................|netrw-explore|
:Nexplore[!] [dir] Vertical Split & Explore...............|netrw-explore|
:Pexplore[!] [dir] Vertical Split & Explore...............|netrw-explore|
:Rexplore Return to Explorer.....................|netrw-explore|
@@ -1321,6 +1329,17 @@ See |g:netrw_dirhistmax| for how to control the quantity of history stack
slots.
CHANGING TREE TOP *netrw-ntree* *:Ntree*
One may specify a new tree top for tree listings using >
:Ntree [dirname]
Without a "dirname", the current line is used (and any leading depth
information is elided).
With a "dirname", the specified directory name is used.
NETRW CLEAN *netrw-clean* *:NetrwClean*
With :NetrwClean one may easily remove netrw from one's home directory;
@@ -1458,7 +1477,7 @@ Associated setting variable: |g:netrw_localrmdir| |g:netrw_rm_cmd|
*netrw-explore* *netrw-hexplore* *netrw-nexplore* *netrw-pexplore*
*netrw-rexplore* *netrw-sexplore* *netrw-texplore* *netrw-vexplore*
*netrw-rexplore* *netrw-sexplore* *netrw-texplore* *netrw-vexplore* *netrw-lexplore*
DIRECTORY EXPLORATION COMMANDS {{{2
:[N]Explore[!] [dir]... Explore directory of current file *:Explore*
@@ -1467,6 +1486,7 @@ DIRECTORY EXPLORATION COMMANDS {{{2
:[N]Sexplore[!] [dir]... Split&Explore current file's directory *:Sexplore*
:Texplore [dir]... Tab & Explore *:Texplore*
:[N]Vexplore[!] [dir]... Vertical Split & Explore *:Vexplore*
:Lexplore [dir]... Left Explorer Toggle *:Lexplore*
Used with :Explore **/pattern : (also see |netrw-starstar|)
:Nexplore............. go to next matching file *:Nexplore*
@@ -1478,6 +1498,9 @@ DIRECTORY EXPLORATION COMMANDS {{{2
window will take over that window. Normally the splitting is taken
horizontally.
:Explore! is like :Explore, but will use vertical splitting.
:Lexplore [dir] toggles an Explorer window on the left hand side
of the current tab It will open a netrw window on the current
directory if [dir] is omitted.
:Sexplore will always split the window before invoking the local-directory
browser. As with Explore, the splitting is normally done
horizontally.
@@ -1486,7 +1509,7 @@ DIRECTORY EXPLORATION COMMANDS {{{2
:Hexplore! [dir] does an :Explore with |:aboveleft| horizontal splitting.
:Vexplore [dir] does an :Explore with |:leftabove| vertical splitting.
:Vexplore! [dir] does an :Explore with |:rightbelow| vertical splitting.
:Texplore [dir] does a tabnew before generating the browser window
:Texplore [dir] does a |:tabnew| before generating the browser window
By default, these commands use the current file's directory. However, one may
explicitly provide a directory (path) to use.
@@ -1505,6 +1528,8 @@ windows should have.
of the <2-leftmouse> map (which is only available under gvim and
cooperative terms).
Also see: |g:netrw_alto| |g:netrw_altv| |g:netrw_winsize|
*netrw-star* *netrw-starpat* *netrw-starstar* *netrw-starstarpat*
EXPLORING WITH STARS AND PATTERNS
@@ -1696,9 +1721,36 @@ As a quick shortcut, one may press >
to toggle between hiding files which begin with a period (dot) and not hiding
them.
Associated setting variable: |g:netrw_list_hide| |g:netrw_hide|
Associated setting variables: |g:netrw_list_hide| |g:netrw_hide|
Associated topics: |netrw-a| |netrw-ctrl-h| |netrw-mh|
*netrw-gitignore*
Netrw provides a helper function 'netrw_gitignore#Hide()' that, when used with
|g:netrw_list_hide| automatically hides all git-ignored files.
'netrw_gitignore#Hide' searches for patterns in the following files:
'./.gitignore'
'./.git/info/exclude'
global gitignore file: `git config --global core.excludesfile`
system gitignore file: `git config --system core.excludesfile`
Files that do not exist, are ignored.
Git-ignore patterns are taken from existing files, and converted to patterns for
hiding files. For example, if you had '*.log' in your '.gitignore' file, it
would be converted to '.*\.log'.
To use this function, simply assign it's output to |g:netrw_list_hide| option.
Example: let g:netrw_list_hide= netrw_gitignore#Hide()
Git-ignored files are hidden in Netrw.
Example: let g:netrw_list_hide= netrw_gitignore#Hide('my_gitignore_file')
Function can take additional files with git-ignore patterns.
Example: g:netrw_list_hide= netrw_gitignore#Hide() . '.*\.swp$'
Combining 'netrw_gitignore#Hide' with custom patterns.
IMPROVING BROWSING *netrw-listhack* *netrw-ssh-hack* {{{2
Especially with the remote directory browser, constantly entering the password
@@ -1778,6 +1830,15 @@ passwords:
http://sial.org/howto/openssh/publickey-auth/
Ssh hints:
Thomer Gil has provided a hint on how to speed up netrw+ssh:
http://thomer.com/howtos/netrw_ssh.html
Alex Young has several hints on speeding ssh up:
http://usevim.com/2012/03/16/editing-remote-files/
LISTING BOOKMARKS AND HISTORY *netrw-qb* *netrw-listbookmark* {{{2
Pressing "qb" (query bookmarks) will list both the bookmarked directories and
@@ -1800,8 +1861,8 @@ directory. Attempts to make a local directory that already exists (as either
a file or a directory) will be detected, reported on, and ignored.
Related topics: |netrw-D|
Associated setting variables: |g:netrw_localmkdir| |g:netrw_mkdir_cmd|
|g:netrw_remote_mkdir|
Associated setting variables: |g:netrw_localmkdir| |g:netrw_mkdir_cmd|
|g:netrw_remote_mkdir| |netrw-%|
MAKING THE BROWSING DIRECTORY THE CURRENT DIRECTORY *netrw-c* {{{2
@@ -1860,6 +1921,10 @@ like >
<
into $HOME/.vim/after/syntax/netrw.vim .
If the mouse is enabled and works with your vim, you may use <s-leftmouse> to
mark one or more files. You may mark multiple files by dragging the shifted
leftmouse. (see |netrw-mouse|)
*markfilelist* *global_markfilelist* *local_markfilelist*
All marked files are entered onto the global marked file list; there is only
one such list. In addition, every netrw buffer also has its own local marked
@@ -2114,7 +2179,15 @@ your browsing preferences. (see also: |netrw-settings|)
--- -----------
Var Explanation
--- -----------
< *g:netrw_alto* change from above splitting to below splitting
< *g:netrw_altfile* some like |CTRL-^| to return to the last
edited file. Choose that by setting this
parameter to 1.
Others like |CTRL-^| to return to the
netrw browsing buffer. Choose that by setting
this parameter to 0.
default: =0
*g:netrw_alto* change from above splitting to below splitting
by setting this variable (see |netrw-o|)
default: =&sb (see |'sb'|)
@@ -2142,6 +2215,10 @@ your browsing preferences. (see also: |netrw-settings|)
to get vertical splitting instead of
horizontal splitting.
Related topics:
|netrw-cr| |netrw-C|
|g:netrw_alto| |g:netrw_altv|
*g:netrw_browsex_viewer* specify user's preference for a viewer: >
"kfmclient exec"
"gnome-open"
@@ -2303,10 +2380,19 @@ your browsing preferences. (see also: |netrw-settings|)
stamp information and file size)
= 2: wide listing (multiple files in columns)
= 3: tree style listing
*g:netrw_list_hide* comma separated pattern list for hiding files
Patterns are regular expressions (see |regexp|)
Example: let g:netrw_list_hide= '.*\.swp$'
default: ""
There's some special support for git-ignore
files: you may add the output from the helper
function 'netrw_gitignore#Hide() automatically
hiding all gitignored files.
For more details see |netrw-gitignore|.
Examples:
let g:netrw_list_hide= '.*\.swp$'
let g:netrw_list_hide= netrw_gitignore#Hide().'.*\.swp$'
default: ""
*g:netrw_localcopycmd* ="cp" Linux/Unix/MacOS/Cygwin
="copy" Windows
@@ -2551,6 +2637,8 @@ To open a file in netrw's current directory, press "%". This map will
query the user for a new filename; an empty file by that name will be
placed in the netrw's current directory (ie. b:netrw_curdir).
Related topics: |netrw-d|
PREVIEW WINDOW *netrw-p* *netrw-preview* {{{2
@@ -2655,7 +2743,7 @@ One may select a netrw window for editing with the "C" mapping, or by setting
g:netrw_chgwin to the selected window number. Subsequent selection of a file
to edit (|netrw-cr|) will use that window.
Related topics: |netrw-cr|
Related topics: |netrw-cr| |g:netrw_browse_split|
Associated setting variables: |g:netrw_chgwin|
@@ -2988,15 +3076,78 @@ which is loaded automatically at startup (assuming :set nocp).
read/write your file over the network in a separate tab.
To save the file, use >
:tabnext
:set bt=
:w! DBG
< Please send that information to <netrw.vim>'s maintainer, >
< Furthermore, it'd be helpful if you would type >
:Dsep
< after each command you issue, thereby making it easier to
associate which part of the debugging trace is due to which
command.
Please send that information to <netrw.vim>'s maintainer, >
NdrOchip at ScampbellPfamily.AbizM - NOSPAM
<
==============================================================================
12. History *netrw-history* {{{1
v150: Jul 12, 2013 * removed a "keepalt" to allow ":e #" to
return to the netrw directory listing
Jul 13, 2013 * (Jonas Diemer) suggested changing
a <cWORD> to <cfile>.
Jul 21, 2013 * (Yuri Kanivetsky) reported that netrw's
use of mkdir did not produce directories
following umask.
Aug 27, 2013 * introduced |g:netrw_altfile| option
Sep 05, 2013 * s:Strlen() now uses |strdisplaywidth()|
when available, by default
Sep 12, 2013 * (Selyano Baldo) reported that netrw wasn't
opening some directories properly from the
command line.
Nov 09, 2013 * |:Lexplore| introduced
* (Ondrej Platek) reported an issue with
netrw's trees (P15). Fixed.
* (Jorge Solis) reported that "t" in
tree mode caused netrw to forget its
line position.
Dec 05, 2013 * Added <s-leftmouse> file marking
(see |netrw-mf|)
Dec 05, 2013 * (Yasuhiro Matsumoto) Explore should use
strlen() instead s:Strlen() when handling
multibyte chars with strpart()
(ie. strpart() is byte oriented, not
display-width oriented).
Dec 09, 2013 * (Ken Takata) Provided a patch; File sizes
and a portion of timestamps were wrongly
highlighted with the directory color when
setting `:let g:netrw_liststyle=1` on Windows.
* (Paul Domaskis) noted that sometimes
cursorline was activating in non-netrw
windows. All but one setting of cursorline
was done via setl; there was one that was
overlooked. Fixed.
Dec 24, 2013 * (esquifit) asked that netrw allow the
/cygdrive prefix be a user-alterable
parameter.
Jan 02, 2014 * Fixed a problem with netrw-based ballon
evaluation (ie. netrw#NetrwBaloonHelp()
not having been loaded error messages)
Jan 03, 2014 * Fixed a problem with tree listings
* New command installed: |:Ntree|
Jan 06, 2014 * (Ivan Brennan) reported a problem with
|netrw-P|. Fixed.
Jan 06, 2014 * Fixed a problem with |netrw-P| when the
modified file was to be abandoned.
Jan 15, 2014 * (Matteo Cavalleri) reported that when the
banner is suppressed and tree listing is
used, a blank line was left at the top of
the display. Fixed.
Jan 20, 2014 * (Gideon Go) reported that, in tree listing
style, with a previous window open, that
the wrong directory was being used to open
a file. Fixed. (P21)
v149: Apr 18, 2013 * in wide listing format, now have maps for
w and b to move to next/previous file
Apr 26, 2013 * one may now copy files in the same
@@ -3009,7 +3160,8 @@ which is loaded automatically at startup (assuming :set nocp).
May 01, 2013 * :Explore ftp://... wasn't working. Fixed.
May 02, 2013 * introduced |g:netrw_bannerbackslash| as
requested by Paul Domaskis.
May 18, 2013 * More fixes for windows (not cygwin)
Jul 03, 2013 * Explore now avoids splitting when a buffer
will be hidden.
v148: Apr 16, 2013 * changed Netrw's Style menu to allow direct
choice of listing style, hiding style, and
sorting style

View File

@@ -1827,6 +1827,7 @@ $VIMRUNTIME starting.txt /*$VIMRUNTIME*
:GnatPretty ft_ada.txt /*:GnatPretty*
:GnatTags ft_ada.txt /*:GnatTags*
:Hexplore pi_netrw.txt /*:Hexplore*
:Lexplore pi_netrw.txt /*:Lexplore*
:Man filetype.txt /*:Man*
:MkVimball pi_vimball.txt /*:MkVimball*
:N editing.txt /*:N*
@@ -1838,6 +1839,7 @@ $VIMRUNTIME starting.txt /*$VIMRUNTIME*
:Nread pi_netrw.txt /*:Nread*
:Ns pi_netrw.txt /*:Ns*
:Nsource pi_netrw.txt /*:Nsource*
:Ntree pi_netrw.txt /*:Ntree*
:Nw pi_netrw.txt /*:Nw*
:Nwrite pi_netrw.txt /*:Nwrite*
:P various.txt /*:P*
@@ -2214,6 +2216,9 @@ $VIMRUNTIME starting.txt /*$VIMRUNTIME*
:foldopen fold.txt /*:foldopen*
:for eval.txt /*:for*
:fu eval.txt /*:fu*
:func-abort eval.txt /*:func-abort*
:func-dict eval.txt /*:func-dict*
:func-range eval.txt /*:func-range*
:function eval.txt /*:function*
:function-verbose eval.txt /*:function-verbose*
:g repeat.txt /*:g*
@@ -2668,6 +2673,7 @@ $VIMRUNTIME starting.txt /*$VIMRUNTIME*
:rviminfo starting.txt /*:rviminfo*
:s change.txt /*:s*
:s% change.txt /*:s%*
:s/\= change.txt /*:s\/\\=*
:sN windows.txt /*:sN*
:sNext windows.txt /*:sNext*
:s\= change.txt /*:s\\=*
@@ -5882,6 +5888,7 @@ g:ada_standard_types ft_ada.txt /*g:ada_standard_types*
g:ada_with_gnat_project_files ft_ada.txt /*g:ada_with_gnat_project_files*
g:ada_withuse_ordinary ft_ada.txt /*g:ada_withuse_ordinary*
g:clojure_align_multiline_strings indent.txt /*g:clojure_align_multiline_strings*
g:clojure_align_subforms indent.txt /*g:clojure_align_subforms*
g:clojure_fuzzy_indent indent.txt /*g:clojure_fuzzy_indent*
g:clojure_fuzzy_indent_blacklist indent.txt /*g:clojure_fuzzy_indent_blacklist*
g:clojure_fuzzy_indent_patterns indent.txt /*g:clojure_fuzzy_indent_patterns*
@@ -5930,6 +5937,7 @@ g:html_use_css syntax.txt /*g:html_use_css*
g:html_use_encoding syntax.txt /*g:html_use_encoding*
g:html_use_xhtml syntax.txt /*g:html_use_xhtml*
g:html_whole_filler syntax.txt /*g:html_whole_filler*
g:netrw_altfile pi_netrw.txt /*g:netrw_altfile*
g:netrw_alto pi_netrw.txt /*g:netrw_alto*
g:netrw_altv pi_netrw.txt /*g:netrw_altv*
g:netrw_banner pi_netrw.txt /*g:netrw_banner*
@@ -5964,6 +5972,7 @@ g:netrw_glob_escape pi_netrw.txt /*g:netrw_glob_escape*
g:netrw_hide pi_netrw.txt /*g:netrw_hide*
g:netrw_home pi_netrw.txt /*g:netrw_home*
g:netrw_http_cmd pi_netrw.txt /*g:netrw_http_cmd*
g:netrw_http_put_cmd pi_netrw.txt /*g:netrw_http_put_cmd*
g:netrw_http_xcmd pi_netrw.txt /*g:netrw_http_xcmd*
g:netrw_ignorenetrc pi_netrw.txt /*g:netrw_ignorenetrc*
g:netrw_keepdir pi_netrw.txt /*g:netrw_keepdir*
@@ -6985,6 +6994,7 @@ netrw-gd pi_netrw.txt /*netrw-gd*
netrw-getftype pi_netrw.txt /*netrw-getftype*
netrw-gf pi_netrw.txt /*netrw-gf*
netrw-gh pi_netrw.txt /*netrw-gh*
netrw-gitignore pi_netrw.txt /*netrw-gitignore*
netrw-gp pi_netrw.txt /*netrw-gp*
netrw-gx pi_netrw.txt /*netrw-gx*
netrw-handler pi_netrw.txt /*netrw-handler*
@@ -6999,6 +7009,7 @@ netrw-incompatible pi_netrw.txt /*netrw-incompatible*
netrw-internal-variables pi_netrw.txt /*netrw-internal-variables*
netrw-intro-browse pi_netrw.txt /*netrw-intro-browse*
netrw-leftmouse pi_netrw.txt /*netrw-leftmouse*
netrw-lexplore pi_netrw.txt /*netrw-lexplore*
netrw-list pi_netrw.txt /*netrw-list*
netrw-listbookmark pi_netrw.txt /*netrw-listbookmark*
netrw-listhack pi_netrw.txt /*netrw-listhack*
@@ -7029,6 +7040,7 @@ netrw-netrc pi_netrw.txt /*netrw-netrc*
netrw-nexplore pi_netrw.txt /*netrw-nexplore*
netrw-noload pi_netrw.txt /*netrw-noload*
netrw-nread pi_netrw.txt /*netrw-nread*
netrw-ntree pi_netrw.txt /*netrw-ntree*
netrw-nwrite pi_netrw.txt /*netrw-nwrite*
netrw-o pi_netrw.txt /*netrw-o*
netrw-options pi_netrw.txt /*netrw-options*

View File

@@ -1,4 +1,4 @@
*todo.txt* For Vim version 7.4. Last change: 2014 Jan 07
*todo.txt* For Vim version 7.4. Last change: 2014 Jan 23
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -34,20 +34,9 @@ not be repeated below, unless there is extra information.
*known-bugs*
-------------------- Known bugs and current work -----------------------
Article for Vim website. (Pritesh Ugrankar, 2013 Dec 13)
Patch for Perl 5.18. (2013 Dec 13, Ken Takata)
Patch 7.4.114 breaks "Entering directory" message parsing.
patch by Lech Lorens, 2013 Dec 30.
Patch to possibly fix crash usng w_localdir. (Dominique Pelle, 2013 Dec 27)
Patch to fix crash when using :bwipeout in autocmd. (Hirohito Higashi, 2014 Jan 6)
Regexp problems:
- After patch 7.4.045 pattern with \zs isn't handled correctly. (Yukihiro
Nakadaira, 2013 Dec 23)
Nakadaira, 2013 Dec 23) Patch 2014 Jan 15, update Jan 16.
- NFA regexp doesn't count tab matches correctly. (Urtica Dioica / gaultheria
Shallon, 2013 Nov 18)
- After patch 7.4.100 there is still a difference between NFA and old engine.
@@ -60,6 +49,14 @@ Regexp problems:
- Ignorecase not handled properly for multi-byte characters. (Axel Bender,
2013 Dec 11)
- Using \@> and \?. (Brett Stahlman, 2013 Dec 21) Remark from Marcin Szamotulski
Remark from Brett 2014 Jan 6 and 7.
Patch to fix endless loop in completion. (Christian Brabandt, 2014 Jan 15)
Patch after 7.4.154: no autoload when not evaluating. (Yasuhiro Matsumoto,
2014 Jan 14)
Test for patch 7.4.149. (Yukihiro Nakadaira, 2014 Jan 15)
Problem that a previous silent ":throw" causes a following try/catch not to
work. (ZyX, 2013 Sep 28)
@@ -67,25 +64,15 @@ work. (ZyX, 2013 Sep 28)
":cd C:\Windows\System32\drivers\etc*" does not work, even though the
directory exists. (Sergio Gallelli, 2013 Dec 29)
Patch for problems with Borland compiler. (Ken Takata, 2013 Dec 14)
Blowfish is actually using CFB instead of OFB. Adjust names in blowfish.c.
Patch to make getregtype() work as documented. (Yukihiro Nakadaira, 2013 Dec
26)
More compiler warnings for Python. (Tony Mechelynck, 2014 Jan 14)
Patch to initialize v:oldfiles. (Yasuhiro Matsumoto, 2013 Dec 15)
Patch to fix that when wide functions fail the non-wide function may do
something wrong. (Ken Takata, 2014 Jan 18)
Patch to fix cursor movement. (Hirohito Higashi, 2013 Dec 21)
Patch to add more help tags. (glts, 2014 Jan 4)
Patch to avoid E685 internal error. (Yukihiro Nakadaira, 2014 Jan 1)
Restore no_autoload?
Alternative: Avoid no_autoload. (ZyX, 2014 Jan 6)
Patch to avoid that :keeppatterns s/foo/bar sets @/. (Yasuhiro Matsumoto, 2013
Dec 17)
Patch for typo in makefile. ZyX, (2013 Dec 15)
Patch 7.4.085 breaks Visual insert in some situations. (Issue 193)
Patch by Christian Brabandt, 2014 Jan 16.
Problem using ":try" inside ":execute". (ZyX, 2013 Sep 15)
@@ -94,18 +81,9 @@ ftplugins.
Python: ":py raw_input('prompt')" doesn't work. (Manu Hack)
Patch to support slices in Python vim.List. (ZyX, 2013 Oct 20)
Patch to support iterator on Python vim.options. (ZyX, 2013 Nov 2)
Patch to make Dictionary.update() work without arguments.
(ZyX, 2013 Oct 19)
Patch to allow more types in remote_expr(). (Lech Lorens, 2014 Jan 5)
Patch for Cobol ftplugin. (ZyX, 2013 Oct 20)
Await response from maintainer.
Include systemverilog file? Two votes yes.
Patch to make "J" set '[ and '] marks. (Christian Brabandt, 2013 Dec 11)
@@ -126,22 +104,37 @@ Syntax highlighting slow (hangs) in SASS file. (Niek Bosch, 2013 Aug 21)
Adding "~" to 'cdpath' doesn't work for completion? (Davido, 2013 Aug 19)
Error number E834 is used twice. (Yukihiro Nakadaira. 2014 Jan 18)
Crash with ":%s/\n//g" on long file. (Aidan Marlin, 2014 Jan 15)
Christian Brabandt: patch to run this into a join. (2014 Jan 18)
Add digraph for Rouble: =P. What's the Unicode?
Issue 174: Detect Mason files.
Phpcomplete.vim update. (Complex, 2014 Jan 15)
PHP syntax is extremely slow. (Anhad Jai Singh, 2014 Jan 19)
Patch to make has() check for Vim version and patch at the same time.
(Marc Weber, 2013 Jun 7)
Regression on pach 7.4.034. (Ingo Karkat, 2013 Nov 20)
Patch to include smack support (Linux security library). (Jose Bollo, 2014 Jan
14) Update Jan 15.
Tag list, as used for :tjump, does not unescape regexp. (Gary Johnson, 2014 Jan
6) With patch in another message.
VMS: Select() doesn't work properly, typing ESC may hang Vim. Use sys$qiow
instead. (Samuel Ferencik, 2013 Sep 28)
Series of patches for NL vs NUL handling. (ZyX, 2013 Nov 3, Nov 9)
Patch to add flag to shortmess to avoid giving completion messages.
(Shougo Matsu, 2014 Jan 6)
(Shougo Matsu, 2014 Jan 6, update Jan 11)
Patch to add v:completed_item. (Shougo Matsu, 2013 Nov 29).
@@ -224,6 +217,10 @@ GTK: problem with 'L' in 'guioptions' changing the window width.
Patch to add option that tells whether small deletes go into the numbered
registers. (Aryeh Leib Taurog, 2013 Nov 18)
Win32: use different args for SearchPath()? (Yasuhiro Matsumoto, 2009 Jan 30)
Also fixes wrong result from executable().
Update from Ken Takata, 2014 Jan 10.
Javascript file where indent gets stuck on: GalaxyMaster, 2012 May 3.
The BufUnload event is triggered when re-using the empty buffer.
@@ -234,6 +231,10 @@ The CompleteDone autocommand needs some info passed to it:
- The word that was selected (empty if abandoned complete)
- Type of completion: tag, omnifunc, user func.
Patch to allow more types in remote_expr(). (Lech Lorens, 2014 Jan 5)
Doesn't work for string in list. Other way to pass all types of variables
reliably?
Using ":call foo#d.f()" doesn't autoload the "foo.vim" file.
That is, calling a dictionary function on an autoloaded dict.
Works OK for echo, just not for ":call" and ":call call()". (Ted, 2011 Mar
@@ -1023,8 +1024,6 @@ system when 'encoding' is "utf-8".
Win32 GUI: last message from startup doesn't show up when there is an echoerr
command. (Cyril Slobin, 2009 Mar 13)
Win32: use different args for SearchPath()? (Yasuhiro Matsumoto, 2009 Jan 30)
Win32: completion of file name ":e c:\!test" results in ":e c:\\!test", which
does not work. (Nieko Maatjes, 2009 Jan 8, Ingo Karkat, 2009 Jan 22)
@@ -1648,6 +1647,9 @@ Completing with 'wildmenu' and using <Up> and <Down> to move through directory
tree stops unexpectedly when using ":cd " and entering a directory that
doesn't contain other directories.
Default for 'background' is wrong when using xterm with 256 colors.
Table with estimates from Matteo Cavalleri, 2014 Jan 10.
Setting 'background' resets the Normal background color:
highlight Normal ctermbg=DarkGray
set background=dark

View File

@@ -1,4 +1,4 @@
*usr_41.txt* For Vim version 7.4. Last change: 2013 Feb 20
*usr_41.txt* For Vim version 7.4. Last change: 2014 Jan 10
VIM USER MANUAL - by Bram Moolenaar
@@ -595,13 +595,17 @@ String manipulation: *string-functions*
matchlist() like matchstr() and also return submatches
stridx() first index of a short string in a long string
strridx() last index of a short string in a long string
strlen() length of a string
strlen() length of a string in bytes
strchars() length of a string in characters
strwidth() size of string when displayed
strdisplaywidth() size of string when displayed, deals with tabs
substitute() substitute a pattern match with a string
submatch() get a specific match in ":s" and substitute()
strpart() get part of a string
expand() expand special keywords
iconv() convert text from one encoding to another
byteidx() byte index of a character in a string
byteidxcomp() like byteidx() but count composing characters
repeat() repeat a string multiple times
eval() evaluate a string expression
@@ -656,6 +660,9 @@ Floating point computation: *float-functions*
ceil() round up
floor() round down
trunc() remove value after decimal point
fmod() remainder of division
exp() exponential
log() natural logarithm (logarithm to base e)
log10() logarithm to base 10
pow() value of x to the exponent y
sqrt() square root
@@ -675,6 +682,7 @@ Other computation: *bitwise-function*
invert() bitwise invert
or() bitwise OR
xor() bitwise XOR
sha256() SHA-256 hash
Variables: *var-functions*
type() type of a variable
@@ -697,11 +705,15 @@ Cursor and mark position: *cursor-functions* *mark-functions*
wincol() window column number of the cursor
winline() window line number of the cursor
cursor() position the cursor at a line/column
screencol() get screen column of the cursor
screenrow() get screen row of the cursor
getpos() get position of cursor, mark, etc.
setpos() set position of cursor, mark, etc.
byte2line() get line number at a specific byte count
line2byte() byte count at a specific line
diff_filler() get the number of filler lines above a line
screenattr() get attribute at a screen line/row
screenchar() get character code at a screen line/row
Working with text in the current buffer: *text-functions*
getline() get a line or list of lines from the buffer
@@ -883,14 +895,22 @@ Various: *various-functions*
libcall() call a function in an external library
libcallnr() idem, returning a number
undofile() get the name of the undo file
undotree() return the state of the undo tree
getreg() get contents of a register
getregtype() get type of a register
setreg() set contents and type of a register
shiftwidth() effective value of 'shiftwidth'
taglist() get list of matching tags
tagfiles() get a list of tags files
luaeval() evaluate Lua expression
mzeval() evaluate |MzScheme| expression
py3eval() evaluate Python expression (|+python3|)
pyeval() evaluate Python expression (|+python|)
==============================================================================
*41.7* Defining a function

View File

@@ -1,7 +1,7 @@
" Vim filetype plugin file
" Language: generic Changelog file
" Maintainer: Nikolai Weibull <now@bitwi.se>
" Latest Revision: 2013-12-15
" Latest Revision: 2014-01-10
" Variables:
" g:changelog_timeformat (deprecated: use g:changelog_dateformat instead) -
" description: the timeformat used in ChangeLog entries.
@@ -152,7 +152,7 @@ if &filetype == 'changelog'
if has_key(middles, str[i + 1])
let mid = middles[str[i + 1]]
let str = strpart(str, 0, i) . mid . strpart(str, i + 2)
let inc = strlen(mid)
let inc = strlen(mid) - 1
endif
let i = stridx(str, '%', i + 1 + inc)
endwhile

View File

@@ -1,7 +1,7 @@
" Vim filetype plugin file
" Language: cobol
" Author: Tim Pope <vimNOSPAM@tpope.info>
" $Id: cobol.vim,v 1.1 2007/05/05 17:24:38 vimboss Exp $
" Last Update: By ZyX: use shiftwidth()
" Insert mode mappings: <C-T> <C-D> <Tab>
" Normal mode mappings: < > << >> [[ ]] [] ][
@@ -113,7 +113,7 @@ endfunction
function! s:increase(...)
let lnum = '.'
let sw = &shiftwidth
let sw = shiftwidth()
let i = a:0 ? a:1 : indent(lnum)
if i >= 11
return sw - (i - 11) % sw
@@ -128,7 +128,7 @@ endfunction
function! s:decrease(...)
let lnum = '.'
let sw = &shiftwidth
let sw = shiftwidth()
let i = indent(a:0 ? a:1 : lnum)
if i >= 11 + sw
return 1 + (i + 12) % sw
@@ -147,7 +147,7 @@ function! CobolIndentBlock(shift)
let head = strpart(getline('.'),0,7)
let tail = strpart(getline('.'),7)
let indent = match(tail,'[^ ]')
let sw = &shiftwidth
let sw = shiftwidth()
let shift = a:shift
if shift > 0
if indent < 4
@@ -221,7 +221,8 @@ endfunction
function! s:Tab()
if (strpart(getline('.'),0,col('.')-1) =~ '^\s*$' && &sta)
return s:IncreaseIndent()
elseif &sts == &sw && &sts != 8 && &et
" &softtabstop < 0: &softtabstop follows &shiftwidth
elseif (&sts < 0 || &sts == shiftwidth()) && &sts != 8 && &et
return s:repeat(" ",s:increase(col('.')-1))
else
return "\<Tab>"

View File

@@ -0,0 +1,36 @@
" Vim filetype plugin file
" Language: Windows Registry export with regedit (*.reg)
" Maintainer: Cade Forester <ahx2323@gmail.com>
" Latest Revision: 2014-01-09
if exists("b:did_ftplugin")
finish
endif
let b:did_ftplugin = 1
let s:cpo_save = &cpo
set cpo&vim
let b:undo_ftplugin =
\ 'let b:browsefilter = "" | ' .
\ 'setlocal ' .
\ 'comments< '.
\ 'commentstring< ' .
\ 'formatoptions< '
if has( 'gui_win32' )
\ && !exists( 'b:browsefilter' )
let b:browsefilter =
\ 'registry files (*.reg)\t*.reg\n' .
\ 'All files (*.*)\t*.*\n'
endif
setlocal comments=:;
setlocal commentstring=;\ %s
setlocal formatoptions-=t
setlocal formatoptions+=croql
let &cpo = s:cpo_save
unlet s:cpo_save

View File

@@ -3,7 +3,7 @@
" Author: John Wellesz <John.wellesz (AT) teaser (DOT) fr>
" URL: http://www.2072productions.com/vim/indent/php.vim
" Home: https://github.com/2072/PHP-Indenting-for-VIm
" Last Change: 2013 August 7th
" Last Change: 2014 Jan 21
" Version: 1.39
"
"
@@ -642,7 +642,7 @@ function! GetPhpIndent()
if previous_line =~ '^\s*}\|;\s*}'.endline " XXX
call cursor(last_line_num, 1)
call search('}\|;\s*}'.endline, 'W')
call search('}\|;\s*}'.endline, 'cW')
let oldLastLine = last_line_num
let last_line_num = searchpair('{', '', '}', 'bW', 'Skippmatch()')

View File

@@ -1,7 +1,7 @@
" ---------------------------------------------------------------------
" getscriptPlugin.vim
" Author: Charles E. Campbell
" Date: Jan 07, 2008
" Date: Nov 29, 2013
" Installing: :help glvs-install
" Usage: :help glvs
"
@@ -13,13 +13,16 @@
" Initialization: {{{1
" if you're sourcing this file, surely you can't be
" expecting vim to be in its vi-compatible mode
if &cp || exists("g:loaded_getscriptPlugin")
if exists("g:loaded_getscriptPlugin")
finish
endif
if &cp
if &verbose
echo "GetLatestVimScripts is not vi-compatible; not loaded (you need to set nocp)"
endif
finish
endif
let g:loaded_getscriptPlugin = "v35"
let g:loaded_getscriptPlugin = "v36"
let s:keepcpo = &cpo
set cpo&vim

View File

@@ -1,9 +1,9 @@
" netrwPlugin.vim: Handles file transfer and remote directory listing across a network
" PLUGIN SECTION
" Date: Apr 30, 2013
" Date: Dec 31, 2013
" Maintainer: Charles E Campbell <NdrOchip@ScampbellPfamily.AbizM-NOSPAM>
" GetLatestVimScripts: 1075 1 :AutoInstall: netrw.vim
" Copyright: Copyright (C) 1999-2012 Charles E. Campbell {{{1
" Copyright: Copyright (C) 1999-2013 Charles E. Campbell {{{1
" Permission is hereby granted to use and distribute this code,
" with or without modifications, provided that this copyright
" notice is copied with it. Like anything else that's free,
@@ -20,27 +20,33 @@
if &cp || exists("g:loaded_netrwPlugin")
finish
endif
"DechoTabOn
let g:loaded_netrwPlugin = "v149"
let g:loaded_netrwPlugin = "v150"
if v:version < 702
echohl WarningMsg | echo "***netrw*** you need vim version 7.2 for this version of netrw" | echohl None
echohl WarningMsg
echo "***warning*** you need vim version 7.2 for this version of netrw"
echohl None
finish
endif
if v:version < 703 || (v:version == 703 && !has("patch465"))
echohl WarningMsg
echo "***warning*** this version of netrw needs vim 7.3.465 or later"
echohl Normal
finish
endif
let s:keepcpo = &cpo
set cpo&vim
"DechoTabOn
"DechoRemOn
" ---------------------------------------------------------------------
" Public Interface: {{{1
" Local Browsing: {{{2
" Local Browsing Autocmds: {{{2
augroup FileExplorer
au!
" SEE Benzinger problem...
au BufEnter * sil! call s:LocalBrowse(expand("<amatch>"))
au VimEnter * sil! call s:VimEnter(expand("<amatch>"))
au BufEnter * sil call s:LocalBrowse(expand("<amatch>"))
au VimEnter * sil call s:VimEnter(expand("<amatch>"))
if has("win32") || has("win95") || has("win64") || has("win16")
au BufEnter .* sil! call s:LocalBrowse(expand("<amatch>"))
au BufEnter .* sil call s:LocalBrowse(expand("<amatch>"))
endif
augroup END
@@ -50,8 +56,8 @@ augroup Network
au BufReadCmd file://* call netrw#FileUrlRead(expand("<amatch>"))
au BufReadCmd ftp://*,rcp://*,scp://*,http://*,https://*,dav://*,davs://*,rsync://*,sftp://* exe "sil doau BufReadPre ".fnameescape(expand("<amatch>"))|call netrw#Nread(2,expand("<amatch>"))|exe "sil doau BufReadPost ".fnameescape(expand("<amatch>"))
au FileReadCmd ftp://*,rcp://*,scp://*,http://*,https://*,dav://*,davs://*,rsync://*,sftp://* exe "sil doau FileReadPre ".fnameescape(expand("<amatch>"))|call netrw#Nread(1,expand("<amatch>"))|exe "sil doau FileReadPost ".fnameescape(expand("<amatch>"))
au BufWriteCmd ftp://*,rcp://*,scp://*,dav://*,davs://*,rsync://*,sftp://* exe "sil doau BufWritePre ".fnameescape(expand("<amatch>"))|exe 'Nwrite '.fnameescape(expand("<amatch>"))|exe "sil doau BufWritePost ".fnameescape(expand("<amatch>"))
au FileWriteCmd ftp://*,rcp://*,scp://*,dav://*,davs://*,rsync://*,sftp://* exe "sil doau FileWritePre ".fnameescape(expand("<amatch>"))|exe "'[,']".'Nwrite '.fnameescape(expand("<amatch>"))|exe "sil doau FileWritePost ".fnameescape(expand("<amatch>"))
au BufWriteCmd ftp://*,rcp://*,scp://*,http://*,dav://*,davs://*,rsync://*,sftp://* exe "sil doau BufWritePre ".fnameescape(expand("<amatch>"))|exe 'Nwrite '.fnameescape(expand("<amatch>"))|exe "sil doau BufWritePost ".fnameescape(expand("<amatch>"))
au FileWriteCmd ftp://*,rcp://*,scp://*,http://*,dav://*,davs://*,rsync://*,sftp://* exe "sil doau FileWritePre ".fnameescape(expand("<amatch>"))|exe "'[,']".'Nwrite '.fnameescape(expand("<amatch>"))|exe "sil doau FileWritePost ".fnameescape(expand("<amatch>"))
try
au SourceCmd ftp://*,rcp://*,scp://*,http://*,https://*,dav://*,davs://*,rsync://*,sftp://* exe 'Nsource '.fnameescape(expand("<amatch>"))
catch /^Vim\%((\a\+)\)\=:E216/
@@ -64,8 +70,9 @@ com! -count=1 -nargs=* Nread call netrw#NetrwSavePosn()<bar>call netrw#NetRead(
com! -range=% -nargs=* Nwrite call netrw#NetrwSavePosn()<bar><line1>,<line2>call netrw#NetWrite(<f-args>)<bar>call netrw#NetrwRestorePosn()
com! -nargs=* NetUserPass call NetUserPass(<f-args>)
com! -nargs=* Nsource call netrw#NetrwSavePosn()<bar>call netrw#NetSource(<f-args>)<bar>call netrw#NetrwRestorePosn()
com! -nargs=? Ntree call netrw#NetrwSetTreetop(<q-args>)
" Commands: :Explore, :Sexplore, Hexplore, Vexplore {{{2
" Commands: :Explore, :Sexplore, Hexplore, Vexplore, Lexplore {{{2
com! -nargs=* -bar -bang -count=0 -complete=dir Explore call netrw#Explore(<count>,0,0+<bang>0,<q-args>)
com! -nargs=* -bar -bang -count=0 -complete=dir Sexplore call netrw#Explore(<count>,1,0+<bang>0,<q-args>)
com! -nargs=* -bar -bang -count=0 -complete=dir Hexplore call netrw#Explore(<count>,1,2+<bang>0,<q-args>)
@@ -73,6 +80,7 @@ com! -nargs=* -bar -bang -count=0 -complete=dir Vexplore call netrw#Explore(<cou
com! -nargs=* -bar -count=0 -complete=dir Texplore call netrw#Explore(<count>,0,6 ,<q-args>)
com! -nargs=* -bar -bang Nexplore call netrw#Explore(-1,0,0,<q-args>)
com! -nargs=* -bar -bang Pexplore call netrw#Explore(-2,0,0,<q-args>)
com! -nargs=* -bar -complete=dir Lexplore call netrw#Lexplore(<q-args>)
" Commands: NetrwSettings {{{2
com! -nargs=0 NetrwSettings call netrwSettings#NetrwSettings()
@@ -83,46 +91,61 @@ if !exists("g:netrw_nogx") && maparg('gx','n') == ""
if !hasmapto('<Plug>NetrwBrowseX')
nmap <unique> gx <Plug>NetrwBrowseX
endif
nno <silent> <Plug>NetrwBrowseX :call netrw#NetrwBrowseX(expand("<cWORD>"),0)<cr>
nno <silent> <Plug>NetrwBrowseX :call netrw#NetrwBrowseX(expand("<cfile>"),0)<cr>
endif
" ---------------------------------------------------------------------
" LocalBrowse: {{{2
" LocalBrowse: invokes netrw#LocalBrowseCheck() on directory buffers {{{2
fun! s:LocalBrowse(dirname)
" unfortunate interaction -- debugging calls can't be used here;
" the BufEnter event causes triggering when attempts to write to
" Unfortunate interaction -- only DechoMsg debugging calls can be safely used here.
" Otherwise, the BufEnter event gets triggered when attempts to write to
" the DBG buffer are made.
if !exists("s:vimentered")
" If s:vimentered doesn't exist, then the VimEnter event hasn't fired. It will,
" and so s:VimEnter() will then be calling this routine, but this time with s:vimentered defined.
" call Dfunc("s:LocalBrowse(dirname<".a:dirname.">) (s:vimentered doesn't exist)")
" call Dret("s:LocalBrowse")
return
endif
" call Decho("s:LocalBrowse(dirname<".a:dirname.">){")
" echomsg "dirname<".a:dirname.">"
" call Dfunc("s:LocalBrowse(dirname<".a:dirname.">) (s:vimentered=".s:vimentered.")")
if has("amiga")
" The check against '' is made for the Amiga, where the empty
" string is the current directory and not checking would break
" things such as the help command.
" call Decho("(LocalBrowse) dirname<".a:dirname."> (amiga)")
" call Decho("(LocalBrowse) dirname<".a:dirname."> (isdirectory, amiga)")
if a:dirname != '' && isdirectory(a:dirname)
sil! call netrw#LocalBrowseCheck(a:dirname)
endif
elseif isdirectory(a:dirname)
" echomsg "dirname<".dirname."> isdir"
" call Decho("(LocalBrowse) dirname<".a:dirname."> (not amiga)")
" call Decho("(LocalBrowse) dirname<".a:dirname."> (isdirectory, not amiga)")
sil! call netrw#LocalBrowseCheck(a:dirname)
else
" not a directory, ignore it
" call Decho("(LocalBrowse) dirname<".a:dirname."> not a directory, ignoring...")
endif
" not a directory, ignore it
" call Decho("|return s:LocalBrowse }")
" call Dret("s:LocalBrowse")
endfun
" ---------------------------------------------------------------------
" s:VimEnter: {{{2
" s:VimEnter: after all vim startup stuff is done, this function is called. {{{2
" Its purpose: to look over all windows and run s:LocalBrowse() on
" them, which checks if they're directories and will create a directory
" listing when appropriate.
" It also sets s:vimentered, letting s:LocalBrowse() know that s:VimEnter()
" has already been called.
fun! s:VimEnter(dirname)
" call Decho("VimEnter(dirname<".a:dirname.">){")
" call Dfunc("s:VimEnter(dirname<".a:dirname.">) expand(%)<".expand("%").">")
let curwin = winnr()
let s:vimentered = 1
windo if a:dirname != expand("%")|call s:LocalBrowse(expand("%:p"))|endif
windo call s:LocalBrowse(expand("%:p"))
exe curwin."wincmd w"
" call Decho("|return VimEnter }")
" call Dret("s:VimEnter")
endfun
" ---------------------------------------------------------------------

View File

@@ -19,11 +19,12 @@ syn cluster NetrwTreeGroup contains=netrwDir,netrwSymLink,netrwExe
syn match netrwPlain "\(\S\+ \)*\S\+" contains=@NoSpell
syn match netrwSpecial "\%(\S\+ \)*\S\+[*|=]\ze\%(\s\{2,}\|$\)" contains=netrwClassify,@NoSpell
syn match netrwDir "\.\{1,2}/" contains=netrwClassify,@NoSpell
syn match netrwDir "\%(\S\+ \)*\S\+/" contains=netrwClassify,@NoSpell
"syn match netrwDir "\%(\S\+ \)*\S\+/" contains=netrwClassify,@NoSpell
syn match netrwDir "\%(\S\+ \)*\S\+/\ze\%(\s\{2,}\|$\)" contains=netrwClassify,@NoSpell
syn match netrwSizeDate "\<\d\+\s\d\{1,2}/\d\{1,2}/\d\{4}\s" skipwhite contains=netrwDateSep,@NoSpell nextgroup=netrwTime
syn match netrwSymLink "\%(\S\+ \)*\S\+@\ze\%(\s\{2,}\|$\)" contains=netrwClassify,@NoSpell
syn match netrwExe "\%(\S\+ \)*\S*[^~]\*\ze\%(\s\{2,}\|$\)" contains=netrwClassify,@NoSpell
syn match netrwTreeBar "^\%([-+|] \)\+" contains=netrwTreeBarSpace nextgroup=@netrwTreeGroup
syn match netrwTreeBar "^\%([-+|] \)\+" contains=netrwTreeBarSpace nextgroup=@netrwTreeGroup
syn match netrwTreeBarSpace " " contained
syn match netrwClassify "[*=|@/]\ze\%(\s\{2,}\|$\)" contained

View File

@@ -1,7 +1,7 @@
" An example for a vimrc file.
"
" Maintainer: Bram Moolenaar <Bram@vim.org>
" Last change: 2011 Apr 15
" Last change: 2014 Feb 05
"
" To use it, copy it to
" for Unix and OS/2: ~/.vimrc
@@ -24,7 +24,8 @@ set backspace=indent,eol,start
if has("vms")
set nobackup " do not keep a backup file, use versions instead
else
set backup " keep a backup file
set backup " keep a backup file (restore to previous version)
set undofile " keep an undo file (undo changes after closing)
endif
set history=50 " keep 50 lines of command line history
set ruler " show the cursor position all the time

View File

@@ -2381,6 +2381,7 @@ shadow: runtime pixmaps
../../testdir/*.in \
../../testdir/*.vim \
../../testdir/python* \
../../testdir/sautest \
../../testdir/test83-tags? \
../../testdir/*.ok .

View File

@@ -4180,6 +4180,7 @@ ins_compl_get_exp(ini)
char_u *dict = NULL;
int dict_f = 0;
compl_T *old_match;
int set_match_pos;
if (!compl_started)
{
@@ -4198,6 +4199,7 @@ ins_compl_get_exp(ini)
for (;;)
{
found_new_match = FAIL;
set_match_pos = FALSE;
/* For ^N/^P pick a new entry from e_cpt if compl_started is off,
* or if found_all says this entry is done. For ^X^L only use the
@@ -4217,6 +4219,10 @@ ins_compl_get_exp(ini)
dec(&first_match_pos);
last_match_pos = first_match_pos;
type = 0;
/* Remember the first match so that the loop stops when we
* wrap and come back there a second time. */
set_match_pos = TRUE;
}
else if (vim_strchr((char_u *)"buwU", *e_cpt) != NULL
&& (ins_buf = ins_compl_next_buf(ins_buf, *e_cpt)) != curbuf)
@@ -4381,7 +4387,7 @@ ins_compl_get_exp(ini)
if (ins_buf->b_p_inf)
p_scs = FALSE;
/* buffers other than curbuf are scanned from the beginning or the
/* Buffers other than curbuf are scanned from the beginning or the
* end but never from the middle, thus setting nowrapscan in this
* buffers is a good idea, on the other hand, we always set
* wrapscan for curbuf to avoid missing matches -- Acevedo,Webb */
@@ -4408,12 +4414,13 @@ ins_compl_get_exp(ini)
compl_pattern, 1L, SEARCH_KEEP + SEARCH_NFMSG,
RE_LAST, (linenr_T)0, NULL);
--msg_silent;
if (!compl_started)
if (!compl_started || set_match_pos)
{
/* set "compl_started" even on fail */
compl_started = TRUE;
first_match_pos = *pos;
last_match_pos = *pos;
set_match_pos = FALSE;
}
else if (first_match_pos.lnum == last_match_pos.lnum
&& first_match_pos.col == last_match_pos.col)

View File

@@ -447,7 +447,7 @@ static int string2float __ARGS((char_u *text, float_T *value));
#endif
static int get_env_tv __ARGS((char_u **arg, typval_T *rettv, int evaluate));
static int find_internal_func __ARGS((char_u *name));
static char_u *deref_func_name __ARGS((char_u *name, int *lenp));
static char_u *deref_func_name __ARGS((char_u *name, int *lenp, int no_autoload));
static int get_func_tv __ARGS((char_u *name, int len, typval_T *rettv, char_u **arg, linenr_T firstline, linenr_T lastline, int *doesrange, int evaluate, dict_T *selfdict));
static int call_func __ARGS((char_u *funcname, int len, typval_T *rettv, int argcount, typval_T *argvars, linenr_T firstline, linenr_T lastline, int *doesrange, int evaluate, dict_T *selfdict));
static void emsg_funcname __ARGS((char *ermsg, char_u *name));
@@ -3432,7 +3432,7 @@ ex_call(eap)
/* If it is the name of a variable of type VAR_FUNC use its contents. */
len = (int)STRLEN(tofree);
name = deref_func_name(tofree, &len);
name = deref_func_name(tofree, &len, FALSE);
/* Skip white space to allow ":call func ()". Not good, but required for
* backward compatibility. */
@@ -5159,7 +5159,7 @@ eval7(arg, rettv, evaluate, want_string)
{
/* If "s" is the name of a variable of type VAR_FUNC
* use its contents. */
s = deref_func_name(s, &len);
s = deref_func_name(s, &len, !evaluate);
/* Invoke the function. */
ret = get_func_tv(s, len, rettv, arg,
@@ -6425,6 +6425,16 @@ list_insert_tv(l, tv, item)
if (ni == NULL)
return FAIL;
copy_tv(tv, &ni->li_tv);
list_insert(l, ni, item);
return OK;
}
void
list_insert(l, ni, item)
list_T *l;
listitem_T *ni;
listitem_T *item;
{
if (item == NULL)
/* Append new item at end of list. */
list_append(l, ni);
@@ -6446,7 +6456,6 @@ list_insert_tv(l, tv, item)
item->li_prev = ni;
++l->lv_len;
}
return OK;
}
/*
@@ -8282,16 +8291,17 @@ find_internal_func(name)
* name it contains, otherwise return "name".
*/
static char_u *
deref_func_name(name, lenp)
deref_func_name(name, lenp, no_autoload)
char_u *name;
int *lenp;
int no_autoload;
{
dictitem_T *v;
int cc;
cc = name[*lenp];
name[*lenp] = NUL;
v = find_var(name, NULL, FALSE);
v = find_var(name, NULL, no_autoload);
name[*lenp] = cc;
if (v != NULL && v->di_tv.v_type == VAR_FUNC)
{
@@ -21938,14 +21948,14 @@ trans_function_name(pp, skip, flags, fdp)
if (lv.ll_exp_name != NULL)
{
len = (int)STRLEN(lv.ll_exp_name);
name = deref_func_name(lv.ll_exp_name, &len);
name = deref_func_name(lv.ll_exp_name, &len, flags & TFN_NO_AUTOLOAD);
if (name == lv.ll_exp_name)
name = NULL;
}
else
{
len = (int)(end - *pp);
name = deref_func_name(*pp, &len);
name = deref_func_name(*pp, &len, flags & TFN_NO_AUTOLOAD);
if (name == *pp)
name = NULL;
}
@@ -24355,7 +24365,7 @@ do_string_sub(str, pat, sub, flags)
garray_T ga;
char_u *ret;
char_u *save_cpo;
int zero_width;
char_u *zero_width = NULL;
/* Make 'cpoptions' empty, so that the 'l' flag doesn't work here */
save_cpo = p_cpo;
@@ -24372,6 +24382,19 @@ do_string_sub(str, pat, sub, flags)
tail = str;
while (vim_regexec_nl(&regmatch, str, (colnr_T)(tail - str)))
{
/* Skip empty match except for first match. */
if (regmatch.startp[0] == regmatch.endp[0])
{
if (zero_width == regmatch.startp[0])
{
/* avoid getting stuck on a match with an empty string */
*((char_u *)ga.ga_data + ga.ga_len) = *tail++;
++ga.ga_len;
continue;
}
zero_width = regmatch.startp[0];
}
/*
* Get some space for a temporary buffer to do the substitution
* into. It will contain:
@@ -24394,17 +24417,9 @@ do_string_sub(str, pat, sub, flags)
(void)vim_regsub(&regmatch, sub, (char_u *)ga.ga_data
+ ga.ga_len + i, TRUE, TRUE, FALSE);
ga.ga_len += i + sublen - 1;
zero_width = (tail == regmatch.endp[0]
|| regmatch.startp[0] == regmatch.endp[0]);
tail = regmatch.endp[0];
if (*tail == NUL)
break;
if (zero_width)
{
/* avoid getting stuck on a match with an empty string */
*((char_u *)ga.ga_data + ga.ga_len) = *tail++;
++ga.ga_len;
}
if (!do_all)
break;
}

View File

@@ -36,8 +36,9 @@ static const char *vim_special_path = "_vim_path_";
#define PyErr_SET_STRING(exc, str) PyErr_SetString(exc, _(str))
#define PyErr_SetVim(str) PyErr_SetString(VimError, str)
#define PyErr_SET_VIM(str) PyErr_SET_STRING(VimError, str)
#define PyErr_FORMAT(exc, str, tail) PyErr_Format(exc, _(str), tail)
#define PyErr_VIM_FORMAT(str, tail) PyErr_FORMAT(VimError, str, tail)
#define PyErr_FORMAT(exc, str, arg) PyErr_Format(exc, _(str), arg)
#define PyErr_FORMAT2(exc, str, arg1, arg2) PyErr_Format(exc, _(str), arg1,arg2)
#define PyErr_VIM_FORMAT(str, arg) PyErr_FORMAT(VimError, str, arg)
#define Py_TYPE_NAME(obj) (obj->ob_type->tp_name == NULL \
? "(NULL)" \
@@ -563,10 +564,8 @@ VimTryEnd(void)
/* Keyboard interrupt should be preferred over anything else */
if (got_int)
{
if (current_exception != NULL)
if (did_throw)
discard_current_exception();
else
need_rethrow = did_throw = FALSE;
got_int = FALSE;
PyErr_SetNone(PyExc_KeyboardInterrupt);
return -1;
@@ -598,10 +597,7 @@ VimTryEnd(void)
/* Python exception is preferred over vim one; unlikely to occur though */
else if (PyErr_Occurred())
{
if (current_exception != NULL)
discard_current_exception();
else
need_rethrow = did_throw = FALSE;
discard_current_exception();
return -1;
}
/* Finally transform VimL exception to python one */
@@ -2108,8 +2104,6 @@ static struct PyMethodDef DictionaryMethods[] = {
};
static PyTypeObject ListType;
static PySequenceMethods ListAsSeq;
static PyMappingMethods ListAsMapping;
typedef struct
{
@@ -2253,7 +2247,7 @@ ListLength(ListObject *self)
}
static PyObject *
ListItem(ListObject *self, Py_ssize_t index)
ListIndex(ListObject *self, Py_ssize_t index)
{
listitem_T *li;
@@ -2273,53 +2267,389 @@ ListItem(ListObject *self, Py_ssize_t index)
return ConvertToPyObject(&li->li_tv);
}
#define PROC_RANGE \
if (last < 0) {\
if (last < -size) \
last = 0; \
else \
last += size; \
} \
if (first < 0) \
first = 0; \
if (first > size) \
first = size; \
if (last > size) \
last = size;
static PyObject *
ListSlice(ListObject *self, Py_ssize_t first, Py_ssize_t last)
ListSlice(ListObject *self, Py_ssize_t first, Py_ssize_t step,
Py_ssize_t slicelen)
{
PyInt i;
PyInt size = ListLength(self);
PyInt n;
PyObject *list;
int reversed = 0;
PROC_RANGE
if (first >= last)
first = last;
if (step == 0)
{
PyErr_SET_STRING(PyExc_ValueError, N_("slice step cannot be zero"));
return NULL;
}
n = last-first;
list = PyList_New(n);
list = PyList_New(slicelen);
if (list == NULL)
return NULL;
for (i = 0; i < n; ++i)
for (i = 0; i < slicelen; ++i)
{
PyObject *item = ListItem(self, first + i);
PyObject *item;
item = ListIndex(self, first + i*step);
if (item == NULL)
{
Py_DECREF(list);
return NULL;
}
PyList_SET_ITEM(list, ((reversed)?(n-i-1):(i)), item);
PyList_SET_ITEM(list, i, item);
}
return list;
}
static PyObject *
ListItem(ListObject *self, PyObject* idx)
{
#if PY_MAJOR_VERSION < 3
if (PyInt_Check(idx))
{
long _idx = PyInt_AsLong(idx);
return ListIndex(self, _idx);
}
else
#endif
if (PyLong_Check(idx))
{
long _idx = PyLong_AsLong(idx);
return ListIndex(self, _idx);
}
else if (PySlice_Check(idx))
{
Py_ssize_t start, stop, step, slicelen;
if (PySlice_GetIndicesEx((PySliceObject *)idx, ListLength(self),
&start, &stop, &step, &slicelen) < 0)
return NULL;
return ListSlice(self, start, step, slicelen);
}
else
{
RAISE_INVALID_INDEX_TYPE(idx);
return NULL;
}
}
static void
list_restore(Py_ssize_t numadded, Py_ssize_t numreplaced, Py_ssize_t slicelen,
list_T *l, listitem_T **lis, listitem_T *lastaddedli)
{
while (numreplaced--)
{
list_insert(l, lis[numreplaced], lis[slicelen + numreplaced]);
listitem_remove(l, lis[slicelen + numreplaced]);
}
while (numadded--)
{
listitem_T *next;
next = lastaddedli->li_prev;
listitem_remove(l, lastaddedli);
lastaddedli = next;
}
}
static int
ListAssSlice(ListObject *self, Py_ssize_t first,
Py_ssize_t step, Py_ssize_t slicelen, PyObject *obj)
{
PyObject *iterator;
PyObject *item;
listitem_T *li;
listitem_T *lastaddedli = NULL;
listitem_T *next;
typval_T v;
list_T *l = self->list;
PyInt i;
PyInt j;
PyInt numreplaced = 0;
PyInt numadded = 0;
PyInt size;
listitem_T **lis;
size = ListLength(self);
if (l->lv_lock)
{
RAISE_LOCKED_LIST;
return -1;
}
if (step == 0)
{
PyErr_SET_STRING(PyExc_ValueError, N_("slice step cannot be zero"));
return -1;
}
if (step != 1 && slicelen == 0)
{
/* Nothing to do. Only error out if obj has some items. */
int ret = 0;
if (obj == NULL)
return 0;
if (!(iterator = PyObject_GetIter(obj)))
return -1;
if ((item = PyIter_Next(iterator)))
{
PyErr_FORMAT(PyExc_ValueError,
N_("attempt to assign sequence of size greater then %d "
"to extended slice"), 0);
Py_DECREF(item);
ret = -1;
}
Py_DECREF(iterator);
return ret;
}
if (obj != NULL)
/* XXX May allocate zero bytes. */
if (!(lis = PyMem_New(listitem_T *, slicelen * 2)))
{
PyErr_NoMemory();
return -1;
}
if (first == size)
li = NULL;
else
{
li = list_find(l, (long) first);
if (li == NULL)
{
PyErr_VIM_FORMAT(N_("internal error: no vim list item %d"),
(int)first);
if (obj != NULL)
PyMem_Free(lis);
return -1;
}
i = slicelen;
while (i-- && li != NULL)
{
j = step;
next = li;
if (step > 0)
while (next != NULL && ((next = next->li_next) != NULL) && --j);
else
while (next != NULL && ((next = next->li_prev) != NULL) && ++j);
if (obj == NULL)
listitem_remove(l, li);
else
lis[slicelen - i - 1] = li;
li = next;
}
if (li == NULL && i != -1)
{
PyErr_SET_VIM(N_("internal error: not enough list items"));
if (obj != NULL)
PyMem_Free(lis);
return -1;
}
}
if (obj == NULL)
return 0;
if (!(iterator = PyObject_GetIter(obj)))
{
PyMem_Free(lis);
return -1;
}
i = 0;
while ((item = PyIter_Next(iterator)))
{
if (ConvertFromPyObject(item, &v) == -1)
{
Py_DECREF(iterator);
Py_DECREF(item);
PyMem_Free(lis);
return -1;
}
Py_DECREF(item);
if (list_insert_tv(l, &v, numreplaced < slicelen
? lis[numreplaced]
: li) == FAIL)
{
clear_tv(&v);
PyErr_SET_VIM(N_("internal error: failed to add item to list"));
list_restore(numadded, numreplaced, slicelen, l, lis, lastaddedli);
PyMem_Free(lis);
return -1;
}
if (numreplaced < slicelen)
{
lis[slicelen + numreplaced] = lis[numreplaced]->li_prev;
list_remove(l, lis[numreplaced], lis[numreplaced]);
numreplaced++;
}
else
{
if (li)
lastaddedli = li->li_prev;
else
lastaddedli = l->lv_last;
numadded++;
}
clear_tv(&v);
if (step != 1 && i >= slicelen)
{
Py_DECREF(iterator);
PyErr_FORMAT(PyExc_ValueError,
N_("attempt to assign sequence of size greater then %d "
"to extended slice"), slicelen);
list_restore(numadded, numreplaced, slicelen, l, lis, lastaddedli);
PyMem_Free(lis);
return -1;
}
++i;
}
Py_DECREF(iterator);
if (step != 1 && i != slicelen)
{
PyErr_FORMAT2(PyExc_ValueError,
N_("attempt to assign sequence of size %d to extended slice "
"of size %d"), i, slicelen);
list_restore(numadded, numreplaced, slicelen, l, lis, lastaddedli);
PyMem_Free(lis);
return -1;
}
if (PyErr_Occurred())
{
list_restore(numadded, numreplaced, slicelen, l, lis, lastaddedli);
PyMem_Free(lis);
return -1;
}
for (i = 0; i < numreplaced; i++)
listitem_free(lis[i]);
if (step == 1)
for (i = numreplaced; i < slicelen; i++)
listitem_remove(l, lis[i]);
PyMem_Free(lis);
return 0;
}
static int
ListAssIndex(ListObject *self, Py_ssize_t index, PyObject *obj)
{
typval_T tv;
list_T *l = self->list;
listitem_T *li;
Py_ssize_t length = ListLength(self);
if (l->lv_lock)
{
RAISE_LOCKED_LIST;
return -1;
}
if (index > length || (index == length && obj == NULL))
{
PyErr_SET_STRING(PyExc_IndexError, N_("list index out of range"));
return -1;
}
if (obj == NULL)
{
li = list_find(l, (long) index);
list_remove(l, li, li);
clear_tv(&li->li_tv);
vim_free(li);
return 0;
}
if (ConvertFromPyObject(obj, &tv) == -1)
return -1;
if (index == length)
{
if (list_append_tv(l, &tv) == FAIL)
{
clear_tv(&tv);
PyErr_SET_VIM(N_("failed to add item to list"));
return -1;
}
}
else
{
li = list_find(l, (long) index);
clear_tv(&li->li_tv);
copy_tv(&tv, &li->li_tv);
clear_tv(&tv);
}
return 0;
}
static Py_ssize_t
ListAssItem(ListObject *self, PyObject *idx, PyObject *obj)
{
#if PY_MAJOR_VERSION < 3
if (PyInt_Check(idx))
{
long _idx = PyInt_AsLong(idx);
return ListAssIndex(self, _idx, obj);
}
else
#endif
if (PyLong_Check(idx))
{
long _idx = PyLong_AsLong(idx);
return ListAssIndex(self, _idx, obj);
}
else if (PySlice_Check(idx))
{
Py_ssize_t start, stop, step, slicelen;
if (PySlice_GetIndicesEx((PySliceObject *)idx, ListLength(self),
&start, &stop, &step, &slicelen) < 0)
return -1;
return ListAssSlice(self, start, step, slicelen,
obj);
}
else
{
RAISE_INVALID_INDEX_TYPE(idx);
return -1;
}
}
static PyObject *
ListConcatInPlace(ListObject *self, PyObject *obj)
{
list_T *l = self->list;
PyObject *lookup_dict;
if (l->lv_lock)
{
RAISE_LOCKED_LIST;
return NULL;
}
if (!(lookup_dict = PyDict_New()))
return NULL;
if (list_py_concat(l, obj, lookup_dict) == -1)
{
Py_DECREF(lookup_dict);
return NULL;
}
Py_DECREF(lookup_dict);
Py_INCREF(self);
return (PyObject *)(self);
}
typedef struct
{
listwatch_T lw;
@@ -2370,156 +2700,6 @@ ListIter(ListObject *self)
NULL, NULL);
}
static int
ListAssItem(ListObject *self, Py_ssize_t index, PyObject *obj)
{
typval_T tv;
list_T *l = self->list;
listitem_T *li;
Py_ssize_t length = ListLength(self);
if (l->lv_lock)
{
RAISE_LOCKED_LIST;
return -1;
}
if (index > length || (index == length && obj == NULL))
{
PyErr_SET_STRING(PyExc_IndexError, N_("list index out of range"));
return -1;
}
if (obj == NULL)
{
li = list_find(l, (long) index);
list_remove(l, li, li);
clear_tv(&li->li_tv);
vim_free(li);
return 0;
}
if (ConvertFromPyObject(obj, &tv) == -1)
return -1;
if (index == length)
{
if (list_append_tv(l, &tv) == FAIL)
{
clear_tv(&tv);
PyErr_SET_VIM(N_("failed to add item to list"));
return -1;
}
}
else
{
li = list_find(l, (long) index);
clear_tv(&li->li_tv);
copy_tv(&tv, &li->li_tv);
clear_tv(&tv);
}
return 0;
}
static int
ListAssSlice(ListObject *self, Py_ssize_t first, Py_ssize_t last, PyObject *obj)
{
PyInt size = ListLength(self);
PyObject *iterator;
PyObject *item;
listitem_T *li;
listitem_T *next;
typval_T v;
list_T *l = self->list;
PyInt i;
if (l->lv_lock)
{
RAISE_LOCKED_LIST;
return -1;
}
PROC_RANGE
if (first == size)
li = NULL;
else
{
li = list_find(l, (long) first);
if (li == NULL)
{
PyErr_VIM_FORMAT(N_("internal error: no vim list item %d"),
(int)first);
return -1;
}
if (last > first)
{
i = last - first;
while (i-- && li != NULL)
{
next = li->li_next;
listitem_remove(l, li);
li = next;
}
}
}
if (obj == NULL)
return 0;
if (!(iterator = PyObject_GetIter(obj)))
return -1;
while ((item = PyIter_Next(iterator)))
{
if (ConvertFromPyObject(item, &v) == -1)
{
Py_DECREF(iterator);
Py_DECREF(item);
return -1;
}
Py_DECREF(item);
if (list_insert_tv(l, &v, li) == FAIL)
{
clear_tv(&v);
PyErr_SET_VIM(N_("internal error: failed to add item to list"));
return -1;
}
clear_tv(&v);
}
Py_DECREF(iterator);
if (PyErr_Occurred())
return -1;
return 0;
}
static PyObject *
ListConcatInPlace(ListObject *self, PyObject *obj)
{
list_T *l = self->list;
PyObject *lookup_dict;
if (l->lv_lock)
{
RAISE_LOCKED_LIST;
return NULL;
}
if (!(lookup_dict = PyDict_New()))
return NULL;
if (list_py_concat(l, obj, lookup_dict) == -1)
{
Py_DECREF(lookup_dict);
return NULL;
}
Py_DECREF(lookup_dict);
Py_INCREF(self);
return (PyObject *)(self);
}
static char *ListAttrs[] = {
"locked",
NULL
@@ -2567,6 +2747,25 @@ ListSetattr(ListObject *self, char *name, PyObject *valObject)
}
}
static PySequenceMethods ListAsSeq = {
(lenfunc) ListLength, /* sq_length, len(x) */
(binaryfunc) 0, /* RangeConcat, sq_concat, x+y */
0, /* RangeRepeat, sq_repeat, x*n */
(PyIntArgFunc) ListIndex, /* sq_item, x[i] */
0, /* was_sq_slice, x[i:j] */
(PyIntObjArgProc) ListAssIndex, /* sq_as_item, x[i]=v */
0, /* was_sq_ass_slice, x[i:j]=v */
0, /* sq_contains */
(binaryfunc) ListConcatInPlace,/* sq_inplace_concat */
0, /* sq_inplace_repeat */
};
static PyMappingMethods ListAsMapping = {
/* mp_length */ (lenfunc) ListLength,
/* mp_subscript */ (binaryfunc) ListItem,
/* mp_ass_subscript */ (objobjargproc) ListAssItem,
};
static struct PyMethodDef ListMethods[] = {
{"extend", (PyCFunction)ListConcatInPlace, METH_O, ""},
{"__dir__", (PyCFunction)ListDir, METH_NOARGS, ""},
@@ -2745,10 +2944,10 @@ typedef int (*checkfun)(void *);
typedef struct
{
PyObject_HEAD
int opt_type;
void *from;
checkfun Check;
PyObject *fromObj;
int opt_type;
void *from;
checkfun Check;
PyObject *fromObj;
} OptionsObject;
static int
@@ -2867,6 +3066,69 @@ OptionsItem(OptionsObject *self, PyObject *keyObject)
}
}
static int
OptionsContains(OptionsObject *self, PyObject *keyObject)
{
char_u *key;
PyObject *todecref;
if (!(key = StringToChars(keyObject, &todecref)))
return -1;
if (*key == NUL)
{
Py_XDECREF(todecref);
return 0;
}
if (get_option_value_strict(key, NULL, NULL, self->opt_type, NULL))
{
Py_XDECREF(todecref);
return 1;
}
else
{
Py_XDECREF(todecref);
return 0;
}
}
typedef struct
{
void *lastoption;
int opt_type;
} optiterinfo_T;
static PyObject *
OptionsIterNext(optiterinfo_T **oii)
{
char_u *name;
if ((name = option_iter_next(&((*oii)->lastoption), (*oii)->opt_type)))
return PyString_FromString((char *)name);
return NULL;
}
static PyObject *
OptionsIter(OptionsObject *self)
{
optiterinfo_T *oii;
if (!(oii = PyMem_New(optiterinfo_T, 1)))
{
PyErr_NoMemory();
return NULL;
}
oii->opt_type = self->opt_type;
oii->lastoption = NULL;
return IterNew(oii,
(destructorfun) PyMem_Free, (nextfun) OptionsIterNext,
NULL, NULL);
}
static int
set_option_value_err(char_u *key, int numval, char_u *stringval, int opt_flags)
{
@@ -3027,6 +3289,19 @@ OptionsAssItem(OptionsObject *self, PyObject *keyObject, PyObject *valObject)
return ret;
}
static PySequenceMethods OptionsAsSeq = {
0, /* sq_length */
0, /* sq_concat */
0, /* sq_repeat */
0, /* sq_item */
0, /* sq_slice */
0, /* sq_ass_item */
0, /* sq_ass_slice */
(objobjproc) OptionsContains, /* sq_contains */
0, /* sq_inplace_concat */
0, /* sq_inplace_repeat */
};
static PyMappingMethods OptionsAsMapping = {
(lenfunc) NULL,
(binaryfunc) OptionsItem,
@@ -5917,8 +6192,10 @@ init_structs(void)
vim_memset(&OptionsType, 0, sizeof(OptionsType));
OptionsType.tp_name = "vim.options";
OptionsType.tp_basicsize = sizeof(OptionsObject);
OptionsType.tp_as_sequence = &OptionsAsSeq;
OptionsType.tp_flags = Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_GC;
OptionsType.tp_doc = "object for manipulating options";
OptionsType.tp_iter = (getiterfunc)OptionsIter;
OptionsType.tp_as_mapping = &OptionsAsMapping;
OptionsType.tp_dealloc = (destructor)OptionsDestructor;
OptionsType.tp_traverse = (traverseproc)OptionsTraverse;

View File

@@ -196,6 +196,7 @@ struct PyMethodDef { Py_ssize_t a; };
# define PyTuple_Size dll_PyTuple_Size
# define PyTuple_GetItem dll_PyTuple_GetItem
# define PyTuple_Type (*dll_PyTuple_Type)
# define PySlice_GetIndicesEx dll_PySlice_GetIndicesEx
# define PyImport_ImportModule dll_PyImport_ImportModule
# define PyDict_New dll_PyDict_New
# define PyDict_GetItemString dll_PyDict_GetItemString
@@ -241,6 +242,7 @@ struct PyMethodDef { Py_ssize_t a; };
# define PySys_GetObject dll_PySys_GetObject
# define PySys_SetArgv dll_PySys_SetArgv
# define PyType_Type (*dll_PyType_Type)
# define PySlice_Type (*dll_PySlice_Type)
# define PyType_Ready (*dll_PyType_Ready)
# define PyType_GenericAlloc dll_PyType_GenericAlloc
# define Py_BuildValue dll_Py_BuildValue
@@ -341,6 +343,9 @@ static PyObject*(*dll_PySequence_Fast)(PyObject *, const char *);
static PyInt(*dll_PyTuple_Size)(PyObject *);
static PyObject*(*dll_PyTuple_GetItem)(PyObject *, PyInt);
static PyTypeObject* dll_PyTuple_Type;
static int (*dll_PySlice_GetIndicesEx)(PySliceObject *r, PyInt length,
PyInt *start, PyInt *stop, PyInt *step,
PyInt *slicelen);
static PyObject*(*dll_PyImport_ImportModule)(const char *);
static PyObject*(*dll_PyDict_New)(void);
static PyObject*(*dll_PyDict_GetItemString)(PyObject *, const char *);
@@ -382,6 +387,7 @@ static int(*dll_PySys_SetObject)(char *, PyObject *);
static PyObject *(*dll_PySys_GetObject)(char *);
static int(*dll_PySys_SetArgv)(int, char **);
static PyTypeObject* dll_PyType_Type;
static PyTypeObject* dll_PySlice_Type;
static int (*dll_PyType_Ready)(PyTypeObject *type);
static PyObject* (*dll_PyType_GenericAlloc)(PyTypeObject *type, PyInt nitems);
static PyObject*(*dll_Py_BuildValue)(char *, ...);
@@ -521,6 +527,7 @@ static struct
{"PyTuple_GetItem", (PYTHON_PROC*)&dll_PyTuple_GetItem},
{"PyTuple_Size", (PYTHON_PROC*)&dll_PyTuple_Size},
{"PyTuple_Type", (PYTHON_PROC*)&dll_PyTuple_Type},
{"PySlice_GetIndicesEx", (PYTHON_PROC*)&dll_PySlice_GetIndicesEx},
{"PyImport_ImportModule", (PYTHON_PROC*)&dll_PyImport_ImportModule},
{"PyDict_GetItemString", (PYTHON_PROC*)&dll_PyDict_GetItemString},
{"PyDict_Next", (PYTHON_PROC*)&dll_PyDict_Next},
@@ -562,6 +569,7 @@ static struct
{"PySys_GetObject", (PYTHON_PROC*)&dll_PySys_GetObject},
{"PySys_SetArgv", (PYTHON_PROC*)&dll_PySys_SetArgv},
{"PyType_Type", (PYTHON_PROC*)&dll_PyType_Type},
{"PySlice_Type", (PYTHON_PROC*)&dll_PySlice_Type},
{"PyType_Ready", (PYTHON_PROC*)&dll_PyType_Ready},
{"PyType_GenericAlloc", (PYTHON_PROC*)&dll_PyType_GenericAlloc},
{"Py_FindMethod", (PYTHON_PROC*)&dll_Py_FindMethod},
@@ -1472,21 +1480,6 @@ DictionaryGetattr(PyObject *self, char *name)
return Py_FindMethod(DictionaryMethods, self, name);
}
static PySequenceMethods ListAsSeq = {
(PyInquiry) ListLength,
(binaryfunc) 0,
(PyIntArgFunc) 0,
(PyIntArgFunc) ListItem,
(PyIntIntArgFunc) ListSlice,
(PyIntObjArgProc) ListAssItem,
(PyIntIntObjArgProc) ListAssSlice,
(objobjproc) 0,
#if PY_MAJOR_VERSION >= 2
(binaryfunc) ListConcatInPlace,
0,
#endif
};
static PyObject *
ListGetattr(PyObject *self, char *name)
{

View File

@@ -97,6 +97,9 @@
#define Py_ssize_t_fmt "n"
#define Py_bytes_fmt "y"
#define PyIntArgFunc ssizeargfunc
#define PyIntObjArgProc ssizeobjargproc
#if defined(DYNAMIC_PYTHON3) || defined(PROTO)
# ifndef WIN3264
@@ -291,8 +294,9 @@ static Py_ssize_t (*py3_PyTuple_Size)(PyObject *);
static PyObject* (*py3_PyTuple_GetItem)(PyObject *, Py_ssize_t);
static int (*py3_PyMapping_Check)(PyObject *);
static PyObject* (*py3_PyMapping_Keys)(PyObject *);
static int (*py3_PySlice_GetIndicesEx)(PyObject *r, Py_ssize_t length,
Py_ssize_t *start, Py_ssize_t *stop, Py_ssize_t *step, Py_ssize_t *slicelength);
static int (*py3_PySlice_GetIndicesEx)(PySliceObject *r, Py_ssize_t length,
Py_ssize_t *start, Py_ssize_t *stop, Py_ssize_t *step,
Py_ssize_t *slicelen);
static PyObject* (*py3_PyErr_NoMemory)(void);
static void (*py3_Py_Finalize)(void);
static void (*py3_PyErr_SetString)(PyObject *, const char *);
@@ -1186,7 +1190,7 @@ BufferSubscript(PyObject *self, PyObject* idx)
if (CheckBuffer((BufferObject *) self))
return NULL;
if (PySlice_GetIndicesEx((PyObject *)idx,
if (PySlice_GetIndicesEx((PySliceObject *)idx,
(Py_ssize_t)((BufferObject *)(self))->buf->b_ml.ml_line_count,
&start, &stop,
&step, &slicelen) < 0)
@@ -1218,7 +1222,7 @@ BufferAsSubscript(PyObject *self, PyObject* idx, PyObject* val)
if (CheckBuffer((BufferObject *) self))
return -1;
if (PySlice_GetIndicesEx((PyObject *)idx,
if (PySlice_GetIndicesEx((PySliceObject *)idx,
(Py_ssize_t)((BufferObject *)(self))->buf->b_ml.ml_line_count,
&start, &stop,
&step, &slicelen) < 0)
@@ -1302,7 +1306,7 @@ RangeSubscript(PyObject *self, PyObject* idx)
{
Py_ssize_t start, stop, step, slicelen;
if (PySlice_GetIndicesEx((PyObject *)idx,
if (PySlice_GetIndicesEx((PySliceObject *)idx,
((RangeObject *)(self))->end-((RangeObject *)(self))->start+1,
&start, &stop,
&step, &slicelen) < 0)
@@ -1329,7 +1333,7 @@ RangeAsSubscript(PyObject *self, PyObject *idx, PyObject *val)
{
Py_ssize_t start, stop, step, slicelen;
if (PySlice_GetIndicesEx((PyObject *)idx,
if (PySlice_GetIndicesEx((PySliceObject *)idx,
((RangeObject *)(self))->end-((RangeObject *)(self))->start+1,
&start, &stop,
&step, &slicelen) < 0)
@@ -1478,76 +1482,6 @@ DictionarySetattro(PyObject *self, PyObject *nameobj, PyObject *val)
/* List object - Definitions
*/
static PySequenceMethods ListAsSeq = {
(lenfunc) ListLength, /* sq_length, len(x) */
(binaryfunc) 0, /* RangeConcat, sq_concat, x+y */
(ssizeargfunc) 0, /* RangeRepeat, sq_repeat, x*n */
(ssizeargfunc) ListItem, /* sq_item, x[i] */
(void *) 0, /* was_sq_slice, x[i:j] */
(ssizeobjargproc) ListAssItem, /* sq_as_item, x[i]=v */
(void *) 0, /* was_sq_ass_slice, x[i:j]=v */
0, /* sq_contains */
(binaryfunc) ListConcatInPlace,/* sq_inplace_concat */
0, /* sq_inplace_repeat */
};
static PyObject *ListSubscript(PyObject *, PyObject *);
static Py_ssize_t ListAsSubscript(PyObject *, PyObject *, PyObject *);
static PyMappingMethods ListAsMapping = {
/* mp_length */ (lenfunc) ListLength,
/* mp_subscript */ (binaryfunc) ListSubscript,
/* mp_ass_subscript */ (objobjargproc) ListAsSubscript,
};
static PyObject *
ListSubscript(PyObject *self, PyObject* idx)
{
if (PyLong_Check(idx))
{
long _idx = PyLong_AsLong(idx);
return ListItem((ListObject *)(self), _idx);
}
else if (PySlice_Check(idx))
{
Py_ssize_t start, stop, step, slicelen;
if (PySlice_GetIndicesEx(idx, ListLength((ListObject *)(self)),
&start, &stop, &step, &slicelen) < 0)
return NULL;
return ListSlice((ListObject *)(self), start, stop);
}
else
{
RAISE_INVALID_INDEX_TYPE(idx);
return NULL;
}
}
static Py_ssize_t
ListAsSubscript(PyObject *self, PyObject *idx, PyObject *obj)
{
if (PyLong_Check(idx))
{
long _idx = PyLong_AsLong(idx);
return ListAssItem((ListObject *)(self), _idx, obj);
}
else if (PySlice_Check(idx))
{
Py_ssize_t start, stop, step, slicelen;
if (PySlice_GetIndicesEx(idx, ListLength((ListObject *)(self)),
&start, &stop, &step, &slicelen) < 0)
return -1;
return ListAssSlice((ListObject *)(self), start, stop, obj);
}
else
{
RAISE_INVALID_INDEX_TYPE(idx);
return -1;
}
}
static PyObject *
ListGetattro(PyObject *self, PyObject *nameobj)
{

View File

@@ -8861,7 +8861,7 @@ get_option_value(name, numval, stringval, opt_flags)
}
#endif
#if defined(FEAT_PYTHON) || defined(FEAT_PYTHON3)
#if defined(FEAT_PYTHON) || defined(FEAT_PYTHON3) || defined(PROTO)
/*
* Returns the option attributes and its value. Unlike the above function it
* will return either global value or local value of the option depending on
@@ -8874,7 +8874,8 @@ get_option_value(name, numval, stringval, opt_flags)
* opt_type). Uses
*
* Returned flags:
* 0 hidden or unknown option
* 0 hidden or unknown option, also option that does not have requested
* type (see SREQ_* in vim.h)
* see SOPT_* in vim.h for other flags
*
* Possible opt_type values: see SREQ_* in vim.h
@@ -8997,6 +8998,68 @@ get_option_value_strict(name, numval, stringval, opt_type, from)
return r;
}
/*
* Iterate over options. First argument is a pointer to a pointer to a structure
* inside options[] array, second is option type like in the above function.
*
* If first argument points to NULL it is assumed that iteration just started
* and caller needs the very first value.
* If first argument points to the end marker function returns NULL and sets
* first argument to NULL.
*
* Returns full option name for current option on each call.
*/
char_u *
option_iter_next(option, opt_type)
void **option;
int opt_type;
{
struct vimoption *ret = NULL;
do
{
if (*option == NULL)
*option = (void *) options;
else if (((struct vimoption *) (*option))->fullname == NULL)
{
*option = NULL;
return NULL;
}
else
*option = (void *) (((struct vimoption *) (*option)) + 1);
ret = ((struct vimoption *) (*option));
/* Hidden option */
if (ret->var == NULL)
{
ret = NULL;
continue;
}
switch (opt_type)
{
case SREQ_GLOBAL:
if (!(ret->indir == PV_NONE || ret->indir & PV_BOTH))
ret = NULL;
break;
case SREQ_BUF:
if (!(ret->indir & PV_BUF))
ret = NULL;
break;
case SREQ_WIN:
if (!(ret->indir & PV_WIN))
ret = NULL;
break;
default:
EMSG2(_(e_intern2), "option_iter_next()");
return NULL;
}
}
while (ret == NULL);
return (char_u *)ret->fullname;
}
#endif
/*

View File

@@ -232,6 +232,8 @@ static int suppress_winsize = 1; /* don't fiddle with console */
static char_u *exe_path = NULL;
static BOOL win8_or_later = FALSE;
/*
* Version of ReadConsoleInput() that works with IME.
* Works around problems on Windows 8.
@@ -251,6 +253,16 @@ read_console_input(
static DWORD s_dwIndex = 0;
static DWORD s_dwMax = 0;
DWORD dwEvents;
int head;
int tail;
int i;
if (!win8_or_later)
{
if (nLength == -1)
return PeekConsoleInput(hInput, lpBuffer, 1, lpEvents);
return ReadConsoleInput(hInput, lpBuffer, 1, &dwEvents);
}
if (s_dwMax == 0)
{
@@ -265,7 +277,29 @@ read_console_input(
*lpEvents = 0;
return TRUE;
}
if (s_dwMax > 1)
{
head = 0;
tail = s_dwMax - 1;
while (head != tail)
{
if (s_irCache[head].EventType == WINDOW_BUFFER_SIZE_EVENT
&& s_irCache[head + 1].EventType
== WINDOW_BUFFER_SIZE_EVENT)
{
/* Remove duplicate event to avoid flicker. */
for (i = head; i < tail; ++i)
s_irCache[i] = s_irCache[i + 1];
--tail;
continue;
}
head++;
}
s_dwMax = tail + 1;
}
}
*lpBuffer = s_irCache[s_dwIndex];
if (nLength != -1 && ++s_dwIndex >= s_dwMax)
s_dwMax = 0;
@@ -617,6 +651,10 @@ PlatformId(void)
g_PlatformId = ovi.dwPlatformId;
if ((ovi.dwMajorVersion == 6 && ovi.dwMinorVersion >= 2)
|| ovi.dwMajorVersion > 6)
win8_or_later = TRUE;
#ifdef HAVE_ACL
/*
* Load the ADVAPI runtime if we are on anything
@@ -4627,6 +4665,7 @@ mch_call_shell(
DWORD flags = CREATE_NEW_CONSOLE;
char_u *p;
ZeroMemory(&si, sizeof(si));
si.cb = sizeof(si);
si.lpReserved = NULL;
si.lpDesktop = NULL;
@@ -4723,9 +4762,9 @@ mch_call_shell(
if (newcmd != cmdbase)
vim_free(newcmd);
if (si.hStdInput != NULL)
if (si.dwFlags == STARTF_USESTDHANDLES && si.hStdInput != NULL)
{
/* Close the handle to \\.\NUL */
/* Close the handle to \\.\NUL created above. */
CloseHandle(si.hStdInput);
}
/* Close the handles to the subprocess, so that it goes away */

View File

@@ -60,6 +60,7 @@ int list_append_dict __ARGS((list_T *list, dict_T *dict));
int list_append_string __ARGS((list_T *l, char_u *str, int len));
int list_insert_tv __ARGS((list_T *l, typval_T *tv, listitem_T *item));
void list_remove __ARGS((list_T *l, listitem_T *item, listitem_T *item2));
void list_insert __ARGS((list_T *l, listitem_T *ni, listitem_T *item));
int garbage_collect __ARGS((void));
void set_ref_in_ht __ARGS((hashtab_T *ht, int copyID));
void set_ref_in_list __ARGS((list_T *l, int copyID));

View File

@@ -23,6 +23,7 @@ char_u *check_colorcolumn __ARGS((win_T *wp));
char_u *check_stl_option __ARGS((char_u *s));
int get_option_value __ARGS((char_u *name, long *numval, char_u **stringval, int opt_flags));
int get_option_value_strict __ARGS((char_u *name, long *numval, char_u **stringval, int opt_type, void *from));
char_u *option_iter_next __ARGS((void **option, int opt_type));
char_u *set_option_value __ARGS((char_u *name, long number, char_u *string, int opt_flags));
char_u *get_term_code __ARGS((char_u *tname));
char_u *get_highlight_default __ARGS((void));

View File

@@ -201,7 +201,7 @@ search_regcomp(pat, pat_save, pat_use, options, regmatch)
* Save the currently used pattern in the appropriate place,
* unless the pattern should not be remembered.
*/
if (!(options & SEARCH_KEEP))
if (!(options & SEARCH_KEEP) && !cmdmod.keeppatterns)
{
/* search or global command */
if (pat_save == RE_SEARCH || pat_save == RE_BOTH)
@@ -1437,7 +1437,7 @@ do_search(oap, dirc, pat, count, options, tm)
curwin->w_set_curswant = TRUE;
end_do_search:
if (options & SEARCH_KEEP)
if ((options & SEARCH_KEEP) || cmdmod.keeppatterns)
spats[0].off = old_off;
vim_free(strcopy);

View File

@@ -47,7 +47,19 @@ j:call search('^$', 'c')
/two
:call search('.', 'c')
:call append(line('$'), getline('.')[col('.') - 1:])
:/^search()/,$w >>test.out
:"
/^substitute
:s/foo/bar/
:$put =@/
/^substitute
:keeppatterns s/asdf/xyz/
:$put =@/
/^substitute
Y:$put =@0
/bar /e
:$put =@0
-:keeppatterns /xyz
0dn:/^search()/,$w >>test.out
:qa!
ENDTEST
@@ -81,6 +93,7 @@ Piece of Java
foobar
substitute foo asdf
one two
search()

View File

@@ -20,3 +20,7 @@ search()
1
1
two
foo
^substitute
substitute bar xyz
xyz

View File

@@ -175,6 +175,23 @@ ENDTEST
TEST_9:
STARTTEST
:set magic&
:set cpo&
:$put =\"\n\nTEST_9:\"
:$put ='xxx'
:s/x/X/gc
yyq/^TEST_10:
ENDTEST
TEST_10:
STARTTEST
:set magic&
:set cpo&
:$put =\"\n\nTEST_10:\"
:let y = substitute('123', '\zs', 'a', 'g') | $put =y
:let y = substitute('123', '\zs.', 'a', 'g') | $put =y
:let y = substitute('123', '.\zs', 'a', 'g') | $put =y
:let y = substitute('123', '\ze', 'a', 'g') | $put =y
:let y = substitute('123', '\ze.', 'a', 'g') | $put =y

View File

@@ -115,3 +115,14 @@ N,,NZ
c
%
TEST_7:
A
A
B
B
-abab
c-cbcbc
TEST_8:

View File

@@ -135,6 +135,18 @@ EOF
:py l=vim.bindeval('l')
:py del l[-6:2]
:$put =string(l)
:let l = [0, 1, 2, 3]
:py l=vim.bindeval('l')
:py del l[::2]
:$put =string(l)
:let l = [0, 1, 2, 3]
:py l=vim.bindeval('l')
:py del l[3:0:-2]
:$put =string(l)
:let l = [0, 1, 2, 3]
:py l=vim.bindeval('l')
:py del l[2:4:-2]
:$put =string(l)
:"
:" Slice assignment to a list
:let l = [0, 1, 2, 3]
@@ -169,6 +181,26 @@ EOF
:py l=vim.bindeval('l')
:py l[0:0]=['h']
:$put =string(l)
:let l = range(8)
:py l=vim.bindeval('l')
:py l[2:6:2] = [10, 20]
:$put =string(l)
:let l = range(8)
:py l=vim.bindeval('l')
:py l[6:2:-2] = [10, 20]
:$put =string(l)
:let l = range(8)
:py l=vim.bindeval('l')
:py l[6:2] = ()
:$put =string(l)
:let l = range(8)
:py l=vim.bindeval('l')
:py l[6:2:1] = ()
:$put =string(l)
:let l = range(8)
:py l=vim.bindeval('l')
:py l[2:2:1] = ()
:$put =string(l)
:"
:" Locked variables
:let l = [0, 1, 2, 3]
@@ -390,6 +422,13 @@ EOF
:$put =string(pyeval('l'))
:py l = ll[-10:10]
:$put =string(pyeval('l'))
:py l = ll[4:2:-1]
:$put =string(pyeval('l'))
:py l = ll[::2]
:$put =string(pyeval('l'))
:py l = ll[4:2:1]
:$put =string(pyeval('l'))
:py del l
:"
:" Vars
:let g:foo = 'bac'
@@ -467,6 +506,11 @@ EOF
:py bopts1=vim.buffers[vim.bindeval("g:bufs")[2]].options
:py bopts2=vim.buffers[vim.bindeval("g:bufs")[1]].options
:py bopts3=vim.buffers[vim.bindeval("g:bufs")[0]].options
:$put ='wopts iters equal: '.pyeval('list(wopts1) == list(wopts2)')
:$put ='bopts iters equal: '.pyeval('list(bopts1) == list(bopts2)')
:py gset=set(iter(gopts1))
:py wset=set(iter(wopts1))
:py bset=set(iter(bopts1))
:set path=.,..,,
:let lst=[]
:let lst+=[['paste', 1, 0, 1, 2, 1, 1, 0 ]]
@@ -497,6 +541,8 @@ EOF
: py oval3=bool(oval3)
: endif
: put ='>>> '.oname
: $put =' g/w/b:'.pyeval('oname in gset').'/'.pyeval('oname in wset').'/'.pyeval('oname in bset')
: $put =' g/w/b (in):'.pyeval('oname in gopts1').'/'.pyeval('oname in wopts1').'/'.pyeval('oname in bopts1')
: for v in ['gopts1', 'wopts1', 'bopts1']
: try
: put =' p/'.v.': '.Ev('repr('.v.'['''.oname.'''])')
@@ -907,6 +953,7 @@ dl.locked = True
l = vim.List()
ll = vim.List('abcE')
ll.locked = True
nel = vim.List('abcO')
f = vim.Function('string')
fd = vim.Function('F')
fdel = vim.Function('D')
@@ -994,6 +1041,20 @@ class FailingIterNext(object):
def next(self):
raise NotImplementedError('next')
class FailingIterNextN(object):
def __init__(self, n):
self.n = n
def __iter__(self):
return self
def next(self):
if self.n:
self.n -= 1
return 1
else:
raise NotImplementedError('next N')
class FailingMappingKey(object):
def __getitem__(self, item):
raise NotImplementedError('getitem:mappingkey')
@@ -1068,6 +1129,13 @@ ee('import failing_import')
ee('import failing')
vim.options['rtp'] = old_rtp
del old_rtp
cb.append("> Options")
cb.append(">> OptionsItem")
ee('vim.options["abcQ"]')
ee('vim.options[""]')
stringtochars_test('vim.options[%s]')
cb.append(">> OptionsContains")
stringtochars_test('%s in vim.options')
cb.append("> Dictionary")
cb.append(">> DictionaryConstructor")
ee('vim.Dictionary("abcI")')
@@ -1098,6 +1166,7 @@ cb.append(">>> kwargs")
cb.append(">>> iter")
ee('d.update(FailingMapping())')
ee('d.update([FailingIterNext()])')
ee('d.update([FailingIterNextN(1)])')
iter_test('d.update(%s)')
convertfrompyobject_test('d.update(%s)')
stringtochars_test('d.update(((%s, 0),))')
@@ -1120,6 +1189,14 @@ ee('l[1000] = 3')
cb.append(">> ListAssSlice")
ee('ll[1:100] = "abcJ"')
iter_test('l[:] = %s')
ee('nel[1:10:2] = "abcK"')
cb.append(repr(tuple(nel)))
ee('nel[1:10:2] = "a"')
cb.append(repr(tuple(nel)))
ee('nel[1:1:-1] = "a"')
cb.append(repr(tuple(nel)))
ee('nel[:] = FailingIterNextN(2)')
cb.append(repr(tuple(nel)))
convertfrompyobject_test('l[:] = [%s]')
cb.append(">> ListConcatInPlace")
iter_test('l.extend(%s)')
@@ -1201,6 +1278,7 @@ del ned
del dl
del l
del ll
del nel
del f
del fd
del fdel
@@ -1214,6 +1292,7 @@ del number_test
del FailingTrue
del FailingIter
del FailingIterNext
del FailingIterNextN
del FailingMapping
del FailingMappingKey
del FailingList

View File

@@ -41,6 +41,9 @@ None
[2, 3]
[2, 3]
[2, 3]
[1, 3]
[0, 2]
[0, 1, 2, 3]
['a', 0, 1, 2, 3]
[0, 'b', 2, 3]
[0, 1, 'c']
@@ -49,6 +52,11 @@ None
['f', 2, 3]
[0, 1, 'g', 2, 3]
['h']
[0, 1, 10, 3, 20, 5, 6, 7]
[0, 1, 2, 3, 20, 5, 10, 7]
[0, 1, 2, 3, 4, 5, 6, 7]
[0, 1, 2, 3, 4, 5, 6, 7]
[0, 1, 2, 3, 4, 5, 6, 7]
[0, 1, 2, 3]
[function('New'), function('DictNew'), 'NewStart', 1, 2, 3, 'NewEnd']
[function('New'), function('DictNew'), 'NewStart', 1, 2, 3, 'NewEnd', 'DictNewStart', 1, 2, 3, 'DictNewEnd', {'a': 'b'}]
@@ -96,12 +104,19 @@ vim: Vim(let):E859:
[0, 1, 2, 3, 4, 5]
[0, 1, 2, 3, 4, 5]
[0, 1, 2, 3, 4, 5]
[4, 3]
[0, 2, 4]
[]
Abc
bac
def
bar
jkl
wopts iters equal: 1
bopts iters equal: 1
>>> paste
g/w/b:1/0/0
g/w/b (in):1/0/0
p/gopts1: False
p/wopts1! KeyError
inv: 2! KeyError
@@ -122,6 +137,8 @@ jkl
W: 1:1 2:1 3:1 4:1
B: 1:1 2:1 3:1 4:1
>>> previewheight
g/w/b:1/0/0
g/w/b (in):1/0/0
p/gopts1: 12
inv: 'a'! TypeError
p/wopts1! KeyError
@@ -143,6 +160,8 @@ jkl
W: 1:5 2:5 3:5 4:5
B: 1:5 2:5 3:5 4:5
>>> operatorfunc
g/w/b:1/0/0
g/w/b (in):1/0/0
p/gopts1: ''
inv: 2! TypeError
p/wopts1! KeyError
@@ -164,6 +183,8 @@ jkl
W: 1:'A' 2:'A' 3:'A' 4:'A'
B: 1:'A' 2:'A' 3:'A' 4:'A'
>>> number
g/w/b:0/1/0
g/w/b (in):0/1/0
p/gopts1! KeyError
inv: 0! KeyError
gopts1! KeyError
@@ -182,6 +203,8 @@ jkl
W: 1:1 2:1 3:0 4:0
B: 1:1 2:1 3:0 4:0
>>> numberwidth
g/w/b:0/1/0
g/w/b (in):0/1/0
p/gopts1! KeyError
inv: -100! KeyError
gopts1! KeyError
@@ -201,6 +224,8 @@ jkl
W: 1:3 2:5 3:2 4:8
B: 1:3 2:5 3:2 4:8
>>> colorcolumn
g/w/b:0/1/0
g/w/b (in):0/1/0
p/gopts1! KeyError
inv: 'abc4'! KeyError
gopts1! KeyError
@@ -220,6 +245,8 @@ jkl
W: 1:'+2' 2:'+3' 3:'+1' 4:''
B: 1:'+2' 2:'+3' 3:'+1' 4:''
>>> statusline
g/w/b:1/1/0
g/w/b (in):1/1/0
p/gopts1: ''
inv: 0! TypeError
p/wopts1: None
@@ -237,6 +264,8 @@ jkl
W: 1:'2' 2:'1' 3:'1' 4:'1'
B: 1:'2' 2:'1' 3:'1' 4:'1'
>>> autoindent
g/w/b:0/0/1
g/w/b (in):0/0/1
p/gopts1! KeyError
inv: 2! KeyError
gopts1! KeyError
@@ -255,6 +284,8 @@ jkl
W: 1:0 2:1 3:0 4:1
B: 1:0 2:1 3:0 4:1
>>> shiftwidth
g/w/b:0/0/1
g/w/b (in):0/0/1
p/gopts1! KeyError
inv: 3! KeyError
gopts1! KeyError
@@ -273,6 +304,8 @@ jkl
W: 1:0 2:2 3:8 4:1
B: 1:0 2:2 3:8 4:1
>>> omnifunc
g/w/b:0/0/1
g/w/b (in):0/0/1
p/gopts1! KeyError
inv: 1! KeyError
gopts1! KeyError
@@ -292,6 +325,8 @@ jkl
W: 1:'A' 2:'B' 3:'' 4:'C'
B: 1:'A' 2:'B' 3:'' 4:'C'
>>> preserveindent
g/w/b:0/0/1
g/w/b (in):0/0/1
p/gopts1! KeyError
inv: 2! KeyError
gopts1! KeyError
@@ -310,6 +345,8 @@ jkl
W: 1:0 2:1 3:0 4:1
B: 1:0 2:1 3:0 4:1
>>> path
g/w/b:1/0/1
g/w/b (in):1/0/1
p/gopts1: '.,..,,'
inv: 0! TypeError
p/wopts1! KeyError
@@ -498,6 +535,21 @@ vim.foreach_rtp(int, 2):TypeError:('foreach_rtp() takes exactly one argument (2
import xxx_no_such_module_xxx:ImportError:('No module named xxx_no_such_module_xxx',)
import failing_import:ImportError:('No module named failing_import',)
import failing:NotImplementedError:()
> Options
>> OptionsItem
vim.options["abcQ"]:KeyError:('abcQ',)
vim.options[""]:ValueError:('empty keys are not allowed',)
>>> Testing StringToChars using vim.options[%s]
vim.options[1]:TypeError:('expected str() or unicode() instance, but got int',)
vim.options[u"\0"]:TypeError:('expected string without null bytes',)
vim.options["\0"]:TypeError:('expected string without null bytes',)
<<< Finished
>> OptionsContains
>>> Testing StringToChars using %s in vim.options
1 in vim.options:TypeError:('expected str() or unicode() instance, but got int',)
u"\0" in vim.options:TypeError:('expected string without null bytes',)
"\0" in vim.options:TypeError:('expected string without null bytes',)
<<< Finished
> Dictionary
>> DictionaryConstructor
vim.Dictionary("abcI"):ValueError:('expected sequence element of size 2, but got sequence of size 1',)
@@ -599,6 +651,7 @@ d["a"] = FailingNumber():TypeError:('long() argument must be a string or a numbe
>>> iter
d.update(FailingMapping()):NotImplementedError:('keys',)
d.update([FailingIterNext()]):NotImplementedError:('next',)
d.update([FailingIterNextN(1)]):NotImplementedError:('next N',)
>>> Testing *Iter* using d.update(%s)
d.update(FailingIter()):NotImplementedError:('iter',)
d.update(FailingIterNext()):NotImplementedError:('next',)
@@ -829,6 +882,14 @@ ll[1:100] = "abcJ":error:('list is locked',)
l[:] = FailingIter():NotImplementedError:('iter',)
l[:] = FailingIterNext():NotImplementedError:('next',)
<<< Finished
nel[1:10:2] = "abcK":ValueError:('attempt to assign sequence of size greater then 2 to extended slice',)
('a', 'b', 'c', 'O')
nel[1:10:2] = "a":ValueError:('attempt to assign sequence of size 1 to extended slice of size 2',)
('a', 'b', 'c', 'O')
nel[1:1:-1] = "a":ValueError:('attempt to assign sequence of size greater then 0 to extended slice',)
('a', 'b', 'c', 'O')
nel[:] = FailingIterNextN(2):NotImplementedError:('next N',)
('a', 'b', 'c', 'O')
>>> Testing StringToChars using l[:] = [{%s : 1}]
l[:] = [{1 : 1}]:TypeError:('expected str() or unicode() instance, but got int',)
l[:] = [{u"\0" : 1}]:TypeError:('expected string without null bytes',)

View File

@@ -128,6 +128,18 @@ EOF
:py3 l=vim.bindeval('l')
:py3 del l[-6:2]
:$put =string(l)
:let l = [0, 1, 2, 3]
:py3 l=vim.bindeval('l')
:py3 del l[::2]
:$put =string(l)
:let l = [0, 1, 2, 3]
:py3 l=vim.bindeval('l')
:py3 del l[3:0:-2]
:$put =string(l)
:let l = [0, 1, 2, 3]
:py3 l=vim.bindeval('l')
:py3 del l[2:4:-2]
:$put =string(l)
:"
:" Slice assignment to a list
:let l = [0, 1, 2, 3]
@@ -162,6 +174,26 @@ EOF
:py3 l=vim.bindeval('l')
:py3 l[0:0]=['h']
:$put =string(l)
:let l = range(8)
:py3 l=vim.bindeval('l')
:py3 l[2:6:2] = [10, 20]
:$put =string(l)
:let l = range(8)
:py3 l=vim.bindeval('l')
:py3 l[6:2:-2] = [10, 20]
:$put =string(l)
:let l = range(8)
:py3 l=vim.bindeval('l')
:py3 l[6:2] = ()
:$put =string(l)
:let l = range(8)
:py3 l=vim.bindeval('l')
:py3 l[6:2:1] = ()
:$put =string(l)
:let l = range(8)
:py3 l=vim.bindeval('l')
:py3 l[2:2:1] = ()
:$put =string(l)
:"
:" Locked variables
:let l = [0, 1, 2, 3]
@@ -363,6 +395,38 @@ EOF
:py3 del trace_main
:$put =string(l)
:"
:" Slice
:py3 ll = vim.bindeval('[0, 1, 2, 3, 4, 5]')
:py3 l = ll[:4]
:$put =string(py3eval('l'))
:py3 l = ll[2:]
:$put =string(py3eval('l'))
:py3 l = ll[:-4]
:$put =string(py3eval('l'))
:py3 l = ll[-2:]
:$put =string(py3eval('l'))
:py3 l = ll[2:4]
:$put =string(py3eval('l'))
:py3 l = ll[4:2]
:$put =string(py3eval('l'))
:py3 l = ll[-4:-2]
:$put =string(py3eval('l'))
:py3 l = ll[-2:-4]
:$put =string(py3eval('l'))
:py3 l = ll[:]
:$put =string(py3eval('l'))
:py3 l = ll[0:6]
:$put =string(py3eval('l'))
:py3 l = ll[-10:10]
:$put =string(py3eval('l'))
:py3 l = ll[4:2:-1]
:$put =string(py3eval('l'))
:py3 l = ll[::2]
:$put =string(py3eval('l'))
:py3 l = ll[4:2:1]
:$put =string(py3eval('l'))
:py3 del l
:"
:" Vars
:let g:foo = 'bac'
:let w:abc3 = 'def'
@@ -439,6 +503,11 @@ EOF
:py3 bopts1=vim.buffers[vim.bindeval("g:bufs")[2]].options
:py3 bopts2=vim.buffers[vim.bindeval("g:bufs")[1]].options
:py3 bopts3=vim.buffers[vim.bindeval("g:bufs")[0]].options
:$put ='wopts iters equal: '.py3eval('list(wopts1) == list(wopts2)')
:$put ='bopts iters equal: '.py3eval('list(bopts1) == list(bopts2)')
:py3 gset=set(iter(gopts1))
:py3 wset=set(iter(wopts1))
:py3 bset=set(iter(bopts1))
:set path=.,..,,
:let lst=[]
:let lst+=[['paste', 1, 0, 1, 2, 1, 1, 0 ]]
@@ -469,6 +538,8 @@ EOF
: py3 oval3=bool(oval3)
: endif
: put ='>>> '.oname
: $put =' g/w/b:'.py3eval('oname in gset').'/'.py3eval('oname in wset').'/'.py3eval('oname in bset')
: $put =' g/w/b (in):'.py3eval('oname in gopts1').'/'.py3eval('oname in wopts1').'/'.py3eval('oname in bopts1')
: for v in ['gopts1', 'wopts1', 'bopts1']
: try
: put =' p/'.v.': '.Ev('repr('.v.'['''.oname.'''])')
@@ -859,6 +930,7 @@ dl.locked = True
l = vim.List()
ll = vim.List('abcE')
ll.locked = True
nel = vim.List('abcO')
f = vim.Function('string')
fd = vim.Function('F')
fdel = vim.Function('D')
@@ -946,6 +1018,20 @@ class FailingIterNext(object):
def __next__(self):
raise NotImplementedError('next')
class FailingIterNextN(object):
def __init__(self, n):
self.n = n
def __iter__(self):
return self
def __next__(self):
if self.n:
self.n -= 1
return 1
else:
raise NotImplementedError('next N')
class FailingMappingKey(object):
def __getitem__(self, item):
raise NotImplementedError('getitem:mappingkey')
@@ -1020,6 +1106,13 @@ ee('import failing_import')
ee('import failing')
vim.options['rtp'] = old_rtp
del old_rtp
cb.append("> Options")
cb.append(">> OptionsItem")
ee('vim.options["abcQ"]')
ee('vim.options[""]')
stringtochars_test('vim.options[%s]')
cb.append(">> OptionsContains")
stringtochars_test('%s in vim.options')
cb.append("> Dictionary")
cb.append(">> DictionaryConstructor")
ee('vim.Dictionary("abcI")')
@@ -1050,6 +1143,7 @@ cb.append(">>> kwargs")
cb.append(">>> iter")
ee('d.update(FailingMapping())')
ee('d.update([FailingIterNext()])')
ee('d.update([FailingIterNextN(1)])')
iter_test('d.update(%s)')
convertfrompyobject_test('d.update(%s)')
stringtochars_test('d.update(((%s, 0),))')
@@ -1072,6 +1166,14 @@ ee('l[1000] = 3')
cb.append(">> ListAssSlice")
ee('ll[1:100] = "abcJ"')
iter_test('l[:] = %s')
ee('nel[1:10:2] = "abcK"')
cb.append(repr(tuple(nel)))
ee('nel[1:10:2] = "a"')
cb.append(repr(tuple(nel)))
ee('nel[1:1:-1] = "a"')
cb.append(repr(tuple(nel)))
ee('nel[:] = FailingIterNextN(2)')
cb.append(repr(tuple(nel)))
convertfrompyobject_test('l[:] = [%s]')
cb.append(">> ListConcatInPlace")
iter_test('l.extend(%s)')
@@ -1153,6 +1255,7 @@ del ned
del dl
del l
del ll
del nel
del f
del fd
del fdel
@@ -1166,6 +1269,7 @@ del number_test
del FailingTrue
del FailingIter
del FailingIterNext
del FailingIterNextN
del FailingMapping
del FailingMappingKey
del FailingList

View File

@@ -41,6 +41,9 @@ None
[2, 3]
[2, 3]
[2, 3]
[1, 3]
[0, 2]
[0, 1, 2, 3]
['a', 0, 1, 2, 3]
[0, 'b', 2, 3]
[0, 1, 'c']
@@ -49,6 +52,11 @@ None
['f', 2, 3]
[0, 1, 'g', 2, 3]
['h']
[0, 1, 10, 3, 20, 5, 6, 7]
[0, 1, 2, 3, 20, 5, 10, 7]
[0, 1, 2, 3, 4, 5, 6, 7]
[0, 1, 2, 3, 4, 5, 6, 7]
[0, 1, 2, 3, 4, 5, 6, 7]
[0, 1, 2, 3]
[function('New'), function('DictNew'), 'NewStart', 1, 2, 3, 'NewEnd']
[function('New'), function('DictNew'), 'NewStart', 1, 2, 3, 'NewEnd', 'DictNewStart', 1, 2, 3, 'DictNewEnd', {'a': 'b'}]
@@ -85,12 +93,30 @@ undefined_name: Vim(let):Trace
vim: Vim(let):E859:
[1]
[1, 10, 11, 10, 11, 10, 11, 10, 11, 10, 11, 10, 1]
[0, 1, 2, 3]
[2, 3, 4, 5]
[0, 1]
[4, 5]
[2, 3]
[]
[2, 3]
[]
[0, 1, 2, 3, 4, 5]
[0, 1, 2, 3, 4, 5]
[0, 1, 2, 3, 4, 5]
[4, 3]
[0, 2, 4]
[]
Abc
bac
def
bar
jkl
wopts iters equal: 1
bopts iters equal: 1
>>> paste
g/w/b:1/0/0
g/w/b (in):1/0/0
p/gopts1: False
p/wopts1! KeyError
inv: 2! KeyError
@@ -111,6 +137,8 @@ jkl
W: 1:1 2:1 3:1 4:1
B: 1:1 2:1 3:1 4:1
>>> previewheight
g/w/b:1/0/0
g/w/b (in):1/0/0
p/gopts1: 12
inv: 'a'! TypeError
p/wopts1! KeyError
@@ -132,6 +160,8 @@ jkl
W: 1:5 2:5 3:5 4:5
B: 1:5 2:5 3:5 4:5
>>> operatorfunc
g/w/b:1/0/0
g/w/b (in):1/0/0
p/gopts1: b''
inv: 2! TypeError
p/wopts1! KeyError
@@ -153,6 +183,8 @@ jkl
W: 1:'A' 2:'A' 3:'A' 4:'A'
B: 1:'A' 2:'A' 3:'A' 4:'A'
>>> number
g/w/b:0/1/0
g/w/b (in):0/1/0
p/gopts1! KeyError
inv: 0! KeyError
gopts1! KeyError
@@ -171,6 +203,8 @@ jkl
W: 1:1 2:1 3:0 4:0
B: 1:1 2:1 3:0 4:0
>>> numberwidth
g/w/b:0/1/0
g/w/b (in):0/1/0
p/gopts1! KeyError
inv: -100! KeyError
gopts1! KeyError
@@ -190,6 +224,8 @@ jkl
W: 1:3 2:5 3:2 4:8
B: 1:3 2:5 3:2 4:8
>>> colorcolumn
g/w/b:0/1/0
g/w/b (in):0/1/0
p/gopts1! KeyError
inv: 'abc4'! KeyError
gopts1! KeyError
@@ -209,6 +245,8 @@ jkl
W: 1:'+2' 2:'+3' 3:'+1' 4:''
B: 1:'+2' 2:'+3' 3:'+1' 4:''
>>> statusline
g/w/b:1/1/0
g/w/b (in):1/1/0
p/gopts1: b''
inv: 0! TypeError
p/wopts1: None
@@ -226,6 +264,8 @@ jkl
W: 1:'2' 2:'1' 3:'1' 4:'1'
B: 1:'2' 2:'1' 3:'1' 4:'1'
>>> autoindent
g/w/b:0/0/1
g/w/b (in):0/0/1
p/gopts1! KeyError
inv: 2! KeyError
gopts1! KeyError
@@ -244,6 +284,8 @@ jkl
W: 1:0 2:1 3:0 4:1
B: 1:0 2:1 3:0 4:1
>>> shiftwidth
g/w/b:0/0/1
g/w/b (in):0/0/1
p/gopts1! KeyError
inv: 3! KeyError
gopts1! KeyError
@@ -262,6 +304,8 @@ jkl
W: 1:0 2:2 3:8 4:1
B: 1:0 2:2 3:8 4:1
>>> omnifunc
g/w/b:0/0/1
g/w/b (in):0/0/1
p/gopts1! KeyError
inv: 1! KeyError
gopts1! KeyError
@@ -281,6 +325,8 @@ jkl
W: 1:'A' 2:'B' 3:'' 4:'C'
B: 1:'A' 2:'B' 3:'' 4:'C'
>>> preserveindent
g/w/b:0/0/1
g/w/b (in):0/0/1
p/gopts1! KeyError
inv: 2! KeyError
gopts1! KeyError
@@ -299,6 +345,8 @@ jkl
W: 1:0 2:1 3:0 4:1
B: 1:0 2:1 3:0 4:1
>>> path
g/w/b:1/0/1
g/w/b (in):1/0/1
p/gopts1: b'.,..,,'
inv: 0! TypeError
p/wopts1! KeyError
@@ -487,6 +535,21 @@ vim.foreach_rtp(int, 2):(<class 'TypeError'>, TypeError('foreach_rtp() takes exa
import xxx_no_such_module_xxx:(<class 'ImportError'>, ImportError('No module named xxx_no_such_module_xxx',))
import failing_import:(<class 'ImportError'>, ImportError('No module named failing_import',))
import failing:(<class 'NotImplementedError'>, NotImplementedError())
> Options
>> OptionsItem
vim.options["abcQ"]:(<class 'KeyError'>, KeyError('abcQ',))
vim.options[""]:(<class 'ValueError'>, ValueError('empty keys are not allowed',))
>>> Testing StringToChars using vim.options[%s]
vim.options[1]:(<class 'TypeError'>, TypeError('expected bytes() or str() instance, but got int',))
vim.options[b"\0"]:(<class 'TypeError'>, TypeError('expected bytes with no null',))
vim.options["\0"]:(<class 'TypeError'>, TypeError('expected bytes with no null',))
<<< Finished
>> OptionsContains
>>> Testing StringToChars using %s in vim.options
1 in vim.options:(<class 'TypeError'>, TypeError('expected bytes() or str() instance, but got int',))
b"\0" in vim.options:(<class 'TypeError'>, TypeError('expected bytes with no null',))
"\0" in vim.options:(<class 'TypeError'>, TypeError('expected bytes with no null',))
<<< Finished
> Dictionary
>> DictionaryConstructor
vim.Dictionary("abcI"):(<class 'ValueError'>, ValueError('expected sequence element of size 2, but got sequence of size 1',))
@@ -588,6 +651,7 @@ d["a"] = FailingNumber():(<class 'NotImplementedError'>, NotImplementedError('in
>>> iter
d.update(FailingMapping()):(<class 'NotImplementedError'>, NotImplementedError('keys',))
d.update([FailingIterNext()]):(<class 'NotImplementedError'>, NotImplementedError('next',))
d.update([FailingIterNextN(1)]):(<class 'NotImplementedError'>, NotImplementedError('next N',))
>>> Testing *Iter* using d.update(%s)
d.update(FailingIter()):(<class 'NotImplementedError'>, NotImplementedError('iter',))
d.update(FailingIterNext()):(<class 'NotImplementedError'>, NotImplementedError('next',))
@@ -818,6 +882,14 @@ ll[1:100] = "abcJ":(<class 'vim.error'>, error('list is locked',))
l[:] = FailingIter():(<class 'NotImplementedError'>, NotImplementedError('iter',))
l[:] = FailingIterNext():(<class 'NotImplementedError'>, NotImplementedError('next',))
<<< Finished
nel[1:10:2] = "abcK":(<class 'ValueError'>, ValueError('attempt to assign sequence of size greater then 2 to extended slice',))
(b'a', b'b', b'c', b'O')
nel[1:10:2] = "a":(<class 'ValueError'>, ValueError('attempt to assign sequence of size 1 to extended slice of size 2',))
(b'a', b'b', b'c', b'O')
nel[1:1:-1] = "a":(<class 'ValueError'>, ValueError('attempt to assign sequence of size greater then 0 to extended slice',))
(b'a', b'b', b'c', b'O')
nel[:] = FailingIterNextN(2):(<class 'NotImplementedError'>, NotImplementedError('next N',))
(b'a', b'b', b'c', b'O')
>>> Testing StringToChars using l[:] = [{%s : 1}]
l[:] = [{1 : 1}]:(<class 'TypeError'>, TypeError('expected bytes() or str() instance, but got int',))
l[:] = [{b"\0" : 1}]:(<class 'TypeError'>, TypeError('expected bytes with no null',))

View File

@@ -409,7 +409,7 @@ u_savecommon(top, bot, newbot, reload)
{
/* This happens when the FileChangedRO autocommand changes the
* file in a way it becomes shorter. */
EMSG(_("E834: Line count changed unexpectedly"));
EMSG(_("E881: Line count changed unexpectedly"));
return FAIL;
}
#endif

View File

@@ -738,6 +738,40 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
166,
/**/
165,
/**/
164,
/**/
163,
/**/
162,
/**/
161,
/**/
160,
/**/
159,
/**/
158,
/**/
157,
/**/
156,
/**/
155,
/**/
154,
/**/
153,
/**/
152,
/**/
151,
/**/
150,
/**/
149,
/**/

View File

@@ -2249,6 +2249,7 @@ typedef int VimClipboard; /* This is required for the prototypes. */
#define SOPT_BUF 0x20 /* Option has buffer-local value */
#define SOPT_UNSET 0x40 /* Option does not have local value set */
/* Option types for various functions in option.c */
#define SREQ_GLOBAL 0 /* Request global option */
#define SREQ_WIN 1 /* Request window-local option */
#define SREQ_BUF 2 /* Request buffer-local option */