I want the vim plugin CtrlP to search in my working_directory when I hit Ctrl+E, I have the following lines in .vimrc
let working_directory ="/home/username/website/blog"
noremap <C-e> :CtrlP &working_directory<CR>
It doesn't work. How to correctly use the working_directory variable to make it work?
You can use :execute and concatenation to insert an expression in your mapping:
execute "nnoremap <C-e> :CtrlP " . working_directory . "<CR>"
Or you can use the expression register:
nnoremap <C-e> :CtrlP <C-r>=working_directory<CR><CR>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With