diff options
Diffstat (limited to 'runtime')
| -rw-r--r-- | runtime/autoload/remote/host.vim | 83 | ||||
| -rw-r--r-- | runtime/doc/motion.txt | 3 | ||||
| -rw-r--r-- | runtime/doc/options.txt | 3 | ||||
| -rw-r--r-- | runtime/doc/vim_diff.txt | 1 | ||||
| -rw-r--r-- | runtime/plugin/gui_shim.vim | 8 | ||||
| -rw-r--r-- | runtime/plugin/rplugin.vim | 63 |
6 files changed, 68 insertions, 93 deletions
diff --git a/runtime/autoload/remote/host.vim b/runtime/autoload/remote/host.vim index 51f7e5886f..e695fb7df7 100644 --- a/runtime/autoload/remote/host.vim +++ b/runtime/autoload/remote/host.vim @@ -2,7 +2,6 @@ let s:hosts = {} let s:plugin_patterns = {} let s:plugins_for_host = {} - " Register a host by associating it with a factory(funcref) function! remote#host#Register(name, pattern, factory) abort let s:hosts[a:name] = {'factory': a:factory, 'channel': 0, 'initialized': 0} @@ -13,7 +12,6 @@ function! remote#host#Register(name, pattern, factory) abort endif endfunction - " Register a clone to an existing host. The new host will use the same factory " as `source`, but it will run as a different process. This can be used by " plugins that should run isolated from other plugins created for the same host @@ -31,12 +29,8 @@ function! remote#host#RegisterClone(name, orig_name) abort \ } endfunction - " Get a host channel, bootstrapping it if necessary function! remote#host#Require(name) abort - if empty(s:plugins_for_host) - call remote#host#LoadRemotePlugins() - endif if !has_key(s:hosts, a:name) throw 'No host named "'.a:name.'" is registered' endif @@ -52,7 +46,6 @@ function! remote#host#Require(name) abort return host.channel endfunction - function! remote#host#IsRunning(name) abort if !has_key(s:hosts, a:name) throw 'No host named "'.a:name.'" is registered' @@ -60,7 +53,6 @@ function! remote#host#IsRunning(name) abort return s:hosts[a:name].channel != 0 endfunction - " Example of registering a Python plugin with two commands (one async), one " autocmd (async) and one function (sync): " @@ -117,73 +109,6 @@ function! remote#host#RegisterPlugin(host, path, specs) abort call add(plugins, {'path': a:path, 'specs': a:specs}) endfunction - -" Get the path to the rplugin manifest file. -function! s:GetManifestPath() abort - let manifest_base = '' - - if exists('$NVIM_RPLUGIN_MANIFEST') - return fnamemodify($NVIM_RPLUGIN_MANIFEST, ':p') - endif - - let dest = has('win32') ? '$LOCALAPPDATA' : '$XDG_DATA_HOME' - if !exists(dest) - let dest = has('win32') ? '~/AppData/Local' : '~/.local/share' - endif - - let dest = fnamemodify(expand(dest), ':p') - if !empty(dest) && !filereadable(dest) - let dest .= ('/' ==# dest[-1:] ? '' : '/') . 'nvim' - call mkdir(dest, 'p', 0700) - let manifest_base = dest - endif - - return manifest_base.'/rplugin.vim' -endfunction - - -" Old manifest file based on known script locations. -function! s:GetOldManifestPath() abort - let prefix = exists('$MYVIMRC') - \ ? $MYVIMRC - \ : matchstr(get(split(execute('scriptnames'), '\n'), 0, ''), '\f\+$') - return fnamemodify(expand(prefix, 1), ':h') - \.'/.'.fnamemodify(prefix, ':t').'-rplugin~' -endfunction - - -function! s:GetManifest() abort - let manifest = s:GetManifestPath() - - if !filereadable(manifest) - " Check if an old manifest file exists and move it to the new location. - let old_manifest = s:GetOldManifestPath() - if filereadable(old_manifest) - call rename(old_manifest, manifest) - endif - endif - - return manifest -endfunction - - -function! remote#host#LoadRemotePlugins() abort - let manifest = s:GetManifest() - if filereadable(manifest) - execute 'source' fnameescape(manifest) - endif -endfunction - - -function! remote#host#LoadRemotePluginsEvent(event, pattern) abort - autocmd! nvim-rplugin - call remote#host#LoadRemotePlugins() - if exists('#'.a:event.'#'.a:pattern) " Avoid 'No matching autocommands'. - execute 'silent doautocmd <nomodeline>' a:event a:pattern - endif -endfunction - - function! s:RegistrationCommands(host) abort " Register a temporary host clone for discovering specs let host_id = a:host.'-registration-clone' @@ -228,7 +153,6 @@ function! s:RegistrationCommands(host) abort return lines endfunction - function! remote#host#UpdateRemotePlugins() abort let commands = [] let hosts = keys(s:hosts) @@ -245,12 +169,11 @@ function! remote#host#UpdateRemotePlugins() abort endtry endif endfor - call writefile(commands, s:GetManifest()) + call writefile(commands, g:loaded_remote_plugins) echomsg printf('remote/host: generated rplugin manifest: %s', - \ s:GetManifest()) + \ g:loaded_remote_plugins) endfunction - function! remote#host#PluginsForHost(host) abort if !has_key(s:plugins_for_host, a:host) let s:plugins_for_host[a:host] = [] @@ -258,7 +181,6 @@ function! remote#host#PluginsForHost(host) abort return s:plugins_for_host[a:host] endfunction - function! remote#host#LoadErrorForHost(host, log) abort return 'Failed to load '. a:host . ' host. '. \ 'You can try to see what happened by starting nvim with '. @@ -266,7 +188,6 @@ function! remote#host#LoadErrorForHost(host, log) abort \ ' Also, the host stderr is available in messages.' endfunction - " Registration of standard hosts " Python/Python3 diff --git a/runtime/doc/motion.txt b/runtime/doc/motion.txt index 606fd53fee..be3170cf92 100644 --- a/runtime/doc/motion.txt +++ b/runtime/doc/motion.txt @@ -401,8 +401,7 @@ a range of folded lines. "b" and "B" move to the start of the first word or WORD before the fold. Special case: "cw" and "cW" are treated like "ce" and "cE" if the cursor is -on a non-blank. This is because "cw" is interpreted as change-word, and a -word does not include the following white space. +on a non-blank. This is Vi-compatible, see |cpo-_| to change the behavior. Another special case: When using the "w" motion in combination with an operator and the last word moved over is at the end of a line, the end of diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt index 25dca5fb51..e28e4e59a8 100644 --- a/runtime/doc/options.txt +++ b/runtime/doc/options.txt @@ -1829,6 +1829,9 @@ A jump table for the options with a short description can be found at |Q_op|. character, the cursor won't move. When not included, the cursor would skip over it and jump to the following occurrence. + *cpo-_* + _ When using |cw| on a word, do not include the + whitespace following the word in the motion. *'cscopepathcomp'* *'cspc'* 'cscopepathcomp' 'cspc' number (default 0) diff --git a/runtime/doc/vim_diff.txt b/runtime/doc/vim_diff.txt index bcc5d03ff0..bea69eb924 100644 --- a/runtime/doc/vim_diff.txt +++ b/runtime/doc/vim_diff.txt @@ -108,6 +108,7 @@ Some `CTRL-SHIFT-...` key chords are distinguished from `CTRL-...` variants <C-Tab>, <C-S-Tab>, <C-BS>, <C-S-BS>, <C-Enter>, <C-S-Enter> Options: + 'cpoptions' flags: |cpo-_| 'inccommand' shows interactive results for |:substitute|-like commands 'statusline' supports unlimited alignment sections 'tabline' %@Func@foo%X can call any function on mouse-click diff --git a/runtime/plugin/gui_shim.vim b/runtime/plugin/gui_shim.vim index 28d82eb1c7..575b826b5e 100644 --- a/runtime/plugin/gui_shim.vim +++ b/runtime/plugin/gui_shim.vim @@ -4,6 +4,14 @@ if !has('win32') || !has('nvim') || exists('g:GuiLoaded') endif let g:GuiLoaded = 1 +" Close the GUI +function! GuiClose() abort + call rpcnotify(0, 'Gui', 'Close') +endfunction + +" Notify the GUI when exiting Neovim +autocmd VimLeave * call GuiClose() + " A replacement for foreground() function! GuiForeground() abort call rpcnotify(0, 'Gui', 'Foreground') diff --git a/runtime/plugin/rplugin.vim b/runtime/plugin/rplugin.vim index b4b03032b3..7d83668a30 100644 --- a/runtime/plugin/rplugin.vim +++ b/runtime/plugin/rplugin.vim @@ -1,16 +1,59 @@ if exists('g:loaded_remote_plugins') finish endif -let g:loaded_remote_plugins = 1 +let g:loaded_remote_plugins = '/path/to/manifest' + +" Get the path to the rplugin manifest file. +function! s:GetManifestPath() abort + let manifest_base = '' + + if exists('$NVIM_RPLUGIN_MANIFEST') + return fnamemodify($NVIM_RPLUGIN_MANIFEST, ':p') + endif + + let dest = has('win32') ? '$LOCALAPPDATA' : '$XDG_DATA_HOME' + if !exists(dest) + let dest = has('win32') ? '~/AppData/Local' : '~/.local/share' + endif + + let dest = fnamemodify(expand(dest), ':p') + if !empty(dest) && !filereadable(dest) + let dest .= ('/' ==# dest[-1:] ? '' : '/') . 'nvim' + call mkdir(dest, 'p', 0700) + let manifest_base = dest + endif + + return manifest_base.'/rplugin.vim' +endfunction + +" Old manifest file based on known script locations. +function! s:GetOldManifestPath() abort + let prefix = exists('$MYVIMRC') + \ ? $MYVIMRC + \ : matchstr(get(split(execute('scriptnames'), '\n'), 0, ''), '\f\+$') + return fnamemodify(expand(prefix, 1), ':h') + \.'/.'.fnamemodify(prefix, ':t').'-rplugin~' +endfunction + +function! s:GetManifest() abort + let manifest = s:GetManifestPath() + if !filereadable(manifest) + " Check if an old manifest file exists and move it to the new location. + let old_manifest = s:GetOldManifestPath() + if filereadable(old_manifest) + call rename(old_manifest, manifest) + endif + endif + return manifest +endfunction + +function! s:LoadRemotePlugins() abort + let g:loaded_remote_plugins = s:GetManifest() + if filereadable(g:loaded_remote_plugins) + execute 'source' fnameescape(g:loaded_remote_plugins) + endif +endfunction command! UpdateRemotePlugins call remote#host#UpdateRemotePlugins() -augroup nvim-rplugin - autocmd! - autocmd FuncUndefined * - \ call remote#host#LoadRemotePluginsEvent( - \ 'FuncUndefined', expand('<amatch>')) - autocmd CmdUndefined * - \ call remote#host#LoadRemotePluginsEvent( - \ 'CmdUndefined', expand('<amatch>')) -augroup END +call s:LoadRemotePlugins() |