I am trying to display a hotkey to do the following in Vim:
- Matches the current c-word currently marked with the cursor
- Create a list of all found occurrences in the current project.
- Open a new tab showing the results.
So, one example that I use uses CTAGS, opens a variable / function declaration in a new tab, for example:
map <C-\> :split<CR>:exec("tag ".expand("<cword>"))<CR>
When pressed CTRL, \a new tab opens with the declaration of the variable / function in which the cursor is located.
The command I'm trying to display is shown below:
:lvim /\<\(text_i_want_to_find\)\>/gj *.c
:lw
When I run this command, a new tab opens containing a list of all .cfiles containing text text_i_want_to_find. I need to change this to do two things different from what she is doing now:
- Search for all files with the extensions
.c, .h, .cpp, .mkinstead of just .c, as well as to search for files with the name "Makefile" - Locate the c-word under the cursor as shown in the figure CTRL- \, instead of manually entering text
text_i_want_to_find
Here is the code in my file .vimrcfor matching. I'm not quite sure if CTRL- can be displayed /, so there is another problem for me.
map <C-/> :split<CR>:lvim /\<\(.expand("<cword>")\)\>/gj *.c *.h *.cpp *.mk Makefile
Does anyone have any tips for fixing this Vim mapping?
EDIT:
, , :
command! -nargs=1 SearchAll execute " grep -srnw --binary-files=without-match --exclude={*~,tags} --exclude-dir=.svn . -e " . expand("<args>") . " " <bar> cwindow
map <C-g> :SearchAll <cword><CR>
CTRL + g. , :
:SearchAll my_text_to_search_for
, !