Skip to content

Commit

Permalink
option to set a default group name
Browse files Browse the repository at this point in the history
  • Loading branch information
hecal3 committed Sep 18, 2016
1 parent db2e661 commit 247631a
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 2 deletions.
4 changes: 2 additions & 2 deletions autoload/leaderGuide.vim
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ function! s:add_map_to_dict(key, cmd, desc, level, dict) " {{{
let curkey = a:key[a:level]
let nlevel = a:level+1
if !has_key(a:dict, curkey)
let a:dict[curkey] = { 'name' : '' }
let a:dict[curkey] = { 'name' : g:leaderGuide_default_group_name }
" mapping defined already, flatten this map
elseif type(a:dict[curkey]) == type([]) && g:leaderGuide_flatten
let cmd = s:escape_mappings(a:cmd)
Expand All @@ -114,7 +114,7 @@ function! s:add_map_to_dict(key, cmd, desc, level, dict) " {{{
let cmd = s:escape_mappings(a:cmd)
let curkey = curkey."m"
if !has_key(a:dict, curkey)
let a:dict[curkey] = {'name' : ''}
let a:dict[curkey] = { 'name' : g:leaderGuide_default_group_name }
endif
endif
" next level
Expand Down
19 changes: 19 additions & 0 deletions doc/vim-leader-guide.txt
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,7 @@ GLOBAL VARIABLES *leader-guide-globals*
|g:leaderGuide_vertical| 0
|g:leaderGuide_hspace| 5
|g:leaderGuide_sort_horizontal| 0
|g:leaderGuide_default_group_name|
|g:leaderGuide_run_map_on_popup| 1
|g:leaderGuide_flatten| 1
|g:leaderGuide_hide_in_display| see description
Expand Down Expand Up @@ -367,6 +368,20 @@ g:leaderGuide_sort_horizontal~
Default: 0


*g:leaderGuide_default_group_name*
g:leaderGuide_default_group_name~
Allows to set a default group name. This name is shown as group
description when the configuration dictionary has no corrosponding entry.

Example:
>
let g:leaderGuide_default_group_name = "+group"
<

Possible values: {String}
Default: "" (Empty String)


*g:leaderGuide_run_map_on_popup*
g:leaderGuide_run_map_on_popup~
If set to 0, |vim-leader-guide| will not parse mappings when opening a
Expand Down Expand Up @@ -416,6 +431,7 @@ g:leaderGuide_flatten~
Default: 1



*g:leaderGuide_displayfunc*
g:leaderGuide_displayfunc~
Sets a function to call on all for every displaystring in the guide
Expand Down Expand Up @@ -484,6 +500,9 @@ g:leaderGuide#displayname~
==============================================================================
CHANGELOG *leader-guide-changelog*

2016-09-18: - Add option to set a default group name.
(See |g:leaderGuide_default_group_name|)

2016-04-22: - Sort entries vertical by default.
(See |g:leaderGuide_sort_horizontal|)

Expand Down
4 changes: 4 additions & 0 deletions plugin/leaderGuide.vim
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ if !exists("g:leaderGuide_flatten")
let g:leaderGuide_flatten = 1
endif

if !exists("g:leaderGuide_default_group_name")
let g:leaderGuide_default_group_name = ""
endif

if !exists("g:leaderGuide_displayfunc")
function! s:leaderGuide_display()
let g:leaderGuide#displayname = substitute(g:leaderGuide#displayname, '\c<cr>$', '', '')
Expand Down

0 comments on commit 247631a

Please sign in to comment.