On 2009-01-30 00:14 (-0800), [email protected] wrote:

> Hello all, I'm new to vim and having a bit of trouble. I'm using
> MacVim and trying to install scripts from vim.org into my ~/.vim
> folder. In my .vimrc I've got these lines to map keyboard shortcuts:
>
> autocmd FileType haskell nmap <C-c><C-l> :GhciRange<CR>
> autocmd FileType haskell vmap <C-c><C-l> :GhciRange<CR>
> autocmd FileType haskell nmap <C-c><C-f> :GhciFile<CR>
>
> When I try to use these key combinations, I get a message saying "not
> an editor command." I've looked around on google and vim's built-in
> help, but I'm not really making much progress. Any suggestions on what
> I'm doing wrong?

Unfortunately I don't know what is the cause of this error message but
I'd like to suggest another way of defining key maps. Instead of adding
several autocmds for a filetype it's usually more convenient to use a
custom filetype plugin file. That is, create file
~/.vim/after/ftplugin/haskell.vim and put your nmap etc. commans there:

    nmap <buffer> <C-c><C-l> :GhciRange<CR>
    vmap <buffer> <C-c><C-l> :GhciRange<CR>
    nmap <buffer> <C-c><C-f> :GhciFile<CR>

Note that we use <buffer> keyword here so that the key maps are local to
that buffer. (And by the way, I think Vim script-writers mess too often
on global level when they should keep their mappings, variables etc. on
buffer-local or window-local level.)

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply via email to