Hi I have seen this question here on stackoverflow, but my question is slightly different.
When I use the following map I define a convenient map:
map <Leader>r :!screen -p run_and_test -X stuff '(cd /really/long/folder/data/gen_prob; epy gen_data.py)^V^V^M'<CR><CR>
This becames in a really long line, and I would prefer to split this by lines. I tried with:
let folder = '/really/long/folder/gen_prob'
let cmd = "'(cd " . folder . "; python gen_data.py)^V^V^M'"
map <Leader>r :execute "!screen -p run_and_test -X stuff" . cmd <cr><cr>
but it does not work.
Any idea on how to split this initial mapping over several lines?
edit: Final solution I implemented:
function! Execute_screen()
let folder = '/really/long/folder/gen_prob'
let cmd = "'(cd " . folder . "; python gen_data.py)\r'"
execute "!screen -p run_and_test -X stuff " . cmd
endfunction
noremap <Leader>r :call Execute_screen()<cr><cr>