Loading ...
Sorry, an error occurred while loading the content.

Selecting an IPv4-address?

Expand Messages
  • Niels Kobschätzki
    Hi, I have a short question. What is the fastest way to select an IPv4-address like 192.168.1.100 for copy/cut&paste? Niels -- -- You received this message
    Message 1 of 20 , Dec 10, 2013
    • 0 Attachment
      Hi,

      I have a short question. What is the fastest way to select an
      IPv4-address like 192.168.1.100 for copy/cut&paste?

      Niels

      --
      --
      You received this message from the "vim_use" maillist.
      Do not top-post! Type your reply below the text you are replying to.
      For more information, visit http://www.vim.org/maillist.php

      ---
      You received this message because you are subscribed to the Google Groups "vim_use" group.
      To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@....
      For more options, visit https://groups.google.com/groups/opt_out.
    • Chris Allison
      Hi, dt yt vt d etc Chris ... -- _ o , , / | | |_| / _/ _| | __/ / / |/ / / /|/ (| -- -- You received this
      Message 2 of 20 , Dec 10, 2013
      • 0 Attachment
        Hi,

        dt<space>
        yt<space>
        vt<space>d

        etc

        Chris

        On 10 December 2013 13:13, Niels Kobschätzki <niels@...> wrote:
        > Hi,
        >
        > I have a short question. What is the fastest way to select an
        > IPv4-address like 192.168.1.100 for copy/cut&paste?
        >
        > Niels
        >
        > --
        > --
        > You received this message from the "vim_use" maillist.
        > Do not top-post! Type your reply below the text you are replying to.
        > For more information, visit http://www.vim.org/maillist.php
        >
        > ---
        > You received this message because you are subscribed to the Google Groups "vim_use" group.
        > To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@....
        > For more options, visit https://groups.google.com/groups/opt_out.



        --
        _ o , ,
        / | | |_| / \_/ \_| |
        \__/ \/ \/ |/ \/ \/ \/|/
        (|

        --
        --
        You received this message from the "vim_use" maillist.
        Do not top-post! Type your reply below the text you are replying to.
        For more information, visit http://www.vim.org/maillist.php

        ---
        You received this message because you are subscribed to the Google Groups "vim_use" group.
        To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@....
        For more options, visit https://groups.google.com/groups/opt_out.
      • Niels Kobschätzki
        ... Ah, thanks. m) Niels ... -- -- You received this message from the vim_use maillist. Do not top-post! Type your reply below the text you are replying to.
        Message 3 of 20 , Dec 10, 2013
        • 0 Attachment
          On Tue, Dec 10, 2013, at 14:19, Chris Allison wrote:
          > Hi,
          >
          > dt<space>
          > yt<space>
          > vt<space>d

          Ah, thanks. m)

          Niels

          > On 10 December 2013 13:13, Niels Kobschätzki <niels@...>
          > wrote:
          > > Hi,
          > >
          > > I have a short question. What is the fastest way to select an
          > > IPv4-address like 192.168.1.100 for copy/cut&paste?
          > >
          > > Niels
          > >
          > > --
          > > --
          > > You received this message from the "vim_use" maillist.
          > > Do not top-post! Type your reply below the text you are replying to.
          > > For more information, visit http://www.vim.org/maillist.php
          > >
          > > ---
          > > You received this message because you are subscribed to the Google Groups "vim_use" group.
          > > To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@....
          > > For more options, visit https://groups.google.com/groups/opt_out.
          >
          >
          >
          > --
          > _ o , ,
          > / | | |_| / \_/ \_| |
          > \__/ \/ \/ |/ \/ \/ \/|/
          > (|
          >
          > --
          > --
          > You received this message from the "vim_use" maillist.
          > Do not top-post! Type your reply below the text you are replying to.
          > For more information, visit http://www.vim.org/maillist.php
          >
          > ---
          > You received this message because you are subscribed to the Google Groups
          > "vim_use" group.
          > To unsubscribe from this group and stop receiving emails from it, send an
          > email to vim_use+unsubscribe@....
          > For more options, visit https://groups.google.com/groups/opt_out.

          --
          --
          You received this message from the "vim_use" maillist.
          Do not top-post! Type your reply below the text you are replying to.
          For more information, visit http://www.vim.org/maillist.php

          ---
          You received this message because you are subscribed to the Google Groups "vim_use" group.
          To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@....
          For more options, visit https://groups.google.com/groups/opt_out.
        • Lucas Prado Melo
          On Tue, Dec 10, 2013 at 10:19 AM, Chris Allison
          Message 4 of 20 , Dec 10, 2013
          • 0 Attachment
            On Tue, Dec 10, 2013 at 10:19 AM, Chris Allison <chris.charles.allison@...> wrote:
            Hi,

            dt<space>
            yt<space>
            vt<space>d

            I think that
            daW
            yaW
            vaWd
            would be more generic

            --
            []'s
            Lucas

            --
            --
            You received this message from the "vim_use" maillist.
            Do not top-post! Type your reply below the text you are replying to.
            For more information, visit http://www.vim.org/maillist.php
             
            ---
            You received this message because you are subscribed to the Google Groups "vim_use" group.
            To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@....
            For more options, visit https://groups.google.com/groups/opt_out.
          • Gary Johnson
            ... Both solutions depend on the characters surrounding the IP address, if any. Regards, Gary -- -- You received this message from the vim_use maillist. Do
            Message 5 of 20 , Dec 10, 2013
            • 0 Attachment
              On 2013-12-10, Lucas Prado Melo wrote:
              > On Tue, Dec 10, 2013 at 10:19 AM, Chris Allison wrote:
              >
              > Hi,
              >
              > dt<space>
              > yt<space>
              > vt<space>d
              >
              >
              > I think that
              > daW
              > yaW
              > vaWd
              > would be more generic

              Both solutions depend on the characters surrounding the IP address,
              if any.

              Regards,
              Gary

              --
              --
              You received this message from the "vim_use" maillist.
              Do not top-post! Type your reply below the text you are replying to.
              For more information, visit http://www.vim.org/maillist.php

              ---
              You received this message because you are subscribed to the Google Groups "vim_use" group.
              To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@....
              For more options, visit https://groups.google.com/groups/opt_out.
            • Tim Chase
              ... If you want to get really fancy, you could do something like ... The only edge case I know of is if the IP address falls at the end of the file. It does
              Message 6 of 20 , Dec 10, 2013
              • 0 Attachment
                On 2013-12-10 14:13, Niels Kobschätzki wrote:
                > Hi,
                >
                > I have a short question. What is the fastest way to select an
                > IPv4-address like 192.168.1.100 for copy/cut&paste?

                If you want to get really fancy, you could do something like

                :nnoremap <leader>ip w?\%(\d\{1,3}\.\)\{3}\d\{1,3}?e<cr>v??<cr>

                The only edge case I know of is if the IP address falls at the end of
                the file.

                It does select semi-bogus IP addresses since the regexp is lax (so it
                could find 999.888.777.666 which is invalid), but that could be
                tightened up if needed.

                -tim









                --
                --
                You received this message from the "vim_use" maillist.
                Do not top-post! Type your reply below the text you are replying to.
                For more information, visit http://www.vim.org/maillist.php

                ---
                You received this message because you are subscribed to the Google Groups "vim_use" group.
                To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@....
                For more options, visit https://groups.google.com/groups/opt_out.
              • Niels Kobschaetzki
                ... That looks interesting. But in the end the IP was just an example. I have to re-configure a dhcpd.conf rather often and have to move around IP- and
                Message 7 of 20 , Dec 10, 2013
                • 0 Attachment
                  On 10/12, Tim Chase wrote:
                  >On 2013-12-10 14:13, Niels Kobschätzki wrote:
                  >> Hi,
                  >>
                  >> I have a short question. What is the fastest way to select an
                  >> IPv4-address like 192.168.1.100 for copy/cut&paste?
                  >
                  >If you want to get really fancy, you could do something like
                  >
                  > :nnoremap <leader>ip w?\%(\d\{1,3}\.\)\{3}\d\{1,3}?e<cr>v??<cr>

                  That looks interesting. But in the end the IP was just an example. I
                  have to re-configure a dhcpd.conf rather often and have to move around
                  IP- and MAC-adresses and selecting them was always tedious. So using "vt;"
                  is what I searched for actually. I always forget about "t".
                  Thanks.

                  Niels

                  --
                  --
                  You received this message from the "vim_use" maillist.
                  Do not top-post! Type your reply below the text you are replying to.
                  For more information, visit http://www.vim.org/maillist.php

                  ---
                  You received this message because you are subscribed to the Google Groups "vim_use" group.
                  To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@....
                  For more options, visit https://groups.google.com/groups/opt_out.
                • Ben Fritz
                  ... If you re going to start using regular expressions, I d just match the whole IP and use gn on it. -- -- You received this message from the vim_use
                  Message 8 of 20 , Dec 10, 2013
                  • 0 Attachment
                    On Tuesday, December 10, 2013 12:52:41 PM UTC-6, Tim Chase wrote:
                    > On 2013-12-10 14:13, Niels Kobschätzki wrote:
                    >
                    > > Hi,
                    >
                    > >
                    >
                    > > I have a short question. What is the fastest way to select an
                    >
                    > > IPv4-address like 192.168.1.100 for copy/cut&paste?
                    >
                    >
                    >
                    > If you want to get really fancy, you could do something like
                    >
                    >
                    >
                    > :nnoremap <leader>ip w?\%(\d\{1,3}\.\)\{3}\d\{1,3}?e<cr>v??<cr>
                    >
                    >
                    >
                    > The only edge case I know of is if the IP address falls at the end of
                    >
                    > the file.
                    >

                    If you're going to start using regular expressions, I'd just match the whole IP and use gn on it.

                    --
                    --
                    You received this message from the "vim_use" maillist.
                    Do not top-post! Type your reply below the text you are replying to.
                    For more information, visit http://www.vim.org/maillist.php

                    ---
                    You received this message because you are subscribed to the Google Groups "vim_use" group.
                    To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@....
                    For more options, visit https://groups.google.com/groups/opt_out.
                  • Tim Chase
                    ... gn ? Is this from some plugin I don t use, or from a newer version of Vim that Debian Stable doesn t yet provide out-of-the-box? :help gn lands me on
                    Message 9 of 20 , Dec 10, 2013
                    • 0 Attachment
                      On 2013-12-10 19:36, Ben Fritz wrote:
                      > If you're going to start using regular expressions, I'd just match
                      > the whole IP and use gn on it.

                      "gn"? Is this from some plugin I don't use, or from a newer version
                      of Vim that Debian Stable doesn't yet provide out-of-the-box? ":help
                      gn" lands me on the "g:gnat" help target which I'm positive you don't
                      mean. :-)

                      (the regexp version was mapped so one can create-once-run-multiple-times)

                      -tim



                      --
                      --
                      You received this message from the "vim_use" maillist.
                      Do not top-post! Type your reply below the text you are replying to.
                      For more information, visit http://www.vim.org/maillist.php

                      ---
                      You received this message because you are subscribed to the Google Groups "vim_use" group.
                      To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@....
                      For more options, visit https://groups.google.com/groups/opt_out.
                    • Gary Johnson
                      ... It appeared in 7.3.610. From version7.txt (found using :helpgrep ): Patch 7.3.610 Problem: Cannot operate on the text that a search pattern
                      Message 10 of 20 , Dec 10, 2013
                      • 0 Attachment
                        On 2013-12-10, Tim Chase wrote:
                        > On 2013-12-10 19:36, Ben Fritz wrote:
                        > > If you're going to start using regular expressions, I'd just match
                        > > the whole IP and use gn on it.
                        >
                        > "gn"? Is this from some plugin I don't use, or from a newer version
                        > of Vim that Debian Stable doesn't yet provide out-of-the-box? ":help
                        > gn" lands me on the "g:gnat" help target which I'm positive you don't
                        > mean. :-)

                        It appeared in 7.3.610.

                        From version7.txt (found using ":helpgrep \<gn\>"):

                        Patch 7.3.610
                        Problem: Cannot operate on the text that a search pattern matches.
                        Solution: Add the "gn" and "gN" commands. (Christian Brabandt)
                        Files: runtime/doc/index.txt, runtime/doc/visual.txt, src/normal.c,
                        src/proto/search.pro, src/search.c, src/testdir/test53.in,
                        src/testdir/test53.ok

                        Regards,
                        Gary

                        --
                        --
                        You received this message from the "vim_use" maillist.
                        Do not top-post! Type your reply below the text you are replying to.
                        For more information, visit http://www.vim.org/maillist.php

                        ---
                        You received this message because you are subscribed to the Google Groups "vim_use" group.
                        To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@....
                        For more options, visit https://groups.google.com/groups/opt_out.
                      • Niels Kobschätzki
                        On Tue, Dec 10, 2013, at 15:04, Lucas Prado Melo wrote: On Tue, Dec 10, 2013 at 10:19 AM, Chris Allison wrote: Hi,
                        Message 11 of 20 , Dec 11, 2013
                        • 0 Attachment
                          On Tue, Dec 10, 2013, at 15:04, Lucas Prado Melo wrote:
                          On Tue, Dec 10, 2013 at 10:19 AM, Chris Allison <chris.charles.allison@...> wrote:
                           
                          Hi,
                           
                          dt<space>
                          yt<space>
                          vt<space>d
                           
                          I think that
                          daW
                          yaW
                          vaWd
                          would be more generic
                           
                          And every day you learn something new. I didn't know about W. Thanks :)
                          Btw viW seems to work even a bit better because it doesn't select the white space. Even so I read the help about text-objects, I do not really understand the difference between w and W in viw and viW (vaw/vaW) though and how it works. But it works.
                          In the case I use it btw. something like vt; (handling a dhcpd.conf) is the fastest way so far.
                           
                          Niels

                          --
                          --
                          You received this message from the "vim_use" maillist.
                          Do not top-post! Type your reply below the text you are replying to.
                          For more information, visit http://www.vim.org/maillist.php
                           
                          ---
                          You received this message because you are subscribed to the Google Groups "vim_use" group.
                          To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@....
                          For more options, visit https://groups.google.com/groups/opt_out.
                        • Lucas Prado Melo
                          On Wed, Dec 11, 2013 at 7:53 AM, Niels Kobschätzki ... w is for word , and W is for WORD . A WORD is simpler: anything separated by whitespaces is a WORD.
                          Message 12 of 20 , Dec 11, 2013
                          • 0 Attachment
                            On Wed, Dec 11, 2013 at 7:53 AM, Niels Kobschätzki <niels@...> wrote:

                             
                            And every day you learn something new. I didn't know about W. Thanks :)
                            Btw viW seems to work even a bit better because it doesn't select the white space. Even so I read the help about text-objects, I do not really understand the difference between w and W in viw and viW (vaw/vaW) though and how it works. But it works.


                            w is for "word", and W is for "WORD". A "WORD" is simpler: anything separated by whitespaces is a WORD. But a "word" can be used in finer contexts. A word is whatever the option 'iskeyword' tells it to be, which is usually a sequence of letters, digits and underscores. So if you position the cursor at the start of myvariable=2 and type dw "myvariable" will be deleted; dW would delete the whole "myvariable=2".

                            --
                            []'s
                            Lucas

                            --
                            --
                            You received this message from the "vim_use" maillist.
                            Do not top-post! Type your reply below the text you are replying to.
                            For more information, visit http://www.vim.org/maillist.php
                             
                            ---
                            You received this message because you are subscribed to the Google Groups "vim_use" group.
                            To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@....
                            For more options, visit https://groups.google.com/groups/opt_out.
                          • Lucas Prado Melo
                            On Wed, Dec 11, 2013 at 8:06 AM, Lucas Prado Melo ... Btw, I should ve said dW, yW, etc... -- [] s Lucas -- -- You received this message from the vim_use
                            Message 13 of 20 , Dec 11, 2013
                            • 0 Attachment

                              On Wed, Dec 11, 2013 at 8:06 AM, Lucas Prado Melo <lucaspradomelo@...> wrote:
                              On Wed, Dec 11, 2013 at 7:53 AM, Niels Kobschätzki <niels@...> wrote:

                               
                              And every day you learn something new. I didn't know about W. Thanks :)
                              Btw viW seems to work even a bit better because it doesn't select the white space. Even so I read the help about text-objects, I do not really understand the difference between w and W in viw and viW (vaw/vaW) though and how it works. But it works.


                              w is for "word", and W is for "WORD". A "WORD" is simpler: anything separated by whitespaces is a WORD. But a "word" can be used in finer contexts. A word is whatever the option 'iskeyword' tells it to be, which is usually a sequence of letters, digits and underscores. So if you position the cursor at the start of myvariable=2 and type dw "myvariable" will be deleted; dW would delete the whole "myvariable=2".

                              Btw, I should've said dW, yW, etc...

                              --
                              []'s
                              Lucas

                              --
                              --
                              You received this message from the "vim_use" maillist.
                              Do not top-post! Type your reply below the text you are replying to.
                              For more information, visit http://www.vim.org/maillist.php
                               
                              ---
                              You received this message because you are subscribed to the Google Groups "vim_use" group.
                              To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@....
                              For more options, visit https://groups.google.com/groups/opt_out.
                            • Paul Isambert
                              ... Event faster: onoremap ; t; which lets you use d; , y; , etc., as dt; , yt; . And since we re having quite some fun (and automating repetitive
                              Message 14 of 20 , Dec 11, 2013
                              • 0 Attachment
                                > In the case I use it btw. something like vt; (handling a dhcpd.conf)
                                > is the fastest way so far.

                                Event faster:

                                onoremap ; t;

                                which lets you use "d;", "y;", etc., as "dt;", "yt;".

                                And since we're having quite some fun (and automating repetitive behaviors is
                                one of the strong points of Vim), you can try:

                                let s:patt = '\%(\d\{1,3}\.\)\{3}\d\{1,3}'
                                function! s:findIP ()
                                let [l, c] = getpos(".")[1:2]
                                let c -= 1
                                let L = getline(l)
                                let diff = 10000
                                let e = 0
                                while 1
                                let [s, e] = [match(L, s:patt, e), matchend(L, s:patt, e)]
                                let [d1, d2] = [s-c, c-e]
                                if s <= -1
                                break
                                elseif d1 <= 0 && d2 <= 0
                                let best = [s, e]
                                break
                                else
                                let [d1, d2] = [abs(d1), abs(d2)]
                                if d1 <= diff || d2 <= diff
                                let best = [s, e]
                                let diff = d1 < d2 ? d1 : d2
                                endif
                                endif
                                endwhile
                                if exists("l:best")
                                call cursor(l, best[0]+1)
                                normal! v
                                call cursor(l, best[1]+1)
                                endif
                                endfunction

                                onoremap <silent> I :<C-U>call <SID>findIP()<CR>

                                This lets you use "dI", "yI", etc., to delete/yank/etc. the IP address that is
                                the closer to the cursor. This way you don't have to move at the beginning of
                                the address you want, simply as close to it as possible. If there's only one
                                address on the current line, you don't have to move the cursor at all.

                                (Note: the script was not thoroughly tested!)

                                Best,
                                Paul

                                --
                                --
                                You received this message from the "vim_use" maillist.
                                Do not top-post! Type your reply below the text you are replying to.
                                For more information, visit http://www.vim.org/maillist.php

                                ---
                                You received this message because you are subscribed to the Google Groups "vim_use" group.
                                To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@....
                                For more options, visit https://groups.google.com/groups/opt_out.
                              • Ben Fritz
                                ... [snip] ... It looks like your complicated script just acts on the last search match, just like gn does built-in. If you re going to bring regex into it,
                                Message 15 of 20 , Dec 11, 2013
                                • 0 Attachment
                                  On Wednesday, December 11, 2013 6:42:05 AM UTC-6, Paul Isambert wrote:
                                  >
                                  > let s:patt = '\%(\d\{1,3}\.\)\{3}\d\{1,3}'
                                  >

                                  [snip]

                                  >
                                  > onoremap <silent> I :<C-U>call <SID>findIP()<CR>
                                  >
                                  >
                                  >
                                  > This lets you use "dI", "yI", etc., to delete/yank/etc. the IP address that is
                                  >
                                  > the closer to the cursor. This way you don't have to move at the beginning of
                                  >
                                  > the address you want, simply as close to it as possible. If there's only one
                                  >
                                  > address on the current line, you don't have to move the cursor at all.
                                  >

                                  It looks like your complicated script just acts on the last search match, just like gn does built-in.

                                  If you're going to bring regex into it, just do /\%(\d\{1,3}\.\)\{3}\d\{1,3} (or use ? instead of / if the match you want is before the cursor) and use ygn, dgn, cgn, etc. to operate on the match (in Vim 7.3.610 or higher). Then you can do it again with ygn to get the NEXT match, or if you deleted it or changed it or something the entire action is repeatable with '.'.

                                  Example, using text:
                                  --------------------
                                  Mine: 192.168.1.101
                                  Yours: 192.168.1.102
                                  --------------------

                                  Place cursor on "Mine". Type /\(\d\+\.\)\{3}\d\+ to select (very loosely) the first IP. Type dgn and then type either dgn again or just . (repeat command) to delete both IP addresses. Yes, I know this toy example could be easily done with :s. But more complicated examples very quickly get to the point where recording a simple macro using gn or gN is much easier than piecing together a complicated regular expression/substitute string for an :s command.

                                  As Gary said, this depends on Vim 7.3.610 or higher. Thanks VERY much to Christian Brabandt for this great feature! I probably use it daily.

                                  --
                                  --
                                  You received this message from the "vim_use" maillist.
                                  Do not top-post! Type your reply below the text you are replying to.
                                  For more information, visit http://www.vim.org/maillist.php

                                  ---
                                  You received this message because you are subscribed to the Google Groups "vim_use" group.
                                  To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@....
                                  For more options, visit https://groups.google.com/groups/opt_out.
                                • Paul Isambert
                                  ... Actually it s a bit smarter, in that it also selects the IP address you re on (with the cursor); the idea is that you probably want to select what your
                                  Message 16 of 20 , Dec 11, 2013
                                  • 0 Attachment
                                    > On Wednesday, December 11, 2013 6:42:05 AM UTC-6, Paul Isambert
                                    > wrote:
                                    > >
                                    > > let s:patt = '\%(\d\{1,3}\.\)\{3}\d\{1,3}'
                                    > >
                                    >
                                    > [snip]
                                    >
                                    > >
                                    > > onoremap <silent> I :<C-U>call <SID>findIP()<CR>
                                    > >
                                    > >
                                    > >
                                    > > This lets you use "dI", "yI", etc., to delete/yank/etc. the IP
                                    > > address that is
                                    > >
                                    > > the closer to the cursor. This way you don't have to move at the
                                    > > beginning of
                                    > >
                                    > > the address you want, simply as close to it as possible. If there's
                                    > > only one
                                    > >
                                    > > address on the current line, you don't have to move the cursor at
                                    > > all.
                                    > >
                                    >
                                    > It looks like your complicated script just acts on the last search
                                    > match, just like gn does built-in.

                                    Actually it's a bit smarter, in that it also selects the IP address you're on
                                    (with the cursor); the idea is that you probably want to select what your
                                    cursor is closer to. Of course that's just a matter of how the OP really
                                    works, but I thought an alternative solution sometimes helps, and a little
                                    complicated script can be really time-saving.

                                    Plus you simply need "dI", "yI", etc.

                                    Best,
                                    Paul

                                    --
                                    --
                                    You received this message from the "vim_use" maillist.
                                    Do not top-post! Type your reply below the text you are replying to.
                                    For more information, visit http://www.vim.org/maillist.php

                                    ---
                                    You received this message because you are subscribed to the Google Groups "vim_use" group.
                                    To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@....
                                    For more options, visit https://groups.google.com/groups/opt_out.
                                  • Christian Brabandt
                                    ... you re on (with the cursor); For what it s worth, gn also selects the match, if your cursor is on it. Best, Christian -- -- You received this message from
                                    Message 17 of 20 , Dec 11, 2013
                                    • 0 Attachment
                                      On Wed, December 11, 2013 17:45, Paul Isambert wrote:

                                      > Actually it's a bit smarter, in that it also selects the IP address
                                      you're on (with the cursor);

                                      For what it's worth, gn also selects the match, if your cursor is on it.

                                      Best,
                                      Christian

                                      --
                                      --
                                      You received this message from the "vim_use" maillist.
                                      Do not top-post! Type your reply below the text you are replying to.
                                      For more information, visit http://www.vim.org/maillist.php

                                      ---
                                      You received this message because you are subscribed to the Google Groups "vim_use" group.
                                      To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@....
                                      For more options, visit https://groups.google.com/groups/opt_out.
                                    • Ben Fritz
                                      ... I see, that s kind of clever. You d need a workaround like pressing 0 first for gn to work. I wonder if gn could be made smart enough to just work if the
                                      Message 18 of 20 , Dec 11, 2013
                                      • 0 Attachment
                                        On Wednesday, December 11, 2013 10:45:12 AM UTC-6, Paul Isambert wrote:
                                        >
                                        > > It looks like your complicated script just acts on the last search
                                        >
                                        > > match, just like gn does built-in.
                                        >
                                        >
                                        >
                                        > Actually it's a bit smarter, in that it also selects the IP address you're on
                                        >
                                        > (with the cursor); the idea is that you probably want to select what your
                                        >
                                        > cursor is closer to. Of course that's just a matter of how the OP really
                                        >
                                        > works, but I thought an alternative solution sometimes helps, and a little
                                        >
                                        > complicated script can be really time-saving.
                                        >
                                        >

                                        I see, that's kind of clever. You'd need a workaround like pressing 0 first for gn to work. I wonder if gn could be made smart enough to just work if the cursor is currently on the match but not at the first character?

                                        >
                                        > Plus you simply need "dI", "yI", etc.
                                        >

                                        You can also just use dgn, ygn, etc. One extra character, without a shift key...same basic effort.

                                        --
                                        --
                                        You received this message from the "vim_use" maillist.
                                        Do not top-post! Type your reply below the text you are replying to.
                                        For more information, visit http://www.vim.org/maillist.php

                                        ---
                                        You received this message because you are subscribed to the Google Groups "vim_use" group.
                                        To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@....
                                        For more options, visit https://groups.google.com/groups/opt_out.
                                      • Christian Brabandt
                                        ... In the spirit of Open Source I thought it s nice to give something back, so I am trying to fix bugs and improve Vim if possible. Although, gn introduced a
                                        Message 19 of 20 , Dec 11, 2013
                                        • 0 Attachment
                                          On Wed, December 11, 2013 15:53, Ben Fritz wrote:
                                          > As Gary said, this depends on Vim 7.3.610 or higher. Thanks VERY much to
                                          > Christian Brabandt for this great feature! I probably use it daily.

                                          In the spirit of Open Source I thought it's nice to give something
                                          back, so I am trying to fix bugs and improve Vim if possible.

                                          Although, gn introduced a couple of bugs, which took a while, until
                                          they were fixed, it was a fun excercise to make it work.

                                          Plus I can practics my C skills ;)

                                          Best,
                                          Christian

                                          --
                                          --
                                          You received this message from the "vim_use" maillist.
                                          Do not top-post! Type your reply below the text you are replying to.
                                          For more information, visit http://www.vim.org/maillist.php

                                          ---
                                          You received this message because you are subscribed to the Google Groups "vim_use" group.
                                          To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@....
                                          For more options, visit https://groups.google.com/groups/opt_out.
                                        • Paul Isambert
                                          ... You still have the problem that / always match after the cursor (unless, of course, you explicitly use something like ô %#ö in the regexp, but thatÆs
                                          Message 20 of 20 , Dec 11, 2013
                                          • 0 Attachment
                                            Ben Fritz <fritzophrenic@...> a écrit:
                                            > On Wednesday, December 11, 2013 10:45:12 AM UTC-6, Paul Isambert wrote:
                                            > >
                                            > > > It looks like your complicated script just acts on the last search
                                            > >
                                            > > > match, just like gn does built-in.
                                            > >
                                            > >
                                            > >
                                            > > Actually it's a bit smarter, in that it also selects the IP address you're on
                                            > >
                                            > > (with the cursor); the idea is that you probably want to select what your
                                            > >
                                            > > cursor is closer to. Of course that's just a matter of how the OP really
                                            > >
                                            > > works, but I thought an alternative solution sometimes helps, and a little
                                            > >
                                            > > complicated script can be really time-saving.
                                            > >
                                            > >
                                            >
                                            > I see, that's kind of clever. You'd need a workaround like pressing 0 first for gn to work. I wonder if gn could be made smart enough to just work if the cursor is currently on the match but not at the first character?

                                            You still have the problem that / always match after the cursor
                                            (unless, of course, you explicitly use something like “\%#” in the
                                            regexp, but that’s quite impractical).

                                            > > Plus you simply need "dI", "yI", etc.
                                            > >
                                            >
                                            > You can also just use dgn, ygn, etc. One extra character, without a shift key...same basic effort.

                                            Oh, I didn’t know “gn” what that clever. I’ve discovered it myself
                                            last week or so, and haven’t had time to really use it.

                                            ... a few seconds later ...

                                            Trying it right now: actually it does select the match if the cursor
                                            is on it, the next match otherwise. So you can map something like:

                                            /<regexp><CR>``gn

                                            which will select the match the cursor is on, if any. And you could
                                            also add a bit of “:nohl” to make things cleaner.

                                            Best,
                                            Paul

                                            --
                                            --
                                            You received this message from the "vim_use" maillist.
                                            Do not top-post! Type your reply below the text you are replying to.
                                            For more information, visit http://www.vim.org/maillist.php

                                            ---
                                            You received this message because you are subscribed to the Google Groups "vim_use" group.
                                            To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@....
                                            For more options, visit https://groups.google.com/groups/opt_out.
                                          Your message has been successfully submitted and would be delivered to recipients shortly.