Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

vim: how to grep from current directory?

Tags:

grep

vim

I run vim . in some directory. Inside vim I move to another directory. There I run :grep command which searches from the first directory where I run vim .. How to configure vim to :grep from the path where currently it is?

like image 648
Ashot Avatar asked Feb 19 '13 14:02

Ashot


1 Answers

I have the <leader>cd to %:p:hmapping too, it is nice.

However for your needs, this line may be better

:grep [options] 'pattern' %:p:h/*

this will do grep from the path of current open file, and keep your real current directory (pwd) untouched.

like image 194
Kent Avatar answered Sep 22 '22 19:09

Kent