Skip to content

Instantly share code, notes, and snippets.

@kana
Created September 13, 2011 11:39
Show Gist options
  • Save kana/1213642 to your computer and use it in GitHub Desktop.
Save kana/1213642 to your computer and use it in GitHub Desktop.
" Quick and dirty solution to http://mobile.twitter.com/nelstrom/status/113572537610416128
" http://stackoverflow.com/questions/7400743/create-a-mapping-for-vims-command-line-that-escapes-the-contents-of-a-register-b
" https://github.com/kana/vim-operator-user
map YourFavoriteKeySequence <Plug>(operator-search-target-text)
call operator#user#define('search-target-text', 'OperatorSerachTargetText')
function! OperatorSerachTargetText(motion_wise)
execute 'normal!' '`['.operator#user#visual_command_from_wise_name(a:motion_wise).'`]"xy'
let @/ = '\V' . escape(substitute(@x, '[\r\n]$', '', ''), '\')
normal! n
endfunction
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment