New version of VS Code started restoring Terminal sessions from the last time it was used. How to override that behavior?
This config in settings.json solved it:
"terminal.integrated.persistentSessionReviveProcess": "never"
So your settings are visible in JSON or UI format. For JSON #Nenad Milosavljevic solution should do the job.
I'll explain the UI one.
Open command palette (CTRL + SHIFT + P)
Type user settings and select the option
Select Features > Terminal > scroll down a little where you'll find the option and then uncheck the option "Integrated: Enable Persistent Sessions"
Close the tab and you're done.
Disable this setting:
Terminal > Integrated: Enable Persistent Sessions
It is enabled by default.
Related
I have switched from default terminal on MacOS Mojave to iterm2. I have an issue about the opening of a new tab from the current tab.
Indeed, I would like to be in the same path than the previous current tab.
For this, I did the classical procedure, i.e to go to iterm2 preferences and Profile and choose Reuse previous session's directory for new tab :
Then, the issue is that once tab opened, all the other tabs are affected and change from their old path to the path of the new tab: I don't understand what happens and which option to use to prevent this behavior.
Every tab is the same than the others: if I do a cd ~/foo/, then the other tabs will go into foodirectory.
Result worse: if I edit with vim a file in one tab, if I do a cd ~/foo/ in another tab, then the tab associated to the edited file disappears is clearing this edition and shows the same windows than the tab where I did cd ~/foo/: very strange.
I want to keep all the current path for all others tabs except for the new one which must be the same than the previous one from which I do a CMD+T.
I saw on different forums this issue sometimes occurs.
Update 1
From what I have seen, it seems that I have to find a way to create a new session when I do the shortcut CMD+T to get another tab independent from the current one (from which I do CMD+T).
But unfortunately, I didn't find how to create a new session in iTerm2 (inside the iTerm2 - Preferences - profile, I could execute a script that creates this new session). From the moment, you can see the command (/bin/bash that I launch when I open a new tab:
I tried also to build the binary iTerm2 from the sources but issue remains.
Update 2
I tried to use a little apple script to force a new session to be created from current window:
tell application "iTerm2"
tell current window
create tab with profile "Terminology2"
end tell
end tell
(where Terminology2 is a duplicate of profile Terminology (default profile).
But always the same issue, the 2 tabs are not independent: each command in one of 2 is executed on the another one.
Update 3
I keep on trying a solution: for this I removed the macport package and hidden files and directory ~/.iTerm2/.
So I downloaded the iTerm2 zip archive from iTerm2 official website.
Here's a screen capture of my profile :
Is shortcut key necessary in this profile to open new tabs : the issue seems to come from this option since it may not concern the shortcut for a new tab ? CMD+T is already a shortcut for opening an independent tab, isn't it ?
Update 4
Solution finally found. Coming from classic MacOS terminal, I was used to do a shortcut CMD+Shift+-> or CMD+Shift+<- to change of tab.
But by chance, I tried simply the shortcut CMD+-> or CMD+<- and so was able to switch between 2 tabs independent.
So this was an error of beginner into iTerm2's world since I was used to apply old classical shortcut of default terminal.
If someone else makes the same mistake, they will know that it is just a configuration issue of shortcut.
The OP already answered the question in Update 4, but in case anyone jumps right to the answers, the solution was to update the Key Mappings and create two new entries - CMD+SHIFT+LEFT & CMD+SHIFT+RIGHT - with assigned actions of Previous Tab and Next Tab, respectively.
These entries can be created in Preferences -> ${Your Profile} -> Keys, and then clicking on the + icon near the Presets... button.
Do you see the all-pane input icon in the upper right?
Command-Shift-I to toggle it. (that is a capital i)
Sounds like you have Broadcasting enabled. To check:
Toolbar > Shell > Broadcast Input > Send input to current Session Only
How can we rename tabs in MobaXTerm for the entire session duration? At the moment, I can right-click and rename the tabs, but as soon as I press enter to get command prompt, MobaXTerm resets tab name to its original default. I have tried changing PS1 env variable with no effect. Please help.
I haven't tried this myself but when you create a profile for a new ssh session, there is a tab "Bookmark settings" and within this tab there is a check box named "Lock terminal title." According to the manual:
Lock terminal title
Terminal title will be set to the session name
If you check this option, any attempt by the shell to set tab title will fail.
Uncheck this option if you want to allow the shell to change tab title.
Looks like you need to open every new tab as a New Session (Click on the "Session" button) and then follow what ks2000 suggested (It works for me).
There is limitation in number of sessions created for non-purchased mobaxterm. When you go for edit the session, red coloured message this message will be displayed. Delete unwanted sessions, unlock terminal title, then it will work. Otherwise purchase mobaxterm.
A bit late, but I came across this and wanted to update it.
I found the answer here:
https://stackoverflow.com/questions/29963545/rename-tab-in-mobaxterm-for-session-duration
I wrote a bash function to quickly handle this for me.
set_title() {
PROMPT_COMMAND="echo -ne \"\033]0;$1\a\""
}
set_title "webserver"
If none of the above works, just go to the sessions tab and click on the session you want to rename (just like when you want to rename a file). You should see the following:
After that, enter the preferred name and hit enter. The following window will occur:
Click yes and voilà!
THIS IS NOT FOR THE SESSION DURATION BUT PERMANENT
Wanting to give byobu a looksee as a screen 'update' of sorts. I start it with
byobu
and instead of the status line sitting at the bottom of the screen, everytime it updates it pushes to an additional line underneath the previous one. before long, the screen (putty) is filled with status line echoes.
How do I stop this?
running puttytray v0.62 on win7 to ubuntu 12.04
Putty defaults to a translation encoding of ISO-8859-1 where as Ubuntu sends out UTF-8 encoding.
Click on your server in the Load, save or delete a stored session window. Then click on the Load button.
Next, in the Category panel on the left click on:
Window -> Translation
Change the drop down under "Received data assumed to be in which character set" to UTF-8.
Once you do that then click on Session in the top of the Category panel and then click on save in the stored sessions area.
I am not saying this is the correct fix. I am just telling you all what fixed it for me without having to do any crazy stuff to the server.
Cheers!
This seems to be an issue with the default byobu backend. By default, byobu in Ubuntu 12.04 uses tmux as the backend. You can change this by running byobu-select-backend and selecting screen (option 2).
While not a solution as to why tmux is doing this on PuTTY sessions, it fixes your issue for the screen scrolling.
The UTF-8 setting works wonders. I usually set this together with Terminal => Keyboard => "Function keys and kepad" from "ESC[n~" to "Xterm R6" and save it as default configuration in Putty. That last option enables the use of the F key functions in Byobu. It's pretty much useless without.
I had a similar issue on a debian Testing/SID server, and it was an issue with several detached screen sessions loose on the system. ps aufx |grep -i screen should find orphaned screen sessions.
I tried sudo byobu-select-backend and tmux is the default on Debian Testing as well, I chose 'screen' but when I tried $ byobu the same scrolling behaviour ensued.
So I ran $ byobu-select-backend as my regular user and selected 'screen' again.
This time, running byobu showed me the detached screen sessions, so I could select them and shut them down gently.
#phanku's answer, namely that the terminal's encoding should be set to UTF-8, allowed me to fix the same problem that the OP described when accessing a byobu session (on Ubuntu 12.04) from a Mac OS X iterm with the help of Michael Hendrick's post that describes setting iTerm to UTF-8:
menu: View -> Show Session Info
Session tab: change Encoding from "Western (ASCII)" to "Unicode (UTF-8)".
for me the problem was related to how compatibility was set:
in the terminal, go to:
right-click, choose 'profiles' > 'profile preference'
choose the 'compatibility' tab
change 'ambiguous-width characters' to 'Narrow'
or
just click on the 'reset' button
it worked for me ...
I use iTerm2 in macOS and run into the same problem. The encoding is already set to UTF-8 but no help. Here's the solution that works for me:
Open Preferences > Profiles
Choose the profile with the problem
Go to Text tab on the right
Uncheck the Treat ambiguous-width characters as double width option
Done.
In Emacs on Linux terms and Cygwin, Ctrl + Up/Down causes a long jump (depending on the mode) say one function block down, on iTerm however this does not work I am assuming I need to manually set key codes send?
I guess you are using iTerm 2. Go to Preferences window in iTerm, and check both "Keys" tabs. One is in the main tabs and the second is for each profile. By default, in the "Keys" tab in your profile ^↑ are ^↓ are defined there to send some backward-compatible special keys. Remove them for your profile and you're good to go!
UPDATE: This change doesn't seem to affect your current tab or window. You may need to start a new iTerm window.
Use M-{ and M-} instead.
In bash shell with emacs key-binding, you can use key combination like M-f, M-b to move one word forward or backward on the shell prompt respectively. Usually, the meta key is mapped to Alt key on Windows and Linux. However, in iTerm, I could not find a way to map this meta key to either Option or Command key on my MacBook Pro.
It seems that in OS X, the meta key is by default mapped to ESC key. So you can use ESC-f, ESC-b on iTerm. However, ESC key is apparently not practical to use. In addition, iTerm does have option that allow you to modifier mapping for the meta key (Bookmarks > Profiles > Keyboard Profiles > Global > Option Key as...), this setting does not seem to work at all.
Therefore, if anyone know what is the solution to this problem, please let me know.
I have upgraded to the latest release, 0.9.6.1012, and this behavior is still persist.
Edit: Some clarification to my question. The key-binding I'm talking about is for bash shell, not in emacs. It just happens that, by default, bash shell also use the same key-binding as emacs.
Open "Preferences" (⌘,) -> Profiles -> Keys -> General tab.
Set Left Option key: to act as Esc+.
Works for me in Emacs, though I'm not sure if it will have any other undesirable effects.
Go to Bookmarks > Manage Profiles. Then select Keyboard Profiles > Global and choose Option Key as Meta. This works for me in version 0.9.6.1201.
In Menu bar Iterm2 => Preferences => Profiles choose the keys tab and select
left Option key act as +Esc
worked for me as well in irssi.
For iTerm2 users this answer just partially solves the problem.
Cmd+., Profiles, Keys and choose Left option Key acts as: +Esc.
In addition to that, you have to go to Preferences (Cmd+,) ➔ Profiles ➔ Keys and in the Key Mappings find these Key Combination's: and . Double click on each mapping and change their Action and Esc+ to the following:
Go to your iTerm preferences select "profiles" then "key" and change your presets in "Natural Text Editing"
It should work immediately after.
It works with iTerm version 3.3.12
Going all zombie resurrection here, but for sake of posterity --
This post got it working as you desire for me, for M-b and M-f, while keeping 'Option Key as Meta' set so you don't sacrifice a modifier (I have vim mappings using meta, personally).
In summary, in your Global Keyboard Profile, add two new mappings with settings:
Key as hex code, value of 62 for b, 66 for f (man ascii)
Modifier as Option
Action as send escape sequence, value b or f
The only thing I still miss from Terminal.app is Opt-Backspace to delete by word. There are other workarounds for that, but I'm just trying to train myself to use Ctrl-w.
It's easier in iTerm2. Go to preferences->bookmark->keyboard and select Option sends +ESC. In iTerm2 you can configure the left and right option keys separately, so remember to change both if that's what you want. Link for iTerm2: http://sites.google.com/site/iterm2home/
Go to Bookmarks > Manage Profiles. Then select Keyboard Profiles > Global and choose Option Key as +ESC.
Works in iTerm Build 0.9.5.0611 & Build 0.9.6.20090415
I found some solution on stackoverflow also, just go to keyboard profile and in "Global" change "Option key as" +ESC
that works for me perfectly =) btw some iterm patch exists also look here: http://www.emacswiki.org/emacs/EmacsForMacOS
I don't know about iTerm, but you can do this in Terminal. Instructions can be found here:
Emacs on Mac OS X Leopard key bindings
Here is what worked for me: Bookmarks > Manage Profiles > Keyboard Profiles > Global/xterm > Option Key as +Esc. With this, I can use Option+Enter in Midnight Commander and the currently selected file/directory name shows up in the command string, as it should. Option Key as Meta did not work for me. My build of iTerm is 0.10.
I was struggling with Meta + Left or Meta + Right. The context was for keystroke in Emacs utilized in an iTerm2 session.
I tried Esc+ and Meta for the left Option key with no luck. I tried with and with out the hex mappings. No luck.
But then I tried "Report modifiers using CSI u". (Documentation here). That allowed me to use the meta + Left and meta + right keys in Emacs, which is the behavior I have on my Linux machine.
The common answers of setting the options key to ESC+, didn't work for me out of the box. At some point I realized that it doesn't work only when opening the floating iterm terminal (using F12). The trick to fix it was setting the options key to ESC+ also for the "Hotkey Window" profile.
This tiny note in the "Apps can change this" mouseover made all the difference for me:
After trying all the options above for what seemed like hours, it was as simple as setting the "Right Option key" to act as Esc+ (though I was pressing Left).
Try "export LANG=C". I'm not emacs expert, but I found this enables emacs on OS X to recognize the Option key as the Meta key in iTerm,