Simplest way to delete a “composite” word?











up vote
20
down vote

favorite
3












Apologies if "composite" is not the technical term. I mean the following:



Hi, I-am-a-composite-word and we are not


I would like to delete only the composite word. In command mode, if I move the cursor to I, then repeating dw a few times, or better typing dw once, followed by a few . presses, will do the trick. However, for various reasons I find myself doing this quite often during the day, thus I was wondering if there's any simpler way.



PS I would NOT consider the command d9w to be a simpler way. Counting a long sequence of words and dashes is not my idea of "simpler".










share|improve this question









New contributor




DeltaIV is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
























    up vote
    20
    down vote

    favorite
    3












    Apologies if "composite" is not the technical term. I mean the following:



    Hi, I-am-a-composite-word and we are not


    I would like to delete only the composite word. In command mode, if I move the cursor to I, then repeating dw a few times, or better typing dw once, followed by a few . presses, will do the trick. However, for various reasons I find myself doing this quite often during the day, thus I was wondering if there's any simpler way.



    PS I would NOT consider the command d9w to be a simpler way. Counting a long sequence of words and dashes is not my idea of "simpler".










    share|improve this question









    New contributor




    DeltaIV is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
    Check out our Code of Conduct.






















      up vote
      20
      down vote

      favorite
      3









      up vote
      20
      down vote

      favorite
      3






      3





      Apologies if "composite" is not the technical term. I mean the following:



      Hi, I-am-a-composite-word and we are not


      I would like to delete only the composite word. In command mode, if I move the cursor to I, then repeating dw a few times, or better typing dw once, followed by a few . presses, will do the trick. However, for various reasons I find myself doing this quite often during the day, thus I was wondering if there's any simpler way.



      PS I would NOT consider the command d9w to be a simpler way. Counting a long sequence of words and dashes is not my idea of "simpler".










      share|improve this question









      New contributor




      DeltaIV is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.











      Apologies if "composite" is not the technical term. I mean the following:



      Hi, I-am-a-composite-word and we are not


      I would like to delete only the composite word. In command mode, if I move the cursor to I, then repeating dw a few times, or better typing dw once, followed by a few . presses, will do the trick. However, for various reasons I find myself doing this quite often during the day, thus I was wondering if there's any simpler way.



      PS I would NOT consider the command d9w to be a simpler way. Counting a long sequence of words and dashes is not my idea of "simpler".







      cursor-motions normal-mode






      share|improve this question









      New contributor




      DeltaIV is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.











      share|improve this question









      New contributor




      DeltaIV is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.









      share|improve this question




      share|improve this question








      edited Nov 5 at 10:08









      statox

      25.7k663130




      25.7k663130






      New contributor




      DeltaIV is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.









      asked Nov 5 at 10:00









      DeltaIV

      2036




      2036




      New contributor




      DeltaIV is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.





      New contributor





      DeltaIV is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.






      DeltaIV is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.






















          4 Answers
          4






          active

          oldest

          votes

















          up vote
          32
          down vote



          accepted










          What you are calling a composite word is actually a WORD (by opposition to a word). Reading :h word and :h WORD should be helpful:



                                      *word*
          A word consists of a sequence of letters, digits and underscores, or a
          sequence of other non-blank characters, separated with white space (spaces,
          tabs, <EOL>). This can be changed with the 'iskeyword' option. An empty line
          is also considered to be a word.
          *WORD*
          A WORD consists of a sequence of non-blank characters, separated with white
          space. An empty line is also considered to be a WORD.


          What you are looking for here is dW when you are on the I or diW when you are anywhere in the word.



          Maybe in the future you will also need to read :h 'iskeyword'.






          share|improve this answer

















          • 1




            thanks for the answer: it works. Apropos of the definition: A WORD consists of a sequence of non-blank characters, separated with white space. Separated with white space means that the WORD is separated by other words or WORDS with white space, right?
            – DeltaIV
            Nov 5 at 10:22






          • 2




            @DeltaIV Yup in-this-sentence there are four"WORDs the 4 WORDs are in-this-sentence, there, are and four"WORDs. It's easy to see when you use w and W or b and B motions for example. Note that a whitespace can be a "regular" space or a tab character.
            – statox
            Nov 5 at 10:29












          • This answer would be more immediately useful if it started with "What you are looking for here is dW .." rather than forcing the reader to wade through to the middle paragraph to find the solution.
            – Mark Meuer
            Nov 6 at 19:52


















          up vote
          9
          down vote













          Another more general solution is to delete up to the whitespace character using dt (with a space after the t), which means "delete to [character]. This often is useful for things like dt: and similar as well.






          share|improve this answer










          New contributor




          allo is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
          Check out our Code of Conduct.


















          • what does dt: do?
            – DeltaIV
            Nov 5 at 15:13






          • 1




            When I posted the same answer, I learned that you can use <code>dt </code> to include a space on the end.
            – BurnsBA
            Nov 5 at 15:16






          • 2




            @DeltaIV Actually what you really need is to read :h motion.txt and to use vimtutor, that will greatly help you to get the basics of Vim
            – statox
            Nov 5 at 15:18










          • @statox I used to be skilled at VIM...10 years ago :-) vimtutor sounds very interesting. I'm not sure it's installed on the remote server (it looks like not even the man utility is installed). However, I'll check: if it's automatically installed together with the vim package, then chances are high that I will be able to use it.
            – DeltaIV
            Nov 5 at 17:44






          • 1




            @BurnsBA Thank you, that's really useful for this site. Btw. you can edit posts from others and even get +2 reputation if your edit makes it through some peer review process. But this way, I learned something new as well :-).
            – allo
            Nov 6 at 9:02


















          up vote
          4
          down vote













          If you want to keep using dw and the like, and also want to let it work with double-clicking a word, you can add



          set iskeyword+=-


          to your .vimrc, which adds - as a word character.



          Example:



          Double-clicking any character in ab-cd visually highlights ab-cd.






          share|improve this answer





















          • I'm fine with switching to dW, but your solution is also pretty cool because it affects visual mode too, I guess. I mean, by modifying the iskeyword, double-clicking and then pressing d I should be able to delete ab-cd. Right?
            – DeltaIV
            Nov 5 at 15:16










          • Or maybe I should switch to visual mode with v, rather than double-clicking. Right?
            – DeltaIV
            Nov 5 at 15:18






          • 1




            @DeltaIV by modifying iskeyword, you can use any method with word objects (including iw or aw, significantly simpler than using a mouse or visual mode)
            – D. Ben Knoble
            Nov 6 at 13:19


















          up vote
          4
          down vote













          Don't forget the f (find) and t (to) commands. I'd probably just dt or df (note the space at the end).






          share|improve this answer










          New contributor




          BurnsBA is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
          Check out our Code of Conduct.


















            Your Answer








            StackExchange.ready(function() {
            var channelOptions = {
            tags: "".split(" "),
            id: "599"
            };
            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',
            convertImagesToLinks: false,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: null,
            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
            });


            }
            });






            DeltaIV is a new contributor. Be nice, and check out our Code of Conduct.










             

            draft saved


            draft discarded


















            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fvi.stackexchange.com%2fquestions%2f17832%2fsimplest-way-to-delete-a-composite-word%23new-answer', 'question_page');
            }
            );

            Post as a guest
































            4 Answers
            4






            active

            oldest

            votes








            4 Answers
            4






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes








            up vote
            32
            down vote



            accepted










            What you are calling a composite word is actually a WORD (by opposition to a word). Reading :h word and :h WORD should be helpful:



                                        *word*
            A word consists of a sequence of letters, digits and underscores, or a
            sequence of other non-blank characters, separated with white space (spaces,
            tabs, <EOL>). This can be changed with the 'iskeyword' option. An empty line
            is also considered to be a word.
            *WORD*
            A WORD consists of a sequence of non-blank characters, separated with white
            space. An empty line is also considered to be a WORD.


            What you are looking for here is dW when you are on the I or diW when you are anywhere in the word.



            Maybe in the future you will also need to read :h 'iskeyword'.






            share|improve this answer

















            • 1




              thanks for the answer: it works. Apropos of the definition: A WORD consists of a sequence of non-blank characters, separated with white space. Separated with white space means that the WORD is separated by other words or WORDS with white space, right?
              – DeltaIV
              Nov 5 at 10:22






            • 2




              @DeltaIV Yup in-this-sentence there are four"WORDs the 4 WORDs are in-this-sentence, there, are and four"WORDs. It's easy to see when you use w and W or b and B motions for example. Note that a whitespace can be a "regular" space or a tab character.
              – statox
              Nov 5 at 10:29












            • This answer would be more immediately useful if it started with "What you are looking for here is dW .." rather than forcing the reader to wade through to the middle paragraph to find the solution.
              – Mark Meuer
              Nov 6 at 19:52















            up vote
            32
            down vote



            accepted










            What you are calling a composite word is actually a WORD (by opposition to a word). Reading :h word and :h WORD should be helpful:



                                        *word*
            A word consists of a sequence of letters, digits and underscores, or a
            sequence of other non-blank characters, separated with white space (spaces,
            tabs, <EOL>). This can be changed with the 'iskeyword' option. An empty line
            is also considered to be a word.
            *WORD*
            A WORD consists of a sequence of non-blank characters, separated with white
            space. An empty line is also considered to be a WORD.


            What you are looking for here is dW when you are on the I or diW when you are anywhere in the word.



            Maybe in the future you will also need to read :h 'iskeyword'.






            share|improve this answer

















            • 1




              thanks for the answer: it works. Apropos of the definition: A WORD consists of a sequence of non-blank characters, separated with white space. Separated with white space means that the WORD is separated by other words or WORDS with white space, right?
              – DeltaIV
              Nov 5 at 10:22






            • 2




              @DeltaIV Yup in-this-sentence there are four"WORDs the 4 WORDs are in-this-sentence, there, are and four"WORDs. It's easy to see when you use w and W or b and B motions for example. Note that a whitespace can be a "regular" space or a tab character.
              – statox
              Nov 5 at 10:29












            • This answer would be more immediately useful if it started with "What you are looking for here is dW .." rather than forcing the reader to wade through to the middle paragraph to find the solution.
              – Mark Meuer
              Nov 6 at 19:52













            up vote
            32
            down vote



            accepted







            up vote
            32
            down vote



            accepted






            What you are calling a composite word is actually a WORD (by opposition to a word). Reading :h word and :h WORD should be helpful:



                                        *word*
            A word consists of a sequence of letters, digits and underscores, or a
            sequence of other non-blank characters, separated with white space (spaces,
            tabs, <EOL>). This can be changed with the 'iskeyword' option. An empty line
            is also considered to be a word.
            *WORD*
            A WORD consists of a sequence of non-blank characters, separated with white
            space. An empty line is also considered to be a WORD.


            What you are looking for here is dW when you are on the I or diW when you are anywhere in the word.



            Maybe in the future you will also need to read :h 'iskeyword'.






            share|improve this answer












            What you are calling a composite word is actually a WORD (by opposition to a word). Reading :h word and :h WORD should be helpful:



                                        *word*
            A word consists of a sequence of letters, digits and underscores, or a
            sequence of other non-blank characters, separated with white space (spaces,
            tabs, <EOL>). This can be changed with the 'iskeyword' option. An empty line
            is also considered to be a word.
            *WORD*
            A WORD consists of a sequence of non-blank characters, separated with white
            space. An empty line is also considered to be a WORD.


            What you are looking for here is dW when you are on the I or diW when you are anywhere in the word.



            Maybe in the future you will also need to read :h 'iskeyword'.







            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered Nov 5 at 10:06









            statox

            25.7k663130




            25.7k663130








            • 1




              thanks for the answer: it works. Apropos of the definition: A WORD consists of a sequence of non-blank characters, separated with white space. Separated with white space means that the WORD is separated by other words or WORDS with white space, right?
              – DeltaIV
              Nov 5 at 10:22






            • 2




              @DeltaIV Yup in-this-sentence there are four"WORDs the 4 WORDs are in-this-sentence, there, are and four"WORDs. It's easy to see when you use w and W or b and B motions for example. Note that a whitespace can be a "regular" space or a tab character.
              – statox
              Nov 5 at 10:29












            • This answer would be more immediately useful if it started with "What you are looking for here is dW .." rather than forcing the reader to wade through to the middle paragraph to find the solution.
              – Mark Meuer
              Nov 6 at 19:52














            • 1




              thanks for the answer: it works. Apropos of the definition: A WORD consists of a sequence of non-blank characters, separated with white space. Separated with white space means that the WORD is separated by other words or WORDS with white space, right?
              – DeltaIV
              Nov 5 at 10:22






            • 2




              @DeltaIV Yup in-this-sentence there are four"WORDs the 4 WORDs are in-this-sentence, there, are and four"WORDs. It's easy to see when you use w and W or b and B motions for example. Note that a whitespace can be a "regular" space or a tab character.
              – statox
              Nov 5 at 10:29












            • This answer would be more immediately useful if it started with "What you are looking for here is dW .." rather than forcing the reader to wade through to the middle paragraph to find the solution.
              – Mark Meuer
              Nov 6 at 19:52








            1




            1




            thanks for the answer: it works. Apropos of the definition: A WORD consists of a sequence of non-blank characters, separated with white space. Separated with white space means that the WORD is separated by other words or WORDS with white space, right?
            – DeltaIV
            Nov 5 at 10:22




            thanks for the answer: it works. Apropos of the definition: A WORD consists of a sequence of non-blank characters, separated with white space. Separated with white space means that the WORD is separated by other words or WORDS with white space, right?
            – DeltaIV
            Nov 5 at 10:22




            2




            2




            @DeltaIV Yup in-this-sentence there are four"WORDs the 4 WORDs are in-this-sentence, there, are and four"WORDs. It's easy to see when you use w and W or b and B motions for example. Note that a whitespace can be a "regular" space or a tab character.
            – statox
            Nov 5 at 10:29






            @DeltaIV Yup in-this-sentence there are four"WORDs the 4 WORDs are in-this-sentence, there, are and four"WORDs. It's easy to see when you use w and W or b and B motions for example. Note that a whitespace can be a "regular" space or a tab character.
            – statox
            Nov 5 at 10:29














            This answer would be more immediately useful if it started with "What you are looking for here is dW .." rather than forcing the reader to wade through to the middle paragraph to find the solution.
            – Mark Meuer
            Nov 6 at 19:52




            This answer would be more immediately useful if it started with "What you are looking for here is dW .." rather than forcing the reader to wade through to the middle paragraph to find the solution.
            – Mark Meuer
            Nov 6 at 19:52










            up vote
            9
            down vote













            Another more general solution is to delete up to the whitespace character using dt (with a space after the t), which means "delete to [character]. This often is useful for things like dt: and similar as well.






            share|improve this answer










            New contributor




            allo is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
            Check out our Code of Conduct.


















            • what does dt: do?
              – DeltaIV
              Nov 5 at 15:13






            • 1




              When I posted the same answer, I learned that you can use <code>dt </code> to include a space on the end.
              – BurnsBA
              Nov 5 at 15:16






            • 2




              @DeltaIV Actually what you really need is to read :h motion.txt and to use vimtutor, that will greatly help you to get the basics of Vim
              – statox
              Nov 5 at 15:18










            • @statox I used to be skilled at VIM...10 years ago :-) vimtutor sounds very interesting. I'm not sure it's installed on the remote server (it looks like not even the man utility is installed). However, I'll check: if it's automatically installed together with the vim package, then chances are high that I will be able to use it.
              – DeltaIV
              Nov 5 at 17:44






            • 1




              @BurnsBA Thank you, that's really useful for this site. Btw. you can edit posts from others and even get +2 reputation if your edit makes it through some peer review process. But this way, I learned something new as well :-).
              – allo
              Nov 6 at 9:02















            up vote
            9
            down vote













            Another more general solution is to delete up to the whitespace character using dt (with a space after the t), which means "delete to [character]. This often is useful for things like dt: and similar as well.






            share|improve this answer










            New contributor




            allo is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
            Check out our Code of Conduct.


















            • what does dt: do?
              – DeltaIV
              Nov 5 at 15:13






            • 1




              When I posted the same answer, I learned that you can use <code>dt </code> to include a space on the end.
              – BurnsBA
              Nov 5 at 15:16






            • 2




              @DeltaIV Actually what you really need is to read :h motion.txt and to use vimtutor, that will greatly help you to get the basics of Vim
              – statox
              Nov 5 at 15:18










            • @statox I used to be skilled at VIM...10 years ago :-) vimtutor sounds very interesting. I'm not sure it's installed on the remote server (it looks like not even the man utility is installed). However, I'll check: if it's automatically installed together with the vim package, then chances are high that I will be able to use it.
              – DeltaIV
              Nov 5 at 17:44






            • 1




              @BurnsBA Thank you, that's really useful for this site. Btw. you can edit posts from others and even get +2 reputation if your edit makes it through some peer review process. But this way, I learned something new as well :-).
              – allo
              Nov 6 at 9:02













            up vote
            9
            down vote










            up vote
            9
            down vote









            Another more general solution is to delete up to the whitespace character using dt (with a space after the t), which means "delete to [character]. This often is useful for things like dt: and similar as well.






            share|improve this answer










            New contributor




            allo is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
            Check out our Code of Conduct.









            Another more general solution is to delete up to the whitespace character using dt (with a space after the t), which means "delete to [character]. This often is useful for things like dt: and similar as well.







            share|improve this answer










            New contributor




            allo is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
            Check out our Code of Conduct.









            share|improve this answer



            share|improve this answer








            edited Nov 6 at 9:01





















            New contributor




            allo is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
            Check out our Code of Conduct.









            answered Nov 5 at 14:37









            allo

            1913




            1913




            New contributor




            allo is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
            Check out our Code of Conduct.





            New contributor





            allo is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
            Check out our Code of Conduct.






            allo is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
            Check out our Code of Conduct.












            • what does dt: do?
              – DeltaIV
              Nov 5 at 15:13






            • 1




              When I posted the same answer, I learned that you can use <code>dt </code> to include a space on the end.
              – BurnsBA
              Nov 5 at 15:16






            • 2




              @DeltaIV Actually what you really need is to read :h motion.txt and to use vimtutor, that will greatly help you to get the basics of Vim
              – statox
              Nov 5 at 15:18










            • @statox I used to be skilled at VIM...10 years ago :-) vimtutor sounds very interesting. I'm not sure it's installed on the remote server (it looks like not even the man utility is installed). However, I'll check: if it's automatically installed together with the vim package, then chances are high that I will be able to use it.
              – DeltaIV
              Nov 5 at 17:44






            • 1




              @BurnsBA Thank you, that's really useful for this site. Btw. you can edit posts from others and even get +2 reputation if your edit makes it through some peer review process. But this way, I learned something new as well :-).
              – allo
              Nov 6 at 9:02


















            • what does dt: do?
              – DeltaIV
              Nov 5 at 15:13






            • 1




              When I posted the same answer, I learned that you can use <code>dt </code> to include a space on the end.
              – BurnsBA
              Nov 5 at 15:16






            • 2




              @DeltaIV Actually what you really need is to read :h motion.txt and to use vimtutor, that will greatly help you to get the basics of Vim
              – statox
              Nov 5 at 15:18










            • @statox I used to be skilled at VIM...10 years ago :-) vimtutor sounds very interesting. I'm not sure it's installed on the remote server (it looks like not even the man utility is installed). However, I'll check: if it's automatically installed together with the vim package, then chances are high that I will be able to use it.
              – DeltaIV
              Nov 5 at 17:44






            • 1




              @BurnsBA Thank you, that's really useful for this site. Btw. you can edit posts from others and even get +2 reputation if your edit makes it through some peer review process. But this way, I learned something new as well :-).
              – allo
              Nov 6 at 9:02
















            what does dt: do?
            – DeltaIV
            Nov 5 at 15:13




            what does dt: do?
            – DeltaIV
            Nov 5 at 15:13




            1




            1




            When I posted the same answer, I learned that you can use <code>dt </code> to include a space on the end.
            – BurnsBA
            Nov 5 at 15:16




            When I posted the same answer, I learned that you can use <code>dt </code> to include a space on the end.
            – BurnsBA
            Nov 5 at 15:16




            2




            2




            @DeltaIV Actually what you really need is to read :h motion.txt and to use vimtutor, that will greatly help you to get the basics of Vim
            – statox
            Nov 5 at 15:18




            @DeltaIV Actually what you really need is to read :h motion.txt and to use vimtutor, that will greatly help you to get the basics of Vim
            – statox
            Nov 5 at 15:18












            @statox I used to be skilled at VIM...10 years ago :-) vimtutor sounds very interesting. I'm not sure it's installed on the remote server (it looks like not even the man utility is installed). However, I'll check: if it's automatically installed together with the vim package, then chances are high that I will be able to use it.
            – DeltaIV
            Nov 5 at 17:44




            @statox I used to be skilled at VIM...10 years ago :-) vimtutor sounds very interesting. I'm not sure it's installed on the remote server (it looks like not even the man utility is installed). However, I'll check: if it's automatically installed together with the vim package, then chances are high that I will be able to use it.
            – DeltaIV
            Nov 5 at 17:44




            1




            1




            @BurnsBA Thank you, that's really useful for this site. Btw. you can edit posts from others and even get +2 reputation if your edit makes it through some peer review process. But this way, I learned something new as well :-).
            – allo
            Nov 6 at 9:02




            @BurnsBA Thank you, that's really useful for this site. Btw. you can edit posts from others and even get +2 reputation if your edit makes it through some peer review process. But this way, I learned something new as well :-).
            – allo
            Nov 6 at 9:02










            up vote
            4
            down vote













            If you want to keep using dw and the like, and also want to let it work with double-clicking a word, you can add



            set iskeyword+=-


            to your .vimrc, which adds - as a word character.



            Example:



            Double-clicking any character in ab-cd visually highlights ab-cd.






            share|improve this answer





















            • I'm fine with switching to dW, but your solution is also pretty cool because it affects visual mode too, I guess. I mean, by modifying the iskeyword, double-clicking and then pressing d I should be able to delete ab-cd. Right?
              – DeltaIV
              Nov 5 at 15:16










            • Or maybe I should switch to visual mode with v, rather than double-clicking. Right?
              – DeltaIV
              Nov 5 at 15:18






            • 1




              @DeltaIV by modifying iskeyword, you can use any method with word objects (including iw or aw, significantly simpler than using a mouse or visual mode)
              – D. Ben Knoble
              Nov 6 at 13:19















            up vote
            4
            down vote













            If you want to keep using dw and the like, and also want to let it work with double-clicking a word, you can add



            set iskeyword+=-


            to your .vimrc, which adds - as a word character.



            Example:



            Double-clicking any character in ab-cd visually highlights ab-cd.






            share|improve this answer





















            • I'm fine with switching to dW, but your solution is also pretty cool because it affects visual mode too, I guess. I mean, by modifying the iskeyword, double-clicking and then pressing d I should be able to delete ab-cd. Right?
              – DeltaIV
              Nov 5 at 15:16










            • Or maybe I should switch to visual mode with v, rather than double-clicking. Right?
              – DeltaIV
              Nov 5 at 15:18






            • 1




              @DeltaIV by modifying iskeyword, you can use any method with word objects (including iw or aw, significantly simpler than using a mouse or visual mode)
              – D. Ben Knoble
              Nov 6 at 13:19













            up vote
            4
            down vote










            up vote
            4
            down vote









            If you want to keep using dw and the like, and also want to let it work with double-clicking a word, you can add



            set iskeyword+=-


            to your .vimrc, which adds - as a word character.



            Example:



            Double-clicking any character in ab-cd visually highlights ab-cd.






            share|improve this answer












            If you want to keep using dw and the like, and also want to let it work with double-clicking a word, you can add



            set iskeyword+=-


            to your .vimrc, which adds - as a word character.



            Example:



            Double-clicking any character in ab-cd visually highlights ab-cd.







            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered Nov 5 at 14:17









            nst0022

            3005




            3005












            • I'm fine with switching to dW, but your solution is also pretty cool because it affects visual mode too, I guess. I mean, by modifying the iskeyword, double-clicking and then pressing d I should be able to delete ab-cd. Right?
              – DeltaIV
              Nov 5 at 15:16










            • Or maybe I should switch to visual mode with v, rather than double-clicking. Right?
              – DeltaIV
              Nov 5 at 15:18






            • 1




              @DeltaIV by modifying iskeyword, you can use any method with word objects (including iw or aw, significantly simpler than using a mouse or visual mode)
              – D. Ben Knoble
              Nov 6 at 13:19


















            • I'm fine with switching to dW, but your solution is also pretty cool because it affects visual mode too, I guess. I mean, by modifying the iskeyword, double-clicking and then pressing d I should be able to delete ab-cd. Right?
              – DeltaIV
              Nov 5 at 15:16










            • Or maybe I should switch to visual mode with v, rather than double-clicking. Right?
              – DeltaIV
              Nov 5 at 15:18






            • 1




              @DeltaIV by modifying iskeyword, you can use any method with word objects (including iw or aw, significantly simpler than using a mouse or visual mode)
              – D. Ben Knoble
              Nov 6 at 13:19
















            I'm fine with switching to dW, but your solution is also pretty cool because it affects visual mode too, I guess. I mean, by modifying the iskeyword, double-clicking and then pressing d I should be able to delete ab-cd. Right?
            – DeltaIV
            Nov 5 at 15:16




            I'm fine with switching to dW, but your solution is also pretty cool because it affects visual mode too, I guess. I mean, by modifying the iskeyword, double-clicking and then pressing d I should be able to delete ab-cd. Right?
            – DeltaIV
            Nov 5 at 15:16












            Or maybe I should switch to visual mode with v, rather than double-clicking. Right?
            – DeltaIV
            Nov 5 at 15:18




            Or maybe I should switch to visual mode with v, rather than double-clicking. Right?
            – DeltaIV
            Nov 5 at 15:18




            1




            1




            @DeltaIV by modifying iskeyword, you can use any method with word objects (including iw or aw, significantly simpler than using a mouse or visual mode)
            – D. Ben Knoble
            Nov 6 at 13:19




            @DeltaIV by modifying iskeyword, you can use any method with word objects (including iw or aw, significantly simpler than using a mouse or visual mode)
            – D. Ben Knoble
            Nov 6 at 13:19










            up vote
            4
            down vote













            Don't forget the f (find) and t (to) commands. I'd probably just dt or df (note the space at the end).






            share|improve this answer










            New contributor




            BurnsBA is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
            Check out our Code of Conduct.






















              up vote
              4
              down vote













              Don't forget the f (find) and t (to) commands. I'd probably just dt or df (note the space at the end).






              share|improve this answer










              New contributor




              BurnsBA is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
              Check out our Code of Conduct.




















                up vote
                4
                down vote










                up vote
                4
                down vote









                Don't forget the f (find) and t (to) commands. I'd probably just dt or df (note the space at the end).






                share|improve this answer










                New contributor




                BurnsBA is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                Check out our Code of Conduct.









                Don't forget the f (find) and t (to) commands. I'd probably just dt or df (note the space at the end).







                share|improve this answer










                New contributor




                BurnsBA is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                Check out our Code of Conduct.









                share|improve this answer



                share|improve this answer








                edited Nov 5 at 14:44





















                New contributor




                BurnsBA is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                Check out our Code of Conduct.









                answered Nov 5 at 14:33









                BurnsBA

                1413




                1413




                New contributor




                BurnsBA is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                Check out our Code of Conduct.





                New contributor





                BurnsBA is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                Check out our Code of Conduct.






                BurnsBA is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                Check out our Code of Conduct.






















                    DeltaIV is a new contributor. Be nice, and check out our Code of Conduct.










                     

                    draft saved


                    draft discarded


















                    DeltaIV is a new contributor. Be nice, and check out our Code of Conduct.













                    DeltaIV is a new contributor. Be nice, and check out our Code of Conduct.












                    DeltaIV is a new contributor. Be nice, and check out our Code of Conduct.















                     


                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function () {
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fvi.stackexchange.com%2fquestions%2f17832%2fsimplest-way-to-delete-a-composite-word%23new-answer', 'question_page');
                    }
                    );

                    Post as a guest




















































































                    這個網誌中的熱門文章

                    Tangent Lines Diagram Along Smooth Curve

                    Yusuf al-Mu'taman ibn Hud

                    Zucchini