aboutsummaryrefslogtreecommitdiff
path: root/runtime
diff options
context:
space:
mode:
Diffstat (limited to 'runtime')
-rw-r--r--runtime/CMakeLists.txt19
-rw-r--r--runtime/autoload/provider/clipboard.vim2
-rw-r--r--runtime/doc/eval.txt60
-rw-r--r--runtime/doc/if_pyth.txt54
-rw-r--r--runtime/doc/index.txt4
-rw-r--r--runtime/doc/options.txt24
-rw-r--r--runtime/doc/quickref.txt1
-rw-r--r--runtime/doc/ui.txt74
-rw-r--r--runtime/doc/vim_diff.txt3
-rw-r--r--runtime/optwin.vim6
10 files changed, 197 insertions, 50 deletions
diff --git a/runtime/CMakeLists.txt b/runtime/CMakeLists.txt
index ad706af087..d66e04f5f2 100644
--- a/runtime/CMakeLists.txt
+++ b/runtime/CMakeLists.txt
@@ -29,21 +29,16 @@ foreach(PACKAGE ${PACKAGES})
file(GLOB "${PACKNAME}_DOC_FILES" ${PACKAGE}/doc/*.txt)
if(${PACKNAME}_DOC_FILES)
file(MAKE_DIRECTORY ${GENERATED_PACKAGE_DIR}/${PACKNAME})
- add_custom_target("${PACKNAME}-tags"
+ add_custom_command(OUTPUT "${GENERATED_PACKAGE_DIR}/${PACKNAME}/doc/tags"
COMMAND ${CMAKE_COMMAND} -E copy_directory
${PACKAGE} ${GENERATED_PACKAGE_DIR}/${PACKNAME}
COMMAND "${PROJECT_BINARY_DIR}/bin/nvim"
-u NONE -i NONE -e --headless -c "helptags doc" -c quit
DEPENDS
nvim
+ nvim_runtime_deps
WORKING_DIRECTORY "${GENERATED_PACKAGE_DIR}/${PACKNAME}"
)
- add_dependencies(${PACKNAME}-tags nvim_runtime_deps)
-
- add_custom_command(OUTPUT "${GENERATED_PACKAGE_DIR}/${PACKNAME}/doc/tags"
- DEPENDS
- "${PACKNAME}-tags"
- )
set("${PACKNAME}_DOC_NAMES")
foreach(DF "${${PACKNAME}_DOC_FILES}")
@@ -67,7 +62,7 @@ foreach(DF ${DOCFILES})
list(APPEND BUILDDOCFILES ${GENERATED_RUNTIME_DIR}/doc/${F})
endforeach()
-add_custom_target(helptags
+add_custom_command(OUTPUT ${GENERATED_HELP_TAGS}
COMMAND ${CMAKE_COMMAND} -E remove doc/*
COMMAND ${CMAKE_COMMAND} -E copy_directory
${PROJECT_SOURCE_DIR}/runtime/doc doc
@@ -75,19 +70,15 @@ add_custom_target(helptags
-u NONE -i NONE -e --headless -c "helptags ++t doc" -c quit
DEPENDS
nvim
+ nvim_runtime_deps
WORKING_DIRECTORY "${GENERATED_RUNTIME_DIR}"
)
-add_dependencies(helptags nvim_runtime_deps)
-add_custom_command(OUTPUT ${GENERATED_HELP_TAGS}
- DEPENDS
- helptags
-)
add_custom_target(doc_html
COMMAND make html
DEPENDS
- helptags
+ ${GENERATED_HELP_TAGS}
WORKING_DIRECTORY "${GENERATED_RUNTIME_DIR}/doc"
)
diff --git a/runtime/autoload/provider/clipboard.vim b/runtime/autoload/provider/clipboard.vim
index fd32e03666..2fb9d74d8d 100644
--- a/runtime/autoload/provider/clipboard.vim
+++ b/runtime/autoload/provider/clipboard.vim
@@ -65,7 +65,7 @@ function! provider#clipboard#Executable() abort
let s:paste = get(g:clipboard, 'paste', { '+': v:null, '*': v:null })
let s:cache_enabled = get(g:clipboard, 'cache_enabled', 0)
return get(g:clipboard, 'name', 'g:clipboard')
- elseif has('mac') && executable('pbpaste') && s:cmd_ok('pbpaste')
+ elseif has('mac')
let s:copy['+'] = 'pbcopy'
let s:paste['+'] = 'pbpaste'
let s:copy['*'] = s:copy['+']
diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt
index e9579d5c86..425dcede8b 100644
--- a/runtime/doc/eval.txt
+++ b/runtime/doc/eval.txt
@@ -2209,6 +2209,7 @@ printf({fmt}, {expr1}...) String format text
pumvisible() Number whether popup menu is visible
pyeval({expr}) any evaluate |Python| expression
py3eval({expr}) any evaluate |python3| expression
+pyxeval({expr}) any evaluate |python_x| expression
range({expr} [, {max} [, {stride}]])
List items from {expr} to {max}
readfile({fname} [, {binary} [, {max}]])
@@ -5740,29 +5741,35 @@ mode([expr]) Return a string that indicates the current mode.
a non-empty String (|non-zero-arg|), then the full mode is
returned, otherwise only the first letter is returned.
- n Normal
- no Operator-pending
- v Visual by character
- V Visual by line
- CTRL-V Visual blockwise
- s Select by character
- S Select by line
- CTRL-S Select blockwise
- i Insert
- ic Insert mode completion |compl-generic|
- ix Insert mode |i_CTRL-X| completion
- R Replace |R|
- Rc Replace mode completion |compl-generic|
- Rv Virtual Replace |gR|
- Rx Replace mode |i_CTRL-X| completion
- c Command-line editing
- cv Vim Ex mode |gQ|
- ce Normal Ex mode |Q|
- r Hit-enter prompt
- rm The -- more -- prompt
- r? A |:confirm| query of some sort
- ! Shell or external command is executing
- t Terminal mode: keys go to the job
+ n Normal
+ no Operator-pending
+ nov Operator-pending (forced characterwise |o_v|)
+ noV Operator-pending (forced linewise |o_V|)
+ noCTRL-V Operator-pending (forced blockwise |o_CTRL-V|)
+ niI Normal using |i_CTRL-O| in |Insert-mode|
+ niR Normal using |i_CTRL-O| in |Replace-mode|
+ niV Normal using |i_CTRL-O| in |Virtual-Replace-mode|
+ v Visual by character
+ V Visual by line
+ CTRL-V Visual blockwise
+ s Select by character
+ S Select by line
+ CTRL-S Select blockwise
+ i Insert
+ ic Insert mode completion |compl-generic|
+ ix Insert mode |i_CTRL-X| completion
+ R Replace |R|
+ Rc Replace mode completion |compl-generic|
+ Rv Virtual Replace |gR|
+ Rx Replace mode |i_CTRL-X| completion
+ c Command-line editing
+ cv Vim Ex mode |gQ|
+ ce Normal Ex mode |Q|
+ r Hit-enter prompt
+ rm The -- more -- prompt
+ r? |:confirm| query of some sort
+ ! Shell or external command is executing
+ t Terminal mode: keys go to the job
This is useful in the 'statusline' option or when used
with |remote_expr()| In most other places it always returns
"c" or "n".
@@ -6146,6 +6153,12 @@ pyeval({expr}) *pyeval()*
non-string keys result in error.
{only available when compiled with the |+python| feature}
+pyxeval({expr}) *pyxeval()*
+ Evaluate Python expression {expr} and return its result
+ converted to Vim data structures.
+ Uses Python 2 or 3, see |python_x| and 'pyxversion'.
+ See also: |pyeval()|, |py3eval()|
+
*E726* *E727*
range({expr} [, {max} [, {stride}]]) *range()*
Returns a |List| with Numbers:
@@ -8517,6 +8530,7 @@ printer Compiled with |:hardcopy| support.
profile Compiled with |:profile| support.
python Legacy Vim Python 2.x API is available. |has-python|
python3 Legacy Vim Python 3.x API is available. |has-python|
+pythonx Compiled with |python_x| interface. |has-pythonx|
quickfix Compiled with |quickfix| support.
reltime Compiled with |reltime()| support.
rightleft Compiled with 'rightleft' support.
diff --git a/runtime/doc/if_pyth.txt b/runtime/doc/if_pyth.txt
index 2da2e5147b..df4b54ef76 100644
--- a/runtime/doc/if_pyth.txt
+++ b/runtime/doc/if_pyth.txt
@@ -692,6 +692,7 @@ vim.Function object *python-Function*
To facilitate bi-directional interface, you can use |pyeval()| and |py3eval()|
functions to evaluate Python expressions and pass their values to Vim script.
+|pyxeval()| is also available.
==============================================================================
9. Python 3 *python3*
@@ -723,4 +724,57 @@ You can test what Python version is available with: >
endif
==============================================================================
+10. Python X *python_x* *pythonx*
+
+Because most python code can be written so that it works with Python 2.6+ and
+Python 3, the pyx* functions and commands have been written. They work the
+same as the Python 2 and 3 variants, but select the Python version using the
+'pyxversion' setting.
+
+Set 'pyxversion' in your |vimrc| to prefer Python 2 or Python 3 for Python
+commands. Changing this setting at runtime risks losing the state of plugins
+(such as initialization).
+
+If you want to use a module, you can put it in the {rtp}/pythonx directory.
+See |pythonx-directory|.
+
+ *:pyx* *:pythonx*
+`:pyx` and `:pythonx` work similar to `:python`. To check if `:pyx` works: >
+ :pyx print("Hello")
+
+To see what version of Python is being used: >
+ :pyx import sys
+ :pyx print(sys.version)
+<
+ *:pyxfile* *python_x-special-comments*
+`:pyxfile` works similar to `:pyfile`. But you can add a "shebang" comment to
+force Vim to use `:pyfile` or `:py3file`: >
+ #!/any string/python2 " Shebang. Must be the first line of the file.
+ #!/any string/python3 " Shebang. Must be the first line of the file.
+ # requires python 2.x " Maximum lines depend on 'modelines'.
+ # requires python 3.x " Maximum lines depend on 'modelines'.
+Unlike normal modelines, the bottom of the file is not checked.
+If none of them are found, the 'pyxversion' option is used.
+ *W20* *W21*
+If Vim does not support the selected Python version a silent message will be
+printed. Use `:messages` to read them.
+
+ *:pyxdo*
+`:pyxdo` works similar to `:pydo`.
+
+ *has-pythonx*
+To check if pyx* functions and commands are available: >
+ if has('pythonx')
+ echo 'pyx* commands are available. (Python ' . &pyx . ')'
+ endif
+
+If you prefer Python 2 and want to fallback to Python 3, set 'pyxversion'
+explicitly in your |.vimrc|. Example: >
+ if has('python')
+ set pyx=2
+ elseif has('python3')
+ set pyx=3
+ endif
+
+==============================================================================
vim:tw=78:ts=8:noet:ft=help:norl:
diff --git a/runtime/doc/index.txt b/runtime/doc/index.txt
index 7024a57333..63ded3152f 100644
--- a/runtime/doc/index.txt
+++ b/runtime/doc/index.txt
@@ -1418,6 +1418,10 @@ tag command action ~
|:python| :py[thon] execute Python command
|:pydo| :pyd[o] execute Python command for each line
|:pyfile| :pyf[ile] execute Python script file
+|:pyx| :pyx execute |python_x| command
+|:pythonx| :pythonx same as :pyx
+|:pyxdo| :pyxd[o] execute |python_x| command for each line
+|:pyxfile| :pyxf[ile] execute |python_x| script file
|:quit| :q[uit] quit current window (when one window quit Vim)
|:quitall| :quita[ll] quit Vim
|:qall| :qa[ll] quit Vim
diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt
index 534b2025cd..bcefa1f56b 100644
--- a/runtime/doc/options.txt
+++ b/runtime/doc/options.txt
@@ -4471,6 +4471,30 @@ A jump table for the options with a short description can be found at |Q_op|.
Insert mode completion. When zero as much space as available is used.
|ins-completion-menu|.
+ *'pyxversion'* *'pyx'*
+'pyxversion' 'pyx' number (default depends on the build)
+ global
+ Specifies the python version used for pyx* functions and commands
+ |python_x|. The default value is as follows:
+
+ |provider| installed Default ~
+ |+python| and |+python3| 0
+ only |+python| 2
+ only |+python3| 3
+
+ Available values are 0, 2 and 3.
+ If 'pyxversion' is 0, it is set to 2 or 3 after the first execution of
+ any python2/3 commands or functions. E.g. `:py` sets to 2, and `:py3`
+ sets to 3. `:pyx` sets it to 3 if Python 3 is available, otherwise sets
+ to 2 if Python 2 is available.
+ See also: |has-pythonx|
+
+ If only |+python| or |+python3| are available,
+ 'pyxversion' has no effect. The pyx* functions and commands are
+ always the same as the installed version.
+
+ This option cannot be set from a |modeline| or in the |sandbox|, for
+ security reasons.
*'quoteescape'* *'qe'*
'quoteescape' 'qe' string (default "\")
diff --git a/runtime/doc/quickref.txt b/runtime/doc/quickref.txt
index cf0efd7a75..98a5244345 100644
--- a/runtime/doc/quickref.txt
+++ b/runtime/doc/quickref.txt
@@ -813,6 +813,7 @@ Short explanation of each option: *option-list*
'pumwidth' 'pw' minimum width of the popup menu
'pythondll' name of the Python 2 dynamic library
'pythonthreedll' name of the Python 3 dynamic library
+'pyxversion' 'pyx' Python version used for pyx* commands
'quoteescape' 'qe' escape characters used in a string
'readonly' 'ro' disallow writing the buffer
'redrawtime' 'rdt' timeout for 'hlsearch' and |:match| highlighting
diff --git a/runtime/doc/ui.txt b/runtime/doc/ui.txt
index c021f236c8..9acd8b2c5a 100644
--- a/runtime/doc/ui.txt
+++ b/runtime/doc/ui.txt
@@ -12,9 +12,10 @@ Nvim UI protocol *ui*
UI Events *ui-events*
GUIs can be implemented as external processes communicating with Nvim over the
-RPC API. The UI model consists of a terminal-like grid with a single,
-monospace font size. Some elements (UI "widgets") can be drawn separately from
-the grid ("externalized").
+RPC API. The default UI model consists of a terminal-like grid with a single,
+monospace font size. The UI can opt-in to have windows drawn on separate
+grids, as well as to have some elements (UI "widgets") be drawn by the UI
+itself rather than by nvim ("externalized").
*ui-options*
@@ -32,6 +33,7 @@ a dictionary with these (optional) keys:
`ext_cmdline` Externalize the cmdline. |ui-cmdline|
`ext_wildmenu` Externalize the wildmenu. |ui-wildmenu|
`ext_linegrid` Use new revision of the grid events. |ui-linegrid|
+ `ext_multigrid` Use per-window grid based events. |ui-multigrid|
`ext_hlstate` Use detailed highlight state. |ui-hlstate|
Specifying a non-existent option is an error. UIs can check the |api-metadata|
@@ -46,7 +48,7 @@ Each update event is itself an array whose first element is the event name and
remaining elements are event-parameter tuples. This allows multiple events of
the same kind to be sent in a row without the event name being repeated. This
batching is mostly used for "grid_line", because each "grid_line" event puts
-contents in one screen line, but clients must be prepared for multiple argument
+contents in one grid line, but clients must be prepared for multiple argument
sets being batched for all event kinds.
Events must be handled in-order. A "flush" event is sent when nvim is done
@@ -61,10 +63,12 @@ By default, Nvim sends |ui-global| and |ui-grid-old| events; these suffice to
implement a terminal-like interface. However there are two revisions of the
grid part of the protocol. The newer revision |ui-linegrid|, enabled by
`ext_linegrid` option, has a more effecient representation of text (especially
-highlighted text), and room for futher enhancements that will use
-multiple grids. The older revision is available and used by default only for
-backwards compatibility reasons. New UIs are strongly recommended to use
-|ui-linegrid|, as further protocol extensions will require it.
+highlighted text), and allows extensions that use multiple grids.
+
+The older revision is available and used by default only for backwards
+compatibility reasons. New UIs are strongly recommended to use |ui-linegrid|,
+as further protocol extensions require it. The |ui-multigrid| extension
+enables |ui-linegrid| implicitly.
Nvim optionally sends screen elements "semantically" as structured events
instead of raw grid-lines, controlled by |ui-ext-options|. The UI must present
@@ -220,7 +224,8 @@ Most of these events take a `grid` index as first parameter. Grid 1 is the
global grid used by default for the entire editor screen state. Grids other
than that will be defined by future extensions. Just activating the
`ext_linegrid` option by itself will never cause any additional grids to be
-created.
+created. To enable per-window grids, `ext_multigrid` option should be set (see
+|ui-multigrid|).
Highlight attribute groups are predefined. UIs should maintain a table to map
numerical highlight `id`:s to the actual attributes.
@@ -476,18 +481,65 @@ highlight group is cleared, so `ui_name` can always be used to reliably identify
screen elements, even if no attributes have been applied.
==============================================================================
+Multigrid Events *ui-multigrid*
+
+Only sent if `ext_multigrid` option is set in |ui-options|. Enables the
+`ext_linegrid` extension implicitly.
+
+The multigrid extension gives the UIs more control over how windows are
+displayed. The UIs receive updates on a separate grid for each window. The UIs
+can set the grid size independently of how much space the window occupies on
+the global layout. This enables the UIs to set a different font size for each
+window if the UI so desires. The UI can also reserve space around the border
+of the window for its own elements, for instance scrollbars from the UI
+toolkit.
+
+By default, the grid size is handled by nvim and set to the outer grid size
+(i.e. the size of the window frame in nvim) whenever the split is created.
+Once a UI sets a grid size, nvim does not handle the size for that grid and
+the UI must change the grid size whenever the outer size is changed. To
+delegate the handling of grid size back to nvim, the UIs should request the
+size (0, 0).
+
+A window can be hidden and redisplayed without its grid being deallocated.
+This can happen multiple times for the same window, for instance when switching
+tabs.
+
+["win_pos", grid, win, start_row, start_col, width, height]
+ Set the position and size of the grid in nvim (i.e. the outer grid
+ size). If the window was previously hidden, it should now be shown
+ again.
+
+["win_hide", grid]
+ Stop displaying the window.
+
+["win_scroll_over_start"]
+ Hint that following `grid_scroll` on the default grid should
+ scroll over windows. This is a temporary workaround to allow
+ UIs to use the builtin message drawing. Later on, messages will be
+ drawn on a dedicated grid.
+
+["win_scroll_over_reset"]
+ Hint that scrolled over windows should be redrawn again, and not be
+ overdrawn by default grid scrolling anymore.
+
+See |ui-linegrid| for grid events.
+See |nvim_ui_try_resize_grid| in |api-ui| to request changing the grid size.
+
+==============================================================================
Popupmenu Events *ui-popupmenu*
Only sent if `ext_popupmenu` option is set in |ui-options|
-["popupmenu_show", items, selected, row, col]
+["popupmenu_show", items, selected, row, col, grid]
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.
+ completed word will be. When |ui-multigrid| is used, `grid` is the
+ grid for the anchor position.
["popupmenu_select", selected]
Select an item in the current popupmenu. `selected` is a zero-based
diff --git a/runtime/doc/vim_diff.txt b/runtime/doc/vim_diff.txt
index 3915763eed..db856ceb65 100644
--- a/runtime/doc/vim_diff.txt
+++ b/runtime/doc/vim_diff.txt
@@ -357,6 +357,9 @@ TUI:
and has a 'ttybuiltin' setting to control how that combination works. Nvim
uses one or the other, it does not attempt to merge the two.
+UI/Display:
+ |Visual| selection highlights the character at cursor. |visual-use|
+
VimL (Vim script) compatibility:
`count` does not alias to |v:count|
`errmsg` does not alias to |v:errmsg|
diff --git a/runtime/optwin.vim b/runtime/optwin.vim
index 1742c64c3e..2e9f4723dd 100644
--- a/runtime/optwin.vim
+++ b/runtime/optwin.vim
@@ -905,7 +905,7 @@ if has("folding")
call append("$", "foldmarker\tmarkers used when 'foldmethod' is \"marker\"")
call append("$", "\t(local to window)")
call <SID>OptionL("fmr")
- call append("$", "foldnestmax\tmaximum fold depth for when 'foldmethod is \"indent\" or \"syntax\"")
+ call append("$", "foldnestmax\tmaximum fold depth for when 'foldmethod' is \"indent\" or \"syntax\"")
call append("$", "\t(local to window)")
call <SID>OptionL("fdn")
endif
@@ -1295,6 +1295,10 @@ if exists("&mzschemedll")
call append("$", "mzschemegcdll\tname of the Tcl GC dynamic library")
call <SID>OptionG("mzschemegcdll", &mzschemegcdll)
endif
+if has('pythonx')
+ call append("$", "pyxversion\twhether to use Python 2 or 3")
+ call append("$", " \tset pyx=" . &wd)
+endif
" Install autocommands to enable mappings in option-window
noremap <silent> <buffer> <CR> <C-\><C-N>:call <SID>CR()<CR>