跳到主要内容

常用设置

提示

记录一些常用的 iTerm2 设置,方便查阅

设置hotkey

设置hotkey,可以快速唤出 iterm2 终端

hotKey

支持光标单词跳转

默认的情况下,终端的单词跳转快捷键 Option + →Option + ←,在 iTerm2 上不起作用,需要在Preferences -> Profiles -> Keys -> Key Bindings 中进行设置:

wordJump

设置 Status Bar

iTerm2 提供了很多 Status Bar,可在在终端页面显示更多关于本机的信息,如:CPU、内存、电池电量等

StatusBar1

点击 Configure Status bar 进入配置页面,这里将想要的 Status bar 拖入下面的方框即可

StatusBar2

设置光标和字体

设置终端的光标样式,有三种可选样式:_|[],自定义字体

setCursorAndText

设置窗口样式

设置窗口背景、透明度、默认窗口大小等

windowStyle

支持rz和sz命令

rzsz 命令是 ZMODEM 协议的命令,用于在终端中进行文件传输

Profiles配置迁移

可通过配置文件导出和导入功能,将Profiles标签页的配置进行迁移

configMigration

我的配置如下

config.json
{
"Working Directory" : "\/Users\/ssgeek",
"Prompt Before Closing 2" : false,
"Selected Text Color" : {
"Green Component" : 0.78431372549019607,
"Blue Component" : 0.77647058823529413,
"Red Component" : 0.77254901960784317
},
"Rows" : 30,
"Ansi 11 Color" : {
"Green Component" : 1,
"Blue Component" : 0.6569250226020813,
"Red Component" : 0.96221715211868286
},
"Use Italic Font" : true,
"HotKey Characters" : "t",
"Foreground Color" : {
"Green Component" : 0.78431372549019607,
"Blue Component" : 0.77647058823529413,
"Red Component" : 0.77254901960784317
},
"HotKey Window Floats" : true,
"Right Option Key Sends" : 0,
"Show Status Bar" : true,
"Character Encoding" : 4,
"Selection Color" : {
"Green Component" : 0.26666666666666666,
"Blue Component" : 0.26666666666666666,
"Red Component" : 0.26666666666666666
},
"Triggers" : [
{
"action" : "MuteCoprocessTrigger",
"parameter" : " \/usr\/local\/bin\/iterm2-send-zmodem.sh",
"regex" : "rz waiting to receive.\\*\\*B0100000023be50",
"partial" : true
},
{
"action" : "MuteCoprocessTrigger",
"parameter" : "\/usr\/local\/bin\/iterm2-recv-zmodem.sh",
"regex" : "\\*\\*B00000000000000",
"partial" : true
}
],
"Blend" : 0.24637363079896912,
"Mouse Reporting" : true,
"Cursor Boost" : 0,
"Ansi 4 Color" : {
"Green Component" : 0.74560397863388062,
"Blue Component" : 0.99405109882354736,
"Red Component" : 0.5230981707572937
},
"Non-ASCII Anti Aliased" : true,
"Sync Title" : false,
"Disable Window Resizing" : true,
"Description" : "Default",
"Close Sessions On End" : true,
"Jobs to Ignore" : [
"rlogin",
"ssh",
"slogin",
"telnet"
],
"Scrollback Lines" : 1000,
"HotKey Window Reopens On Activation" : false,
"Draw Powerline Glyphs" : true,
"Status Bar Layout" : {
"components" : [
{
"class" : "iTermStatusBarCPUUtilizationComponent",
"configuration" : {
"knobs" : {
"base: priority" : 5,
"shared text color" : {
"Red Component" : 0.86000317335128784,
"Color Space" : "P3",
"Blue Component" : 0.63590961694717407,
"Alpha Component" : 1,
"Green Component" : 0.6414334774017334
},
"base: compression resistance" : 1
},
"layout advanced configuration dictionary value" : {
"remove empty components" : false,
"font" : ".AppleSystemUIFont 12",
"algorithm" : 0,
"auto-rainbow style" : 3
}
}
},
{
"class" : "iTermStatusBarMemoryUtilizationComponent",
"configuration" : {
"knobs" : {
"base: priority" : 5,
"shared text color" : {
"Red Component" : 0.68831604719161987,
"Color Space" : "P3",
"Blue Component" : 0.82982355356216431,
"Alpha Component" : 1,
"Green Component" : 0.89269793033599854
},
"base: compression resistance" : 1
},
"layout advanced configuration dictionary value" : {
"remove empty components" : false,
"font" : ".AppleSystemUIFont 12",
"algorithm" : 0,
"auto-rainbow style" : 3
}
}
},
{
"class" : "iTermStatusBarNetworkUtilizationComponent",
"configuration" : {
"knobs" : {
"base: priority" : 5,
"shared text color" : {
"Red Component" : 0.86000508069992065,
"Color Space" : "P3",
"Blue Component" : 0.76881867647171021,
"Alpha Component" : 1,
"Green Component" : 0.64143049716949463
},
"base: compression resistance" : 1
},
"layout advanced configuration dictionary value" : {
"remove empty components" : false,
"font" : ".AppleSystemUIFont 12",
"algorithm" : 0,
"auto-rainbow style" : 3
}
}
}
],
"advanced configuration" : {
"remove empty components" : false,
"font" : ".AppleSystemUIFont 12",
"algorithm" : 0,
"auto-rainbow style" : 3
}
},
"Flashing Bell" : false,
"Cursor Guide Color" : {
"Red Component" : 0.70213186740875244,
"Color Space" : "sRGB",
"Blue Component" : 1,
"Alpha Component" : 0.25,
"Green Component" : 0.9268307089805603
},
"BM Growl" : true,
"Ansi 3 Color" : {
"Green Component" : 0.84313725490196079,
"Blue Component" : 0.69411764705882351,
"Red Component" : 1
},
"Use Non-ASCII Font" : true,
"Link Color" : {
"Red Component" : 0,
"Color Space" : "sRGB",
"Blue Component" : 0.73423302173614502,
"Alpha Component" : 1,
"Green Component" : 0.35916060209274292
},
"Shortcut" : "",
"Background Image Location" : "\/Users\/ssgeek\/Pictures\/pap.er\/10791641441933_.pic.jpg",
"Bold Color" : {
"Green Component" : 0.78431372549019607,
"Blue Component" : 0.77647058823529413,
"Red Component" : 0.77254901960784317
},
"Use Cursor Guide" : false,
"Unlimited Scrollback" : false,
"Allow Title Setting" : true,
"Custom Command" : "No",
"HotKey Key Code" : 17,
"Title Components" : 2,
"Keyboard Map" : {
"0x7f-0x80000" : {
"Text" : "0x1b 0x7f",
"Action" : 11
},
"0xf702-0x280000" : {
"Text" : "b",
"Action" : 10
},
"0xf702-0x300000" : {
"Text" : "0x1",
"Action" : 11
},
"0xf728-0x80000" : {
"Text" : "d",
"Action" : 10
},
"0x7f-0x100000" : {
"Text" : "0x15",
"Action" : 11
},
"0xf703-0x300000" : {
"Text" : "0x5",
"Action" : 11
},
"0xf728-0x0" : {
"Text" : "0x4",
"Action" : 11
},
"0xf703-0x280000" : {
"Text" : "f",
"Action" : 10
}
},
"Ansi 14 Color" : {
"Green Component" : 0.74560397863388062,
"Blue Component" : 0.99405109882354736,
"Red Component" : 0.5230981707572937
},
"Ansi 2 Color" : {
"Green Component" : 0.76470588235294112,
"Blue Component" : 0.54117647058823526,
"Red Component" : 0.52941176470588236
},
"Background Image Is Tiled" : false,
"Send Code When Idle" : false,
"ASCII Anti Aliased" : true,
"Tags" : [

],
"Ansi 9 Color" : {
"Green Component" : 0.37254901959999998,
"Blue Component" : 0.94509803920000002,
"Red Component" : 0.99215686270000003
},
"Use Bold Font" : true,
"Silence Bell" : false,
"Ansi 12 Color" : {
"Green Component" : 0.79607843137254897,
"Blue Component" : 0.99607843137254903,
"Red Component" : 0.58823529411764708
},
"Window Type" : 0,
"Allow Title Reporting" : false,
"Use Bright Bold" : true,
"Has Hotkey" : true,
"HotKey Modifier Activation" : 0,
"Cursor Text Color" : {
"Green Component" : 0.08235294371843338,
"Blue Component" : 0.08235294371843338,
"Red Component" : 0.08235294371843338
},
"HotKey Window Dock Click Action" : 0,
"Default Bookmark" : "No",
"Cursor Color" : {
"Green Component" : 0.81568628549575806,
"Blue Component" : 0.81568628549575806,
"Red Component" : 0.81568628549575806
},
"Disable Smcup Rmcup" : false,
"Name" : "Default",
"Blinking Cursor" : false,
"Ansi 1 Color" : {
"Green Component" : 0.37254901959999998,
"Blue Component" : 0.94509803920000002,
"Red Component" : 0.99215686270000003
},
"Guid" : "D692522D-E12E-4DF6-A8CC-EFD108459817",
"Ansi 8 Color" : {
"Green Component" : 0,
"Blue Component" : 0,
"Red Component" : 0
},
"Ansi 10 Color" : {
"Green Component" : 0.97885209321975708,
"Blue Component" : 0.21213282644748688,
"Red Component" : 0.58183550834655762
},
"Idle Code" : 0,
"Badge Color" : {
"Red Component" : 1,
"Color Space" : "sRGB",
"Blue Component" : 0,
"Alpha Component" : 0.5,
"Green Component" : 0.1491314172744751
},
"Smart Cursor Color" : false,
"Ambiguous Double Width" : false,
"Background Image Mode" : 0,
"Ansi 0 Color" : {
"Green Component" : 0,
"Blue Component" : 0,
"Red Component" : 0
},
"Cursor Type" : 1,
"Blur" : false,
"Normal Font" : "Consolas 14",
"Vertical Spacing" : 1,
"Use Underline Color" : false,
"Disable Printing" : false,
"Ansi 7 Color" : {
"Green Component" : 0.87803357839584351,
"Blue Component" : 0.87804847955703735,
"Red Component" : 0.87805986404418945
},
"Space" : 0,
"HotKey Window AutoHides" : true,
"Command" : "",
"Terminal Type" : "xterm-new",
"Horizontal Spacing" : 1,
"Option Key Sends" : 0,
"Only The Default BG Color Uses Transparency" : false,
"Minimum Contrast" : 0.20989435369318182,
"HotKey Modifier Flags" : 1179648,
"Ansi 15 Color" : {
"Green Component" : 0.87803351879119873,
"Blue Component" : 0.87804841995239258,
"Red Component" : 0.87805980443954468
},
"HotKey Window Animates" : true,
"Unicode Version" : 8,
"Ansi 6 Color" : {
"Green Component" : 0.74560397863388062,
"Blue Component" : 0.99405109882354736,
"Red Component" : 0.5230981707572937
},
"Transparency" : 0,
"HotKey Activated By Modifier" : false,
"Background Color" : {
"Green Component" : 0.092142701148986816,
"Blue Component" : 0.097707755863666534,
"Red Component" : 0.086937598884105682
},
"Screen" : -1,
"HotKey Characters Ignoring Modifiers" : "T",
"Non Ascii Font" : "Consolas 13",
"Ansi 13 Color" : {
"Green Component" : 0.71280097961425781,
"Blue Component" : 0.98932766914367676,
"Red Component" : 0.72722584009170532
},
"Use Tab Color" : false,
"Columns" : 120,
"HotKey Alternate Shortcuts" : [

],
"Visual Bell" : true,
"Custom Directory" : "No",
"Ansi 5 Color" : {
"Green Component" : 0.71280097961425781,
"Blue Component" : 0.98932766914367676,
"Red Component" : 0.72722584009170532
}
}

关闭选中方框和小箭头

新版本的 iTerm2 在选中内容时会出现选中方框,还会在当前行左侧显示一个小箭头,看起来有点碍眼

markSelected

可以通过以下设置将其关闭

关闭小箭头

markSelected2

关闭选中方框

markSelected3

标签页设置

可以通过快捷键 Command + I 对当前打开的标签页进行设置,而不用对全局进行设置,这在一些临时配置时非常有用,例如设置标签页的名称

tabSetting