How to open a new terminal in VS Code from command line? - linux

Is it possible to open a new terminal tab in VS Code from the command line? I know it's possible to have hotkeys and click the icon in the GUI. However, I need to do this from a script to have several terminals. I am running Ubuntu within a Docker devcontainer. I looked at the solution of using a terminal multiplexer, which might work, but it doesn't seem necessary.

Related

Running sublime commands

Is there a way to run a sublimetext command (ie, the built-in commands documented here or added) without creating a keybinding or adding something to the pallette and .sublime-commands?
I've tried running sublime.run_command from the console to no avail.
Right before posting I realized I should be using the local window instance.
Opening the python console with ctrl+` and run the command using the current instance window.run_command("<command>", args=<args>) is a workable solution.
(posting anyways because I was unable to find an answer to my question)

Using console as tab

I have several cpp source files in tabs in vim. I would like to have another tab with command prompt in order to run make. I open net tab , run sh and now I have console. But how to move from this console to other tabs? If I press ctrl+page up I have garbage in console and no tab change. How to move to another text tab when staying in console tab?
As I said, vim 8 or neovim both have an terminal emulator in it.
Since you are using vim 7 here are some other ways:
Tmux as #wizzup mentioned is perfect for this use-case. I think it is the most used Terminal-Multiplexer and extremly mighty. It is complex in comparison but since you are using vim, a steep learning curve should not be a killer point. However there are a few cavehats but you will find thousands of articles to solve them.
GNU Screen is an alternative to tmux, I have no experience with it, but should be usable pretty good with vim too.
With them you can use something like this Plugin which allows you to use the terminal in vim itself. However I haven't tested it but it seems to be rather groomed.

Copy/pasting feature in codeblocks in linux

I have installed Code::Blocks 12.11 in my linux mint but pasting input at runtime in the command line(I think it is called command line)doesn't seem to work.I have to type the whole input inorder to get output.Can anybody tell me how to fix this?
P.S :- I have tied ctrl+V as well as right click and paste but nothing really working in my case
This problem arises when you have xterm as your launch terminal.You can solve this by switching your terminal from xterm to gnome-terminal.
Go to Settings -> Environment -> Terminal to Launch Console Programs
and change the launch terminal from xterm to gnome terminal from the options.
In the terminal, for copy and paste:
Shift+Ctrl-c and Shift+Ctrl-v
In the Xterm, for pasting:
Middle click or Shift-Insert
if you want to copy in the xterm, you just select the text with your mouse and paste using the middle click or Shift-Instert, but it just works inside the xterm.

Run Selection in MATLAB from Linux Command Line

I am running an SSH into a linux computer. The MATLAB GUI can be very slow and unresponsive. Is there a way I can use MATLAB in command line mode so that I can highlight part of my code and run that section? In GUI, it is possible to do this in the Editor window by right clicking and choosing 'Run Selection' or by pressing F9. In command line mode, I only know how to run the entire script.
In a similar vein, can I run a section of the code (the 'Run and Advance' button in the GUI) using command line?
Also, is it possible to see the workspace (like the Workspace window in the GUI version) from the command line?
AFAIK there is a no-desktop mode in MATLAB, which you can access by running it with -nodesktop parameter, this should provide you with what you need. You can find more info on official MATLAB pages
As Niemand said you can start MATLAB with the flag -nodesktop.
You won't be able to select and run a potion of code with -nodesktop. You could just put that chunk of code in a separate function or script and call that.
If you're doing a lot of work without the GUI I would recommend looking at http://matlab-emacs.sourceforge.net. This is a MATLAB mode for Emacs that provides many of the same functionalities as the MATLAB desktop.
Lastly check out who and whos to see the workspace variables.

alt-tab like functionality when using terminal?

When working in GUI we do alt-tab (or cmd-tab in mac) to switch between multiple programs, for example I am writing a text file in a text editor and then I do alt-tab to switch to already running browser to google up something then I alt-tab again to come back to keep editing.
How do you perform such "switch between" programs in command line interface - for example working with a ssh command line shell?
EDIT: I forgot to mention it, I am using ssh to connect to my university's server, and they don't have screen & tmux installed, and my account have no right to install any new apps... Is there any built-in functionality to perform this task, or any work around? For exmaple can I "minimize" running proggram and come back to regular shell interface, do some work, then display the "minimized" process again?
Another workaround: use the shell's job control, eg if you're editing a file, CTRL-z pauses the editor and brings you back to the shell, where you can compile, see manpages, browse the web or whatever -- and of course you can background the browser or anything else.
Screen command offers the ability to detach a long running process (or program, or shell-script) from a session and then attach it back at a later time.
As a crude workaround, run multiple terminal windows on your computer, and alt-tab between them.
Incidentally, at the Linux console, you can switch virtual terminals with ctrl+alt+F for at least F1 through F6, commonly F8 or more (depends on how the distro sets them up). Not your case, I know, but in case future visitors should benefit.
If you are comfortable in Emacs, it allows you to run multiple independent ansi-term buffers.
You can also use "GNU screen" to emulate multiple terminals in one terminal.

Resources