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

Re: [vim] text formatting

Expand Messages
  • Dr. Charles E. Campbell
    ... The gj and gk commands are what you want! If you prefer their behavior to the usual j and k commands, you can always give yourself some handy maps:
    Message 1 of 13 , Feb 5, 2001
      Thus saith Arjona, Ariel:
      > The problem is that when I turn on wrapping in Vim, the whole wrapped
      > text is still considered one long line (which it is actually), where editors
      > like notepad will alow me to move up and down the text as if there were
      > multiple lines.
      ---------------------------------------------------------------------

      The "gj" and "gk" commands are what you want! If you prefer their
      behavior to the usual j and k commands, you can always give yourself
      some handy maps:

      nnoremap j gj
      nnoremap k gk

      Regards,
      C Campbell

      --
      Charles E Campbell, Jr, PhD _ __ __
      Goddard Space Flight Center / /_/\_\_/ /
      cec@... /_/ \/_//_/
      PGP public key: http://www.erols.com/astronaut/pgp.html/
    • Benji Fisher
      ... Have a look at ... in tips.txt to get something like Notepad behavior. If you want one file line per screen line, ... will do it. Besides reading all of
      Message 2 of 13 , Feb 5, 2001
        andy@... wrote:
        >
        > > multiple lines. Is there a way to have such behavior in Vim as well? I am
        > > trying to avoid <CR>s, since I want the text to adjust to the size of the
        > > window (I am using gvim 5.7 in Win2K BTW :)
        >
        > I have this same issue: I don't want Vim to wordwrap when I'm looking at
        > Apache log files. I want to scroll left'n'right if necessary, but see
        > only one record per line.
        >
        > xoxo,
        > Andy

        Have a look at

        :help edit-no-break

        in tips.txt to get something like Notepad behavior. If you want one
        file line per screen line,

        :set nowrap

        will do it. Besides reading all of :help options, a good way to find
        the options you want is

        :options

        HTH --Benji Fisher
      • Arjona, Ariel
        nowrap is what you need
        Message 3 of 13 , Feb 5, 2001
          nowrap is what you need

          > -----Original Message-----
          > From: andy@... [mailto:andy@...]
          > Sent: Monday, February 05, 2001 10:24 AM
          > To: Arjona, Ariel
          > Cc: Vim Mailing List (E-mail)
          > Subject: Re: text formatting
          >
          >
          > > multiple lines. Is there a way to have such behavior in Vim
          > as well? I am
          > > trying to avoid <CR>s, since I want the text to adjust to
          > the size of the
          > > window (I am using gvim 5.7 in Win2K BTW :)
          >
          > I have this same issue: I don't want Vim to wordwrap when I'm
          > looking at
          > Apache log files. I want to scroll left'n'right if necessary, but see
          > only one record per line.
          >
          > xoxo,
          > Andy
          >
          > --
          > # Andy Lester http://www.petdance.com AIM:petdance
          > %_=split';','.; Perl ;@;st a;m;ker;p;not;o;hac;t;her;y;ju';
          > print map $_{$_}, split //,
          > 'andy@...'
          >
          >
        • Arjona, Ariel
          oops! set nowrap I mean :)
          Message 4 of 13 , Feb 5, 2001
            oops!

            set nowrap I mean :)

            > -----Original Message-----
            > From: Arjona, Ariel [mailto:aarjona@...]
            > Sent: Monday, February 05, 2001 10:59 AM
            > To: andy@...
            > Cc: Vim Mailing List (E-mail)
            > Subject: RE: text formatting
            >
            >
            > nowrap is what you need
            >
            > > -----Original Message-----
            > > From: andy@... [mailto:andy@...]
            > > Sent: Monday, February 05, 2001 10:24 AM
            > > To: Arjona, Ariel
            > > Cc: Vim Mailing List (E-mail)
            > > Subject: Re: text formatting
            > >
            > >
            > > > multiple lines. Is there a way to have such behavior in Vim
            > > as well? I am
            > > > trying to avoid <CR>s, since I want the text to adjust to
            > > the size of the
            > > > window (I am using gvim 5.7 in Win2K BTW :)
            > >
            > > I have this same issue: I don't want Vim to wordwrap when I'm
            > > looking at
            > > Apache log files. I want to scroll left'n'right if
            > necessary, but see
            > > only one record per line.
            > >
            > > xoxo,
            > > Andy
            > >
            > > --
            > > # Andy Lester http://www.petdance.com AIM:petdance
            > > %_=split';','.; Perl ;@;st a;m;ker;p;not;o;hac;t;her;y;ju';
            > > print map $_{$_}, split //,
            > > 'andy@...'
            > >
            > >
            >
          • Arjona, Ariel
            That hit the spot. Thanx a lot! I have only one doubt left. I like the behavior of regular j, k commands (the only ones I used until now). The thing is that
            Message 5 of 13 , Feb 5, 2001
              That hit the spot. Thanx a lot!
              I have only one doubt left. I like the behavior of regular j, k commands
              (the only ones I used until now). The thing is that when in nowrap mode I
              didn't notice the difference between gj and regular j for instance. Is there
              any?

              Regards,
              Ariel Arjona


              > -----Original Message-----
              > From: Dr. Charles E. Campbell [mailto:cec@...]
              > Sent: Monday, February 05, 2001 10:28 AM
              > To: aarjona@...
              > Cc: vim@...
              > Subject: Re: [vim] text formatting
              >
              >
              > Thus saith Arjona, Ariel:
              > > The problem is that when I turn on wrapping in Vim, the
              > whole wrapped
              > > text is still considered one long line (which it is
              > actually), where editors
              > > like notepad will alow me to move up and down the text as
              > if there were
              > > multiple lines.
              > ---------------------------------------------------------------------
              >
              > The "gj" and "gk" commands are what you want! If you prefer their
              > behavior to the usual j and k commands, you can always give yourself
              > some handy maps:
              >
              > nnoremap j gj
              > nnoremap k gk
              >
              > Regards,
              > C Campbell
              >
              > --
              > Charles E Campbell, Jr, PhD _ __ __
              > Goddard Space Flight Center / /_/\_\_/ /
              > cec@... /_/ \/_//_/
              > PGP public key: http://www.erols.com/astronaut/pgp.html/
              >
            • Benji Fisher
              ... I think the only difference is when wrap is set and there are long lines. --Benji Fisher
              Message 6 of 13 , Feb 5, 2001
                "Arjona, Ariel" wrote:
                >
                > That hit the spot. Thanx a lot!
                > I have only one doubt left. I like the behavior of regular j, k commands
                > (the only ones I used until now). The thing is that when in nowrap mode I
                > didn't notice the difference between gj and regular j for instance. Is there
                > any?

                I think the only difference is when 'wrap' is set and there are
                long lines.

                --Benji Fisher
              • Arjona, Ariel
                Forgot, is there an equivalent for Insert mode?
                Message 7 of 13 , Feb 5, 2001
                  Forgot, is there an equivalent for Insert mode?

                  > -----Original Message-----
                  > From: Benji Fisher [mailto:fisherbb@...]
                  > Sent: Monday, February 05, 2001 11:47 AM
                  > To: Arjona, Ariel
                  > Cc: vim@...
                  > Subject: Re: [vim] text formatting
                  >
                  >
                  > "Arjona, Ariel" wrote:
                  > >
                  > > That hit the spot. Thanx a lot!
                  > > I have only one doubt left. I like the behavior of regular
                  > j, k commands
                  > > (the only ones I used until now). The thing is that when in
                  > nowrap mode I
                  > > didn't notice the difference between gj and regular j for
                  > instance. Is there
                  > > any?
                  >
                  > I think the only difference is when 'wrap' is set and there are
                  > long lines.
                  >
                  > --Benji Fisher
                  >
                • Alan G. Isaac
                  ... imap gji etc Alan Isaac
                  Message 8 of 13 , Feb 5, 2001
                    On Mon, 5 Feb 2001, Arjona, Ariel wrote:
                    > can I bind the arrow keys to Ctrl-O gj for example while in insert mode?

                    imap <down> <esc>gji
                    etc

                    Alan Isaac
                  • Benji Fisher
                    ... Beware of i and a in mappings: do they do what you want if the cursor is at the start or end of the line? In this case, consider Start Here: X End Here:
                    Message 9 of 13 , Feb 5, 2001
                      "Alan G. Isaac" wrote:
                      >
                      > On Mon, 5 Feb 2001, Arjona, Ariel wrote:
                      > > can I bind the arrow keys to Ctrl-O gj for example while in insert mode?
                      >
                      > imap <down> <esc>gji
                      > etc
                      >
                      > Alan Isaac

                      Beware of i and a in mappings: do they do what you want if the
                      cursor is at the start or end of the line? In this case, consider

                      Start Here: X
                      End Here: X

                      I think that

                      :imap <Down> <C-O>gj
                      :imap <Up> <C-O>gk

                      is safer.

                      --Benji Fisher
                    • Arjona, Ariel
                      Thanks to Dr.C, Alan Isaac and Benji Fisher for the feedback. Finaly got it down. Here is what I ended up adding to my _vimrc file for future reference for
                      Message 10 of 13 , Feb 5, 2001
                        Thanks to Dr.C, Alan Isaac and Benji Fisher for the feedback. Finaly got it
                        down. Here is what I ended up adding to my _vimrc file for future reference
                        for other people:

                        nnoremap j gj
                        nnoremap k gk
                        inoremap <down> <C-O>gj
                        inoremap <up> <C-O>gk
                        set showbreak=\ \ \ \ \ \ \ \

                        > -----Original Message-----
                        > From: Benji Fisher [mailto:fisherbb@...]
                        > Sent: Monday, February 05, 2001 12:23 PM
                        > To: Vim Users
                        > Subject: Re: text formatting
                        >
                        >
                        > "Alan G. Isaac" wrote:
                        > >
                        > > On Mon, 5 Feb 2001, Arjona, Ariel wrote:
                        > > > can I bind the arrow keys to Ctrl-O gj for example while
                        > in insert mode?
                        > >
                        > > imap <down> <esc>gji
                        > > etc
                        > >
                        > > Alan Isaac
                        >
                        > Beware of i and a in mappings: do they do what you want if the
                        > cursor is at the start or end of the line? In this case, consider
                        >
                        > Start Here: X
                        > End Here: X
                        >
                        > I think that
                        >
                        > :imap <Down> <C-O>gj
                        > :imap <Up> <C-O>gk
                        >
                        > is safer.
                        >
                        > --Benji Fisher
                        >
                      • David Olbersen
                        On Mon, 5 Feb 2001, Arjona, Ariel wrote: - The problem is that when I turn on wrapping in Vim, the whole wraped - text is still considered one long line (which
                        Message 11 of 13 , Feb 5, 2001
                          On Mon, 5 Feb 2001, Arjona, Ariel wrote:

                          ->The problem is that when I turn on wrapping in Vim, the whole wraped
                          ->text is still considered one long line (which it is actually)

                          Maybe something along the lines of ':set textwidth=80' would help?
                        Your message has been successfully submitted and would be delivered to recipients shortly.