Index: runtime/doc/version7.txt
===================================================================
*** runtime/doc/version7.txt	(revision 242)
--- runtime/doc/version7.txt	(working copy)
***************
*** 856,861 ****
--- 856,862 ----
  |getreg()|		get contents of a register
  |gettabwinvar()|	get variable from window in specified tab page.
  |has_key()|		check whether a key appears in a Dictionary
+ |haslocaldir()|		check if current window used |:lcd|
  |hasmapto()|		check for a mapping to a string
  |inputlist()|		select an entry from a list
  |index()|		index of item in List
Index: runtime/doc/todo.txt
===================================================================
*** runtime/doc/todo.txt	(revision 242)
--- runtime/doc/todo.txt	(working copy)
***************
*** 606,614 ****
  8   When redirecting and using ":silent" the current column for displaying and
      redirection can be different.  Use a separate variable to hold the column
      for redirection.
- 7   There is no way to change directory and go back without changing the local
-     and/or global directory.  Add a way to find out if the current window uses
-     a local directory.  Add cdcmd() that returns ":cd" or ":lcd"?
  7   The messages for "vim --help" and "vim --version" don't use
      'termencoding'.
  8   When 'scrollbind' is set, a window won't scroll horizontally if the cursor
--- 606,611 ----
Index: runtime/doc/usr_41.txt
===================================================================
*** runtime/doc/usr_41.txt	(revision 242)
--- runtime/doc/usr_41.txt	(working copy)
***************
*** 703,708 ****
--- 703,709 ----
  	isdirectory()		check if a directory exists
  	getfsize()		get the size of a file
  	getcwd()		get the current working directory
+ 	haslocaldir()		check if current window used |:lcd|
  	tempname()		get the name of a temporary file
  	mkdir()			create a new directory
  	delete()		delete a file
Index: runtime/doc/eval.txt
===================================================================
*** runtime/doc/eval.txt	(revision 242)
--- runtime/doc/eval.txt	(working copy)
***************
*** 1623,1628 ****
--- 1623,1629 ----
  globpath( {path}, {expr})	String	do glob({expr}) for all dirs in {path}
  has( {feature})			Number	TRUE if feature {feature} supported
  has_key( {dict}, {key})		Number	TRUE if {dict} has entry {key}
+ haslocaldir()			Number	TRUE if current window executed |:lcd|
  hasmapto( {what} [, {mode} [, {abbr}]])
  				Number	TRUE if mapping to {what} exists
  histadd( {history},{item})	String	add an item to a history
***************
*** 3016,3021 ****
--- 3017,3025 ----
  		The result is a Number, which is 1 if |Dictionary| {dict} has
  		an entry with key {key}.  Zero otherwise.
  
+ haslocaldir()						*haslocaldir()*
+ 		The result is a Number, which is 1 when the current
+                 window has set a local path via |:lcd|, and 0 otherwise.
  
  hasmapto({what} [, {mode} [, {abbr}]])			*hasmapto()*
  		The result is a Number, which is 1 if there is a mapping that
Index: src/eval.c
===================================================================
*** src/eval.c	(revision 242)
--- src/eval.c	(working copy)
***************
*** 541,546 ****
--- 541,547 ----
  static void f_globpath __ARGS((typval_T *argvars, typval_T *rettv));
  static void f_has __ARGS((typval_T *argvars, typval_T *rettv));
  static void f_has_key __ARGS((typval_T *argvars, typval_T *rettv));
+ static void f_haslocaldir __ARGS((typval_T *argvars, typval_T *rettv));
  static void f_hasmapto __ARGS((typval_T *argvars, typval_T *rettv));
  static void f_histadd __ARGS((typval_T *argvars, typval_T *rettv));
  static void f_histdel __ARGS((typval_T *argvars, typval_T *rettv));
***************
*** 7110,7115 ****
--- 7111,7117 ----
      {"globpath",	2, 2, f_globpath},
      {"has",		1, 1, f_has},
      {"has_key",		2, 2, f_has_key},
+     {"haslocaldir",	0, 0, f_haslocaldir},
      {"hasmapto",	1, 3, f_hasmapto},
      {"highlightID",	1, 1, f_hlID},		/* obsolete */
      {"highlight_exists",1, 1, f_hlexists},	/* obsolete */
***************
*** 11134,11139 ****
--- 11136,11152 ----
  }
  
  /*
+  * "haslocaldir()" function
+  */
+     static void
+ f_haslocaldir(argvars, rettv)
+     typval_T	*argvars;
+     typval_T	*rettv;
+ {
+     rettv->vval.v_number = (curwin->w_localdir != NULL);
+ }
+ 
+ /*
   * "hasmapto()" function
   */
      static void
