Hi,
:h todo.txt lists this item:

    ":colorscheme" without arguments should echo the current color 
    scheme name.

This has bothered me long enough, so I grabbed the source and gave 
myself a chance to give something back. So here is the patch.

regards,
Christian

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

To unsubscribe from this group, send email to 
vim_dev+unsubscribegooglegroups.com or reply to this email with the words 
"REMOVE ME" as the subject.
diff -r 24100651daa9 runtime/doc/syntax.txt
--- a/runtime/doc/syntax.txt	Tue Mar 23 18:22:46 2010 +0100
+++ b/runtime/doc/syntax.txt	Mon Mar 29 23:32:53 2010 +0200
@@ -3871,6 +3871,12 @@
 in their own color.
 
 						*:colo* *:colorscheme* *E185*
+:colo[rscheme]		Output the name of the currently active color scheme.
+			This is basically the same as >
+				:echo g:colors_name
+>			In case g:colors_name has not been defined, :colo
+			will simply return "default".
+
 :colo[rscheme] {name}	Load color scheme {name}.  This searches 'runtimepath'
 			for the file "colors/{name}.vim.  The first one that
 			is found is loaded.
diff -r 24100651daa9 src/eval.c
--- a/src/eval.c	Tue Mar 23 18:22:46 2010 +0100
+++ b/src/eval.c	Mon Mar 29 23:32:53 2010 +0200
@@ -18376,8 +18376,14 @@
     else
     {
 	v = find_var(name, NULL);
-	if (v != NULL)
+	if (v != NULL) 
 	    tv = &v->di_tv;
+        else if ((v == NULL) &&	 (STRCMP(name, "g:colors_name") == 0))
+	{
+	    atv.v_type = VAR_STRING;
+	    atv.vval.v_string = (char_u *)"default";
+	    tv = &atv;
+	}
     }
 
     if (tv == NULL)
diff -r 24100651daa9 src/ex_cmds.h
--- a/src/ex_cmds.h	Tue Mar 23 18:22:46 2010 +0100
+++ b/src/ex_cmds.h	Mon Mar 29 23:32:53 2010 +0200
@@ -256,7 +256,7 @@
 EX(CMD_colder,		"colder",	qf_age,
 			RANGE|NOTADR|COUNT|TRLBAR),
 EX(CMD_colorscheme,	"colorscheme",	ex_colorscheme,
-			NEEDARG|WORD1|TRLBAR|CMDWIN),
+			WORD1|TRLBAR|CMDWIN),
 EX(CMD_command,		"command",	ex_command,
 			EXTRA|BANG|NOTRLCOM|USECTRLV|CMDWIN),
 EX(CMD_comclear,	"comclear",	ex_comclear,
diff -r 24100651daa9 src/ex_docmd.c
--- a/src/ex_docmd.c	Tue Mar 23 18:22:46 2010 +0100
+++ b/src/ex_docmd.c	Mon Mar 29 23:32:53 2010 +0200
@@ -6226,8 +6226,19 @@
 ex_colorscheme(eap)
     exarg_T	*eap;
 {
+    char *type;
+    if (*eap->arg == NUL)
+    {
+       type = "g:colors_name";
+       eap->arg = vim_strsave((char_u *)type);
+       ex_echo(eap);
+    }
+    else
+    {
     if (load_colors(eap->arg) == FAIL)
 	EMSG2(_("E185: Cannot find color scheme %s"), eap->arg);
+    }
+    
 }
 
     static void

Raspunde prin e-mail lui