Author Topic: Can VSlick be setup to "auto exit" when the last file is closed  (Read 3667 times)

fmerrow

  • Junior Community Member
  • Posts: 4
  • Hero Points: 0
Can VSlick be setup to "auto exit" when the last file is closed
« on: December 02, 2010, 08:19:18 pm »
Okay, so even after all of these years, I still love VI and while I use VSlick a lot . . . what I really love about VS is that its VIM emulation mode is excellent!

I am moving to a new system, and felt this urge to install VIM . . . yet VS is VIM plus so much more, I asked myself why . . . the reason is really trivial.

One thing that VIM does, is when I "ZZ" on the last file closing it . . . VIM terminates and gets out of my way . . . and puts me back on my Command Prompt.

However, VS leaves the GUI up . . . so I have to exit out . . . it is as simple as that . . . it take either a mouse movement and click or Alt-F4 to get back to the command prompt, so I use VIM in many places where VS would be as good or better.

I looked for an option "Exit on Last File Close" or equal . . . but don't see anything.

Is it possible to get VS to have the desired behavior?

Frank

Wanderer

  • Senior Community Member
  • Posts: 557
  • Hero Points: 23
Re: Can VSlick be setup to "auto exit" when the last file is closed
« Reply #1 on: December 02, 2010, 09:11:32 pm »
I imagine you could write a macro that is called whenever a buffer is closed.  If there are no more buffers left, close SlickEdit.
I'll go look for the place you would hook that in....

fmerrow

  • Junior Community Member
  • Posts: 4
  • Hero Points: 0
Re: Can VSlick be setup to "auto exit" when the last file is closed
« Reply #2 on: December 04, 2010, 01:20:57 am »
If you could point me at an example of how to catch a buffer close event . . . that would be very helpful.

I dug around in the programming docs a little bit . . . I see documenation on dialog events . . . nothing for "buffer close" . . . plus frankly this will be my first trip into programming VSlick . . . there is a lot there to learn . . . installing VIM would be easier . . .

I'm not sure it would be more fun though.  <wink>

Frank

fmerrow

  • Junior Community Member
  • Posts: 4
  • Hero Points: 0
Re: Can VSlick be setup to "auto exit" when the last file is closed
« Reply #3 on: December 04, 2010, 01:52:23 am »
Okay, so as it turns out, I have to install VIM anyway . . . though the reason is very perverted.

One "feature" that VS has that I have never understood . . . in VI emulation mode, once you open the command line (by typing ":"), you cannot paste into the command line buffer.

I have no idea why this is . . . but it has been a consistent "feature/bug" since the very beginning of VSlick (I been using both VIM and VSlick for like 15 years).

Most of the time it is no big deal, but occasionally I have that really complicated piece of information in my paste buffer than just cannot be easily re-typed . . . in that case, I fall back to VIM . . . VIM is happy to allow me to paste as I am building the command . . . (almost always I am building a complex %s/// command).

Frank

Graeme

  • Senior Community Member
  • Posts: 2494
  • Hero Points: 325
Re: Can VSlick be setup to "auto exit" when the last file is closed
« Reply #4 on: December 04, 2010, 03:38:48 am »
The code below is untested.  You could bind your normal buffer close shortcut key to this command.  Copy it into a macro file and use the load-module command on the macro menu to load it.

Code: [Select]
#include "vslick.sh"
_command close_buffer_and_maybe_exit() name_info(','VSARG2_READ_ONLY|VSARG2_REQUIRES_EDITORCTL)
{
   quit();
   if (_no_child_windows()) {
      safe_exit();
   }
}

Regarding VIM paste  - did you look up VIM emulation tables in the help.  It appears to indicate that one of Ctrl Y or Ctrl V should work  - I couldn't figure out which one though.

Graeme
« Last Edit: December 04, 2010, 06:52:15 am by Graeme »

fmerrow

  • Junior Community Member
  • Posts: 4
  • Hero Points: 0
Re: Can VSlick be setup to "auto exit" when the last file is closed
« Reply #5 on: December 04, 2010, 04:58:47 pm »
>Regarding VIM paste  - did you look up VIM emulation tables in the help.  It appears to indicate that
>one of Ctrl Y or Ctrl V should work  - I couldn't figure out which one though.

WOOT!!!  Thank you SO MUCH . . . ctl-Y works!!!  Excellent . . . this has bugged me for many years . . . nice to know it can be done.

I'll give your macro a try later today . . . again thank you.

Frank

P.S. As a side note, the reason ctl-v doesn't work is because ctl-v has a meaning in VI . . . so they moved the key . . . no problem . . . what I've never understood is why right click "Paste" was also disabled . . . perhaps "menu Paste" and ctl-v are so closely tied by the operating system they cannot be separated . . . seems like the menu could be made to work though even though the ctl-v itself has been hijacked for another purpose.  In any case . . . thank you!