How do I display all the lines in the current buffer that contain a specified pattern?
You can use the following command to display all the lines in the current buffer that contain a specified pattern:
:g//p
For example, the following command will display all the lines in the current buffer that contain “vim”:
:g/vim/p
Since :p is the default command to be executed for the ex command :g, you can also use:
:g/vim
If you also want the corresponding line numbers, then you can use the following command:
:g//#
Read free Software Algorithms and Computer Science Books by CodeAhoy Learn.
Introduction to Recursion and Backtracking