mirror of
				https://github.com/amix/vimrc
				synced 2025-10-31 06:33:35 +08:00 
			
		
		
		
	Merge pull request #179 from dragonxlwang/patch-1
enable search with visual selection with highlight
This commit is contained in:
		| @ -199,8 +199,8 @@ set wrap "Wrap lines | ||||
| """""""""""""""""""""""""""""" | ||||
| " Visual mode pressing * or # searches for the current selection | ||||
| " Super useful! From an idea by Michael Naumann | ||||
| vnoremap <silent> * :call VisualSelection('f', '')<CR> | ||||
| vnoremap <silent> # :call VisualSelection('b', '')<CR> | ||||
| vnoremap <silent> * :<C-u>call VisualSelection('', '')<CR>/<C-R>=@/<CR><CR> | ||||
| vnoremap <silent> # :<C-u>call VisualSelection('', '')<CR>?<C-R>=@/<CR><CR> | ||||
|  | ||||
|  | ||||
| """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" | ||||
| @ -379,14 +379,10 @@ function! VisualSelection(direction, extra_filter) range | ||||
|     let l:pattern = escape(@", '\\/.*$^~[]') | ||||
|     let l:pattern = substitute(l:pattern, "\n$", "", "") | ||||
|  | ||||
|     if a:direction == 'b' | ||||
|         execute "normal ?" . l:pattern . "^M" | ||||
|     elseif a:direction == 'gv' | ||||
|     if a:direction == 'gv' | ||||
|         call CmdLine("Ag \"" . l:pattern . "\" " ) | ||||
|     elseif a:direction == 'replace' | ||||
|         call CmdLine("%s" . '/'. l:pattern . '/') | ||||
|     elseif a:direction == 'f' | ||||
|         execute "normal /" . l:pattern . "^M" | ||||
|     endif | ||||
|  | ||||
|     let @/ = l:pattern | ||||
|  | ||||
		Reference in New Issue
	
	Block a user
	 Amir Salihefendic
					Amir Salihefendic