문제

In iTerm2 we can set the xterm-256color option by going to Preferences -> Profiles -> Terminal -> Terminal Emulation -> Report Terminal Type and chosing xterm-256color

I want to add to my dotfile's installation script so I don't have to change it manually. Is there a way of setting this option via command line? Maybe via iTerm itself or maybe via apple's defaults write.....

Thank you!

도움이 되었습니까?

해결책

default works only if the setting is a top level key, for example

[admin@mb-125:~] : defaults read com.googlecode.iterm2 | grep -i promptonquit
    PromptOnQuit = 1;
[admin@mb-125:~] : defaults write com.googlecode.iterm2 PromptOnQuit -bool FALSE
[admin@mb-125:~] : defaults read com.googlecode.iterm2 | grep -i promptonquit
    PromptOnQuit = 0;

xterm-256color is part of a dictionary, and we need to use plistbuddy to change it, here is the command to see the current settings

[admin@mb-125:~] : /usr/libexec/PlistBuddy -c "Print :\"New Bookmarks\":0:\"Terminal Type\"" Library/Preferences/com.googlecode.iterm2.plist 
xterm-256color

And this is how you change it from command line

[admin@mb-125:~] : /usr/libexec/PlistBuddy -c "Set :\"New Bookmarks\":0:\"Terminal Type\" xterm" Library/Preferences/com.googlecode.iterm2.plist 
[admin@mb-125:~] : /usr/libexec/PlistBuddy -c "Print :\"New Bookmarks\":0:\"Terminal Type\"" Library/Preferences/com.googlecode.iterm2.plist 
xterm    

다른 팁

In the ~/Library/Preferences folder there's a file called com.googlecode.iterm2.plist. This file contains all your iTerm preferences. What I like to do is keep a copy of that preferences file inside my dotfile repo. When I'm installing on a new system I copy it into ~/Library/Preferences via my installation script .

Hope that helps!

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top