Sublime Forum

TerminalView - Terminal inside ST3 view (Linux/macOS only)

#1

A plugin for those who want a terminal inside ST3 that supports interactive applications, password prompts, etc. I made the plugin mostly because I wanted to become more familiar with how terminals and shells work together (and where the different responsibilities are placed).

The outcome turned out better than expected and I think this plugin might actually be useful to someone else than me.

9 Likes

Start SublimeREPL at startup by default
#2

This is some fun stuff :smiley: . Can confirm that it also happens to work on my macOS laptop.

0 Likes

#3

Hey rwols glad you enjoy the plugin - nice to know it works on macOS aswell. I think there may have been some ST3 wrapping going on in your gif there (second ls came back skewed). I just pushed a fix to that :wink:

0 Likes

#4

No, that was just the sublime window being larger than the rectangle that I was recording. Not sure what you fixed then :smile:.

1 Like

#5

Excellent, it seems a lighter but better alternative to SublimeREPL.

0 Likes

#6

Great !!! I hope this plugin become full featured terminal :wink:

0 Likes

#7

I assume this is going to make its way to package control soon?

1 Like

#8

Glad people are finding the plugin useful :slight_smile:
@humza Yes. There’s a few things I would like to work out but hopefully soon I’ll be confident in making the plugin accessible through package control.

0 Likes

#9

Version 0.1.0 is out and a pull request has been made to package control -> https://github.com/wbond/package_control_channel/pull/6359

Be sure to check it out and test the color support (has to be enabled in settings).

0 Likes

#10

This plugin rocks and I already use it everyday. I’d like to put in a vote for scrollback functionality though (possibly the “scrolling functionality” referenced in the readme). Basically I really miss being able to scroll back through the terminal history. Having a configurable history buffer, ie number of saved lines (eg 5000) would be fantastic too!

Keep up the good work!

0 Likes

#11

Plugin is now available via package control https://packagecontrol.io/packages/TerminalView
@nutjob2 You are right that is the feature I am referring to in the readme and I agree it would be a very nice addition. I will probably be looking into it over the next week if I find the time :slight_smile:

0 Likes

#12

While I’m at it can I also suggest reconnecting existing terminal windows at startup? Probably not critical functionality but it would be nice to not have to close your previous work and re-open a terminal window when re-opening ST. This is only an issue if ST is configured to reopen your windows at startup, of course.

Something else I’ve been thinking about is getting the same error message navigation functionality as you find in build panels, so you can jump to the right source file and line when a error message is displayed in the terminal, but that probably can be implemented as a separate plugin, since it doesn’t require any terminal functionality.

0 Likes

#13

Cool, looks great !

I think there is room for improvements but this is a great start.

List of suggestions (note that I’d be interested in contributing if you agree with them):

  • color support:
    [EDIT]: sorry for the noise it’s working as intended

  • selecting like in a regular ST buffer
    I often need to copy/paste from the output, often the output I’m interested in span several lines and are not necessarly consecutive. To do this I need to copy the whole buffer in ST and select what I want through Ctrl+D. Being able to do this inside ST with your plugin would really simplify that workflow.
    I’m not sure if it’s voluntary but for now your plugin prevent any kind of selection. If you select something it would get unselected in as soon as you release the mouse.

  • editing like a regular ST buffer:
    Same thing I’d like to be able to edit the current terminal input with standard ST command. As that conflict with terminal special character (like Ctrl+D that insert EOD) I’d add a menu entry to insert such chars.

  • use ST syntaxes to color command output.
    I think it would be amazing if we could use specific ST syntax to color specific command output.
    For example I’d like to be able to put a specific syntax to color the logs of my program.
    Alternatively a simple system that let you match lines with regex and color them would already be nice.

  • Infinite buffer output
    I’m surprised by the current behavior that cut the term output to a fix size. Is it because you’re doing a “screen” emulation ? Wouldn’t it be possible to have access to the complete output ?

1 Like

#14

@nutjob2
Old sessions
I like the idea of re-opening old session for QOL reasons but it would be a bit tricky to implement since the shell is terminated when ST is closed. We could probably track the current working dir and try to re-open session but running programs would probably be lost.

Opening file paths
Finding file paths and opening them in ST would probably be do-able (and quite relevant) so I’ll definitely look into that at some point :slight_smile:

@gwenzek
Colors
Color support should be working with pyte which is the terminal emulator thats being used. If enabling colors through settings does not work for you I suggest you create an issue with some info about your setup (ST3 version, bash version, etc.)

Selecting/copying like regular buffer
As described in my development plan some copy paste functionality is to be included. I imagine the copy functionality being implemented somewhat like you describe. That is, you would enable some kind of “edit mode” where you can move the cursor freely and use your regular ST keybindings.

Editing input
The input goes straight to the shell so this is not really a possibility. It’s possible that the plugin could support some kind of command staging mode but that would be extreme QOL.

ST3 syntax coloring
This might actually be quite easy to implement. I’ll have a look at it when I get a bit of time.

Scrolling
I have a working PoC on another branch. The best terminal emulator I could find was pyte - but it only supports showing a screen of characters. The way the PoC works is by using pyte’s history screen. This works great but the ST scrollbars are not being used. I would like to implement a sliding window approach where the actual ST buffer is used as history but this will take some time and consideration (and probably some restructuring).

Thanks for the comments guys.

4 Likes

#15

Version 0.2 is out which includes some optimizations and scrolling support (using pyte not ST3 scrolling though).

Version 0.3 is also on the way where copy/paste functionality has already been included. This release is also going to include support for user provided syntax files as suggested by @gwenzek.

0 Likes

#16

With regards to “old sessions”: For me it’s just the inconvenience of having to recreate/reconnect windows to the plugin. Connecting to previous terminal sessions isn’t a big deal since the terminal environment is already setup at startup, or is driven by scripts.

0 Likes

#17

I agree the dead sessions should at least be restarted from scratch - Ill look into this when I have some time :slight_smile:

1 Like

#18

Version 0.3 is out with copy/paste functionality and support for user-provided syntax files as suggested by @gwenzek

1 Like

#19

Any chance we could see a windows version?

0 Likes

#20

You can track this feature request on:

https://github.com/Wramberg/TerminalView/issues/3

Accordingly to the author, this would require a lot of work and should not happen anytime soon.

I also would like to see it for windows, but it requires a python module which is only available for Linux. Perhaps the better request would be for the python module required to be also make available for windows.

I think the ones are import fcntl and import termios which are imported on the file:

I am just not sure why they are inside a try...catch block. Perhaps it is not to throw an error when cloning the package on windows machine.

0 Likes