Skip to main content
edited tags
Link
Friedrich
  • 3.3k
  • 1
  • 13
  • 26
Source Link
Vivian De Smedt
  • 21.1k
  • 5
  • 22
  • 40

How to configure repmo such that it works with ]m and pythonsense?

I would like to jump from method to method in Python. With Vim you can use the ]m combination to jump to the next method and the [m to the previous.

Since the ] is quite awkward to type on a Belgium keyboard. So I would like to use the repmo plugin to repeat the motion.

I successfully configured repmo to repeat the jump to the next cpp scope:

map <expr> ; repmo#LastKey(';')|sunmap ;
map <expr> , repmo#LastRevKey(',')|sunmap ,

" Still repeat fFtT (now with counts):
noremap <expr> f repmo#ZapKey('f')|sunmap f
noremap <expr> F repmo#ZapKey('F')|sunmap F
noremap <expr> t repmo#ZapKey('t')|sunmap t
noremap <expr> T repmo#ZapKey('T')|sunmap T

" Now following can also be repeated with `;` and `,`:
for keys in [ ['[[', ']]'], ['[]', ']['], ['[m', ']m'], ['[M', ']M'], ['[c', ']c'] ]
  execute 'noremap <expr> '.keys[0]." repmo#SelfKey('".keys[0]."', '".keys[1]."')|sunmap ".keys[0]
  execute 'noremap <expr> '.keys[1]." repmo#SelfKey('".keys[1]."', '".keys[0]."')|sunmap ".keys[1]
endfor

But it doesn't work for the python filetype.

I believe it has to do that there is a custom mapping for ]m in the python filetype.

Does someone knows how to achieve that?