Wednesday, April 29, 2015

Re: Autocmd to have a mapping only for a specific file

av wrote:
> Le jeudi 23 avril 2015 09:25:11 UTC+2, av a écrit :
>> Hi,
>>
>> I try to have an autocommand that would provide a mapping to the <enter> and <c-enter> keys only on a certain file name. Like myfile.txt for example.
>>
>> I have tried a test like this here, and it works for the <c-Enter> mapping but not for the <Enter> one:
>>
>> autocmd! BufNewFile,BufRead,BufEnter myfile.txt nmap <buffer> <Enter> :echo 'Hi!'<cr>
>> autocmd! BufNewFile,BufRead,BufEnter myfile.txt nmap <buffer> <c-Enter> :echo 'Test!'<cr>
>>
>> And when I do :map <enter> vim says that there are "No mapping found"
>>
>> Any ideas why? And please tell me if I chose the right list of events.
>>
>> Thank you very much,
>>
>> Alexandre
> It seems I cannot use <Enter> and <c-Enter> at the same time, only one of the 2 works. Why is that?
>
Go into insert mode.

Type ctrl-v [return]
Type ctrl-v ctrl-[return]

You'll likely find that there's no difference between them.

Regards,
Chip Campbell

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments: