From e573b3020c032400eed60b649a2cbf55266e6bb0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karel=20Ko=C4=8D=C3=AD?= Date: Thu, 30 Jun 2016 16:03:25 +0200 Subject: Add current configurations from old repository --- vim/bundle/tlib_vim/autoload/tlib/notify.vim | 113 +++++++++++++++++++++++++++ 1 file changed, 113 insertions(+) create mode 100755 vim/bundle/tlib_vim/autoload/tlib/notify.vim (limited to 'vim/bundle/tlib_vim/autoload/tlib/notify.vim') diff --git a/vim/bundle/tlib_vim/autoload/tlib/notify.vim b/vim/bundle/tlib_vim/autoload/tlib/notify.vim new file mode 100755 index 0000000..541dbd0 --- /dev/null +++ b/vim/bundle/tlib_vim/autoload/tlib/notify.vim @@ -0,0 +1,113 @@ +" notify.vim +" @Author: Tom Link (mailto:micathom AT gmail com?subject=[vim]) +" @Website: http://www.vim.org/account/profile.php?user_id=4037 +" @License: GPL (see http://www.gnu.org/licenses/gpl.txt) +" @Created: 2008-09-19. +" @Last Change: 2016-06-28. +" @Revision: 2.3.19 + +let s:save_cpo = &cpo +set cpo&vim + + +" :display: tlib#notify#Echo(text, ?style='') +" Print text in the echo area. Temporarily disable 'ruler' and 'showcmd' +" in order to prevent |press-enter| messages. +function! tlib#notify#Echo(text, ...) + TVarArg 'style' + let ruler = &ruler + let showcmd = &showcmd + let text = substitute(a:text, '\n', '|', 'g') + try + set noruler + set noshowcmd + if !empty(style) + exec 'echohl' style + endif + echo strpart(text, 0, &columns - 1) + finally + if !empty(style) + echohl None + endif + let &ruler = ruler + let &showcmd = showcmd + endtry +endf + + +" Contributed by Erik Falor: +" If the line containing the message is too long, echoing it will cause +" a 'Hit ENTER' prompt to appear. This function cleans up the line so +" that does not happen. +" The echoed line is too long if it is wider than the width of the +" window, minus cmdline space taken up by the ruler and showcmd +" features. +function! tlib#notify#TrimMessage(message) "{{{3 + let filler = '...' + + " If length of message with tabs converted into spaces + length of + " line number + 2 (for the ': ' that follows the line number) is + " greater than the width of the screen, truncate in the middle + let to_fill = &columns + " TLogVAR to_fill + + " Account for space used by elements in the command-line to avoid + " 'Hit ENTER' prompts. + " If showcmd is on, it will take up 12 columns. + " If the ruler is enabled, but not displayed in the statusline, it + " will in its default form take 17 columns. If the user defines a + " custom &rulerformat, they will need to specify how wide it is. + if has('cmdline_info') + if &showcmd + let to_fill -= 12 + else + let to_fill -= 1 + endif + " TLogVAR &showcmd, to_fill + + " TLogVAR &laststatus, &ruler, &rulerformat + if &ruler + if &laststatus == 0 || winnr('$') == 1 + if has('statusline') + if &rulerformat == '' + " default ruler is 17 chars wide + let to_fill -= 17 + elseif exists('g:MP_rulerwidth') + let to_fill -= g:MP_rulerwidth + else + " tml: fallback: guess length + let to_fill -= strlen(&rulerformat) + endif + else + endif + endif + else + endif + else + let to_fill -= 1 + endif + + " TLogVAR to_fill + " TLogDBG strlen(a:message) + if strlen(a:message) > to_fill + let front = to_fill / 2 - 1 + let back = front + if to_fill % 2 == 0 | let back -= 1 | endif + return strpart(a:message, 0, front) . filler . + \strpart(a:message, strlen(a:message) - back) + else + return a:message + endif +endfunction + + +function! tlib#notify#PrintError() abort "{{{3 + echohl ErrorMsg + echom v:exception + echom v:throwpoint + echohl NONE +endf + + +let &cpo = s:save_cpo +unlet s:save_cpo -- cgit v1.2.3