autoload/plugins/dein.vim

Enforce vim script implementation to reduce ambiguities and improve robustness:

scriptversion 4
load_config(plugin: Optional[str])) None

Load configuration file for plugin.

When no plugin is provided we use default to loading the configuration file for current dein plugin.

Parameters

plugin – Name of plugin to load configuration file for

function! plugins#dein#load_config(plugin = v:none) abort
    const l:name = substitute(a:plugin ?? g:dein#plugin.name, '-', '_', 'g')
    execute 'source ~/.vim/localcfg/plugins/' .. l:name .. '.vim'
endfunction
prefix(prefix: str, args: List[str]) List[str]

Add a prefix to a list of strings.

This greatly improves readability, in my opinion, for command definitions in dein#add calls.

Parameters
  • prefix – String to prepend

  • args – Elements to operate on

Returns

Strings with prefix prepended

function! plugins#dein#prefix(prefix, args) abort
    return mapnew(a:args, {_, s -> a:prefix .. s})
endfunction
suffix(suffix: str, args: List[str]) List[str]

Add a suffix to a list of strings.

This greatly improves readability, in my opinion, for command definitions in dein#add calls.

Parameters
  • suffix – String to append

  • args – Elements to operate on

Returns

Strings with suffix appended

function! plugins#dein#suffix(suffix, args) abort
    return mapnew(a:args, {_, s -> s .. a:suffix})
endfunction
has_exec(command: str) bool

Check for installed command.

executable() doesn’t cache results, so we’ll do it ourselves to handle repeated calls.

Parameters

command – Command to check for

Returns

Whether command is installed

let s:has_exec_cache = {}
function! plugins#dein#has_exec(command) abort
    if !has_key(s:has_exec_cache, a:command)
        let s:has_exec_cache[a:command] = executable(a:command)
    endif
    return s:has_exec_cache[a:command]
endfunction