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

Feature Request - Customize your vi-bindings #11

Closed
teoljungberg opened this issue Jul 10, 2012 · 5 comments
Closed

Feature Request - Customize your vi-bindings #11

teoljungberg opened this issue Jul 10, 2012 · 5 comments

Comments

@teoljungberg
Copy link

This would be a featurekiller for me atleast

@Shadowfiend
Copy link
Member

What exactly do you mean? Key bindings, commands, or what?

@teoljungberg
Copy link
Author

The movement keys, i.e
noremap H ^
noremap L g_

Basicly to create a .vimrc-like file that lets you create custom keys, commands and whatnot

@Shadowfiend
Copy link
Member

Gotcha. You can do this right now, but you have to use Nu:

(let (map (ViMap normalMap))
  (map map:"H" to:"^")
  (map map:"L" to:"g_))

Notably, g_ isn't implemented, so you'll have to implement it. You can also map to Nu expressions:

((ViMap normalMap) map:"g_" toExpression:(do ()
    ; code for what to do on g_
  ))

Lastly, you can map recursively:

((ViMap normalMap) map:"H" to:"^" recursively:t scope:nil)

I can look into exposing these maps via actual map commands, however.

@Shadowfiend
Copy link
Member

Actually I think you can define the command(s) yourself using ExMap:

((ExMap defaultMap) define:"map" syntax:"E" as:(do (command)
  (let (partsArray ((command arg) componentsSeparatedByString:" "))
    (if (= (partsArray length) 2)
      (let (partsList (partsArray list))
        ((ViMap normalMap) map:(head partsList) to:(head (tail partsList))))
      (else
        ; throw an exception or something
      ))))

Warning: not tested hehe. But that should more or less do it.

@teoljungberg
Copy link
Author

Great thanks! I'll look into that

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