Select and Insert for each symbol in VIM or Emacs
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
add a comment |
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
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
add a comment |
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
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
python python-3.x python-2.7 vim emacs
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
add a comment |
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
add a comment |
3 Answers
3
active
oldest
votes
You can just press "r:" (no quotes).
It will replace the whole block with the colon character.
1
Thats it. Nice thank you man
– Barry
Dec 16 '18 at 16:23
add a comment |
- Select the text block visually as you describe
- press ':'
s/./:/g
Does that do what you want?
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
add a comment |
Try
:1,5s/[0-5].(/@:(/g
where 1, 5 => start, end line numbers
Or else select text and then use
:'<,'>s/[0-5].(/@:(/g
%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
add a comment |
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
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
You can just press "r:" (no quotes).
It will replace the whole block with the colon character.
1
Thats it. Nice thank you man
– Barry
Dec 16 '18 at 16:23
add a comment |
You can just press "r:" (no quotes).
It will replace the whole block with the colon character.
1
Thats it. Nice thank you man
– Barry
Dec 16 '18 at 16:23
add a comment |
You can just press "r:" (no quotes).
It will replace the whole block with the colon character.
You can just press "r:" (no quotes).
It will replace the whole block with the colon character.
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
add a comment |
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
add a comment |
- Select the text block visually as you describe
- press ':'
s/./:/g
Does that do what you want?
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
add a comment |
- Select the text block visually as you describe
- press ':'
s/./:/g
Does that do what you want?
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
add a comment |
- Select the text block visually as you describe
- press ':'
s/./:/g
Does that do what you want?
- Select the text block visually as you describe
- press ':'
s/./:/g
Does that do what you want?
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
add a comment |
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
add a comment |
Try
:1,5s/[0-5].(/@:(/g
where 1, 5 => start, end line numbers
Or else select text and then use
:'<,'>s/[0-5].(/@:(/g
%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
add a comment |
Try
:1,5s/[0-5].(/@:(/g
where 1, 5 => start, end line numbers
Or else select text and then use
:'<,'>s/[0-5].(/@:(/g
%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
add a comment |
Try
:1,5s/[0-5].(/@:(/g
where 1, 5 => start, end line numbers
Or else select text and then use
:'<,'>s/[0-5].(/@:(/g
Try
:1,5s/[0-5].(/@:(/g
where 1, 5 => start, end line numbers
Or else select text and then use
:'<,'>s/[0-5].(/@:(/g
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
add a comment |
%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
add a comment |
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.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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
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