Recently, I have made a big contribution to my .vimrc , and somewhere along the line I introduced an unwanted function. When executing a substitution command, where the search token appears more than once in a row, only the first token changes (although the remaining tokens are highlighted as a result of the replacement). I have seen several posts here on how to enable this behavior in each case, but I have yet to see something about what might lead to this being the default behavior or how to disable it. If anyone has any ideas, they will be appreciated.
For reference my .vimrc ( https://github.com/chpatton013/dotfiles/blob/master/vim/.vimrc ):
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" " Autocommands """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" " Reread configuration of Vim if .vimrc is saved augroup VimConfig au! au BufWritePost ~/.vimrc so ~/.vimrc au BufWritePost _vimrc so ~/_vimrc au BufWritePost vimrc so ~/.vimrc augroup END " Set colorcolumn to 80 chars, or (if not supported) highlight lines > 80 chars augroup ColorColumnConfig au! if exists('+colorcolumn') au BufWinEnter * set colorcolumn=80 au BufWinEnter * hi ColorColumn ctermbg=lightgrey guibg=lightgrey else au BufWinEnter * let w:m2=matchadd('ErrorMsg', '\%>80v.\+', -1) endif augroup END " Highlight over-length characters and trailing whitespace augroup ExtraCharacters au! au ColorScheme * highlight ExtraWhitespace ctermbg=Red guibg=Red au ColorScheme * highlight OverLength ctermbg=red ctermfg=white guibg=red guifg=white au BufWinEnter * let w:whitespace_match_number = \ matchadd('ExtraWhitespace', '\s\+$') au BufWinEnter * call matchadd('OverLength', \ '\(^\(\s\)\{-}\(*\|//\|/\*\)\{1}\(.\)*\(\%81v\)\)\@<=\(.\)\{1,}$') au InsertEnter * call s:ToggleWhitespaceMatch('i') au InsertLeave * call s:ToggleWhitespaceMatch('n') augroup END " Resize splits on window resize au VimResized * exe "normal! \<cw>=" " Restore the cursor when we can. au BufWinEnter * call RestoreCursor() " Change the statusline color based on current mode augroup StatuslineColor au! au InsertEnter * call InsertStatuslineColor(v:insertmode) au InsertLeave * hi statusline ctermfg=cyan ctermbg=black guifg=cyan guibg=black augroup END """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" " Plugins """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" " Pathogen - https://github.com/tpope/vim-pathogen runtime bundle/vim-pathogen/autoload/pathogen.vim call pathogen
And the following plugins make up the contents of my bundle directory ( https://github.com/chpatton013/dotfiles/tree/master/vim/.vim/bundle ):
neocomplcache/ syntastic/ vim-abolish/ vim-colors-solarized/ vim-commentary/ vim-easymotion/ vim-fugitive/ vim-pathogen/ vim-repeat/ vim-surround/
Finally, I disabled all plugins, but the problem was not resolved. I deleted my .vimrc and the problem was resolved (so this is not some kind of global setting out of my control). I disabled some individual settings in .vimrc , but I could not fix the problem. In the end, I got tired of playing beat-moth and decided to appeal to the community. Any ideas?
EDIT: As an example,
I use the command :%s/foo/foobar/g
Text foo bar foo converted to foobar bar foo
EDIT: Solved by pb2q. set gdefault inverts the behavior of /g .
chpatton013
source share