diff options
author | ZyX <kp-pav@yandex.ru> | 2017-11-06 20:23:35 +0300 |
---|---|---|
committer | ZyX <kp-pav@yandex.ru> | 2017-11-06 20:23:35 +0300 |
commit | 24a353364d6d186d528009fd0bb603d87183cf35 (patch) | |
tree | a4070dc00731475d6bbdd3c84e61806b33802f7a | |
parent | f2660bee6aca35be3d0ddb1d225784476c13cd27 (diff) | |
parent | 946c2a8ee85830c543e389724575ae531e89b170 (diff) | |
download | rneovim-24a353364d6d186d528009fd0bb603d87183cf35.tar.gz rneovim-24a353364d6d186d528009fd0bb603d87183cf35.tar.bz2 rneovim-24a353364d6d186d528009fd0bb603d87183cf35.zip |
Merge branch 'master' into expression-parser
229 files changed, 2785 insertions, 1246 deletions
@@ -34,6 +34,11 @@ Install from source make CMAKE_BUILD_TYPE=RelWithDebInfo sudo make install +To install to a non-default location, specify `CMAKE_INSTALL_PREFIX`: + + make CMAKE_EXTRA_FLAGS="-DCMAKE_INSTALL_PREFIX=/full/path/" + make install + See [the wiki](https://github.com/neovim/neovim/wiki/Building-Neovim) for details. Install from package diff --git a/runtime/autoload/javascriptcomplete.vim b/runtime/autoload/javascriptcomplete.vim index 2abe41b463..14bc3d7ce3 100644 --- a/runtime/autoload/javascriptcomplete.vim +++ b/runtime/autoload/javascriptcomplete.vim @@ -1,7 +1,7 @@ " Vim completion script " Language: Java Script " Maintainer: Mikolaj Machowski ( mikmach AT wp DOT pl ) -" Last Change: 2006 Apr 30 +" Last Change: 2017 Mar 04 function! javascriptcomplete#CompleteJS(findstart, base) if a:findstart @@ -563,7 +563,7 @@ function! javascriptcomplete#CompleteJS(findstart, base) for i in arguments let g:ia = i let f_elements = matchlist(i, 'function\s\+\(\k\+\)\s*(\(.\{-}\))') - if len(f_elements) == 3 + if len(f_elements) >= 3 let b:js_menuinfo[f_elements[1].'('] = f_elements[2] endif endfor diff --git a/runtime/autoload/spellfile.vim b/runtime/autoload/spellfile.vim index a5ffa514ea..fe7113b9a4 100644 --- a/runtime/autoload/spellfile.vim +++ b/runtime/autoload/spellfile.vim @@ -88,8 +88,8 @@ function! spellfile#LoadFile(lang) endif endif if newbufnr == winbufnr(0) - " We are back the old buffer, remove any (half-finished) download. - g/^/d_ + " We are back to the old buffer, remove any (half-finished) download. + keeppatterns g/^/d_ else let newbufnr = winbufnr(0) endif @@ -127,7 +127,7 @@ function! spellfile#LoadFile(lang) exe "write " . dirname . '/' . fname " Also download the .sug file. - g/^/d_ + keeppatterns g/^/d_ let fname = substitute(fname, '\.spl$', '.sug', '') echo 'Downloading ' . fname . '...' call spellfile#Nread(fname) diff --git a/runtime/compiler/bdf.vim b/runtime/compiler/bdf.vim index ca33776988..b062e847aa 100644 --- a/runtime/compiler/bdf.vim +++ b/runtime/compiler/bdf.vim @@ -1,7 +1,7 @@ " Vim compiler file -" Compiler: BDF to PCF Conversion -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2006-04-19 +" Compiler: BDF to PCF Conversion +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2006-04-19 if exists("current_compiler") finish diff --git a/runtime/compiler/gcc.vim b/runtime/compiler/gcc.vim index 19ea2edc12..1af568de57 100644 --- a/runtime/compiler/gcc.vim +++ b/runtime/compiler/gcc.vim @@ -1,7 +1,7 @@ " Vim compiler file -" Compiler: GNU C Compiler -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2010-10-14 +" Compiler: GNU C Compiler +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2010-10-14 " added line suggested by Anton Lindqvist 2016 Mar 31 if exists("current_compiler") diff --git a/runtime/compiler/rst.vim b/runtime/compiler/rst.vim index 15d2d79f64..c34bd3ba81 100644 --- a/runtime/compiler/rst.vim +++ b/runtime/compiler/rst.vim @@ -1,7 +1,7 @@ " Vim compiler file -" Compiler: reStructuredText Documentation Format -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2006-04-19 +" Compiler: reStructuredText Documentation Format +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2006-04-19 if exists("current_compiler") finish diff --git a/runtime/doc/api.txt b/runtime/doc/api.txt index 159dd93c5e..ef8b9c7d47 100644 --- a/runtime/doc/api.txt +++ b/runtime/doc/api.txt @@ -7,7 +7,7 @@ Nvim API *API* *api* Nvim exposes a powerful API that can be used by plugins and external processes -via |msgpack-rpc|, Lua and VimL (|eval-api|). +via |RPC|, |Lua| and VimL (|eval-api|). Applications can also embed libnvim to work with the C API directly. @@ -135,6 +135,26 @@ nvim_command({command}) *nvim_command()* Parameters:~ {command} Ex-command string +nvim_get_hl_by_name({name}, {rgb}) *nvim_get_hl_by_name()* + Gets a highlight definition by name. + + Parameters:~ + {name} Highlight group name + {rgb} Export RGB colors + + Return:~ + Highlight definition map + +nvim_get_hl_by_id({hl_id}, {rgb}) *nvim_get_hl_by_id()* + Gets a highlight definition by id. |hlID()| + + Parameters:~ + {hl_id} Highlight id as returned by |hlID()| + {rgb} Export RGB colors + + Return:~ + Highlight definition map + nvim_feedkeys({keys}, {mode}, {escape_csi}) *nvim_feedkeys()* Passes input keys to Nvim. On VimL error: Does not fail, but updates v:errmsg. @@ -151,7 +171,11 @@ nvim_input({keys}) *nvim_input()* Unlike `nvim_feedkeys`, this uses a lower-level input buffer and the call is not deferred. This is the most reliable way to - emulate real user input. + send real user input. + + Note: + |keycodes| like <CR> are translated, so "<" is special. To + input a literal "<", send <LT>. Attributes:~ {async} @@ -204,14 +228,11 @@ nvim_call_function({fname}, {args}) *nvim_call_function()* Result of the function call nvim_execute_lua({code}, {args}) *nvim_execute_lua()* - Execute lua code. Parameters might be passed, they are - available inside the chunk as `...`. The chunk can return a - value. + Execute lua code. Parameters (if any) are available as `...` + inside the chunk. The chunk can return a value. - To evaluate an expression, it must be prefixed with "return ". - For instance, to call a lua function with arguments sent in - and get its return value back, use the code "return - my_function(...)". + Only statements are executed. To evaluate an expression, + prefix it with `return`: return my_function(...) Parameters:~ {code} lua code to execute @@ -220,7 +241,7 @@ nvim_execute_lua({code}, {args}) *nvim_execute_lua()* Return:~ Return value of lua code if present or NIL. -nvim_strwidth({str}) *nvim_strwidth()* +nvim_strwidth({text}) *nvim_strwidth()* Calculates the number of display cells occupied by `text`. <Tab> counts as one cell. @@ -347,7 +368,7 @@ nvim_set_current_buf({buffer}) *nvim_set_current_buf()* Sets the current buffer Parameters:~ - {id} Buffer handle + {buffer} Buffer handle nvim_list_wins() *nvim_list_wins()* Gets the current list of window handles @@ -365,7 +386,7 @@ nvim_set_current_win({window}) *nvim_set_current_win()* Sets the current window Parameters:~ - {handle} Window handle + {window} Window handle nvim_list_tabpages() *nvim_list_tabpages()* Gets the current list of tabpage handles @@ -383,7 +404,7 @@ nvim_set_current_tabpage({tabpage}) *nvim_set_current_tabpage()* Sets the current tabpage Parameters:~ - {handle} Tabpage handle + {tabpage} Tabpage handle nvim_subscribe({event}) *nvim_subscribe()* Subscribes to event broadcasts @@ -404,26 +425,25 @@ nvim_get_color_map() *nvim_get_color_map()* TODO: Documentation nvim_get_mode() *nvim_get_mode()* - Gets the current mode. - mode: Mode string. |mode()| - blocking: true if Nvim is waiting for input. - - Attributes:~ - {async} + Gets the current mode. |mode()| "blocking" is true if Nvim is + waiting for input. Return:~ Dictionary { "mode": String, "blocking": Boolean } + Attributes:~ + {async} + nvim_get_keymap({mode}) *nvim_get_keymap()* - Get a list of dictionaries describing global (i.e. non-buffer) - mappings Note that the "buffer" key will be 0 to represent - false. + Gets a list of dictionaries describing global (non-buffer) + mappings. The "buffer" key in the returned dictionary is + always zero. Parameters:~ - {mode} The abbreviation for the mode + {mode} Mode short-name ("n", "i", "v", ...) Return:~ - An array of maparg() like dictionaries describing mappings + Array of maparg()-like dictionaries describing mappings nvim_get_api_info() *nvim_get_api_info()* TODO: Documentation @@ -584,16 +604,16 @@ nvim_buf_get_changedtick({buffer}) *nvim_buf_get_changedtick()* b:changedtickvalue. nvim_buf_get_keymap({buffer}, {mode}) *nvim_buf_get_keymap()* - Get a list of dictionaries describing buffer-local mappings - Note that the buffer key in the dictionary will represent the - buffer handle where the mapping is present + Gets a list of dictionaries describing buffer-local mappings. + The "buffer" key in the returned dictionary reflects the + buffer handle where the mapping is present. Parameters:~ - {mode} The abbreviation for the mode - {buffer_id} Buffer handle + {mode} Mode short-name ("n", "i", "v", ...) + {buffer} Buffer handle Return:~ - An array of maparg() like dictionaries describing mappings + Array of maparg()-like dictionaries describing mappings nvim_buf_set_var({buffer}, {name}, {value}) *nvim_buf_set_var()* Sets a buffer-scoped (b:) variable @@ -670,24 +690,24 @@ nvim_buf_add_highlight({buffer}, {src_id}, {hl_group}, {line}, {col_start}, {col_end}) Adds a highlight to buffer. - This can be used for plugins which dynamically generate - highlights to a buffer (like a semantic highlighter or - linter). The function adds a single highlight to a buffer. - Unlike matchaddpos() highlights follow changes to line - numbering (as lines are inserted/removed above the highlighted - line), like signs and marks do. - - "src_id" is useful for batch deletion/updating of a set of - highlights. When called with src_id = 0, an unique source id - is generated and returned. Succesive calls can pass in it as - "src_id" to add new highlights to the same source group. All - highlights in the same group can then be cleared with - nvim_buf_clear_highlight. If the highlight never will be - manually deleted pass in -1 for "src_id". - - If "hl_group" is the empty string no highlight is added, but a - new src_id is still returned. This is useful for an external - plugin to synchrounously request an unique src_id at + Useful for plugins that dynamically generate highlights to a + buffer (like a semantic highlighter or linter). The function + adds a single highlight to a buffer. Unlike matchaddpos() + highlights follow changes to line numbering (as lines are + inserted/removed above the highlighted line), like signs and + marks do. + + `src_id` is useful for batch deletion/updating of a set of + highlights. When called with `src_id = 0`, an unique source id + is generated and returned. Successive calls can pass that + `src_id` to associate new highlights with the same source + group. All highlights in the same group can be cleared with + `nvim_buf_clear_highlight`. If the highlight never will be + manually deleted, pass `src_id = -1`. + + If `hl_group` is the empty string no highlight is added, but a + new `src_id` is still returned. This is useful for an external + plugin to synchrounously request an unique `src_id` at initialization, and later asynchronously add and clear highlights in response to buffer changes. @@ -696,7 +716,7 @@ nvim_buf_add_highlight({buffer}, {src_id}, {hl_group}, {line}, {src_id} Source group to use or 0 to use a new group, or -1 for ungrouped highlight {hl_group} Name of the highlight group to use - {line} Line to highlight + {line} Line to highlight (zero-indexed) {col_start} Start of range of columns to highlight {col_end} End of range of columns to highlight, or -1 to highlight to end of line @@ -948,4 +968,4 @@ nvim_ui_try_resize({width}, {height}) *nvim_ui_try_resize()* nvim_ui_set_option({name}, {value}) *nvim_ui_set_option()* TODO: Documentation - vim:tw=78:ts=8:ft=help:norl: + vim:tw=78:ts=8:ft=help:norl:
\ No newline at end of file diff --git a/runtime/doc/develop.txt b/runtime/doc/develop.txt index 298f64bbee..36826e2479 100644 --- a/runtime/doc/develop.txt +++ b/runtime/doc/develop.txt @@ -142,6 +142,8 @@ shell The Vim application. This can cover the whole screen (e.g., window View on a buffer. There can be several windows in Vim, together with the command line, menubar, toolbar, etc. they fit in the shell. +frame Windows are kept in a tree of frames. Each frame contains + a column, row, or window ("leaf" frame). PROVIDERS *dev-provider* @@ -230,23 +232,47 @@ _not_ a Buffer). The common {action} "list" indicates that it lists all bufs (plural) in the global context. +API-CLIENT *dev-api-client* + +Package Naming ~ +API client packages should NOT be named something ambiguous like "neovim" or +"python-client". Use "nvim" as a prefix/suffix to some other identifier +following ecosystem conventions. + +For example, Python packages tend to have "py" in the name, so "pynvim" is +a good name: it's idiomatic and unambiguous. If the package is named "neovim", +it confuses users, and complicates documentation and discussions. + +Examples of API-client package names: + GOOD: nvim-racket + GOOD: pynvim + BAD: python-client + BAD: neovim + +Implementation ~ +Consider using libmpack instead of the msgpack.org C/C++ library. libmpack is +small, efficient, and C89-compatible. It can be easily inlined in your +C project source, too. https://github.com/libmpack/libmpack/ + + EXTERNAL UI *dev-ui* +Compatibility ~ External UIs should be aware of the |api-contract|. In particular, future -versions of Nvim may add optional, new items to existing events. The API is -strongly backwards-compatible, but clients must not break if new fields are -added to existing events. +versions of Nvim may add new items to existing events. The API is strongly +backwards-compatible, but clients must not break if new fields are added to +existing events. -External UIs are expected to implement some common features. +Common Features ~ +External UIs are expected to implement these common features: +- Cursor style (shape, color) should respond to the 'guicursor' properties + delivered with the mode_info_set UI event. +- Send the "super" key (Windows key, Apple key) as a |<D-| chord. -- Users may want to configure UI-specific options. The UI should publish the - |GUIEnter| autocmd after attaching to Nvim: > - doautocmd GUIEnter +Implementation ~ - Options can be monitored for changes by the |OptionSet| autocmd. E.g. if the user sets the 'guifont' option, this autocmd notifies channel 42: > autocmd OptionSet guifont call rpcnotify(42, 'option-changed', 'guifont', &guifont) -- cursor-shape change: 'guicursor' properties are sent in the mode_info_set UI - event. vim:tw=78:ts=8:ft=help:norl: diff --git a/runtime/doc/editing.txt b/runtime/doc/editing.txt index a747058991..0099d14822 100644 --- a/runtime/doc/editing.txt +++ b/runtime/doc/editing.txt @@ -236,7 +236,7 @@ If you want to keep the changed buffer without saving it, switch on the *:vie* *:view* :vie[w][!] [++opt] [+cmd] file - When used in Ex mode: Leave |Ex mode|, go back to + When used in Ex mode: Leave |Ex-mode|, go back to Normal mode. Otherwise same as |:edit|, but set 'readonly' option for this buffer. diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt index 300bdd061e..7bf148a833 100644 --- a/runtime/doc/eval.txt +++ b/runtime/doc/eval.txt @@ -1785,7 +1785,7 @@ v:scrollstart String describing the script or function that caused the *v:servername* *servername-variable* *$NVIM_LISTEN_ADDRESS* -v:servername Default {Nvim} server address. Equivalent to +v:servername Default Nvim server address. Equivalent to |$NVIM_LISTEN_ADDRESS| on startup. |serverstop()| Read-only. @@ -1870,6 +1870,8 @@ v:termresponse The escape sequence returned by the terminal for the DA *v:testing* *testing-variable* v:testing Must be set before using `test_garbagecollect_now()`. + Also, when set certain error messages won't be shown for 2 + seconds. (e.g. "'dictionary' option is empty") *v:this_session* *this_session-variable* v:this_session Full filename of the last loaded or saved session file. See @@ -3197,7 +3199,7 @@ execute({command} [, {silent}]) *execute()* "" no `:silent` used "silent" `:silent` used "silent!" `:silent!` used - The default is 'silent'. Note that with "silent!", unlike + The default is "silent". Note that with "silent!", unlike `:redir`, error messages are dropped. To get a list of lines use |split()| on the result: > @@ -3775,10 +3777,10 @@ get({dict}, {key} [, {default}]) get({func}, {what}) Get item {what} from Funcref {func}. Possible values for {what} are: - 'name' The function name - 'func' The function - 'dict' The dictionary - 'args' The list with arguments + "name" The function name + "func" The function + "dict" The dictionary + "args" The list with arguments *getbufinfo()* getbufinfo([{expr}]) @@ -4915,42 +4917,48 @@ items({dict}) *items()* entry and the value of this entry. The |List| is in arbitrary order. -jobclose({job}[, {stream}]) {Nvim} *jobclose()* - Close {job}'s {stream}, which can be one of "stdin", "stdout", - "stderr" or "rpc" (closes the rpc channel for a job started - with the "rpc" option.) If {stream} is omitted, all streams - are closed. If the job is a pty job, this will then close the - pty master, sending SIGHUP to the job process. +jobclose({job}[, {stream}]) *jobclose()* + Close {stream} of |job-id| {job}, where {stream} is one of: + "stdin", "stdout", "stderr", "rpc" (RPC channel of a job + started with `"rpc":v:true`). If {stream} is omitted, all + streams are closed. If the job is a pty job, this will close + the pty master, sending SIGHUP to the job process. -jobpid({job}) {Nvim} *jobpid()* - Return the pid (process id) of {job}. +jobpid({job}) *jobpid()* + Return the PID (process id) of |job-id| {job}. -jobresize({job}, {width}, {height}) {Nvim} *jobresize()* - Resize {job}'s pseudo terminal window to {width} and {height}. - This function will fail if used on jobs started without the - "pty" option. +jobresize({job}, {width}, {height}) *jobresize()* + Resize the pseudo terminal window of |job-id| {job} to {width} + columns and {height} rows. + Fails if the job was not started with `"pty":v:true`. -jobsend({job}, {data}) {Nvim} *jobsend()* - Send data to {job} by writing it to the stdin of the process. +jobsend({job}, {data}) *jobsend()* + Writes to stdin of the process associated with |job-id| {job}. Returns 1 if the write succeeded, 0 otherwise. - See |job-control| for more information. + See |job-control|. {data} may be a string, string convertible, or a list. If - {data} is a list, the items will be separated by newlines and - any newlines in an item will be sent as a NUL. A final newline - can be sent by adding a final empty string. For example: > + {data} is a list, the items will be joined by newlines; any + newlines in an item will be sent as NUL. To send a final + newline, include a final empty string. Example: > :call jobsend(j, ["abc", "123\n456", ""]) < will send "abc<NL>123<NUL>456<NL>". - If the job was started with the rpc option this function - cannot be used, instead use |rpcnotify()| and |rpcrequest()| - to communicate with the job. + jobsend() writes raw data, not RPC messages. If the job was + created with `"rpc":v:true` then the channel expects RPC + messages, use |rpcnotify()| and |rpcrequest()| instead. -jobstart({cmd}[, {opts}]) {Nvim} *jobstart()* - Spawns {cmd} as a job. If {cmd} is a |List| it is run - directly. If {cmd} is a |String| it is processed like this: > +jobstart({cmd}[, {opts}]) *jobstart()* + Spawns {cmd} as a job. + If {cmd} is a List it runs directly (no 'shell'). + If {cmd} is a String it runs in the 'shell', like this: > :call jobstart(split(&shell) + split(&shellcmdflag) + ['{cmd}']) -< (Only shows the idea; see |shell-unquoting| for full details.) +< (See |shell-unquoting| for details.) + + Returns |job-id| on success, 0 on invalid arguments (or job + table is full), -1 if {cmd}[0] or 'shell' is not executable. + + See |job-control| and |rpc|. NOTE: on Windows if {cmd} is a List: - cmd[0] must be an executable (not a "built-in"). If it is @@ -4962,6 +4970,7 @@ jobstart({cmd}[, {opts}]) {Nvim} *jobstart()* by CommandLineToArgvW https://msdn.microsoft.com/bb776391 unless cmd[0] is some form of "cmd.exe". + *jobstart-options* {opts} is a dictionary with these keys: |on_stdout|: stdout event handler (function name or |Funcref|) |on_stderr|: stderr event handler (function name or |Funcref|) @@ -4972,9 +4981,9 @@ jobstart({cmd}[, {opts}]) {Nvim} *jobstart()* with the job over stdin and stdout. "on_stdout" is then ignored, but "on_stderr" can still be used. pty : If set, the job will be connected to a new pseudo - terminal, and the job streams are connected to - the master file descriptor. "on_stderr" is ignored - as all output will be received on stdout. + terminal and the job streams are connected to the + master file descriptor. "on_stderr" is ignored, + "on_stdout" receives all output. width : (pty only) Width of the terminal screen height : (pty only) Height of the terminal screen @@ -4982,43 +4991,31 @@ jobstart({cmd}[, {opts}]) {Nvim} *jobstart()* detach : (non-pty only) Detach the job process from the nvim process. The process will not get killed when nvim exits. If the process dies before - nvim exits, on_exit will still be invoked. + nvim exits, "on_exit" will still be invoked. - {opts} is passed as |self| to the callback; the caller may - pass arbitrary data by setting other keys. - Returns: - - The job ID on success, which is used by |jobsend()| (or - |rpcnotify()| and |rpcrequest()| if "rpc" option was used) - and |jobstop()| - - 0 on invalid arguments or if the job table is full - - -1 if {cmd}[0] is not executable. - See |job-control| and |msgpack-rpc| for more information. - -jobstop({job}) {Nvim} *jobstop()* - Stop a job created with |jobstart()| by sending a `SIGTERM` - to the corresponding process. If the process doesn't exit - cleanly soon, a `SIGKILL` will be sent. When the job is - finally closed, the exit handler provided to |jobstart()| or - |termopen()| will be run. - See |job-control| for more information. - -jobwait({ids}[, {timeout}]) {Nvim} *jobwait()* + {opts} is passed as |self| dictionary to the callback; the + caller may set other keys to pass application-specific data. + +jobstop({job}) *jobstop()* + Stop |job-id| {job} by sending SIGTERM to the job process. If + the process does not terminate after a timeout then SIGKILL + will be sent. When the job terminates its |on_exit| handler + (if any) will be invoked. + See |job-control|. + +jobwait({ids}[, {timeout}]) *jobwait()* Wait for a set of jobs to finish. The {ids} argument is a list - of ids for jobs that will be waited for. If passed, {timeout} - is the maximum number of milliseconds to wait. While this - function is executing, callbacks for jobs not in the {ids} - list can be executed. Also, the screen wont be updated unless - |:redraw| is invoked by one of the callbacks. - - Returns a list of integers with the same length as {ids}, with - each integer representing the wait result for the - corresponding job id. The possible values for the resulting - integers are: - - * the job return code if the job exited - * -1 if the wait timed out for the job - * -2 if the job was interrupted - * -3 if the job id is invalid. + of |job-id|s to wait for. {timeout} is the maximum number of + milliseconds to wait. During jobwait(), callbacks for jobs not + in the {ids} list may be invoked. The screen will not redraw + unless |:redraw| is invoked by a callback. + + Returns a list of len({ids}) integers, where each integer is + the wait-result of the corresponding job. Each wait-result is: + Job exit-code, if the job exited + -1 if the wait timed out for the job + -2 if the job was interrupted + -3 if the |job-id| is invalid. join({list} [, {sep}]) *join()* Join the items in {list} together into one String. @@ -5652,7 +5649,7 @@ mode([expr]) Return a string that indicates the current mode. i Insert R Replace |R| Rv Virtual Replace |gR| - t Terminal {Nvim} + t Terminal c Command-line cv Vim Ex mode |gQ| ce Normal Ex mode |Q| @@ -7662,7 +7659,7 @@ taglist({expr}[, {filename}]) *taglist()* may appear, they give the name of the entity the tag is contained in. - The ex-command 'cmd' can be either an ex search pattern, a + The ex-command "cmd" can be either an ex search pattern, a line number or a line number followed by a byte number. If there are no matching tags, then an empty list is returned. @@ -8201,9 +8198,9 @@ There are four types of features: Example: > :if has("win32") < *has-patch* -3. {Nvim} version. The "nvim-1.2.3" feature means that the Nvim version is - 1.2.3 or later. Example: > - :if has("nvim-1.2.3") +3. Nvim version. The "nvim-0.2.1" feature means that the Nvim version is + 0.2.1 or later. Example: > + :if has("nvim-0.2.1") < 4. Included patches. The "patch123" feature means that patch 123 has been included. Note that this form does not check the version of Vim, you need diff --git a/runtime/doc/fold.txt b/runtime/doc/fold.txt index 42efb04d7a..fc8484b741 100644 --- a/runtime/doc/fold.txt +++ b/runtime/doc/fold.txt @@ -58,7 +58,7 @@ whichever is lower. These are empty or white lines and lines starting with a character in 'foldignore'. White space is skipped before checking for characters in 'foldignore'. For C use "#" to ignore preprocessor lines. -When you want to ignore lines in another way, use the 'expr' method. The +When you want to ignore lines in another way, use the "expr" method. The |indent()| function can be used in 'foldexpr' to get the indent of a line. @@ -133,7 +133,7 @@ fold level. But note that foldlevel() may return -1 if the level is not known yet. And it returns the level at the start of the line, while a fold might end in that line. -It may happened that folds are not updated properly. You can use |zx| or |zX| +It may happen that folds are not updated properly. You can use |zx| or |zX| to force updating folds. diff --git a/runtime/doc/helphelp.txt b/runtime/doc/helphelp.txt index d86a95e854..f8164a6982 100644 --- a/runtime/doc/helphelp.txt +++ b/runtime/doc/helphelp.txt @@ -305,7 +305,7 @@ the applicable Vim version. The last field specifies the last modification date of the file. Each field is separated by a tab. At the bottom of the help file, place a Vim modeline to set the 'textwidth' -and 'tabstop' options and the 'filetype' to 'help'. Never set a global option +and 'tabstop' options and the 'filetype' to "help". Never set a global option in such a modeline, that can have consequences undesired by whoever reads that help. diff --git a/runtime/doc/if_lua.txt b/runtime/doc/if_lua.txt index a123041866..968d882a22 100644 --- a/runtime/doc/if_lua.txt +++ b/runtime/doc/if_lua.txt @@ -24,7 +24,7 @@ the existing `package.cpath` are used. Example: 1. Given that - 'runtimepath' contains `/foo/bar,/xxx;yyy/baz,/abc`; - - initial (defined at compile time or derived from + - initial (defined at compile-time or derived from `$LUA_CPATH`/`$LUA_INIT`) `package.cpath` contains `./?.so;/def/ghi/a?d/j/g.elf;/def/?.so`. 2. It finds `?`-containing suffixes `/?.so`, `/a?d/j/g.elf` and `/?.so`, in @@ -159,14 +159,17 @@ Examples: > :lua vim.api.nvim_command('echo "Hello, Nvim!"') < +To see the Lua version: > + :lua print(_VERSION) + +To see the LuaJIT version: > + :lua print(jit.version) +< :[range]lua << {endmarker} {script} {endmarker} Execute Lua script {script}. - Note: This command doesn't work when the Lua - feature wasn't compiled in. To avoid errors, see - |script-here|. {endmarker} must NOT be preceded by any white space. If {endmarker} is omitted from after the "<<", a dot '.' must be used after {script}, like @@ -186,15 +189,8 @@ Example: EOF endfunction -Note that the variables are prefixed with `local`: they will disappear when -block finishes. This is not the case for globals. - -To see what version of Lua you have: > - :lua print(_VERSION) - -If you use LuaJIT you can also use this: > - :lua print(jit.version) -< +Note that the `local` variables will disappear when block finishes. This is +not the case for globals. *:luado* :[range]luado {body} Execute Lua function "function (line, linenr) {body} diff --git a/runtime/doc/if_ruby.txt b/runtime/doc/if_ruby.txt index a657d88a44..ace304c083 100644 --- a/runtime/doc/if_ruby.txt +++ b/runtime/doc/if_ruby.txt @@ -63,7 +63,7 @@ To see what version of Ruby you have: > *:rubyfile* *:rubyf* :rubyf[ile] {file} Execute the Ruby script in {file}. This is the same as - ":ruby load 'file'", but allows file name completion. + `:ruby load 'file'`, but allows file name completion. Executing Ruby commands is not possible in the |sandbox|. diff --git a/runtime/doc/index.txt b/runtime/doc/index.txt index ad93dcb000..bde4bcb630 100644 --- a/runtime/doc/index.txt +++ b/runtime/doc/index.txt @@ -993,10 +993,12 @@ tag command action in Command-line editing mode ~ |c_<CR>| <CR> execute entered command |c_CTRL-M| CTRL-M same as <CR> |c_CTRL-N| CTRL-N after using 'wildchar' with multiple matches: - go to next match, otherwise: same as <Down> + go to next match, otherwise: recall older + command-line from history. CTRL-O not used |c_CTRL-P| CTRL-P after using 'wildchar' with multiple matches: - go to previous match, otherwise: same as <Up> + go to previous match, otherwise: recall older + command-line from history. |c_CTRL-Q| CTRL-Q same as CTRL-V, unless it's used for terminal control flow |c_CTRL-R| CTRL-R {0-9a-z"%#*:= CTRL-F CTRL-P CTRL-W CTRL-A} diff --git a/runtime/doc/insert.txt b/runtime/doc/insert.txt index 9ef58fa54c..f3bde9d8d2 100644 --- a/runtime/doc/insert.txt +++ b/runtime/doc/insert.txt @@ -1077,7 +1077,7 @@ items: empty when non-zero this match will be added even when it is an empty string -All of these except 'icase', 'dup' and 'empty' must be a string. If an item +All of these except "icase", "dup" and "empty" must be a string. If an item does not meet these requirements then an error message is given and further items in the list are not used. You can mix string and Dictionary items in the returned list. diff --git a/runtime/doc/intro.txt b/runtime/doc/intro.txt index 90b0ff7da3..30524fb6aa 100644 --- a/runtime/doc/intro.txt +++ b/runtime/doc/intro.txt @@ -373,8 +373,7 @@ CTRL-{char} {char} typed as a control character; that is, typing {char} *key-notation* *key-codes* *keycodes* These names for keys are used in the documentation. They can also be used -with the ":map" command (insert the key name by pressing CTRL-K and then the -key you want the name for). +with the ":map" command. notation meaning equivalent decimal value(s) ~ ----------------------------------------------------------------------- diff --git a/runtime/doc/job_control.txt b/runtime/doc/job_control.txt index 2cf48f0f4f..7ba0acff48 100644 --- a/runtime/doc/job_control.txt +++ b/runtime/doc/job_control.txt @@ -4,41 +4,30 @@ NVIM REFERENCE MANUAL by Thiago de Arruda -Nvim's facilities for job control *job-control* +Nvim job control *job-control* + +Job control is a way to perform multitasking in Nvim, so scripts can spawn and +control multiple processes without blocking the current Nvim instance. Type |gO| to see the table of contents. ============================================================================== -1. Introduction *job-control-intro* - -Job control is a simple way to perform multitasking in vimscript. Wikipedia -contains a more generic/detailed description: +Concepts -"Job control in computing refers to the control of multiple tasks or Jobs on a -computer system, ensuring that they each have access to adequate resources to -perform correctly, that competition for limited resources does not cause a -deadlock where two or more jobs are unable to complete, resolving such -situations where they do occur, and terminating jobs that, for any reason, are -not performing as expected." +Job Id *job-id* -In a few words: It allows a vimscript programmer to concurrently spawn and -control multiple processes without blocking the current Nvim instance. +When a job starts it is assigned a number, unique for the life of the current +Nvim session. Functions like |jobstart()| return job ids. Functions like +|jobsend()|, |jobstop()|, |rpcnotify()|, and |rpcrequest()| take job ids. -Nvim's job control was designed to be simple and familiar to vimscript -programmers, instead of being very powerful but complex. Unlike Vim's -facilities for calling with external commands, job control does not depend on -available shells, instead relying on OS functionality for process management. +============================================================================== +Usage *job-control-usage* -Internally, Nvim job control is powered by libuv, which has a nice -cross-platform API for managing processes. See https://github.com/libuv/libuv -for details. +To control jobs, use the "job…" family of functions: |jobstart()|, +|jobsend()|, |jobstop()|. -============================================================================== -2. Usage *job-control-usage* +Example: > -Job control is achieved by calling a combination of the |jobstart()|, -|jobsend()| and |jobstop()| functions. Here's an example: -> function! s:JobHandler(job_id, data, event) dict if a:event == 'stdout' let str = self.shell.' stdout: '.join(a:data) @@ -58,35 +47,41 @@ Job control is achieved by calling a combination of the |jobstart()|, let job1 = jobstart(['bash'], extend({'shell': 'shell 1'}, s:callbacks)) let job2 = jobstart(['bash', '-c', 'for i in {1..10}; do echo hello $i!; sleep 1; done'], extend({'shell': 'shell 2'}, s:callbacks)) +To test the above script, copy it to a file ~/foo.vim and run it: > + nvim -u ~/foo.vim < -To test the above, copy it to the file ~/jobcontrol.vim and start with a clean -nvim instance: -> - nvim -u NONE -S ~/jobcontrol.vim -< -Here's what is happening: - -- Two bash instances are spawned by |jobstart()| with their stdin/stdout/stderr - connected to nvim. -- The first shell is idle, waiting to read commands from its stdin. -- The second shell is started with the -c argument, causing it to execute a - command then exit. In this case, the command is a for loop that will print 0 - through 9 then exit. -- The `JobHandler()` function is a callback passed to |jobstart()| to handle - various job events. It takes care of displaying stdout/stderr received from - the shells. - *on_stdout* *on_stderr* *on_exit* -- The arguments passed to `JobHandler()` are: - - 0: The job id - 1: If the event is "stdout" or "stderr", a list with lines read from the - corresponding stream. For "exit", it is the status returned by the - program. - 2: The event type, which is "stdout", "stderr" or "exit". +Description of what happens: + - Two bash shells are spawned by |jobstart()| with their stdin/stdout/stderr + streams connected to nvim. + - The first shell is idle, waiting to read commands from its stdin. + - The second shell is started with -c which executes the command (a for-loop + printing 0 through 9) and then exits. + - `JobHandler()` callback is passed to |jobstart()| to handle various job + events. It displays stdout/stderr data received from the shells. + + *on_stdout* +Arguments passed to on_stdout callback: + 0: |job-id| + 1: List of lines read from the stream. If the last item is not "" (empty + string), then it is an incomplete line that might be continued at the + next on_stdout invocation. See Note 2 below. + 2: Event type: "stdout" + *on_stderr* +Arguments passed to on_stderr callback: + 0: |job-id| + 1: List of lines read from the stream. If the last item is not "" (empty + string), then it is an incomplete line that might be continued at the + next on_stderr invocation. See Note 2 below. + 2: Event type: "stderr" + *on_exit* +Arguments passed to on_exit callback: + 0: |job-id| + 1: Exit-code of the process. + 2: Event type: "exit" Note: Buffered stdout/stderr data which has not been flushed by the sender - will not trigger the "stdout" callback (but if the process ends, the - "exit" callback will be triggered). + will not trigger the on_stdout/on_stderr callback (but if the process + ends, the on_exit callback will be invoked). For example, "ruby -e" buffers output, so small strings will be buffered unless "auto-flushing" ($stdout.sync=true) is enabled. > function! Receive(job_id, data, event) @@ -97,9 +92,25 @@ Here's what is happening: \ {'on_stdout': 'Receive'}) < https://github.com/neovim/neovim/issues/1592 -The options dictionary is passed as the "self" variable to the callback -function. Here's a more object-oriented version of the above: -> + Note 2: + Job event handlers may receive partial (incomplete) lines. For a given + invocation of on_stdout/on_stderr, `a:data` is not guaranteed to end + with a newline. + - `abcdefg` may arrive as `['abc']`, `['defg']`. + - `abc\nefg` may arrive as `['abc', '']`, `['efg']` or `['abc']`, + `['','efg']`, or even `['ab']`, `['c','efg']`. + Easy way to deal with this: initialize a list as `['']`, then append + to it as follows: > + let s:chunks = [''] + func! s:on_stdout(job_id, data, event) dict + let s:chunks[-1] .= a:data[0] + call extend(s:chunks, a:data[1:]) + endf +< + +The |jobstart-options| dictionary is passed as |self| to the callback. +The above example could be written in this "object-oriented" style: > + let Shell = {} function Shell.on_stdout(_job_id, data, event) @@ -126,19 +137,13 @@ function. Here's a more object-oriented version of the above: let instance = Shell.new('bomb', \ 'for i in $(seq 9 -1 1); do echo $i 1>&$((i % 2 + 1)); sleep 1; done') < -To send data to the job's stdin, one can use the |jobsend()| function, like -this: -> +To send data to the job's stdin, use |jobsend()|: > :call jobsend(job1, "ls\n") :call jobsend(job1, "invalid-command\n") :call jobsend(job1, "exit\n") < -A job may be killed at any time with the |jobstop()| function: -> +A job may be killed with |jobstop()|: > :call jobstop(job1) < -When |jobstop()| is called, `SIGTERM` will be sent to the job. If a job does -not exit after 2 seconds, `SIGKILL` will be sent. - ============================================================================== vim:tw=78:ts=8:noet:ft=help:norl: diff --git a/runtime/doc/map.txt b/runtime/doc/map.txt index e78b4cc942..fa7d01aa5f 100644 --- a/runtime/doc/map.txt +++ b/runtime/doc/map.txt @@ -556,7 +556,8 @@ Upper and lowercase differences are ignored. *map-comments* It is not possible to put a comment after these commands, because the '"' -character is considered to be part of the {lhs} or {rhs}. +character is considered to be part of the {lhs} or {rhs}. However, one can +use |", since this starts a new, empty command with a comment. *map_bar* *map-bar* Since the '|' character is used to separate a map command from the next diff --git a/runtime/doc/mlang.txt b/runtime/doc/mlang.txt index 6453a96877..8284d38fa4 100644 --- a/runtime/doc/mlang.txt +++ b/runtime/doc/mlang.txt @@ -172,6 +172,7 @@ Send an e-mail to the Vim maintainer <maintainer@vim.org>. special characters like "&" and "<Tab>" need to be included. Spaces and dots need to be escaped with a backslash, just like in other |:menu| commands. + Case in {english} is ignored. See the $VIMRUNTIME/lang directory for examples. diff --git a/runtime/doc/motion.txt b/runtime/doc/motion.txt index 81137b6069..600eb3ab9e 100644 --- a/runtime/doc/motion.txt +++ b/runtime/doc/motion.txt @@ -184,7 +184,7 @@ l or *l* *$* *<End>* *<kEnd>* $ or <End> To the end of the line. When a count is given also go - [count - 1] lines downward |inclusive|. + [count - 1] lines downward. |inclusive| motion. In Visual mode the cursor goes to just after the last character in the line. When 'virtualedit' is active, "$" may move the cursor diff --git a/runtime/doc/msgpack_rpc.txt b/runtime/doc/msgpack_rpc.txt index 7af6e401da..a1453a6cc6 100644 --- a/runtime/doc/msgpack_rpc.txt +++ b/runtime/doc/msgpack_rpc.txt @@ -175,7 +175,7 @@ contains information that makes this task easier (see also |rpc-types|): even more strongly-typed APIs. - Functions that are considered to be methods that operate on instances of Nvim special types (msgpack EXT) will have the `"method"` attribute set to - `true`. The reciever type is the type of the first argument. The method + `true`. The receiver type is the type of the first argument. The method names are prefixed with `nvim_` plus a shortened type name, e.g. `nvim_buf_get_lines` represents the `get_lines` method of a Buffer instance. - Global functions have `"method"` set to `false` and are prefixed with just diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt index 4df08ca5fb..433b083942 100644 --- a/runtime/doc/options.txt +++ b/runtime/doc/options.txt @@ -959,8 +959,8 @@ A jump table for the options with a short description can be found at |Q_op|. wildmode More matches in |cmdline-completion| available (depends on the 'wildmode' setting). - This is most useful, to fine tune when in insert mode the bell should - be rung. For normal mode and ex commands, the bell is often rung to + This is most useful to fine tune when in Insert mode the bell should + be rung. For Normal mode and Ex commands, the bell is often rung to indicate that an error occurred. It can be silenced by adding the "error" keyword. @@ -3099,6 +3099,28 @@ A jump table for the options with a short description can be found at |Q_op|. global The builtin |highlight-groups| cannot be changed. + *'history'* *'hi'* +'history' 'hi' number (Vim default: 10000, Vi default: 0) + global + A history of ":" commands, and a history of previous search patterns + is remembered. This option decides how many entries may be stored in + each of these histories (see |cmdline-editing|). + The maximum value is 10000. + + *'hkmap'* *'hk'* *'nohkmap'* *'nohk'* +'hkmap' 'hk' boolean (default off) + global + When on, the keyboard is mapped for the Hebrew character set. + Normally you would set 'allowrevins' and use CTRL-_ in insert mode to + toggle this option. See |rileft.txt|. + + *'hkmapp'* *'hkp'* *'nohkmapp'* *'nohkp'* +'hkmapp' 'hkp' boolean (default off) + global + When on, phonetic keyboard mapping is used. 'hkmap' must also be on. + This is useful if you have a non-Hebrew keyboard. + See |rileft.txt|. + *'hlsearch'* *'hls'* *'nohlsearch'* *'nohls'* 'hlsearch' 'hls' boolean (default on) global @@ -3122,28 +3144,6 @@ A jump table for the options with a short description can be found at |Q_op|. You can specify whether the highlight status is restored on startup with the 'h' flag in 'shada' |shada-h|. - *'history'* *'hi'* -'history' 'hi' number (Vim default: 10000, Vi default: 0) - global - A history of ":" commands, and a history of previous search patterns - is remembered. This option decides how many entries may be stored in - each of these histories (see |cmdline-editing|). - The maximum value is 10000. - - *'hkmap'* *'hk'* *'nohkmap'* *'nohk'* -'hkmap' 'hk' boolean (default off) - global - When on, the keyboard is mapped for the Hebrew character set. - Normally you would set 'allowrevins' and use CTRL-_ in insert mode to - toggle this option. See |rileft.txt|. - - *'hkmapp'* *'hkp'* *'nohkmapp'* *'nohkp'* -'hkmapp' 'hkp' boolean (default off) - global - When on, phonetic keyboard mapping is used. 'hkmap' must also be on. - This is useful if you have a non-Hebrew keyboard. - See |rileft.txt|. - *'icon'* *'noicon'* 'icon' boolean (default off, on when title can be restored) global @@ -5668,7 +5668,7 @@ A jump table for the options with a short description can be found at |Q_op|. word. The expression must evaluate to a List of Lists, each with a suggestion and a score. Example: - [['the', 33], ['that', 44]] + [['the', 33], ['that', 44]] ~ Set 'verbose' and use |z=| to see the scores that the internal methods use. A lower score is better. This may invoke |spellsuggest()| if you temporarily @@ -6759,7 +6759,7 @@ A jump table for the options with a short description can be found at |Q_op|. Highlights of vertical separators are determined by the window to the left of the separator. The highlight of a tabpage in |tabline| is - determine by the last-focused window of the tabpage. Highlights of + determined by the last-focused window of the tabpage. Highlights of the popupmenu are determined by the current window. Highlights in the message area cannot be overridden. diff --git a/runtime/doc/pattern.txt b/runtime/doc/pattern.txt index 8243a3ca7d..b7025c8e7e 100644 --- a/runtime/doc/pattern.txt +++ b/runtime/doc/pattern.txt @@ -853,10 +853,13 @@ $ At end of pattern or in front of "\|", "\)" or "\n" ('magic' on): \%V Match inside the Visual area. When Visual mode has already been stopped match in the area that |gv| would reselect. This is a |/zero-width| match. To make sure the whole pattern is - inside the Visual area put it at the start and end of the pattern, - e.g.: > + inside the Visual area put it at the start and just before the end of + the pattern, e.g.: > + /\%Vfoo.*ba\%Vr +< This also works if only "foo bar" was Visually selected. This: > /\%Vfoo.*bar\%V -< Only works for the current buffer. +< would match "foo bar" if the Visual selection continues after the "r". + Only works for the current buffer. */\%#* *cursor-position* \%# Matches with the cursor position. Only works when matching in a diff --git a/runtime/doc/provider.txt b/runtime/doc/provider.txt index 02f3fcab6c..b806b08f95 100644 --- a/runtime/doc/provider.txt +++ b/runtime/doc/provider.txt @@ -133,8 +133,8 @@ registers. Nvim looks for these clipboard tools, in order of priority: - |g:clipboard| - pbcopy/pbpaste (macOS) - - xclip - - xsel (newer alternative to xclip) + - xsel (if $DISPLAY is set) + - xclip (if $DISPLAY is set) - lemonade (for SSH) https://github.com/pocke/lemonade - doitclient (for SSH) http://www.chiark.greenend.org.uk/~sgtatham/doit/ - win32yank (Windows) @@ -162,13 +162,11 @@ process has not died, the cached selection is applied. ============================================================================== X11 selection mechanism *clipboard-x11* *x11-selection* -The clipboard providers for X11 store text in what is known as "selections". -Selections are "owned" by an application, so when the application is closed, -the selection text is lost. - +X11 clipboard providers store text in "selections". Selections are owned by an +application, so when the application gets closed, the selection text is lost. The contents of selections are held by the originating application (e.g., upon -a copy), and only passed on to another application when that other application -asks for them (e.g., upon a paste). +a copy), and only passed to another application when that other application +requests them (e.g., upon a paste). *quoteplus* *quote+* diff --git a/runtime/doc/quickfix.txt b/runtime/doc/quickfix.txt index a647318347..4c9a68fa63 100644 --- a/runtime/doc/quickfix.txt +++ b/runtime/doc/quickfix.txt @@ -32,10 +32,13 @@ The 'errorformat' option should be set to match the error messages from your compiler (see |errorformat| below). *location-list* *E776* -A location list is similar to a quickfix list and contains a list of positions -in files. A location list is associated with a window and each window can -have a separate location list. A location list can be associated with only -one window. The location list is independent of the quickfix list. +A location list is a window-local quickfix list. You get one after commands +like `:lvimgrep`, `:lgrep`, `:lhelpgrep`, `:lmake`, etc., which create a +location list instead of a quickfix list as the corresponding `:vimgrep`, +`:grep`, `:helpgrep`, `:make` do. +A location list is associated with a window and each window can have a +separate location list. A location list can be associated with only one +window. The location list is independent of the quickfix list. When a window with a location list is split, the new window gets a copy of the location list. When there are no longer any references to a location list, @@ -1362,7 +1365,7 @@ prints information about entering a directory in the form "Making all in dir". Making all in dir2 ./dir1/dir2 This can be solved by printing absolute directories in the "enter directory" - message or by printing "leave directory" messages.. + message or by printing "leave directory" messages. To avoid this problem, ensure to print absolute directory names and "leave directory" messages. diff --git a/runtime/doc/scroll.txt b/runtime/doc/scroll.txt index 56af9ab75e..99ebd26db3 100644 --- a/runtime/doc/scroll.txt +++ b/runtime/doc/scroll.txt @@ -211,7 +211,7 @@ past its buffer's limits. However, if a 'scrollbind' window that has a relative offset that is past its buffer's limits is given the cursor focus, the other 'scrollbind' windows must jump to a location where the current window's relative offset is valid. This -behavior can be changed by clearing the 'jump' flag from the 'scrollopt' +behavior can be changed by clearing the "jump" flag from the 'scrollopt' option. *syncbind* *:syncbind* *:sync* diff --git a/runtime/doc/syntax.txt b/runtime/doc/syntax.txt index cbaa2916e6..d87825e489 100644 --- a/runtime/doc/syntax.txt +++ b/runtime/doc/syntax.txt @@ -2616,9 +2616,9 @@ later, and part earlier) adds. RESTRUCTURED TEXT *rst.vim* *ft-rst-syntax* -You may set what syntax definitions should be used for code blocks via +You may set what syntax definitions should be used for code blocks via > let rst_syntax_code_list = ['vim', 'lisp', ...] - +< REXX *rexx.vim* *ft-rexx-syntax* diff --git a/runtime/doc/ui.txt b/runtime/doc/ui.txt index deac1609c0..685019aed7 100644 --- a/runtime/doc/ui.txt +++ b/runtime/doc/ui.txt @@ -28,6 +28,7 @@ a dictionary with these (optional) keys: `ext_popupmenu` Externalize the popupmenu. |ui-popupmenu| `ext_tabline` Externalize the tabline. |ui-tabline| `ext_cmdline` Externalize the cmdline. |ui-cmdline| + `ext_wildmenu` Externalize the wildmenu. |ui-ext-wildmenu| Nvim will then send msgpack-rpc notifications, with the method name "redraw" and a single argument, an array of screen update events. @@ -201,21 +202,21 @@ Popupmenu Events *ui-popupmenu* Only sent if `ext_popupmenu` option is set in |ui-options| ["popupmenu_show", items, selected, row, col] - `items` is an array of the items to show, the - items are themselves arrays of the form [word, kind, menu, info] - as defined at |complete-items|, except that `word` is replaced by - `abbr` if present. `selected` is the initially selected item, either a - zero-based index into the array of items, or -1 if no item is - selected. `row` and `col` is the anchor position, where the first - character of the completed word will be. + Show |popupmenu-completion|. `items` is an array of completion items + to show; each item is an array of the form [word, kind, menu, info] as + defined at |complete-items|, except that `word` is replaced by `abbr` + if present. `selected` is the initially-selected item, a zero-based + index into the array of items (-1 if no item is selected). `row` and + `col` give the anchor position, where the first character of the + completed word will be. ["popupmenu_select", selected] - An item in the currently displayed popupmenu is selected. `selected` - is either a zero-based index into the array of items from the last - `popupmenu_show` event, or -1 if no item is selected. + Select an item in the current popupmenu. `selected` is a zero-based + index into the array of items from the last popupmenu_show event, or + -1 if no item is selected. ["popupmenu_hide"] - The popupmenu is hidden. + Hide the popupmenu. ============================================================================== Tabline Events *ui-tabline* @@ -237,7 +238,7 @@ Only sent if `ext_cmdline` option is set in |ui-options| content: List of [attrs, string] [[{}, "t"], [attrs, "est"], ...] - Triggered when the user types in the cmdline. + Triggered when the cmdline is displayed or changed. The `content` is the full content that should be displayed in the cmdline, and the `pos` is the position of the cursor that in the cmdline. The content is divided into chunks with different highlight @@ -265,7 +266,7 @@ Only sent if `ext_cmdline` option is set in |ui-options| `shift` is true the text after the cursor should be shifted, otherwise it should overwrite the char at the cursor. - Should be hidden at next cmdline_pos. + Should be hidden at next cmdline_show. ["cmdline_hide"] Hide the cmdline. @@ -287,4 +288,21 @@ Only sent if `ext_cmdline` option is set in |ui-options| Hide the block. ============================================================================== +Wildmenu Events *ui-wildmenu* + +Only sent if `ext_wildmenu` option is set in |ui-options| + +["wildmenu_show", items] + Activate the wildmenu (command-line completion). `items` is an array + with the completion items. + +["wildmenu_select", selected] + Select an item in the current wildmenu. `selected` is a zero-based + index into the array of items from the last wildmenu_show event, or -1 + if no item is selected. + +["wildmenu_hide"] + Hide the wildmenu. + +============================================================================== vim:tw=78:ts=8:noet:ft=help:norl: diff --git a/runtime/doc/usr_02.txt b/runtime/doc/usr_02.txt index b738cdc48b..a1e3d606ec 100644 --- a/runtime/doc/usr_02.txt +++ b/runtime/doc/usr_02.txt @@ -543,7 +543,7 @@ Summary: *help-summary* > 8) Ex-commands always start with ":", so to go to the :s command help: > :help :s -9) Commands specifically for debugging start with ">". To go to to the help +9) Commands specifically for debugging start with ">". To go to the help for the "cont" debug command: > :help >cont @@ -652,7 +652,7 @@ Summary: *help-summary* > 22) Autocommand events can be found by their name: > :help BufWinLeave < To see all possible events: > - :help autocommands-events + :help autocommand-events 23) Command-line switches always start with "-". So for the help of the -f command switch of Vim use: > diff --git a/runtime/doc/usr_41.txt b/runtime/doc/usr_41.txt index acb6fd0fa4..4f6a5aa5ab 100644 --- a/runtime/doc/usr_41.txt +++ b/runtime/doc/usr_41.txt @@ -95,7 +95,7 @@ Then there is the ":let i += 1" command. This does the same thing as to the same variable. The example was given to explain the commands, but would you really want to -make such a loop it can be written much more compact: > +make such a loop, it can be written much more compact: > :for i in range(1, 4) : echo "count is" i @@ -692,6 +692,7 @@ Other computation: *bitwise-function* Variables: *var-functions* type() type of a variable islocked() check if a variable is locked + funcref() get a Funcref for a function reference function() get a Funcref for a function name getbufvar() get a variable value from a specific buffer setbufvar() set a variable in a specific buffer @@ -883,6 +884,7 @@ GUI: *gui-functions* getfontname() get name of current font being used getwinposx() X position of the GUI Vim window getwinposy() Y position of the GUI Vim window + balloon_show() set the balloon content Vim server: *server-functions* serverlist() return the list of server names @@ -1541,7 +1543,7 @@ WHITE SPACE Blank lines are allowed and ignored. Leading whitespace characters (blanks and TABs) are always ignored. The -whitespaces between parameters (e.g. between the 'set' and the 'cpoptions' in +whitespaces between parameters (e.g. between the "set" and the "cpoptions" in the example below) are reduced to one blank character and plays the role of a separator, the whitespaces after the last (visible) character may or may not be ignored depending on the situation, see below. diff --git a/runtime/doc/vim_diff.txt b/runtime/doc/vim_diff.txt index c92fcd8994..6959d64989 100644 --- a/runtime/doc/vim_diff.txt +++ b/runtime/doc/vim_diff.txt @@ -60,14 +60,17 @@ a complete and centralized reference of those differences. MAJOR COMPONENTS ~ -Embedded terminal emulator |terminal| -RPC API |RPC| -Shared data |shada| -XDG base directories |xdg| +API |API| +Lua scripting |lua| Job control |job-control| Remote plugins |remote-plugin| -Python plugins |provider-python| -Clipboard integration |provider-clipboard| +Providers + Clipboard |provider-clipboard| + Python plugins |provider-python| + Ruby plugins |provider-ruby| +Shared data |shada| +Embedded terminal |terminal| +XDG base directories |xdg| USER EXPERIENCE ~ @@ -87,6 +90,16 @@ Working intuitively and consistently is a major goal of Nvim. - Vim's internal test functions (test_autochdir(), test_settime(), etc.) are not exposed (nor implemented); instead Nvim has a robust API. +- Behaviors, options, documentation are removed if they cost users more time + than they save. + +Usability details have been improved where the benefit outweighs any +backwards-compatibility cost. Some examples: + +- |K| in help documents can be used like |CTRL-]|. +- Directories for 'directory' and 'undodir' are auto-created. +- Terminal features such as 'guicursor' are enabled where possible. + ARCHITECTURE ~ External plugins run in separate processes. |remote-plugin| This improves @@ -130,6 +143,7 @@ Commands: |:checkhealth| |:drop| is available on all platforms |:Man| is available by default, with many improvements such as completion + |:tchdir| tab-local |current-directory| Functions: |dictwatcheradd()| notifies a callback whenever a |Dict| is modified diff --git a/runtime/filetype.vim b/runtime/filetype.vim index 7d0f9cf779..79fbcbca00 100644 --- a/runtime/filetype.vim +++ b/runtime/filetype.vim @@ -1,7 +1,7 @@ " Vim support file to detect file types " " Maintainer: Bram Moolenaar <Bram@vim.org> -" Last Change: 2017 Jan 06 +" Last Change: 2017 Mar 13 " Listen very carefully, I will say this only once if exists("did_load_filetypes") @@ -1362,6 +1362,9 @@ endfunc " Not Quite C au BufNewFile,BufRead *.nqc setf nqc +" NSE - Nmap Script Engine - uses Lua syntax +au BufNewFile,BufRead *.nse setf lua + " NSIS au BufNewFile,BufRead *.nsi,*.nsh setf nsis @@ -2276,6 +2279,9 @@ au BufNewFile,BufRead .tidyrc,tidyrc setf tidy " TF mud client au BufNewFile,BufRead *.tf,.tfrc,tfrc setf tf +" tmux configuration +au BufNewFile,BufRead {.,}tmux*.conf setf tmux + " TPP - Text Presentation Program au BufNewFile,BufReadPost *.tpp setf tpp diff --git a/runtime/ftplugin/a2ps.vim b/runtime/ftplugin/a2ps.vim index 6653351949..0e24e3088f 100644 --- a/runtime/ftplugin/a2ps.vim +++ b/runtime/ftplugin/a2ps.vim @@ -1,7 +1,7 @@ " Vim filetype plugin file -" Language: a2ps(1) configuration file -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2008-07-09 +" Language: a2ps(1) configuration file +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2008-07-09 if exists("b:did_ftplugin") finish diff --git a/runtime/ftplugin/alsaconf.vim b/runtime/ftplugin/alsaconf.vim index 5d763c8011..6d9d80a208 100644 --- a/runtime/ftplugin/alsaconf.vim +++ b/runtime/ftplugin/alsaconf.vim @@ -1,7 +1,7 @@ " Vim filetype plugin file -" Language: alsaconf(8) configuration file -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2008-07-09 +" Language: alsaconf(8) configuration file +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2008-07-09 if exists("b:did_ftplugin") finish diff --git a/runtime/ftplugin/arch.vim b/runtime/ftplugin/arch.vim index 71d831e112..1c697b8ca1 100644 --- a/runtime/ftplugin/arch.vim +++ b/runtime/ftplugin/arch.vim @@ -1,7 +1,7 @@ " Vim filetype plugin file -" Language: GNU Arch inventory file -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2008-07-09 +" Language: GNU Arch inventory file +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2008-07-09 if exists("b:did_ftplugin") finish diff --git a/runtime/ftplugin/automake.vim b/runtime/ftplugin/automake.vim index 20b06af362..9f981a7a83 100644 --- a/runtime/ftplugin/automake.vim +++ b/runtime/ftplugin/automake.vim @@ -1,7 +1,7 @@ " Vim filetype plugin file -" Language: Automake -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2008-07-09 +" Language: Automake +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2008-07-09 if exists("b:did_ftplugin") finish diff --git a/runtime/ftplugin/bdf.vim b/runtime/ftplugin/bdf.vim index 120c5df968..85b7b4042a 100644 --- a/runtime/ftplugin/bdf.vim +++ b/runtime/ftplugin/bdf.vim @@ -1,7 +1,7 @@ " Vim filetype plugin file -" Language: BDF font definition -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2008-07-09 +" Language: BDF font definition +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2008-07-09 if exists("b:did_ftplugin") finish diff --git a/runtime/ftplugin/calendar.vim b/runtime/ftplugin/calendar.vim index 6f117e36e5..f454ba1dc8 100644 --- a/runtime/ftplugin/calendar.vim +++ b/runtime/ftplugin/calendar.vim @@ -1,7 +1,7 @@ " Vim filetype plugin file -" Language: calendar(1) input file -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2008-07-09 +" Language: calendar(1) input file +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2008-07-09 if exists("b:did_ftplugin") finish diff --git a/runtime/ftplugin/cdrdaoconf.vim b/runtime/ftplugin/cdrdaoconf.vim index 557fd82c53..563bb8f5f1 100644 --- a/runtime/ftplugin/cdrdaoconf.vim +++ b/runtime/ftplugin/cdrdaoconf.vim @@ -1,6 +1,6 @@ " Vim filetype plugin file -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2007-12-04 +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2007-12-04 if exists("b:did_ftplugin") finish diff --git a/runtime/ftplugin/conf.vim b/runtime/ftplugin/conf.vim index 1b110e475b..ff2add1fa3 100644 --- a/runtime/ftplugin/conf.vim +++ b/runtime/ftplugin/conf.vim @@ -1,7 +1,7 @@ " Vim filetype plugin file -" Language: generic configuration file -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2008-07-09 +" Language: generic configuration file +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2008-07-09 if exists("b:did_ftplugin") finish diff --git a/runtime/ftplugin/crm.vim b/runtime/ftplugin/crm.vim index e86e683068..06baee883a 100644 --- a/runtime/ftplugin/crm.vim +++ b/runtime/ftplugin/crm.vim @@ -1,7 +1,7 @@ " Vim filetype plugin file -" Language: CRM114 -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2008-07-09 +" Language: CRM114 +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2008-07-09 if exists("b:did_ftplugin") finish diff --git a/runtime/ftplugin/css.vim b/runtime/ftplugin/css.vim index 43d1edfa5b..ea4424418c 100644 --- a/runtime/ftplugin/css.vim +++ b/runtime/ftplugin/css.vim @@ -1,7 +1,7 @@ " Vim filetype plugin file -" Language: CSS -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2008-07-09 +" Language: CSS +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2008-07-09 if exists("b:did_ftplugin") finish diff --git a/runtime/ftplugin/cvsrc.vim b/runtime/ftplugin/cvsrc.vim index c410530588..34b148409e 100644 --- a/runtime/ftplugin/cvsrc.vim +++ b/runtime/ftplugin/cvsrc.vim @@ -1,7 +1,7 @@ " Vim filetype plugin file -" Language: cvs(1) RC file -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2008-07-09 +" Language: cvs(1) RC file +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2008-07-09 if exists("b:did_ftplugin") finish diff --git a/runtime/ftplugin/denyhosts.vim b/runtime/ftplugin/denyhosts.vim index 557fd82c53..563bb8f5f1 100644 --- a/runtime/ftplugin/denyhosts.vim +++ b/runtime/ftplugin/denyhosts.vim @@ -1,6 +1,6 @@ " Vim filetype plugin file -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2007-12-04 +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2007-12-04 if exists("b:did_ftplugin") finish diff --git a/runtime/ftplugin/dictconf.vim b/runtime/ftplugin/dictconf.vim index 659046c176..71a2b67258 100644 --- a/runtime/ftplugin/dictconf.vim +++ b/runtime/ftplugin/dictconf.vim @@ -1,7 +1,7 @@ " Vim filetype plugin file -" Language: dict(1) configuration file -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2008-07-09 +" Language: dict(1) configuration file +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2008-07-09 if exists("b:did_ftplugin") finish diff --git a/runtime/ftplugin/dictdconf.vim b/runtime/ftplugin/dictdconf.vim index ee738c50ce..0ee4c9d7e0 100644 --- a/runtime/ftplugin/dictdconf.vim +++ b/runtime/ftplugin/dictdconf.vim @@ -1,7 +1,7 @@ " Vim filetype plugin file -" Language: dictd(8) configuration file -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2008-07-09 +" Language: dictd(8) configuration file +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2008-07-09 if exists("b:did_ftplugin") finish diff --git a/runtime/ftplugin/dircolors.vim b/runtime/ftplugin/dircolors.vim index 3b3d046e36..d07d1e34da 100644 --- a/runtime/ftplugin/dircolors.vim +++ b/runtime/ftplugin/dircolors.vim @@ -1,7 +1,7 @@ " Vim filetype plugin file -" Language: dircolors(1) input file -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2008-07-09 +" Language: dircolors(1) input file +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2008-07-09 if exists("b:did_ftplugin") finish diff --git a/runtime/ftplugin/dosini.vim b/runtime/ftplugin/dosini.vim index 461403ca95..0d0f0f8983 100644 --- a/runtime/ftplugin/dosini.vim +++ b/runtime/ftplugin/dosini.vim @@ -1,7 +1,7 @@ " Vim filetype plugin file -" Language: Configuration File (ini file) for MSDOS/MS Windows -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2008-07-09 +" Language: Configuration File (ini file) for MSDOS/MS Windows +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2008-07-09 if exists("b:did_ftplugin") finish diff --git a/runtime/ftplugin/elinks.vim b/runtime/ftplugin/elinks.vim index 7d9257566b..921f9c276b 100644 --- a/runtime/ftplugin/elinks.vim +++ b/runtime/ftplugin/elinks.vim @@ -1,7 +1,7 @@ " Vim filetype plugin file -" Language: elinks(1) configuration file -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2008-07-09 +" Language: elinks(1) configuration file +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2008-07-09 if exists("b:did_ftplugin") finish diff --git a/runtime/ftplugin/eterm.vim b/runtime/ftplugin/eterm.vim index e072c638b1..e2f88ef8c6 100644 --- a/runtime/ftplugin/eterm.vim +++ b/runtime/ftplugin/eterm.vim @@ -1,7 +1,7 @@ " Vim filetype plugin file -" Language: eterm(1) configuration file -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2008-07-09 +" Language: eterm(1) configuration file +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2008-07-09 if exists("b:did_ftplugin") finish diff --git a/runtime/ftplugin/fetchmail.vim b/runtime/ftplugin/fetchmail.vim index a0d4650c03..33bb417be4 100644 --- a/runtime/ftplugin/fetchmail.vim +++ b/runtime/ftplugin/fetchmail.vim @@ -1,7 +1,7 @@ " Vim filetype plugin file -" Language: fetchmail(1) RC File -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2008-07-09 +" Language: fetchmail(1) RC File +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2008-07-09 if exists("b:did_ftplugin") finish diff --git a/runtime/ftplugin/framescript.vim b/runtime/ftplugin/framescript.vim index 805401a89b..48fe0ace7c 100644 --- a/runtime/ftplugin/framescript.vim +++ b/runtime/ftplugin/framescript.vim @@ -1,7 +1,7 @@ " Vim ftplugin file -" Language: FrameScript -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2008-07-19 +" Language: FrameScript +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2008-07-19 let s:cpo_save = &cpo set cpo&vim diff --git a/runtime/ftplugin/gpg.vim b/runtime/ftplugin/gpg.vim index 5caa1f69c1..3f890e58f6 100644 --- a/runtime/ftplugin/gpg.vim +++ b/runtime/ftplugin/gpg.vim @@ -1,7 +1,7 @@ " Vim filetype plugin file -" Language: gpg(1) configuration file -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2008-07-09 +" Language: gpg(1) configuration file +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2008-07-09 if exists("b:did_ftplugin") finish diff --git a/runtime/ftplugin/group.vim b/runtime/ftplugin/group.vim index eef3cd68d9..e6b76ba607 100644 --- a/runtime/ftplugin/group.vim +++ b/runtime/ftplugin/group.vim @@ -1,7 +1,7 @@ " Vim filetype plugin file -" Language: group(5) user group file -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2008-07-09 +" Language: group(5) user group file +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2008-07-09 if exists("b:did_ftplugin") finish diff --git a/runtime/ftplugin/grub.vim b/runtime/ftplugin/grub.vim index 21c4e3609d..cd6e1139e5 100644 --- a/runtime/ftplugin/grub.vim +++ b/runtime/ftplugin/grub.vim @@ -1,7 +1,7 @@ " Vim filetype plugin file -" Language: grub(8) configuration file -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2008-07-09 +" Language: grub(8) configuration file +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2008-07-09 if exists("b:did_ftplugin") finish diff --git a/runtime/ftplugin/hamster.vim b/runtime/ftplugin/hamster.vim index c23adc4232..29711fb093 100644 --- a/runtime/ftplugin/hamster.vim +++ b/runtime/ftplugin/hamster.vim @@ -1,8 +1,8 @@ " Vim filetype plugin " Language: Hamster Script " Version: 2.0.6.0 -" Maintainer: David Fishburn <fishburn@ianywhere.com> -" Last Change: Wed Nov 08 2006 12:03:09 PM +" Maintainer: David Fishburn <dfishburn dot vim at gmail dot com> +" Last Change: 2017 Mar 07 " Only do this when not done yet for this buffer if exists("b:did_ftplugin") @@ -13,6 +13,7 @@ endif let b:did_ftplugin = 1 let s:cpo_save = &cpo +set cpo&vim set cpo-=C let b:undo_ftplugin = "setl fo< com< tw< commentstring<" diff --git a/runtime/ftplugin/haskell.vim b/runtime/ftplugin/haskell.vim index 144f9f6860..de77bdfb8a 100644 --- a/runtime/ftplugin/haskell.vim +++ b/runtime/ftplugin/haskell.vim @@ -1,7 +1,7 @@ " Vim filetype plugin file -" Language: Haskell -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2008-07-09 +" Language: Haskell +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2008-07-09 if exists("b:did_ftplugin") finish diff --git a/runtime/ftplugin/help.vim b/runtime/ftplugin/help.vim index e6d48454d9..0f448bd306 100644 --- a/runtime/ftplugin/help.vim +++ b/runtime/ftplugin/help.vim @@ -1,7 +1,7 @@ " Vim filetype plugin file -" Language: Vim help file -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2008-07-09 +" Language: Vim help file +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2008-07-09 if exists("b:did_ftplugin") finish diff --git a/runtime/ftplugin/hostconf.vim b/runtime/ftplugin/hostconf.vim index 557fd82c53..563bb8f5f1 100644 --- a/runtime/ftplugin/hostconf.vim +++ b/runtime/ftplugin/hostconf.vim @@ -1,6 +1,6 @@ " Vim filetype plugin file -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2007-12-04 +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2007-12-04 if exists("b:did_ftplugin") finish diff --git a/runtime/ftplugin/hostsaccess.vim b/runtime/ftplugin/hostsaccess.vim index a2f55acb8a..d32485f162 100644 --- a/runtime/ftplugin/hostsaccess.vim +++ b/runtime/ftplugin/hostsaccess.vim @@ -1,7 +1,7 @@ " Vim filetype plugin file -" Language: hosts_access(5) control file -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2008-07-09 +" Language: hosts_access(5) control file +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2008-07-09 if exists("b:did_ftplugin") finish diff --git a/runtime/ftplugin/indent.vim b/runtime/ftplugin/indent.vim index 0e195b0615..e6d928a073 100644 --- a/runtime/ftplugin/indent.vim +++ b/runtime/ftplugin/indent.vim @@ -1,7 +1,7 @@ " Vim filetype plugin file -" Language: indent(1) configuration file -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2008-07-09 +" Language: indent(1) configuration file +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2008-07-09 if exists("b:did_ftplugin") finish diff --git a/runtime/ftplugin/ld.vim b/runtime/ftplugin/ld.vim index 31ce5c9ffd..1ab80d533c 100644 --- a/runtime/ftplugin/ld.vim +++ b/runtime/ftplugin/ld.vim @@ -1,7 +1,7 @@ " Vim filetype plugin file -" Language: ld(1) script -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2008-07-09 +" Language: ld(1) script +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2008-07-09 if exists("b:did_ftplugin") finish diff --git a/runtime/ftplugin/lftp.vim b/runtime/ftplugin/lftp.vim index 9e2eeb52cb..5bc496c884 100644 --- a/runtime/ftplugin/lftp.vim +++ b/runtime/ftplugin/lftp.vim @@ -1,7 +1,7 @@ " Vim filetype plugin file -" Language: lftp(1) configuration file -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2008-07-09 +" Language: lftp(1) configuration file +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2008-07-09 if exists("b:did_ftplugin") finish diff --git a/runtime/ftplugin/libao.vim b/runtime/ftplugin/libao.vim index 38bd3de92c..0ce5831b28 100644 --- a/runtime/ftplugin/libao.vim +++ b/runtime/ftplugin/libao.vim @@ -1,7 +1,7 @@ " Vim filetype plugin file -" Language: libao.conf(5) configuration file -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2008-07-09 +" Language: libao.conf(5) configuration file +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2008-07-09 if exists("b:did_ftplugin") finish diff --git a/runtime/ftplugin/limits.vim b/runtime/ftplugin/limits.vim index cd5b7b5c93..90a10a6c22 100644 --- a/runtime/ftplugin/limits.vim +++ b/runtime/ftplugin/limits.vim @@ -1,7 +1,7 @@ " Vim filetype plugin file -" Language: limits(5) configuration file -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2008-07-09 +" Language: limits(5) configuration file +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2008-07-09 if exists("b:did_ftplugin") finish diff --git a/runtime/ftplugin/loginaccess.vim b/runtime/ftplugin/loginaccess.vim index 7c44f972f2..d27114a7ae 100644 --- a/runtime/ftplugin/loginaccess.vim +++ b/runtime/ftplugin/loginaccess.vim @@ -1,7 +1,7 @@ " Vim filetype plugin file -" Language: login.access(5) configuration file -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2008-07-09 +" Language: login.access(5) configuration file +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2008-07-09 if exists("b:did_ftplugin") finish diff --git a/runtime/ftplugin/logindefs.vim b/runtime/ftplugin/logindefs.vim index 668d08a002..7873396808 100644 --- a/runtime/ftplugin/logindefs.vim +++ b/runtime/ftplugin/logindefs.vim @@ -1,7 +1,7 @@ " Vim filetype plugin file -" Language: login.defs(5) configuration file -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2008-07-09 +" Language: login.defs(5) configuration file +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2008-07-09 if exists("b:did_ftplugin") finish diff --git a/runtime/ftplugin/m4.vim b/runtime/ftplugin/m4.vim index 0ffe0ac77e..3745507321 100644 --- a/runtime/ftplugin/m4.vim +++ b/runtime/ftplugin/m4.vim @@ -1,7 +1,7 @@ " Vim filetype plugin file -" Language: m4 -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2008-07-09 +" Language: m4 +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2008-07-09 if exists("b:did_ftplugin") finish diff --git a/runtime/ftplugin/mailaliases.vim b/runtime/ftplugin/mailaliases.vim index 1b10c86ae3..0ae4b452d0 100644 --- a/runtime/ftplugin/mailaliases.vim +++ b/runtime/ftplugin/mailaliases.vim @@ -1,6 +1,6 @@ " Vim filetype plugin file -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2008-07-09 +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2008-07-09 if exists("b:did_ftplugin") finish diff --git a/runtime/ftplugin/mailcap.vim b/runtime/ftplugin/mailcap.vim index f4c8c232d8..ba8573c722 100644 --- a/runtime/ftplugin/mailcap.vim +++ b/runtime/ftplugin/mailcap.vim @@ -1,7 +1,7 @@ " Vim filetype plugin file -" Language: Mailcap configuration file -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2008-07-09 +" Language: Mailcap configuration file +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2008-07-09 if exists("b:did_ftplugin") finish diff --git a/runtime/ftplugin/manconf.vim b/runtime/ftplugin/manconf.vim index a249a97507..aa85408cef 100644 --- a/runtime/ftplugin/manconf.vim +++ b/runtime/ftplugin/manconf.vim @@ -1,7 +1,7 @@ " Vim filetype plugin file -" Language: man.conf(5) - man configuration file -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2008-07-09 +" Language: man.conf(5) - man configuration file +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2008-07-09 if exists("b:did_ftplugin") finish diff --git a/runtime/ftplugin/modconf.vim b/runtime/ftplugin/modconf.vim index f200e9f61e..c8e76b538b 100644 --- a/runtime/ftplugin/modconf.vim +++ b/runtime/ftplugin/modconf.vim @@ -1,7 +1,7 @@ " Vim filetype plugin file -" Language: modules.conf(5) configuration file -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2008-07-09 +" Language: modules.conf(5) configuration file +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2008-07-09 if exists("b:did_ftplugin") finish diff --git a/runtime/ftplugin/mplayerconf.vim b/runtime/ftplugin/mplayerconf.vim index 65034a8152..86547609c3 100644 --- a/runtime/ftplugin/mplayerconf.vim +++ b/runtime/ftplugin/mplayerconf.vim @@ -1,7 +1,7 @@ " Vim filetype plugin file -" Language: mplayer(1) configuration file -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2008-07-09 +" Language: mplayer(1) configuration file +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2008-07-09 if exists("b:did_ftplugin") finish diff --git a/runtime/ftplugin/muttrc.vim b/runtime/ftplugin/muttrc.vim index a109e5ddda..c8ad0f2ec5 100644 --- a/runtime/ftplugin/muttrc.vim +++ b/runtime/ftplugin/muttrc.vim @@ -1,7 +1,7 @@ " Vim filetype plugin file -" Language: mutt RC File -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2006-04-19 +" Language: mutt RC File +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2006-04-19 if exists("b:did_ftplugin") finish diff --git a/runtime/ftplugin/nanorc.vim b/runtime/ftplugin/nanorc.vim index be20d12503..e45ebac0eb 100644 --- a/runtime/ftplugin/nanorc.vim +++ b/runtime/ftplugin/nanorc.vim @@ -1,7 +1,7 @@ " Vim filetype plugin file -" Language: nanorc(5) - GNU nano configuration file -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2008-07-09 +" Language: nanorc(5) - GNU nano configuration file +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2008-07-09 if exists("b:did_ftplugin") finish diff --git a/runtime/ftplugin/netrc.vim b/runtime/ftplugin/netrc.vim index 105a1d3a8e..02ee327295 100644 --- a/runtime/ftplugin/netrc.vim +++ b/runtime/ftplugin/netrc.vim @@ -1,7 +1,7 @@ " Vim filetype plugin file -" Language: netrc(5) configuration file -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2008-07-09 +" Language: netrc(5) configuration file +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2008-07-09 if exists("b:did_ftplugin") finish diff --git a/runtime/ftplugin/nsis.vim b/runtime/ftplugin/nsis.vim index acc26208c4..949691bf6e 100644 --- a/runtime/ftplugin/nsis.vim +++ b/runtime/ftplugin/nsis.vim @@ -1,7 +1,7 @@ " Vim ftplugin file -" Language: NSIS script -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2008-07-09 +" Language: NSIS script +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2008-07-09 let s:cpo_save = &cpo set cpo&vim diff --git a/runtime/ftplugin/pamconf.vim b/runtime/ftplugin/pamconf.vim index 96d96461e2..f0a693e3a5 100644 --- a/runtime/ftplugin/pamconf.vim +++ b/runtime/ftplugin/pamconf.vim @@ -1,7 +1,7 @@ " Vim filetype plugin file -" Language: pam(8) configuration file -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2008-07-09 +" Language: pam(8) configuration file +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2008-07-09 if exists("b:did_ftplugin") finish diff --git a/runtime/ftplugin/passwd.vim b/runtime/ftplugin/passwd.vim index 5088c43359..f6e0f50342 100644 --- a/runtime/ftplugin/passwd.vim +++ b/runtime/ftplugin/passwd.vim @@ -1,7 +1,7 @@ " Vim filetype plugin file -" Language: passwd(5) password file -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2008-07-09 +" Language: passwd(5) password file +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2008-07-09 if exists("b:did_ftplugin") finish diff --git a/runtime/ftplugin/pinfo.vim b/runtime/ftplugin/pinfo.vim index 6ec1f87b9e..50473a8114 100644 --- a/runtime/ftplugin/pinfo.vim +++ b/runtime/ftplugin/pinfo.vim @@ -1,7 +1,7 @@ " Vim filetype plugin file -" Language: pinfo(1) configuration file -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2008-07-09 +" Language: pinfo(1) configuration file +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2008-07-09 if exists("b:did_ftplugin") finish diff --git a/runtime/ftplugin/procmail.vim b/runtime/ftplugin/procmail.vim index cc2ceede19..d64f19274d 100644 --- a/runtime/ftplugin/procmail.vim +++ b/runtime/ftplugin/procmail.vim @@ -1,7 +1,7 @@ " Vim filetype plugin file -" Language: procmail(1) configuration file -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2008-07-09 +" Language: procmail(1) configuration file +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2008-07-09 if exists("b:did_ftplugin") finish diff --git a/runtime/ftplugin/prolog.vim b/runtime/ftplugin/prolog.vim index caeb574c5a..f4e7d135b5 100644 --- a/runtime/ftplugin/prolog.vim +++ b/runtime/ftplugin/prolog.vim @@ -1,7 +1,7 @@ " Vim filetype plugin file -" Language: Prolog -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2008-07-09 +" Language: Prolog +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2008-07-09 if exists("b:did_ftplugin") finish diff --git a/runtime/ftplugin/protocols.vim b/runtime/ftplugin/protocols.vim index 2486ff9370..83856ce7ba 100644 --- a/runtime/ftplugin/protocols.vim +++ b/runtime/ftplugin/protocols.vim @@ -1,7 +1,7 @@ " Vim filetype plugin file -" Language: protocols(5) - Internet protocols definition file -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2008-07-09 +" Language: protocols(5) - Internet protocols definition file +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2008-07-09 if exists("b:did_ftplugin") finish diff --git a/runtime/ftplugin/quake.vim b/runtime/ftplugin/quake.vim index f62693b11a..c3a2e52347 100644 --- a/runtime/ftplugin/quake.vim +++ b/runtime/ftplugin/quake.vim @@ -1,7 +1,7 @@ " Vim filetype plugin file -" Language: Quake[1-3] configuration file -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2008-07-09 +" Language: Quake[1-3] configuration file +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2008-07-09 if exists("b:did_ftplugin") finish diff --git a/runtime/ftplugin/racc.vim b/runtime/ftplugin/racc.vim index 7ff22f8937..0cd852c365 100644 --- a/runtime/ftplugin/racc.vim +++ b/runtime/ftplugin/racc.vim @@ -1,7 +1,7 @@ " Vim filetype plugin file -" Language: Racc input file -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2008-07-09 +" Language: Racc input file +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2008-07-09 if exists("b:did_ftplugin") finish diff --git a/runtime/ftplugin/readline.vim b/runtime/ftplugin/readline.vim index 0a4dbb5c03..e9ef93ec7f 100644 --- a/runtime/ftplugin/readline.vim +++ b/runtime/ftplugin/readline.vim @@ -1,7 +1,7 @@ " Vim filetype plugin file -" Language: readline(3) configuration file -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2008-07-09 +" Language: readline(3) configuration file +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2008-07-09 if exists("b:did_ftplugin") finish diff --git a/runtime/ftplugin/rnc.vim b/runtime/ftplugin/rnc.vim index 2b8fd50d8d..90aa111c67 100644 --- a/runtime/ftplugin/rnc.vim +++ b/runtime/ftplugin/rnc.vim @@ -1,7 +1,7 @@ " Vim filetype plugin file -" Language: Relax NG compact syntax -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2008-07-09 +" Language: Relax NG compact syntax +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2008-07-09 if exists("b:did_ftplugin") finish diff --git a/runtime/ftplugin/rst.vim b/runtime/ftplugin/rst.vim index b871cf1486..e61213e7a5 100644 --- a/runtime/ftplugin/rst.vim +++ b/runtime/ftplugin/rst.vim @@ -1,7 +1,7 @@ " Vim filetype plugin file -" Language: reStructuredText documentation format -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2008-07-09 +" Language: reStructuredText documentation format +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2008-07-09 if exists("b:did_ftplugin") finish diff --git a/runtime/ftplugin/screen.vim b/runtime/ftplugin/screen.vim index 95c3849556..c22089be2c 100644 --- a/runtime/ftplugin/screen.vim +++ b/runtime/ftplugin/screen.vim @@ -1,7 +1,7 @@ " Vim filetype plugin file -" Language: screen(1) configuration file -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2008-07-09 +" Language: screen(1) configuration file +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2008-07-09 if exists("b:did_ftplugin") finish diff --git a/runtime/ftplugin/sensors.vim b/runtime/ftplugin/sensors.vim index 813d14c0e1..c02a729405 100644 --- a/runtime/ftplugin/sensors.vim +++ b/runtime/ftplugin/sensors.vim @@ -1,7 +1,7 @@ " Vim filetype plugin file -" Language: sensors.conf(5) - libsensors configuration file -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2008-07-09 +" Language: sensors.conf(5) - libsensors configuration file +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2008-07-09 if exists("b:did_ftplugin") finish diff --git a/runtime/ftplugin/services.vim b/runtime/ftplugin/services.vim index d34349ee28..dda08ac20a 100644 --- a/runtime/ftplugin/services.vim +++ b/runtime/ftplugin/services.vim @@ -1,7 +1,7 @@ " Vim filetype plugin file -" Language: services(5) - Internet network services list -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2008-07-09 +" Language: services(5) - Internet network services list +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2008-07-09 if exists("b:did_ftplugin") finish diff --git a/runtime/ftplugin/setserial.vim b/runtime/ftplugin/setserial.vim index f9d5945787..e5823f4432 100644 --- a/runtime/ftplugin/setserial.vim +++ b/runtime/ftplugin/setserial.vim @@ -1,7 +1,7 @@ " Vim filetype plugin file -" Language: setserial(8) configuration file -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2008-07-09 +" Language: setserial(8) configuration file +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2008-07-09 if exists("b:did_ftplugin") finish diff --git a/runtime/ftplugin/sieve.vim b/runtime/ftplugin/sieve.vim index 9a8759c024..3092b5d2d3 100644 --- a/runtime/ftplugin/sieve.vim +++ b/runtime/ftplugin/sieve.vim @@ -1,7 +1,7 @@ " Vim filetype plugin file -" Language: Sieve filtering language input file -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2008-07-09 +" Language: Sieve filtering language input file +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2008-07-09 if exists("b:did_ftplugin") finish diff --git a/runtime/ftplugin/slpconf.vim b/runtime/ftplugin/slpconf.vim index 0c45689672..a975a499e5 100644 --- a/runtime/ftplugin/slpconf.vim +++ b/runtime/ftplugin/slpconf.vim @@ -1,7 +1,7 @@ " Vim filetype plugin file -" Language: RFC 2614 - An API for Service Location configuration file -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2008-07-09 +" Language: RFC 2614 - An API for Service Location configuration file +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2008-07-09 if exists("b:did_ftplugin") finish diff --git a/runtime/ftplugin/slpreg.vim b/runtime/ftplugin/slpreg.vim index e9d533e2d4..74c7285b66 100644 --- a/runtime/ftplugin/slpreg.vim +++ b/runtime/ftplugin/slpreg.vim @@ -1,7 +1,7 @@ " Vim filetype plugin file -" Language: RFC 2614 - An API for Service Location registration file -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2008-07-09 +" Language: RFC 2614 - An API for Service Location registration file +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2008-07-09 if exists("b:did_ftplugin") finish diff --git a/runtime/ftplugin/slpspi.vim b/runtime/ftplugin/slpspi.vim index 8d64d476f1..633555e493 100644 --- a/runtime/ftplugin/slpspi.vim +++ b/runtime/ftplugin/slpspi.vim @@ -1,7 +1,7 @@ " Vim filetype plugin file -" Language: RFC 2614 - An API for Service Location SPI file -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2008-07-09 +" Language: RFC 2614 - An API for Service Location SPI file +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2008-07-09 if exists("b:did_ftplugin") finish diff --git a/runtime/ftplugin/sql.vim b/runtime/ftplugin/sql.vim index c2bc857947..4d6fcd9564 100644 --- a/runtime/ftplugin/sql.vim +++ b/runtime/ftplugin/sql.vim @@ -1,8 +1,8 @@ " SQL filetype plugin file " Language: SQL (Common for Oracle, Microsoft SQL Server, Sybase) -" Version: 11.0 +" Version: 12.0 " Maintainer: David Fishburn <dfishburn dot vim at gmail dot com> -" Last Change: 2013 May 13 +" Last Change: 2017 Mar 07 " Download: http://vim.sourceforge.net/script.php?script_id=454 " For more details please use: @@ -36,6 +36,14 @@ " " History " +" Version 12.0 (April 2013) +" +" NF: Added support for "BEGIN TRY ... END TRY ... BEGIN CATCH ... END CATCH +" BF: This plugin is designed to be used with other plugins to enable the +" SQL completion with Perl, Python, Java, ... The loading mechanism +" was not checking if the SQL objects were created, which can lead to +" the plugin not loading the SQL support. +" " Version 11.0 (May 2013) " " NF: Updated to use SyntaxComplete's new regex support for syntax groups. @@ -80,15 +88,17 @@ " Only do this when not done yet for this buffer -if exists("b:did_ftplugin") - finish +" This ftplugin can be used with other ftplugins. So ensure loading +" happens if all elements of this plugin have not yet loaded. +if exists("b:did_ftplugin") && exists("b:current_ftplugin") && b:current_ftplugin == 'sql' + finish endif let s:save_cpo = &cpo set cpo&vim " Disable autowrapping for code, but enable for comments -" t Auto-wrap text using textwidth +" t Auto-wrap text using textwidth " c Auto-wrap comments using textwidth, inserting the current comment " leader automatically. setlocal formatoptions-=t @@ -171,6 +181,9 @@ if !exists("*SQL_SetType") if exists("b:current_syntax") " echomsg 'SQLSetType - clearing syntax' syntax clear + if exists("b:current_syntax") + unlet b:current_syntax + endif endif if exists("b:did_indent") " echomsg 'SQLSetType - clearing indent' @@ -187,7 +200,7 @@ if !exists("*SQL_SetType") " Do not specify a buffer local variable if it is " the default value if new_sql_type == 'sql' - let new_sql_type = 'sqloracle' + let new_sql_type = 'sqloracle' endif let b:sql_type_override = new_sql_type @@ -234,25 +247,26 @@ if exists("b:sql_type_override") " echo 'sourcing buffer ftplugin/'.b:sql_type_override.'.vim' if globpath(&runtimepath, 'ftplugin/'.b:sql_type_override.'.vim') != '' exec 'runtime ftplugin/'.b:sql_type_override.'.vim' - " else - " echomsg 'ftplugin/'.b:sql_type_override.' not exist, using default' + " else + " echomsg 'ftplugin/'.b:sql_type_override.' not exist, using default' endif elseif exists("g:sql_type_default") " echo 'sourcing global ftplugin/'.g:sql_type_default.'.vim' if globpath(&runtimepath, 'ftplugin/'.g:sql_type_default.'.vim') != '' exec 'runtime ftplugin/'.g:sql_type_default.'.vim' - " else - " echomsg 'ftplugin/'.g:sql_type_default.'.vim not exist, using default' + " else + " echomsg 'ftplugin/'.g:sql_type_default.'.vim not exist, using default' endif endif " If the above runtime command succeeded, do not load the default settings -if exists("b:did_ftplugin") - finish +" as they should have already been loaded from a previous run. +if exists("b:did_ftplugin") && exists("b:current_ftplugin") && b:current_ftplugin == 'sql' + finish endif let b:undo_ftplugin = "setl comments< formatoptions< define< omnifunc<" . - \ " | unlet! b:browsefilter b:match_words" + \ " | unlet! b:browsefilter b:match_words" " Don't load another plugin for this buffer let b:did_ftplugin = 1 @@ -261,7 +275,7 @@ let b:current_ftplugin = 'sql' " Win32 can filter files in the browse dialog if has("gui_win32") && !exists("b:browsefilter") let b:browsefilter = "SQL Files (*.sql)\t*.sql\n" . - \ "All Files (*.*)\t*.*\n" + \ "All Files (*.*)\t*.*\n" endif " Some standard expressions for use with the matchit strings @@ -312,14 +326,24 @@ if !exists("b:match_words") " WHEN column_not_found THEN " WHEN OTHERS THEN " + " begin try + " end try + " begin catch + " end catch + " " create[ or replace] procedure|function|event - " \ '^\s*\<\%(do\|for\|while\|loop\)\>.*:'. + " \ '^\s*\<\%(do\|for\|while\|loop\)\>.*:'. " For ColdFusion support setlocal matchpairs+=<:> let b:match_words = &matchpairs . - \ ',\<begin\>:\<end\>\W*$,'. - \ + \ ',\%(\<begin\)\%(\s\+\%(try\|catch\)\>\)\@!:\<end\>\W*$,'. + \ + \ '\<begin\s\+try\>:'. + \ '\<end\s\+try\>:'. + \ '\<begin\s\+catch\>:'. + \ '\<end\s\+catch\>,'. + \ \ s:notend . '\<if\>:'. \ '\<elsif\>\|\<elseif\>\|\<else\>:'. \ '\<end\s\+if\>,'. @@ -339,14 +363,14 @@ if !exists("b:match_words") \ '\%(\<create\s\+' . s:or_replace . '\)\?'. \ '\%(function\|procedure\|event\):'. \ '\<returns\?\>' - " \ '\<begin\>\|\<returns\?\>:'. - " \ '\<end\>\(;\)\?\s*$' - " \ '\<exception\>:'.s:when_no_matched_or_others. - " \ ':\<when\s\+others\>,'. - " - " \ '\%(\<exception\>\|\%('. s:notend . '\<case\>\)\):'. - " \ '\%(\<default\>\|'.s:when_no_matched_or_others.'\):'. - " \ '\%(\%(\<when\s\+others\>\)\|\<end\s\+case\>\),' . + " \ '\<begin\>\|\<returns\?\>:'. + " \ '\<end\>\(;\)\?\s*$' + " \ '\<exception\>:'.s:when_no_matched_or_others. + " \ ':\<when\s\+others\>,'. + " + " \ '\%(\<exception\>\|\%('. s:notend . '\<case\>\)\):'. + " \ '\%(\<default\>\|'.s:when_no_matched_or_others.'\):'. + " \ '\%(\%(\<when\s\+others\>\)\|\<end\s\+case\>\),' . endif " Define how to find the macro definition of a variable using the various diff --git a/runtime/ftplugin/sshconfig.vim b/runtime/ftplugin/sshconfig.vim index f940af972e..d933ce0527 100644 --- a/runtime/ftplugin/sshconfig.vim +++ b/runtime/ftplugin/sshconfig.vim @@ -1,7 +1,7 @@ " Vim filetype plugin file -" Language: OpenSSH client configuration file -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2008-07-09 +" Language: OpenSSH client configuration file +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2008-07-09 if exists("b:did_ftplugin") finish diff --git a/runtime/ftplugin/sudoers.vim b/runtime/ftplugin/sudoers.vim index 5756302178..38dbf559ee 100644 --- a/runtime/ftplugin/sudoers.vim +++ b/runtime/ftplugin/sudoers.vim @@ -1,7 +1,7 @@ " Vim filetype plugin file -" Language: sudoers(5) configuration files -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2008-07-09 +" Language: sudoers(5) configuration files +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2008-07-09 if exists("b:did_ftplugin") finish diff --git a/runtime/ftplugin/sysctl.vim b/runtime/ftplugin/sysctl.vim index fb1098dd3b..8d331cea38 100644 --- a/runtime/ftplugin/sysctl.vim +++ b/runtime/ftplugin/sysctl.vim @@ -1,7 +1,7 @@ " Vim filetype plugin file -" Language: sysctl.conf(5) configuration file -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2008-07-09 +" Language: sysctl.conf(5) configuration file +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2008-07-09 if exists("b:did_ftplugin") finish diff --git a/runtime/ftplugin/terminfo.vim b/runtime/ftplugin/terminfo.vim index 7ce31d1ca1..0ffcc58f58 100644 --- a/runtime/ftplugin/terminfo.vim +++ b/runtime/ftplugin/terminfo.vim @@ -1,7 +1,7 @@ " Vim filetype plugin file -" Language: terminfo(5) definition -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2008-07-09 +" Language: terminfo(5) definition +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2008-07-09 if exists("b:did_ftplugin") finish diff --git a/runtime/ftplugin/tmux.vim b/runtime/ftplugin/tmux.vim new file mode 100644 index 0000000000..ed9154924b --- /dev/null +++ b/runtime/ftplugin/tmux.vim @@ -0,0 +1,12 @@ +" Vim filetype plugin file +" Language: tmux(1) configuration file +" URL: https://github.com/ericpruitt/tmux.vim/ +" Maintainer: Eric Pruitt <eric.pruitt@gmail.com> +" Last Changed: 2017 Mar 10 + +if exists("b:did_ftplugin") + finish +endif +let b:did_ftplugin = 1 + +setlocal commentstring=#\ %s diff --git a/runtime/ftplugin/treetop.vim b/runtime/ftplugin/treetop.vim index 2da3c405f5..f978d15303 100644 --- a/runtime/ftplugin/treetop.vim +++ b/runtime/ftplugin/treetop.vim @@ -1,7 +1,7 @@ " Vim filetype plugin file -" Language: Treetop -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2011-03-14 +" Language: Treetop +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2011-03-14 if exists("b:did_ftplugin") finish diff --git a/runtime/ftplugin/udevconf.vim b/runtime/ftplugin/udevconf.vim index 6042e14413..0bbd86a0a4 100644 --- a/runtime/ftplugin/udevconf.vim +++ b/runtime/ftplugin/udevconf.vim @@ -1,7 +1,7 @@ " Vim filetype plugin file -" Language: udev(8) configuration file -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2008-07-09 +" Language: udev(8) configuration file +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2008-07-09 if exists("b:did_ftplugin") finish diff --git a/runtime/ftplugin/udevperm.vim b/runtime/ftplugin/udevperm.vim index e7ad31d071..f8fb4d4d99 100644 --- a/runtime/ftplugin/udevperm.vim +++ b/runtime/ftplugin/udevperm.vim @@ -1,7 +1,7 @@ " Vim filetype plugin file -" Language: udev(8) permissions file -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2008-07-09 +" Language: udev(8) permissions file +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2008-07-09 if exists("b:did_ftplugin") finish diff --git a/runtime/ftplugin/udevrules.vim b/runtime/ftplugin/udevrules.vim index be8d646968..6404f6c85e 100644 --- a/runtime/ftplugin/udevrules.vim +++ b/runtime/ftplugin/udevrules.vim @@ -1,7 +1,7 @@ " Vim filetype plugin file -" Language: udev(8) rules file -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2008-07-09 +" Language: udev(8) rules file +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2008-07-09 if exists("b:did_ftplugin") finish diff --git a/runtime/ftplugin/updatedb.vim b/runtime/ftplugin/updatedb.vim index f4e7bcebd5..3015918d70 100644 --- a/runtime/ftplugin/updatedb.vim +++ b/runtime/ftplugin/updatedb.vim @@ -1,7 +1,7 @@ " Vim filetype plugin file -" Language: updatedb.conf(5) configuration file -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2008-07-09 +" Language: updatedb.conf(5) configuration file +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2008-07-09 if exists("b:did_ftplugin") finish diff --git a/runtime/ftplugin/xdefaults.vim b/runtime/ftplugin/xdefaults.vim index cd851829ca..c1aff70176 100644 --- a/runtime/ftplugin/xdefaults.vim +++ b/runtime/ftplugin/xdefaults.vim @@ -1,7 +1,7 @@ " Vim filetype plugin file -" Language: X resources files like ~/.Xdefaults (xrdb) -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2008-07-09 +" Language: X resources files like ~/.Xdefaults (xrdb) +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2008-07-09 if exists("b:did_ftplugin") finish diff --git a/runtime/ftplugin/xf86conf.vim b/runtime/ftplugin/xf86conf.vim index ab7569a100..5a21539dd5 100644 --- a/runtime/ftplugin/xf86conf.vim +++ b/runtime/ftplugin/xf86conf.vim @@ -1,7 +1,7 @@ " Vim filetype plugin file -" Language: XFree86 Configuration File -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2008-07-09 +" Language: XFree86 Configuration File +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2008-07-09 if exists("b:did_ftplugin") finish diff --git a/runtime/ftplugin/xinetd.vim b/runtime/ftplugin/xinetd.vim index f209af18be..2b7b64e4fa 100644 --- a/runtime/ftplugin/xinetd.vim +++ b/runtime/ftplugin/xinetd.vim @@ -1,7 +1,7 @@ " Vim filetype plugin file -" Language: xinetd.conf(5) configuration file -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2008-07-09 +" Language: xinetd.conf(5) configuration file +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2008-07-09 if exists("b:did_ftplugin") finish diff --git a/runtime/ftplugin/xmodmap.vim b/runtime/ftplugin/xmodmap.vim index 027ae09ff2..77fccd5b4d 100644 --- a/runtime/ftplugin/xmodmap.vim +++ b/runtime/ftplugin/xmodmap.vim @@ -1,7 +1,7 @@ " Vim filetype plugin file -" Language: xmodmap(1) definition file -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2008-07-09 +" Language: xmodmap(1) definition file +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2008-07-09 if exists("b:did_ftplugin") finish diff --git a/runtime/ftplugin/yaml.vim b/runtime/ftplugin/yaml.vim index b88803ab3a..ceff36f7e4 100644 --- a/runtime/ftplugin/yaml.vim +++ b/runtime/ftplugin/yaml.vim @@ -1,7 +1,7 @@ " Vim filetype plugin file -" Language: YAML (YAML Ain't Markup Language) -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2008-07-09 +" Language: YAML (YAML Ain't Markup Language) +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2008-07-09 if exists("b:did_ftplugin") finish diff --git a/runtime/indent/automake.vim b/runtime/indent/automake.vim index 5fbc222bc7..7e38f92ebf 100644 --- a/runtime/indent/automake.vim +++ b/runtime/indent/automake.vim @@ -1,7 +1,7 @@ " Vim indent file -" Language: automake -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2006-04-19 +" Language: automake +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2006-04-19 if exists("b:did_indent") finish diff --git a/runtime/indent/config.vim b/runtime/indent/config.vim index 7eb1657572..074f467bee 100644 --- a/runtime/indent/config.vim +++ b/runtime/indent/config.vim @@ -1,8 +1,8 @@ " Vim indent file -" Language: Autoconf configure.{ac,in} file -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2006-12-20 -" TODO: how about nested [()]'s in one line +" Language: Autoconf configure.{ac,in} file +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2006-12-20 +" TODO: how about nested [()]'s in one line " what's wrong with '\\\@!'? " Only load this indent file when no other was loaded. diff --git a/runtime/indent/css.vim b/runtime/indent/css.vim index f0a272eff9..4d15b8d2dc 100644 --- a/runtime/indent/css.vim +++ b/runtime/indent/css.vim @@ -2,6 +2,7 @@ " Language: CSS " Maintainer: Nikolai Weibull <now@bitwi.se> " Latest Revision: 2012-05-30 +" Use of shiftwidth() added by Oleg Zubchenko. if exists("b:did_indent") finish @@ -75,8 +76,8 @@ function GetCSSIndent() return 0 endif - return indent(pnum) + s:count_braces(pnum, 1) * &sw - \ - s:count_braces(v:lnum, 0) * &sw + return indent(pnum) + s:count_braces(pnum, 1) * shiftwidth() + \ - s:count_braces(v:lnum, 0) * shiftwidth() endfunction let &cpo = s:keepcpo diff --git a/runtime/indent/dictconf.vim b/runtime/indent/dictconf.vim index adbc1a5242..2e15c76146 100644 --- a/runtime/indent/dictconf.vim +++ b/runtime/indent/dictconf.vim @@ -1,7 +1,7 @@ " Vim indent file -" Language: dict(1) configuration file -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2006-12-20 +" Language: dict(1) configuration file +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2006-12-20 if exists("b:did_indent") finish diff --git a/runtime/indent/dictdconf.vim b/runtime/indent/dictdconf.vim index 9427342c7e..5c4fbdafb5 100644 --- a/runtime/indent/dictdconf.vim +++ b/runtime/indent/dictdconf.vim @@ -1,7 +1,7 @@ " Vim indent file -" Language: dictd(8) configuration file -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2006-12-20 +" Language: dictd(8) configuration file +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2006-12-20 if exists("b:did_indent") finish diff --git a/runtime/indent/docbk.vim b/runtime/indent/docbk.vim index 3fde2a13b6..d8661ffbe9 100644 --- a/runtime/indent/docbk.vim +++ b/runtime/indent/docbk.vim @@ -1,7 +1,7 @@ " Vim indent file -" Language: DocBook Documentation Format -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2006-04-19 +" Language: DocBook Documentation Format +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2006-04-19 if exists("b:did_indent") finish diff --git a/runtime/indent/dtd.vim b/runtime/indent/dtd.vim index 88c0c5129e..5633362367 100644 --- a/runtime/indent/dtd.vim +++ b/runtime/indent/dtd.vim @@ -1,7 +1,7 @@ " Vim indent file -" Language: DTD (Document Type Definition for XML) -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2011-07-08 +" Language: DTD (Document Type Definition for XML) +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2011-07-08 let s:cpo_save = &cpo set cpo&vim @@ -84,7 +84,7 @@ function GetDTDIndent() let [declaration, end] = s:lex1(line, col) if declaration == "" - return indent + &sw + return indent + shiftwidth() elseif declaration == '--' " We’re looking at a comment. Now, simply determine if the comment is " terminated or not. If it isn’t, let Vim take care of that using @@ -100,7 +100,7 @@ function GetDTDIndent() " Check for element name. If none exists, indent one level. let [name, end] = s:lex(line, end) if name == "" - return indent + &sw + return indent + shiftwidth() endif " Check for token following element name. This can be a specification of @@ -113,7 +113,7 @@ function GetDTDIndent() let n += 1 endwhile if token == "" - return indent + &sw + return indent + shiftwidth() endif " Next comes the content model. If the token we’ve found isn’t a @@ -148,7 +148,7 @@ function GetDTDIndent() return indent endif " TODO: Should use s:lex here on getline(v:lnum) and check for >. - return getline(v:lnum) =~ '^\s*>' || count(values(seen), 0) == 0 ? indent : (indent + &sw) + return getline(v:lnum) =~ '^\s*>' || count(values(seen), 0) == 0 ? indent : (indent + shiftwidth()) endif " If we’ve seen an addition or exception already and this is of the same @@ -167,7 +167,7 @@ function GetDTDIndent() " Check for element name. If none exists, indent one level. let [name, end] = s:lex(line, end) if name == "" - return indent + &sw + return indent + shiftwidth() endif " Check for any number of attributes. @@ -180,7 +180,7 @@ function GetDTDIndent() let [name, end] = s:lex(line, end) if name == "" " TODO: Should use s:lex here on getline(v:lnum) and check for >. - return getline(v:lnum) =~ '^\s*>' ? indent : (indent + &sw) + return getline(v:lnum) =~ '^\s*>' ? indent : (indent + shiftwidth()) elseif name == ">" return indent endif @@ -194,14 +194,14 @@ function GetDTDIndent() " (CDATA|NMTOKEN|NMTOKENS|ID|IDREF|IDREFS|ENTITY|ENTITIES)? let [value, end] = s:lex(line, end, '^\%((\|[^[:space:]]\+\)') if value == "" - return indent + &sw * 2 + return indent + shiftwidth() * 2 elseif value == 'NOTATION' " If this is a enumerated value based on notations, read another token " for the actual value. If it doesn’t exist, indent three levels. " TODO: If validating according to above, value must be equal to '('. let [value, end] = s:lex(line, end, '^\%((\|[^[:space:]]\+\)') if value == "" - return indent + &sw * 3 + return indent + shiftwidth() * 3 endif endif @@ -216,13 +216,13 @@ function GetDTDIndent() " two levels. let [default, end] = s:lex(line, end, '^\%("\_[^"]*"\|#\(REQUIRED\|IMPLIED\|FIXED\)\)') if default == "" - return indent + &sw * 2 + return indent + shiftwidth() * 2 elseif default == '#FIXED' " We need to look for the fixed value. If non exists, indent three " levels. let [default, end] = s:lex(line, end, '^"\_[^"]*"') if default == "" - return indent + &sw * 3 + return indent + shiftwidth() * 3 endif endif endwhile @@ -233,11 +233,11 @@ function GetDTDIndent() " again, if none exists, indent one level. let [name, end] = s:lex(line, end) if name == "" - return indent + &sw + return indent + shiftwidth() elseif name == '%' let [name, end] = s:lex(line, end) if name == "" - return indent + &sw + return indent + shiftwidth() endif endif @@ -256,27 +256,27 @@ function GetDTDIndent() " we’re now done with this entity. let [value, end] = s:lex(line, end) if value == "" - return indent + &sw + return indent + shiftwidth() elseif value == 'SYSTEM' || value == 'PUBLIC' let [quoted_string, end] = s:lex(line, end, '\%("[^"]\+"\|''[^'']\+''\)') if quoted_string == "" - return indent + &sw * 2 + return indent + shiftwidth() * 2 endif if value == 'PUBLIC' let [quoted_string, end] = s:lex(line, end, '\%("[^"]\+"\|''[^'']\+''\)') if quoted_string == "" - return indent + &sw * 2 + return indent + shiftwidth() * 2 endif endif let [ndata, end] = s:lex(line, end) if ndata == "" - return indent + &sw + return indent + shiftwidth() endif let [name, end] = s:lex(line, end) - return name == "" ? (indent + &sw * 2) : indent + return name == "" ? (indent + shiftwidth() * 2) : indent else return indent endif @@ -284,24 +284,24 @@ function GetDTDIndent() " Check for notation name. If none exists, indent one level. let [name, end] = s:lex(line, end) if name == "" - return indent + &sw + return indent + shiftwidth() endif " Now check for the external ID. If none exists, indent one level. let [id, end] = s:lex(line, end) if id == "" - return indent + &sw + return indent + shiftwidth() elseif id == 'SYSTEM' || id == 'PUBLIC' let [quoted_string, end] = s:lex(line, end, '\%("[^"]\+"\|''[^'']\+''\)') if quoted_string == "" - return indent + &sw * 2 + return indent + shiftwidth() * 2 endif if id == 'PUBLIC' let [quoted_string, end] = s:lex(line, end, '\%("[^"]\+"\|''[^'']\+''\|>\)') if quoted_string == "" " TODO: Should use s:lex here on getline(v:lnum) and check for >. - return getline(v:lnum) =~ '^\s*>' ? indent : (indent + &sw * 2) + return getline(v:lnum) =~ '^\s*>' ? indent : (indent + shiftwidth() * 2) elseif quoted_string == '>' return indent endif diff --git a/runtime/indent/eiffel.vim b/runtime/indent/eiffel.vim index 87e82e833d..d7667a8346 100644 --- a/runtime/indent/eiffel.vim +++ b/runtime/indent/eiffel.vim @@ -2,9 +2,10 @@ " Language: Eiffel " Maintainer: Jocelyn Fiat <jfiat@eiffel.com> " Previous-Maintainer: David Clarke <gadicath@dishevelled.net> +" Contributions from: Takuya Fujiwara " Contributions from: Thilo Six -" $Date: 2004/12/09 21:33:52 $ -" $Revision: 1.3 $ +" $Date: 2017/03/08 06:00:00 $ +" $Revision: 1.4 $ " URL: https://github.com/eiffelhub/vim-eiffel " Only load this indent file when no other was loaded. @@ -28,7 +29,7 @@ let b:undo_indent = "setl smartindent< indentkeys< indentexpr< autoindent< comme " Define some stuff " keywords grouped by indenting let s:trust_user_indent = '\(+\)\(\s*\(--\).*\)\=$' -let s:relative_indent = '^\s*\(deferred\|class\|feature\|creation\|inherit\|loop\|from\|until\|if\|else\|elseif\|ensure\|require\|check\|do\|local\|invariant\|variant\|rename\|redefine\|do\|export\)\>' +let s:relative_indent = '^\s*\(deferred\|class\|feature\|creation\|inherit\|loop\|from\|across\|until\|if\|else\|elseif\|ensure\|require\|check\|do\|local\|invariant\|variant\|rename\|redefine\|do\|export\)\>' let s:outdent = '^\s*\(else\|invariant\|variant\|do\|require\|until\|loop\|local\)\>' let s:no_indent = '^\s*\(class\|feature\|creation\|inherit\)\>' let s:single_dent = '^[^-]\+[[:alnum:]]\+ is\(\s*\(--\).*\)\=$' @@ -63,23 +64,23 @@ function GetEiffelIndent() " Add a 'shiftwidth' after lines that start with an indent word let ind = indent(lnum) if getline(lnum) =~ s:relative_indent - let ind = ind + &sw + let ind = ind + shiftwidth() endif " Indent to single indent if getline(v:lnum) =~ s:single_dent && getline(v:lnum) !~ s:relative_indent \ && getline(v:lnum) !~ '\s*\<\(and\|or\|implies\)\>' - let ind = &sw + let ind = shiftwidth() endif " Indent to double indent if getline(v:lnum) =~ s:inheritance_dent - let ind = 2 * &sw + let ind = 2 * shiftwidth() endif " Indent line after the first line of the function definition if getline(lnum) =~ s:single_dent - let ind = ind + &sw + let ind = ind + shiftwidth() endif " The following should always be at the start of a line, no indenting @@ -91,17 +92,17 @@ function GetEiffelIndent() " or first thing after the 'do' if getline(v:lnum) =~ s:outdent && getline(v:lnum - 1) !~ s:single_dent \ && getline(v:lnum - 1) !~ '^\s*do\>' - let ind = ind - &sw + let ind = ind - shiftwidth() endif " Subtract a shiftwidth for end statements if getline(v:lnum) =~ '^\s*end\>' - let ind = ind - &sw + let ind = ind - shiftwidth() endif " set indent of zero end statements that are at an indent of 3, this should " only ever be the class's end. - if getline(v:lnum) =~ '^\s*end\>' && ind == &sw + if getline(v:lnum) =~ '^\s*end\>' && ind == shiftwidth() let ind = 0 endif diff --git a/runtime/indent/eterm.vim b/runtime/indent/eterm.vim index f25f5f4dad..8ee342fcfa 100644 --- a/runtime/indent/eterm.vim +++ b/runtime/indent/eterm.vim @@ -1,7 +1,7 @@ " Vim indent file -" Language: Eterm configuration file -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2006-12-20 +" Language: Eterm configuration file +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2006-12-20 if exists("b:did_indent") finish @@ -25,11 +25,11 @@ function GetEtermIndent() let ind = indent(lnum) if getline(lnum) =~ '^\s*begin\>' - let ind = ind + &sw + let ind = ind + shiftwidth() endif if getline(v:lnum) =~ '^\s*end\>' - let ind = ind - &sw + let ind = ind - shiftwidth() endif return ind diff --git a/runtime/indent/framescript.vim b/runtime/indent/framescript.vim index 49ff92a81d..f9a274eab6 100644 --- a/runtime/indent/framescript.vim +++ b/runtime/indent/framescript.vim @@ -1,7 +1,7 @@ " Vim indent file -" Language: FrameScript -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2008-07-19 +" Language: FrameScript +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2008-07-19 if exists("b:did_indent") finish @@ -30,11 +30,11 @@ function GetFrameScriptIndent() let ind = indent(lnum) if getline(lnum) =~? '^\s*\%(If\|Loop\|Sub\)' - let ind = ind + &sw + let ind = ind + shiftwidth() endif if getline(v:lnum) =~? '^\s*\%(Else\|End\%(If\|Loop\|Sub\)\)' - let ind = ind - &sw + let ind = ind - shiftwidth() endif return ind diff --git a/runtime/indent/java.vim b/runtime/indent/java.vim index e0aec0faef..49f8010d21 100644 --- a/runtime/indent/java.vim +++ b/runtime/indent/java.vim @@ -1,12 +1,14 @@ " Vim indent file " Language: Java " Previous Maintainer: Toby Allsopp <toby.allsopp@peace.com> -" Current Maintainer: Hong Xu <xuhdev@gmail.com> -" Last Change: 2012 May 18 -" Version: 1.0 +" Current Maintainer: Hong Xu <hong@topbug.net> +" Homepage: http://www.vim.org/scripts/script.php?script_id=3899 +" https://github.com/xuhdev/indent-java.vim +" Last Change: 2016 Mar 7 +" Version: 1.1 " License: Same as Vim. -" Copyright (c) 2012 Hong Xu -" Before 2012, this file is maintained by Toby Allsopp. +" Copyright (c) 2012-2016 Hong Xu +" Before 2012, this file was maintained by Toby Allsopp. " Only load this indent file when no other was loaded. if exists("b:did_indent") @@ -29,6 +31,7 @@ let b:undo_indent = "set cin< cino< indentkeys< indentexpr<" if exists("*GetJavaIndent") finish endif + let s:keepcpo= &cpo set cpo&vim @@ -70,7 +73,7 @@ function GetJavaIndent() " If the previous line starts with '@', we should have the same indent as " the previous one - if getline(lnum) =~ '^\s*@\S\+\s*$' + if getline(lnum) =~ '^\s*@.*$' return indent(lnum) endif @@ -85,9 +88,9 @@ function GetJavaIndent() " Try to align "throws" lines for methods and "extends" and "implements" for " classes. - if getline(v:lnum) =~ '^\s*\(extends\|implements\)\>' - \ && getline(lnum) !~ '^\s*\(extends\|implements\)\>' - let theIndent = theIndent + &sw + if getline(v:lnum) =~ '^\s*\(throws\|extends\|implements\)\>' + \ && getline(lnum) !~ '^\s*\(throws\|extends\|implements\)\>' + let theIndent = theIndent + shiftwidth() endif " correct for continuation lines of "throws", "implements" and "extends" @@ -96,27 +99,27 @@ function GetJavaIndent() if strlen(cont_kw) > 0 let amount = strlen(cont_kw) + 1 if getline(lnum) !~ ',\s*$' - let theIndent = theIndent - (amount + &sw) + let theIndent = theIndent - (amount + shiftwidth()) if theIndent < 0 let theIndent = 0 endif elseif prev == lnum let theIndent = theIndent + amount if cont_kw ==# 'throws' - let theIndent = theIndent + &sw + let theIndent = theIndent + shiftwidth() endif endif elseif getline(prev) =~ '^\s*\(throws\|implements\|extends\)\>' \ && (getline(prev) =~ '{\s*$' \ || getline(v:lnum) =~ '^\s*{\s*$') - let theIndent = theIndent - &sw + let theIndent = theIndent - shiftwidth() endif " When the line starts with a }, try aligning it with the matching {, " skipping over "throws", "extends" and "implements" clauses. if getline(v:lnum) =~ '^\s*}\s*\(//.*\|/\*.*\)\=$' call cursor(v:lnum, 1) - silent normal % + silent normal! % let lnum = line('.') if lnum < v:lnum while lnum > 1 diff --git a/runtime/indent/ld.vim b/runtime/indent/ld.vim index eccf42b2b4..a72a3a9548 100644 --- a/runtime/indent/ld.vim +++ b/runtime/indent/ld.vim @@ -1,7 +1,7 @@ " Vim indent file -" Language: ld(1) script -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2006-12-20 +" Language: ld(1) script +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2006-12-20 if exists("b:did_indent") finish @@ -65,7 +65,7 @@ function GetLDIndent() if line =~ '^\s*\*' return cindent(v:lnum) elseif line =~ '^\s*}' - return indent(v:lnum) - &sw + return indent(v:lnum) - shiftwidth() endif let pnum = s:prevnonblanknoncomment(v:lnum - 1) @@ -73,11 +73,11 @@ function GetLDIndent() return 0 endif - let ind = indent(pnum) + s:count_braces(pnum, 1) * &sw + let ind = indent(pnum) + s:count_braces(pnum, 1) * shiftwidth() let pline = getline(pnum) if pline =~ '}\s*$' - let ind -= (s:count_braces(pnum, 0) - (pline =~ '^\s*}' ? 1 : 0)) * &sw + let ind -= (s:count_braces(pnum, 0) - (pline =~ '^\s*}' ? 1 : 0)) * shiftwidth() endif return ind diff --git a/runtime/indent/make.vim b/runtime/indent/make.vim index 8412fbb4d1..66a8a40173 100644 --- a/runtime/indent/make.vim +++ b/runtime/indent/make.vim @@ -1,7 +1,7 @@ " Vim indent file -" Language: Makefile -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2007-05-07 +" Language: Makefile +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2007-05-07 if exists("b:did_indent") finish @@ -48,14 +48,14 @@ function GetMakeIndent() if prev_prev_line =~ s:continuation_rx return indent(prev_lnum) elseif prev_line =~ s:rule_rx - return &sw + return shiftwidth() elseif prev_line =~ s:assignment_rx call cursor(prev_lnum, 1) if search(s:assignment_rx, 'W') != 0 return virtcol('.') - 1 else " TODO: ? - return &sw + return shiftwidth() endif else " TODO: OK, this might be a continued shell command, so perhaps indent @@ -66,7 +66,7 @@ function GetMakeIndent() " return indent(prev_lnum) + 2 " endif "endif - return indent(prev_lnum) + &sw + return indent(prev_lnum) + shiftwidth() endif elseif prev_prev_line =~ s:continuation_rx let folded_line = s:remove_continuation(prev_prev_line) . ' ' . s:remove_continuation(prev_line) @@ -102,13 +102,13 @@ function GetMakeIndent() return &ts endif elseif prev_line =~ s:conditional_directive_rx - return &sw + return shiftwidth() else let line = getline(v:lnum) if line =~ s:just_inserted_rule_rx return 0 elseif line =~ s:end_conditional_directive_rx - return v:lnum - 1 == 0 ? 0 : indent(v:lnum - 1) - &sw + return v:lnum - 1 == 0 ? 0 : indent(v:lnum - 1) - shiftwidth() else return v:lnum - 1 == 0 ? 0 : indent(v:lnum - 1) endif diff --git a/runtime/indent/readline.vim b/runtime/indent/readline.vim index 6ac2185bdc..e202ddfd89 100644 --- a/runtime/indent/readline.vim +++ b/runtime/indent/readline.vim @@ -1,7 +1,7 @@ " Vim indent file -" Language: readline configuration file -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2006-12-20 +" Language: readline configuration file +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2006-12-20 if exists("b:did_indent") finish @@ -25,11 +25,11 @@ function GetReadlineIndent() let ind = indent(lnum) if getline(lnum) =~ '^\s*$\(if\|else\)\>' - let ind = ind + &sw + let ind = ind + shiftwidth() endif if getline(v:lnum) =~ '^\s*$\(else\|endif\)\>' - let ind = ind - &sw + let ind = ind - shiftwidth() endif return ind diff --git a/runtime/indent/rst.vim b/runtime/indent/rst.vim index 80d3308fd8..c1ef8c9957 100644 --- a/runtime/indent/rst.vim +++ b/runtime/indent/rst.vim @@ -1,7 +1,7 @@ " Vim indent file -" Language: reStructuredText Documentation Format -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2011-08-03 +" Language: reStructuredText Documentation Format +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2011-08-03 if exists("b:did_indent") finish diff --git a/runtime/indent/sas.vim b/runtime/indent/sas.vim new file mode 100644 index 0000000000..d591b2796e --- /dev/null +++ b/runtime/indent/sas.vim @@ -0,0 +1,138 @@ +" Vim indent file +" Language: SAS +" Maintainer: Zhen-Huan Hu <wildkeny@gmail.com> +" Version: 3.0.1 +" Last Change: Mar 13, 2017 + +if exists("b:did_indent") + finish +endif +let b:did_indent = 1 + +setlocal indentexpr=GetSASIndent() +setlocal indentkeys+=;,=~data,=~proc,=~macro + +if exists("*GetSASIndent") + finish +endif + +let s:cpo_save = &cpo +set cpo&vim + +" Regex that captures the start of a data/proc section +let s:section_str = '\v%(^|;)\s*%(data|proc)>' +" Regex that captures the end of a run-processing section +let s:section_run = '\v%(^|;)\s*run\s*;' +" Regex that captures the end of a data/proc section +let s:section_end = '\v%(^|;)\s*%(quit|enddata)\s*;' + +" Regex that captures the start of a control block (anything inside a section) +let s:block_str = '\v<%(do>%([^;]+<%(to|over)>[^;]+)=|%(define|layout|method|select)>[^;]+|begingraph)\s*;' +" Regex that captures the end of a control block (anything inside a section) +let s:block_end = '\v<%(end|endlayout|endgraph)\s*;' + +" Regex that captures the start of a macro +let s:macro_str = '\v%(^|;)\s*\%macro>' +" Regex that captures the end of a macro +let s:macro_end = '\v%(^|;)\s*\%mend\s*;' + +" Regex that defines the end of the program +let s:program_end = '\v%(^|;)\s*endsas\s*;' + +" List of procs supporting run-processing +let s:run_processing_procs = [ + \ 'catalog', 'chart', 'datasets', 'document', 'ds2', 'plot', 'sql', + \ 'gareabar', 'gbarline', 'gchart', 'gkpi', 'gmap', 'gplot', 'gradar', 'greplay', 'gslide', 'gtile', + \ 'anova', 'arima', 'catmod', 'factex', 'glm', 'model', 'optex', 'plan', 'reg', + \ 'iml', + \ ] + +" Find the line number of previous keyword defined by the regex +function! s:PrevMatch(lnum, regex) + let prev_lnum = prevnonblank(a:lnum - 1) + while prev_lnum > 0 + let prev_line = getline(prev_lnum) + if prev_line =~ a:regex + break + else + let prev_lnum = prevnonblank(prev_lnum - 1) + endif + endwhile + return prev_lnum +endfunction + +" Main function +function! GetSASIndent() + let prev_lnum = prevnonblank(v:lnum - 1) + if prev_lnum ==# 0 + " Leave the indentation of the first line unchanged + return indent(1) + else + let prev_line = getline(prev_lnum) + " Previous non-blank line contains the start of a macro/section/block + " while not the end of a macro/section/block (at the same line) + if (prev_line =~ s:section_str && prev_line !~ s:section_run && prev_line !~ s:section_end) || + \ (prev_line =~ s:block_str && prev_line !~ s:block_end) || + \ (prev_line =~ s:macro_str && prev_line !~ s:macro_end) + let ind = indent(prev_lnum) + &sts + elseif prev_line =~ s:section_run && prev_line !~ s:section_end + let prev_section_str_lnum = s:PrevMatch(v:lnum, s:section_str) + let prev_section_end_lnum = max([ + \ s:PrevMatch(v:lnum, s:section_end), + \ s:PrevMatch(v:lnum, s:macro_end ), + \ s:PrevMatch(v:lnum, s:program_end)]) + " Check if the section supports run-processing + if prev_section_end_lnum < prev_section_str_lnum && + \ getline(prev_section_str_lnum) =~ '\v%(^|;)\s*proc\s+%(' . + \ join(s:run_processing_procs, '|') . ')>' + let ind = indent(prev_lnum) + &sts + else + let ind = indent(prev_lnum) + endif + else + let ind = indent(prev_lnum) + endif + endif + " Re-adjustments based on the inputs of the current line + let curr_line = getline(v:lnum) + if curr_line =~ s:program_end + " End of the program + " Same indentation as the first non-blank line + return indent(nextnonblank(1)) + elseif curr_line =~ s:macro_end + " Current line is the end of a macro + " Match the indentation of the start of the macro + return indent(s:PrevMatch(v:lnum, s:macro_str)) + elseif curr_line =~ s:block_end && curr_line !~ s:block_str + " Re-adjust if current line is the end of a block + " while not the beginning of a block (at the same line) + " Returning the indent of previous block start directly + " would not work due to nesting + let ind = ind - &sts + elseif curr_line =~ s:section_str || curr_line =~ s:section_run || curr_line =~ s:section_end + " Re-adjust if current line is the start/end of a section + " since the end of a section could be inexplicit + let prev_section_str_lnum = s:PrevMatch(v:lnum, s:section_str) + " Check if the previous section supports run-processing + if getline(prev_section_str_lnum) =~ '\v%(^|;)\s*proc\s+%(' . + \ join(s:run_processing_procs, '|') . ')>' + let prev_section_end_lnum = max([ + \ s:PrevMatch(v:lnum, s:section_end), + \ s:PrevMatch(v:lnum, s:macro_end ), + \ s:PrevMatch(v:lnum, s:program_end)]) + else + let prev_section_end_lnum = max([ + \ s:PrevMatch(v:lnum, s:section_end), + \ s:PrevMatch(v:lnum, s:section_run), + \ s:PrevMatch(v:lnum, s:macro_end ), + \ s:PrevMatch(v:lnum, s:program_end)]) + endif + if prev_section_end_lnum < prev_section_str_lnum + let ind = ind - &sts + endif + endif + return ind +endfunction + +let &cpo = s:cpo_save +unlet s:cpo_save diff --git a/runtime/indent/scala.vim b/runtime/indent/scala.vim index f97c79bbab..6fd8ca9d81 100644 --- a/runtime/indent/scala.vim +++ b/runtime/indent/scala.vim @@ -412,24 +412,24 @@ function! GetScalaIndent() if prevline =~ '^\s*\.' return ind else - return ind + &shiftwidth + return ind + shiftwidth() endif endif " Indent html literals if prevline !~ '/>\s*$' && prevline =~ '^\s*<[a-zA-Z][^>]*>\s*$' call scala#ConditionalConfirm("3") - return ind + &shiftwidth + return ind + shiftwidth() endif " assumes curly braces around try-block if curline =~ '^\s*}\s*\<catch\>' - return ind - &shiftwidth + return ind - shiftwidth() elseif curline =~ '^\s*\<catch\>' return ind endif - " Add a 'shiftwidth' after lines that start a block + " Add a shiftwidth()' after lines that start a block " If 'if', 'for' or 'while' end with ), this is a one-line block " If 'val', 'var', 'def' end with =, this is a one-line block if (prevline =~ '^\s*\<\%(\%(}\?\s*else\s\+\)\?if\|for\|while\)\>.*[)=]\s*$' && scala#NumberOfBraceGroups(prevline) <= 1) @@ -438,7 +438,7 @@ function! GetScalaIndent() \ || prevline =~ '^\s*\%(}\s*\)\?\<else\>\s*$' \ || prevline =~ '=\s*$' call scala#ConditionalConfirm("4") - let ind = ind + &shiftwidth + let ind = ind + shiftwidth() elseif prevline =~ '^\s*\<\%(}\?\s*else\s\+\)\?if\>' && curline =~ '^\s*}\?\s*\<else\>' return ind endif @@ -447,7 +447,7 @@ function! GetScalaIndent() let bracketCount = scala#CountBrackets(prevline, '{', '}') if bracketCount > 0 || prevline =~ '.*{\s*$' call scala#ConditionalConfirm("5b") - let ind = ind + &shiftwidth + let ind = ind + shiftwidth() elseif bracketCount < 0 call scala#ConditionalConfirm("6b") " if the closing brace actually completes the braces entirely, then we @@ -475,7 +475,7 @@ function! GetScalaIndent() let bracketCount = scala#CountBrackets(prevline, '(', ')') if bracketCount > 0 || prevline =~ '.*(\s*$' call scala#ConditionalConfirm("5a") - let ind = ind + &shiftwidth + let ind = ind + shiftwidth() elseif bracketCount < 0 call scala#ConditionalConfirm("6a") " if the closing brace actually completes the braces entirely, then we @@ -497,7 +497,7 @@ function! GetScalaIndent() else " This is the only part that's different from from the '{', '}' one below " Yup... some refactoring is necessary at some point. - let ind = ind + (bracketCount * &shiftwidth) + let ind = ind + (bracketCount * shiftwidth()) let lineCompletedBrackets = 1 endif endif @@ -506,10 +506,10 @@ function! GetScalaIndent() if curline =~ '^\s*}\?\s*\<else\>\%(\s\+\<if\>\s*(.*)\)\?\s*{\?\s*$' && \ ! scala#LineIsCompleteIf(prevline) && \ prevline !~ '^.*}\s*$' - let ind = ind - &shiftwidth + let ind = ind - shiftwidth() endif - " Subtract a 'shiftwidth' on '}' or html + " Subtract a shiftwidth()' on '}' or html let curCurlyCount = scala#CountCurlies(curline) if curCurlyCount < 0 call scala#ConditionalConfirm("14a") @@ -517,7 +517,7 @@ function! GetScalaIndent() return indent(matchline) elseif curline =~ '^\s*</[a-zA-Z][^>]*>' call scala#ConditionalConfirm("14c") - return ind - &shiftwidth + return ind - shiftwidth() endif let prevParenCount = scala#CountParens(prevline) @@ -529,7 +529,7 @@ function! GetScalaIndent() let prevCurlyCount = scala#CountCurlies(prevline) if prevCurlyCount == 0 && prevline =~ '^.*\%(=>\|⇒\)\s*$' && prevline !~ '^\s*this\s*:.*\%(=>\|⇒\)\s*$' && curline !~ '^\s*\<case\>' call scala#ConditionalConfirm("16") - let ind = ind + &shiftwidth + let ind = ind + shiftwidth() endif if ind == originalIndentValue && curline =~ '^\s*\<case\>' @@ -555,7 +555,7 @@ function! GetScalaIndent() if scala#LineIsAClosingXML(prevline) if scala#LineCompletesXML(prevlnum, prevline) call scala#ConditionalConfirm("20a") - return ind - &shiftwidth + return ind - shiftwidth() else call scala#ConditionalConfirm("20b") return ind @@ -566,7 +566,7 @@ function! GetScalaIndent() "let indentMultiplier = scala#LineCompletesDefValr(prevlnum, prevline) "if indentMultiplier != 0 " call scala#ConditionalConfirm("19a") - " let ind = ind - (indentMultiplier * &shiftwidth) + " let ind = ind - (indentMultiplier * shiftwidth()) let defValrLine = scala#Test(prevlnum, prevline, '{', '}') if defValrLine != -1 call scala#ConditionalConfirm("21a") @@ -575,10 +575,10 @@ function! GetScalaIndent() call scala#ConditionalConfirm("21b") if scala#GetLine(prevnonblank(prevlnum - 1)) =~ '^.*\<else\>\s*\%(//.*\)\?$' call scala#ConditionalConfirm("21c") - let ind = ind - &shiftwidth + let ind = ind - shiftwidth() elseif scala#LineCompletesIfElse(prevlnum, prevline) call scala#ConditionalConfirm("21d") - let ind = ind - &shiftwidth + let ind = ind - shiftwidth() elseif scala#CountParens(curline) < 0 && curline =~ '^\s*)' && scala#GetLine(scala#GetLineThatMatchesBracket('(', ')')) =~ '.*(\s*$' " Handles situations that look like this: " @@ -592,7 +592,7 @@ function! GetScalaIndent() " 10 " ).somethingHere() call scala#ConditionalConfirm("21e") - let ind = ind - &shiftwidth + let ind = ind - shiftwidth() endif endif endif diff --git a/runtime/indent/tcl.vim b/runtime/indent/tcl.vim index a92f57d67d..e9d61e4366 100644 --- a/runtime/indent/tcl.vim +++ b/runtime/indent/tcl.vim @@ -56,7 +56,7 @@ function GetTclIndent() if line =~ '^\s*\*' return cindent(v:lnum) elseif line =~ '^\s*}' - return indent(v:lnum) - &sw + return indent(v:lnum) - shiftwidth() endif let pnum = s:prevnonblanknoncomment(v:lnum - 1) @@ -64,11 +64,11 @@ function GetTclIndent() return 0 endif - let ind = indent(pnum) + s:count_braces(pnum, 1) * &sw + let ind = indent(pnum) + s:count_braces(pnum, 1) * shiftwidth() let pline = getline(pnum) if pline =~ '}\s*$' - let ind -= (s:count_braces(pnum, 0) - (pline =~ '^\s*}' ? 1 : 0)) * &sw + let ind -= (s:count_braces(pnum, 0) - (pline =~ '^\s*}' ? 1 : 0)) * shiftwidth() endif return ind diff --git a/runtime/indent/tcsh.vim b/runtime/indent/tcsh.vim index 59a9d56f44..ed08e6c6e2 100644 --- a/runtime/indent/tcsh.vim +++ b/runtime/indent/tcsh.vim @@ -32,17 +32,17 @@ function TcshGetIndent() let ind = indent(lnum) let line = getline(lnum) if line =~ '\v^\s*%(while|foreach)>|^\s*%(case\s.*:|default:|else)\s*$|%(<then|\\)$' - let ind = ind + &sw + let ind = ind + shiftwidth() endif if line =~ '\v^\s*breaksw>' - let ind = ind - &sw + let ind = ind - shiftwidth() endif " Subtract indent if current line has on end, endif, case commands let line = getline(v:lnum) if line =~ '\v^\s*%(else|end|endif)\s*$' - let ind = ind - &sw + let ind = ind - shiftwidth() endif return ind diff --git a/runtime/indent/tf.vim b/runtime/indent/tf.vim index 17597734b8..a980538506 100644 --- a/runtime/indent/tf.vim +++ b/runtime/indent/tf.vim @@ -1,8 +1,8 @@ " Vim indent file " Language: tf (TinyFugue) " Maintainer: Christian J. Robinson <heptite@gmail.com> -" URL: http://christianrobinson.name/vim/indent/tf.vim -" Last Change: 2002 May 29 +" URL: http://www.vim.org/scripts/script.php?script_id=174 +" Last Change: 2017 Feb 25 " Only load this indent file when no other was loaded. if exists("b:did_indent") @@ -38,14 +38,14 @@ function GetTFIndent() endif if line =~ '\(/def.*\\\|/for.*\(%;\s*\)\@\<!\\\)$' - let ind = ind + &sw + let ind = ind + shiftwidth() elseif line =~ '\(/if\|/else\|/then\)' if line !~ '/endif' - let ind = ind + &sw + let ind = ind + shiftwidth() endif elseif line =~ '/while' if line !~ '/done' - let ind = ind + &sw + let ind = ind + shiftwidth() endif endif @@ -53,11 +53,11 @@ function GetTFIndent() if line =~ '\(/else\|/endif\|/then\)' if line !~ '/if' - let ind = ind - &sw + let ind = ind - shiftwidth() endif elseif line =~ '/done' if line !~ '/while' - let ind = ind - &sw + let ind = ind - shiftwidth() endif endif diff --git a/runtime/indent/treetop.vim b/runtime/indent/treetop.vim index a2af78b8c2..2c6eecf5c4 100644 --- a/runtime/indent/treetop.vim +++ b/runtime/indent/treetop.vim @@ -1,7 +1,7 @@ " Vim indent file -" Language: Treetop -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2011-03-14 +" Language: Treetop +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2011-03-14 if exists("b:did_indent") finish @@ -26,12 +26,12 @@ function GetTreetopIndent() let line = getline(pnum) if line =~ '^\s*\%(grammar\|module\|rule\)\>' - let ind += &sw + let ind += shiftwidth() endif let line = getline(v:lnum) if line =~ '^\s*end\>' - let ind -= &sw + let ind -= shiftwidth() end retur ind diff --git a/runtime/indent/verilog.vim b/runtime/indent/verilog.vim index ecca462636..6222dc341f 100644 --- a/runtime/indent/verilog.vim +++ b/runtime/indent/verilog.vim @@ -1,10 +1,12 @@ " Language: Verilog HDL -" Maintainer: Chih-Tsun Huang <cthuang@larc.ee.nthu.edu.tw> -" Last Change: 2011 Dec 10 by Thilo Six -" URL: http://larc.ee.nthu.edu.tw/~cthuang/vim/indent/verilog.vim +" Maintainer: Chih-Tsun Huang <cthuang@cs.nthu.edu.tw> +" Last Change: 2017 Feb 24 by Chih-Tsun Huang +" URL: http://www.cs.nthu.edu.tw/~cthuang/vim/indent/verilog.vim " " Credits: " Suggestions for improvement, bug reports by +" Takuya Fujiwara <tyru.exe@gmail.com> +" Thilo Six <debian@Xk2c.de> " Leo Butlero <lbutler@brocade.com> " " Buffer Variables: @@ -38,7 +40,7 @@ function GetVerilogIndent() if exists('b:verilog_indent_width') let offset = b:verilog_indent_width else - let offset = &sw + let offset = shiftwidth() endif if exists('b:verilog_indent_modules') let indent_modules = offset diff --git a/runtime/indent/xf86conf.vim b/runtime/indent/xf86conf.vim index 4174a24224..5a8bc0fec1 100644 --- a/runtime/indent/xf86conf.vim +++ b/runtime/indent/xf86conf.vim @@ -1,7 +1,7 @@ " Vim indent file -" Language: XFree86 Configuration File -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2006-12-20 +" Language: XFree86 Configuration File +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2006-12-20 if exists("b:did_indent") finish @@ -26,11 +26,11 @@ function GetXF86ConfIndent() let ind = indent(lnum) if getline(lnum) =~? '^\s*\(Sub\)\=Section\>' - let ind = ind + &sw + let ind = ind + shiftwidth() endif if getline(v:lnum) =~? '^\s*End\(Sub\)\=Section\>' - let ind = ind - &sw + let ind = ind - shiftwidth() endif return ind diff --git a/runtime/indent/xinetd.vim b/runtime/indent/xinetd.vim index c8127237e8..977ee3d33b 100644 --- a/runtime/indent/xinetd.vim +++ b/runtime/indent/xinetd.vim @@ -1,7 +1,7 @@ " Vim indent file -" Language: xinetd.conf(5) configuration file -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2006-12-20 +" Language: xinetd.conf(5) configuration file +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2006-12-20 if exists("b:did_indent") finish @@ -47,8 +47,8 @@ function GetXinetdIndent() return 0 endif - return indent(pnum) + s:count_braces(pnum, 1) * &sw - \ - s:count_braces(v:lnum, 0) * &sw + return indent(pnum) + s:count_braces(pnum, 1) * shiftwidth() + \ - s:count_braces(v:lnum, 0) * shiftwidth() endfunction let &cpo = s:keepcpo diff --git a/runtime/indent/yacc.vim b/runtime/indent/yacc.vim index 2ab7d7b38c..01ad4fc56d 100644 --- a/runtime/indent/yacc.vim +++ b/runtime/indent/yacc.vim @@ -1,7 +1,7 @@ " Vim indent file -" Language: YACC input file -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2006-12-20 +" Language: YACC input file +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2006-12-20 " Only load this indent file when no other was loaded. if exists("b:did_indent") diff --git a/runtime/menu.vim b/runtime/menu.vim index 37e9d8733b..6e1b22c921 100644 --- a/runtime/menu.vim +++ b/runtime/menu.vim @@ -2,7 +2,7 @@ " You can also use this as a start for your own set of menus. " " Maintainer: Bram Moolenaar <Bram@vim.org> -" Last Change: 2017 Feb 09 +" Last Change: 2017 Mar 04 " Note that ":an" (short for ":anoremenu") is often used to make a menu work " in all modes and avoid side effects from mappings defined by the user. @@ -70,7 +70,7 @@ endif " Help menu an 9999.10 &Help.&Overview<Tab><F1> :help<CR> an 9999.20 &Help.&User\ Manual :help usr_toc<CR> -an 9999.30 &Help.&How-to\ links :help how-to<CR> +an 9999.30 &Help.&How-To\ Links :help how-to<CR> an <silent> 9999.40 &Help.&Find\.\.\. :call <SID>Helpfind()<CR> an 9999.45 &Help.-sep1- <Nop> an 9999.50 &Help.&Credits :help credits<CR> @@ -112,7 +112,7 @@ an 10.350 &File.Save\ &As\.\.\.<Tab>:sav :browse confirm saveas<CR> if has("diff") an 10.400 &File.-SEP2- <Nop> - an 10.410 &File.Split\ &Diff\ with\.\.\. :browse vert diffsplit<CR> + an 10.410 &File.Split\ &Diff\ With\.\.\. :browse vert diffsplit<CR> an 10.420 &File.Split\ Patched\ &By\.\.\. :browse vert diffpatch<CR> endif @@ -212,25 +212,25 @@ endfun " Edit/Global Settings an 20.440.100 &Edit.&Global\ Settings.Toggle\ Pattern\ &Highlight<Tab>:set\ hls! :set hls! hls?<CR> -an 20.440.110 &Edit.&Global\ Settings.Toggle\ &Ignore-case<Tab>:set\ ic! :set ic! ic?<CR> -an 20.440.110 &Edit.&Global\ Settings.Toggle\ &Showmatch<Tab>:set\ sm! :set sm! sm?<CR> - -an 20.440.120 &Edit.&Global\ Settings.&Context\ lines.\ 1\ :set so=1<CR> -an 20.440.120 &Edit.&Global\ Settings.&Context\ lines.\ 2\ :set so=2<CR> -an 20.440.120 &Edit.&Global\ Settings.&Context\ lines.\ 3\ :set so=3<CR> -an 20.440.120 &Edit.&Global\ Settings.&Context\ lines.\ 4\ :set so=4<CR> -an 20.440.120 &Edit.&Global\ Settings.&Context\ lines.\ 5\ :set so=5<CR> -an 20.440.120 &Edit.&Global\ Settings.&Context\ lines.\ 7\ :set so=7<CR> -an 20.440.120 &Edit.&Global\ Settings.&Context\ lines.\ 10\ :set so=10<CR> -an 20.440.120 &Edit.&Global\ Settings.&Context\ lines.\ 100\ :set so=100<CR> +an 20.440.110 &Edit.&Global\ Settings.Toggle\ &Ignoring\ Case<Tab>:set\ ic! :set ic! ic?<CR> +an 20.440.110 &Edit.&Global\ Settings.Toggle\ &Showing\ Matched\ Pairs<Tab>:set\ sm! :set sm! sm?<CR> + +an 20.440.120 &Edit.&Global\ Settings.&Context\ Lines.\ 1\ :set so=1<CR> +an 20.440.120 &Edit.&Global\ Settings.&Context\ Lines.\ 2\ :set so=2<CR> +an 20.440.120 &Edit.&Global\ Settings.&Context\ Lines.\ 3\ :set so=3<CR> +an 20.440.120 &Edit.&Global\ Settings.&Context\ Lines.\ 4\ :set so=4<CR> +an 20.440.120 &Edit.&Global\ Settings.&Context\ Lines.\ 5\ :set so=5<CR> +an 20.440.120 &Edit.&Global\ Settings.&Context\ Lines.\ 7\ :set so=7<CR> +an 20.440.120 &Edit.&Global\ Settings.&Context\ Lines.\ 10\ :set so=10<CR> +an 20.440.120 &Edit.&Global\ Settings.&Context\ Lines.\ 100\ :set so=100<CR> an 20.440.130.40 &Edit.&Global\ Settings.&Virtual\ Edit.Never :set ve=<CR> an 20.440.130.50 &Edit.&Global\ Settings.&Virtual\ Edit.Block\ Selection :set ve=block<CR> -an 20.440.130.60 &Edit.&Global\ Settings.&Virtual\ Edit.Insert\ mode :set ve=insert<CR> +an 20.440.130.60 &Edit.&Global\ Settings.&Virtual\ Edit.Insert\ Mode :set ve=insert<CR> an 20.440.130.70 &Edit.&Global\ Settings.&Virtual\ Edit.Block\ and\ Insert :set ve=block,insert<CR> an 20.440.130.80 &Edit.&Global\ Settings.&Virtual\ Edit.Always :set ve=all<CR> an 20.440.140 &Edit.&Global\ Settings.Toggle\ Insert\ &Mode<Tab>:set\ im! :set im!<CR> -an 20.440.145 &Edit.&Global\ Settings.Toggle\ Vi\ C&ompatible<Tab>:set\ cp! :set cp!<CR> +an 20.440.145 &Edit.&Global\ Settings.Toggle\ Vi\ C&ompatibility<Tab>:set\ cp! :set cp!<CR> an <silent> 20.440.150 &Edit.&Global\ Settings.Search\ &Path\.\.\. :call <SID>SearchP()<CR> an <silent> 20.440.160 &Edit.&Global\ Settings.Ta&g\ Files\.\.\. :call <SID>TagFiles()<CR> " @@ -274,13 +274,13 @@ endfun " Boolean options an 20.440.100 &Edit.F&ile\ Settings.Toggle\ Line\ &Numbering<Tab>:set\ nu! :set nu! nu?<CR> -an 20.440.105 &Edit.F&ile\ Settings.Toggle\ relati&ve\ Line\ Numbering<Tab>:set\ rnu! :set rnu! rnu?<CR> +an 20.440.105 &Edit.F&ile\ Settings.Toggle\ Relati&ve\ Line\ Numbering<Tab>:set\ rnu! :set rnu! rnu?<CR> an 20.440.110 &Edit.F&ile\ Settings.Toggle\ &List\ Mode<Tab>:set\ list! :set list! list?<CR> -an 20.440.120 &Edit.F&ile\ Settings.Toggle\ Line\ &Wrap<Tab>:set\ wrap! :set wrap! wrap?<CR> -an 20.440.130 &Edit.F&ile\ Settings.Toggle\ W&rap\ at\ word<Tab>:set\ lbr! :set lbr! lbr?<CR> -an 20.440.160 &Edit.F&ile\ Settings.Toggle\ &expand-tab<Tab>:set\ et! :set et! et?<CR> -an 20.440.170 &Edit.F&ile\ Settings.Toggle\ &auto-indent<Tab>:set\ ai! :set ai! ai?<CR> -an 20.440.180 &Edit.F&ile\ Settings.Toggle\ &C-indenting<Tab>:set\ cin! :set cin! cin?<CR> +an 20.440.120 &Edit.F&ile\ Settings.Toggle\ Line\ &Wrapping<Tab>:set\ wrap! :set wrap! wrap?<CR> +an 20.440.130 &Edit.F&ile\ Settings.Toggle\ W&rapping\ at\ Word<Tab>:set\ lbr! :set lbr! lbr?<CR> +an 20.440.160 &Edit.F&ile\ Settings.Toggle\ Tab\ &Expanding<Tab>:set\ et! :set et! et?<CR> +an 20.440.170 &Edit.F&ile\ Settings.Toggle\ &Auto\ Indenting<Tab>:set\ ai! :set ai! ai?<CR> +an 20.440.180 &Edit.F&ile\ Settings.Toggle\ &C-Style\ Indenting<Tab>:set\ cin! :set cin! cin?<CR> " other options an 20.440.600 &Edit.F&ile\ Settings.-SEP2- <Nop> @@ -309,7 +309,7 @@ fun! s:TextWidth() " Remove leading zeros to avoid it being used as an octal number. " But keep a zero by itself. let tw = substitute(n, "^0*", "", "") - let &tw = tw == '' ? 0 : tw + let &tw = tw == '' ? 0 : tw endif endfun @@ -390,10 +390,10 @@ if !exists("g:ctags_command") let g:ctags_command = "ctags -R ." endif -an 40.300 &Tools.&Jump\ to\ this\ tag<Tab>g^] g<C-]> -vunmenu &Tools.&Jump\ to\ this\ tag<Tab>g^] -vnoremenu &Tools.&Jump\ to\ this\ tag<Tab>g^] g<C-]> -an 40.310 &Tools.Jump\ &back<Tab>^T <C-T> +an 40.300 &Tools.&Jump\ to\ This\ Tag<Tab>g^] g<C-]> +vunmenu &Tools.&Jump\ to\ This\ Tag<Tab>g^] +vnoremenu &Tools.&Jump\ to\ This\ Tag<Tab>g^] g<C-]> +an 40.310 &Tools.Jump\ &Back<Tab>^T <C-T> an 40.320 &Tools.Build\ &Tags\ File :exe "!" . g:ctags_command<CR> if has("folding") || has("spell") @@ -404,17 +404,17 @@ endif if has("spell") an 40.335.110 &Tools.&Spelling.&Spell\ Check\ On :set spell<CR> an 40.335.120 &Tools.&Spelling.Spell\ Check\ &Off :set nospell<CR> - an 40.335.130 &Tools.&Spelling.To\ &Next\ error<Tab>]s ]s - an 40.335.130 &Tools.&Spelling.To\ &Previous\ error<Tab>[s [s + an 40.335.130 &Tools.&Spelling.To\ &Next\ Error<Tab>]s ]s + an 40.335.130 &Tools.&Spelling.To\ &Previous\ Error<Tab>[s [s an 40.335.140 &Tools.&Spelling.Suggest\ &Corrections<Tab>z= z= - an 40.335.150 &Tools.&Spelling.&Repeat\ correction<Tab>:spellrepall :spellrepall<CR> + an 40.335.150 &Tools.&Spelling.&Repeat\ Correction<Tab>:spellrepall :spellrepall<CR> an 40.335.200 &Tools.&Spelling.-SEP1- <Nop> - an 40.335.210 &Tools.&Spelling.Set\ language\ to\ "en" :set spl=en spell<CR> - an 40.335.220 &Tools.&Spelling.Set\ language\ to\ "en_au" :set spl=en_au spell<CR> - an 40.335.230 &Tools.&Spelling.Set\ language\ to\ "en_ca" :set spl=en_ca spell<CR> - an 40.335.240 &Tools.&Spelling.Set\ language\ to\ "en_gb" :set spl=en_gb spell<CR> - an 40.335.250 &Tools.&Spelling.Set\ language\ to\ "en_nz" :set spl=en_nz spell<CR> - an 40.335.260 &Tools.&Spelling.Set\ language\ to\ "en_us" :set spl=en_us spell<CR> + an 40.335.210 &Tools.&Spelling.Set\ Language\ to\ "en" :set spl=en spell<CR> + an 40.335.220 &Tools.&Spelling.Set\ Language\ to\ "en_au" :set spl=en_au spell<CR> + an 40.335.230 &Tools.&Spelling.Set\ Language\ to\ "en_ca" :set spl=en_ca spell<CR> + an 40.335.240 &Tools.&Spelling.Set\ Language\ to\ "en_gb" :set spl=en_gb spell<CR> + an 40.335.250 &Tools.&Spelling.Set\ Language\ to\ "en_nz" :set spl=en_nz spell<CR> + an 40.335.260 &Tools.&Spelling.Set\ Language\ to\ "en_us" :set spl=en_us spell<CR> an <silent> 40.335.270 &Tools.&Spelling.&Find\ More\ Languages :call <SID>SpellLang()<CR> let s:undo_spellang = ['aun &Tools.&Spelling.&Find\ More\ Languages'] @@ -431,7 +431,7 @@ if has("spell") endif if !exists("g:menutrans_set_lang_to") - let g:menutrans_set_lang_to = 'Set language to' + let g:menutrans_set_lang_to = 'Set Language to' endif let found = 0 @@ -468,13 +468,13 @@ endif " Tools.Fold Menu if has("folding") " open close folds - an 40.340.110 &Tools.&Folding.&Enable/Disable\ folds<Tab>zi zi + an 40.340.110 &Tools.&Folding.&Enable/Disable\ Folds<Tab>zi zi an 40.340.120 &Tools.&Folding.&View\ Cursor\ Line<Tab>zv zv - an 40.340.120 &Tools.&Folding.Vie&w\ Cursor\ Line\ only<Tab>zMzx zMzx - inoremenu 40.340.120 &Tools.&Folding.Vie&w\ Cursor\ Line\ only<Tab>zMzx <C-O>zM<C-O>zx - an 40.340.130 &Tools.&Folding.C&lose\ more\ folds<Tab>zm zm - an 40.340.140 &Tools.&Folding.&Close\ all\ folds<Tab>zM zM - an 40.340.150 &Tools.&Folding.O&pen\ more\ folds<Tab>zr zr + an 40.340.120 &Tools.&Folding.Vie&w\ Cursor\ Line\ Only<Tab>zMzx zMzx + inoremenu 40.340.120 &Tools.&Folding.Vie&w\ Cursor\ Line\ Only<Tab>zMzx <C-O>zM<C-O>zx + an 40.340.130 &Tools.&Folding.C&lose\ More\ Folds<Tab>zm zm + an 40.340.140 &Tools.&Folding.&Close\ All\ Folds<Tab>zM zM + an 40.340.150 &Tools.&Folding.O&pen\ More\ Folds<Tab>zr zr an 40.340.160 &Tools.&Folding.&Open\ All\ Folds<Tab>zR zR " fold method an 40.340.200 &Tools.&Folding.-SEP1- <Nop> @@ -490,14 +490,14 @@ if has("folding") an 40.340.240 &Tools.&Folding.Delete\ &All\ Folds<Tab>zD zD " moving around in folds an 40.340.300 &Tools.&Folding.-SEP2- <Nop> - an 40.340.310.10 &Tools.&Folding.Fold\ col&umn\ width.\ &0\ :set fdc=0<CR> - an 40.340.310.20 &Tools.&Folding.Fold\ col&umn\ width.\ &2\ :set fdc=2<CR> - an 40.340.310.30 &Tools.&Folding.Fold\ col&umn\ width.\ &3\ :set fdc=3<CR> - an 40.340.310.40 &Tools.&Folding.Fold\ col&umn\ width.\ &4\ :set fdc=4<CR> - an 40.340.310.50 &Tools.&Folding.Fold\ col&umn\ width.\ &5\ :set fdc=5<CR> - an 40.340.310.60 &Tools.&Folding.Fold\ col&umn\ width.\ &6\ :set fdc=6<CR> - an 40.340.310.70 &Tools.&Folding.Fold\ col&umn\ width.\ &7\ :set fdc=7<CR> - an 40.340.310.80 &Tools.&Folding.Fold\ col&umn\ width.\ &8\ :set fdc=8<CR> + an 40.340.310.10 &Tools.&Folding.Fold\ Col&umn\ Width.\ &0\ :set fdc=0<CR> + an 40.340.310.20 &Tools.&Folding.Fold\ Col&umn\ Width.\ &2\ :set fdc=2<CR> + an 40.340.310.30 &Tools.&Folding.Fold\ Col&umn\ Width.\ &3\ :set fdc=3<CR> + an 40.340.310.40 &Tools.&Folding.Fold\ Col&umn\ Width.\ &4\ :set fdc=4<CR> + an 40.340.310.50 &Tools.&Folding.Fold\ Col&umn\ Width.\ &5\ :set fdc=5<CR> + an 40.340.310.60 &Tools.&Folding.Fold\ Col&umn\ Width.\ &6\ :set fdc=6<CR> + an 40.340.310.70 &Tools.&Folding.Fold\ Col&umn\ Width.\ &7\ :set fdc=7<CR> + an 40.340.310.80 &Tools.&Folding.Fold\ Col&umn\ Width.\ &8\ :set fdc=8<CR> endif " has folding if has("diff") @@ -525,7 +525,7 @@ an 40.430.70 &Tools.Error\ &Window.&Close<Tab>:cclose :cclose<CR> an 40.520 &Tools.-SEP3- <Nop> an <silent> 40.530 &Tools.&Convert\ to\ HEX<Tab>:%!xxd \ :call <SID>XxdConv()<CR> -an <silent> 40.540 &Tools.Conve&rt\ back<Tab>:%!xxd\ -r +an <silent> 40.540 &Tools.Conve&rt\ Back<Tab>:%!xxd\ -r \ :call <SID>XxdBack()<CR> " Use a function to do the conversion, so that it also works with 'insertmode' @@ -574,7 +574,7 @@ while strlen(s:n) > 0 endif " Ignore case for Windows let s:name = substitute(s:name, '\c.*[/\\:\]]\([^/\\:]*\)\.vim', '\1', '') - exe "an 30.440." . s:idx . ' &Tools.Se&T\ Compiler.' . s:name . " :compiler " . s:name . "<CR>" + exe "an 30.440." . s:idx . ' &Tools.Se&t\ Compiler.' . s:name . " :compiler " . s:name . "<CR>" unlet s:name unlet s:i let s:idx = s:idx + 10 @@ -807,8 +807,8 @@ an 70.345 &Window.Close\ &Other(s)<Tab>^Wo :confirm only<CR> an 70.350 &Window.-SEP2- <Nop> an 70.355 &Window.Move\ &To.&Top<Tab>^WK <C-W>K an 70.355 &Window.Move\ &To.&Bottom<Tab>^WJ <C-W>J -an 70.355 &Window.Move\ &To.&Left\ side<Tab>^WH <C-W>H -an 70.355 &Window.Move\ &To.&Right\ side<Tab>^WL <C-W>L +an 70.355 &Window.Move\ &To.&Left\ Side<Tab>^WH <C-W>H +an 70.355 &Window.Move\ &To.&Right\ Side<Tab>^WL <C-W>L an 70.360 &Window.Rotate\ &Up<Tab>^WR <C-W>R an 70.362 &Window.Rotate\ &Down<Tab>^Wr <C-W>r an 70.365 &Window.-SEP3- <Nop> @@ -891,7 +891,7 @@ if has("spell") let s:suglist = spellsuggest(w, 10) endif if len(s:suglist) > 0 - let s:changeitem = 'change\ "' . escape(w, ' .'). '"\ to' + let s:changeitem = 'Change\ "' . escape(w, ' .'). '"\ to' let s:fromword = w let pri = 1 " set 'cpo' to include the <CR> @@ -903,10 +903,10 @@ if has("spell") let pri += 1 endfor - let s:additem = 'add\ "' . escape(w, ' .') . '"\ to\ word\ list' + let s:additem = 'Add\ "' . escape(w, ' .') . '"\ to\ Word\ List' exe 'anoremenu 1.6 PopUp.' . s:additem . ' :spellgood ' . w . '<CR>' - let s:ignoreitem = 'ignore\ "' . escape(w, ' .') . '"' + let s:ignoreitem = 'Ignore\ "' . escape(w, ' .') . '"' exe 'anoremenu 1.7 PopUp.' . s:ignoreitem . ' :spellgood! ' . w . '<CR>' anoremenu 1.8 PopUp.-SpellSep- : @@ -1045,7 +1045,7 @@ endif " !exists("did_install_default_menus") if !exists("did_install_syntax_menu") an 50.212 &Syntax.&Manual :syn manual<CR> an 50.214 &Syntax.A&utomatic :syn on<CR> - an <silent> 50.216 &Syntax.on/off\ for\ &This\ file :call <SID>SynOnOff()<CR> + an <silent> 50.216 &Syntax.On/Off\ for\ &This\ File :call <SID>SynOnOff()<CR> if !exists("*s:SynOnOff") fun s:SynOnOff() if has("syntax_items") @@ -1073,14 +1073,14 @@ if (exists("did_load_filetypes") || exists("syntax_on")) if exists("do_syntax_sel_menu") runtime! synmenu.vim else - an 50.10 &Syntax.&Show\ filetypes\ in\ menu :let do_syntax_sel_menu = 1<Bar>runtime! synmenu.vim<Bar>aunmenu &Syntax.&Show\ filetypes\ in\ menu<CR> + an 50.10 &Syntax.&Show\ File\ Types\ in\ Menu :let do_syntax_sel_menu = 1<Bar>runtime! synmenu.vim<Bar>aunmenu &Syntax.&Show\ File\ Types\ in\ Menu<CR> an 50.195 &Syntax.-SEP1- <Nop> endif an 50.210 &Syntax.&Off :syn off<CR> an 50.700 &Syntax.-SEP3- <Nop> -an 50.710 &Syntax.Co&lor\ test :sp $VIMRUNTIME/syntax/colortest.vim<Bar>so %<CR> -an 50.720 &Syntax.&Highlight\ test :runtime syntax/hitest.vim<CR> +an 50.710 &Syntax.Co&lor\ Test :sp $VIMRUNTIME/syntax/colortest.vim<Bar>so %<CR> +an 50.720 &Syntax.&Highlight\ Test :runtime syntax/hitest.vim<CR> an 50.730 &Syntax.&Convert\ to\ HTML :runtime syntax/2html.vim<CR> endif " !exists("did_install_syntax_menu") diff --git a/runtime/plugin/man.vim b/runtime/plugin/man.vim index 63faa15213..7bccd4a3b9 100644 --- a/runtime/plugin/man.vim +++ b/runtime/plugin/man.vim @@ -5,7 +5,7 @@ if exists('g:loaded_man') endif let g:loaded_man = 1 -command! -range=0 -complete=customlist,man#complete -nargs=* Man call man#open_page(v:count, v:count1, <q-mods>, <f-args>) +command! -bar -range=0 -complete=customlist,man#complete -nargs=* Man call man#open_page(v:count, v:count1, <q-mods>, <f-args>) augroup man autocmd! diff --git a/runtime/plugin/tarPlugin.vim b/runtime/plugin/tarPlugin.vim index 034cbe225a..6d9e6bd540 100644 --- a/runtime/plugin/tarPlugin.vim +++ b/runtime/plugin/tarPlugin.vim @@ -40,6 +40,7 @@ augroup tar au BufReadCmd *.tar.bz2 call tar#Browse(expand("<amatch>")) au BufReadCmd *.tar.Z call tar#Browse(expand("<amatch>")) au BufReadCmd *.tgz call tar#Browse(expand("<amatch>")) + au BufReadCmd *.tbz call tar#Browse(expand("<amatch>")) au BufReadCmd *.tar.lzma call tar#Browse(expand("<amatch>")) au BufReadCmd *.tar.xz call tar#Browse(expand("<amatch>")) au BufReadCmd *.txz call tar#Browse(expand("<amatch>")) diff --git a/runtime/scripts.vim b/runtime/scripts.vim index c2f6d5cff1..3b6163f9c2 100644 --- a/runtime/scripts.vim +++ b/runtime/scripts.vim @@ -1,7 +1,7 @@ " Vim support file to detect file types in scripts " " Maintainer: Bram Moolenaar <Bram@vim.org> -" Last change: 2016 May 21 +" Last change: 2017 Mar 04 " This file is called by an autocommand for every file that has just been " loaded into a buffer. It checks if the type of file can be recognized by @@ -124,6 +124,10 @@ if s:line1 =~ "^#!" elseif s:name =~ 'ruby' set ft=ruby + " JavaScript + elseif s:name =~ 'node\(js\)\=\>' || s:name =~ 'rhino\>' + set ft=javascript + " BC calculator elseif s:name =~ '^bc\>' set ft=bc @@ -156,6 +160,14 @@ if s:line1 =~ "^#!" elseif s:name =~ 'escript' set ft=erlang + " Haskell + elseif s:name =~ 'haskell' + set ft=haskell + + " Scala + elseif s:name =~ 'scala\>' + set ft=scala + endif unlet s:name diff --git a/runtime/synmenu.vim b/runtime/synmenu.vim index 81e3667298..b156cd2fc7 100644 --- a/runtime/synmenu.vim +++ b/runtime/synmenu.vim @@ -604,11 +604,11 @@ an 50.150.430 &Syntax.WXYZ.Zimbu :cal SetSyn("zimbu")<CR> an 50.195 &Syntax.-SEP1- <Nop> -an <silent> 50.200 &Syntax.Set\ '&syntax'\ only :call <SID>Setsynonly()<CR> +an <silent> 50.200 &Syntax.Set\ '&syntax'\ Only :call <SID>Setsynonly()<CR> fun! s:Setsynonly() let s:syntax_menu_synonly = 1 endfun -an <silent> 50.202 &Syntax.Set\ '&filetype'\ too :call <SID>Nosynonly()<CR> +an <silent> 50.202 &Syntax.Set\ '&filetype'\ Too :call <SID>Nosynonly()<CR> fun! s:Nosynonly() if exists("s:syntax_menu_synonly") unlet s:syntax_menu_synonly diff --git a/runtime/syntax/a2ps.vim b/runtime/syntax/a2ps.vim index 2a87d62f90..afe3af1eed 100644 --- a/runtime/syntax/a2ps.vim +++ b/runtime/syntax/a2ps.vim @@ -1,7 +1,7 @@ " Vim syntax file -" Language: a2ps(1) configuration file -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2006-04-19 +" Language: a2ps(1) configuration file +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2006-04-19 if exists("b:current_syntax") finish diff --git a/runtime/syntax/alsaconf.vim b/runtime/syntax/alsaconf.vim index 8fd51f0ac4..143fcc0a2e 100644 --- a/runtime/syntax/alsaconf.vim +++ b/runtime/syntax/alsaconf.vim @@ -1,7 +1,7 @@ " Vim syntax file -" Language: alsaconf(8) configuration file -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2006-04-19 +" Language: alsaconf(8) configuration file +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2006-04-19 if exists("b:current_syntax") finish diff --git a/runtime/syntax/arch.vim b/runtime/syntax/arch.vim index fa9c3f02c3..f9d095e443 100644 --- a/runtime/syntax/arch.vim +++ b/runtime/syntax/arch.vim @@ -1,7 +1,7 @@ " Vim syntax file -" Language: GNU Arch inventory file -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2007-06-17 +" Language: GNU Arch inventory file +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2007-06-17 if exists("b:current_syntax") finish diff --git a/runtime/syntax/bdf.vim b/runtime/syntax/bdf.vim index d0c73eb601..cc1a337569 100644 --- a/runtime/syntax/bdf.vim +++ b/runtime/syntax/bdf.vim @@ -1,7 +1,7 @@ " Vim syntax file -" Language: BDF font definition -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2006-04-19 +" Language: BDF font definition +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2006-04-19 if exists("b:current_syntax") finish diff --git a/runtime/syntax/calendar.vim b/runtime/syntax/calendar.vim index 588b41a4b8..4250109019 100644 --- a/runtime/syntax/calendar.vim +++ b/runtime/syntax/calendar.vim @@ -1,7 +1,7 @@ " Vim syntax file -" Language: calendar(1) input file -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2006-04-19 +" Language: calendar(1) input file +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2006-04-19 if exists("b:current_syntax") finish diff --git a/runtime/syntax/cdrdaoconf.vim b/runtime/syntax/cdrdaoconf.vim index 5058c23a24..0fa65103fb 100644 --- a/runtime/syntax/cdrdaoconf.vim +++ b/runtime/syntax/cdrdaoconf.vim @@ -1,7 +1,7 @@ " Vim syntax file -" Language: cdrdao(1) configuration file -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2007-09-02 +" Language: cdrdao(1) configuration file +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2007-09-02 if exists("b:current_syntax") finish diff --git a/runtime/syntax/cdrtoc.vim b/runtime/syntax/cdrtoc.vim index fa752dbfb8..866784d7c2 100644 --- a/runtime/syntax/cdrtoc.vim +++ b/runtime/syntax/cdrtoc.vim @@ -1,7 +1,7 @@ " Vim syntax file -" Language: cdrdao(1) TOC file -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2007-05-10 +" Language: cdrdao(1) TOC file +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2007-05-10 if exists("b:current_syntax") finish diff --git a/runtime/syntax/cmusrc.vim b/runtime/syntax/cmusrc.vim index e36a69c698..b821affd57 100644 --- a/runtime/syntax/cmusrc.vim +++ b/runtime/syntax/cmusrc.vim @@ -1,6 +1,6 @@ " Vim syntax file -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2007-06-17 +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2007-06-17 if exists("b:current_syntax") finish diff --git a/runtime/syntax/crm.vim b/runtime/syntax/crm.vim index 17b67d44f0..5285de3e23 100644 --- a/runtime/syntax/crm.vim +++ b/runtime/syntax/crm.vim @@ -1,7 +1,7 @@ " Vim syntax file -" Language: CRM114 -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2006-04-19 +" Language: CRM114 +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2006-04-19 if exists("b:current_syntax") finish diff --git a/runtime/syntax/cvsrc.vim b/runtime/syntax/cvsrc.vim index 6c2c4eea04..9522de6436 100644 --- a/runtime/syntax/cvsrc.vim +++ b/runtime/syntax/cvsrc.vim @@ -1,7 +1,7 @@ " Vim syntax file -" Language: cvs(1) RC file -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2006-04-19 +" Language: cvs(1) RC file +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2006-04-19 if exists("b:current_syntax") finish diff --git a/runtime/syntax/denyhosts.vim b/runtime/syntax/denyhosts.vim index 0ec09ba13e..f32faab168 100644 --- a/runtime/syntax/denyhosts.vim +++ b/runtime/syntax/denyhosts.vim @@ -1,7 +1,7 @@ " Vim syntax file -" Language: denyhosts configuration file -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2007-06-25 +" Language: denyhosts configuration file +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2007-06-25 if exists("b:current_syntax") finish diff --git a/runtime/syntax/dictconf.vim b/runtime/syntax/dictconf.vim index e7fa476975..c762808c89 100644 --- a/runtime/syntax/dictconf.vim +++ b/runtime/syntax/dictconf.vim @@ -1,7 +1,7 @@ " Vim syntax file -" Language: dict(1) configuration file -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2006-04-19 +" Language: dict(1) configuration file +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2006-04-19 if exists("b:current_syntax") finish diff --git a/runtime/syntax/dictdconf.vim b/runtime/syntax/dictdconf.vim index 44bf6f8bad..ecf5fd346f 100644 --- a/runtime/syntax/dictdconf.vim +++ b/runtime/syntax/dictdconf.vim @@ -1,7 +1,7 @@ " Vim syntax file -" Language: dictd(8) configuration file -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2006-04-19 +" Language: dictd(8) configuration file +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2006-04-19 if exists("b:current_syntax") finish diff --git a/runtime/syntax/elinks.vim b/runtime/syntax/elinks.vim index b4d9e02ef6..98252a24d3 100644 --- a/runtime/syntax/elinks.vim +++ b/runtime/syntax/elinks.vim @@ -1,7 +1,7 @@ " Vim syntax file -" Language: elinks(1) configuration file -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2007-06-17 +" Language: elinks(1) configuration file +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2007-06-17 if exists("b:current_syntax") finish diff --git a/runtime/syntax/erlang.vim b/runtime/syntax/erlang.vim index 11b763409b..870fcca106 100644 --- a/runtime/syntax/erlang.vim +++ b/runtime/syntax/erlang.vim @@ -1,9 +1,10 @@ " Vim syntax file " Language: Erlang (http://www.erlang.org) " Maintainer: Csaba Hoch <csaba.hoch@gmail.com> -" Last Update: 2013-Jul-25 +" Contributor: Adam Rutkowski <hq@mtod.org> +" Last Update: 2017-Mar-05 " License: Vim license -" URL: https://github.com/hcs42/vim-erlang +" URL: https://github.com/vim-erlang/vim-erlang-runtime " Acknowledgements: This script was originally created by Kresimir Marzic [1]. " The script was then revamped by Csaba Hoch [2]. During the revamp, the new @@ -46,7 +47,6 @@ syn match erlangComment '%.*$' contains=erlangCommentAnnotation,erlang syn match erlangCommentAnnotation ' \@<=@\%(clear\|docfile\|end\|headerfile\|todo\|TODO\|type\|author\|copyright\|doc\|reference\|see\|since\|title\|version\|deprecated\|hidden\|private\|equiv\|spec\|throws\)' contained syn match erlangCommentAnnotation /`[^']*'/ contained syn keyword erlangTodo TODO FIXME XXX contained -syn match erlangShebang '^#!.*' " Numbers (minimum base is 2, maximum is 36.) syn match erlangNumberInteger '\<\d\+\>' @@ -56,12 +56,12 @@ syn match erlangNumberFloat '\<\d\+\.\d\+\%([eE][+-]\=\d\+\)\=\>' " Strings, atoms, characters syn region erlangString start=/"/ end=/"/ contains=erlangStringModifier syn region erlangQuotedAtom start=/'/ end=/'/ contains=erlangQuotedAtomModifier -syn match erlangStringModifier '\~\a\|\\\%(\o\{1,3}\|x\x\x\|x{\x\+}\|\^.\|.\)' contained -syn match erlangQuotedAtomModifier '\~\a\|\\\%(\o\{1,3}\|x\x\x\|x{\x\+}\|\^.\|.\)' contained +syn match erlangStringModifier '\\\%(\o\{1,3}\|x\x\x\|x{\x\+}\|\^.\|.\)\|\~\%([ni~]\|\%(-\=\d\+\|\*\)\=\.\=\%(\*\|\d\+\)\=\%(\..\)\=[tl]*[cfegswpWPBX#bx+]\)' contained +syn match erlangQuotedAtomModifier '\\\%(\o\{1,3}\|x\x\x\|x{\x\+}\|\^.\|.\)' contained syn match erlangModifier '\$\%([^\\]\|\\\%(\o\{1,3}\|x\x\x\|x{\x\+}\|\^.\|.\)\)' " Operators, separators -syn match erlangOperator '==\|=:=\|/=\|=/=\|<\|=<\|>\|>=\|++\|--\|=\|!\|<-\|+\|-\|\*\|\/' +syn match erlangOperator '==\|=:=\|/=\|=/=\|<\|=<\|>\|>=\|=>\|:=\|++\|--\|=\|!\|<-\|+\|-\|\*\|\/' syn keyword erlangOperator div rem or xor bor bxor bsl bsr and band not bnot andalso orelse syn match erlangBracket '{\|}\|\[\|]\||\|||' syn match erlangPipe '|' @@ -72,14 +72,19 @@ syn match erlangAtom '\<\l[[:alnum:]_@]*' contains=erlangBoolean syn keyword erlangBoolean true false contained syn match erlangLocalFuncCall '\<\a[[:alnum:]_@]*\>\%(\%(\s\|\n\|%.*\n\)*(\)\@=' contains=erlangBIF syn match erlangLocalFuncRef '\<\a[[:alnum:]_@]*\>\%(\%(\s\|\n\|%.*\n\)*/\)\@=' -syn match erlangGlobalFuncCall '\<\%(\a[[:alnum:]_@]*\%(\s\|\n\|%.*\n\)*\.\%(\s\|\n\|%.*\n\)*\)*\a[[:alnum:]_@]*\%(\s\|\n\|%.*\n\)*:\%(\s\|\n\|%.*\n\)*\a[[:alnum:]_@]*\>\%(\%(\s\|\n\|%.*\n\)*(\)\@=' contains=erlangComment -syn match erlangGlobalFuncRef '\<\%(\a[[:alnum:]_@]*\%(\s\|\n\|%.*\n\)*\.\%(\s\|\n\|%.*\n\)*\)*\a[[:alnum:]_@]*\%(\s\|\n\|%.*\n\)*:\%(\s\|\n\|%.*\n\)*\a[[:alnum:]_@]*\>\%(\%(\s\|\n\|%.*\n\)*/\)\@=' contains=erlangComment +syn match erlangGlobalFuncCall '\<\%(\a[[:alnum:]_@]*\%(\s\|\n\|%.*\n\)*\.\%(\s\|\n\|%.*\n\)*\)*\a[[:alnum:]_@]*\%(\s\|\n\|%.*\n\)*:\%(\s\|\n\|%.*\n\)*\a[[:alnum:]_@]*\>\%(\%(\s\|\n\|%.*\n\)*(\)\@=' contains=erlangComment,erlangVariable +syn match erlangGlobalFuncRef '\<\%(\a[[:alnum:]_@]*\%(\s\|\n\|%.*\n\)*\.\%(\s\|\n\|%.*\n\)*\)*\a[[:alnum:]_@]*\%(\s\|\n\|%.*\n\)*:\%(\s\|\n\|%.*\n\)*\a[[:alnum:]_@]*\>\%(\%(\s\|\n\|%.*\n\)*/\)\@=' contains=erlangComment,erlangVariable -" Variables, macros, records +" Variables, macros, records, maps syn match erlangVariable '\<[A-Z_][[:alnum:]_@]*' syn match erlangMacro '??\=[[:alnum:]_@]\+' syn match erlangMacro '\%(-define(\)\@<=[[:alnum:]_@]\+' +syn match erlangMap '#' syn match erlangRecord '#\s*\l[[:alnum:]_@]*' +syn region erlangQuotedRecord start=/#\s*'/ end=/'/ contains=erlangQuotedAtomModifier + +" Shebang (this line has to be after the ErlangMap) +syn match erlangShebang '^#!.*' " Bitstrings syn match erlangBitType '\%(\/\%(\s\|\n\|%.*\n\)*\)\@<=\%(integer\|float\|binary\|bytes\|bitstring\|bits\|binary\|utf8\|utf16\|utf32\|signed\|unsigned\|big\|little\|native\|unit\)\%(\%(\s\|\n\|%.*\n\)*-\%(\s\|\n\|%.*\n\)*\%(integer\|float\|binary\|bytes\|bitstring\|bits\|binary\|utf8\|utf16\|utf32\|signed\|unsigned\|big\|little\|native\|unit\)\)*' contains=erlangComment @@ -94,7 +99,7 @@ syn match erlangPreCondit '^\s*-\%(\s\|\n\|%.*\n\)*\%(ifdef\|ifndef\|else\|endif syn match erlangType '^\s*-\%(\s\|\n\|%.*\n\)*\%(spec\|type\|opaque\|callback\)\>' contains=erlangComment " Keywords -syn keyword erlangKeyword after begin case catch cond end fun if let of query +syn keyword erlangKeyword after begin case catch cond end fun if let of syn keyword erlangKeyword receive when try " Build-in-functions (BIFs) @@ -142,7 +147,6 @@ let b:erlang_syntax_synced = 1 let s:old_style = (exists("g:erlang_old_style_highlight") && \g:erlang_old_style_highlight == 1) -" Only when an item doesn't have highlighting yet " Comments hi def link erlangComment Comment @@ -188,6 +192,8 @@ hi def link erlangGlobalFuncRef Function hi def link erlangVariable Normal hi def link erlangMacro Normal hi def link erlangRecord Normal +hi def link erlangQuotedRecord Normal +hi def link erlangMap Normal else hi def link erlangAtom String hi def link erlangLocalFuncCall Normal @@ -197,6 +203,8 @@ hi def link erlangGlobalFuncRef Normal hi def link erlangVariable Identifier hi def link erlangMacro Macro hi def link erlangRecord Structure +hi def link erlangQuotedRecord Structure +hi def link erlangMap Structure endif " Bitstrings diff --git a/runtime/syntax/eterm.vim b/runtime/syntax/eterm.vim index f6c50a20cb..9b43cb255f 100644 --- a/runtime/syntax/eterm.vim +++ b/runtime/syntax/eterm.vim @@ -1,7 +1,7 @@ " Vim syntax file -" Language: eterm(1) configuration file -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2006-04-21 +" Language: eterm(1) configuration file +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2006-04-21 if exists("b:current_syntax") finish diff --git a/runtime/syntax/fetchmail.vim b/runtime/syntax/fetchmail.vim index 89de1ff80d..7a421050d0 100644 --- a/runtime/syntax/fetchmail.vim +++ b/runtime/syntax/fetchmail.vim @@ -1,7 +1,7 @@ " Vim syntax file -" Language: fetchmail(1) RC File -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2006-04-19 +" Language: fetchmail(1) RC File +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2006-04-19 if exists("b:current_syntax") finish diff --git a/runtime/syntax/framescript.vim b/runtime/syntax/framescript.vim index 39d75e8826..8b16d048a0 100644 --- a/runtime/syntax/framescript.vim +++ b/runtime/syntax/framescript.vim @@ -1,7 +1,7 @@ " Vim syntax file -" Language: FrameScript v4.0 -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2007-02-22 +" Language: FrameScript v4.0 +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2007-02-22 if exists("b:current_syntax") finish diff --git a/runtime/syntax/gpg.vim b/runtime/syntax/gpg.vim index cde21ee563..46e2099994 100644 --- a/runtime/syntax/gpg.vim +++ b/runtime/syntax/gpg.vim @@ -1,7 +1,7 @@ " Vim syntax file -" Language: gpg(1) configuration file -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2010-10-14 +" Language: gpg(1) configuration file +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2010-10-14 if exists("b:current_syntax") finish diff --git a/runtime/syntax/group.vim b/runtime/syntax/group.vim index ab2d56d6a5..f62a4a1d69 100644 --- a/runtime/syntax/group.vim +++ b/runtime/syntax/group.vim @@ -1,7 +1,7 @@ " Vim syntax file -" Language: group(5) user group file -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2012-08-05 +" Language: group(5) user group file +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2012-08-05 if exists("b:current_syntax") finish diff --git a/runtime/syntax/grub.vim b/runtime/syntax/grub.vim index f63449db0e..3743ae3643 100644 --- a/runtime/syntax/grub.vim +++ b/runtime/syntax/grub.vim @@ -1,7 +1,7 @@ " Vim syntax file -" Language: grub(8) configuration file -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2006-04-19 +" Language: grub(8) configuration file +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2006-04-19 if exists("b:current_syntax") finish diff --git a/runtime/syntax/hostconf.vim b/runtime/syntax/hostconf.vim index 4fc8af0ba3..593ed72eed 100644 --- a/runtime/syntax/hostconf.vim +++ b/runtime/syntax/hostconf.vim @@ -1,7 +1,7 @@ " Vim syntax file -" Language: host.conf(5) configuration file -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2007-06-25 +" Language: host.conf(5) configuration file +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2007-06-25 if exists("b:current_syntax") finish diff --git a/runtime/syntax/indent.vim b/runtime/syntax/indent.vim index 389101a522..ddeae67e0d 100644 --- a/runtime/syntax/indent.vim +++ b/runtime/syntax/indent.vim @@ -1,10 +1,10 @@ " Vim syntax file -" Language: indent(1) configuration file -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2010-01-23 -" indent_is_bsd: If exists, will change somewhat to match BSD implementation +" Language: indent(1) configuration file +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2010-01-23 +" indent_is_bsd: If exists, will change somewhat to match BSD implementation " -" TODO: is the deny-all (a la lilo.vim nice or no?)... +" TODO: is the deny-all (a la lilo.vim nice or no?)... " irritating to be wrong to the last char... " would be sweet if right until one char fails diff --git a/runtime/syntax/initex.vim b/runtime/syntax/initex.vim index 8f3462f5cf..564a6e0cca 100644 --- a/runtime/syntax/initex.vim +++ b/runtime/syntax/initex.vim @@ -1,7 +1,7 @@ " Vim syntax file -" Language: TeX (core definition) -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2006-04-19 +" Language: TeX (core definition) +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2006-04-19 if exists("b:current_syntax") finish @@ -11,7 +11,7 @@ let s:cpo_save = &cpo set cpo&vim " This follows the grouping (sort of) found at -" http://www.tug.org/utilities/plain/cseq.html#top-fam +" http: //www.tug.org/utilities/plain/cseq.html#top-fam syn keyword initexTodo TODO FIXME XXX NOTE diff --git a/runtime/syntax/ld.vim b/runtime/syntax/ld.vim index fc12919c50..22949d9759 100644 --- a/runtime/syntax/ld.vim +++ b/runtime/syntax/ld.vim @@ -1,7 +1,7 @@ " Vim syntax file -" Language: ld(1) script -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2006-04-19 +" Language: ld(1) script +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2006-04-19 if exists("b:current_syntax") finish diff --git a/runtime/syntax/ldapconf.vim b/runtime/syntax/ldapconf.vim index 70ddaab57a..662ea203be 100644 --- a/runtime/syntax/ldapconf.vim +++ b/runtime/syntax/ldapconf.vim @@ -1,7 +1,7 @@ " Vim syntax file -" Language: ldap.conf(5) configuration file. -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2006-12-11 +" Language: ldap.conf(5) configuration file. +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2006-12-11 if exists("b:current_syntax") finish diff --git a/runtime/syntax/lftp.vim b/runtime/syntax/lftp.vim index 6a8e4f9e19..20ddee5bcb 100644 --- a/runtime/syntax/lftp.vim +++ b/runtime/syntax/lftp.vim @@ -1,7 +1,7 @@ " Vim syntax file -" Language: lftp(1) configuration file -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2007-06-17 +" Language: lftp(1) configuration file +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2007-06-17 if exists("b:current_syntax") finish diff --git a/runtime/syntax/libao.vim b/runtime/syntax/libao.vim index 25b6e8284e..1a3bd90cc5 100644 --- a/runtime/syntax/libao.vim +++ b/runtime/syntax/libao.vim @@ -1,7 +1,7 @@ " Vim syntax file -" Language: libao.conf(5) configuration file -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2006-04-19 +" Language: libao.conf(5) configuration file +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2006-04-19 if exists("b:current_syntax") finish diff --git a/runtime/syntax/limits.vim b/runtime/syntax/limits.vim index a6d245ae11..96bd423869 100644 --- a/runtime/syntax/limits.vim +++ b/runtime/syntax/limits.vim @@ -1,7 +1,7 @@ " Vim syntax file -" Language: limits(5) configuration file -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2006-04-19 +" Language: limits(5) configuration file +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2006-04-19 if exists("b:current_syntax") finish diff --git a/runtime/syntax/litestep.vim b/runtime/syntax/litestep.vim index b4c15faf65..e3d967f010 100644 --- a/runtime/syntax/litestep.vim +++ b/runtime/syntax/litestep.vim @@ -1,7 +1,7 @@ " Vim syntax file -" Language: LiteStep RC file -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2007-02-22 +" Language: LiteStep RC file +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2007-02-22 if exists("b:current_syntax") finish diff --git a/runtime/syntax/loginaccess.vim b/runtime/syntax/loginaccess.vim index 07d60eeca0..650e067d18 100644 --- a/runtime/syntax/loginaccess.vim +++ b/runtime/syntax/loginaccess.vim @@ -1,7 +1,7 @@ " Vim syntax file -" Language: login.access(5) configuration file -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2006-04-19 +" Language: login.access(5) configuration file +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2006-04-19 if exists("b:current_syntax") finish diff --git a/runtime/syntax/logindefs.vim b/runtime/syntax/logindefs.vim index 59d18e7ef4..8cb4295eda 100644 --- a/runtime/syntax/logindefs.vim +++ b/runtime/syntax/logindefs.vim @@ -1,7 +1,7 @@ " Vim syntax file -" Language: login.defs(5) configuration file -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2010-11-29 +" Language: login.defs(5) configuration file +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2010-11-29 if exists("b:current_syntax") finish diff --git a/runtime/syntax/mailaliases.vim b/runtime/syntax/mailaliases.vim index 743068f66f..a5282aa074 100644 --- a/runtime/syntax/mailaliases.vim +++ b/runtime/syntax/mailaliases.vim @@ -1,7 +1,7 @@ " Vim syntax file -" Language: aliases(5) local alias database file -" Maintainer: Nikolai Weibull <nikolai@bitwi.se> -" Latest Revision: 2008-04-14 +" Language: aliases(5) local alias database file +" Previous Maintainer: Nikolai Weibull <nikolai@bitwi.se> +" Latest Revision: 2008-04-14 if exists("b:current_syntax") finish diff --git a/runtime/syntax/manconf.vim b/runtime/syntax/manconf.vim index 90ecc8ec17..2c17568d87 100644 --- a/runtime/syntax/manconf.vim +++ b/runtime/syntax/manconf.vim @@ -1,7 +1,7 @@ " Vim syntax file -" Language: man.conf(5) - man configuration file -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2006-04-19 +" Language: man.conf(5) - man configuration file +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2006-04-19 if exists("b:current_syntax") finish diff --git a/runtime/syntax/modconf.vim b/runtime/syntax/modconf.vim index 54b6593b66..76b36edcf0 100644 --- a/runtime/syntax/modconf.vim +++ b/runtime/syntax/modconf.vim @@ -1,7 +1,7 @@ " Vim syntax file -" Language: modules.conf(5) configuration file -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2007-10-25 +" Language: modules.conf(5) configuration file +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2007-10-25 if exists("b:current_syntax") finish diff --git a/runtime/syntax/nanorc.vim b/runtime/syntax/nanorc.vim index 2ae4961fdb..606ac7fdf1 100644 --- a/runtime/syntax/nanorc.vim +++ b/runtime/syntax/nanorc.vim @@ -1,7 +1,7 @@ " Vim syntax file -" Language: nanorc(5) - GNU nano configuration file -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2006-04-19 +" Language: nanorc(5) - GNU nano configuration file +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2006-04-19 if exists("b:current_syntax") finish diff --git a/runtime/syntax/netrc.vim b/runtime/syntax/netrc.vim index 9f15d16637..4d068a1b76 100644 --- a/runtime/syntax/netrc.vim +++ b/runtime/syntax/netrc.vim @@ -1,7 +1,7 @@ " Vim syntax file -" Language: netrc(5) configuration file -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2010-01-03 +" Language: netrc(5) configuration file +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2010-01-03 if exists("b:current_syntax") finish diff --git a/runtime/syntax/pamconf.vim b/runtime/syntax/pamconf.vim index e3c8ba87fd..10d667bdf5 100644 --- a/runtime/syntax/pamconf.vim +++ b/runtime/syntax/pamconf.vim @@ -1,7 +1,7 @@ " Vim syntax file -" Language: pam(8) configuration file -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2011-08-03 +" Language: pam(8) configuration file +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2011-08-03 if exists("b:current_syntax") diff --git a/runtime/syntax/passwd.vim b/runtime/syntax/passwd.vim index cdaed58cc0..ad90202b06 100644 --- a/runtime/syntax/passwd.vim +++ b/runtime/syntax/passwd.vim @@ -1,7 +1,7 @@ " Vim syntax file -" Language: passwd(5) password file -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2006-10-03 +" Language: passwd(5) password file +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2006-10-03 if exists("b:current_syntax") finish diff --git a/runtime/syntax/pinfo.vim b/runtime/syntax/pinfo.vim index bf4126e59a..cb9e60ebb3 100644 --- a/runtime/syntax/pinfo.vim +++ b/runtime/syntax/pinfo.vim @@ -1,7 +1,7 @@ " Vim syntax file -" Language: pinfo(1) configuration file -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2007-06-17 +" Language: pinfo(1) configuration file +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2007-06-17 if exists("b:current_syntax") finish diff --git a/runtime/syntax/plaintex.vim b/runtime/syntax/plaintex.vim index 7020c68e9b..5cb49a0bfc 100644 --- a/runtime/syntax/plaintex.vim +++ b/runtime/syntax/plaintex.vim @@ -1,7 +1,7 @@ " Vim syntax file -" Language: TeX (plain.tex format) -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2006-10-26 +" Language: TeX (plain.tex format) +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2006-10-26 if exists("b:current_syntax") finish diff --git a/runtime/syntax/protocols.vim b/runtime/syntax/protocols.vim index 1dc109caf6..f31ca5a4b7 100644 --- a/runtime/syntax/protocols.vim +++ b/runtime/syntax/protocols.vim @@ -1,7 +1,7 @@ " Vim syntax file -" Language: protocols(5) - Internet protocols definition file -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2006-04-19 +" Language: protocols(5) - Internet protocols definition file +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2006-04-19 if exists("b:current_syntax") finish diff --git a/runtime/syntax/quake.vim b/runtime/syntax/quake.vim index 3a9b68d6f3..7db53106ad 100644 --- a/runtime/syntax/quake.vim +++ b/runtime/syntax/quake.vim @@ -1,11 +1,11 @@ " Vim syntax file -" Language: Quake[1-3] configuration file -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2007-06-17 +" Language: Quake[1-3] configuration file +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2007-06-17 " quake_is_quake1 - the syntax is to be used for quake1 configs " quake_is_quake2 - the syntax is to be used for quake2 configs " quake_is_quake3 - the syntax is to be used for quake3 configs -" Credits: Tomasz Kalkosinski wrote the original quake3Colors stuff +" Credits: Tomasz Kalkosinski wrote the original quake3Colors stuff if exists("b:current_syntax") finish diff --git a/runtime/syntax/racc.vim b/runtime/syntax/racc.vim index d412227cbd..2d4c176eb7 100644 --- a/runtime/syntax/racc.vim +++ b/runtime/syntax/racc.vim @@ -1,7 +1,7 @@ " Vim default file -" Language: Racc input file -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2008-06-22 +" Language: Racc input file +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2008-06-22 if exists("b:current_syntax") finish diff --git a/runtime/syntax/readline.vim b/runtime/syntax/readline.vim index 091722e5e5..2ec0c8e60a 100644 --- a/runtime/syntax/readline.vim +++ b/runtime/syntax/readline.vim @@ -1,7 +1,7 @@ " Vim syntax file -" Language: readline(3) configuration file -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2012-04-25 +" Language: readline(3) configuration file +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2012-04-25 " readline_has_bash - if defined add support for bash specific " settings/functions diff --git a/runtime/syntax/rnc.vim b/runtime/syntax/rnc.vim index 8436c88755..7d3907e991 100644 --- a/runtime/syntax/rnc.vim +++ b/runtime/syntax/rnc.vim @@ -1,7 +1,7 @@ " Vim syntax file -" Language: Relax NG compact syntax -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2007-06-17 +" Language: Relax NG compact syntax +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2007-06-17 if exists("b:current_syntax") finish diff --git a/runtime/syntax/scala.vim b/runtime/syntax/scala.vim index 7779c43996..c5a175fd77 100644 --- a/runtime/syntax/scala.vim +++ b/runtime/syntax/scala.vim @@ -71,6 +71,8 @@ hi link scalaUnicodeChar Special syn match scalaOperator "||" syn match scalaOperator "&&" +syn match scalaOperator "|" +syn match scalaOperator "&" hi link scalaOperator Special syn match scalaNameDefinition /\<[_A-Za-z0-9$]\+\>/ contained nextgroup=scalaPostNameDefinition,scalaVariableDeclarationList @@ -142,7 +144,7 @@ hi link scalaString String hi link scalaStringEmbeddedQuote String syn region scalaIString matchgroup=scalaInterpolationBrackets start=/\<[a-zA-Z][a-zA-Z0-9_]*"/ skip=/\\"/ end=/"/ contains=scalaInterpolation,scalaInterpolationB,scalaEscapedChar,scalaUnicodeChar -syn region scalaTripleIString matchgroup=scalaInterpolationBrackets start=/\<[a-zA-Z][a-zA-Z0-9_]*"""/ end=/"""\%([^"]\|$\)/ contains=scalaInterpolation,scalaInterpolationB,scalaEscapedChar,scalaUnicodeChar +syn region scalaTripleIString matchgroup=scalaInterpolationBrackets start=/\<[a-zA-Z][a-zA-Z0-9_]*"""/ end=/"""\ze\%([^"]\|$\)/ contains=scalaInterpolation,scalaInterpolationB,scalaEscapedChar,scalaUnicodeChar hi link scalaIString String hi link scalaTripleIString String diff --git a/runtime/syntax/sensors.vim b/runtime/syntax/sensors.vim index 63cececc68..f8bc4c696b 100644 --- a/runtime/syntax/sensors.vim +++ b/runtime/syntax/sensors.vim @@ -1,7 +1,7 @@ " Vim syntax file -" Language: sensors.conf(5) - libsensors configuration file -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2006-04-19 +" Language: sensors.conf(5) - libsensors configuration file +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2006-04-19 if exists("b:current_syntax") finish diff --git a/runtime/syntax/services.vim b/runtime/syntax/services.vim index 661f57a7e8..94e39ae219 100644 --- a/runtime/syntax/services.vim +++ b/runtime/syntax/services.vim @@ -1,7 +1,7 @@ " Vim syntax file -" Language: services(5) - Internet network services list -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2006-04-19 +" Language: services(5) - Internet network services list +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2006-04-19 if exists("b:current_syntax") finish diff --git a/runtime/syntax/setserial.vim b/runtime/syntax/setserial.vim index cdd309d7f2..967fa5f6d2 100644 --- a/runtime/syntax/setserial.vim +++ b/runtime/syntax/setserial.vim @@ -1,7 +1,7 @@ " Vim syntax file -" Language: setserial(8) configuration file -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2006-04-19 +" Language: setserial(8) configuration file +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2006-04-19 if exists("b:current_syntax") finish diff --git a/runtime/syntax/sieve.vim b/runtime/syntax/sieve.vim index 4bb4417f39..35b4dfb79c 100644 --- a/runtime/syntax/sieve.vim +++ b/runtime/syntax/sieve.vim @@ -1,7 +1,7 @@ " Vim syntax file -" Language: Sieve filtering language input file -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2007-10-25 +" Language: Sieve filtering language input file +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2007-10-25 if exists("b:current_syntax") finish diff --git a/runtime/syntax/slpconf.vim b/runtime/syntax/slpconf.vim index 9fe4503780..712ba90719 100644 --- a/runtime/syntax/slpconf.vim +++ b/runtime/syntax/slpconf.vim @@ -1,7 +1,7 @@ " Vim syntax file -" Language: RFC 2614 - An API for Service Location configuration file -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2006-04-19 +" Language: RFC 2614 - An API for Service Location configuration file +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2006-04-19 if exists("b:current_syntax") finish diff --git a/runtime/syntax/slpreg.vim b/runtime/syntax/slpreg.vim index f3c8a7fc8e..a177b063f0 100644 --- a/runtime/syntax/slpreg.vim +++ b/runtime/syntax/slpreg.vim @@ -1,7 +1,7 @@ " Vim syntax file -" Language: RFC 2614 - An API for Service Location registration file -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2006-04-19 +" Language: RFC 2614 - An API for Service Location registration file +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2006-04-19 if exists("b:current_syntax") finish diff --git a/runtime/syntax/slpspi.vim b/runtime/syntax/slpspi.vim index 8507e3de69..eaeb02a80f 100644 --- a/runtime/syntax/slpspi.vim +++ b/runtime/syntax/slpspi.vim @@ -1,7 +1,7 @@ " Vim syntax file -" Language: RFC 2614 - An API for Service Location SPI file -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2006-04-19 +" Language: RFC 2614 - An API for Service Location SPI file +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2006-04-19 if exists("b:current_syntax") finish diff --git a/runtime/syntax/sudoers.vim b/runtime/syntax/sudoers.vim index fffc1cf8bb..df1eb99b42 100644 --- a/runtime/syntax/sudoers.vim +++ b/runtime/syntax/sudoers.vim @@ -1,7 +1,7 @@ " Vim syntax file -" Language: sudoers(5) configuration files -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2011-02-24 +" Language: sudoers(5) configuration files +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2011-02-24 if exists("b:current_syntax") finish diff --git a/runtime/syntax/sysctl.vim b/runtime/syntax/sysctl.vim index 748054fd73..d99ac01835 100644 --- a/runtime/syntax/sysctl.vim +++ b/runtime/syntax/sysctl.vim @@ -1,7 +1,7 @@ " Vim syntax file -" Language: sysctl.conf(5) configuration file -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2011-05-02 +" Language: sysctl.conf(5) configuration file +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2011-05-02 if exists("b:current_syntax") finish diff --git a/runtime/syntax/terminfo.vim b/runtime/syntax/terminfo.vim index 0ea112ad47..2b0ab0860a 100644 --- a/runtime/syntax/terminfo.vim +++ b/runtime/syntax/terminfo.vim @@ -1,7 +1,7 @@ " Vim syntax file -" Language: terminfo(5) definition -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2006-04-19 +" Language: terminfo(5) definition +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2006-04-19 if exists("b:current_syntax") finish diff --git a/runtime/syntax/tmux.vim b/runtime/syntax/tmux.vim new file mode 100644 index 0000000000..1ba5f67736 --- /dev/null +++ b/runtime/syntax/tmux.vim @@ -0,0 +1,124 @@ +" Language: tmux(1) configuration file +" Version: 2.3 (git-14dc2ac) +" URL: https://github.com/ericpruitt/tmux.vim/ +" Maintainer: Eric Pruitt <eric.pruitt@gmail.com> +" License: 2-Clause BSD (http://opensource.org/licenses/BSD-2-Clause) + +if exists("b:current_syntax") + finish +endif + +" Explicitly change compatiblity options to Vim's defaults because this file +" uses line continuations. +let s:original_cpo = &cpo +set cpo&vim + +let b:current_syntax = "tmux" +setlocal iskeyword+=- +syntax case match + +syn keyword tmuxAction none any current other +syn keyword tmuxBoolean off on + +syn keyword tmuxTodo FIXME NOTE TODO XXX contained + +syn match tmuxColour /\<colour[0-9]\+/ display +syn match tmuxKey /\(C-\|M-\|\^\)\+\S\+/ display +syn match tmuxNumber /\d\+/ display +syn match tmuxFlags /\s-\a\+/ display +syn match tmuxVariable /\w\+=/ display +syn match tmuxVariableExpansion /\${\=\w\+}\=/ display + +syn region tmuxComment start=/#/ skip=/\\\@<!\\$/ end=/$/ contains=tmuxTodo + +syn region tmuxString start=+"+ skip=+\\\\\|\\"\|\\$+ excludenl end=+"+ end='$' contains=tmuxFormatString +syn region tmuxString start=+'+ skip=+\\\\\|\\'\|\\$+ excludenl end=+'+ end='$' contains=tmuxFormatString + +" TODO: Figure out how escaping works inside of #(...) and #{...} blocks. +syn region tmuxFormatString start=/#[#DFhHIPSTW]/ end=// contained keepend +syn region tmuxFormatString start=/#{/ skip=/#{.\{-}}/ end=/}/ contained keepend +syn region tmuxFormatString start=/#(/ skip=/#(.\{-})/ end=/)/ contained keepend + +hi def link tmuxFormatString Identifier +hi def link tmuxAction Boolean +hi def link tmuxBoolean Boolean +hi def link tmuxCommands Keyword +hi def link tmuxComment Comment +hi def link tmuxKey Special +hi def link tmuxNumber Number +hi def link tmuxFlags Identifier +hi def link tmuxOptions Function +hi def link tmuxString String +hi def link tmuxTodo Todo +hi def link tmuxVariable Identifier +hi def link tmuxVariableExpansion Identifier + +" Make the foreground of colourXXX keywords match the color they represent. +" Darker colors have their background set to white. +for s:i in range(0, 255) + let s:bg = (!s:i || s:i == 16 || (s:i > 231 && s:i < 235)) ? 15 : "none" + exec "syn match tmuxColour" . s:i . " /\\<colour" . s:i . "\\>/ display" +\ " | highlight tmuxColour" . s:i . " ctermfg=" . s:i . " ctermbg=" . s:bg +endfor + +syn keyword tmuxOptions +\ buffer-limit command-alias default-terminal escape-time exit-unattached +\ focus-events history-file message-limit set-clipboard terminal-overrides +\ assume-paste-time base-index bell-action bell-on-alert default-command +\ default-shell destroy-unattached detach-on-destroy +\ display-panes-active-colour display-panes-colour display-panes-time +\ display-time history-limit key-table lock-after-time lock-command +\ message-attr message-bg message-command-attr message-command-bg +\ message-command-fg message-command-style message-fg message-style mouse +\ prefix prefix2 renumber-windows repeat-time set-titles set-titles-string +\ status status-attr status-bg status-fg status-interval status-justify +\ status-keys status-left status-left-attr status-left-bg status-left-fg +\ status-left-length status-left-style status-position status-right +\ status-right-attr status-right-bg status-right-fg status-right-length +\ status-right-style status-style update-environment visual-activity +\ visual-bell visual-silence word-separators aggressive-resize allow-rename +\ alternate-screen automatic-rename automatic-rename-format +\ clock-mode-colour clock-mode-style force-height force-width +\ main-pane-height main-pane-width mode-attr mode-bg mode-fg mode-keys +\ mode-style monitor-activity monitor-silence other-pane-height +\ other-pane-width pane-active-border-bg pane-active-border-fg +\ pane-active-border-style pane-base-index pane-border-bg pane-border-fg +\ pane-border-format pane-border-status pane-border-style remain-on-exit +\ synchronize-panes window-active-style window-style +\ window-status-activity-attr window-status-activity-bg +\ window-status-activity-fg window-status-activity-style window-status-attr +\ window-status-bell-attr window-status-bell-bg window-status-bell-fg +\ window-status-bell-style window-status-bg window-status-current-attr +\ window-status-current-bg window-status-current-fg +\ window-status-current-format window-status-current-style window-status-fg +\ window-status-format window-status-last-attr window-status-last-bg +\ window-status-last-fg window-status-last-style window-status-separator +\ window-status-style wrap-search xterm-keys + +syn keyword tmuxCommands +\ attach-session attach bind-key bind break-pane breakp capture-pane +\ capturep clear-history clearhist choose-buffer choose-client choose-tree +\ choose-session choose-window command-prompt confirm-before confirm +\ copy-mode clock-mode detach-client detach suspend-client suspendc +\ display-message display display-panes displayp find-window findw if-shell +\ if join-pane joinp move-pane movep kill-pane killp kill-server +\ start-server start kill-session kill-window killw unlink-window unlinkw +\ list-buffers lsb list-clients lsc list-keys lsk list-commands lscm +\ list-panes lsp list-sessions ls list-windows lsw load-buffer loadb +\ lock-server lock lock-session locks lock-client lockc move-window movew +\ link-window linkw new-session new has-session has new-window neww +\ paste-buffer pasteb pipe-pane pipep refresh-client refresh rename-session +\ rename rename-window renamew resize-pane resizep respawn-pane respawnp +\ respawn-window respawnw rotate-window rotatew run-shell run save-buffer +\ saveb show-buffer showb select-layout selectl next-layout nextl +\ previous-layout prevl select-pane selectp last-pane lastp select-window +\ selectw next-window next previous-window prev last-window last send-keys +\ send send-prefix set-buffer setb delete-buffer deleteb set-environment +\ setenv set-hook show-hooks set-option set set-window-option setw +\ show-environment showenv show-messages showmsgs show-options show +\ show-window-options showw source-file source split-window splitw swap-pane +\ swapp swap-window swapw switch-client switchc unbind-key unbind wait-for +\ wait + +let &cpo = s:original_cpo +unlet! s:original_cpo s:bg s:i diff --git a/runtime/syntax/treetop.vim b/runtime/syntax/treetop.vim index 921c5bea1d..60bbf26193 100644 --- a/runtime/syntax/treetop.vim +++ b/runtime/syntax/treetop.vim @@ -1,7 +1,7 @@ " Vim syntax file -" Language: Treetop -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2011-03-14 +" Language: Treetop +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2011-03-14 if exists("b:current_syntax") finish diff --git a/runtime/syntax/udevconf.vim b/runtime/syntax/udevconf.vim index a294604906..82fd81daf6 100644 --- a/runtime/syntax/udevconf.vim +++ b/runtime/syntax/udevconf.vim @@ -1,7 +1,7 @@ " Vim syntax file -" Language: udev(8) configuration file -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2006-04-19 +" Language: udev(8) configuration file +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2006-04-19 if exists("b:current_syntax") finish diff --git a/runtime/syntax/udevperm.vim b/runtime/syntax/udevperm.vim index 9d3af09d07..abda0b6663 100644 --- a/runtime/syntax/udevperm.vim +++ b/runtime/syntax/udevperm.vim @@ -1,7 +1,7 @@ " Vim syntax file -" Language: udev(8) permissions file -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2006-04-19 +" Language: udev(8) permissions file +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2006-04-19 if exists("b:current_syntax") finish diff --git a/runtime/syntax/udevrules.vim b/runtime/syntax/udevrules.vim index b04d728865..ce156ccc13 100644 --- a/runtime/syntax/udevrules.vim +++ b/runtime/syntax/udevrules.vim @@ -1,7 +1,7 @@ " Vim syntax file -" Language: udev(8) rules file -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2006-12-18 +" Language: udev(8) rules file +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2006-12-18 if exists("b:current_syntax") finish diff --git a/runtime/syntax/updatedb.vim b/runtime/syntax/updatedb.vim index 7c082d62df..224a7dd2c2 100644 --- a/runtime/syntax/updatedb.vim +++ b/runtime/syntax/updatedb.vim @@ -1,7 +1,7 @@ " Vim syntax file -" Language: updatedb.conf(5) configuration file -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2009-05-25 +" Language: updatedb.conf(5) configuration file +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2009-05-25 if exists("b:current_syntax") finish diff --git a/runtime/syntax/xinetd.vim b/runtime/syntax/xinetd.vim index 9010a48a1d..fab3a916ea 100644 --- a/runtime/syntax/xinetd.vim +++ b/runtime/syntax/xinetd.vim @@ -1,7 +1,7 @@ " Vim syntax file -" Language: xinetd.conf(5) configuration file -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2006-04-19 +" Language: xinetd.conf(5) configuration file +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2006-04-19 if exists("b:current_syntax") finish diff --git a/runtime/syntax/xmodmap.vim b/runtime/syntax/xmodmap.vim index 69c70c563d..28cae3eb71 100644 --- a/runtime/syntax/xmodmap.vim +++ b/runtime/syntax/xmodmap.vim @@ -1,7 +1,7 @@ " Vim syntax file -" Language: xmodmap(1) definition file -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2006-04-19 +" Language: xmodmap(1) definition file +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2006-04-19 if exists("b:current_syntax") finish diff --git a/scripts/gen_api_vimdoc.py b/scripts/gen_api_vimdoc.py index 4dcb42d685..51e585a007 100644 --- a/scripts/gen_api_vimdoc.py +++ b/scripts/gen_api_vimdoc.py @@ -38,6 +38,10 @@ import subprocess from xml.dom import minidom +if sys.version_info[0] < 3: + print("use Python 3") + sys.exit(1) + doc_filename = 'api.txt' # String used to find the start of the generated part of the doc. section_start_token = '*api-global*' @@ -69,7 +73,7 @@ text_width = 78 script_path = os.path.abspath(__file__) base_dir = os.path.dirname(os.path.dirname(script_path)) src_dir = os.path.join(base_dir, 'src/nvim/api') -out_dir = os.path.join(base_dir, 'tmp/api_doc') +out_dir = os.path.join(base_dir, 'tmp-api-doc') filter_cmd = '%s %s' % (sys.executable, script_path) seen_funcs = set() @@ -217,7 +221,12 @@ def parse_para(parent, width=62): width=width) + '\n') elif child.nodeName == 'simplesect': kind = child.getAttribute('kind') - if kind == 'return': + if kind == 'note': + lines.append('Note:') + lines.append(doc_wrap(parse_para(child), + prefix=' ', + width=width)) + elif kind == 'return': lines.append('%s:~' % kind.title()) lines.append(doc_wrap(parse_para(child), prefix=' ', @@ -280,14 +289,19 @@ def parse_source_xml(filename): parts = return_type.strip('_').split('_') return_type = '%s(%s)' % (parts[0], ', '.join(parts[1:])) + name = get_text(get_child(member, 'name')) + annotations = get_text(get_child(member, 'argsstring')) if annotations and ')' in annotations: annotations = annotations.rsplit(')', 1)[-1].strip() + # XXX: (doxygen 1.8.11) 'argsstring' only includes FUNC_ATTR_* + # attributes if the function signature is non-void. + # Force attributes here for such functions. + if name == 'nvim_get_mode' and len(annotations) == 0: + annotations += 'FUNC_API_ASYNC' annotations = filter(None, map(lambda x: annotation_map.get(x), annotations.split())) - name = get_text(get_child(member, 'name')) - vimtag = '*%s()*' % name args = [] type_length = 0 diff --git a/src/nvim/api/buffer.c b/src/nvim/api/buffer.c index c381e92dc7..4b6a88e5fa 100644 --- a/src/nvim/api/buffer.c +++ b/src/nvim/api/buffer.c @@ -439,6 +439,7 @@ Object nvim_buf_get_var(Buffer buffer, String name, Error *err) /// Gets a changed tick of a buffer /// /// @param[in] buffer Buffer handle. +/// @param[out] err Error details, if any /// /// @return `b:changedtick` value. Integer nvim_buf_get_changedtick(Buffer buffer, Error *err) @@ -453,14 +454,14 @@ Integer nvim_buf_get_changedtick(Buffer buffer, Error *err) return buf->b_changedtick; } -/// Get a list of dictionaries describing buffer-local mappings -/// Note that the buffer key in the dictionary will represent the buffer -/// handle where the mapping is present +/// Gets a list of dictionaries describing buffer-local mappings. +/// The "buffer" key in the returned dictionary reflects the buffer +/// handle where the mapping is present. /// -/// @param mode The abbreviation for the mode -/// @param buffer_id Buffer handle +/// @param mode Mode short-name ("n", "i", "v", ...) +/// @param buffer Buffer handle /// @param[out] err Error details, if any -/// @returns An array of maparg() like dictionaries describing mappings +/// @returns Array of maparg()-like dictionaries describing mappings ArrayOf(Dictionary) nvim_buf_get_keymap(Buffer buffer, String mode, Error *err) FUNC_API_SINCE(3) { @@ -739,29 +740,29 @@ ArrayOf(Integer, 2) nvim_buf_get_mark(Buffer buffer, String name, Error *err) /// Adds a highlight to buffer. /// -/// This can be used for plugins which dynamically generate highlights to a -/// buffer (like a semantic highlighter or linter). The function adds a single +/// Useful for plugins that dynamically generate highlights to a buffer +/// (like a semantic highlighter or linter). The function adds a single /// highlight to a buffer. Unlike matchaddpos() highlights follow changes to /// line numbering (as lines are inserted/removed above the highlighted line), /// like signs and marks do. /// -/// "src_id" is useful for batch deletion/updating of a set of highlights. When -/// called with src_id = 0, an unique source id is generated and returned. -/// Succesive calls can pass in it as "src_id" to add new highlights to the same -/// source group. All highlights in the same group can then be cleared with -/// nvim_buf_clear_highlight. If the highlight never will be manually deleted -/// pass in -1 for "src_id". +/// `src_id` is useful for batch deletion/updating of a set of highlights. When +/// called with `src_id = 0`, an unique source id is generated and returned. +/// Successive calls can pass that `src_id` to associate new highlights with +/// the same source group. All highlights in the same group can be cleared +/// with `nvim_buf_clear_highlight`. If the highlight never will be manually +/// deleted, pass `src_id = -1`. /// -/// If "hl_group" is the empty string no highlight is added, but a new src_id +/// If `hl_group` is the empty string no highlight is added, but a new `src_id` /// is still returned. This is useful for an external plugin to synchrounously -/// request an unique src_id at initialization, and later asynchronously add and -/// clear highlights in response to buffer changes. +/// request an unique `src_id` at initialization, and later asynchronously add +/// and clear highlights in response to buffer changes. /// /// @param buffer Buffer handle /// @param src_id Source group to use or 0 to use a new group, /// or -1 for ungrouped highlight /// @param hl_group Name of the highlight group to use -/// @param line Line to highlight +/// @param line Line to highlight (zero-indexed) /// @param col_start Start of range of columns to highlight /// @param col_end End of range of columns to highlight, /// or -1 to highlight to end of line diff --git a/src/nvim/api/ui_events.in.h b/src/nvim/api/ui_events.in.h index 65357d008a..847b21072a 100644 --- a/src/nvim/api/ui_events.in.h +++ b/src/nvim/api/ui_events.in.h @@ -65,6 +65,7 @@ void popupmenu_hide(void) FUNC_API_SINCE(3) FUNC_API_REMOTE_ONLY; void popupmenu_select(Integer selected) FUNC_API_SINCE(3) FUNC_API_REMOTE_ONLY; + void tabline_update(Tabpage current, Array tabs) FUNC_API_SINCE(3) FUNC_API_REMOTE_ONLY; @@ -84,4 +85,10 @@ void cmdline_block_append(Array lines) void cmdline_block_hide(void) FUNC_API_SINCE(3) FUNC_API_REMOTE_ONLY; +void wildmenu_show(Array items) + FUNC_API_SINCE(3) FUNC_API_REMOTE_ONLY; +void wildmenu_select(Integer selected) + FUNC_API_SINCE(3) FUNC_API_REMOTE_ONLY; +void wildmenu_hide(void) + FUNC_API_SINCE(3) FUNC_API_REMOTE_ONLY; #endif // NVIM_API_UI_EVENTS_IN_H diff --git a/src/nvim/api/vim.c b/src/nvim/api/vim.c index 8de37e2cf3..0596c3ebd8 100644 --- a/src/nvim/api/vim.c +++ b/src/nvim/api/vim.c @@ -168,7 +168,10 @@ void nvim_feedkeys(String keys, String mode, Boolean escape_csi) /// On VimL error: Does not fail, but updates v:errmsg. /// /// Unlike `nvim_feedkeys`, this uses a lower-level input buffer and the call -/// is not deferred. This is the most reliable way to emulate real user input. +/// is not deferred. This is the most reliable way to send real user input. +/// +/// @note |keycodes| like <CR> are translated, so "<" is special. +/// To input a literal "<", send <LT>. /// /// @param keys to be typed /// @return Number of bytes actually written (can be fewer than @@ -322,15 +325,15 @@ Object nvim_execute_lua(String code, Array args, Error *err) /// @param text Some text /// @param[out] err Error details, if any /// @return Number of cells -Integer nvim_strwidth(String str, Error *err) +Integer nvim_strwidth(String text, Error *err) FUNC_API_SINCE(1) { - if (str.size > INT_MAX) { + if (text.size > INT_MAX) { api_set_error(err, kErrorTypeValidation, "String length is too high"); return 0; } - return (Integer) mb_string2cells((char_u *) str.data); + return (Integer)mb_string2cells((char_u *)text.data); } /// Gets the paths contained in 'runtimepath'. @@ -580,7 +583,7 @@ Buffer nvim_get_current_buf(void) /// Sets the current buffer /// -/// @param id Buffer handle +/// @param buffer Buffer handle /// @param[out] err Error details, if any void nvim_set_current_buf(Buffer buffer, Error *err) FUNC_API_SINCE(1) @@ -634,7 +637,7 @@ Window nvim_get_current_win(void) /// Sets the current window /// -/// @param handle Window handle +/// @param window Window handle void nvim_set_current_win(Window window, Error *err) FUNC_API_SINCE(1) { @@ -687,7 +690,7 @@ Tabpage nvim_get_current_tabpage(void) /// Sets the current tabpage /// -/// @param handle Tabpage handle +/// @param tabpage Tabpage handle /// @param[out] err Error details, if any void nvim_set_current_tabpage(Tabpage tabpage, Error *err) FUNC_API_SINCE(1) @@ -757,9 +760,8 @@ Dictionary nvim_get_color_map(void) } -/// Gets the current mode. -/// mode: Mode string. |mode()| -/// blocking: true if Nvim is waiting for input. +/// Gets the current mode. |mode()| +/// "blocking" is true if Nvim is waiting for input. /// /// @returns Dictionary { "mode": String, "blocking": Boolean } Dictionary nvim_get_mode(void) @@ -775,11 +777,11 @@ Dictionary nvim_get_mode(void) return rv; } -/// Get a list of dictionaries describing global (i.e. non-buffer) mappings -/// Note that the "buffer" key will be 0 to represent false. +/// Gets a list of dictionaries describing global (non-buffer) mappings. +/// The "buffer" key in the returned dictionary is always zero. /// -/// @param mode The abbreviation for the mode -/// @returns An array of maparg() like dictionaries describing mappings +/// @param mode Mode short-name ("n", "i", "v", ...) +/// @returns Array of maparg()-like dictionaries describing mappings ArrayOf(Dictionary) nvim_get_keymap(String mode) FUNC_API_SINCE(3) { diff --git a/src/nvim/buffer.c b/src/nvim/buffer.c index 9d42fbc1b3..f874268910 100644 --- a/src/nvim/buffer.c +++ b/src/nvim/buffer.c @@ -5278,6 +5278,44 @@ int bufhl_add_hl(buf_T *buf, return src_id; } +/// Add highlighting to a buffer, bounded by two cursor positions, +/// with an offset. +/// +/// @param buf Buffer to add highlights to +/// @param src_id src_id to use or 0 to use a new src_id group, +/// or -1 for ungrouped highlight. +/// @param hl_id Highlight group id +/// @param pos_start Cursor position to start the hightlighting at +/// @param pos_end Cursor position to end the highlighting at +/// @param offset Move the whole highlighting this many columns to the right +void bufhl_add_hl_pos_offset(buf_T *buf, + int src_id, + int hl_id, + lpos_T pos_start, + lpos_T pos_end, + colnr_T offset) +{ + colnr_T hl_start = 0; + colnr_T hl_end = 0; + + for (linenr_T lnum = pos_start.lnum; lnum <= pos_end.lnum; lnum ++) { + if (pos_start.lnum < lnum && lnum < pos_end.lnum) { + hl_start = offset; + hl_end = MAXCOL; + } else if (lnum == pos_start.lnum && lnum < pos_end.lnum) { + hl_start = pos_start.col + offset + 1; + hl_end = MAXCOL; + } else if (pos_start.lnum < lnum && lnum == pos_end.lnum) { + hl_start = offset; + hl_end = pos_end.col + offset; + } else if (pos_start.lnum == lnum && pos_end.lnum == lnum) { + hl_start = pos_start.col + offset + 1; + hl_end = pos_end.col + offset; + } + (void)bufhl_add_hl(buf, src_id, hl_id, lnum, hl_start, hl_end); + } +} + /// Clear bufhl highlights from a given source group and range of lines. /// /// @param buf The buffer to remove highlights from diff --git a/src/nvim/eval/decode.c b/src/nvim/eval/decode.c index 9c9c2c2dc8..0933b1bf9c 100644 --- a/src/nvim/eval/decode.c +++ b/src/nvim/eval/decode.c @@ -266,7 +266,7 @@ typval_T decode_string(const char *const s, const size_t len, { assert(s != NULL || len == 0); const bool really_hasnul = (hasnul == kNone - ? memchr(s, NUL, len) != NULL + ? ((s != NULL) && (memchr(s, NUL, len) != NULL)) : (bool)hasnul); if (really_hasnul) { list_T *const list = tv_list_alloc(); diff --git a/src/nvim/ex_cmds.c b/src/nvim/ex_cmds.c index 918e7a0c91..39059a2c80 100644 --- a/src/nvim/ex_cmds.c +++ b/src/nvim/ex_cmds.c @@ -90,14 +90,20 @@ typedef struct { SubIgnoreType do_ic; ///< ignore case flag } subflags_T; -/// Lines matched during :substitute. +/// Partial result of a substitution during :substitute. +/// Numbers refer to the buffer _after_ substitution typedef struct { - linenr_T lnum; - long nmatch; - char_u *line; - kvec_t(colnr_T) cols; ///< columns of in-line matches -} MatchedLine; -typedef kvec_t(MatchedLine) MatchedLineVec; + lpos_T start; // start of the match + lpos_T end; // end of the match + linenr_T pre_match; // where to begin showing lines before the match +} SubResult; + +// Collected results of a substitution for showing them in +// the preview window +typedef struct { + kvec_t(SubResult) subresults; + linenr_T lines_needed; // lines neede in the preview window +} PreviewLines; #ifdef INCLUDE_GENERATED_DECLARATIONS # include "ex_cmds.c.generated.h" @@ -3168,7 +3174,10 @@ static buf_T *do_sub(exarg_T *eap, proftime_T timeout) linenr_T old_line_count = curbuf->b_ml.ml_line_count; char_u *sub_firstline; // allocated copy of first sub line bool endcolumn = false; // cursor in last column when done - MatchedLineVec matched_lines = KV_INITIAL_VALUE; + PreviewLines preview_lines = { KV_INITIAL_VALUE, 0 }; + static int pre_src_id = 0; // Source id for the preview highlight + static int pre_hl_id = 0; + buf_T *orig_buf = curbuf; // save to reset highlighting pos_T old_cursor = curwin->w_cursor; int start_nsubs; int save_ma = 0; @@ -3336,7 +3345,7 @@ static buf_T *do_sub(exarg_T *eap, proftime_T timeout) linenr_T line2 = eap->line2; for (linenr_T lnum = eap->line1; lnum <= line2 && !got_quit && !aborting() - && (!preview || matched_lines.size < (size_t)p_cwh + && (!preview || preview_lines.lines_needed <= (linenr_T)p_cwh || lnum <= curwin->w_botline); lnum++) { long nmatch = vim_regexec_multi(®match, curwin, curbuf, lnum, @@ -3401,8 +3410,6 @@ static buf_T *do_sub(exarg_T *eap, proftime_T timeout) sub_firstlnum = lnum; copycol = 0; matchcol = 0; - // the current match - MatchedLine matched_line = { 0, 0, NULL, KV_INITIAL_VALUE }; /* At first match, remember current cursor position. */ if (!got_match) { @@ -3419,10 +3426,19 @@ static buf_T *do_sub(exarg_T *eap, proftime_T timeout) * 5. break if there isn't another match in this line */ for (;; ) { - /* Advance "lnum" to the line where the match starts. The - * match does not start in the first line when there is a line - * break before \zs. */ + SubResult current_match = { + .start = { 0, 0 }, + .end = { 0, 0 }, + .pre_match = 0, + }; + // lnum is where the match start, but maybe not the pattern match, + // since we can have \n before \zs in the pattern + + // Advance "lnum" to the line where the match starts. The + // match does not start in the first line when there is a line + // break before \zs. if (regmatch.startpos[0].lnum > 0) { + current_match.pre_match = lnum; lnum += regmatch.startpos[0].lnum; sub_firstlnum += regmatch.startpos[0].lnum; nmatch -= regmatch.startpos[0].lnum; @@ -3430,6 +3446,10 @@ static buf_T *do_sub(exarg_T *eap, proftime_T timeout) sub_firstline = NULL; } + // Now we're at the line where the pattern match starts + // Note: If not first match on a line, column can't be known here + current_match.start.lnum = sub_firstlnum; + if (sub_firstline == NULL) { sub_firstline = vim_strsave(ml_get(sub_firstlnum)); } @@ -3439,12 +3459,6 @@ static buf_T *do_sub(exarg_T *eap, proftime_T timeout) curwin->w_cursor.lnum = lnum; do_again = FALSE; - if (preview) { - // Increment the in-line match count and store the column. - matched_line.nmatch++; - kv_push(matched_line.cols, regmatch.startpos[0].col); - } - /* * 1. Match empty string does not count, except for first * match. This reproduces the strange vi behaviour. @@ -3464,6 +3478,10 @@ static buf_T *do_sub(exarg_T *eap, proftime_T timeout) else ++matchcol; } + // match will be pushed to preview_lines, bring it into a proper state + current_match.start.col = matchcol; + current_match.end.lnum = sub_firstlnum; + current_match.end.col = matchcol; goto skip; } @@ -3669,6 +3687,7 @@ static buf_T *do_sub(exarg_T *eap, proftime_T timeout) // go beyond the last line of the buffer. if (nmatch > curbuf->b_ml.ml_line_count - sub_firstlnum + 1) { nmatch = curbuf->b_ml.ml_line_count - sub_firstlnum + 1; + current_match.end.lnum = sub_firstlnum + nmatch; skip_match = true; } @@ -3696,8 +3715,19 @@ static buf_T *do_sub(exarg_T *eap, proftime_T timeout) } \ } while (0) + // Save the line numbers for the preview buffer + // NOTE: If the pattern matches a final newline, the next line will + // be shown also, but should not be highlighted. Intentional for now. if (preview && !has_second_delim) { + current_match.start.col = regmatch.startpos[0].col; + if (current_match.end.lnum == 0) { + current_match.end.lnum = sub_firstlnum + nmatch - 1; + } + current_match.end.col = regmatch.endpos[0].col; + ADJUST_SUB_FIRSTLNUM(); + lnum += nmatch - 1; + goto skip; } @@ -3747,6 +3777,10 @@ static buf_T *do_sub(exarg_T *eap, proftime_T timeout) memmove(new_end, sub_firstline + copycol, (size_t)copy_len); new_end += copy_len; + // Finally, at this point we can know where the match actually will + // start in the new text + current_match.start.col = new_end - new_start; + (void)vim_regsub_multi(®match, sub_firstlnum - regmatch.startpos[0].lnum, sub, new_end, true, p_magic, true); @@ -3799,6 +3833,8 @@ static buf_T *do_sub(exarg_T *eap, proftime_T timeout) p1 += (*mb_ptr2len)(p1) - 1; } } + current_match.end.col = STRLEN(new_start); + current_match.end.lnum = lnum; } // 4. If subflags.do_all is set, find next match. @@ -3907,9 +3943,30 @@ skip: * found the match. */ if (nmatch == -1) lnum -= regmatch.startpos[0].lnum; + +#define PUSH_PREVIEW_LINES() \ + do { \ + linenr_T match_lines = current_match.end.lnum \ + - current_match.start.lnum +1; \ + if (preview_lines.subresults.size > 0) { \ + linenr_T last = kv_last(preview_lines.subresults).end.lnum; \ + if (last == current_match.start.lnum) { \ + preview_lines.lines_needed += match_lines - 1; \ + } \ + } else { \ + preview_lines.lines_needed += match_lines; \ + } \ + kv_push(preview_lines.subresults, current_match); \ + } while (0) + + // Push the match to preview_lines. + PUSH_PREVIEW_LINES(); + break; } } + // Push the match to preview_lines. + PUSH_PREVIEW_LINES(); line_breakcheck(); } @@ -3919,12 +3976,6 @@ skip: xfree(new_start); /* for when substitute was cancelled */ xfree(sub_firstline); /* free the copy of the original line */ sub_firstline = NULL; - - if (preview) { - matched_line.lnum = lnum; - matched_line.line = vim_strsave(ml_get(lnum)); - kv_push(matched_lines, matched_line); - } } line_breakcheck(); @@ -3999,25 +4050,34 @@ skip: // Show 'inccommand' preview if there are matched lines. buf_T *preview_buf = NULL; + size_t subsize = preview_lines.subresults.size; if (preview && !aborting()) { if (got_quit) { // Substitution is too slow, disable 'inccommand'. set_string_option_direct((char_u *)"icm", -1, (char_u *)"", OPT_FREE, SID_NONE); - } else if (*p_icm != NUL && matched_lines.size != 0 && pat != NULL) { + } else if (*p_icm != NUL && pat != NULL) { + if (pre_src_id == 0) { + // Get a unique new src_id, saved in a static + pre_src_id = bufhl_add_hl(NULL, 0, -1, 0, 0, 0); + } + if (pre_hl_id == 0) { + pre_hl_id = syn_check_group((char_u *)S_LEN("Substitute")); + } curbuf->b_changed = save_b_changed; // preserve 'modified' during preview - preview_buf = show_sub(eap, old_cursor, pat, sub, &matched_lines); + preview_buf = show_sub(eap, old_cursor, &preview_lines, + pre_hl_id, pre_src_id); + if (subsize > 0) { + bufhl_clear_line_range(orig_buf, pre_src_id, eap->line1, + kv_last(preview_lines.subresults).end.lnum); + } } } - for (MatchedLine m; kv_size(matched_lines);) { - m = kv_pop(matched_lines); - xfree(m.line); - kv_destroy(m.cols); - } - kv_destroy(matched_lines); + kv_destroy(preview_lines.subresults); return preview_buf; #undef ADJUST_SUB_FIRSTLNUM +#undef PUSH_PREVIEW_LINES } // NOLINT(readability/fn_size) /* @@ -6017,8 +6077,8 @@ void set_context_in_sign_cmd(expand_T *xp, char_u *arg) /// Shows the effects of the :substitute command being typed ('inccommand'). /// If inccommand=split, shows a preview window and later restores the layout. -static buf_T *show_sub(exarg_T *eap, pos_T old_cusr, char_u *pat, char_u *sub, - MatchedLineVec *matched_lines) +static buf_T *show_sub(exarg_T *eap, pos_T old_cusr, + PreviewLines *preview_lines, int hl_id, int src_id) FUNC_ATTR_NONNULL_ALL { static handle_T bufnr = 0; // special buffer, re-used on each visit @@ -6026,8 +6086,8 @@ static buf_T *show_sub(exarg_T *eap, pos_T old_cusr, char_u *pat, char_u *sub, win_T *save_curwin = curwin; cmdmod_T save_cmdmod = cmdmod; char_u *save_shm_p = vim_strsave(p_shm); - size_t sub_size = mb_string2cells(sub); - size_t pat_size = mb_string2cells(pat); + PreviewLines lines = *preview_lines; + buf_T *orig_buf = curbuf; // We keep a special-purpose buffer around, but don't assume it exists. buf_T *preview_buf = bufnr ? buflist_findnr(bufnr) : 0; @@ -6039,22 +6099,26 @@ static buf_T *show_sub(exarg_T *eap, pos_T old_cusr, char_u *pat, char_u *sub, bool outside_curline = (eap->line1 != old_cusr.lnum || eap->line2 != old_cusr.lnum); - bool split = outside_curline && (*p_icm != 'n') && (sub_size || pat_size); + bool split = outside_curline && (*p_icm != 'n'); if (preview_buf == curbuf) { // Preview buffer cannot preview itself! split = false; preview_buf = NULL; } // Place cursor on nearest matching line, to undo do_sub() cursor placement. - for (size_t i = 0; i < matched_lines->size; i++) { - MatchedLine curmatch = matched_lines->items[i]; - if (curmatch.lnum >= old_cusr.lnum) { - curwin->w_cursor.lnum = curmatch.lnum; - curwin->w_cursor.col = curmatch.cols.items[0]; + for (size_t i = 0; i < lines.subresults.size; i++) { + SubResult curres = lines.subresults.items[i]; + if (curres.start.lnum >= old_cusr.lnum) { + curwin->w_cursor.lnum = curres.start.lnum; + curwin->w_cursor.col = curres.start.col; break; } // Else: All matches are above, do_sub() already placed cursor. } + // Width of the "| lnum|..." column which displays the line numbers. + linenr_T highest_num_line = 0; + int col_width = 0; + if (split && win_split((int)p_cwh, WSP_BOT) != FAIL) { buf_open_scratch(preview_buf ? bufnr : 0, "[Preview]"); buf_clear(); @@ -6069,44 +6133,77 @@ static buf_T *show_sub(exarg_T *eap, pos_T old_cusr, char_u *pat, char_u *sub, curwin->w_p_spell = false; curwin->w_p_fen = false; - // Width of the "| lnum|..." column which displays the line numbers. - linenr_T highest_num_line = kv_last(*matched_lines).lnum; - int col_width = log10(highest_num_line) + 1 + 3; - - char *str = NULL; - size_t old_line_size = 0; - size_t line_size; - int src_id_highlight = 0; - int hl_id = syn_check_group((char_u *)"Substitute", 13); - - // Dump the lines into the preview buffer. - for (size_t line = 0; line < matched_lines->size; line++) { - MatchedLine mat = matched_lines->items[line]; - line_size = mb_string2cells(mat.line) + col_width + 1; - - // Reallocate if str not long enough - if (line_size > old_line_size) { - str = xrealloc(str, line_size * sizeof(char)); - old_line_size = line_size; + if (lines.subresults.size > 0) { + highest_num_line = kv_last(lines.subresults).end.lnum; + col_width = log10(highest_num_line) + 1 + 3; + } + } + + char *str = NULL; // construct the line to show in here + size_t old_line_size = 0; + size_t line_size = 0; + linenr_T linenr_preview = 0; // last line added to preview buffer + linenr_T linenr_origbuf = 0; // last line added to original buffer + linenr_T next_linenr = 0; // next line to show for the match + + for (size_t matchidx = 0; matchidx < lines.subresults.size; matchidx++) { + SubResult match = lines.subresults.items[matchidx]; + + if (split && preview_buf) { + lpos_T p_start = { 0, match.start.col }; // match starts here in preview + lpos_T p_end = { 0, match.end.col }; // ... and ends here + + if (match.pre_match == 0) { + next_linenr = match.start.lnum; + } else { + next_linenr = match.pre_match; + } + // Don't add a line twice + if (next_linenr == linenr_origbuf) { + next_linenr++; + p_start.lnum = linenr_preview; // might be redefined below + p_end.lnum = linenr_preview; // might be redefined below } - // Put "|lnum| line" into `str` and append it to the preview buffer. - snprintf(str, line_size, "|%*ld| %s", col_width - 3, mat.lnum, mat.line); - ml_append(line, (char_u *)str, (colnr_T)line_size, false); - - // highlight the replaced part - if (sub_size > 0) { - for (size_t i = 0; i < mat.cols.size; i++) { - colnr_T col_start = mat.cols.items[i] + col_width - + i * (sub_size - pat_size) + 1; - colnr_T col_end = col_start - 1 + sub_size; - src_id_highlight = bufhl_add_hl(curbuf, src_id_highlight, hl_id, - line + 1, col_start, col_end); + for (; next_linenr <= match.end.lnum; next_linenr++) { + if (next_linenr == match.start.lnum) { + p_start.lnum = linenr_preview + 1; } + if (next_linenr == match.end.lnum) { + p_end.lnum = linenr_preview + 1; + } + char *line; + if (next_linenr == orig_buf->b_ml.ml_line_count + 1) { + line = ""; + } else { + line = (char *)ml_get_buf(orig_buf, next_linenr, false); + line_size = strlen(line) + col_width + 1; + + // Reallocate if line not long enough + if (line_size > old_line_size) { + str = xrealloc(str, line_size * sizeof(char)); + old_line_size = line_size; + } + } + // Put "|lnum| line" into `str` and append it to the preview buffer. + snprintf(str, line_size, "|%*ld| %s", col_width - 3, + next_linenr, line); + if (linenr_preview == 0) { + ml_replace(1, (char_u *)str, true); + } else { + ml_append(linenr_preview, (char_u *)str, (colnr_T)line_size, false); + } + linenr_preview += 1; } + linenr_origbuf = match.end.lnum; + + bufhl_add_hl_pos_offset(preview_buf, src_id, hl_id, p_start, + p_end, col_width); } - xfree(str); + bufhl_add_hl_pos_offset(orig_buf, src_id, hl_id, match.start, + match.end, 0); } + xfree(str); redraw_later(SOME_VALID); win_enter(save_curwin, false); // Return to original window @@ -6156,7 +6253,11 @@ void ex_substitute(exarg_T *eap) curwin->w_p_cul = false; // Disable 'cursorline' curwin->w_p_cuc = false; // Disable 'cursorcolumn' + // Don't show search highlighting during live substitution + bool save_hls = p_hls; + p_hls = false; buf_T *preview_buf = do_sub(eap, profile_setlimit(p_rdt)); + p_hls = save_hls; if (save_changedtick != curbuf->b_changedtick) { // Undo invisibly. This also moves the cursor! diff --git a/src/nvim/ex_cmds2.c b/src/nvim/ex_cmds2.c index 371f7b3bce..9b8e463aee 100644 --- a/src/nvim/ex_cmds2.c +++ b/src/nvim/ex_cmds2.c @@ -1039,9 +1039,14 @@ static void profile_reset(void) uf->uf_tm_total = profile_zero(); uf->uf_tm_self = profile_zero(); uf->uf_tm_children = profile_zero(); + + xfree(uf->uf_tml_count); + xfree(uf->uf_tml_total); + xfree(uf->uf_tml_self); uf->uf_tml_count = NULL; uf->uf_tml_total = NULL; uf->uf_tml_self = NULL; + uf->uf_tml_start = profile_zero(); uf->uf_tml_children = profile_zero(); uf->uf_tml_wait = profile_zero(); @@ -1068,7 +1073,7 @@ static void profile_init(scriptitem_T *si) si->sn_pr_nest = 0; } -/// save time when starting to invoke another script or function. +/// Save time when starting to invoke another script or function. void script_prof_save( proftime_T *tm // place to store wait time ) @@ -1141,12 +1146,14 @@ static void script_dump_profile(FILE *fd) if (sfd == NULL) { fprintf(fd, "Cannot open file!\n"); } else { - for (int i = 0; i < si->sn_prl_ga.ga_len; i++) { + // Keep going till the end of file, so that trailing + // continuation lines are listed. + for (int i = 0; ; i++) { if (vim_fgets(IObuff, IOSIZE, sfd)) { break; } - pp = &PRL_ITEM(si, i); - if (pp->snp_count > 0) { + if (i < si->sn_prl_ga.ga_len + && (pp = &PRL_ITEM(si, i))->snp_count > 0) { fprintf(fd, "%5d ", pp->snp_count); if (profile_equal(pp->sn_prl_total, pp->sn_prl_self)) { fprintf(fd, " "); @@ -2871,22 +2878,6 @@ int do_source(char_u *fname, int check_other, int is_vimrc) save_sourcing_lnum = sourcing_lnum; sourcing_lnum = 0; - cookie.conv.vc_type = CONV_NONE; // no conversion - - // Read the first line so we can check for a UTF-8 BOM. - firstline = getsourceline(0, (void *)&cookie, 0); - if (firstline != NULL && STRLEN(firstline) >= 3 && firstline[0] == 0xef - && firstline[1] == 0xbb && firstline[2] == 0xbf) { - // Found BOM; setup conversion, skip over BOM and recode the line. - convert_setup(&cookie.conv, (char_u *)"utf-8", p_enc); - p = string_convert(&cookie.conv, firstline + 3, NULL); - if (p == NULL) { - p = vim_strsave(firstline + 3); - } - xfree(firstline); - firstline = p; - } - // start measuring script load time if --startuptime was passed and // time_fd was successfully opened afterwards. proftime_T rel_time; @@ -2959,6 +2950,22 @@ int do_source(char_u *fname, int check_other, int is_vimrc) } } + cookie.conv.vc_type = CONV_NONE; // no conversion + + // Read the first line so we can check for a UTF-8 BOM. + firstline = getsourceline(0, (void *)&cookie, 0); + if (firstline != NULL && STRLEN(firstline) >= 3 && firstline[0] == 0xef + && firstline[1] == 0xbb && firstline[2] == 0xbf) { + // Found BOM; setup conversion, skip over BOM and recode the line. + convert_setup(&cookie.conv, (char_u *)"utf-8", p_enc); + p = string_convert(&cookie.conv, firstline + 3, NULL); + if (p == NULL) { + p = vim_strsave(firstline + 3); + } + xfree(firstline); + firstline = p; + } + // Call do_cmdline, which will call getsourceline() to get the lines. do_cmdline(firstline, getsourceline, (void *)&cookie, DOCMD_VERBOSE|DOCMD_NOWAIT|DOCMD_REPEAT); @@ -3068,6 +3075,8 @@ char_u *get_scriptname(scid_T id) # if defined(EXITFREE) void free_scriptnames(void) { + profile_reset(); + # define FREE_SCRIPTNAME(item) xfree((item)->sn_name) GA_DEEP_CLEAR(&script_items, scriptitem_T, FREE_SCRIPTNAME); } @@ -3281,7 +3290,8 @@ void script_line_start(void) if (si->sn_prof_on && sourcing_lnum >= 1) { // Grow the array before starting the timer, so that the time spent // here isn't counted. - ga_grow(&si->sn_prl_ga, (int)(sourcing_lnum - si->sn_prl_ga.ga_len)); + (void)ga_grow(&si->sn_prl_ga, + (int)(sourcing_lnum - si->sn_prl_ga.ga_len)); si->sn_prl_idx = sourcing_lnum - 1; while (si->sn_prl_ga.ga_len <= si->sn_prl_idx && si->sn_prl_ga.ga_len < si->sn_prl_ga.ga_maxlen) { diff --git a/src/nvim/ex_getln.c b/src/nvim/ex_getln.c index 3b751530e8..e6fb2571c4 100644 --- a/src/nvim/ex_getln.c +++ b/src/nvim/ex_getln.c @@ -536,6 +536,9 @@ static int command_line_execute(VimState *state, int key) if (!(s->c == p_wc && KeyTyped) && s->c != p_wcm && s->c != Ctrl_N && s->c != Ctrl_P && s->c != Ctrl_A && s->c != Ctrl_L) { + if (ui_is_external(kUIWildmenu)) { + ui_call_wildmenu_hide(); + } if (s->xpc.xp_numfiles != -1) { (void)ExpandOne(&s->xpc, NULL, NULL, 0, WILD_FREE); } @@ -2836,7 +2839,7 @@ void ui_ext_cmdline_block_append(int indent, const char *line) { char *buf = xmallocz(indent + strlen(line)); memset(buf, ' ', indent); - memcpy(buf+indent, line, strlen(line)); + memcpy(buf + indent, line, strlen(line)); // -V575 Array item = ARRAY_DICT_INIT; ADD(item, DICTIONARY_OBJ((Dictionary)ARRAY_DICT_INIT)); @@ -3567,11 +3570,17 @@ ExpandOne ( else findex = -1; } - if (p_wmnu) - win_redr_status_matches(xp, xp->xp_numfiles, xp->xp_files, - findex, cmd_showtail); - if (findex == -1) + if (p_wmnu) { + if (ui_is_external(kUIWildmenu)) { + ui_call_wildmenu_select(findex); + } else { + win_redr_status_matches(xp, xp->xp_numfiles, xp->xp_files, + findex, cmd_showtail); + } + } + if (findex == -1) { return vim_strsave(orig_save); + } return vim_strsave(xp->xp_files[findex]); } else return NULL; @@ -3928,6 +3937,15 @@ static int showmatches(expand_T *xp, int wildmenu) showtail = cmd_showtail; } + if (ui_is_external(kUIWildmenu)) { + Array args = ARRAY_DICT_INIT; + for (i = 0; i < num_files; i++) { + ADD(args, STRING_OBJ(cstr_to_string((char *)files_found[i]))); + } + ui_call_wildmenu_show(args); + return EXPAND_OK; + } + if (!wildmenu) { msg_didany = FALSE; /* lines_left will be set */ msg_start(); /* prepare for paging */ @@ -6180,4 +6198,3 @@ static void set_search_match(pos_T *t) coladvance((colnr_T)MAXCOL); } } - diff --git a/src/nvim/lua/executor.c b/src/nvim/lua/executor.c index 16bb4169c4..8e7b8a1824 100644 --- a/src/nvim/lua/executor.c +++ b/src/nvim/lua/executor.c @@ -336,8 +336,8 @@ static lua_State *nlua_init(void) /// Calls nlua_init() if needed. Is responsible for pre-lua call initalization /// like updating `package.[c]path` with directories derived from &runtimepath. /// -/// @return Interprter instance to use. Will either be initialized now or taken -/// from previous initalization. +/// @return Interpreter instance to use. Will either be initialized now or +/// taken from previous initialization. static lua_State *nlua_enter(void) FUNC_ATTR_NONNULL_RET FUNC_ATTR_WARN_UNUSED_RESULT { diff --git a/src/nvim/ops.c b/src/nvim/ops.c index c6df71ea46..432c9a8b47 100644 --- a/src/nvim/ops.c +++ b/src/nvim/ops.c @@ -2735,7 +2735,7 @@ void do_put(int regname, yankreg_T *reg, int dir, long count, int flags) // Autocommands may be executed when saving lines for undo, which may make // y_array invalid. Start undo now to avoid that. if (u_save(curwin->w_cursor.lnum, curwin->w_cursor.lnum + 1) == FAIL) { - ELOG(_("Failed to save undo information")); + ELOG("Failed to save undo information"); return; } } diff --git a/src/nvim/testdir/test_profile.vim b/src/nvim/testdir/test_profile.vim index 183f52b8ac..4cbd800da5 100644 --- a/src/nvim/testdir/test_profile.vim +++ b/src/nvim/testdir/test_profile.vim @@ -115,7 +115,7 @@ func Test_profile_file() call assert_match('^ Self time:\s\+\d\+\.\d\+$', lines[3]) call assert_equal('', lines[4]) call assert_equal('count total (s) self (s)', lines[5]) - call assert_equal(' func! Foo()', lines[6]) + call assert_match(' 2 0.\d\+ func! Foo()', lines[6]) call assert_equal(' endfunc', lines[7]) " Loop iterates 10 times. Since script runs twice, body executes 20 times. " First line of loop executes one more time than body to detect end of loop. @@ -132,6 +132,42 @@ func Test_profile_file() call delete('Xprofile_file.log') endfunc +func Test_profile_file_with_cont() + let lines = [ + \ 'echo "hello', + \ ' \ world"', + \ 'echo "foo ', + \ ' \bar"', + \ ] + + call writefile(lines, 'Xprofile_file.vim') + call system(v:progpath + \ . ' -es -u NONE -U NONE -i NONE --noplugin' + \ . ' -c "profile start Xprofile_file.log"' + \ . ' -c "profile file Xprofile_file.vim"' + \ . ' -c "so Xprofile_file.vim"' + \ . ' -c "qall!"') + call assert_equal(0, v:shell_error) + + let lines = readfile('Xprofile_file.log') + call assert_equal(11, len(lines)) + + call assert_match('^SCRIPT .*Xprofile_file.vim$', lines[0]) + call assert_equal('Sourced 1 time', lines[1]) + call assert_match('^Total time:\s\+\d\+\.\d\+$', lines[2]) + call assert_match('^ Self time:\s\+\d\+\.\d\+$', lines[3]) + call assert_equal('', lines[4]) + call assert_equal('count total (s) self (s)', lines[5]) + call assert_match(' 1 0.\d\+ echo "hello', lines[6]) + call assert_equal(' \ world"', lines[7]) + call assert_match(' 1 0.\d\+ echo "foo ', lines[8]) + call assert_equal(' \bar"', lines[9]) + call assert_equal('', lines[10]) + + call delete('Xprofile_file.vim') + call delete('Xprofile_file.log') +endfunc + func Test_profile_completion() call feedkeys(":profile \<C-A>\<C-B>\"\<CR>", 'tx') call assert_equal('"profile continue dump file func pause start stop', @:) diff --git a/test/README.md b/test/README.md index 15041b74e8..a76cfc5235 100644 --- a/test/README.md +++ b/test/README.md @@ -1,31 +1,48 @@ -# Tests +Tests +===== Tests are run by `/cmake/RunTests.cmake` file, using busted. For some failures, `.nvimlog` (or `$NVIM_LOG_FILE`) may provide insight. -## Directory structure +Lint +---- -Directories with tests: `/test/benchmark` for benchmarks, `/test/functional` for -functional tests, `/test/unit` for unit tests. `/test/config` contains `*.in` -files (currently a single one) which are transformed into `*.lua` files using -`configure_file` CMake command: this is for acessing CMake variables in lua -tests. `/test/includes` contains include files for use by luajit `ffi.cdef` -C definitions parser: normally used to make macros not accessible via this -mechanism accessible the other way. +`make lint` (and `make testlint`) runs [luacheck](https://github.com/mpeterv/luacheck) +on the test code. -Files `/test/*/preload.lua` contain modules which will be preloaded by busted, -via `--helper` option. `/test/**/helpers.lua` contain various “library” -functions, (intended to be) used by a number of tests and not just a single one. +If a luacheck warning must be ignored, specify the warning code. Example: -`/test/*/**/*_spec.lua` are files containing actual tests. Files that do not end -with a `_spec.lua` are libraries like `/test/**/helpers.lua`, except that they -have some common topic. + -- luacheck: ignore 621 -Tests inside `/test/unit` and `/test/functional` are normally divided into -groups by the semantic component they are testing. +http://luacheck.readthedocs.io/en/stable/warnings.html -## Environment variables +Ignore the smallest applicable scope (e.g. inside a function, not at the top of +the file). + +Layout +------ + +- `/test/benchmark` : benchmarks +- `/test/functional` : functional tests +- `/test/unit` : unit tests +- `/test/config` : contains `*.in` files which are transformed into `*.lua` + files using `configure_file` CMake command: this is for acessing CMake + variables in lua tests. +- `/test/includes` : include-files for use by luajit `ffi.cdef` C definitions + parser: normally used to make macros not accessible via this mechanism + accessible the other way. +- `/test/*/preload.lua` : modules preloaded by busted `--helper` option +- `/test/**/helpers.lua` : common utility functions for test code +- `/test/*/**/*_spec.lua` : actual tests. Files that do not end with + `_spec.lua` are libraries like `/test/**/helpers.lua`, except that they have + some common topic. + +Tests in `/test/unit` and `/test/functional` are normally divided into groups +by the semantic component they are testing. + +Environment variables +--------------------- Test behaviour is affected by environment variables. Currently supported (Functional, Unit, Benchmarks) (when Defined; when set to _1_; when defined, diff --git a/test/functional/api/server_requests_spec.lua b/test/functional/api/server_requests_spec.lua index 4380e52b8b..a2a198ca83 100644 --- a/test/functional/api/server_requests_spec.lua +++ b/test/functional/api/server_requests_spec.lua @@ -304,14 +304,30 @@ describe('server -> client', function() connect_test(server, 'pipe', address) end) - it('via ip address', function() + it('via ipv4 address', function() local server = spawn(nvim_argv) set_session(server) local address = funcs.serverstart("127.0.0.1:") + if #address == 0 then + pending('no ipv4 stack', function() end) + return + end eq('127.0.0.1:', string.sub(address,1,10)) connect_test(server, 'tcp', address) end) + it('via ipv6 address', function() + local server = spawn(nvim_argv) + set_session(server) + local address = funcs.serverstart('::1:') + if #address == 0 then + pending('no ipv6 stack', function() end) + return + end + eq('::1:', string.sub(address,1,4)) + connect_test(server, 'tcp', address) + end) + it('via hostname', function() local server = spawn(nvim_argv) set_session(server) diff --git a/test/functional/eval/json_functions_spec.lua b/test/functional/eval/json_functions_spec.lua index 4d34cde849..8dcaea806e 100644 --- a/test/functional/eval/json_functions_spec.lua +++ b/test/functional/eval/json_functions_spec.lua @@ -776,4 +776,11 @@ describe('json_encode() function', function() it('can dump NULL dictionary', function() eq('{}', eval('json_encode(v:_null_dict)')) end) + + it('fails to parse NULL strings and lists', function() + eq('Vim(call):E474: Attempt to decode a blank string', + exc_exec('call json_decode($XXX_UNEXISTENT_VAR_XXX)')) + eq('Vim(call):E474: Attempt to decode a blank string', + exc_exec('call json_decode(v:_null_list)')) + end) end) diff --git a/test/functional/eval/server_spec.lua b/test/functional/eval/server_spec.lua index 115114c3c3..393616838e 100644 --- a/test/functional/eval/server_spec.lua +++ b/test/functional/eval/server_spec.lua @@ -63,23 +63,33 @@ describe('serverstart(), serverstop()', function() eq({}, funcs.serverlist()) local s = funcs.serverstart('127.0.0.1:0') -- assign random port - assert(string.match(s, '127.0.0.1:%d+')) - eq(s, funcs.serverlist()[1]) - clear_serverlist() + if #s > 0 then + assert(string.match(s, '127.0.0.1:%d+')) + eq(s, funcs.serverlist()[1]) + clear_serverlist() + end s = funcs.serverstart('127.0.0.1:') -- assign random port - assert(string.match(s, '127.0.0.1:%d+')) - eq(s, funcs.serverlist()[1]) - clear_serverlist() + if #s > 0 then + assert(string.match(s, '127.0.0.1:%d+')) + eq(s, funcs.serverlist()[1]) + clear_serverlist() + end - funcs.serverstart('127.0.0.1:12345') - funcs.serverstart('127.0.0.1:12345') -- exists already; ignore - funcs.serverstart('::1:12345') - funcs.serverstart('::1:12345') -- exists already; ignore - local expected = { - '127.0.0.1:12345', - '::1:12345', - } + local expected = {} + local v4 = '127.0.0.1:12345' + s = funcs.serverstart(v4) + if #s > 0 then + table.insert(expected, v4) + funcs.serverstart(v4) -- exists already; ignore + end + + local v6 = '::1:12345' + s = funcs.serverstart(v6) + if #s > 0 then + table.insert(expected, v6) + funcs.serverstart(v6) -- exists already; ignore + end eq(expected, funcs.serverlist()) clear_serverlist() diff --git a/test/functional/ui/inccommand_spec.lua b/test/functional/ui/inccommand_spec.lua index cc023ef10d..53fd17c309 100644 --- a/test/functional/ui/inccommand_spec.lua +++ b/test/functional/ui/inccommand_spec.lua @@ -21,6 +21,42 @@ local default_text = [[ two lines ]] +local multiline_text = [[ + 1 2 3 + A B C + 4 5 6 + X Y Z + 7 8 9 +]] + +local multimatch_text = [[ + a bdc eae a fgl lzia r + x +]] + +local multibyte_text = [[ + £ ¥ ѫѫ PEPPERS +£ ¥ ѫfѫ + a£ ѫ¥KOL +£ ¥ libm +£ ¥ +]] + +local long_multiline_text = [[ + 1 2 3 + A B C + 4 5 6 + X Y Z + 7 8 9 + K L M + a b c + d e f + q r s + x y z + £ m n + t œ ¥ +]] + local function common_setup(screen, inccommand, text) if screen then command("syntax on") @@ -682,14 +718,14 @@ describe(":substitute, inccommand=split", function() feed(":%s/tw") screen:expect([[ Inc substitution on | - two lines | + {12:tw}o lines | | {15:~ }| {15:~ }| {11:[No Name] }| - |2| two lines | - |4| two lines | - | + |2| {12:tw}o lines | + |4| {12:tw}o lines | + {15:~ }| {15:~ }| {15:~ }| {15:~ }| @@ -704,13 +740,13 @@ describe(":substitute, inccommand=split", function() it("shows preview when cmd modifiers are present", function() -- one modifier feed(':keeppatterns %s/tw/to') - screen:expect([[too lines]], nil, nil, nil, true) + screen:expect([[{12:to}o lines]], nil, nil, nil, true) feed('<Esc>') screen:expect([[two lines]], nil, nil, nil, true) -- multiple modifiers feed(':keeppatterns silent %s/tw/to') - screen:expect([[too lines]], nil, nil, nil, true) + screen:expect([[{12:to}o lines]], nil, nil, nil, true) feed('<Esc>') screen:expect([[two lines]], nil, nil, nil, true) @@ -724,14 +760,14 @@ describe(":substitute, inccommand=split", function() feed(":%s/tw") screen:expect([[ Inc substitution on | - two lines | + {12:tw}o lines | | {15:~ }| {15:~ }| {11:[No Name] [+] }| - |2| two lines | - |4| two lines | - | + |2| {12:tw}o lines | + |4| {12:tw}o lines | + {15:~ }| {15:~ }| {15:~ }| {15:~ }| @@ -752,7 +788,7 @@ describe(":substitute, inccommand=split", function() {11:[No Name] [+] }| |2| o lines | |4| o lines | - | + {15:~ }| {15:~ }| {15:~ }| {15:~ }| @@ -764,14 +800,14 @@ describe(":substitute, inccommand=split", function() feed("x") screen:expect([[ Inc substitution on | - xo lines | + {12:x}o lines | | {15:~ }| {15:~ }| {11:[No Name] [+] }| |2| {12:x}o lines | |4| {12:x}o lines | - | + {15:~ }| {15:~ }| {15:~ }| {15:~ }| @@ -790,7 +826,7 @@ describe(":substitute, inccommand=split", function() {11:[No Name] [+] }| |2| o lines | |4| o lines | - | + {15:~ }| {15:~ }| {15:~ }| {15:~ }| @@ -805,14 +841,14 @@ describe(":substitute, inccommand=split", function() feed(":%s/tw/XX") screen:expect([[ Inc substitution on | - XXo lines | + {12:XX}o lines | | {15:~ }| {15:~ }| {11:[No Name] [+] }| |2| {12:XX}o lines | |4| {12:XX}o lines | - | + {15:~ }| {15:~ }| {15:~ }| {15:~ }| @@ -828,7 +864,7 @@ describe(":substitute, inccommand=split", function() screen:sleep(1) screen:expect([[ Inc substitution on | - two lines | + {12:tw}o lines | Inc substitution on | two lines | | @@ -872,14 +908,14 @@ describe(":substitute, inccommand=split", function() -- 'cursorline' is NOT active during preview. screen:expect([[ Inc substitution on | - {9:tw}o lines | + {12:tw}o lines | Inc substitution on | - {9:tw}o lines | + {12:tw}o lines | | {11:[No Name] [+] }| - |2| {9:tw}o lines | - |4| {9:tw}o lines | - | + |2| {12:tw}o lines | + |4| {12:tw}o lines | + {15:~ }| {15:~ }| {15:~ }| {15:~ }| @@ -894,14 +930,14 @@ describe(":substitute, inccommand=split", function() feed('M M M<esc>') feed(':%s/M/123/g') screen:expect([[ - 123 123 123 | + {12:123} {12:123} {12:123} | Inc substitution on | two lines | Inc substitution on | two lines | {11:[No Name] [+] }| |1| {12:123} {12:123} {12:123} | - | + {15:~ }| {15:~ }| {15:~ }| {15:~ }| @@ -912,6 +948,28 @@ describe(":substitute, inccommand=split", function() ]]) end) + it("highlights nothing when there's no match", function() + feed('gg') + feed(':%s/Inx') + screen:expect([[ + Inc substitution on | + two lines | + Inc substitution on | + two lines | + | + {11:[No Name] [+] }| + | + {15:~ }| + {15:~ }| + {15:~ }| + {15:~ }| + {15:~ }| + {15:~ }| + {10:[Preview] }| + :%s/Inx^ | + ]]) + end) + it('previews correctly when previewhight is small', function() feed_command('set cwh=3') feed_command('set hls') @@ -919,15 +977,15 @@ describe(":substitute, inccommand=split", function() insert(string.rep('abc abc abc\n', 20)) feed(':%s/abc/MMM/g') screen:expect([[ - MMM MMM MMM | - MMM MMM MMM | - MMM MMM MMM | - MMM MMM MMM | - MMM MMM MMM | - MMM MMM MMM | - MMM MMM MMM | - MMM MMM MMM | - MMM MMM MMM | + {12:MMM} {12:MMM} {12:MMM} | + {12:MMM} {12:MMM} {12:MMM} | + {12:MMM} {12:MMM} {12:MMM} | + {12:MMM} {12:MMM} {12:MMM} | + {12:MMM} {12:MMM} {12:MMM} | + {12:MMM} {12:MMM} {12:MMM} | + {12:MMM} {12:MMM} {12:MMM} | + {12:MMM} {12:MMM} {12:MMM} | + {12:MMM} {12:MMM} {12:MMM} | {11:[No Name] [+] }| | 1| {12:MMM} {12:MMM} {12:MMM} | | 2| {12:MMM} {12:MMM} {12:MMM} | @@ -969,9 +1027,9 @@ describe(":substitute, inccommand=split", function() screen:expect([[ BBo lines | Inc substitution on | - Xo lines | + {12:X}o lines | Inc substitution on | - Xo lines | + {12:X}o lines | {11:[No Name] [+] }| |1001| {12:X}o lines | |1003| {12:X}o lines | @@ -1069,15 +1127,15 @@ describe(":substitute, inccommand=split", function() feed(":1,2s/t/X") screen:expect([[ - Inc subsXitution on | - Xwo lines | + Inc subs{12:X}itution on | + {12:X}wo lines | Inc substitution on | two lines | | {11:[No Name] [+] }| |1| Inc subs{12:X}itution on | |2| {12:X}wo lines | - | + {15:~ }| {15:~ }| {15:~ }| {15:~ }| @@ -1134,7 +1192,7 @@ describe("inccommand=nosplit", function() two lines | Inc substitution on | two lines | - Line *.X | + Line *.{12:X} | {15:~ }| {15:~ }| {15:~ }| @@ -1142,7 +1200,6 @@ describe("inccommand=nosplit", function() :%smagic/3.*/X^ | ]]) - feed([[<C-\><C-N>]]) -- cancel feed(":%snomagic/3.*/X") -- start :snomagic command screen:expect([[ @@ -1150,7 +1207,7 @@ describe("inccommand=nosplit", function() two lines | Inc substitution on | two lines | - Line *.X here | + Line *.{12:X} here | {15:~ }| {15:~ }| {15:~ }| @@ -1162,13 +1219,13 @@ describe("inccommand=nosplit", function() it("shows preview when cmd modifiers are present", function() -- one modifier feed(':keeppatterns %s/tw/to') - screen:expect([[too lines]], nil, nil, nil, true) + screen:expect([[{12:to}o lines]], nil, nil, nil, true) feed('<Esc>') screen:expect([[two lines]], nil, nil, nil, true) -- multiple modifiers feed(':keeppatterns silent %s/tw/to') - screen:expect([[too lines]], nil, nil, nil, true) + screen:expect([[{12:to}o lines]], nil, nil, nil, true) feed('<Esc>') screen:expect([[two lines]], nil, nil, nil, true) @@ -1178,15 +1235,38 @@ describe("inccommand=nosplit", function() feed('<Esc>') end) + it("does not show window after toggling :set inccommand", function() + feed(":%s/tw/OKOK") + feed("<Esc>") + command("set icm=split") + feed(":%s/tw/OKOK") + feed("<Esc>") + command("set icm=nosplit") + feed(":%s/tw/OKOK") + wait() + screen:expect([[ + Inc substitution on | + {12:OKOK}o lines | + Inc substitution on | + {12:OKOK}o lines | + | + {15:~ }| + {15:~ }| + {15:~ }| + {15:~ }| + :%s/tw/OKOK^ | + ]]) + end) + it('never shows preview buffer', function() feed_command("set hlsearch") feed(":%s/tw") screen:expect([[ Inc substitution on | - {9:tw}o lines | + {12:tw}o lines | Inc substitution on | - {9:tw}o lines | + {12:tw}o lines | | {15:~ }| {15:~ }| @@ -1198,9 +1278,9 @@ describe("inccommand=nosplit", function() feed("/BM") screen:expect([[ Inc substitution on | - BMo lines | + {12:BM}o lines | Inc substitution on | - BMo lines | + {12:BM}o lines | | {15:~ }| {15:~ }| @@ -1212,9 +1292,9 @@ describe("inccommand=nosplit", function() feed("/") screen:expect([[ Inc substitution on | - BMo lines | + {12:BM}o lines | Inc substitution on | - BMo lines | + {12:BM}o lines | | {15:~ }| {15:~ }| @@ -1245,8 +1325,8 @@ describe("inccommand=nosplit", function() feed(":1,2s/t/X") screen:expect([[ - Inc subsXitution on | - Xwo lines | + Inc subs{12:X}itution on | + {12:X}wo lines | Inc substitution on | two lines | | @@ -1563,7 +1643,7 @@ describe("'inccommand' split windows", function() feed(":%s/tw") screen:expect([[ Inc substitution on {10:|}Inc substitution on| - two lines {10:|}two lines | + {12:tw}o lines {10:|}{12:tw}o lines | {10:|} | {15:~ }{10:|}{15:~ }| {15:~ }{10:|}{15:~ }| @@ -1578,13 +1658,13 @@ describe("'inccommand' split windows", function() {15:~ }{10:|}{15:~ }| {11:[No Name] [+] }{10:|}{15:~ }| Inc substitution on {10:|}{15:~ }| - two lines {10:|}{15:~ }| + {12:tw}o lines {10:|}{15:~ }| {10:|}{15:~ }| {15:~ }{10:|}{15:~ }| {15:~ }{10:|}{15:~ }| {10:[No Name] [+] [No Name] [+] }| - |2| two lines | - | + |2| {12:tw}o lines | + {15:~ }| {15:~ }| {15:~ }| {15:~ }| @@ -1602,7 +1682,7 @@ describe("'inccommand' split windows", function() feed(":%s/tw") screen:expect([[ Inc substitution on {10:|}Inc substitution on| - two lines {10:|}two lines | + {12:tw}o lines {10:|}{12:tw}o lines | {10:|} | {15:~ }{10:|}{15:~ }| {15:~ }{10:|}{15:~ }| @@ -1617,13 +1697,13 @@ describe("'inccommand' split windows", function() {15:~ }{10:|}{15:~ }| {11:[No Name] [+] }{10:[No Name] [+] }| Inc substitution on | - two lines | + {12:tw}o lines | | {15:~ }| {15:~ }| {10:[No Name] [+] }| - |2| two lines | - | + |2| {12:tw}o lines | + {15:~ }| {15:~ }| {15:~ }| {15:~ }| @@ -1652,7 +1732,7 @@ describe("'inccommand' split windows", function() screen:expect([[ Inc substitution on | - two lines | + {12:tw}o lines | | {15:~ }| {15:~ }| @@ -1672,8 +1752,8 @@ describe("'inccommand' split windows", function() {15:~ }| {15:~ }| {11:[No Name] [+] }| - |2| two lines | - | + |2| {12:tw}o lines | + {15:~ }| {15:~ }| {15:~ }| {15:~ }| @@ -1711,4 +1791,668 @@ describe("'inccommand' with 'gdefault'", function() expect("A\nA") eq({mode='n', blocking=false}, nvim("get_mode")) end) + + it("does not crash on zero-width matches #7485", function() + common_setup(nil, "split", default_text) + command("set gdefault") + feed("gg") + feed("Vj") + feed(":s/\\%V") + eq({mode='c', blocking=false}, nvim("get_mode")) + feed("<Esc>") + eq({mode='n', blocking=false}, nvim("get_mode")) + end) + + it("removes highlights after abort for a zero-width match", function() + local screen = Screen.new(30,5) + common_setup(screen, "nosplit", default_text) + command("set gdefault") + + feed(":%s/\\%1c/a/") + screen:expect([[ + {12:a}Inc substitution on | + {12:a}two lines | + {12:a} | + {15:~ }| + :%s/\%1c/a/^ | + ]]) + + feed("<Esc>") + screen:expect([[ + Inc substitution on | + two lines | + ^ | + {15:~ }| + | + ]]) + end) + +end) + +describe(":substitute", function() + local screen = Screen.new(30,15) + + before_each(function() + clear() + end) + + it(", inccommand=split, highlights multiline substitutions", function() + common_setup(screen, "split", multiline_text) + feed("gg") + + feed(":%s/2\\_.*X") + screen:expect([[ + 1 {12:2 3} | + {12:A B C} | + {12:4 5 6} | + {12:X} Y Z | + 7 8 9 | + {11:[No Name] [+] }| + |1| 1 {12:2 3} | + |2|{12: A B C} | + |3|{12: 4 5 6} | + |4|{12: X} Y Z | + {15:~ }| + {15:~ }| + {15:~ }| + {10:[Preview] }| + :%s/2\_.*X^ | + ]]) + + feed("/MMM") + screen:expect([[ + 1 {12:MMM} Y Z | + 7 8 9 | + | + {15:~ }| + {15:~ }| + {11:[No Name] [+] }| + |1| 1 {12:MMM} Y Z | + {15:~ }| + {15:~ }| + {15:~ }| + {15:~ }| + {15:~ }| + {15:~ }| + {10:[Preview] }| + :%s/2\_.*X/MMM^ | + ]]) + + feed("\\rK\\rLLL") + screen:expect([[ + 1 {12:MMM} | + {12:K} | + {12:LLL} Y Z | + 7 8 9 | + | + {11:[No Name] [+] }| + |1| 1 {12:MMM} | + |2|{12: K} | + |3|{12: LLL} Y Z | + {15:~ }| + {15:~ }| + {15:~ }| + {15:~ }| + {10:[Preview] }| + :%s/2\_.*X/MMM\rK\rLLL^ | + ]]) + end) + + it(", inccommand=nosplit, highlights multiline substitutions", function() + common_setup(screen, "nosplit", multiline_text) + feed("gg") + + feed(":%s/2\\_.*X/MMM") + screen:expect([[ + 1 {12:MMM} Y Z | + 7 8 9 | + | + {15:~ }| + {15:~ }| + {15:~ }| + {15:~ }| + {15:~ }| + {15:~ }| + {15:~ }| + {15:~ }| + {15:~ }| + {15:~ }| + {15:~ }| + :%s/2\_.*X/MMM^ | + ]]) + + feed("\\rK\\rLLL") + screen:expect([[ + 1 {12:MMM} | + {12:K} | + {12:LLL} Y Z | + 7 8 9 | + | + {15:~ }| + {15:~ }| + {15:~ }| + {15:~ }| + {15:~ }| + {15:~ }| + {15:~ }| + {15:~ }| + {15:~ }| + :%s/2\_.*X/MMM\rK\rLLL^ | + ]]) + end) + + it(", inccommand=split, highlights multiple matches on a line", function() + common_setup(screen, "split", multimatch_text) + command("set gdefault") + feed("gg") + + feed(":%s/a/XLK") + screen:expect([[ + {12:XLK} bdc e{12:XLK}e {12:XLK} fgl lzi{12:XLK} r| + x | + | + {15:~ }| + {15:~ }| + {11:[No Name] [+] }| + |1| {12:XLK} bdc e{12:XLK}e {12:XLK} fgl lzi{12:X}| + {12:LK} r | + {15:~ }| + {15:~ }| + {15:~ }| + {15:~ }| + {15:~ }| + {10:[Preview] }| + :%s/a/XLK^ | + ]]) + end) + + it(", inccommand=nosplit, highlights multiple matches on a line", function() + common_setup(screen, "nosplit", multimatch_text) + command("set gdefault") + feed("gg") + + feed(":%s/a/XLK") + screen:expect([[ + {12:XLK} bdc e{12:XLK}e {12:XLK} fgl lzi{12:XLK} r| + x | + | + {15:~ }| + {15:~ }| + {15:~ }| + {15:~ }| + {15:~ }| + {15:~ }| + {15:~ }| + {15:~ }| + {15:~ }| + {15:~ }| + {15:~ }| + :%s/a/XLK^ | + ]]) + end) + + it(", inccommand=split, with \\zs", function() + common_setup(screen, "split", multiline_text) + feed("gg") + + feed(":%s/[0-9]\\n\\zs[A-Z]/OKO") + screen:expect([[ + 1 2 3 | + {12:OKO} B C | + 4 5 6 | + {12:OKO} Y Z | + 7 8 9 | + {11:[No Name] [+] }| + |1| 1 2 3 | + |2| {12:OKO} B C | + |3| 4 5 6 | + |4| {12:OKO} Y Z | + {15:~ }| + {15:~ }| + {15:~ }| + {10:[Preview] }| + :%s/[0-9]\n\zs[A-Z]/OKO^ | + ]]) + end) + + it(", inccommand=nosplit, with \\zs", function() + common_setup(screen, "nosplit", multiline_text) + feed("gg") + + feed(":%s/[0-9]\\n\\zs[A-Z]/OKO") + screen:expect([[ + 1 2 3 | + {12:OKO} B C | + 4 5 6 | + {12:OKO} Y Z | + 7 8 9 | + | + {15:~ }| + {15:~ }| + {15:~ }| + {15:~ }| + {15:~ }| + {15:~ }| + {15:~ }| + {15:~ }| + :%s/[0-9]\n\zs[A-Z]/OKO^ | + ]]) + end) + + it(", inccommand=split, substitutions of different length", + function() + common_setup(screen, "split", "T T123 T2T TTT T090804\nx") + + feed(":%s/T\\([0-9]\\+\\)/\\1\\1/g") + screen:expect([[ + T {12:123123} {12:22}T TTT {12:090804090804} | + x | + {15:~ }| + {15:~ }| + {15:~ }| + {11:[No Name] [+] }| + |1| T {12:123123} {12:22}T TTT {12:090804090}| + {12:804} | + {15:~ }| + {15:~ }| + {15:~ }| + {15:~ }| + {15:~ }| + {10:[Preview] }| + :%s/T\([0-9]\+\)/\1\1/g^ | + ]]) + end) + + it(", inccommand=nosplit, substitutions of different length", function() + common_setup(screen, "nosplit", "T T123 T2T TTT T090804\nx") + + feed(":%s/T\\([0-9]\\+\\)/\\1\\1/g") + screen:expect([[ + T {12:123123} {12:22}T TTT {12:090804090804} | + x | + {15:~ }| + {15:~ }| + {15:~ }| + {15:~ }| + {15:~ }| + {15:~ }| + {15:~ }| + {15:~ }| + {15:~ }| + {15:~ }| + {15:~ }| + {15:~ }| + :%s/T\([0-9]\+\)/\1\1/g^ | + ]]) + end) + + it(", inccommand=split, contraction of lines", function() + local text = [[ + T T123 T T123 T2T TT T23423424 + x + afa Q + adf la;lkd R + alx + ]] + + common_setup(screen, "split", text) + feed(":%s/[QR]\\n") + screen:expect([[ + afa {12:Q} | + adf la;lkd {12:R} | + alx | + | + {15:~ }| + {11:[No Name] [+] }| + |3| afa {12:Q} | + |4|{12: }adf la;lkd {12:R} | + |5|{12: }alx | + {15:~ }| + {15:~ }| + {15:~ }| + {15:~ }| + {10:[Preview] }| + :%s/[QR]\n^ | + ]]) + + feed("/KKK") + screen:expect([[ + x | + afa {12:KKK}adf la;lkd {12:KKK}alx | + | + {15:~ }| + {15:~ }| + {11:[No Name] [+] }| + |3| afa {12:KKK}adf la;lkd {12:KKK}alx | + {15:~ }| + {15:~ }| + {15:~ }| + {15:~ }| + {15:~ }| + {15:~ }| + {10:[Preview] }| + :%s/[QR]\n/KKK^ | + ]]) + end) + + it(", inccommand=nosplit, contraction of lines", function() + local text = [[ + T T123 T T123 T2T TT T23423424 + x + afa Q + adf la;lkd R + alx + ]] + + common_setup(screen, "nosplit", text) + feed(":%s/[QR]\\n/KKK") + screen:expect([[ + T T123 T T123 T2T TT T23423424| + x | + afa {12:KKK}adf la;lkd {12:KKK}alx | + | + {15:~ }| + {15:~ }| + {15:~ }| + {15:~ }| + {15:~ }| + {15:~ }| + {15:~ }| + {15:~ }| + {15:~ }| + {15:~ }| + :%s/[QR]\n/KKK^ | + ]]) + end) + + it(", inccommand=split, multibyte text", function() + common_setup(screen, "split", multibyte_text) + feed(":%s/£.*ѫ/X¥¥") + screen:expect([[ + {12:X¥¥} | + a{12:X¥¥}¥KOL | + £ ¥ libm | + £ ¥ | + | + {11:[No Name] [+] }| + |1| {12:X¥¥} PEPPERS | + |2| {12:X¥¥} | + |3| a{12:X¥¥}¥KOL | + {15:~ }| + {15:~ }| + {15:~ }| + {15:~ }| + {10:[Preview] }| + :%s/£.*ѫ/X¥¥^ | + ]]) + + feed("\\ra££ ¥") + screen:expect([[ + {12:a££ ¥} | + a{12:X¥¥} | + {12:a££ ¥}¥KOL | + £ ¥ libm | + £ ¥ | + {11:[No Name] [+] }| + |1| {12:X¥¥} | + |2|{12: a££ ¥} PEPPERS | + |3| {12:X¥¥} | + |4|{12: a££ ¥} | + |5| a{12:X¥¥} | + |6|{12: a££ ¥}¥KOL | + {15:~ }| + {10:[Preview] }| + :%s/£.*ѫ/X¥¥\ra££ ¥^ | + ]]) + end) + + it(", inccommand=nosplit, multibyte text", function() + common_setup(screen, "nosplit", multibyte_text) + feed(":%s/£.*ѫ/X¥¥") + screen:expect([[ + {12:X¥¥} PEPPERS | + {12:X¥¥} | + a{12:X¥¥}¥KOL | + £ ¥ libm | + £ ¥ | + | + {15:~ }| + {15:~ }| + {15:~ }| + {15:~ }| + {15:~ }| + {15:~ }| + {15:~ }| + {15:~ }| + :%s/£.*ѫ/X¥¥^ | + ]]) + + feed("\\ra££ ¥") + screen:expect([[ + {12:X¥¥} | + {12:a££ ¥} PEPPERS | + {12:X¥¥} | + {12:a££ ¥} | + a{12:X¥¥} | + {12:a££ ¥}¥KOL | + £ ¥ libm | + £ ¥ | + | + {15:~ }| + {15:~ }| + {15:~ }| + {15:~ }| + {15:~ }| + :%s/£.*ѫ/X¥¥\ra££ ¥^ | + ]]) + end) + + it(", inccommand=split, small cmdwinheight", function() + common_setup(screen, "split", long_multiline_text) + command("set cmdwinheight=2") + + feed(":%s/[a-z]") + screen:expect([[ + X Y Z | + 7 8 9 | + K L M | + {12:a} b c | + {12:d} e f | + {12:q} r s | + {12:x} y z | + £ {12:m} n | + {12:t} œ ¥ | + | + {11:[No Name] [+] }| + | 7| {12:a} b c | + | 8| {12:d} e f | + {10:[Preview] }| + :%s/[a-z]^ | + ]]) + + feed("/JLKR £") + screen:expect([[ + X Y Z | + 7 8 9 | + K L M | + {12:JLKR £} b c | + {12:JLKR £} e f | + {12:JLKR £} r s | + {12:JLKR £} y z | + £ {12:JLKR £} n | + {12:JLKR £} œ ¥ | + | + {11:[No Name] [+] }| + | 7| {12:JLKR £} b c | + | 8| {12:JLKR £} e f | + {10:[Preview] }| + :%s/[a-z]/JLKR £^ | + ]]) + + feed("\\rѫ ab \\rXXXX") + screen:expect([[ + 7 8 9 | + K L M | + {12:JLKR £} | + {12:ѫ ab } | + {12:XXXX} b c | + {12:JLKR £} | + {12:ѫ ab } | + {12:XXXX} e f | + {12:JLKR £} | + {11:[No Name] [+] }| + | 7| {12:JLKR £} | + | 8|{12: ѫ ab } | + {10:[Preview] }| + :%s/[a-z]/JLKR £\rѫ ab \rXXX| + X^ | + ]]) + end) + + it(", inccommand=split, large cmdwinheight", function() + common_setup(screen, "split", long_multiline_text) + command("set cmdwinheight=11") + + feed(":%s/. .$") + screen:expect([[ + t {12:œ ¥} | + {11:[No Name] [+] }| + | 1| 1 {12:2 3} | + | 2| A {12:B C} | + | 3| 4 {12:5 6} | + | 4| X {12:Y Z} | + | 5| 7 {12:8 9} | + | 6| K {12:L M} | + | 7| a {12:b c} | + | 8| d {12:e f} | + | 9| q {12:r s} | + |10| x {12:y z} | + |11| £ {12:m n} | + {10:[Preview] }| + :%s/. .$^ | + ]]) + + feed("/ YYY") + screen:expect([[ + t {12: YYY} | + {11:[No Name] [+] }| + | 1| 1 {12: YYY} | + | 2| A {12: YYY} | + | 3| 4 {12: YYY} | + | 4| X {12: YYY} | + | 5| 7 {12: YYY} | + | 6| K {12: YYY} | + | 7| a {12: YYY} | + | 8| d {12: YYY} | + | 9| q {12: YYY} | + |10| x {12: YYY} | + |11| £ {12: YYY} | + {10:[Preview] }| + :%s/. .$/ YYY^ | + ]]) + + feed("\\r KKK") + screen:expect([[ + a {12: YYY} | + {11:[No Name] [+] }| + | 1| 1 {12: YYY} | + | 2|{12: KKK} | + | 3| A {12: YYY} | + | 4|{12: KKK} | + | 5| 4 {12: YYY} | + | 6|{12: KKK} | + | 7| X {12: YYY} | + | 8|{12: KKK} | + | 9| 7 {12: YYY} | + |10|{12: KKK} | + |11| K {12: YYY} | + {10:[Preview] }| + :%s/. .$/ YYY\r KKK^ | + ]]) + end) + + it(", inccommand=split, lookaround", function() + common_setup(screen, "split", "something\neverything\nsomeone") + feed([[:%s/\(some\)\@<lt>=thing/one/]]) + screen:expect([[ + some{12:one} | + everything | + someone | + {15:~ }| + {15:~ }| + {11:[No Name] [+] }| + |1| some{12:one} | + {15:~ }| + {15:~ }| + {15:~ }| + {15:~ }| + {15:~ }| + {15:~ }| + {10:[Preview] }| + :%s/\(some\)\@<=thing/one/^ | + ]]) + + feed("<C-c>") + wait() + feed([[:%s/\(some\)\@<lt>!thing/one/]]) + screen:expect([[ + something | + every{12:one} | + someone | + {15:~ }| + {15:~ }| + {11:[No Name] [+] }| + |2| every{12:one} | + {15:~ }| + {15:~ }| + {15:~ }| + {15:~ }| + {15:~ }| + {15:~ }| + {10:[Preview] }| + :%s/\(some\)\@<!thing/one/^ | + ]]) + + feed([[<C-c>]]) + wait() + feed([[:%s/some\(thing\)\@=/every/]]) + screen:expect([[ + {12:every}thing | + everything | + someone | + {15:~ }| + {15:~ }| + {11:[No Name] [+] }| + |1| {12:every}thing | + {15:~ }| + {15:~ }| + {15:~ }| + {15:~ }| + {15:~ }| + {15:~ }| + {10:[Preview] }| + :%s/some\(thing\)\@=/every/^ | + ]]) + + feed([[<C-c>]]) + wait() + feed([[:%s/some\(thing\)\@!/every/]]) + screen:expect([[ + everything | + {12:every}one | + {15:~ }| + {15:~ }| + {15:~ }| + {11:[No Name] [+] }| + |3| {12:every}one | + {15:~ }| + {15:~ }| + {15:~ }| + {15:~ }| + {15:~ }| + {15:~ }| + {10:[Preview] }| + :%s/some\(thing\)\@!/every/^ | + ]]) + end) end) diff --git a/test/functional/ui/tabline_spec.lua b/test/functional/ui/tabline_spec.lua index 56331a33b5..e8271de0bf 100644 --- a/test/functional/ui/tabline_spec.lua +++ b/test/functional/ui/tabline_spec.lua @@ -2,7 +2,7 @@ local helpers = require('test.functional.helpers')(after_each) local Screen = require('test.functional.ui.screen') local clear, command, eq = helpers.clear, helpers.command, helpers.eq -describe('ui/tabline', function() +describe('ui/ext_tabline', function() local screen local event_tabs, event_curtab @@ -21,37 +21,34 @@ describe('ui/tabline', function() screen:detach() end) - describe('externalized', function() - it('publishes UI events', function() - command("tabedit another-tab") + it('publishes UI events', function() + command("tabedit another-tab") - local expected_tabs = { - {tab = { id = 1 }, name = '[No Name]'}, - {tab = { id = 2 }, name = 'another-tab'}, - } - screen:expect([[ - ^ | - ~ | - ~ | - ~ | - | - ]], nil, nil, function() - eq({ id = 2 }, event_curtab) - eq(expected_tabs, event_tabs) - end) - - command("tabNext") - screen:expect([[ - ^ | - ~ | - ~ | - ~ | - | - ]], nil, nil, function() - eq({ id = 1 }, event_curtab) - eq(expected_tabs, event_tabs) - end) + local expected_tabs = { + {tab = { id = 1 }, name = '[No Name]'}, + {tab = { id = 2 }, name = 'another-tab'}, + } + screen:expect([[ + ^ | + ~ | + ~ | + ~ | + | + ]], nil, nil, function() + eq({ id = 2 }, event_curtab) + eq(expected_tabs, event_tabs) + end) + command("tabNext") + screen:expect([[ + ^ | + ~ | + ~ | + ~ | + | + ]], nil, nil, function() + eq({ id = 1 }, event_curtab) + eq(expected_tabs, event_tabs) end) end) end) diff --git a/test/functional/ui/wildmode_spec.lua b/test/functional/ui/wildmode_spec.lua index 41a751c284..042969357e 100644 --- a/test/functional/ui/wildmode_spec.lua +++ b/test/functional/ui/wildmode_spec.lua @@ -179,3 +179,100 @@ describe('command line completion', function() ]]) end) end) + +describe('ui/ext_wildmenu', function() + local screen + local items, selected = nil, nil + + before_each(function() + clear() + screen = Screen.new(25, 5) + screen:attach({rgb=true, ext_wildmenu=true}) + screen:set_on_event_handler(function(name, data) + if name == "wildmenu_show" then + items = data[1] + elseif name == "wildmenu_select" then + selected = data[1] + elseif name == "wildmenu_hide" then + items, selected = nil, nil + end + end) + end) + + after_each(function() + screen:detach() + end) + + it('works with :sign <tab>', function() + local expected = { + 'define', + 'jump', + 'list', + 'place', + 'undefine', + 'unplace', + } + + command('set wildmode=full') + command('set wildmenu') + feed(':sign <tab>') + screen:expect([[ + | + ~ | + ~ | + ~ | + :sign define^ | + ]], nil, nil, function() + eq(expected, items) + eq(0, selected) + end) + + feed('<tab>') + screen:expect([[ + | + ~ | + ~ | + ~ | + :sign jump^ | + ]], nil, nil, function() + eq(expected, items) + eq(1, selected) + end) + + feed('<left><left>') + screen:expect([[ + | + ~ | + ~ | + ~ | + :sign ^ | + ]], nil, nil, function() + eq(expected, items) + eq(-1, selected) + end) + + feed('<right>') + screen:expect([[ + | + ~ | + ~ | + ~ | + :sign define^ | + ]], nil, nil, function() + eq(expected, items) + eq(0, selected) + end) + + feed('a') + screen:expect([[ + | + ~ | + ~ | + ~ | + :sign definea^ | + ]], nil, nil, function() + eq(nil, items) + eq(nil, selected) + end) + end) +end) diff --git a/test/functional/viml/completion_spec.lua b/test/functional/viml/completion_spec.lua index 0e5278345c..b70ef724b7 100644 --- a/test/functional/viml/completion_spec.lua +++ b/test/functional/viml/completion_spec.lua @@ -868,7 +868,7 @@ describe('completion', function() end) end) -describe('ui/externalized/popupmenu', function() +describe('ui/ext_popupmenu', function() local screen local items, selected, anchor before_each(function() diff --git a/third-party/CMakeLists.txt b/third-party/CMakeLists.txt index ed2e7d02bb..ab9ff1f60d 100644 --- a/third-party/CMakeLists.txt +++ b/third-party/CMakeLists.txt @@ -130,8 +130,8 @@ set(GPERF_SHA256 588546b945bba4b70b6a3a616e80b4ab466e3f33024a352fc2198112cdbb3ae set(WINTOOLS_URL https://github.com/neovim/deps/raw/2f9acbecf06365c10baa3c0087f34a54c9c6f949/opt/win32tools.zip) set(WINTOOLS_SHA256 8bfce7e3a365721a027ce842f2ec1cf878f1726233c215c05964aac07300798c) -set(WINGUI_URL https://github.com/equalsraf/neovim-qt/releases/download/v0.2.7/neovim-qt.zip) -set(WINGUI_SHA256 b548f6e4045f16a10163b0e433f05b115b2f877cb47c4eacbf80eaad1a8429ab) +set(WINGUI_URL https://github.com/equalsraf/neovim-qt/releases/download/v0.2.8/neovim-qt.zip) +set(WINGUI_SHA256 260efc686423e2529360b6a45c8e241fbbf276c8de6b04d44f45ab5b6fe8df8f) set(WIN32YANK_X86_URL https://github.com/equalsraf/win32yank/releases/download/v0.0.4/win32yank-x86.zip) set(WIN32YANK_X86_SHA256 62f34e5a46c5d4a7b3f3b512e1ff7b77fedd432f42581cbe825233a996eed62c) |