Via Conque I use vim as an IDE for all my coding. I am starting to work in python, which is persnickety about spacing, so to test deeply indented subroutines or code blocks, I need to gate code sent to the terminal with %cpaste and --. That is, if I am interactively editing and testing the following:def wait_job(layer2, vault_name, job_id, sleepsec=60, timeout=86400):     Wait for a job to terminate.     t0 = datetime.now()    vault = fetch_vault(layer2, vault_name)    while 1:        job = vault.get_job(job_id)        if not job.completed:            tf = datetime.now()            delta = tf - t0            if (delta.seconds > timeout):                # 2FIX: should this just return false?                raise Exception('timed out')            time.sleep(sleepsec)        else:            break    wasok = job.completed    return wasokAnd grab the code block starting from if not job.completed, and send it to an ipython process in a Conque window, I have to send:%cpaste        if not job.completed:            tf = datetime.now()            delta = tf - t0            if (delta.seconds > timeout):                # 2FIX: should this just return false?                raise Exception('timed out')            time.sleep(sleepsec)        else:            break--I believe I have to modify the following line in the definition of ConqueTerm_SendVisKey:if maparg(g:ConqueTerm_SendVisKey, 'v') == ''  sil exe 'v' . map_modifier . 'map <silent> ' . g:ConqueTerm_SendVisKey . ' :<C-u>call conque_term#send_selected(visualmode())<CR>'endifBut am not sure where to start. Probably it would be better to define variables for gate start and gate end, but can I just do a string concat around visualmode()? Or must I send call the send three times?
modify conque to gate selected text
vimscript;plugin conque
It's possible to get this behaviour without changing ConqueTerm's code itself. The code below applies your desired behaviour to linewise visual mode selections*.It works by adding the gates to the buffer, sending the whole lot over to ConqueTerm (using the same code that ConqueTerm itself uses in its mapping), and then removing the gates again.You can add the code to your .vimrc, or if you want it only to apply to Python files, you could add <buffer> to the vnoremap mapping to make it buffer-specific and put it in .vim/after/ftplugin/markdown.vim so it applies to all Python files:vnoremap <silent> <f9> :<c-u>call ConqueWrapper(%cpaste, --)<CR>function! ConqueWrapper(start_gate, end_gate)  let m = visualmode()   Only apply this wrapper to linewise selections  if m ==# 'V'    let start_line = line('<)    let end_line = line('>)     Add in the code gates    call append(end_line, a:end_gate)    call append(start_line - 1, a:start_gate)     Reset the visual marks    call setpos('<, [0, start_line, 0, 0])    call setpos('>, [0, end_line + 2, 0, 0])     Send to ConqueTerm    call conque_term#send_selected(V)     Switch back to original buffer    wincmd p     Remove the code gates    execute end_line + 2 . delete _    execute start_line . delete _     Switch back to ConqueTerm    wincmd p  else     Not linewise: just pass it on directly to ConqueTerm    execute call conque_term#send_selected(\ . m . \)  endifendfunctionMy personal preference is not to make changes to the source code of plugins if I can avoid it, because then you have to either:Make a fork of plugin project, and keep this updated by merging in future changes from the original project,Or reapply your changes every time you update the plugin....neither of which is a very appealing prospect.* Because I don't think it makes much sense for characterwise or blockwise selections, and the code to implement it would be more complicated, and therefore harder for you to understand.