From 7afad33753b6ca6d0ff4d98fbc0ab29b6692a7b7 Mon Sep 17 00:00:00 2001 From: Marco Hinz Date: Thu, 28 Mar 2019 14:57:52 +0100 Subject: [PATCH] Execute "sign place" with C lang Fixes https://github.com/mhinz/vim-signify/issues/293 --- autoload/sy/fold.vim | 7 +------ autoload/sy/sign.vim | 4 +--- autoload/sy/util.vim | 10 ++++++++++ 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/autoload/sy/fold.vim b/autoload/sy/fold.vim index bc5835c..e3afb97 100644 --- a/autoload/sy/fold.vim +++ b/autoload/sy/fold.vim @@ -88,12 +88,7 @@ endfunction " Function: s:get_lines {{{1 function! s:get_lines() abort - let lang = v:lang - language message C - redir => signlist - silent! execute 'sign place buffer='. b:sy.buffer - redir END - silent! execute 'language message' lang + let signlist = sy#util#execute('sign place buffer='. b:sy.buffer) let lines = [] for line in split(signlist, '\n')[2:] diff --git a/autoload/sy/sign.vim b/autoload/sy/sign.vim index 918a521..2bf6ec7 100644 --- a/autoload/sy/sign.vim +++ b/autoload/sy/sign.vim @@ -24,9 +24,7 @@ function! sy#sign#get_current_signs(sy) abort let a:sy.internal = {} let a:sy.external = {} - redir => signlist - silent! execute 'sign place buffer='. a:sy.buffer - redir END + let signlist = sy#util#execute('sign place buffer='. a:sy.buffer) for signline in split(signlist, '\n')[2:] let tokens = matchlist(signline, '\v^\s+\S+\=(\d+)\s+\S+\=(\d+)\s+\S+\=(.*)$') diff --git a/autoload/sy/util.vim b/autoload/sy/util.vim index 5e7e06d..43a9cc6 100644 --- a/autoload/sy/util.vim +++ b/autoload/sy/util.vim @@ -97,3 +97,13 @@ function! sy#util#return_if_no_changes() abort endif return '' endfunction + +" Function: #execute {{{1 +function! sy#util#execute(cmd) abort + let lang = v:lang + redir => output + silent! execute a:cmd + redir END + silent! execute 'language message' lang + return output +endfunction