I have a linux machine with KDES.
I have many Konsole sessions opened. Each one has few opened tabs.
Occasionally, I'm changing some basic configuration such as adding alias or altering a bit the prompt. In that case, I would like to update all the opened shells about it. Such as sending "source ~/.aliases" to all of the shells.
I have found tmux, but it create its own arrangement of windows. I however, want to use the already existing arrangement of konsole windows.
I also found qdbus, but those commands seem to works only on the current konsole and not other konsole processes.
Any help will be appreciated.
Related
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.
I want to have "two vim open" because I have multiple monitors.
Also I would like them to share buffers, clipboards, etc.
So I'd like to share the same instance across two different windows.
I have found:
vim --remote file.txt
but this opens the file in the first vim; it doesn't open a new window within the same vim instance.
How can multiple vim windows share the same instance?
Although I don't believe there is a native way this can be achieved in VIM, there are however other ways to get similar behavior :
Expand your terminal to be available on both monitors, that way you can use vim splits and have one split in each monitor and hence work on the same file in both monitors. Although this is probably less cool.
Use something like tmux / screen. This way you can just launch multiple terminal windows and have them in separate monitors and connect to the same tmux session from both. You can then edit / view your vim session in either monitor and it will be perfectly mirrored in the other.
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.
I have a gVIM script that parses current buffer and offers user to select one of multiple choices. It is implemented as console input, but since i'm using graphical version of gVIM, maybe it's possible to use graphical version of multiple choice dialog? I have tried to use python + Tkinter but it's very unstable and is not working on some NIX boxes :(. Any ideas?
GVim has, in its functions and settings, nothing that would enable showing GUI elements (with a few noble exceptions, like closing dialog and such.).
That being said, GVim is open source, and nothing stops you from downloading the source and messing with it.
After some research i have found a solution. VIM supports so-called "clientserver" mode and external application can send a command to it. So this task (and many others) can be solved with following technique (tested on Windows, OSX and Ubuntu):
VIMscript that handles a command launches standalone GUI script in
separate process and returns.
Standalone GUI script (python/ruby/.exe/whatever) displays GUI and
waits for user interaction.
After user interaction, standalone GUI script closes it's window,
communicates back to VIM via "clientserver" interface (call another
script, open file, move cursor etc) and exits.
how does one "undo close-tab" in terminal? And quite related to it, is it possible to remember a session of tabs in terminal?
I mean (alike Firefox) if I close all tabs in a particular terminal window, how do I open with same the next day?
Its really useful to remember the terminal session for people like me who use multiple tabs a lot, and do not wish to start the next day with remembering what (and whereall) one was working, when one left the desk the day before.
In mouse right-click menu of gnome-terminal, one could easily (and I have) mistakenly click close tab instead of 'Copy'and lost track of what and where one was before selecting the text selected. In this case, undo closed-tab will serve a great purpose (available in Firefox already)
Thanks!
--V
For the gnome terminal, you can use
gnome-terminal --profile=〈your profile〉 --save-config=〈file〉
I launch it as a background task to save the terminal state periodically.
"termit" can save sessions and is scriptable in lua: https://github.com/nonstop/termit/wiki
I don't know about an "undo close tab" feature, though.
For reference, my termit lua config can be found here: https://github.com/thet/dotfiles-termit
On Linux, gnome-terminal is able to load multiple tabs with different working directories. Like termit (which is much more flexible due to it's lua scripting interface), it doesn't have a "undo close tab" feature.
Open Gnome terminal with multiple tabs, each one in another working directory: gnome-terminal --tab --working-directory=/home --tab --working-directory=~ --tab --working-directory=/opt.
Open Gnome terminal with multiple tabs and one base working directory: gnome-terminal --working-directory=/home --tab --tab --tab.
For more options do: gnome-terminal --help-all.
The gnome terminal doesn't have such features, but if you're open to change you could try konsole, it has some nice 'save session' options you could find helpful, though nothing about re-opening accidentally closed tabs, as far as I know.
The other thing, if you're particular about your desktop, is that KDE's konsole might not fit all too well within Gnome.