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

Inputting the "agda input prefix" as a literal #148

Open
googleson78 opened this issue May 7, 2024 · 5 comments
Open

Inputting the "agda input prefix" as a literal #148

googleson78 opened this issue May 7, 2024 · 5 comments

Comments

@googleson78
Copy link
Contributor

If I set my agda input prefix to e.g. v, how can I input a v? My current prefix is a backtick, and I cannot figure out how to input a backtick into my code 😅

@googleson78
Copy link
Contributor Author

(backtick is also my localleader, if that's relevant)

@isovector
Copy link
Collaborator

I don't think there's any way, today! I'm open to suggestions for what you'd like to happen, though.

@googleson78
Copy link
Contributor Author

The easiest way to get this, although a bit annoying, is to have a "timeout", i.e. if you press "agda input prefix" and wait for 1s, you just get the prefix input as a literal. This is what maps usually do in vim - if you do

inoremap asdf ...

and then input an a while in insert mode, you'll eventually get the a input as a character after waiting for a bit.

@epeery
Copy link

epeery commented Jun 19, 2024

Adding these two lines to the AgdaFiletype function is what I do.

vim.fn['cornelis#bind_input']('<leader>', '<leader>')
vim.fn['cornelis#bind_input'](' ', '<leader>')

This lets me insert the literal form of my leader key by either typing it twice or by pressing space.

I'm using Lua with NeoVim but I would assume that adding the equivalent VimScript would also work:

call cornelis#bind_input("<leader>", "<leader>")
call cornelis#bind_input(" ", "<leader>")

Also note that remapping space causes the leader key to be inserted on timeout. This is what I prefer but some may find the behavior undesirable.

@silky
Copy link
Contributor

silky commented Jul 7, 2024

Yes, I did exactly what @epeery did. But in the end I got annoyed at typing my localleader twice, so I just changed my agda_input_prefix to tab 😀

I think maybe the secret is to set that value per file-type; I think in Agda I don't type my localleader much, so I don't mind it being that (,, if anyone is curious.)

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

4 participants