2013-05-16 142 views
1

在iTerm2我们可以去Preferences -> Profiles -> Terminal -> Terminal Emulation -> Report Terminal Type和艇员选拔xterm-256color如何通过脚本/命令行

我想添加到我的dotfile的安装脚本,所以我不设置的xterm-256color选项上iTerm2设置的xterm,256colors不得不手动改变它。 有没有通过命令行设置这个选项的方法?也许通过的iTerm本身也许通过苹果的defaults write.....

谢谢!

回答

2

默认工作只有设置为最高级别键,例如

[[email protected]:~] : defaults read com.googlecode.iterm2 | grep -i promptonquit 
    PromptOnQuit = 1; 
[[email protected]:~] : defaults write com.googlecode.iterm2 PromptOnQuit -bool FALSE 
[[email protected]:~] : defaults read com.googlecode.iterm2 | grep -i promptonquit 
    PromptOnQuit = 0; 

的xterm-256color是一本字典的一部分,我们需要使用plistbuddy去改变它,这里是查看命令当前设置

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

这就是你如何从命令行更改

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

~/Library/Preferences文件夹中有一个名为com.googlecode.iterm2.plist文件。该文件包含您的所有iTerm首选项。我喜欢做的是保留我的dotfile回购中的首选项文件的副本。当我在新系统上安装时,我通过我的安装脚本将它复制到~/Library/Preferences

希望有帮助!