enviando código de vim a stata

He estado usando Vim para escribir scripts Stata en Windows desde hace un tiempo en la universidad. Estoy aprendiendo R en este momento, y quiero cambiar completamente a Linux como mi sistema operativo (recientemente me cambié a Ubuntu en mi computadora portátil). R funciona bien con Vim en Windows y Linux, sin embargo, todavía necesito usar Stata a veces. En Windows, he estado usando un script AutoIt simple proporcionado por un usuario de Stata para enviar líneas / todo el archivo a Stata para su evaluación. Este script no funciona en Linux.

Así es como se ve el guión

; AutoIt v3 script to run a Stata do-file from an external text editor
; Version 3.1, Friedrich Huebler, [email protected], www.huebler.info, 30 March 2009

; Declare variables
Global $ini, $statapath, $statawin, $dofile, $winpause, $keypause, $clippause

; File locations
; Path to INI file
$ini = @ScriptDir & "\rundo.ini"
; Path to Stata executable
$statapath = IniRead($ini, "Stata", "statapath", "C:\Program Files\Stata10\wsestata.exe")
; Title of Stata window
$statawin = IniRead($ini, "Stata", "statawin", "Stata/SE 10.1")

; Path to do-file that is passed to AutoIt
; Edit line to match editor used, if necessary
$dofile = $CmdLine[1]

; Delays
; Pause after copying of Stata commands to clipboard
$clippause = IniRead($ini, "Delays", "clippause", "100")
; Pause between window-related operations
$winpause = IniRead($ini, "Delays", "winpause", "200")
; Pause between keystrokes sent to Stata
$keypause = IniRead($ini, "Delays", "keypause", "1")

; Set SendKeyDelay and WinWaitDelay to speed up or slow down script
Opt("WinWaitDelay", $winpause)
Opt("SendKeyDelay", $keypause)

; If more than one Stata window is open, the window 
; that was most recently active will be matched
Opt("WinTitleMatchMode", 2)

; Check if Stata is already open, start Stata if not
If WinExists($statawin) Then
  WinActivate($statawin)
  WinWaitActive($statawin)
  ; Activate Stata Command Window and select text (if any)
  Send("^4")
  Send("^a")
  ; Run saved do-file
  ; Double quotes around $dofile needed in case path contains blanks
  ClipPut("do " & '"' & $dofile & '"')
  ; Pause avoids problem with clipboard, may be AutoIt or Windows bug
  Sleep($clippause)
  Send("^v" & "{Enter}")
Else
  Run($statapath)
  WinWaitActive($statawin)
  ; Activate Stata Command Window
  Send("^4")
  ; Run saved do-file
  ; Double quotes around $dofile needed in case path contains blanks
  ClipPut("do " & '"' & $dofile & '"')
  ; Pause avoids problem with clipboard, may be AutoIt or Windows bug
  Sleep($clippause)
  Send("^v" & "{Enter}")
EndIf

; End of script

con lo siguiente en mi vimrc

" STATA DO-FILE SCRIPTS

fun! RunIt()
  w
  !start "C:\Programme\Stata10\integvim\rundo3\rundo.exe" "%:p"
endfun
map <F8> :<C-U>call RunIt()<CR><CR>
imap <F8> <Esc>:<C-U>call RunIt()<CR><CR>

fun! RunDoLines()
  let selectedLines = getbufline('%', line("'<"), line("'>"))
 if col("'>") < strlen(getline(line("'>")))
  let selectedLines[-1] = strpart(selectedLines[-1], 0, col("'>"))
  endif
 if col("'<") != 1
  let selectedLines[0] = strpart(selectedLines[0], col("'<")-1)
  endif
 let temp = tempname() . ".do"
  call writefile(selectedLines, temp)
    exec "!start C:\\Programme\\Stata10\\integvim\\rundo3\\rundo.exe " . temp
    au VimLeave * exe "!del -y" temp
endfun
map <F9> :<C-U>call RunDoLines()<CR><CR> 
imap <F9> <Esc>:<C-U>call RunDoLines()<CR><CR> 

Esto es realmente práctico y prácticamente la única razón por la que todavía me quedo con Windows. ¿Cómo haría para conseguir algo así para Ubuntu? Soy nuevo en Linux, y realmente no sé mucho sobre programación además de las estadísticas. Cualquier ayuda es muy apreciada. (No sugiera emacs, el soporte de emacs para stata es defectuoso y, aunque su integración con R es mucho mejor, me gustaría seguir usando Vim por ahora).

Sobre un tema posiblemente relacionado: estoy considerando aprender Python, ya que probablemente trabajaré con datos y realizaré análisis empíricos durante más tiempo, y creo que podría ser útil para algunas tareas, p. Ej. para resolver problemas como este o analizar datos de sitios web. ¿Se recomienda esto, o debería mirar otro idioma (u olvidar la idea por completo)?

Respuestas a la pregunta(0)

Su respuesta a la pregunta