Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Overwrite key mapping #8

Closed
ornicar opened this issue Apr 16, 2011 · 4 comments
Closed

Overwrite key mapping #8

ornicar opened this issue Apr 16, 2011 · 4 comments

Comments

@ornicar
Copy link
Contributor

ornicar commented Apr 16, 2011

Hi Hut,
I recently switched to the colemak keyboard layout (http://colemak.com). The j and k letters are replaced with n and e. So I tried to overwrite ranger mappings in ~/.config/ranger/keys.py:

from ranger.api.keys import *
map = vim_aliases = KeyMapWithDirections()
map.dir('n', alias='<down>')
map.dir('e', alias='<up>')

The new e mapping works well. n does not. I think it is because n is already mapped by ranger.
So I'd like to replace this mapping with mine, but I can't figure out how to proceed. Any help would be much appreciated.

@hut
Copy link
Member

hut commented Apr 26, 2011

Hi, try:

keymanager.unmap("browser", "n")

@ornicar
Copy link
Contributor Author

ornicar commented Apr 26, 2011

No effect. I must be doing something wrong, here is my ~/.config/ranger/keys.py


from ranger.api.keys import *

keymanager.unmap("browser", "n")

map = vim_aliases = KeyMapWithDirections()
map.dir('n', down='<down>')
map.dir('e', alias='<up>')

map('j', fm.search())
map('J', fm.search(forward=False))

map('E', fm.edit_file())

keymanager.merge_all(map)     # merge the new map into all existing ones.

@hut
Copy link
Member

hut commented Apr 26, 2011

how about:
map('n', fm.move(down=1))

@ornicar
Copy link
Contributor Author

ornicar commented Apr 26, 2011

That does the trick! I can now use ranger with colemak, you are my hero!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants