Last active
February 8, 2019 07:59
-
-
Save HersonHN/5414492 to your computer and use it in GitHub Desktop.
Global Search in VIM
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function! GlobalSearch() | |
let text = escape(input("what do you want to search?: "), '\\/') | |
if text == "" | |
echo "" | return | |
endif | |
let extension = escape(input("Wich extension? (* for all): "), '\\/') | |
if extension == "" | |
echo "" | return | |
endif | |
let search_command = ':lvim /\V' . text . '/gj ./**/*.' . extension | |
try | |
execute search_command | |
catch | |
echo "Nothing found" | |
return | |
endtry | |
lwindow | |
endfunction | |
""" mapping the function to leader-shift-f | |
noremap <leader>F :call GlobalSearch() <CR> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment