Skip to content

Instantly share code, notes, and snippets.

@hyuki0000
Last active March 21, 2017 02:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hyuki0000/45189cb5e188ef42c8ca0925cd3acf95 to your computer and use it in GitHub Desktop.
Save hyuki0000/45189cb5e188ef42c8ca0925cd3acf95 to your computer and use it in GitHub Desktop.
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