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

Avoid existing keymap override #93

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

KSR-Yasuda
Copy link

It looks overriding some keymaps.

It already checks existing keymap for U, though,
also other keymaps ., u, <C-R> should do so, shouldn't them?

Related with the issue #91, too.

How to Repro

" Check existing keymaps.
" Here some keymaps exist for `machakann/vim-highlightedundo` plugin.
:nmap . | nmap u | nmap U | nmap <C-R>
" No mapping found
" n  u             <Plug>(highlightedundo-undo)
" n  U             <Plug>(highlightedundo-Undo)
" n  <C-R>         <Plug>(highlightedundo-redo)

" Insert some text
i
foobar

" Still key mapping is not overrode yet.
:nmap . | nmap u | nmap U | nmap <C-R>
" No mapping found
" n  u             <Plug>(highlightedundo-undo)
" n  U             <Plug>(highlightedundo-Undo)
" n  <C-R>         <Plug>(highlightedundo-redo)

"---------------------------------------------------------------

" Use `tpope/vim-surround` plugin.
yss'

" Then, some of keymaps are overrode
:nmap . | nmap u | nmap U | nmap <C-R>
" n  .             <Plug>(RepeatDot)
" n  u             <Plug>(RepeatUndo)
" n  U             <Plug>(highlightedundo-Undo)
" n  <C-R>         <Plug>(RepeatRedo)
.vimrc
" vim: ft=vim et ts=4 sts=4 sw=4

" Vundle

set nocompatible               " be iMproved
filetype off                   " required!
set rtp+=~/.vim/bundle/Vundle.vim

call vundle#begin()

"-------------------------------------------------------------------------------

" let Vundle manage Vundle, required
Plugin 'VundleVim/Vundle.vim'

"...............................................................................

Plugin 'tpope/vim-repeat'
Plugin 'tpope/vim-surround'

Plugin 'machakann/vim-highlightedundo'

nmap u     <Plug>(highlightedundo-undo)
nmap <C-r> <Plug>(highlightedundo-redo)
nmap U     <Plug>(highlightedundo-Undo)
nmap g-    <Plug>(highlightedundo-gminus)
nmap g+    <Plug>(highlightedundo-gplus)

"-------------------------------------------------------------------------------

call vundle#end()           " required
filetype plugin indent on   " required!

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

Successfully merging this pull request may close these issues.

1 participant