Create a gist now

Instantly share code, notes, and snippets.

eregexプラグイン用に、 1,$s/ → 1,$S/ に変換 g/ → G/ に変換
" eregexプラグイン用に、 1,$s/ → 1,$S/ に変換 g/ → G/ に変換
" Based on: https://twitter.com/koturn/status/843830301780406272
" https://gist.github.com/hyuki0000/45189cb5e188ef42c8ca0925cd3acf95
cnoremap <expr>/ ReplaceSlash()
function ReplaceSlash()
if getcmdtype() ==# ':'
if getcmdline() ==# '1,$s'
call feedkeys("\<C-u>1,$S/", 'n')
return
elseif getcmdline() ==# 'g'
call feedkeys("\<C-u>G/", 'n')
return
endif
endif
return '/'
endfunction
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment