Adds codemod function
This commit is contained in:
parent
c7c71da568
commit
085a7e446d
2 changed files with 35 additions and 1 deletions
|
|
@ -438,7 +438,7 @@ vnoremap L $
|
|||
|
||||
|
||||
" Search for visually selected text
|
||||
vnoremap // y/<C-r>"<CR>N
|
||||
" vnoremap // y/<C-r>"<CR>N
|
||||
|
||||
|
||||
" trim trailing whitespace on save
|
||||
|
|
@ -459,3 +459,20 @@ let g:ctrlp_custom_ignore = {
|
|||
\ 'file': '\v\.(exe|dll|png|jpg|jpeg)$'
|
||||
\}
|
||||
|
||||
|
||||
" Search within a visual selection
|
||||
function! RangeSearch(direction)
|
||||
call inputsave()
|
||||
let g:srchstr = input(a:direction)
|
||||
call inputrestore()
|
||||
if strlen(g:srchstr) > 0
|
||||
let g:srchstr = g:srchstr.
|
||||
\ '\%>'.(line("'<")-1).'l'.
|
||||
\ '\%<'.(line("'>")+1).'l'
|
||||
else
|
||||
let g:srchstr = ''
|
||||
endif
|
||||
endfunction
|
||||
vnoremap <silent> / :<C-U>call RangeSearch('/')<CR>:if strlen(g:srchstr) > 0\|exec '/'.g:srchstr\|endif<CR>
|
||||
vnoremap <silent> ? :<C-U>call RangeSearch('?')<CR>:if strlen(g:srchstr) > 0\|exec '?'.g:srchstr\|endif<CR>
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue