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

Re: replace represenation of certain characters with a string of characters?

Expand Messages
  • Christian Brabandt
    ... This however allows to visually display a portion of a text by a single other char (not 2 as you asked about). In your case, you can do: syn match
    Message 1 of 18 , Mar 25, 2013
    • 0 Attachment
      On Tue, March 26, 2013 03:41, neolus wrote:
      > I couldn't figure out a way to phrase my question but I'm not asking about
      > replacing patterns or anything.
      > I'd like to know if it's possible in vim to ( visually ) show any certain
      > character as something else. e.g. while editing a text file any occurrence
      > of the character '?' would just /look/ like '<>' but is still the
      > character
      > '?' and nothing is different except what you see. I'm asking because I
      > figured this is impossible but maybe someone out there knows something I
      > don't?
      >

      :h new-conceal

      This however allows to visually display a portion of a text by a single
      other char (not 2 as you asked about).

      In your case, you can do:

      syn match MyConcealedChar /?/ conceal cchar=Ąę
      :set conceallevel=2 concealcursor=nv

      See also
      :h 'conceallevel'
      :h 'concealcursor'

      regards,
      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.
    • neolus
      I considered using fontforge that way, only issue is I m not sure if fonts have particular resrtictions to cell size for each character. For my purposes I m
      Message 2 of 18 , Mar 26, 2013
      • 0 Attachment
        I considered using fontforge that way, only issue is I'm not sure if fonts
        have particular resrtictions to cell size for each character. For my
        purposes I'm doing more of a
        ( replace character with wide character e.g. from: ? to: <<>> )
        kinda thing..



        --
        View this message in context: http://vim.1045645.n5.nabble.com/replace-represenation-of-certain-characters-with-a-string-of-characters-tp5714620p5714646.html
        Sent from the Vim - General mailing list archive at Nabble.com.

        --
        --
        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.
      • neolus
        whenever I tried with two characters vim complained it was an invalid argument. conceallevel 2 is on but it still won t work with more than one character. I
        Message 3 of 18 , Mar 26, 2013
        • 0 Attachment
          whenever I tried with two characters vim complained it was an invalid
          argument.
          conceallevel 2 is on but it still won't work with more than one character.
          I tried
          hi Special gui=bold guibg=#000000 guifg=#022FEE
          set cole=2
          syn match Container "B" conceal cchar=AE
          syn match Container "B" conceal cchar=Ąę
          and it complained. Were you just suggesting I try it? or did you try it and
          it worked?
          I read the help file and it does technically say that 2 still takes one
          character.
          "is completely hidden unless it has a
          custom replacement character"




          --
          View this message in context: http://vim.1045645.n5.nabble.com/replace-represenation-of-certain-characters-with-a-string-of-characters-tp5714620p5714649.html
          Sent from the Vim - General mailing list archive at Nabble.com.

          --
          --
          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.
        • neolus
          Also even if fontforge could let me draw a wide glyph doesn t vim only allow monospace fonts anyway? -- View this message in context:
          Message 4 of 18 , Mar 26, 2013
          • 0 Attachment
            Also even if fontforge could let me draw a wide glyph doesn't vim only allow
            monospace fonts anyway?



            --
            View this message in context: http://vim.1045645.n5.nabble.com/replace-represenation-of-certain-characters-with-a-string-of-characters-tp5714620p5714650.html
            Sent from the Vim - General mailing list archive at Nabble.com.

            --
            --
            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.
          • John Little
            ... In principle, CJK fonts have double width characters in them. See, f.ex., :help guifontwide. However, I have just imparted the totality of my knowledge
            Message 5 of 18 , Mar 26, 2013
            • 0 Attachment
              On Wednesday, March 27, 2013 2:47:14 PM UTC+13, neolus wrote:
              > Also even if fontforge could let me draw a wide glyph doesn't vim only allow
              > monospace fonts anyway?

              In principle, CJK fonts have double width characters in them. See, f.ex., :help guifontwide. However, I have just imparted the totality of my knowledge on the topic.

              Regards, John Little

              --
              --
              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.
            • neolus
              if that s all it s not worth looking into for me, as I in fact want more than just two character width . -- View this message in context:
              Message 6 of 18 , Mar 26, 2013
              • 0 Attachment
                if that's all it's not worth looking into for me, as I in fact want more than
                just two character width .



                --
                View this message in context: http://vim.1045645.n5.nabble.com/replace-represenation-of-certain-characters-with-a-string-of-characters-tp5714620p5714652.html
                Sent from the Vim - General mailing list archive at Nabble.com.

                --
                --
                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.
              • neolus
                I m sorry to be misleading, from the start I wanted to be able to do this with more than 2 characters ( at least 4 in particular) it seems like I gave the
                Message 7 of 18 , Mar 26, 2013
                • 0 Attachment
                  I'm sorry to be misleading, from the start I wanted to be able to do this
                  with more than 2 characters ( at least 4 in particular) it seems like I gave
                  the impression that I only needed two.



                  --
                  View this message in context: http://vim.1045645.n5.nabble.com/replace-represenation-of-certain-characters-with-a-string-of-characters-tp5714620p5714653.html
                  Sent from the Vim - General mailing list archive at Nabble.com.

                  --
                  --
                  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.
                • John Little
                  ... Another thought, you could use autocommands on reading and writing the file to change what s seen, like the way vim handles gzipped files. Regards, John
                  Message 8 of 18 , Mar 26, 2013
                  • 0 Attachment
                    > I wanted to be able to do thiswith more than 2 characters ( at least 4 in particular)

                    Another thought, you could use autocommands on reading and writing the file to change what's seen, like the way vim handles gzipped files.

                    Regards, John Little

                    --
                    --
                    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
                    ... If you read my message again, I already wrote, that only a single character is possible. regards, Christian -- -- You received this message from the
                    Message 9 of 18 , Mar 26, 2013
                    • 0 Attachment
                      On Wed, March 27, 2013 02:45, neolus wrote:
                      > whenever I tried with two characters vim complained it was an invalid
                      > argument.
                      > conceallevel 2 is on but it still won't work with more than one character.
                      > I tried
                      > hi Special gui=bold guibg=#000000 guifg=#022FEE
                      > set cole=2
                      > syn match Container "B" conceal cchar=AE
                      > syn match Container "B" conceal cchar=Ąę
                      > and it complained. Were you just suggesting I try it? or did you try it
                      > and
                      > it worked?
                      > I read the help file and it does technically say that 2 still takes one
                      > character.
                      > "is completely hidden unless it has a
                      > custom replacement character"


                      If you read my message again, I already wrote, that only a single character
                      is possible.

                      regards,
                      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.
                    • Christian Brabandt
                      ... How about a different approach and misusing folding: set fdm=expr fde= 1 fdl=0 foldminlines=0 fdt=substitute(getline(v:foldstart), vim , EMACS , g )
                      Message 10 of 18 , Mar 26, 2013
                      • 0 Attachment
                        On Wed, March 27, 2013 04:46, neolus wrote:
                        > I'm sorry to be misleading, from the start I wanted to be able to do this
                        > with more than 2 characters ( at least 4 in particular) it seems like I
                        > gave
                        > the impression that I only needed two.
                        >

                        How about a different approach and misusing folding:
                        set fdm=expr fde='>1' fdl=0 foldminlines=0
                        fdt=substitute(getline(v:foldstart),'vim','EMACS','g') fillchars-=fold

                        (You might want to adjust the Folded highlighting group. Syntax
                        highlighting won't be possible though).

                        regards,
                        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.
                      • neolus
                        hi I tried the first command and then the second gave me an error saying E492: Not an editor command: fdt=substitute(getline(v:foldstart), vim , EMACS , g )
                        Message 11 of 18 , Mar 27, 2013
                        • 0 Attachment
                          hi I tried the first command and then the second gave me an error saying

                          E492: Not an editor command:
                          fdt=substitute(getline(v:foldstart),'vim','EMACS','g') fillchars-=fold
                          I also tried the command with
                          set fdt=substitute(getline(v:foldstart),'vim','EMACS','g')
                          fillchars-=fold
                          which didn't complain but nothing happened, ( I typed a g and it was the
                          same? )

                          Anyway I'd like to keep syntax highlighting if possible so maybe we
                          shouldn't get too much in to this. I have a feeling it won't lead to
                          promising results...





                          --
                          View this message in context: http://vim.1045645.n5.nabble.com/replace-represenation-of-certain-characters-with-a-string-of-characters-tp5714620p5714664.html
                          Sent from the Vim - General mailing list archive at Nabble.com.

                          --
                          --
                          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.
                        • neolus
                          John Little-4 wrote ... you mean like running sed on the whole file when opening it and running it again after saving it? that s basically my give up plan --
                          Message 12 of 18 , Mar 27, 2013
                          • 0 Attachment
                            John Little-4 wrote
                            > Another thought, you could use autocommands on reading and writing the
                            > file to change what's seen, like the way vim handles gzipped files.

                            you mean like running sed on the whole file when opening it and running it
                            again after saving it?
                            that's basically my "give up plan"



                            --
                            View this message in context: http://vim.1045645.n5.nabble.com/replace-represenation-of-certain-characters-with-a-string-of-characters-tp5714620p5714667.html
                            Sent from the Vim - General mailing list archive at Nabble.com.

                            --
                            --
                            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
                            ... That was supposed to be typed in one single line (e.g. one single :set line without linebreaks), probably my mail was wrapped when sending. You also need
                            Message 13 of 18 , Mar 27, 2013
                            • 0 Attachment
                              On Wed, March 27, 2013 16:51, neolus wrote:
                              > hi I tried the first command and then the second gave me an error saying
                              >
                              > E492: Not an editor command:
                              > fdt=substitute(getline(v:foldstart),'vim','EMACS','g') fillchars-=fold
                              > I also tried the command with
                              > set fdt=substitute(getline(v:foldstart),'vim','EMACS','g')
                              > fillchars-=fold
                              > which didn't complain but nothing happened, ( I typed a g and it was the
                              > same? )

                              That was supposed to be typed in one single line (e.g. one single :set
                              line without linebreaks), probably my mail was wrapped when sending.
                              You also need to enable folding, e.g. :set foldenable

                              So in whole type this as 1 single :set statement:
                              set fdm=expr fde='>1' fdl=0 foldminlines=0
                              fdt=substitute(getline(v:foldstart),'vim','EMACS','g') fillchars-=fold fen

                              BTW: You know, that you need to replace vim by the chars you want to be
                              replaced and EMACS by the chars, that you like to see, right?

                              regards,
                              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.
                            • neolus
                              Christian Brabandt wrote ... no I did not get that before :) thx for explaining. impressive workaround! now just to make it more seemless I only need to figure
                              Message 14 of 18 , Apr 3 10:18 AM
                              • 0 Attachment
                                Christian Brabandt wrote
                                > BTW: You know, that you need to replace vim by the chars you want to be
                                > replaced and EMACS by the chars, that you like to see, right?

                                no I did not get that before :) thx for explaining.
                                impressive workaround!
                                now just to make it more seemless
                                I only need to figure out a way to get rid of the highlighting and appended
                                '--------'s
                                to get what I want now.




                                --
                                View this message in context: http://vim.1045645.n5.nabble.com/replace-represenation-of-certain-characters-with-a-string-of-characters-tp5714620p5714782.html
                                Sent from the Vim - General mailing list archive at Nabble.com.

                                --
                                --
                                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
                                Hi neolus! ... What highlighting? ... The :set fillchars-=fold should have taken care of that. In any case, make sure your fillchars setting doesn t include
                                Message 15 of 18 , Apr 3 11:24 AM
                                • 0 Attachment
                                  Hi neolus!

                                  On Mi, 03 Apr 2013, neolus wrote:

                                  > Christian Brabandt wrote
                                  > > BTW: You know, that you need to replace vim by the chars you want to be
                                  > > replaced and EMACS by the chars, that you like to see, right?
                                  >
                                  > no I did not get that before :) thx for explaining.
                                  > impressive workaround!
                                  > now just to make it more seemless
                                  > I only need to figure out a way to get rid of the highlighting and appended

                                  What highlighting?

                                  > '--------'s to get what I want now.

                                  The :set fillchars-=fold should have taken care of that. In any case,
                                  make sure your 'fillchars' setting doesn't include the fold item.

                                  Mit freundlichen Grüßen
                                  Christian
                                  --
                                  Glauben: Dinge für wahr halten, für die es keine Parallele und keinen
                                  Beweis gibt und die jemand verkündet, der über kein Wissen verfügt.
                                  -- Ambrose Gwinnet Bierce (Des Teufels Wörterbuch)

                                  --
                                  --
                                  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.
                                • neolus
                                  It s probably just my color scheme I have to fix, thx for all the help Christian! TSCHÜSS! -- View this message in context:
                                  Message 16 of 18 , Apr 4 4:50 PM
                                  • 0 Attachment
                                    It's probably just my color scheme I have to fix, thx for all the help
                                    Christian!
                                    TSCHÜSS!



                                    --
                                    View this message in context: http://vim.1045645.n5.nabble.com/replace-represenation-of-certain-characters-with-a-string-of-characters-tp5714620p5714819.html
                                    Sent from the Vim - General mailing list archive at Nabble.com.

                                    --
                                    --
                                    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.