Sublime Forum

Finally, a multi-platform Terminal running in Sublime Text

#1

(it was called Console)

Terminus is heavily inspired by TerminalView. However, TerminalView lacks of many features and does not provide good user experiences. Compare with TerminalView, this has

  • Windows support
  • continuous history
  • easily customizable themes
  • unicode support
  • 256 colors support
  • better xterm support

The package is not yet available via Package Control. I am aiming to release it in a week. Any feedback is welcome.

37 Likes

Problem when building a program
#2

Really nice. Feedback after quick testing on Windows 10 below.
(edit: I’ll see what I can debug/help with later today)


Scrolling through themes is extremely slow. Any change to the theme seems to be very slow, like changing font size or just activating the tab after viewing another tab.

Setting "selection_foreground" doesn’t seem to have an effect. (theme = user)


I’d like to be able to specify which shell command to use, for example ["C:\\msys64\\msys2_shell.cmd", "-no-start", "-defterm", "-msys2"]. I tried this with

>>> window.run_command('console_open', {'cmd': ['C:\\msys64\\msys2_shell.cmd', '-no-start', '-defterm', '-msys2']})

and variations of it, but it doesn’t seem like it would be that easy - it just comes back with process terminated with return code 1. I can specify a shell directly, for example window.run_command('console_open', {'cmd': 'C:\\msys64\\usr\\bin\\zsh.exe'}), but that means I need to also pass all the environment stuff that msys2_shell.cmd takes care of, like PATH.


WSL bash seems to work fine (window.run_command('console_open', {'cmd': 'bash.exe'})).


1 Like

#3

I’m having some issues with scrolling. It seems to scroll back to a fixed point when I press any key to enter something into the terminal, so that the cursor is scrolled out of view. I have kind of long windows, over 100 lines, is it assuming a maximum window size perhaps?

So when I run a command that outputs 250 lines, it doesn’t scroll to the end of the output, and always scrolls back to 125 lines, about half way.

Build 3176; MacOS 10.11.4; No other plugins.

1 Like

#4

@FHTheron
Did you turn on 256color when switching themes? It is quick fast on my Mac though. Maybe due to slow hard disk? The theme generator is actually built on a hack, I’ll check the selection setting later.

@nutjob2
That’s strange. Do you have a simple way to reproduce it? Also, what shell are you using?

0 Likes

#5

Using bash. The only thing I did was select the terminal-basic theme. Note that it doesn’t happen if I scroll down so the input line is the first line of the window, ie all other lines are not visible and have been scrolled off the top of the window.

Reproducing it would be:

  • open a console using your readme instructions, in a new window
  • call a command that produces about 250 lines (in my case youtube-dl --help)
  • try entering any other command
0 Likes

#6

Note that if I just hit return until the input line scrolls off the end of the screen it seems to be one line off, just beyond the bottom of the window. If there are a few of lines of output it seems to then be about half of the number of those lines below the bottom of the window. I could be wrong but that seems to be a pattern.

1 Like

#7

@FHTheron

Update: I have fixed the selection_foreground bug.

Additionally, I believe you need to use cmd.exe /c path-to-cmd-files to open cmd files.

0 Likes

#8

@nutjob2
I cannot reproduce it

0 Likes

#9

Found the thing that slowed it down after I saw “Plugin Event Profile”. If I disable ScopeHunter things work faster. Note that I did not have ScopeHunter in any active mode, it was just installed.

on_activated:
...
    ScopeHunter.scope_hunter: 21.000s total, mean: 0.259s, max: 2.609s

Now I want to see if I can keep Smart Backspace installed and get my backspace to actually work in the console view.

0 Likes

#10

Here we go, just needed to find the right keybinding context:

    { "keys": ["shift+backspace"], "command": "smart_backspace" },
    { "keys": ["backspace"], "command": "normal_backspace"
    },
    { "keys": ["backspace"], "command": "console_keypress",
        "args": { "key": "backspace" },
        "context": [{"key": "setting.console_view"}]
    },

How does "context": [{"key": "setting.console_view"}] work? Can I negate the test with something like "context": [{"key": "setting.console_view", "operator": "not_equal", "operand": null}]

0 Likes

#11

Something like

{ "key": "setting.console_view", "operator": "equal", "operand": false }
1 Like

#12

It’d be nice to have the console open in the current file’s directory, or perhaps set some environment variables about sublime’s open file / project or anything useful for use by shell scripts.

I’m also used to close the current view with Ctrl-W, which doesn’t work here. Ctrl-F4 works though.

Awesome plugin.

0 Likes

#13

@gpfsmurf

It is because ctrl+w may mean something in terminal, for example, it is used in vim. You could always redefine the keybind for console_view, say adding ctrl+w in your user keybind settings for closing the view.

3 Likes

#14

Hi,
I have three question:

  1. Is it possible open the console at position of last file location?
  2. Is it possible open the console on the bottom (like a sublime console)?
  3. How can I do if I want msys2 terminal on windows?
0 Likes

#15

Easiest is to just start it from within the open Console:
> C:\msys64\msys2_shell.cmd -no-start -defterm -msys2

The other option is to bind window.run_command('console_open' ... to a shortcut key and specify bash.exe or zsh.exe in msys as the command. You then also need to pass a whole bunch of environment variables (basically do what msys2_shell.cmd would do) and this is just not worth it. Starting inside the Console is much easier.

0 Likes

#16

Very cool @randy3k! When it will be available on Package Control, I will add it as a “dependency” for my plugin JavaScript Enhancements, so users will have to download also your plugin :slight_smile: (at this moment the dependency is TerminalView but, like you said, it hasn’t Windows support and the other things!).

0 Likes

#17

You can’t make a package a dependency of another package. Dependencies are things like libraries and executables.

0 Likes

#18

Did you try?

cmd.exe /c C:\msys64\msys2_shell.cmd -no-start -defterm -msys
1 Like

#19

Is it possible open the console on the bottom (like a sublime console)?

I don’t think it is possible. The closest thing is to open a pane in the bottom of the window.

1 Like

#20

Yeah I know! In fact I wrote “dependency” because I mean that I only check if the plugin have been installed or not! I don’t mean in the dependencies.json file :thumbsup:

0 Likes