diff options
121 files changed, 2880 insertions, 2003 deletions
diff --git a/.gitignore b/.gitignore index ed452c03a9..23c8fd1957 100644 --- a/.gitignore +++ b/.gitignore @@ -68,4 +68,4 @@ local.mk /runtime/doc/errors.log # clint errors, generated by `make lint` -errors.json +/errors.json diff --git a/CMakeLists.txt b/CMakeLists.txt index 3c12486d4e..6c3f4d927d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -40,17 +40,17 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Darwin") set(USE_FNAME_CASE TRUE) endif() -# Set available build types for CMake GUIs. -# A different build type can still be set by -DCMAKE_BUILD_TYPE=... -set_property(CACHE CMAKE_BUILD_TYPE PROPERTY - STRINGS "Debug" "Dev" "Release" "MinSizeRel" "RelWithDebInfo") - # Set default build type. if(NOT CMAKE_BUILD_TYPE) message(STATUS "CMAKE_BUILD_TYPE not given, defaulting to 'Dev'.") set(CMAKE_BUILD_TYPE "Dev" CACHE STRING "Choose the type of build." FORCE) endif() +# Set available build types for CMake GUIs. +# A different build type can still be set by -DCMAKE_BUILD_TYPE=... +set_property(CACHE CMAKE_BUILD_TYPE PROPERTY + STRINGS "Debug" "Dev" "Release" "MinSizeRel" "RelWithDebInfo") + # If not in a git repo (e.g., a tarball) these tokens define the complete # version string, else it is combined with the result of `git describe`. set(NVIM_VERSION_MAJOR 0) @@ -216,12 +216,16 @@ if(HAS_WVLA_FLAG) add_definitions(-Wvla) endif() -check_c_compiler_flag(-fstack-protector-strong HAS_FSTACK_PROTECTOR_STRONG_FLAG) -check_c_compiler_flag(-fstack-protector HAS_FSTACK_PROTECTOR_FLAG) -if(HAS_FSTACK_PROTECTOR_STRONG_FLAG) - add_definitions(-fstack-protector-strong) -elseif(HAS_FSTACK_PROTECTOR_FLAG) - add_definitions(-fstack-protector --param ssp-buffer-size=4) +if(UNIX) + # -fstack-protector breaks non Unix builds even in Mingw-w64 + check_c_compiler_flag(-fstack-protector-strong HAS_FSTACK_PROTECTOR_STRONG_FLAG) + check_c_compiler_flag(-fstack-protector HAS_FSTACK_PROTECTOR_FLAG) + + if(HAS_FSTACK_PROTECTOR_STRONG_FLAG) + add_definitions(-fstack-protector-strong) + elseif(HAS_FSTACK_PROTECTOR_FLAG) + add_definitions(-fstack-protector --param ssp-buffer-size=4) + endif() endif() check_c_compiler_flag(-fdiagnostics-color=auto HAS_DIAG_COLOR_FLAG) @@ -422,7 +426,11 @@ if(BUSTED_PRG) if(POLICY CMP0026) cmake_policy(SET CMP0026 OLD) endif() - get_target_property(TEST_LIBNVIM_PATH nvim-test LOCATION) + if(CMAKE_GENERATOR MATCHES "Visual Studio") + set(TEST_LIBNVIM_PATH ${CMAKE_BINARY_DIR}/lib/nvim-test.dll) + else() + get_target_property(TEST_LIBNVIM_PATH nvim-test LOCATION) + endif() configure_file( test/config/paths.lua.in @@ -3316,7 +3316,7 @@ def ProcessFile(filename, vlevel, extra_check_functions=[]): _SetVerboseLevel(vlevel) try: - # Support the UNIX convention of using "-" for stdin. Note that + # Support the Unix convention of using "-" for stdin. Note that # we are not opening the file with universal newline support # (which codecs doesn't support anyway), so the resulting lines do # contain trailing '\r' characters if we are reading a file that diff --git a/cmake/FindMsgpack.cmake b/cmake/FindMsgpack.cmake index 7d88137915..fbd107e45a 100644 --- a/cmake/FindMsgpack.cmake +++ b/cmake/FindMsgpack.cmake @@ -7,7 +7,7 @@ if(NOT MSGPACK_USE_BUNDLED) find_package(PkgConfig) if (PKG_CONFIG_FOUND) - pkg_check_modules(PC_MSGPACK QUIET msgpack) + pkg_search_module(PC_MSGPACK QUIET msgpackc msgpack) endif() else() set(PC_MSGPACK_INCLUDEDIR) @@ -23,13 +23,14 @@ find_path(MSGPACK_INCLUDE_DIR msgpack.h HINTS ${PC_MSGPACK_INCLUDEDIR} ${PC_MSGPACK_INCLUDE_DIRS} ${LIMIT_SEARCH}) -# If we're asked to use static linkage, add libmsgpack.a as a preferred library name. +# If we're asked to use static linkage, add libmsgpack{,c}.a as a preferred library name. if(MSGPACK_USE_STATIC) list(APPEND MSGPACK_NAMES + "${CMAKE_STATIC_LIBRARY_PREFIX}msgpackc${CMAKE_STATIC_LIBRARY_SUFFIX}" "${CMAKE_STATIC_LIBRARY_PREFIX}msgpack${CMAKE_STATIC_LIBRARY_SUFFIX}") endif() -list(APPEND MSGPACK_NAMES msgpack) +list(APPEND MSGPACK_NAMES msgpackc msgpack) find_library(MSGPACK_LIBRARY NAMES ${MSGPACK_NAMES} HINTS ${PC_MSGPACK_LIBDIR} ${PC_MSGPACK_LIBRARY_DIRS} diff --git a/config/CMakeLists.txt b/config/CMakeLists.txt index 48ecc9cc33..2d3c484845 100644 --- a/config/CMakeLists.txt +++ b/config/CMakeLists.txt @@ -15,7 +15,6 @@ check_type_size("void *" SIZEOF_VOID_PTR) check_symbol_exists(_NSGetEnviron crt_externs.h HAVE__NSGETENVIRON) # Headers -check_include_files(fcntl.h HAVE_FCNTL_H) check_include_files(iconv.h HAVE_ICONV_H) check_include_files(langinfo.h HAVE_LANGINFO_H) check_include_files(locale.h HAVE_LOCALE_H) @@ -24,10 +23,9 @@ check_include_files(strings.h HAVE_STRINGS_H) check_include_files(sys/wait.h HAVE_SYS_WAIT_H) if(NOT HAVE_SYS_WAIT_H AND UNIX) # See if_cscope.c - message(SEND_ERROR "header sys/wait.h is required for UNIX") + message(SEND_ERROR "header sys/wait.h is required for Unix") endif() check_include_files(sys/utsname.h HAVE_SYS_UTSNAME_H) -check_include_files(utime.h HAVE_UTIME_H) check_include_files(unistd.h HAVE_UNISTD_H) check_include_files(utime.h HAVE_UTIME_H) diff --git a/config/config.h.in b/config/config.h.in index 84a90301ff..1eafc8cb95 100644 --- a/config/config.h.in +++ b/config/config.h.in @@ -13,7 +13,6 @@ #endif #cmakedefine HAVE__NSGETENVIRON -#cmakedefine HAVE_FCNTL_H #cmakedefine HAVE_FD_CLOEXEC #cmakedefine HAVE_FSEEKO #cmakedefine HAVE_GETPWENT diff --git a/contrib/YouCompleteMe/ycm_extra_conf.py b/contrib/YouCompleteMe/ycm_extra_conf.py index 12ad080143..7c54677c8f 100644 --- a/contrib/YouCompleteMe/ycm_extra_conf.py +++ b/contrib/YouCompleteMe/ycm_extra_conf.py @@ -9,7 +9,7 @@ def DirectoryOfThisScript(): def GetDatabase(): compilation_database_folder = os.path.join(DirectoryOfThisScript(), - '..', '..', 'build') + '..', 'build') if os.path.exists(compilation_database_folder): return ycm_core.CompilationDatabase(compilation_database_folder) return None diff --git a/man/nvim.1 b/man/nvim.1 index 968da04d52..f9c4e24d0b 100644 --- a/man/nvim.1 +++ b/man/nvim.1 @@ -75,7 +75,7 @@ Can be used to edit files starting with a hyphen .Pq Sq - . .It Fl -literal Interpret filenames literally, that is, do not expand wildcards. -Has no effect on UNIX-like systems, where the shell expands wildcards. +Has no effect on Unix-like systems, where the shell expands wildcards. .It Fl e Ex mode. See diff --git a/runtime/autoload/phpcomplete.vim b/runtime/autoload/phpcomplete.vim index 5ddad88873..dbc40fdf36 100644 --- a/runtime/autoload/phpcomplete.vim +++ b/runtime/autoload/phpcomplete.vim @@ -3,7 +3,7 @@ " Maintainer: Dávid Szabó ( complex857 AT gmail DOT com ) " Previous Maintainer: Mikolaj Machowski ( mikmach AT wp DOT pl ) " URL: https://github.com/shawncplus/phpcomplete.vim -" Last Change: 2014 Dec 01 +" Last Change: 2015 Feb 28 " " OPTIONS: " @@ -145,7 +145,7 @@ function! phpcomplete#CompletePHP(findstart, base) " {{{ let [current_namespace, imports] = phpcomplete#GetCurrentNameSpace(getline(0, line('.'))) - if context =~? '^use\s' + if context =~? '^use\s' || context ==? 'use' return phpcomplete#CompleteUse(a:base) endif @@ -189,7 +189,7 @@ function! phpcomplete#CompletePHP(findstart, base) " {{{ " }}} elseif context =~? 'implements' return phpcomplete#CompleteClassName(a:base, ['i'], current_namespace, imports) - elseif context =~? 'extends\s\+.\+$' + elseif context =~? 'extends\s\+.\+$' && a:base == '' return ['implements'] elseif context =~? 'extends' let kinds = context =~? 'class\s' ? ['c'] : ['i'] @@ -244,12 +244,13 @@ function! phpcomplete#CompleteUse(base) " {{{ if has_key(tag, 'namespace') let patched_ctags_detected = 1 endif + if tag.kind ==? 'n' && tag.name =~? '^'.namespace_match_pattern let patched_ctags_detected = 1 call add(namespaced_matches, {'word': tag.name, 'kind': 'n', 'menu': tag.filename, 'info': tag.filename }) - elseif has_key(tag, 'namespace') && (tag.kind ==? 'c' || tag.kind ==? 'i') && tag.namespace ==? namespace_for_class + elseif has_key(tag, 'namespace') && (tag.kind ==? 'c' || tag.kind ==? 'i' || tag.kind ==? 't') && tag.namespace ==? namespace_for_class call add(namespaced_matches, {'word': namespace_for_class.'\'.tag.name, 'kind': tag.kind, 'menu': tag.filename, 'info': tag.filename }) - elseif (tag.kind ==? 'c' || tag.kind ==? 'i') + elseif (tag.kind ==? 'c' || tag.kind ==? 'i' || tag.kind ==? 't') call add(no_namespace_matches, {'word': namespace_for_class.'\'.tag.name, 'kind': tag.kind, 'menu': tag.filename, 'info': tag.filename }) endif endfor @@ -272,6 +273,10 @@ function! phpcomplete#CompleteUse(base) " {{{ endfor endif + for comp in res + let comp.word = substitute(comp.word, '^\\', '', '') + endfor + return res endfunction " }}} @@ -326,6 +331,7 @@ function! phpcomplete#CompleteGeneral(base, current_namespace, imports) " {{{ let ext_functions = {} let ext_constants = {} let ext_classes = {} + let ext_traits = {} let ext_interfaces = {} let ext_namespaces = {} @@ -420,7 +426,7 @@ function! phpcomplete#CompleteGeneral(base, current_namespace, imports) " {{{ endif endif endif - elseif tag.kind ==? 'c' || tag.kind ==? 'i' + elseif tag.kind ==? 'c' || tag.kind ==? 'i' || tag.kind ==? 't' let info = ' - '.tag.filename let key = '' @@ -441,6 +447,8 @@ function! phpcomplete#CompleteGeneral(base, current_namespace, imports) " {{{ let ext_classes[key] = info elseif tag.kind ==? 'i' let ext_interfaces[key] = info + elseif tag.kind ==? 't' + let ext_traits[key] = info endif endif endif @@ -463,7 +471,7 @@ function! phpcomplete#CompleteGeneral(base, current_namespace, imports) " {{{ endfor for [interfacename, info] in items(g:php_builtin_interfacenames) if interfacename =~? '^'.base - let builtin_interfaces[leading_slash.interfacename] = info + let builtin_interfaces[leading_slash.g:php_builtin_interfaces[tolower(interfacename)].name] = info endif endfor endif @@ -511,6 +519,8 @@ function! phpcomplete#CompleteGeneral(base, current_namespace, imports) " {{{ else let ext_interfaces[imported_name] = ' '.import.name.' - '.import.filename endif + elseif import.kind ==? 't' + let ext_traits[imported_name] = ' '.import.name.' - '.import.filename endif " no builtin interfaces @@ -540,6 +550,9 @@ function! phpcomplete#CompleteGeneral(base, current_namespace, imports) " {{{ " Add external interfaces call extend(all_values, ext_interfaces) + " Add external traits + call extend(all_values, ext_traits) + " Add built-in classes call extend(all_values, builtin_classnames) @@ -566,6 +579,8 @@ function! phpcomplete#CompleteGeneral(base, current_namespace, imports) " {{{ elseif has_key(ext_interfaces, i) || has_key(builtin_interfaces, i) let info = has_key(ext_interfaces, i) ? ext_interfaces[i] : builtin_interfaces[i].' - builtin' let final_list += [{'word':i, 'kind': 'i', 'menu': info, 'info': i.info}] + elseif has_key(ext_traits, i) + let final_list += [{'word':i, 'kind': 't', 'menu': ext_traits[i], 'info': ext_traits[i]}] elseif has_key(int_constants, i) || has_key(builtin_constants, i) let info = has_key(int_constants, i) ? int_constants[i] : ' - builtin' let final_list += [{'word':i, 'kind': 'd', 'menu': info, 'info': i.info}] @@ -784,7 +799,7 @@ function! phpcomplete#CompleteClassName(base, kinds, current_namespace, imports) let tags = [] if len(tag_match_pattern) >= g:phpcomplete_min_num_of_chars_for_namespace_completion - let tags = phpcomplete#GetTaglist('^'.tag_match_pattern) + let tags = phpcomplete#GetTaglist('^\c'.tag_match_pattern) endif if len(tags) @@ -861,6 +876,39 @@ function! phpcomplete#CompareCompletionRow(i1, i2) " {{{ endfunction " }}} +function! s:getNextCharWithPos(filelines, current_pos) " {{{ + let line_no = a:current_pos[0] + let col_no = a:current_pos[1] + let last_line = a:filelines[len(a:filelines) - 1] + let end_pos = [len(a:filelines) - 1, strlen(last_line) - 1] + if line_no > end_pos[0] || line_no == end_pos[0] && col_no > end_pos[1] + return ['EOF', 'EOF'] + endif + + " we've not reached the end of the current line break + if col_no + 1 < strlen(a:filelines[line_no]) + let col_no += 1 + else + " we've reached the end of the current line, jump to the next + " non-blank line (blank lines have no position where we can read from, + " not even a whitespace. The newline char does not positionable by vim + let line_no += 1 + while strlen(a:filelines[line_no]) == 0 + let line_no += 1 + endwhile + + let col_no = 0 + endif + + " return 'EOF' string to signal end of file, normal results only one char + " in length + if line_no == end_pos[0] && col_no > end_pos[1] + return ['EOF', 'EOF'] + endif + + return [[line_no, col_no], a:filelines[line_no][col_no]] +endfunction " }}} + function! phpcomplete#EvaluateModifiers(modifiers, required_modifiers, prohibited_modifiers) " {{{ " if theres no modifier, and no modifier is allowed and no modifier is required if len(a:modifiers) == 0 && len(a:required_modifiers) == 0 @@ -1602,26 +1650,26 @@ function! phpcomplete#GetClassName(start_line, context, current_namespace, impor endif endif - " in-file lookup for typehinted function arguments - " - the function can have a name or be anonymous (e.g., function qux() { ... } vs. function () { ... }) - " - the type-hinted argument can be anywhere in the arguments list. - if line =~? 'function\(\s\+'.function_name_pattern.'\)\?\s*(.\{-}'.class_name_pattern.'\s\+'.object && !object_is_array - let f_args = matchstr(line, '\cfunction\(\s\+'.function_name_pattern.'\)\?\s*(\zs.\{-}\ze)') - let args = split(f_args, '\s*\zs,\ze\s*') - for arg in args - if arg =~# object.'\(,\|$\)' - let classname_candidate = matchstr(arg, '\s*\zs'.class_name_pattern.'\ze\s\+'.object) - let [classname_candidate, class_candidate_namespace] = phpcomplete#ExpandClassName(classname_candidate, a:current_namespace, a:imports) + " function declaration line + if line =~? 'function\(\s\+'.function_name_pattern.'\)\?\s*(' + let function_lines = join(reverse(lines), " ") + " search for type hinted arguments + if function_lines =~? 'function\(\s\+'.function_name_pattern.'\)\?\s*(.\{-}'.class_name_pattern.'\s\+'.object && !object_is_array + let f_args = matchstr(function_lines, '\cfunction\(\s\+'.function_name_pattern.'\)\?\s*(\zs.\{-}\ze)') + let args = split(f_args, '\s*\zs,\ze\s*') + for arg in args + if arg =~# object.'\(,\|$\)' + let classname_candidate = matchstr(arg, '\s*\zs'.class_name_pattern.'\ze\s\+'.object) + let [classname_candidate, class_candidate_namespace] = phpcomplete#ExpandClassName(classname_candidate, a:current_namespace, a:imports) + break + endif + endfor + if classname_candidate != '' break endif - endfor - if classname_candidate != '' - break endif - endif - " if we see a function declaration, try loading the docblock for it and look for matching @params - if line =~? 'function\(\s\+'.function_name_pattern.'\)\?\s*(.\{-}'.object + " search for docblock for the function let match_line = substitute(line, '\\', '\\\\', 'g') let sccontent = getline(0, a:start_line - i) let doc_str = phpcomplete#GetDocBlock(sccontent, match_line) @@ -1641,13 +1689,14 @@ function! phpcomplete#GetClassName(start_line, context, current_namespace, impor endif " assignment for the variable in question with a variable on the right hand side - if line =~# '^\s*'.object.'\s*=&\?\s*'.variable_name_pattern + if line =~# '^\s*'.object.'\s*=&\?\s\+\(clone\)\?\s*'.variable_name_pattern " try to find the next non-comment or string ";" char - let start_col = match(line, '^\s*'.object.'\C\s*=\zs&\?\s*'.variable_name_pattern) + let start_col = match(line, '^\s*'.object.'\C\s*=\zs&\?\s\+\(clone\)\?\s*'.variable_name_pattern) let filelines = reverse(lines) let [pos, char] = s:getNextCharWithPos(filelines, [a:start_line - i - 1, start_col]) let chars_read = 1 + let last_pos = pos " read while end of the file while char != 'EOF' && chars_read < 1000 let last_pos = pos @@ -1689,6 +1738,7 @@ function! phpcomplete#GetClassName(start_line, context, current_namespace, impor let filelines = reverse(lines) let [pos, char] = s:getNextCharWithPos(filelines, [a:start_line - i - 1, start_col]) let chars_read = 1 + let last_pos = pos " read while end of the file while char != 'EOF' && chars_read < 1000 let last_pos = pos @@ -1819,7 +1869,7 @@ function! phpcomplete#GetClassLocation(classname, namespace) " {{{ let i = 1 while i < line('.') let line = getline(line('.')-i) - if line =~? '^\s*\(abstract\s\+\|final\s\+\)*\s*class\s*'.a:classname.'\(\s\+\|$\)' && tolower(current_namespace) == search_namespace + if line =~? '^\s*\(abstract\s\+\|final\s\+\)*\s*\(class\|interface\|trait\)\s*'.a:classname.'\(\s\+\|$\)' && tolower(current_namespace) == search_namespace return expand('%:p') else let i += 1 @@ -1831,7 +1881,9 @@ function! phpcomplete#GetClassLocation(classname, namespace) " {{{ let no_namespace_candidate = '' let tags = phpcomplete#GetTaglist('^'.a:classname.'$') for tag in tags - if tag.kind == 'c' || tag.kind == 'i' + " We'll allow interfaces and traits to be handled classes since you + " can't have colliding names with different kinds anyway + if tag.kind == 'c' || tag.kind == 'i' || tag.kind == 't' if !has_key(tag, 'namespace') let no_namespace_candidate = tag.filename else @@ -1979,9 +2031,9 @@ function! phpcomplete#GetClassContentsStructure(file_path, file_lines, class_nam " remember the window we started at let phpcomplete_original_window = winnr() - silent! below 1new + silent! tab 1new silent! 0put =cfile - call search('\(class\|interface\)\_s\+'.a:class_name.'\(\>\|$\)') + call search('\c\(class\|interface\|trait\)\_s\+'.a:class_name.'\(\>\|$\)') let cfline = line('.') call search('{') let endline = line('.') @@ -1994,8 +2046,48 @@ function! phpcomplete#GetClassContentsStructure(file_path, file_lines, class_nam let extends_class = '' endif call searchpair('{', '', '}', 'W') - let classcontent = join(getline(cfline, line('.')), "\n") + let class_closing_bracket_line = line('.') + let classcontent = join(getline(cfline, class_closing_bracket_line), "\n") + + let used_traits = [] + " move back to the line next to the class's definition + call cursor(endline + 1, 1) + let keep_searching = 1 + while keep_searching != 0 + " try to grab "use..." keywords + let [lnum, col] = searchpos('\c^\s\+use\s\+'.class_name_pattern, 'cW', class_closing_bracket_line) + let syn_name = synIDattr(synID(lnum, col, 0), "name") + if syn_name =~? 'string\|comment' + call cursor(lnum + 1, 1) + continue + endif + + let trait_line = getline(lnum) + if trait_line !~? ';' + " try to find the next line containing ';' + let l = lnum + let search_line = trait_line + + " add lines from the file until theres no ';' in them + while search_line !~? ';' && l > 0 + " file lines are reversed so we need to go backwards + let l += 1 + let search_line = getline(l) + let trait_line .= ' '.substitute(search_line, '\(^\s\+\|\s\+$\)', '', 'g') + endwhile + endif + let use_expression = matchstr(trait_line, '^\s*use\s\+\zs.\{-}\ze;') + let use_parts = map(split(use_expression, '\s*,\s*'), 'substitute(v:val, "\\s+", " ", "g")') + let used_traits += map(use_parts, 'substitute(v:val, "\\s", "", "g")') + call cursor(lnum + 1, 1) + + if [lnum, col] == [0, 0] + let keep_searching = 0 + endif + endwhile + silent! bw! % + let [current_namespace, imports] = phpcomplete#GetCurrentNameSpace(a:file_lines[0:cfline]) " go back to original window exe phpcomplete_original_window.'wincmd w' @@ -2008,21 +2100,27 @@ function! phpcomplete#GetClassContentsStructure(file_path, file_lines, class_nam \ 'mtime': getftime(full_file_path), \ }) + let all_extends = used_traits if extends_class != '' - let [extends_class, namespace] = phpcomplete#ExpandClassName(extends_class, current_namespace, imports) - if namespace == '' - let namespace = '\' - endif - let classlocation = phpcomplete#GetClassLocation(extends_class, namespace) - if classlocation == "VIMPHP_BUILTINOBJECT" - let result += [phpcomplete#GenerateBuiltinClassStub(g:php_builtin_classes[tolower(extends_class)])] - elseif classlocation != '' && filereadable(classlocation) - let full_file_path = fnamemodify(classlocation, ':p') - let result += phpcomplete#GetClassContentsStructure(full_file_path, readfile(full_file_path), extends_class) - elseif tolower(current_namespace) == tolower(namespace) - " try to find the declaration in the same file. - let result += phpcomplete#GetClassContentsStructure(full_file_path, a:file_lines, extends_class) - endif + call add(all_extends, extends_class) + endif + if len(all_extends) > 0 + for class in all_extends + let [class, namespace] = phpcomplete#ExpandClassName(class, current_namespace, imports) + if namespace == '' + let namespace = '\' + endif + let classlocation = phpcomplete#GetClassLocation(class, namespace) + if classlocation == "VIMPHP_BUILTINOBJECT" + let result += [phpcomplete#GenerateBuiltinClassStub(g:php_builtin_classes[tolower(class)])] + elseif classlocation != '' && filereadable(classlocation) + let full_file_path = fnamemodify(classlocation, ':p') + let result += phpcomplete#GetClassContentsStructure(full_file_path, readfile(full_file_path), class) + elseif tolower(current_namespace) == tolower(namespace) + " try to find the declaration in the same file. + let result += phpcomplete#GetClassContentsStructure(full_file_path, a:file_lines, class) + endif + endfor endif return result @@ -2270,19 +2368,40 @@ endfunction! " }}} function! phpcomplete#GetCurrentNameSpace(file_lines) " {{{ + let original_window = winnr() + + silent! tab 1new + silent! 0put =a:file_lines + normal! G + + " clear out classes, functions and other blocks + while 1 + let block_start_pos = searchpos('\c\(class\|trait\|function\|interface\)\s\+\_.\{-}\zs{', 'Web') + if block_start_pos == [0, 0] + break + endif + let block_end_pos = searchpairpos('{', '', '}\|\%$', 'W', 'synIDattr(synID(line("."), col("."), 0), "name") =~? "string\\|comment"') + silent! exec block_start_pos[0].','.block_end_pos[0].'d' + endwhile + normal! G + + " grab the remains + let file_lines = reverse(getline(1, line('.') - 1)) + + silent! bw! % + exe original_window.'wincmd w' + let namespace_name_pattern = '[a-zA-Z_\x7f-\xff\\][a-zA-Z_0-9\x7f-\xff\\]*' - let file_lines = reverse(copy(a:file_lines)) let i = 0 let file_length = len(file_lines) let imports = {} - let current_namespace = '\' while i < file_length let line = file_lines[i] if line =~? '^\s*namespace\s*'.namespace_name_pattern - let current_namespace = matchstr(line, '^\s*namespace\s*\zs'.namespace_name_pattern.'\ze') + let current_namespace = matchstr(line, '\c^\s*namespace\s*\zs'.namespace_name_pattern.'\ze') break endif @@ -2303,11 +2422,11 @@ function! phpcomplete#GetCurrentNameSpace(file_lines) " {{{ let use_line .= ' '.substitute(search_line, '\(^\s\+\|\s\+$\)', '', 'g') endwhile endif - let use_expression = matchstr(use_line, '^\s*use\s\+\zs.\{-}\ze;') + let use_expression = matchstr(use_line, '^\c\s*use\s\+\zs.\{-}\ze;') let use_parts = map(split(use_expression, '\s*,\s*'), 'substitute(v:val, "\\s+", " ", "g")') for part in use_parts if part =~? '\s\+as\s\+' - let [object, name] = split(part, '\s\+as\s\+') + let [object, name] = split(part, '\s\+as\s\+\c') let object = substitute(object, '^\\', '', '') let name = substitute(name, '^\\', '', '') else @@ -2343,7 +2462,7 @@ function! phpcomplete#GetCurrentNameSpace(file_lines) " {{{ break endif " if the name matches with the extracted classname and namespace - if (tag.kind == 'c' || tag.kind == 'i') && tag.name == classname + if (tag.kind == 'c' || tag.kind == 'i' || tag.kind == 't') && tag.name == classname if has_key(tag, 'namespace') let patched_ctags_detected = 1 if tag.namespace == namespace_for_classes @@ -2386,7 +2505,7 @@ function! phpcomplete#GetCurrentNameSpace(file_lines) " {{{ let tags = phpcomplete#GetTaglist('^'.import['name'].'$') for tag in tags " search for the first matchin namespace, class, interface with no namespace - if !has_key(tag, 'namespace') && (tag.kind == 'n' || tag.kind == 'c' || tag.kind == 'i') + if !has_key(tag, 'namespace') && (tag.kind == 'n' || tag.kind == 'c' || tag.kind == 'i' || tag.kind == 't') call extend(import, tag) let import['builtin'] = 0 break diff --git a/runtime/autoload/provider/clipboard.vim b/runtime/autoload/provider/clipboard.vim index 5d1ce7896d..3728eb9367 100644 --- a/runtime/autoload/provider/clipboard.vim +++ b/runtime/autoload/provider/clipboard.vim @@ -83,6 +83,7 @@ function! s:clipboard.set(lines, regtype, reg) end let selection.data = [a:lines, a:regtype] let argv = split(s:copy[a:reg], " ") + let selection.detach = s:cache_enabled let jobid = jobstart(argv, selection) if jobid <= 0 echohl WarningMsg diff --git a/runtime/autoload/provider/script_host.py b/runtime/autoload/provider/script_host.py index 96d70e0330..416b4070bb 100644 --- a/runtime/autoload/provider/script_host.py +++ b/runtime/autoload/provider/script_host.py @@ -1,5 +1,6 @@ """Legacy python/python3-vim emulation.""" import imp +import io import logging import os import sys @@ -151,7 +152,7 @@ class ScriptHost(object): current.range = current.buffer.range(start, stop) -class RedirectStream(object): +class RedirectStream(io.IOBase): def __init__(self, redirect_handler): self.redirect_handler = redirect_handler @@ -161,9 +162,6 @@ class RedirectStream(object): def writelines(self, seq): self.redirect_handler('\n'.join(seq)) - def flush(self): - pass - class LegacyEvalHook(neovim.SessionHook): diff --git a/runtime/doc/autocmd.txt b/runtime/doc/autocmd.txt index ffba29efc7..140a2f2e66 100644 --- a/runtime/doc/autocmd.txt +++ b/runtime/doc/autocmd.txt @@ -1041,7 +1041,7 @@ The pattern is interpreted like mostly used in file names: [^ch] match any character but 'c' and 'h' Note that for all systems the '/' character is used for path separator (even -MS-DOS). This was done because the backslash is difficult to use in a pattern +Windows). This was done because the backslash is difficult to use in a pattern and to make the autocommands portable across different systems. *autocmd-changes* diff --git a/runtime/doc/change.txt b/runtime/doc/change.txt index f01def6ab2..42dc84e0de 100644 --- a/runtime/doc/change.txt +++ b/runtime/doc/change.txt @@ -1,4 +1,4 @@ -*change.txt* For Vim version 7.4. Last change: 2015 Jan 27 +*change.txt* For Vim version 7.4. Last change: 2015 Feb 10 VIM REFERENCE MANUAL by Bram Moolenaar @@ -371,8 +371,10 @@ CTRL-X Subtract [count] from the number or alphabetic character at or after the cursor. The CTRL-A and CTRL-X commands work for (signed) decimal numbers, unsigned -octal and hexadecimal numbers and alphabetic characters. This depends on the -'nrformats' option. +binary/octal/hexadecimal numbers and alphabetic characters. This +depends on the 'nrformats' option. +- When 'nrformats' includes "bin", Vim considers numbers starting with '0b' or + '0B' as binary. - When 'nrformats' includes "octal", Vim considers numbers starting with a '0' to be octal, unless the number includes a '8' or '9'. Other numbers are decimal and may have a preceding minus sign. @@ -386,6 +388,10 @@ octal and hexadecimal numbers and alphabetic characters. This depends on the under or after the cursor. This is useful to make lists with an alphabetic index. +For decimals a leading negative sign is considered for incrementing or +decrementing, for binary and octal and hex values, it won't be considered. To +ignore the sign Visually select the number before using CTRL-A or CTRL-X. + For numbers with leading zeros (including all octal and hexadecimal numbers), Vim preserves the number of characters in the number when possible. CTRL-A on "0077" results in "0100", CTRL-X on "0x100" results in "0x0ff". @@ -397,6 +403,10 @@ octal number. Note that when 'nrformats' includes "octal", decimal numbers with leading zeros cause mistakes, because they can be confused with octal numbers. +Note similarly, when 'nrformats' includes "bin", binary numbers with a leading +'0x' or '0X' can be interpreted as hexadecimal rather than binary since '0b' +are valid hexadecimal digits. + The CTRL-A command is very useful in a macro. Example: Use the following steps to make a numbered list. @@ -832,13 +842,13 @@ This replaces each 'E' character with a euro sign. Read more in |<Char->|. :promptf[ind] [string] Put up a Search dialog. When [string] is given, it is used as the initial search string. - {only for Win32 and GTK GUI} + {only for Win32 GUI} *:promptr* *:promptrepl* :promptr[epl] [string] Put up a Search/Replace dialog. When [string] is given, it is used as the initial search string. - {only for Win32 and GTK GUI} + {only for Win32 GUI} 4.4 Changing tabs *change-tabs* @@ -1147,12 +1157,14 @@ if none of buffers matches the given name. 7. Expression register "= *quote_=* *quote=* *@=* This is not really a register that stores text, but is a way to use an expression in commands which use a register. The expression register is -read-only; you cannot put text into it. After the '=', the cursor moves to -the command-line, where you can enter any expression (see |expression|). All -normal command-line editing commands are available, including a special -history for expressions. When you end the command-line by typing <CR>, Vim -computes the result of the expression. If you end it with <Esc>, Vim abandons -the expression. If you do not enter an expression, Vim uses the previous +read-write. + +When typing the '=' after " or CTRL-R the cursor moves to the command-line, +where you can enter any expression (see |expression|). All normal +command-line editing commands are available, including a special history for +expressions. When you end the command-line by typing <CR>, Vim computes the +result of the expression. If you end it with <Esc>, Vim abandons the +expression. If you do not enter an expression, Vim uses the previous expression (like with the "/" command). The expression must evaluate to a String. A Number is always automatically @@ -1171,18 +1183,6 @@ See |quotestar| and |quoteplus|. When the clipboard is not available or not working, the unnamed register is used instead. For Unix systems and Mac OS X, see |nvim-clipboard|. - *quote_~* *quote~* *<Drop>* -The read-only "~ register stores the dropped text from the last drag'n'drop -operation. When something has been dropped onto Vim, the "~ register is -filled in and the <Drop> pseudo key is sent for notification. You can remap -this key if you want; the default action (for all modes) is to insert the -contents of the "~ register at the cursor position. -{only available when compiled with the |+dnd| feature, currently only with the -GTK GUI} - -Note: The "~ register is only used when dropping plain text onto Vim. -Drag'n'drop of URI lists is handled internally. - 9. Black hole register "_ *quote_* When writing to this register, nothing happens. This can be used to delete text without affecting the normal registers. When reading from this register, @@ -1193,7 +1193,7 @@ Contains the most recent search-pattern. This is used for "n" and 'hlsearch'. It is writable with `:let`, you can change it to have 'hlsearch' highlight other matches without actually searching. You can't yank or delete into this register. The search direction is available in |v:searchforward|. -Note that the valued is restored when returning from a function +Note that the value is restored when returning from a function |function-search-undo|. *@/* @@ -1405,10 +1405,10 @@ When you hit Return in a C-comment, Vim will insert the middle comment leader for the new line: " * ". To close this comment you just have to type "/" before typing anything else on the new line. This will replace the middle-comment leader with the end-comment leader and apply any specified -alignment, leaving just " */". There is no need to hit BackSpace first. +alignment, leaving just " */". There is no need to hit Backspace first. -When there is a match with a middle part, but there also is a maching end part -which is longer, the end part is used. This makes a C style comment work +When there is a match with a middle part, but there also is a matching end +part which is longer, the end part is used. This makes a C style comment work without requiring the middle part to end with a space. Here is an example of alignment flags at work to make a comment stand out @@ -1612,7 +1612,7 @@ Vim has a sorting function and a sorting command. The sorting function can be found here: |sort()|, |uniq()|. *:sor* *:sort* -:[range]sor[t][!] [i][u][r][n][x][o] [/{pattern}/] +:[range]sor[t][!] [i][u][r][n][x][o][b] [/{pattern}/] Sort lines in [range]. When no range is given all lines are sorted. @@ -1632,6 +1632,9 @@ found here: |sort()|, |uniq()|. With [o] sorting is done on the first octal number in the line (after or inside a {pattern} match). + With [b] sorting is done on the first binary number in + the line (after or inside a {pattern} match). + With [u] only keep the first of a sequence of identical lines (ignoring case when [i] is used). Without this flag, a sequence of identical lines diff --git a/runtime/doc/cmdline.txt b/runtime/doc/cmdline.txt index ddf5b110cd..ae808a4a9b 100644 --- a/runtime/doc/cmdline.txt +++ b/runtime/doc/cmdline.txt @@ -379,7 +379,7 @@ CTRL-N After using 'wildchar' which got multiple matches, go to next <S-Tab> *c_CTRL-P* *c_<S-Tab>* CTRL-P After using 'wildchar' which got multiple matches, go to previous match. Otherwise recall older command-line from - history. <S-Tab> only works with the GUI and with MS-DOS. + history. <S-Tab> only works with the GUI. *c_CTRL-A* CTRL-A All names that match the pattern in front of the cursor are inserted. @@ -492,7 +492,6 @@ followed by another Vim command: :function :global :help - :helpfind :lcscope :ldo :lfdo @@ -820,7 +819,7 @@ These modifiers can be given, in this order: separator is removed. Thus ":p:h" on a directory name results on the directory name itself (without trailing slash). When the file name is an absolute path (starts with "/" for - Unix; "x:\" for MS-DOS and WIN32), that part is not removed. + Unix; "x:\" for Windows), that part is not removed. When there is no head (path is relative to current directory) the result is empty. :t Tail of the file name (last component of the name). Must @@ -919,8 +918,8 @@ option contains "sh", this is done twice, to avoid the shell trying to expand the "!". *filename-backslash* -For filesystems that use a backslash as directory separator (MS-DOS and -Windows), it's a bit difficult to recognize a backslash that is used +For filesystems that use a backslash as directory separator (Windows +filesystems), it's a bit difficult to recognize a backslash that is used to escape the special meaning of the next character. The general rule is: If the backslash is followed by a normal file name character, it does not have a special meaning. Therefore "\file\foo" is a valid file name, you don't have diff --git a/runtime/doc/editing.txt b/runtime/doc/editing.txt index 1044236826..bcb89f6527 100644 --- a/runtime/doc/editing.txt +++ b/runtime/doc/editing.txt @@ -130,9 +130,7 @@ You can use this file if you discover that you need the original file. See also the 'patchmode' option. The name of the backup file is normally the same as the original file with 'backupext' appended. The default "~" is a bit strange to avoid accidentally overwriting existing files. If you prefer ".bak" -change the 'backupext' option. Extra dots are replaced with '_' on MS-DOS -machines, when Vim has detected that an MS-DOS-like filesystem is being used -(e.g., messydos or crossdos). The backup file can be placed in another +change the 'backupext' option. The backup file can be placed in another directory by setting 'backupdir'. When you started editing without giving a file name, "No File" is displayed in @@ -276,7 +274,8 @@ CTRL-^ Edit the alternate file. Mostly the alternate file is Mnemonic: "goto file". Uses the 'isfname' option to find out which characters are supposed to be in a file name. Trailing - punctuation characters ".,:;!" are ignored. + punctuation characters ".,:;!" are ignored. Escaped + spaces "\ " are reduced to a single space. Uses the 'path' option as a list of directory names to look for the file. See the 'path' option for details about relative directories and wildcards. @@ -470,9 +469,9 @@ The 'fileformat' option sets the <EOL> style for a file: "mac" <CR> Mac format *Mac-format* When reading a file, the mentioned characters are interpreted as the <EOL>. -In DOS format (default for MS-DOS and Win32), <CR><NL> and <NL> are both -interpreted as the <EOL>. Note that when writing the file in DOS format, -<CR> characters will be added for each single <NL>. Also see |file-read|. +In DOS format (default for Windows), <CR><NL> and <NL> are both interpreted as +the <EOL>. Note that when writing the file in DOS format, <CR> characters will +be added for each single <NL>. Also see |file-read|. When writing a file, the mentioned characters are used for <EOL>. For DOS format <CR><NL> is used. Also see |DOS-format-write|. @@ -493,13 +492,13 @@ If you start editing a new file and the 'fileformats' option is not empty (which is the default), Vim will try to detect whether the lines in the file are separated by the specified formats. When set to "unix,dos", Vim will check for lines with a single <NL> (as used on Unix) or by a <CR><NL> pair -(MS-DOS). Only when ALL lines end in <CR><NL>, 'fileformat' is set to "dos", +(Windows). Only when ALL lines end in <CR><NL>, 'fileformat' is set to "dos", otherwise it is set to "unix". When 'fileformats' includes "mac", and no <NL> characters are found in the file, 'fileformat' is set to "mac". -If the 'fileformat' option is set to "dos" on non-MS-DOS systems the message +If the 'fileformat' option is set to "dos" on non-Windows systems the message "[dos format]" is shown to remind you that something unusual is happening. On -MS-DOS systems you get the message "[unix format]" if 'fileformat' is set to +Windows systems you get the message "[unix format]" if 'fileformat' is set to "unix". On all systems but the Macintosh you get the message "[mac format]" if 'fileformat' is set to "mac". @@ -965,10 +964,10 @@ lost the original file. *DOS-format-write* If the 'fileformat' is "dos", <CR> <NL> is used for <EOL>. This is default -for MS-DOS and Win32. On other systems the message "[dos format]" is shown to +for Windows. On other systems the message "[dos format]" is shown to remind you that an unusual <EOL> was used. *Unix-format-write* -If the 'fileformat' is "unix", <NL> is used for <EOL>. On MS-DOS and Win32 +If the 'fileformat' is "unix", <NL> is used for <EOL>. On Windows the message "[unix format]" is shown. *Mac-format-write* If the 'fileformat' is "mac", <CR> is used for <EOL>. On non-Mac systems the @@ -998,11 +997,11 @@ When the file name is actually a device name, Vim will not make a backup (that would be impossible). You need to use "!", since the device already exists. Example for Unix: > :w! /dev/lpt0 -and for MS-DOS or MS-Windows: > +and Windows: > :w! lpt0 For Unix a device is detected when the name doesn't refer to a normal file or a directory. A fifo or named pipe also looks like a device to Vim. -For MS-DOS and MS-Windows the device is detected by its name: +For Windows the device is detected by its name: CON CLOCK$ NUL @@ -1145,7 +1144,7 @@ If you want to always use ":confirm", set the 'confirm' option. |:diffsplit|, |:diffpatch|, |:pedit|, |:redir|, |:source|, |:update|, |:visual|, |:vsplit|, and |:qall| if 'confirm' is set. - {only in Win32, GTK and Mac GUI} + {only in Win32 GUI} When ":browse" is not possible you get an error message. If the |+browse| feature is missing or the {command} doesn't support browsing, the {command} is @@ -1173,16 +1172,13 @@ For versions of Vim where browsing is not supported, the command is executed unmodified. *browsefilter* -For MS Windows and GTK, you can modify the filters that are used in the browse -dialog. By setting the g:browsefilter or b:browsefilter variables, you can -change the filters globally or locally to the buffer. The variable is set to -a string in the format "{filter label}\t{pattern};{pattern}\n" where {filter -label} is the text that appears in the "Files of Type" comboBox, and {pattern} -is the pattern which filters the filenames. Several patterns can be given, -separated by ';'. - -For Motif the same format is used, but only the very first pattern is actually -used (Motif only offers one pattern, but you can edit it). +For Windows you can modify the filters that are used in the browse dialog. By +setting the g:browsefilter or b:browsefilter variables, you can change the +filters globally or locally to the buffer. The variable is set to a string in +the format "{filter label}\t{pattern};{pattern}\n" where {filter label} is the +text that appears in the "Files of Type" comboBox, and {pattern} is the +pattern which filters the filenames. Several patterns can be given, separated +by ';'. For example, to have only Vim files in the dialog, you could use the following command: > @@ -1226,7 +1222,7 @@ present in 'cpoptions' and "!" is not used in the command. Does not change the meaning of an already opened file, because its full path name is remembered. Files from the |arglist| may change though! - On MS-DOS this also changes the active drive. + On Windows this also changes the active drive. To change to the directory of the current file: > :cd %:h < diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt index 5b9c0bf702..f0747dad1b 100644 --- a/runtime/doc/eval.txt +++ b/runtime/doc/eval.txt @@ -65,14 +65,16 @@ the Number. Examples: Number 0 --> String "0" ~ Number -1 --> String "-1" ~ *octal* -Conversion from a String to a Number is done by converting the first digits -to a number. Hexadecimal "0xf9" and Octal "017" numbers are recognized. If -the String doesn't start with digits, the result is zero. Examples: +Conversion from a String to a Number is done by converting the first digits to +a number. Hexadecimal "0xf9", Octal "017", and Binary "0b10" numbers are +recognized. If the String doesn't start with digits, the result is zero. +Examples: String "456" --> Number 456 ~ String "6bar" --> Number 6 ~ String "foo" --> Number 0 ~ String "0xf1" --> Number 241 ~ String "0100" --> Number 64 ~ + String "0b101" --> Number 5 ~ String "-8" --> Number -8 ~ String "+8" --> Number 0 ~ @@ -1894,6 +1896,7 @@ isdirectory( {directory}) Number TRUE if {directory} is a directory islocked( {expr}) Number TRUE if {expr} is locked items( {dict}) List key-value pairs in {dict} jobclose({job}[, {stream}]) Number Closes a job stream(s) +jobpid({job}) Number Returns pid of a job. jobresize({job}, {width}, {height}) Number Resize {job}'s pseudo terminal window jobsend({job}, {data}) Number Writes {data} to {job}'s stdin @@ -2563,9 +2566,9 @@ confirm({msg} [, {choices} [, {default} [, {type}]]]) {default} is omitted, 1 is used. The optional {type} argument gives the type of dialog. This - is only used for the icon of the GTK, Mac, and Win32 GUI. It - can be one of these values: "Error", "Question", "Info", - "Warning" or "Generic". Only the first character is relevant. + is only used for the icon of the Win32 GUI. It can be one of + these values: "Error", "Question", "Info", "Warning" or + "Generic". Only the first character is relevant. When {type} is omitted, "Generic" is used. If the user aborts the dialog by pressing <Esc>, CTRL-C, @@ -2825,7 +2828,7 @@ executable({expr}) *executable()* arguments. executable() uses the value of $PATH and/or the normal searchpath for programs. *PATHEXT* - On MS-DOS and MS-Windows the ".exe", ".bat", etc. can + On Windows the ".exe", ".bat", etc. can optionally be included. Then the extensions in $PATHEXT are tried. Thus if "foo.exe" does not exist, "foo.exe.bat" can be found. If $PATHEXT is not set then ".exe;.com;.bat;.cmd" is @@ -2833,9 +2836,9 @@ executable({expr}) *executable()* the name without an extension. When 'shell' looks like a Unix shell, then the name is also tried without adding an extension. - On MS-DOS and MS-Windows it only checks if the file exists and + On Windows it only checks if the file exists and is not a directory, not if it's really executable. - On MS-Windows an executable in the same directory as Vim is + On Windows an executable in the same directory as Vim is always found. Since this directory is added to $PATH it should also work to execute it |win32-PATH|. The result is a Number: @@ -3279,8 +3282,7 @@ foreground() Move the Vim window to the foreground. Useful when sent from On Win32 systems this might not work, the OS does not always allow a window to bring itself to the foreground. Use |remote_foreground()| instead. - {only in the Win32 and GTK GUI versions and the - Win32 console version} + {only in the Win32 GUI and console version} function({name}) *function()* *E700* @@ -3411,7 +3413,7 @@ getchar([expr]) *getchar()* : endwhile :endfunction < - You may also receive syntetic characters, such as + You may also receive synthetic characters, such as |<CursorHold>|. Often you will want to ignore this and get another character: > :function GetKey() @@ -3528,8 +3530,6 @@ getfontname([{name}]) *getfontname()* Only works when the GUI is running, thus not in your vimrc or gvimrc file. Use the |GUIEnter| autocommand to use this function just after the GUI has started. - Note that the GTK 2 GUI accepts any font name, thus checking - for a valid name does not work. getfperm({fname}) *getfperm()* The result is a String, which is the read, write, and execute @@ -3628,8 +3628,7 @@ getmatches() *getmatches()* < *getpid()* getpid() Return a Number which is the process ID of the Vim process. - On Unix and MS-Windows this is a unique number, until Vim - exits. On MS-DOS it's always zero. + This is a unique number, until Vim exits. *getpos()* getpos({expr}) Get the position for {expr}. For possible values of {expr} @@ -4161,6 +4160,9 @@ jobclose({job}[, {stream}]) {Nvim} *jobclose()* Close {job}'s {stream}, which can be one "stdin", "stdout" or "stderr". If {stream} is omitted, all streams are closed. +jobpid({job}) {Nvim} *jobpid()* + Return the pid (process id) of {job}. + jobresize({job}, {width}, {height}) {Nvim} *jobresize()* Resize {job}'s pseudo terminal window to {width} and {height}. This function will fail if used on jobs started without the @@ -4198,6 +4200,10 @@ jobstart({cmd}[, {opts}]) {Nvim} *jobstart()* - width: Width of the terminal screen(only if pty is set) - height: Height of the terminal screen(only if pty is set) - TERM: $TERM environment variable(only if pty is set) + - detach: Detach the job process from the nvim process. The + process won't get killed when nvim exists. If the process + dies before nvim exits, on_exit will still be invoked. + This option is only allowed for non-pty jobs. Either funcrefs or function names can be passed as event handlers. The {opts} object is also used as the "self" argument for the callback, so the caller may pass arbitrary @@ -4915,6 +4921,9 @@ printf({fmt}, {expr1} ...) *printf()* %c single byte %d decimal number %5d decimal number padded with spaces to 5 characters + %b binary number + %08b binary number padded with zeros to at least 8 characters + %B binary number using upper case letters %x hex number %04x hex number padded with zeros to at least 4 characters %X hex number using upper case letters @@ -5001,20 +5010,19 @@ printf({fmt}, {expr1} ...) *printf()* The conversion specifiers and their meanings are: - *printf-d* *printf-o* *printf-x* *printf-X* - doxX The Number argument is converted to signed decimal - (d), unsigned octal (o), or unsigned hexadecimal (x - and X) notation. The letters "abcdef" are used for - x conversions; the letters "ABCDEF" are used for X - conversions. - The precision, if any, gives the minimum number of - digits that must appear; if the converted value - requires fewer digits, it is padded on the left with - zeros. - In no case does a non-existent or small field width - cause truncation of a numeric field; if the result of - a conversion is wider than the field width, the field - is expanded to contain the conversion result. + *printf-d* *printf-b* *printf-B* *printf-o* *printf-x* *printf-X* + dbBoxX The Number argument is converted to signed decimal (d), + unsigned binary (b and B), unsigned octal (o), or + unsigned hexadecimal (x and X) notation. The letters + "abcdef" are used for x conversions; the letters + "ABCDEF" are used for X conversions. The precision, if + any, gives the minimum number of digits that must + appear; if the converted value requires fewer digits, it + is padded on the left with zeros. In no case does a + non-existent or small field width cause truncation of a + numeric field; if the result of a conversion is wider + than the field width, the field is expanded to contain + the conversion result. *printf-c* c The Number argument is converted to a byte, and the @@ -5086,7 +5094,7 @@ py3eval({expr}) *py3eval()* Evaluate Python expression {expr} and return its result converted to Vim data structures. Numbers and strings are returned as they are (strings are - copied though, unicode strings are additionally converted to + copied though, Unicode strings are additionally converted to 'encoding'). Lists are represented as Vim |List| type. Dictionaries are represented as Vim |Dictionary| type with @@ -5213,8 +5221,7 @@ remote_foreground({server}) *remote_foreground()* Note: This does not restore the window if it was minimized, like foreground() does. This function is not available in the |sandbox|. - {only in the Win32 and GTK GUI versions and the - Win32 console version} + {only in the Win32 GUI and the Win32 console version} remote_peek({serverid} [, {retvar}]) *remote_peek()* @@ -5890,12 +5897,12 @@ setwinvar({nr}, {varname}, {val}) *setwinvar()* :call setwinvar(2, "myvar", "foobar") sha256({string}) *sha256()* - Returns a String with 64 hex charactes, which is the SHA256 + Returns a String with 64 hex characters, which is the SHA256 checksum of {string}. shellescape({string} [, {special}]) *shellescape()* Escape {string} for use as a shell command argument. - On MS-Windows and MS-DOS, when 'shellslash' is not set, it + On Windows when 'shellslash' is not set, it will enclose {string} in double quotes and double all double quotes within {string}. For other systems, it will enclose {string} in single quotes @@ -6131,12 +6138,14 @@ str2float( {expr}) *str2float()* str2nr( {expr} [, {base}]) *str2nr()* Convert string {expr} to a number. - {base} is the conversion base, it can be 8, 10 or 16. + {base} is the conversion base, it can be 2, 8, 10 or 16. When {base} is omitted base 10 is used. This also means that a leading zero doesn't cause octal conversion to be used, as with the default String to Number conversion. When {base} is 16 a leading "0x" or "0X" is ignored. With a - different base the result will be zero. + different base the result will be zero. Similarly, when {base} + is 8 a leading "0" is ignored, and when {base} is 2 a leading + "0b" or "0B" is ignored. Text after the number is silently ignored. @@ -6980,7 +6989,6 @@ debug Compiled with "DEBUG" defined. dialog_con Compiled with console dialog support. dialog_gui Compiled with GUI dialog support. digraphs Compiled with support for digraphs. -dnd Compiled with support for the "~ register |quote_~|. eval Compiled with expression evaluation support. Always true, of course! ex_extra Compiled with extra Ex commands |+ex_extra|. @@ -6998,10 +7006,6 @@ fname_case Case in file names matters (for Windows this is not folding Compiled with |folding| support. gettext Compiled with message translation |multi-lang| gui Compiled with GUI enabled. -gui_gnome Compiled with Gnome support (gui_gtk is also defined). -gui_gtk Compiled with GTK+ GUI (any version). -gui_gtk2 Compiled with GTK+ 2 GUI (gui_gtk is also defined). -gui_mac Compiled with Macintosh GUI. gui_running Vim is running in the GUI, or it will start soon. gui_win32 Compiled with MS Windows Win32 GUI. iconv Can use iconv() for conversion. @@ -8563,7 +8567,7 @@ You can catch all Vim errors by the pattern > *catch-text* NOTE: You should never catch the error message text itself: > :catch /No such variable/ -only works in the english locale, but not when the user has selected +only works in the English locale, but not when the user has selected a different language by the |:language| command. It is however helpful to cite the message text in a comment: > :catch /^Vim(\a\+):E108:/ " No such variable diff --git a/runtime/doc/farsi.txt b/runtime/doc/farsi.txt index 6036264237..b85c0a357c 100644 --- a/runtime/doc/farsi.txt +++ b/runtime/doc/farsi.txt @@ -111,7 +111,7 @@ The letter encoding used is the Vim extended ISIR-3342 standard with a built in function to convert between Vim extended ISIR-3342 and ISIR-3342 standard. For document portability reasons, the letter encoding is kept the same across -different platforms (i.e. UNIX's, NT/95/98, MS DOS, ...). +different platforms (i.e. Unix, Windows, ...). o Keyboard diff --git a/runtime/doc/filetype.txt b/runtime/doc/filetype.txt index baf7550948..b6525e8494 100644 --- a/runtime/doc/filetype.txt +++ b/runtime/doc/filetype.txt @@ -595,7 +595,7 @@ Format description: ignored. 2. Each entry starts with line that has format "{type} with timestamp {timestamp}:". {timestamp} is |strftime()|-formatted string representing - actual UNIX timestamp value. First strftime() argument is equal to + actual Unix timestamp value. First strftime() argument is equal to `%Y-%m-%dT%H:%M:%S`. When writing this timestamp is parsed using |msgpack#strptime()|, with caching (it remembers which timestamp produced particular strftime() output and uses this value if you did not change diff --git a/runtime/doc/gui.txt b/runtime/doc/gui.txt index eeeeb3cd20..8d97678af2 100644 --- a/runtime/doc/gui.txt +++ b/runtime/doc/gui.txt @@ -593,10 +593,6 @@ The default menus have these priorities: When no or zero priority is given, 500 is used. The priority for the PopUp menu is not used. -The Help menu will be placed on the far right side of the menu bar on systems -which support this (GTK+). For GTK+ 2, this is not done anymore -because right-aligning the Help menu is now discouraged UI design. - You can use a priority higher than 9999, to make it go after the Help menu, but that is non-standard and is discouraged. The highest possible priority is about 32000. The lowest is 1. @@ -665,10 +661,8 @@ level. Vim interprets the items in this menu as follows: toolbar button image. Note that the exact filename is OS-specific: For example, under Win32 the command > :amenu ToolBar.Hello :echo "hello"<CR> -< would find the file 'hello.bmp'. Under GTK+/X11 it is 'Hello.xpm'. With - GTK+ 2 the files 'Hello.png', 'Hello.xpm' and 'Hello.bmp' are checked for - existence, and the first one found would be used. - For MS-Windows and GTK+ 2 the bitmap is scaled to fit the button. For +< would find the file 'hello.bmp'. Under X11 it is 'Hello.xpm'. + For MS-Windows and the bitmap is scaled to fit the button. For MS-Windows a size of 18 by 18 pixels works best. For MS-Windows the bitmap should have 16 colors with the standard palette. The light grey pixels will be changed to the Window frame color and the @@ -717,8 +711,8 @@ nr Name Normal action ~ 30 WinMinWidth make current window use few columns *hidden-menus* *win32-hidden-menus* -In the Win32 and GTK+ GUI, starting a menu name with ']' excludes that menu -from the main menu bar. You must then use the |:popup| command to display it. +In the Win32 GUI, starting a menu name with ']' excludes that menu from the +main menu bar. You must then use the |:popup| command to display it. *popup-menu* You can define the special menu "PopUp". This is the menu that is displayed @@ -871,9 +865,8 @@ a menu item - you don't need to do a :tunmenu as well. 5.9 Popup Menus -In the Win32 and GTK+ GUI, you can cause a menu to popup at the cursor. -This behaves similarly to the PopUp menus except that any menu tree can -be popped up. +In the Win32 GUI, you can cause a menu to popup at the cursor. This behaves +similarly to the PopUp menus except that any menu tree can be popped up. This command is for backwards compatibility, using it is discouraged, because it behaves in a strange way. @@ -882,7 +875,7 @@ it behaves in a strange way. :popu[p] {name} Popup the menu {name}. The menu named must have at least one subentry, but need not appear on the menu-bar (see |hidden-menus|). - {only available for Win32 and GTK GUI} + {only available for Win32 GUI} :popu[p]! {name} Like above, but use the position of the mouse pointer instead of the cursor. diff --git a/runtime/doc/gui_w32.txt b/runtime/doc/gui_w32.txt index 7bc0f5cb13..ce00600979 100644 --- a/runtime/doc/gui_w32.txt +++ b/runtime/doc/gui_w32.txt @@ -257,17 +257,6 @@ WARNING: If you close this window with the "X" button, and confirm the question if you really want to kill the application, Vim may be killed too! (This does not apply to commands run asynchronously with ":!start".) - *msdos-mode* -If you get a dialog that says "This program is set to run in MS-DOS mode..." -when you run an external program, you can solve this by changing the -properties of the associated shortcut: -- Use a Windows Explorer to find the command.com that is used. It can be - c:\command.com, c:\dos\command.com, c:\windows\command.com, etc. -- With the right mouse button, select properties of this command.com. -- In the Program tab select "Advanced". -- Unselect "MS-DOS mode". -- Click "OK" twice. - *win32-!start* Normally, Vim waits for a command to complete before continuing (this makes sense for most shell commands which produce output for Vim to use). If you diff --git a/runtime/doc/helphelp.txt b/runtime/doc/helphelp.txt index dea7dded95..f3533b8815 100644 --- a/runtime/doc/helphelp.txt +++ b/runtime/doc/helphelp.txt @@ -184,12 +184,6 @@ command: > :!xterm -e vim +help & < - *:helpfind* *:helpf* -:helpf[ind] Like |:help|, but use a dialog to enter the argument. - Only for backwards compatibility. It now executes the - ToolBar.FindHelp menu entry instead of using a builtin - dialog. {only when compiled with |+GUI_GTK|} - *:helpt* *:helptags* *E154* *E150* *E151* *E152* *E153* *E670* :helpt[ags] [++t] {dir} diff --git a/runtime/doc/index.txt b/runtime/doc/index.txt index c98f43f324..2067b0c321 100644 --- a/runtime/doc/index.txt +++ b/runtime/doc/index.txt @@ -1,4 +1,4 @@ -*index.txt* For Vim version 7.4. Last change: 2015 Jan 07 +*index.txt* For Vim version 7.4. Last change: 2015 Feb 12 VIM REFERENCE MANUAL by Bram Moolenaar @@ -700,12 +700,16 @@ tag char note action in Normal mode ~ |g'| g'{mark} 1 like |'| but without changing the jumplist |g`| g`{mark} 1 like |`| but without changing the jumplist |gstar| g* 1 like "*", but without using "\<" and "\>" +|g+| g+ go to newer text state N times +|g,| g, 1 go to N newer position in change list +|g-| g- go to older text state N times |g0| g0 1 when 'wrap' off go to leftmost character of the current line that is on the screen; when 'wrap' on go to the leftmost character of the current screen line |g8| g8 print hex value of bytes used in UTF-8 character under the cursor +|g;| g; 1 go to N older position in change list |g<| g< display previous command output |g?| g? 2 Rot13 encoding operator |g?g?| g?? 2 Rot13 encode current line @@ -734,6 +738,7 @@ tag char note action in Normal mode ~ the screen; when 'wrap' on go to the leftmost non-white character of the current screen line +|g_| g_ 1 cursor to the last CHAR N - 1 lines lower |ga| ga print ascii value of character under the cursor |gd| gd 1 go to definition of word under the cursor @@ -1241,7 +1246,6 @@ tag command action ~ |:hardcopy| :ha[rdcopy] send text to the printer |:help| :h[elp] open a help window |:helpclose| :helpc[lose] close one help window -|:helpfind| :helpf[ind] dialog to open a help window |:helpgrep| :helpg[rep] like ":grep" but searches help files |:helptags| :helpt[ags] generate help tags for a directory |:highlight| :hi[ghlight] specify highlighting methods diff --git a/runtime/doc/insert.txt b/runtime/doc/insert.txt index 013eb6b97b..cb01d5fe92 100644 --- a/runtime/doc/insert.txt +++ b/runtime/doc/insert.txt @@ -1941,9 +1941,9 @@ If the 'fileformats' option is not empty Vim tries to recognize the type of changed, the detected format is only used while reading the file. A similar thing happens with 'fileencodings'. -On non-MS-DOS and Win32 systems the message "[dos format]" is shown if +On non-Windows systems the message "[dos format]" is shown if a file is read in DOS format, to remind you that something unusual is done. -On Macintosh, MS-DOS, and Win32 the message "[unix format]" is shown if +On Macintosh and Windows the message "[unix format]" is shown if a file is read in Unix format. On non-Macintosh systems, the message "[Mac format]" is shown if a file is read in Mac format. diff --git a/runtime/doc/intro.txt b/runtime/doc/intro.txt index 431b6e1ad7..fdf106a7bb 100644 --- a/runtime/doc/intro.txt +++ b/runtime/doc/intro.txt @@ -251,7 +251,7 @@ Vim would never have become what it is now, without the help of these people! lots of patches Ingo Wilken Tcl interface Mike Williams PostScript printing - Juergen Weigert Lattice version, AUX improvements, UNIX and + Juergen Weigert Lattice version, AUX improvements, Unix and MS-DOS ports, autoconf Stefan 'Sec' Zehl Maintainer of vim.org diff --git a/runtime/doc/mbyte.txt b/runtime/doc/mbyte.txt index 02c00bc03b..c87ed317d4 100644 --- a/runtime/doc/mbyte.txt +++ b/runtime/doc/mbyte.txt @@ -97,14 +97,6 @@ is the difficult part. It depends on the system you are using, the locale and a few other things. See the chapters on fonts: |mbyte-fonts-X11| for X-Windows and |mbyte-fonts-MSwin| for MS-Windows. -For GTK+ 2, you can skip most of this section. The option 'guifontset' does -no longer exist. You only need to set 'guifont' and everything should "just -work". If your system comes with Xft2 and fontconfig and the current font -does not contain a certain glyph, a different font will be used automatically -if available. The 'guifontwide' option is still supported but usually you do -not need to set it. It is only necessary if the automatic font selection does -not suit your needs. - For X11 you can set the 'guifontset' option to a list of fonts that together cover the characters that are used. Example for Korean: > @@ -484,11 +476,6 @@ For Vim you may need to set 'encoding' to "utf-8". Unfortunately, using fonts in X11 is complicated. The name of a single-byte font is a long string. For multi-byte fonts we need several of these... -Note: Most of this is no longer relevant for GTK+ 2. Selecting a font via -its XLFD is not supported; see 'guifont' for an example of how to -set the font. Do yourself a favor and ignore the |XLFD| and |xfontset| -sections below. - First of all, Vim only accepts fixed-width fonts for displaying text. You cannot use proportionally spaced fonts. This excludes many of the available (and nicer looking) fonts. However, for menus and tooltips any font can be @@ -791,20 +778,6 @@ For example, when you are using kinput2 as |IM-server| and sh, > export XMODIFIERS="@im=kinput2" < -FULLY CONTROLLED XIM - -You can fully control XIM, like with IME of MS-Windows (see |multibyte-ime|). -This is currently only available for the GTK GUI. - -Before using fully controlled XIM, one setting is required. Set the -'imactivatekey' option to the key that is used for the activation of the input -method. For example, when you are using kinput2 + canna as IM Server, the -activation key is probably Shift+Space: > - - :set imactivatekey=S-space - -See 'imactivatekey' for the format. - ============================================================================== 8. Input on MS-Windows *mbyte-IME* @@ -1142,14 +1115,12 @@ internally. Vim has comprehensive UTF-8 support. It works well in: - xterm with utf-8 support enabled -- Motif and GTK GUI - MS-Windows GUI - several other platforms Double-width characters are supported. This works best with 'guifontwide' or 'guifontset'. When using only 'guifont' the wide characters are drawn in the -normal width and a space to fill the gap. Note that the 'guifontset' option -is no longer relevant in the GTK+ 2 GUI. +normal width and a space to fill the gap. *bom-bytes* When reading a file a BOM (Byte Order Mark) can be used to recognize the @@ -1219,8 +1190,6 @@ doesn't always work. See the system specific remarks below, and 'langmenu'. USING UTF-8 IN X-Windows *utf-8-in-xwindows* -Note: This section does not apply to the GTK+ 2 GUI. - You need to specify a font to be used. For double-wide characters another font is required, which is exactly twice as wide. There are three ways to do this: diff --git a/runtime/doc/message.txt b/runtime/doc/message.txt index 2ef2a67c4a..114bb61d99 100644 --- a/runtime/doc/message.txt +++ b/runtime/doc/message.txt @@ -401,12 +401,6 @@ You have used an ":unabbreviate" command with an argument which is not an existing abbreviation. All variations of this command give the same message: ":cunabbrev", ":iunabbrev", etc. Check for trailing white space. -> - /dev/dsp: No such file or directory - -Only given for GTK GUI with Gnome support. Gnome tries to use the audio -device and it isn't present. You can ignore this error. - *E31* > No such mapping diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt index 718125d9dc..013e7c742c 100644 --- a/runtime/doc/options.txt +++ b/runtime/doc/options.txt @@ -183,7 +183,7 @@ the option value, use '\"' instead. This example sets the 'titlestring' option to 'hi "there"': > :set titlestring=hi\ \"there\" -For MS-DOS and WIN32 backslashes in file names are mostly not removed. More +For Windows backslashes in file names are mostly not removed. More precise: For options that expect a file name (those where environment variables are expanded) a backslash before a normal file name character is not removed. But a backslash before a special character (space, backslash, comma, @@ -488,11 +488,11 @@ number can be specified where "vim:" or "Vim:" is used: vim<{vers}: version before {vers} vim={vers}: version {vers} vim>{vers}: version after {vers} -{vers} is 600 for Vim 6.0 (hundred times the major version plus minor). -For example, to use a modeline only for Vim 6.0 and later: - /* vim600: set foldmethod=marker: */ ~ -To use a modeline for Vim before version 5.7: - /* vim<570: set sw=4: */ ~ +{vers} is 700 for Vim 7.0 (hundred times the major version plus minor). +For example, to use a modeline only for Vim 7.0: + /* vim700: set foldmethod=marker */ ~ +To use a modeline for Vim after version 7.2: + /* vim>702: set cole=2: */ ~ There can be no blanks between "vim" and the ":". @@ -772,14 +772,14 @@ A jump table for the options with a short description can be found at |Q_op|. putting a ":gui" command in the gvimrc file, before where the value of 'background' is used (e.g., before ":syntax on"). - For MS-DOS and Windows the default is "dark". + For Windows the default is "dark". For other systems "dark" is used when 'term' is "linux", "screen.linux", "cygwin" or "putty", or $COLORFGBG suggests a dark background. Otherwise the default is "light". Normally this option would be set in the vimrc file. Possibly depending on the terminal name. Example: > - :if &term == "pcterm" + :if &term == "xterm" : set background=dark :endif < When this option is set, the default settings for the highlight groups @@ -900,7 +900,7 @@ A jump table for the options with a short description can be found at |Q_op|. impossible!). Writing may fail because of this. - A directory "." means to put the backup file in the same directory as the edited file. - - A directory starting with "./" (or ".\" for MS-DOS et al.) means to + - A directory starting with "./" (or ".\" for Windows) means to put the backup file relative to where the edited file is. The leading "." is replaced with the path name of the edited file. ("." inside a directory name has no special meaning). @@ -1110,7 +1110,7 @@ A jump table for the options with a short description can be found at |Q_op|. *'browsedir'* *'bsdir'* 'browsedir' 'bsdir' string (default: "last") global - {only for Motif, GTK, Mac and Win32 GUI} + {only for Mac and Win32 GUI} Which directory to use for the file browser: last Use same directory as with last file browser, where a file was opened or saved. @@ -1193,8 +1193,9 @@ A jump table for the options with a short description can be found at |Q_op|. nofile only: The buffer name is fixed, it is not handled like a file name. It is not modified in response to a |:cd| command. - nofile only: When using ":e bufname" and already editing "bufname" - nothing changes, since there is no file to edit. + both: When using ":e bufname" and already editing "bufname" + the buffer is made empty and autocommands are + triggered as usual for |:edit|. *E676* "acwrite" implies that the buffer name is not related to a file, like "nofile", but it will be written. Thus, in contrast to "nofile" and @@ -2074,7 +2075,7 @@ A jump table for the options with a short description can be found at |Q_op|. the edited file. On Unix, a dot is prepended to the file name, so it doesn't show in a directory listing. On MS-Windows the "hidden" attribute is set and a dot prepended if possible. - - A directory starting with "./" (or ".\" for MS-DOS et al.) means to + - A directory starting with "./" (or ".\" for Windows) means to put the swap file relative to where the edited file is. The leading "." is replaced with the path name of the edited file. - For Unix and Win32, if a directory ends in two path separators "//" @@ -2394,7 +2395,7 @@ A jump table for the options with a short description can be found at |Q_op|. is read. *'fileformat'* *'ff'* -'fileformat' 'ff' string (MS-DOS and MS-Windows default: "dos", +'fileformat' 'ff' string (Windows default: "dos", Unix default: "unix", Macintosh default: "mac") local to buffer @@ -2438,8 +2439,8 @@ A jump table for the options with a short description can be found at |Q_op|. 2. If a <NL> is found and 'fileformats' includes "unix", 'fileformat' is set to "unix". Note that when a <NL> is found without a preceding <CR>, "unix" is preferred over "dos". - 3. If 'fileformat' has not yet been set, and if 'fileformats' - includes "mac", 'fileformat' is set to "mac". + 3. If 'fileformat' has not yet been set, and if a <CR> is found, and + if 'fileformats' includes "mac", 'fileformat' is set to "mac". This means that "mac" is only chosen when: "unix" is not present or no <NL> is found in the file, and "dos" is not present or no <CR><NL> is found in the file. @@ -2812,7 +2813,6 @@ A jump table for the options with a short description can be found at |Q_op|. will force the harddrive to spin up on Linux systems running in laptop mode, so it may be undesirable in some situations. Be warned that turning this off increases the chances of data loss after a crash. - Also see 'swapsync' for controlling fsync() on swap files. *'gdefault'* *'gd'* *'nogdefault'* *'nogd'* 'gdefault' 'gd' boolean (default off) @@ -2865,14 +2865,14 @@ A jump table for the options with a short description can be found at |Q_op|. r-cr:hor20-Cursor/lCursor, sm:block-Cursor -blinkwait175-blinkoff150-blinkon175", - for MS-DOS and Win32 console: + for Windows console: "n-v-c:block,o:hor50,i-ci:hor15, r-cr:hor30,sm:block") global {only available when compiled with GUI enabled, and - for MS-DOS and Win32 console} + for Windows console} This option tells Vim what the cursor should look like in different - modes. It fully works in the GUI. In an MSDOS or Win32 console, only + modes. It fully works in the GUI. In a Windows console, only the height of the cursor can be changed. This can be done by specifying a block cursor, or a percentage for a vertical or horizontal cursor. @@ -2971,28 +2971,18 @@ A jump table for the options with a short description can be found at |Q_op|. the case of X). The font names given should be "normal" fonts. Vim will try to find the related bold and italic fonts. - For Win32, GTK, Motif, and Mac OS: > + For Win32 and Mac OS: > :set guifont=* < will bring up a font requester, where you can pick the font you want. The font name depends on the GUI used. See |setting-guifont| for a way to set 'guifont' for various systems. - For the GTK+ 2 GUI the font name looks like this: > - :set guifont=Andale\ Mono\ 11 -< That's all. XLFDs are not used. For Chinese this is reported to work - well: > - if has("gui_gtk2") - set guifont=Bitstream\ Vera\ Sans\ Mono\ 12,Fixed\ 12 - set guifontwide=Microsoft\ Yahei\ 12,WenQuanYi\ Zen\ Hei\ 12 - endif -< For Mac OSX you can use something like this: > :set guifont=Monaco:h10 < *E236* Note that the fonts must be mono-spaced (all characters have the same - width). An exception is GTK 2: all fonts are accepted, but - mono-spaced fonts look best. + width). To preview a font on X11, you might be able to use the "xfontsel" program. The "xlsfonts" program gives a list of all available fonts. @@ -3025,7 +3015,6 @@ A jump table for the options with a short description can be found at |Q_op|. global {only available when compiled with GUI enabled and with the |+xfontset| feature} - {not available in the GTK+ 2 GUI} When not empty, specifies two (or more) fonts to be used. The first one for normal English, the second one for your special language. See |xfontset|. @@ -3053,24 +3042,12 @@ A jump table for the options with a short description can be found at |Q_op|. Note: The size of these fonts must be exactly twice as wide as the one specified with 'guifont' and the same height. - All GUI versions but GTK+ 2: - 'guifontwide' is only used when 'encoding' is set to "utf-8" and 'guifontset' is empty or invalid. When 'guifont' is set and a valid font is found in it and 'guifontwide' is empty Vim will attempt to find a matching double-width font and set 'guifontwide' to it. - GTK+ 2 GUI only: *guifontwide_gtk2* - - If set and valid, 'guifontwide' is always used for double width - characters, even if 'encoding' is not set to "utf-8". - Vim does not attempt to find an appropriate value for 'guifontwide' - automatically. If 'guifontwide' is empty Pango/Xft will choose the - font for characters not available in 'guifont'. Thus you do not need - to set 'guifontwide' at all unless you want to override the choice - made by Pango/Xft. - Windows +multibyte only: *guifontwide_win_mbyte* If set and valid, 'guifontwide' is used for IME instead of 'guifont'. @@ -3078,7 +3055,7 @@ A jump table for the options with a short description can be found at |Q_op|. *'guiheadroom'* *'ghr'* 'guiheadroom' 'ghr' number (default 50) global - {only for GTK and X11 GUI} + {only for X11 GUI} The number of pixels subtracted from the screen height when fitting the GUI window on the screen. Set this before the GUI is started, e.g., in your |gvimrc| file. When zero, the whole screen height will @@ -3088,8 +3065,7 @@ A jump table for the options with a short description can be found at |Q_op|. screen. *'guioptions'* *'go'* -'guioptions' 'go' string (default "egmrLT" (MS-Windows), - "aegimrLT" (GTK and Motif)) +'guioptions' 'go' string (default "egmrLT" (MS-Windows)) global {only available when compiled with GUI enabled} This option only has an effect in the GUI version of Vim. It is a @@ -3135,10 +3111,9 @@ A jump table for the options with a short description can be found at |Q_op|. 'guitablabel' can be used to change the text in the labels. When 'e' is missing a non-GUI tab pages line may be used. The GUI tabs are only supported on some systems, currently - GTK, Motif, Mac OS/X and MS-Windows. + Mac OS/X and MS-Windows. *'go-i'* - 'i' Use a Vim icon. For GTK with KDE it is used in the left-upper - corner of the window. + 'i' Use a Vim icon. *'go-m'* 'm' Menu bar is present. *'go-M'* @@ -3151,8 +3126,7 @@ A jump table for the options with a short description can be found at |Q_op|. 'g' Grey menu items: Make menu items that are not active grey. If 'g' is not included inactive menu items are not shown at all. *'go-T'* - 'T' Include Toolbar. Currently only in Win32, GTK+, and - Motif GUIs. + 'T' Include Toolbar. Currently only in Win32 GUI. *'go-r'* 'r' Right-hand scrollbar is always present. *'go-R'* @@ -3436,54 +3410,10 @@ A jump table for the options with a short description can be found at |Q_op|. |/ignorecase|. *'imactivatefunc'* *'imaf'* -'imactivatefunc' 'imaf' string (default "") - global - {only available when compiled with |+xim| and - |+GUI_GTK|} - This option specifies a function that will be called to - activate/inactivate Input Method. +'imactivatefunc' 'imaf' Removed. |vim-differences| {Nvim} - Example: > - function ImActivateFunc(active) - if a:active - ... do something - else - ... do something - endif - " return value is not used - endfunction - set imactivatefunc=ImActivateFunc -< *'imactivatekey'* *'imak'* -'imactivatekey' 'imak' string (default "") - global - {only available when compiled with |+xim| and - |+GUI_GTK|} *E599* - Specifies the key that your Input Method in X-Windows uses for - activation. When this is specified correctly, vim can fully control - IM with 'imcmdline', 'iminsert' and 'imsearch'. - You can't use this option to change the activation key, the option - tells Vim what the key is. - Format: - [MODIFIER_FLAG-]KEY_STRING - - These characters can be used for MODIFIER_FLAG (case is ignored): - S Shift key - L Lock key - C Control key - 1 Mod1 key - 2 Mod2 key - 3 Mod3 key - 4 Mod4 key - 5 Mod5 key - Combinations are allowed, for example "S-C-space" or "SC-space" are - both shift+ctrl+space. - See <X11/keysymdef.h> and XStringToKeysym for KEY_STRING. - - Example: > - :set imactivatekey=S-space -< "S-space" means shift+space. This is the activation key for kinput2 + - canna (Japanese), and ami (Korean). +'imactivatekey' 'imak' Removed. |vim-differences| {Nvim} *'imcmdline'* *'imc'* *'noimcmdline'* *'noimc'* 'imcmdline' 'imc' boolean (default off) @@ -3542,21 +3472,7 @@ A jump table for the options with a short description can be found at |Q_op|. option to a valid keymap name. *'imstatusfunc'* *'imsf'* -'imstatusfunc' 'imsf' string (default "") - global - {only available when compiled with |+xim| and - |+GUI_GTK|} - This option specifies a function that is called to obtain the status - of Input Method. It must return a positive number when IME is active. - - Example: > - function ImStatusFunc() - let is_active = ...do something - return is_active ? 1 : 0 - endfunction - set imstatusfunc=ImStatusFunc -< - NOTE: This function is invoked very often. Keep it fast. +'imstatusfunc' 'imsf' Removed. |vim-differences| {Nvim} *'include'* *'inc'* 'include' 'inc' string (default "^\s*#\s*include") @@ -3698,7 +3614,7 @@ A jump table for the options with a short description can be found at |Q_op|. When executing commands with |:normal| 'insertmode' is not used. *'isfname'* *'isf'* -'isfname' 'isf' string (default for MS-DOS and Win32: +'isfname' 'isf' string (default for Windows: "@,48-57,/,\,.,-,_,+,,,#,$,%,{,},[,],:,@-@,!,~,=" otherwise: "@,48-57,/,.,-,_,+,,,#,$,%,~,=") global @@ -3749,7 +3665,7 @@ A jump table for the options with a short description can be found at |Q_op|. See |option-backslash| about including spaces and backslashes. *'isident'* *'isi'* -'isident' 'isi' string (default for MS-DOS and Win32: +'isident' 'isi' string (default for Windows: "@,48-57,_,128-167,224-235" otherwise: "@,48-57,_,192-255") global @@ -4372,7 +4288,7 @@ A jump table for the options with a short description can be found at |Q_op|. The mouse pointer is restored when the mouse is moved. *'mousemodel'* *'mousem'* -'mousemodel' 'mousem' string (default "extend", "popup" for MS-DOS and Win32) +'mousemodel' 'mousem' string (default "extend", "popup" for Windows) global Sets the model to use for the mouse. The name mostly specifies what the right mouse button is used for: @@ -4474,7 +4390,7 @@ A jump table for the options with a short description can be found at |Q_op|. *'mousetime'* *'mouset'* 'mousetime' 'mouset' number (default 500) global - Only for GUI, MS-DOS, Win32 and Unix with xterm. Defines the maximum + Only for GUI, Windows and Unix with xterm. Defines the maximum time in msec between two mouse clicks for the second click to be recognized as a multi click. @@ -4555,11 +4471,11 @@ A jump table for the options with a short description can be found at |Q_op|. *'opendevice'* *'odev'* *'noopendevice'* *'noodev'* 'opendevice' 'odev' boolean (default off) global - {only for MS-DOS and MS-Windows} + {only for Windows} Enable reading and writing from devices. This may get Vim stuck on a device that can be opened but doesn't actually do the I/O. Therefore it is off by default. - Note that on MS-Windows editing "aux.h", "lpt1.txt" and the like also + Note that on Windows editing "aux.h", "lpt1.txt" and the like also result in editing a device. @@ -5333,7 +5249,7 @@ A jump table for the options with a short description can be found at |Q_op|. r Removable media. The argument is a string (up to the next ','). This parameter can be given several times. Each specifies the start of a path for which no marks will be - stored. This is to avoid removable media. For MS-DOS you + stored. This is to avoid removable media. For Windows you could use "ra:,rb:". You can also use it for temp files, e.g., for Unix: "r/tmp". Case is ignored. *shada-s* @@ -5371,8 +5287,7 @@ A jump table for the options with a short description can be found at |Q_op|. *'shell'* *'sh'* *E91* 'shell' 'sh' string (default $SHELL or "sh", - MS-DOS and Win32: "command.com" or - "cmd.exe") + Windows: "cmd.exe") global Name of the shell to use for ! and :! commands. When changing the value also check these options: 'shellpipe', 'shellslash' @@ -5414,11 +5329,11 @@ A jump table for the options with a short description can be found at |Q_op|. *'shellcmdflag'* *'shcf'* 'shellcmdflag' 'shcf' string (default: "-c"; - MS-DOS and Win32, when 'shell' does not + Windows, when 'shell' does not contain "sh" somewhere: "/c") global Flag passed to the shell to execute "!" and ":!" commands; e.g., - "bash.exe -c ls" or "command.com /c dir". For the MS-DOS-like + "bash.exe -c ls" or "cmd.exe /c dir". For Windows systems, the default is set according to the value of 'shell', to reduce the need to set this option by the user. On Unix it can have more than one flag. Each white space separated @@ -5426,7 +5341,7 @@ A jump table for the options with a short description can be found at |Q_op|. See |option-backslash| about including spaces and backslashes. See |shell-unquoting| which talks about separating this option into multiple arguments. - Also see |dos-shell| for MS-DOS and MS-Windows. + Also see |dos-shell| for Windows. This option cannot be set from a |modeline| or in the |sandbox|, for security reasons. @@ -5441,7 +5356,7 @@ A jump table for the options with a short description can be found at |Q_op|. The name of the temporary file can be represented by "%s" if necessary (the file name is appended automatically if no %s appears in the value of this option). - For MS-DOS the default is ">". The output is directly saved in a file + For Windows the default is ">". The output is directly saved in a file and not echoed to the screen. For Unix the default it "| tee". The stdout of the compiler is saved in a file and echoed to the screen. If the 'shell' option is "csh" or @@ -5465,7 +5380,7 @@ A jump table for the options with a short description can be found at |Q_op|. security reasons. *'shellquote'* *'shq'* -'shellquote' 'shq' string (default: ""; MS-DOS and Win32, when 'shell' +'shellquote' 'shq' string (default: ""; Windows, when 'shell' contains "sh" somewhere: "\"") global Quoting character(s), put around the command passed to the shell, for @@ -5473,7 +5388,7 @@ A jump table for the options with a short description can be found at |Q_op|. quoting. See 'shellxquote' to include the redirection. It's probably not useful to set both options. This is an empty string by default. Only known to be useful for - third-party shells on MS-DOS-like systems, such as the MKS Korn Shell + third-party shells on Windows systems, such as the MKS Korn Shell or bash, where it should be "\"". The default is adjusted according the value of 'shell', to reduce the need to set this option by the user. See |dos-shell|. @@ -5538,7 +5453,7 @@ A jump table for the options with a short description can be found at |Q_op|. *'shellxescape'* *'sxe'* 'shellxescape' 'sxe' string (default: ""; - for MS-DOS and MS-Windows: "\"&|<>()@^") + for Windows: "\"&|<>()@^") global When 'shellxquote' is set to "(" then the characters listed in this option will be escaped with a '^' character. This makes it possible @@ -5707,8 +5622,7 @@ A jump table for the options with a short description can be found at |Q_op|. Use the 'M' flag in 'highlight' to set the type of highlighting for this message. When |XIM| may be used the message will include "XIM". But this - doesn't mean XIM is really active, especially when 'imactivatekey' is - not set. + doesn't mean XIM is really active. *'showtabline'* *'stal'* 'showtabline' 'stal' number (default 1) @@ -6204,7 +6118,7 @@ A jump table for the options with a short description can be found at |Q_op|. When 'swapfile' is reset, the swap file for the current buffer is immediately deleted. When 'swapfile' is set, and 'updatecount' is non-zero, a swap file is immediately created. - Also see |swap-file| and |'swapsync'|. + Also see |swap-file|. If you want to open a new buffer without creating a swap file for it, use the |:noswapfile| modifier. @@ -6212,16 +6126,7 @@ A jump table for the options with a short description can be found at |Q_op|. specify special kinds of buffers. See |special-buffers|. *'swapsync'* *'sws'* -'swapsync' 'sws' string (default "fsync") - global - When this option is not empty a swap file is synced to disk after - writing to it. This takes some time, especially on busy Unix systems. - When this option is empty parts of the swap file may be in memory and - not written to disk. When the system crashes you may lose more work. - On Unix the system does a sync now and then without Vim asking for it, - so the disadvantage of setting this option off is small. On some - systems the swap file will not be written at all. - The 'fsync' option is used for the actual file. +'swapsync' 'sws' Removed. |vim-differences| {Nvim} *'switchbuf'* *'swb'* 'switchbuf' 'swb' string (default "") @@ -6436,9 +6341,8 @@ A jump table for the options with a short description can be found at |Q_op|. 'term' string (default is $TERM, if that fails: in the GUI: "builtin_gui" on Mac: "mac-ansi" - on MS-DOS: "pcterm" on Unix: "ansi" - on Win 32: "win32") + on Windows: "win32") global Name of the terminal. Used for choosing the terminal control characters. Environment variables are expanded |:set_env|. @@ -6708,7 +6612,6 @@ A jump table for the options with a short description can be found at |Q_op|. When 'updatecount' is set from zero to non-zero, swap files are created for all buffers that have 'swapfile' set. When 'updatecount' is set to zero, existing swap files are not deleted. - Also see |'swapsync'|. This option has no meaning in buffers where |'buftype'| is "nofile" or "nowrite". @@ -7012,7 +6915,7 @@ A jump table for the options with a short description can be found at |Q_op|. *'winaltkeys'* *'wak'* 'winaltkeys' 'wak' string (default "menu") global - {only used in Win32, Motif, and GTK} + {only used in Win32} Some GUI versions allow the access to menu entries by using the ALT key in combination with a character that appears underlined in the menu. This conflicts with the use of the ALT key for mappings and @@ -7027,8 +6930,7 @@ A jump table for the options with a short description can be found at |Q_op|. keys can be mapped. If the menu is disabled by excluding 'm' from 'guioptions', the ALT key is never used for the menu. - This option is not used for <F10>; on Win32 and with GTK <F10> will - select the menu, unless it has been mapped. + This option is not used for <F10>; on Win32. *'window'* *'wi'* 'window' 'wi' number (default screen height - 1) @@ -7196,6 +7098,6 @@ A jump table for the options with a short description can be found at |Q_op|. global The number of microseconds to wait for each character sent to the screen. When non-zero, characters are sent to the terminal one by - one. For MS-DOS pcterm this does not work. For debugging purposes. + one. For debugging purposes. vim:tw=78:ts=8:ft=help:noet:norl: diff --git a/runtime/doc/pattern.txt b/runtime/doc/pattern.txt index 1a76a4749a..84dce82176 100644 --- a/runtime/doc/pattern.txt +++ b/runtime/doc/pattern.txt @@ -1,4 +1,4 @@ -*pattern.txt* For Vim version 7.4. Last change: 2014 Sep 06 +*pattern.txt* For Vim version 7.4. Last change: 2015 Mar 16 VIM REFERENCE MANUAL by Bram Moolenaar @@ -59,6 +59,8 @@ explanations are in chapter 27 |usr_27.txt|. *n* n Repeat the latest "/" or "?" [count] times. + If the cursor doesn't move the search is repeated with + count + 1. |last-pattern| *N* @@ -129,7 +131,7 @@ gD Goto global Declaration. When the cursor is on a *CTRL-C* CTRL-C Interrupt current (search) command. Use CTRL-Break on - MS-DOS |dos-CTRL-Break|. + Windows |dos-CTRL-Break|. In Normal mode, any pending command is aborted. *:noh* *:nohlsearch* @@ -1050,7 +1052,10 @@ x A single character, with no special meaning, matches itself *E769* When the ']' is not there Vim will not give an error message but assume no collection is used. Useful to search for '['. However, you - do get E769 for internal searching. + do get E769 for internal searching. And be aware that in a + `:substitute` command the whole command becomes the pattern. E.g. + ":s/[/x/" searches for "[/x" and replaces it with nothing. It does + not search for "[" and replaces it with "x"! If the sequence begins with "^", it matches any single character NOT in the collection: "[^xyz]" matches anything but 'x', 'y' and 'z'. @@ -1082,7 +1087,7 @@ x A single character, with no special meaning, matches itself *[:backspace:]* [:backspace:] the <BS> character The brackets in character class expressions are additional to the brackets delimiting a collection. For example, the following is a - plausible pattern for a UNIX filename: "[-./[:alnum:]_~]\+" That is, + plausible pattern for a Unix filename: "[-./[:alnum:]_~]\+" That is, a list of at least one character, each of which is either '-', '.', '/', alphabetic, numeric, '_' or '~'. These items only work for 8-bit characters. diff --git a/runtime/doc/quickfix.txt b/runtime/doc/quickfix.txt index 399933b512..bcce5a983a 100644 --- a/runtime/doc/quickfix.txt +++ b/runtime/doc/quickfix.txt @@ -587,11 +587,11 @@ or simpler > "$*" can be given multiple times, for example: > :set makeprg=gcc\ -o\ $*\ $* -The 'shellpipe' option defaults to ">" for MS-DOS and Win32. This means that -the output of the compiler is saved in a file and not shown on the screen -directly. For Unix "| tee" is used. The compiler output is shown on the -screen and saved in a file the same time. Depending on the shell used "|& -tee" or "2>&1| tee" is the default, so stderr output will be included. +The 'shellpipe' option defaults to ">" on Windows. This means that the output +of the compiler is saved in a file and not shown on the screen directly. For +Unix "| tee" is used. The compiler output is shown on the screen and saved in +a file the same time. Depending on the shell used "|& tee" or "2>&1| tee" is +the default, so stderr output will be included. If 'shellpipe' is empty, the {errorfile} part will be omitted. This is useful for compilers that write to an errorfile themselves. @@ -999,9 +999,9 @@ normally happens by matching following characters and items. When nothing is following the rest of the line is matched. If "%f" is followed by a '%' or a backslash, it will look for a sequence of 'isfname' characters. -On MS-DOS and MS-Windows a leading "C:" will be included in "%f", even when -using "%f:". This means that a file name which is a single alphabetical -letter will not be detected. +On Windows a leading "C:" will be included in "%f", even when using "%f:". +This means that a file name which is a single alphabetical letter will not be +detected. The "%p" conversion is normally followed by a "^". It's used for compilers that output a line like: > diff --git a/runtime/doc/quickref.txt b/runtime/doc/quickref.txt index 1346a83fdd..ded5e69438 100644 --- a/runtime/doc/quickref.txt +++ b/runtime/doc/quickref.txt @@ -730,13 +730,10 @@ Short explanation of each option: *option-list* 'icon' let Vim set the text of the window icon 'iconstring' string to use for the Vim icon text 'ignorecase' 'ic' ignore case in search patterns -'imactivatekey' 'imak' key that activates the X input method -'imactivatefunc' 'imaf' function to enable/disable the X input method 'imcmdline' 'imc' use IM when starting to edit a command line 'imdisable' 'imd' do not use the IM in any mode 'iminsert' 'imi' use :lmap or IM in Insert mode 'imsearch' 'ims' use :lmap or IM when typing a search pattern -'imstatusfunc' 'imsf' function to obtain X input method status 'include' 'inc' pattern to be used to find an include file 'includeexpr' 'inex' expression used to process an include line 'incsearch' 'is' highlight match while typing search pattern @@ -873,7 +870,6 @@ Short explanation of each option: *option-list* 'suffixes' 'su' suffixes that are ignored with multiple match 'suffixesadd' 'sua' suffixes added when searching for a file 'swapfile' 'swf' whether to use a swapfile for a buffer -'swapsync' 'sws' how to sync the swap file 'switchbuf' 'swb' sets behavior when switching to another buffer 'synmaxcol' 'smc' maximum column to find syntax items 'syntax' 'syn' syntax to be loaded for current buffer @@ -984,11 +980,9 @@ Short explanation of each option: *option-list* |g_CTRL-G| g CTRL-G show cursor column, line, and character position |CTRL-C| CTRL-C during searches: Interrupt the search -|dos-CTRL-Break| CTRL-Break MS-DOS: during searches: Interrupt the search +|dos-CTRL-Break| CTRL-Break Windows: during searches: Interrupt the search |<Del>| <Del> while entering a count: delete last character |:version| :ve[rsion] show version information -|:mode| :mode N MS-DOS: set screen mode to N (number, C80, - C4350, etc.) |:normal| :norm[al][!] {commands} execute Normal mode commands |Q| Q switch to "Ex" mode diff --git a/runtime/doc/recover.txt b/runtime/doc/recover.txt index 34a579f499..e09138b2f5 100644 --- a/runtime/doc/recover.txt +++ b/runtime/doc/recover.txt @@ -60,7 +60,7 @@ Disadvantages: If you want to put swap files in a fixed place, put a command resembling the following ones in your vimrc: :set dir=~/tmp (for Unix) - :set dir=c:\\tmp (for MS-DOS and Win32) + :set dir=c:\\tmp (for Windows) This is also very handy when editing files on floppy. Of course you will have to create that "tmp" directory for this to work! @@ -92,10 +92,7 @@ changed, not when you only moved around. The reason why it is not kept up to date all the time is that this would slow down normal work too much. You can change the 200 character count with the 'updatecount' option. You can set the time with the 'updatetime' option. The time is given in milliseconds. -After writing to the swap file Vim syncs the file to disk. This takes some -time, especially on busy Unix systems. If you don't want this you can set the -'swapsync' option to an empty string. The risk of losing work becomes bigger -though. +After writing to the swap file Vim syncs the file to disk. If the writing to the swap file is not wanted, it can be switched off by setting the 'updatecount' option to 0. The same is done when starting Vim diff --git a/runtime/doc/remote.txt b/runtime/doc/remote.txt index 81ab72a100..933ab3a444 100644 --- a/runtime/doc/remote.txt +++ b/runtime/doc/remote.txt @@ -1,4 +1,4 @@ -*remote.txt* For Vim version 7.4. Last change: 2008 May 24 +*remote.txt* For Vim version 7.4. Last change: 2015 Mar 01 VIM REFERENCE MANUAL by Bram Moolenaar @@ -34,7 +34,8 @@ The following command line arguments are available: The remote Vim is raised. If you don't want this use > vim --remote-send "<C-\><C-N>:n filename<CR>" -< --remote-silent [+{cmd}] {file} ... *--remote-silent* +< + --remote-silent [+{cmd}] {file} ... *--remote-silent* As above, but don't complain if there is no server and the file is edited locally. --remote-wait [+{cmd}] {file} ... *--remote-wait* diff --git a/runtime/doc/repeat.txt b/runtime/doc/repeat.txt index d029391c60..59dbbf3067 100644 --- a/runtime/doc/repeat.txt +++ b/runtime/doc/repeat.txt @@ -287,13 +287,13 @@ with CTRL-V followed by the three digit decimal code. This does NOT work for the <t_xx> termcap codes, these can only be used in mappings. *:source_crnl* *W15* -MS-DOS and Win32: Files that are read with ":source" normally have -<CR><NL> <EOL>s. These always work. If you are using a file with <NL> <EOL>s -(for example, a file made on Unix), this will be recognized if 'fileformats' -is not empty and the first line does not end in a <CR>. This fails if the -first line has something like ":map <F1> :help^M", where "^M" is a <CR>. If -the first line ends in a <CR>, but following ones don't, you will get an error -message, because the <CR> from the first lines will be lost. +Windows: Files that are read with ":source" normally have <CR><NL> <EOL>s. +These always work. If you are using a file with <NL> <EOL>s (for example, a +file made on Unix), this will be recognized if 'fileformats' is not empty and +the first line does not end in a <CR>. This fails if the first line has +something like ":map <F1> :help^M", where "^M" is a <CR>. If the first line +ends in a <CR>, but following ones don't, you will get an error message, +because the <CR> from the first lines will be lost. Mac Classic: Files that are read with ":source" normally have <CR> <EOL>s. These always work. If you are using a file with <NL> <EOL>s (for example, a @@ -303,7 +303,7 @@ linebreaks which has a <CR> in first line. On other systems, Vim expects ":source"ed files to end in a <NL>. These always work. If you are using a file with <CR><NL> <EOL>s (for example, a -file made on MS-DOS), all lines will have a trailing <CR>. This may cause +file made on Windows), all lines will have a trailing <CR>. This may cause problems for some commands (e.g., mappings). There is no automatic <EOL> detection, because it's common to start with a line that defines a mapping that ends in a <CR>, which will confuse the automaton. @@ -390,7 +390,7 @@ To enter debugging mode use one of these methods: useful to find out what is happening when Vim is starting up. A side effect is that Vim will switch the terminal mode before initialisations have finished, with unpredictable results. - For a GUI-only version (Windows, Macintosh) the debugging will start as + For a GUI-only version (Windows) the debugging will start as soon as the GUI window has been opened. To make this happen early, add a ":gui" command in the vimrc file. *:debug* @@ -658,10 +658,6 @@ long you take to respond to the input() prompt is irrelevant. Profiling should give a good indication of where time is spent, but keep in mind there are various things that may clobber the results: -- The accuracy of the time measured depends on the gettimeofday() system - function. It may only be as accurate as 1/100 second, even though the times - are displayed in micro seconds. - - Real elapsed time is measured, if other processes are busy they may cause delays at unpredictable moments. You may want to run the profiling several times and use the lowest results. diff --git a/runtime/doc/scroll.txt b/runtime/doc/scroll.txt index 0b3d45e969..f2a6f713e6 100644 --- a/runtime/doc/scroll.txt +++ b/runtime/doc/scroll.txt @@ -245,26 +245,6 @@ dragging the scrollbar of the current window. How many lines are scrolled depends on your mouse driver. If the scroll action causes input focus problems, see |intellimouse-wheel-problems|. -For the X11 GUIs (Motif and GTK) scrolling the wheel generates key -presses <ScrollWheelUp>, <ScrollWheelDown>, <ScrollWheelLeft> and -<ScrollWheelRight>. For example, if you push the scroll wheel upwards a -<ScrollWheelUp> key press is generated causing the window to scroll upwards -(while the text is actually moving downwards). The default action for these -keys are: - <ScrollWheelUp> scroll three lines up *<ScrollWheelUp>* - <S-ScrollWheelUp> scroll one page up *<S-ScrollWheelUp>* - <C-ScrollWheelUp> scroll one page up *<C-ScrollWheelUp>* - <ScrollWheelDown> scroll three lines down *<ScrollWheelDown>* - <S-ScrollWheelDown> scroll one page down *<S-ScrollWheelDown>* - <C-ScrollWheelDown> scroll one page down *<C-ScrollWheelDown>* - <ScrollWheelLeft> scroll six columns left *<ScrollWheelLeft>* - <S-ScrollWheelLeft> scroll one page left *<S-ScrollWheelLeft>* - <C-ScrollWheelLeft> scroll one page left *<C-ScrollWheelLeft>* - <ScrollWheelRight> scroll six columns right *<ScrollWheelRight>* - <S-ScrollWheelRight> scroll one page right *<S-ScrollWheelRight>* - <C-ScrollWheelRight> scroll one page right *<C-ScrollWheelRight>* -This should work in all modes, except when editing the command line. - Note that horizontal scrolling only works if 'nowrap' is set. Also, unless the "h" flag in 'guioptions' is set, the cursor moves to the longest visible line if the cursor line is about to be scrolled off the screen (similarly to @@ -281,13 +261,6 @@ You can also use Alt and Ctrl modifiers. This only works when Vim gets the scroll wheel events, of course. You can check if this works with the "xev" program. -When using XFree86, the /etc/XF86Config file should have the correct entry for -your mouse. For FreeBSD, this entry works for a Logitech scrollmouse: > - Protocol "MouseMan" - Device "/dev/psm0" - ZAxisMapping 4 5 -See the XFree86 documentation for information. - *<MouseDown>* *<MouseUp>* The keys <MouseDown> and <MouseUp> have been deprecated. Use <ScrollWheelUp> instead of <MouseDown> and use <ScrollWheelDown> instead of <MouseUp>. diff --git a/runtime/doc/sign.txt b/runtime/doc/sign.txt index 8dc229df41..44a5361c5d 100644 --- a/runtime/doc/sign.txt +++ b/runtime/doc/sign.txt @@ -75,12 +75,8 @@ DEFINING A SIGN. *:sign-define* *E255* *E160* *E612* Define the file name where the bitmap can be found. Should be a full path. The bitmap should fit in the place of two characters. This is not checked. If the bitmap is too big it - will cause redraw problems. Only GTK 2 can scale the bitmap - to fit the space available. + will cause redraw problems. toolkit supports ~ - GTK 1 pixmap (.xpm) - GTK 2 many - Motif pixmap (.xpm) Win32 .bmp, .ico, .cur pixmap (.xpm) |+xpm_w32| diff --git a/runtime/doc/spell.txt b/runtime/doc/spell.txt index a45a97a0fe..752444a3bd 100644 --- a/runtime/doc/spell.txt +++ b/runtime/doc/spell.txt @@ -35,9 +35,7 @@ Vim only checks words for spelling, there is no grammar check. If the 'mousemodel' option is set to "popup" and the cursor is on a badly spelled word or it is "popup_setpos" and the mouse pointer is on a badly spelled word, then the popup menu will contain a submenu to replace the bad -word. Note: this slows down the appearance of the popup menu. Note for GTK: -don't release the right mouse button until the menu appears, otherwise it -won't work. +word. Note: this slows down the appearance of the popup menu. To search for the next misspelled word: diff --git a/runtime/doc/starting.txt b/runtime/doc/starting.txt index f46a258e2e..e2473976eb 100644 --- a/runtime/doc/starting.txt +++ b/runtime/doc/starting.txt @@ -356,7 +356,7 @@ accordingly. Vim proceeds in this order: 1. Set the 'shell' and 'term' option *SHELL* *COMSPEC* *TERM* The environment variable SHELL, if it exists, is used to set the - 'shell' option. On MS-DOS and Win32, the COMSPEC variable is used + 'shell' option. On Windows, the COMSPEC variable is used if SHELL is not set. The environment variable TERM, if it exists, is used to set the 'term' option. However, 'term' will change later when starting the GUI (step @@ -494,7 +494,7 @@ sessions. Put it in a place so that it will be found by 3b: Local setup: Put all commands that you need for editing a specific directory only into a vimrc file and place it in that directory under the name ".nvimrc" ("_nvimrc" -for MS-DOS and Win32). NOTE: To make Vim look for these special files you +for Windows). NOTE: To make Vim look for these special files you have to turn on the option 'exrc'. See |trojan-horse| too. System setup: @@ -516,10 +516,9 @@ interfere with Vi, then use the variable VIMINIT and the file init.vim instead. MS-DOS line separators: -On MS-DOS-like systems (MS-DOS itself and Win32), Vim assumes that all -the vimrc files have <CR> <NL> pairs as line separators. This will give -problems if you have a file with only <NL>s and have a line like -":map xx yy^M". The trailing ^M will be ignored. +On Windows systems Vim assumes that all the vimrc files have <CR> <NL> pairs +as line separators. This will give problems if you have a file with only +<NL>s and have a line like ":map xx yy^M". The trailing ^M will be ignored. The $MYVIMRC or $MYGVIMRC file will be set to the first found vimrc and/or gvimrc file. @@ -947,7 +946,7 @@ about to abandon with ":bdel", use ":wsh". The '[' and ']' marks are not stored, but the '"' mark is. The '"' mark is very useful for jumping to the cursor position when the file was last exited. No marks are saved for files that start with any string given with the "r" flag in 'shada'. This can be -used to avoid saving marks for files on removable media (for MS-DOS you would +used to avoid saving marks for files on removable media (for Windows you would use "ra:,rb:". The |v:oldfiles| variable is filled with the file names that the ShaDa file has marks for. diff --git a/runtime/doc/syntax.txt b/runtime/doc/syntax.txt index 9d510f4be1..6603d65645 100644 --- a/runtime/doc/syntax.txt +++ b/runtime/doc/syntax.txt @@ -1,4 +1,4 @@ -*syntax.txt* For Vim version 7.4. Last change: 2015 Feb 03 +*syntax.txt* For Vim version 7.4. Last change: 2015 Mar 20 VIM REFERENCE MANUAL by Bram Moolenaar @@ -71,10 +71,10 @@ with: > For a color terminal see |:hi-normal-cterm|. For setting up your own colors syntax highlighting see |syncolor|. -NOTE: The syntax files on MS-DOS and Windows have lines that end in <CR><NL>. -The files for Unix end in <NL>. This means you should use the right type of -file for your system. Although on MS-DOS and Windows the right format is -automatically selected if the 'fileformats' option is not empty. +NOTE: The syntax files on Windows have lines that end in <CR><NL>. The files +for Unix end in <NL>. This means you should use the right type of file for +your system. Although on Windows the right format is automatically selected +if the 'fileformats' option is not empty. NOTE: When using reverse video ("gvim -fg white -bg black"), the default value of 'background' will not be set until the GUI window is opened, which is after @@ -206,7 +206,8 @@ thing. These are then linked to a highlight group that specifies the color. A syntax group name doesn't specify any color or attributes itself. The name for a highlight or syntax group must consist of ASCII letters, digits -and the underscore. As a regexp: "[a-zA-Z0-9_]*" +and the underscore. As a regexp: "[a-zA-Z0-9_]*". However, Vim does not give +an error when using other characters. To be able to allow each user to pick his favorite set of colors, there must be preferred names for highlight groups that are common for many languages. @@ -4238,7 +4239,7 @@ If the "maxlines={N}" argument is given, the number of lines that are searched for a comment or syncing pattern is restricted to N lines backwards (after adding "minlines"). This is useful if you have few things to sync on and a slow machine. Example: > - :syntax sync ccomment maxlines=500 + :syntax sync maxlines=500 ccomment < *:syn-sync-linebreaks* When using a pattern that matches multiple lines, a change in one line may @@ -4506,7 +4507,7 @@ mentioned for the default values. See |:verbose-cmd| for more information. *highlight-args* *E416* *E417* *E423* There are three types of terminals for highlighting: term a normal terminal (vt100, xterm) -cterm a color terminal (MS-DOS console, color-xterm, these have the "Co" +cterm a color terminal (Windows console, color-xterm, these have the "Co" termcap entry) gui the GUI @@ -4631,6 +4632,8 @@ ctermbg={color-nr} *highlight-ctermbg* Note that for some color terminals these names may result in the wrong colors! + You can also use "NONE" to remove the color. + *:hi-normal-cterm* When setting the "ctermfg" or "ctermbg" colors for the Normal group, these will become the colors used for the non-highlighted text. @@ -4652,7 +4655,7 @@ ctermbg={color-nr} *highlight-ctermbg* *E419* *E420* When Vim knows the normal foreground and background colors, "fg" and "bg" can be used as color names. This only works after setting the - colors for the Normal group and for the MS-DOS console. Example, for + colors for the Normal group and for the Windows console. Example, for reverse video: > :highlight Visual ctermfg=bg ctermbg=fg < Note that the colors are used that are valid at the moment this diff --git a/runtime/doc/term.txt b/runtime/doc/term.txt index 9610555dce..d85b4a326d 100644 --- a/runtime/doc/term.txt +++ b/runtime/doc/term.txt @@ -1,4 +1,4 @@ -*term.txt* For Vim version 7.4. Last change: 2014 May 13 +*term.txt* For Vim version 7.4. Last change: 2015 Feb 23 VIM REFERENCE MANUAL by Bram Moolenaar @@ -425,11 +425,9 @@ cleared when scrolling). Unfortunately it is not possible to deduce from the termcap how cursor positioning should be done when using a scrolling region: Relative to the beginning of the screen or relative to the beginning of the scrolling region. -Most terminals use the first method. A known exception is the MS-DOS console -(pcterm). The 't_CS' option should be set to any string when cursor -positioning is relative to the start of the scrolling region. It should be -set to an empty string otherwise. It defaults to "yes" when 'term' is -"pcterm". +Most terminals use the first method. The 't_CS' option should be set to any +string when cursor positioning is relative to the start of the scrolling +region. It should be set to an empty string otherwise. Note for xterm users: The shifted cursor keys normally don't work. You can make them work with the xmodmap command and some mappings in Vim. @@ -672,10 +670,9 @@ border, the text is scrolled. A selection can be started by pressing the left mouse button on the first character, moving the mouse to the last character, then releasing the mouse button. You will not always see the selection until you release the button, -only in some versions (GUI, MS-DOS, WIN32) will the dragging be shown -immediately. Note that you can make the text scroll by moving the mouse at -least one character in the first/last line in the window when 'scrolloff' is -non-zero. +only in some versions (GUI, Windows) will the dragging be shown immediately. +Note that you can make the text scroll by moving the mouse at least one +character in the first/last line in the window when 'scrolloff' is non-zero. In Normal, Visual and Select mode clicking the right mouse button causes the Visual area to be extended. When 'mousemodel' is "popup", the left button has @@ -689,9 +686,9 @@ work on systems where the window manager consumes the mouse events when the alt key is pressed (it may move the window). *double-click* -Double, triple and quadruple clicks are supported when the GUI is active, -for MS-DOS and Win32, and for an xterm (if the gettimeofday() function is -available). For selecting text, extra clicks extend the selection: +Double, triple and quadruple clicks are supported when the GUI is active, for +Windows and for an xterm. For selecting text, extra clicks extend the +selection: click select ~ double word or % match *<2-LeftMouse>* triple line *<3-LeftMouse>* diff --git a/runtime/doc/usr_02.txt b/runtime/doc/usr_02.txt index cd25b14e32..f81a4e3a2c 100644 --- a/runtime/doc/usr_02.txt +++ b/runtime/doc/usr_02.txt @@ -29,11 +29,10 @@ To start Vim, enter this command: > gvim file.txt -In UNIX you can type this at any command prompt. If you are running Microsoft -Windows, open an MS-DOS prompt window and enter the command. - In either case, Vim starts editing a file called file.txt. Because this -is a new file, you get a blank window. This is what your screen will look -like: +On Unix you can type this at any command prompt. If you are running Windows, +open a command prompt window and enter the command. In either case, Vim +starts editing a file called file.txt. Because this is a new file, you get a +blank window. This is what your screen will look like: +---------------------------------------+ |# | @@ -61,10 +60,9 @@ use this command: > the editing occurs inside your command window. In other words, if you are running inside an xterm, the editor uses your xterm window. If you are using -an MS-DOS command prompt window under Microsoft Windows, the editing occurs -inside this window. The text in the window will look the same for both -versions, but with gvim you have extra features, like a menu bar. More about -that later. +the command prompt under Microsoft Windows, the editing occurs inside this +window. The text in the window will look the same for both versions, but with +gvim you have extra features, like a menu bar. More about that later. ============================================================================== *02.2* Inserting text @@ -80,7 +78,7 @@ mistakes; you can correct them later. To enter the following programmer's limerick, this is what you type: > iA very intelligent turtle - Found programming UNIX a hurdle + Found programming Unix a hurdle After typing "turtle" you press the <Enter> key to start a new line. Finally you press the <Esc> key to stop Insert mode and go back to Normal mode. You @@ -88,7 +86,7 @@ now have two lines of text in your Vim window: +---------------------------------------+ |A very intelligent turtle | - |Found programming UNIX a hurdle | + |Found programming Unix a hurdle | |~ | |~ | | | @@ -110,7 +108,7 @@ of the window. This indicates you are in Insert mode. +---------------------------------------+ |A very intelligent turtle | - |Found programming UNIX a hurdle | + |Found programming Unix a hurdle | |~ | |~ | |-- INSERT -- | @@ -187,7 +185,7 @@ look like this: +---------------------------------------+ |intelligent turtle | - |Found programming UNIX a hurdle | + |Found programming Unix a hurdle | |~ | |~ | | | @@ -202,7 +200,7 @@ insert mode (the final <Esc>). The result: +---------------------------------------+ |A young intelligent turtle | - |Found programming UNIX a hurdle | + |Found programming Unix a hurdle | |~ | |~ | | | @@ -215,7 +213,7 @@ To delete a whole line use the "dd" command. The following line will then move up to fill the gap: +---------------------------------------+ - |Found programming UNIX a hurdle | + |Found programming Unix a hurdle | |~ | |~ | |~ | @@ -332,7 +330,7 @@ Insert mode. Then you can type the text for the new line. Suppose the cursor is somewhere in the first of these two lines: A very intelligent turtle ~ - Found programming UNIX a hurdle ~ + Found programming Unix a hurdle ~ If you now use the "o" command and type new text: > @@ -342,7 +340,7 @@ The result is: A very intelligent turtle ~ That liked using Vim ~ - Found programming UNIX a hurdle ~ + Found programming Unix a hurdle ~ The "O" command (uppercase) opens a line above the cursor. diff --git a/runtime/doc/usr_09.txt b/runtime/doc/usr_09.txt index 05cc32bceb..d68d734b8f 100644 --- a/runtime/doc/usr_09.txt +++ b/runtime/doc/usr_09.txt @@ -134,10 +134,10 @@ The following command makes the mouse work like a Microsoft Windows mouse: > :behave mswin -The default behavior of the mouse on UNIX systems is xterm. The default -behavior on a Microsoft Windows system is selected during the installation -process. For details about what the two behaviors are, see |:behave|. Here -follows a summary. +The default behavior of the mouse on Unix systems is xterm. The default +behavior on Windows systems is selected during the installation process. For +details about what the two behaviors are, see |:behave|. Here follows a +summary. XTERM MOUSE BEHAVIOR diff --git a/runtime/doc/usr_10.txt b/runtime/doc/usr_10.txt index 64b0181c35..bf7ba18222 100644 --- a/runtime/doc/usr_10.txt +++ b/runtime/doc/usr_10.txt @@ -698,10 +698,10 @@ still be something that an external command can do better or faster. through an external program. In other words, it runs the system command represented by {program}, giving it the block of text represented by {motion} as input. The output of this command then replaces the selected block. - Because this summarizes badly if you are unfamiliar with UNIX filters, take + Because this summarizes badly if you are unfamiliar with Unix filters, take a look at an example. The sort command sorts a file. If you execute the following command, the unsorted file input.txt will be sorted and written to -output.txt. (This works on both UNIX and Microsoft Windows.) > +output.txt. This works on both Unix and Windows. > sort <input.txt >output.txt diff --git a/runtime/doc/usr_11.txt b/runtime/doc/usr_11.txt index 2a810af6c2..1a72c300d7 100644 --- a/runtime/doc/usr_11.txt +++ b/runtime/doc/usr_11.txt @@ -293,7 +293,6 @@ If you really don't want to see this message, you can add the 'A' flag to the 'updatecount' Number of key strokes after which the swap file is flushed to disk. 'updatetime' Timeout after which the swap file is flushed to disk. -'swapsync' Whether the disk is synced when the swap file is flushed. 'directory' List of directory names where to store the swap file. 'maxmem' Limit for memory usage before writing text to the swap file. 'maxmemtot' Same, but for all files in total. diff --git a/runtime/doc/usr_12.txt b/runtime/doc/usr_12.txt index fba1b53274..237abae55f 100644 --- a/runtime/doc/usr_12.txt +++ b/runtime/doc/usr_12.txt @@ -309,7 +309,7 @@ matches can be found. ============================================================================== *12.8* Find where a word is used -If you are a UNIX user, you can use a combination of Vim and the grep command +If you are a Unix user, you can use a combination of Vim and the grep command to edit all the files that contain a given word. This is extremely useful if you are working on a program and want to view or edit all the files that contain a specific variable. @@ -324,7 +324,7 @@ will only list the files containing the word and not print the matching lines. The word it is searching for is "frame_counter". Actually, this can be any regular expression. (Note: What grep uses for regular expressions is not exactly the same as what Vim uses.) - The entire command is enclosed in backticks (`). This tells the UNIX shell + The entire command is enclosed in backticks (`). This tells the Unix shell to run this command and pretend that the results were typed on the command line. So what happens is that the grep command is run and produces a list of files, these files are put on the Vim command line. This results in Vim diff --git a/runtime/doc/usr_23.txt b/runtime/doc/usr_23.txt index bdb3b7afd6..4761203512 100644 --- a/runtime/doc/usr_23.txt +++ b/runtime/doc/usr_23.txt @@ -25,7 +25,7 @@ Back in the early days, the old Teletype machines used two characters to start a new line. One to move the carriage back to the first position (carriage return, <CR>), another to move the paper up (line feed, <LF>). When computers came out, storage was expensive. Some people decided that -they did not need two characters for end-of-line. The UNIX people decided +they did not need two characters for end-of-line. The Unix people decided they could use <Line Feed> only for end-of-line. The Apple people standardized on <CR>. The MS-DOS (and Microsoft Windows) folks decided to keep the old <CR><LF>. @@ -34,7 +34,7 @@ have line-break problems. The Vim editor automatically recognizes the different file formats and handles things properly behind your back. The option 'fileformats' contains the various formats that will be tried when a new file is edited. The following command, for example, tells Vim to -try UNIX format first and MS-DOS format second: > +try Unix format first and MS-DOS format second: > :set fileformats=unix,dos @@ -97,12 +97,12 @@ CONVERSION You can use the 'fileformat' option to convert from one file format to another. Suppose, for example, that you have an MS-DOS file named README.TXT -that you want to convert to UNIX format. Start by editing the MS-DOS format +that you want to convert to Unix format. Start by editing the MS-DOS format file: > vim README.TXT Vim will recognize this as a dos format file. Now change the file format to -UNIX: > +Unix: > :set fileformat=unix :write diff --git a/runtime/doc/usr_24.txt b/runtime/doc/usr_24.txt index 46a22c683c..ba9d083fe0 100644 --- a/runtime/doc/usr_24.txt +++ b/runtime/doc/usr_24.txt @@ -563,9 +563,9 @@ that combination. Thus CTRL-K dP also works. Since there is no digraph for "dP" Vim will also search for a "Pd" digraph. Note: - The digraphs depend on the character set that Vim assumes you are - using. On MS-DOS they are different from MS-Windows. Always use - ":digraphs" to find out which digraphs are currently available. + The digraphs depend on the character set that Vim assumes you + are using. Always use ":digraphs" to find out which digraphs are + currently available. You can define your own digraphs. Example: > diff --git a/runtime/doc/usr_27.txt b/runtime/doc/usr_27.txt index fb096593f2..d837610698 100644 --- a/runtime/doc/usr_27.txt +++ b/runtime/doc/usr_27.txt @@ -83,7 +83,7 @@ matter if 'ignorecase' or 'smartcase' was changed. Note: If your search takes much longer than you expected, you can interrupt - it with CTRL-C on Unix and CTRL-Break on MS-DOS and MS-Windows. + it with CTRL-C on Unix and CTRL-Break on Windows. ============================================================================== *27.2* Wrapping around the file end diff --git a/runtime/doc/usr_41.txt b/runtime/doc/usr_41.txt index c6b143ca0e..8017b99f97 100644 --- a/runtime/doc/usr_41.txt +++ b/runtime/doc/usr_41.txt @@ -1499,8 +1499,8 @@ Here is a summary of items that apply to Vim scripts. They are also mentioned elsewhere, but form a nice checklist. The end-of-line character depends on the system. For Unix a single <NL> -character is used. For MS-DOS, Windows and the like, <CR><LF> is used. -This is important when using mappings that end in a <CR>. See |:source_crnl|. +character is used. For Windows <CR><LF> is used. This is important when +using mappings that end in a <CR>. See |:source_crnl|. WHITE SPACE diff --git a/runtime/doc/various.txt b/runtime/doc/various.txt index efe20571ac..26ff8f0783 100644 --- a/runtime/doc/various.txt +++ b/runtime/doc/various.txt @@ -314,7 +314,6 @@ N *+dialog_gui* Support for |:confirm| with GUI dialog. N *+dialog_con* Support for |:confirm| with console dialog. N *+dialog_con_gui* Support for |:confirm| with GUI and console dialog. N *+digraphs* |digraphs| *E196* - *+dnd* Support for DnD into the "~ register |quote_~|. N *+eval* expression evaluation |eval.txt| N *+ex_extra* Vim's extra Ex commands: |:center|, |:left|, |:normal|, |:retab| and |:right| @@ -325,7 +324,6 @@ N *+find_in_path* include file searches: |[I|, |:isearch|, |CTRL-W_CTRL-I|, |:checkpath|, etc. N *+folding* |folding| N *+gettext* message translations |multi-lang| - *+GUI_GTK* Unix only: GTK+ |GUI| *+iconv* Compiled with the |iconv()| function *+iconv/dyn* Likewise |iconv-dynamic| |/dyn| N *+insert_expand* |insert_expand| Insert mode completion @@ -565,17 +563,11 @@ which it was defined is reported. :5sleep "sleep for five seconds :sleep 100m "sleep for a hundred milliseconds 10gs "sleep for ten seconds -< Can be interrupted with CTRL-C (CTRL-Break on MS-DOS). +< Can be interrupted with CTRL-C (CTRL-Break on Windows). "gs" stands for "goto sleep". While sleeping the cursor is positioned in the text, if at a visible position. - - *g_CTRL-A* -g CTRL-A Only when Vim was compiled with MEM_PROFILING defined - (which is very rare): print memory usage statistics. - Only useful for debugging Vim. - ============================================================================== 2. Using Vim like less or more *less* diff --git a/runtime/doc/vi_diff.txt b/runtime/doc/vi_diff.txt index 1553fe93d1..38248d1b22 100644 --- a/runtime/doc/vi_diff.txt +++ b/runtime/doc/vi_diff.txt @@ -44,8 +44,7 @@ Memory usage limits The option 'maxmem' ('mm') is used to set the maximum memory used for one buffer (in kilobytes). 'maxmemtot' is used to set the maximum memory used for -all buffers (in kilobytes). The defaults depend on the system used. For -MS-DOS, 'maxmemtot' is set depending on the amount of memory available. +all buffers (in kilobytes). The defaults depend on the system used. These are not hard limits, but tell Vim when to move text into a swap file. If you don't like Vim to swap to a file, set 'maxmem' and 'maxmemtot' to a very large value. The swap file will then only be used for recovery. If you @@ -77,7 +76,7 @@ Graphical User Interface (GUI). |gui| Included support for GUI: menu's, mouse, scrollbars, etc. You can define your own menus. Better support for CTRL/SHIFT/ALT keys in combination with special keys and mouse. Supported for various - platforms such as GTK, Win32, and Macintosh. + platforms such as Win32. Multiple windows and buffers. |windows.txt| Vim can split the screen into several windows, each editing a diff --git a/runtime/doc/vim_diff.txt b/runtime/doc/vim_diff.txt index a1d7c7d62c..6609a96e9e 100644 --- a/runtime/doc/vim_diff.txt +++ b/runtime/doc/vim_diff.txt @@ -199,10 +199,14 @@ Other options: 'cpoptions' ('g', 'w', 'H', '*', '-', 'j', and all POSIX flags were removed) 'guioptions' (only the 't' flag was removed) 'guipty' + 'imactivatefunc' + 'imactivatekey' + 'imstatusfunc' 'macatsui' 'restorescreen' 'shelltype' 'shortname' + 'swapsync' 'termencoding' (Vim 7.4.852 also removed this for Windows) 'textauto' 'textmode' @@ -215,6 +219,7 @@ Other options: Other commands: :Print :fixdel + :helpfind :mode (no longer accepts an argument) :open :shell diff --git a/runtime/doc/windows.txt b/runtime/doc/windows.txt index 56f57c21c5..eee171b7da 100644 --- a/runtime/doc/windows.txt +++ b/runtime/doc/windows.txt @@ -681,7 +681,6 @@ can also get to them with the buffer list commands, like ":bnext". When using the |:tab| modifier each argument is opened in a tab page. The last window is used if it's empty. Also see |++opt| and |+cmd|. - {only available when compiled with a GUI} ============================================================================== 8. Do a command in all buffers or windows *list-repeat* diff --git a/runtime/filetype.vim b/runtime/filetype.vim index 5dbd1a9a19..37a20be984 100644 --- a/runtime/filetype.vim +++ b/runtime/filetype.vim @@ -1,7 +1,7 @@ " Vim support file to detect file types " " Maintainer: Bram Moolenaar <Bram@vim.org> -" Last Change: 2015 Jan 14 +" Last Change: 2015 Mar 13 " Listen very carefully, I will say this only once if exists("did_load_filetypes") @@ -1262,8 +1262,8 @@ au BufNewFile,BufRead */etc/modules.conf,*/etc/modules,*/etc/conf.modules setf m " Mplayer config au BufNewFile,BufRead mplayer.conf,*/.mplayer/config setf mplayerconf -" Moterola S record -au BufNewFile,BufRead *.s19,*.s28,*.s37 setf srec +" Motorola S record +au BufNewFile,BufRead *.s19,*.s28,*.s37,*.mot,*.srec setf srec " Mrxvtrc au BufNewFile,BufRead mrxvtrc,.mrxvtrc setf mrxvtrc diff --git a/runtime/ftplugin/spec.vim b/runtime/ftplugin/spec.vim index 0b6750de94..f972753533 100644 --- a/runtime/ftplugin/spec.vim +++ b/runtime/ftplugin/spec.vim @@ -2,7 +2,7 @@ " Filename: spec.vim " Maintainer: Igor Gnatenko i.gnatenko.brain@gmail.com " Former Maintainer: Gustavo Niemeyer <niemeyer@conectiva.com> (until March 2014) -" Last Change: Sun Mar 2 11:24 MSK 2014 Igor Gnatenko +" Last Change: Fri Feb 20 16:01 MSK 2014 Igor Gnatenko if exists("b:did_ftplugin") finish @@ -18,7 +18,9 @@ if !exists("no_plugin_maps") && !exists("no_spec_maps") endif endif -noremap <buffer> <unique> <script> <Plug>SpecChangelog :call <SID>SpecChangelog("")<CR> +if !hasmapto("call <SID>SpecChangelog(\"\")<CR>") + noremap <buffer> <unique> <script> <Plug>SpecChangelog :call <SID>SpecChangelog("")<CR> +endif if !exists("*s:GetRelVer") function! s:GetRelVer() diff --git a/runtime/optwin.vim b/runtime/optwin.vim index 03e44abeb3..a092f18d23 100644 --- a/runtime/optwin.vim +++ b/runtime/optwin.vim @@ -972,8 +972,6 @@ call <SID>OptionG("dir", &dir) call append("$", "swapfile\tuse a swap file for this buffer") call append("$", "\t(local to buffer)") call <SID>BinOptionL("swf") -call append("$", "swapsync\t\"sync\", \"fsync\" or empty; how to flush a swap file to disk") -call <SID>OptionG("sws", &sws) call append("$", "updatecount\tnumber of characters typed to cause a swap file update") call append("$", " \tset uc=" . &uc) call append("$", "updatetime\ttime in msec after which the swap file will be updated") diff --git a/runtime/syntax/asterisk.vim b/runtime/syntax/asterisk.vim index 58e867d42a..fd4ec39c91 100644 --- a/runtime/syntax/asterisk.vim +++ b/runtime/syntax/asterisk.vim @@ -1,8 +1,9 @@ " Vim syntax file " Language: Asterisk config file -" Maintainer: brc007 +" Maintainer: Jean Aunis <jean.aunis@yahoo.fr> +" Previous Maintainer: brc007 " Updated for 1.2 by Tilghman Lesher (Corydon76) -" Last Change: 2006 Mar 20 +" Last Change: 2015 Feb 27 " version 0.4 " if version < 600 @@ -17,18 +18,19 @@ syn sync fromstart syn keyword asteriskTodo TODO contained syn match asteriskComment ";.*" contains=asteriskTodo syn match asteriskContext "\[.\{-}\]" -syn match asteriskExten "^\s*exten\s*=>\?\s*[^,]\+" contains=asteriskPattern +syn match asteriskExten "^\s*\zsexten\s*=>\?\s*[^,]\+\ze," contains=asteriskPattern nextgroup=asteriskPriority +syn match asteriskExten "^\s*\zssame\s*=>\?\s*\ze" nextgroup=asteriskPriority syn match asteriskExten "^\s*\(register\|channel\|ignorepat\|include\|\(no\)\?load\)\s*=>\?" syn match asteriskPattern "_\(\[[[:alnum:]#*\-]\+\]\|[[:alnum:]#*]\)*\.\?" contained syn match asteriskPattern "[^A-Za-z0-9,]\zs[[:alnum:]#*]\+\ze" contained syn match asteriskApp ",\zs[a-zA-Z]\+\ze$" syn match asteriskApp ",\zs[a-zA-Z]\+\ze(" " Digits plus oldlabel (newlabel) -syn match asteriskPriority ",\zs[[:digit:]]\+\(+[[:alpha:]][[:alnum:]_]*\)\?\(([[:alpha:]][[:alnum:]_]*)\)\?\ze," contains=asteriskLabel +syn match asteriskPriority "\zs[[:digit:]]\+\(+[[:alpha:]][[:alnum:]_]*\)\?\(([[:alpha:]][[:alnum:]_]*)\)\?\ze," contains=asteriskLabel " oldlabel plus digits (newlabel) -syn match asteriskPriority ",\zs[[:alpha:]][[:alnum:]_]*+[[:digit:]]\+\(([[:alpha:]][[:alnum:]_]*)\)\?\ze," contains=asteriskLabel +syn match asteriskPriority "\zs[[:alpha:]][[:alnum:]_]*+[[:digit:]]\+\(([[:alpha:]][[:alnum:]_]*)\)\?\ze," contains=asteriskLabel " s or n plus digits (newlabel) -syn match asteriskPriority ",\zs[sn]\(+[[:digit:]]\+\)\?\(([[:alpha:]][[:alnum:]_]*)\)\?\ze," contains=asteriskLabel +syn match asteriskPriority "\zs[sn]\(+[[:digit:]]\+\)\?\(([[:alpha:]][[:alnum:]_]*)\)\?\ze," contains=asteriskLabel syn match asteriskLabel "(\zs[[:alpha:]][[:alnum:]]*\ze)" contained syn match asteriskError "^\s*#\s*[[:alnum:]]*" syn match asteriskInclude "^\s*#\s*\(include\|exec\)\s.*" diff --git a/runtime/syntax/c.vim b/runtime/syntax/c.vim index 128e1a2a4a..a520e6317f 100644 --- a/runtime/syntax/c.vim +++ b/runtime/syntax/c.vim @@ -1,7 +1,7 @@ " Vim syntax file " Language: C " Maintainer: Bram Moolenaar <Bram@vim.org> -" Last Change: 2014 Nov 13 +" Last Change: 2015 Feb 27 " Quit when a (custom) syntax file was already loaded if exists("b:current_syntax") @@ -330,6 +330,8 @@ if !exists("c_no_ansi") || exists("c_ansi_constants") || exists("c_gnu") " POSIX 2001 syn keyword cConstant SIGBUS SIGPOLL SIGPROF SIGSYS SIGURG syn keyword cConstant SIGVTALRM SIGXCPU SIGXFSZ + " non-POSIX signals + syn keyword cConstant SIGWINCH SIGINFO " Add POSIX errors as well syn keyword cConstant E2BIG EACCES EAGAIN EBADF EBADMSG EBUSY syn keyword cConstant ECANCELED ECHILD EDEADLK EDOM EEXIST EFAULT diff --git a/runtime/syntax/cobol.vim b/runtime/syntax/cobol.vim index 5315e75211..51ca3d8773 100644 --- a/runtime/syntax/cobol.vim +++ b/runtime/syntax/cobol.vim @@ -1,10 +1,10 @@ " Vim syntax file -" Language: COBOL -" Maintainer: Tim Pope <vimNOSPAM@tpope.info> +" Language: COBOL +" Maintainer: Tim Pope <vimNOSPAM@tpope.org> " (formerly Davyd Ondrejko <vondraco@columbus.rr.com>) " (formerly Sitaram Chamarty <sitaram@diac.com> and -" James Mitchell <james_mitchell@acm.org>) -" $Id: cobol.vim,v 1.2 2007/05/05 18:23:43 vimboss Exp $ +" James Mitchell <james_mitchell@acm.org>) +" Last Change: 2015 Feb 13 " For version 5.x: Clear all syntax items " For version 6.x: Quit when a syntax file was already loaded @@ -145,7 +145,7 @@ syn match cobolString /'[^']*\('\|$\)/ syn match cobolIndicator "\%7c[D-]" contained if exists("cobol_legacy_code") - syn region cobolCondFlow contains=ALLBUT,cobolLine start="\<\(IF\|INVALID\|END\|EOP\)\>" skip=/\('\|"\)[^"]\{-}\("\|'\|$\)/ end="\." keepend + syn region cobolCondFlow contains=ALLBUT,cobolLine,cobolBadLine start="\<\(IF\|INVALID\|END\|EOP\)\>" skip=/\('\|"\)[^"]\{-}\("\|'\|$\)/ end="\." keepend endif " many legacy sources have junk in columns 1-6: must be before others diff --git a/runtime/syntax/hex.vim b/runtime/syntax/hex.vim index 40c655395f..40f7f0dd10 100644 --- a/runtime/syntax/hex.vim +++ b/runtime/syntax/hex.vim @@ -1,7 +1,29 @@ " Vim syntax file -" Language: Intel hex MCS51 -" Maintainer: Sams Ricahrd <sams@ping.at> -" Last Change: 2003 Apr 25 +" Language: Intel HEX +" Maintainer: Markus Heidelberg <markus.heidelberg@web.de> +" Previous version: Sams Ricahrd <sams@ping.at> +" Last Change: 2015 Feb 24 + +" Each record (line) is built as follows: +" +" field digits states +" +" +----------+ +" | start | 1 (':') hexRecStart +" +----------+ +" | count | 2 hexDataByteCount +" +----------+ +" | address | 4 hexNoAddress, hexDataAddress, (hexAddressFieldUnknown) +" +----------+ +" | type | 2 hexRecType, (hexRecTypeUnknown) +" +----------+ +" | data | 0..510 hexDataOdd, hexDataEven, hexExtendedAddress, hexStartAddress, (hexDataFieldUnknown, hexDataUnexpected) +" +----------+ +" | checksum | 2 hexChecksum +" +----------+ +" +" States in parentheses in the upper format description indicate that they +" should not appear in a valid file. " For version 5.x: Clear all syntax items " For version 6.x: Quit when a syntax file was already loaded @@ -11,21 +33,39 @@ elseif exists("b:current_syntax") finish endif -syn case ignore +syn match hexRecStart "^:" + +syn match hexDataByteCount "^:[0-9a-fA-F]\{2}" contains=hexRecStart nextgroup=hexAddress + +syn match hexAddress "[0-9a-fA-F]\{4}" transparent contained nextgroup=hexRecTypeUnknown,hexRecType +" The address field groups include the record type field in the last 2 +" characters, the proper match for highlighting follows below. +syn match hexAddressFieldUnknown "^:[0-9a-fA-F]\{8}" contains=hexDataByteCount nextgroup=hexDataFieldUnknown,hexChecksum +syn match hexDataAddress "^:[0-9a-fA-F]\{6}00" contains=hexDataByteCount nextgroup=hexDataOdd,hexChecksum +syn match hexNoAddress "^:[0-9a-fA-F]\{6}01" contains=hexDataByteCount nextgroup=hexDataUnexpected,hexChecksum +syn match hexNoAddress "^:[0-9a-fA-F]\{6}0[24]" contains=hexDataByteCount nextgroup=hexExtendedAddress +syn match hexNoAddress "^:[0-9a-fA-F]\{6}0[35]" contains=hexDataByteCount nextgroup=hexStartAddress + +syn match hexRecTypeUnknown "[0-9a-fA-F]\{2}" contained +syn match hexRecType "0[0-5]" contained + +syn match hexDataFieldUnknown "[0-9a-fA-F]\{2}" contained nextgroup=hexDataFieldUnknown,hexChecksum +" alternating highlight per byte for easier reading +syn match hexDataOdd "[0-9a-fA-F]\{2}" contained nextgroup=hexDataEven,hexChecksum +syn match hexDataEven "[0-9a-fA-F]\{2}" contained nextgroup=hexDataOdd,hexChecksum +" data bytes which should not exist +syn match hexDataUnexpected "[0-9a-fA-F]\{2}" contained nextgroup=hexDataUnexpected,hexChecksum +" Data digit pair regex usage also results in only highlighting the checksum +" if the number of data characters is even. -" storage types +" special data fields +syn match hexExtendedAddress "[0-9a-fA-F]\{4}" contained nextgroup=hexDataUnexpected,hexChecksum +syn match hexStartAddress "[0-9a-fA-F]\{8}" contained nextgroup=hexDataUnexpected,hexChecksum -syn match hexChecksum "[0-9a-fA-F]\{2}$" -syn match hexAdress "^:[0-9a-fA-F]\{6}" contains=hexDataByteCount -syn match hexRecType "^:[0-9a-fA-F]\{8}" contains=hexAdress -syn match hexDataByteCount contained "^:[0-9a-fA-F]\{2}" contains=hexStart -syn match hexStart contained "^:" -syn match hexExtAdrRec "^:02000002[0-9a-fA-F]\{4}" contains=hexSpecRec -syn match hexExtLinAdrRec "^:02000004[0-9a-fA-F]\{4}" contains=hexSpecRec -syn match hexSpecRec contained "^:0[02]00000[124]" contains=hexStart -syn match hexEOF "^:00000001" contains=hexStart +syn match hexChecksum "[0-9a-fA-F]\{2}$" contained -syn case match +" Folding Data Records below an Extended Segment/Linear Address Record +syn region hexExtAdrBlock start="^:[0-9a-fA-F]\{7}[24]" skip="^:[0-9a-fA-F]\{7}0" end="^:"me=s-1 fold transparent " Define the default highlighting. " For version 5.7 and earlier: only when not done already @@ -38,16 +78,21 @@ if version >= 508 || !exists("did_hex_syntax_inits") command -nargs=+ HiLink hi def link <args> endif - " The default methods for highlighting. Can be overridden later - HiLink hexStart SpecialKey - HiLink hexDataByteCount Constant - HiLink hexAdress Comment - HiLink hexRecType WarningMsg - HiLink hexChecksum Search - HiLink hexExtAdrRec hexAdress - HiLink hexEOF hexSpecRec - HiLink hexExtLinAdrRec hexAdress - HiLink hexSpecRec DiffAdd + " The default methods for highlighting. Can be overridden later + HiLink hexRecStart hexRecType + HiLink hexDataByteCount Constant + hi def hexAddressFieldUnknown term=italic cterm=italic gui=italic + HiLink hexDataAddress Comment + HiLink hexNoAddress DiffAdd + HiLink hexRecTypeUnknown hexRecType + HiLink hexRecType WarningMsg + hi def hexDataFieldUnknown term=italic cterm=italic gui=italic + hi def hexDataOdd term=bold cterm=bold gui=bold + hi def hexDataEven term=NONE cterm=NONE gui=NONE + HiLink hexDataUnexpected Error + HiLink hexExtendedAddress hexDataAddress + HiLink hexStartAddress hexDataAddress + HiLink hexChecksum DiffChange delcommand HiLink endif diff --git a/runtime/syntax/java.vim b/runtime/syntax/java.vim index e5491b2612..e113a904c3 100644 --- a/runtime/syntax/java.vim +++ b/runtime/syntax/java.vim @@ -2,7 +2,7 @@ " Language: Java " Maintainer: Claudio Fleiner <claudio@fleiner.com> " URL: http://www.fleiner.com/vim/syntax/java.vim -" Last Change: 2012 Oct 05 +" Last Change: 2015 March 01 " Please check :help java.vim for comments on some of the options available. @@ -30,7 +30,7 @@ endif " some characters that cannot be in a java program (outside a string) syn match javaError "[\\@`]" -syn match javaError "<<<\|\.\.\|=>\|||=\|&&=\|[^-]->\|\*\/" +syn match javaError "<<<\|\.\.\|=>\|||=\|&&=\|\*\/" syn match javaOK "\.\.\." @@ -63,7 +63,7 @@ syn match javaTypedef "\.\s*\<class\>"ms=s+1 syn keyword javaClassDecl enum syn match javaClassDecl "^class\>" syn match javaClassDecl "[^.]\s*\<class\>"ms=s+1 -syn match javaAnnotation "@\([_$a-zA-Z][_$a-zA-Z0-9]*\.\)*[_$a-zA-Z][_$a-zA-Z0-9]*\>" +syn match javaAnnotation "@\([_$a-zA-Z][_$a-zA-Z0-9]*\.\)*[_$a-zA-Z][_$a-zA-Z0-9]*\>\(([^)]*)\)\=" contains=javaString syn match javaClassDecl "@interface\>" syn keyword javaBranch break continue nextgroup=javaUserLabelRef skipwhite syn match javaUserLabelRef "\k\+" contained @@ -121,7 +121,7 @@ if exists("java_space_errors") endif endif -syn region javaLabelRegion transparent matchgroup=javaLabel start="\<case\>" matchgroup=NONE end=":" contains=javaNumber,javaCharacter +syn region javaLabelRegion transparent matchgroup=javaLabel start="\<case\>" matchgroup=NONE end=":" contains=javaNumber,javaCharacter,javaString syn match javaUserLabel "^\s*[_$a-zA-Z][_$a-zA-Z0-9_]*\s*:"he=e-1 contains=javaLabel syn keyword javaLabel default @@ -188,10 +188,10 @@ syn region javaString start=+"+ end=+"+ end=+$+ contains=javaSpecialChar,javaS syn match javaCharacter "'[^']*'" contains=javaSpecialChar,javaSpecialCharError syn match javaCharacter "'\\''" contains=javaSpecialChar syn match javaCharacter "'[^\\]'" -syn match javaNumber "\<\(0[0-7]*\|0[xX]\x\+\|\d\+\)[lL]\=\>" -syn match javaNumber "\(\<\d\+\.\d*\|\.\d\+\)\([eE][-+]\=\d\+\)\=[fFdD]\=" -syn match javaNumber "\<\d\+[eE][-+]\=\d\+[fFdD]\=\>" -syn match javaNumber "\<\d\+\([eE][-+]\=\d\+\)\=[fFdD]\>" +syn match javaNumber "\<\(0[bB][0-1]\+\|0[0-7]*\|0[xX]\x\+\|\d\(\d\|_\d\)*\)[lL]\=\>" +syn match javaNumber "\(\<\d\(\d\|_\d\)*\.\(\d\(\d\|_\d\)*\)\=\|\.\d\(\d\|_\d\)*\)\([eE][-+]\=\d\(\d\|_\d\)*\)\=[fFdD]\=" +syn match javaNumber "\<\d\(\d\|_\d\)*[eE][-+]\=\d\(\d\|_\d\)*[fFdD]\=\>" +syn match javaNumber "\<\d\(\d\|_\d\)*\([eE][-+]\=\d\(\d\|_\d\)*\)\=[fFdD]\>" " unicode characters syn match javaSpecial "\\u\d\{4\}" @@ -200,19 +200,21 @@ syn cluster javaTop add=javaString,javaCharacter,javaNumber,javaSpecial,javaStri if exists("java_highlight_functions") if java_highlight_functions == "indent" - syn match javaFuncDef "^\(\t\| \{8\}\)[_$a-zA-Z][_$a-zA-Z0-9_. \[\]]*([^-+*/()]*)" contains=javaScopeDecl,javaType,javaStorageClass,@javaClasses - syn region javaFuncDef start=+^\(\t\| \{8\}\)[$_a-zA-Z][$_a-zA-Z0-9_. \[\]]*([^-+*/()]*,\s*+ end=+)+ contains=javaScopeDecl,javaType,javaStorageClass,@javaClasses - syn match javaFuncDef "^ [$_a-zA-Z][$_a-zA-Z0-9_. \[\]]*([^-+*/()]*)" contains=javaScopeDecl,javaType,javaStorageClass,@javaClasses - syn region javaFuncDef start=+^ [$_a-zA-Z][$_a-zA-Z0-9_. \[\]]*([^-+*/()]*,\s*+ end=+)+ contains=javaScopeDecl,javaType,javaStorageClass,@javaClasses + syn match javaFuncDef "^\(\t\| \{8\}\)[_$a-zA-Z][_$a-zA-Z0-9_. \[\]<>]*([^-+*/]*)" contains=javaScopeDecl,javaType,javaStorageClass,@javaClasses,javaAnnotation + syn region javaFuncDef start=+^\(\t\| \{8\}\)[$_a-zA-Z][$_a-zA-Z0-9_. \[\]<>]*([^-+*/]*,\s*+ end=+)+ contains=javaScopeDecl,javaType,javaStorageClass,@javaClasses,javaAnnotation + syn match javaFuncDef "^ [$_a-zA-Z][$_a-zA-Z0-9_. \[\]<>]*([^-+*/]*)" contains=javaScopeDecl,javaType,javaStorageClass,@javaClasses,javaAnnotation + syn region javaFuncDef start=+^ [$_a-zA-Z][$_a-zA-Z0-9_. \[\]<>]*([^-+*/]*,\s*+ end=+)+ contains=javaScopeDecl,javaType,javaStorageClass,@javaClasses,javaAnnotation else " This line catches method declarations at any indentation>0, but it assumes " two things: " 1. class names are always capitalized (ie: Button) " 2. method names are never capitalized (except constructors, of course) - syn region javaFuncDef start=+^\s\+\(\(public\|protected\|private\|static\|abstract\|final\|native\|synchronized\)\s\+\)*\(\(void\|boolean\|char\|byte\|short\|int\|long\|float\|double\|\([A-Za-z_][A-Za-z0-9_$]*\.\)*[A-Z][A-Za-z0-9_$]*\)\(<[^>]*>\)\=\(\[\]\)*\s\+[a-z][A-Za-z0-9_$]*\|[A-Z][A-Za-z0-9_$]*\)\s*([^0-9]+ end=+)+ contains=javaScopeDecl,javaType,javaStorageClass,javaComment,javaLineComment,@javaClasses + "syn region javaFuncDef start=+^\s\+\(\(public\|protected\|private\|static\|abstract\|final\|native\|synchronized\)\s\+\)*\(\(void\|boolean\|char\|byte\|short\|int\|long\|float\|double\|\([A-Za-z_][A-Za-z0-9_$]*\.\)*[A-Z][A-Za-z0-9_$]*\)\(<[^>]*>\)\=\(\[\]\)*\s\+[a-z][A-Za-z0-9_$]*\|[A-Z][A-Za-z0-9_$]*\)\s*([^0-9]+ end=+)+ contains=javaScopeDecl,javaType,javaStorageClass,javaComment,javaLineComment,@javaClasses + syn region javaFuncDef start=+^\s\+\(\(public\|protected\|private\|static\|abstract\|final\|native\|synchronized\)\s\+\)*\(<.*>\s\+\)\?\(\(void\|boolean\|char\|byte\|short\|int\|long\|float\|double\|\([A-Za-z_][A-Za-z0-9_$]*\.\)*[A-Z][A-Za-z0-9_$]*\)\(<[^(){}]*>\)\=\(\[\]\)*\s\+[a-z][A-Za-z0-9_$]*\|[A-Z][A-Za-z0-9_$]*\)\s*(+ end=+)+ contains=javaScopeDecl,javaType,javaStorageClass,javaComment,javaLineComment,@javaClasses,javaAnnotation endif + syn match javaLambdaDef "[a-zA-Z_][a-zA-Z0-9_]*\s*->" syn match javaBraces "[{}]" - syn cluster javaTop add=javaFuncDef,javaBraces + syn cluster javaTop add=javaFuncDef,javaBraces,javaLambdaDef endif if exists("java_highlight_debug") @@ -266,18 +268,23 @@ if exists("java_mark_braces_in_parens_as_errors") endif " catch errors caused by wrong parenthesis -syn region javaParenT transparent matchgroup=javaParen start="(" end=")" contains=@javaTop,javaParenT1 +syn region javaParenT transparent matchgroup=javaParen start="(" end=")" contains=@javaTop,javaParenT1 syn region javaParenT1 transparent matchgroup=javaParen1 start="(" end=")" contains=@javaTop,javaParenT2 contained syn region javaParenT2 transparent matchgroup=javaParen2 start="(" end=")" contains=@javaTop,javaParenT contained syn match javaParenError ")" " catch errors caused by wrong square parenthesis -syn region javaParenT transparent matchgroup=javaParen start="\[" end="\]" contains=@javaTop,javaParenT1 +syn region javaParenT transparent matchgroup=javaParen start="\[" end="\]" contains=@javaTop,javaParenT1 syn region javaParenT1 transparent matchgroup=javaParen1 start="\[" end="\]" contains=@javaTop,javaParenT2 contained syn region javaParenT2 transparent matchgroup=javaParen2 start="\[" end="\]" contains=@javaTop,javaParenT contained syn match javaParenError "\]" JavaHiLink javaParenError javaError +if exists("java_highlight_functions") + syn match javaLambdaDef "([a-zA-Z0-9_<>\[\], \t]*)\s*->" + " needs to be defined after the parenthesis error catcher to work +endif + if !exists("java_minlines") let java_minlines = 10 endif @@ -288,6 +295,7 @@ if version >= 508 || !exists("did_java_syn_inits") if version < 508 let did_java_syn_inits = 1 endif + JavaHiLink javaLambdaDef Function JavaHiLink javaFuncDef Function JavaHiLink javaVarArg Function JavaHiLink javaBraces Function diff --git a/runtime/syntax/make.vim b/runtime/syntax/make.vim index 6fd46aaa54..35b09341a6 100644 --- a/runtime/syntax/make.vim +++ b/runtime/syntax/make.vim @@ -2,7 +2,7 @@ " Language: Makefile " Maintainer: Claudio Fleiner <claudio@fleiner.com> " URL: http://www.fleiner.com/vim/syntax/make.vim -" Last Change: 2012 Oct 05 +" Last Change: 2015 Feb 28 " For version 5.x: Clear all syntax items " For version 6.x: Quit when a syntax file was already loaded @@ -43,8 +43,8 @@ syn region makeIdent start="\$(" skip="\\)\|\\\\" end=")" contains=makeStatement syn region makeIdent start="\${" skip="\\}\|\\\\" end="}" contains=makeStatement,makeIdent,makeSString,makeDString syn match makeIdent "\$\$\w*" syn match makeIdent "\$[^({]" -syn match makeIdent "^ *\a\w*\s*[:+?!*]="me=e-2 -syn match makeIdent "^ *\a\w*\s*="me=e-1 +syn match makeIdent "^ *[^:#= \t]*\s*[:+?!*]="me=e-2 +syn match makeIdent "^ *[^:#= \t]*\s*="me=e-1 syn match makeIdent "%" " Makefile.in variables @@ -55,11 +55,11 @@ syn match makeConfig "@[A-Za-z0-9_]\+@" syn match makeImplicit "^\.[A-Za-z0-9_./\t -]\+\s*:$"me=e-1 nextgroup=makeSource syn match makeImplicit "^\.[A-Za-z0-9_./\t -]\+\s*:[^=]"me=e-2 nextgroup=makeSource -syn region makeTarget transparent matchgroup=makeTarget start="^[A-Za-z0-9_./$()%-][A-Za-z0-9_./\t $()%-]*:\{1,2}[^:=]"rs=e-1 end=";"re=e-1,me=e-1 end="[^\\]$" keepend contains=makeIdent,makeSpecTarget,makeNextLine skipnl nextGroup=makeCommands -syn match makeTarget "^[A-Za-z0-9_./$()%*@-][A-Za-z0-9_./\t $()%*@-]*::\=\s*$" contains=makeIdent,makeSpecTarget skipnl nextgroup=makeCommands,makeCommandError +syn region makeTarget transparent matchgroup=makeTarget start="^[~A-Za-z0-9_./$()%-][A-Za-z0-9_./\t $()%-]*:\{1,2}[^:=]"rs=e-1 end=";"re=e-1,me=e-1 end="[^\\]$" keepend contains=makeIdent,makeSpecTarget,makeNextLine,makeComment skipnl nextGroup=makeCommands +syn match makeTarget "^[~A-Za-z0-9_./$()%*@-][A-Za-z0-9_./\t $()%*@-]*::\=\s*$" contains=makeIdent,makeSpecTarget,makeComment skipnl nextgroup=makeCommands,makeCommandError -syn region makeSpecTarget transparent matchgroup=makeSpecTarget start="^\.\(SUFFIXES\|PHONY\|DEFAULT\|PRECIOUS\|IGNORE\|SILENT\|EXPORT_ALL_VARIABLES\|KEEP_STATE\|LIBPATTERNS\|NOTPARALLEL\|DELETE_ON_ERROR\|INTERMEDIATE\|POSIX\|SECONDARY\)\>\s*:\{1,2}[^:=]"rs=e-1 end="[^\\]$" keepend contains=makeIdent,makeSpecTarget,makeNextLine skipnl nextGroup=makeCommands -syn match makeSpecTarget "^\.\(SUFFIXES\|PHONY\|DEFAULT\|PRECIOUS\|IGNORE\|SILENT\|EXPORT_ALL_VARIABLES\|KEEP_STATE\|LIBPATTERNS\|NOTPARALLEL\|DELETE_ON_ERROR\|INTERMEDIATE\|POSIX\|SECONDARY\)\>\s*::\=\s*$" contains=makeIdent skipnl nextgroup=makeCommands,makeCommandError +syn region makeSpecTarget transparent matchgroup=makeSpecTarget start="^\.\(SUFFIXES\|PHONY\|DEFAULT\|PRECIOUS\|IGNORE\|SILENT\|EXPORT_ALL_VARIABLES\|KEEP_STATE\|LIBPATTERNS\|NOTPARALLEL\|DELETE_ON_ERROR\|INTERMEDIATE\|POSIX\|SECONDARY\)\>\s*:\{1,2}[^:=]"rs=e-1 end="[^\\]$" keepend contains=makeIdent,makeSpecTarget,makeNextLine,makeComment skipnl nextGroup=makeCommands +syn match makeSpecTarget "^\.\(SUFFIXES\|PHONY\|DEFAULT\|PRECIOUS\|IGNORE\|SILENT\|EXPORT_ALL_VARIABLES\|KEEP_STATE\|LIBPATTERNS\|NOTPARALLEL\|DELETE_ON_ERROR\|INTERMEDIATE\|POSIX\|SECONDARY\)\>\s*::\=\s*$" contains=makeIdent,makeComment skipnl nextgroup=makeCommands,makeCommandError syn match makeCommandError "^\s\+\S.*" contained syn region makeCommands start=";"hs=s+1 start="^\t" end="^[^\t#]"me=e-1,re=e-1 end="^$" contained contains=makeCmdNextLine,makeSpecial,makeComment,makeIdent,makePreCondit,makeDefine,makeDString,makeSString nextgroup=makeCommandError diff --git a/runtime/syntax/pfmain.vim b/runtime/syntax/pfmain.vim index a0904457a2..32ed6975c0 100644 --- a/runtime/syntax/pfmain.vim +++ b/runtime/syntax/pfmain.vim @@ -1,11 +1,11 @@ " Vim syntax file " Language: Postfix main.cf configuration " Maintainer: KELEMEN Peter <Peter dot Kelemen at cern dot ch> -" Last Update: Hong Xu -" Last Change: 2011 May 14 +" Last Updates: Anton Shestakov, Hong Xu +" Last Change: 2015 Feb 10 " Version: 0.40 " URL: http://cern.ch/fuji/vim/syntax/pfmain.vim -" Comment: Based on Postfix 2.9 defaults. +" Comment: Based on Postfix 2.12/3.0 postconf.5.html. if version < 600 syntax clear @@ -41,6 +41,7 @@ syntax keyword pfmainConf address_verify_relayhost syntax keyword pfmainConf address_verify_sender syntax keyword pfmainConf address_verify_sender_dependent_default_transport_maps syntax keyword pfmainConf address_verify_sender_dependent_relayhost_maps +syntax keyword pfmainConf address_verify_sender_ttl syntax keyword pfmainConf address_verify_service_name syntax keyword pfmainConf address_verify_transport_maps syntax keyword pfmainConf address_verify_virtual_transport @@ -52,6 +53,7 @@ syntax keyword pfmainConf allow_min_user syntax keyword pfmainConf allow_percent_hack syntax keyword pfmainConf allow_untrusted_routing syntax keyword pfmainConf alternate_config_directories +syntax keyword pfmainConf always_add_missing_headers syntax keyword pfmainConf always_bcc syntax keyword pfmainConf anvil_rate_time_unit syntax keyword pfmainConf anvil_status_update_time @@ -61,6 +63,7 @@ syntax keyword pfmainConf application_event_drain_time syntax keyword pfmainConf authorized_flush_users syntax keyword pfmainConf authorized_mailq_users syntax keyword pfmainConf authorized_submit_users +syntax keyword pfmainConf authorized_verp_clients syntax keyword pfmainConf backwards_bounce_logfile_compatibility syntax keyword pfmainConf berkeley_db_create_buffer_size syntax keyword pfmainConf berkeley_db_read_buffer_size @@ -81,7 +84,9 @@ syntax keyword pfmainConf command_directory syntax keyword pfmainConf command_execution_directory syntax keyword pfmainConf command_expansion_filter syntax keyword pfmainConf command_time_limit +syntax keyword pfmainConf compatibility_level syntax keyword pfmainConf config_directory +syntax keyword pfmainConf confirm_delay_cleared syntax keyword pfmainConf connection_cache_protocol_timeout syntax keyword pfmainConf connection_cache_service_name syntax keyword pfmainConf connection_cache_status_update_time @@ -89,14 +94,17 @@ syntax keyword pfmainConf connection_cache_ttl_limit syntax keyword pfmainConf content_filter syntax keyword pfmainConf cyrus_sasl_config_path syntax keyword pfmainConf daemon_directory +syntax keyword pfmainConf daemon_table_open_error_is_fatal syntax keyword pfmainConf daemon_timeout syntax keyword pfmainConf data_directory syntax keyword pfmainConf debug_peer_level syntax keyword pfmainConf debug_peer_list +syntax keyword pfmainConf debugger_command syntax keyword pfmainConf default_database_type syntax keyword pfmainConf default_delivery_slot_cost syntax keyword pfmainConf default_delivery_slot_discount syntax keyword pfmainConf default_delivery_slot_loan +syntax keyword pfmainConf default_delivery_status_filter syntax keyword pfmainConf default_destination_concurrency_failed_cohort_limit syntax keyword pfmainConf default_destination_concurrency_limit syntax keyword pfmainConf default_destination_concurrency_negative_feedback @@ -137,6 +145,7 @@ syntax keyword pfmainConf duplicate_filter_limit syntax keyword pfmainConf empty_address_default_transport_maps_lookup_key syntax keyword pfmainConf empty_address_recipient syntax keyword pfmainConf empty_address_relayhost_maps_lookup_key +syntax keyword pfmainConf enable_errors_to syntax keyword pfmainConf enable_long_queue_ids syntax keyword pfmainConf enable_original_recipient syntax keyword pfmainConf error_notice_recipient @@ -144,6 +153,8 @@ syntax keyword pfmainConf error_service_name syntax keyword pfmainConf execution_directory_expansion_filter syntax keyword pfmainConf expand_owner_alias syntax keyword pfmainConf export_environment +syntax keyword pfmainConf extract_recipient_limit +syntax keyword pfmainConf fallback_relay syntax keyword pfmainConf fallback_transport syntax keyword pfmainConf fallback_transport_maps syntax keyword pfmainConf fast_flush_domains @@ -177,25 +188,33 @@ syntax keyword pfmainConf ipc_idle syntax keyword pfmainConf ipc_timeout syntax keyword pfmainConf ipc_ttl syntax keyword pfmainConf line_length_limit +syntax keyword pfmainConf lmdb_map_size syntax keyword pfmainConf lmtp_address_preference +syntax keyword pfmainConf lmtp_address_verify_target +syntax keyword pfmainConf lmtp_assume_final syntax keyword pfmainConf lmtp_bind_address syntax keyword pfmainConf lmtp_bind_address6 syntax keyword pfmainConf lmtp_body_checks +syntax keyword pfmainConf lmtp_cache_connection syntax keyword pfmainConf lmtp_cname_overrides_servername syntax keyword pfmainConf lmtp_connect_timeout syntax keyword pfmainConf lmtp_connection_cache_destinations syntax keyword pfmainConf lmtp_connection_cache_on_demand syntax keyword pfmainConf lmtp_connection_cache_time_limit +syntax keyword pfmainConf lmtp_connection_reuse_count_limit syntax keyword pfmainConf lmtp_connection_reuse_time_limit syntax keyword pfmainConf lmtp_data_done_timeout syntax keyword pfmainConf lmtp_data_init_timeout syntax keyword pfmainConf lmtp_data_xfer_timeout syntax keyword pfmainConf lmtp_defer_if_no_mx_address_found +syntax keyword pfmainConf lmtp_delivery_status_filter syntax keyword pfmainConf lmtp_destination_concurrency_limit syntax keyword pfmainConf lmtp_destination_recipient_limit syntax keyword pfmainConf lmtp_discard_lhlo_keyword_address_maps syntax keyword pfmainConf lmtp_discard_lhlo_keywords +syntax keyword pfmainConf lmtp_dns_reply_filter syntax keyword pfmainConf lmtp_dns_resolver_options +syntax keyword pfmainConf lmtp_dns_support_level syntax keyword pfmainConf lmtp_enforce_tls syntax keyword pfmainConf lmtp_generic_maps syntax keyword pfmainConf lmtp_header_checks @@ -230,9 +249,11 @@ syntax keyword pfmainConf lmtp_sasl_security_options syntax keyword pfmainConf lmtp_sasl_tls_security_options syntax keyword pfmainConf lmtp_sasl_tls_verified_security_options syntax keyword pfmainConf lmtp_sasl_type +syntax keyword pfmainConf lmtp_send_dummy_mail_auth syntax keyword pfmainConf lmtp_send_xforward_command syntax keyword pfmainConf lmtp_sender_dependent_authentication syntax keyword pfmainConf lmtp_skip_5xx_greeting +syntax keyword pfmainConf lmtp_skip_quit_response syntax keyword pfmainConf lmtp_starttls_timeout syntax keyword pfmainConf lmtp_tcp_port syntax keyword pfmainConf lmtp_tls_CAfile @@ -248,6 +269,7 @@ syntax keyword pfmainConf lmtp_tls_enforce_peername syntax keyword pfmainConf lmtp_tls_exclude_ciphers syntax keyword pfmainConf lmtp_tls_fingerprint_cert_match syntax keyword pfmainConf lmtp_tls_fingerprint_digest +syntax keyword pfmainConf lmtp_tls_force_insecure_host_tlsa_lookup syntax keyword pfmainConf lmtp_tls_key_file syntax keyword pfmainConf lmtp_tls_loglevel syntax keyword pfmainConf lmtp_tls_mandatory_ciphers @@ -262,10 +284,12 @@ syntax keyword pfmainConf lmtp_tls_secure_cert_match syntax keyword pfmainConf lmtp_tls_security_level syntax keyword pfmainConf lmtp_tls_session_cache_database syntax keyword pfmainConf lmtp_tls_session_cache_timeout +syntax keyword pfmainConf lmtp_tls_trust_anchor_file syntax keyword pfmainConf lmtp_tls_verify_cert_match syntax keyword pfmainConf lmtp_use_tls syntax keyword pfmainConf lmtp_xforward_timeout syntax keyword pfmainConf local_command_shell +syntax keyword pfmainConf local_delivery_status_filter syntax keyword pfmainConf local_destination_concurrency_limit syntax keyword pfmainConf local_destination_recipient_limit syntax keyword pfmainConf local_header_rewrite_clients @@ -287,17 +311,19 @@ syntax keyword pfmainConf mailq_path syntax keyword pfmainConf manpage_directory syntax keyword pfmainConf maps_rbl_domains syntax keyword pfmainConf maps_rbl_reject_code -syntax keyword pfmainConf master_service_disable syntax keyword pfmainConf masquerade_classes syntax keyword pfmainConf masquerade_domains syntax keyword pfmainConf masquerade_exceptions +syntax keyword pfmainConf master_service_disable syntax keyword pfmainConf max_idle syntax keyword pfmainConf max_use syntax keyword pfmainConf maximal_backoff_time syntax keyword pfmainConf maximal_queue_lifetime +syntax keyword pfmainConf message_drop_headers syntax keyword pfmainConf message_reject_characters syntax keyword pfmainConf message_size_limit syntax keyword pfmainConf message_strip_characters +syntax keyword pfmainConf meta_directory syntax keyword pfmainConf milter_command_timeout syntax keyword pfmainConf milter_connect_macros syntax keyword pfmainConf milter_connect_timeout @@ -335,10 +361,12 @@ syntax keyword pfmainConf newaliases_path syntax keyword pfmainConf non_fqdn_reject_code syntax keyword pfmainConf non_smtpd_milters syntax keyword pfmainConf notify_classes +syntax keyword pfmainConf nullmx_reject_code syntax keyword pfmainConf owner_request_special syntax keyword pfmainConf parent_domain_matches_subdomains syntax keyword pfmainConf permit_mx_backup_networks syntax keyword pfmainConf pickup_service_name +syntax keyword pfmainConf pipe_delivery_status_filter syntax keyword pfmainConf plaintext_reject_code syntax keyword pfmainConf postmulti_control_commands syntax keyword pfmainConf postmulti_start_commands @@ -362,7 +390,9 @@ syntax keyword pfmainConf postscreen_dnsbl_action syntax keyword pfmainConf postscreen_dnsbl_reply_map syntax keyword pfmainConf postscreen_dnsbl_sites syntax keyword pfmainConf postscreen_dnsbl_threshold +syntax keyword pfmainConf postscreen_dnsbl_timeout syntax keyword pfmainConf postscreen_dnsbl_ttl +syntax keyword pfmainConf postscreen_dnsbl_whitelist_threshold syntax keyword pfmainConf postscreen_enforce_tls syntax keyword pfmainConf postscreen_expansion_filter syntax keyword pfmainConf postscreen_forbidden_commands @@ -381,6 +411,8 @@ syntax keyword pfmainConf postscreen_post_queue_limit syntax keyword pfmainConf postscreen_pre_queue_limit syntax keyword pfmainConf postscreen_reject_footer syntax keyword pfmainConf postscreen_tls_security_level +syntax keyword pfmainConf postscreen_upstream_proxy_protocol +syntax keyword pfmainConf postscreen_upstream_proxy_timeout syntax keyword pfmainConf postscreen_use_tls syntax keyword pfmainConf postscreen_watchdog_timeout syntax keyword pfmainConf postscreen_whitelist_interfaces @@ -395,7 +427,9 @@ syntax keyword pfmainConf proxy_write_maps syntax keyword pfmainConf proxymap_service_name syntax keyword pfmainConf proxywrite_service_name syntax keyword pfmainConf qmgr_clog_warn_time +syntax keyword pfmainConf qmgr_daemon_timeout syntax keyword pfmainConf qmgr_fudge_factor +syntax keyword pfmainConf qmgr_ipc_timeout syntax keyword pfmainConf qmgr_message_active_limit syntax keyword pfmainConf qmgr_message_recipient_limit syntax keyword pfmainConf qmgr_message_recipient_minimum @@ -435,17 +469,21 @@ syntax keyword pfmainConf resolve_numeric_domain syntax keyword pfmainConf rewrite_service_name syntax keyword pfmainConf sample_directory syntax keyword pfmainConf send_cyrus_sasl_authzid +syntax keyword pfmainConf sender_based_routing syntax keyword pfmainConf sender_bcc_maps syntax keyword pfmainConf sender_canonical_classes syntax keyword pfmainConf sender_canonical_maps syntax keyword pfmainConf sender_dependent_default_transport_maps syntax keyword pfmainConf sender_dependent_relayhost_maps +syntax keyword pfmainConf sendmail_fix_line_endings syntax keyword pfmainConf sendmail_path syntax keyword pfmainConf service_throttle_time syntax keyword pfmainConf setgid_group +syntax keyword pfmainConf shlib_directory syntax keyword pfmainConf show_user_unknown_table_name syntax keyword pfmainConf showq_service_name syntax keyword pfmainConf smtp_address_preference +syntax keyword pfmainConf smtp_address_verify_target syntax keyword pfmainConf smtp_always_send_ehlo syntax keyword pfmainConf smtp_bind_address syntax keyword pfmainConf smtp_bind_address6 @@ -455,16 +493,20 @@ syntax keyword pfmainConf smtp_connect_timeout syntax keyword pfmainConf smtp_connection_cache_destinations syntax keyword pfmainConf smtp_connection_cache_on_demand syntax keyword pfmainConf smtp_connection_cache_time_limit +syntax keyword pfmainConf smtp_connection_reuse_count_limit syntax keyword pfmainConf smtp_connection_reuse_time_limit syntax keyword pfmainConf smtp_data_done_timeout syntax keyword pfmainConf smtp_data_init_timeout syntax keyword pfmainConf smtp_data_xfer_timeout syntax keyword pfmainConf smtp_defer_if_no_mx_address_found +syntax keyword pfmainConf smtp_delivery_status_filter syntax keyword pfmainConf smtp_destination_concurrency_limit syntax keyword pfmainConf smtp_destination_recipient_limit syntax keyword pfmainConf smtp_discard_ehlo_keyword_address_maps syntax keyword pfmainConf smtp_discard_ehlo_keywords +syntax keyword pfmainConf smtp_dns_reply_filter syntax keyword pfmainConf smtp_dns_resolver_options +syntax keyword pfmainConf smtp_dns_support_level syntax keyword pfmainConf smtp_enforce_tls syntax keyword pfmainConf smtp_fallback_relay syntax keyword pfmainConf smtp_generic_maps @@ -479,6 +521,7 @@ syntax keyword pfmainConf smtp_mx_address_limit syntax keyword pfmainConf smtp_mx_session_limit syntax keyword pfmainConf smtp_nested_header_checks syntax keyword pfmainConf smtp_never_send_ehlo +syntax keyword pfmainConf smtp_per_record_deadline syntax keyword pfmainConf smtp_pix_workaround_delay_time syntax keyword pfmainConf smtp_pix_workaround_maps syntax keyword pfmainConf smtp_pix_workaround_threshold_time @@ -500,8 +543,10 @@ syntax keyword pfmainConf smtp_sasl_security_options syntax keyword pfmainConf smtp_sasl_tls_security_options syntax keyword pfmainConf smtp_sasl_tls_verified_security_options syntax keyword pfmainConf smtp_sasl_type +syntax keyword pfmainConf smtp_send_dummy_mail_auth syntax keyword pfmainConf smtp_send_xforward_command syntax keyword pfmainConf smtp_sender_dependent_authentication +syntax keyword pfmainConf smtp_skip_4xx_greeting syntax keyword pfmainConf smtp_skip_5xx_greeting syntax keyword pfmainConf smtp_skip_quit_response syntax keyword pfmainConf smtp_starttls_timeout @@ -519,6 +564,7 @@ syntax keyword pfmainConf smtp_tls_enforce_peername syntax keyword pfmainConf smtp_tls_exclude_ciphers syntax keyword pfmainConf smtp_tls_fingerprint_cert_match syntax keyword pfmainConf smtp_tls_fingerprint_digest +syntax keyword pfmainConf smtp_tls_force_insecure_host_tlsa_lookup syntax keyword pfmainConf smtp_tls_key_file syntax keyword pfmainConf smtp_tls_loglevel syntax keyword pfmainConf smtp_tls_mandatory_ciphers @@ -533,7 +579,9 @@ syntax keyword pfmainConf smtp_tls_secure_cert_match syntax keyword pfmainConf smtp_tls_security_level syntax keyword pfmainConf smtp_tls_session_cache_database syntax keyword pfmainConf smtp_tls_session_cache_timeout +syntax keyword pfmainConf smtp_tls_trust_anchor_file syntax keyword pfmainConf smtp_tls_verify_cert_match +syntax keyword pfmainConf smtp_tls_wrappermode syntax keyword pfmainConf smtp_use_tls syntax keyword pfmainConf smtp_xforward_timeout syntax keyword pfmainConf smtpd_authorized_verp_clients @@ -554,6 +602,7 @@ syntax keyword pfmainConf smtpd_delay_open_until_valid_rcpt syntax keyword pfmainConf smtpd_delay_reject syntax keyword pfmainConf smtpd_discard_ehlo_keyword_address_maps syntax keyword pfmainConf smtpd_discard_ehlo_keywords +syntax keyword pfmainConf smtpd_dns_reply_filter syntax keyword pfmainConf smtpd_end_of_data_restrictions syntax keyword pfmainConf smtpd_enforce_tls syntax keyword pfmainConf smtpd_error_sleep_time @@ -565,14 +614,19 @@ syntax keyword pfmainConf smtpd_helo_required syntax keyword pfmainConf smtpd_helo_restrictions syntax keyword pfmainConf smtpd_history_flush_threshold syntax keyword pfmainConf smtpd_junk_command_limit +syntax keyword pfmainConf smtpd_log_access_permit_actions syntax keyword pfmainConf smtpd_milters syntax keyword pfmainConf smtpd_noop_commands syntax keyword pfmainConf smtpd_null_access_lookup_key syntax keyword pfmainConf smtpd_peername_lookup syntax keyword pfmainConf smtpd_per_record_deadline +syntax keyword pfmainConf smtpd_policy_service_default_action syntax keyword pfmainConf smtpd_policy_service_max_idle syntax keyword pfmainConf smtpd_policy_service_max_ttl +syntax keyword pfmainConf smtpd_policy_service_request_limit +syntax keyword pfmainConf smtpd_policy_service_retry_delay syntax keyword pfmainConf smtpd_policy_service_timeout +syntax keyword pfmainConf smtpd_policy_service_try_limit syntax keyword pfmainConf smtpd_proxy_ehlo syntax keyword pfmainConf smtpd_proxy_filter syntax keyword pfmainConf smtpd_proxy_options @@ -583,13 +637,16 @@ syntax keyword pfmainConf smtpd_recipient_restrictions syntax keyword pfmainConf smtpd_reject_footer syntax keyword pfmainConf smtpd_reject_unlisted_recipient syntax keyword pfmainConf smtpd_reject_unlisted_sender +syntax keyword pfmainConf smtpd_relay_restrictions syntax keyword pfmainConf smtpd_restriction_classes +syntax keyword pfmainConf smtpd_sasl_application_name syntax keyword pfmainConf smtpd_sasl_auth_enable syntax keyword pfmainConf smtpd_sasl_authenticated_header syntax keyword pfmainConf smtpd_sasl_exceptions_networks syntax keyword pfmainConf smtpd_sasl_local_domain syntax keyword pfmainConf smtpd_sasl_path syntax keyword pfmainConf smtpd_sasl_security_options +syntax keyword pfmainConf smtpd_sasl_service syntax keyword pfmainConf smtpd_sasl_tls_security_options syntax keyword pfmainConf smtpd_sasl_type syntax keyword pfmainConf smtpd_sender_login_maps @@ -628,21 +685,21 @@ syntax keyword pfmainConf smtpd_tls_security_level syntax keyword pfmainConf smtpd_tls_session_cache_database syntax keyword pfmainConf smtpd_tls_session_cache_timeout syntax keyword pfmainConf smtpd_tls_wrappermode +syntax keyword pfmainConf smtpd_upstream_proxy_protocol +syntax keyword pfmainConf smtpd_upstream_proxy_timeout syntax keyword pfmainConf smtpd_use_tls +syntax keyword pfmainConf smtputf8_autodetect_classes +syntax keyword pfmainConf smtputf8_enable syntax keyword pfmainConf soft_bounce syntax keyword pfmainConf stale_lock_time syntax keyword pfmainConf stress syntax keyword pfmainConf strict_7bit_headers syntax keyword pfmainConf strict_8bitmime syntax keyword pfmainConf strict_8bitmime_body -syntax keyword pfmainConf strict_mime_encoding_domain -syntax keyword pfmainConf strict_rfc821_envelopes -syntax keyword pfmainConf strict_7bit_headers -syntax keyword pfmainConf strict_8bitmime -syntax keyword pfmainConf strict_8bitmime_body syntax keyword pfmainConf strict_mailbox_ownership syntax keyword pfmainConf strict_mime_encoding_domain syntax keyword pfmainConf strict_rfc821_envelopes +syntax keyword pfmainConf strict_smtputf8 syntax keyword pfmainConf sun_mailtool_compatibility syntax keyword pfmainConf swap_bangpath syntax keyword pfmainConf syslog_facility @@ -650,11 +707,15 @@ syntax keyword pfmainConf syslog_name syntax keyword pfmainConf tcp_windowsize syntax keyword pfmainConf tls_append_default_CA syntax keyword pfmainConf tls_daemon_random_bytes +syntax keyword pfmainConf tls_dane_digest_agility +syntax keyword pfmainConf tls_dane_digests +syntax keyword pfmainConf tls_dane_trust_anchor_digest_enable syntax keyword pfmainConf tls_disable_workarounds syntax keyword pfmainConf tls_eecdh_strong_curve syntax keyword pfmainConf tls_eecdh_ultra_curve syntax keyword pfmainConf tls_export_cipherlist syntax keyword pfmainConf tls_high_cipherlist +syntax keyword pfmainConf tls_legacy_public_key_fingerprints syntax keyword pfmainConf tls_low_cipherlist syntax keyword pfmainConf tls_medium_cipherlist syntax keyword pfmainConf tls_null_cipherlist @@ -664,6 +725,10 @@ syntax keyword pfmainConf tls_random_exchange_name syntax keyword pfmainConf tls_random_prng_update_period syntax keyword pfmainConf tls_random_reseed_period syntax keyword pfmainConf tls_random_source +syntax keyword pfmainConf tls_session_ticket_cipher +syntax keyword pfmainConf tls_ssl_options +syntax keyword pfmainConf tls_wildcard_matches_multiple_labels +syntax keyword pfmainConf tlsmgr_service_name syntax keyword pfmainConf tlsproxy_enforce_tls syntax keyword pfmainConf tlsproxy_service_name syntax keyword pfmainConf tlsproxy_tls_CAfile @@ -711,6 +776,7 @@ syntax keyword pfmainConf transport_recipient_limit syntax keyword pfmainConf transport_recipient_refill_delay syntax keyword pfmainConf transport_recipient_refill_limit syntax keyword pfmainConf transport_retry_time +syntax keyword pfmainConf transport_time_limit syntax keyword pfmainConf trigger_timeout syntax keyword pfmainConf undisclosed_recipients_header syntax keyword pfmainConf unknown_address_reject_code @@ -731,10 +797,12 @@ syntax keyword pfmainConf unverified_sender_reject_code syntax keyword pfmainConf unverified_sender_reject_reason syntax keyword pfmainConf unverified_sender_tempfail_action syntax keyword pfmainConf verp_delimiter_filter +syntax keyword pfmainConf virtual_alias_address_length_limit syntax keyword pfmainConf virtual_alias_domains syntax keyword pfmainConf virtual_alias_expansion_limit syntax keyword pfmainConf virtual_alias_maps syntax keyword pfmainConf virtual_alias_recursion_limit +syntax keyword pfmainConf virtual_delivery_status_filter syntax keyword pfmainConf virtual_destination_concurrency_limit syntax keyword pfmainConf virtual_destination_recipient_limit syntax keyword pfmainConf virtual_gid_maps @@ -743,6 +811,7 @@ syntax keyword pfmainConf virtual_mailbox_domains syntax keyword pfmainConf virtual_mailbox_limit syntax keyword pfmainConf virtual_mailbox_lock syntax keyword pfmainConf virtual_mailbox_maps +syntax keyword pfmainConf virtual_maps syntax keyword pfmainConf virtual_minimum_uid syntax keyword pfmainConf virtual_transport syntax keyword pfmainConf virtual_uid_maps @@ -765,6 +834,7 @@ syntax match pfmainRef "$\<address_verify_relayhost\>" syntax match pfmainRef "$\<address_verify_sender\>" syntax match pfmainRef "$\<address_verify_sender_dependent_default_transport_maps\>" syntax match pfmainRef "$\<address_verify_sender_dependent_relayhost_maps\>" +syntax match pfmainRef "$\<address_verify_sender_ttl\>" syntax match pfmainRef "$\<address_verify_service_name\>" syntax match pfmainRef "$\<address_verify_transport_maps\>" syntax match pfmainRef "$\<address_verify_virtual_transport\>" @@ -776,6 +846,7 @@ syntax match pfmainRef "$\<allow_min_user\>" syntax match pfmainRef "$\<allow_percent_hack\>" syntax match pfmainRef "$\<allow_untrusted_routing\>" syntax match pfmainRef "$\<alternate_config_directories\>" +syntax match pfmainRef "$\<always_add_missing_headers\>" syntax match pfmainRef "$\<always_bcc\>" syntax match pfmainRef "$\<anvil_rate_time_unit\>" syntax match pfmainRef "$\<anvil_status_update_time\>" @@ -785,6 +856,7 @@ syntax match pfmainRef "$\<application_event_drain_time\>" syntax match pfmainRef "$\<authorized_flush_users\>" syntax match pfmainRef "$\<authorized_mailq_users\>" syntax match pfmainRef "$\<authorized_submit_users\>" +syntax match pfmainRef "$\<authorized_verp_clients\>" syntax match pfmainRef "$\<backwards_bounce_logfile_compatibility\>" syntax match pfmainRef "$\<berkeley_db_create_buffer_size\>" syntax match pfmainRef "$\<berkeley_db_read_buffer_size\>" @@ -805,7 +877,9 @@ syntax match pfmainRef "$\<command_directory\>" syntax match pfmainRef "$\<command_execution_directory\>" syntax match pfmainRef "$\<command_expansion_filter\>" syntax match pfmainRef "$\<command_time_limit\>" +syntax match pfmainRef "$\<compatibility_level\>" syntax match pfmainRef "$\<config_directory\>" +syntax match pfmainRef "$\<confirm_delay_cleared\>" syntax match pfmainRef "$\<connection_cache_protocol_timeout\>" syntax match pfmainRef "$\<connection_cache_service_name\>" syntax match pfmainRef "$\<connection_cache_status_update_time\>" @@ -813,14 +887,17 @@ syntax match pfmainRef "$\<connection_cache_ttl_limit\>" syntax match pfmainRef "$\<content_filter\>" syntax match pfmainRef "$\<cyrus_sasl_config_path\>" syntax match pfmainRef "$\<daemon_directory\>" +syntax match pfmainRef "$\<daemon_table_open_error_is_fatal\>" syntax match pfmainRef "$\<daemon_timeout\>" syntax match pfmainRef "$\<data_directory\>" syntax match pfmainRef "$\<debug_peer_level\>" syntax match pfmainRef "$\<debug_peer_list\>" +syntax match pfmainRef "$\<debugger_command\>" syntax match pfmainRef "$\<default_database_type\>" syntax match pfmainRef "$\<default_delivery_slot_cost\>" syntax match pfmainRef "$\<default_delivery_slot_discount\>" syntax match pfmainRef "$\<default_delivery_slot_loan\>" +syntax match pfmainRef "$\<default_delivery_status_filter\>" syntax match pfmainRef "$\<default_destination_concurrency_failed_cohort_limit\>" syntax match pfmainRef "$\<default_destination_concurrency_limit\>" syntax match pfmainRef "$\<default_destination_concurrency_negative_feedback\>" @@ -861,6 +938,7 @@ syntax match pfmainRef "$\<duplicate_filter_limit\>" syntax match pfmainRef "$\<empty_address_default_transport_maps_lookup_key\>" syntax match pfmainRef "$\<empty_address_recipient\>" syntax match pfmainRef "$\<empty_address_relayhost_maps_lookup_key\>" +syntax match pfmainRef "$\<enable_errors_to\>" syntax match pfmainRef "$\<enable_long_queue_ids\>" syntax match pfmainRef "$\<enable_original_recipient\>" syntax match pfmainRef "$\<error_notice_recipient\>" @@ -868,6 +946,8 @@ syntax match pfmainRef "$\<error_service_name\>" syntax match pfmainRef "$\<execution_directory_expansion_filter\>" syntax match pfmainRef "$\<expand_owner_alias\>" syntax match pfmainRef "$\<export_environment\>" +syntax match pfmainRef "$\<extract_recipient_limit\>" +syntax match pfmainRef "$\<fallback_relay\>" syntax match pfmainRef "$\<fallback_transport\>" syntax match pfmainRef "$\<fallback_transport_maps\>" syntax match pfmainRef "$\<fast_flush_domains\>" @@ -901,25 +981,33 @@ syntax match pfmainRef "$\<ipc_idle\>" syntax match pfmainRef "$\<ipc_timeout\>" syntax match pfmainRef "$\<ipc_ttl\>" syntax match pfmainRef "$\<line_length_limit\>" +syntax match pfmainRef "$\<lmdb_map_size\>" syntax match pfmainRef "$\<lmtp_address_preference\>" +syntax match pfmainRef "$\<lmtp_address_verify_target\>" +syntax match pfmainRef "$\<lmtp_assume_final\>" syntax match pfmainRef "$\<lmtp_bind_address\>" syntax match pfmainRef "$\<lmtp_bind_address6\>" syntax match pfmainRef "$\<lmtp_body_checks\>" +syntax match pfmainRef "$\<lmtp_cache_connection\>" syntax match pfmainRef "$\<lmtp_cname_overrides_servername\>" syntax match pfmainRef "$\<lmtp_connect_timeout\>" syntax match pfmainRef "$\<lmtp_connection_cache_destinations\>" syntax match pfmainRef "$\<lmtp_connection_cache_on_demand\>" syntax match pfmainRef "$\<lmtp_connection_cache_time_limit\>" +syntax match pfmainRef "$\<lmtp_connection_reuse_count_limit\>" syntax match pfmainRef "$\<lmtp_connection_reuse_time_limit\>" syntax match pfmainRef "$\<lmtp_data_done_timeout\>" syntax match pfmainRef "$\<lmtp_data_init_timeout\>" syntax match pfmainRef "$\<lmtp_data_xfer_timeout\>" syntax match pfmainRef "$\<lmtp_defer_if_no_mx_address_found\>" +syntax match pfmainRef "$\<lmtp_delivery_status_filter\>" syntax match pfmainRef "$\<lmtp_destination_concurrency_limit\>" syntax match pfmainRef "$\<lmtp_destination_recipient_limit\>" syntax match pfmainRef "$\<lmtp_discard_lhlo_keyword_address_maps\>" syntax match pfmainRef "$\<lmtp_discard_lhlo_keywords\>" +syntax match pfmainRef "$\<lmtp_dns_reply_filter\>" syntax match pfmainRef "$\<lmtp_dns_resolver_options\>" +syntax match pfmainRef "$\<lmtp_dns_support_level\>" syntax match pfmainRef "$\<lmtp_enforce_tls\>" syntax match pfmainRef "$\<lmtp_generic_maps\>" syntax match pfmainRef "$\<lmtp_header_checks\>" @@ -954,9 +1042,11 @@ syntax match pfmainRef "$\<lmtp_sasl_security_options\>" syntax match pfmainRef "$\<lmtp_sasl_tls_security_options\>" syntax match pfmainRef "$\<lmtp_sasl_tls_verified_security_options\>" syntax match pfmainRef "$\<lmtp_sasl_type\>" +syntax match pfmainRef "$\<lmtp_send_dummy_mail_auth\>" syntax match pfmainRef "$\<lmtp_send_xforward_command\>" syntax match pfmainRef "$\<lmtp_sender_dependent_authentication\>" syntax match pfmainRef "$\<lmtp_skip_5xx_greeting\>" +syntax match pfmainRef "$\<lmtp_skip_quit_response\>" syntax match pfmainRef "$\<lmtp_starttls_timeout\>" syntax match pfmainRef "$\<lmtp_tcp_port\>" syntax match pfmainRef "$\<lmtp_tls_CAfile\>" @@ -972,6 +1062,7 @@ syntax match pfmainRef "$\<lmtp_tls_enforce_peername\>" syntax match pfmainRef "$\<lmtp_tls_exclude_ciphers\>" syntax match pfmainRef "$\<lmtp_tls_fingerprint_cert_match\>" syntax match pfmainRef "$\<lmtp_tls_fingerprint_digest\>" +syntax match pfmainRef "$\<lmtp_tls_force_insecure_host_tlsa_lookup\>" syntax match pfmainRef "$\<lmtp_tls_key_file\>" syntax match pfmainRef "$\<lmtp_tls_loglevel\>" syntax match pfmainRef "$\<lmtp_tls_mandatory_ciphers\>" @@ -982,11 +1073,16 @@ syntax match pfmainRef "$\<lmtp_tls_per_site\>" syntax match pfmainRef "$\<lmtp_tls_policy_maps\>" syntax match pfmainRef "$\<lmtp_tls_protocols\>" syntax match pfmainRef "$\<lmtp_tls_scert_verifydepth\>" +syntax match pfmainRef "$\<lmtp_tls_secure_cert_match\>" +syntax match pfmainRef "$\<lmtp_tls_security_level\>" +syntax match pfmainRef "$\<lmtp_tls_session_cache_database\>" syntax match pfmainRef "$\<lmtp_tls_session_cache_timeout\>" +syntax match pfmainRef "$\<lmtp_tls_trust_anchor_file\>" syntax match pfmainRef "$\<lmtp_tls_verify_cert_match\>" syntax match pfmainRef "$\<lmtp_use_tls\>" syntax match pfmainRef "$\<lmtp_xforward_timeout\>" syntax match pfmainRef "$\<local_command_shell\>" +syntax match pfmainRef "$\<local_delivery_status_filter\>" syntax match pfmainRef "$\<local_destination_concurrency_limit\>" syntax match pfmainRef "$\<local_destination_recipient_limit\>" syntax match pfmainRef "$\<local_header_rewrite_clients\>" @@ -1008,17 +1104,19 @@ syntax match pfmainRef "$\<mailq_path\>" syntax match pfmainRef "$\<manpage_directory\>" syntax match pfmainRef "$\<maps_rbl_domains\>" syntax match pfmainRef "$\<maps_rbl_reject_code\>" -syntax match pfmainRef "$\<master_service_disable\>" syntax match pfmainRef "$\<masquerade_classes\>" syntax match pfmainRef "$\<masquerade_domains\>" syntax match pfmainRef "$\<masquerade_exceptions\>" +syntax match pfmainRef "$\<master_service_disable\>" syntax match pfmainRef "$\<max_idle\>" syntax match pfmainRef "$\<max_use\>" syntax match pfmainRef "$\<maximal_backoff_time\>" syntax match pfmainRef "$\<maximal_queue_lifetime\>" +syntax match pfmainRef "$\<message_drop_headers\>" syntax match pfmainRef "$\<message_reject_characters\>" syntax match pfmainRef "$\<message_size_limit\>" syntax match pfmainRef "$\<message_strip_characters\>" +syntax match pfmainRef "$\<meta_directory\>" syntax match pfmainRef "$\<milter_command_timeout\>" syntax match pfmainRef "$\<milter_connect_macros\>" syntax match pfmainRef "$\<milter_connect_timeout\>" @@ -1056,10 +1154,12 @@ syntax match pfmainRef "$\<newaliases_path\>" syntax match pfmainRef "$\<non_fqdn_reject_code\>" syntax match pfmainRef "$\<non_smtpd_milters\>" syntax match pfmainRef "$\<notify_classes\>" +syntax match pfmainRef "$\<nullmx_reject_code\>" syntax match pfmainRef "$\<owner_request_special\>" syntax match pfmainRef "$\<parent_domain_matches_subdomains\>" syntax match pfmainRef "$\<permit_mx_backup_networks\>" syntax match pfmainRef "$\<pickup_service_name\>" +syntax match pfmainRef "$\<pipe_delivery_status_filter\>" syntax match pfmainRef "$\<plaintext_reject_code\>" syntax match pfmainRef "$\<postmulti_control_commands\>" syntax match pfmainRef "$\<postmulti_start_commands\>" @@ -1083,7 +1183,9 @@ syntax match pfmainRef "$\<postscreen_dnsbl_action\>" syntax match pfmainRef "$\<postscreen_dnsbl_reply_map\>" syntax match pfmainRef "$\<postscreen_dnsbl_sites\>" syntax match pfmainRef "$\<postscreen_dnsbl_threshold\>" +syntax match pfmainRef "$\<postscreen_dnsbl_timeout\>" syntax match pfmainRef "$\<postscreen_dnsbl_ttl\>" +syntax match pfmainRef "$\<postscreen_dnsbl_whitelist_threshold\>" syntax match pfmainRef "$\<postscreen_enforce_tls\>" syntax match pfmainRef "$\<postscreen_expansion_filter\>" syntax match pfmainRef "$\<postscreen_forbidden_commands\>" @@ -1102,9 +1204,8 @@ syntax match pfmainRef "$\<postscreen_post_queue_limit\>" syntax match pfmainRef "$\<postscreen_pre_queue_limit\>" syntax match pfmainRef "$\<postscreen_reject_footer\>" syntax match pfmainRef "$\<postscreen_tls_security_level\>" -syntax match pfmainRef "$\<lmtp_tls_secure_cert_match\>" -syntax match pfmainRef "$\<lmtp_tls_security_level\>" -syntax match pfmainRef "$\<lmtp_tls_session_cache_database\>" +syntax match pfmainRef "$\<postscreen_upstream_proxy_protocol\>" +syntax match pfmainRef "$\<postscreen_upstream_proxy_timeout\>" syntax match pfmainRef "$\<postscreen_use_tls\>" syntax match pfmainRef "$\<postscreen_watchdog_timeout\>" syntax match pfmainRef "$\<postscreen_whitelist_interfaces\>" @@ -1119,7 +1220,9 @@ syntax match pfmainRef "$\<proxy_write_maps\>" syntax match pfmainRef "$\<proxymap_service_name\>" syntax match pfmainRef "$\<proxywrite_service_name\>" syntax match pfmainRef "$\<qmgr_clog_warn_time\>" +syntax match pfmainRef "$\<qmgr_daemon_timeout\>" syntax match pfmainRef "$\<qmgr_fudge_factor\>" +syntax match pfmainRef "$\<qmgr_ipc_timeout\>" syntax match pfmainRef "$\<qmgr_message_active_limit\>" syntax match pfmainRef "$\<qmgr_message_recipient_limit\>" syntax match pfmainRef "$\<qmgr_message_recipient_minimum\>" @@ -1159,17 +1262,21 @@ syntax match pfmainRef "$\<resolve_numeric_domain\>" syntax match pfmainRef "$\<rewrite_service_name\>" syntax match pfmainRef "$\<sample_directory\>" syntax match pfmainRef "$\<send_cyrus_sasl_authzid\>" +syntax match pfmainRef "$\<sender_based_routing\>" syntax match pfmainRef "$\<sender_bcc_maps\>" syntax match pfmainRef "$\<sender_canonical_classes\>" syntax match pfmainRef "$\<sender_canonical_maps\>" syntax match pfmainRef "$\<sender_dependent_default_transport_maps\>" syntax match pfmainRef "$\<sender_dependent_relayhost_maps\>" +syntax match pfmainRef "$\<sendmail_fix_line_endings\>" syntax match pfmainRef "$\<sendmail_path\>" syntax match pfmainRef "$\<service_throttle_time\>" syntax match pfmainRef "$\<setgid_group\>" +syntax match pfmainRef "$\<shlib_directory\>" syntax match pfmainRef "$\<show_user_unknown_table_name\>" syntax match pfmainRef "$\<showq_service_name\>" syntax match pfmainRef "$\<smtp_address_preference\>" +syntax match pfmainRef "$\<smtp_address_verify_target\>" syntax match pfmainRef "$\<smtp_always_send_ehlo\>" syntax match pfmainRef "$\<smtp_bind_address\>" syntax match pfmainRef "$\<smtp_bind_address6\>" @@ -1179,16 +1286,20 @@ syntax match pfmainRef "$\<smtp_connect_timeout\>" syntax match pfmainRef "$\<smtp_connection_cache_destinations\>" syntax match pfmainRef "$\<smtp_connection_cache_on_demand\>" syntax match pfmainRef "$\<smtp_connection_cache_time_limit\>" +syntax match pfmainRef "$\<smtp_connection_reuse_count_limit\>" syntax match pfmainRef "$\<smtp_connection_reuse_time_limit\>" syntax match pfmainRef "$\<smtp_data_done_timeout\>" syntax match pfmainRef "$\<smtp_data_init_timeout\>" syntax match pfmainRef "$\<smtp_data_xfer_timeout\>" syntax match pfmainRef "$\<smtp_defer_if_no_mx_address_found\>" +syntax match pfmainRef "$\<smtp_delivery_status_filter\>" syntax match pfmainRef "$\<smtp_destination_concurrency_limit\>" syntax match pfmainRef "$\<smtp_destination_recipient_limit\>" syntax match pfmainRef "$\<smtp_discard_ehlo_keyword_address_maps\>" syntax match pfmainRef "$\<smtp_discard_ehlo_keywords\>" +syntax match pfmainRef "$\<smtp_dns_reply_filter\>" syntax match pfmainRef "$\<smtp_dns_resolver_options\>" +syntax match pfmainRef "$\<smtp_dns_support_level\>" syntax match pfmainRef "$\<smtp_enforce_tls\>" syntax match pfmainRef "$\<smtp_fallback_relay\>" syntax match pfmainRef "$\<smtp_generic_maps\>" @@ -1203,6 +1314,7 @@ syntax match pfmainRef "$\<smtp_mx_address_limit\>" syntax match pfmainRef "$\<smtp_mx_session_limit\>" syntax match pfmainRef "$\<smtp_nested_header_checks\>" syntax match pfmainRef "$\<smtp_never_send_ehlo\>" +syntax match pfmainRef "$\<smtp_per_record_deadline\>" syntax match pfmainRef "$\<smtp_pix_workaround_delay_time\>" syntax match pfmainRef "$\<smtp_pix_workaround_maps\>" syntax match pfmainRef "$\<smtp_pix_workaround_threshold_time\>" @@ -1224,8 +1336,10 @@ syntax match pfmainRef "$\<smtp_sasl_security_options\>" syntax match pfmainRef "$\<smtp_sasl_tls_security_options\>" syntax match pfmainRef "$\<smtp_sasl_tls_verified_security_options\>" syntax match pfmainRef "$\<smtp_sasl_type\>" +syntax match pfmainRef "$\<smtp_send_dummy_mail_auth\>" syntax match pfmainRef "$\<smtp_send_xforward_command\>" syntax match pfmainRef "$\<smtp_sender_dependent_authentication\>" +syntax match pfmainRef "$\<smtp_skip_4xx_greeting\>" syntax match pfmainRef "$\<smtp_skip_5xx_greeting\>" syntax match pfmainRef "$\<smtp_skip_quit_response\>" syntax match pfmainRef "$\<smtp_starttls_timeout\>" @@ -1243,6 +1357,7 @@ syntax match pfmainRef "$\<smtp_tls_enforce_peername\>" syntax match pfmainRef "$\<smtp_tls_exclude_ciphers\>" syntax match pfmainRef "$\<smtp_tls_fingerprint_cert_match\>" syntax match pfmainRef "$\<smtp_tls_fingerprint_digest\>" +syntax match pfmainRef "$\<smtp_tls_force_insecure_host_tlsa_lookup\>" syntax match pfmainRef "$\<smtp_tls_key_file\>" syntax match pfmainRef "$\<smtp_tls_loglevel\>" syntax match pfmainRef "$\<smtp_tls_mandatory_ciphers\>" @@ -1257,7 +1372,9 @@ syntax match pfmainRef "$\<smtp_tls_secure_cert_match\>" syntax match pfmainRef "$\<smtp_tls_security_level\>" syntax match pfmainRef "$\<smtp_tls_session_cache_database\>" syntax match pfmainRef "$\<smtp_tls_session_cache_timeout\>" +syntax match pfmainRef "$\<smtp_tls_trust_anchor_file\>" syntax match pfmainRef "$\<smtp_tls_verify_cert_match\>" +syntax match pfmainRef "$\<smtp_tls_wrappermode\>" syntax match pfmainRef "$\<smtp_use_tls\>" syntax match pfmainRef "$\<smtp_xforward_timeout\>" syntax match pfmainRef "$\<smtpd_authorized_verp_clients\>" @@ -1278,6 +1395,7 @@ syntax match pfmainRef "$\<smtpd_delay_open_until_valid_rcpt\>" syntax match pfmainRef "$\<smtpd_delay_reject\>" syntax match pfmainRef "$\<smtpd_discard_ehlo_keyword_address_maps\>" syntax match pfmainRef "$\<smtpd_discard_ehlo_keywords\>" +syntax match pfmainRef "$\<smtpd_dns_reply_filter\>" syntax match pfmainRef "$\<smtpd_end_of_data_restrictions\>" syntax match pfmainRef "$\<smtpd_enforce_tls\>" syntax match pfmainRef "$\<smtpd_error_sleep_time\>" @@ -1289,14 +1407,19 @@ syntax match pfmainRef "$\<smtpd_helo_required\>" syntax match pfmainRef "$\<smtpd_helo_restrictions\>" syntax match pfmainRef "$\<smtpd_history_flush_threshold\>" syntax match pfmainRef "$\<smtpd_junk_command_limit\>" +syntax match pfmainRef "$\<smtpd_log_access_permit_actions\>" syntax match pfmainRef "$\<smtpd_milters\>" syntax match pfmainRef "$\<smtpd_noop_commands\>" syntax match pfmainRef "$\<smtpd_null_access_lookup_key\>" syntax match pfmainRef "$\<smtpd_peername_lookup\>" syntax match pfmainRef "$\<smtpd_per_record_deadline\>" +syntax match pfmainRef "$\<smtpd_policy_service_default_action\>" syntax match pfmainRef "$\<smtpd_policy_service_max_idle\>" syntax match pfmainRef "$\<smtpd_policy_service_max_ttl\>" +syntax match pfmainRef "$\<smtpd_policy_service_request_limit\>" +syntax match pfmainRef "$\<smtpd_policy_service_retry_delay\>" syntax match pfmainRef "$\<smtpd_policy_service_timeout\>" +syntax match pfmainRef "$\<smtpd_policy_service_try_limit\>" syntax match pfmainRef "$\<smtpd_proxy_ehlo\>" syntax match pfmainRef "$\<smtpd_proxy_filter\>" syntax match pfmainRef "$\<smtpd_proxy_options\>" @@ -1307,13 +1430,16 @@ syntax match pfmainRef "$\<smtpd_recipient_restrictions\>" syntax match pfmainRef "$\<smtpd_reject_footer\>" syntax match pfmainRef "$\<smtpd_reject_unlisted_recipient\>" syntax match pfmainRef "$\<smtpd_reject_unlisted_sender\>" +syntax match pfmainRef "$\<smtpd_relay_restrictions\>" syntax match pfmainRef "$\<smtpd_restriction_classes\>" +syntax match pfmainRef "$\<smtpd_sasl_application_name\>" syntax match pfmainRef "$\<smtpd_sasl_auth_enable\>" syntax match pfmainRef "$\<smtpd_sasl_authenticated_header\>" syntax match pfmainRef "$\<smtpd_sasl_exceptions_networks\>" syntax match pfmainRef "$\<smtpd_sasl_local_domain\>" syntax match pfmainRef "$\<smtpd_sasl_path\>" syntax match pfmainRef "$\<smtpd_sasl_security_options\>" +syntax match pfmainRef "$\<smtpd_sasl_service\>" syntax match pfmainRef "$\<smtpd_sasl_tls_security_options\>" syntax match pfmainRef "$\<smtpd_sasl_type\>" syntax match pfmainRef "$\<smtpd_sender_login_maps\>" @@ -1352,21 +1478,21 @@ syntax match pfmainRef "$\<smtpd_tls_security_level\>" syntax match pfmainRef "$\<smtpd_tls_session_cache_database\>" syntax match pfmainRef "$\<smtpd_tls_session_cache_timeout\>" syntax match pfmainRef "$\<smtpd_tls_wrappermode\>" +syntax match pfmainRef "$\<smtpd_upstream_proxy_protocol\>" +syntax match pfmainRef "$\<smtpd_upstream_proxy_timeout\>" syntax match pfmainRef "$\<smtpd_use_tls\>" +syntax match pfmainRef "$\<smtputf8_autodetect_classes\>" +syntax match pfmainRef "$\<smtputf8_enable\>" syntax match pfmainRef "$\<soft_bounce\>" syntax match pfmainRef "$\<stale_lock_time\>" syntax match pfmainRef "$\<stress\>" syntax match pfmainRef "$\<strict_7bit_headers\>" syntax match pfmainRef "$\<strict_8bitmime\>" syntax match pfmainRef "$\<strict_8bitmime_body\>" -syntax match pfmainRef "$\<strict_mime_encoding_domain\>" -syntax match pfmainRef "$\<strict_rfc821_envelopes\>" -syntax match pfmainRef "$\<strict_7bit_headers\>" -syntax match pfmainRef "$\<strict_8bitmime\>" -syntax match pfmainRef "$\<strict_8bitmime_body\>" syntax match pfmainRef "$\<strict_mailbox_ownership\>" syntax match pfmainRef "$\<strict_mime_encoding_domain\>" syntax match pfmainRef "$\<strict_rfc821_envelopes\>" +syntax match pfmainRef "$\<strict_smtputf8\>" syntax match pfmainRef "$\<sun_mailtool_compatibility\>" syntax match pfmainRef "$\<swap_bangpath\>" syntax match pfmainRef "$\<syslog_facility\>" @@ -1374,11 +1500,15 @@ syntax match pfmainRef "$\<syslog_name\>" syntax match pfmainRef "$\<tcp_windowsize\>" syntax match pfmainRef "$\<tls_append_default_CA\>" syntax match pfmainRef "$\<tls_daemon_random_bytes\>" +syntax match pfmainRef "$\<tls_dane_digest_agility\>" +syntax match pfmainRef "$\<tls_dane_digests\>" +syntax match pfmainRef "$\<tls_dane_trust_anchor_digest_enable\>" syntax match pfmainRef "$\<tls_disable_workarounds\>" syntax match pfmainRef "$\<tls_eecdh_strong_curve\>" syntax match pfmainRef "$\<tls_eecdh_ultra_curve\>" syntax match pfmainRef "$\<tls_export_cipherlist\>" syntax match pfmainRef "$\<tls_high_cipherlist\>" +syntax match pfmainRef "$\<tls_legacy_public_key_fingerprints\>" syntax match pfmainRef "$\<tls_low_cipherlist\>" syntax match pfmainRef "$\<tls_medium_cipherlist\>" syntax match pfmainRef "$\<tls_null_cipherlist\>" @@ -1388,6 +1518,10 @@ syntax match pfmainRef "$\<tls_random_exchange_name\>" syntax match pfmainRef "$\<tls_random_prng_update_period\>" syntax match pfmainRef "$\<tls_random_reseed_period\>" syntax match pfmainRef "$\<tls_random_source\>" +syntax match pfmainRef "$\<tls_session_ticket_cipher\>" +syntax match pfmainRef "$\<tls_ssl_options\>" +syntax match pfmainRef "$\<tls_wildcard_matches_multiple_labels\>" +syntax match pfmainRef "$\<tlsmgr_service_name\>" syntax match pfmainRef "$\<tlsproxy_enforce_tls\>" syntax match pfmainRef "$\<tlsproxy_service_name\>" syntax match pfmainRef "$\<tlsproxy_tls_CAfile\>" @@ -1435,6 +1569,7 @@ syntax match pfmainRef "$\<transport_recipient_limit\>" syntax match pfmainRef "$\<transport_recipient_refill_delay\>" syntax match pfmainRef "$\<transport_recipient_refill_limit\>" syntax match pfmainRef "$\<transport_retry_time\>" +syntax match pfmainRef "$\<transport_time_limit\>" syntax match pfmainRef "$\<trigger_timeout\>" syntax match pfmainRef "$\<undisclosed_recipients_header\>" syntax match pfmainRef "$\<unknown_address_reject_code\>" @@ -1455,10 +1590,12 @@ syntax match pfmainRef "$\<unverified_sender_reject_code\>" syntax match pfmainRef "$\<unverified_sender_reject_reason\>" syntax match pfmainRef "$\<unverified_sender_tempfail_action\>" syntax match pfmainRef "$\<verp_delimiter_filter\>" +syntax match pfmainRef "$\<virtual_alias_address_length_limit\>" syntax match pfmainRef "$\<virtual_alias_domains\>" syntax match pfmainRef "$\<virtual_alias_expansion_limit\>" syntax match pfmainRef "$\<virtual_alias_maps\>" syntax match pfmainRef "$\<virtual_alias_recursion_limit\>" +syntax match pfmainRef "$\<virtual_delivery_status_filter\>" syntax match pfmainRef "$\<virtual_destination_concurrency_limit\>" syntax match pfmainRef "$\<virtual_destination_recipient_limit\>" syntax match pfmainRef "$\<virtual_gid_maps\>" @@ -1467,39 +1604,62 @@ syntax match pfmainRef "$\<virtual_mailbox_domains\>" syntax match pfmainRef "$\<virtual_mailbox_limit\>" syntax match pfmainRef "$\<virtual_mailbox_lock\>" syntax match pfmainRef "$\<virtual_mailbox_maps\>" +syntax match pfmainRef "$\<virtual_maps\>" syntax match pfmainRef "$\<virtual_minimum_uid\>" syntax match pfmainRef "$\<virtual_transport\>" syntax match pfmainRef "$\<virtual_uid_maps\>" +syntax keyword pfmainWord accept syntax keyword pfmainWord all +syntax keyword pfmainWord always syntax keyword pfmainWord check_address_map syntax keyword pfmainWord check_ccert_access +syntax keyword pfmainWord check_client_a_access syntax keyword pfmainWord check_client_access +syntax keyword pfmainWord check_client_mx_access +syntax keyword pfmainWord check_client_ns_access syntax keyword pfmainWord check_etrn_access +syntax keyword pfmainWord check_helo_a_access syntax keyword pfmainWord check_helo_access syntax keyword pfmainWord check_helo_mx_access syntax keyword pfmainWord check_helo_ns_access syntax keyword pfmainWord check_policy_service +syntax keyword pfmainWord check_recipient_a_access syntax keyword pfmainWord check_recipient_access syntax keyword pfmainWord check_recipient_maps syntax keyword pfmainWord check_recipient_mx_access syntax keyword pfmainWord check_recipient_ns_access syntax keyword pfmainWord check_relay_domains +syntax keyword pfmainWord check_reverse_client_hostname_a_access +syntax keyword pfmainWord check_reverse_client_hostname_access +syntax keyword pfmainWord check_reverse_client_hostname_mx_access +syntax keyword pfmainWord check_reverse_client_hostname_ns_access +syntax keyword pfmainWord check_sasl_access +syntax keyword pfmainWord check_sender_a_access syntax keyword pfmainWord check_sender_access syntax keyword pfmainWord check_sender_mx_access syntax keyword pfmainWord check_sender_ns_access syntax keyword pfmainWord class syntax keyword pfmainWord client_address syntax keyword pfmainWord client_port +syntax keyword pfmainWord dane +syntax keyword pfmainWord dane-only +syntax keyword pfmainWord defer syntax keyword pfmainWord defer_if_permit syntax keyword pfmainWord defer_if_reject +syntax keyword pfmainWord defer_unauth_destination +syntax keyword pfmainWord disabled syntax keyword pfmainWord dns +syntax keyword pfmainWord dnssec syntax keyword pfmainWord drop syntax keyword pfmainWord dunno +syntax keyword pfmainWord enabled +syntax keyword pfmainWord encrypt syntax keyword pfmainWord enforce syntax keyword pfmainWord envelope_recipient syntax keyword pfmainWord envelope_sender syntax keyword pfmainWord export +syntax keyword pfmainWord fingerprint syntax keyword pfmainWord header_recipient syntax keyword pfmainWord header_sender syntax keyword pfmainWord high @@ -1509,22 +1669,37 @@ syntax keyword pfmainWord ipv4 syntax keyword pfmainWord ipv6 syntax keyword pfmainWord localtime syntax keyword pfmainWord low +syntax keyword pfmainWord may +syntax keyword pfmainWord maybe syntax keyword pfmainWord medium syntax keyword pfmainWord native +syntax keyword pfmainWord never +syntax keyword pfmainWord no_address_mappings +syntax keyword pfmainWord no_header_body_checks +syntax keyword pfmainWord no_header_reply +syntax keyword pfmainWord no_milters +syntax keyword pfmainWord no_unknown_recipient_checks +syntax keyword pfmainWord none syntax keyword pfmainWord null +syntax keyword pfmainWord off +syntax keyword pfmainWord on syntax keyword pfmainWord permit syntax keyword pfmainWord permit_auth_destination +syntax keyword pfmainWord permit_dnswl_client syntax keyword pfmainWord permit_inet_interfaces syntax keyword pfmainWord permit_mx_backup syntax keyword pfmainWord permit_mynetworks syntax keyword pfmainWord permit_naked_ip_address +syntax keyword pfmainWord permit_rhswl_client syntax keyword pfmainWord permit_sasl_authenticated syntax keyword pfmainWord permit_tls_all_clientcerts syntax keyword pfmainWord permit_tls_clientcerts +syntax keyword pfmainWord quarantine syntax keyword pfmainWord reject syntax keyword pfmainWord reject_authenticated_sender_login_mismatch syntax keyword pfmainWord reject_invalid_helo_hostname syntax keyword pfmainWord reject_invalid_hostname +syntax keyword pfmainWord reject_known_sender_login_mismatch syntax keyword pfmainWord reject_maps_rbl syntax keyword pfmainWord reject_multi_recipient_bounce syntax keyword pfmainWord reject_non_fqdn_helo_hostname @@ -1537,10 +1712,12 @@ syntax keyword pfmainWord reject_rbl_client syntax keyword pfmainWord reject_rhsbl_client syntax keyword pfmainWord reject_rhsbl_helo syntax keyword pfmainWord reject_rhsbl_recipient +syntax keyword pfmainWord reject_rhsbl_reverse_client syntax keyword pfmainWord reject_rhsbl_sender syntax keyword pfmainWord reject_sender_login_mismatch syntax keyword pfmainWord reject_unauth_destination syntax keyword pfmainWord reject_unauth_pipelining +syntax keyword pfmainWord reject_unauthenticated_sender_login_mismatch syntax keyword pfmainWord reject_unknown_address syntax keyword pfmainWord reject_unknown_client syntax keyword pfmainWord reject_unknown_client_hostname @@ -1554,11 +1731,15 @@ syntax keyword pfmainWord reject_unlisted_recipient syntax keyword pfmainWord reject_unlisted_sender syntax keyword pfmainWord reject_unverified_recipient syntax keyword pfmainWord reject_unverified_sender +syntax keyword pfmainWord secure +syntax keyword pfmainWord server_name syntax keyword pfmainWord sleep syntax keyword pfmainWord smtpd_access_maps -syntax keyword pfmainWord server_name syntax keyword pfmainWord speed_adjust +syntax keyword pfmainWord strong syntax keyword pfmainWord subnet +syntax keyword pfmainWord tempfail +syntax keyword pfmainWord ultra syntax keyword pfmainWord warn_if_reject syntax keyword pfmainWord CRYPTOPRO_TLSEXT_BUG syntax keyword pfmainWord DONT_INSERT_EMPTY_FRAGMENTS @@ -1574,7 +1755,7 @@ syntax keyword pfmainWord TLS_BLOCK_PADDING_BUG syntax keyword pfmainWord TLS_D5_BUG syntax keyword pfmainWord TLS_ROLLBACK_BUG -syntax keyword pfmainDict btree cidr environ hash nis pcre proxy regexp sdbm sdbm static tcp unix +syntax keyword pfmainDict btree cidr environ hash nis pcre proxy regexp sdbm static tcp unix syntax keyword pfmainQueueDir incoming active deferred corrupt hold syntax keyword pfmainTransport smtp lmtp unix local relay uucp virtual syntax keyword pfmainLock fcntl flock dotlock @@ -1588,26 +1769,50 @@ syntax match pfmainVariable "\$\w\+" contains=pfmainRef syntax match pfmainSpecial "\<alias\>" syntax match pfmainSpecial "\<canonical\>" +syntax match pfmainSpecial "\<forward\>" +syntax match pfmainSpecial "\<generic\>" +syntax match pfmainSpecial "\<include\>" +syntax match pfmainSpecial "\<virtual\>" + +syntax match pfmainSpecial "\<delay_dotcrlf\>" +syntax match pfmainSpecial "\<disable_esmtp\>" + +syntax match pfmainSpecial "\<res_defnames\>" +syntax match pfmainSpecial "\<res_dnsrch\>" + syntax match pfmainSpecial "\<command\>" syntax match pfmainSpecial "\<file\>" -syntax match pfmainSpecial "\<forward\>" + +syntax match pfmainSpecial "\<forward_secrecy\>" +syntax match pfmainSpecial "\<mutual_auth\>" +syntax match pfmainSpecial "\<noactive\>" syntax match pfmainSpecial "\<noanonymous\>" +syntax match pfmainSpecial "\<nodictionary\>" syntax match pfmainSpecial "\<noplaintext\>" + +syntax match pfmainSpecial "\<bounce\>" +syntax match pfmainSpecial "\<2bounce\>" +syntax match pfmainSpecial "\<data\>" +syntax match pfmainSpecial "\<delay\>" +syntax match pfmainSpecial "\<policy\>" +syntax match pfmainSpecial "\<protocol\>" syntax match pfmainSpecial "\<resource\>" syntax match pfmainSpecial "\<software\>" -syntax match pfmainSpecial "\<bounce\>" syntax match pfmainSpecial "\<cleanup\>" syntax match pfmainSpecial "\<cyrus\>" -syntax match pfmainSpecial "\<defer\>" syntax match pfmainSpecial "\<error\>" syntax match pfmainSpecial "\<flush\>" +syntax match pfmainSpecial "\<notify\>" syntax match pfmainSpecial "\<pickup\>" syntax match pfmainSpecial "\<postdrop\>" syntax match pfmainSpecial "\<qmgr\>" +syntax match pfmainSpecial "\<qmqpd\>" syntax match pfmainSpecial "\<rewrite\>" syntax match pfmainSpecial "\<scache\>" +syntax match pfmainSpecial "\<sendmail\>" syntax match pfmainSpecial "\<showq\>" +syntax match pfmainSpecial "\<smtpd\>" syntax match pfmainSpecial "\<trace\>" syntax match pfmainSpecial "\<verify\>" diff --git a/runtime/syntax/srec.vim b/runtime/syntax/srec.vim new file mode 100644 index 0000000000..19b6d97426 --- /dev/null +++ b/runtime/syntax/srec.vim @@ -0,0 +1,96 @@ +" Vim syntax file +" Language: Motorola S-Record +" Maintainer: Markus Heidelberg <markus.heidelberg@web.de> +" Last Change: 2015 Feb 24 + +" Each record (line) is built as follows: +" +" field digits states +" +" +----------+ +" | start | 1 ('S') srecRecStart +" +----------+ +" | type | 1 srecRecType, (srecRecTypeUnknown) +" +----------+ +" | count | 2 srecByteCount +" +----------+ +" | address | 4/6/8 srecNoAddress, srecDataAddress, srecRecCount, srecStartAddress, (srecAddressFieldUnknown) +" +----------+ +" | data | 0..504/502/500 srecDataOdd, srecDataEven, (srecDataUnexpected) +" +----------+ +" | checksum | 2 srecChecksum +" +----------+ +" +" States in parentheses in the upper format description indicate that they +" should not appear in a valid file. + +" For version 5.x: Clear all syntax items +" For version 6.x: Quit when a syntax file was already loaded +if version < 600 + syntax clear +elseif exists("b:current_syntax") + finish +endif + +syn match srecRecStart "^S" + +syn match srecRecTypeUnknown "^S." contains=srecRecStart +syn match srecRecType "^S[0-35-9]" contains=srecRecStart + +syn match srecByteCount "^S.[0-9a-fA-F]\{2}" contains=srecRecTypeUnknown nextgroup=srecAddressFieldUnknown,srecChecksum +syn match srecByteCount "^S[0-35-9][0-9a-fA-F]\{2}" contains=srecRecType + +syn match srecAddressFieldUnknown "[0-9a-fA-F]\{2}" contained nextgroup=srecAddressFieldUnknown,srecChecksum + +syn match srecNoAddress "^S0[0-9a-fA-F]\{6}" contains=srecByteCount nextgroup=srecDataOdd,srecChecksum +syn match srecDataAddress "^S1[0-9a-fA-F]\{6}" contains=srecByteCount nextgroup=srecDataOdd,srecChecksum +syn match srecDataAddress "^S2[0-9a-fA-F]\{8}" contains=srecByteCount nextgroup=srecDataOdd,srecChecksum +syn match srecDataAddress "^S3[0-9a-fA-F]\{10}" contains=srecByteCount nextgroup=srecDataOdd,srecChecksum +syn match srecRecCount "^S5[0-9a-fA-F]\{6}" contains=srecByteCount nextgroup=srecDataUnexpected,srecChecksum +syn match srecRecCount "^S6[0-9a-fA-F]\{8}" contains=srecByteCount nextgroup=srecDataUnexpected,srecChecksum +syn match srecStartAddress "^S7[0-9a-fA-F]\{10}" contains=srecByteCount nextgroup=srecDataUnexpected,srecChecksum +syn match srecStartAddress "^S8[0-9a-fA-F]\{8}" contains=srecByteCount nextgroup=srecDataUnexpected,srecChecksum +syn match srecStartAddress "^S9[0-9a-fA-F]\{6}" contains=srecByteCount nextgroup=srecDataUnexpected,srecChecksum + +" alternating highlight per byte for easier reading +syn match srecDataOdd "[0-9a-fA-F]\{2}" contained nextgroup=srecDataEven,srecChecksum +syn match srecDataEven "[0-9a-fA-F]\{2}" contained nextgroup=srecDataOdd,srecChecksum +" data bytes which should not exist +syn match srecDataUnexpected "[0-9a-fA-F]\{2}" contained nextgroup=srecDataUnexpected,srecChecksum +" Data digit pair regex usage also results in only highlighting the checksum +" if the number of data characters is even. + +syn match srecChecksum "[0-9a-fA-F]\{2}$" contained + +" Define the default highlighting. +" For version 5.7 and earlier: only when not done already +" For version 5.8 and later: only when an item doesn't have highlighting yet +if version >= 508 || !exists("did_srec_syntax_inits") + if version < 508 + let did_srec_syntax_inits = 1 + command -nargs=+ HiLink hi link <args> + else + command -nargs=+ HiLink hi def link <args> + endif + + " The default methods for highlighting. Can be overridden later + HiLink srecRecStart srecRecType + HiLink srecRecTypeUnknown srecRecType + HiLink srecRecType WarningMsg + HiLink srecByteCount Constant + hi def srecAddressFieldUnknown term=italic cterm=italic gui=italic + HiLink srecNoAddress DiffAdd + HiLink srecDataAddress Comment + HiLink srecRecCount srecNoAddress + HiLink srecStartAddress srecDataAddress + hi def srecDataOdd term=bold cterm=bold gui=bold + hi def srecDataEven term=NONE cterm=NONE gui=NONE + HiLink srecDataUnexpected Error + HiLink srecChecksum DiffChange + + delcommand HiLink +endif + +let b:current_syntax = "srec" + +" vim: ts=8 diff --git a/scripts/vim-patch.sh b/scripts/vim-patch.sh index c0934a17e3..bdd3d6209b 100755 --- a/scripts/vim-patch.sh +++ b/scripts/vim-patch.sh @@ -161,29 +161,19 @@ list_vim_patches() { printf "\nVim patches missing from Neovim:\n" - # Get tags since 7.4.442. - local vim_tags=$(cd "${VIM_SOURCE_DIR}" && git tag --contains v7.4.442) - - # Get non-versioned commits since e2719096. - if git log -1 --grep='.' --invert-grep > /dev/null 2>&1 ; then - local vim_runtime_commits=$(cd "${VIM_SOURCE_DIR}" && \ - git log --reverse --format='%H' --grep='^patch' --grep='^updated for version' \ - --invert-grep e2719096250a19ecdd9a35d13702879f163d2a50..HEAD) - else # --invert-grep requires git 2.4+ - echo "Warning: some runtime updates may not be listed (requires git 2.4+)." - local vim_runtime_commits=$(cd "${VIM_SOURCE_DIR}" && \ - git log --reverse --format='%H' --grep='Updated' e2719096250a19ecdd9a35d13702879f163d2a50..HEAD) - fi + # Get commits since 7.4.602. + local vim_commits=$(cd "${VIM_SOURCE_DIR}" && git log --reverse --format='%H' v7.4.602..HEAD) local vim_commit - for vim_commit in ${vim_tags} ${vim_runtime_commits}; do + for vim_commit in ${vim_commits}; do local is_missing - if [[ ${vim_commit} =~ v([0-9].[0-9].([0-9]{3,4})) ]]; then - local patch_number="${BASH_REMATCH[2]}" + local vim_tag=$(cd "${VIM_SOURCE_DIR}" && git describe --tags --exact-match "${vim_commit}" 2>/dev/null) + if [[ -n "${vim_tag}" ]]; then + local patch_number="${vim_tag:5}" # Remove prefix like "v7.4." # Tagged Vim patch, check version.c: is_missing="$(sed -n '/static int included_patches/,/}/p' "${NEOVIM_SOURCE_DIR}/src/nvim/version.c" | - grep -x -e "[[:space:]]*//${patch_number} NA" -e "[[:space:]]*${patch_number}," >/dev/null && echo "false" || echo "true")" - vim_commit="${BASH_REMATCH[1]//-/.}" + grep -x -e "[[:space:]]*//[[:space:]]${patch_number} NA" -e "[[:space:]]*${patch_number}," >/dev/null && echo "false" || echo "true")" + vim_commit="${vim_tag#v}" else # Untagged Vim patch (e.g. runtime updates), check the Neovim git log: is_missing="$(cd "${NEOVIM_SOURCE_DIR}" && @@ -203,6 +193,9 @@ list_vim_patches() { echo echo " Examples: '${BASENAME} -p 7.4.487'" echo " '${BASENAME} -p 1e8ebf870720e7b671f98f22d653009826304c4f'" + echo + echo " NOTE: Please port the _oldest_ patch if you possibly can." + echo " Out-of-order patches increase the possibility of bugs." } review_pr() { diff --git a/src/nvim/ascii.h b/src/nvim/ascii.h index 2b3e94d5a0..44ff540b40 100644 --- a/src/nvim/ascii.h +++ b/src/nvim/ascii.h @@ -85,10 +85,25 @@ # define PATHSEPSTR "/" #endif -static inline bool ascii_iswhite(int) REAL_FATTR_ALWAYS_INLINE REAL_FATTR_CONST; -static inline bool ascii_isdigit(int) REAL_FATTR_ALWAYS_INLINE REAL_FATTR_CONST; -static inline bool ascii_isxdigit(int) REAL_FATTR_ALWAYS_INLINE REAL_FATTR_CONST; -static inline bool ascii_isspace(int) REAL_FATTR_ALWAYS_INLINE REAL_FATTR_CONST; +static inline bool ascii_iswhite(int) + REAL_FATTR_CONST + REAL_FATTR_ALWAYS_INLINE; + +static inline bool ascii_isdigit(int) + REAL_FATTR_CONST + REAL_FATTR_ALWAYS_INLINE; + +static inline bool ascii_isxdigit(int) + REAL_FATTR_CONST + REAL_FATTR_ALWAYS_INLINE; + +static inline bool ascii_isbdigit(int) + REAL_FATTR_CONST + REAL_FATTR_ALWAYS_INLINE; + +static inline bool ascii_isspace(int) + REAL_FATTR_CONST + REAL_FATTR_ALWAYS_INLINE; /// Checks if `c` is a space or tab character. /// @@ -122,6 +137,14 @@ static inline bool ascii_isxdigit(int c) || (c >= 'A' && c <= 'F'); } +/// Checks if `c` is a binary digit, that is, 0-1. +/// +/// @see {ascii_isdigit} +static inline bool ascii_isbdigit(int c) +{ + return (c == '0' || c == '1'); +} + /// Checks if `c` is a white-space character, that is, /// one of \f, \n, \r, \t, \v. /// diff --git a/src/nvim/charset.c b/src/nvim/charset.c index b93eafbf60..e0c9443511 100644 --- a/src/nvim/charset.c +++ b/src/nvim/charset.c @@ -1454,6 +1454,24 @@ char_u* skipdigits(char_u *q) return p; } +/// skip over binary digits +/// +/// @param q pointer to string +/// +/// @return Pointer to the character after the skipped digits. +const char* skipbin(const char *q) + FUNC_ATTR_PURE + FUNC_ATTR_NONNULL_ALL + FUNC_ATTR_NONNULL_RET +{ + const char *p = q; + while (ascii_isbdigit(*p)) { + // skip to next non-digit + p++; + } + return p; +} + /// skip over digits and hex characters /// /// @param q @@ -1485,6 +1503,24 @@ char_u* skiptodigit(char_u *q) return p; } +/// skip to binary character (or NUL after the string) +/// +/// @param q pointer to string +/// +/// @return Pointer to the binary character or (NUL after the string). +const char* skiptobin(const char *q) + FUNC_ATTR_PURE + FUNC_ATTR_NONNULL_ALL + FUNC_ATTR_NONNULL_RET +{ + const char *p = q; + while (*p != NUL && !ascii_isbdigit(*p)) { + // skip to next digit + p++; + } + return p; +} + /// skip to hex character (or NUL after the string) /// /// @param q @@ -1720,67 +1756,77 @@ int vim_isblankline(char_u *lbuf) } /// Convert a string into a long and/or unsigned long, taking care of -/// hexadecimal and octal numbers. Accepts a '-' sign. -/// If "hexp" is not NULL, returns a flag to indicate the type of the number: +/// hexadecimal, octal and binary numbers. Accepts a '-' sign. +/// If "prep" is not NULL, returns a flag to indicate the type of the number: /// 0 decimal /// '0' octal +/// 'B' bin +/// 'b' bin /// 'X' hex /// 'x' hex /// If "len" is not NULL, the length of the number in characters is returned. /// If "nptr" is not NULL, the signed result is returned in it. /// If "unptr" is not NULL, the unsigned result is returned in it. +/// If "dobin" is non-zero recognize binary numbers, when > 1 always assume +/// binary number. /// If "dooct" is non-zero recognize octal numbers, when > 1 always assume /// octal number. /// If "dohex" is non-zero recognize hex numbers, when > 1 always assume /// hex number. /// /// @param start -/// @param hexp Returns type of number 0 = decimal, 'x' or 'X' is hex, -// '0' = octal +/// @param prep Returns type of number 0 = decimal, 'x' or 'X' is hex, +// '0' = octal, 'b' or 'B' is bin /// @param len Returns the detected length of number. +/// @param dobin recognize binary number /// @param dooct recognize octal number /// @param dohex recognize hex number /// @param nptr Returns the signed result. /// @param unptr Returns the unsigned result. -void vim_str2nr(char_u *start, int *hexp, int *len, int dooct, int dohex, +void vim_str2nr(char_u *start, int *prep, int *len, + int dobin, int dooct, int dohex, long *nptr, unsigned long *unptr) { char_u *ptr = start; - int hex = 0; // default is decimal - int negative = FALSE; + int pre = 0; // default is decimal + int negative = false; unsigned long un = 0; int n; if (ptr[0] == '-') { - negative = TRUE; - ++ptr; + negative = true; + ptr++; } - // Recognize hex and octal. + // Recognize hex, octal, and bin. if ((ptr[0] == '0') && (ptr[1] != '8') && (ptr[1] != '9')) { - hex = ptr[1]; + pre = ptr[1]; if (dohex - && ((hex == 'X') || (hex == 'x')) + && ((pre == 'X') || (pre == 'x')) && ascii_isxdigit(ptr[2])) { // hexadecimal ptr += 2; + } else if (dobin + && ((pre == 'B') || (pre == 'b')) + && ascii_isbdigit(ptr[2])) { + // binary + ptr += 2; } else { // default is decimal - hex = 0; + pre = 0; if (dooct) { // Don't interpret "0", "08" or "0129" as octal. for (n = 1; ascii_isdigit(ptr[n]); ++n) { if (ptr[n] > '7') { // can't be octal - hex = 0; + pre = 0; break; } - if (ptr[n] >= '0') { // assume octal - hex = '0'; + pre = '0'; } } } @@ -1788,14 +1834,26 @@ void vim_str2nr(char_u *start, int *hexp, int *len, int dooct, int dohex, } // Do the string-to-numeric conversion "manually" to avoid sscanf quirks. - if ((hex == '0') || (dooct > 1)) { + if ((pre == 'B') || (pre == 'b') || (dobin > 1)) { + // bin + if (pre != 0) { + n += 2; // skip over "0b" + } + while ('0' <= *ptr && *ptr <= '1') { + un = 2 * un + (unsigned long)(*ptr - '0'); + ptr++; + } + } else if ((pre == '0') || (dooct > 1)) { // octal while ('0' <= *ptr && *ptr <= '7') { un = 8 * un + (unsigned long)(*ptr - '0'); ptr++; } - } else if ((hex != 0) || (dohex > 1)) { + } else if (pre != 0 || dohex > 1) { // hex + if (pre != 0) { + n += 2; // skip over "0x" + } while (ascii_isxdigit(*ptr)) { un = 16 * un + (unsigned long)hex2nr(*ptr); ptr++; @@ -1808,8 +1866,8 @@ void vim_str2nr(char_u *start, int *hexp, int *len, int dooct, int dohex, } } - if (hexp != NULL) { - *hexp = hex; + if (prep != NULL) { + *prep = pre; } if (len != NULL) { diff --git a/src/nvim/eval.c b/src/nvim/eval.c index 7ac51d7bd7..a5a8671697 100644 --- a/src/nvim/eval.c +++ b/src/nvim/eval.c @@ -1113,19 +1113,17 @@ typval_T *eval_expr(char_u *arg, char_u **nextcmd) } -/* - * Call some vimL function and return the result in "*rettv". - * Uses argv[argc] for the function arguments. Only Number and String - * arguments are currently supported. - * Returns OK or FAIL. - */ -int -call_vim_function ( +// Call some vimL function and return the result in "*rettv". +// Uses argv[argc] for the function arguments. Only Number and String +// arguments are currently supported. +// +// Return OK or FAIL. +int call_vim_function( char_u *func, int argc, char_u **argv, - int safe, /* use the sandbox */ - int str_arg_only, /* all arguments are strings */ + int safe, // use the sandbox + int str_arg_only, // all arguments are strings typval_T *rettv ) { @@ -1138,18 +1136,19 @@ call_vim_function ( typval_T *argvars = xmalloc((argc + 1) * sizeof(typval_T)); for (int i = 0; i < argc; i++) { - /* Pass a NULL or empty argument as an empty string */ + // Pass a NULL or empty argument as an empty string if (argv[i] == NULL || *argv[i] == NUL) { argvars[i].v_type = VAR_STRING; argvars[i].vval.v_string = (char_u *)""; continue; } - if (str_arg_only) + if (str_arg_only) { len = 0; - else - /* Recognize a number argument, the others must be strings. */ - vim_str2nr(argv[i], NULL, &len, TRUE, TRUE, &n, NULL); + } else { + // Recognize a number argument, the others must be strings. + vim_str2nr(argv[i], NULL, &len, true, true, true, &n, NULL); + } if (len != 0 && len == (int)STRLEN(argv[i])) { argvars[i].v_type = VAR_NUMBER; argvars[i].vval.v_number = n; @@ -1166,16 +1165,17 @@ call_vim_function ( rettv->v_type = VAR_UNKNOWN; /* clear_tv() uses this */ ret = call_func(func, (int)STRLEN(func), rettv, argc, argvars, - curwin->w_cursor.lnum, curwin->w_cursor.lnum, - &doesrange, TRUE, NULL); + curwin->w_cursor.lnum, curwin->w_cursor.lnum, + &doesrange, true, NULL); if (safe) { --sandbox; restore_funccal(save_funccalp); } xfree(argvars); - if (ret == FAIL) + if (ret == FAIL) { clear_tv(rettv); + } return ret; } @@ -4025,38 +4025,35 @@ eval6 ( return OK; } -/* - * Handle sixth level expression: - * number number constant - * "string" string constant - * 'string' literal string constant - * &option-name option value - * @r register contents - * identifier variable value - * function() function call - * $VAR environment variable - * (expression) nested expression - * [expr, expr] List - * {key: val, key: val} Dictionary - * - * Also handle: - * ! in front logical NOT - * - in front unary minus - * + in front unary plus (ignored) - * trailing [] subscript in String or List - * trailing .name entry in Dictionary - * - * "arg" must point to the first non-white of the expression. - * "arg" is advanced to the next non-white after the recognized expression. - * - * Return OK or FAIL. - */ -static int -eval7 ( +// Handle sixth level expression: +// number number constant +// "string" string constant +// 'string' literal string constant +// &option-name option value +// @r register contents +// identifier variable value +// function() function call +// $VAR environment variable +// (expression) nested expression +// [expr, expr] List +// {key: val, key: val} Dictionary +// +// Also handle: +// ! in front logical NOT +// - in front unary minus +// + in front unary plus (ignored) +// trailing [] subscript in String or List +// trailing .name entry in Dictionary +// +// "arg" must point to the first non-white of the expression. +// "arg" is advanced to the next non-white after the recognized expression. +// +// Return OK or FAIL. +static int eval7( char_u **arg, typval_T *rettv, int evaluate, - int want_string /* after "." operator */ + int want_string // after "." operator ) { long n; @@ -4066,24 +4063,19 @@ eval7 ( int ret = OK; char_u *alias; - /* - * Initialise variable so that clear_tv() can't mistake this for a - * string and free a string that isn't there. - */ + // Initialise variable so that clear_tv() can't mistake this for a + // string and free a string that isn't there. rettv->v_type = VAR_UNKNOWN; - /* - * Skip '!' and '-' characters. They are handled later. - */ + // Skip '!' and '-' characters. They are handled later. start_leader = *arg; - while (**arg == '!' || **arg == '-' || **arg == '+') + while (**arg == '!' || **arg == '-' || **arg == '+') { *arg = skipwhite(*arg + 1); + } end_leader = *arg; switch (**arg) { - /* - * Number constant. - */ + // Number constant. case '0': case '1': case '2': @@ -4096,27 +4088,30 @@ eval7 ( case '9': { char_u *p = skipdigits(*arg + 1); - int get_float = FALSE; + int get_float = false; - /* We accept a float when the format matches - * "[0-9]\+\.[0-9]\+\([eE][+-]\?[0-9]\+\)\?". This is very - * strict to avoid backwards compatibility problems. - * Don't look for a float after the "." operator, so that - * ":let vers = 1.2.3" doesn't fail. */ + // We accept a float when the format matches + // "[0-9]\+\.[0-9]\+\([eE][+-]\?[0-9]\+\)\?". This is very + // strict to avoid backwards compatibility problems. + // Don't look for a float after the "." operator, so that + // ":let vers = 1.2.3" doesn't fail. if (!want_string && p[0] == '.' && ascii_isdigit(p[1])) { - get_float = TRUE; + get_float = true; p = skipdigits(p + 2); if (*p == 'e' || *p == 'E') { ++p; - if (*p == '-' || *p == '+') + if (*p == '-' || *p == '+') { ++p; - if (!ascii_isdigit(*p)) - get_float = FALSE; - else + } + if (!ascii_isdigit(*p)) { + get_float = false; + } else { p = skipdigits(p + 1); + } + } + if (ASCII_ISALPHA(*p) || *p == '.') { + get_float = false; } - if (ASCII_ISALPHA(*p) || *p == '.') - get_float = FALSE; } if (get_float) { float_T f; @@ -4127,7 +4122,7 @@ eval7 ( rettv->vval.v_float = f; } } else { - vim_str2nr(*arg, NULL, &len, TRUE, TRUE, &n, NULL); + vim_str2nr(*arg, NULL, &len, true, true, true, &n, NULL); *arg += len; if (evaluate) { rettv->v_type = VAR_NUMBER; @@ -4137,62 +4132,47 @@ eval7 ( break; } - /* - * String constant: "string". - */ + // String constant: "string". case '"': ret = get_string_tv(arg, rettv, evaluate); break; - /* - * Literal string constant: 'str''ing'. - */ + // Literal string constant: 'str''ing'. case '\'': ret = get_lit_string_tv(arg, rettv, evaluate); break; - /* - * List: [expr, expr] - */ + // List: [expr, expr] case '[': ret = get_list_tv(arg, rettv, evaluate); break; - /* - * Dictionary: {key: val, key: val} - */ + // Dictionary: {key: val, key: val} case '{': ret = get_dict_tv(arg, rettv, evaluate); break; - /* - * Option value: &name - */ + // Option value: &name case '&': ret = get_option_tv(arg, rettv, evaluate); break; - /* - * Environment variable: $VAR. - */ + // Environment variable: $VAR. case '$': ret = get_env_tv(arg, rettv, evaluate); break; - /* - * Register contents: @r. - */ + // Register contents: @r. case '@': ++*arg; if (evaluate) { rettv->v_type = VAR_STRING; rettv->vval.v_string = get_reg_contents(**arg, kGRegExprSrc); } - if (**arg != NUL) + if (**arg != NUL) { ++*arg; + } break; - /* - * nested expression: (expression). - */ + // nested expression: (expression). case '(': *arg = skipwhite(*arg + 1); - ret = eval1(arg, rettv, evaluate); /* recursive! */ - if (**arg == ')') + ret = eval1(arg, rettv, evaluate); // recursive! + if (**arg == ')') { ++*arg; - else if (ret == OK) { + } else if (ret == OK) { EMSG(_("E110: Missing ')'")); clear_tv(rettv); ret = FAIL; @@ -4204,71 +4184,72 @@ eval7 ( } if (ret == NOTDONE) { - /* - * Must be a variable or function name. - * Can also be a curly-braces kind of name: {expr}. - */ + // Must be a variable or function name. + // Can also be a curly-braces kind of name: {expr}. s = *arg; - len = get_name_len(arg, &alias, evaluate, TRUE); - if (alias != NULL) + len = get_name_len(arg, &alias, evaluate, true); + if (alias != NULL) { s = alias; + } - if (len <= 0) + if (len <= 0) { ret = FAIL; - else { - if (**arg == '(') { /* recursive! */ - /* If "s" is the name of a variable of type VAR_FUNC - * use its contents. */ + } else { + if (**arg == '(') { // recursive! + // If "s" is the name of a variable of type VAR_FUNC + // use its contents. s = deref_func_name(s, &len, !evaluate); - /* Invoke the function. */ + // Invoke the function. ret = get_func_tv(s, len, rettv, arg, curwin->w_cursor.lnum, curwin->w_cursor.lnum, &len, evaluate, NULL); - /* If evaluate is FALSE rettv->v_type was not set in - * get_func_tv, but it's needed in handle_subscript() to parse - * what follows. So set it here. */ + // If evaluate is false rettv->v_type was not set in + // get_func_tv, but it's needed in handle_subscript() to parse + // what follows. So set it here. if (rettv->v_type == VAR_UNKNOWN && !evaluate && **arg == '(') { rettv->vval.v_string = empty_string; rettv->v_type = VAR_FUNC; } - /* Stop the expression evaluation when immediately - * aborting on error, or when an interrupt occurred or - * an exception was thrown but not caught. */ + // Stop the expression evaluation when immediately + // aborting on error, or when an interrupt occurred or + // an exception was thrown but not caught. if (aborting()) { - if (ret == OK) + if (ret == OK) { clear_tv(rettv); + } ret = FAIL; } - } else if (evaluate) - ret = get_var_tv(s, len, rettv, TRUE, FALSE); - else + } else if (evaluate) { + ret = get_var_tv(s, len, rettv, true, false); + } else { ret = OK; + } } xfree(alias); } *arg = skipwhite(*arg); - /* Handle following '[', '(' and '.' for expr[expr], expr.name, - * expr(expr). */ - if (ret == OK) - ret = handle_subscript(arg, rettv, evaluate, TRUE); + // Handle following '[', '(' and '.' for expr[expr], expr.name, + // expr(expr). + if (ret == OK) { + ret = handle_subscript(arg, rettv, evaluate, true); + } - /* - * Apply logical NOT and unary '-', from right to left, ignore '+'. - */ + // Apply logical NOT and unary '-', from right to left, ignore '+'. if (ret == OK && evaluate && end_leader > start_leader) { - int error = FALSE; + int error = false; int val = 0; float_T f = 0.0; - if (rettv->v_type == VAR_FLOAT) + if (rettv->v_type == VAR_FLOAT) { f = rettv->vval.v_float; - else + } else { val = get_tv_number_chk(rettv, &error); + } if (error) { clear_tv(rettv); ret = FAIL; @@ -4276,15 +4257,17 @@ eval7 ( while (end_leader > start_leader) { --end_leader; if (*end_leader == '!') { - if (rettv->v_type == VAR_FLOAT) + if (rettv->v_type == VAR_FLOAT) { f = !f; - else + } else { val = !val; + } } else if (*end_leader == '-') { - if (rettv->v_type == VAR_FLOAT) + if (rettv->v_type == VAR_FLOAT) { f = -f; - else + } else { val = -val; + } } } if (rettv->v_type == VAR_FLOAT) { @@ -7236,6 +7219,7 @@ static struct fst { { "islocked", 1, 1, f_islocked }, { "items", 1, 1, f_items }, { "jobclose", 1, 2, f_jobclose }, + { "jobpid", 1, 1, f_jobpid }, { "jobresize", 3, 3, f_jobresize }, { "jobsend", 2, 2, f_jobsend }, { "jobstart", 1, 2, f_jobstart }, @@ -11611,6 +11595,31 @@ static void f_jobclose(typval_T *argvars, typval_T *rettv) } } +// "jobpid(id)" function +static void f_jobpid(typval_T *argvars, typval_T *rettv) +{ + rettv->v_type = VAR_NUMBER; + rettv->vval.v_number = 0; + + if (check_restricted() || check_secure()) { + return; + } + + if (argvars[0].v_type != VAR_NUMBER) { + EMSG(_(e_invarg)); + return; + } + + TerminalJobData *data = find_job(argvars[0].vval.v_number); + if (!data) { + EMSG(_(e_invjob)); + return; + } + + Process *proc = (Process *)&data->proc; + rettv->vval.v_number = proc->pid; +} + // "jobsend()" function static void f_jobsend(typval_T *argvars, typval_T *rettv) { @@ -11771,8 +11780,9 @@ static void f_jobstart(typval_T *argvars, typval_T *rettv) } bool pty = job_opts && get_dict_number(job_opts, (uint8_t *)"pty") != 0; + bool detach = job_opts && get_dict_number(job_opts, (uint8_t *)"detach") != 0; TerminalJobData *data = common_job_init(argv, on_stdout, on_stderr, on_exit, - job_opts, pty); + job_opts, pty, detach); Process *proc = (Process *)&data->proc; if (pty) { @@ -15971,9 +15981,7 @@ static void f_str2float(typval_T *argvars, typval_T *rettv) rettv->v_type = VAR_FLOAT; } -/* - * "str2nr()" function - */ +// "str2nr()" function static void f_str2nr(typval_T *argvars, typval_T *rettv) { int base = 10; @@ -15982,16 +15990,21 @@ static void f_str2nr(typval_T *argvars, typval_T *rettv) if (argvars[1].v_type != VAR_UNKNOWN) { base = get_tv_number(&argvars[1]); - if (base != 8 && base != 10 && base != 16) { + if (base != 2 && base != 8 && base != 10 && base != 16) { EMSG(_(e_invarg)); return; } } p = skipwhite(get_tv_string(&argvars[0])); - if (*p == '+') + if (*p == '+') { p = skipwhite(p + 1); - vim_str2nr(p, NULL, NULL, base == 8 ? 2 : 0, base == 16 ? 2 : 0, &n, NULL); + } + vim_str2nr(p, NULL, NULL, + base == 2 ? 2 : 0, + base == 8 ? 2 : 0, + base == 16 ? 2 : 0, + &n, NULL); rettv->vval.v_number = n; } @@ -16776,7 +16789,7 @@ static void f_termopen(typval_T *argvars, typval_T *rettv) } TerminalJobData *data = common_job_init(argv, on_stdout, on_stderr, on_exit, - job_opts, true); + job_opts, true, false); data->proc.pty.width = curwin->w_width; data->proc.pty.height = curwin->w_height; data->proc.pty.term_name = xstrdup("xterm-256color"); @@ -18271,9 +18284,10 @@ long get_tv_number_chk(typval_T *varp, int *denote) EMSG(_("E703: Using a Funcref as a Number")); break; case VAR_STRING: - if (varp->vval.v_string != NULL) + if (varp->vval.v_string != NULL) { vim_str2nr(varp->vval.v_string, NULL, NULL, - TRUE, TRUE, &n, NULL); + true, true, true, &n, NULL); + } return n; case VAR_LIST: EMSG(_("E745: Using a List as a Number")); @@ -18285,10 +18299,12 @@ long get_tv_number_chk(typval_T *varp, int *denote) EMSG2(_(e_intern2), "get_tv_number()"); break; } - if (denote == NULL) /* useful for values that must be unsigned */ + if (denote == NULL) { + // useful for values that must be unsigned n = -1; - else - *denote = TRUE; + } else { + *denote = true; + } return n; } @@ -21782,8 +21798,13 @@ char_u *do_string_sub(char_u *str, char_u *pat, char_u *sub, char_u *flags) return ret; } -static inline TerminalJobData *common_job_init(char **argv, ufunc_T *on_stdout, - ufunc_T *on_stderr, ufunc_T *on_exit, dict_T *self, bool pty) +static inline TerminalJobData *common_job_init(char **argv, + ufunc_T *on_stdout, + ufunc_T *on_stderr, + ufunc_T *on_exit, + dict_T *self, + bool pty, + bool detach) { TerminalJobData *data = xcalloc(1, sizeof(TerminalJobData)); data->stopped = false; @@ -21806,6 +21827,7 @@ static inline TerminalJobData *common_job_init(char **argv, ufunc_T *on_stdout, } proc->cb = on_process_exit; proc->events = data->events; + proc->detach = detach; return data; } @@ -21833,8 +21855,13 @@ static inline bool common_job_callbacks(dict_T *vopts, ufunc_T **on_stdout, static inline bool common_job_start(TerminalJobData *data, typval_T *rettv) { - data->refcount++; Process *proc = (Process *)&data->proc; + if (proc->type == kProcessTypePty && proc->detach) { + EMSG2(_(e_invarg2), "terminal/pty job cannot be detached"); + return false; + } + + data->refcount++; char *cmd = xstrdup(proc->argv[0]); if (!process_spawn(proc)) { EMSG2(_(e_jobspawn), cmd); diff --git a/src/nvim/event/libuv_process.c b/src/nvim/event/libuv_process.c index 44305c69bc..9ef3468284 100644 --- a/src/nvim/event/libuv_process.c +++ b/src/nvim/event/libuv_process.c @@ -21,6 +21,9 @@ bool libuv_process_spawn(LibuvProcess *uvproc) uvproc->uvopts.args = proc->argv; uvproc->uvopts.flags = UV_PROCESS_WINDOWS_HIDE | UV_PROCESS_WINDOWS_VERBATIM_ARGUMENTS; + if (proc->detach) { + uvproc->uvopts.flags |= UV_PROCESS_DETACHED; + } uvproc->uvopts.exit_cb = exit_cb; uvproc->uvopts.cwd = NULL; uvproc->uvopts.env = NULL; diff --git a/src/nvim/event/process.c b/src/nvim/event/process.c index 0336eb880a..e6012595fd 100644 --- a/src/nvim/event/process.c +++ b/src/nvim/event/process.c @@ -29,6 +29,7 @@ } \ } while (0) +static bool process_is_tearing_down = false; bool process_spawn(Process *proc) FUNC_ATTR_NONNULL_ALL { @@ -112,11 +113,22 @@ bool process_spawn(Process *proc) FUNC_ATTR_NONNULL_ALL void process_teardown(Loop *loop) FUNC_ATTR_NONNULL_ALL { + process_is_tearing_down = true; kl_iter(WatcherPtr, loop->children, current) { Process *proc = (*current)->data; - uv_kill(proc->pid, SIGTERM); - proc->term_sent = true; - process_stop(proc); + if (proc->detach) { + // Close handles to process without killing it. + CREATE_EVENT(loop->events, process_close_handles, 1, proc); + } else { + if (proc->type == kProcessTypeUv) { + uv_kill(proc->pid, SIGTERM); + proc->term_sent = true; + process_stop(proc); + } else { // kProcessTypePty + process_close_streams(proc); + pty_process_close_master((PtyProcess *)proc); + } + } } // Wait until all children exit @@ -303,6 +315,10 @@ static void decref(Process *proc) static void process_close(Process *proc) FUNC_ATTR_NONNULL_ARG(1) { + if (process_is_tearing_down && proc->detach && proc->closed) { + // If a detached process dies while tearing down it might get closed twice. + return; + } assert(!proc->closed); proc->closed = true; switch (proc->type) { @@ -333,6 +349,7 @@ static void on_process_exit(Process *proc) DLOG("Stopping process kill timer"); uv_timer_stop(&loop->children_kill_timer); } + // Process handles are closed in the next event loop tick. This is done to // give libuv more time to read data from the OS after the process exits(If // process_close_streams is called with data still in the OS buffer, we lose diff --git a/src/nvim/event/process.h b/src/nvim/event/process.h index 45edc46b95..e23c8ea60f 100644 --- a/src/nvim/event/process.h +++ b/src/nvim/event/process.h @@ -25,7 +25,7 @@ struct process { Stream *in, *out, *err; process_exit_cb cb; internal_process_cb internal_exit_cb, internal_close_cb; - bool closed, term_sent; + bool closed, term_sent, detach; Queue *events; }; @@ -48,7 +48,8 @@ static inline Process process_init(Loop *loop, ProcessType type, void *data) .closed = false, .term_sent = false, .internal_close_cb = NULL, - .internal_exit_cb = NULL + .internal_exit_cb = NULL, + .detach = false }; } diff --git a/src/nvim/ex_cmds.c b/src/nvim/ex_cmds.c index b1ae6520b1..407dded6af 100644 --- a/src/nvim/ex_cmds.c +++ b/src/nvim/ex_cmds.c @@ -329,9 +329,7 @@ static int sort_compare(const void *s1, const void *s2) return result; } -/* - * ":sort". - */ +// ":sort". void ex_sort(exarg_T *eap) { regmatch_T regmatch; @@ -343,17 +341,19 @@ void ex_sort(exarg_T *eap) char_u *p; char_u *s; char_u *s2; - char_u c; /* temporary character storage */ - int unique = FALSE; + char_u c; // temporary character storage + int unique = false; long deleted; colnr_T start_col; colnr_T end_col; - int sort_oct; /* sort on octal number */ - int sort_hex; /* sort on hex number */ + int sort_bin; // sort on bin number + int sort_oct; // sort on octal number + int sort_hex; // sort on hex number - /* Sorting one line is really quick! */ - if (count <= 1) + // Sorting one line is really quick! + if (count <= 1) { return; + } if (u_save((linenr_T)(eap->line1 - 1), (linenr_T)(eap->line2 + 1)) == FAIL) return; @@ -362,47 +362,51 @@ void ex_sort(exarg_T *eap) regmatch.regprog = NULL; sorti_T *nrs = xmalloc(count * sizeof(sorti_T)); - sort_abort = sort_ic = sort_rx = sort_nr = sort_oct = sort_hex = 0; + sort_abort = sort_ic = sort_rx = sort_nr = sort_bin = sort_oct = sort_hex = 0; for (p = eap->arg; *p != NUL; ++p) { - if (ascii_iswhite(*p)) - ; - else if (*p == 'i') - sort_ic = TRUE; - else if (*p == 'r') - sort_rx = TRUE; - else if (*p == 'n') + if (ascii_iswhite(*p)) { + } else if (*p == 'i') { + sort_ic = true; + } else if (*p == 'r') { + sort_rx = true; + } else if (*p == 'n') { sort_nr = 2; - else if (*p == 'o') + } else if (*p == 'b') { + sort_bin = 2; + } else if (*p == 'o') { sort_oct = 2; - else if (*p == 'x') + } else if (*p == 'x') { sort_hex = 2; - else if (*p == 'u') - unique = TRUE; - else if (*p == '"') /* comment start */ + } else if (*p == 'u') { + unique = true; + } else if (*p == '"') { + // comment start break; - else if (check_nextcmd(p) != NULL) { + } else if (check_nextcmd(p) != NULL) { eap->nextcmd = check_nextcmd(p); break; } else if (!ASCII_ISALPHA(*p) && regmatch.regprog == NULL) { - s = skip_regexp(p + 1, *p, TRUE, NULL); + s = skip_regexp(p + 1, *p, true, NULL); if (*s != *p) { EMSG(_(e_invalpat)); goto sortend; } *s = NUL; - /* Use last search pattern if sort pattern is empty. */ + // Use last search pattern if sort pattern is empty. if (s == p + 1) { if (last_search_pat() == NULL) { EMSG(_(e_noprevre)); goto sortend; } regmatch.regprog = vim_regcomp(last_search_pat(), RE_MAGIC); - } else + } else { regmatch.regprog = vim_regcomp(p + 1, RE_MAGIC); - if (regmatch.regprog == NULL) + } + if (regmatch.regprog == NULL) { goto sortend; - p = s; /* continue after the regexp */ + } + p = s; // continue after the regexp regmatch.rm_ic = p_ic; } else { EMSG2(_(e_invarg2), p); @@ -410,28 +414,27 @@ void ex_sort(exarg_T *eap) } } - /* Can only have one of 'n', 'o' and 'x'. */ - if (sort_nr + sort_oct + sort_hex > 2) { + // Can only have one of 'n', 'b', 'o' and 'x'. + if (sort_nr + sort_bin + sort_oct + sort_hex > 2) { EMSG(_(e_invarg)); goto sortend; } - /* From here on "sort_nr" is used as a flag for any number sorting. */ - sort_nr += sort_oct + sort_hex; + // From here on "sort_nr" is used as a flag for any number sorting. + sort_nr += sort_bin + sort_oct + sort_hex; - /* - * Make an array with all line numbers. This avoids having to copy all - * the lines into allocated memory. - * When sorting on strings "start_col_nr" is the offset in the line, for - * numbers sorting it's the number to sort on. This means the pattern - * matching and number conversion only has to be done once per line. - * Also get the longest line length for allocating "sortbuf". - */ + // Make an array with all line numbers. This avoids having to copy all + // the lines into allocated memory. + // When sorting on strings "start_col_nr" is the offset in the line, for + // numbers sorting it's the number to sort on. This means the pattern + // matching and number conversion only has to be done once per line. + // Also get the longest line length for allocating "sortbuf". for (lnum = eap->line1; lnum <= eap->line2; ++lnum) { s = ml_get(lnum); len = (int)STRLEN(s); - if (maxlen < len) + if (maxlen < len) { maxlen = len; + } start_col = 0; end_col = len; @@ -439,34 +442,41 @@ void ex_sort(exarg_T *eap) if (sort_rx) { start_col = (colnr_T)(regmatch.startp[0] - s); end_col = (colnr_T)(regmatch.endp[0] - s); - } else + } else { start_col = (colnr_T)(regmatch.endp[0] - s); - } else if (regmatch.regprog != NULL) + } + } else if (regmatch.regprog != NULL) { end_col = 0; + } if (sort_nr) { - /* Make sure vim_str2nr doesn't read any digits past the end - * of the match, by temporarily terminating the string there */ + // Make sure vim_str2nr doesn't read any digits past the end + // of the match, by temporarily terminating the string there s2 = s + end_col; c = *s2; *s2 = NUL; - /* Sorting on number: Store the number itself. */ + // Sorting on number: Store the number itself. p = s + start_col; - if (sort_hex) + if (sort_hex) { s = skiptohex(p); - else + } else if (sort_bin) { + s = (char_u*) skiptobin((char*) p); + } else { s = skiptodigit(p); - if (s > p && s[-1] == '-') - --s; /* include preceding negative sign */ - if (*s == NUL) - /* empty line should sort before any number */ + } + if (s > p && s[-1] == '-') { + --s; // include preceding negative sign + } + if (*s == NUL) { + // empty line should sort before any number nrs[lnum - eap->line1].start_col_nr = -MAXLNUM; - else - vim_str2nr(s, NULL, NULL, sort_oct, sort_hex, - &nrs[lnum - eap->line1].start_col_nr, NULL); + } else { + vim_str2nr(s, NULL, NULL, sort_bin, sort_oct, sort_hex, + &nrs[lnum - eap->line1].start_col_nr, NULL); + } *s2 = c; } else { - /* Store the column to sort at. */ + // Store the column to sort at. nrs[lnum - eap->line1].start_col_nr = start_col; nrs[lnum - eap->line1].end_col_nr = end_col; } @@ -479,17 +489,17 @@ void ex_sort(exarg_T *eap) goto sortend; } - /* Allocate a buffer that can hold the longest line. */ + // Allocate a buffer that can hold the longest line. sortbuf1 = xmalloc(maxlen + 1); sortbuf2 = xmalloc(maxlen + 1); - /* Sort the array of line numbers. Note: can't be interrupted! */ + // Sort the array of line numbers. Note: can't be interrupted! qsort((void *)nrs, count, sizeof(sorti_T), sort_compare); if (sort_abort) goto sortend; - /* Insert the lines in the sorted order below the last one. */ + // Insert the lines in the sorted order below the last one. lnum = eap->line2; for (i = 0; i < count; ++i) { s = ml_get(nrs[eap->forceit ? count - i - 1 : i].lnum); @@ -507,19 +517,22 @@ void ex_sort(exarg_T *eap) goto sortend; } - /* delete the original lines if appending worked */ - if (i == count) - for (i = 0; i < count; ++i) - ml_delete(eap->line1, FALSE); - else + // delete the original lines if appending worked + if (i == count) { + for (i = 0; i < count; ++i) { + ml_delete(eap->line1, false); + } + } else { count = 0; + } - /* Adjust marks for deleted (or added) lines and prepare for displaying. */ + // Adjust marks for deleted (or added) lines and prepare for displaying. deleted = (long)(count - (lnum - eap->line2)); - if (deleted > 0) + if (deleted > 0) { mark_adjust(eap->line2 - deleted, eap->line2, (long)MAXLNUM, -deleted); - else if (deleted < 0) + } else if (deleted < 0) { mark_adjust(eap->line2, MAXLNUM, -deleted, 0L); + } changed_lines(eap->line1, 0, eap->line2 + 1, -deleted); curwin->w_cursor.lnum = eap->line1; @@ -530,8 +543,9 @@ sortend: xfree(sortbuf1); xfree(sortbuf2); vim_regfree(regmatch.regprog); - if (got_int) + if (got_int) { EMSG(_(e_interr)); + } } /* @@ -951,30 +965,26 @@ void do_bang(int addr_count, exarg_T *eap, int forceit, int do_in, int do_out) xfree(newcmd); } -/* - * do_filter: filter lines through a command given by the user - * - * We mostly use temp files and the call_shell() routine here. This would - * normally be done using pipes on a UNIX machine, but this is more portable - * to non-unix machines. The call_shell() routine needs to be able - * to deal with redirection somehow, and should handle things like looking - * at the PATH env. variable, and adding reasonable extensions to the - * command name given by the user. All reasonable versions of call_shell() - * do this. - * Alternatively, if on Unix and redirecting input or output, but not both, - * and the 'shelltemp' option isn't set, use pipes. - * We use input redirection if do_in is TRUE. - * We use output redirection if do_out is TRUE. - */ -static void -do_filter ( +// do_filter: filter lines through a command given by the user +// +// We mostly use temp files and the call_shell() routine here. This would +// normally be done using pipes on a Unix system, but this is more portable +// to non-Unix systems. The call_shell() routine needs to be able +// to deal with redirection somehow, and should handle things like looking +// at the PATH env. variable, and adding reasonable extensions to the +// command name given by the user. All reasonable versions of call_shell() +// do this. +// Alternatively, if on Unix and redirecting input or output, but not both, +// and the 'shelltemp' option isn't set, use pipes. +// We use input redirection if do_in is TRUE. +// We use output redirection if do_out is TRUE. +static void do_filter( linenr_T line1, linenr_T line2, exarg_T *eap, /* for forced 'ff' and 'fenc' */ char_u *cmd, int do_in, - int do_out -) + int do_out) { char_u *itmp = NULL; char_u *otmp = NULL; @@ -1690,7 +1700,7 @@ check_overwrite ( && os_file_exists(ffname)) { if (!eap->forceit && !eap->append) { #ifdef UNIX - /* with UNIX it is possible to open a directory */ + // It is possible to open a directory on Unix. if (os_isdir(ffname)) { EMSG2(_(e_isadir2), ffname); return FAIL; @@ -2859,6 +2869,8 @@ void do_sub(exarg_T *eap) static int do_list = FALSE; /* list last line with subs. */ static int do_number = FALSE; /* list last line with line nr*/ static int do_ic = 0; /* ignore case flag */ + int save_do_all; // remember user specified 'g' flag + int save_do_ask; // remember user specified 'c' flag char_u *pat = NULL, *sub = NULL; /* init for GCC */ int delimiter; int sublen; @@ -3048,12 +3060,14 @@ void do_sub(exarg_T *eap) break; ++cmd; } - if (do_count) + if (do_count) { do_ask = FALSE; + } - /* - * check for a trailing count - */ + save_do_all = do_all; + save_do_ask = do_ask; + + // check for a trailing count cmd = skipwhite(cmd); if (ascii_isdigit(*cmd)) { i = getdigits_long(&cmd); @@ -3752,8 +3766,12 @@ skip: /* Cursor position may require updating */ changed_window_setting(); - vim_regfree(regmatch.regprog); -} + vim_regfree(regmatch.regprog); + + // Restore the flag values, they can be used for ":&&". + do_all = save_do_all; + do_ask = save_do_ask; + } /* * Give message for number of substitutions. diff --git a/src/nvim/ex_cmds.lua b/src/nvim/ex_cmds.lua index 702abf3cf0..6c8835b5c5 100644 --- a/src/nvim/ex_cmds.lua +++ b/src/nvim/ex_cmds.lua @@ -1025,12 +1025,6 @@ return { func='ex_helpclose', }, { - command='helpfind', - flags=bit.bor(EXTRA, NOTRLCOM), - addr_type=ADDR_LINES, - func='ex_ni', - }, - { command='helpgrep', flags=bit.bor(EXTRA, NOTRLCOM, NEEDARG), addr_type=ADDR_LINES, diff --git a/src/nvim/ex_cmds2.c b/src/nvim/ex_cmds2.c index 57153cf5a1..47774f5a99 100644 --- a/src/nvim/ex_cmds2.c +++ b/src/nvim/ex_cmds2.c @@ -6,6 +6,7 @@ #include <inttypes.h> #include <stdbool.h> #include <string.h> +#include <fcntl.h> #include "nvim/vim.h" #include "nvim/ascii.h" diff --git a/src/nvim/ex_docmd.c b/src/nvim/ex_docmd.c index 84bd31d9ad..cbe7c1a231 100644 --- a/src/nvim/ex_docmd.c +++ b/src/nvim/ex_docmd.c @@ -6843,9 +6843,9 @@ void ex_cd(exarg_T *eap) prev_dir = NULL; #if defined(UNIX) - /* for UNIX ":cd" means: go to home directory */ + // On Unix ":cd" means: go to home directory. if (*new_dir == NUL) { - /* use NameBuff for home directory name */ + // Use NameBuff for home directory name. expand_env((char_u *)"$HOME", NameBuff, MAXPATHL); new_dir = NameBuff; } diff --git a/src/nvim/ex_getln.c b/src/nvim/ex_getln.c index 6d81f3680a..87a6bf8901 100644 --- a/src/nvim/ex_getln.c +++ b/src/nvim/ex_getln.c @@ -596,7 +596,7 @@ static int command_line_execute(VimState *state, int key) } if (s->j > 0) { - // TODO(tarruda): this is only for DOS/UNIX systems - need to put in + // TODO(tarruda): this is only for DOS/Unix systems - need to put in // machine-specific stuff here and in upseg init cmdline_del(s->j); put_on_cmdline(upseg + 1, 3, false); @@ -4767,35 +4767,40 @@ int del_history_idx(int histype, int idx) return TRUE; } -/* - * Get indices "num1,num2" that specify a range within a list (not a range of - * text lines in a buffer!) from a string. Used for ":history" and ":clist". - * Returns OK if parsed successfully, otherwise FAIL. - */ +/// Get indices that specify a range within a list (not a range of text lines +/// in a buffer!) from a string. Used for ":history" and ":clist". +/// +/// @param str string to parse range from +/// @param num1 from +/// @param num2 to +/// +/// @return OK if parsed successfully, otherwise FAIL. int get_list_range(char_u **str, int *num1, int *num2) { int len; - int first = FALSE; + int first = false; long num; *str = skipwhite(*str); - if (**str == '-' || ascii_isdigit(**str)) { /* parse "from" part of range */ - vim_str2nr(*str, NULL, &len, FALSE, FALSE, &num, NULL); + if (**str == '-' || ascii_isdigit(**str)) { // parse "from" part of range + vim_str2nr(*str, NULL, &len, false, false, false, &num, NULL); *str += len; *num1 = (int)num; - first = TRUE; + first = true; } *str = skipwhite(*str); - if (**str == ',') { /* parse "to" part of range */ + if (**str == ',') { // parse "to" part of range *str = skipwhite(*str + 1); - vim_str2nr(*str, NULL, &len, FALSE, FALSE, &num, NULL); + vim_str2nr(*str, NULL, &len, false, false, false, &num, NULL); if (len > 0) { *num2 = (int)num; *str = skipwhite(*str + len); - } else if (!first) /* no number given at all */ + } else if (!first) { // no number given at all return FAIL; - } else if (first) /* only one number given */ + } + } else if (first) { // only one number given *num2 = *num1; + } return OK; } diff --git a/src/nvim/fileio.c b/src/nvim/fileio.c index bd0f0fc80a..26376afa27 100644 --- a/src/nvim/fileio.c +++ b/src/nvim/fileio.c @@ -7,6 +7,7 @@ #include <stdbool.h> #include <string.h> #include <inttypes.h> +#include <fcntl.h> #include "nvim/vim.h" #include "nvim/ascii.h" @@ -366,14 +367,13 @@ readfile ( /* don't display the file info for another buffer now */ need_fileinfo = FALSE; - /* - * For Unix: Use the short file name whenever possible. - * Avoids problems with networks and when directory names are changed. - * Don't do this for MS-DOS, a "cd" in a sub-shell may have moved us to - * another directory, which we don't detect. - */ - if (sfname == NULL) + // For Unix: Use the short file name whenever possible. + // Avoids problems with networks and when directory names are changed. + // Don't do this for Windows, a "cd" in a sub-shell may have moved us to + // another directory, which we don't detect. + if (sfname == NULL) { sfname = fname; + } #if defined(UNIX) fname = sfname; #endif @@ -1992,13 +1992,14 @@ failed: } #ifdef OPEN_CHR_FILES -/* - * Returns TRUE if the file name argument is of the form "/dev/fd/\d\+", - * which is the name of files used for process substitution output by - * some shells on some operating systems, e.g., bash on SunOS. - * Do not accept "/dev/fd/[012]", opening these may hang Vim. - */ -static int is_dev_fd_file(char_u *fname) +/// Returns true if the file name argument is of the form "/dev/fd/\d\+", +/// which is the name of files used for process substitution output by +/// some shells on some operating systems, e.g., bash on SunOS. +/// Do not accept "/dev/fd/[012]", opening these may hang Vim. +/// +/// @param fname file name to check +static bool is_dev_fd_file(char_u *fname) + FUNC_ATTR_NONNULL_ALL FUNC_ATTR_WARN_UNUSED_RESULT { return STRNCMP(fname, "/dev/fd/", 8) == 0 && ascii_isdigit(fname[8]) @@ -2353,13 +2354,12 @@ buf_write ( if (sfname == NULL) sfname = fname; - /* - * For Unix: Use the short file name whenever possible. - * Avoids problems with networks and when directory names are changed. - * Don't do this for MS-DOS, a "cd" in a sub-shell may have moved us to - * another directory, which we don't detect - */ - ffname = fname; /* remember full fname */ + + // For Unix: Use the short file name whenever possible. + // Avoids problems with networks and when directory names are changed. + // Don't do this for Windows, a "cd" in a sub-shell may have moved us to + // another directory, which we don't detect. + ffname = fname; // remember full fname #ifdef UNIX fname = sfname; #endif @@ -3807,29 +3807,30 @@ void msg_add_fname(buf_T *buf, char_u *fname) STRCAT(IObuff, "\" "); } -/* - * Append message for text mode to IObuff. - * Return TRUE if something appended. - */ -static int msg_add_fileformat(int eol_type) +/// Append message for text mode to IObuff. +/// +/// @param eol_type line ending type +/// +/// @return true if something was appended. +static bool msg_add_fileformat(int eol_type) { #ifndef USE_CRNL if (eol_type == EOL_DOS) { STRCAT(IObuff, shortmess(SHM_TEXT) ? _("[dos]") : _("[dos format]")); - return TRUE; + return true; } #endif if (eol_type == EOL_MAC) { STRCAT(IObuff, shortmess(SHM_TEXT) ? _("[mac]") : _("[mac format]")); - return TRUE; + return true; } #ifdef USE_CRNL if (eol_type == EOL_UNIX) { STRCAT(IObuff, shortmess(SHM_TEXT) ? _("[unix]") : _("[unix format]")); - return TRUE; + return true; } #endif - return FALSE; + return false; } /* @@ -3893,7 +3894,11 @@ static int check_mtime(buf_T *buf, FileInfo *file_info) return OK; } -static int time_differs(long t1, long t2) +/// Return true if the times differ +/// +/// @param t1 first time +/// @param t2 second time +static bool time_differs(long t1, long t2) FUNC_ATTR_CONST { #if defined(__linux__) || defined(MSWIN) /* On a FAT filesystem, esp. under Linux, there are only 5 bits to store @@ -4082,19 +4087,17 @@ static int buf_write_bytes(struct bw_info *ip) return (wlen < len) ? FAIL : OK; } -/* - * Convert a Unicode character to bytes. - * Return TRUE for an error, FALSE when it's OK. - */ -static int -ucs2bytes ( - unsigned c, /* in: character */ - char_u **pp, /* in/out: pointer to result */ - int flags /* FIO_ flags */ -) +/// Convert a Unicode character to bytes. +/// +/// @param c character to convert +/// @param[in,out] pp pointer to store the result at +/// @param flags FIO_ flags that specify which encoding to use +/// +/// @return true for an error, false when it's OK. +static bool ucs2bytes(unsigned c, char_u **pp, int flags) FUNC_ATTR_NONNULL_ALL { char_u *p = *pp; - int error = FALSE; + bool error = false; int cc; @@ -4116,8 +4119,9 @@ ucs2bytes ( /* Make two words, ten bits of the character in each. First * word is 0xd800 - 0xdbff, second one 0xdc00 - 0xdfff */ c -= 0x10000; - if (c >= 0x100000) - error = TRUE; + if (c >= 0x100000) { + error = true; + } cc = ((c >> 10) & 0x3ff) + 0xd800; if (flags & FIO_ENDIAN_L) { *p++ = cc; @@ -4127,8 +4131,9 @@ ucs2bytes ( *p++ = cc; } c = (c & 0x3ff) + 0xdc00; - } else - error = TRUE; + } else { + error = true; + } } if (flags & FIO_ENDIAN_L) { *p++ = c; @@ -4139,7 +4144,7 @@ ucs2bytes ( } } else { /* Latin1 */ if (c >= 0x100) { - error = TRUE; + error = true; *p++ = 0xBF; } else *p++ = c; @@ -4149,11 +4154,14 @@ ucs2bytes ( return error; } -/* - * Return TRUE if file encoding "fenc" requires conversion from or to - * 'encoding'. - */ -static int need_conversion(char_u *fenc) +/// Return true if file encoding "fenc" requires conversion from or to +/// 'encoding'. +/// +/// @param fenc file encoding to check +/// +/// @return true if conversion is required +static bool need_conversion(const char_u *fenc) + FUNC_ATTR_NONNULL_ALL FUNC_ATTR_WARN_UNUSED_RESULT { int same_encoding; int enc_flags; @@ -4180,19 +4188,19 @@ static int need_conversion(char_u *fenc) return !(enc_utf8 && fenc_flags == FIO_UTF8); } -/* - * Check "ptr" for a unicode encoding and return the FIO_ flags needed for the - * internal conversion. - * if "ptr" is an empty string, use 'encoding'. - */ -static int get_fio_flags(char_u *ptr) +/// Return the FIO_ flags needed for the internal conversion if 'name' was +/// unicode or latin1, otherwise 0. If "name" is an empty string, +/// use 'encoding'. +/// +/// @param name string to check for encoding +static int get_fio_flags(const char_u *name) { int prop; - if (*ptr == NUL) - ptr = p_enc; - - prop = enc_canon_props(ptr); + if (*name == NUL) { + name = p_enc; + } + prop = enc_canon_props(name); if (prop & ENC_UNICODE) { if (prop & ENC_2BYTE) { if (prop & ENC_ENDIAN_L) @@ -4424,11 +4432,15 @@ char *modname(const char *fname, const char *ext, bool prepend_dot) return retval; } -/* - * Like fgets(), but if the file line is too long, it is truncated and the - * rest of the line is thrown away. Returns TRUE for end-of-file. - */ -int vim_fgets(char_u *buf, int size, FILE *fp) +/// Like fgets(), but if the file line is too long, it is truncated and the +/// rest of the line is thrown away. +/// +/// @param[out] buf buffer to fill +/// @param size size of the buffer +/// @param fp file to read from +/// +/// @return true for end-of-file. +bool vim_fgets(char_u *buf, int size, FILE *fp) FUNC_ATTR_NONNULL_ALL { char *eof; #define FGETS_SIZE 200 @@ -5327,11 +5339,13 @@ static void au_del_group(char_u *name) } } -/* - * Find the ID of an autocmd group name. - * Return it's ID. Returns AUGROUP_ERROR (< 0) for error. - */ -static int au_find_group(char_u *name) +/// Find the ID of an autocmd group name. +/// +/// @param name augroup name +/// +/// @return the ID or AUGROUP_ERROR (< 0) for error. +static int au_find_group(const char_u *name) + FUNC_ATTR_PURE FUNC_ATTR_WARN_UNUSED_RESULT { for (int i = 0; i < augroups.ga_len; ++i) { if (AUGROUP_NAME(i) != NULL && STRCMP(AUGROUP_NAME(i), name) == 0) { @@ -5341,10 +5355,11 @@ static int au_find_group(char_u *name) return AUGROUP_ERROR; } -/* - * Return TRUE if augroup "name" exists. - */ -int au_has_group(char_u *name) +/// Return true if augroup "name" exists. +/// +/// @param name augroup name +bool au_has_group(const char_u *name) + FUNC_ATTR_PURE FUNC_ATTR_WARN_UNUSED_RESULT { return au_find_group(name) != AUGROUP_ERROR; } @@ -5461,21 +5476,24 @@ find_end_event ( return pat; } -/* - * Return TRUE if "event" is included in 'eventignore'. - */ -static int event_ignored(event_T event) +/// Return true if "event" is included in 'eventignore'. +/// +/// @param event event to check +static bool event_ignored(event_T event) + FUNC_ATTR_PURE FUNC_ATTR_WARN_UNUSED_RESULT { - char_u *p = p_ei; + char_u *p = p_ei; while (*p != NUL) { - if (STRNICMP(p, "all", 3) == 0 && (p[3] == NUL || p[3] == ',')) - return TRUE; - if (event_name2nr(p, &p) == event) - return TRUE; + if (STRNICMP(p, "all", 3) == 0 && (p[3] == NUL || p[3] == ',')) { + return true; + } + if (event_name2nr(p, &p) == event) { + return true; + } } - return FALSE; + return false; } /* @@ -5992,18 +6010,19 @@ void ex_doautoall(exarg_T *eap) check_cursor(); /* just in case lines got deleted */ } -/* - * Check *argp for <nomodeline>. When it is present return FALSE, otherwise - * return TRUE and advance *argp to after it. - * Thus return TRUE when do_modelines() should be called. - */ -int check_nomodeline(char_u **argp) +/// Check *argp for <nomodeline>. When it is present return false, otherwise +/// return true and advance *argp to after it. Thus do_modelines() should be +/// called when true is returned. +/// +/// @param[in,out] argp argument string +bool check_nomodeline(char_u **argp) + FUNC_ATTR_NONNULL_ALL FUNC_ATTR_WARN_UNUSED_RESULT { if (STRNCMP(*argp, "<nomodeline>", 12) == 0) { *argp = skipwhite(*argp + 12); - return FALSE; + return false; } - return TRUE; + return true; } /* @@ -6180,76 +6199,78 @@ win_found: static int autocmd_nested = FALSE; -/* - * Execute autocommands for "event" and file name "fname". - * Return TRUE if some commands were executed. - */ -int -apply_autocmds ( - event_T event, - char_u *fname, /* NULL or empty means use actual file name */ - char_u *fname_io, /* fname to use for <afile> on cmdline */ - int force, /* when TRUE, ignore autocmd_busy */ - buf_T *buf /* buffer for <abuf> */ -) +/// Execute autocommands for "event" and file name "fname". +/// +/// @param event event that occured +/// @param fname filename, NULL or empty means use actual file name +/// @param fname_io filename to use for <afile> on cmdline +/// @param force When true, ignore autocmd_busy +/// @param buf Buffer for <abuf> +/// +/// @return true if some commands were executed. +bool apply_autocmds(event_T event, char_u *fname, char_u *fname_io, bool force, + buf_T *buf) { return apply_autocmds_group(event, fname, fname_io, force, AUGROUP_ALL, buf, NULL); } -/* - * Like apply_autocmds(), but with extra "eap" argument. This takes care of - * setting v:filearg. - */ -static int apply_autocmds_exarg(event_T event, char_u *fname, char_u *fname_io, int force, buf_T *buf, exarg_T *eap) +/// Like apply_autocmds(), but with extra "eap" argument. This takes care of +/// setting v:filearg. +/// +/// @param event event that occured +/// @param fname NULL or empty means use actual file name +/// @param fname_io fname to use for <afile> on cmdline +/// @param force When true, ignore autocmd_busy +/// @param buf Buffer for <abuf> +/// @param exarg Ex command arguments +/// +/// @return true if some commands were executed. +static bool apply_autocmds_exarg(event_T event, char_u *fname, char_u *fname_io, + bool force, buf_T *buf, exarg_T *eap) { return apply_autocmds_group(event, fname, fname_io, force, AUGROUP_ALL, buf, eap); } -/* - * Like apply_autocmds(), but handles the caller's retval. If the script - * processing is being aborted or if retval is FAIL when inside a try - * conditional, no autocommands are executed. If otherwise the autocommands - * cause the script to be aborted, retval is set to FAIL. - */ -int -apply_autocmds_retval ( - event_T event, - char_u *fname, /* NULL or empty means use actual file name */ - char_u *fname_io, /* fname to use for <afile> on cmdline */ - int force, /* when TRUE, ignore autocmd_busy */ - buf_T *buf, /* buffer for <abuf> */ - int *retval /* pointer to caller's retval */ -) +/// Like apply_autocmds(), but handles the caller's retval. If the script +/// processing is being aborted or if retval is FAIL when inside a try +/// conditional, no autocommands are executed. If otherwise the autocommands +/// cause the script to be aborted, retval is set to FAIL. +/// +/// @param event event that occured +/// @param fname NULL or empty means use actual file name +/// @param fname_io fname to use for <afile> on cmdline +/// @param force When true, ignore autocmd_busy +/// @param buf Buffer for <abuf> +/// @param[in,out] retval caller's retval +/// +/// @return true if some autocommands were executed +bool apply_autocmds_retval(event_T event, char_u *fname, char_u *fname_io, + bool force, buf_T *buf, int *retval) { - int did_cmd; - - if (should_abort(*retval)) - return FALSE; + if (should_abort(*retval)) { + return false; + } - did_cmd = apply_autocmds_group(event, fname, fname_io, force, - AUGROUP_ALL, buf, NULL); - if (did_cmd - && aborting() - ) + bool did_cmd = apply_autocmds_group(event, fname, fname_io, force, + AUGROUP_ALL, buf, NULL); + if (did_cmd && aborting()) { *retval = FAIL; + } return did_cmd; } -/* - * Return TRUE when there is a CursorHold autocommand defined. - */ -int has_cursorhold(void) +/// Return true when there is a CursorHold/CursorHoldI autocommand defined for +/// the current mode. +bool has_cursorhold(void) FUNC_ATTR_PURE FUNC_ATTR_WARN_UNUSED_RESULT { return first_autopat[(int)(get_real_state() == NORMAL_BUSY ? EVENT_CURSORHOLD : EVENT_CURSORHOLDI)] != NULL; } -/* - * Return TRUE if the CursorHold event can be triggered. - */ -int trigger_cursorhold(void) +/// Return true if the CursorHold/CursorHoldI event can be triggered. +bool trigger_cursorhold(void) FUNC_ATTR_PURE FUNC_ATTR_WARN_UNUSED_RESULT { int state; @@ -6260,10 +6281,11 @@ int trigger_cursorhold(void) && !ins_compl_active() ) { state = get_real_state(); - if (state == NORMAL_BUSY || (state & INSERT) != 0) - return TRUE; + if (state == NORMAL_BUSY || (state & INSERT) != 0) { + return true; + } } - return FALSE; + return false; } /// Return true if "event" autocommand is defined. @@ -6274,23 +6296,27 @@ bool has_event(int event) FUNC_ATTR_PURE FUNC_ATTR_WARN_UNUSED_RESULT return first_autopat[event] != NULL; } -static int -apply_autocmds_group ( - event_T event, - char_u *fname, /* NULL or empty means use actual file name */ - char_u *fname_io, /* fname to use for <afile> on cmdline, NULL means - use fname */ - int force, /* when TRUE, ignore autocmd_busy */ - int group, /* group ID, or AUGROUP_ALL */ - buf_T *buf, /* buffer for <abuf> */ - exarg_T *eap /* command arguments */ -) +/// Execute autocommands for "event" and file name "fname". +/// +/// @param event event that occured +/// @param fname filename, NULL or empty means use actual file name +/// @param fname_io filename to use for <afile> on cmdline, +/// NULL means use `fname`. +/// @param force When true, ignore autocmd_busy +/// @param group autocmd group ID or AUGROUP_ALL +/// @param buf Buffer for <abuf> +/// @param exarg Ex command arguments +/// +/// @return true if some commands were executed. +static bool apply_autocmds_group(event_T event, char_u *fname, char_u *fname_io, + bool force, int group, buf_T *buf, + exarg_T *eap) { char_u *sfname = NULL; /* short file name */ char_u *tail; bool save_changed; buf_T *old_curbuf; - int retval = FALSE; + bool retval = false; char_u *save_sourcing_name; linenr_T save_sourcing_lnum; char_u *save_autocmd_fname; @@ -6444,17 +6470,16 @@ apply_autocmds_group ( } if (fname == NULL) { /* out of memory */ xfree(sfname); - retval = FALSE; + retval = false; goto BYPASS_AU; } #ifdef BACKSLASH_IN_FILENAME - /* - * Replace all backslashes with forward slashes. This makes the - * autocommand patterns portable between Unix and MS-DOS. - */ - if (sfname != NULL) + // Replace all backslashes with forward slashes. This makes the + // autocommand patterns portable between Unix and Windows. + if (sfname != NULL) { forward_slash(sfname); + } forward_slash(fname); #endif @@ -6528,17 +6553,19 @@ apply_autocmds_group ( if (eap != NULL) { save_cmdarg = set_cmdarg(eap, NULL); set_vim_var_nr(VV_CMDBANG, (long)eap->forceit); - } else - save_cmdarg = NULL; /* avoid gcc warning */ - retval = TRUE; - /* mark the last pattern, to avoid an endless loop when more patterns - * are added when executing autocommands */ - for (ap = patcmd.curpat; ap->next != NULL; ap = ap->next) - ap->last = FALSE; - ap->last = TRUE; - check_lnums(TRUE); /* make sure cursor and topline are valid */ + } else { + save_cmdarg = NULL; // avoid gcc warning + } + retval = true; + // mark the last pattern, to avoid an endless loop when more patterns + // are added when executing autocommands + for (ap = patcmd.curpat; ap->next != NULL; ap = ap->next) { + ap->last = false; + } + ap->last = true; + check_lnums(true); // make sure cursor and topline are valid do_cmdline(NULL, getnextac, (void *)&patcmd, - DOCMD_NOWAIT|DOCMD_VERBOSE|DOCMD_REPEAT); + DOCMD_NOWAIT|DOCMD_VERBOSE|DOCMD_REPEAT); if (eap != NULL) { (void)set_cmdarg(NULL, save_cmdarg); set_vim_var_nr(VV_CMDBANG, save_cmdbang); @@ -6754,42 +6781,44 @@ char_u *getnextac(int c, void *cookie, int indent) return retval; } -/* - * Return TRUE if there is a matching autocommand for "fname". - * To account for buffer-local autocommands, function needs to know - * in which buffer the file will be opened. - */ -int has_autocmd(event_T event, char_u *sfname, buf_T *buf) +/// Return true if there is a matching autocommand for "fname". +/// To account for buffer-local autocommands, function needs to know +/// in which buffer the file will be opened. +/// +/// @param event event that occured. +/// @param sfname filename the event occured in. +/// @param buf buffer the file is open in +bool has_autocmd(event_T event, char_u *sfname, buf_T *buf) + FUNC_ATTR_WARN_UNUSED_RESULT { AutoPat *ap; char_u *fname; char_u *tail = path_tail(sfname); - int retval = FALSE; + bool retval = false; - fname = (char_u *)FullName_save((char *)sfname, FALSE); - if (fname == NULL) - return FALSE; + fname = (char_u *)FullName_save((char *)sfname, false); + if (fname == NULL) { + return false; + } #ifdef BACKSLASH_IN_FILENAME - /* - * Replace all backslashes with forward slashes. This makes the - * autocommand patterns portable between Unix and MS-DOS. - */ + // Replace all backslashes with forward slashes. This makes the + // autocommand patterns portable between Unix and Windows. sfname = vim_strsave(sfname); forward_slash(sfname); forward_slash(fname); #endif - for (ap = first_autopat[(int)event]; ap != NULL; ap = ap->next) + for (ap = first_autopat[(int)event]; ap != NULL; ap = ap->next) { if (ap->pat != NULL && ap->cmds != NULL && (ap->buflocal_nr == 0 ? match_file_pat(NULL, &ap->reg_prog, fname, sfname, tail, ap->allow_dirs) - : buf != NULL && ap->buflocal_nr == buf->b_fnum - )) { - retval = TRUE; + : buf != NULL && ap->buflocal_nr == buf->b_fnum)) { + retval = true; break; } + } xfree(fname); #ifdef BACKSLASH_IN_FILENAME @@ -6877,29 +6906,27 @@ char_u *get_event_name(expand_T *xp, int idx) } -/* - * Return TRUE if autocmd is supported. - */ -int autocmd_supported(char_u *name) +/// Return true if autocmd "event" is supported. +bool autocmd_supported(char_u *event) { char_u *p; - return event_name2nr(name, &p) != NUM_EVENTS; + return event_name2nr(event, &p) != NUM_EVENTS; } -/* - * Return TRUE if an autocommand is defined for a group, event and - * pattern: The group can be omitted to accept any group. "event" and "pattern" - * can be NULL to accept any event and pattern. "pattern" can be NULL to accept - * any pattern. Buffer-local patterns <buffer> or <buffer=N> are accepted. - * Used for: - * exists("#Group") or - * exists("#Group#Event") or - * exists("#Group#Event#pat") or - * exists("#Event") or - * exists("#Event#pat") - */ -int au_exists(char_u *arg) +/// Return true if an autocommand is defined for a group, event and +/// pattern: The group can be omitted to accept any group. +/// `event` and `pattern` can be omitted to accept any event and pattern. +/// Buffer-local patterns <buffer> or <buffer=N> are accepted. +/// Used for: +/// exists("#Group") or +/// exists("#Group#Event") or +/// exists("#Group#Event#pat") or +/// exists("#Event") or +/// exists("#Event#pat") +/// +/// @param arg autocommand string +bool au_exists(const char_u *arg) FUNC_ATTR_WARN_UNUSED_RESULT { char_u *arg_save; char_u *pattern = NULL; @@ -6909,7 +6936,7 @@ int au_exists(char_u *arg) AutoPat *ap; buf_T *buflocal_buf = NULL; int group; - int retval = FALSE; + bool retval = false; /* Make a copy so that we can change the '#' chars to a NUL. */ arg_save = vim_strsave(arg); @@ -6925,8 +6952,8 @@ int au_exists(char_u *arg) event_name = arg_save; } else { if (p == NULL) { - /* "Group": group name is present and it's recognized */ - retval = TRUE; + // "Group": group name is present and it's recognized + retval = true; goto theend; } @@ -6968,7 +6995,7 @@ int au_exists(char_u *arg) || (buflocal_buf == NULL ? fnamecmp(ap->pat, pattern) == 0 : ap->buflocal_nr == buflocal_buf->b_fnum))) { - retval = TRUE; + retval = true; break; } @@ -6983,12 +7010,13 @@ theend: /// /// Used for autocommands and 'wildignore'. /// -/// @param pattern the pattern to match with -/// @param prog the pre-compiled regprog or NULL -/// @param fname the full path of the file name -/// @param sfname the short file name or NULL -/// @param tail the tail of the path -/// @param allow_dirs allow matching with dir +/// @param pattern pattern to match with +/// @param prog pre-compiled regprog or NULL +/// @param fname full path of the file name +/// @param sfname short file name or NULL +/// @param tail tail of the path +/// @param allow_dirs Allow matching with dir +/// /// @return true if there is a match, false otherwise static bool match_file_pat(char_u *pattern, regprog_T **prog, char_u *fname, char_u *sfname, char_u *tail, int allow_dirs) @@ -7027,12 +7055,17 @@ static bool match_file_pat(char_u *pattern, regprog_T **prog, char_u *fname, return result; } -/* - * Return TRUE if a file matches with a pattern in "list". - * "list" is a comma-separated list of patterns, like 'wildignore'. - * "sfname" is the short file name or NULL, "ffname" the long file name. - */ -int match_file_list(char_u *list, char_u *sfname, char_u *ffname) +/// Check if a file matches with a pattern in "list". +/// "list" is a comma-separated list of patterns, like 'wildignore'. +/// "sfname" is the short file name or NULL, "ffname" the long file name. +/// +/// @param list list of patterns to match +/// @param sfname short file name +/// @param ffname full file name +/// +/// @return true if there was a match +bool match_file_list(char_u *list, char_u *sfname, char_u *ffname) + FUNC_ATTR_WARN_UNUSED_RESULT FUNC_ATTR_NONNULL_ARG(1, 3) { char_u buf[100]; char_u *tail; @@ -7043,20 +7076,21 @@ int match_file_list(char_u *list, char_u *sfname, char_u *ffname) tail = path_tail(sfname); - /* try all patterns in 'wildignore' */ + // try all patterns in 'wildignore' p = list; while (*p) { - copy_option_part(&p, buf, 100, ","); - regpat = file_pat_to_reg_pat(buf, NULL, &allow_dirs, FALSE); - if (regpat == NULL) + copy_option_part(&p, buf, ARRAY_SIZE(buf), ","); + regpat = file_pat_to_reg_pat(buf, NULL, &allow_dirs, false); + if (regpat == NULL) { break; - match = match_file_pat(regpat, NULL, ffname, sfname, - tail, (int)allow_dirs); + } + match = match_file_pat(regpat, NULL, ffname, sfname, tail, (int)allow_dirs); xfree(regpat); - if (match) - return TRUE; + if (match) { + return true; + } } - return FALSE; + return false; } /// Convert the given pattern "pat" which has shell style wildcards in it, into diff --git a/src/nvim/globals.h b/src/nvim/globals.h index 50eda6cb17..b45f13de4c 100644 --- a/src/nvim/globals.h +++ b/src/nvim/globals.h @@ -8,11 +8,10 @@ // actually defined and initialized. #ifndef EXTERN # define EXTERN extern -# define INIT(x) +# define INIT(...) #else # ifndef INIT -# define INIT(x) x -# define DO_INIT +# define INIT(...) __VA_ARGS__ # endif #endif @@ -117,12 +116,9 @@ #define DFLT_COLS 80 /* default value for 'columns' */ #define DFLT_ROWS 24 /* default value for 'lines' */ -EXTERN long Rows /* nr of rows in the screen */ -#ifdef DO_INIT - = DFLT_ROWS -#endif -; -EXTERN long Columns INIT(= DFLT_COLS); /* nr of columns in the screen */ +EXTERN long Rows INIT(= DFLT_ROWS); // nr of rows in the screen + +EXTERN long Columns INIT(= DFLT_COLS); // nr of columns in the screen /* * The characters and attributes cached for the screen. @@ -751,11 +747,8 @@ EXTERN int can_si INIT(= FALSE); */ EXTERN int can_si_back INIT(= FALSE); -EXTERN pos_T saved_cursor /* w_cursor before formatting text. */ -#ifdef DO_INIT - = INIT_POS_T(0, 0, 0) -#endif -; +// w_cursor before formatting text. +EXTERN pos_T saved_cursor INIT(= INIT_POS_T(0, 0, 0)); /* * Stuff for insert mode. @@ -917,19 +910,16 @@ EXTERN int RedrawingDisabled INIT(= 0); EXTERN int readonlymode INIT(= FALSE); /* Set to TRUE for "view" */ EXTERN int recoverymode INIT(= FALSE); /* Set to TRUE for "-r" option */ -EXTERN typebuf_T typebuf /* typeahead buffer */ -#ifdef DO_INIT - = {NULL, NULL, 0, 0, 0, 0, 0, 0, 0} -#endif -; -EXTERN int ex_normal_busy INIT(= 0); /* recursiveness of ex_normal() */ -EXTERN int ex_normal_lock INIT(= 0); /* forbid use of ex_normal() */ -EXTERN int ignore_script INIT(= FALSE); /* ignore script input */ -EXTERN int stop_insert_mode; /* for ":stopinsert" and 'insertmode' */ +// typeahead buffer +EXTERN typebuf_T typebuf INIT(= { NULL, NULL, 0, 0, 0, 0, 0, 0, 0 }); -EXTERN int KeyTyped; /* TRUE if user typed current char */ -EXTERN int KeyStuffed; /* TRUE if current char from stuffbuf */ -EXTERN int maptick INIT(= 0); /* tick for each non-mapped char */ +EXTERN int ex_normal_busy INIT(= 0); // recursiveness of ex_normal() +EXTERN int ex_normal_lock INIT(= 0); // forbid use of ex_normal() +EXTERN int ignore_script INIT(= false); // ignore script input +EXTERN int stop_insert_mode; // for ":stopinsert" and 'insertmode' +EXTERN int KeyTyped; // TRUE if user typed current char +EXTERN int KeyStuffed; // TRUE if current char from stuffbuf +EXTERN int maptick INIT(= 0); // tick for each non-mapped char EXTERN char_u chartab[256]; /* table used in charset.c; See init_chartab() for explanation */ @@ -959,30 +949,28 @@ EXTERN reg_extmatch_T *re_extmatch_in INIT(= NULL); /* Used by vim_regexec(): EXTERN reg_extmatch_T *re_extmatch_out INIT(= NULL); /* Set by vim_regexec() * to store \z\(...\) matches */ -EXTERN int did_outofmem_msg INIT(= FALSE); -/* set after out of memory msg */ -EXTERN int did_swapwrite_msg INIT(= FALSE); -/* set after swap write error msg */ -EXTERN int undo_off INIT(= FALSE); /* undo switched off for now */ -EXTERN int global_busy INIT(= 0); /* set when :global is executing */ -EXTERN int listcmd_busy INIT(= FALSE); /* set when :argdo, :windo or - :bufdo is executing */ -EXTERN int need_start_insertmode INIT(= FALSE); -/* start insert mode soon */ -EXTERN char_u *last_cmdline INIT(= NULL); /* last command line (for ":) */ -EXTERN char_u *repeat_cmdline INIT(= NULL); /* command line for "." */ -EXTERN char_u *new_last_cmdline INIT(= NULL); /* new value for last_cmdline */ -EXTERN char_u *autocmd_fname INIT(= NULL); /* fname for <afile> on cmdline */ -EXTERN int autocmd_fname_full; /* autocmd_fname is full path */ -EXTERN int autocmd_bufnr INIT(= 0); /* fnum for <abuf> on cmdline */ -EXTERN char_u *autocmd_match INIT(= NULL); /* name for <amatch> on cmdline */ -EXTERN int did_cursorhold INIT(= FALSE); /* set when CursorHold t'gerd */ -EXTERN pos_T last_cursormoved /* for CursorMoved event */ -# ifdef DO_INIT - = INIT_POS_T(0, 0, 0) -# endif -; -EXTERN int last_changedtick INIT(= 0); /* for TextChanged event */ +EXTERN int did_outofmem_msg INIT(= false); +// set after out of memory msg +EXTERN int did_swapwrite_msg INIT(= false); +// set after swap write error msg +EXTERN int undo_off INIT(= false); // undo switched off for now +EXTERN int global_busy INIT(= 0); // set when :global is executing +EXTERN int listcmd_busy INIT(= false); // set when :argdo, :windo or + // :bufdo is executing +EXTERN int need_start_insertmode INIT(= false); +// start insert mode soon +EXTERN char_u *last_cmdline INIT(= NULL); // last command line (for ":) +EXTERN char_u *repeat_cmdline INIT(= NULL); // command line for "." +EXTERN char_u *new_last_cmdline INIT(= NULL); // new value for last_cmdline +EXTERN char_u *autocmd_fname INIT(= NULL); // fname for <afile> on cmdline +EXTERN int autocmd_fname_full; // autocmd_fname is full path +EXTERN int autocmd_bufnr INIT(= 0); // fnum for <abuf> on cmdline +EXTERN char_u *autocmd_match INIT(= NULL); // name for <amatch> on cmdline +EXTERN int did_cursorhold INIT(= false); // set when CursorHold t'gerd +// for CursorMoved event +EXTERN pos_T last_cursormoved INIT(= INIT_POS_T(0, 0, 0)); + +EXTERN int last_changedtick INIT(= 0); // for TextChanged event EXTERN buf_T *last_changedtick_buf INIT(= NULL); EXTERN int postponed_split INIT(= 0); /* for CTRL-W CTRL-] command */ @@ -1092,13 +1080,9 @@ EXTERN int typebuf_was_filled INIT(= FALSE); /* received text from client #ifdef BACKSLASH_IN_FILENAME -EXTERN char psepc INIT(= '\\'); /* normal path separator character */ -EXTERN char psepcN INIT(= '/'); /* abnormal path separator character */ -EXTERN char pseps[2] /* normal path separator string */ -# ifdef DO_INIT - = {'\\', 0} -# endif -; +EXTERN char psepc INIT(= '\\'); // normal path separator character +EXTERN char psepcN INIT(= '/'); // abnormal path separator character +EXTERN char pseps[2] INIT(= { '\\', 0 }); // normal path separator string #endif /* Set to TRUE when an operator is being executed with virtual editing, MAYBE @@ -1117,12 +1101,8 @@ EXTERN int need_cursor_line_redraw INIT(= FALSE); #ifdef USE_MCH_ERRMSG -/* Grow array to collect error messages in until they can be displayed. */ -EXTERN garray_T error_ga -# ifdef DO_INIT - = GA_EMPTY_INIT_VALUE -# endif -; +// Grow array to collect error messages in until they can be displayed. +EXTERN garray_T error_ga INIT(= GA_EMPTY_INIT_VALUE); #endif diff --git a/src/nvim/if_cscope.c b/src/nvim/if_cscope.c index cd206e2e0d..d236501b3f 100644 --- a/src/nvim/if_cscope.c +++ b/src/nvim/if_cscope.c @@ -11,6 +11,7 @@ #include <assert.h> #include <errno.h> #include <inttypes.h> +#include <fcntl.h> #include "nvim/vim.h" #include "nvim/ascii.h" @@ -1841,9 +1842,7 @@ static void sig_handler(int s) { */ static void cs_release_csp(size_t i, int freefnpp) { - /* - * Trying to exit normally (not sure whether it is fit to UNIX cscope - */ + // Trying to exit normally (not sure whether it is fit to Unix cscope) if (csinfo[i].to_fp != NULL) { (void)fputs("q\n", csinfo[i].to_fp); (void)fflush(csinfo[i].to_fp); diff --git a/src/nvim/keymap.c b/src/nvim/keymap.c index b2fd929714..7054bb822a 100644 --- a/src/nvim/keymap.c +++ b/src/nvim/keymap.c @@ -531,17 +531,14 @@ trans_special ( return dlen; } -/* - * Try translating a <> name at (*srcp)[], return the key and modifiers. - * srcp is advanced to after the <> name. - * returns 0 if there is no match. - */ -int -find_special_key ( +// Try translating a <> name at (*srcp)[], return the key and modifiers. +// srcp is advanced to after the <> name. +// returns 0 if there is no match. +int find_special_key( char_u **srcp, int *modp, - int keycode, /* prefer key code, e.g. K_DEL instead of DEL */ - int keep_x_key /* don't translate xHome to Home key */ + int keycode, // prefer key code, e.g. K_DEL instead of DEL + int keep_x_key // don't translate xHome to Home key ) { char_u *last_dash; @@ -558,24 +555,26 @@ find_special_key ( if (src[0] != '<') return 0; - /* Find end of modifier list */ + // Find end of modifier list last_dash = src; for (bp = src + 1; *bp == '-' || vim_isIDc(*bp); bp++) { if (*bp == '-') { last_dash = bp; if (bp[1] != NUL) { - if (has_mbyte) + if (has_mbyte) { l = mb_ptr2len(bp + 1); - else + } else { l = 1; - if (bp[l + 1] == '>') - bp += l; /* anything accepted, like <C-?> */ + } + if (bp[l + 1] == '>') { + bp += l; // anything accepted, like <C-?> + } } } - if (bp[0] == 't' && bp[1] == '_' && bp[2] && bp[3]) - bp += 3; /* skip t_xx, xx may be '-' or '>' */ - else if (STRNICMP(bp, "char-", 5) == 0) { - vim_str2nr(bp + 5, NULL, &l, TRUE, TRUE, NULL, NULL); + if (bp[0] == 't' && bp[1] == '_' && bp[2] && bp[3]) { + bp += 3; // skip t_xx, xx may be '-' or '>' + } else if (STRNICMP(bp, "char-", 5) == 0) { + vim_str2nr(bp + 5, NULL, &l, true, true, true, NULL, NULL); bp += l + 5; break; } @@ -589,55 +588,53 @@ find_special_key ( for (bp = src + 1; bp < last_dash; bp++) { if (*bp != '-') { bit = name_to_mod_mask(*bp); - if (bit == 0x0) - break; /* Illegal modifier name */ + if (bit == 0x0) { + break; // Illegal modifier name + } modifiers |= bit; } } - /* - * Legal modifier name. - */ + // Legal modifier name. if (bp >= last_dash) { if (STRNICMP(last_dash + 1, "char-", 5) == 0 && ascii_isdigit(last_dash[6])) { - /* <Char-123> or <Char-033> or <Char-0x33> */ - vim_str2nr(last_dash + 6, NULL, NULL, TRUE, TRUE, NULL, &n); + // <Char-123> or <Char-033> or <Char-0x33> + vim_str2nr(last_dash + 6, NULL, NULL, true, true, true, NULL, &n); key = (int)n; } else { /* * Modifier with single letter, or special key name. */ - if (has_mbyte) + if (has_mbyte) { l = mb_ptr2len(last_dash + 1); - else + } else { l = 1; - if (modifiers != 0 && last_dash[l + 1] == '>') + } + if (modifiers != 0 && last_dash[l + 1] == '>') { key = PTR2CHAR(last_dash + 1); - else { + } else { key = get_special_key_code(last_dash + 1); - if (!keep_x_key) + if (!keep_x_key) { key = handle_x_keys(key); + } } } - /* - * get_special_key_code() may return NUL for invalid - * special key name. - */ + // get_special_key_code() may return NUL for invalid + // special key name. if (key != NUL) { - /* - * Only use a modifier when there is no special key code that - * includes the modifier. - */ + // Only use a modifier when there is no special key code that + // includes the modifier. key = simplify_key(key, &modifiers); if (!keycode) { - /* don't want keycode, use single byte code */ - if (key == K_BS) + // don't want keycode, use single byte code + if (key == K_BS) { key = BS; - else if (key == K_DEL || key == K_KDEL) + } else if (key == K_DEL || key == K_KDEL) { key = DEL; + } } // Normal Key with modifier: diff --git a/src/nvim/memfile.c b/src/nvim/memfile.c index 9f5e4247b5..8cf5642a80 100644 --- a/src/nvim/memfile.c +++ b/src/nvim/memfile.c @@ -40,6 +40,7 @@ #include <limits.h> #include <string.h> #include <stdbool.h> +#include <fcntl.h> #include "nvim/vim.h" #include "nvim/ascii.h" @@ -459,11 +460,9 @@ int mf_sync(memfile_T *mfp, int flags) if (hp == NULL || status == FAIL) mfp->mf_dirty = false; - if ((flags & MFS_FLUSH) && *p_sws != NUL) { - if (STRCMP(p_sws, "fsync") == 0) { - if (os_fsync(mfp->mf_fd)) { - status = FAIL; - } + if (flags & MFS_FLUSH) { + if (os_fsync(mfp->mf_fd)) { + status = FAIL; } } diff --git a/src/nvim/memline.c b/src/nvim/memline.c index c91a25df6e..f58b2ac38f 100644 --- a/src/nvim/memline.c +++ b/src/nvim/memline.c @@ -38,6 +38,7 @@ #include <inttypes.h> #include <string.h> #include <stdbool.h> +#include <fcntl.h> #include "nvim/ascii.h" #include "nvim/vim.h" diff --git a/src/nvim/message.c b/src/nvim/message.c index 66b8b9b5d2..00f4c0a85c 100644 --- a/src/nvim/message.c +++ b/src/nvim/message.c @@ -3037,7 +3037,7 @@ static double tv_float(typval_T *tvs, int *idxp) * http://www.ijs.si/software/snprintf/ * * This snprintf() only supports the following conversion specifiers: - * s, c, d, u, o, x, X, p (and synonyms: i, D, U, O - see below) + * s, c, b, B, d, u, o, x, X, p (and synonyms: i, D, U, O - see below) * with flags: '-', '+', ' ', '0' and '#'. * An asterisk is supported for field width as well as precision. * @@ -3103,8 +3103,9 @@ int vim_vsnprintf(char *str, size_t str_m, char *fmt, va_list ap, typval_T *tvs) char *p = fmt; int arg_idx = 1; - if (!p) + if (!p) { p = ""; + } while (*p) { if (*p != '%') { // copy up to the next '%' or NUL without any changes @@ -3176,9 +3177,9 @@ int vim_vsnprintf(char *str, size_t str_m, char *fmt, va_list ap, typval_T *tvs) if (*p == '*') { p++; int j = tvs ? tv_nr(tvs, &arg_idx) : va_arg(ap, int); - if (j >= 0) + if (j >= 0) { min_field_width = j; - else { + } else { min_field_width = -j; justify_left = 1; } @@ -3187,8 +3188,9 @@ int vim_vsnprintf(char *str, size_t str_m, char *fmt, va_list ap, typval_T *tvs) // argument like common implementations do unsigned int uj = *p++ - '0'; - while (ascii_isdigit((int)(*p))) + while (ascii_isdigit((int)(*p))) { uj = 10 * uj + (unsigned int)(*p++ - '0'); + } min_field_width = uj; } @@ -3199,9 +3201,9 @@ int vim_vsnprintf(char *str, size_t str_m, char *fmt, va_list ap, typval_T *tvs) if (*p == '*') { int j = tvs ? tv_nr(tvs, &arg_idx) : va_arg(ap, int); p++; - if (j >= 0) + if (j >= 0) { precision = j; - else { + } else { precision_specified = 0; precision = 0; } @@ -3210,8 +3212,9 @@ int vim_vsnprintf(char *str, size_t str_m, char *fmt, va_list ap, typval_T *tvs) // treat argument like common implementations do unsigned int uj = *p++ - '0'; - while (ascii_isdigit((int)(*p))) + while (ascii_isdigit((int)(*p))) { uj = 10 * uj + (unsigned int)(*p++ - '0'); + } precision = uj; } } @@ -3262,14 +3265,13 @@ int vim_vsnprintf(char *str, size_t str_m, char *fmt, va_list ap, typval_T *tvs) if (!str_arg) { str_arg = "[NULL]"; str_arg_l = 6; - } - // make sure not to address string beyond the specified precision - else if (!precision_specified) + } else if (!precision_specified) { + // make sure not to address string beyond the specified precision str_arg_l = strlen(str_arg); - // truncate string if necessary as requested by precision - else if (precision == 0) + } else if (precision == 0) { + // truncate string if necessary as requested by precision str_arg_l = 0; - else { + } else { // memchr on HP does not like n > 2^31 // TODO(elmart): check if this still holds / is relevant str_arg_l = (size_t)((char *)xmemscan(str_arg, @@ -3283,8 +3285,9 @@ int vim_vsnprintf(char *str, size_t str_m, char *fmt, va_list ap, typval_T *tvs) - mb_string2cells((char_u *) str_arg); if (precision) { char_u *p1 = (char_u *)str_arg; - for (size_t i = 0; i < precision && *p1; i++) + for (size_t i = 0; i < precision && *p1; i++) { p1 += mb_ptr2len(p1); + } str_arg_l = precision = p1 - (char_u *)str_arg; } } @@ -3295,9 +3298,14 @@ int vim_vsnprintf(char *str, size_t str_m, char *fmt, va_list ap, typval_T *tvs) } break; - case 'd': case 'u': case 'o': case 'x': case 'X': case 'p': { - // u, o, x, X and p conversion specifiers imply the value is unsigned; - // d implies a signed value + case 'd': + case 'u': + case 'b': case 'B': + case 'o': + case 'x': case 'X': + case 'p': { + // u, b, B, o, x, X and p conversion specifiers imply + // the value is unsigned; d implies a signed value // 0 if numeric argument is zero (or if pointer is NULL for 'p'), // +1 if greater than zero (or non NULL for 'p'), @@ -3325,8 +3333,9 @@ int vim_vsnprintf(char *str, size_t str_m, char *fmt, va_list ap, typval_T *tvs) if (fmt_spec == 'p') { length_modifier = '\0'; ptr_arg = tvs ? (void *)tv_str(tvs, &arg_idx) : va_arg(ap, void *); - if (ptr_arg) + if (ptr_arg) { arg_sign = 1; + } } else if (fmt_spec == 'd') { // signed switch (length_modifier) { @@ -3334,25 +3343,28 @@ int vim_vsnprintf(char *str, size_t str_m, char *fmt, va_list ap, typval_T *tvs) case 'h': // char and short arguments are passed as int int_arg = tvs ? tv_nr(tvs, &arg_idx) : va_arg(ap, int); - if (int_arg > 0) + if (int_arg > 0) { arg_sign = 1; - else if (int_arg < 0) + } else if (int_arg < 0) { arg_sign = -1; + } break; case 'l': long_arg = tvs ? tv_nr(tvs, &arg_idx) : va_arg(ap, long int); - if (long_arg > 0) + if (long_arg > 0) { arg_sign = 1; - else if (long_arg < 0) + } else if (long_arg < 0) { arg_sign = -1; + } break; case '2': long_long_arg = tvs ? tv_nr(tvs, &arg_idx) - : va_arg(ap, long long int); - if (long_long_arg > 0) + : va_arg(ap, long long int); // NOLINT (runtime/int) + if (long_long_arg > 0) { arg_sign = 1; - else if (long_long_arg < 0) + } else if (long_long_arg < 0) { arg_sign = -1; + } break; } } else { @@ -3362,24 +3374,23 @@ int vim_vsnprintf(char *str, size_t str_m, char *fmt, va_list ap, typval_T *tvs) case 'h': uint_arg = tvs ? (unsigned)tv_nr(tvs, &arg_idx) : va_arg(ap, unsigned int); - if (uint_arg != 0) - arg_sign = 1; + if (uint_arg != 0) { arg_sign = 1; } break; case 'l': ulong_arg = tvs ? (unsigned long)tv_nr(tvs, &arg_idx) : va_arg(ap, unsigned long int); - if (ulong_arg != 0) - arg_sign = 1; + if (ulong_arg != 0) { arg_sign = 1; } break; case '2': - ulong_long_arg = tvs ? (unsigned long long)tv_nr(tvs, &arg_idx) - : va_arg(ap, unsigned long long int); - if (ulong_long_arg) arg_sign = 1; + ulong_long_arg = tvs + ? (unsigned long long)tv_nr(tvs, &arg_idx) // NOLINT (runtime/int) + : va_arg(ap, unsigned long long int); // NOLINT (runtime/int) + if (ulong_long_arg) { arg_sign = 1; } break; case 'z': size_t_arg = tvs ? (size_t)tv_nr(tvs, &arg_idx) : va_arg(ap, size_t); - if (size_t_arg) arg_sign = 1; + if (size_t_arg) { arg_sign = 1; } break; } } @@ -3390,16 +3401,19 @@ int vim_vsnprintf(char *str, size_t str_m, char *fmt, va_list ap, typval_T *tvs) // For d, i, u, o, x, and X conversions, if precision is specified, // '0' flag should be ignored. This is so with Solaris 2.6, Digital UNIX // 4.0, HPUX 10, Linux, FreeBSD, NetBSD; but not with Perl. - if (precision_specified) + if (precision_specified) { zero_padding = 0; + } if (fmt_spec == 'd') { - if (force_sign && arg_sign >= 0) + if (force_sign && arg_sign >= 0) { tmp[str_arg_l++] = space_for_positive ? ' ' : '+'; + } // leave negative numbers for sprintf to handle, to // avoid handling tricky cases like (short int)-32768 } else if (alternate_form) { - if (arg_sign != 0 && (fmt_spec == 'x' || fmt_spec == 'X') ) { + if (arg_sign != 0 && (fmt_spec == 'x' || fmt_spec == 'X' || + fmt_spec == 'b' || fmt_spec == 'B')) { tmp[str_arg_l++] = '0'; tmp[str_arg_l++] = fmt_spec; } @@ -3407,20 +3421,20 @@ int vim_vsnprintf(char *str, size_t str_m, char *fmt, va_list ap, typval_T *tvs) } zero_padding_insertion_ind = str_arg_l; - if (!precision_specified) + if (!precision_specified) { precision = 1; // default precision is 1 + } if (precision == 0 && arg_sign == 0) { // when zero value is formatted with an explicit precision 0, - // resulting formatted string is empty (d, i, u, o, x, X, p) + // resulting formatted string is empty (d, i, u, b, B, o, x, X, p) } else { char f[5]; int f_l = 0; // construct a simple format string for sprintf f[f_l++] = '%'; - if (!length_modifier) - ; - else if (length_modifier == '2') { + if (!length_modifier) { + } else if (length_modifier == '2') { f[f_l++] = 'l'; f[f_l++] = 'l'; } else @@ -3441,6 +3455,41 @@ int vim_vsnprintf(char *str, size_t str_m, char *fmt, va_list ap, typval_T *tvs) case '2': str_arg_l += sprintf(tmp + str_arg_l, f, long_long_arg); break; } + } else if (fmt_spec == 'b' || fmt_spec == 'B') { + // binary + size_t bits = 0; + switch (length_modifier) { + case '\0': + case 'h': for (bits = sizeof(unsigned) * 8; bits > 0; bits--) { + if ((uint_arg >> (bits - 1)) & 0x1) { break; } } + + while (bits > 0) { + tmp[str_arg_l++] = + ((uint_arg >> --bits) & 0x1) ? '1' : '0'; } + break; + case 'l': for (bits = sizeof(unsigned long) * 8; bits > 0; bits--) { + if ((ulong_arg >> (bits - 1)) & 0x1) { break; } } + + while (bits > 0) { + tmp[str_arg_l++] = + ((ulong_arg >> --bits) & 0x1) ? '1' : '0'; } + break; + case '2': for (bits = sizeof(unsigned long long) * 8; // NOLINT (runtime/int) + bits > 0; bits--) { + if ((ulong_long_arg >> (bits - 1)) & 0x1) { break; } } + + while (bits > 0) { + tmp[str_arg_l++] = + ((ulong_long_arg >> --bits) & 0x1) ? '1' : '0'; } + break; + case 'z': for (bits = sizeof(size_t) * 8; bits > 0; bits--) { + if ((size_t_arg >> (bits - 1)) & 0x1) { break; } } + + while (bits > 0) { + tmp[str_arg_l++] = + ((size_t_arg >> --bits) & 0x1) ? '1' : '0'; } + break; + } } else { // unsigned switch (length_modifier) { @@ -3464,7 +3513,9 @@ int vim_vsnprintf(char *str, size_t str_m, char *fmt, va_list ap, typval_T *tvs) if (zero_padding_insertion_ind + 1 < str_arg_l && tmp[zero_padding_insertion_ind] == '0' && (tmp[zero_padding_insertion_ind + 1] == 'x' - || tmp[zero_padding_insertion_ind + 1] == 'X')) + || tmp[zero_padding_insertion_ind + 1] == 'X' + || tmp[zero_padding_insertion_ind + 1] == 'b' + || tmp[zero_padding_insertion_ind + 1] == 'B')) zero_padding_insertion_ind += 2; } @@ -3507,7 +3558,7 @@ int vim_vsnprintf(char *str, size_t str_m, char *fmt, va_list ap, typval_T *tvs) // floating point char format[40]; int l; - int remove_trailing_zeroes = FALSE; + int remove_trailing_zeroes = false; double f = tvs ? tv_float(tvs, &arg_idx) : va_arg(ap, double); double abs_f = f < 0 ? -f : f; @@ -3518,7 +3569,7 @@ int vim_vsnprintf(char *str, size_t str_m, char *fmt, va_list ap, typval_T *tvs) fmt_spec = 'f'; else fmt_spec = fmt_spec == 'g' ? 'e' : 'E'; - remove_trailing_zeroes = TRUE; + remove_trailing_zeroes = true; } if (fmt_spec == 'f' && abs_f > 1.0e307) { diff --git a/src/nvim/misc1.c b/src/nvim/misc1.c index b2cec82121..6c969a43fc 100644 --- a/src/nvim/misc1.c +++ b/src/nvim/misc1.c @@ -2729,13 +2729,6 @@ void fast_breakcheck(void) } } -#ifndef SEEK_SET -# define SEEK_SET 0 -#endif -#ifndef SEEK_END -# define SEEK_END 2 -#endif - /* * Get the stdout of an external command. * If "ret_len" is NULL replace NUL characters with NL. When "ret_len" is not diff --git a/src/nvim/ops.c b/src/nvim/ops.c index c3d968ca51..19dbd0f9f6 100644 --- a/src/nvim/ops.c +++ b/src/nvim/ops.c @@ -1991,6 +1991,7 @@ void op_insert(oparg_T *oap, long count1) char_u *firstline, *ins_text; struct block_def bd; int i; + pos_T t1; /* edit() changes this - record it for OP_APPEND */ bd.is_MAX = (curwin->w_curswant == MAXCOL); @@ -2053,7 +2054,16 @@ void op_insert(oparg_T *oap, long count1) } } - edit(NUL, FALSE, (linenr_T)count1); + t1 = oap->start; + edit(NUL, false, (linenr_T)count1); + + // When a tab was inserted, and the characters in front of the tab + // have been converted to a tab as well, the column of the cursor + // might have actually been reduced, so need to adjust here. */ + if (t1.lnum == curbuf->b_op_start_orig.lnum && + lt(curbuf->b_op_start_orig, t1)) { + oap->start = curbuf->b_op_start_orig; + } /* If user has moved off this line, we don't know what to do, so do * nothing. @@ -2069,21 +2079,23 @@ void op_insert(oparg_T *oap, long count1) if (oap->start.lnum == curbuf->b_op_start_orig.lnum && !bd.is_MAX) { if (oap->op_type == OP_INSERT && oap->start.col + oap->start.coladd - != curbuf->b_op_start_orig.col + curbuf->b_op_start_orig.coladd) { + != curbuf->b_op_start_orig.col + curbuf->b_op_start_orig.coladd) { + size_t t = getviscol2(curbuf->b_op_start_orig.col, + curbuf->b_op_start_orig.coladd); oap->start.col = curbuf->b_op_start_orig.col; - pre_textlen -= getviscol2(oap->start.col, oap->start.coladd) - - oap->start_vcol; - oap->start_vcol = getviscol2(oap->start.col, oap->start.coladd); + pre_textlen -= t - oap->start_vcol; + oap->start_vcol = t; } else if (oap->op_type == OP_APPEND && oap->end.col + oap->end.coladd - >= curbuf->b_op_start_orig.col - + curbuf->b_op_start_orig.coladd) { + >= curbuf->b_op_start_orig.col + + curbuf->b_op_start_orig.coladd) { + size_t t = getviscol2(curbuf->b_op_start_orig.col, + curbuf->b_op_start_orig.coladd); oap->start.col = curbuf->b_op_start_orig.col; /* reset pre_textlen to the value of OP_INSERT */ pre_textlen += bd.textlen; - pre_textlen -= getviscol2(oap->start.col, oap->start.coladd) - - oap->start_vcol; - oap->start_vcol = getviscol2(oap->start.col, oap->start.coladd); + pre_textlen -= t - oap->start_vcol; + oap->start_vcol = t; oap->op_type = OP_INSERT; } } @@ -4186,75 +4198,102 @@ static void reverse_line(char_u *s) # define RLADDSUBFIX(ptr) if (curwin->w_p_rl) reverse_line(ptr); -/* - * add or subtract 'Prenum1' from a number in a line - * 'command' is CTRL-A for add, CTRL-X for subtract - * - * return FAIL for failure, OK otherwise - */ +/// Add or subtract from a number in a line. +/// +/// @param command CTRL-A for add, CTRL-X for subtract +// @param Prenum1 number to add or subtract +/// +/// @return FAIL for failure, OK otherwise int do_addsub(int command, linenr_T Prenum1) { int col; char_u *buf1; char_u buf2[NUMBUFLEN]; - int hex; /* 'X' or 'x': hex; '0': octal */ - static int hexupper = FALSE; /* 0xABC */ + int pre; // 'X' or 'x': hex; '0': octal; 'B' or 'b': bin + static int hexupper = false; // 0xABC unsigned long n, oldn; char_u *ptr; int c; - int length = 0; /* character length of the number */ + int length = 0; // character length of the number int todel; int dohex; int dooct; + int dobin; int doalp; int firstdigit; int negative; int subtract; - dohex = (vim_strchr(curbuf->b_p_nf, 'x') != NULL); /* "heX" */ - dooct = (vim_strchr(curbuf->b_p_nf, 'o') != NULL); /* "Octal" */ - doalp = (vim_strchr(curbuf->b_p_nf, 'p') != NULL); /* "alPha" */ + dohex = (vim_strchr(curbuf->b_p_nf, 'x') != NULL); // "heX" + dooct = (vim_strchr(curbuf->b_p_nf, 'o') != NULL); // "Octal" + dobin = (vim_strchr(curbuf->b_p_nf, 'b') != NULL); // "Bin" + doalp = (vim_strchr(curbuf->b_p_nf, 'p') != NULL); // "alPha" ptr = get_cursor_line_ptr(); RLADDSUBFIX(ptr); - /* - * First check if we are on a hexadecimal number, after the "0x". - */ + // First check if we are on a hexadecimal number, after the "0x". col = curwin->w_cursor.col; - if (dohex) - while (col > 0 && ascii_isxdigit(ptr[col])) - --col; - if ( dohex - && col > 0 - && (ptr[col] == 'X' - || ptr[col] == 'x') - && ptr[col - 1] == '0' - && ascii_isxdigit(ptr[col + 1])) { - /* - * Found hexadecimal number, move to its start. - */ - --col; + + if (dobin) { + while (col > 0 && ascii_isbdigit(ptr[col])) { + col--; + } + } + + if (dohex) { + while (col > 0 && ascii_isxdigit(ptr[col])) { + col--; + } + } + if (dobin + && dohex + && !((col > 0 + && (ptr[col] == 'X' || + ptr[col] == 'x') + && ptr[col - 1] == '0' + && ascii_isxdigit(ptr[col + 1])))) { + // In case of binary/hexadecimal pattern overlap match, rescan + + col = curwin->w_cursor.col; + + while (col > 0 && ascii_isdigit(ptr[col])) { + col--; + } + } + + if ((dohex + && col > 0 + && (ptr[col] == 'X' + || ptr[col] == 'x') + && ptr[col - 1] == '0' + && ascii_isxdigit(ptr[col + 1])) || + (dobin + && col > 0 + && (ptr[col] == 'B' + || ptr[col] == 'b') + && ptr[col - 1] == '0' + && ascii_isbdigit(ptr[col + 1]))) { + // Found hexadecimal or binary number, move to its start. + col--; } else { - /* - * Search forward and then backward to find the start of number. - */ + // Search forward and then backward to find the start of number. col = curwin->w_cursor.col; while (ptr[col] != NUL && !ascii_isdigit(ptr[col]) - && !(doalp && ASCII_ISALPHA(ptr[col]))) - ++col; + && !(doalp && ASCII_ISALPHA(ptr[col]))) { + col++; + } while (col > 0 && ascii_isdigit(ptr[col - 1]) - && !(doalp && ASCII_ISALPHA(ptr[col]))) - --col; + && !(doalp && ASCII_ISALPHA(ptr[col]))) { + col--; + } } - /* - * If a number was found, and saving for undo works, replace the number. - */ + // If a number was found, and saving for undo works, replace the number. firstdigit = ptr[col]; RLADDSUBFIX(ptr); if ((!ascii_isdigit(firstdigit) && !(doalp && ASCII_ISALPHA(firstdigit))) @@ -4263,152 +4302,170 @@ int do_addsub(int command, linenr_T Prenum1) return FAIL; } - /* get ptr again, because u_save() may have changed it */ + // get ptr again, because u_save() may have changed it ptr = get_cursor_line_ptr(); RLADDSUBFIX(ptr); if (doalp && ASCII_ISALPHA(firstdigit)) { - /* decrement or increment alphabetic character */ + // decrement or increment alphabetic character if (command == Ctrl_X) { if (CharOrd(firstdigit) < Prenum1) { - if (isupper(firstdigit)) + if (isupper(firstdigit)) { firstdigit = 'A'; - else + } else { firstdigit = 'a'; - } else + } + } else { firstdigit -= Prenum1; + } } else { if (26 - CharOrd(firstdigit) - 1 < Prenum1) { - if (isupper(firstdigit)) + if (isupper(firstdigit)) { firstdigit = 'Z'; - else + } else { firstdigit = 'z'; - } else + } + } else { firstdigit += Prenum1; + } } curwin->w_cursor.col = col; - (void)del_char(FALSE); + (void)del_char(false); ins_char(firstdigit); } else { - negative = FALSE; - if (col > 0 && ptr[col - 1] == '-') { /* negative number */ + negative = false; + if (col > 0 && ptr[col - 1] == '-') { // negative number --col; - negative = TRUE; + negative = true; } - /* get the number value (unsigned) */ - vim_str2nr(ptr + col, &hex, &length, dooct, dohex, NULL, &n); + // get the number value (unsigned) + vim_str2nr(ptr + col, &pre, &length, dobin, dooct, dohex, NULL, &n); - /* ignore leading '-' for hex and octal numbers */ - if (hex && negative) { + // ignore leading '-' for hex, octal and bin numbers + if (pre && negative) { ++col; --length; - negative = FALSE; + negative = false; } - /* add or subtract */ - subtract = FALSE; - if (command == Ctrl_X) - subtract ^= TRUE; - if (negative) - subtract ^= TRUE; + // add or subtract + subtract = false; + if (command == Ctrl_X) { + subtract ^= true; + } + if (negative) { + subtract ^= true; + } oldn = n; - if (subtract) - n -= (unsigned long)Prenum1; - else - n += (unsigned long)Prenum1; - /* handle wraparound for decimal numbers */ - if (!hex) { + n = subtract ? n - (unsigned long) Prenum1 + : n + (unsigned long) Prenum1; + + // handle wraparound for decimal numbers + if (!pre) { if (subtract) { if (n > oldn) { n = 1 + (n ^ (unsigned long)-1); - negative ^= TRUE; + negative ^= true; } } else { /* add */ if (n < oldn) { n = (n ^ (unsigned long)-1); - negative ^= TRUE; + negative ^= true; } } - if (n == 0) - negative = FALSE; + if (n == 0) { + negative = false; + } } - /* - * Delete the old number. - */ + // Delete the old number. curwin->w_cursor.col = col; todel = length; c = gchar_cursor(); - /* - * Don't include the '-' in the length, only the length of the part - * after it is kept the same. - */ - if (c == '-') + + // Don't include the '-' in the length, only the length of the part + // after it is kept the same. + if (c == '-') { --length; + } while (todel-- > 0) { if (c < 0x100 && isalpha(c)) { - if (isupper(c)) - hexupper = TRUE; - else - hexupper = FALSE; + if (isupper(c)) { + hexupper = true; + } else { + hexupper = false; + } } - /* del_char() will mark line needing displaying */ - (void)del_char(FALSE); + // del_char() will mark line needing displaying + (void)del_char(false); c = gchar_cursor(); } - /* - * Prepare the leading characters in buf1[]. - * When there are many leading zeros it could be very long. Allocate - * a bit too much. - */ + // Prepare the leading characters in buf1[]. + // When there are many leading zeros it could be very long. Allocate + // a bit too much. buf1 = xmalloc(length + NUMBUFLEN); ptr = buf1; if (negative) { *ptr++ = '-'; } - if (hex) { + if (pre) { *ptr++ = '0'; --length; } - if (hex == 'x' || hex == 'X') { - *ptr++ = hex; + if (pre == 'b' || pre == 'B' || + pre == 'x' || pre == 'X') { + *ptr++ = pre; --length; } - /* - * Put the number characters in buf2[]. - */ - if (hex == 0) - sprintf((char *)buf2, "%" PRIu64, (uint64_t)n); - else if (hex == '0') - sprintf((char *)buf2, "%" PRIo64, (uint64_t)n); - else if (hex && hexupper) - sprintf((char *)buf2, "%" PRIX64, (uint64_t)n); - else - sprintf((char *)buf2, "%" PRIx64, (uint64_t)n); + // Put the number characters in buf2[]. + if (pre == 'b' || pre == 'B') { + size_t bits = 0; + size_t pos = 0; + + // leading zeros + for (bits = 8 * sizeof(unsigned long); bits > 0; bits--) { + if ((n >> (bits - 1)) & 0x1) { break; } + } + + while (bits > 0) { + buf2[pos++] = ((n >> --bits) & 0x1) ? '1' : '0'; + } + + buf2[pos] = '\0'; + + } else if (pre == 0) { + snprintf((char *)buf2, NUMBUFLEN, "%" PRIu64, (uint64_t)n); + } else if (pre == '0') { + snprintf((char *)buf2, NUMBUFLEN, "%" PRIo64, (uint64_t)n); + } else if (pre && hexupper) { + snprintf((char *)buf2, NUMBUFLEN, "%" PRIX64, (uint64_t)n); + } else { + snprintf((char *)buf2, NUMBUFLEN, "%" PRIx64, (uint64_t)n); + } length -= (int)STRLEN(buf2); - /* - * Adjust number of zeros to the new number of digits, so the - * total length of the number remains the same. - * Don't do this when - * the result may look like an octal number. - */ - if (firstdigit == '0' && !(dooct && hex == 0)) - while (length-- > 0) + // Adjust number of zeros to the new number of digits, so the + // total length of the number remains the same. + // Don't do this when + // the result may look like an octal number. + if (firstdigit == '0' && !(dooct && pre == 0)) { + while (length-- > 0) { *ptr++ = '0'; + } + } *ptr = NUL; STRCAT(buf1, buf2); ins_str(buf1); /* insert the new number */ xfree(buf1); } --curwin->w_cursor.col; - curwin->w_set_curswant = TRUE; - ptr = ml_get_buf(curbuf, curwin->w_cursor.lnum, TRUE); + curwin->w_set_curswant = true; + ptr = ml_get_buf(curbuf, curwin->w_cursor.lnum, true); RLADDSUBFIX(ptr); return OK; } diff --git a/src/nvim/option.c b/src/nvim/option.c index 2ac1abeeba..b4054dc28c 100644 --- a/src/nvim/option.c +++ b/src/nvim/option.c @@ -258,30 +258,31 @@ typedef struct vimoption { #define PARAM_COUNT ARRAY_SIZE(options) -static char *(p_ambw_values[]) = {"single", "double", NULL}; -static char *(p_bg_values[]) = {"light", "dark", NULL}; -static char *(p_nf_values[]) = {"octal", "hex", "alpha", NULL}; -static char *(p_ff_values[]) = {FF_UNIX, FF_DOS, FF_MAC, NULL}; -static char *(p_wop_values[]) = {"tagfile", NULL}; -static char *(p_wak_values[]) = {"yes", "menu", "no", NULL}; -static char *(p_mousem_values[]) = -{"extend", "popup", "popup_setpos", "mac", NULL}; -static char *(p_sel_values[]) = {"inclusive", "exclusive", "old", NULL}; -static char *(p_slm_values[]) = {"mouse", "key", "cmd", NULL}; -static char *(p_km_values[]) = {"startsel", "stopsel", NULL}; -static char *(p_scbopt_values[]) = {"ver", "hor", "jump", NULL}; -static char *(p_debug_values[]) = {"msg", "throw", "beep", NULL}; -static char *(p_ead_values[]) = {"both", "ver", "hor", NULL}; -static char *(p_buftype_values[]) = -{"nofile", "nowrite", "quickfix", "help", "acwrite", "terminal", NULL}; -static char *(p_bufhidden_values[]) = {"hide", "unload", "delete", "wipe", NULL}; -static char *(p_bs_values[]) = {"indent", "eol", "start", NULL}; -static char *(p_fdm_values[]) = {"manual", "expr", "marker", "indent", "syntax", - "diff", - NULL}; -static char *(p_fcl_values[]) = {"all", NULL}; -static char *(p_cot_values[]) = {"menu", "menuone", "longest", "preview", - "noinsert", "noselect", NULL}; +static char *(p_ambw_values[]) = { "single", "double", NULL }; +static char *(p_bg_values[]) = { "light", "dark", NULL }; +static char *(p_nf_values[]) = { "bin", "octal", "hex", "alpha", NULL }; +static char *(p_ff_values[]) = { FF_UNIX, FF_DOS, FF_MAC, NULL }; +static char *(p_wop_values[]) = { "tagfile", NULL }; +static char *(p_wak_values[]) = { "yes", "menu", "no", NULL }; +static char *(p_mousem_values[]) = { "extend", "popup", "popup_setpos", + "mac", NULL }; +static char *(p_sel_values[]) = { "inclusive", "exclusive", "old", NULL }; +static char *(p_slm_values[]) = { "mouse", "key", "cmd", NULL }; +static char *(p_km_values[]) = { "startsel", "stopsel", NULL }; +static char *(p_scbopt_values[]) = { "ver", "hor", "jump", NULL }; +static char *(p_debug_values[]) = { "msg", "throw", "beep", NULL }; +static char *(p_ead_values[]) = { "both", "ver", "hor", NULL }; +static char *(p_buftype_values[]) = { "nofile", "nowrite", "quickfix", + "help", "acwrite", "terminal", NULL }; + +static char *(p_bufhidden_values[]) = { "hide", "unload", "delete", + "wipe", NULL }; +static char *(p_bs_values[]) = { "indent", "eol", "start", NULL }; +static char *(p_fdm_values[]) = { "manual", "expr", "marker", "indent", + "syntax", "diff", NULL }; +static char *(p_fcl_values[]) = { "all", NULL }; +static char *(p_cot_values[]) = { "menu", "menuone", "longest", "preview", + "noinsert", "noselect", NULL }; #ifdef INCLUDE_GENERATED_DECLARATIONS # include "option.c.generated.h" @@ -1431,7 +1432,7 @@ do_set ( } else if (*arg == '-' || ascii_isdigit(*arg)) { // Allow negative (for 'undolevels'), octal and // hex numbers. - vim_str2nr(arg, NULL, &i, true, true, &value, NULL); + vim_str2nr(arg, NULL, &i, true, true, true, &value, NULL); if (arg[i] != NUL && !ascii_iswhite(arg[i])) { errmsg = e_invarg; goto skip; diff --git a/src/nvim/option_defs.h b/src/nvim/option_defs.h index 938aa9bc83..7a837de45c 100644 --- a/src/nvim/option_defs.h +++ b/src/nvim/option_defs.h @@ -535,27 +535,26 @@ EXTERN int p_stmp; /* 'shelltemp' */ #ifdef BACKSLASH_IN_FILENAME EXTERN int p_ssl; /* 'shellslash' */ #endif -EXTERN char_u *p_stl; /* 'statusline' */ -EXTERN int p_sr; /* 'shiftround' */ -EXTERN char_u *p_shm; /* 'shortmess' */ -EXTERN char_u *p_sbr; /* 'showbreak' */ -EXTERN int p_sc; /* 'showcmd' */ -EXTERN int p_sft; /* 'showfulltag' */ -EXTERN int p_sm; /* 'showmatch' */ -EXTERN int p_smd; /* 'showmode' */ -EXTERN long p_ss; /* 'sidescroll' */ -EXTERN long p_siso; /* 'sidescrolloff' */ -EXTERN int p_scs; /* 'smartcase' */ -EXTERN int p_sta; /* 'smarttab' */ -EXTERN int p_sb; /* 'splitbelow' */ -EXTERN long p_tpm; /* 'tabpagemax' */ -EXTERN char_u *p_tal; /* 'tabline' */ -EXTERN char_u *p_sps; /* 'spellsuggest' */ -EXTERN int p_spr; /* 'splitright' */ -EXTERN int p_sol; /* 'startofline' */ -EXTERN char_u *p_su; /* 'suffixes' */ -EXTERN char_u *p_sws; /* 'swapsync' */ -EXTERN char_u *p_swb; /* 'switchbuf' */ +EXTERN char_u *p_stl; // 'statusline' +EXTERN int p_sr; // 'shiftround' +EXTERN char_u *p_shm; // 'shortmess' +EXTERN char_u *p_sbr; // 'showbreak' +EXTERN int p_sc; // 'showcmd' +EXTERN int p_sft; // 'showfulltag' +EXTERN int p_sm; // 'showmatch' +EXTERN int p_smd; // 'showmode' +EXTERN long p_ss; // 'sidescroll' +EXTERN long p_siso; // 'sidescrolloff' +EXTERN int p_scs; // 'smartcase' +EXTERN int p_sta; // 'smarttab' +EXTERN int p_sb; // 'splitbelow' +EXTERN long p_tpm; // 'tabpagemax' +EXTERN char_u *p_tal; // 'tabline' +EXTERN char_u *p_sps; // 'spellsuggest' +EXTERN int p_spr; // 'splitright' +EXTERN int p_sol; // 'startofline' +EXTERN char_u *p_su; // 'suffixes' +EXTERN char_u *p_swb; // 'switchbuf' EXTERN unsigned swb_flags; #ifdef IN_OPTION_C static char *(p_swb_values[]) = {"useopen", "usetab", "split", "newtab", NULL}; diff --git a/src/nvim/options.lua b/src/nvim/options.lua index cdac6ffd5c..3dd37cb5dc 100644 --- a/src/nvim/options.lua +++ b/src/nvim/options.lua @@ -1144,20 +1144,6 @@ return { defaults={if_true={vi=false}} }, { - full_name='imactivatefunc', abbreviation='imaf', - type='string', scope={'global'}, - secure=true, - vi_def=true, - enable_if=false, - }, - { - full_name='imactivatekey', abbreviation='imak', - type='string', scope={'global'}, - vi_def=true, - enable_if=false, - defaults={if_true={vi=""}} - }, - { full_name='imcmdline', abbreviation='imc', type='bool', scope={'global'}, vi_def=true, @@ -1194,13 +1180,6 @@ return { } }, { - full_name='imstatusfunc', abbreviation='imsf', - type='string', scope={'global'}, - secure=true, - vi_def=true, - enable_if=false, - }, - { full_name='include', abbreviation='inc', type='string', scope={'global', 'buffer'}, vi_def=true, @@ -1620,7 +1599,7 @@ return { deny_duplicates=true, alloced=true, varname='p_nf', - defaults={if_true={vi="octal,hex", vim="hex"}} + defaults={if_true={vi="bin,octal,hex", vim="bin,hex"}} }, { full_name='number', abbreviation='nu', @@ -2297,13 +2276,6 @@ return { defaults={if_true={vi=true}} }, { - full_name='swapsync', abbreviation='sws', - type='string', scope={'global'}, - vi_def=true, - varname='p_sws', - defaults={if_true={vi="fsync"}} - }, - { full_name='switchbuf', abbreviation='swb', type='string', list='comma', scope={'global'}, deny_duplicates=true, diff --git a/src/nvim/os/dl.c b/src/nvim/os/dl.c index b4a35e203e..fef02cc784 100644 --- a/src/nvim/os/dl.c +++ b/src/nvim/os/dl.c @@ -63,7 +63,7 @@ bool os_libcall(const char *libname, // call the library and save the result // TODO(aktau): catch signals and use jmp (if available) to handle - // exceptions. jmp's on UNIX seem to interact trickily with signals as + // exceptions. jmp's on Unix seem to interact trickily with signals as // well. So for now we only support those libraries that are well-behaved. if (str_out) { str_str_fn sfn = (str_str_fn) fn; diff --git a/src/nvim/os/env.c b/src/nvim/os/env.c index a791dca39c..c1804067e9 100644 --- a/src/nvim/os/env.c +++ b/src/nvim/os/env.c @@ -142,7 +142,7 @@ void os_get_hostname(char *hostname, size_t len) /// - go to that directory /// - do os_dirname() to get the real name of that directory. /// This also works with mounts and links. -/// Don't do this for MS-DOS, it will change the "current dir" for a drive. +/// Don't do this for Windows, it will change the "current dir" for a drive. static char_u *homedir = NULL; void init_homedir(void) @@ -290,7 +290,7 @@ void expand_env_esc(char_u *srcp, char_u *dst, int dstlen, bool esc, bool one, } #if defined(UNIX) - // Verify that we have found the end of a UNIX ${VAR} style variable + // Verify that we have found the end of a Unix ${VAR} style variable if (src[1] == '{' && *tail != '}') { var = NULL; } else { diff --git a/src/nvim/os/os_defs.h b/src/nvim/os/os_defs.h index 8afbd29292..eee0cdd10b 100644 --- a/src/nvim/os/os_defs.h +++ b/src/nvim/os/os_defs.h @@ -34,28 +34,6 @@ # define DFLT_MAXMEMTOT (10*1024) #endif -#if !defined(S_ISDIR) && defined(S_IFDIR) -# define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR) -#endif -#if !defined(S_ISREG) && defined(S_IFREG) -# define S_ISREG(m) (((m) & S_IFMT) == S_IFREG) -#endif -#if !defined(S_ISLNK) && defined(S_IFLNK) -# define S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK) -#endif -#if !defined(S_ISBLK) && defined(S_IFBLK) -# define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK) -#endif -#if !defined(S_ISSOCK) && defined(S_IFSOCK) -# define S_ISSOCK(m) (((m) & S_IFMT) == S_IFSOCK) -#endif -#if !defined(S_ISFIFO) && defined(S_IFIFO) -# define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO) -#endif -#if !defined(S_ISCHR) && defined(S_IFCHR) -# define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR) -#endif - // Note: Some systems need both string.h and strings.h (Savage). However, // some systems can't handle both, only use string.h in that case. #include <string.h> diff --git a/src/nvim/os/time.c b/src/nvim/os/time.c index ba1dcf631a..188f0802c9 100644 --- a/src/nvim/os/time.c +++ b/src/nvim/os/time.c @@ -93,7 +93,7 @@ struct tm *os_localtime_r(const time_t *restrict clock, #endif } -/// Obtains the current UNIX timestamp and adjusts it to local time +/// Obtains the current Unix timestamp and adjusts it to local time. /// /// @param result Pointer to a 'struct tm' where the result should be placed /// @return A pointer to a 'struct tm' in the current time zone (the 'result' @@ -104,7 +104,7 @@ struct tm *os_get_localtime(struct tm *result) FUNC_ATTR_NONNULL_ALL return os_localtime_r(&rawtime, result); } -/// Obtains the current UNIX timestamp +/// Obtains the current Unix timestamp. /// /// @return Seconds since epoch. Timestamp os_time(void) diff --git a/src/nvim/os/win_defs.h b/src/nvim/os/win_defs.h index e6a714601f..ba96347a12 100644 --- a/src/nvim/os/win_defs.h +++ b/src/nvim/os/win_defs.h @@ -5,6 +5,10 @@ #include <sys/stat.h> #include <stdio.h> +// Windows does not have S_IFLNK but libuv defines it +// and sets the flag for us when calling uv_fs_stat. +#include <uv.h> + #define NAME_MAX _MAX_PATH #define TEMP_DIR_NAMES {"$TMP", "$TEMP", "$USERPROFILE", ""} @@ -17,6 +21,9 @@ #define USE_CRNL +// We have our own RGB macro in macros.h. +#undef RGB + #ifdef _MSC_VER # ifndef inline # define inline __inline @@ -47,4 +54,30 @@ typedef SSIZE_T ssize_t; # endif #endif +#ifndef O_NOFOLLOW +# define O_NOFOLLOW 0 +#endif + +#if !defined(S_ISDIR) && defined(S_IFDIR) +# define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR) +#endif +#if !defined(S_ISREG) && defined(S_IFREG) +# define S_ISREG(m) (((m) & S_IFMT) == S_IFREG) +#endif +#if !defined(S_ISLNK) && defined(S_IFLNK) +# define S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK) +#endif +#if !defined(S_ISBLK) && defined(S_IFBLK) +# define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK) +#endif +#if !defined(S_ISSOCK) && defined(S_IFSOCK) +# define S_ISSOCK(m) (((m) & S_IFMT) == S_IFSOCK) +#endif +#if !defined(S_ISFIFO) && defined(S_IFIFO) +# define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO) +#endif +#if !defined(S_ISCHR) && defined(S_IFCHR) +# define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR) +#endif + #endif // NVIM_OS_WIN_DEFS_H diff --git a/src/nvim/os_unix.c b/src/nvim/os_unix.c index 6c7cb3bba7..cb9a58cc77 100644 --- a/src/nvim/os_unix.c +++ b/src/nvim/os_unix.c @@ -175,13 +175,6 @@ void mch_exit(int r) exit(r); } -#ifndef SEEK_SET -# define SEEK_SET 0 -#endif -#ifndef SEEK_END -# define SEEK_END 2 -#endif - #define SHELL_SPECIAL (char_u *)"\t \"&'$;<>()\\|" /// Does wildcard pattern matching using the shell. diff --git a/src/nvim/path.c b/src/nvim/path.c index 23b22b67f1..5ac3d07f67 100644 --- a/src/nvim/path.c +++ b/src/nvim/path.c @@ -196,7 +196,7 @@ char_u *get_past_head(char_u *path) int vim_ispathsep(int c) { #ifdef UNIX - return c == '/'; /* UNIX has ':' inside file names */ + return c == '/'; // Unix has ':' inside file names #else # ifdef BACKSLASH_IN_FILENAME return c == ':' || c == '/' || c == '\\'; diff --git a/src/nvim/regexp.c b/src/nvim/regexp.c index e2c4b590d0..e01e812a70 100644 --- a/src/nvim/regexp.c +++ b/src/nvim/regexp.c @@ -4186,7 +4186,7 @@ regmatch ( /* When only a composing char is given match at any * position where that composing char appears. */ status = RA_NOMATCH; - for (i = 0; reginput[i] != NUL; i += utf_char2len(inpc)) { + for (i = 0; reginput[i] != NUL; i += utf_ptr2len(reginput + i)) { inpc = mb_ptr2char(reginput + i); if (!utf_iscomposing(inpc)) { if (i > 0) @@ -5333,10 +5333,12 @@ do_class: if ((len = (*mb_ptr2len)(opnd)) > 1) { if (ireg_ic && enc_utf8) cf = utf_fold(utf_ptr2char(opnd)); - while (count < maxcount) { - for (i = 0; i < len; ++i) - if (opnd[i] != scan[i]) + while (count < maxcount && (*mb_ptr2len)(scan) >= len) { + for (i = 0; i < len; ++i) { + if (opnd[i] != scan[i]) { break; + } + } if (i < len && (!ireg_ic || !enc_utf8 || utf_fold(utf_ptr2char(scan)) != cf)) break; diff --git a/src/nvim/regexp_nfa.c b/src/nvim/regexp_nfa.c index b96dcc66b3..1fd024a062 100644 --- a/src/nvim/regexp_nfa.c +++ b/src/nvim/regexp_nfa.c @@ -5875,7 +5875,7 @@ static int nfa_regmatch(nfa_regprog_T *prog, nfa_state_T *start, regsubs_T *subm // If ireg_icombine is not set only skip over the character // itself. When it is set skip over composing characters. if (result && enc_utf8 && !ireg_icombine) { - clen = utf_char2len(curc); + clen = utf_ptr2len(reginput); } ADD_STATE_IF_MATCH(t->state); diff --git a/src/nvim/screen.c b/src/nvim/screen.c index 977dd5b2d4..9a64a7c3a9 100644 --- a/src/nvim/screen.c +++ b/src/nvim/screen.c @@ -752,10 +752,11 @@ static void win_update(win_T *wp) lnumt = wp->w_lines[i].wl_lastlnum + 1; if (lnumb == MAXLNUM && wp->w_lines[i].wl_lnum >= mod_bot) { lnumb = wp->w_lines[i].wl_lnum; - /* When there is a fold column it might need updating - * in the next line ("J" just above an open fold). */ - if (wp->w_p_fdc > 0) - ++lnumb; + // When there is a fold column it might need updating + // in the next line ("J" just above an open fold). + if (compute_foldcolumn(wp, 0) > 0) { + lnumb++; + } } } @@ -1567,10 +1568,11 @@ static void win_draw_end(win_T *wp, int c1, int c2, int row, int endrow, hlf_T h { int n = 0; # define FDC_OFF n + int fdc = compute_foldcolumn(wp, 0); if (wp->w_p_rl) { - /* No check for cmdline window: should never be right-left. */ - n = wp->w_p_fdc; + // No check for cmdline window: should never be right-left. + n = fdc; if (n > 0) { /* draw the fold column at the right */ @@ -1610,8 +1612,8 @@ static void win_draw_end(win_T *wp, int c1, int c2, int row, int endrow, hlf_T h wp->w_wincol, wp->w_wincol + n, cmdwin_type, ' ', hl_attr(HLF_AT)); } - if (wp->w_p_fdc > 0) { - int nn = n + wp->w_p_fdc; + if (fdc > 0) { + int nn = n + fdc; /* draw the fold column at the left */ if (nn > wp->w_width) @@ -1654,6 +1656,20 @@ static int advance_color_col(int vcol, int **color_cols) return **color_cols >= 0; } +// Compute the width of the foldcolumn. Based on 'foldcolumn' and how much +// space is available for window "wp", minus "col". +static int compute_foldcolumn(win_T *wp, int col) +{ + int fdc = wp->w_p_fdc; + int wmw = wp == curwin && p_wmw == 0 ? 1 : p_wmw; + int wwidth = wp->w_width; + + if (fdc > wwidth - (col + wmw)) { + fdc = wwidth - (col + wmw); + } + return fdc; +} + /* * Display one folded line. */ @@ -1692,12 +1708,9 @@ static void fold_line(win_T *wp, long fold_count, foldinfo_T *foldinfo, linenr_T ++col; } - /* - * 2. Add the 'foldcolumn' - */ - fdc = wp->w_p_fdc; - if (fdc > wp->w_width - col) - fdc = wp->w_width - col; + // 2. Add the 'foldcolumn' + // Reduce the width when there is not enough space. + fdc = compute_foldcolumn(wp, col); if (fdc > 0) { fill_foldcolumn(buf, wp, TRUE, lnum); if (wp->w_p_rl) { @@ -2018,37 +2031,42 @@ fill_foldcolumn ( int level; int first_level; int empty; + int fdc = compute_foldcolumn(wp, 0); - /* Init to all spaces. */ - memset(p, ' ', (size_t)wp->w_p_fdc); + // Init to all spaces. + memset(p, ' ', (size_t)fdc); level = win_foldinfo.fi_level; if (level > 0) { - /* If there is only one column put more info in it. */ - empty = (wp->w_p_fdc == 1) ? 0 : 1; + // If there is only one column put more info in it. + empty = (fdc == 1) ? 0 : 1; - /* If the column is too narrow, we start at the lowest level that - * fits and use numbers to indicated the depth. */ - first_level = level - wp->w_p_fdc - closed + 1 + empty; - if (first_level < 1) + // If the column is too narrow, we start at the lowest level that + // fits and use numbers to indicated the depth. + first_level = level - fdc - closed + 1 + empty; + if (first_level < 1) { first_level = 1; + } - for (i = 0; i + empty < wp->w_p_fdc; ++i) { + for (i = 0; i + empty < fdc; i++) { if (win_foldinfo.fi_lnum == lnum - && first_level + i >= win_foldinfo.fi_low_level) + && first_level + i >= win_foldinfo.fi_low_level) { p[i] = '-'; - else if (first_level == 1) + } else if (first_level == 1) { p[i] = '|'; - else if (first_level + i <= 9) + } else if (first_level + i <= 9) { p[i] = '0' + first_level + i; - else + } else { p[i] = '>'; - if (first_level + i == level) + } + if (first_level + i == level) { break; + } } } - if (closed) - p[i >= wp->w_p_fdc ? i - 1 : i] = '+'; + if (closed) { + p[i >= fdc ? i - 1 : i] = '+'; + } } /* @@ -2629,11 +2647,13 @@ win_line ( } if (draw_state == WL_FOLD - 1 && n_extra == 0) { + int fdc = compute_foldcolumn(wp, 0); + draw_state = WL_FOLD; - if (wp->w_p_fdc > 0) { - /* Draw the 'foldcolumn'. */ - fill_foldcolumn(extra, wp, FALSE, lnum); - n_extra = wp->w_p_fdc; + if (fdc > 0) { + // Draw the 'foldcolumn'. + fill_foldcolumn(extra, wp, false, lnum); + n_extra = fdc; p_extra = extra; p_extra[n_extra] = NUL; c_extra = NUL; @@ -3459,7 +3479,7 @@ win_line ( c = ' '; } } else if (c == NUL - && ((wp->w_p_list && lcs_eol > 0) + && (wp->w_p_list || ((fromcol >= 0 || fromcol_prev >= 0) && tocol > vcol && VIsual_mode != Ctrl_V @@ -3469,11 +3489,11 @@ win_line ( && !(noinvcur && lnum == wp->w_cursor.lnum && (colnr_T)vcol == wp->w_virtcol))) - && lcs_eol_one >= 0) { - /* Display a '$' after the line or highlight an extra - * character if the line break is included. */ - /* For a diff line the highlighting continues after the - * "$". */ + && lcs_eol_one > 0) { + // Display a '$' after the line or highlight an extra + // character if the line break is included. + // For a diff line the highlighting continues after the + // "$". if (diff_hlf == (hlf_T)0 && line_attr == 0) { /* In virtualedit, visual selections may extend * beyond end of line. */ @@ -3486,10 +3506,11 @@ win_line ( c_extra = NUL; } } - if (wp->w_p_list) + if (wp->w_p_list && lcs_eol > 0) { c = lcs_eol; - else + } else { c = ' '; + } lcs_eol_one = -1; --ptr; /* put it back at the NUL */ if (!attr_pri) { diff --git a/src/nvim/shada.c b/src/nvim/shada.c index 59ef2a0d28..dcdf2195f8 100644 --- a/src/nvim/shada.c +++ b/src/nvim/shada.c @@ -5,6 +5,7 @@ #include <stdint.h> #include <inttypes.h> #include <errno.h> +#include <fcntl.h> #ifdef HAVE_UNISTD_H # include <unistd.h> #endif diff --git a/src/nvim/spell.c b/src/nvim/spell.c index 420e8e2b70..b2028109be 100644 --- a/src/nvim/spell.c +++ b/src/nvim/spell.c @@ -1063,8 +1063,7 @@ static char_u *repl_to = NULL; // // Returns the length of the word in bytes, also when it's OK, so that the // caller can skip over the word. -size_t -spell_check ( +size_t spell_check( win_T *wp, // current window char_u *ptr, hlf_T *attrp, @@ -1082,12 +1081,14 @@ spell_check ( // A word never starts at a space or a control character. Return quickly // then, skipping over the character. - if (*ptr <= ' ') + if (*ptr <= ' ') { return 1; + } // Return here when loading language files failed. - if (GA_EMPTY(&wp->w_s->b_langp)) + if (GA_EMPTY(&wp->w_s->b_langp)) { return 1; + } memset(&mi, 0, sizeof(matchinf_T)); @@ -1095,10 +1096,13 @@ spell_check ( // 0X99FF. But always do check spelling to find "3GPP" and "11 // julifeest". if (*ptr >= '0' && *ptr <= '9') { - if (*ptr == '0' && (ptr[1] == 'x' || ptr[1] == 'X')) + if (*ptr == '0' && (ptr[1] == 'b' || ptr[1] == 'B')) { + mi.mi_end = (char_u*) skipbin((char*) ptr + 2); + } else if (*ptr == '0' && (ptr[1] == 'x' || ptr[1] == 'X')) { mi.mi_end = skiphex(ptr + 2); - else + } else { mi.mi_end = skipdigits(ptr); + } nrlen = (size_t)(mi.mi_end - ptr); } @@ -1113,12 +1117,14 @@ spell_check ( if (capcol != NULL && *capcol == 0 && wp->w_s->b_cap_prog != NULL) { // Check word starting with capital letter. c = PTR2CHAR(ptr); - if (!SPELL_ISUPPER(c)) + if (!SPELL_ISUPPER(c)) { wrongcaplen = (size_t)(mi.mi_fend - ptr); + } } } - if (capcol != NULL) + if (capcol != NULL) { *capcol = -1; + } // We always use the characters up to the next non-word character, // also for bad words. @@ -1131,8 +1137,9 @@ spell_check ( // case-fold the word with one non-word character, so that we can check // for the word end. - if (*mi.mi_fend != NUL) + if (*mi.mi_fend != NUL) { mb_ptr_adv(mi.mi_fend); + } (void)spell_casefold(ptr, (int)(mi.mi_fend - ptr), mi.mi_fword, MAXWLEN + 1); mi.mi_fwordlen = (int)STRLEN(mi.mi_fword); @@ -1149,8 +1156,9 @@ spell_check ( // If reloading fails the language is still in the list but everything // has been cleared. - if (mi.mi_lp->lp_slang->sl_fidxs == NULL) + if (mi.mi_lp->lp_slang->sl_fidxs == NULL) { continue; + } // Check for a matching word in case-folded words. find_word(&mi, FIND_FOLDWORD); @@ -1181,18 +1189,18 @@ spell_check ( // If we found a number skip over it. Allows for "42nd". Do flag // rare and local words, e.g., "3GPP". if (nrlen > 0) { - if (mi.mi_result == SP_BAD || mi.mi_result == SP_BANNED) + if (mi.mi_result == SP_BAD || mi.mi_result == SP_BANNED) { return nrlen; - } + } + } else if (!spell_iswordp_nmw(ptr, wp)) { // When we are at a non-word character there is no error, just // skip over the character (try looking for a word after it). - else if (!spell_iswordp_nmw(ptr, wp)) { if (capcol != NULL && wp->w_s->b_cap_prog != NULL) { regmatch_T regmatch; // Check for end of sentence. regmatch.regprog = wp->w_s->b_cap_prog; - regmatch.rm_ic = FALSE; + regmatch.rm_ic = false; int r = vim_regexec(®match, ptr, 0); wp->w_s->b_cap_prog = regmatch.regprog; if (r) { @@ -1204,12 +1212,12 @@ spell_check ( return (size_t)(*mb_ptr2len)(ptr); } return 1; - } else if (mi.mi_end == ptr) + } else if (mi.mi_end == ptr) { // Always include at least one character. Required for when there // is a mixup in "midword". mb_ptr_adv(mi.mi_end); - else if (mi.mi_result == SP_BAD - && LANGP_ENTRY(wp->w_s->b_langp, 0)->lp_slang->sl_nobreak) { + } else if (mi.mi_result == SP_BAD + && LANGP_ENTRY(wp->w_s->b_langp, 0)->lp_slang->sl_nobreak) { char_u *p, *fp; int save_result = mi.mi_result; @@ -1219,11 +1227,12 @@ spell_check ( if (mi.mi_lp->lp_slang->sl_fidxs != NULL) { p = mi.mi_word; fp = mi.mi_fword; - for (;; ) { + for (;;) { mb_ptr_adv(p); mb_ptr_adv(fp); - if (p >= mi.mi_end) + if (p >= mi.mi_end) { break; + } mi.mi_compoff = (int)(fp - mi.mi_fword); find_word(&mi, FIND_COMPOUND); if (mi.mi_result != SP_BAD) { @@ -1235,12 +1244,13 @@ spell_check ( } } - if (mi.mi_result == SP_BAD || mi.mi_result == SP_BANNED) + if (mi.mi_result == SP_BAD || mi.mi_result == SP_BANNED) { *attrp = HLF_SPB; - else if (mi.mi_result == SP_RARE) + } else if (mi.mi_result == SP_RARE) { *attrp = HLF_SPR; - else + } else { *attrp = HLF_SPL; + } } if (wrongcaplen > 0 && (mi.mi_result == SP_OK || mi.mi_result == SP_RARE)) { diff --git a/src/nvim/testdir/Makefile b/src/nvim/testdir/Makefile index b4292dbd4b..aaa6f4b97e 100644 --- a/src/nvim/testdir/Makefile +++ b/src/nvim/testdir/Makefile @@ -14,7 +14,7 @@ SCRIPTS := test_eval.out \ test24.out \ test30.out \ test32.out test34.out \ - test36.out test37.out test39.out test40.out \ + test36.out test37.out test40.out \ test42.out test45.out \ test47.out test48.out test49.out \ test52.out test53.out test55.out \ @@ -29,7 +29,6 @@ SCRIPTS := test_eval.out \ test_charsearch.out \ test_close_count.out \ test_command_count.out \ - test_cdo.out \ NEW_TESTS = @@ -97,6 +96,7 @@ clean: *.rej \ *.orig \ test.log \ + messages \ $(RM_ON_RUN) \ $(RM_ON_START) \ valgrind.* \ @@ -149,7 +149,7 @@ test1.out: .gdbinit test1.in test49.out: test49.vim nolog: - -rm -f test.log + -rm -f test.log messages # New style of tests uses Vim script with assert calls. These are easier @@ -160,9 +160,9 @@ RUN_VIMTEST = VIMRUNTIME=$(SCRIPTSOURCE); export VIMRUNTIME; $(VALGRIND) $(VIMPR newtests: newtestssilent @/bin/sh -c "if test -f messages && grep -q 'FAILED' messages; then \ cat messages && cat test.log; \ - fi" \ + fi" newtestssilent: $(NEW_TESTS) %.res: %.vim .gdbinit - $(RUN_VIMTEST) -u runtest.vim $*.vim + $(RUN_VIMTEST) -u NONE -S runtest.vim $*.vim diff --git a/src/nvim/testdir/runtest.vim b/src/nvim/testdir/runtest.vim index 0dc142eb97..8314a45d0c 100644 --- a/src/nvim/testdir/runtest.vim +++ b/src/nvim/testdir/runtest.vim @@ -21,9 +21,7 @@ " It will be called after each Test_ function. " Without the +eval feature we can't run these tests, bail out. -if 0 - quit! -endif +so small.vim " Check that the screen size is at least 24 x 80 characters. if &lines < 24 || &columns < 80 @@ -38,7 +36,16 @@ endif " Source the test script. First grab the file name, in case the script " navigates away. let testname = expand('%') -source % +let done = 0 +let fail = 0 +let errors = [] +let messages = [] +try + source % +catch + let fail += 1 + call add(errors, 'Caught exception: ' . v:exception . ' @ ' . v:throwpoint) +endtry " Locate Test_ functions and execute them. redir @q @@ -46,14 +53,12 @@ function /^Test_ redir END let tests = split(substitute(@q, 'function \(\k*()\)', '\1', 'g')) -let done = 0 -let fail = 0 -let errors = [] for test in tests if exists("*SetUp") call SetUp() endif + call add(messages, 'Executing ' . test) let done += 1 try exe 'call ' . test @@ -89,9 +94,20 @@ if len(errors) > 0 write endif -echo 'Executed ' . done . (done > 1 ? ' tests': ' test') +let message = 'Executed ' . done . (done > 1 ? ' tests': ' test') +echo message +call add(messages, message) if fail > 0 - echo fail . ' FAILED' + let message = fail . ' FAILED' + echo message + call add(messages, message) endif +" Append messages to "messages" +split messages +call append(line('$'), '') +call append(line('$'), 'From ' . testname . ':') +call append(line('$'), messages) +write + qall! diff --git a/src/nvim/testdir/test39.in b/src/nvim/testdir/test39.in deleted file mode 100644 index ebbcbd6d0d..0000000000 --- a/src/nvim/testdir/test39.in +++ /dev/null @@ -1,106 +0,0 @@ - -Test Visual block mode commands -And test "U" in Visual mode, also on German sharp S. - -STARTTEST -:so small.vim -:so mbyte.vim -/^abcde -:" Test shift-right of a block -jlllljj>wlljlll> -:" Test shift-left of a block -G$hhhhkk< -:" Test block-insert -GklkkkIxyz -:" Test block-replace -Gllllkkklllrq -:" Test block-change -G$khhhhhkkcmno -:$-4,$w! test.out -:" Test block-insert using cursor keys for movement -/^aaaa/ -:exe ":norm! l\<C-V>jjjlllI\<Right>\<Right> \<Esc>" -:/^aa/,/^$/w >> test.out -/xaaa$/ -:exe ":norm! \<C-V>jjjI<>\<Left>p\<Esc>" -:/xaaa$/,/^$/w >> test.out -:" Test for Visual block was created with the last <C-v>$ -/^A23$/ -:exe ":norm! l\<C-V>j$Aab\<Esc>" -:.,/^$/w >> test.out -:" Test for Visual block was created with the middle <C-v>$ (1) -/^B23$/ -:exe ":norm! l\<C-V>j$hAab\<Esc>" -:.,/^$/w >> test.out -:" Test for Visual block was created with the middle <C-v>$ (2) -/^C23$/ -:exe ":norm! l\<C-V>j$hhAab\<Esc>" -:.,/^$/w >> test.out -:" Test for Visual block insert when virtualedit=all and utf-8 encoding -:set ve=all -:/\t\tline -:exe ":norm! 07l\<C-V>jjIx\<Esc>" -:.,/^$/w >> test.out -:" Test for Visual block append when virtualedit=all -:exe ":norm! 012l\<C-v>jjAx\<Esc>" -:set ve= -:.,/^$/w >> test.out -:" gUe must uppercase a whole word, also when ß changes to SS -Gothe youtußeuu endYpk0wgUe -:" gUfx must uppercase until x, inclusive. -O- youßtußexu -0fogUfx -:" VU must uppercase a whole line -YpkVU -:" same, when it's the last line in the buffer -YPGi111VUddP -:" Uppercase two lines -Oblah di -doh dutVkUj -:" Uppercase part of two lines -ddppi333k0i222fyllvjfuUk -:" visual replace using Enter or NL -G3o1234567892k05l2jr
G3o987652k02l2jr
-G3o1234567892k05l2jr -G3o987652k02l2jr -:" -:" Test cursor position. When ve=block and Visual block mode and $gj -:set ve=block -:exe ":norm! 2k\<C-V>$gj\<Esc>" -:let cpos=getpos("'>") -:$put ='col:'.cpos[2].' off:'.cpos[3] -:/^the/,$w >> test.out -:qa! -ENDTEST - - line1 - line2 - line3 - -aaaaaa -bbbbbb -cccccc -dddddd - -xaaa -bbbb -cccc -dddd - -yaaa -¿¿¿ -bbb - -A23 -4567 - -B23 -4567 - -C23 -4567 - -abcdefghijklm -abcdefghijklm -abcdefghijklm -abcdefghijklm -abcdefghijklm diff --git a/src/nvim/testdir/test39.ok b/src/nvim/testdir/test39.ok Binary files differdeleted file mode 100644 index 198e5b14dc..0000000000 --- a/src/nvim/testdir/test39.ok +++ /dev/null diff --git a/src/nvim/testdir/test_cdo.in b/src/nvim/testdir/test_cdo.in deleted file mode 100644 index fb80ea1164..0000000000 --- a/src/nvim/testdir/test_cdo.in +++ /dev/null @@ -1,107 +0,0 @@ -Tests for the :cdo, :cfdo, :ldo and :lfdo commands - -STARTTEST -:so small.vim -:if !has('quickfix') | e! test.ok | wq! test.out | endif - -:call writefile(["Line1", "Line2", "Line3"], 'Xtestfile1') -:call writefile(["Line1", "Line2", "Line3"], 'Xtestfile2') -:call writefile(["Line1", "Line2", "Line3"], 'Xtestfile3') - -:function RunTests(cchar) -: let nl="\n" - -: enew -: " Try with an empty list -: exe a:cchar . "do let g:result .= expand('%') . ' ' . line('.') . 'L' . ' ' . col('.') . 'C' . nl" - -: " Populate the list and then try -: exe a:cchar . "getexpr ['non-error 1', 'Xtestfile1:1:3:Line1', 'non-error 2', 'Xtestfile2:2:2:Line2', 'non-error 3', 'Xtestfile3:3:1:Line3']" -: exe a:cchar . "do let g:result .= expand('%') . ' ' . line('.') . 'L' . ' ' . col('.') . 'C' . nl" - -: " Run command only on selected error lines -: enew -: exe "2,3" . a:cchar . "do let g:result .= expand('%') . ' ' . line('.') . 'L' . ' ' . col('.') . 'C' . nl" -: " Boundary condition tests -: enew -: exe "1,1" . a:cchar . "do let g:result .= expand('%') . ' ' . line('.') . 'L' . ' ' . col('.') . 'C' . nl" -: enew -: exe "3" . a:cchar . "do let g:result .= expand('%') . ' ' . line('.') . 'L' . ' ' . col('.') . 'C' . nl" -: " Range test commands -: enew -: exe "%" . a:cchar . "do let g:result .= expand('%') . ' ' . line('.') . 'L' . ' ' . col('.') . 'C' . nl" -: enew -: exe "1,$" . a:cchar . "do let g:result .= expand('%') . ' ' . line('.') . 'L' . ' ' . col('.') . 'C' . nl" -: enew -: exe a:cchar . 'prev' -: exe "." . a:cchar . "do let g:result .= expand('%') . ' ' . line('.') . 'L' . ' ' . col('.') . 'C' . nl" -: " Invalid error lines test -: enew -: exe "27" . a:cchar . "do let g:result .= expand('%') . ' ' . line('.') . 'L' . ' ' . col('.') . 'C' . nl" -: exe "4,5" . a:cchar . "do let g:result .= expand('%') . ' ' . line('.') . 'L' . ' ' . col('.') . 'C' . nl" - -: " Run commands from an unsaved buffer -: let v:errmsg='' -: enew -: setlocal modified -: exe "2,2" . a:cchar . "do let g:result .= expand('%') . ' ' . line('.') . 'L' . ' ' . col('.') . 'C' . nl" -: if v:errmsg =~# 'No write since last change' -: let g:result .= 'Unsaved file change test passed' . nl -: else -: let g:result .= 'Unsaved file change test failed' . nl -: endif - -: " If the executed command fails, then the operation should be aborted -: enew! -: let subst_count = 0 -: exe a:cchar . "do s/Line/xLine/ | let subst_count += 1" -: if subst_count == 1 && getline('.') == 'xLine1' -: let g:result .= 'Abort command on error test passed' . nl -: else -: let g:result .= 'Abort command on error test failed' . nl -: endif - -: exe "2,2" . a:cchar . "do! let g:result .= expand('%') . ' ' . line('.') . 'L' . ' ' . col('.') . 'C' . nl" - -: " List with no valid error entries -: edit! +2 Xtestfile1 -: exe a:cchar . "getexpr ['non-error 1', 'non-error 2', 'non-error 3']" -: exe a:cchar . "do let g:result .= expand('%') . ' ' . line('.') . 'L' . ' ' . col('.') . 'C' . nl" -: exe "2" . a:cchar . "do let g:result .= expand('%') . ' ' . line('.') . 'L' . ' ' . col('.') . 'C' . nl" -: let v:errmsg='' -: exe "%" . a:cchar . "do let g:result .= expand('%') . ' ' . line('.') . 'L' . ' ' . col('.') . 'C' . nl" -: exe "1,$" . a:cchar . "do let g:result .= expand('%') . ' ' . line('.') . 'L' . ' ' . col('.') . 'C' . nl" -: exe "." . a:cchar . "do let g:result .= expand('%') . ' ' . line('.') . 'L' . ' ' . col('.') . 'C' . nl" -: let g:result .= v:errmsg - -: " List with only one valid entry -: exe a:cchar . "getexpr ['Xtestfile3:3:1:Line3']" -: exe a:cchar . "do let g:result .= expand('%') . ' ' . line('.') . 'L' . ' ' . col('.') . 'C' . nl" - -: " Tests for :cfdo and :lfdo commands -: exe a:cchar . "getexpr ['non-error 1', 'Xtestfile1:1:3:Line1', 'Xtestfile1:2:1:Line2', 'non-error 2', 'Xtestfile2:2:2:Line2', 'non-error 3', 'Xtestfile3:2:3:Line2', 'Xtestfile3:3:1:Line3']" -: exe a:cchar . "fdo let g:result .= expand('%') . ' ' . line('.') . 'L' . ' ' . col('.') . 'C' . nl" -: exe "3" . a:cchar . "fdo let g:result .= expand('%') . ' ' . line('.') . 'L' . ' ' . col('.') . 'C' . nl" -: exe "2,3" . a:cchar . "fdo let g:result .= expand('%') . ' ' . line('.') . 'L' . ' ' . col('.') . 'C' . nl" -: exe "%" . a:cchar . "fdo let g:result .= expand('%') . ' ' . line('.') . 'L' . ' ' . col('.') . 'C' . nl" -: exe "1,$" . a:cchar . "fdo let g:result .= expand('%') . ' ' . line('.') . 'L' . ' ' . col('.') . 'C' . nl" -: exe a:cchar . 'pfile' -: exe "." . a:cchar . "fdo let g:result .= expand('%') . ' ' . line('.') . 'L' . ' ' . col('.') . 'C' . nl" - -: " List with only one valid entry -: exe a:cchar . "getexpr ['Xtestfile2:2:5:Line2']" -: exe a:cchar . "fdo let g:result .= expand('%') . ' ' . line('.') . 'L' . ' ' . col('.') . 'C' . nl" -:endfunction - -:let result='' -:" Tests for the :cdo quickfix list command -:call RunTests('c') -:let result .= "\n" -:" Tests for the :ldo location list command -:call RunTests('l') - -:edit! test.out -:0put =result -:wq! -ENDTEST - diff --git a/src/nvim/testdir/test_cdo.ok b/src/nvim/testdir/test_cdo.ok deleted file mode 100644 index ddcff4bbb8..0000000000 --- a/src/nvim/testdir/test_cdo.ok +++ /dev/null @@ -1,66 +0,0 @@ -Xtestfile1 1L 3C -Xtestfile2 2L 2C -Xtestfile3 3L 1C -Xtestfile2 2L 2C -Xtestfile3 3L 1C -Xtestfile1 1L 3C -Xtestfile3 3L 1C -Xtestfile1 1L 3C -Xtestfile2 2L 2C -Xtestfile3 3L 1C -Xtestfile1 1L 3C -Xtestfile2 2L 2C -Xtestfile3 3L 1C -Xtestfile2 2L 2C -Unsaved file change test passed -Abort command on error test passed -Xtestfile2 2L 2C -Xtestfile3 3L 1C -Xtestfile1 1L 3C -Xtestfile2 2L 2C -Xtestfile3 2L 3C -Xtestfile3 2L 3C -Xtestfile2 2L 2C -Xtestfile3 2L 3C -Xtestfile1 1L 3C -Xtestfile2 2L 2C -Xtestfile3 2L 3C -Xtestfile1 1L 3C -Xtestfile2 2L 2C -Xtestfile3 2L 3C -Xtestfile2 2L 2C -Xtestfile2 2L 5C - -Xtestfile1 1L 3C -Xtestfile2 2L 2C -Xtestfile3 3L 1C -Xtestfile2 2L 2C -Xtestfile3 3L 1C -Xtestfile1 1L 3C -Xtestfile3 3L 1C -Xtestfile1 1L 3C -Xtestfile2 2L 2C -Xtestfile3 3L 1C -Xtestfile1 1L 3C -Xtestfile2 2L 2C -Xtestfile3 3L 1C -Xtestfile2 2L 2C -Unsaved file change test passed -Abort command on error test passed -Xtestfile2 2L 2C -Xtestfile3 3L 1C -Xtestfile1 1L 3C -Xtestfile2 2L 2C -Xtestfile3 2L 3C -Xtestfile3 2L 3C -Xtestfile2 2L 2C -Xtestfile3 2L 3C -Xtestfile1 1L 3C -Xtestfile2 2L 2C -Xtestfile3 2L 3C -Xtestfile1 1L 3C -Xtestfile2 2L 2C -Xtestfile3 2L 3C -Xtestfile2 2L 2C -Xtestfile2 2L 5C - diff --git a/src/nvim/undo.c b/src/nvim/undo.c index 69ac18ad54..6b60f95f22 100644 --- a/src/nvim/undo.c +++ b/src/nvim/undo.c @@ -77,6 +77,7 @@ #include <limits.h> #include <stdbool.h> #include <string.h> +#include <fcntl.h> #include "nvim/vim.h" #include "nvim/ascii.h" diff --git a/src/nvim/version.c b/src/nvim/version.c index 53a877b91a..4ac224fecb 100644 --- a/src/nvim/version.c +++ b/src/nvim/version.c @@ -133,7 +133,7 @@ static int included_patches[] = { // 994 NA // 993, // 992 NA - // 991, + 991, // 990 NA 989, // 988 NA @@ -143,10 +143,10 @@ static int included_patches[] = { // 984, // 983, // 982 NA - // 981, - // 980, + 981, + 980, // 979 NA - // 978, + 978, // 977, // 976 NA 975, @@ -395,7 +395,7 @@ static int included_patches[] = { // 732, // 731 NA // 730 NA - // 729, + 729, // 728 NA // 727 NA // 726 NA @@ -403,14 +403,14 @@ static int included_patches[] = { // 724 NA 723, // 722, - // 721, + 721, // 720 NA 719, 718, // 717, - // 716, - // 715, - // 714, + 716, + 715, + 714, 713, 712, 711, @@ -439,7 +439,7 @@ static int included_patches[] = { // 688, // 687 NA 686, - // 685, + 685, // 684, // 683 NA 682, @@ -508,9 +508,9 @@ static int included_patches[] = { // 619 NA // 618 NA 617, - // 616, + 616, 615, - // 614, + 614, // 613, 612, // 611 NA @@ -521,7 +521,7 @@ static int included_patches[] = { 606, 605, 604, - // 603, + 603, 602, 601, 600, diff --git a/src/nvim/vim.h b/src/nvim/vim.h index fa00d9efcf..2e20d48f90 100644 --- a/src/nvim/vim.h +++ b/src/nvim/vim.h @@ -27,9 +27,6 @@ Error: configure did not run properly.Check auto/config.log. # endif #endif -/* user ID of root is usually zero, but not for everybody */ -#define ROOT_UID 0 - /* Can't use "PACKAGE" here, conflicts with a Perl include file. */ #ifndef VIMPACKAGE @@ -38,9 +35,11 @@ Error: configure did not run properly.Check auto/config.log. #include "nvim/os/os_defs.h" /* bring lots of system header files */ -#define NUMBUFLEN 30 /* length of a buffer to store a number in ASCII */ +#define NUMBUFLEN 65 // length of a buffer to store a number in ASCII -# define MAX_TYPENR 65535 +#define MAX_TYPENR 65535 + +#define ROOT_UID 0 #include "nvim/keymap.h" #include "nvim/macros.h" @@ -232,15 +231,6 @@ enum { /* Size in bytes of the hash used in the undo file. */ #define UNDO_HASH_SIZE 32 -#ifdef HAVE_FCNTL_H -# include <fcntl.h> -#endif - - -#ifndef O_NOFOLLOW -# define O_NOFOLLOW 0 -#endif - /* * defines to avoid typecasts from (char_u *) to (char *) and back * (vim_strchr() and vim_strrchr() are now in alloc.c) diff --git a/test/functional/eval/printf_spec.lua b/test/functional/eval/printf_spec.lua new file mode 100644 index 0000000000..6180f4156a --- /dev/null +++ b/test/functional/eval/printf_spec.lua @@ -0,0 +1,60 @@ +local helpers = require('test.functional.helpers') +local clear = helpers.clear +local eq = helpers.eq +local funcs = helpers.funcs +local exc_exec = helpers.exc_exec + +describe('printf()', function() + before_each(clear) + + it('works with zero and %b', function() + eq('0', funcs.printf('%lb', 0)) + eq('0', funcs.printf('%llb', 0)) + eq('0', funcs.printf('%zb', 0)) + end) + it('works with one and %b', function() + eq('1', funcs.printf('%b', 1)) + eq('1', funcs.printf('%lb', 1)) + eq('1', funcs.printf('%llb', 1)) + eq('1', funcs.printf('%zb', 1)) + end) + it('works with 0xff and %b', function() + eq('11111111', funcs.printf('%b', 0xff)) + eq('11111111', funcs.printf('%lb', 0xff)) + eq('11111111', funcs.printf('%llb', 0xff)) + eq('11111111', funcs.printf('%zb', 0xff)) + end) + it('accepts width modifier with %b', function() + eq(' 1', funcs.printf('%3b', 1)) + end) + it('accepts prefix modifier with %b', function() + eq('0b1', funcs.printf('%#b', 1)) + end) + it('writes capital B with %B', function() + eq('0B1', funcs.printf('%#B', 1)) + end) + it('accepts prefix, zero-fill and width modifiers with %b', function() + eq('0b001', funcs.printf('%#05b', 1)) + end) + it('accepts prefix and width modifiers with %b', function() + eq(' 0b1', funcs.printf('%#5b', 1)) + end) + it('does not write prefix for zero with prefix and width modifier used with %b', function() + eq(' 0', funcs.printf('%#5b', 0)) + end) + it('accepts precision modifier with %b', function() + eq('00000', funcs.printf('%.5b', 0)) + end) + it('accepts all modifiers with %b at once', function() + -- zero-fill modifier is ignored when used with left-align + -- force-sign and add-blank are ignored + -- use-grouping-characters modifier is ignored always + eq('0b00011 ', funcs.printf('% \'+#0-10.5b', 3)) + end) + it('errors out when %b modifier is used for a list', function() + eq('Vim(call):E745: Using a List as a Number', exc_exec('call printf("%b", [])')) + end) + it('errors out when %b modifier is used for a float', function() + eq('Vim(call):E805: Using a Float as a Number', exc_exec('call printf("%b", 3.1415926535)')) + end) +end) diff --git a/test/functional/job/job_spec.lua b/test/functional/job/job_spec.lua index 0915ab0955..d21b9051e2 100644 --- a/test/functional/job/job_spec.lua +++ b/test/functional/job/job_spec.lua @@ -142,6 +142,35 @@ describe('jobs', function() nvim('command', "call jobstart(['cat', '-'], g:job_opts)") end) + it('can get the pid value using getpid', function() + nvim('command', "let j = jobstart(['cat', '-'], g:job_opts)") + local pid = eval('jobpid(j)') + eq(0,os.execute('ps -p '..pid..' > /dev/null')) + nvim('command', 'call jobstop(j)') + eq({'notification', 'exit', {0, 0}}, next_msg()) + neq(0,os.execute('ps -p '..pid..' > /dev/null')) + end) + + it("doesn't survive the exit of nvim", function() + -- use sleep, which doesn't die on stdin close + nvim('command', "let j = jobstart(['sleep', '1000'], g:job_opts)") + local pid = eval('jobpid(j)') + eq(0,os.execute('ps -p '..pid..' > /dev/null')) + clear() + neq(0,os.execute('ps -p '..pid..' > /dev/null')) + end) + + it('can survive the exit of nvim with "detach"', function() + nvim('command', 'let g:job_opts.detach = 1') + nvim('command', "let j = jobstart(['sleep', '1000'], g:job_opts)") + local pid = eval('jobpid(j)') + eq(0,os.execute('ps -p '..pid..' > /dev/null')) + clear() + eq(0,os.execute('ps -p '..pid..' > /dev/null')) + -- clean up after ourselves + os.execute('kill -9 '..pid..' > /dev/null') + end) + it('can pass user data to the callback', function() nvim('command', 'let g:job_opts.user = {"n": 5, "s": "str", "l": [1]}') nvim('command', "call jobstart(['echo'], g:job_opts)") diff --git a/test/functional/legacy/035_increment_and_decrement_spec.lua b/test/functional/legacy/035_increment_and_decrement_spec.lua index 20c0cc4206..e6252c384b 100644 --- a/test/functional/legacy/035_increment_and_decrement_spec.lua +++ b/test/functional/legacy/035_increment_and_decrement_spec.lua @@ -11,34 +11,40 @@ describe('increment and decrement commands', function() it('should work', function() -- Insert some numbers in various bases. insert([[ - 100 0x100 077 0 - 100 0x100 077 + 0b101 100 0x100 077 0 + 0b101 100 0x100 077 100 0x100 077 0xfF 0xFf - 100 0x100 077]]) + 100 0x100 077 + 0x0b101 0b1101]]) -- Increment and decrement numbers in the first row, interpreting the -- numbers as decimal, octal or hexadecimal. - execute('set nrformats=octal,hex', '1') - feed('102ll64128$') + execute('set nrformats=bin,octal,hex', '1') + feed('63l102ll64128$') -- For the second row, treat the numbers as decimal or octal. -- 0x100 should be interpreted as decimal 0, the character x, and decimal 100. execute('set nrformats=octal', '2') - feed('0102l2w65129blx6lD') + feed('0w102l2w65129blx6lD') -- For the third row, treat the numbers as decimal or hexadecimal. -- 077 should be interpreted as decimal 77. execute('set nrformats=hex', '3') feed('0101l257Txldt ') - -- For the last row, interpret all numbers as decimal. + -- For the fourth row, interpret all numbers as decimal. execute('set nrformats=', '4') feed('0200l100w78') + -- For the last row, interpret as binary and hexadecimal. + execute('set nrformats=bin,hex', '5') + feed('010065l6432') + expect([[ - 0 0x0ff 0000 -1 - 0 1x100 0777777 + 0b011 0 0x0ff 0000 -1 + 1b101 0 1x100 0777777 -1 0x0 078 0xFE 0xfe - -100 -100x100 000]]) + -100 -100x100 000 + 0x0b0de 0b0101101]]) end) end) diff --git a/test/functional/legacy/039_visual_block_mode_commands_spec.lua b/test/functional/legacy/039_visual_block_mode_commands_spec.lua new file mode 100644 index 0000000000..55db9169fa --- /dev/null +++ b/test/functional/legacy/039_visual_block_mode_commands_spec.lua @@ -0,0 +1,234 @@ +-- Test Visual block mode commands +-- And test "U" in Visual mode, also on German sharp S. + +local helpers = require('test.functional.helpers') +local nvim, eq = helpers.meths, helpers.eq +local insert, feed = helpers.insert, helpers.feed +local clear, expect = helpers.clear, helpers.expect +local source, execute = helpers.source, helpers.execute + +describe('Visual block mode', function() + + before_each(function() + clear() + + execute('set ts&vi sw&vi sts&vi noet') -- Vim compatible + end) + + it('should shift, insert, replace and change a block', function() + insert([[ + abcdefghijklm + abcdefghijklm + abcdefghijklm + abcdefghijklm + abcdefghijklm]]) + + feed('gg') + -- Test shift-right of a block + feed('jllll<C-v>jj>wll<C-v>jlll><CR>') + -- Test shift-left of a block + feed('G$hhhh<C-v>kk<lt>') + -- Test block-insert + feed('Gkl<C-v>kkkIxyz<ESC>') + -- Test block-replace + feed('Gllll<C-v>kkklllrq') + -- Test block-change + feed('G$khhh<C-v>hhkkcmno<ESC>') + + expect([[ + axyzbcdefghijklm + axyzqqqq mno ghijklm + axyzqqqqef mno ghijklm + axyzqqqqefgmnoklm + abcdqqqqijklm]]) + end) + + it('should insert a block using cursor keys for movement', function() + insert([[ + aaaaaa + bbbbbb + cccccc + dddddd + + xaaa + bbbb + cccc + dddd]]) + + execute('/^aa') + feed('l<C-v>jjjlllI<Right><Right> <ESC>') + execute('/xaaa$') + feed('<C-v>jjjI<lt>><Left>p<ESC>') + + expect([[ + aaa aaa + bbb bbb + ccc ccc + ddd ddd + + <p>xaaa + <p>bbbb + <p>cccc + <p>dddd]]) + end) + + it('should create a block', function() + insert([[ + A23 + 4567 + + B23 + 4567 + + C23 + 4567]]) + + -- Test for Visual block was created with the last <C-v>$. + execute('/^A23$/') + feed('l<C-v>j$Aab<ESC>') + -- Test for Visual block was created with the middle <C-v>$ (1). + execute('/^B23$/') + feed('l<C-v>j$hAab<ESC>') + -- Test for Visual block was created with the middle <C-v>$ (2). + execute('/^C23$/') + feed('l<C-v>j$hhAab<ESC>') + + expect([[ + A23ab + 4567ab + + B23 ab + 4567ab + + C23ab + 456ab7]]) + end) + + it('should insert and append a block when virtualedit=all', function() + insert([[ + line1 + line2 + line3 + ]]) + + -- Test for Visual block insert when virtualedit=all and utf-8 encoding. + execute('set ve=all') + execute('/\t\tline') + feed('07l<C-v>jjIx<ESC>') + + expect([[ + x line1 + x line2 + x line3 + ]]) + + -- Test for Visual block append when virtualedit=all. + feed('012l<C-v>jjAx<ESC>') + + expect([[ + x x line1 + x x line2 + x x line3 + ]]) + end) + + it('should make a selected part uppercase', function() + -- GUe must uppercase a whole word, also when ß changes to SS. + feed('Gothe youtußeuu end<ESC>Ypk0wgUe<CR>') + -- GUfx must uppercase until x, inclusive. + feed('O- youßtußexu -<ESC>0fogUfx<CR>') + -- VU must uppercase a whole line. + feed('YpkVU<CR>') + -- Same, when it's the last line in the buffer. + feed('YPGi111<ESC>VUddP<CR>') + -- Uppercase two lines. + feed('Oblah di<CR>') + feed('doh dut<ESC>VkUj<CR>') + -- Uppercase part of two lines. + feed('ddppi333<ESC>k0i222<esc>fyllvjfuUk<CR>') + + expect([[ + + the YOUTUSSEUU end + - yOUSSTUSSEXu - + THE YOUTUSSEUU END + 111THE YOUTUSSEUU END + BLAH DI + DOH DUT + 222the yoUTUSSEUU END + 333THE YOUTUßeuu end]]) + end) + + it('should replace using Enter or NL', function() + -- Visual replace using Enter or NL. + feed('G3o123456789<ESC>2k05l<C-v>2jr<CR>') + feed('G3o98765<ESC>2k02l<C-v>2jr<C-v><CR>') + feed('G3o123456789<ESC>2k05l<C-v>2jr<CR>') + feed('G3o98765<ESC>2k02l<C-v>2jr<C-v><Nul>') + + local expected = [[ + + 12345 + 789 + 12345 + 789 + 12345 + 789 + 98<CR>65 + 98<CR>65 + 98<CR>65 + 12345 + 789 + 12345 + 789 + 12345 + 789 + 98<Nul>65 + 98<Nul>65 + 98<Nul>65]] + expected = expected:gsub('<CR>', '\r') + expected = expected:gsub('<Nul>', '\x00') + + expect(expected) + end) + + it('should treat cursor position correctly when virtualedit=block', function() + insert([[ + 12345 + 789 + 98765]]) + + -- Test cursor position. When virtualedit=block and Visual block mode and $gj. + execute('set ve=block') + feed('G2l') + feed('2k<C-v>$gj<ESC>') + execute([[let cpos=getpos("'>")]]) + local cpos = nvim.get_var('cpos') + local expected = { + col = 4, + off = 0 + } + local actual = { + col = cpos[3], + off = cpos[4] + } + + eq(expected, actual) + end) + + it('should replace spaces in front of the block with tabs', function() + insert([[ + #define BO_ALL 0x0001 + #define BO_BS 0x0002 + #define BO_CRSR 0x0004]]) + + -- Block_insert when replacing spaces in front of the block with tabs. + execute('set ts=8 sts=4 sw=4') + feed('ggf0<C-v>2jI<TAB><ESC>') + + expect([[ + #define BO_ALL 0x0001 + #define BO_BS 0x0002 + #define BO_CRSR 0x0004]]) + end) +end) diff --git a/test/functional/legacy/057_sort_spec.lua b/test/functional/legacy/057_sort_spec.lua index 585b391198..65defbae96 100644 --- a/test/functional/legacy/057_sort_spec.lua +++ b/test/functional/legacy/057_sort_spec.lua @@ -600,4 +600,39 @@ describe(':sort', function() eq('Vim(sort):E474: Invalid argument', eval('tmpvar')) expect(text) end) + + it('binary', function() + insert([[ + 0b111000 + 0b101100 + 0b101001 + 0b101001 + 0b101000 + 0b000000 + 0b001000 + 0b010000 + 0b101000 + 0b100000 + 0b101010 + 0b100010 + 0b100100 + 0b100010]]) + execute([[sort b]]) + expect([[ + 0b000000 + 0b001000 + 0b010000 + 0b100000 + 0b100010 + 0b100010 + 0b100100 + 0b101000 + 0b101000 + 0b101001 + 0b101001 + 0b101010 + 0b101100 + 0b111000]]) + end) + end) diff --git a/test/functional/legacy/cdo_spec.lua b/test/functional/legacy/cdo_spec.lua new file mode 100644 index 0000000000..4b313ede3f --- /dev/null +++ b/test/functional/legacy/cdo_spec.lua @@ -0,0 +1,226 @@ +-- Tests for the :cdo, :cfdo, :ldo and :lfdo commands + +local helpers = require('test.functional.helpers') +local nvim, clear = helpers.meths, helpers.clear +local call, feed = helpers.call, helpers.feed +local source, eq = helpers.source, helpers.eq + +local function expected_empty() + eq({}, nvim.get_vvar('errors')) +end + +describe('cdo', function() + before_each(function() + clear() + + call('writefile', {'Line1', 'Line2', 'Line3'}, 'Xtestfile1') + call('writefile', {'Line1', 'Line2', 'Line3'}, 'Xtestfile2') + call('writefile', {'Line1', 'Line2', 'Line3'}, 'Xtestfile3') + + source([=[ + " Returns the current line in '<filename> <linenum>L <column>C' format + function GetRuler() + return expand('%') . ' ' . line('.') . 'L' . ' ' . col('.') . 'C' + endfunction + + " Tests for the :cdo and :ldo commands + function XdoTests(cchar) + enew + + " Shortcuts for calling the cdo and ldo commands + let Xdo = a:cchar . 'do' + let Xgetexpr = a:cchar . 'getexpr' + let Xprev = a:cchar. 'prev' + let XdoCmd = Xdo . ' call add(l, GetRuler())' + + " Try with an empty list + let l = [] + exe XdoCmd + call assert_equal([], l) + + " Populate the list and then try + exe Xgetexpr . " ['non-error 1', 'Xtestfile1:1:3:Line1', 'non-error 2', 'Xtestfile2:2:2:Line2', 'non-error 3', 'Xtestfile3:3:1:Line3']" + + let l = [] + exe XdoCmd + call assert_equal(['Xtestfile1 1L 3C', 'Xtestfile2 2L 2C', 'Xtestfile3 3L 1C'], l) + + " Run command only on selected error lines + let l = [] + enew + exe "2,3" . XdoCmd + call assert_equal(['Xtestfile2 2L 2C', 'Xtestfile3 3L 1C'], l) + + " Boundary condition tests + let l = [] + enew + exe "1,1" . XdoCmd + call assert_equal(['Xtestfile1 1L 3C'], l) + + let l = [] + enew + exe "3" . XdoCmd + call assert_equal(['Xtestfile3 3L 1C'], l) + + " Range test commands + let l = [] + enew + exe "%" . XdoCmd + call assert_equal(['Xtestfile1 1L 3C', 'Xtestfile2 2L 2C', 'Xtestfile3 3L 1C'], l) + + let l = [] + enew + exe "1,$" . XdoCmd + call assert_equal(['Xtestfile1 1L 3C', 'Xtestfile2 2L 2C', 'Xtestfile3 3L 1C'], l) + + let l = [] + enew + exe Xprev + exe "." . XdoCmd + call assert_equal(['Xtestfile2 2L 2C'], l) + + let l = [] + enew + exe "+" . XdoCmd + call assert_equal(['Xtestfile3 3L 1C'], l) + + " Invalid error lines test + let l = [] + enew + exe "silent! 27" . XdoCmd + exe "silent! 4,5" . XdoCmd + call assert_equal([], l) + + " Run commands from an unsaved buffer + let v:errmsg='' + let l = [] + enew + setlocal modified + exe "silent! 2,2" . XdoCmd + if v:errmsg !~# 'No write since last change' + call add(v:errors, 'Unsaved file change test failed') + endif + + " If the executed command fails, then the operation should be aborted + enew! + let subst_count = 0 + exe "silent!" . Xdo . " s/Line/xLine/ | let subst_count += 1" + if subst_count != 1 || getline('.') != 'xLine1' + call add(v:errors, 'Abort command on error test failed') + endif + + let l = [] + exe "2,2" . Xdo . "! call add(l, GetRuler())" + call assert_equal(['Xtestfile2 2L 2C'], l) + + " List with no valid error entries + let l = [] + edit! +2 Xtestfile1 + exe Xgetexpr . " ['non-error 1', 'non-error 2', 'non-error 3']" + exe XdoCmd + call assert_equal([], l) + exe "silent! 2" . XdoCmd + call assert_equal([], l) + let v:errmsg='' + exe "%" . XdoCmd + exe "1,$" . XdoCmd + exe "." . XdoCmd + call assert_equal('', v:errmsg) + + " List with only one valid entry + let l = [] + exe Xgetexpr . " ['Xtestfile3:3:1:Line3']" + exe XdoCmd + call assert_equal(['Xtestfile3 3L 1C'], l) + + endfunction + + " Tests for the :cfdo and :lfdo commands + function XfdoTests(cchar) + enew + + " Shortcuts for calling the cfdo and lfdo commands + let Xfdo = a:cchar . 'fdo' + let Xgetexpr = a:cchar . 'getexpr' + let XfdoCmd = Xfdo . ' call add(l, GetRuler())' + let Xpfile = a:cchar. 'pfile' + + " Clear the quickfix/location list + exe Xgetexpr . " []" + + " Try with an empty list + let l = [] + exe XfdoCmd + call assert_equal([], l) + + " Populate the list and then try + exe Xgetexpr . " ['non-error 1', 'Xtestfile1:1:3:Line1', 'Xtestfile1:2:1:Line2', 'non-error 2', 'Xtestfile2:2:2:Line2', 'non-error 3', 'Xtestfile3:2:3:Line2', 'Xtestfile3:3:1:Line3']" + + let l = [] + exe XfdoCmd + call assert_equal(['Xtestfile1 1L 3C', 'Xtestfile2 2L 2C', 'Xtestfile3 2L 3C'], l) + + " Run command only on selected error lines + let l = [] + exe "2,3" . XfdoCmd + call assert_equal(['Xtestfile2 2L 2C', 'Xtestfile3 2L 3C'], l) + + " Boundary condition tests + let l = [] + exe "3" . XfdoCmd + call assert_equal(['Xtestfile3 2L 3C'], l) + + " Range test commands + let l = [] + exe "%" . XfdoCmd + call assert_equal(['Xtestfile1 1L 3C', 'Xtestfile2 2L 2C', 'Xtestfile3 2L 3C'], l) + + let l = [] + exe "1,$" . XfdoCmd + call assert_equal(['Xtestfile1 1L 3C', 'Xtestfile2 2L 2C', 'Xtestfile3 2L 3C'], l) + + let l = [] + exe Xpfile + exe "." . XfdoCmd + call assert_equal(['Xtestfile2 2L 2C'], l) + + " List with only one valid entry + let l = [] + exe Xgetexpr . " ['Xtestfile2:2:5:Line2']" + exe XfdoCmd + call assert_equal(['Xtestfile2 2L 5C'], l) + + endfunction + ]=]) + end) + + after_each(function() + os.remove('Xtestfile1') + os.remove('Xtestfile2') + os.remove('Xtestfile3') + end) + + it('works for :cdo', function() + -- call('XdoTests', 'c') + feed(":call XdoTests('c')<CR><C-l>") + expected_empty() + end) + + it('works for :cfdo', function() + -- call('XfdoTests', 'c') + feed(":call XfdoTests('c')<CR><C-l>") + expected_empty() + end) + + it('works for :ldo', function() + -- call('XdoTests', 'l') + feed(":call XdoTests('l')<CR><C-l>") + expected_empty() + end) + + it('works for :lfdo', function() + -- call('XfdoTests', 'l') + feed(":call XfdoTests('l')<CR><C-l>") + expected_empty() + end) +end) diff --git a/test/functional/legacy/mapping_spec.lua b/test/functional/legacy/mapping_spec.lua index 3f86ec60de..a0d19926cb 100644 --- a/test/functional/legacy/mapping_spec.lua +++ b/test/functional/legacy/mapping_spec.lua @@ -84,6 +84,23 @@ describe('mapping', function() +]]) end) + it('feedkeys', function() + insert([[ + a b c d + a b c d + ]]) + + -- Vim's issue #212 (feedkeys insert mapping at current position) + execute('nnoremap . :call feedkeys(".", "in")<cr>') + feed('/^a b<cr>') + feed('0qqdw.ifoo<esc>qj0@q<esc>') + execute('unmap .') + expect([[ + fooc d + fooc d + ]]) + end) + it('i_CTRL-G_U', function() -- <c-g>U<cursor> works only within a single line execute('imapclear') diff --git a/test/functional/ui/mouse_spec.lua b/test/functional/ui/mouse_spec.lua index 30f37a7463..b3992c4a89 100644 --- a/test/functional/ui/mouse_spec.lua +++ b/test/functional/ui/mouse_spec.lua @@ -14,6 +14,7 @@ describe('Mouse input', function() before_each(function() clear() nvim('set_option', 'mouse', 'a') + nvim('set_option', 'listchars', 'eol:$') -- set mouset to very high value to ensure that even in valgrind/travis, -- nvim will still pick multiple clicks nvim('set_option', 'mouset', 5000) diff --git a/test/includes/pre/sys/fcntl.h b/test/includes/pre/fcntl.h index 767c97a631..9c50ed5b1d 100644 --- a/test/includes/pre/sys/fcntl.h +++ b/test/includes/pre/fcntl.h @@ -1,4 +1,4 @@ -#include <sys/fcntl.h> +#include <fcntl.h> static const mode_t kO_RDONLY = O_RDONLY; static const mode_t kO_WRONLY = O_WRONLY; diff --git a/test/unit/os/env_spec.lua b/test/unit/os/env_spec.lua index e0e12a24f2..9e00a3e8f8 100644 --- a/test/unit/os/env_spec.lua +++ b/test/unit/os/env_spec.lua @@ -148,8 +148,8 @@ describe('env function', function() local name = 'NEOVIM_UNIT_TEST_EXPAND_ENV_ESCN' local value = 'NEOVIM_UNIT_TEST_EXPAND_ENV_ESCV' os_setenv(name, value, 1) - -- TODO(bobtwinkles) This only tests UNIX expansions. There should be a - -- test for windows as well + -- TODO(bobtwinkles) This only tests Unix expansions. There should be a + -- test for Windows as well local input1 = to_cstr('$NEOVIM_UNIT_TEST_EXPAND_ENV_ESCN/test') local input2 = to_cstr('${NEOVIM_UNIT_TEST_EXPAND_ENV_ESCN}/test') local output_buff1 = cstr(255, '') diff --git a/test/unit/os/fs_spec.lua b/test/unit/os/fs_spec.lua index 95c98f18a1..2f393d353d 100644 --- a/test/unit/os/fs_spec.lua +++ b/test/unit/os/fs_spec.lua @@ -22,7 +22,7 @@ cimport('./src/nvim/main.h') cimport('./src/nvim/fileio.h') local fs = cimport('./src/nvim/os/os.h') cppimport('sys/stat.h') -cppimport('sys/fcntl.h') +cppimport('fcntl.h') cppimport('uv-errno.h') local buffer = "" diff --git a/third-party/CMakeLists.txt b/third-party/CMakeLists.txt index de421365c4..d7bb620236 100644 --- a/third-party/CMakeLists.txt +++ b/third-party/CMakeLists.txt @@ -55,7 +55,7 @@ endif() # Cross compiling: use these for dependencies built for the # HOST system, when not crosscompiling these should be the -# same as DEPS_*. Except when targeting UNIX in which case +# same as DEPS_*. Except when targeting Unix in which case # want all the dependencies to use the same compiler. if(CMAKE_CROSSCOMPILING AND NOT UNIX) set(HOSTDEPS_INSTALL_DIR "${CMAKE_BINARY_DIR}/host") diff --git a/third-party/cmake/BuildMsgpack.cmake b/third-party/cmake/BuildMsgpack.cmake index f0d5fab676..4b6b361e85 100644 --- a/third-party/cmake/BuildMsgpack.cmake +++ b/third-party/cmake/BuildMsgpack.cmake @@ -53,7 +53,7 @@ if(MINGW AND CMAKE_CROSSCOMPILING) # Hack to avoid -rdynamic in Mingw -DCMAKE_SHARED_LIBRARY_LINK_C_FLAGS="") elseif(MSVC) - # Same as UNIX without fPIC + # Same as Unix without fPIC set(MSGPACK_CONFIGURE_COMMAND ${CMAKE_COMMAND} ${DEPS_BUILD_DIR}/src/msgpack -DMSGPACK_ENABLE_CXX=OFF -DMSGPACK_BUILD_TESTS=OFF |