Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit ee56141

Browse files
committed
get docs by sending foo?, just like ipython
currently only supported for sending single lines which end with a question mark.
1 parent 094b738 commit ee56141

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

ftplugin/python/ipy.vim

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -425,6 +425,16 @@ def run_this_file():
425425

426426
@with_subchannel
427427
def run_this_line():
428+
if vim.current.line.strip().endswith('?'):
429+
# intercept question mark queries -- move to the word just before the
430+
# question mark and call the get_doc_buffer on it
431+
w = vim.current.window
432+
original_pos = w.cursor
433+
new_pos = (original_pos[0], vim.current.line.index('?')-1)
434+
w.cursor = new_pos
435+
get_doc_buffer()
436+
w.cursor = original_pos
437+
return
428438
msg_id = send(vim.current.line)
429439
print_prompt(vim.current.line, msg_id)
430440

0 commit comments

Comments
 (0)