Wednesday, January 10, 2024

How to replace characters in visual block selection

I use vim 9.1.0016 on Windows 10.

In second column I would like to replace all A characters with X characters.

Sample:
AAA AAA
AAA AAA


After change:
AAA XXX
AAA XXX


Above is very simple sample. In my case I have text of words, not just letter A.

I did:
My cursor after opening a file is at first character in top left as expected.
1. Move 4 characters to the right: 4l
2. To get into visual block: CTRL+V
3. Select current and line bellow: j
4. Select text to tend of line: $
5. Now second column is selected. I would like do the substitution with: :s/A/X/g
And now I get:
XXX XXX
XXX XXX


How to substitute characters inside visual block?
Regards

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/87ea4f57-af67-443f-9d06-d0ace2996e0en%40googlegroups.com.

No comments: