Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

oops. i thought i had done that some times. i'll see if i can come up with any useful mechanisms to compensate for lying


allright. i came up with something but 1) it only works on windows and 2) you need an extra app. it's a really really good app though

the app is AutoHotkey: http://www.autohotkey.com/

and the script is:

  #SingleInstance Force
  
  #Enter::
      SendInput mr^a ;mark current spot in register r and select all
      Sleep 20
      SendInput ^c{Esc}``r ;copy, stop selection, return to spot

      ;if we have a REPL already, use it.  otherwise start a new one
      IfWinExist, Arc REPL
          WinActivate, Arc REPL
      else
          start_arc()

      MouseClick Right, 50, 50 ;open context menu
      SendInput p ;p for paste
  exit

  start_arc()
  {
      Run cmd /k cd "c:\\documents and settings\\blahblah\\desktop\\arc2"
      Sleep 100  ;wait for the cmd window to show before typing
      SendInput mzscheme -m -f "c:/documents and settings/blahblah/desktop/arc2/as.scm"{Enter}

      Sleep 200  ;wait for title to change
      IfWinExist, C:\WINDOWS\system32\cmd.exe - mzscheme
          WinSetTitle Arc REPL
  }

it's pretty simple. as you can see, it's for Arc, and it's setting a script to windows key + Enter. if you're editing some code in Vim, hit the hot key (when you're in command mode) and the script will ctrl+a -> ctrl+c the code in Vim and right-click paste it in the REPL. if there isn't a REPL open it will first open one and then paste it

you can make modifications such as only running what you have selected (would work well with visual modes,) only running the current paragraph (using the parentheses commands in Vim,) running what you have copied (i.e. Run-from-clipboard) and so on and so forth. you can also have a little window pop up where you can type some code and have it execute etc etc


I do use AHK for other things but never used it for this purpose, so, Thanks! I do my coding in my Linux machine though.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: