Vim: Jump to line and change from another line?
I know from the question "Vim: Can you delete a specific line number from another line" that you delete a specific line by using :95d
.
As far as I understand Vim, then it should be possible to use verbs in any combination, e.g. where you can use d
(delete), you should also be able to use c
(change) or y
(yank). This does not seem to be the case with the jump-to-line motion. If I do a :95c
then I would expect it to go to line 95 and change that line. This does not happen. Vim just stares at me, waiting for my next input.
I am aware i could just :95
and then cc
, but since Vim is all about productivity and as few keystrokes as possible, I was hoping for a command similar to :95d
Is there any way to jump to a specific line and change it, in one command and without macros/binds (I'm trying to keep my install as clean as possible)?
vim
add a comment |
I know from the question "Vim: Can you delete a specific line number from another line" that you delete a specific line by using :95d
.
As far as I understand Vim, then it should be possible to use verbs in any combination, e.g. where you can use d
(delete), you should also be able to use c
(change) or y
(yank). This does not seem to be the case with the jump-to-line motion. If I do a :95c
then I would expect it to go to line 95 and change that line. This does not happen. Vim just stares at me, waiting for my next input.
I am aware i could just :95
and then cc
, but since Vim is all about productivity and as few keystrokes as possible, I was hoping for a command similar to :95d
Is there any way to jump to a specific line and change it, in one command and without macros/binds (I'm trying to keep my install as clean as possible)?
vim
add a comment |
I know from the question "Vim: Can you delete a specific line number from another line" that you delete a specific line by using :95d
.
As far as I understand Vim, then it should be possible to use verbs in any combination, e.g. where you can use d
(delete), you should also be able to use c
(change) or y
(yank). This does not seem to be the case with the jump-to-line motion. If I do a :95c
then I would expect it to go to line 95 and change that line. This does not happen. Vim just stares at me, waiting for my next input.
I am aware i could just :95
and then cc
, but since Vim is all about productivity and as few keystrokes as possible, I was hoping for a command similar to :95d
Is there any way to jump to a specific line and change it, in one command and without macros/binds (I'm trying to keep my install as clean as possible)?
vim
I know from the question "Vim: Can you delete a specific line number from another line" that you delete a specific line by using :95d
.
As far as I understand Vim, then it should be possible to use verbs in any combination, e.g. where you can use d
(delete), you should also be able to use c
(change) or y
(yank). This does not seem to be the case with the jump-to-line motion. If I do a :95c
then I would expect it to go to line 95 and change that line. This does not happen. Vim just stares at me, waiting for my next input.
I am aware i could just :95
and then cc
, but since Vim is all about productivity and as few keystrokes as possible, I was hoping for a command similar to :95d
Is there any way to jump to a specific line and change it, in one command and without macros/binds (I'm trying to keep my install as clean as possible)?
vim
vim
asked Nov 19 '18 at 10:01
Esben Boye-JacobsenEsben Boye-Jacobsen
761414
761414
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
If you go through command-line mode, you'll have to live with the peculiarities of the used Ex command.
For delete, there's not much difference between :95d<CR>
and 95Gdd
(both five keys, one of them shifted). For change, the :change
command does not go into interactive editing, as you expect, but instead asks for the replacement text on the command-line (concluded by entering a single .
on a separate line), as :help :change
explains.
If that's weird for you, then by all means use 95Gcc
, or :95norm! cc<CR>
if you insist on going through command-line mode.
1
Agreed, use95G
instead of:95
– Conner
Nov 19 '18 at 16:46
Ok, that makes sense - Thanks for your answer!
– Esben Boye-Jacobsen
Nov 20 '18 at 8:07
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%2f53372201%2fvim-jump-to-line-and-change-from-another-line%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
If you go through command-line mode, you'll have to live with the peculiarities of the used Ex command.
For delete, there's not much difference between :95d<CR>
and 95Gdd
(both five keys, one of them shifted). For change, the :change
command does not go into interactive editing, as you expect, but instead asks for the replacement text on the command-line (concluded by entering a single .
on a separate line), as :help :change
explains.
If that's weird for you, then by all means use 95Gcc
, or :95norm! cc<CR>
if you insist on going through command-line mode.
1
Agreed, use95G
instead of:95
– Conner
Nov 19 '18 at 16:46
Ok, that makes sense - Thanks for your answer!
– Esben Boye-Jacobsen
Nov 20 '18 at 8:07
add a comment |
If you go through command-line mode, you'll have to live with the peculiarities of the used Ex command.
For delete, there's not much difference between :95d<CR>
and 95Gdd
(both five keys, one of them shifted). For change, the :change
command does not go into interactive editing, as you expect, but instead asks for the replacement text on the command-line (concluded by entering a single .
on a separate line), as :help :change
explains.
If that's weird for you, then by all means use 95Gcc
, or :95norm! cc<CR>
if you insist on going through command-line mode.
1
Agreed, use95G
instead of:95
– Conner
Nov 19 '18 at 16:46
Ok, that makes sense - Thanks for your answer!
– Esben Boye-Jacobsen
Nov 20 '18 at 8:07
add a comment |
If you go through command-line mode, you'll have to live with the peculiarities of the used Ex command.
For delete, there's not much difference between :95d<CR>
and 95Gdd
(both five keys, one of them shifted). For change, the :change
command does not go into interactive editing, as you expect, but instead asks for the replacement text on the command-line (concluded by entering a single .
on a separate line), as :help :change
explains.
If that's weird for you, then by all means use 95Gcc
, or :95norm! cc<CR>
if you insist on going through command-line mode.
If you go through command-line mode, you'll have to live with the peculiarities of the used Ex command.
For delete, there's not much difference between :95d<CR>
and 95Gdd
(both five keys, one of them shifted). For change, the :change
command does not go into interactive editing, as you expect, but instead asks for the replacement text on the command-line (concluded by entering a single .
on a separate line), as :help :change
explains.
If that's weird for you, then by all means use 95Gcc
, or :95norm! cc<CR>
if you insist on going through command-line mode.
answered Nov 19 '18 at 10:24
Ingo KarkatIngo Karkat
132k14148198
132k14148198
1
Agreed, use95G
instead of:95
– Conner
Nov 19 '18 at 16:46
Ok, that makes sense - Thanks for your answer!
– Esben Boye-Jacobsen
Nov 20 '18 at 8:07
add a comment |
1
Agreed, use95G
instead of:95
– Conner
Nov 19 '18 at 16:46
Ok, that makes sense - Thanks for your answer!
– Esben Boye-Jacobsen
Nov 20 '18 at 8:07
1
1
Agreed, use
95G
instead of :95
– Conner
Nov 19 '18 at 16:46
Agreed, use
95G
instead of :95
– Conner
Nov 19 '18 at 16:46
Ok, that makes sense - Thanks for your answer!
– Esben Boye-Jacobsen
Nov 20 '18 at 8:07
Ok, that makes sense - Thanks for your answer!
– Esben Boye-Jacobsen
Nov 20 '18 at 8:07
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%2f53372201%2fvim-jump-to-line-and-change-from-another-line%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