Hi,

I found frustration in displaying space chars and after searching the web
this seemed currently impossible but seemingly a wanted feature.

Therefore I downloaded the source and created a patch to do what I wanted.
I've attached the patch, added inline at the bottom of the email, also on
github here
https://github.com/tobes/vim/commit/0e7a0df6ea97c4b49338ceb4d86ef2608f85ca8a
.

Please let me know if there is anything I can do to aid getting this patch
or another that adds this feature added to vim.

I since discovered in the todo.txt that a patch had been created 6 years
ago although seemingly never merged
/runtime/doc/todo.txt  line 2062
-   Patch for adding "space" item in 'listchars'. (Jérémie Roquet, 2009 Oct
29,


Thanks for all the hard work that's been put in over the years

Toby Dacre


============================================


diff --git runtime/doc/options.txt runtime/doc/options.txt
index 39c3270..b617c39 100644
--- runtime/doc/options.txt
+++ runtime/doc/options.txt
@@ -4743,6 +4743,9 @@ A jump table for the options with a short description
can be found at |Q_op|.
                               *lcs-nbsp*
       nbsp:c    Character to show for a non-breakable space (character
             0xA0, 160).  Left blank when omitted.
+                            *lcs-space*
+      space:c    Character to show for a space. Left blank when
+            omitted.

     The characters ':' and ',' should not be used.  UTF-8 characters can
     be used when 'encoding' is "utf-8", otherwise only printable
diff --git src/globals.h src/globals.h
index 759c510..f0879dc 100644
--- src/globals.h
+++ src/globals.h
@@ -1163,6 +1163,7 @@ EXTERN int    lcs_eol INIT(= '$');
 EXTERN int    lcs_ext INIT(= NUL);
 EXTERN int    lcs_prec INIT(= NUL);
 EXTERN int    lcs_nbsp INIT(= NUL);
+EXTERN int    lcs_space INIT(= NUL);
 EXTERN int    lcs_tab1 INIT(= NUL);
 EXTERN int    lcs_tab2 INIT(= NUL);
 EXTERN int    lcs_trail INIT(= NUL);
diff --git src/option.c src/option.c
index d9cfda0..4d388e3 100644
--- src/option.c
+++ src/option.c
@@ -7320,6 +7320,7 @@ set_chars_option(varp)
     {&lcs_eol,    "eol"},
     {&lcs_ext,    "extends"},
     {&lcs_nbsp,    "nbsp"},
+    {&lcs_space,    "space"},
     {&lcs_prec,    "precedes"},
     {&lcs_tab2,    "tab"},
     {&lcs_trail,    "trail"},
diff --git src/screen.c src/screen.c
index 6816503..682039d 100644
--- src/screen.c
+++ src/screen.c
@@ -4307,6 +4307,26 @@ win_line(wp, lnum, startrow, endrow, nochange)
 #endif
         ++ptr;

+        /* 'list' : change char 32 to lcs_space. */
+        if (wp->w_p_list && (c == 32
+#ifdef FEAT_MBYTE
+            || (mb_utf8 && mb_c == 32)
+#endif
+            ) && lcs_space){
+        c = lcs_space;
+#ifdef FEAT_MBYTE
+        mb_c = c;
+        if (enc_utf8 && (*mb_char2len)(c) > 1)
+        {
+            mb_utf8 = TRUE;
+            u8cc[0] = 0;
+            c = 0xc0;
+        }
+        else
+            mb_utf8 = FALSE;    /* don't draw as UTF-8 */
+#endif
+        }
+
         /* 'list' : change char 160 to lcs_nbsp. */
         if (wp->w_p_list && (c == 160
 #ifdef FEAT_MBYTE

-- 
-- 
You received this message from the "vim_dev" 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_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.
commit 0e7a0df6ea97c4b49338ceb4d86ef2608f85ca8a
Author: Toby Dacre <[email protected]>
Date:   Mon Jun 15 20:54:43 2015 +0100

    Add space option to listchars

diff --git runtime/doc/options.txt runtime/doc/options.txt
index 39c3270..b617c39 100644
--- runtime/doc/options.txt
+++ runtime/doc/options.txt
@@ -4743,6 +4743,9 @@ A jump table for the options with a short description can 
be found at |Q_op|.
                                                        *lcs-nbsp*
          nbsp:c        Character to show for a non-breakable space (character
                        0xA0, 160).  Left blank when omitted.
+                                                       *lcs-space*
+         space:c       Character to show for a space. Left blank when
+                       omitted.
 
        The characters ':' and ',' should not be used.  UTF-8 characters can
        be used when 'encoding' is "utf-8", otherwise only printable
diff --git src/globals.h src/globals.h
index 759c510..f0879dc 100644
--- src/globals.h
+++ src/globals.h
@@ -1163,6 +1163,7 @@ EXTERN int        lcs_eol INIT(= '$');
 EXTERN int     lcs_ext INIT(= NUL);
 EXTERN int     lcs_prec INIT(= NUL);
 EXTERN int     lcs_nbsp INIT(= NUL);
+EXTERN int     lcs_space INIT(= NUL);
 EXTERN int     lcs_tab1 INIT(= NUL);
 EXTERN int     lcs_tab2 INIT(= NUL);
 EXTERN int     lcs_trail INIT(= NUL);
diff --git src/option.c src/option.c
index d9cfda0..4d388e3 100644
--- src/option.c
+++ src/option.c
@@ -7320,6 +7320,7 @@ set_chars_option(varp)
        {&lcs_eol,      "eol"},
        {&lcs_ext,      "extends"},
        {&lcs_nbsp,     "nbsp"},
+       {&lcs_space,    "space"},
        {&lcs_prec,     "precedes"},
        {&lcs_tab2,     "tab"},
        {&lcs_trail,    "trail"},
diff --git src/screen.c src/screen.c
index 6816503..682039d 100644
--- src/screen.c
+++ src/screen.c
@@ -4307,6 +4307,26 @@ win_line(wp, lnum, startrow, endrow, nochange)
 #endif
            ++ptr;
 
+           /* 'list' : change char 32 to lcs_space. */
+           if (wp->w_p_list && (c == 32
+#ifdef FEAT_MBYTE
+                       || (mb_utf8 && mb_c == 32)
+#endif
+                   ) && lcs_space){
+               c = lcs_space;
+#ifdef FEAT_MBYTE
+               mb_c = c;
+               if (enc_utf8 && (*mb_char2len)(c) > 1)
+               {
+                   mb_utf8 = TRUE;
+                   u8cc[0] = 0;
+                   c = 0xc0;
+               }
+               else
+                   mb_utf8 = FALSE;    /* don't draw as UTF-8 */
+#endif
+           }
+
            /* 'list' : change char 160 to lcs_nbsp. */
            if (wp->w_p_list && (c == 160
 #ifdef FEAT_MBYTE

Raspunde prin e-mail lui