CDO: Vim commands you NEED TO KNOW #5
If you’re new to using Vim or just looking to brush up on your skills, there are a few essential commands that you absolutely need to know. Here are five important Vim commands that will make your editing experience smooth and efficient.
1. :w
This command allows you to save your changes to the current file. Simply type :w and press Enter to save your work. You can also use :w filename to save the file with a new name.
2. :q
To quit Vim, use the :q command. If you have unsaved changes, you can use :q! to force quit without saving. Remember to save your work before quitting!
3. :wq
Combining the save and quit commands, :wq allows you to save your changes and exit Vim in one go. This is a quick and efficient way to close your file after making edits.
4. /search term
To search for a specific term in your file, use the / command followed by the term you want to search for. Press Enter to find the next occurrence of the term in your document.
5. :%s/search term/replacement term/g
If you want to replace all occurrences of a term in your file, use the :%s command. Simply type :%s/search term/replacement term/g and press Enter to replace all instances of the search term with the replacement term.
These five Vim commands are essential for efficiently navigating and editing your files. Practice using them regularly to become a master at Vim editing!
How do you learn that? Reading the documentation?
Using jetbrains ide you just use refactor->rename and voila
Wtf is that thing that appeared under your ear among the shots?
Ctrl-Q made my day. Thanks
Bro has never heard of LSP refactor
Thanks nerd
The thing about vim is that you cant actually exit it.
Or you use spectra
Is there a way to do it like in visual studio?….In VS I can right click -> rename variable and it renames variable across whole project automatically and pretty safe because it is based on language symbol….is it possible to do it in vim by LSP???
Big if true!
How to open telescope?
Specifically for s//g this may have had the same behavior, but it is good to be careful to use the correct command depending on whether you need it too run once per item found (cdo) or once per file where an item was found (cfdo if I'm not mistaken).
Example: if you want to add an import clause at the start of the file for every file where there is an item in the quickfix list you could do `:cfdo norm ggOimport foo` (may need to escape the spacebar). If you use cdo in this case, files with multiple of term found would add multiple of the same import to the top of the file.
`:vimgrep previous src/**/*.js` then `:cdo s/previous/next` no telescope required.
or you could highlight the variable and press F6 in jetbrains….
cmd+shift+r in jetbrains 😢
When we getting livestreams ???
so, you found how to replace foo with bar in all files without using a mouse in vim. horayy, that will boost my productivity 10x!
Hey, thanks nerds 😆
lsp renaming would be better but this is cool, gna use it from now
+1 sub! 🎉 🚀🙌