I am trying to use a variable in this mapping:

let board_ip = ""                                                                      │
nnoremap <F6> :AsyncRun echo . board_ip . > /dev/pts/1 2>&1<CR>

But I cannot get it working, getting board_ip echoed all the time.


Use :execute to run a command made out of strings:

let g:board_ip = ""
nnoremap <F6> :execute "AsyncRun echo " . g:board_ip . " > /dev/pts/1 2>&1"<CR>

Not the answer you're looking for? Browse other questions tagged or ask your own question.