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

More newbie questions

Expand Messages
  • Daniel Bron
    Hello, 1) Can I get visible spaces ? 2) Can Vim display line numbers? 3) How can I remap the tab key so that if a block of text is selected and tab is
    Message 1 of 13 , Jul 30, 2003
    • 0 Attachment
      Hello,

      1) Can I get 'visible spaces'?

      2) Can Vim display line numbers?

      3) How can I remap the tab key so that if a block of text is
      selected
      and tab is pressed, the entire block is indented, and vice-versa
      for
      shift+tab?

      Thanks,
      -D. Bron
    • uws
      ... Use syntax hilighting or :set hlsearch / . ... mvrgr, Wouter -- ... you asked me to kill your headache :: use a gun -- sneaker pimps
      Message 2 of 13 , Jul 30, 2003
      • 0 Attachment
        På Wed, Jul 30, 2003 at 11:25:38AM -0400, Daniel Bron skrev:
        > Hello,
        >
        > 1) Can I get 'visible spaces'?

        Use syntax hilighting or :set hlsearch<CR>/ <CR>.

        > 2) Can Vim display line numbers?

        :set number

        > 3) How can I remap the tab key so that if a block of text is selected
        > and tab is pressed, the entire block is indented, and vice-versa for
        > shift+tab?

        :vnoremap <Tab> >>
        :vnoremap <S-Tab> <<

        mvrgr, Wouter

        --
        :wq mail uws@...

        you asked me to kill your headache :: use a gun -- sneaker pimps
      • Sergei Gerasenko
        ... and then ... See http://vimdoc.sourceforge.net/cgi-bin/vimfaq2html3.pl#17.7
        Message 3 of 13 , Jul 30, 2003
        • 0 Attachment
          On Wed, Jul 30, 2003 at 11:25:38AM -0400, Daniel Bron wrote:
          > Hello,
          >
          > 1) Can I get 'visible spaces'?

          :set list

          and then

          :set listchars=trail:.

          See http://vimdoc.sourceforge.net/cgi-bin/vimfaq2html3.pl#17.7
        • David Rock
          ... This is good, but only for trailing spaces. You will still need to research hlsearch for spaces not at the end of a line. -- David Rock
          Message 4 of 13 , Jul 30, 2003
          • 0 Attachment
            * Sergei Gerasenko <gerases@...> [2003-07-30 11:52]:
            > On Wed, Jul 30, 2003 at 11:25:38AM -0400, Daniel Bron wrote:
            > > Hello,
            > >
            > > 1) Can I get 'visible spaces'?
            >
            > :set list
            >
            > and then
            >
            > :set listchars=trail:.
            >
            > See http://vimdoc.sourceforge.net/cgi-bin/vimfaq2html3.pl#17.7

            This is good, but only for trailing spaces. You will still need to
            research hlsearch for spaces not at the end of a line.

            --
            David Rock
            david@...
          • Antony Scriven
            ... Is this necessary in with a monospaced font? There is either a gap between the letters, or there isn t. Antony
            Message 5 of 13 , Jul 30, 2003
            • 0 Attachment
              David Rock wrote:

              > * Sergei Gerasenko <gerases@...> [2003-07-30 11:52]:
              > > On Wed, Jul 30, 2003 at 11:25:38AM -0400, Daniel Bron wrote:
              > > > Hello,
              > > >
              > > > 1) Can I get 'visible spaces'?
              > >
              > > :set list
              > >
              > > and then
              > >
              > > :set listchars=trail:.
              > >
              > > See http://vimdoc.sourceforge.net/cgi-bin/vimfaq2html3.pl#17.7
              >
              > This is good, but only for trailing spaces. You will still need to
              > research hlsearch for spaces not at the end of a line.

              Is this necessary in with a monospaced font? There is either
              a gap between the letters, or there isn't.

              Antony
            • David Rock
              ... What about tabs? You may see spaces, but you will not know if it is attributed to tabs or spaces. To fix this, you could use another item in ... -- David
              Message 6 of 13 , Jul 30, 2003
              • 0 Attachment
                * Antony Scriven <ads1@...> [2003-07-30 12:27]:
                > David Rock wrote:
                >
                > > * Sergei Gerasenko <gerases@...> [2003-07-30 11:52]:
                > > > On Wed, Jul 30, 2003 at 11:25:38AM -0400, Daniel Bron wrote:
                > > > > Hello,
                > > > >
                > > > > 1) Can I get 'visible spaces'?
                > > >
                > > > :set list
                > > >
                > > > and then
                > > >
                > > > :set listchars=trail:.
                > > >
                > > > See http://vimdoc.sourceforge.net/cgi-bin/vimfaq2html3.pl#17.7
                > >
                > > This is good, but only for trailing spaces. You will still need to
                > > research hlsearch for spaces not at the end of a line.
                >
                > Is this necessary in with a monospaced font? There is either
                > a gap between the letters, or there isn't.

                What about tabs? You may see spaces, but you will not know if it is
                attributed to tabs or spaces. To fix this, you could use another item in
                your listchars:
                :set lcs=trail:.,tab:>-

                --
                David Rock
                david@...
              • Antony Scriven
                [ Charset ISO-8859-1 unsupported, converting... ] ... Sure. I thought someone had already mentioned :set list. I probably imagined that. As David Rock has
                Message 7 of 13 , Jul 31, 2003
                • 0 Attachment
                  [ Charset ISO-8859-1 unsupported, converting... ]
                  > P? Wed, Jul 30, 2003 at 12:27:36PM -0400, Antony Scriven skrev:
                  > > David Rock wrote:
                  > > > This is good, but only for trailing spaces. You will still need to
                  > > > research hlsearch for spaces not at the end of a line.
                  > > Is this necessary in with a monospaced font? There is either
                  > > a gap between the letters, or there isn't.
                  >
                  > These spaces could also be tabs.
                  >
                  > mvrgr, Wouter

                  Sure. I thought someone had already mentioned :set list. I
                  probably imagined that. As David Rock has mentioned :set
                  lcs+=tab:>- is useful for this. And once that is set, I
                  don't think that you need to make spaces visible, IMO.

                  I've also just noticed that the default for 'lcs' is not vi
                  compatible: it doesn't show tabs as ^I (at least not in my
                  vim6.1). I'm guessing this is because it fouls up alignment.

                  > --
                  > :wq mail uws@...
                  >
                  > i awake to see that no one is free :: we're all fugitives -- coldplay

                  Finally, someone I've heard of :-)

                  Antony
                • uws
                  ... If you re editing Makefile (for instance), you could use :set list, which I find very hard to look at for a longer duration, or syntax hilighting which
                  Message 8 of 13 , Jul 31, 2003
                  • 0 Attachment
                    På Thu, Jul 31, 2003 at 04:05:46AM -0400, Antony Scriven skrev:
                    > [ Charset ISO-8859-1 unsupported, converting... ]
                    > > P? Wed, Jul 30, 2003 at 12:27:36PM -0400, Antony Scriven skrev:
                    > > > David Rock wrote:
                    > > > > This is good, but only for trailing spaces. You will still need to
                    > > > > research hlsearch for spaces not at the end of a line.
                    > > > Is this necessary in with a monospaced font? There is either
                    > > > a gap between the letters, or there isn't.
                    > > These spaces could also be tabs.
                    > Sure. I thought someone had already mentioned :set list. I
                    > probably imagined that. As David Rock has mentioned :set
                    > lcs+=tab:>- is useful for this. And once that is set, I
                    > don't think that you need to make spaces visible, IMO.

                    If you're editing Makefile (for instance), you could use :set list, which I
                    find very hard to look at for a longer duration, or syntax hilighting which
                    gives all spaces a different backgound color. I prefer the latter.

                    > > i awake to see that no one is free :: we're all fugitives -- coldplay
                    > Finally, someone I've heard of :-)

                    Heh. My random sigs are cool. :)

                    mvrgr, Wouter

                    --
                    :wq mail uws@...

                    who's gonna take it like this? :: no way :: you are, you are -- gomez
                  • Antony Scriven
                    ... Good point. I guess it depends on your colourscheme. I display tabs as lightblue on a light background. They aren t too distracting for me. But using
                    Message 9 of 13 , Jul 31, 2003
                    • 0 Attachment
                      Wouter wrote:

                      > P? Thu, Jul 31, 2003 at 04:05:46AM -0400, Antony Scriven
                      > skrev:
                      >
                      > > > Wed, Jul 30, 2003 at 12:27:36PM -0400, Antony
                      > > > Scriven skrev:
                      > > >
                      > > > > David Rock wrote:
                      > > > >
                      > > > > > This is good, but only for trailing spaces.
                      > > > > > You will still need to research hlsearch for
                      > > > > > spaces not at the end of a line.
                      > > > >
                      > > > > Is this necessary in with a monospaced font?
                      > > > > There is either a gap between the letters, or
                      > > > > there isn't.
                      > > >
                      > > > These spaces could also be tabs.
                      > >
                      > > Sure. I thought someone had already mentioned :set
                      > > list. I probably imagined that. As David Rock has
                      > > mentioned :set lcs+=tab:>- is useful for this. And
                      > > once that is set, I don't think that you need to make
                      > > spaces visible, IMO.
                      >
                      > If you're editing Makefile (for instance), you could use
                      > :set list, which I find very hard to look at for a
                      > longer duration, or syntax hilighting which gives all
                      > spaces a different backgound color. I prefer the latter.

                      Good point. I guess it depends on your colourscheme. I
                      display tabs as lightblue on a light background. They aren't
                      too distracting for me. But using syntax highlighting to
                      highlight spaces in this case is a good idea.

                      Antony

                      (Phew! Reformatting that quotation was tricky in nvi :-()
                    • Antoine J. Mechelynck
                      ... According to what is said in the help, if you :set list and lcs haven t been set (for instance in the vimrc) then tabs will appear as ^I. To make them
                      Message 10 of 13 , Jul 31, 2003
                      • 0 Attachment
                        Antony Scriven <ads1@...> wrote:
                        > [ Charset ISO-8859-1 unsupported, converting... ]
                        > > P? Wed, Jul 30, 2003 at 12:27:36PM -0400, Antony Scriven skrev:
                        > > > David Rock wrote:
                        > > > > This is good, but only for trailing spaces. You will still
                        > need to > > > research hlsearch for spaces not at the end of a line.
                        > > > Is this necessary in with a monospaced font? There is either
                        > > > a gap between the letters, or there isn't.
                        > >
                        > > These spaces could also be tabs.
                        > >
                        > > mvrgr, Wouter
                        >
                        > Sure. I thought someone had already mentioned :set list. I
                        > probably imagined that. As David Rock has mentioned :set
                        > lcs+=tab:>- is useful for this. And once that is set, I
                        > don't think that you need to make spaces visible, IMO.
                        >
                        > I've also just noticed that the default for 'lcs' is not vi
                        > compatible: it doesn't show tabs as ^I (at least not in my
                        > vim6.1). I'm guessing this is because it fouls up alignment.
                        >
                        > > --
                        > > :wq mail
                        > uws@... >
                        > > i awake to see that no one is free :: we're all fugitives
                        > -- coldplay
                        >
                        > Finally, someone I've heard of :-)
                        >
                        > Antony

                        According to what is said in the help, if you ":set list" and 'lcs' haven't
                        been set (for instance in the vimrc) then tabs will appear as ^I. To make
                        them appear white with 'list' on, then ":set lcs +=tab:\ \ ". But if 'list'
                        is off (the default) vim shows tabs as whitespace and doesn't show any of
                        the other suboptions (eol, trail, precedes, extends) of 'listchars'.

                        Regards,
                        Tony.
                      • Antony Scriven
                        ... Hmm, I m glad you ve pointed this out. Of course vim displays tabs as `^I by default. Doing vim -u NONE a moment ago and then :set list I get `^I for
                        Message 11 of 13 , Jul 31, 2003
                        • 0 Attachment
                          Antoine Mechelynck wrote:

                          > Antony Scriven <ads1@... >wrote:
                          > > [...] I've also just noticed that the default for
                          > > 'lcs' is not vi compatible: it doesn't show tabs as
                          > > ^I (at least not in my vim6.1). I'm guessing this is
                          > > because it fouls up alignment.
                          >
                          > According to what is said in the help, if you ":set
                          > list" and 'lcs' haven't been set (for instance in the
                          > vimrc) then tabs will appear as ^I. To make them appear
                          > white with 'list' on, then ":set lcs +=tab:\ \ ". But if
                          > 'list' is off (the default) vim shows tabs as whitespace
                          > and doesn't show any of the other suboptions (eol,
                          > trail, precedes, extends) of 'listchars'.

                          Hmm, I'm glad you've pointed this out. Of course vim
                          displays tabs as `^I' by default. Doing vim -u NONE a moment
                          ago and then :set list I get `^I' for tabs which is I what I
                          would have expected. Now, I then :set lcs=+tab:>-, and then
                          :set lcs& and had nothing displaying for tabs. :set lcs=
                          however did result in `^I' displaying for tabs.

                          I was able to reproduce this behaviour, but in the course of
                          writing up my exact steps it stopped happening. And now it
                          doesn't happen. Go figure. I think it was probably just a
                          glitch in the screen redrawing.

                          Antony
                        • Antoine J. Mechelynck
                          ... Maybe. The helpfile says that the default setting for lcs is eol:$ (and tab empty, ie, ^I). But I didn t actually check if it s true. My own preference
                          Message 12 of 13 , Aug 1, 2003
                          • 0 Attachment
                            Antony Scriven <ads1@...> wrote:
                            > Antoine Mechelynck wrote:
                            >
                            > > Antony Scriven <ads1@... >wrote:
                            > > > [...] I've also just noticed that the default for
                            > > > 'lcs' is not vi compatible: it doesn't show tabs as
                            > > > ^I (at least not in my vim6.1). I'm guessing this is
                            > > > because it fouls up alignment.
                            > >
                            > > According to what is said in the help, if you ":set
                            > > list" and 'lcs' haven't been set (for instance in the
                            > > vimrc) then tabs will appear as ^I. To make them appear
                            > > white with 'list' on, then ":set lcs +=tab:\ \ ". But if
                            > > 'list' is off (the default) vim shows tabs as whitespace
                            > > and doesn't show any of the other suboptions (eol,
                            > > trail, precedes, extends) of 'listchars'.
                            >
                            > Hmm, I'm glad you've pointed this out. Of course vim
                            > displays tabs as `^I' by default. Doing vim -u NONE a moment
                            > ago and then :set list I get `^I' for tabs which is I what I
                            > would have expected. Now, I then :set lcs=+tab:>-, and then
                            > > set lcs& and had nothing displaying for tabs. :set lcs=
                            > however did result in `^I' displaying for tabs.
                            >
                            > I was able to reproduce this behaviour, but in the course of
                            > writing up my exact steps it stopped happening. And now it
                            > doesn't happen. Go figure. I think it was probably just a
                            > glitch in the screen redrawing.
                            >
                            > Antony

                            Maybe. The helpfile says that the default setting for lcs is "eol:$" (and
                            tab empty, ie, ^I). But I didn't actually check if it's true. My own
                            preference goes to ":set lcs=tab:\ \ ,eol:¶" but other people have other
                            tastes and that's what options are for: let everyone use what suits them
                            best.

                            Regards,
                            Tony.
                          • Jürgen Krämer
                            Hi, ... you only need one greater-than or lower-than while in visual mode. Those mappings (un-)indent the selected block, hide the selection and than wait for
                            Message 13 of 13 , Aug 4, 2003
                            • 0 Attachment
                              Hi,

                              uws wrote:
                              > På Wed, Jul 30, 2003 at 11:25:38AM -0400, Daniel Bron skrev:
                              >
                              >> 3) How can I remap the tab key so that if a block of text is selected
                              >> and tab is pressed, the entire block is indented, and vice-versa for
                              >> shift+tab?
                              >
                              >
                              > :vnoremap <Tab> >>
                              > :vnoremap <S-Tab> <<

                              you only need one greater-than or lower-than while in visual mode.
                              Those mappings (un-)indent the selected block, hide the selection
                              and than wait for the user to tell VIM the objects which are to be
                              (un-)indented next. So

                              :vnoremap <tab> >
                              :vnoremap <s-tab> <

                              would be better. And if Daniel wants to (un-)indent the selected
                              block more than once, he can automatically restore the selection
                              at the end of the mapping

                              :vnoremap <tab> >gv
                              :vnoremap <s-tab> <gv

                              Regards,
                              Jürgen

                              --
                              Jürgen Krämer Softwareentwicklung
                              Habel GmbH mailto:jkraemer@...
                              Hinteres Öschle 2 Tel: (0 74 61) 93 53 15
                              78604 Rietheim-Weilheim Fax: (0 74 61) 93 53 99
                            Your message has been successfully submitted and would be delivered to recipients shortly.