DJMcMayhem / V

A golfing language inspired by everybody's favorite text editor, vim.
77 stars 9 forks source link

Xterm not pre-installed on Mac #15

Closed kritixilithos closed 5 years ago

kritixilithos commented 7 years ago

os_code.py opens xterm to run V programs in debug mode for both Linux and Mac. However, in macs xterm by default is an unknown command since it is not pre-installed.

elif args["platform"] == "Linux": command = "xterm -e 'nvim -n -i NONE -u nvim/init.vim "

All I'm suggesting is that there be a statement to check if the platform is macOS and then runs the program without calling xterm

DJMcMayhem commented 7 years ago

That's a great point. Right now I'm just pretending that mac and linux are identical since most of the commands are close enough. https://github.com/DJMcMayhem/V/blob/master/main.py#L35

I'll distinguish the two, but I don't have a mac for testing on. Do you know what command I can use to open nvim in a new terminal window rather than the current one? The reason I used xterm -e 'nvim ...' is so that a new window would open and the process would fork. I'm not sure how to do that on OS X.

kritixilithos commented 7 years ago

With help from an SO answer, I was able to try something to fix it. Hence, I created a pull request after trying out everything to see if they worked, and they did! But I'm not entirely sure if what I did is the best way of solving this issue because the process doesn't really fork...

It should be noted that the new window will always (unless you modify the default settings) be the standard Terminal window. So even if you are running from another terminal (like XQuartz or iTerm2), it will still open a Terminal window when running nvim. (Also if you are using XQuartz like I am, the xterm command will also work)

kritixilithos commented 7 years ago

Thinking about it now, there is an alternative that would not require any change in the code, but would require another dependency for the users, XQuartz (used to be called X11 on older macs, but doesn't exist on newer macs). With XQuartz, the xterm command will run just fine without any problems. Not just that, the command key (as per my experience) will now emulate the behaviour of the alt key on windows and linux (for example, on the standard Terminal, alt+o = ø, but on XQuartz, Cmd+o = ï). This would make it easier for V-golfing.

DJMcMayhem commented 5 years ago

Closed in https://github.com/DJMcMayhem/V/commit/aced470fad746a90415ff2144efea660f0af75b8