Add option to check prefix override.
Hi, thank you for the great plugin. I use it very conveniently.
But I don't want to check if the prefix overrides other commands.
This is because I disable popup and use the prefix set in gopher_map in the prefix of another plugin command.
So how about adding the following options?
let g:gopher_map = {
\ '_check_map': 0,
\ }
And, ftplugin/go.vim.
let s:is_check = g:gopher_map['_check_map']
let s:has_norm = s:is_check ? mapcheck(g:gopher_map['_nmap_prefix'], 'n') isnot# '' : 0
let s:has_ins = s:is_check ? mapcheck(g:gopher_map['_imap_prefix'], 'i') isnot# '' : 0
Thanks.
I'm trying to understand your use case, but I'm not sure if I follow exactly what the source of your problem is. I don't understand what you mean with "use the prefix set in gopher_map in the prefix of another plugin command". Do you mean you have the prefer (e.g. ;) mapped to something else as well? Maybe you can share the relevant parts of the configuration?
I'd prefer to avoid adding another setting and just do the The Right Thing™ instead, if that's possible.
Thank you for your reply. And sorry for not enough information.
GoDiag's result is below.
VERSION
VIM - Vi IMproved 8.1 (2018 May 18, compiled Oct 23 2019 15:11:17); macOS 版
go version go1.13.4 darwin/amd64; GOPATH=/Users/nametake/go; GOROOT=/usr/local/Cellar/g
o/1.13.4/libexec; GO111MODULE=auto
gopher.vim version 6404926 2019-10-31 14:01:58 0800 (4 days ago) Don't override existi
ng user mappings
VARIABLES
gopher_highlight ['string-spell', 'string-fmt']
gopher_build_flags []
gopher_build_tags []
gopher_tag_transform snakecase
gopher_tag_default json
gopher_map {'_default': 1, 'return': 'r', 'implement': 'm', 'error': 'e', '_
imap_ctrl': 1, '_popup': 1, '_nmap_prefix': ';', '_imap_prefix': '<C-k>', 'if': 'i'}
gopher_tag_complete ['db', 'json', 'json,omitempty', 'yaml']
gopher_debug []
COMMAND HISTORY (newest on top)
And, the minimum configuration .vimrc I am thinking of is below.
function AnotherPluginFunc() abort
echomsg 'func'
endfunction
nnoremap <Plug>(another-plugin-cmd) :<C-u>call AnotherPluginFunc()<CR>
nmap ;a <Plug>(another-plugin-cmd)
call plug#begin('~/.vim/plugged')
Plug 'arp242/gopher.vim'
let g:gopher_map = {
\ '_popup': 0,
\ }
call plug#end()
With the above vimrc configuration, the following error message is displayed when vim starts.
gopher.vim: skipping normal mode mappings as ; is already mapped to <Plug>(another-plugin-cmd)
I want to use gopher.vim commands (e.g. ;r) without using popup.
I also want to use the prefix used in gopher.vim as a prefix for other commands.
Thank you.
Right, I see what you mean now: you have ;a – which is not a gopher.vim mapping – mapped to something unrelated, and that's needlessly preventing all the mappings. Thanks for explaining.
So how it should work is something like:
- Popup menu enabled: works as it is now, since it hijacks all of
;(although arguably it shouldn't and work withtimeout/ttimeoutlike regular Vim mappings?) - Popup menu disabled and exactly
;is mapped: don't need to do anything. - Popup menu disabled and
;ior any other gopher.vim mapping is mapped: display a warning.
I think that would work?
It's not a simple change, and I want to work on another project this week. I've reverted this change for the time being, until I can do it right. Updating to the latest master should fix things for you for now.
Thank you for your quick response!
After updating to master, no errors occurred.
- Popup menu enabled: works as it is now, since it hijacks all of; (although arguably it shouldn't and work with
timeout/ttimeoutlike regular Vim mappings?)- Popup menu disabled and exactly
;is mapped: don't need to do anything.- Popup menu disabled and
;ior any other gopher.vim mapping is mapped: display a warning.
I think the above is the best!
Thank you very much.