aboutsummaryrefslogtreecommitdiff
path: root/runtime
diff options
context:
space:
mode:
Diffstat (limited to 'runtime')
-rw-r--r--runtime/autoload/man.vim20
-rw-r--r--runtime/doc/eval.txt20
-rw-r--r--runtime/doc/usr_41.txt1
3 files changed, 25 insertions, 16 deletions
diff --git a/runtime/autoload/man.vim b/runtime/autoload/man.vim
index 930db3ceb7..dab88fde23 100644
--- a/runtime/autoload/man.vim
+++ b/runtime/autoload/man.vim
@@ -7,22 +7,10 @@ let s:loaded_man = 1
let s:find_arg = '-w'
let s:localfile_arg = v:true " Always use -l if possible. #6683
-let s:section_arg = '-s'
+let s:section_arg = '-S'
-function! s:init_section_flag()
- call system(['env', 'MANPAGER=cat', 'man', s:section_arg, '1', 'man'])
- if v:shell_error
- let s:section_arg = '-S'
- endif
-endfunction
-
-function! s:init() abort
- call s:init_section_flag()
- " TODO(nhooyr): Does `man -l` on SunOS list searched directories?
+function! man#init() abort
try
- if !has('win32') && $OSTYPE !~? 'cygwin\|linux' && system('uname -s') =~? 'SunOS' && system('uname -r') =~# '^5'
- let s:find_arg = '-l'
- endif
" Check for -l support.
call s:get_page(s:get_path('', 'man'))
catch /E145:/
@@ -141,7 +129,7 @@ function! s:get_page(path) abort
" Disable hard-wrap by using a big $MANWIDTH (max 1000 on some systems #9065).
" Soft-wrap: ftplugin/man.vim sets wrap/breakindent/….
" Hard-wrap: driven by `man`.
- let manwidth = !get(g:,'man_hardwrap', 1) ? 999 : (empty($MANWIDTH) ? winwidth(0) : $MANWIDTH)
+ let manwidth = !get(g:, 'man_hardwrap', 1) ? 999 : (empty($MANWIDTH) ? winwidth(0) : $MANWIDTH)
" Force MANPAGER=cat to ensure Vim is not recursively invoked (by man-db).
" http://comments.gmane.org/gmane.editors.vim.devel/29085
" Set MAN_KEEP_FORMATTING so Debian man doesn't discard backspaces.
@@ -466,4 +454,4 @@ function! man#goto_tag(pattern, flags, info) abort
\ })
endfunction
-call s:init()
+call man#init()
diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt
index f9a5d36205..efb6272e58 100644
--- a/runtime/doc/eval.txt
+++ b/runtime/doc/eval.txt
@@ -2126,6 +2126,7 @@ finddir({name} [, {path} [, {count}]])
String find directory {name} in {path}
findfile({name} [, {path} [, {count}]])
String find file {name} in {path}
+flatten({list} [, {maxdepth}]) List flatten {list} up to {maxdepth} levels
float2nr({expr}) Number convert Float {expr} to a Number
floor({expr}) Float round {expr} down
fmod({expr1}, {expr2}) Float remainder of {expr1} / {expr2}
@@ -3918,6 +3919,25 @@ findfile({name} [, {path} [, {count}]]) *findfile()*
< Searches from the directory of the current file upwards until
it finds the file "tags.vim".
+flatten({list} [, {maxdepth}]) *flatten()*
+ Flatten {list} up to {maxdepth} levels. Without {maxdepth}
+ the result is a |List| without nesting, as if {maxdepth} is
+ a very large number.
+ The {list} is changed in place, make a copy first if you do
+ not want that.
+ *E964*
+ {maxdepth} means how deep in nested lists changes are made.
+ {list} is not modified when {maxdepth} is 0.
+ {maxdepth} must be positive number.
+
+ If there is an error the number zero is returned.
+
+ Example: >
+ :echo flatten([1, [2, [3, 4]], 5])
+< [1, 2, 3, 4, 5] >
+ :echo flatten([1, [2, [3, 4]], 5], 1)
+< [1, 2, [3, 4], 5]
+
float2nr({expr}) *float2nr()*
Convert {expr} to a Number by omitting the part after the
decimal point.
diff --git a/runtime/doc/usr_41.txt b/runtime/doc/usr_41.txt
index 234f7801ab..31da51bfbe 100644
--- a/runtime/doc/usr_41.txt
+++ b/runtime/doc/usr_41.txt
@@ -644,6 +644,7 @@ List manipulation: *list-functions*
min() minimum value in a List
count() count number of times a value appears in a List
repeat() repeat a List multiple times
+ flatten() flatten a List
Dictionary manipulation: *dict-functions*
get() get an entry without an error for a wrong key