From d835c030f24a598ef02815dfd21dd40307f9a22c Mon Sep 17 00:00:00 2001 From: Paul Jolly Date: Fri, 28 Aug 2015 18:55:17 +0100 Subject: remote/define.vim: support remote function "range" --- runtime/autoload/remote/define.vim | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'runtime') diff --git a/runtime/autoload/remote/define.vim b/runtime/autoload/remote/define.vim index ca1def0941..dcf773d215 100644 --- a/runtime/autoload/remote/define.vim +++ b/runtime/autoload/remote/define.vim @@ -1,7 +1,7 @@ function! remote#define#CommandOnHost(host, method, sync, name, opts) let prefix = '' - if has_key(a:opts, 'range') + if has_key(a:opts, 'range') if a:opts.range == '' || a:opts.range == '%' " -range or -range=%, pass the line range in a list let prefix = ',' @@ -157,6 +157,9 @@ endfunction function! remote#define#FunctionOnChannel(channel, method, sync, name, opts) let rpcargs = [a:channel, '"'.a:method.'"', 'a:000'] + if has_key(a:opts, 'range') && a:opts.range != '0' + call add(rpcargs, '[a:firstline, a:lastline]') + endif call s:AddEval(rpcargs, a:opts) let function_def = s:GetFunctionPrefix(a:name, a:opts) @@ -187,7 +190,7 @@ let s:next_gid = 1 function! s:GetNextAutocmdGroup() let gid = s:next_gid let s:next_gid += 1 - + let group_name = 'RPC_DEFINE_AUTOCMD_GROUP_'.gid " Ensure the group is defined exe 'augroup '.group_name.' | augroup END' @@ -218,7 +221,11 @@ endfunction function! s:GetFunctionPrefix(name, opts) - return "function! ".a:name."(...)\n" + let res = "function! ".a:name."(...)" + if has_key(a:opts, 'range') && a:opts.range != '0' + let res = res." range" + endif + return res."\n" endfunction -- cgit From 4a200ceafa475f5c4a7dc576df97a12caedd3590 Mon Sep 17 00:00:00 2001 From: Case Nelson Date: Sun, 10 Apr 2016 00:20:57 -0600 Subject: test: remote/define.vim: range --- runtime/autoload/remote/define.vim | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'runtime') diff --git a/runtime/autoload/remote/define.vim b/runtime/autoload/remote/define.vim index dcf773d215..b04a5d2280 100644 --- a/runtime/autoload/remote/define.vim +++ b/runtime/autoload/remote/define.vim @@ -157,7 +157,7 @@ endfunction function! remote#define#FunctionOnChannel(channel, method, sync, name, opts) let rpcargs = [a:channel, '"'.a:method.'"', 'a:000'] - if has_key(a:opts, 'range') && a:opts.range != '0' + if has_key(a:opts, 'range') call add(rpcargs, '[a:firstline, a:lastline]') endif call s:AddEval(rpcargs, a:opts) @@ -222,7 +222,7 @@ endfunction function! s:GetFunctionPrefix(name, opts) let res = "function! ".a:name."(...)" - if has_key(a:opts, 'range') && a:opts.range != '0' + if has_key(a:opts, 'range') let res = res." range" endif return res."\n" -- cgit