I just recently found a very nice command to search for a pattern in a document, and display all hits:
Since the command is a bit cumbersome to type, I would like to make a shortcut, so instead of typing the command above, I could simply type
sl stands for search & list, for lack of a better name.)
I wonder what is the best way to do this. I think one first needs to define a function
function! SearchList(pattern) f/a:pattern/z#.1 endfunction
But the only thing the function does, is to show its own content (since this is the only occurrence of
a:pattern in my
So here I'm stuck. To create a mapping, is the function actually needed? Or what is the best way to define the mapping? And if indeed a function is the way to go, how would I write this function?