简体   繁体   中英

some vimrc commands not loaded at startup

Some time ago the line in my vimrc (d:/programs/vim/_vimrc) stopped working (not the only one):

nnoremap <unique> ç :execute ':let @/ = "\\<' . expand('<cword>') . '\\>"'<CR>:set hlsearch<CR>

(This line overwrite the functionality of * but without jumping to the next observation, just highlight the word under the cursor. I mapped it to ç because this char is in my keyboard near * and vim does not uses it, but you could map any other key)

The problem is that for some time it stopped working if placed in _vimrc, but works if placed in $VIM/vimfiles/plugins/myPlugins.vim

Have you experienced this issue? It could be because of installing a new plugin? I am mostly intrigued for this behavior. I have tried with :scriptnames and other copies of _vimrc, .vimrc, .vim/vimrc, etc., but can not find the source of the misbehavior.

From :h <unique> :

If the first argument to one of these commands is "" and it is used to define a new mapping or abbreviation, the command will fail if the mapping or abbreviation already exists.

Use :verbose nmap ç to see where it is defined.

Or simply drop <unique> which doesn't seem useful at all.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM