Skip to content

Instantly share code, notes, and snippets.

@jhbabon
Last active December 12, 2018 10:10
Show Gist options
  • Save jhbabon/553026dfd861e9377c84c418ca829f4d to your computer and use it in GitHub Desktop.
Save jhbabon/553026dfd861e9377c84c418ca829f4d to your computer and use it in GitHub Desktop.
scout.vim visual selection
" see: http://vimcasts.org/episodes/search-for-the-selected-text/
function! s:VScoutSearch(cmdtype)
let temp = @s
norm! gv"sy
let s:selection = @s
let @s = temp
if a:cmdtype == 'files'
call scout#files#run({ 'search': s:selection })
endif
if a:cmdtype == 'buffers'
call scout#buffers#run({ 'search': s:selection })
endif
endfunction
xnoremap <leader>fw :<C-u>call <SID>VScoutSearch('files')<CR>
xnoremap <leader>bw :<C-u>call <SID>VScoutSearch('buffers')<CR>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment