Vim cursor setup












2















Let's say I have this line in Vim and I click $ to reach EOL.



Hello Worl*d


The asterisk marks the place of the cursor, i.e. enter image description here



Let's say now that I wanted to delete backwards until the space, so I use dT<Space>. This leaves me with:



Hello *d


The problem is that the cursor is actually between the l and the d.



Another option in this case would diw (or diW if the word contained hyphens etc), but I like to be able to use the motion that first pops up in my head, and sometimes it's more obvious to do a motion until a character.



Is there any workaround here? One idea is to have the cursor moved to the right of the cursor block, instead of the left. I haven't found anything on this.










share|improve this question

























  • Where do you see a /?

    – harrymc
    Jan 30 at 11:23











  • Not slash, I cursivated the l and d in World. I fix it so we avoid misunderstandings.

    – Max
    Jan 30 at 12:29
















2















Let's say I have this line in Vim and I click $ to reach EOL.



Hello Worl*d


The asterisk marks the place of the cursor, i.e. enter image description here



Let's say now that I wanted to delete backwards until the space, so I use dT<Space>. This leaves me with:



Hello *d


The problem is that the cursor is actually between the l and the d.



Another option in this case would diw (or diW if the word contained hyphens etc), but I like to be able to use the motion that first pops up in my head, and sometimes it's more obvious to do a motion until a character.



Is there any workaround here? One idea is to have the cursor moved to the right of the cursor block, instead of the left. I haven't found anything on this.










share|improve this question

























  • Where do you see a /?

    – harrymc
    Jan 30 at 11:23











  • Not slash, I cursivated the l and d in World. I fix it so we avoid misunderstandings.

    – Max
    Jan 30 at 12:29














2












2








2


1






Let's say I have this line in Vim and I click $ to reach EOL.



Hello Worl*d


The asterisk marks the place of the cursor, i.e. enter image description here



Let's say now that I wanted to delete backwards until the space, so I use dT<Space>. This leaves me with:



Hello *d


The problem is that the cursor is actually between the l and the d.



Another option in this case would diw (or diW if the word contained hyphens etc), but I like to be able to use the motion that first pops up in my head, and sometimes it's more obvious to do a motion until a character.



Is there any workaround here? One idea is to have the cursor moved to the right of the cursor block, instead of the left. I haven't found anything on this.










share|improve this question
















Let's say I have this line in Vim and I click $ to reach EOL.



Hello Worl*d


The asterisk marks the place of the cursor, i.e. enter image description here



Let's say now that I wanted to delete backwards until the space, so I use dT<Space>. This leaves me with:



Hello *d


The problem is that the cursor is actually between the l and the d.



Another option in this case would diw (or diW if the word contained hyphens etc), but I like to be able to use the motion that first pops up in my head, and sometimes it's more obvious to do a motion until a character.



Is there any workaround here? One idea is to have the cursor moved to the right of the cursor block, instead of the left. I haven't found anything on this.







vim






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Jan 30 at 12:29







Max

















asked Jan 30 at 10:26









MaxMax

479




479













  • Where do you see a /?

    – harrymc
    Jan 30 at 11:23











  • Not slash, I cursivated the l and d in World. I fix it so we avoid misunderstandings.

    – Max
    Jan 30 at 12:29



















  • Where do you see a /?

    – harrymc
    Jan 30 at 11:23











  • Not slash, I cursivated the l and d in World. I fix it so we avoid misunderstandings.

    – Max
    Jan 30 at 12:29

















Where do you see a /?

– harrymc
Jan 30 at 11:23





Where do you see a /?

– harrymc
Jan 30 at 11:23













Not slash, I cursivated the l and d in World. I fix it so we avoid misunderstandings.

– Max
Jan 30 at 12:29





Not slash, I cursivated the l and d in World. I fix it so we avoid misunderstandings.

– Max
Jan 30 at 12:29










2 Answers
2






active

oldest

votes


















1














I understand that the problem is to delete the last word in the line when the EOL
character immediately follows this word, when your preferred shortcut leaves
the last character without deleting it.



The problem might be because Vim makes a distinction between inclusive and exclusive
motions. Using v toggles the "inclusiveness" or "exclusiveness" of a motion.



So you may use this combination:
d+v+T+Space



See :help inclusive for an explication.



If this is too long, you may record a
macro
for it.



You could also use the following shortcuts:



daw : delete the word under the cursor (includes spaces before the next word)
caw : same and puts you in insert mode
diw : delete entire word without touching whitespace around it
daW : delete all characters between two whitespaces





share|improve this answer
























  • Just what I was looking for. Will use the v command a lot, for sure. Thanks for the options as well.

    – Max
    Jan 30 at 14:28





















1















  • With :set virtualedit=onemore, you can move the cursor to the right of the last character, and your command would work: $ldT<Space>

  • As you've mentioned, the natural motion would be iw in this case.

  • Instead of T<Space>, you could also use b here.

  • I probably would use bD here.

  • If dT<Space> is what first comes to your mind, you can correct the missed character with x. As long as you don't use the deleted contents or undo, this doesn't matter.






share|improve this answer
























  • Thanks for the clarification and the possible solutions, I read up some one "onemore" and it seems that it may break some plugins etc, so I'll opt for the solution to toggle vinclusiveness.

    – Max
    Jan 30 at 14:26












Your Answer








StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "3"
};
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%2fsuperuser.com%2fquestions%2f1400019%2fvim-cursor-setup%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























2 Answers
2






active

oldest

votes








2 Answers
2






active

oldest

votes









active

oldest

votes






active

oldest

votes









1














I understand that the problem is to delete the last word in the line when the EOL
character immediately follows this word, when your preferred shortcut leaves
the last character without deleting it.



The problem might be because Vim makes a distinction between inclusive and exclusive
motions. Using v toggles the "inclusiveness" or "exclusiveness" of a motion.



So you may use this combination:
d+v+T+Space



See :help inclusive for an explication.



If this is too long, you may record a
macro
for it.



You could also use the following shortcuts:



daw : delete the word under the cursor (includes spaces before the next word)
caw : same and puts you in insert mode
diw : delete entire word without touching whitespace around it
daW : delete all characters between two whitespaces





share|improve this answer
























  • Just what I was looking for. Will use the v command a lot, for sure. Thanks for the options as well.

    – Max
    Jan 30 at 14:28


















1














I understand that the problem is to delete the last word in the line when the EOL
character immediately follows this word, when your preferred shortcut leaves
the last character without deleting it.



The problem might be because Vim makes a distinction between inclusive and exclusive
motions. Using v toggles the "inclusiveness" or "exclusiveness" of a motion.



So you may use this combination:
d+v+T+Space



See :help inclusive for an explication.



If this is too long, you may record a
macro
for it.



You could also use the following shortcuts:



daw : delete the word under the cursor (includes spaces before the next word)
caw : same and puts you in insert mode
diw : delete entire word without touching whitespace around it
daW : delete all characters between two whitespaces





share|improve this answer
























  • Just what I was looking for. Will use the v command a lot, for sure. Thanks for the options as well.

    – Max
    Jan 30 at 14:28
















1












1








1







I understand that the problem is to delete the last word in the line when the EOL
character immediately follows this word, when your preferred shortcut leaves
the last character without deleting it.



The problem might be because Vim makes a distinction between inclusive and exclusive
motions. Using v toggles the "inclusiveness" or "exclusiveness" of a motion.



So you may use this combination:
d+v+T+Space



See :help inclusive for an explication.



If this is too long, you may record a
macro
for it.



You could also use the following shortcuts:



daw : delete the word under the cursor (includes spaces before the next word)
caw : same and puts you in insert mode
diw : delete entire word without touching whitespace around it
daW : delete all characters between two whitespaces





share|improve this answer













I understand that the problem is to delete the last word in the line when the EOL
character immediately follows this word, when your preferred shortcut leaves
the last character without deleting it.



The problem might be because Vim makes a distinction between inclusive and exclusive
motions. Using v toggles the "inclusiveness" or "exclusiveness" of a motion.



So you may use this combination:
d+v+T+Space



See :help inclusive for an explication.



If this is too long, you may record a
macro
for it.



You could also use the following shortcuts:



