Select and Insert for each symbol in VIM or Emacs












0















Im trying to do this im VIM but im open for emacs too.



Lets say I got a block of code like this.



test.butter0.(A, b)
test.butter1.(A, b)
test.butter2.(A, b)
test.butter3.(A, b)
test.butter4.(A, b)
test.butter5.(A, b)


And now I press Control V and I select all of the "." Symbols. Now I want to press Colon ":" and insert colon for each individual "." symbol.



So select and then press a Key and insert that key in each place of the selected symbol or letter. Also would be awesome if I can also copy one symbol or string from my file and then select all period or @ sings or all numbers or any vertical column of symbols and paste it but replace it for each symbol selected.



like this:



test:butter0.(A, b)
test:butter1.(A, b)
test:butter2.(A, b)
test:butter3.(A, b)
test:butter4.(A, b)
test:butter5.(A, b)


or



test.butter@.(A, b)
test.butter@.(A, b)
test.butter@.(A, b)
test.butter@.(A, b)
test.butter@.(A, b)
test.butter@.(A, b)


Is that possible? and if yes how? If it's not possible, how hard would it be to write a Select+insert for each symbol extension?










share|improve this question

























  • Someone just posted this: %s/./:/ and it worked. Is it possible to Shortcut it to a key combination?

    – Barry
    Dec 16 '18 at 15:48











  • Close voters: programming tools like editors are on topic, though there is also vi.stackexchange.com if you feel the question belongs elsewhere.

    – snakecharmerb
    Dec 16 '18 at 15:49
















0















Im trying to do this im VIM but im open for emacs too.



Lets say I got a block of code like this.



test.butter0.(A, b)
test.butter1.(A, b)
test.butter2.(A, b)
test.butter3.(A, b)
test.butter4.(A, b)
test.butter5.(A, b)


And now I press Control V and I select all of the "." Symbols. Now I want to press Colon ":" and insert colon for each individual "." symbol.



So select and then press a Key and insert that key in each place of the selected symbol or letter. Also would be awesome if I can also copy one symbol or string from my file and then select all period or @ sings or all numbers or any vertical column of symbols and paste it but replace it for each symbol selected.



like this:



test:butter0.(A, b)
test:butter1.(A, b)
test:butter2.(A, b)
test:butter3.(A, b)
test:butter4.(A, b)
test:butter5.(A, b)


or



test.butter@.(A, b)
test.butter@.(A, b)
test.butter@.(A, b)
test.butter@.(A, b)
test.butter@.(A, b)
test.butter@.(A, b)


Is that possible? and if yes how? If it's not possible, how hard would it be to write a Select+insert for each symbol extension?










share|improve this question

























  • Someone just posted this: %s/./:/ and it worked. Is it possible to Shortcut it to a key combination?

    – Barry
    Dec 16 '18 at 15:48











  • Close voters: programming tools like editors are on topic, though there is also vi.stackexchange.com if you feel the question belongs elsewhere.

    – snakecharmerb
    Dec 16 '18 at 15:49














0












0








0








Im trying to do this im VIM but im open for emacs too.



Lets say I got a block of code like this.



test.butter0.(A, b)
test.butter1.(A, b)
test.butter2.(A, b)
test.butter3.(A, b)
test.butter4.(A, b)
test.butter5.(A, b)


And now I press Control V and I select all of the "." Symbols. Now I want to press Colon ":" and insert colon for each individual "." symbol.



So select and then press a Key and insert that key in each place of the selected symbol or letter. Also would be awesome if I can also copy one symbol or string from my file and then select all period or @ sings or all numbers or any vertical column of symbols and paste it but replace it for each symbol selected.



like this:



test:butter0.(A, b)
test:butter1.(A, b)
test:butter2.(A, b)
test:butter3.(A, b)
test:butter4.(A, b)
test:butter5.(A, b)


or



test.butter@.(A, b)
test.butter@.(A, b)
test.butter@.(A, b)
test.butter@.(A, b)
test.butter@.(A, b)
test.butter@.(A, b)


Is that possible? and if yes how? If it's not possible, how hard would it be to write a Select+insert for each symbol extension?










share|improve this question
















Im trying to do this im VIM but im open for emacs too.



Lets say I got a block of code like this.



test.butter0.(A, b)
test.butter1.(A, b)
test.butter2.(A, b)
test.butter3.(A, b)
test.butter4.(A, b)
test.butter5.(A, b)


And now I press Control V and I select all of the "." Symbols. Now I want to press Colon ":" and insert colon for each individual "." symbol.



So select and then press a Key and insert that key in each place of the selected symbol or letter. Also would be awesome if I can also copy one symbol or string from my file and then select all period or @ sings or all numbers or any vertical column of symbols and paste it but replace it for each symbol selected.



like this:



test:butter0.(A, b)
test:butter1.(A, b)
test:butter2.(A, b)
test:butter3.(A, b)
test:butter4.(A, b)
test:butter5.(A, b)


or



test.butter@.(A, b)
test.butter@.(A, b)
test.butter@.(A, b)
test.butter@.(A, b)
test.butter@.(A, b)
test.butter@.(A, b)


Is that possible? and if yes how? If it's not possible, how hard would it be to write a Select+insert for each symbol extension?







python python-3.x python-2.7 vim emacs






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Dec 16 '18 at 15:40







Barry

















asked Dec 16 '18 at 15:35









BarryBarry

726




726













  • Someone just posted this: %s/./:/ and it worked. Is it possible to Shortcut it to a key combination?

    – Barry
    Dec 16 '18 at 15:48











  • Close voters: programming tools like editors are on topic, though there is also vi.stackexchange.com if you feel the question belongs elsewhere.

    – snakecharmerb
    Dec 16 '18 at 15:49



















  • Someone just posted this: %s/./:/ and it worked. Is it possible to Shortcut it to a key combination?

    – Barry
    Dec 16 '18 at 15:48











  • Close voters: programming tools like editors are on topic, though there is also vi.stackexchange.com if you feel the question belongs elsewhere.

    – snakecharmerb
    Dec 16 '18 at 15:49

















Someone just posted this: %s/./:/ and it worked. Is it possible to Shortcut it to a key combination?

– Barry
Dec 16 '18 at 15:48





Someone just posted this: %s/./:/ and it worked. Is it possible to Shortcut it to a key combination?

– Barry
Dec 16 '18 at 15:48













Close voters: programming tools like editors are on topic, though there is also vi.stackexchange.com if you feel the question belongs elsewhere.

– snakecharmerb
Dec 16 '18 at 15:49





Close voters: programming tools like editors are on topic, though there is also vi.stackexchange.com if you feel the question belongs elsewhere.

– snakecharmerb
Dec 16 '18 at 15:49












3 Answers
3






active

oldest

votes


















1














You can just press "r:" (no quotes).
It will replace the whole block with the colon character.






share|improve this answer



















  • 1





    Thats it. Nice thank you man

    – Barry
    Dec 16 '18 at 16:23



















1















  • Select the text block visually as you describe

  • press ':'

  • s/./:/g


Does that do what you want?






share|improve this answer
























  • This will only replace the first "." to ":".

    – Barry
    Dec 16 '18 at 15:42











  • :substitute works with linewise ranges, not block selections.

    – D. Ben Knoble
    Dec 16 '18 at 20:14



















1














Try



:1,5s/[0-5].(/@:(/g




where 1, 5 => start, end line numbers





Or else select text and then use



:'<,'>s/[0-5].(/@:(/g





share|improve this answer


























  • %s/./:/ works fine man. Is it possible to bind that to let's say: CTR + double V when pasting? so that I can select the entire column of periods with Command+V, then pressing control and twice V to paste it in for each selected character.

    – Barry
    Dec 16 '18 at 15:54











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53803688%2fselect-and-insert-for-each-symbol-in-vim-or-emacs%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























3 Answers
3






active

oldest

votes








3 Answers
3






active

oldest

votes









active

oldest

votes






active

oldest

votes









1














You can just press "r:" (no quotes).
It will replace the whole block with the colon character.






share|improve this answer



















  • 1





    Thats it. Nice thank you man

    – Barry
    Dec 16 '18 at 16:23
















1














You can just press "r:" (no quotes).
It will replace the whole block with the colon character.






share|improve this answer



















  • 1





    Thats it. Nice thank you man

    – Barry
    Dec 16 '18 at 16:23














1












1








1







You can just press "r:" (no quotes).
It will replace the whole block with the colon character.






share|improve this answer













You can just press "r:" (no quotes).
It will replace the whole block with the colon character.







share|improve this answer












share|improve this answer



share|improve this answer










answered Dec 16 '18 at 16:18









Lucas GouvêaLucas Gouvêa

262




262








  • 1





    Thats it. Nice thank you man

    – Barry
    Dec 16 '18 at 16:23














  • 1





    Thats it. Nice thank you man

    – Barry
    Dec 16 '18 at 16:23








1




1





Thats it. Nice thank you man

– Barry
Dec 16 '18 at 16:23





Thats it. Nice thank you man

– Barry
Dec 16 '18 at 16:23













1















  • Select the text block visually as you describe

  • press ':'

  • s/./:/g


Does that do what you want?






share|improve this answer
























  • This will only replace the first "." to ":".

    – Barry
    Dec 16 '18 at 15:42











  • :substitute works with linewise ranges, not block selections.

    – D. Ben Knoble
    Dec 16 '18 at 20:14
















1















  • Select the text block visually as you describe

  • press ':'

  • s/./:/g


Does that do what you want?






share|improve this answer
























  • This will only replace the first "." to ":".

    – Barry
    Dec 16 '18 at 15:42











  • :substitute works with linewise ranges, not block selections.

    – D. Ben Knoble
    Dec 16 '18 at 20:14














1












1








1








  • Select the text block visually as you describe

  • press ':'

  • s/./:/g


Does that do what you want?






share|improve this answer














  • Select the text block visually as you describe

  • press ':'

  • s/./:/g


Does that do what you want?







share|improve this answer












share|improve this answer



share|improve this answer










answered Dec 16 '18 at 15:40









snakecharmerbsnakecharmerb

11.4k42251




11.4k42251













  • This will only replace the first "." to ":".

    – Barry
    Dec 16 '18 at 15:42











  • :substitute works with linewise ranges, not block selections.

    – D. Ben Knoble
    Dec 16 '18 at 20:14



















  • This will only replace the first "." to ":".

    – Barry
    Dec 16 '18 at 15:42











  • :substitute works with linewise ranges, not block selections.

    – D. Ben Knoble
    Dec 16 '18 at 20:14

















This will only replace the first "." to ":".

– Barry
Dec 16 '18 at 15:42





This will only replace the first "." to ":".

– Barry
Dec 16 '18 at 15:42













:substitute works with linewise ranges, not block selections.

– D. Ben Knoble
Dec 16 '18 at 20:14





:substitute works with linewise ranges, not block selections.

– D. Ben Knoble
Dec 16 '18 at 20:14











1














Try



:1,5s/[0-5].(/@:(/g




where 1, 5 => start, end line numbers





Or else select text and then use



:'<,'>s/[0-5].(/@:(/g





share|improve this answer


























  • %s/./:/ works fine man. Is it possible to bind that to let's say: CTR + double V when pasting? so that I can select the entire column of periods with Command+V, then pressing control and twice V to paste it in for each selected character.

    – Barry
    Dec 16 '18 at 15:54
















1














Try



:1,5s/[0-5].(/@:(/g




where 1, 5 => start, end line numbers





Or else select text and then use



:'<,'>s/[0-5].(/@:(/g





share|improve this answer


























  • %s/./:/ works fine man. Is it possible to bind that to let's say: CTR + double V when pasting? so that I can select the entire column of periods with Command+V, then pressing control and twice V to paste it in for each selected character.

    – Barry
    Dec 16 '18 at 15:54














1












1








1







Try



:1,5s/[0-5].(/@:(/g




where 1, 5 => start, end line numbers





Or else select text and then use



:'<,'>s/[0-5].(/@:(/g





share|improve this answer















Try



:1,5s/[0-5].(/@:(/g




where 1, 5 => start, end line numbers





Or else select text and then use



:'<,'>s/[0-5].(/@:(/g






share|improve this answer














share|improve this answer



share|improve this answer








edited Jan 1 at 16:19

























answered Dec 16 '18 at 15:49









shirishshirish

63336




63336













  • %s/./:/ works fine man. Is it possible to bind that to let's say: CTR + double V when pasting? so that I can select the entire column of periods with Command+V, then pressing control and twice V to paste it in for each selected character.

    – Barry
    Dec 16 '18 at 15:54



















  • %s/./:/ works fine man. Is it possible to bind that to let's say: CTR + double V when pasting? so that I can select the entire column of periods with Command+V, then pressing control and twice V to paste it in for each selected character.

    – Barry
    Dec 16 '18 at 15:54

















%s/./:/ works fine man. Is it possible to bind that to let's say: CTR + double V when pasting? so that I can select the entire column of periods with Command+V, then pressing control and twice V to paste it in for each selected character.

– Barry
Dec 16 '18 at 15:54





%s/./:/ works fine man. Is it possible to bind that to let's say: CTR + double V when pasting? so that I can select the entire column of periods with Command+V, then pressing control and twice V to paste it in for each selected character.

– Barry
Dec 16 '18 at 15:54


















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53803688%2fselect-and-insert-for-each-symbol-in-vim-or-emacs%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

MongoDB - Not Authorized To Execute Command

How to fix TextFormField cause rebuild widget in Flutter

in spring boot 2.1 many test slices are not allowed anymore due to multiple @BootstrapWith