Browse files

Don't map insert mode when mapping is printable character

This makes sure that people who decide to map a character
like "K" don't get a nasty surprise the next time they try
to type that character in insert mode in a Python buffer.
  • Loading branch information...
xolox committed May 28, 2010
1 parent 7c1b80f commit 2d45371f62b9eb274b837ce084c1ad77710af713
Showing with 8 additions and 3 deletions.
  1. +8 −3 pyref.vim
@@ -1,6 +1,6 @@
" Vim plug-in
" Maintainer: Peter Odding <>
" Last Change: May 25, 2010
" Last Change: May 28, 2010
" URL:
" License: MIT
@@ -104,8 +104,13 @@ augroup END
function! s:DefineMappings()
let command = '%s <silent> <buffer> %s %s:call <Sid>PyRef()<CR>'
execute printf(command, 'inoremap', g:pyref_mapping, '<C-O>')
execute printf(command, 'nnoremap', g:pyref_mapping, '')
" Always define the normal mode mapping.
execute printf(command, 'nmap', g:pyref_mapping, '')
" Don't create the insert mode mapping when "g:pyref_mapping" has been
" changed to something like K because it'll conflict with regular input.
if g:pyref_mapping =~ '^<[^>]\+>'
execute printf(command, 'imap', g:pyref_mapping, '<C-O>')
" This list of lists contains [url_format, method_pattern] pairs that are used

0 comments on commit 2d45371

Please sign in to comment.