daw : delete the word under the cursor (includes spaces before the next word)
caw : same and puts you in insert mode
diw : delete entire word without touching whitespace around it
daW : delete all characters between two whitespaces






share|improve this answer












share|improve this answer



share|improve this answer










answered Jan 30 at 13:13









harrymcharrymc

264k14272581




264k14272581













  • Just what I was looking for. Will use the v command a lot, for sure. Thanks for the options as well.

    – Max
    Jan 30 at 14:28





















  • Just what I was looking for. Will use the v command a lot, for sure. Thanks for the options as well.

    – Max
    Jan 30 at 14:28



















Just what I was looking for. Will use the v command a lot, for sure. Thanks for the options as well.

– Max
Jan 30 at 14:28







Just what I was looking for. Will use the v command a lot, for sure. Thanks for the options as well.

– Max
Jan 30 at 14:28















1















  • With :set virtualedit=onemore, you can move the cursor to the right of the last character, and your command would work: $ldT<Space>

  • As you've mentioned, the natural motion would be iw in this case.

  • Instead of T<Space>, you could also use b here.

  • I probably would use bD here.

  • If dT<Space> is what first comes to your mind, you can correct the missed character with x. As long as you don't use the deleted contents or undo, this doesn't matter.






share|improve this answer
























  • Thanks for the clarification and the possible solutions, I read up some one "onemore" and it seems that it may break some plugins etc, so I'll opt for the solution to toggle vinclusiveness.

    – Max
    Jan 30 at 14:26
















1















  • With :set virtualedit=onemore, you can move the cursor to the right of the last character, and your command would work: $ldT<Space>

  • As you've mentioned, the natural motion would be iw in this case.

  • Instead of T<Space>, you could also use b here.

  • I probably would use bD here.

  • If dT<Space> is what first comes to your mind, you can correct the missed character with x. As long as you don't use the deleted contents or undo, this doesn't matter.






share|improve this answer
























  • Thanks for the clarification and the possible solutions, I read up some one "onemore" and it seems that it may break some plugins etc, so I'll opt for the solution to toggle vinclusiveness.

    – Max
    Jan 30 at 14:26














1












1








1








  • With :set virtualedit=onemore, you can move the cursor to the right of the last character, and your command would work: $ldT<Space>

  • As you've mentioned, the natural motion would be iw in this case.

  • Instead of T<Space>, you could also use b here.

  • I probably would use bD here.

  • If dT<Space> is what first comes to your mind, you can correct the missed character with x. As long as you don't use the deleted contents or undo, this doesn't matter.






share|improve this answer














  • With :set virtualedit=onemore, you can move the cursor to the right of the last character, and your command would work: $ldT<Space>

  • As you've mentioned, the natural motion would be iw in this case.

  • Instead of T<Space>, you could also use b here.

  • I probably would use bD here.

  • If dT<Space> is what first comes to your mind, you can correct the missed character with x. As long as you don't use the deleted contents or undo, this doesn't matter.







share|improve this answer












share|improve this answer



share|improve this answer










answered Jan 30 at 13:05









Ingo KarkatIngo Karkat

17.8k22646




17.8k22646













  • Thanks for the clarification and the possible solutions, I read up some one "onemore" and it seems that it may break some plugins etc, so I'll opt for the solution to toggle vinclusiveness.

    – Max
    Jan 30 at 14:26



















  • Thanks for the clarification and the possible solutions, I read up some one "onemore" and it seems that it may break some plugins etc, so I'll opt for the solution to toggle vinclusiveness.

    – Max
    Jan 30 at 14:26

















Thanks for the clarification and the possible solutions, I read up some one "onemore" and it seems that it may break some plugins etc, so I'll opt for the solution to toggle vinclusiveness.

– Max
Jan 30 at 14:26





Thanks for the clarification and the possible solutions, I read up some one "onemore" and it seems that it may break some plugins etc, so I'll opt for the solution to toggle vinclusiveness.

– Max
Jan 30 at 14:26


















draft saved

draft discarded




















































Thanks for contributing an answer to Super User!


  • 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%2fsuperuser.com%2fquestions%2f1400019%2fvim-cursor-setup%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

Plaza Victoria

Puebla de Zaragoza

Musa