How to use variables correctly in vimrc

I want the vim plugin to CtrlP

search in mine working_directory

, when I press Ctrl + E I have the following lines in.vimrc

let working_directory ="/home/username/website/blog"
noremap <C-e> :CtrlP &working_directory<CR>

      

This does not work. How do I use a variable correctly working_directory

to make it work?

+3


source to share


1 answer


You can also use :execute

concatenation to insert an expression into your mapping:

execute "nnoremap <C-e> :CtrlP " . working_directory . "<CR>"

      



Or you can use the case of expressions:

nnoremap <C-e> :CtrlP <C-r>=working_directory<CR><CR>

      

+4


source







All Articles