Ron89 / thesaurus_query.vim

Multi-language Thesaurus Query and Replacement plugin for Vim/NeoVim
http://www.vim.org/scripts/script.php?script_id=5341
Apache License 2.0
220 stars 23 forks source link

mapping already exists for <leader>cs #23

Closed sadid closed 6 years ago

sadid commented 6 years ago

I've set:

nnoremap <leader>ct :ThesaurusQueryReplaceCurrentWord<CR>
vnoremap <leader>ct y:ThesaurusQueryReplace <C-r>"<CR>

in my .vimrc file. But I get the above error when running vim.

I even tried this:

nnoremap <leader>ct :ThesaurusQueryReplaceCurrentWord<CR>
vnoremap <leader>ct "ky:ThesaurusQueryReplace <C-r>k<CR>
nnoremap <leader>ct :ThesaurusQueryReplaceCurrentWord<CR>
vnoremap <leader>ct "ky:ThesaurusQueryReplace <C-r>k<CR>

or other scenarios. I only be able to fix this problem with changing the same definitions in the ~/.vim/plugged/thesaurus_query.vim/plugin/thesaurus_query.vim file which is not a robust fix.

if g:tq_map_keys
    nnoremap <unique><silent> <Leader>ct :ThesaurusQueryReplaceCurrentWord<CR>
    vnoremap <unique><silent> <Leader>ct "ky:ThesaurusQueryReplace <C-r>k<CR>
    nnoremap <silent> <LocalLeader>ct :ThesaurusQueryReplaceCurrentWord<CR>
    vnoremap <silent> <LocalLeader>ct "ky:ThesaurusQueryReplace <C-r>k<CR>
endif

I'm using vim-8.0.1176-1

Ron89 commented 6 years ago

In this case, you can let g:tq_map_keys=0 in your vimrc file and add your own key mappings in it. This way, the plugin won't setup default key mapping. Do you think this is good enough?

sadid commented 6 years ago

@Ron89 Good, Thanks. Now I can go without modifying the source. But I can't use my custom keybinding as well and I've to go with :The<Tab> which is Ok but not ideal. I might have missed something. Here is my .vimrc:

let g:tq_map_keys=0
nnoremap <leader>ct :ThesaurusQueryReplaceCurrentWord<CR>
vnoremap <leader>ct y:ThesaurusQueryReplace <C-r>"<CR>
Ron89 commented 6 years ago

This is strange... The mappings should work. Have you tried to see the mappings of your current buffer and see if it is actually mapped or override by something else? You can do so by :map And if there are too many entries, you can use :redir to redirect the result of map to a register or a file.

On Wed, Oct 11, 2017 at 10:50 PM, Sadid notifications@github.com wrote:

@Ron89 https://github.com/ron89 Good, Thanks. Now I can go without modifying the source. But I can't use my custom keybinding as well and I've to go with :The which is Ok but not ideal. I might have missed something. Here is my .vimrc:

let g:tq_map_keys=0 nnoremap ct :ThesaurusQueryReplaceCurrentWord vnoremap ct y:ThesaurusQueryReplace "

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/Ron89/thesaurus_query.vim/issues/23#issuecomment-335836932, or mute the thread https://github.com/notifications/unsubscribe-auth/ACkkvd9g3gp-5doUV8VgKAr4OM_emyyjks5srNXBgaJpZM4P1h00 .

sadid commented 6 years ago

I double check. The strange thing is it maps to default leader \ while I've set leader , as default leader. Now it's fixed. Thanks