Search code examples
vim

How to match `<<` only at the beginning of every line?


I want to search << at the beginning of the lines in the following text.

<<test
test<<
test<<test
<<test

The result I expect are << in the first line and the 4th line , not include 3rd line . I tried to use \<<< to match prefix . But it is useless . What should I do ? Thank you .


Solution

  • To match the beginning of a line, use the atom ^. This should do what you want:

    /^<<