aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt3
-rw-r--r--Makefile4
-rwxr-xr-xclint.py257
-rw-r--r--cmake/FindLibUV.cmake21
-rw-r--r--cmake/FindLuaJit.cmake2
-rw-r--r--runtime/autoload/getscript.vim667
-rw-r--r--runtime/autoload/remote/host.vim17
-rw-r--r--runtime/autoload/tutor.vim7
-rw-r--r--runtime/doc/help.txt1
-rw-r--r--runtime/doc/options.txt5
-rw-r--r--runtime/doc/pi_getscript.txt482
-rw-r--r--runtime/doc/usr_05.txt1
-rw-r--r--runtime/doc/usr_21.txt4
-rw-r--r--runtime/doc/usr_41.txt2
-rw-r--r--runtime/ftplugin/tutor.vim3
-rw-r--r--runtime/plugin/getscriptPlugin.vim41
-rw-r--r--runtime/tutor/en/vim-01-beginner.tutor10
-rw-r--r--src/nvim/ascii.h7
-rw-r--r--src/nvim/buffer.c14
-rw-r--r--src/nvim/edit.c8
-rw-r--r--src/nvim/eval.c9
-rw-r--r--src/nvim/ex_cmds.c8
-rw-r--r--src/nvim/ex_cmds2.c8
-rw-r--r--src/nvim/ex_cmds_defs.h6
-rw-r--r--src/nvim/ex_docmd.c17
-rw-r--r--src/nvim/ex_eval.c8
-rw-r--r--src/nvim/ex_getln.c10
-rw-r--r--src/nvim/fileio.c19
-rw-r--r--src/nvim/fold.c9
-rw-r--r--src/nvim/getchar.c8
-rw-r--r--src/nvim/globals.h60
-rw-r--r--src/nvim/hardcopy.c8
-rw-r--r--src/nvim/if_cscope.c3
-rw-r--r--src/nvim/keymap.c2
-rw-r--r--src/nvim/keymap.h7
-rw-r--r--src/nvim/log.c2
-rw-r--r--src/nvim/macros.h11
-rw-r--r--src/nvim/main.c10
-rw-r--r--src/nvim/mark.c8
-rw-r--r--src/nvim/mbyte.c9
-rw-r--r--src/nvim/memfile.c8
-rw-r--r--src/nvim/memline.c8
-rw-r--r--src/nvim/menu.c10
-rw-r--r--src/nvim/message.c8
-rw-r--r--src/nvim/misc1.c8
-rw-r--r--src/nvim/misc2.c10
-rw-r--r--src/nvim/move.c7
-rw-r--r--src/nvim/normal.c7
-rw-r--r--src/nvim/ops.c8
-rw-r--r--src/nvim/option.c8
-rw-r--r--src/nvim/os/env.c21
-rw-r--r--src/nvim/os/os_defs.h26
-rw-r--r--src/nvim/os/signal.c12
-rw-r--r--src/nvim/os/unix_defs.h18
-rw-r--r--src/nvim/os/win_defs.h11
-rw-r--r--src/nvim/os_unix.c8
-rw-r--r--src/nvim/path.c4
-rw-r--r--src/nvim/popupmnu.c2
-rw-r--r--src/nvim/quickfix.c8
-rw-r--r--src/nvim/regexp_nfa.c7
-rw-r--r--src/nvim/screen.c8
-rw-r--r--src/nvim/search.c7
-rw-r--r--src/nvim/shada.c307
-rw-r--r--src/nvim/spell.c6
-rw-r--r--src/nvim/strings.c1
-rw-r--r--src/nvim/syntax.c8
-rw-r--r--src/nvim/tag.c8
-rw-r--r--src/nvim/types.h7
-rw-r--r--src/nvim/undo.c74
-rw-r--r--src/nvim/version.c8
-rw-r--r--src/nvim/vim.h7
-rw-r--r--src/nvim/window.c8
-rw-r--r--test/functional/plugin/shada_spec.lua5
-rw-r--r--third-party/cmake/BuildLuarocks.cmake2
74 files changed, 582 insertions, 1851 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 0633744e97..f06d060560 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -53,8 +53,7 @@ endif()
# - If not in a git repo (e.g. a tarball) these tokens set the version string.
set(NVIM_VERSION_MAJOR 0)
set(NVIM_VERSION_MINOR 1)
-set(NVIM_VERSION_PATCH 0)
-set(NVIM_VERSION_PRERELEASE "-dev")
+set(NVIM_VERSION_PATCH 1)
file(TO_CMAKE_PATH ${CMAKE_CURRENT_LIST_DIR}/.git FORCED_GIT_DIR)
include(GetGitRevisionDescription)
diff --git a/Makefile b/Makefile
index 343307eb2b..1fc15e1312 100644
--- a/Makefile
+++ b/Makefile
@@ -89,14 +89,14 @@ functionaltest: | nvim
testlint: | nvim
$(BUILD_CMD) -C build testlint
-test: functionaltest
-
unittest: | nvim
+$(BUILD_CMD) -C build unittest
benchmark: | nvim
+$(BUILD_CMD) -C build benchmark
+test: functionaltest unittest
+
clean:
+test -d build && $(BUILD_CMD) -C build clean || true
$(MAKE) -C src/nvim/testdir clean
diff --git a/clint.py b/clint.py
index 0eaab6e3f6..d507837e58 100755
--- a/clint.py
+++ b/clint.py
@@ -198,6 +198,8 @@ _ERROR_CATEGORIES = [
'runtime/printf',
'runtime/printf_format',
'runtime/threadsafe_fn',
+ 'syntax/parenthesis',
+ 'whitespace/alignment',
'whitespace/blank_line',
'whitespace/braces',
'whitespace/comma',
@@ -213,7 +215,7 @@ _ERROR_CATEGORIES = [
'whitespace/parens',
'whitespace/semicolon',
'whitespace/tab',
- 'whitespace/todo'
+ 'whitespace/todo',
]
# The default state of the category filter. This is overrided by the --filter=
@@ -826,9 +828,9 @@ def Error(filename, linenum, category, confidence, message):
_RE_PATTERN_CLEANSE_LINE_ESCAPES = re.compile(
r'\\([abfnrtv?"\\\']|\d+|x[0-9a-fA-F]+)')
# Matches strings. Escape codes should already be removed by ESCAPES.
-_RE_PATTERN_CLEANSE_LINE_DOUBLE_QUOTES = re.compile(r'"[^"]*"')
+_RE_PATTERN_CLEANSE_LINE_DOUBLE_QUOTES = re.compile(r'"([^"]*)"')
# Matches characters. Escape codes should already be removed by ESCAPES.
-_RE_PATTERN_CLEANSE_LINE_SINGLE_QUOTES = re.compile(r"'.'")
+_RE_PATTERN_CLEANSE_LINE_SINGLE_QUOTES = re.compile(r"'(.)'")
# Matches multi-line C++ comments.
# This RE is a little bit more complicated than one might expect, because we
# have to take care of space removals tools so we can handle comments inside
@@ -923,39 +925,48 @@ def CleanseComments(line):
class CleansedLines(object):
- """Holds 3 copies of all lines with different preprocessing applied to them.
+ """Holds 5 copies of all lines with different preprocessing applied to them.
1) elided member contains lines without strings and comments,
2) lines member contains lines without comments, and
- 3) raw_lines member contains all the lines without processing.
+ 3) raw_lines member contains all the lines with multiline comments replaced.
+ 4) init_lines member contains all the lines without processing.
+ 5) elided_with_space_strings is like elided, but with string literals
+ looking like `" "`.
All these three members are of <type 'list'>, and of the same length.
"""
- def __init__(self, lines):
+ def __init__(self, lines, init_lines):
self.elided = []
self.lines = []
self.raw_lines = lines
self.num_lines = len(lines)
+ self.init_lines = init_lines
self.lines_without_raw_strings = lines
+ self.elided_with_space_strings = []
for linenum in range(len(self.lines_without_raw_strings)):
self.lines.append(CleanseComments(
self.lines_without_raw_strings[linenum]))
elided = self._CollapseStrings(
self.lines_without_raw_strings[linenum])
self.elided.append(CleanseComments(elided))
+ elided = CleanseComments(self._CollapseStrings(
+ self.lines_without_raw_strings[linenum], True))
+ self.elided_with_space_strings.append(elided)
def NumLines(self):
"""Returns the number of lines represented."""
return self.num_lines
@staticmethod
- def _CollapseStrings(elided):
+ def _CollapseStrings(elided, keep_spaces=False):
"""Collapses strings and chars on a line to simple "" or '' blocks.
We nix strings first so we're not fooled by text like '"http://"'
Args:
elided: The line being processed.
+ keep_spaces: If true, collapse to
Returns:
The line with collapsed strings.
@@ -964,12 +975,75 @@ class CleansedLines(object):
# Remove escaped characters first to make quote/single quote
# collapsing basic. Things that look like escaped characters
# shouldn't occur outside of strings and chars.
- elided = _RE_PATTERN_CLEANSE_LINE_ESCAPES.sub('', elided)
- elided = _RE_PATTERN_CLEANSE_LINE_SINGLE_QUOTES.sub("''", elided)
- elided = _RE_PATTERN_CLEANSE_LINE_DOUBLE_QUOTES.sub('""', elided)
+ elided = _RE_PATTERN_CLEANSE_LINE_ESCAPES.sub(
+ '' if not keep_spaces else lambda m: ' ' * len(m.group(0)),
+ elided)
+ elided = _RE_PATTERN_CLEANSE_LINE_SINGLE_QUOTES.sub(
+ "''" if not keep_spaces
+ else lambda m: "'" + (' ' * len(m.group(1))) + "'",
+ elided)
+ elided = _RE_PATTERN_CLEANSE_LINE_DOUBLE_QUOTES.sub(
+ '""' if not keep_spaces
+ else lambda m: '"' + (' ' * len(m.group(1))) + '"',
+ elided)
return elided
+BRACES = {
+ '(': ')',
+ '{': '}',
+ '[': ']',
+ # '<': '>', C++-specific pair removed
+}
+
+
+CLOSING_BRACES = dict(((v, k) for k, v in BRACES.items()))
+
+
+def GetExprBracesPosition(clean_lines, linenum, pos):
+ """List positions of all kinds of braces
+
+ If input points to ( or { or [ then function proceeds until finding the
+ position which closes it.
+
+ Args:
+ clean_lines: A CleansedLines instance containing the file.
+ linenum: Current line number.
+ pos: A position on the line.
+
+ Yields:
+ A tuple (linenum, pos, brace, depth) that points to each brace.
+ Additionally each new line (linenum, pos, 's', depth) is yielded, for each
+ line end (linenum, pos, 'e', depth) is yielded and at the very end it
+ yields (linenum, pos, None, None).
+ """
+ depth = 0
+ yielded_line_start = True
+ startpos = pos
+ while linenum < clean_lines.NumLines() - 1:
+ line = clean_lines.elided_with_space_strings[linenum]
+ if not line.startswith('#') or yielded_line_start:
+ # Ignore #ifdefs, but not if it is macros that are checked
+ for i, brace in enumerate(line[startpos:]):
+ pos = i + startpos
+ if brace != ' ' and not yielded_line_start:
+ yield (linenum, pos, 's', depth)
+ yielded_line_start = True
+ if brace in BRACES:
+ depth += 1
+ yield (linenum, pos, brace, depth)
+ elif brace in CLOSING_BRACES:
+ yield (linenum, pos, brace, depth)
+ depth -= 1
+ if depth == 0:
+ yield (linenum, pos, None, None)
+ return
+ yield (linenum, len(line) - 1, 'e', depth)
+ yielded_line_start = False
+ startpos = 0
+ linenum += 1
+
+
def FindEndOfExpressionInLine(line, startpos, depth, startchar, endchar):
"""Find the position just after the matching endchar.
@@ -995,9 +1069,9 @@ def FindEndOfExpressionInLine(line, startpos, depth, startchar, endchar):
def CloseExpression(clean_lines, linenum, pos):
- """If input points to ( or { or [ or <, finds the position that closes it.
+ """If input points to ( or { or [, finds the position that closes it.
- If lines[linenum][pos] points to a '(' or '{' or '[' or '<', finds the
+ If lines[linenum][pos] points to a '(' or '{' or '[', finds the
linenum/pos that correspond to the closing of the expression.
Args:
@@ -1014,16 +1088,9 @@ def CloseExpression(clean_lines, linenum, pos):
line = clean_lines.elided[linenum]
startchar = line[pos]
- if startchar not in '({[<':
+ if startchar not in BRACES:
return (line, clean_lines.NumLines(), -1)
- if startchar == '(':
- endchar = ')'
- if startchar == '[':
- endchar = ']'
- if startchar == '{':
- endchar = '}'
- if startchar == '<':
- endchar = '>'
+ endchar = BRACES[startchar]
# Check first line
(end_pos, num_open) = FindEndOfExpressionInLine(
@@ -1300,6 +1367,23 @@ def CheckForMultilineCommentsAndStrings(filename, clean_lines, linenum, error):
'Use C++11 raw strings or concatenation instead.')
+def CheckForOldStyleComments(filename, line, linenum, error):
+ """Logs an error if we see /*-style comment
+
+ Args:
+ filename: The name of the current file.
+ line: The text of the line to check.
+ linenum: The number of the line to check.
+ error: The function to call with any errors found.
+ """
+ if line.find('/*') >= 0 and line[-1] != '\\':
+ error(filename, linenum, 'readability/old_style_comment', 5,
+ '/*-style comment found, it should be replaced with //-style. '
+ '/*-style comments are only allowed inside macros. '
+ 'Note that you should not use /*-style comments to document '
+ 'macros itself, use doxygen-style comments for this.')
+
+
threading_list = (
('asctime(', 'os_asctime_r('),
('ctime(', 'os_ctime_r('),
@@ -1968,6 +2052,92 @@ def FindPreviousMatchingAngleBracket(clean_lines, linenum, init_prefix):
return False
+def CheckExpressionAlignment(filename, clean_lines, linenum, error, startpos=0):
+ """Checks for the correctness of alignment inside expressions
+
+ Args:
+ filename: The name of the current file.
+ clean_lines: A CleansedLines instance containing the file.
+ linenum: The number of the line to check.
+ error: The function to call with any errors found.
+ startpos: Position where to start searching for expression start.
+ """
+ level_starts = {}
+ line = clean_lines.elided_with_space_strings[linenum]
+ prev_line_start = Search(r'\S', line).start()
+ depth_line_starts = {}
+ pos = min([
+ idx
+ for idx in (
+ line.find(k, startpos)
+ for k in BRACES
+ if k != '{'
+ )
+ if idx >= 0
+ ] + [len(line) + 1])
+ if pos == len(line) + 1:
+ return
+ ignore_error_levels = set()
+ firstlinenum = linenum
+ for linenum, pos, brace, depth in GetExprBracesPosition(
+ clean_lines, linenum, pos
+ ):
+ line = clean_lines.elided_with_space_strings[linenum]
+ if depth is None:
+ if pos < len(line) - 1:
+ CheckExpressionAlignment(filename, clean_lines, linenum, error,
+ pos + 1)
+ return
+ elif depth <= 0:
+ error(filename, linenum, 'syntax/parenthesis', 4,
+ 'Unbalanced parenthesis')
+ return
+ if brace == 's':
+ assert firstlinenum != linenum
+ if level_starts[depth][1]:
+ if line[pos] == BRACES[depth_line_starts[depth][1]]:
+ if pos != depth_line_starts[depth][0]:
+ if depth not in ignore_error_levels:
+ error(filename, linenum, 'whitespace/indent', 2,
+ 'End of the inner expression should have '
+ 'the same indent as start')
+ else:
+ if (pos != depth_line_starts[depth][0] + 4
+ and not (depth_line_starts[depth][1] == '{'
+ and pos == depth_line_starts[depth][0] + 2)):
+ if depth not in ignore_error_levels:
+ error(filename, linenum, 'whitespace/indent', 2,
+ 'Inner expression indentation should be 4')
+ else:
+ if (pos != level_starts[depth][0] + 1
+ + (level_starts[depth][2] == '{')):
+ if depth not in ignore_error_levels:
+ error(filename, linenum, 'whitespace/alignment', 2,
+ 'Inner expression should be aligned '
+ 'as opening brace + 1 (+ 2 in case of {)')
+ prev_line_start = pos
+ elif brace == 'e':
+ pass
+ else:
+ opening = brace in BRACES
+ if opening:
+ # Only treat {} as part of the expression if it is preceded by
+ # "=" (brace initializer) or "(type)" (construct like (struct
+ # foo) { ... }).
+ if brace == '{' and not (Search(
+ r'(?:= *|\((?:struct )?\w+(\s*\[\w*\])?\)) *$',
+ line[:pos])
+ ):
+ ignore_error_levels.add(depth)
+ line_ended_with_opening = (
+ pos == len(line) - 2 * (line.endswith(' \\')) - 1)
+ level_starts[depth] = (pos, line_ended_with_opening, brace)
+ if line_ended_with_opening:
+ depth_line_starts[depth] = (prev_line_start, brace)
+ else:
+ del level_starts[depth]
+
+
def CheckSpacing(filename, clean_lines, linenum, nesting_state, error):
"""Checks for the correctness of various spacing issues in the code.
@@ -1975,7 +2145,8 @@ def CheckSpacing(filename, clean_lines, linenum, nesting_state, error):
if/for/while/switch, no spaces around parens in function calls, two
spaces between code and comment, don't start a block with a blank
line, don't end a function with a blank line, don't add a blank line
- after public/protected/private, don't have too many blank lines in a row.
+ after public/protected/private, don't have too many blank lines in a row,
+ spaces after {, spaces before }.
Args:
filename: The name of the current file.
@@ -2236,6 +2407,10 @@ def CheckSpacing(filename, clean_lines, linenum, nesting_state, error):
# Next we will look for issues with function calls.
CheckSpacingForFunctionCall(filename, line, linenum, error)
+ # Check whether everything inside expressions is aligned correctly
+ if any((line.find(k) >= 0 for k in BRACES if k != '{')):
+ CheckExpressionAlignment(filename, clean_lines, linenum, error)
+
# Except after an opening paren, or after another opening brace (in case of
# an initializer list, for instance), you should have spaces before your
# braces. And since you should never have braces at the beginning of a line,
@@ -2292,8 +2467,6 @@ def CheckSpacing(filename, clean_lines, linenum, nesting_state, error):
'Extra space before [')
# You shouldn't have a space before a semicolon at the end of the line.
- # There's a special case for "for" since the style guide allows space before
- # the semicolon there.
if Search(r':\s*;\s*$', line):
error(filename, linenum, 'whitespace/semicolon', 5,
'Semicolon defining empty statement. Use {} instead.')
@@ -2301,12 +2474,18 @@ def CheckSpacing(filename, clean_lines, linenum, nesting_state, error):
error(filename, linenum, 'whitespace/semicolon', 5,
'Line contains only semicolon. If this should be an empty'
' statement, use {} instead.')
- elif (Search(r'\s+;\s*$', line) and
- not Search(r'\bfor\b', line)):
+ elif Search(r'\s+;\s*$', line):
error(filename, linenum, 'whitespace/semicolon', 5,
'Extra space before last semicolon. If this should be an empty '
'statement, use {} instead.')
+ if Search(r'\{(?!\})\S', line):
+ error(filename, linenum, 'whitespace/braces', 5,
+ 'Missing space after {')
+ if Search(r'\S(?<!\{)\}', line):
+ error(filename, linenum, 'whitespace/braces', 5,
+ 'Missing space before }')
+
def GetPreviousNonBlankLine(clean_lines, linenum):
"""Return the most recent non-blank line and its line number.
@@ -2361,11 +2540,27 @@ def CheckBraces(filename, clean_lines, linenum, error):
' of the previous line')
# An else clause should be on the same line as the preceding closing brace.
+ # If there is no preceding closing brace, there should be one.
if Match(r'\s*else\s*', line):
prevline = GetPreviousNonBlankLine(clean_lines, linenum)[0]
if Match(r'\s*}\s*$', prevline):
error(filename, linenum, 'whitespace/newline', 4,
'An else should appear on the same line as the preceding }')
+ else:
+ error(filename, linenum, 'readability/braces', 5,
+ 'An else should always have braces before it')
+
+ # If should always have a brace
+ for blockstart in ('if', 'while', 'for'):
+ if Match(r'\s*{0}[^{{]*$'.format(blockstart), line):
+ pos = line.find(blockstart)
+ pos = line.find('(', pos)
+ if pos > 0:
+ (endline, _, endpos) = CloseExpression(
+ clean_lines, linenum, pos)
+ if endline[endpos:].find('{') == -1:
+ error(filename, linenum, 'readability/braces', 5,
+ '{0} should always use braces'.format(blockstart))
# If braces come on one side of an else, they should be on both.
# However, we have to worry about "else if" that spans multiple lines!
@@ -3026,12 +3221,14 @@ def ProcessLine(filename, file_extension, clean_lines, line,
arguments : filename, clean_lines, line, error
"""
raw_lines = clean_lines.raw_lines
+ init_lines = clean_lines.init_lines
ParseNolintSuppressions(filename, raw_lines[line], line, error)
nesting_state.Update(filename, clean_lines, line, error)
if nesting_state.stack and nesting_state.stack[-1].inline_asm != _NO_ASM:
return
CheckForFunctionLengths(filename, clean_lines, line, function_state, error)
CheckForMultilineCommentsAndStrings(filename, clean_lines, line, error)
+ CheckForOldStyleComments(filename, init_lines[line], line, error)
CheckStyle(
filename, clean_lines, line, file_extension, nesting_state, error)
CheckLanguage(filename, clean_lines, line, file_extension, include_state,
@@ -3072,12 +3269,12 @@ def ProcessFileData(filename, file_extension, lines, error,
for line in range(1, len(lines)):
ParseKnownErrorSuppressions(filename, lines, line)
- if _cpplint_state.record_errors_file:
- raw_lines = lines[:]
+ init_lines = lines[:]
+ if _cpplint_state.record_errors_file:
def RecordedError(filename, linenum, category, confidence, message):
if not IsErrorSuppressedByNolint(category, linenum):
- key = raw_lines[linenum - 1 if linenum else 0:linenum + 2]
+ key = init_lines[linenum - 1 if linenum else 0:linenum + 2]
err = [filename, key, category]
json.dump(err, _cpplint_state.record_errors_file)
_cpplint_state.record_errors_file.write('\n')
@@ -3089,7 +3286,7 @@ def ProcessFileData(filename, file_extension, lines, error,
CheckForHeaderGuard(filename, lines, error)
RemoveMultiLineComments(filename, lines, error)
- clean_lines = CleansedLines(lines)
+ clean_lines = CleansedLines(lines, init_lines)
for line in range(clean_lines.NumLines()):
ProcessLine(filename, file_extension, clean_lines, line,
include_state, function_state, nesting_state, error,
diff --git a/cmake/FindLibUV.cmake b/cmake/FindLibUV.cmake
index 8542100e67..dcdd5e48b7 100644
--- a/cmake/FindLibUV.cmake
+++ b/cmake/FindLibUV.cmake
@@ -59,11 +59,6 @@ if(HAVE_LIBDL)
list(APPEND LIBUV_LIBRARIES dl)
endif()
-check_library_exists(iphlpapi GetAdaptersAddresses "iphlpapi.h" HAVE_LIBIPHLPAPI)
-if(HAVE_LIBIPHLPAPI)
- list(APPEND LIBUV_LIBRARIES iphlpapi)
-endif()
-
check_library_exists(kstat kstat_lookup "kstat.h" HAVE_LIBKSTAT)
if(HAVE_LIBKSTAT)
list(APPEND LIBUV_LIBRARIES kstat)
@@ -84,11 +79,6 @@ if(HAVE_LIBPERFSTAT)
list(APPEND LIBUV_LIBRARIES perfstat)
endif()
-check_library_exists(psapi GetProcessMemoryInfo "psapi.h" HAVE_LIBPSAPI)
-if(HAVE_LIBPSAPI)
- list(APPEND LIBUV_LIBRARIES psapi)
-endif()
-
check_library_exists(rt clock_gettime "time.h" HAVE_LIBRT)
if(HAVE_LIBRT)
list(APPEND LIBUV_LIBRARIES rt)
@@ -99,13 +89,12 @@ if(HAVE_LIBSENDFILE)
list(APPEND LIBUV_LIBRARIES sendfile)
endif()
-check_library_exists(userenv GetUserProfileDirectoryW "userenv.h" HAVE_LIBUSERENV)
-if(HAVE_LIBUSERENV)
+if(WIN32)
+ # check_library_exists() does not work for Win32 API calls in X86 due to name
+ # mangling calling conventions
+ list(APPEND LIBUV_LIBRARIES iphlpapi)
+ list(APPEND LIBUV_LIBRARIES psapi)
list(APPEND LIBUV_LIBRARIES userenv)
-endif()
-
-check_library_exists(ws2_32 WSAStartup "winsock2.h" HAVE_LIBWS232)
-if(HAVE_LIBWS232)
list(APPEND LIBUV_LIBRARIES ws2_32)
endif()
diff --git a/cmake/FindLuaJit.cmake b/cmake/FindLuaJit.cmake
index 59642d11b9..e9ff53ab62 100644
--- a/cmake/FindLuaJit.cmake
+++ b/cmake/FindLuaJit.cmake
@@ -34,7 +34,7 @@ endif()
if(MSVC)
list(APPEND LUAJIT_NAMES lua51)
elseif(MINGW)
- list(APPEND LUAJIT_NAMES libluajit)
+ list(APPEND LUAJIT_NAMES libluajit libluajit-5.1)
else()
list(APPEND LUAJIT_NAMES luajit-5.1)
endif()
diff --git a/runtime/autoload/getscript.vim b/runtime/autoload/getscript.vim
deleted file mode 100644
index d50bc2edc0..0000000000
--- a/runtime/autoload/getscript.vim
+++ /dev/null
@@ -1,667 +0,0 @@
-" ---------------------------------------------------------------------
-" getscript.vim
-" Author: Charles E. Campbell
-" Date: Jan 21, 2014
-" Version: 36
-" Installing: :help glvs-install
-" Usage: :help glvs
-"
-" GetLatestVimScripts: 642 1 :AutoInstall: getscript.vim
-"redraw!|call inputsave()|call input("Press <cr> to continue")|call inputrestore()
-" ---------------------------------------------------------------------
-" Initialization: {{{1
-" if you're sourcing this file, surely you can't be
-" expecting vim to be in its vi-compatible mode!
-if exists("g:loaded_getscript")
- finish
-endif
-let g:loaded_getscript= "v36"
-if &cp
- echoerr "GetLatestVimScripts is not vi-compatible; not loaded (you need to set nocp)"
- finish
-endif
-if v:version < 702
- echohl WarningMsg
- echo "***warning*** this version of getscript needs vim 7.2"
- echohl Normal
- finish
-endif
-let s:keepcpo = &cpo
-set cpo&vim
-"DechoTabOn
-
-" ---------------------------
-" Global Variables: {{{1
-" ---------------------------
-" Cygwin Detection ------- {{{2
-if !exists("g:getscript_cygwin")
- if has("win32") || has("win95") || has("win64") || has("win16")
- if &shell =~ '\%(\<bash\>\|\<zsh\>\)\%(\.exe\)\=$'
- let g:getscript_cygwin= 1
- else
- let g:getscript_cygwin= 0
- endif
- else
- let g:getscript_cygwin= 0
- endif
-endif
-
-" wget vs curl {{{2
-if !exists("g:GetLatestVimScripts_wget")
- if executable("wget")
- let g:GetLatestVimScripts_wget= "wget"
- elseif executable("curl")
- let g:GetLatestVimScripts_wget= "curl"
- else
- let g:GetLatestVimScripts_wget = 'echo "GetLatestVimScripts needs wget or curl"'
- let g:GetLatestVimScripts_options = ""
- endif
-endif
-
-" options that wget and curl require:
-if !exists("g:GetLatestVimScripts_options")
- if g:GetLatestVimScripts_wget == "wget"
- let g:GetLatestVimScripts_options= "-q -O"
- elseif g:GetLatestVimScripts_wget == "curl"
- let g:GetLatestVimScripts_options= "-s -O"
- else
- let g:GetLatestVimScripts_options= ""
- endif
-endif
-
-" by default, allow autoinstall lines to work
-if !exists("g:GetLatestVimScripts_allowautoinstall")
- let g:GetLatestVimScripts_allowautoinstall= 1
-endif
-
-" set up default scriptaddr address
-if !exists("g:GetLatestVimScripts_scriptaddr")
- let g:GetLatestVimScripts_scriptaddr = 'http://vim.sourceforge.net/script.php?script_id='
-endif
-
-"" For debugging:
-"let g:GetLatestVimScripts_wget = "echo"
-"let g:GetLatestVimScripts_options = "options"
-
-" ---------------------------------------------------------------------
-" Check If AutoInstall Capable: {{{1
-let s:autoinstall= ""
-if g:GetLatestVimScripts_allowautoinstall
-
- if (has("win32") || has("gui_win32") || has("gui_win32s") || has("win16") || has("win64") || has("win32unix") || has("win95")) && &shell != "bash"
- " windows (but not cygwin/bash)
- let s:dotvim= "vimfiles"
- if !exists("g:GetLatestVimScripts_mv")
- let g:GetLatestVimScripts_mv= "ren"
- endif
-
- else
- " unix
- let s:dotvim= ".vim"
- if !exists("g:GetLatestVimScripts_mv")
- let g:GetLatestVimScripts_mv= "mv"
- endif
- endif
-
- if exists("g:GetLatestVimScripts_autoinstalldir") && isdirectory(g:GetLatestVimScripts_autoinstalldir)
- let s:autoinstall= g:GetLatestVimScripts_autoinstalldir"
- elseif exists('$HOME') && isdirectory(expand("$HOME")."/".s:dotvim)
- let s:autoinstall= $HOME."/".s:dotvim
- endif
-" call Decho("s:autoinstall<".s:autoinstall.">")
-"else "Decho
-" call Decho("g:GetLatestVimScripts_allowautoinstall=".g:GetLatestVimScripts_allowautoinstall.": :AutoInstall: disabled")
-endif
-
-" ---------------------------------------------------------------------
-" Public Interface: {{{1
-com! -nargs=0 GetLatestVimScripts call getscript#GetLatestVimScripts()
-com! -nargs=0 GetScript call getscript#GetLatestVimScripts()
-silent! com -nargs=0 GLVS call getscript#GetLatestVimScripts()
-
-" ---------------------------------------------------------------------
-" GetLatestVimScripts: this function gets the latest versions of {{{1
-" scripts based on the list in
-" (first dir in runtimepath)/GetLatest/GetLatestVimScripts.dat
-fun! getscript#GetLatestVimScripts()
-" call Dfunc("GetLatestVimScripts() autoinstall<".s:autoinstall.">")
-
-" insure that wget is executable
- if executable(g:GetLatestVimScripts_wget) != 1
- echoerr "GetLatestVimScripts needs ".g:GetLatestVimScripts_wget." which apparently is not available on your system"
-" call Dret("GetLatestVimScripts : wget not executable/availble")
- return
- endif
-
- " insure that fnameescape() is available
- if !exists("*fnameescape")
- echoerr "GetLatestVimScripts needs fnameescape() (provided by 7.1.299 or later)"
- return
- endif
-
- " Find the .../GetLatest subdirectory under the runtimepath
- for datadir in split(&rtp,',') + ['']
- if isdirectory(datadir."/GetLatest")
-" call Decho("found directory<".datadir.">")
- let datadir= datadir . "/GetLatest"
- break
- endif
- if filereadable(datadir."GetLatestVimScripts.dat")
-" call Decho("found ".datadir."/GetLatestVimScripts.dat")
- break
- endif
- endfor
-
- " Sanity checks: readability and writability
- if datadir == ""
- echoerr 'Missing "GetLatest/" on your runtimepath - see :help glvs-dist-install'
-" call Dret("GetLatestVimScripts : unable to find a GetLatest subdirectory")
- return
- endif
- if filewritable(datadir) != 2
- echoerr "(getLatestVimScripts) Your ".datadir." isn't writable"
-" call Dret("GetLatestVimScripts : non-writable directory<".datadir.">")
- return
- endif
- let datafile= datadir."/GetLatestVimScripts.dat"
- if !filereadable(datafile)
- echoerr "Your data file<".datafile."> isn't readable"
-" call Dret("GetLatestVimScripts : non-readable datafile<".datafile.">")
- return
- endif
- if !filewritable(datafile)
- echoerr "Your data file<".datafile."> isn't writable"
-" call Dret("GetLatestVimScripts : non-writable datafile<".datafile.">")
- return
- endif
- " --------------------
- " Passed sanity checks
- " --------------------
-
-" call Decho("datadir <".datadir.">")
-" call Decho("datafile <".datafile.">")
-
- " don't let any event handlers interfere (like winmanager's, taglist's, etc)
- let eikeep = &ei
- let hlskeep = &hls
- let acdkeep = &acd
- set ei=all hls&vim noacd
-
- " Edit the datafile (ie. GetLatestVimScripts.dat):
- " 1. record current directory (origdir),
- " 2. change directory to datadir,
- " 3. split window
- " 4. edit datafile
- let origdir= getcwd()
-" call Decho("exe cd ".fnameescape(substitute(datadir,'\','/','ge')))
- exe "cd ".fnameescape(substitute(datadir,'\','/','ge'))
- split
-" call Decho("exe e ".fnameescape(substitute(datafile,'\','/','ge')))
- exe "e ".fnameescape(substitute(datafile,'\','/','ge'))
- res 1000
- let s:downloads = 0
- let s:downerrors= 0
-
- " Check on dependencies mentioned in plugins
-" call Decho(" ")
-" call Decho("searching plugins for GetLatestVimScripts dependencies")
- let lastline = line("$")
-" call Decho("lastline#".lastline)
- let firstdir = substitute(&rtp,',.*$','','')
- let plugins = split(globpath(firstdir,"plugin/**/*.vim"),'\n')
- let plugins = plugins + split(globpath(firstdir,"AsNeeded/**/*.vim"),'\n')
- let foundscript = 0
-
- " this loop updates the GetLatestVimScripts.dat file
- " with dependencies explicitly mentioned in the plugins
- " via GetLatestVimScripts: ... lines
- " It reads the plugin script at the end of the GetLatestVimScripts.dat
- " file, examines it, and then removes it.
- for plugin in plugins
-" call Decho(" ")
-" call Decho("plugin<".plugin.">")
-
- " read plugin in
- " evidently a :r creates a new buffer (the "#" buffer) that is subsequently unused -- bwiping it
- $
-" call Decho(".dependency checking<".plugin."> line$=".line("$"))
-" call Decho("..exe silent r ".fnameescape(plugin))
- exe "silent r ".fnameescape(plugin)
- exe "silent bwipe ".bufnr("#")
-
- while search('^"\s\+GetLatestVimScripts:\s\+\d\+\s\+\d\+','W') != 0
- let depscript = substitute(getline("."),'^"\s\+GetLatestVimScripts:\s\+\d\+\s\+\d\+\s\+\(.*\)$','\1','e')
- let depscriptid = substitute(getline("."),'^"\s\+GetLatestVimScripts:\s\+\(\d\+\)\s\+.*$','\1','')
- let llp1 = lastline+1
-" call Decho("..depscript<".depscript.">")
-
- " found a "GetLatestVimScripts: # #" line in the script;
- " check if its already in the datafile by searching backwards from llp1,
- " the (prior to reading in the plugin script) last line plus one of the GetLatestVimScripts.dat file,
- " for the script-id with no wrapping allowed.
- let curline = line(".")
- let noai_script = substitute(depscript,'\s*:AutoInstall:\s*','','e')
- exe llp1
- let srchline = search('^\s*'.depscriptid.'\s\+\d\+\s\+.*$','bW')
- if srchline == 0
- " this second search is taken when, for example, a 0 0 scriptname is to be skipped over
- let srchline= search('\<'.noai_script.'\>','bW')
- endif
-" call Decho("..noai_script<".noai_script."> depscriptid#".depscriptid." srchline#".srchline." curline#".line(".")." lastline#".lastline)
-
- if srchline == 0
- " found a new script to permanently include in the datafile
- let keep_rega = @a
- let @a = substitute(getline(curline),'^"\s\+GetLatestVimScripts:\s\+','','')
- echomsg "Appending <".@a."> to ".datafile." for ".depscript
-" call Decho("..Appending <".@a."> to ".datafile." for ".depscript)
- exe lastline."put a"
- let @a = keep_rega
- let lastline = llp1
- let curline = curline + 1
- let foundscript = foundscript + 1
-" else " Decho
-" call Decho("..found <".noai_script."> (already in datafile at line#".srchline.")")
- endif
-
- let curline = curline + 1
- exe curline
- endwhile
-
- " llp1: last line plus one
- let llp1= lastline + 1
-" call Decho(".deleting lines: ".llp1.",$d")
- exe "silent! ".llp1.",$d"
- endfor
-" call Decho("--- end dependency checking loop --- foundscript=".foundscript)
-" call Decho(" ")
-" call Dredir("BUFFER TEST (GetLatestVimScripts 1)","ls!")
-
- if foundscript == 0
- setlocal nomod
- endif
-
- " --------------------------------------------------------------------
- " Check on out-of-date scripts using GetLatest/GetLatestVimScripts.dat
- " --------------------------------------------------------------------
-" call Decho("begin: checking out-of-date scripts using datafile<".datafile.">")
- setlocal lz
- 1
-" /^-----/,$g/^\s*\d/call Decho(getline("."))
- 1
- /^-----/,$g/^\s*\d/call s:GetOneScript()
-" call Decho("--- end out-of-date checking --- ")
-
- " Final report (an echomsg)
- try
- silent! ?^-------?
- catch /^Vim\%((\a\+)\)\=:E114/
-" call Dret("GetLatestVimScripts : nothing done!")
- return
- endtry
- exe "norm! kz\<CR>"
- redraw!
- let s:msg = ""
- if s:downloads == 1
- let s:msg = "Downloaded one updated script to <".datadir.">"
- elseif s:downloads == 2
- let s:msg= "Downloaded two updated scripts to <".datadir.">"
- elseif s:downloads > 1
- let s:msg= "Downloaded ".s:downloads." updated scripts to <".datadir.">"
- else
- let s:msg= "Everything was already current"
- endif
- if s:downerrors > 0
- let s:msg= s:msg." (".s:downerrors." downloading errors)"
- endif
- echomsg s:msg
- " save the file
- if &mod
- silent! w!
- endif
- q!
-
- " restore events and current directory
- exe "cd ".fnameescape(substitute(origdir,'\','/','ge'))
- let &ei = eikeep
- let &hls = hlskeep
- let &acd = acdkeep
- setlocal nolz
-" call Dredir("BUFFER TEST (GetLatestVimScripts 2)","ls!")
-" call Dret("GetLatestVimScripts : did ".s:downloads." downloads")
-endfun
-
-" ---------------------------------------------------------------------
-" GetOneScript: (Get Latest Vim Script) this function operates {{{1
-" on the current line, interpreting two numbers and text as
-" ScriptID, SourceID, and Filename.
-" It downloads any scripts that have newer versions from vim.sourceforge.net.
-fun! s:GetOneScript(...)
-" call Dfunc("GetOneScript()")
-
- " set options to allow progress to be shown on screen
- let rega= @a
- let t_ti= &t_ti
- let t_te= &t_te
- let rs = &rs
- set t_ti= t_te= nors
-
- " put current line on top-of-screen and interpret it into
- " a script identifer : used to obtain webpage
- " source identifier : used to identify current version
- " and an associated comment: used to report on what's being considered
- if a:0 >= 3
- let scriptid = a:1
- let srcid = a:2
- let fname = a:3
- let cmmnt = ""
-" call Decho("scriptid<".scriptid.">")
-" call Decho("srcid <".srcid.">")
-" call Decho("fname <".fname.">")
- else
- let curline = getline(".")
- if curline =~ '^\s*#'
- let @a= rega
-" call Dret("GetOneScript : skipping a pure comment line")
- return
- endif
- let parsepat = '^\s*\(\d\+\)\s\+\(\d\+\)\s\+\(.\{-}\)\(\s*#.*\)\=$'
- try
- let scriptid = substitute(curline,parsepat,'\1','e')
- catch /^Vim\%((\a\+)\)\=:E486/
- let scriptid= 0
- endtry
- try
- let srcid = substitute(curline,parsepat,'\2','e')
- catch /^Vim\%((\a\+)\)\=:E486/
- let srcid= 0
- endtry
- try
- let fname= substitute(curline,parsepat,'\3','e')
- catch /^Vim\%((\a\+)\)\=:E486/
- let fname= ""
- endtry
- try
- let cmmnt= substitute(curline,parsepat,'\4','e')
- catch /^Vim\%((\a\+)\)\=:E486/
- let cmmnt= ""
- endtry
-" call Decho("curline <".curline.">")
-" call Decho("parsepat<".parsepat.">")
-" call Decho("scriptid<".scriptid.">")
-" call Decho("srcid <".srcid.">")
-" call Decho("fname <".fname.">")
- endif
-
- " plugin author protection from downloading his/her own scripts atop their latest work
- if scriptid == 0 || srcid == 0
- " When looking for :AutoInstall: lines, skip scripts that have 0 0 scriptname
- let @a= rega
-" call Dret("GetOneScript : skipping a scriptid==srcid==0 line")
- return
- endif
-
- let doautoinstall= 0
- if fname =~ ":AutoInstall:"
-" call Decho("case AutoInstall: fname<".fname.">")
- let aicmmnt= substitute(fname,'\s\+:AutoInstall:\s\+',' ','')
-" call Decho("aicmmnt<".aicmmnt."> s:autoinstall=".s:autoinstall)
- if s:autoinstall != ""
- let doautoinstall = g:GetLatestVimScripts_allowautoinstall
- endif
- else
- let aicmmnt= fname
- endif
-" call Decho("aicmmnt<".aicmmnt.">: doautoinstall=".doautoinstall)
-
- exe "norm z\<CR>"
- redraw!
-" call Decho('considering <'.aicmmnt.'> scriptid='.scriptid.' srcid='.srcid)
- echo 'considering <'.aicmmnt.'> scriptid='.scriptid.' srcid='.srcid
-
- " grab a copy of the plugin's vim.sourceforge.net webpage
- let scriptaddr = g:GetLatestVimScripts_scriptaddr.scriptid
- let tmpfile = tempname()
- let v:errmsg = ""
-
- " make up to three tries at downloading the description
- let itry= 1
- while itry <= 3
-" call Decho(".try#".itry." to download description of <".aicmmnt."> with addr=".scriptaddr)
- if has("win32") || has("win16") || has("win95")
-" call Decho(".new|exe silent r!".g:GetLatestVimScripts_wget." ".g:GetLatestVimScripts_options." ".shellescape(tmpfile).' '.shellescape(scriptaddr)."|bw!")
- new|exe "silent r!".g:GetLatestVimScripts_wget." ".g:GetLatestVimScripts_options." ".shellescape(tmpfile).' '.shellescape(scriptaddr)|bw!
- else
-" call Decho(".exe silent !".g:GetLatestVimScripts_wget." ".g:GetLatestVimScripts_options." ".shellescape(tmpfile)." ".shellescape(scriptaddr))
- exe "silent !".g:GetLatestVimScripts_wget." ".g:GetLatestVimScripts_options." ".shellescape(tmpfile)." ".shellescape(scriptaddr)
- endif
- if itry == 1
- exe "silent vsplit ".fnameescape(tmpfile)
- else
- silent! e %
- endif
- setlocal bh=wipe
-
- " find the latest source-id in the plugin's webpage
- silent! 1
- let findpkg= search('Click on the package to download','W')
- if findpkg > 0
- break
- endif
- let itry= itry + 1
- endwhile
-" call Decho(" --- end downloading tries while loop --- itry=".itry)
-
- " testing: did finding "Click on the package..." fail?
- if findpkg == 0 || itry >= 4
- silent q!
- call delete(tmpfile)
- " restore options
- let &t_ti = t_ti
- let &t_te = t_te
- let &rs = rs
- let s:downerrors = s:downerrors + 1
-" call Decho("***warning*** couldn'".'t find "Click on the package..." in description page for <'.aicmmnt.">")
- echomsg "***warning*** couldn'".'t find "Click on the package..." in description page for <'.aicmmnt.">"
-" call Dret("GetOneScript : srch for /Click on the package/ failed")
- let @a= rega
- return
- endif
-" call Decho('found "Click on the package to download"')
-
- let findsrcid= search('src_id=','W')
- if findsrcid == 0
- silent q!
- call delete(tmpfile)
- " restore options
- let &t_ti = t_ti
- let &t_te = t_te
- let &rs = rs
- let s:downerrors = s:downerrors + 1
-" call Decho("***warning*** couldn'".'t find "src_id=" in description page for <'.aicmmnt.">")
- echomsg "***warning*** couldn'".'t find "src_id=" in description page for <'.aicmmnt.">"
- let @a= rega
-" call Dret("GetOneScript : srch for /src_id/ failed")
- return
- endif
-" call Decho('found "src_id=" in description page')
-
- let srcidpat = '^\s*<td class.*src_id=\(\d\+\)">\([^<]\+\)<.*$'
- let latestsrcid= substitute(getline("."),srcidpat,'\1','')
- let sname = substitute(getline("."),srcidpat,'\2','') " script name actually downloaded
-" call Decho("srcidpat<".srcidpat."> latestsrcid<".latestsrcid."> sname<".sname.">")
- silent q!
- call delete(tmpfile)
-
- " convert the strings-of-numbers into numbers
- let srcid = srcid + 0
- let latestsrcid = latestsrcid + 0
-" call Decho("srcid=".srcid." latestsrcid=".latestsrcid." sname<".sname.">")
-
- " has the plugin's most-recent srcid increased, which indicates that it has been updated
- if latestsrcid > srcid
-" call Decho("[latestsrcid=".latestsrcid."] <= [srcid=".srcid."]: need to update <".sname.">")
-
- let s:downloads= s:downloads + 1
- if sname == bufname("%")
- " GetLatestVimScript has to be careful about downloading itself
- let sname= "NEW_".sname
- endif
-
- " -----------------------------------------------------------------------------
- " the plugin has been updated since we last obtained it, so download a new copy
- " -----------------------------------------------------------------------------
-" call Decho(".downloading new <".sname.">")
- echomsg ".downloading new <".sname.">"
- if has("win32") || has("win16") || has("win95")
-" call Decho(".new|exe silent r!".g:GetLatestVimScripts_wget." ".g:GetLatestVimScripts_options." ".shellescape(sname)." ".shellescape('http://vim.sourceforge.net/scripts/download_script.php?src_id='.latestsrcid)."|q")
- new|exe "silent r!".g:GetLatestVimScripts_wget." ".g:GetLatestVimScripts_options." ".shellescape(sname)." ".shellescape('http://vim.sourceforge.net/scripts/download_script.php?src_id='.latestsrcid)|q
- else
-" call Decho(".exe silent !".g:GetLatestVimScripts_wget." ".g:GetLatestVimScripts_options." ".shellescape(sname)." ".shellescape('http://vim.sourceforge.net/scripts/download_script.php?src_id='))
- exe "silent !".g:GetLatestVimScripts_wget." ".g:GetLatestVimScripts_options." ".shellescape(sname)." ".shellescape('http://vim.sourceforge.net/scripts/download_script.php?src_id=').latestsrcid
- endif
-
- " --------------------------------------------------------------------------
- " AutoInstall: only if doautoinstall has been requested by the plugin itself
- " --------------------------------------------------------------------------
-" call Decho("checking if plugin requested autoinstall: doautoinstall=".doautoinstall)
- if doautoinstall
-" call Decho(" ")
-" call Decho("Autoinstall: getcwd<".getcwd()."> filereadable(".sname.")=".filereadable(sname))
- if filereadable(sname)
-" call Decho("<".sname."> is readable")
-" call Decho("exe silent !".g:GetLatestVimScripts_mv." ".shellescape(sname)." ".shellescape(s:autoinstall))
- exe "silent !".g:GetLatestVimScripts_mv." ".shellescape(sname)." ".shellescape(s:autoinstall)
- let curdir = fnameescape(substitute(getcwd(),'\','/','ge'))
- let installdir= curdir."/Installed"
- if !isdirectory(installdir)
- call mkdir(installdir)
- endif
-" call Decho("curdir<".curdir."> installdir<".installdir.">")
-" call Decho("exe cd ".fnameescape(s:autoinstall))
- exe "cd ".fnameescape(s:autoinstall)
-
- " determine target directory for moves
- let firstdir= substitute(&rtp,',.*$','','')
- let pname = substitute(sname,'\..*','.vim','')
-" call Decho("determine tgtdir: is <".firstdir.'/AsNeeded/'.pname." readable?")
- if filereadable(firstdir.'/AsNeeded/'.pname)
- let tgtdir= "AsNeeded"
- else
- let tgtdir= "plugin"
- endif
-" call Decho("tgtdir<".tgtdir."> pname<".pname.">")
-
- " decompress
- if sname =~ '\.bz2$'
-" call Decho("decompress: attempt to bunzip2 ".sname)
- exe "sil !bunzip2 ".shellescape(sname)
- let sname= substitute(sname,'\.bz2$','','')
-" call Decho("decompress: new sname<".sname."> after bunzip2")
- elseif sname =~ '\.gz$'
-" call Decho("decompress: attempt to gunzip ".sname)
- exe "sil !gunzip ".shellescape(sname)
- let sname= substitute(sname,'\.gz$','','')
-" call Decho("decompress: new sname<".sname."> after gunzip")
- elseif sname =~ '\.xz$'
-" call Decho("decompress: attempt to unxz ".sname)
- exe "sil !unxz ".shellescape(sname)
- let sname= substitute(sname,'\.xz$','','')
-" call Decho("decompress: new sname<".sname."> after unxz")
- else
-" call Decho("no decompression needed")
- endif
-
- " distribute archive(.zip, .tar, .vba, ...) contents
- if sname =~ '\.zip$'
-" call Decho("dearchive: attempt to unzip ".sname)
- exe "silent !unzip -o ".shellescape(sname)
- elseif sname =~ '\.tar$'
-" call Decho("dearchive: attempt to untar ".sname)
- exe "silent !tar -xvf ".shellescape(sname)
- elseif sname =~ '\.tgz$'
-" call Decho("dearchive: attempt to untar+gunzip ".sname)
- exe "silent !tar -zxvf ".shellescape(sname)
- elseif sname =~ '\.taz$'
-" call Decho("dearchive: attempt to untar+uncompress ".sname)
- exe "silent !tar -Zxvf ".shellescape(sname)
- elseif sname =~ '\.tbz$'
-" call Decho("dearchive: attempt to untar+bunzip2 ".sname)
- exe "silent !tar -jxvf ".shellescape(sname)
- elseif sname =~ '\.txz$'
-" call Decho("dearchive: attempt to untar+xz ".sname)
- exe "silent !tar -Jxvf ".shellescape(sname)
- elseif sname =~ '\.vba$'
-" call Decho("dearchive: attempt to handle a vimball: ".sname)
- silent 1split
- if exists("g:vimball_home")
- let oldvimballhome= g:vimball_home
- endif
- let g:vimball_home= s:autoinstall
- exe "silent e ".fnameescape(sname)
- silent so %
- silent q
- if exists("oldvimballhome")
- let g:vimball_home= oldvimballhome
- else
- unlet g:vimball_home
- endif
- else
-" call Decho("no dearchiving needed")
- endif
-
- " ---------------------------------------------
- " move plugin to plugin/ or AsNeeded/ directory
- " ---------------------------------------------
- if sname =~ '.vim$'
-" call Decho("dearchive: attempt to simply move ".sname." to ".tgtdir)
- exe "silent !".g:GetLatestVimScripts_mv." ".shellescape(sname)." ".tgtdir
- else
-" call Decho("dearchive: move <".sname."> to installdir<".installdir.">")
- exe "silent !".g:GetLatestVimScripts_mv." ".shellescape(sname)." ".installdir
- endif
- if tgtdir != "plugin"
-" call Decho("exe silent !".g:GetLatestVimScripts_mv." plugin/".shellescape(pname)." ".tgtdir)
- exe "silent !".g:GetLatestVimScripts_mv." plugin/".shellescape(pname)." ".tgtdir
- endif
-
- " helptags step
- let docdir= substitute(&rtp,',.*','','e')."/doc"
-" call Decho("helptags: docdir<".docdir.">")
- exe "helptags ".fnameescape(docdir)
- exe "cd ".fnameescape(curdir)
- endif
- if fname !~ ':AutoInstall:'
- let modline=scriptid." ".latestsrcid." :AutoInstall: ".fname.cmmnt
- else
- let modline=scriptid." ".latestsrcid." ".fname.cmmnt
- endif
- else
- let modline=scriptid." ".latestsrcid." ".fname.cmmnt
- endif
-
- " update the data in the <GetLatestVimScripts.dat> file
- call setline(line("."),modline)
-" call Decho("update data in ".expand("%")."#".line(".").": modline<".modline.">")
-" else " Decho
-" call Decho("[latestsrcid=".latestsrcid."] <= [srcid=".srcid."], no need to update")
- endif
-
- " restore options
- let &t_ti = t_ti
- let &t_te = t_te
- let &rs = rs
- let @a = rega
-" call Dredir("BUFFER TEST (GetOneScript)","ls!")
-
-" call Dret("GetOneScript")
-endfun
-
-" ---------------------------------------------------------------------
-" Restore Options: {{{1
-let &cpo= s:keepcpo
-unlet s:keepcpo
-
-" ---------------------------------------------------------------------
-" Modelines: {{{1
-" vim: ts=8 sts=2 fdm=marker nowrap
diff --git a/runtime/autoload/remote/host.vim b/runtime/autoload/remote/host.vim
index afbf136861..d04dea180c 100644
--- a/runtime/autoload/remote/host.vim
+++ b/runtime/autoload/remote/host.vim
@@ -168,10 +168,15 @@ function! s:UpdateRemotePlugins()
let hosts = keys(s:hosts)
for host in hosts
if has_key(s:plugin_patterns, host)
- let commands = commands
- \ + ['" '.host.' plugins']
- \ + s:RegistrationCommands(host)
- \ + ['', '']
+ try
+ let commands +=
+ \ ['" '.host.' plugins']
+ \ + s:RegistrationCommands(host)
+ \ + ['', '']
+ catch
+ echomsg v:throwpoint
+ echomsg v:exception
+ endtry
endif
endfor
call writefile(commands, s:remote_plugins_manifest)
@@ -212,9 +217,11 @@ function! s:RequirePythonHost(host)
return channel_id
endif
catch
+ echomsg v:throwpoint
echomsg v:exception
endtry
- throw 'Failed to load Python host. You can try to see what happened '.
+ throw 'Failed to load '. a:host.orig_name . ' host. '.
+ \ 'You can try to see what happened '.
\ 'by starting Neovim with the environment variable '.
\ '$NVIM_PYTHON_LOG_FILE set to a file and opening '.
\ 'the generated log file. Also, the host stderr will be available '.
diff --git a/runtime/autoload/tutor.vim b/runtime/autoload/tutor.vim
index d2881f7f34..4d5a10a97c 100644
--- a/runtime/autoload/tutor.vim
+++ b/runtime/autoload/tutor.vim
@@ -2,6 +2,12 @@
" Setup: {{{1
function! tutor#SetupVim()
+ if &columns < 90
+ set columns=90
+ endif
+ if !exists('g:did_load_ftplugin') || g:did_load_ftplugin != 1
+ filetype plugin on
+ endif
if has('syntax')
if !exists('g:syntax_on') || g:syntax_on == 0
syntax on
@@ -336,6 +342,7 @@ function! tutor#TutorCmd(tutor_name)
let l:to_open = l:tutors[l:tutor_to_open-1]
endif
+ call tutor#SetupVim()
exe "edit ".l:to_open
endfunction
diff --git a/runtime/doc/help.txt b/runtime/doc/help.txt
index bb19805a20..766a440cb3 100644
--- a/runtime/doc/help.txt
+++ b/runtime/doc/help.txt
@@ -162,7 +162,6 @@ Remarks about specific systems ~
|os_win32.txt| MS-Windows
*standard-plugin-list*
Standard plugins ~
-|pi_getscript.txt| Downloading latest version of Vim scripts
|pi_gzip.txt| Reading and writing compressed files
|pi_netrw.txt| Reading and writing files over a network
|pi_paren.txt| Highlight matching parens
diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt
index bbf3da8de7..70a585654e 100644
--- a/runtime/doc/options.txt
+++ b/runtime/doc/options.txt
@@ -1561,8 +1561,7 @@ A jump table for the options with a short description can be found at |Q_op|.
1 Each block of concealed text is replaced with one
character. If the syntax item does not have a custom
replacement character defined (see |:syn-cchar|) the
- character defined in 'listchars' is used (default is a
- space).
+ character defined in 'listchars' is used.
It is highlighted with the "Conceal" highlight group.
2 Concealed text is completely hidden unless it has a
custom replacement character defined (see
@@ -4076,7 +4075,7 @@ A jump table for the options with a short description can be found at |Q_op|.
visible in the first column.
*lcs-conceal*
conceal:c Character to show in place of concealed text, when
- 'conceallevel' is set to 1.
+ 'conceallevel' is set to 1. A space when omitted.
*lcs-nbsp*
nbsp:c Character to show for a non-breakable space (character
0xA0, 160). Left blank when omitted.
diff --git a/runtime/doc/pi_getscript.txt b/runtime/doc/pi_getscript.txt
deleted file mode 100644
index 628d9b74e5..0000000000
--- a/runtime/doc/pi_getscript.txt
+++ /dev/null
@@ -1,482 +0,0 @@
-*pi_getscript.txt* For Vim version 7.0. Last change: 2013 Nov 29
->
- GETSCRIPT REFERENCE MANUAL by Charles E. Campbell
-<
-Authors: Charles E. Campbell <NdrOchip@ScampbellPfamilyA.Mbiz>
- (remove NOSPAM from the email address)
- *GetLatestVimScripts-copyright*
-Copyright: (c) 2004-2012 by Charles E. Campbell *glvs-copyright*
- The VIM LICENSE (see |copyright|) applies to the files in this
- package, including getscriptPlugin.vim, getscript.vim,
- GetLatestVimScripts.dist, and pi_getscript.txt, except use "getscript"
- instead of "VIM". Like anything else that's free, getscript and its
- associated files are provided *as is* and comes with no warranty of
- any kind, either expressed or implied. No guarantees of
- merchantability. No guarantees of suitability for any purpose. By
- using this plugin, you agree that in no event will the copyright
- holder be liable for any damages resulting from the use of this
- software. Use at your own risk!
-
-Getscript is a plugin that simplifies retrieval of the latest versions of the
-scripts that you yourself use! Typing |:GLVS| will invoke getscript; it will
-then use the <GetLatestVimScripts.dat> (see |GetLatestVimScripts_dat|) file to
-get the latest versions of scripts listed therein from http://vim.sf.net/.
-
-==============================================================================
-1. Contents *glvs-contents* *glvs* *getscript*
- *GetLatestVimScripts*
-
- 1. Contents........................................: |glvs-contents|
- 2. GetLatestVimScripts -- Getting Started..........: |glvs-install|
- 3. GetLatestVimScripts Usage.......................: |glvs-usage|
- 4. GetLatestVimScripts Data File...................: |glvs-data|
- 5. GetLatestVimScripts Friendly Plugins............: |glvs-plugins|
- 6. GetLatestVimScripts AutoInstall.................: |glvs-autoinstall|
- 7. GetLatestViMScripts Options.....................: |glvs-options|
- 8. GetLatestVimScripts Algorithm...................: |glvs-alg|
- 9. GetLatestVimScripts History.....................: |glvs-hist|
-
-
-==============================================================================
-2. GetLatestVimScripts -- Getting Started *getscript-start*
- *getlatestvimscripts-install*
-
- VERSION FROM VIM DISTRIBUTION *glvs-dist-install*
-
-Vim 7.0 does not include the GetLatestVimScripts.dist file which
-serves as an example and a template. So, you'll need to create
-your own! See |GetLatestVimScripts_dat|.
-
- VERSION FROM VIM SF NET *glvs-install*
-
-NOTE: The last step, that of renaming/moving the GetLatestVimScripts.dist
-file, is for those who have just downloaded GetLatestVimScripts.tar.bz2 for
-the first time.
-
-The GetLatestVimScripts.dist file serves as an example and a template for your
-own personal list. Feel free to remove all the scripts mentioned within it;
-the "important" part of it is the first two lines.
-
-Your computer needs to have wget or curl for GetLatestVimScripts to do its work.
-
- 1. if compressed: gunzip getscript.vba.gz
- 2. Unix:
- vim getscript.vba
- :so %
- :q
- cd ~/.vim/GetLatest
- mv GetLatestVimScripts.dist GetLatestVimScripts.dat
- (edit GetLatestVimScripts.dat to install your own personal
- list of desired plugins -- see |GetLatestVimScripts_dat|)
-
- 3. Windows:
- vim getscript.vba
- :so %
- :q
- cd **path-to-vimfiles**/GetLatest
- mv GetLatestVimScripts.dist GetLatestVimScripts.dat
- (edit GetLatestVimScripts.dat to install your own personal
- list of desired plugins -- see |GetLatestVimScripts_dat|)
-
-
-==============================================================================
-3. GetLatestVimScripts Usage *glvs-usage* *:GLVS*
-
-Unless it has been defined elsewhere, >
-
- :GLVS
-
-will invoke GetLatestVimScripts(). If some other plugin has defined that
-command, then you may type
->
- :GetLatestVimScripts
-<
-The script will attempt to update and, if permitted, will automatically
-install scripts from http://vim.sourceforge.net/. To do so it will peruse a
-file,
->
- .vim/GetLatest/GetLatestVimScripts.dat (unix)
-<
-or >
- ..wherever..\vimfiles\GetLatest\GetLatestVimScripts.dat (windows)
-(see |glvs-data|), and examine plugins in your [.vim|vimfiles]/plugin
-directory (see |glvs-plugins|).
-
-Scripts which have been downloaded will appear in the
-~/.vim/GetLatest (unix) or ..wherever..\vimfiles\GetLatest (windows)
-subdirectory. GetLatestVimScripts will attempt to automatically
-install them if you have the following line in your <.vimrc>: >
-
- let g:GetLatestVimScripts_allowautoinstall=1
-
-The <GetLatestVimScripts.dat> file will be automatically be updated to
-reflect the latest version of script(s) so downloaded.
-(also see |glvs-options|)
-
-
-==============================================================================
-4. GetLatestVimScripts Data File *getscript-data* *glvs-data*
- *:GetLatestVimScripts_dat*
-The data file <GetLatestVimScripts.dat> must have for its first two lines
-the following text:
->
- ScriptID SourceID Filename
- --------------------------
-<
-Following those two lines are three columns; the first two are numeric
-followed by a text column. The GetLatest/GetLatestVimScripts.dist file
-contains an example of such a data file. Anything following a #... is
-ignored, so you may embed comments in the file.
-
-The first number on each line gives the script's ScriptID. When you're about
-to use a web browser to look at scripts on http://vim.sf.net/, just before you
-click on the script's link, you'll see a line resembling
-
- http://vim.sourceforge.net/scripts/script.php?script_id=40
-
-The "40" happens to be a ScriptID that GetLatestVimScripts needs to
-download the associated page, and is assigned by vim.sf.net itself
-during initial uploading of the plugin.
-
-The second number on each line gives the script's SourceID. The SourceID
-records the count of uploaded scripts as determined by vim.sf.net; hence it
-serves to indicate "when" a script was uploaded. Setting the SourceID to 1
-insures that GetLatestVimScripts will assume that the script it has is
-out-of-date.
-
-The SourceID is extracted by GetLatestVimScripts from the script's page on
-vim.sf.net; whenever it is greater than the one stored in the
-GetLatestVimScripts.dat file, the script will be downloaded
-(see |GetLatestVimScripts_dat|).
-
-If your script's author has included a special comment line in his/her plugin,
-the plugin itself will be used by GetLatestVimScripts to build your
-<GetLatestVimScripts.dat> file, including any dependencies on other scripts it
-may have. As an example, consider: >
-
- " GetLatestVimScripts: 884 1 :AutoInstall: AutoAlign.vim
-
-This comment line tells getscript.vim to check vimscript #884 and that the
-script is automatically installable. Getscript will also use this line to
-help build the GetLatestVimScripts.dat file, by including a line such as: >
-
- 884 1 :AutoInstall: AutoAlign.vim
-<
-assuming that such a line isn't already in GetLatestVimScripts.dat file.
-See |glvs-plugins| for more. Thus, GetLatestVimScripts thus provides a
-comprehensive ability to keep your plugins up-to-date!
-
-In summary:
-
- * Optionally tell getscript that it is allowed to build/append a
- GetLatestVimScripts.dat file based upon already installed plugins: >
- let g:GetLatestVimScripts_allowautoinstall=1
-<
- * A line such as >
- " GetLatestVimScripts: 884 1 :AutoInstall: AutoAlign.vim
-< in an already-downloaded plugin constitutes the concurrence of the
- plugin author that getscript may do AutoInstall. Not all plugins
- may be AutoInstall-able, and the plugin's author is best situated
- to know whether or not his/her plugin will AutoInstall properly.
-
- * A line such as >
- 884 1 :AutoInstall: AutoAlign.vim
-< in your GetLatestVimScripts.dat file constitutes your permission
- to getscript to do AutoInstall. AutoInstall requires both your
- and the plugin author's permission. See |GetLatestVimScripts_dat|.
-
-
- *GetLatestVimScripts_dat*
-As an example of a <GetLatestVimScripts.dat> file:
->
- ScriptID SourceID Filename
- --------------------------
- 294 1 :AutoInstall: Align.vim
- 120 2 Decho.vim
- 40 3 DrawIt.tar.gz
- 451 4 EasyAccents.vim
- 195 5 engspchk.vim
- 642 6 GetLatestVimScripts.vim
- 489 7 Manpageview.vim
-<
-Note: the first two lines are required, but essentially act as comments.
-
-
-==============================================================================
-5. GetLatestVimScripts Friendly Plugins *getscript-plugins* *glvs-plugins*
-
- (this section is for plugin authors)~
-
-If a plugin author includes the following comment anywhere in their plugin,
-GetLatestVimScripts will find it and use it to automatically build the user's
-GetLatestVimScripts.dat files:
->
- src_id
- v
- " GetLatestVimScripts: ### ### yourscriptname
- ^
- scriptid
-<
-As an author, you should include such a line in to refer to your own script
-plus any additional lines describing any plugin dependencies it may have.
-Same format, of course!
-
-If your command is auto-installable (see |glvs-autoinstall|), and most scripts
-are, then you may include :AutoInstall: just before "yourscriptname":
->
- src_id
- v
- " GetLatestVimScripts: ### ### :AutoInstall: yourscriptname
- ^
- scriptid
-<
-NOTE: The :AutoInstall: feature requires both the plugin author's and~
- the user's permission to operate!~
-
-GetLatestVimScripts commands for those scripts are then appended, if not
-already present, to the user's GetLatest/GetLatestVimScripts.dat file. It is
-a relatively painless way to automate the acquisition of any scripts your
-plugins depend upon.
-
-Now, as an author, you probably don't want GetLatestVimScripts to download
-your own scripts atop your own copy, thereby overwriting your not-yet-released
-hard work. GetLatestVimScripts provides a solution for this: put
->
- 0 0 yourscriptname
-<
-into your <GetLatestVimScripts.dat> file and GetLatestVimScripts will skip
-examining the "yourscriptname" scripts for those GetLatestVimScripts comment
-lines. As a result, those lines won't be inadvertently installed into your
-<GetLatestVimScripts.dat> file and subsequently used to download your own
-scripts. This is especially important to do if you've included the
-:AutoInstall: option.
-
-Be certain to use the same "yourscriptname" in the "0 0 yourscriptname" line
-as you've used in your GetLatestVimScripts comment!
-
-
-==============================================================================
-6. GetLatestVimScripts AutoInstall *getscript-autoinstall*
- *glvs-autoinstall*
-
-GetLatestVimScripts now supports "AutoInstall". Not all scripts are
-supportive of auto-install, as they may have special things you need to do to
-install them (please refer to the script's "install" directions). On the
-other hand, most scripts will be auto-installable.
-
-To let GetLatestVimScripts do an autoinstall, the data file's comment field
-should begin with (surrounding blanks are ignored): >
-
- :AutoInstall:
-<
-Both colons are needed, and it should begin the comment (yourscriptname)
-field.
-
-One may prevent any autoinstalling by putting the following line in your
-<.vimrc>: >
-
- let g:GetLatestVimScripts_allowautoinstall= 0
-<
-With :AutoInstall: enabled, as it is by default, files which end with
-
- ---.tar.bz2 : decompressed & untarred in .vim/ directory
- ---.vba.bz2 : decompressed in .vim/ directory, then vimball handles it
- ---.vim.bz2 : decompressed & moved into .vim/plugin directory
- ---.tar.gz : decompressed & untarred in .vim/ directory
- ---.vba.gz : decompressed in .vim/ directory, then vimball handles it
- ---.vim.gz : decompressed & moved into .vim/plugin directory
- ---.vba : unzipped in .vim/ directory
- ---.vim : moved to .vim/plugin directory
- ---.zip : unzipped in .vim/ directory
-
-and which merely need to have their components placed by the untar/gunzip or
-move-to-plugin-directory process should be auto-installable. Vimballs, of
-course, should always be auto-installable.
-
-When is a script not auto-installable? Let me give an example:
-
- .vim/after/syntax/blockhl.vim
-
-The <blockhl.vim> script provides block highlighting for C/C++ programs; it is
-available at:
-
- http://vim.sourceforge.net/scripts/script.php?script_id=104
-
-Currently, vim's after/syntax only supports by-filetype scripts (in
-blockhl.vim's case, that's after/syntax/c.vim). Hence, auto-install would
-possibly overwrite the current user's after/syntax/c.vim file.
-
-In my own case, I use <aftersyntax.vim> (renamed to after/syntax/c.vim) to
-allow a after/syntax/c/ directory:
-
- http://vim.sourceforge.net/scripts/script.php?script_id=1023
-
-The script allows multiple syntax files to exist separately in the
-after/syntax/c subdirectory. I can't bundle aftersyntax.vim in and build an
-appropriate tarball for auto-install because of the potential for the
-after/syntax/c.vim contained in it to overwrite a user's c.vim.
-
-
-==============================================================================
-7. GetLatestVimScripts Options *glvs-options*
->
- g:GetLatestVimScripts_wget
-< default= "wget"
- This variable holds the name of the command for obtaining
- scripts.
->
- g:GetLatestVimScripts_options
-< default= "-q -O"
- This variable holds the options to be used with the
- g:GetLatestVimScripts_wget command.
->
- g:GetLatestVimScripts_allowautoinstall
-< default= 1
- This variable indicates whether GetLatestVimScripts is allowed
- to attempt to automatically install scripts. Furthermore, the
- plugin author has to have explicitly indicated that his/her
- plugin is automatically installable (via the :AutoInstall:
- keyword in the GetLatestVimScripts comment line).
->
- g:GetLatestVimScripts_autoinstalldir
-< default= $HOME/.vim (linux)
- default= $HOME/vimfiles (windows)
- Override where :AutoInstall: scripts will be installed.
- Doesn't override vimball installation.
->
- g:GetLatestVimScripts_scriptaddr
-< default='http://vim.sourceforge.net/script.php?script_id='
- Override this if your system needs
- ... ='http://vim.sourceforge.net/script/script.php?script_id='
-
-==============================================================================
-8. GetLatestVimScripts Algorithm *glvs-algorithm* *glvs-alg*
-
-The Vim sourceforge page dynamically creates a page by keying off of the
-so-called script-id. Within the webpage of
-
- http://vim.sourceforge.net/scripts/script.php?script_id=40
-
-is a line specifying the latest source-id (src_id). The source identifier
-numbers are always increasing, hence if the src_id is greater than the one
-recorded for the script in GetLatestVimScripts then it's time to download a
-newer copy of that script.
-
-GetLatestVimScripts will then download the script and update its internal
-database of script ids, source ids, and scriptnames.
-
-The AutoInstall process will:
-
- Move the file from GetLatest/ to the following directory
- Unix : $HOME/.vim
- Windows: $HOME\vimfiles
- if the downloaded file ends with ".bz2"
- bunzip2 it
- else if the downloaded file ends with ".gz"
- gunzip it
- if the resulting file ends with ".zip"
- unzip it
- else if the resulting file ends with ".tar"
- tar -oxvf it
- else if the resulting file ends with ".vim"
- move it to the plugin subdirectory
-
-
-==============================================================================
-9. GetLatestVimScripts History *getscript-history* *glvs-hist* {{{1
-
-v36 Apr 22, 2013 : * (glts) suggested use of plugin/**/*.vim instead of
- plugin/*.vim in globpath() call.
- * (Andy Wokula) got warning message when setting
- g:loaded_getscriptPlugin
-v35 Apr 07, 2012 : * (MengHuan Yu) pointed out that the script url has
- changed (somewhat). However, it doesn't work, and
- the original one does (under Linux). I'll make it
- yet-another-option.
-v34 Jun 23, 2011 : * handles additional decompression options for tarballs
- (tgz taz tbz txz)
-v33 May 31, 2011 : * using fnameescape() instead of escape()
- * *.xz support
-v32 Jun 19, 2010 : * (Jan Steffens) added support for xz compression
-v31 Jun 29, 2008 : * (Bill McCarthy) fixed having hls enabled with getscript
- * (David Schaefer) the acd option interferes with vimballs
- Solution: bypass the acd option
-v30 Jun 13, 2008 : * GLVS now checks for existence of fnameescape() and will
- issue an error message if it is not supported
-v29 Jan 07, 2008 : * Bram M pointed out that cpo is a global option and that
- getscriptPlugin.vim was setting it but not restoring it.
-v28 Jan 02, 2008 : * improved shell quoting character handling, cygwin
- interface, register-a bypass
- Oct 29, 2007 * Bill McCarthy suggested a change to getscript that avoids
- creating pop-up windows
-v24 Apr 16, 2007 : * removed save&restore of the fo option during script
- loading
-v23 Nov 03, 2006 : * ignores comments (#...)
- * handles vimballs
-v22 Oct 13, 2006 : * supports automatic use of curl if wget is not
- available
-v21 May 01, 2006 : * now takes advantage of autoloading.
-v20 Dec 23, 2005 : * Eric Haarbauer found&fixed a bug with unzip use;
- unzip needs the -o flag to overwrite.
-v19 Nov 28, 2005 : * v18's GetLatestVimScript line accessed the wrong
- script! Fixed.
-v18 Mar 21, 2005 : * bugfix to automatic database construction
- * bugfix - nowrapscan caused an error
- (tnx to David Green for the fix)
- Apr 01, 2005 * if shell is bash, "mv" instead of "ren" used in
- :AutoInstall:s, even though its o/s is windows
- Apr 01, 2005 * when downloading errors occurred, GLVS was
- terminating early. It now just goes on to trying
- the next script (after trying three times to
- download a script description page)
- Apr 20, 2005 * bugfix - when a failure to download occurred,
- GetLatestVimScripts would stop early and claim that
- everything was current. Fixed.
-v17 Aug 25, 2004 : * g:GetLatestVimScripts_allowautoinstall, which
- defaults to 1, can be used to prevent all
- :AutoInstall:
-v16 Aug 25, 2004 : * made execution of bunzip2/gunzip/tar/zip silent
- * fixed bug with :AutoInstall: use of helptags
-v15 Aug 24, 2004 : * bugfix: the "0 0 comment" download prevention wasn't
- always preventing downloads (just usually). Fixed.
-v14 Aug 24, 2004 : * bugfix -- helptags was using dotvim, rather than
- s:dotvim. Fixed.
-v13 Aug 23, 2004 : * will skip downloading a file if its scriptid or srcid
- is zero. Useful for script authors; that way their
- own GetLatestVimScripts activity won't overwrite
- their scripts.
-v12 Aug 23, 2004 : * bugfix - a "return" got left in the distribution that
- was intended only for testing. Removed, now works.
- * :AutoInstall: implemented
-v11 Aug 20, 2004 : * GetLatestVimScripts is now a plugin:
- * :GetLatestVimScripts command
- * (runtimepath)/GetLatest/GetLatestVimScripts.dat
- now holds scripts that need updating
-v10 Apr 19, 2004 : * moved history from script to doc
-v9 Jan 23, 2004 : windows (win32/win16/win95) will use
- double quotes ("") whereas other systems will use
- single quotes ('') around the urls in calls via wget
-v8 Dec 01, 2003 : makes three tries at downloading
-v7 Sep 02, 2003 : added error messages if "Click on..." or "src_id="
- not found in downloaded webpage
- Uses t_ti, t_te, and rs to make progress visible
-v6 Aug 06, 2003 : final status messages now display summary of work
- ( "Downloaded someqty scripts" or
- "Everything was current")
- Now GetLatestVimScripts is careful about downloading
- GetLatestVimScripts.vim itself!
- (goes to <NEW_GetLatestVimScripts.vim>)
-v5 Aug 04, 2003 : missing an endif near bottom
-v4 Jun 17, 2003 : redraw! just before each "considering" message
-v3 May 27, 2003 : Protects downloaded files from errant shell
- expansions with single quotes: '...'
-v2 May 14, 2003 : extracts name of item to be obtained from the
- script file. Uses it instead of comment field
- for output filename; comment is used in the
- "considering..." line and is now just a comment!
- * Fixed a bug: a string-of-numbers is not the
- same as a number, so I added zero to them
- and they became numbers. Fixes comparison.
-
-==============================================================================
-vim:tw=78:ts=8:ft=help:fdm=marker
diff --git a/runtime/doc/usr_05.txt b/runtime/doc/usr_05.txt
index a130d84630..86fcf0cc2f 100644
--- a/runtime/doc/usr_05.txt
+++ b/runtime/doc/usr_05.txt
@@ -285,7 +285,6 @@ Where can you find plugins?
- You could write one yourself, see |write-plugin|.
Some plugins come as a vimball archive, see |vimball|.
-Some plugins can be updated automatically, see |getscript|.
USING A GLOBAL PLUGIN
diff --git a/runtime/doc/usr_21.txt b/runtime/doc/usr_21.txt
index bdff81ef69..f99c3263d0 100644
--- a/runtime/doc/usr_21.txt
+++ b/runtime/doc/usr_21.txt
@@ -70,9 +70,7 @@ difference. Without it executes the program normally, with the range a number
of text lines is filtered through the program.
Executing a whole row of programs this way is possible. But a shell is much
-better at it. You can start a new shell this way: >
-
- :shell
+better at it. You can start a new shell with |:terminal|.
This is similar to using CTRL-Z to suspend Vim. The difference is that a new
shell is started.
diff --git a/runtime/doc/usr_41.txt b/runtime/doc/usr_41.txt
index 705702c083..fe9d9b4d62 100644
--- a/runtime/doc/usr_41.txt
+++ b/runtime/doc/usr_41.txt
@@ -2465,8 +2465,6 @@ utility is recommended.
For utmost portability use Vim itself to pack scripts together. This can be
done with the Vimball utility. See |vimball|.
-It's good if you add a line to allow automatic updating. See |glvs-plugins|.
-
==============================================================================
Next chapter: |usr_42.txt| Add new menus
diff --git a/runtime/ftplugin/tutor.vim b/runtime/ftplugin/tutor.vim
index 0a28d7def4..1579753170 100644
--- a/runtime/ftplugin/tutor.vim
+++ b/runtime/ftplugin/tutor.vim
@@ -21,8 +21,9 @@ setlocal iskeyword=@,-,_
setlocal foldmethod=expr
setlocal foldexpr=tutor#TutorFolds()
-setlocal foldcolumn=3
+setlocal foldcolumn=1
setlocal foldlevel=4
+setlocal nowrap
setlocal statusline=%{toupper(expand('%:t:r'))}\ tutorial%=
setlocal statusline+=%{tutor#InfoText()}
diff --git a/runtime/plugin/getscriptPlugin.vim b/runtime/plugin/getscriptPlugin.vim
deleted file mode 100644
index fb0fbeab7b..0000000000
--- a/runtime/plugin/getscriptPlugin.vim
+++ /dev/null
@@ -1,41 +0,0 @@
-" ---------------------------------------------------------------------
-" getscriptPlugin.vim
-" Author: Charles E. Campbell
-" Date: Nov 29, 2013
-" Installing: :help glvs-install
-" Usage: :help glvs
-"
-" GetLatestVimScripts: 642 1 :AutoInstall: getscript.vim
-"
-" (Rom 15:11 WEB) Again, "Praise the Lord, all you Gentiles! Let
-" all the peoples praise Him."
-" ---------------------------------------------------------------------
-" Initialization: {{{1
-" if you're sourcing this file, surely you can't be
-" expecting vim to be in its vi-compatible mode
-if exists("g:loaded_getscriptPlugin")
- finish
-endif
-if &cp
- if &verbose
- echo "GetLatestVimScripts is not vi-compatible; not loaded (you need to set nocp)"
- endif
- finish
-endif
-let g:loaded_getscriptPlugin = "v36"
-let s:keepcpo = &cpo
-set cpo&vim
-
-" ---------------------------------------------------------------------
-" Public Interface: {{{1
-com! -nargs=0 GetLatestVimScripts call getscript#GetLatestVimScripts()
-com! -nargs=0 GetScripts call getscript#GetLatestVimScripts()
-silent! com -nargs=0 GLVS call getscript#GetLatestVimScripts()
-
-" ---------------------------------------------------------------------
-" Restore Options: {{{1
-let &cpo= s:keepcpo
-unlet s:keepcpo
-
-" ---------------------------------------------------------------------
-" vim: ts=8 sts=2 fdm=marker nowrap
diff --git a/runtime/tutor/en/vim-01-beginner.tutor b/runtime/tutor/en/vim-01-beginner.tutor
index f791e727e7..47d4ed06a1 100644
--- a/runtime/tutor/en/vim-01-beginner.tutor
+++ b/runtime/tutor/en/vim-01-beginner.tutor
@@ -7,6 +7,12 @@ IMPORTANT to remember that this tutor is set up to teach by use. That means
that you need to do the exercises to learn them properly. If you only read
the text, you will soon forget what is most important!
+For now, make sure that your Shift-Lock key is NOT depressed and press the `j`{normal}
+key enough times to move the cursor so that Lesson 0 completely fills the
+screen.
+
+# Lesson 0
+
NOTE: The commands in the lessons will modify the text, but those changes won't
be saved. Don't worry about messing things up; just remember that pressing
[<Esc>](<Esc>) and then [u](u) will undo the latest change.
@@ -30,9 +36,7 @@ or press a sequence of keys
Text within <'s and >'s (like `<Enter>`{normal}) describes a key to press instead of text
to type.
-Now, make sure that your Shift-Lock key is NOT depressed and press the `j`{normal}
-key enough times to move the cursor so that Lesson 1.1 completely fills the
-screen.
+Now, move to the next lesson (remember, use j).
## Lesson 1.1: MOVING THE CURSOR
diff --git a/src/nvim/ascii.h b/src/nvim/ascii.h
index cce52c5250..2b3e94d5a0 100644
--- a/src/nvim/ascii.h
+++ b/src/nvim/ascii.h
@@ -1,10 +1,3 @@
-/*
- * VIM - Vi IMproved by Bram Moolenaar
- *
- * Do ":help uganda" in Vim to read copying and usage conditions.
- * Do ":help credits" in Vim to see a list of people who contributed.
- */
-
#ifndef NVIM_ASCII_H
#define NVIM_ASCII_H
diff --git a/src/nvim/buffer.c b/src/nvim/buffer.c
index fb1aeb7ba8..fae8e9ecd0 100644
--- a/src/nvim/buffer.c
+++ b/src/nvim/buffer.c
@@ -1,12 +1,4 @@
/*
- * VIM - Vi IMproved by Bram Moolenaar
- *
- * Do ":help uganda" in Vim to read copying and usage conditions.
- * Do ":help credits" in Vim to see a list of people who contributed.
- * See README.md for an overview of the Vim source code.
- */
-
-/*
* buffer.c: functions for dealing with the buffer structure
*/
@@ -3753,8 +3745,10 @@ int build_stl_str_hl(
// Put a `<` to mark where we truncated at
*trunc_p = '<';
- // Advance the pointer to the end of the string
- trunc_p = trunc_p + STRLEN(trunc_p);
+ if (width + 1 < maxwidth) {
+ // Advance the pointer to the end of the string
+ trunc_p = trunc_p + STRLEN(trunc_p);
+ }
// Fill up for half a double-wide character.
while (++width < maxwidth) {
diff --git a/src/nvim/edit.c b/src/nvim/edit.c
index 08b587df8a..8dc2844d8e 100644
--- a/src/nvim/edit.c
+++ b/src/nvim/edit.c
@@ -1,12 +1,4 @@
/*
- * VIM - Vi IMproved by Bram Moolenaar
- *
- * Do ":help uganda" in Vim to read copying and usage conditions.
- * Do ":help credits" in Vim to see a list of people who contributed.
- * See README.md for an overview of the Vim source code.
- */
-
-/*
* edit.c: functions for Insert mode
*/
diff --git a/src/nvim/eval.c b/src/nvim/eval.c
index 3e502a94ba..4a2bf2ac7a 100644
--- a/src/nvim/eval.c
+++ b/src/nvim/eval.c
@@ -1,13 +1,4 @@
/*
- *
- * VIM - Vi IMproved by Bram Moolenaar
- *
- * Do ":help uganda" in Vim to read copying and usage conditions.
- * Do ":help credits" in Vim to see a list of people who contributed.
- * See README.md for an overview of the Vim source code.
- */
-
-/*
* eval.c: Expression evaluation.
*/
diff --git a/src/nvim/ex_cmds.c b/src/nvim/ex_cmds.c
index f69910eb99..3f19421a75 100644
--- a/src/nvim/ex_cmds.c
+++ b/src/nvim/ex_cmds.c
@@ -1,12 +1,4 @@
/*
- * VIM - Vi IMproved by Bram Moolenaar
- *
- * Do ":help uganda" in Vim to read copying and usage conditions.
- * Do ":help credits" in Vim to see a list of people who contributed.
- * See README.md for an overview of the Vim source code.
- */
-
-/*
* ex_cmds.c: some functions for command line commands
*/
diff --git a/src/nvim/ex_cmds2.c b/src/nvim/ex_cmds2.c
index bb629fad76..87a6283310 100644
--- a/src/nvim/ex_cmds2.c
+++ b/src/nvim/ex_cmds2.c
@@ -1,12 +1,4 @@
/*
- * VIM - Vi IMproved by Bram Moolenaar
- *
- * Do ":help uganda" in Vim to read copying and usage conditions.
- * Do ":help credits" in Vim to see a list of people who contributed.
- * See README.md for an overview of the Vim source code.
- */
-
-/*
* ex_cmds2.c: some more functions for command line commands
*/
diff --git a/src/nvim/ex_cmds_defs.h b/src/nvim/ex_cmds_defs.h
index 4065cc2fdc..10d2eb688e 100644
--- a/src/nvim/ex_cmds_defs.h
+++ b/src/nvim/ex_cmds_defs.h
@@ -1,9 +1,3 @@
-/*
- * VIM - Vi IMproved by Bram Moolenaar
- *
- * Do ":help uganda" in Vim to read copying and usage conditions.
- * Do ":help credits" in Vim to see a list of people who contributed.
- */
#ifndef NVIM_EX_CMDS_DEFS_H
#define NVIM_EX_CMDS_DEFS_H
diff --git a/src/nvim/ex_docmd.c b/src/nvim/ex_docmd.c
index b50c7330d3..59bda9345e 100644
--- a/src/nvim/ex_docmd.c
+++ b/src/nvim/ex_docmd.c
@@ -1,12 +1,4 @@
/*
- * VIM - Vi IMproved by Bram Moolenaar
- *
- * Do ":help uganda" in Vim to read copying and usage conditions.
- * Do ":help credits" in Vim to see a list of people who contributed.
- * See README.md for an overview of the Vim source code.
- */
-
-/*
* ex_docmd.c: functions for executing an Ex command line.
*/
@@ -3454,6 +3446,7 @@ static linenr_T get_address(char_u **ptr,
}
if (addr_type != ADDR_LINES) {
EMSG(_(e_invaddr));
+ cmd = NULL;
goto error;
}
if (skip)
@@ -3481,6 +3474,7 @@ static linenr_T get_address(char_u **ptr,
c = *cmd++;
if (addr_type != ADDR_LINES) {
EMSG(_(e_invaddr));
+ cmd = NULL;
goto error;
}
if (skip) { /* skip "/pat/" */
@@ -3524,6 +3518,7 @@ static linenr_T get_address(char_u **ptr,
++cmd;
if (addr_type != ADDR_LINES) {
EMSG(_(e_invaddr));
+ cmd = NULL;
goto error;
}
if (*cmd == '&')
@@ -3595,7 +3590,8 @@ static linenr_T get_address(char_u **ptr,
else
n = getdigits(&cmd);
if (addr_type == ADDR_LOADED_BUFFERS || addr_type == ADDR_BUFFERS)
- lnum = compute_buffer_local_count(addr_type, lnum, (i == '-') ? -1 * n : n);
+ lnum = compute_buffer_local_count(
+ addr_type, lnum, (i == '-') ? -1 * n : n);
else if (i == '-')
lnum -= n;
else
@@ -3663,7 +3659,8 @@ static char_u *invalid_range(exarg_T *eap)
}
break;
case ADDR_ARGUMENTS:
- if (eap->line2 > ARGCOUNT + (!ARGCOUNT)) { // add 1 if ARGCOUNT is 0
+ // add 1 if ARGCOUNT is 0
+ if (eap->line2 > ARGCOUNT + (!ARGCOUNT)) {
return (char_u *)_(e_invrange);
}
break;
diff --git a/src/nvim/ex_eval.c b/src/nvim/ex_eval.c
index 773005e72b..bf67047ae8 100644
--- a/src/nvim/ex_eval.c
+++ b/src/nvim/ex_eval.c
@@ -1,12 +1,4 @@
/*
- * VIM - Vi IMproved by Bram Moolenaar
- *
- * Do ":help uganda" in Vim to read copying and usage conditions.
- * Do ":help credits" in Vim to see a list of people who contributed.
- * See README.md for an overview of the Vim source code.
- */
-
-/*
* ex_eval.c: functions for Ex command line for the +eval feature.
*/
#include <assert.h>
diff --git a/src/nvim/ex_getln.c b/src/nvim/ex_getln.c
index c9a324b49f..6d81f3680a 100644
--- a/src/nvim/ex_getln.c
+++ b/src/nvim/ex_getln.c
@@ -1,12 +1,4 @@
/*
- * VIM - Vi IMproved by Bram Moolenaar
- *
- * Do ":help uganda" in Vim to read copying and usage conditions.
- * Do ":help credits" in Vim to see a list of people who contributed.
- * See README.md for an overview of the Vim source code.
- */
-
-/*
* ex_getln.c: Functions for entering and editing an Ex command line.
*/
@@ -579,7 +571,7 @@ static int command_line_execute(VimState *state, int key)
}
if (vim_ispathsep(ccline.cmdbuff[s->j])
#ifdef BACKSLASH_IN_FILENAME
- && vim_strchr(" *?[{`$%#", ccline.cmdbuff[j + 1])
+ && vim_strchr(" *?[{`$%#", ccline.cmdbuff[s->j + 1])
== NULL
#endif
) {
diff --git a/src/nvim/fileio.c b/src/nvim/fileio.c
index f57b48cd15..bc5b08ef24 100644
--- a/src/nvim/fileio.c
+++ b/src/nvim/fileio.c
@@ -1,12 +1,4 @@
/*
- * VIM - Vi IMproved by Bram Moolenaar
- *
- * Do ":help uganda" in Vim to read copying and usage conditions.
- * Do ":help credits" in Vim to see a list of people who contributed.
- * See README.md for an overview of the Vim source code.
- */
-
-/*
* fileio.c: read from and write to a file
*/
@@ -4339,8 +4331,6 @@ void shorten_fnames(int force)
/// @return [allocated] - A new filename, made up from:
/// * fname + ext, if fname not NULL.
/// * current dir + ext, if fname is NULL.
-/// On Windows, and if ext starts with ".", a "_" is
-/// preprended to ext (for filename to be valid).
/// Result is guaranteed to:
/// * be ended by <ext>.
/// * have a basename with at most BASENAMELEN chars:
@@ -4394,15 +4384,6 @@ char *modname(const char *fname, const char *ext, bool prepend_dot)
char *s;
s = ptr + strlen(ptr);
-#if defined(WIN3264)
- // If there is no file name, and the extension starts with '.', put a
- // '_' before the dot, because just ".ext" may be invalid if it's on a
- // FAT partition, and on HPFS it doesn't matter.
- else if ((fname == NULL || *fname == NUL) && *ext == '.') {
- *s++ = '_';
- }
-#endif
-
// Append the extension.
// ext can start with '.' and cannot exceed 3 more characters.
strcpy(s, ext);
diff --git a/src/nvim/fold.c b/src/nvim/fold.c
index 29921bc816..2e32e78062 100644
--- a/src/nvim/fold.c
+++ b/src/nvim/fold.c
@@ -1,11 +1,4 @@
-/* vim: set fdm=marker fdl=1 fdc=3
- *
- * VIM - Vi IMproved by Bram Moolenaar
- *
- * Do ":help uganda" in Vim to read copying and usage conditions.
- * Do ":help credits" in Vim to see a list of people who contributed.
- * See README.md for an overview of the Vim source code.
- */
+// vim: set fdm=marker fdl=1 fdc=3
/*
* fold.c: code for folding
diff --git a/src/nvim/getchar.c b/src/nvim/getchar.c
index 3692fa27aa..44d6c086e7 100644
--- a/src/nvim/getchar.c
+++ b/src/nvim/getchar.c
@@ -1,12 +1,4 @@
/*
- * VIM - Vi IMproved by Bram Moolenaar
- *
- * Do ":help uganda" in Vim to read copying and usage conditions.
- * Do ":help credits" in Vim to see a list of people who contributed.
- * See README.md for an overview of the Vim source code.
- */
-
-/*
* getchar.c
*
* functions related with getting a character from the user/mapping/redo/...
diff --git a/src/nvim/globals.h b/src/nvim/globals.h
index 7c42238d20..52eebebf41 100644
--- a/src/nvim/globals.h
+++ b/src/nvim/globals.h
@@ -1,10 +1,3 @@
-/*
- * VIM - Vi IMproved by Bram Moolenaar
- *
- * Do ":help uganda" in Vim to read copying and usage conditions.
- * Do ":help credits" in Vim to see a list of people who contributed.
- */
-
#ifndef NVIM_GLOBALS_H
#define NVIM_GLOBALS_H
@@ -55,6 +48,57 @@
# endif
#endif
+#ifdef WIN32
+# define _PATHSEPSTR "\\"
+#else
+# define _PATHSEPSTR "/"
+#endif
+
+#ifndef FILETYPE_FILE
+# define FILETYPE_FILE "filetype.vim"
+#endif
+
+#ifndef FTPLUGIN_FILE
+# define FTPLUGIN_FILE "ftplugin.vim"
+#endif
+
+#ifndef INDENT_FILE
+# define INDENT_FILE "indent.vim"
+#endif
+
+#ifndef FTOFF_FILE
+# define FTOFF_FILE "ftoff.vim"
+#endif
+
+#ifndef FTPLUGOF_FILE
+# define FTPLUGOF_FILE "ftplugof.vim"
+#endif
+
+#ifndef INDOFF_FILE
+# define INDOFF_FILE "indoff.vim"
+#endif
+
+#define DFLT_ERRORFILE "errors.err"
+
+#ifndef SYS_VIMRC_FILE
+# define SYS_VIMRC_FILE "$VIM" _PATHSEPSTR "sysinit.vim"
+#endif
+
+#ifndef DFLT_HELPFILE
+# define DFLT_HELPFILE "$VIMRUNTIME" _PATHSEPSTR "doc" _PATHSEPSTR "help.txt"
+#endif
+
+#ifndef SYNTAX_FNAME
+# define SYNTAX_FNAME "$VIMRUNTIME" _PATHSEPSTR "syntax" _PATHSEPSTR "%s.vim"
+#endif
+
+#ifndef EXRC_FILE
+# define EXRC_FILE ".exrc"
+#endif
+
+#ifndef VIMRC_FILE
+# define VIMRC_FILE ".nvimrc"
+#endif
/* Values for "starting" */
#define NO_SCREEN 2 /* no screen updating yet */
@@ -998,7 +1042,7 @@ EXTERN int lcs_space INIT(= NUL);
EXTERN int lcs_tab1 INIT(= NUL);
EXTERN int lcs_tab2 INIT(= NUL);
EXTERN int lcs_trail INIT(= NUL);
-EXTERN int lcs_conceal INIT(= '-');
+EXTERN int lcs_conceal INIT(= ' ');
/* Characters from 'fillchars' option */
EXTERN int fill_stl INIT(= ' ');
diff --git a/src/nvim/hardcopy.c b/src/nvim/hardcopy.c
index 9f7431ee7d..ab8959239b 100644
--- a/src/nvim/hardcopy.c
+++ b/src/nvim/hardcopy.c
@@ -1,12 +1,4 @@
/*
- * VIM - Vi IMproved by Bram Moolenaar
- *
- * Do ":help uganda" in Vim to read copying and usage conditions.
- * Do ":help credits" in Vim to see a list of people who contributed.
- * See README.md for an overview of the Vim source code.
- */
-
-/*
* hardcopy.c: printing to paper
*/
diff --git a/src/nvim/if_cscope.c b/src/nvim/if_cscope.c
index 578ae5de1e..3585c26ca2 100644
--- a/src/nvim/if_cscope.c
+++ b/src/nvim/if_cscope.c
@@ -4,9 +4,8 @@
*
* The basic idea/structure of cscope for Vim was borrowed from Nvi. There
* might be a few lines of code that look similar to what Nvi has.
- *
- * See README.md for an overview of the Vim source code.
*/
+
#include <stdbool.h>
#include <assert.h>
diff --git a/src/nvim/keymap.c b/src/nvim/keymap.c
index 85380ba173..04d6cbf5e3 100644
--- a/src/nvim/keymap.c
+++ b/src/nvim/keymap.c
@@ -1,4 +1,4 @@
-/************************************************************************
+/*
* functions that use lookup tables for various things, generally to do with
* special key codes.
*/
diff --git a/src/nvim/keymap.h b/src/nvim/keymap.h
index d2d96c6149..766362d145 100644
--- a/src/nvim/keymap.h
+++ b/src/nvim/keymap.h
@@ -1,10 +1,3 @@
-/*
- * VIM - Vi IMproved by Bram Moolenaar
- *
- * Do ":help uganda" in Vim to read copying and usage conditions.
- * Do ":help credits" in Vim to see a list of people who contributed.
- */
-
#ifndef NVIM_KEYMAP_H
#define NVIM_KEYMAP_H
diff --git a/src/nvim/log.c b/src/nvim/log.c
index 08b6d0483e..5767da03af 100644
--- a/src/nvim/log.c
+++ b/src/nvim/log.c
@@ -14,7 +14,7 @@
# include <unistd.h>
#endif
-#define USR_LOG_FILE "$HOME/.nvimlog"
+#define USR_LOG_FILE "$HOME" _PATHSEPSTR ".nvimlog"
static uv_mutex_t mutex;
diff --git a/src/nvim/macros.h b/src/nvim/macros.h
index d42997650c..26ab5a7de7 100644
--- a/src/nvim/macros.h
+++ b/src/nvim/macros.h
@@ -1,17 +1,6 @@
#ifndef NVIM_MACROS_H
#define NVIM_MACROS_H
-/*
- * VIM - Vi IMproved by Bram Moolenaar
- *
- * Do ":help uganda" in Vim to read copying and usage conditions.
- * Do ":help credits" in Vim to see a list of people who contributed.
- */
-
-/*
- * macros.h: macro definitions for often used code
- */
-
#ifndef MIN
# define MIN(X, Y) ((X) < (Y) ? (X) : (Y))
#endif
diff --git a/src/nvim/main.c b/src/nvim/main.c
index 203aeb8d69..cef10d12d5 100644
--- a/src/nvim/main.c
+++ b/src/nvim/main.c
@@ -1,11 +1,3 @@
-/*
- * VIM - Vi IMproved by Bram Moolenaar
- *
- * Do ":help uganda" in Vim to read copying and usage conditions.
- * Do ":help credits" in Vim to see a list of people who contributed.
- * See README.md for an overview of the Vim source code.
- */
-
#define EXTERN
#include <assert.h>
#include <stdint.h>
@@ -1864,5 +1856,3 @@ static void check_swap_exists_action(void)
getout(1);
handle_swap_exists(NULL);
}
-
-
diff --git a/src/nvim/mark.c b/src/nvim/mark.c
index 38a76a45e6..e2f212340c 100644
--- a/src/nvim/mark.c
+++ b/src/nvim/mark.c
@@ -1,12 +1,4 @@
/*
- * VIM - Vi IMproved by Bram Moolenaar
- *
- * Do ":help uganda" in Vim to read copying and usage conditions.
- * Do ":help credits" in Vim to see a list of people who contributed.
- * See README.md for an overview of the Vim source code.
- */
-
-/*
* mark.c: functions for setting marks and jumping to them
*/
diff --git a/src/nvim/mbyte.c b/src/nvim/mbyte.c
index fc7199e3a6..b02c18c53b 100644
--- a/src/nvim/mbyte.c
+++ b/src/nvim/mbyte.c
@@ -1,13 +1,6 @@
/*
- * VIM - Vi IMproved by Bram Moolenaar
- * Multibyte extensions partly by Sung-Hoon Baek
- *
- * Do ":help uganda" in Vim to read copying and usage conditions.
- * Do ":help credits" in Vim to see a list of people who contributed.
- * See README.md for an overview of the Vim source code.
- */
-/*
* mbyte.c: Code specifically for handling multi-byte characters.
+ * Multibyte extensions partly by Sung-Hoon Baek
*
* The encoding used in the core is set with 'encoding'. When 'encoding' is
* changed, the following four variables are set (for speed).
diff --git a/src/nvim/memfile.c b/src/nvim/memfile.c
index b2783736e1..3df4cbc4a3 100644
--- a/src/nvim/memfile.c
+++ b/src/nvim/memfile.c
@@ -1,11 +1,3 @@
-/*
- * VIM - Vi IMproved by Bram Moolenaar
- *
- * Do ":help uganda" in Vim to read copying and usage conditions.
- * Do ":help credits" in Vim to see a list of people who contributed.
- * See README.md for an overview of the Vim source code.
- */
-
/// An abstraction to handle blocks of memory which can be stored in a file.
/// This is the implementation of a sort of virtual memory.
///
diff --git a/src/nvim/memline.c b/src/nvim/memline.c
index e822a58273..0ba8dd98d0 100644
--- a/src/nvim/memline.c
+++ b/src/nvim/memline.c
@@ -1,11 +1,3 @@
-/*
- * VIM - Vi IMproved by Bram Moolenaar
- *
- * Do ":help uganda" in Vim to read copying and usage conditions.
- * Do ":help credits" in Vim to see a list of people who contributed.
- * See README.md for an overview of the Vim source code.
- */
-
/* for debugging */
/* #define CHECK(c, s) if (c) EMSG(s) */
#define CHECK(c, s)
diff --git a/src/nvim/menu.c b/src/nvim/menu.c
index 3859ba5ec8..91a72abfc5 100644
--- a/src/nvim/menu.c
+++ b/src/nvim/menu.c
@@ -1,14 +1,6 @@
/*
- * VIM - Vi IMproved by Bram Moolenaar
- * GUI/Motif support by Robert Webb
- *
- * Do ":help uganda" in Vim to read copying and usage conditions.
- * Do ":help credits" in Vim to see a list of people who contributed.
- * See README.md for an overview of the Vim source code.
- */
-
-/*
* Code for menus. Used for the GUI and 'wildmenu'.
+ * GUI/Motif support by Robert Webb
*/
#include <assert.h>
diff --git a/src/nvim/message.c b/src/nvim/message.c
index 52e2a286c3..66b8b9b5d2 100644
--- a/src/nvim/message.c
+++ b/src/nvim/message.c
@@ -1,12 +1,4 @@
/*
- * VIM - Vi IMproved by Bram Moolenaar
- *
- * Do ":help uganda" in Vim to read copying and usage conditions.
- * Do ":help credits" in Vim to see a list of people who contributed.
- * See README.md for an overview of the Vim source code.
- */
-
-/*
* message.c: functions for displaying messages on the command line
*/
diff --git a/src/nvim/misc1.c b/src/nvim/misc1.c
index 0ba6929686..96ef6cbaef 100644
--- a/src/nvim/misc1.c
+++ b/src/nvim/misc1.c
@@ -1,12 +1,4 @@
/*
- * VIM - Vi IMproved by Bram Moolenaar
- *
- * Do ":help uganda" in Vim to read copying and usage conditions.
- * Do ":help credits" in Vim to see a list of people who contributed.
- * See README.md for an overview of the Vim source code.
- */
-
-/*
* misc1.c: functions that didn't seem to fit elsewhere
*/
diff --git a/src/nvim/misc2.c b/src/nvim/misc2.c
index d72a8f17e0..3c0a1414a6 100644
--- a/src/nvim/misc2.c
+++ b/src/nvim/misc2.c
@@ -1,12 +1,4 @@
/*
- * VIM - Vi IMproved by Bram Moolenaar
- *
- * Do ":help uganda" in Vim to read copying and usage conditions.
- * Do ":help credits" in Vim to see a list of people who contributed.
- * See README.md for an overview of the Vim source code.
- */
-
-/*
* misc2.c: Various functions.
*/
#include <assert.h>
@@ -478,7 +470,7 @@ void put_time(FILE *fd, time_t time_)
{
uint8_t buf[8];
time_to_bytes(time_, buf);
- fwrite(buf, sizeof(uint8_t), ARRAY_SIZE(buf), fd);
+ (void)fwrite(buf, sizeof(uint8_t), ARRAY_SIZE(buf), fd);
}
/// Writes time_t to "buf[8]".
diff --git a/src/nvim/move.c b/src/nvim/move.c
index b44d3f2fd9..eb55397511 100644
--- a/src/nvim/move.c
+++ b/src/nvim/move.c
@@ -1,11 +1,4 @@
/*
- * VIM - Vi IMproved by Bram Moolenaar
- *
- * Do ":help uganda" in Vim to read copying and usage conditions.
- * Do ":help credits" in Vim to see a list of people who contributed.
- * See README.md for an overview of the Vim source code.
- */
-/*
* move.c: Functions for moving the cursor and scrolling text.
*
* There are two ways to move the cursor:
diff --git a/src/nvim/normal.c b/src/nvim/normal.c
index a0d2c7903d..ad53e9bf24 100644
--- a/src/nvim/normal.c
+++ b/src/nvim/normal.c
@@ -1,11 +1,4 @@
/*
- * VIM - Vi IMproved by Bram Moolenaar
- *
- * Do ":help uganda" in Vim to read copying and usage conditions.
- * Do ":help credits" in Vim to see a list of people who contributed.
- * See README.md for an overview of the Vim source code.
- */
-/*
* normal.c: Contains the main routine for processing characters in command
* mode. Communicates closely with the code in ops.c to handle
* the operators.
diff --git a/src/nvim/ops.c b/src/nvim/ops.c
index 6693ca23c8..956b9c7758 100644
--- a/src/nvim/ops.c
+++ b/src/nvim/ops.c
@@ -1,12 +1,4 @@
/*
- * VIM - Vi IMproved by Bram Moolenaar
- *
- * Do ":help uganda" in Vim to read copying and usage conditions.
- * Do ":help credits" in Vim to see a list of people who contributed.
- * See README.md for an overview of the Vim source code.
- */
-
-/*
* ops.c: implementation of various operators: op_shift, op_delete, op_tilde,
* op_change, op_yank, do_put, do_join
*/
diff --git a/src/nvim/option.c b/src/nvim/option.c
index 60c415f297..dbcd230186 100644
--- a/src/nvim/option.c
+++ b/src/nvim/option.c
@@ -1,12 +1,4 @@
/*
- * VIM - Vi IMproved by Bram Moolenaar
- *
- * Do ":help uganda" in Vim to read copying and usage conditions.
- * Do ":help credits" in Vim to see a list of people who contributed.
- * See README.md for an overview of the Vim source code.
- */
-
-/*
* Code to handle user-settable options. This is all pretty much table-
* driven. Checklist for adding a new option:
* - Put it in the options array below (copy an existing entry).
diff --git a/src/nvim/os/env.c b/src/nvim/os/env.c
index bf6db97fcf..0e052ced55 100644
--- a/src/nvim/os/env.c
+++ b/src/nvim/os/env.c
@@ -141,6 +141,27 @@ void init_homedir(void)
char_u *var = (char_u *)os_getenv("HOME");
+#ifdef WIN32
+ // Typically, $HOME is not defined on Windows, unless the user has
+ // specifically defined it for Vim's sake. However, on Windows NT
+ // platforms, $HOMEDRIVE and $HOMEPATH are automatically defined for
+ // each user. Try constructing $HOME from these.
+ if (var == NULL) {
+ const char *homedrive = os_getenv("HOMEDRIVE");
+ const char *homepath = os_getenv("HOMEPATH");
+ if (homepath == NULL) {
+ homepath = "\\";
+ }
+ if (homedrive != NULL && strlen(homedrive) + strlen(homepath) < MAXPATHL) {
+ snprintf((char *)NameBuff, MAXPATHL, "%s%s", homedrive, homepath);
+ if (NameBuff[0] != NUL) {
+ var = NameBuff;
+ vim_setenv("HOME", (char *)NameBuff);
+ }
+ }
+ }
+#endif
+
if (var != NULL) {
#ifdef UNIX
/*
diff --git a/src/nvim/os/os_defs.h b/src/nvim/os/os_defs.h
index 55a2d5513e..7d77899287 100644
--- a/src/nvim/os/os_defs.h
+++ b/src/nvim/os/os_defs.h
@@ -39,32 +39,6 @@
# define MAXPATHL 1024
#endif
-#ifndef FILETYPE_FILE
-# define FILETYPE_FILE "filetype.vim"
-#endif
-
-#ifndef FTPLUGIN_FILE
-# define FTPLUGIN_FILE "ftplugin.vim"
-#endif
-
-#ifndef INDENT_FILE
-# define INDENT_FILE "indent.vim"
-#endif
-
-#ifndef FTOFF_FILE
-# define FTOFF_FILE "ftoff.vim"
-#endif
-
-#ifndef FTPLUGOF_FILE
-# define FTPLUGOF_FILE "ftplugof.vim"
-#endif
-
-#ifndef INDOFF_FILE
-# define INDOFF_FILE "indoff.vim"
-#endif
-
-#define DFLT_ERRORFILE "errors.err"
-
// Command-processing buffer. Use large buffers for all platforms.
#define CMDBUFFSIZE 1024
diff --git a/src/nvim/os/signal.c b/src/nvim/os/signal.c
index 7158721433..0ff6016e32 100644
--- a/src/nvim/os/signal.c
+++ b/src/nvim/os/signal.c
@@ -32,9 +32,13 @@ void signal_init(void)
signal_watcher_init(&loop, &shup, NULL);
signal_watcher_init(&loop, &squit, NULL);
signal_watcher_init(&loop, &sterm, NULL);
+#ifdef SIGPIPE
signal_watcher_start(&spipe, on_signal, SIGPIPE);
+#endif
signal_watcher_start(&shup, on_signal, SIGHUP);
+#ifdef SIGQUIT
signal_watcher_start(&squit, on_signal, SIGQUIT);
+#endif
signal_watcher_start(&sterm, on_signal, SIGTERM);
#ifdef SIGPWR
signal_watcher_init(&loop, &spwr, NULL);
@@ -82,12 +86,16 @@ static char * signal_name(int signum)
case SIGPWR:
return "SIGPWR";
#endif
+#ifdef SIGPIPE
case SIGPIPE:
return "SIGPIPE";
+#endif
case SIGTERM:
return "SIGTERM";
+#ifdef SIGQUIT
case SIGQUIT:
return "SIGQUIT";
+#endif
case SIGHUP:
return "SIGHUP";
default:
@@ -123,11 +131,15 @@ static void on_signal(SignalWatcher *handle, int signum, void *data)
ml_sync_all(false, false);
break;
#endif
+#ifdef SIGPIPE
case SIGPIPE:
// Ignore
break;
+#endif
case SIGTERM:
+#ifdef SIGQUIT
case SIGQUIT:
+#endif
case SIGHUP:
if (!rejecting_deadly) {
deadly_signal(signum);
diff --git a/src/nvim/os/unix_defs.h b/src/nvim/os/unix_defs.h
index b1511d4b56..e3ba3262f4 100644
--- a/src/nvim/os/unix_defs.h
+++ b/src/nvim/os/unix_defs.h
@@ -9,7 +9,6 @@
# include <sys/param.h>
#endif
-
#define TEMP_DIR_NAMES {"$TMPDIR", "/tmp", ".", "~"}
#define TEMP_FILE_PATH_MAXLEN 256
@@ -18,21 +17,4 @@
// Special wildcards that need to be handled by the shell.
#define SPECIAL_WILDCHAR "`'{"
-// Unix system-dependent file names
-#ifndef SYS_VIMRC_FILE
-# define SYS_VIMRC_FILE "$VIM/sysinit.vim"
-#endif
-#ifndef DFLT_HELPFILE
-# define DFLT_HELPFILE "$VIMRUNTIME/doc/help.txt"
-#endif
-#ifndef SYNTAX_FNAME
-# define SYNTAX_FNAME "$VIMRUNTIME/syntax/%s.vim"
-#endif
-#ifndef EXRC_FILE
-# define EXRC_FILE ".exrc"
-#endif
-#ifndef VIMRC_FILE
-# define VIMRC_FILE ".nvimrc"
-#endif
-
#endif // NVIM_OS_UNIX_DEFS_H
diff --git a/src/nvim/os/win_defs.h b/src/nvim/os/win_defs.h
index bfd431c9c6..32960dfbe9 100644
--- a/src/nvim/os/win_defs.h
+++ b/src/nvim/os/win_defs.h
@@ -6,17 +6,6 @@
#define TEMP_DIR_NAMES {"$TMP", "$TEMP", "$USERPROFILE", ""}
#define TEMP_FILE_PATH_MAXLEN _MAX_PATH
-// Defines needed to fix the build on Windows:
-// - DFLT_DIR
-// - DFLT_BDIR
-// - DFLT_VDIR
-// - EXRC_FILE
-// - VIMRC_FILE
-// - SYNTAX_FNAME
-// - DFLT_HELPFILE
-// - SYS_VIMRC_FILE
-// - SPECIAL_WILDCHAR
-
#define USE_CRNL
#ifdef _MSC_VER
diff --git a/src/nvim/os_unix.c b/src/nvim/os_unix.c
index ddb799f23d..62b264046c 100644
--- a/src/nvim/os_unix.c
+++ b/src/nvim/os_unix.c
@@ -1,12 +1,4 @@
/*
- * VIM - Vi IMproved by Bram Moolenaar
- *
- * Do ":help uganda" in Vim to read copying and usage conditions.
- * Do ":help credits" in Vim to see a list of people who contributed.
- * See README.md for an overview of the Vim source code.
- */
-
-/*
* os_unix.c -- code for all flavors of Unix (BSD, SYSV, SVR4, POSIX, ...)
*
* A lot of this file was originally written by Juergen Weigert and later
diff --git a/src/nvim/path.c b/src/nvim/path.c
index a14ba38508..253035ed99 100644
--- a/src/nvim/path.c
+++ b/src/nvim/path.c
@@ -1,4 +1,3 @@
-
#include <assert.h>
#include <inttypes.h>
#include <stdbool.h>
@@ -468,16 +467,13 @@ bool path_has_wildcard(const char_u *p)
return false;
}
-#if defined(UNIX)
/*
* Unix style wildcard expansion code.
- * It's here because it's used both for Unix and Mac.
*/
static int pstrcmp(const void *a, const void *b)
{
return pathcmp(*(char **)a, *(char **)b, -1);
}
-#endif
/// Checks if a path has a character path_expand can expand.
/// @param p The path to expand.
diff --git a/src/nvim/popupmnu.c b/src/nvim/popupmnu.c
index 10012a9775..001740943f 100644
--- a/src/nvim/popupmnu.c
+++ b/src/nvim/popupmnu.c
@@ -1,7 +1,7 @@
/// @file popupmnu.c
///
/// Popup menu (PUM)
-//
+
#include <assert.h>
#include <inttypes.h>
#include <stdbool.h>
diff --git a/src/nvim/quickfix.c b/src/nvim/quickfix.c
index 8be010c560..8e6ae46a3b 100644
--- a/src/nvim/quickfix.c
+++ b/src/nvim/quickfix.c
@@ -1,12 +1,4 @@
/*
- * VIM - Vi IMproved by Bram Moolenaar
- *
- * Do ":help uganda" in Vim to read copying and usage conditions.
- * Do ":help credits" in Vim to see a list of people who contributed.
- * See README.md for an overview of the Vim source code.
- */
-
-/*
* quickfix.c: functions for quickfix mode, using a file with error messages
*/
diff --git a/src/nvim/regexp_nfa.c b/src/nvim/regexp_nfa.c
index fa356da5b9..b96dcc66b3 100644
--- a/src/nvim/regexp_nfa.c
+++ b/src/nvim/regexp_nfa.c
@@ -1897,9 +1897,10 @@ static int nfa_regpiece(void)
return OK;
}
- // The engine is very inefficient (uses too many states) when the maximum is
- // much larger than the minimum. Bail out if we can use the other engine.
- if ((nfa_re_flags & RE_AUTO) && maxval > minval + 200) {
+ // The engine is very inefficient (uses too many states) when the maximum
+ // is much larger than the minimum and when the maximum is large. Bail out
+ // if we can use the other engine.
+ if ((nfa_re_flags & RE_AUTO) && (maxval > minval + 200 || maxval > 500)) {
return FAIL;
}
diff --git a/src/nvim/screen.c b/src/nvim/screen.c
index bea09fd804..9fdb476748 100644
--- a/src/nvim/screen.c
+++ b/src/nvim/screen.c
@@ -1,12 +1,4 @@
/*
- * VIM - Vi IMproved by Bram Moolenaar
- *
- * Do ":help uganda" in Vim to read copying and usage conditions.
- * Do ":help credits" in Vim to see a list of people who contributed.
- * See README.md for an overview of the Vim source code.
- */
-
-/*
* screen.c: code for displaying on the screen
*
* Output to the screen (console, terminal emulator or GUI window) is minimized
diff --git a/src/nvim/search.c b/src/nvim/search.c
index 89c96fe31e..cb461c9ef2 100644
--- a/src/nvim/search.c
+++ b/src/nvim/search.c
@@ -1,11 +1,4 @@
/*
- * VIM - Vi IMproved by Bram Moolenaar
- *
- * Do ":help uganda" in Vim to read copying and usage conditions.
- * Do ":help credits" in Vim to see a list of people who contributed.
- * See README.md for an overview of the Vim source code.
- */
-/*
* search.c: code for normal mode searching commands
*/
diff --git a/src/nvim/shada.c b/src/nvim/shada.c
index e21c6f17fe..340c14066a 100644
--- a/src/nvim/shada.c
+++ b/src/nvim/shada.c
@@ -10,7 +10,9 @@
#include <stdint.h>
#include <inttypes.h>
#include <errno.h>
-#include <unistd.h>
+#ifdef HAVE_UNISTD_H
+# include <unistd.h>
+#endif
#include <assert.h>
#include <msgpack.h>
@@ -203,11 +205,11 @@ enum SRNIFlags {
kSDReadHeader = (1 << kSDItemHeader), ///< Determines whether header should
///< be read (it is usually ignored).
kSDReadUndisableableData = (
- (1 << kSDItemSearchPattern)
- | (1 << kSDItemSubString)
- | (1 << kSDItemJump)), ///< Data reading which cannot be disabled by &shada
- ///< or other options except for disabling reading
- ///< ShaDa as a whole.
+ (1 << kSDItemSearchPattern)
+ | (1 << kSDItemSubString)
+ | (1 << kSDItemJump)), ///< Data reading which cannot be disabled by
+ ///< &shada or other options except for disabling
+ ///< reading ShaDa as a whole.
kSDReadRegisters = (1 << kSDItemRegister), ///< Determines whether registers
///< should be read (may only be
///< disabled when writing, but
@@ -444,7 +446,7 @@ typedef struct sd_write_def {
.attr = { __VA_ARGS__ } \
} \
}
-#define DEFAULT_POS {1, 0, 0}
+#define DEFAULT_POS { 1, 0, 0 }
static const pos_T default_pos = DEFAULT_POS;
static const ShadaEntry sd_default_values[] = {
[kSDItemMissing] = { .type = kSDItemMissing, .timestamp = 0 },
@@ -531,11 +533,14 @@ static inline void hmll_init(HMLList *const hmll, const size_t size)
///
/// @param hmll Pointer to the list.
/// @param cur_entry Name of the variable to iterate over.
+/// @param code Code to execute on each iteration.
///
/// @return `for` cycle header (use `HMLL_FORALL(hmll, cur_entry) {body}`).
-#define HMLL_FORALL(hmll, cur_entry) \
+#define HMLL_FORALL(hmll, cur_entry, code) \
for (HMLListEntry *cur_entry = (hmll)->first; cur_entry != NULL; \
- cur_entry = cur_entry->next)
+ cur_entry = cur_entry->next) { \
+ code \
+ } \
/// Remove entry from the linked list
///
@@ -631,11 +636,14 @@ static inline void hmll_insert(HMLList *const hmll,
/// @param hmll Pointer to the list.
/// @param cur_entry Name of the variable to iterate over, must be already
/// defined.
+/// @param code Code to execute on each iteration.
///
/// @return `for` cycle header (use `HMLL_FORALL(hmll, cur_entry) {body}`).
-#define HMLL_ITER_BACK(hmll, cur_entry) \
+#define HMLL_ITER_BACK(hmll, cur_entry, code) \
for (cur_entry = (hmll)->last; cur_entry != NULL; \
- cur_entry = cur_entry->prev)
+ cur_entry = cur_entry->prev) { \
+ code \
+ }
/// Free linked list
///
@@ -957,11 +965,11 @@ static int shada_read_file(const char *const file, const int flags)
if (p_verbose > 0) {
verbose_enter();
smsg(_("Reading ShaDa file \"%s\"%s%s%s"),
- fname,
- (flags & kShaDaWantInfo) ? _(" info") : "",
- (flags & kShaDaWantMarks) ? _(" marks") : "",
- (flags & kShaDaGetOldfiles) ? _(" oldfiles") : "",
- of_ret != 0 ? _(" FAILED") : "");
+ fname,
+ (flags & kShaDaWantInfo) ? _(" info") : "",
+ (flags & kShaDaWantMarks) ? _(" marks") : "",
+ (flags & kShaDaGetOldfiles) ? _(" oldfiles") : "",
+ of_ret != 0 ? _(" FAILED") : "");
verbose_leave();
}
@@ -1009,8 +1017,8 @@ static const void *shada_hist_iter(const void *const iter,
.histtype = history_type,
.string = (char *) hist_he.hisstr,
.sep = (char) (history_type == HIST_SEARCH
- ? (char) hist_he.hisstr[STRLEN(hist_he.hisstr) + 1]
- : 0),
+ ? (char) hist_he.hisstr[STRLEN(hist_he.hisstr) + 1]
+ : 0),
.additional_elements = hist_he.additional_elements,
}
}
@@ -1072,11 +1080,11 @@ static void hms_insert(HistoryMergerState *const hms_p, const ShadaEntry entry,
}
}
HMLListEntry *insert_after;
- HMLL_ITER_BACK(hmll, insert_after) {
+ HMLL_ITER_BACK(hmll, insert_after, {
if (insert_after->data.timestamp <= entry.timestamp) {
break;
}
- }
+ })
hmll_insert(hmll, insert_after, entry, can_free_entry);
}
@@ -1134,14 +1142,14 @@ static inline void hms_to_he_array(const HistoryMergerState *const hms_p,
FUNC_ATTR_NONNULL_ALL
{
histentry_T *hist = hist_array;
- HMLL_FORALL(&hms_p->hmll, cur_entry) {
+ HMLL_FORALL(&hms_p->hmll, cur_entry, {
hist->timestamp = cur_entry->data.timestamp;
hist->hisnum = (int) (hist - hist_array) + 1;
hist->hisstr = (char_u *) cur_entry->data.data.history_item.string;
hist->additional_elements =
cur_entry->data.data.history_item.additional_elements;
hist++;
- }
+ })
*new_hisnum = (int) (hist - hist_array);
*new_hisidx = *new_hisnum - 1;
}
@@ -1159,10 +1167,11 @@ static inline void hms_dealloc(HistoryMergerState *const hms_p)
///
/// @param[in] hms_p Merger structure to iterate over.
/// @param[out] cur_entry Name of the iterator variable.
+/// @param code Code to execute on each iteration.
///
/// @return for cycle header. Use `HMS_ITER(hms_p, cur_entry) {body}`.
-#define HMS_ITER(hms_p, cur_entry) \
- HMLL_FORALL(&((hms_p)->hmll), cur_entry)
+#define HMS_ITER(hms_p, cur_entry, code) \
+ HMLL_FORALL(&((hms_p)->hmll), cur_entry, code)
/// Find buffer for given buffer name (cached)
///
@@ -1339,18 +1348,18 @@ static void shada_read(ShaDaReadDef *const sd_reader, const int flags)
(cur_entry.data.search_pattern.is_substitute_pattern
? &set_substitute_pattern
: &set_search_pattern)((SearchPattern) {
- .magic = cur_entry.data.search_pattern.magic,
- .no_scs = !cur_entry.data.search_pattern.smartcase,
- .off = {
- .dir = cur_entry.data.search_pattern.search_backward ? '?' : '/',
- .line = cur_entry.data.search_pattern.has_line_offset,
- .end = cur_entry.data.search_pattern.place_cursor_at_end,
- .off = cur_entry.data.search_pattern.offset,
- },
- .pat = (char_u *) cur_entry.data.search_pattern.pat,
- .additional_data = cur_entry.data.search_pattern.additional_data,
- .timestamp = cur_entry.timestamp,
- });
+ .magic = cur_entry.data.search_pattern.magic,
+ .no_scs = !cur_entry.data.search_pattern.smartcase,
+ .off = {
+ .dir = cur_entry.data.search_pattern.search_backward ? '?' : '/',
+ .line = cur_entry.data.search_pattern.has_line_offset,
+ .end = cur_entry.data.search_pattern.place_cursor_at_end,
+ .off = cur_entry.data.search_pattern.offset,
+ },
+ .pat = (char_u *) cur_entry.data.search_pattern.pat,
+ .additional_data = cur_entry.data.search_pattern.additional_data,
+ .timestamp = cur_entry.timestamp,
+ });
if (cur_entry.data.search_pattern.is_last_used) {
set_last_used_pattern(
cur_entry.data.search_pattern.is_substitute_pattern);
@@ -2428,13 +2437,13 @@ static ShaDaWriteResult shada_write(ShaDaWriteDef *const sd_writer,
}
const unsigned srni_flags = (unsigned) (
- kSDReadUndisableableData
- | kSDReadUnknown
- | (dump_history ? kSDReadHistory : 0)
- | (dump_registers ? kSDReadRegisters : 0)
- | (dump_global_vars ? kSDReadVariables : 0)
- | (dump_global_marks ? kSDReadGlobalMarks : 0)
- | (num_marked_files ? kSDReadLocalMarks | kSDReadChanges : 0));
+ kSDReadUndisableableData
+ | kSDReadUnknown
+ | (dump_history ? kSDReadHistory : 0)
+ | (dump_registers ? kSDReadRegisters : 0)
+ | (dump_global_vars ? kSDReadVariables : 0)
+ | (dump_global_marks ? kSDReadGlobalMarks : 0)
+ | (num_marked_files ? kSDReadLocalMarks | kSDReadChanges : 0));
msgpack_packer *const packer = msgpack_packer_new(sd_writer,
&msgpack_sd_writer_write);
@@ -2893,16 +2902,16 @@ static ShaDaWriteResult shada_write(ShaDaWriteDef *const sd_writer,
for (size_t i = 0; i < HIST_COUNT; i++) {
if (dump_one_history[i]) {
hms_insert_whole_neovim_history(&wms->hms[i]);
- HMS_ITER(&wms->hms[i], cur_entry) {
+ HMS_ITER(&wms->hms[i], cur_entry, {
if (!shada_pack_encoded_entry(
- packer, &sd_writer->sd_conv, (PossiblyFreedShadaEntry) {
- .data = cur_entry->data,
- .can_free_entry = cur_entry->can_free_entry,
- }, max_kbyte)) {
+ packer, &sd_writer->sd_conv, (PossiblyFreedShadaEntry) {
+ .data = cur_entry->data,
+ .can_free_entry = cur_entry->can_free_entry,
+ }, max_kbyte)) {
ret = kSDWriteFailed;
break;
}
- }
+ })
hms_dealloc(&wms->hms[i]);
if (ret == kSDWriteFailed) {
goto shada_write_exit;
@@ -3353,8 +3362,8 @@ static inline char *get_converted_string(const vimconv_T *const sd_conv,
entry_name " entry at position %" PRIu64 " " \
error_desc
#define CHECK_KEY(key, expected) ( \
- key.via.str.size == sizeof(expected) - 1 \
- && STRNCMP(key.via.str.ptr, expected, sizeof(expected) - 1) == 0)
+ key.via.str.size == sizeof(expected) - 1 \
+ && STRNCMP(key.via.str.ptr, expected, sizeof(expected) - 1) == 0)
#define CLEAR_GA_AND_ERROR_OUT(ga) \
do { \
ga_clear(&ga); \
@@ -3377,18 +3386,17 @@ static inline char *get_converted_string(const vimconv_T *const sd_conv,
tgt = proc(obj.via.attr); \
} while (0)
#define CHECK_KEY_IS_STR(entry_name) \
- do { \
- if (unpacked.data.via.map.ptr[i].key.type != MSGPACK_OBJECT_STR) { \
- emsgu(_(READERR(entry_name, "has key which is not a string")), \
- initial_fpos); \
- CLEAR_GA_AND_ERROR_OUT(ad_ga); \
- } else if (unpacked.data.via.map.ptr[i].key.via.str.size == 0) { \
- emsgu(_(READERR(entry_name, "has empty key")), initial_fpos); \
- CLEAR_GA_AND_ERROR_OUT(ad_ga); \
- } \
- } while (0)
+ if (unpacked.data.via.map.ptr[i].key.type != MSGPACK_OBJECT_STR) { \
+ emsgu(_(READERR(entry_name, "has key which is not a string")), \
+ initial_fpos); \
+ CLEAR_GA_AND_ERROR_OUT(ad_ga); \
+ } else if (unpacked.data.via.map.ptr[i].key.via.str.size == 0) { \
+ emsgu(_(READERR(entry_name, "has empty key")), initial_fpos); \
+ CLEAR_GA_AND_ERROR_OUT(ad_ga); \
+ }
#define CHECKED_KEY(entry_name, name, error_desc, tgt, condition, attr, proc) \
- if (CHECK_KEY(unpacked.data.via.map.ptr[i].key, name)) { \
+ else if (CHECK_KEY( /* NOLINT(readability/braces) */ \
+ unpacked.data.via.map.ptr[i].key, name)) { \
CHECKED_ENTRY( \
condition, "has " name " key value " error_desc, \
entry_name, unpacked.data.via.map.ptr[i].val, \
@@ -3408,17 +3416,17 @@ static inline char *get_converted_string(const vimconv_T *const sd_conv,
#define INT_KEY(entry_name, name, tgt, proc) \
CHECKED_KEY( \
entry_name, name, "which is not an integer", tgt, \
- (unpacked.data.via.map.ptr[i].val.type \
- == MSGPACK_OBJECT_POSITIVE_INTEGER \
- || unpacked.data.via.map.ptr[i].val.type \
- == MSGPACK_OBJECT_NEGATIVE_INTEGER), \
+ ((unpacked.data.via.map.ptr[i].val.type \
+ == MSGPACK_OBJECT_POSITIVE_INTEGER) \
+ || (unpacked.data.via.map.ptr[i].val.type \
+ == MSGPACK_OBJECT_NEGATIVE_INTEGER)), \
i64, proc)
#define INTEGER_KEY(entry_name, name, tgt) \
INT_KEY(entry_name, name, tgt, TOINT)
#define LONG_KEY(entry_name, name, tgt) \
INT_KEY(entry_name, name, tgt, TOLONG)
#define ADDITIONAL_KEY \
- { \
+ else { /* NOLINT(readability/braces) */ \
ga_grow(&ad_ga, 1); \
memcpy(((char *)ad_ga.ga_data) + ((size_t) ad_ga.ga_len \
* sizeof(*unpacked.data.via.map.ptr)), \
@@ -3427,9 +3435,9 @@ static inline char *get_converted_string(const vimconv_T *const sd_conv,
ad_ga.ga_len++; \
}
#define CONVERTED(str, len) ( \
- sd_reader->sd_conv.vc_type != CONV_NONE \
- ? get_converted_string(&sd_reader->sd_conv, (str), (len)) \
- : xmemdupz((str), (len)))
+ sd_reader->sd_conv.vc_type != CONV_NONE \
+ ? get_converted_string(&sd_reader->sd_conv, (str), (len)) \
+ : xmemdupz((str), (len)))
#define BIN_CONVERTED(b) CONVERTED(b.ptr, b.size)
#define SET_ADDITIONAL_DATA(tgt, name) \
do { \
@@ -3623,38 +3631,28 @@ shada_read_next_item_start:
garray_T ad_ga;
ga_init(&ad_ga, sizeof(*(unpacked.data.via.map.ptr)), 1);
for (size_t i = 0; i < unpacked.data.via.map.size; i++) {
- CHECK_KEY_IS_STR("search pattern");
+ CHECK_KEY_IS_STR("search pattern")
BOOLEAN_KEY("search pattern", SEARCH_KEY_MAGIC,
entry->data.search_pattern.magic)
- else
- BOOLEAN_KEY("search pattern", SEARCH_KEY_SMARTCASE,
- entry->data.search_pattern.smartcase)
- else
- BOOLEAN_KEY("search pattern", SEARCH_KEY_HAS_LINE_OFFSET,
- entry->data.search_pattern.has_line_offset)
- else
- BOOLEAN_KEY("search pattern", SEARCH_KEY_PLACE_CURSOR_AT_END,
- entry->data.search_pattern.place_cursor_at_end)
- else
- BOOLEAN_KEY("search pattern", SEARCH_KEY_IS_LAST_USED,
- entry->data.search_pattern.is_last_used)
- else
- BOOLEAN_KEY("search pattern", SEARCH_KEY_IS_SUBSTITUTE_PATTERN,
- entry->data.search_pattern.is_substitute_pattern)
- else
- BOOLEAN_KEY("search pattern", SEARCH_KEY_HIGHLIGHTED,
- entry->data.search_pattern.highlighted)
- else
- BOOLEAN_KEY("search pattern", SEARCH_KEY_BACKWARD,
- entry->data.search_pattern.search_backward)
- else
- INTEGER_KEY("search pattern", SEARCH_KEY_OFFSET,
- entry->data.search_pattern.offset)
- else
- CONVERTED_STRING_KEY("search pattern", SEARCH_KEY_PAT,
- entry->data.search_pattern.pat)
- else
- ADDITIONAL_KEY
+ BOOLEAN_KEY("search pattern", SEARCH_KEY_SMARTCASE,
+ entry->data.search_pattern.smartcase)
+ BOOLEAN_KEY("search pattern", SEARCH_KEY_HAS_LINE_OFFSET,
+ entry->data.search_pattern.has_line_offset)
+ BOOLEAN_KEY("search pattern", SEARCH_KEY_PLACE_CURSOR_AT_END,
+ entry->data.search_pattern.place_cursor_at_end)
+ BOOLEAN_KEY("search pattern", SEARCH_KEY_IS_LAST_USED,
+ entry->data.search_pattern.is_last_used)
+ BOOLEAN_KEY("search pattern", SEARCH_KEY_IS_SUBSTITUTE_PATTERN,
+ entry->data.search_pattern.is_substitute_pattern)
+ BOOLEAN_KEY("search pattern", SEARCH_KEY_HIGHLIGHTED,
+ entry->data.search_pattern.highlighted)
+ BOOLEAN_KEY("search pattern", SEARCH_KEY_BACKWARD,
+ entry->data.search_pattern.search_backward)
+ INTEGER_KEY("search pattern", SEARCH_KEY_OFFSET,
+ entry->data.search_pattern.offset)
+ CONVERTED_STRING_KEY("search pattern", SEARCH_KEY_PAT,
+ entry->data.search_pattern.pat)
+ ADDITIONAL_KEY
}
if (entry->data.search_pattern.pat == NULL) {
emsgu(_(READERR("search pattern", "has no pattern")), initial_fpos);
@@ -3675,7 +3673,7 @@ shada_read_next_item_start:
garray_T ad_ga;
ga_init(&ad_ga, sizeof(*(unpacked.data.via.map.ptr)), 1);
for (size_t i = 0; i < unpacked.data.via.map.size; i++) {
- CHECK_KEY_IS_STR("mark");
+ CHECK_KEY_IS_STR("mark")
if (CHECK_KEY(unpacked.data.via.map.ptr[i].key, KEY_NAME_CHAR)) {
if (type_u64 == kSDItemJump || type_u64 == kSDItemChange) {
emsgu(_(READERR("mark", "has n key which is only valid for "
@@ -3688,15 +3686,11 @@ shada_read_next_item_start:
"has n key value which is not an unsigned integer",
"mark", unpacked.data.via.map.ptr[i].val,
entry->data.filemark.name, u64, TOCHAR);
- } else {
- LONG_KEY("mark", KEY_LNUM, entry->data.filemark.mark.lnum)
- else
- INTEGER_KEY("mark", KEY_COL, entry->data.filemark.mark.col)
- else
- STRING_KEY("mark", KEY_FILE, entry->data.filemark.fname)
- else
- ADDITIONAL_KEY
}
+ LONG_KEY("mark", KEY_LNUM, entry->data.filemark.mark.lnum)
+ INTEGER_KEY("mark", KEY_COL, entry->data.filemark.mark.col)
+ STRING_KEY("mark", KEY_FILE, entry->data.filemark.fname)
+ ADDITIONAL_KEY
}
if (entry->data.filemark.fname == NULL) {
emsgu(_(READERR("mark", "is missing file name")), initial_fpos);
@@ -3721,48 +3715,44 @@ shada_read_next_item_start:
garray_T ad_ga;
ga_init(&ad_ga, sizeof(*(unpacked.data.via.map.ptr)), 1);
for (size_t i = 0; i < unpacked.data.via.map.size; i++) {
- CHECK_KEY_IS_STR("register");
- TYPED_KEY("register", REG_KEY_TYPE, "an unsigned integer",
- entry->data.reg.type, POSITIVE_INTEGER, u64, TOU8)
- else
- TYPED_KEY("register", KEY_NAME_CHAR, "an unsigned integer",
- entry->data.reg.name, POSITIVE_INTEGER, u64, TOCHAR)
- else
- TYPED_KEY("register", REG_KEY_WIDTH, "an unsigned integer",
- entry->data.reg.width, POSITIVE_INTEGER, u64, TOSIZE)
- else
- if (CHECK_KEY(unpacked.data.via.map.ptr[i].key,
- REG_KEY_CONTENTS)) {
- if (unpacked.data.via.map.ptr[i].val.type != MSGPACK_OBJECT_ARRAY) {
- emsgu(_(READERR(
- "register",
- "has " REG_KEY_CONTENTS " key with non-array value")),
- initial_fpos);
- CLEAR_GA_AND_ERROR_OUT(ad_ga);
- }
- if (unpacked.data.via.map.ptr[i].val.via.array.size == 0) {
- emsgu(_(READERR("register",
- "has " REG_KEY_CONTENTS " key with empty array")),
- initial_fpos);
+ CHECK_KEY_IS_STR("register")
+ if (CHECK_KEY(unpacked.data.via.map.ptr[i].key,
+ REG_KEY_CONTENTS)) {
+ if (unpacked.data.via.map.ptr[i].val.type != MSGPACK_OBJECT_ARRAY) {
+ emsgu(_(READERR("register",
+ "has " REG_KEY_CONTENTS
+ " key with non-array value")),
+ initial_fpos);
+ CLEAR_GA_AND_ERROR_OUT(ad_ga);
+ }
+ if (unpacked.data.via.map.ptr[i].val.via.array.size == 0) {
+ emsgu(_(READERR("register",
+ "has " REG_KEY_CONTENTS " key with empty array")),
+ initial_fpos);
+ CLEAR_GA_AND_ERROR_OUT(ad_ga);
+ }
+ const msgpack_object_array arr =
+ unpacked.data.via.map.ptr[i].val.via.array;
+ for (size_t i = 0; i < arr.size; i++) {
+ if (arr.ptr[i].type != MSGPACK_OBJECT_BIN) {
+ emsgu(_(READERR("register", "has " REG_KEY_CONTENTS " array "
+ "with non-binary value")), initial_fpos);
CLEAR_GA_AND_ERROR_OUT(ad_ga);
}
- const msgpack_object_array arr =
- unpacked.data.via.map.ptr[i].val.via.array;
- for (size_t i = 0; i < arr.size; i++) {
- if (arr.ptr[i].type != MSGPACK_OBJECT_BIN) {
- emsgu(_(READERR("register", "has " REG_KEY_CONTENTS " array "
- "with non-binary value")), initial_fpos);
- CLEAR_GA_AND_ERROR_OUT(ad_ga);
- }
- }
- entry->data.reg.contents_size = arr.size;
- entry->data.reg.contents = xmalloc(arr.size * sizeof(char *));
- for (size_t i = 0; i < arr.size; i++) {
- entry->data.reg.contents[i] = BIN_CONVERTED(arr.ptr[i].via.bin);
- }
- } else {
- ADDITIONAL_KEY
}
+ entry->data.reg.contents_size = arr.size;
+ entry->data.reg.contents = xmalloc(arr.size * sizeof(char *));
+ for (size_t i = 0; i < arr.size; i++) {
+ entry->data.reg.contents[i] = BIN_CONVERTED(arr.ptr[i].via.bin);
+ }
+ }
+ TYPED_KEY("register", REG_KEY_TYPE, "an unsigned integer",
+ entry->data.reg.type, POSITIVE_INTEGER, u64, TOU8)
+ TYPED_KEY("register", KEY_NAME_CHAR, "an unsigned integer",
+ entry->data.reg.name, POSITIVE_INTEGER, u64, TOCHAR)
+ TYPED_KEY("register", REG_KEY_WIDTH, "an unsigned integer",
+ entry->data.reg.width, POSITIVE_INTEGER, u64, TOSIZE)
+ ADDITIONAL_KEY
}
if (entry->data.reg.contents == NULL) {
emsgu(_(READERR("register", "has missing " REG_KEY_CONTENTS " array")),
@@ -3830,8 +3820,8 @@ shada_read_next_item_hist_no_conv:
+ 1); // Separator character
entry->data.history_item.string = xmalloc(strsize);
memcpy(entry->data.history_item.string,
- unpacked.data.via.array.ptr[1].via.bin.ptr,
- unpacked.data.via.array.ptr[1].via.bin.size);
+ unpacked.data.via.array.ptr[1].via.bin.ptr,
+ unpacked.data.via.array.ptr[1].via.bin.size);
} else {
size_t len = unpacked.data.via.array.ptr[1].via.bin.size;
char *const converted = string_convert(
@@ -3951,17 +3941,14 @@ shada_read_next_item_hist_no_conv:
const size_t j = i;
{
for (size_t i = 0; i < unpacked.data.via.map.size; i++) {
- CHECK_KEY_IS_STR("buffer list entry");
+ CHECK_KEY_IS_STR("buffer list entry")
LONG_KEY("buffer list entry", KEY_LNUM,
- entry->data.buffer_list.buffers[j].pos.lnum)
- else
- INTEGER_KEY("buffer list entry", KEY_COL,
- entry->data.buffer_list.buffers[j].pos.col)
- else
- STRING_KEY("buffer list entry", KEY_FILE,
- entry->data.buffer_list.buffers[j].fname)
- else
- ADDITIONAL_KEY
+ entry->data.buffer_list.buffers[j].pos.lnum)
+ INTEGER_KEY("buffer list entry", KEY_COL,
+ entry->data.buffer_list.buffers[j].pos.col)
+ STRING_KEY("buffer list entry", KEY_FILE,
+ entry->data.buffer_list.buffers[j].fname)
+ ADDITIONAL_KEY
}
}
}
diff --git a/src/nvim/spell.c b/src/nvim/spell.c
index a5b66ad220..420e8e2b70 100644
--- a/src/nvim/spell.c
+++ b/src/nvim/spell.c
@@ -1,9 +1,3 @@
-// VIM - Vi IMproved by Bram Moolenaar
-//
-// Do ":help uganda" in Vim to read copying and usage conditions.
-// Do ":help credits" in Vim to see a list of people who contributed.
-// See README.md for an overview of the Vim source code.
-
// spell.c: code for spell checking
//
// The spell checking mechanism uses a tree (aka trie). Each node in the tree
diff --git a/src/nvim/strings.c b/src/nvim/strings.c
index 4bd394cb44..00dcf3cf46 100644
--- a/src/nvim/strings.c
+++ b/src/nvim/strings.c
@@ -1,4 +1,3 @@
-
#include <inttypes.h>
#include <stdbool.h>
#include <string.h>
diff --git a/src/nvim/syntax.c b/src/nvim/syntax.c
index f65b21a40b..24422c71fb 100644
--- a/src/nvim/syntax.c
+++ b/src/nvim/syntax.c
@@ -1,12 +1,4 @@
/*
- * VIM - Vi IMproved by Bram Moolenaar
- *
- * Do ":help uganda" in Vim to read copying and usage conditions.
- * Do ":help credits" in Vim to see a list of people who contributed.
- * See README.md for an overview of the Vim source code.
- */
-
-/*
* syntax.c: code for syntax highlighting
*/
diff --git a/src/nvim/tag.c b/src/nvim/tag.c
index 1b3fda8aca..d832924efd 100644
--- a/src/nvim/tag.c
+++ b/src/nvim/tag.c
@@ -1,12 +1,4 @@
/*
- * VIM - Vi IMproved by Bram Moolenaar
- *
- * Do ":help uganda" in Vim to read copying and usage conditions.
- * Do ":help credits" in Vim to see a list of people who contributed.
- * See README.md for an overview of the Vim source code.
- */
-
-/*
* Code to handle tags and the tag stack
*/
diff --git a/src/nvim/types.h b/src/nvim/types.h
index afd684925a..bfe8be2091 100644
--- a/src/nvim/types.h
+++ b/src/nvim/types.h
@@ -1,10 +1,3 @@
-/*
- * VIM - Vi IMproved by Bram Moolenaar
- *
- * Do ":help uganda" in Vim to read copying and usage conditions.
- * Do ":help credits" in Vim to see a list of people who contributed.
- */
-
#ifndef NVIM_TYPES_H
#define NVIM_TYPES_H
diff --git a/src/nvim/undo.c b/src/nvim/undo.c
index 6c87f01746..69ac18ad54 100644
--- a/src/nvim/undo.c
+++ b/src/nvim/undo.c
@@ -1,12 +1,4 @@
/*
- * VIM - Vi IMproved by Bram Moolenaar
- *
- * Do ":help uganda" in Vim to read copying and usage conditions.
- * Do ":help credits" in Vim to see a list of people who contributed.
- * See README.md for an overview of the Vim source code.
- */
-
-/*
* undo.c: multi level undo facility
*
* The saved lines are stored in a list of lists (one for each buffer):
@@ -283,32 +275,32 @@ int u_savedel(linenr_T lnum, long nlines)
nlines == curbuf->b_ml.ml_line_count ? 2 : lnum, FALSE);
}
-/*
- * Return TRUE when undo is allowed. Otherwise give an error message and
- * return FALSE.
- */
-int undo_allowed(void)
+/// Return true when undo is allowed. Otherwise print an error message and
+/// return false.
+///
+/// @return true if undo is allowed.
+bool undo_allowed(void)
{
/* Don't allow changes when 'modifiable' is off. */
if (!MODIFIABLE(curbuf)) {
EMSG(_(e_modifiable));
- return FALSE;
+ return false;
}
// In the sandbox it's not allowed to change the text.
if (sandbox != 0) {
EMSG(_(e_sandbox));
- return FALSE;
+ return false;
}
/* Don't allow changes in the buffer while editing the cmdline. The
* caller of getcmdline() may get confused. */
if (textlock != 0) {
EMSG(_(e_secure));
- return FALSE;
+ return false;
}
- return TRUE;
+ return true;
}
/*
@@ -755,7 +747,11 @@ static void u_free_uhp(u_header_T *uhp)
xfree(uhp);
}
-/// Writes the header.
+/// Writes the undofile header.
+///
+/// @param bi The buffer information
+/// @param hash The hash of the buffer contents
+//
/// @returns false in case of an error.
static bool serialize_header(bufinfo_T *bi, char_u *hash)
FUNC_ATTR_NONNULL_ALL
@@ -809,6 +805,12 @@ static bool serialize_header(bufinfo_T *bi, char_u *hash)
return true;
}
+/// Writes an undo header.
+///
+/// @param bi The buffer information
+/// @param uhp The undo header to write
+//
+/// @returns false in case of an error.
static bool serialize_uhp(bufinfo_T *bi, u_header_T *uhp)
{
if (!undo_write_bytes(bi, (uintmax_t)UF_HEADER_MAGIC, 2)) {
@@ -929,6 +931,9 @@ static u_header_T *unserialize_uhp(bufinfo_T *bi,
/// Serializes "uep".
///
+/// @param bi The buffer information
+/// @param uep The undo entry to write
+//
/// @returns false in case of an error.
static bool serialize_uep(bufinfo_T *bi, u_entry_T *uep)
{
@@ -1553,6 +1558,10 @@ theend:
/// Writes a sequence of bytes to the undo file.
///
+/// @param bi The buffer info
+/// @param ptr The byte buffer to write
+/// @param len The number of bytes to write
+///
/// @returns false in case of an error.
static bool undo_write(bufinfo_T *bi, uint8_t *ptr, size_t len)
FUNC_ATTR_NONNULL_ARG(1)
@@ -1564,6 +1573,10 @@ static bool undo_write(bufinfo_T *bi, uint8_t *ptr, size_t len)
///
/// Must match with undo_read_?c() functions.
///
+/// @param bi The buffer info
+/// @param nr The number to write
+/// @param len The number of bytes to use when writing the number.
+///
/// @returns false in case of an error.
static bool undo_write_bytes(bufinfo_T *bi, uintmax_t nr, size_t len)
{
@@ -1608,6 +1621,10 @@ static time_t undo_read_time(bufinfo_T *bi)
/// Reads "buffer[size]" from the undo file.
///
+/// @param bi The buffer info
+/// @param buffer Character buffer to read data into
+/// @param size The size of the character buffer
+///
/// @returns false in case of an error.
static bool undo_read(bufinfo_T *bi, uint8_t *buffer, size_t size)
FUNC_ATTR_NONNULL_ARG(1)
@@ -2838,19 +2855,26 @@ static char_u *u_save_line(linenr_T lnum)
return vim_strsave(ml_get(lnum));
}
-/*
- * Check if the 'modified' flag is set, or 'ff' has changed (only need to
- * check the first character, because it can only be "dos", "unix" or "mac").
- * "nofile" and "scratch" type buffers are considered to always be unchanged.
- */
-int bufIsChanged(buf_T *buf)
+/// Check if the 'modified' flag is set, or 'ff' has changed (only need to
+/// check the first character, because it can only be "dos", "unix" or "mac").
+/// "nofile" and "scratch" type buffers are considered to always be unchanged.
+///
+/// @param buf The buffer to check
+///
+/// @return true if the buffer has changed
+bool bufIsChanged(buf_T *buf)
{
return
!bt_dontwrite(buf) &&
(buf->b_changed || file_ff_differs(buf, true));
}
-int curbufIsChanged(void)
+/// Check if the 'modified' flag is set, or 'ff' has changed (only need to
+/// check the first character, because it can only be "dos", "unix" or "mac").
+/// "nofile" and "scratch" type buffers are considered to always be unchanged.
+///
+/// @return true if the current buffer has changed
+bool curbufIsChanged(void)
{
return
!bt_dontwrite(curbuf) &&
diff --git a/src/nvim/version.c b/src/nvim/version.c
index b45d98aa37..2b0d6f22f2 100644
--- a/src/nvim/version.c
+++ b/src/nvim/version.c
@@ -347,7 +347,7 @@ static int included_patches[] = {
// 652 NA
651,
// 650 NA
- // 649,
+ 649,
// 648 NA
// 647 NA
646,
@@ -365,7 +365,7 @@ static int included_patches[] = {
// 634,
633,
// 632 NA
- // 631,
+ 631,
630,
629,
// 628,
@@ -373,13 +373,13 @@ static int included_patches[] = {
// 626 NA
// 625 NA
// 624,
- // 623,
+ 623,
// 622 NA
// 621 NA
// 620,
// 619 NA
// 618 NA
- // 617,
+ 617,
// 616,
615,
// 614,
diff --git a/src/nvim/vim.h b/src/nvim/vim.h
index 48d53369de..fa00d9efcf 100644
--- a/src/nvim/vim.h
+++ b/src/nvim/vim.h
@@ -1,10 +1,3 @@
-/*
- * VIM - Vi IMproved by Bram Moolenaar
- *
- * Do ":help uganda" in Vim to read copying and usage conditions.
- * Do ":help credits" in Vim to see a list of people who contributed.
- */
-
#ifndef NVIM_VIM_H
#define NVIM_VIM_H
diff --git a/src/nvim/window.c b/src/nvim/window.c
index 8ac50b2731..16ff7dfb14 100644
--- a/src/nvim/window.c
+++ b/src/nvim/window.c
@@ -1,11 +1,3 @@
-/*
- * VIM - Vi IMproved by Bram Moolenaar
- *
- * Do ":help uganda" in Vim to read a list of people who contributed.
- * Do ":help credits" in Vim to see a list of people who contributed.
- * See README.md for an overview of the Vim source code.
- */
-
#include <assert.h>
#include <inttypes.h>
#include <stdbool.h>
diff --git a/test/functional/plugin/shada_spec.lua b/test/functional/plugin/shada_spec.lua
index 020bb11bbc..4100a30452 100644
--- a/test/functional/plugin/shada_spec.lua
+++ b/test/functional/plugin/shada_spec.lua
@@ -2114,6 +2114,11 @@ describe('In plugin/shada.vim', function()
os.remove(fname_tmp)
end)
+ teardown(function()
+ os.remove(fname)
+ os.remove(fname_tmp)
+ end)
+
local shada_eq = function(expected, fname_)
local fd = io.open(fname_)
local mpack_result = fd:read('*a')
diff --git a/third-party/cmake/BuildLuarocks.cmake b/third-party/cmake/BuildLuarocks.cmake
index f3e5a96220..a6126af789 100644
--- a/third-party/cmake/BuildLuarocks.cmake
+++ b/third-party/cmake/BuildLuarocks.cmake
@@ -123,7 +123,7 @@ if(USE_BUNDLED_BUSTED)
add_custom_command(OUTPUT ${HOSTDEPS_BIN_DIR}/luacheck
COMMAND ${LUAROCKS_BINARY}
- ARGS build https://raw.githubusercontent.com/mpeterv/luacheck/0.12.0/luacheck-scm-1.rockspec ${LUAROCKS_BUILDARGS}
+ ARGS build https://raw.githubusercontent.com/mpeterv/luacheck/3929eaa3528be2a8a50c593d687c8625205a2033/luacheck-scm-1.rockspec ${LUAROCKS_BUILDARGS}
DEPENDS busted)
add_custom_target(luacheck
DEPENDS ${HOSTDEPS_BIN_DIR}/luacheck)