Limiting search scope for code in Vim
How can I limit the search scope in Vim to the function/class/code block that the cursor is currently in, without having to figure out what the line numbers are? Being able to search in the visual selection would also do, as there are methods for selecting the current code block. (Similar to this question, but more generic) I'm going to just copy and paste the entire content of "Searching with / and ?" (within a visual selection) from the Vim Tips Wiki . In visual mode, / and ? will update the visual selection just like any other cursor-movement command (that is, when in visual mode, searching