Files
2017-05-26 17:54:58 +02:00

37 lines
1.3 KiB
VimL

" ingo/compat/command.vim: Compatibility functions for commands.
"
" DEPENDENCIES:
"
" Copyright: (C) 2017 Ingo Karkat
" The VIM LICENSE applies to this script; see ':help copyright'.
"
" Maintainer: Ingo Karkat <ingo@karkat.de>
"
" REVISION DATE REMARKS
" 1.030.001 20-Feb-2017 file creation
function! ingo#compat#command#Mods( mods )
"******************************************************************************
"* PURPOSE:
" Return the command modifiers |<mods>| passed in raw as a:mods.
" In order to support older Vim versions that don't have this, one cannot use
" <q-mods>; this isn't understood and raises an error. Instead, we can benefit
" from the fact that the modifiers do not contain special characters, and do
" the quoting ourselves: '<mods>'. Now we only need to remove the identifer in
" case it hasn't been understood, and this is what this function is about.
" command! Sedit call SpecialEdit(<q-mods>)
" command! Sedit call SpecialEdit(ingo#compat#command#Mods('<args>'))
"* ASSUMPTIONS / PRECONDITIONS:
" None.
"* EFFECTS / POSTCONDITIONS:
" None.
"* INPUTS:
" '<mods>'
"* RETURN VALUES:
" Usable modifiers.
"******************************************************************************
return (a:mods ==# '<mods>' ? '' : a:mods)
endfunction
" vim: set ts=8 sts=4 sw=4 noexpandtab ff=unix fdm=syntax :