mirror of
https://github.com/inkarkat/vim-ingo-library.git
synced 2026-05-29 11:18:51 +02:00
Add ingo#funcref#AsString()
In contrast to ingo#funcref#ToString(), this can be useful when concatenating Funcrefs (and keep them as Funcrefs, i.e. with the function(...)) with other types, avoiding "E729: using Funcref as a String".
This commit is contained in:
@@ -86,6 +86,7 @@ HISTORY
|
||||
- Add ingo/workingdir.vim module.
|
||||
- Add ingo/selection/virtcols.vim module.
|
||||
- Add ingo/str/list.vim module.
|
||||
- Add ingo#funcref#AsString().
|
||||
|
||||
##### 1.034 13-Feb-2018
|
||||
- Add ingo/regexp/split.vim module.
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
"
|
||||
" DEPENDENCIES:
|
||||
"
|
||||
" Copyright: (C) 2013-2017 Ingo Karkat
|
||||
" Copyright: (C) 2013-2018 Ingo Karkat
|
||||
" The VIM LICENSE applies to this script; see ':help copyright'.
|
||||
"
|
||||
" Maintainer: Ingo Karkat <ingo@karkat.de>
|
||||
@@ -15,4 +15,8 @@ function! ingo#funcref#ToString( Funcref )
|
||||
return (empty(l:functionName) ? '' . a:Funcref : l:functionName)
|
||||
endfunction
|
||||
|
||||
function! ingo#funcref#AsString( Funcref )
|
||||
return (type(a:Funcref) == 2 ? string(a:Funcref) : a:Funcref)
|
||||
endfunction
|
||||
|
||||
" vim: set ts=8 sts=4 sw=4 noexpandtab ff=unix fdm=syntax :
|
||||
|
||||
@@ -100,6 +100,7 @@ HISTORY *ingo-library-history*
|
||||
- Add ingo/workingdir.vim module.
|
||||
- Add ingo/selection/virtcols.vim module.
|
||||
- Add ingo/str/list.vim module.
|
||||
- Add ingo#funcref#AsString().
|
||||
|
||||
1.034 13-Feb-2018
|
||||
- Add ingo/regexp/split.vim module.
|
||||
|
||||
Reference in New Issue
Block a user