Greetings.
I've been using Vim for a long time, but never got around to learning programming in it. I've always found it difficult. I wonder if someone here is willing to help me with a little project.
I sometimes highlight a line or paragraph and run some search and replace on it:
:'<,'>s/some string/another string/g
Then I may do it again with another pair of strings. Then another pair.
Some time later, I may have to do it again. There may be new string pairs, but most of the pairs will have been applied before. So at least they are recorded in the command history for some time. But sometimes that history is lost/overwritten or it's just annoying to scroll until I find the exact desired pair.
So I would like to create a list of string pairs, ideally in a separate file and with some kind of separator such as '|' between the strings. Then I would highlight the line or paragraph and run the macro or script and have all pair replacements applied automatically.
The replacing part would be quite easy for me to accomplish if I only wanted to apply one pair of strings. But I want to keep a list and I have no idea about how to open and parse the list file and iterate over each pair. I know a little programming and I could certainly achieve that in other languages, but I am really not fluent in Vimish. Can someone please help me with that?
TIA
--
Luciano ES
>>
--
--
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/20210828030535.3c58eb60%40lud1.home.
No comments:
Post a Comment