0

I use the autocmd VimEnter * echo "some text" but this is showing for every file when I open.

How to restrict this only for a specific folders? Let's say /tmp/test/sample.txt. If I want to use the above logic for sample.txt in /tmp/test, how to do this?

Kusalananda
  • 320,670
  • 36
  • 633
  • 936
Deepak
  • 3
  • 1

1 Answers1

1

You were along the correct lines, just change the * to the path that you want to apply the autocmd to:

autocmd VimEnter /tmp/test/* echo "Some text for /tmp/test"
Ed Neville
  • 1,330
  • 10
  • 11
  • what I am expecting is when I vim /tmp/test/sample.txt should see the custom message but with this I did not see the actual expected message. – Deepak Feb 15 '17 at 19:50
  • Please provide the exact line that you're using as I get the desired behaviour, a message is printed at the bottom of the vim window. Please also confirm that you're using vim and not a different vi derivative. – Ed Neville Feb 15 '17 at 20:25
  • applogies, Yeah it is working fine as I expected. One QQ how to do with vim and vi and View in a single command any chance to figure it out? – Deepak Feb 15 '17 at 20:35