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

Re: How can i make TAB key to be a visible character.

Expand Messages
  • Ben Schmidt
    ... The listchars setting is also relevant. See ... Smiles, Ben. Send instant messages to your online friends http://au.messenger.yahoo.com
    Message 1 of 15 , Jan 1, 2008
      AkGw wrote:
      >
      > In C source file we always expand table (set expandtab) , but how can we
      > confirm if all TAB character has been expanded. Can we make TAB to be
      > a visible character such as "[TAB]" and how to do so .
      >
      > Thanks
      > Alick

      :set list

      The listchars setting is also relevant. See

      :help 'list'
      :help 'listchars'

      Smiles,

      Ben.





      Send instant messages to your online friends http://au.messenger.yahoo.com


      --~--~---------~--~----~------------~-------~--~----~
      You received this message from the "vim_use" maillist.
      For more information, visit http://www.vim.org/maillist.php
      -~----------~----~----~----~------~----~------~--~---
    • Ben Schmidt
      ... See my earlier reply about making them visible. But there are some other things you could try: 1. searching for tabs with the / command. In normal mode do
      Message 2 of 15 , Jan 1, 2008
        AkGw wrote:
        >
        > In C source file we always expand table (set expandtab) , but how can we
        > confirm if all TAB character has been expanded.

        See my earlier reply about making them visible. But there are some other things
        you could try:

        1. searching for tabs with the / command. In normal mode do

        /\t

        then press Enter, and it will jump to any tabs it finds. Use N to find the next ones.

        2. the :retab command will change all tabs to spaces (when expandtab is on). You
        can also get it to do the reverse if expandtab is off and you put a ! on the end. See

        :help :retab

        Cheers,

        Ben.




        Send instant messages to your online friends http://au.messenger.yahoo.com


        --~--~---------~--~----~------------~-------~--~----~
        You received this message from the "vim_use" maillist.
        For more information, visit http://www.vim.org/maillist.php
        -~----------~----~----~----~------~----~------~--~---
      • Tim Chase
        ... It sounds like you re looking for ... (and :set nolist to turn it off, or :set list! to toggle it) You may also be interested in the listchars
        Message 3 of 15 , Jan 1, 2008
          > In C source file we always expand table (set expandtab) , but how can we
          > confirm if all TAB character has been expanded. Can we make TAB to be
          > a visible character such as "[TAB]" and how to do so .


          It sounds like you're looking for

          :set list

          (and ":set nolist" to turn it off, or ":set list!" to toggle it)

          You may also be interested in the 'listchars' setting which
          allows you to choose the characters used for showing tabs.

          :help 'list'
          :help 'listchars'

          for more info.

          -tim




          --~--~---------~--~----~------------~-------~--~----~
          You received this message from the "vim_use" maillist.
          For more information, visit http://www.vim.org/maillist.php
          -~----------~----~----~----~------~----~------~--~---
        • Kazuo Teramoto
          On Jan 2, 2008 1:19 AM, Tim Chase wrote: :set list :help list :help listcharsOn Jan 2, 2008 1:16 AM, Ben Schmidt
          Message 4 of 15 , Jan 1, 2008
            On Jan 2, 2008 1:19 AM, Tim Chase <vim@...> wrote:
            > :set list
            > :help 'list'
            > :help 'listchars'

            On Jan 2, 2008 1:16 AM, Ben Schmidt <mail_ben_schmidt@...> wrote:
            > :set list
            > :help 'list'
            > :help 'listchars'

            vim_use need a collision detector ^__^'

            --
            «Dans la vie, rien n'est à craindre, tout est à comprendre»
            Marie Sklodowska Curie.

            --~--~---------~--~----~------------~-------~--~----~
            You received this message from the "vim_use" maillist.
            For more information, visit http://www.vim.org/maillist.php
            -~----------~----~----~----~------~----~------~--~---
          • Bill McCarthy
            ... You already have many good answers. Searching is very simple with 3 keystrokes: / If you find one, replace it with: r Look for the next
            Message 5 of 15 , Jan 1, 2008
              On Tue 1-Jan-08 9:03pm -0600, AkGw wrote:

              > In C source file we always expand table (set expandtab) , but how can we
              > confirm if all TAB character has been expanded. Can we make TAB to be
              > a visible character such as "[TAB]" and how to do so .

              You already have many good answers. Searching is very
              simple with 3 keystrokes: /<tab><enter>

              If you find one, replace it with: r<space>

              Look for the next one with: n

              Until you find no more: .n

              --
              Best regards,
              Bill


              --~--~---------~--~----~------------~-------~--~----~
              You received this message from the "vim_use" maillist.
              For more information, visit http://www.vim.org/maillist.php
              -~----------~----~----~----~------~----~------~--~---
            • Charles E Campbell Jr
              ... In addition to :set list, which others have already mentioned, there s SeeTab.vim (http://vim.sourceforge.net/scripts/script.php?script_id=628) which makes
              Message 6 of 15 , Jan 2, 2008
                AkGw wrote:

                >In C source file we always expand table (set expandtab) , but how can we
                > confirm if all TAB character has been expanded. Can we make TAB to be
                >a visible character such as "[TAB]" and how to do so .
                >
                >
                In addition to :set list, which others have already mentioned, there's
                SeeTab.vim (http://vim.sourceforge.net/scripts/script.php?script_id=628)
                which makes tabs visible with |s (and retains the usual tab spacing).
                Get the plugin, put in your plugins directory, type :SeeTab to toggle.

                Happy New Year!
                Chip Campbell


                --~--~---------~--~----~------------~-------~--~----~
                You received this message from the "vim_use" maillist.
                For more information, visit http://www.vim.org/maillist.php
                -~----------~----~----~----~------~----~------~--~---
              • James M Beck
                ... I highlight all the tab characters in red. I have these two lines in my .vimrc. highlight Tabs ctermbg=1 match Tabs t -James
                Message 7 of 15 , Jan 4, 2008
                  > In C source file we always expand table (set expandtab) , but how can we
                  > confirm if all TAB character has been expanded. Can we make TAB to be
                  > a visible character such as "[TAB]" and how to do so .


                  I highlight all the tab characters in red. I have these two lines in my
                  .vimrc.

                  highlight Tabs ctermbg=1
                  match Tabs "\t"

                  -James

                  --~--~---------~--~----~------------~-------~--~----~
                  You received this message from the "vim_use" maillist.
                  For more information, visit http://www.vim.org/maillist.php
                  -~----------~----~----~----~------~----~------~--~---
                • Gabriel Linder
                  On Fri, 04 Jan 2008 10:17:39 -0600 ... Very nice and interesting, but it works only for the first tab. I have added this at end of my .vimrc : highlight Tabs
                  Message 8 of 15 , Jan 7, 2008
                    On Fri, 04 Jan 2008 10:17:39 -0600
                    "James M Beck" <james.m.beck@...> wrote:

                    >
                    > > In C source file we always expand table (set expandtab) , but how
                    > > can we confirm if all TAB character has been expanded. Can we make
                    > > TAB to be a visible character such as "[TAB]" and how to do so .
                    >
                    >
                    > I highlight all the tab characters in red. I have these two lines in
                    > my .vimrc.
                    >
                    > highlight Tabs ctermbg=1
                    > match Tabs "\t"
                    >
                    > -James
                    >

                    Very nice and interesting, but it works only for the first tab.

                    I have added this at end of my .vimrc :
                    highlight Tabs ctermbg=1
                    match Tabs "\(\t\| $\)"

                    And now when I run vim -p foo bar I have tabs/ending spaces in red only
                    for the first tab (foo), not for the others (only bar here).

                    Is there a workaround for this ?

                    --~--~---------~--~----~------------~-------~--~----~
                    You received this message from the "vim_use" maillist.
                    For more information, visit http://www.vim.org/maillist.php
                    -~----------~----~----~----~------~----~------~--~---
                  • Ben Schmidt
                    ... I think you want to set it up as an autocommand for every file you open. I think... au BufRead,BufNewFile * hi Tabs ctermbg=1 | match Tabs ( t | $ ) See
                    Message 9 of 15 , Jan 7, 2008
                      Gabriel Linder wrote:
                      > On Fri, 04 Jan 2008 10:17:39 -0600
                      > "James M Beck" <james.m.beck@...> wrote:
                      >
                      >>> In C source file we always expand table (set expandtab) , but how
                      >>> can we confirm if all TAB character has been expanded. Can we make
                      >>> TAB to be a visible character such as "[TAB]" and how to do so .
                      >>
                      >> I highlight all the tab characters in red. I have these two lines in
                      >> my .vimrc.
                      >>
                      >> highlight Tabs ctermbg=1
                      >> match Tabs "\t"
                      >>
                      >> -James
                      >>
                      >
                      > Very nice and interesting, but it works only for the first tab.
                      >
                      > I have added this at end of my .vimrc :
                      > highlight Tabs ctermbg=1
                      > match Tabs "\(\t\| $\)"
                      >
                      > And now when I run vim -p foo bar I have tabs/ending spaces in red only
                      > for the first tab (foo), not for the others (only bar here).
                      >
                      > Is there a workaround for this ?

                      I think you want to set it up as an autocommand for every file you open. I think...

                      au BufRead,BufNewFile * hi Tabs ctermbg=1 | match Tabs "\(\t\| $\)"

                      See

                      :help :au

                      and

                      $VIMRUNTIME/filetype.vim

                      for more info.

                      Ben.





                      Send instant messages to your online friends http://au.messenger.yahoo.com


                      --~--~---------~--~----~------------~-------~--~----~
                      You received this message from the "vim_use" maillist.
                      For more information, visit http://www.vim.org/maillist.php
                      -~----------~----~----~----~------~----~------~--~---
                    • Ben Schmidt
                      ... Though I guess I should mention that :set list might do what you want anyway! See ... Ben. Send instant messages to your online friends
                      Message 10 of 15 , Jan 7, 2008
                        Ben Schmidt wrote:
                        > Gabriel Linder wrote:
                        >> On Fri, 04 Jan 2008 10:17:39 -0600
                        >> "James M Beck" <james.m.beck@...> wrote:
                        >>
                        >>>> In C source file we always expand table (set expandtab) , but how
                        >>>> can we confirm if all TAB character has been expanded. Can we make
                        >>>> TAB to be a visible character such as "[TAB]" and how to do so .
                        >>> I highlight all the tab characters in red. I have these two lines in
                        >>> my .vimrc.
                        >>>
                        >>> highlight Tabs ctermbg=1
                        >>> match Tabs "\t"
                        >>>
                        >>> -James
                        >>>
                        >> Very nice and interesting, but it works only for the first tab.
                        >>
                        >> I have added this at end of my .vimrc :
                        >> highlight Tabs ctermbg=1
                        >> match Tabs "\(\t\| $\)"
                        >>
                        >> And now when I run vim -p foo bar I have tabs/ending spaces in red only
                        >> for the first tab (foo), not for the others (only bar here).
                        >>
                        >> Is there a workaround for this ?
                        >
                        > I think you want to set it up as an autocommand for every file you open. I think...
                        >
                        > au BufRead,BufNewFile * hi Tabs ctermbg=1 | match Tabs "\(\t\| $\)"
                        >
                        > See
                        >
                        > :help :au
                        >
                        > and
                        >
                        > $VIMRUNTIME/filetype.vim
                        >
                        > for more info.
                        >
                        > Ben.

                        Though I guess I should mention that :set list might do what you want anyway!

                        See

                        :help 'list'
                        :help 'listchars'

                        Ben.





                        Send instant messages to your online friends http://au.messenger.yahoo.com


                        --~--~---------~--~----~------------~-------~--~----~
                        You received this message from the "vim_use" maillist.
                        For more information, visit http://www.vim.org/maillist.php
                        -~----------~----~----~----~------~----~------~--~---
                      • Tony Mechelynck
                        ... To make tabs visible, I recommend using the list and listchars options (q.v.): - listchars is global, list is window-local. - With list off, tabs
                        Message 11 of 15 , Jan 7, 2008
                          Gabriel Linder wrote:
                          > On Fri, 04 Jan 2008 10:17:39 -0600
                          > "James M Beck" <james.m.beck@...> wrote:
                          >
                          >>> In C source file we always expand table (set expandtab) , but how
                          >>> can we confirm if all TAB character has been expanded. Can we make
                          >>> TAB to be a visible character such as "[TAB]" and how to do so .
                          >>
                          >> I highlight all the tab characters in red. I have these two lines in
                          >> my .vimrc.
                          >>
                          >> highlight Tabs ctermbg=1
                          >> match Tabs "\t"
                          >>
                          >> -James
                          >>
                          >
                          > Very nice and interesting, but it works only for the first tab.
                          >
                          > I have added this at end of my .vimrc :
                          > highlight Tabs ctermbg=1
                          > match Tabs "\(\t\| $\)"
                          >
                          > And now when I run vim -p foo bar I have tabs/ending spaces in red only
                          > for the first tab (foo), not for the others (only bar here).
                          >
                          > Is there a workaround for this ?

                          To make tabs visible, I recommend using the 'list' and 'listchars' options (q.v.):

                          - 'listchars' is global, 'list' is window-local.
                          - With 'list' off, tabs appear as one or more blank spaces.
                          - With 'list' on and no "tab=" part in 'listchars', tabs are shown as ^I
                          - With 'list' on and ":set listchars=tab:\ \ ,<etc.>" (where <etc.> are other
                          'listchars' settings), tabs are one or more blank spaces again, but the other
                          'listchars' sub-options are active.
                          - With 'list' on and ":set listchars=tab:\|_", tabs are represented as one
                          vertical bar followed by zero or more underscores, as many as necessary.
                          - And so on.
                          - Note: In any ":set" command, spaces, double quotes, vertical bars and
                          (except in DOS/Windows paths) backslashes must be backslash-escaped, see
                          ":help option-backslash".

                          These options show the tabs in SpecialKey highlighting, usually in blue
                          foreground on the default background.


                          Best regards,
                          Tony.
                          --
                          i'm living so far beyond my income that we may almost be said to be
                          living apart.
                          -- e. e. cummings

                          --~--~---------~--~----~------------~-------~--~----~
                          You received this message from the "vim_use" maillist.
                          For more information, visit http://www.vim.org/maillist.php
                          -~----------~----~----~----~------~----~------~--~---
                        • Gabriel Linder
                          On Mon, 07 Jan 2008 21:11:42 +1100 ... Thanks you, it works now (I didn t know autocmd and events before). I know of list, but I prefer to have them in red :)
                          Message 12 of 15 , Jan 7, 2008
                            On Mon, 07 Jan 2008 21:11:42 +1100
                            Ben Schmidt <mail_ben_schmidt@...> wrote:
                            > Ben Schmidt wrote:
                            > >
                            > > I think you want to set it up as an autocommand for every file you
                            > > open. I think...
                            > >
                            > > au BufRead,BufNewFile * hi Tabs ctermbg=1 | match Tabs "\(\t\| $\)"
                            > >
                            > > See
                            > >
                            > > :help :au
                            > >
                            > > and
                            > >
                            > > $VIMRUNTIME/filetype.vim
                            > >
                            > > for more info.
                            > >
                            > > Ben.
                            >
                            > Though I guess I should mention that :set list might do what you want
                            > anyway!
                            >
                            > See
                            >
                            > :help 'list'
                            > :help 'listchars'
                            >

                            Thanks you, it works now (I didn't know autocmd and events before).

                            I know of list, but I prefer to have them in red :)

                            --~--~---------~--~----~------------~-------~--~----~
                            You received this message from the "vim_use" maillist.
                            For more information, visit http://www.vim.org/maillist.php
                            -~----------~----~----~----~------~----~------~--~---
                          • Tim Chase
                            ... Well, you can always change this in your personal colorscheme: hi SpecialKey guifg=Yellow guibg=Red ctermfg=Yellow ctermbg=Red or hi SpecialKey guifg=red
                            Message 13 of 15 , Jan 7, 2008
                              >> :help 'list'
                              >> :help 'listchars'
                              >>
                              >
                              > Thanks you, it works now (I didn't know autocmd and events before).
                              >
                              > I know of list, but I prefer to have them in red :)

                              Well, you can always change this in your personal colorscheme:

                              hi SpecialKey guifg=Yellow guibg=Red ctermfg=Yellow ctermbg=Red

                              or

                              hi SpecialKey guifg=red ctermfg=red term=bold

                              When 'list' is set, the tabs show up as "^I" highlighted via the
                              highlighting group "SpecialKey", so all you need to do is
                              redefine the colors for this group and presto!

                              :help hl-SpecialKey

                              -tim




                              --~--~---------~--~----~------------~-------~--~----~
                              You received this message from the "vim_use" maillist.
                              For more information, visit http://www.vim.org/maillist.php
                              -~----------~----~----~----~------~----~------~--~---
                            • Charles E Campbell Jr
                              There s also SeeTab.vim which makes tabs visible as |s. http://vim.sourceforge.net/scripts/script.php?script_id=628
                              Message 14 of 15 , Jan 7, 2008
                                There's also SeeTab.vim which makes tabs visible as |s.

                                http://vim.sourceforge.net/scripts/script.php?script_id=628
                                http://mysite.verizon.net/astronaut/vim/index.html#SEETAB

                                Regards,
                                Chip Campbell


                                --~--~---------~--~----~------------~-------~--~----~
                                You received this message from the "vim_use" maillist.
                                For more information, visit http://www.vim.org/maillist.php
                                -~----------~----~----~----~------~----~------~--~---
                              Your message has been successfully submitted and would be delivered to recipients shortly.