2013-05-16 139 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

希望有幫助!