Skip to content

Commit

Permalink
Add visual mappping to ctr
Browse files Browse the repository at this point in the history
  • Loading branch information
hkupty committed Jan 24, 2017
1 parent 2b9dc3f commit bb62179
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
1 change: 1 addition & 0 deletions plugin/iron.vim
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
nmap <silent> ctr :set opfunc=IronSendMotion<CR>g@
vmap <silent> ctr :call IronSendMotion('visual')<CR>
"Call previous command again
nmap <silent> cp :call IronSend("\u001b\u005b\u0041")<CR>
8 changes: 5 additions & 3 deletions rplugin/python3/iron/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,10 +113,13 @@ def mapping_send(self, args):
if fn:
fn(self)

@neovim.function("IronSendMotion")
def send_motion_to_repl(self, args):
@neovim.function("IronSendMotion", range=True)
def send_motion_to_repl(self, args, rng=None):
logger.debug("Supplied data: {}".format(", ".join(args)))
if args[0] == 'line':
self.call_cmd("""normal! '[V']"sy""")
if args[0] == 'visual':
self.call_cmd("""normal! `<v`>"sy""")
else:
self.call_cmd("""normal! `[v`]"sy""")

Expand All @@ -131,7 +134,6 @@ def send_to_repl(self, args):
return None

logger.debug("Supplied data: {}".format(args[0]))

logger.info("Sending data to repl -> {}".format(repl))

if 'multiline' in repl:
Expand Down

0 comments on commit bb62179

Please sign in to comment.