SlickEdit Product Discussion > SlickEdit®

Sync'ing the Current Dir (in File Open pane) with a document's path

(1/2) > >>

It there a built-in command, or an add-in, that will cause the Current Directory (in left-side File Open pane) to be sync'ed with the currently selected document Window?  It would be nice if this could be either automatic or on-demand, but I would be happy with at least one of these.  I am using CUA mode.

Thanks in advance for any help.

I created these 2 macros for that purpose.
cdb == cd to current buffer
cdp == cd to project dir

--- Code: ---_command void cdb() name_info(',' VSARG2_REQUIRES_MDI_EDITORCTL|VSARG2_READ_ONLY|VSARG2_ICON)
   // @see cd_to_file_dir ()
   _str newdir=strip_filename (p_buf_name,'N');
   if ( last_char (newdir)==FILESEP ) newdir=substr (newdir,1,length (newdir)-1);
   if ( (newdir != '') && (getcwd () != newdir) )
      cd (newdir, 'm');
      // HS2: added to sync with 'Open' tab in project toolbar and process buffer
      _cd_tbopen ();
      _process_cd (newdir);

_command void cdp () name_info(',' VSARG2_REQUIRES_MDI_EDITORCTL|VSARG2_READ_ONLY|VSARG2_ICON)
   _str cwd=_ProjectGet_WorkingDir (_ProjectHandle (_project_name));
   if ( cwd != '' )
      cwd=absolute (cwd,strip_filename (_project_name,'n'));
      cd (cwd, 'm');
      // HS2: added to sync with 'Open' tab in project toolbar and process buffer
      _cd_tbopen ();
      _process_cd (cwd);

--- End code ---
Hope this is what you need.

SlickEdit has a capability for this built into the GNU Emacs emulation.  You may also enable this in any emulation by using Set Macro Variable or set-var command, and changing def_switchbuf_cd from 0 to 1.

Yes - I knew this cool setting .. but I prefer to stay in my project root normally.
And for some 'special' situations I just use these little helpers.
Thanks, HS2


That works great!  Thanks!

HS2.... I would love to try your approach but I am new enough to Slickedit (2 days) that I don't even know how to put that code into Slickedit.  I assume once loaded I can assign them to key-strokes.

Can you give me a simple list of steps to perform?
1. Save your text to file (name?  location?  file extension?)
2. Commands in Slickedit to "load"?
3. Name for key-binding assignments?

I am lacking docs at present.  My purchase has not yet been processed.  Thanks for the help.



[0] Message Index

[#] Next page

Go to full version