mirror of
https://github.com/m42e/vim-plug-config.git
synced 2025-12-12 11:21:13 +00:00
added 'bindings' file
This commit is contained in:
@@ -15,7 +15,10 @@ Place this configuration before the `plug#begin()`
|
|||||||
|
|
||||||
## Create or Edit
|
## Create or Edit
|
||||||
|
|
||||||
Just call `PlugConfig <pluginname>` and it will either open an existing one (first one found) or it will create one in the first directory. Autocomplete is supported, too.
|
Just call `PlugConfig <pluginname|'bindings'>` and it will either open an existing one (first one found) or it will create one in the first directory. Autocomplete is supported, too.
|
||||||
|
|
||||||
|
`binding` is a special one, it will always be present and loaded if the file exists, regardless of the existence of a plugin named like this. It can be used to have bindings/mapping which trigger the loading of a plugin. In my case it contains `<leader>n :NERDTreeFocus<CR>` for example.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
|
|||||||
@@ -3,6 +3,10 @@ if exists("g:vim_plug_config") || &cp || v:version < 700
|
|||||||
endif
|
endif
|
||||||
let g:vim_plug_config = 1
|
let g:vim_plug_config = 1
|
||||||
|
|
||||||
|
function! s:get_plugin_names()
|
||||||
|
return keys(g:plugs) + ['bindings']
|
||||||
|
endfunction
|
||||||
|
|
||||||
function! s:get_config_path(name, create)
|
function! s:get_config_path(name, create)
|
||||||
" uniform name, remove vim prefix
|
" uniform name, remove vim prefix
|
||||||
let l:pluginconfig = tolower(a:name).'.vim'
|
let l:pluginconfig = tolower(a:name).'.vim'
|
||||||
@@ -45,8 +49,8 @@ endfunction
|
|||||||
|
|
||||||
function! s:load_all_configs()
|
function! s:load_all_configs()
|
||||||
let g:plugs_configs = {}
|
let g:plugs_configs = {}
|
||||||
for plug in keys(g:plugs)
|
for plug in s:get_plugin_names()
|
||||||
if has_key(g:plugs[plug], 'on') || has_key(g:plugs[plug], 'for')
|
if has_key(g:plugs, plug) && ( has_key(g:plugs[plug], 'on') || has_key(g:plugs[plug], 'for') )
|
||||||
execute 'autocmd User ' . plug . ' call s:load_config("' . plug . '")'
|
execute 'autocmd User ' . plug . ' call s:load_config("' . plug . '")'
|
||||||
else
|
else
|
||||||
call s:load_config(plug)
|
call s:load_config(plug)
|
||||||
@@ -55,7 +59,7 @@ function! s:load_all_configs()
|
|||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:names(...)
|
function! s:names(...)
|
||||||
return sort(filter(keys(g:plugs), 'stridx(v:val, a:1) == 0'))
|
return sort(filter(s:get_plugin_names(), 'stridx(v:val, a:1) == 0'))
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
call s:load_all_configs()
|
call s:load_all_configs()
|
||||||
|
|||||||
Reference in New Issue
Block a user