vim-leader-guide icon indicating copy to clipboard operation
vim-leader-guide copied to clipboard

Bug/Regression with autocommand

Open ctjhoa opened this issue 7 years ago • 1 comments

Hi,

A few months ago, I notice a bug with vim-leader-guide (https://github.com/ctjhoa/spacevim/issues/32) and I didn't take the time to look at it until now.

Here is what I've found. With the current version of vim-leader-guide calling register_prefix_description from an autocommand will lead to a bug where the name of your entry does not show. If I rollback to the commit bade1b9dfc5e56aaf322791fff11e350fd8681ae it works as intended.

I did a .vimrc which show the issue:

call plug#begin('~/.vim/plugged')

Plug 'hecal3/vim-leader-guide'

call plug#end()

let mapleader = ' '
let g:leaderGuide_vertical = 1


" THIS WORKS
" ==========
" call leaderGuide#register_prefix_descriptions("<Space>", "g:lmap")
" nnoremap <silent> <leader> :<c-u>LeaderGuide '<Space>'<CR>
" vnoremap <silent> <leader> :<c-u>LeaderGuideVisual '<Space>'<CR>
" ==========

" THIS DON'T
" ==========
function! s:vim_enter()
        call leaderGuide#register_prefix_descriptions("<Space>", "g:lmap")
        nnoremap <silent> <leader> :<c-u>LeaderGuide '<Space>'<CR>
        vnoremap <silent> <leader> :<c-u>LeaderGuideVisual '<Space>'<CR>
endfunction

augroup delayed
  autocmd!
  autocmd VimEnter * call s:vim_enter()
augroup END
" ==========

let g:lmap = get(g:, 'lmap', {})
let g:lmap.a = { 'name': '+applications' }

Thanks

ctjhoa avatar Mar 18 '17 15:03 ctjhoa