Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Treat <expr> mapping as normal mapping #60

Closed
linjiX opened this issue Jul 24, 2019 · 0 comments
Closed

Treat <expr> mapping as normal mapping #60

linjiX opened this issue Jul 24, 2019 · 0 comments
Labels
enhancement New feature or request

Comments

@linjiX
Copy link

linjiX commented Jul 24, 2019

  • OS: Ubuntu 16.04

  • Vim: Vi IMproved 8.1-1729

set nocompatible
let mapleader="\<Space>"

call plug#begin('~/.vim/plug')
Plug 'liuchengxu/vim-which-key'
call plug#end()

nnoremap <silent> <leader> :<C-u>WhichKey '<Space>'<CR>
let g:which_key_map = {}
call which_key#register('<Space>', "g:which_key_map")

function W() abort
    return ":echo 'test'\<CR>"
endfunction

nnoremap <expr> <leader>t W()

Problem Description

In the minimal vimrc above, a <expr> mapping is defined (<leader>t to echo 'test').
It works fine if you press <leader>t without a break.
But if you press <leader> and wait until which-key window appear, then press t, which-key will ignore <expr> and just execute W() in normal mode.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants