0

Let's say I have a function give me ASCII value of a character that is passed as an argument and call it AsciiFunc (It's late and I can't think of creative names). Is it possible to define a single mapping which calls AsciiFunc and passes to it the character typed. For eg. if the function is mapped to <leader>a then pressing <leader>af will call the function AsciiFunc and pass 'f' as a parameter?

Just to avoid confusion, I know that ga gives the ascii and other information of the character under the cursor, that is not what I'm looking for. I'm looking for a way to avoid having to create multiple mappings one each for every possible value that AsciiFunc can take as an argument.

1 Answer 1

4

You can call getchar() function inside AsciiFunc(). It'll wait for input.

Sign up to request clarification or add additional context in comments.

1 Comment

You mean map <leader>a to :call AsciiFunc() and have a getchar() inside AsciiFunc?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.