1

I'd like to run a bash shell in a 'normal' document window in Slick Edit.

At a minimum I'd be content with running a command and having all output captured into a document window. Better would be the ability to interactively work with the shell in that window.

Vincent Scheib
  • 17,142
  • 9
  • 61
  • 77

1 Answers1

3

This is a bit crude, but it is what I use for launching external programs (including bash scripts). When I used to work in Win+Cygwin I also had a wrapper around the bash script but I forget why I needed that.

but remember that you can always tie specific actions to your project (build, compile, etc), you can always add your own as well Project->Properties->Tools->New. All those commands can execute in the process window

#include "slick.sh"

static _str mytmp='/tmp/myvstmp.txt'


_command git_annotate(_str filename='') name_info(',' VSARG2_MACRO )
{
   if (filename=='') {
      filename=p_buf_name;
   }
   curr_line=p_line;

   delete_file(mytmp); // make sure we dont get old file
   if( file_match(mytmp,'1')==mytmp ) {
      message('Tmp file delete failed! ('mytmp') change permissions and if still failing - restart vs');
      return 1
   }

   shell('/usr/bin/git blame -s 'filename' | sed "s@^\(.\{8\}\) [^)]*) @\1 @" >'mytmp, 'p');

   if( file_match(mytmp,'1')!=mytmp ) {
      message('Annotate failed');
      return 1
   }

   status=edit('-w 'mytmp);
   if (status) {
      message('Error opening output file for display.');
      return 1
   }

   goto_line(curr_line+1);

   // keep disk clean
   p_buf_flags |= VSBUFFLAG_THROW_AWAY_CHANGES;
   name("* annotate output *" filename, false);
   delete_file(mytmp);
}
nhed
  • 5,774
  • 3
  • 30
  • 44