aboutsummaryrefslogtreecommitdiffstats
path: root/bundle/case_star/plugin/case_star.vim
blob: cc9d53013bee563866e9dc4e805271477dc136a6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
" TODO: if not on start of word, ensure we move to previous match
" nnoremap <silent> c# :call search('\C' . expand('<cword>'), 'bz')<CR>
" nnoremap <expr> c# <SID>SearchBackward()
" nnoremap c# :call <SID>SearchBackward()<CR>
nnoremap <expr> c# <SID>SearchBackward()
" nnoremap <silent> c* :call search('\C' . expand('<cword>'), 'z')<CR>
nnoremap <silent> c* /\C<C-r>=expand('<cword>')<CR><CR>

" call search('\C' . expand('<cword>'), 'bz')
" call search('\C' . expand('<cword>'), 'z')

" TODO: Currently behaves like g* g#. Need * # versions.


" function! s:SearchBackward()
" 	call search('\<', 'bc')
" 	" return "?\\C\<C-r>=expand('<cword>')\<CR>\<CR>"
" 	" execute 'normal! ?\C' . expand('<cword>') . '<CR>'
" 	execute 'normal! ?\C' . expand('<cword>') . "\<CR>"
" endfunction

function! s:SearchBackward()
	let expr = ''

	let expr .= ":call search('\<', 'bc')\<CR>"
	" let expr .= "?\\C\<C-r>=expand('<cword>')\<CR>\<CR>"
	let cword = expand('<cword>')
	let expr .= '?\C' . cword ."\<CR>"

	return expr
endfunction