Skip to content

Instantly share code, notes, and snippets.

@ivankovnatsky
Last active November 2, 2023 14:29
Show Gist options
  • Save ivankovnatsky/09a9d41267252160f4610b48fb118ce3 to your computer and use it in GitHub Desktop.
Save ivankovnatsky/09a9d41267252160f4610b48fb118ce3 to your computer and use it in GitHub Desktop.

Replace recursively

:args `rg Neovim -l`

:argdo %s/Neovim/Nvim/ge | update

Replace visual selection

:'<,'>:s/\%V[ :]/-/g

Continue with macros execution till the end of the file

:%:normal @h

https://vim.fandom.com/wiki/Search_and_replace_in_a_visual_selection

Rename file name

Without plugins, by vim way:

:!sav new.name to write current file with a new name and immediately open this file.

:!rm <c-r># to remove previously opened file (your file old.name in this case). Without this command it will be still on the disk. Note that <c-r># is actually what you should press, not a command. It should insert filename into rm command: :!rm old.name.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment