1
0
forked from aniani/vim

patch 8.1.0846: not easy to recognize the system Vim runs on

Problem:    Not easy to recognize the system Vim runs on.
Solution:   Add more items to the features list. (Ozaki Kiichi, closes #3855)
This commit is contained in:
Bram Moolenaar
2019-01-29 22:58:21 +01:00
parent 2a4857a1fc
commit 39536dd557
7 changed files with 115 additions and 43 deletions

View File

@@ -1,4 +1,4 @@
*eval.txt* For Vim version 8.1. Last change: 2019 Jan 24 *eval.txt* For Vim version 8.1. Last change: 2019 Jan 29
VIM REFERENCE MANUAL by Bram Moolenaar VIM REFERENCE MANUAL by Bram Moolenaar
@@ -696,7 +696,7 @@ similar to -1. >
:let otherblob = myblob[:] " make a copy of the Blob :let otherblob = myblob[:] " make a copy of the Blob
If the first index is beyond the last byte of the Blob or the second index is If the first index is beyond the last byte of the Blob or the second index is
before the first byte, the result is an empty list. There is no error before the first index, the result is an empty list. There is no error
message. message.
If the second index is equal to or greater than the length of the list the If the second index is equal to or greater than the length of the list the
@@ -2511,7 +2511,10 @@ remote_read({serverid} [, {timeout}])
remote_send({server}, {string} [, {idvar}]) remote_send({server}, {string} [, {idvar}])
String send key sequence String send key sequence
remote_startserver({name}) none become server {name} remote_startserver({name}) none become server {name}
remove({list}, {idx} [, {end}]) any remove items {idx}-{end} from {list} remove({list}, {idx} [, {end}]) any/List
remove items {idx}-{end} from {list}
remove({blob}, {idx} [, {end}]) Number/Blob
remove bytes {idx}-{end} from {blob}
remove({dict}, {key}) any remove entry {key} from {dict} remove({dict}, {key}) any remove entry {key} from {dict}
rename({from}, {to}) Number rename (move) file from {from} to {to} rename({from}, {to}) Number rename (move) file from {from} to {to}
repeat({expr}, {count}) String repeat {expr} {count} times repeat({expr}, {count}) String repeat {expr} {count} times
@@ -6056,13 +6059,9 @@ line({expr}) The result is a Number, which is the line number of the file
line(".") line number of the cursor line(".") line number of the cursor
line("'t") line number of mark t line("'t") line number of mark t
line("'" . marker) line number of mark marker line("'" . marker) line number of mark marker
< *last-position-jump* <
This autocommand jumps to the last known position in a file To jump to the last known position when opening a file see
just after opening it, if the '" mark is set: > |last-position-jump|.
:au BufReadPost *
\ if line("'\"") > 1 && line("'\"") <= line("$") && &ft !~# 'commit'
\ | exe "normal! g`\""
\ | endif
line2byte({lnum}) *line2byte()* line2byte({lnum}) *line2byte()*
Return the byte count from the start of the buffer for line Return the byte count from the start of the buffer for line
@@ -6504,8 +6503,10 @@ min({expr}) Return the minimum value of all items in {expr}.
*mkdir()* *E739* *mkdir()* *E739*
mkdir({name} [, {path} [, {prot}]]) mkdir({name} [, {path} [, {prot}]])
Create directory {name}. Create directory {name}.
If {path} is "p" then intermediate directories are created as If {path} is "p" then intermediate directories are created as
necessary. Otherwise it must be "". necessary. Otherwise it must be "".
If {prot} is given it is used to set the protection bits of If {prot} is given it is used to set the protection bits of
the new directory. The default is 0755 (rwxr-xr-x: r/w for the new directory. The default is 0755 (rwxr-xr-x: r/w for
the user readable for others). Use 0700 to make it unreadable the user readable for others). Use 0700 to make it unreadable
@@ -6514,9 +6515,17 @@ mkdir({name} [, {path} [, {prot}]])
with 0755. with 0755.
Example: > Example: >
:call mkdir($HOME . "/tmp/foo/bar", "p", 0700) :call mkdir($HOME . "/tmp/foo/bar", "p", 0700)
< This function is not available in the |sandbox|. < This function is not available in the |sandbox|.
There is no error if the directory already exists and the "p" There is no error if the directory already exists and the "p"
flag is passed (since patch 8.0.1708). flag is passed (since patch 8.0.1708). However, without the
"p" option the call will fail.
The function result is a Number, which is 1 if the call was
successful or 0 if the directory creation failed or partly
failed.
Not available on all systems. To check use: > Not available on all systems. To check use: >
:if exists("*mkdir") :if exists("*mkdir")
< <
@@ -7325,6 +7334,9 @@ remove({list}, {idx} [, {end}]) *remove()*
Example: > Example: >
:echo "last item: " . remove(mylist, -1) :echo "last item: " . remove(mylist, -1)
:call remove(mylist, 0, 9) :call remove(mylist, 0, 9)
<
Use |delete()| to remove a file.
remove({blob}, {idx} [, {end}]) remove({blob}, {idx} [, {end}])
Without {end}: Remove the byte at {idx} from |Blob| {blob} and Without {end}: Remove the byte at {idx} from |Blob| {blob} and
return the byte. return the byte.
@@ -7335,13 +7347,12 @@ remove({blob}, {idx} [, {end}])
Example: > Example: >
:echo "last byte: " . remove(myblob, -1) :echo "last byte: " . remove(myblob, -1)
:call remove(mylist, 0, 9) :call remove(mylist, 0, 9)
remove({dict}, {key}) remove({dict}, {key})
Remove the entry from {dict} with key {key}. Example: > Remove the entry from {dict} with key {key}. Example: >
:echo "removed " . remove(dict, "one") :echo "removed " . remove(dict, "one")
< If there is no {key} in {dict} this is an error. < If there is no {key} in {dict} this is an error.
Use |delete()| to remove a file.
rename({from}, {to}) *rename()* rename({from}, {to}) *rename()*
Rename the file by the name {from} to the name {to}. This Rename the file by the name {from} to the name {to}. This
should also work to move files across file systems. The should also work to move files across file systems. The
@@ -9724,10 +9735,10 @@ type({expr}) The result is a Number representing the type of {expr}.
Dictionary: 4 |v:t_dict| Dictionary: 4 |v:t_dict|
Float: 5 |v:t_float| Float: 5 |v:t_float|
Boolean: 6 |v:t_bool| (v:false and v:true) Boolean: 6 |v:t_bool| (v:false and v:true)
None 7 |v:t_none| (v:null and v:none) None: 7 |v:t_none| (v:null and v:none)
Job 8 |v:t_job| Job: 8 |v:t_job|
Channel 9 |v:t_channel| Channel: 9 |v:t_channel|
Blob 10 |v:t_blob| Blob: 10 |v:t_blob|
For backward compatibility, this method can be used: > For backward compatibility, this method can be used: >
:if type(myvar) == type(0) :if type(myvar) == type(0)
:if type(myvar) == type("") :if type(myvar) == type("")
@@ -10150,7 +10161,7 @@ all_builtin_terms Compiled with all builtin terminals enabled.
amiga Amiga version of Vim. amiga Amiga version of Vim.
arabic Compiled with Arabic support |Arabic|. arabic Compiled with Arabic support |Arabic|.
arp Compiled with ARP support (Amiga). arp Compiled with ARP support (Amiga).
autocmd Compiled with autocommand support. |autocommand| autocmd Compiled with autocommand support. (always true)
autochdir Compiled with support for 'autochdir' autochdir Compiled with support for 'autochdir'
autoservername Automatically enable |clientserver| autoservername Automatically enable |clientserver|
balloon_eval Compiled with |balloon-eval| support. balloon_eval Compiled with |balloon-eval| support.
@@ -10159,6 +10170,7 @@ beos BeOS version of Vim.
browse Compiled with |:browse| support, and browse() will browse Compiled with |:browse| support, and browse() will
work. work.
browsefilter Compiled with support for |browsefilter|. browsefilter Compiled with support for |browsefilter|.
bsd Compiled on an OS in the BSD family (excluding macOS).
builtin_terms Compiled with some builtin terminals. builtin_terms Compiled with some builtin terminals.
byte_offset Compiled with support for 'o' in 'statusline' byte_offset Compiled with support for 'o' in 'statusline'
cindent Compiled with 'cindent' support. cindent Compiled with 'cindent' support.
@@ -10171,6 +10183,7 @@ comments Compiled with |'comments'| support.
compatible Compiled to be very Vi compatible. compatible Compiled to be very Vi compatible.
cryptv Compiled with encryption support |encryption|. cryptv Compiled with encryption support |encryption|.
cscope Compiled with |cscope| support. cscope Compiled with |cscope| support.
cursorbind Compiled with |cursorbind| (always true)
debug Compiled with "DEBUG" defined. debug Compiled with "DEBUG" defined.
dialog_con Compiled with console dialog support. dialog_con Compiled with console dialog support.
dialog_gui Compiled with GUI dialog support. dialog_gui Compiled with GUI dialog support.
@@ -10182,7 +10195,7 @@ ebcdic Compiled on a machine with ebcdic character set.
emacs_tags Compiled with support for Emacs tags. emacs_tags Compiled with support for Emacs tags.
eval Compiled with expression evaluation support. Always eval Compiled with expression evaluation support. Always
true, of course! true, of course!
ex_extra |+ex_extra|, always true now ex_extra |+ex_extra| (always true)
extra_search Compiled with support for |'incsearch'| and extra_search Compiled with support for |'incsearch'| and
|'hlsearch'| |'hlsearch'|
farsi Compiled with Farsi support |farsi|. farsi Compiled with Farsi support |farsi|.
@@ -10211,6 +10224,7 @@ gui_running Vim is running in the GUI, or it will start soon.
gui_win32 Compiled with MS Windows Win32 GUI. gui_win32 Compiled with MS Windows Win32 GUI.
gui_win32s idem, and Win32s system being used (Windows 3.1) gui_win32s idem, and Win32s system being used (Windows 3.1)
hangul_input Compiled with Hangul input support. |hangul| hangul_input Compiled with Hangul input support. |hangul|
hpux HP-UX version of Vim.
iconv Can use iconv() for conversion. iconv Can use iconv() for conversion.
insert_expand Compiled with support for CTRL-X expansion commands in insert_expand Compiled with support for CTRL-X expansion commands in
Insert mode. Insert mode.
@@ -10221,6 +10235,7 @@ langmap Compiled with 'langmap' support.
libcall Compiled with |libcall()| support. libcall Compiled with |libcall()| support.
linebreak Compiled with 'linebreak', 'breakat', 'showbreak' and linebreak Compiled with 'linebreak', 'breakat', 'showbreak' and
'breakindent' support. 'breakindent' support.
linux Linux version of Vim.
lispindent Compiled with support for lisp indenting. lispindent Compiled with support for lisp indenting.
listcmds Compiled with commands for the buffer list |:files| listcmds Compiled with commands for the buffer list |:files|
and the argument list |arglist|. and the argument list |arglist|.
@@ -10271,7 +10286,7 @@ quickfix Compiled with |quickfix| support.
reltime Compiled with |reltime()| support. reltime Compiled with |reltime()| support.
rightleft Compiled with 'rightleft' support. rightleft Compiled with 'rightleft' support.
ruby Compiled with Ruby interface |ruby|. ruby Compiled with Ruby interface |ruby|.
scrollbind Compiled with 'scrollbind' support. scrollbind Compiled with 'scrollbind' support. (always true)
showcmd Compiled with 'showcmd' support. showcmd Compiled with 'showcmd' support.
signs Compiled with |:sign| support. signs Compiled with |:sign| support.
smartindent Compiled with 'smartindent' support. smartindent Compiled with 'smartindent' support.
@@ -10279,6 +10294,7 @@ spell Compiled with spell checking support |spell|.
startuptime Compiled with |--startuptime| support. startuptime Compiled with |--startuptime| support.
statusline Compiled with support for 'statusline', 'rulerformat' statusline Compiled with support for 'statusline', 'rulerformat'
and special formats of 'titlestring' and 'iconstring'. and special formats of 'titlestring' and 'iconstring'.
sun SunOS version of Vim.
sun_workshop Support for Sun |workshop| has been removed. sun_workshop Support for Sun |workshop| has been removed.
syntax Compiled with syntax highlighting support |syntax|. syntax Compiled with syntax highlighting support |syntax|.
syntax_items There are active syntax highlighting items for the syntax_items There are active syntax highlighting items for the
@@ -10310,27 +10326,29 @@ user_commands User-defined commands.
vcon Win32: Virtual console support is working, can use vcon Win32: Virtual console support is working, can use
'termguicolors'. Also see |+vtp|. 'termguicolors'. Also see |+vtp|.
vertsplit Compiled with vertically split windows |:vsplit|. vertsplit Compiled with vertically split windows |:vsplit|.
(always true)
vim_starting True while initial source'ing takes place. |startup| vim_starting True while initial source'ing takes place. |startup|
*vim_starting* *vim_starting*
viminfo Compiled with viminfo support. viminfo Compiled with viminfo support.
virtualedit Compiled with 'virtualedit' option. virtualedit Compiled with 'virtualedit' option. (always true)
visual Compiled with Visual mode. (always true) visual Compiled with Visual mode. (always true)
visualextra Compiled with extra Visual mode commands. (always visualextra Compiled with extra Visual mode commands. (always
true) |blockwise-operators|. true) |blockwise-operators|.
vms VMS version of Vim. vms VMS version of Vim.
vreplace Compiled with |gR| and |gr| commands. vreplace Compiled with |gR| and |gr| commands. (always true)
vtp Compiled for vcon support |+vtp| (check vcon to find vtp Compiled for vcon support |+vtp| (check vcon to find
out if it works in the current console). out if it works in the current console).
wildignore Compiled with 'wildignore' option. wildignore Compiled with 'wildignore' option.
wildmenu Compiled with 'wildmenu' option. wildmenu Compiled with 'wildmenu' option.
win16 old version for MS-Windows 3.1 (always False) win16 old version for MS-Windows 3.1 (always false)
win32 Win32 version of Vim (MS-Windows 95 and later, 32 or win32 Win32 version of Vim (MS-Windows 95 and later, 32 or
64 bits) 64 bits)
win32unix Win32 version of Vim, using Unix files (Cygwin) win32unix Win32 version of Vim, using Unix files (Cygwin)
win64 Win64 version of Vim (MS-Windows 64 bit). win64 Win64 version of Vim (MS-Windows 64 bit).
win95 Win32 version for MS-Windows 95/98/ME (always False) win95 Win32 version for MS-Windows 95/98/ME (always false)
winaltkeys Compiled with 'winaltkeys' option. winaltkeys Compiled with 'winaltkeys' option.
windows Compiled with support for more than one window. windows Compiled with support for more than one window.
(always true)
writebackup Compiled with 'writebackup' default on. writebackup Compiled with 'writebackup' default on.
xfontset Compiled with X fontset support |xfontset|. xfontset Compiled with X fontset support |xfontset|.
xim Compiled with X input method support |xim|. xim Compiled with X input method support |xim|.

View File

@@ -6118,6 +6118,15 @@ f_has(typval_T *argvars, typval_T *rettv)
#ifdef __BEOS__ #ifdef __BEOS__
"beos", "beos",
#endif #endif
#if defined(BSD) && !defined(MACOS_X)
"bsd",
#endif
#ifdef hpux
"hpux",
#endif
#ifdef __linux__
"linux",
#endif
#ifdef MACOS_X #ifdef MACOS_X
"mac", /* Mac OS X (and, once, Mac OS Classic) */ "mac", /* Mac OS X (and, once, Mac OS Classic) */
"osx", /* Mac OS X */ "osx", /* Mac OS X */
@@ -6129,6 +6138,11 @@ f_has(typval_T *argvars, typval_T *rettv)
#ifdef __QNX__ #ifdef __QNX__
"qnx", "qnx",
#endif #endif
#ifdef SUN_SYSTEM
"sun",
#else
"moon",
#endif
#ifdef UNIX #ifdef UNIX
"unix", "unix",
#endif #endif
@@ -6158,7 +6172,7 @@ f_has(typval_T *argvars, typval_T *rettv)
#endif #endif
"autocmd", "autocmd",
#ifdef FEAT_AUTOCHDIR #ifdef FEAT_AUTOCHDIR
"autochdir", "autochdir",
#endif #endif
#ifdef FEAT_AUTOSERVERNAME #ifdef FEAT_AUTOSERVERNAME
"autoservername", "autoservername",

View File

@@ -29,7 +29,7 @@ endfunc
func s:get_resources() func s:get_resources()
let pid = getpid() let pid = getpid()
if has('mac') if executable('lsof')
return systemlist('lsof -p ' . pid . ' | awk ''$4~/^[0-9]*[rwu]$/&&$5=="REG"{print$NF}''') return systemlist('lsof -p ' . pid . ' | awk ''$4~/^[0-9]*[rwu]$/&&$5=="REG"{print$NF}''')
elseif isdirectory('/proc/' . pid . '/fd/') elseif isdirectory('/proc/' . pid . '/fd/')
return systemlist('readlink /proc/' . pid . '/fd/* | grep -v ''^/dev/''') return systemlist('readlink /proc/' . pid . '/fd/* | grep -v ''^/dev/''')

View File

@@ -1054,22 +1054,31 @@ func Test_libcall_libcallnr()
let libc = 'msvcrt.dll' let libc = 'msvcrt.dll'
elseif has('mac') elseif has('mac')
let libc = 'libSystem.B.dylib' let libc = 'libSystem.B.dylib'
elseif system('uname -s') =~ 'SunOS' elseif executable('ldd')
" Set the path to libc.so according to the architecture. let libc = matchstr(split(system('ldd ' . GetVimProg())), '/libc\.so\>')
let test_bits = system('file ' . GetVimProg()) endif
let test_arch = system('uname -p') if get(l:, 'libc', '') ==# ''
if test_bits =~ '64-bit' && test_arch =~ 'sparc'
let libc = '/usr/lib/sparcv9/libc.so'
elseif test_bits =~ '64-bit' && test_arch =~ 'i386'
let libc = '/usr/lib/amd64/libc.so'
else
let libc = '/usr/lib/libc.so'
endif
else
" On Unix, libc.so can be in various places. " On Unix, libc.so can be in various places.
" Interestingly, using an empty string for the 1st argument of libcall if has('linux')
" allows to call functions from libc which is not documented. " There is not documented but regarding the 1st argument of glibc's
let libc = '' " dlopen an empty string and nullptr are equivalent, so using an empty
" string for the 1st argument of libcall allows to call functions.
let libc = ''
elseif has('sun')
" Set the path to libc.so according to the architecture.
let test_bits = system('file ' . GetVimProg())
let test_arch = system('uname -p')
if test_bits =~ '64-bit' && test_arch =~ 'sparc'
let libc = '/usr/lib/sparcv9/libc.so'
elseif test_bits =~ '64-bit' && test_arch =~ 'i386'
let libc = '/usr/lib/amd64/libc.so'
else
let libc = '/usr/lib/libc.so'
endif
else
" Unfortunately skip this test until a good way is found.
return
endif
endif endif
if has('win32') if has('win32')
@@ -1208,3 +1217,32 @@ func Test_confirm()
call assert_fails('call confirm("Are you sure?", "&Yes\n&No\n", [])', 'E745:') call assert_fails('call confirm("Are you sure?", "&Yes\n&No\n", [])', 'E745:')
call assert_fails('call confirm("Are you sure?", "&Yes\n&No\n", 0, [])', 'E730:') call assert_fails('call confirm("Are you sure?", "&Yes\n&No\n", 0, [])', 'E730:')
endfunc endfunc
func Test_platform_name()
" The system matches at most only one name.
let names = ['amiga', 'beos', 'bsd', 'hpux', 'linux', 'mac', 'qnx', 'sun', 'vms', 'win32', 'win32unix']
call assert_inrange(0, 1, len(filter(copy(names), 'has(v:val)')))
" Is Unix?
call assert_equal(has('beos'), has('beos') && has('unix'))
call assert_equal(has('bsd'), has('bsd') && has('unix'))
call assert_equal(has('hpux'), has('hpux') && has('unix'))
call assert_equal(has('linux'), has('linux') && has('unix'))
call assert_equal(has('mac'), has('mac') && has('unix'))
call assert_equal(has('qnx'), has('qnx') && has('unix'))
call assert_equal(has('sun'), has('sun') && has('unix'))
call assert_equal(has('win32'), has('win32') && !has('unix'))
call assert_equal(has('win32unix'), has('win32unix') && has('unix'))
if has('unix') && executable('uname')
let uname = system('uname')
call assert_equal(uname =~? 'BeOS', has('beos'))
call assert_equal(uname =~? 'BSD\|DragonFly', has('bsd'))
call assert_equal(uname =~? 'HP-UX', has('hpux'))
call assert_equal(uname =~? 'Linux', has('linux'))
call assert_equal(uname =~? 'Darwin', has('mac'))
call assert_equal(uname =~? 'QNX', has('qnx'))
call assert_equal(uname =~? 'SunOS', has('sun'))
call assert_equal(uname =~? 'CYGWIN\|MSYS', has('win32unix'))
endif
endfunc

View File

@@ -559,7 +559,7 @@ endfunction
func Test_terminal_noblock() func Test_terminal_noblock()
let buf = term_start(&shell) let buf = term_start(&shell)
if has('mac') if has('bsd') || has('mac') || has('sun')
" The shell or something else has a problem dealing with more than 1000 " The shell or something else has a problem dealing with more than 1000
" characters at the same time. " characters at the same time.
let len = 1000 let len = 1000

View File

@@ -33,7 +33,7 @@ func Test_writefile_fails_gently()
endfunc endfunc
func Test_writefile_fails_conversion() func Test_writefile_fails_conversion()
if !has('iconv') || system('uname -s') =~ 'SunOS' if !has('iconv') || has('sun')
return return
endif endif
set nobackup nowritebackup set nobackup nowritebackup

View File

@@ -783,6 +783,8 @@ static char *(features[]) =
static int included_patches[] = static int included_patches[] =
{ /* Add new patch number below this line */ { /* Add new patch number below this line */
/**/
846,
/**/ /**/
845, 845,
/**/ /**/