|
1 | 1 | let s:funcs = {}
|
2 | 2 | let s:loaders = {}
|
| 3 | +let s:hint_pad = 4 |
3 | 4 |
|
4 | 5 |
|
5 | 6 | " Select UI Loaders: {{{
|
@@ -64,13 +65,17 @@ function! s:open_inputlist(options) "{{{
|
64 | 65 | let index = 0
|
65 | 66 | let candidates = []
|
66 | 67 | let max_length = max(map(copy(a:options), 'strlen(v:val.text)'))
|
| 68 | + let max_hint_len = max(map(copy(a:options), 'strlen(v:val.hint)')) |
| 69 | + let hint_pad = max_hint_len > 0 ? s:hint_pad : 0 |
67 | 70 | for option in a:options
|
68 | 71 | let group = get(option, 'group_name', '')
|
69 | 72 | let line = printf(
|
70 |
| - \ '%2S => %-*S %S', |
| 73 | + \ '%2S => %-*S ' . repeat(' ', hint_pad) . ' %-*S %S', |
71 | 74 | \ index + 1,
|
72 | 75 | \ max_length,
|
73 | 76 | \ option.text,
|
| 77 | + \ max_hint_len, |
| 78 | + \ option.hint, |
74 | 79 | \ len(group) ? printf(' (%s)', group) : ''
|
75 | 80 | \ )
|
76 | 81 | call add(candidates, line)
|
@@ -98,14 +103,19 @@ function! s:open_confirm(options) "{{{
|
98 | 103 | let captions = []
|
99 | 104 | let candidates = []
|
100 | 105 | let max_length = max(map(copy(a:options), 'strlen(v:val.text)'))
|
| 106 | + let max_hint_len = max(map(copy(a:options), 'strlen(v:val.hint)')) |
| 107 | + let hint_pad = max_hint_len > 0 ? s:hint_pad : 0 |
| 108 | + |
101 | 109 | for option in a:options
|
102 | 110 | let caption = nr2char(char2nr('A') + index)
|
103 | 111 | let group = get(option, 'group_name', '')
|
104 | 112 | let line = printf(
|
105 |
| - \ ' %2S) => %-*S %S', |
| 113 | + \ ' %2S) => %-*S ' . repeat(' ', hint_pad) . ' %-*S %S', |
106 | 114 | \ caption,
|
107 | 115 | \ max_length,
|
108 | 116 | \ option.text,
|
| 117 | + \ max_hint_len, |
| 118 | + \ option.hint, |
109 | 119 | \ len(group) ? printf(' (%s)', group) : ''
|
110 | 120 | \ )
|
111 | 121 | call add(candidates, line)
|
|
0 commit comments