aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--bundle/case_star/plugin/case_star.vim28
1 files changed, 27 insertions, 1 deletions
diff --git a/bundle/case_star/plugin/case_star.vim b/bundle/case_star/plugin/case_star.vim
index 62deac7..cc9d530 100644
--- a/bundle/case_star/plugin/case_star.vim
+++ b/bundle/case_star/plugin/case_star.vim
@@ -1,5 +1,31 @@
" TODO: if not on start of word, ensure we move to previous match
-nnoremap <silent> c# ?\C<C-r>=expand('<cword>')<CR><CR>
+" 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