2

I'm using vim and the python-mode extension, but I'm having a hard time using commands that contain r. It's causing vim to replace characters instead of executing my desired command.

Here is what the vim docs for python-mode say -

let g:pymode_rope_organize_imports_bind = '<C-c>ro'

So I'm doing CTRL-cro, but like I said, it's replacing which ever character I'm under with the letter o.

What am I missing?

self.
  • 1,612
  • 4
  • 18
  • 35
  • 1
    Does it work when you use something other than ``? That may cause Vim to abort the mapping. – Ingo Karkat Nov 12 '14 at 16:18
  • @IngoKarkat: It does not. The same behavior is causing the follow-up r to replace the character under my cursor to `o`. – self. Nov 18 '14 at 13:35
  • I seem to be having the same issue on Ubuntu 17.10 When I run :map Ctrl-c I get o C *@:call pymode#motion#select('^\s*class\s', 0) – gabkdlly Jan 18 '18 at 15:06

1 Answers1

2

It seems that your mapping is not being interpreted by Vim, so it only sees the Ctrl-c, which by default aborts the current action, then the replace command r (see :help r) followed by its "argument".

You could check if the mapping is defined with :map <c-c>.

If it is correctly defined it may be that your terminal is handling the Ctrl-c directly and not passing it to Vim, as stated in Vim FAQ 20.5 - Why does mapping the key not work?. In this case you could follow the instructions on Vim FAQ 20.4 - I am not able to create a mapping for the key. What is wrong?, in special:

1) First make sure, the key is passed correctly to Vim. To determine if
   this is the case, put Vim in Insert mode and then hit Ctrl-V (or
   Ctrl-Q if your Ctrl-V is remapped to the paste operation (e.g. on
   Windows if you are using the mswin.vim script file) followed by your
   key.

   If nothing appears in the buffer (and assuming that you have
   'showcmd' on, ^V remains displayed near the bottom right of the Vim
   screen), then Vim doesn't get your key correctly and there is nothing
   to be done, other than selecting a different key for your mapping or
   using GVim, which should recognise the key correctly.
mMontu
  • 8,983
  • 4
  • 38
  • 53
  • I did this and vim doesn't recognize the bind. As all binds for this plugin use this is very strange, it seems. I can't imagine that I have to re-map everything. – self. Nov 18 '14 at 14:58