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(…

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!


Print Share Comment Cite Upload Translate
APA
Jonas Schumacher | Sciencx (2024-03-29T12:50:18+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 2024-03-29T12:50:18+00:00,<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 2024-03-29T12:50:18+00:00]. 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 2024-03-29T12:50:18+00:00. 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: 2024-03-29T12:50:18+00:00]
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/ | 2024-03-29T12:50:18+00:00
https://github.com/addpipe/simple-recorderjs-demo