python - Can't open working VIM editor from Java/Scala console application -


i'm trying run interactive editor java command-line program. example, equivalent code in python:

import subprocess; subprocess.call(["vim", "/tmp/hello"]) 

and opens vim editor , returns control python program when you're done editing.

the "equivalent" java program:

public class main{     public static void main(string[] args) throws java.io.ioexception{         new java.lang.processbuilder()                 .command("vim", "/tmp/hello2")                 .inheritio()                 .start();      } } 

does not open vim , leaves terminal in funky state need call reset before continuing.

the "equivalent" scala program

object main{   def main(args: array[string]): unit = {     import sys.process._     seq("vim", "/tmp/hello2").!<   } } 

opens vim successfully, keyboard navigation borked, , pressing arrow keys results in input like

^[od^[oa^[oc^[ob 

being entered text area instead of moving cursor around.

is there way replicate correct python behavior in java/scala?

programs such vi, emacs work in terminal programs such xterm. not designed work in process streams java , scala use execute external programs using processbuilder , sys.process respectively. why not able manipulate cursor , why vim not open forcing reset.

i haven't tried try invoking terminal program instead of vim directly , passing argument terminal program open vim.


Comments

Popular posts from this blog

node.js - Using Node without global install -

How to access a php class file from PHPFox framework into javascript code written in simple HTML file? -

java - Null response to php query in android, even though php works properly -