derekelkins / agda-vim

Agda interaction in vim
BSD 2-Clause "Simplified" License
130 stars 47 forks source link

Ability to disable the insert-mode \ unicode entry #20

Closed HalosGhost closed 8 years ago

HalosGhost commented 8 years ago

If this feature is already present, I have not found a way to disable it, but I am hoping to do some literate programming in agda (which uses latex). The result is that I will be typing regular old \ a lot and the unicode entry is incredibly bothersome for that.

I already have a very full XCompose set up and I would much prefer to use that. Is this feature already available? If so, how does one disable it? If not, any chance that you will see fit to add it?

derekelkins commented 8 years ago

There is no variable that controls this currently, but I can add it. It should only take a few minutes. You can also just comment out the runtime agda-utf8.vim line in ftplugin/agda.vim.

derekelkins commented 8 years ago

Okay, I just pushed 5bbc866 which add the variable g:agdavim_includeutf8_mappings which if you set it to 0 in your vimrc should cause the agda-utf8.vim file not to be loaded.

HalosGhost commented 8 years ago

I attempted to comment out that runtime line as you suggested but it does not seem to have changed anything. Is there a chance something else is causing it to be loaded?

derekelkins commented 8 years ago

Not really in this project unless your bundling mechanism just loads every file in the root of the bundle. The string "agda-utf8.vim" only occurs on that line in the whole project. You can grep your .vim folder to see if something else is loading a version, if, for example, you followed the directions on the Agda vim editing wiki page at some point in the past. You could also just remove the agda-utf8.vim file and that would unambiguously make it clear whether that is where the mappings are coming from.

HalosGhost commented 8 years ago

This is what confuses me. I have also tried deleting that file wholesale and the \ unicode escape still happens. But, this only happens for me in agda files, no where else. Do you know if the native vim agda syntax provides something like that?

derekelkins commented 8 years ago

So, are you sure the \ is leading into unicode? E.g. does \N produce a blackboard N? If not, it's just that the commands in the Agda mode use LocalLeader by default and that is \ by default (in fact, the Unicode mappings also use LocalLeader), so it may just be waiting for a command, e.g. \t to get types. You can write let maplocalleader = ',' in your vimrc, say, to change that (it just needs to run before the mappings are made and comma is just an example.)

derekelkins commented 8 years ago

The "Typing Unicode Characters" section on this page, refers to the files and setup for the Unicode mappings. You can check for e.g. after/syntax/agda.vim or for unicode-keys to see if any of those being run.

HalosGhost commented 8 years ago

Indeed, they do produce unicode characters, however, I just noticed something that may give the key to the problem. It seems if I start a new source file, this behavior does not happen in the new file. Does vim cache this kind of thing somewhere?

HalosGhost commented 8 years ago

Ah hah! I figured it out. This was indeed not an issue with agda-vim (my apologies for the noise). It seems $HOME/.vim/view contains some cached information about files that have been opened with vim. Clearing the relevant files after having disabled the agda-utf8.vim runtime has solved this issue.

Thank you for the help!

derekelkins commented 8 years ago

I'd be surprised if it did that across vim sessions (i.e. closing and reopening vim entirely). Of course, it won't reload the mappings, which are buffer local, if the buffer remains open.

HalosGhost commented 8 years ago

Actually, they did persist across closing and reopening vim entirely. I had to clear the relevant files from the view directory in order to get it to update. This may very well be due to some archaic setting I have in my rc that I had forgotten about.