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

Re: Please help with 3 topics...medium/advanced

Expand Messages
  • Michael Naumann
    ... For this I have some mappings to ease my life: map @a map @b map @c map @d With these, I m able to quickly map something with qa,qb,qc
    Message 1 of 17 , May 3, 2003
    • 0 Attachment
      On Saturday 03 May 2003 16:48, Myche'jae-Bel wrote:
      > way; in this case, I want to surround each line in double quotes. In
      > vile, I did the equivalent (in vim) as this: <qa0i"^[A"jq> (once again
      > commands surrounded by <>). This sets up a macro in register a that goes
      > to the beginning of the line, puts quotes around the line, and then goes
      > to the next line. Then I would do: <@a...> etc. for each line that
      > had to be changed. Now, in vim, I need to <@a@@@@@@> which is a little
      > harder, but not bad.

      For this I have some mappings to ease my life:
      map <F5> @a
      map <F6> @b
      map <F7> @c
      map <F7> @d

      With these, I'm able to quickly map something with qa,qb,qc or qd
      and have it instantly available under an F-Key.

      BTW: with the correct settings, vim remembers the contents of registers
      through invocations - very neat.

      HTH, Michael
    • Mikolaj Machowski
      ... What is harder depends :) I prefer regexps :))) m. -- LaTeX + Vim = http://vim-latex.sourceforge.net/ Vim-list(s) Users Map: (last change 21 Apr)
      Message 2 of 17 , May 3, 2003
      • 0 Attachment
        On Sat, May 03, 2003 at 12:21:40PM -0400, Myche'jae-Bel wrote:
        > String name
        > Address address
        > long phone
        > turns into
        > public String getName() { return this.name; }
        > public Address getAddress() { return this.address; }
        > public long getPhone() { return this.phone; }
        > using this macro
        > qa0wyw0i public ^[wwi get^[l~A() { return this.^[pA; }^[jq
        > and then @a@@ gets me what I want. This would be extremely hard to do
        > with regular expressions.

        :s+\(\w\+\)\s\(\w\+\)+ public \1 get\u\2() { return this.\2; }+

        What is harder depends :) I prefer regexps :)))

        m.
        --
        LaTeX + Vim = http://vim-latex.sourceforge.net/
        Vim-list(s) Users Map: (last change 21 Apr)
        http://skawina.eu.org/mikolaj/vimlist
        Are You There?
      • Piet Delport
        ... I m surprised no one has mentioned the CTRL-^ command... it does exactly what Juergen wants, AFAICT. -- Piet Delport Today s subliminal thought is:
        Message 3 of 17 , May 4, 2003
        • 0 Attachment
          On Sat, 03 May 2003 at 17:53:34 +0200, Juergen Salk wrote:
          > * Myche'jae-Bel <mikeb@...> [030503 09:06]:
          >
          >> 3) buffers...most recently used order
          >>
          >> One thing that would really help is a "most recently used" buffer
          >> switch command. This would be similar to vile's <_> (underscore)
          >> command. If Vim could maintain the order you've recently used your
          >> open buffers (instead of the order you opened them) I could <:map _
          >> :bmru!^M> (or maybe even something fancier so I could say <4_> to go
          >> to the fourth most recently used buffer).
          >
          > In vim there is an "alternate buffer", which is the most recently
          > used buffer. So you can switch back and forth between two buffers
          > you're workin on by <:b#>.

          I'm surprised no one has mentioned the CTRL-^ command... it does exactly
          what Juergen wants, AFAICT.

          --
          Piet Delport
          Today's subliminal thought is:
        • Gary Holloway
          It appears that (any) *backwards* motion used with a yank moves the cursor, but not forward motion! I can t imagine that that behavior is intentional? :)
          Message 4 of 17 , May 5, 2003
          • 0 Attachment
            It appears that (any) *backwards* motion used with a yank moves the cursor, but
            not forward motion!

            I can't imagine that that behavior is intentional? :) Bram?

            -gary

            / FROM: Juergen Salk <juergen.salk@...>, May 3 17:53 2003
            | ABOUT: Re: Please help with 3 topics...medium/advanced
            |
            | * Myche'jae-Bel <mikeb@...> [030503 09:06]:
            |
            | > 1) yanking
            | >
            | > I'm coming from vile, and I'm used to the cursor staying put when you yank
            | > (for instance, <majjjjjy'a> doesn't then return you to 'a, you're still down
            | > five lines).
            | >
            | > How do I get vim to leave me at the current cursor position, and not
            | > return me to 'a?
            | >
            | > Like, in Vim I kind of want <y'a> to really do <y'a``>. Any ideas? Is
            | > there another way I should be doing this?
            |
            | I second that! A yank command should be a yank command and not
            | a movement. It's also somewhat inconsistent, because other
            | y{motion} commands do not imply any movement.
            |
            [snip]
          • Benji Fisher
            ... Isn t this vi-compatible? --Benji Fisher
            Message 5 of 17 , May 5, 2003
            • 0 Attachment
              Gary Holloway wrote:
              > It appears that (any) *backwards* motion used with a yank moves the cursor, but
              > not forward motion!
              >
              > I can't imagine that that behavior is intentional? :) Bram?
              >
              > -gary

              Isn't this vi-compatible?

              --Benji Fisher
            • Bram Moolenaar
              ... This has been discussed before. The current behavior should be equal to that of Vi. If not, then give me an example. The behavior is consistent in that
              Message 6 of 17 , May 5, 2003
              • 0 Attachment
                Gary Holloway wrote:

                > It appears that (any) *backwards* motion used with a yank moves the
                > cursor, but not forward motion!
                >
                > I can't imagine that that behavior is intentional? :) Bram?

                This has been discussed before. The current behavior should be equal to
                that of Vi. If not, then give me an example.

                The behavior is consistent in that it moves the cursor to the start of
                the yanked area.

                I thought there was an item in the todo list to add a yank command that
                doesn't move the cursor, but I can't find it now.

                --
                hundred-and-one symptoms of being an internet addict:
                173. You keep tracking down the email addresses of all your friends
                (even childhood friends).

                /// Bram Moolenaar -- Bram@... -- http://www.Moolenaar.net \\\
                /// Creator of Vim - Vi IMproved -- http://www.Vim.org \\\
                \\\ Project leader for A-A-P -- http://www.A-A-P.org ///
                \\\ Help AIDS victims, buy at Amazon -- http://ICCF.nl/click1.html ///
              • Gary Holloway
                / FROM: Bram Moolenaar , May 5 20:25 2003 ... Alas, I m sure it is (I don t remember thinking this movement is odd when first switching
                Message 7 of 17 , May 5, 2003
                • 0 Attachment
                  / FROM: Bram Moolenaar <Bram@...>, May 5 20:25 2003
                  | ABOUT: Re: Please help with 3 topics...medium/advanced
                  |
                  |
                  | Gary Holloway wrote:
                  |
                  | > It appears that (any) *backwards* motion used with a yank moves the
                  | > cursor, but not forward motion!
                  | >
                  | > I can't imagine that that behavior is intentional? :) Bram?
                  |
                  | This has been discussed before. The current behavior should be equal to
                  | that of Vi. If not, then give me an example.

                  Alas, I'm sure it is (I don't remember thinking "this movement is odd" when
                  first switching from vi to vim). I sadly cannot confirm that anymore as all
                  our systems are now Linux, and therefore are vim!

                  |
                  | The behavior is consistent in that it moves the cursor to the start of
                  | the yanked area.

                  Ah, that's what I thought. Which is also confirmed with things like "yas"
                  (yank a sentence), where the cursor is in the middle of the yanked text...and
                  sure enough the cursor moves to the beginning of the yanked area.

                  But of course the example I first thought of to yank around the cursor didn't
                  move the cursor -- command-line yanks, such as:

                  :100,200y
                  or
                  :'a,'by

                  while sitting on line 150 (or line 1000 for that matter) does not move the
                  cursor. Similarly, when using marks (:'a,'by). Don't know how vi handled
                  that; so I cannot address the compatibilty here. My guess is that's the way it
                  worked... since yanking like that would likely be from a far-off area, and it
                  would be disconcerting to have the cursor jump there. Whereas when using
                  *movement* to yank, the movment would tend to be more localized.

                  |
                  | I thought there was an item in the todo list to add a yank command that
                  | doesn't move the cursor, but I can't find it now.

                  That might be nice. I just use '' if I didn't want to move. :)

                  -gary

                  |
                  | --
                  | hundred-and-one symptoms of being an internet addict:
                  | 173. You keep tracking down the email addresses of all your friends
                  | (even childhood friends).
                  |
                  | /// Bram Moolenaar -- Bram@... -- http://www.Moolenaar.net \\\
                  | /// Creator of Vim - Vi IMproved -- http://www.Vim.org \\\
                  | \\\ Project leader for A-A-P -- http://www.A-A-P.org ///
                  | \\\ Help AIDS victims, buy at Amazon -- http://ICCF.nl/click1.html ///
                  |
                  \ END: Bram Moolenaar
                • Juergen Salk
                  ... Maybe an option - such as yankmove / noyankmove - would suffice. Regards - Juergen
                  Message 8 of 17 , May 5, 2003
                  • 0 Attachment
                    * Bram Moolenaar <Bram@...> [030505 20:45]:

                    >
                    > > It appears that (any) *backwards* motion used with a yank moves the
                    > > cursor, but not forward motion!
                    > >
                    > > I can't imagine that that behavior is intentional? :) Bram?
                    >
                    > This has been discussed before. The current behavior should be equal to
                    > that of Vi. If not, then give me an example.
                    >
                    > I thought there was an item in the todo list to add a yank command that
                    > doesn't move the cursor, but I can't find it now.

                    Maybe an option - such as 'yankmove' / 'noyankmove' - would
                    suffice.

                    Regards - Juergen
                  • Charles E. Campbell
                    ... Its how SVR4.0 vi behaves, and its how I remember even earlier versions of vi behaving. Whoops. Guess I can t hide my non-teenage-ness anymore ...
                    Message 9 of 17 , May 5, 2003
                    • 0 Attachment
                      On Mon, May 05, 2003 at 08:25:31PM +0200, Bram Moolenaar wrote:
                      > > It appears that (any) *backwards* motion used with a yank moves the
                      > > cursor, but not forward motion!
                      > >
                      > > I can't imagine that that behavior is intentional? :) Bram?
                      >
                      > This has been discussed before. The current behavior should be equal to
                      > that of Vi. If not, then give me an example.
                      ---------------------------------------------------------------------

                      Its how SVR4.0 vi behaves, and its how I remember even earlier versions
                      of vi behaving. Whoops. Guess I can't hide my non-teenage-ness anymore
                      :O.

                      Regards,
                      Chip Campbell

                      --
                      Charles E Campbell, Jr, PhD _ __ __
                      Goddard Space Flight Center / /_/\_\_/ /
                      cec@... /_/ \/_//_/
                      PGP public key: http://www.erols.com/astronaut/pgp.html
                    • Bram Moolenaar
                      ... Certainly not. Options that change command behavior always cause lots of trouble for script writers. -- If Microsoft would build a car... ... the oil,
                      Message 10 of 17 , May 5, 2003
                      • 0 Attachment
                        Juergen Salk wrote:

                        > * Bram Moolenaar <Bram@...> [030505 20:45]:
                        >
                        > >
                        > > > It appears that (any) *backwards* motion used with a yank moves the
                        > > > cursor, but not forward motion!
                        > > >
                        > > > I can't imagine that that behavior is intentional? :) Bram?
                        > >
                        > > This has been discussed before. The current behavior should be equal to
                        > > that of Vi. If not, then give me an example.
                        > >
                        > > I thought there was an item in the todo list to add a yank command that
                        > > doesn't move the cursor, but I can't find it now.
                        >
                        > Maybe an option - such as 'yankmove' / 'noyankmove' - would
                        > suffice.

                        Certainly not. Options that change command behavior always cause lots
                        of trouble for script writers.

                        --
                        If Microsoft would build a car...
                        ... the oil, water temperature, and alternator warning lights would
                        all be replaced by a single "General Protection Fault" warning light.

                        /// Bram Moolenaar -- Bram@... -- http://www.Moolenaar.net \\\
                        /// Creator of Vim - Vi IMproved -- http://www.Vim.org \\\
                        \\\ Project leader for A-A-P -- http://www.A-A-P.org ///
                        \\\ Help AIDS victims, buy at Amazon -- http://ICCF.nl/click1.html ///
                      • Myche'jae-Bel
                        ... Ahh, if I would have RTFM I probably would have read that vim strives to be 100% vi compatible. And, since I never used REAL vi for any amount of time
                        Message 11 of 17 , May 5, 2003
                        • 0 Attachment
                          On Mon, 5 May 2003, Bram Moolenaar wrote:
                          > Juergen Salk wrote:
                          > > * Bram Moolenaar <Bram@...> [030505 20:45]:
                          > > > > It appears that (any) *backwards* motion used with a yank moves the
                          > > > > cursor, but not forward motion!
                          > > > >
                          > > > > I can't imagine that that behavior is intentional? :) Bram?
                          > > >
                          > > > This has been discussed before. The current behavior should be equal to
                          > > > that of Vi. If not, then give me an example.
                          > > >
                          > > > I thought there was an item in the todo list to add a yank command that
                          > > > doesn't move the cursor, but I can't find it now.
                          > >
                          > > Maybe an option - such as 'yankmove' / 'noyankmove' - would
                          > > suffice.
                          >
                          > Certainly not. Options that change command behavior always cause lots
                          > of trouble for script writers.

                          Ahh, if I would have RTFM I probably would have read that vim strives to
                          be 100% vi compatible.

                          And, since I never used REAL vi for any amount of time (always vile from
                          the beginning), I didn't know this behavior wasn't the norm.

                          I'd have to agree then, I would like to ask for a different "yank and
                          don't move" command if anybody's interested. Then I could just map it for
                          me.

                          Although, in the mean time maybe I'll just start yanking backwards, or use
                          `` or maybe figure something else out.

                          Mike

                          ======================================== http://www.gl.umbc.edu/~mikeb =
                          Mike J. Bell \\_O The above are my opinions.
                          UMBC Alumnus _/\\_ finger mikeb@... for my
                          mikeb@... / \\_ PGP public key
                        Your message has been successfully submitted and would be delivered to recipients shortly.