Search for word boundaries in Vim & VSCode Vim

So you know that / will bring up search in Vim and VSCode Vim. That’s good!

But then you named a variable is and now want to find every occurence of that word – but only where it stands alone. So no places where it occurs as part of your isLargePizza(…


This content originally appeared on DEV Community 👩‍💻👨‍💻 and was authored by Jonas Schumacher

So you know that / will bring up search in Vim and VSCode Vim. That's good!

But then you named a variable is and now want to find every occurence of that word - but only where it stands alone. So no places where it occurs as part of your isLargePizza() function for example.

Luckily, that's doable: \< matches the beginning of a word and \> the end.

So hitting ...

/\<is\>

... will to the trick!


This content originally appeared on DEV Community 👩‍💻👨‍💻 and was authored by Jonas Schumacher


Print Share Comment Cite Upload Translate Updates
APA

Jonas Schumacher | Sciencx (2022-12-03T13:33:02+00:00) Search for word boundaries in Vim & VSCode Vim. Retrieved from https://www.scien.cx/2022/12/03/search-for-word-boundaries-in-vim-vscode-vim/

MLA
" » Search for word boundaries in Vim & VSCode Vim." Jonas Schumacher | Sciencx - Saturday December 3, 2022, https://www.scien.cx/2022/12/03/search-for-word-boundaries-in-vim-vscode-vim/
HARVARD
Jonas Schumacher | Sciencx Saturday December 3, 2022 » Search for word boundaries in Vim & VSCode Vim., viewed ,<https://www.scien.cx/2022/12/03/search-for-word-boundaries-in-vim-vscode-vim/>
VANCOUVER
Jonas Schumacher | Sciencx - » Search for word boundaries in Vim & VSCode Vim. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2022/12/03/search-for-word-boundaries-in-vim-vscode-vim/
CHICAGO
" » Search for word boundaries in Vim & VSCode Vim." Jonas Schumacher | Sciencx - Accessed . https://www.scien.cx/2022/12/03/search-for-word-boundaries-in-vim-vscode-vim/
IEEE
" » Search for word boundaries in Vim & VSCode Vim." Jonas Schumacher | Sciencx [Online]. Available: https://www.scien.cx/2022/12/03/search-for-word-boundaries-in-vim-vscode-vim/. [Accessed: ]
rf:citation
» Search for word boundaries in Vim & VSCode Vim | Jonas Schumacher | Sciencx | https://www.scien.cx/2022/12/03/search-for-word-boundaries-in-vim-vscode-vim/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.