From: Ian Kelling Date: Sun, 14 Aug 2016 05:35:39 +0000 (-0700) Subject: working snapshot X-Git-Url: https://iankelling.org/git/?p=distro-setup;a=commitdiff_plain;h=6c41878284a2347515e54a61b5aa650f130b0a81 working snapshot --- 6c41878284a2347515e54a61b5aa650f130b0a81 diff --git a/.Xkeymap b/.Xkeymap new file mode 100644 index 0000000..9bc2bad --- /dev/null +++ b/.Xkeymap @@ -0,0 +1,1668 @@ +xkb_keymap { +xkb_keycodes "evdev+aliases(qwerty)" { + minimum = 8; + maximum = 255; + = 9; + = 10; + = 11; + = 12; + = 13; + = 14; + = 15; + = 16; + = 17; + = 18; + = 19; + = 20; + = 21; + = 22; + = 23; + = 24; + = 25; + = 26; + = 27; + = 28; + = 29; + = 30; + = 31; + = 32; + = 33; + = 34; + = 35; + = 36; + = 37; + = 38; + = 39; + = 40; + = 41; + = 42; + = 43; + = 44; + = 45; + = 46; + = 47; + = 48; + = 49; + = 50; + = 51; + = 52; + = 53; + = 54; + = 55; + = 56; + = 57; + = 58; + = 59; + = 60; + = 61; + = 62; + = 63; + = 64; + = 65; + = 66; + = 67; + = 68; + = 69; + = 70; + = 71; + = 72; + = 73; + = 74; + = 75; + = 76; + = 77; + = 78; + = 79; + = 80; + = 81; + = 82; + = 83; + = 84; + = 85; + = 86; + = 87; + = 88; + = 89; + = 90; + = 91; + = 92; + = 94; + = 95; + = 96; + = 97; + = 98; + = 99; + = 100; + = 101; + = 102; + = 103; + = 104; + = 105; + = 106; + = 107; + = 108; + = 109; + = 110; + = 111; + = 112; + = 113; + = 114; + = 115; + = 116; + = 117; + = 118; + = 119; + = 120; + = 121; + = 122; + = 123; + = 124; + = 125; + = 126; + = 127; + = 128; + = 129; + = 130; + = 131; + = 132; + = 133; + = 134; + = 135; + = 136; + = 137; + = 138; + = 139; + = 140; + = 141; + = 142; + = 143; + = 144; + = 145; + = 146; + = 147; + = 148; + = 149; + = 150; + = 151; + = 152; + = 153; + = 154; + = 155; + = 156; + = 157; + = 158; + = 159; + = 160; + = 161; + = 162; + = 163; + = 164; + = 165; + = 166; + = 167; + = 168; + = 169; + = 170; + = 171; + = 172; + = 173; + = 174; + = 175; + = 176; + = 177; + = 178; + = 179; + = 180; + = 181; + = 182; + = 183; + = 184; + = 185; + = 186; + = 187; + = 188; + = 189; + = 190; + = 191; + = 192; + = 193; + = 194; + = 195; + = 196; + = 197; + = 198; + = 199; + = 200; + = 201; + = 202; + = 203; + = 204; + = 205; + = 206; + = 207; + = 208; + = 209; + = 210; + = 211; + = 212; + = 213; + = 214; + = 215; + = 216; + = 217; + = 218; + = 219; + = 220; + = 221; + = 222; + = 223; + = 224; + = 225; + = 226; + = 227; + = 228; + = 229; + = 230; + = 231; + = 232; + = 233; + = 234; + = 235; + = 236; + = 237; + = 238; + = 239; + = 240; + = 241; + = 242; + = 243; + = 244; + = 245; + = 246; + = 247; + = 248; + = 249; + = 250; + = 251; + = 252; + = 253; + indicator 1 = "Caps Lock"; + indicator 2 = "Num Lock"; + indicator 3 = "Scroll Lock"; + indicator 4 = "Compose"; + indicator 5 = "Kana"; + indicator 6 = "Sleep"; + indicator 7 = "Suspend"; + indicator 8 = "Mute"; + indicator 9 = "Misc"; + indicator 10 = "Mail"; + indicator 11 = "Charging"; + virtual indicator 12 = "Shift Lock"; + virtual indicator 13 = "Group 2"; + virtual indicator 14 = "Mouse Keys"; + alias = ; + alias = ; + alias = ; + alias = ; + alias = ; + alias = ; + alias = ; + alias = ; + alias = ; + alias = ; + alias = ; + alias = ; + alias = ; + alias = ; + alias = ; + alias = ; + alias = ; + alias = ; + alias = ; + alias = ; + alias = ; + alias = ; + alias = ; + alias = ; + alias = ; + alias = ; + alias = ; + alias = ; + alias = ; + alias = ; + alias = ; + alias = ; + alias = ; +}; + +xkb_types "complete" { + + virtual_modifiers NumLock,Alt,LevelThree,LAlt,RAlt,RControl,LControl,ScrollLock,LevelFive,AltGr,Meta,Super,Hyper; + + type "ONE_LEVEL" { + modifiers= none; + level_name[Level1]= "Any"; + }; + type "TWO_LEVEL" { + modifiers= Shift; + map[Shift]= Level2; + level_name[Level1]= "Base"; + level_name[Level2]= "Shift"; + }; + type "ALPHABETIC" { + modifiers= Shift+Lock; + map[Shift]= Level2; + map[Lock]= Level2; + level_name[Level1]= "Base"; + level_name[Level2]= "Caps"; + }; + type "KEYPAD" { + modifiers= Shift+NumLock; + map[Shift]= Level2; + map[NumLock]= Level2; + level_name[Level1]= "Base"; + level_name[Level2]= "Number"; + }; + type "SHIFT+ALT" { + modifiers= Shift+Alt; + map[Shift+Alt]= Level2; + level_name[Level1]= "Base"; + level_name[Level2]= "Shift+Alt"; + }; + type "PC_CONTROL_LEVEL2" { + modifiers= Control; + map[Control]= Level2; + level_name[Level1]= "Base"; + level_name[Level2]= "Control"; + }; + type "PC_LCONTROL_LEVEL2" { + modifiers= LControl; + map[LControl]= Level2; + level_name[Level1]= "Base"; + level_name[Level2]= "LControl"; + }; + type "PC_RCONTROL_LEVEL2" { + modifiers= RControl; + map[RControl]= Level2; + level_name[Level1]= "Base"; + level_name[Level2]= "RControl"; + }; + type "PC_ALT_LEVEL2" { + modifiers= Alt; + map[Alt]= Level2; + level_name[Level1]= "Base"; + level_name[Level2]= "Alt"; + }; + type "PC_LALT_LEVEL2" { + modifiers= LAlt; + map[LAlt]= Level2; + level_name[Level1]= "Base"; + level_name[Level2]= "LAlt"; + }; + type "PC_RALT_LEVEL2" { + modifiers= RAlt; + map[RAlt]= Level2; + level_name[Level1]= "Base"; + level_name[Level2]= "RAlt"; + }; + type "CTRL+ALT" { + modifiers= Shift+Control+Alt+LevelThree; + map[Shift]= Level2; + preserve[Shift]= Shift; + map[LevelThree]= Level3; + map[Shift+LevelThree]= Level4; + preserve[Shift+LevelThree]= Shift; + map[Control+Alt]= Level5; + level_name[Level1]= "Base"; + level_name[Level2]= "Shift"; + level_name[Level3]= "Alt Base"; + level_name[Level4]= "Shift Alt"; + level_name[Level5]= "Ctrl+Alt"; + }; + type "LOCAL_EIGHT_LEVEL" { + modifiers= Shift+Lock+Control+LevelThree; + map[Shift+Lock]= Level1; + map[Shift]= Level2; + map[Lock]= Level2; + map[LevelThree]= Level3; + map[Shift+Lock+LevelThree]= Level3; + map[Shift+LevelThree]= Level4; + map[Lock+LevelThree]= Level4; + map[Control]= Level5; + map[Shift+Lock+Control]= Level5; + map[Shift+Control]= Level6; + map[Lock+Control]= Level6; + map[Control+LevelThree]= Level7; + map[Shift+Lock+Control+LevelThree]= Level7; + map[Shift+Control+LevelThree]= Level8; + map[Lock+Control+LevelThree]= Level8; + level_name[Level1]= "Base"; + level_name[Level2]= "Shift"; + level_name[Level3]= "Level3"; + level_name[Level4]= "Shift Level3"; + level_name[Level5]= "Ctrl"; + level_name[Level6]= "Shift Ctrl"; + level_name[Level7]= "Level3 Ctrl"; + level_name[Level8]= "Shift Level3 Ctrl"; + }; + type "THREE_LEVEL" { + modifiers= Shift+LevelThree; + map[Shift]= Level2; + map[LevelThree]= Level3; + map[Shift+LevelThree]= Level3; + level_name[Level1]= "Base"; + level_name[Level2]= "Shift"; + level_name[Level3]= "Level3"; + }; + type "EIGHT_LEVEL" { + modifiers= Shift+LevelThree+LevelFive; + map[Shift]= Level2; + map[LevelThree]= Level3; + map[Shift+LevelThree]= Level4; + map[LevelFive]= Level5; + map[Shift+LevelFive]= Level6; + map[LevelThree+LevelFive]= Level7; + map[Shift+LevelThree+LevelFive]= Level8; + level_name[Level1]= "Base"; + level_name[Level2]= "Shift"; + level_name[Level3]= "Alt Base"; + level_name[Level4]= "Shift Alt"; + level_name[Level5]= "X"; + level_name[Level6]= "X Shift"; + level_name[Level7]= "X Alt Base"; + level_name[Level8]= "X Shift Alt"; + }; + type "EIGHT_LEVEL_ALPHABETIC" { + modifiers= Shift+Lock+LevelThree+LevelFive; + map[Shift]= Level2; + map[Lock]= Level2; + map[LevelThree]= Level3; + map[Shift+LevelThree]= Level4; + map[Lock+LevelThree]= Level4; + map[Shift+Lock+LevelThree]= Level3; + map[LevelFive]= Level5; + map[Shift+LevelFive]= Level6; + map[Lock+LevelFive]= Level6; + map[LevelThree+LevelFive]= Level7; + map[Shift+LevelThree+LevelFive]= Level8; + map[Lock+LevelThree+LevelFive]= Level8; + map[Shift+Lock+LevelThree+LevelFive]= Level7; + level_name[Level1]= "Base"; + level_name[Level2]= "Shift"; + level_name[Level3]= "Alt Base"; + level_name[Level4]= "Shift Alt"; + level_name[Level5]= "X"; + level_name[Level6]= "X Shift"; + level_name[Level7]= "X Alt Base"; + level_name[Level8]= "X Shift Alt"; + }; + type "EIGHT_LEVEL_SEMIALPHABETIC" { + modifiers= Shift+Lock+LevelThree+LevelFive; + map[Shift]= Level2; + map[Lock]= Level2; + map[LevelThree]= Level3; + map[Shift+LevelThree]= Level4; + map[Lock+LevelThree]= Level3; + preserve[Lock+LevelThree]= Lock; + map[Shift+Lock+LevelThree]= Level4; + preserve[Shift+Lock+LevelThree]= Lock; + map[LevelFive]= Level5; + map[Shift+LevelFive]= Level6; + map[Lock+LevelFive]= Level6; + preserve[Lock+LevelFive]= Lock; + map[LevelThree+LevelFive]= Level7; + map[Shift+LevelThree+LevelFive]= Level8; + map[Lock+LevelThree+LevelFive]= Level7; + preserve[Lock+LevelThree+LevelFive]= Lock; + map[Shift+Lock+LevelThree+LevelFive]= Level8; + preserve[Shift+Lock+LevelThree+LevelFive]= Lock; + map[Shift+Lock+LevelFive]= Level1; + preserve[Shift+Lock+LevelFive]= Lock; + level_name[Level1]= "Base"; + level_name[Level2]= "Shift"; + level_name[Level3]= "Alt Base"; + level_name[Level4]= "Shift Alt"; + level_name[Level5]= "X"; + level_name[Level6]= "X Shift"; + level_name[Level7]= "X Alt Base"; + level_name[Level8]= "X Shift Alt"; + }; + type "FOUR_LEVEL" { + modifiers= Shift+LevelThree; + map[Shift]= Level2; + map[LevelThree]= Level3; + map[Shift+LevelThree]= Level4; + level_name[Level1]= "Base"; + level_name[Level2]= "Shift"; + level_name[Level3]= "Alt Base"; + level_name[Level4]= "Shift Alt"; + }; + type "FOUR_LEVEL_ALPHABETIC" { + modifiers= Shift+Lock+LevelThree; + map[Shift]= Level2; + map[Lock]= Level2; + map[LevelThree]= Level3; + map[Shift+LevelThree]= Level4; + map[Lock+LevelThree]= Level4; + map[Shift+Lock+LevelThree]= Level3; + level_name[Level1]= "Base"; + level_name[Level2]= "Shift"; + level_name[Level3]= "Alt Base"; + level_name[Level4]= "Shift Alt"; + }; + type "FOUR_LEVEL_SEMIALPHABETIC" { + modifiers= Shift+Lock+LevelThree; + map[Shift]= Level2; + map[Lock]= Level2; + map[LevelThree]= Level3; + map[Shift+LevelThree]= Level4; + map[Lock+LevelThree]= Level3; + preserve[Lock+LevelThree]= Lock; + map[Shift+Lock+LevelThree]= Level4; + preserve[Shift+Lock+LevelThree]= Lock; + level_name[Level1]= "Base"; + level_name[Level2]= "Shift"; + level_name[Level3]= "Alt Base"; + level_name[Level4]= "Shift Alt"; + }; + type "FOUR_LEVEL_MIXED_KEYPAD" { + modifiers= Shift+NumLock+LevelThree; + map[Shift+NumLock]= Level1; + map[NumLock]= Level2; + map[Shift]= Level2; + map[LevelThree]= Level3; + map[NumLock+LevelThree]= Level3; + map[Shift+LevelThree]= Level4; + map[Shift+NumLock+LevelThree]= Level4; + level_name[Level1]= "Base"; + level_name[Level2]= "Number"; + level_name[Level3]= "Alt Base"; + level_name[Level4]= "Shift Alt"; + }; + type "FOUR_LEVEL_X" { + modifiers= Shift+Control+Alt+LevelThree; + map[LevelThree]= Level2; + map[Shift+LevelThree]= Level3; + map[Control+Alt]= Level4; + level_name[Level1]= "Base"; + level_name[Level2]= "Alt Base"; + level_name[Level3]= "Shift Alt"; + level_name[Level4]= "Ctrl+Alt"; + }; + type "SEPARATE_CAPS_AND_SHIFT_ALPHABETIC" { + modifiers= Shift+Lock+LevelThree; + map[Shift]= Level2; + map[Lock]= Level4; + preserve[Lock]= Lock; + map[LevelThree]= Level3; + map[Shift+LevelThree]= Level4; + map[Lock+LevelThree]= Level3; + preserve[Lock+LevelThree]= Lock; + map[Shift+Lock+LevelThree]= Level3; + level_name[Level1]= "Base"; + level_name[Level2]= "Shift"; + level_name[Level3]= "AltGr Base"; + level_name[Level4]= "Shift AltGr"; + }; + type "FOUR_LEVEL_PLUS_LOCK" { + modifiers= Shift+Lock+LevelThree; + map[Shift]= Level2; + map[LevelThree]= Level3; + map[Shift+LevelThree]= Level4; + map[Lock]= Level5; + map[Shift+Lock]= Level2; + map[Lock+LevelThree]= Level3; + map[Shift+Lock+LevelThree]= Level4; + level_name[Level1]= "Base"; + level_name[Level2]= "Shift"; + level_name[Level3]= "Alt Base"; + level_name[Level4]= "Shift Alt"; + level_name[Level5]= "Lock"; + }; + type "FOUR_LEVEL_KEYPAD" { + modifiers= Shift+NumLock+LevelThree; + map[Shift]= Level2; + map[NumLock]= Level2; + map[LevelThree]= Level3; + map[Shift+LevelThree]= Level4; + map[NumLock+LevelThree]= Level4; + map[Shift+NumLock+LevelThree]= Level3; + level_name[Level1]= "Base"; + level_name[Level2]= "Number"; + level_name[Level3]= "Alt Base"; + level_name[Level4]= "Alt Number"; + }; +}; + +xkb_compatibility "complete" { + + virtual_modifiers NumLock,Alt,LevelThree,LAlt,RAlt,RControl,LControl,ScrollLock,LevelFive,AltGr,Meta,Super,Hyper; + + interpret.useModMapMods= AnyLevel; + interpret.repeat= False; + interpret.locking= False; + interpret ISO_Level2_Latch+Exactly(Shift) { + useModMapMods=level1; + action= LatchMods(modifiers=Shift,clearLocks,latchToLock); + }; + interpret Shift_Lock+AnyOf(Shift+Lock) { + action= LockMods(modifiers=Shift); + }; + interpret Num_Lock+AnyOf(all) { + virtualModifier= NumLock; + action= LockMods(modifiers=NumLock); + }; + interpret ISO_Lock+AnyOf(all) { + action= ISOLock(modifiers=modMapMods,affect=all); + }; + interpret ISO_Level3_Shift+AnyOf(all) { + virtualModifier= LevelThree; + useModMapMods=level1; + action= SetMods(modifiers=LevelThree,clearLocks); + }; + interpret ISO_Level3_Latch+AnyOf(all) { + virtualModifier= LevelThree; + useModMapMods=level1; + action= LatchMods(modifiers=LevelThree,clearLocks,latchToLock); + }; + interpret ISO_Level3_Lock+AnyOf(all) { + virtualModifier= LevelThree; + useModMapMods=level1; + action= LockMods(modifiers=LevelThree); + }; + interpret Alt_L+AnyOf(all) { + virtualModifier= Alt; + action= SetMods(modifiers=modMapMods,clearLocks); + }; + interpret Alt_R+AnyOf(all) { + virtualModifier= Alt; + action= SetMods(modifiers=modMapMods,clearLocks); + }; + interpret Meta_L+AnyOf(all) { + virtualModifier= Meta; + action= SetMods(modifiers=modMapMods,clearLocks); + }; + interpret Meta_R+AnyOf(all) { + virtualModifier= Meta; + action= SetMods(modifiers=modMapMods,clearLocks); + }; + interpret Super_L+AnyOf(all) { + virtualModifier= Super; + action= SetMods(modifiers=modMapMods,clearLocks); + }; + interpret Super_R+AnyOf(all) { + virtualModifier= Super; + action= SetMods(modifiers=modMapMods,clearLocks); + }; + interpret Hyper_L+AnyOf(all) { + virtualModifier= Hyper; + action= SetMods(modifiers=modMapMods,clearLocks); + }; + interpret Hyper_R+AnyOf(all) { + virtualModifier= Hyper; + action= SetMods(modifiers=modMapMods,clearLocks); + }; + interpret Scroll_Lock+AnyOf(all) { + virtualModifier= ScrollLock; + action= LockMods(modifiers=modMapMods); + }; + interpret ISO_Level5_Shift+AnyOf(all) { + virtualModifier= LevelFive; + useModMapMods=level1; + action= SetMods(modifiers=LevelFive,clearLocks); + }; + interpret ISO_Level5_Latch+AnyOf(all) { + virtualModifier= LevelFive; + action= LatchMods(modifiers=LevelFive,clearLocks,latchToLock); + }; + interpret ISO_Level5_Lock+AnyOf(all) { + virtualModifier= LevelFive; + action= LockMods(modifiers=LevelFive); + }; + interpret Mode_switch+AnyOfOrNone(all) { + virtualModifier= AltGr; + useModMapMods=level1; + action= SetGroup(group=+1); + }; + interpret ISO_Level3_Shift+AnyOfOrNone(all) { + action= SetMods(modifiers=LevelThree,clearLocks); + }; + interpret ISO_Level3_Latch+AnyOfOrNone(all) { + action= LatchMods(modifiers=LevelThree,clearLocks,latchToLock); + }; + interpret ISO_Level3_Lock+AnyOfOrNone(all) { + action= LockMods(modifiers=LevelThree); + }; + interpret ISO_Group_Latch+AnyOfOrNone(all) { + virtualModifier= AltGr; + useModMapMods=level1; + action= LatchGroup(group=2); + }; + interpret ISO_Next_Group+AnyOfOrNone(all) { + virtualModifier= AltGr; + useModMapMods=level1; + action= LockGroup(group=+1); + }; + interpret ISO_Prev_Group+AnyOfOrNone(all) { + virtualModifier= AltGr; + useModMapMods=level1; + action= LockGroup(group=-1); + }; + interpret ISO_First_Group+AnyOfOrNone(all) { + action= LockGroup(group=1); + }; + interpret ISO_Last_Group+AnyOfOrNone(all) { + action= LockGroup(group=2); + }; + interpret Pointer_Button_Dflt+AnyOfOrNone(all) { + action= PtrBtn(button=default); + }; + interpret Pointer_Button1+AnyOfOrNone(all) { + action= PtrBtn(button=1); + }; + interpret Pointer_Button2+AnyOfOrNone(all) { + action= PtrBtn(button=2); + }; + interpret Pointer_Button3+AnyOfOrNone(all) { + action= PtrBtn(button=3); + }; + interpret Pointer_DblClick_Dflt+AnyOfOrNone(all) { + action= PtrBtn(button=default,count=2); + }; + interpret Pointer_DblClick1+AnyOfOrNone(all) { + action= PtrBtn(button=1,count=2); + }; + interpret Pointer_DblClick2+AnyOfOrNone(all) { + action= PtrBtn(button=2,count=2); + }; + interpret Pointer_DblClick3+AnyOfOrNone(all) { + action= PtrBtn(button=3,count=2); + }; + interpret Pointer_Drag_Dflt+AnyOfOrNone(all) { + action= LockPtrBtn(button=default,affect=both); + }; + interpret Pointer_Drag1+AnyOfOrNone(all) { + action= LockPtrBtn(button=1,affect=both); + }; + interpret Pointer_Drag2+AnyOfOrNone(all) { + action= LockPtrBtn(button=2,affect=both); + }; + interpret Pointer_Drag3+AnyOfOrNone(all) { + action= LockPtrBtn(button=3,affect=both); + }; + interpret Pointer_EnableKeys+AnyOfOrNone(all) { + action= LockControls(controls=MouseKeys); + }; + interpret Pointer_Accelerate+AnyOfOrNone(all) { + action= LockControls(controls=MouseKeysAccel); + }; + interpret Pointer_DfltBtnNext+AnyOfOrNone(all) { + action= SetPtrDflt(affect=button,button=+1); + }; + interpret Pointer_DfltBtnPrev+AnyOfOrNone(all) { + action= SetPtrDflt(affect=button,button=-1); + }; + interpret AccessX_Enable+AnyOfOrNone(all) { + action= LockControls(controls=AccessXKeys); + }; + interpret AccessX_Feedback_Enable+AnyOfOrNone(all) { + action= LockControls(controls=AccessXFeedback); + }; + interpret RepeatKeys_Enable+AnyOfOrNone(all) { + action= LockControls(controls=RepeatKeys); + }; + interpret SlowKeys_Enable+AnyOfOrNone(all) { + action= LockControls(controls=SlowKeys); + }; + interpret BounceKeys_Enable+AnyOfOrNone(all) { + action= LockControls(controls=BounceKeys); + }; + interpret StickyKeys_Enable+AnyOfOrNone(all) { + action= LockControls(controls=StickyKeys); + }; + interpret MouseKeys_Enable+AnyOfOrNone(all) { + action= LockControls(controls=MouseKeys); + }; + interpret MouseKeys_Accel_Enable+AnyOfOrNone(all) { + action= LockControls(controls=MouseKeysAccel); + }; + interpret Overlay1_Enable+AnyOfOrNone(all) { + action= LockControls(controls=Overlay1); + }; + interpret Overlay2_Enable+AnyOfOrNone(all) { + action= LockControls(controls=Overlay2); + }; + interpret AudibleBell_Enable+AnyOfOrNone(all) { + action= LockControls(controls=AudibleBell); + }; + interpret Terminate_Server+AnyOfOrNone(all) { + action= Terminate(); + }; + interpret Alt_L+AnyOfOrNone(all) { + action= SetMods(modifiers=Alt,clearLocks); + }; + interpret Alt_R+AnyOfOrNone(all) { + action= SetMods(modifiers=Alt,clearLocks); + }; + interpret Meta_L+AnyOfOrNone(all) { + action= SetMods(modifiers=Meta,clearLocks); + }; + interpret Meta_R+AnyOfOrNone(all) { + action= SetMods(modifiers=Meta,clearLocks); + }; + interpret Super_L+AnyOfOrNone(all) { + action= SetMods(modifiers=Super,clearLocks); + }; + interpret Super_R+AnyOfOrNone(all) { + action= SetMods(modifiers=Super,clearLocks); + }; + interpret Hyper_L+AnyOfOrNone(all) { + action= SetMods(modifiers=Hyper,clearLocks); + }; + interpret Hyper_R+AnyOfOrNone(all) { + action= SetMods(modifiers=Hyper,clearLocks); + }; + interpret Shift_L+AnyOfOrNone(all) { + action= SetMods(modifiers=Shift,clearLocks); + }; + interpret XF86Switch_VT_1+AnyOfOrNone(all) { + repeat= True; + action= SwitchScreen(screen=1,!same); + }; + interpret XF86Switch_VT_2+AnyOfOrNone(all) { + repeat= True; + action= SwitchScreen(screen=2,!same); + }; + interpret XF86Switch_VT_3+AnyOfOrNone(all) { + repeat= True; + action= SwitchScreen(screen=3,!same); + }; + interpret XF86Switch_VT_4+AnyOfOrNone(all) { + repeat= True; + action= SwitchScreen(screen=4,!same); + }; + interpret XF86Switch_VT_5+AnyOfOrNone(all) { + repeat= True; + action= SwitchScreen(screen=5,!same); + }; + interpret XF86Switch_VT_6+AnyOfOrNone(all) { + repeat= True; + action= SwitchScreen(screen=6,!same); + }; + interpret XF86Switch_VT_7+AnyOfOrNone(all) { + repeat= True; + action= SwitchScreen(screen=7,!same); + }; + interpret XF86Switch_VT_8+AnyOfOrNone(all) { + repeat= True; + action= SwitchScreen(screen=8,!same); + }; + interpret XF86Switch_VT_9+AnyOfOrNone(all) { + repeat= True; + action= SwitchScreen(screen=9,!same); + }; + interpret XF86Switch_VT_10+AnyOfOrNone(all) { + repeat= True; + action= SwitchScreen(screen=10,!same); + }; + interpret XF86Switch_VT_11+AnyOfOrNone(all) { + repeat= True; + action= SwitchScreen(screen=11,!same); + }; + interpret XF86Switch_VT_12+AnyOfOrNone(all) { + repeat= True; + action= SwitchScreen(screen=12,!same); + }; + interpret XF86LogGrabInfo+AnyOfOrNone(all) { + repeat= True; + action= Private(type=0x86,data[0]=0x50,data[1]=0x72,data[2]=0x47,data[3]=0x72,data[4]=0x62,data[5]=0x73,data[6]=0x00); + }; + interpret XF86LogWindowTree+AnyOfOrNone(all) { + repeat= True; + action= Private(type=0x86,data[0]=0x50,data[1]=0x72,data[2]=0x57,data[3]=0x69,data[4]=0x6e,data[5]=0x73,data[6]=0x00); + }; + interpret XF86Next_VMode+AnyOfOrNone(all) { + repeat= True; + action= Private(type=0x86,data[0]=0x2b,data[1]=0x56,data[2]=0x4d,data[3]=0x6f,data[4]=0x64,data[5]=0x65,data[6]=0x00); + }; + interpret XF86Prev_VMode+AnyOfOrNone(all) { + repeat= True; + action= Private(type=0x86,data[0]=0x2d,data[1]=0x56,data[2]=0x4d,data[3]=0x6f,data[4]=0x64,data[5]=0x65,data[6]=0x00); + }; + interpret ISO_Level5_Shift+AnyOfOrNone(all) { + action= SetMods(modifiers=LevelFive,clearLocks); + }; + interpret ISO_Level5_Latch+AnyOfOrNone(all) { + action= LatchMods(modifiers=LevelFive,clearLocks,latchToLock); + }; + interpret ISO_Level5_Lock+AnyOfOrNone(all) { + action= LockMods(modifiers=LevelFive); + }; + interpret Caps_Lock+AnyOfOrNone(all) { + action= LockMods(modifiers=Lock); + }; + interpret Any+Exactly(Lock) { + action= LockMods(modifiers=Lock); + }; + interpret Any+AnyOf(all) { + action= SetMods(modifiers=modMapMods,clearLocks); + }; + group 2 = AltGr; + group 3 = AltGr; + group 4 = AltGr; + indicator "Caps Lock" { + !allowExplicit; + whichModState= locked; + modifiers= Lock; + }; + indicator "Num Lock" { + !allowExplicit; + whichModState= locked; + modifiers= NumLock; + }; + indicator "Scroll Lock" { + whichModState= locked; + modifiers= ScrollLock; + }; + indicator "Shift Lock" { + !allowExplicit; + whichModState= locked; + modifiers= Shift; + }; + indicator "Group 2" { + !allowExplicit; + groups= 0xfe; + }; + indicator "Mouse Keys" { + indicatorDrivesKeyboard; + controls= mouseKeys; + }; +}; + +xkb_symbols "pc+us+inet(evdev)" { + + name[group1]="English (US)"; + + key { [ Escape ] }; + key { [ 1, exclam ] }; + key { [ 2, at ] }; + key { [ 3, numbersign ] }; + key { [ 4, dollar ] }; + key { [ 5, percent ] }; + key { [ 6, asciicircum ] }; + key { [ 7, ampersand ] }; + key { [ 8, asterisk ] }; + key { [ 9, parenleft ] }; + key { [ 0, parenright ] }; + key { [ minus, underscore ] }; + key { [ equal, plus ] }; + key { [ BackSpace, BackSpace ] }; + key { [ Tab, ISO_Left_Tab ] }; + key { + type= "ALPHABETIC", + symbols[Group1]= [ q, Q ] + }; + key { + type= "ALPHABETIC", + symbols[Group1]= [ w, W ] + }; + key { + type= "ALPHABETIC", + symbols[Group1]= [ e, E ] + }; + key { + type= "ALPHABETIC", + symbols[Group1]= [ r, R ] + }; + key { + type= "ALPHABETIC", + symbols[Group1]= [ t, T ] + }; + key { + type= "ALPHABETIC", + symbols[Group1]= [ y, Y ] + }; + key { + type= "ALPHABETIC", + symbols[Group1]= [ u, U ] + }; + key { + type= "ALPHABETIC", + symbols[Group1]= [ i, I ] + }; + key { + type= "ALPHABETIC", + symbols[Group1]= [ o, O ] + }; + key { + type= "ALPHABETIC", + symbols[Group1]= [ p, P ] + }; + key { [ bracketleft, braceleft ] }; + key { [ bracketright, braceright ] }; + key { [ Return ] }; + key { [ Control_L ] }; + key { + type= "ALPHABETIC", + symbols[Group1]= [ a, A ] + }; + key { + type= "ALPHABETIC", + symbols[Group1]= [ s, S ] + }; + key { + type= "ALPHABETIC", + symbols[Group1]= [ d, D ] + }; + key { + type= "ALPHABETIC", + symbols[Group1]= [ f, F ] + }; + key { + type= "ALPHABETIC", + symbols[Group1]= [ g, G ] + }; + key { + type= "ALPHABETIC", + symbols[Group1]= [ h, H ] + }; + key { + type= "ALPHABETIC", + symbols[Group1]= [ j, J ] + }; + key { + type= "ALPHABETIC", + symbols[Group1]= [ k, K ] + }; + key { + type= "ALPHABETIC", + symbols[Group1]= [ l, L ] + }; + key { [ semicolon, colon ] }; + key { [ apostrophe, quotedbl ] }; + key { [ grave, asciitilde ] }; + key { [ Shift_L ] }; + key { [ backslash, bar ] }; + key { + type= "ALPHABETIC", + symbols[Group1]= [ z, Z ] + }; + key { + type= "ALPHABETIC", + symbols[Group1]= [ x, X ] + }; + key { + type= "ALPHABETIC", + symbols[Group1]= [ c, C ] + }; + key { + type= "ALPHABETIC", + symbols[Group1]= [ v, V ] + }; + key { + type= "ALPHABETIC", + symbols[Group1]= [ b, B ] + }; + key { + type= "ALPHABETIC", + symbols[Group1]= [ n, N ] + }; + key { + type= "ALPHABETIC", + symbols[Group1]= [ m, M ] + }; + key { [ comma, less ] }; + key { [ period, greater ] }; + key { [ slash, question ] }; + key { [ Shift_R ] }; + key { + type= "CTRL+ALT", + symbols[Group1]= [ underscore, grave, KP_Multiply, KP_Multiply, XF86ClearGrab ] + }; + key { [ Alt_L, Meta_L ] }; + key { [ space ] }; + key { [ Caps_Lock ] }; + key { + type= "CTRL+ALT", + symbols[Group1]= [ F1, F1, F1, F1, XF86Switch_VT_1 ] + }; + key { + type= "CTRL+ALT", + symbols[Group1]= [ F2, F2, F2, F2, XF86Switch_VT_2 ] + }; + key { + type= "CTRL+ALT", + symbols[Group1]= [ F3, F3, F3, F3, XF86Switch_VT_3 ] + }; + key { + type= "CTRL+ALT", + symbols[Group1]= [ F4, F4, F4, F4, XF86Switch_VT_4 ] + }; + key { + type= "CTRL+ALT", + symbols[Group1]= [ F5, F5, F5, F5, XF86Switch_VT_5 ] + }; + key { + type= "CTRL+ALT", + symbols[Group1]= [ F6, F6, F6, F6, XF86Switch_VT_6 ] + }; + key { + type= "CTRL+ALT", + symbols[Group1]= [ F7, F7, F7, F7, XF86Switch_VT_7 ] + }; + key { + type= "CTRL+ALT", + symbols[Group1]= [ F8, F8, F8, F8, XF86Switch_VT_8 ] + }; + key { + type= "CTRL+ALT", + symbols[Group1]= [ F9, F9, F9, F9, XF86Switch_VT_9 ] + }; + key { + type= "CTRL+ALT", + symbols[Group1]= [ Pointer_Button1, Pointer_Button1, Pointer_Button1, Pointer_Button1, XF86Switch_VT_10 ] + }; + key { [ Num_Lock ] }; + key { [ Scroll_Lock ] }; + key { [ KP_Home, KP_7 ] }; + key { [ KP_Up, KP_8 ] }; + key { [ KP_Prior, KP_9 ] }; + key { + type= "CTRL+ALT", + symbols[Group1]= [ asterisk, grave, KP_Subtract, KP_Subtract, XF86Prev_VMode ] + }; + key { [ KP_Left, KP_4 ] }; + key { [ KP_Begin, KP_5 ] }; + key { [ KP_Right, KP_6 ] }; + key { + type= "CTRL+ALT", + symbols[Group1]= [ KP_Add, asciitilde, KP_Add, KP_Add, XF86Next_VMode ] + }; + key { [ KP_End, KP_1 ] }; + key { [ KP_Down, KP_2 ] }; + key { [ KP_Next, KP_3 ] }; + key { [ KP_Insert, KP_0 ] }; + key { [ KP_Delete, KP_Decimal ] }; + key { [ ISO_Level3_Shift ] }; + key { + type= "FOUR_LEVEL", + symbols[Group1]= [ less, greater, bar, brokenbar ] + }; + key { + type= "CTRL+ALT", + symbols[Group1]= [ F11, F11, F11, F11, XF86Switch_VT_11 ] + }; + key { + type= "CTRL+ALT", + symbols[Group1]= [ F12, F12, F12, F12, XF86Switch_VT_12 ] + }; + key { [ Katakana ] }; + key { [ Hiragana ] }; + key { [ Henkan_Mode ] }; + key { [ Hiragana_Katakana ] }; + key { [ Muhenkan ] }; + key { [ KP_Enter ] }; + key { [ Control_R ] }; + key { type= "CTRL+ALT", + symbols[Group1]= [ parenleft, KP_Equal, KP_Equal, KP_Equal, XF86Ungrab ] + }; + key { + type= "CTRL+ALT", + symbols[Group1]= [ parenright, KP_Divide, KP_Divide, KP_Divide, XF86Ungrab ] + }; + key { + type= "PC_ALT_LEVEL2", + symbols[Group1]= [ Print, Sys_Req ] + }; + key { + type= "TWO_LEVEL", + symbols[Group1]= [ Alt_R, Meta_R ] + }; + key { [ Linefeed ] }; + key { [ Home ] }; + key { [ Up ] }; + key { [ Pointer_Button2 ] }; + key { [ Left ] }; + key { [ Right ] }; + key { [ End ] }; + key { [ Down ] }; + key { [ Pointer_Button3 ] }; + key { [ Insert ] }; + key { [ Delete ] }; + key { [ XF86AudioMute ] }; + key { [ XF86AudioLowerVolume ] }; + key { [ XF86AudioRaiseVolume ] }; + key { [ XF86PowerOff ] }; + key { [ plusminus ] }; + key { + type= "PC_CONTROL_LEVEL2", + symbols[Group1]= [ Pause, Break ] + }; + key { [ XF86LaunchA ] }; + key { [ KP_Decimal, KP_Decimal ] }; + key { [ Hangul ] }; + key { [ Hangul_Hanja ] }; + key { [ Super_L ] }; + key { [ Super_R ] }; + key { [ Menu ] }; + key { [ Cancel ] }; + key { [ Redo ] }; + key { [ SunProps ] }; + key { [ Undo ] }; + key { [ SunFront ] }; + key { [ XF86Copy ] }; + key { [ SunOpen ] }; + key { [ XF86Paste ] }; + key { [ Find ] }; + key { [ XF86Cut ] }; + key { [ Help ] }; + key { [ XF86MenuKB ] }; + key { [ XF86Calculator ] }; + key { [ XF86Sleep ] }; + key { [ XF86WakeUp ] }; + key { [ XF86Explorer ] }; + key { [ XF86Send ] }; + key { [ XF86Xfer ] }; + key { [ XF86Launch1 ] }; + key { [ XF86Launch2 ] }; + key { [ XF86WWW ] }; + key { [ XF86DOS ] }; + key { [ XF86ScreenSaver ] }; + key { [ XF86RotateWindows ] }; + key { [ XF86Mail ] }; + key { [ XF86Favorites ] }; + key { [ XF86MyComputer ] }; + key { [ XF86Back ] }; + key { [ XF86Forward ] }; + key { [ XF86Eject ] }; + key { [ XF86Eject, XF86Eject ] }; + key { [ XF86AudioNext ] }; + key { [ XF86AudioPlay, XF86AudioPause ] }; + key { [ XF86AudioPrev ] }; + key { [ XF86AudioStop, XF86Eject ] }; + key { [ XF86AudioRecord ] }; + key { [ XF86AudioRewind ] }; + key { [ XF86Phone ] }; + key { [ XF86Tools ] }; + key { [ XF86HomePage ] }; + key { [ XF86Reload ] }; + key { [ XF86Close ] }; + key { [ XF86ScrollUp ] }; + key { [ XF86ScrollDown ] }; + key { [ parenleft ] }; + key { [ parenright ] }; + key { [ XF86New ] }; + key { [ Redo ] }; + key { [ XF86Tools ] }; + key { [ XF86Launch5 ] }; + key { [ XF86Launch6 ] }; + key { [ XF86Launch7 ] }; + key { [ XF86Launch8 ] }; + key { [ XF86Launch9 ] }; + key { [ XF86AudioMicMute ] }; + key { [ XF86TouchpadToggle ] }; + key { [ XF86TouchpadOn ] }; + key { [ XF86TouchpadOff ] }; + key { [ Mode_switch ] }; + key { [ NoSymbol, Alt_L ] }; + key { [ NoSymbol, Meta_L ] }; + key { [ NoSymbol, Super_L ] }; + key { [ NoSymbol, Hyper_L ] }; + key { [ XF86AudioPlay ] }; + key { [ XF86AudioPause ] }; + key { [ XF86Launch3 ] }; + key { [ XF86Launch4 ] }; + key { [ XF86LaunchB ] }; + key { [ XF86Suspend ] }; + key { [ XF86Close ] }; + key { [ XF86AudioPlay ] }; + key { [ XF86AudioForward ] }; + key { [ Print ] }; + key { [ XF86WebCam ] }; + key { [ XF86Mail ] }; + key { [ XF86Messenger ] }; + key { [ XF86Search ] }; + key { [ XF86Go ] }; + key { [ XF86Finance ] }; + key { [ XF86Game ] }; + key { [ XF86Shop ] }; + key { [ Cancel ] }; + key { [ XF86MonBrightnessDown ] }; + key { [ XF86MonBrightnessUp ] }; + key { [ XF86AudioMedia ] }; + key { [ XF86Display ] }; + key { [ XF86KbdLightOnOff ] }; + key { [ XF86KbdBrightnessDown ] }; + key { [ XF86KbdBrightnessUp ] }; + key { [ XF86Send ] }; + key { [ XF86Reply ] }; + key { [ XF86MailForward ] }; + key { [ XF86Save ] }; + key { [ XF86Documents ] }; + key { [ XF86Battery ] }; + key { [ XF86Bluetooth ] }; + key { [ XF86WLAN ] }; + modifier_map Control { }; + modifier_map Shift { }; + modifier_map Shift { }; + modifier_map Mod1 { }; + modifier_map Lock { }; + modifier_map Mod2 { }; + modifier_map Mod5 { }; + modifier_map Control { }; + modifier_map Mod1 { }; + modifier_map Mod4 { }; + modifier_map Mod4 { }; + modifier_map Mod5 { }; + modifier_map Mod1 { }; + modifier_map Mod4 { }; + modifier_map Mod4 { }; +}; + +xkb_geometry "pc(pc105)" { + + width= 470; + height= 180; + + alias = ; + alias = ; + + baseColor= "white"; + labelColor= "black"; + xfont= "-*-helvetica-medium-r-normal--*-120-*-*-*-*-iso8859-1"; + description= "Generic 105"; + + shape "NORM" { + corner= 1, + { [ 18, 18 ] }, + { [ 2, 1 ], [ 16, 16 ] } + }; + shape "BKSP" { + corner= 1, + { [ 38, 18 ] }, + { [ 2, 1 ], [ 36, 16 ] } + }; + shape "TABK" { + corner= 1, + { [ 28, 18 ] }, + { [ 2, 1 ], [ 26, 16 ] } + }; + shape "BKSL" { + corner= 1, + { [ 28, 18 ] }, + { [ 2, 1 ], [ 26, 16 ] } + }; + shape "RTRN" { + corner= 1, + { [ 0, 0 ], [ 28, 0 ], [ 28, 37 ], [ 5, 37 ], + [ 5, 18 ], [ 0, 18 ] }, + { [ 2, 1 ], [ 26, 1 ], [ 26, 35 ], [ 7, 35 ], + [ 7, 16 ], [ 2, 16 ] }, + approx= { [ 5, 0 ], [ 28, 37 ] } + }; + shape "CAPS" { + corner= 1, + { [ 33, 18 ] }, + { [ 2, 1 ], [ 31, 16 ] } + }; + shape "LFSH" { + corner= 1, + { [ 25, 18 ] }, + { [ 2, 1 ], [ 23, 16 ] } + }; + shape "RTSH" { + corner= 1, + { [ 50, 18 ] }, + { [ 2, 1 ], [ 48, 16 ] } + }; + shape "MODK" { + corner= 1, + { [ 27, 18 ] }, + { [ 2, 1 ], [ 25, 16 ] } + }; + shape "SMOD" { + corner= 1, + { [ 23, 18 ] }, + { [ 2, 1 ], [ 21, 16 ] } + }; + shape "SPCE" { + corner= 1, + { [ 113, 18 ] }, + { [ 2, 1 ], [ 111, 16 ] } + }; + shape "KP0" { + corner= 1, + { [ 37, 18 ] }, + { [ 2, 1 ], [ 35, 16 ] } + }; + shape "KPAD" { + corner= 1, + { [ 18, 37 ] }, + { [ 2, 1 ], [ 16, 35 ] } + }; + shape "LEDS" { { [ 75, 20 ] } }; + shape "LED" { { [ 5, 1 ] } }; + section "Function" { + key.color= "grey20"; + priority= 7; + top= 22; + left= 19; + width= 351; + height= 19; + row { + top= 1; + left= 1; + keys { + { , "NORM", 1 }, + { , "NORM", 20, color="white" }, + { , "NORM", 1, color="white" }, + { , "NORM", 1, color="white" }, + { , "NORM", 1, color="white" }, + { , "NORM", 11, color="white" }, + { , "NORM", 1, color="white" }, + { , "NORM", 1, color="white" }, + { , "NORM", 1, color="white" }, + { , "NORM", 11, color="white" }, + { , "NORM", 1, color="white" }, + { , "NORM", 1, color="white" }, + { , "NORM", 1, color="white" }, + { , "NORM", 8, color="white" }, + { , "NORM", 1, color="white" }, + { , "NORM", 1, color="white" } + }; + }; + }; // End of "Function" section + + section "Alpha" { + key.color= "white"; + priority= 8; + top= 61; + left= 19; + width= 287; + height= 95; + row { + top= 1; + left= 1; + keys { + { , "NORM", 1 }, { , "NORM", 1 }, + { , "NORM", 1 }, { , "NORM", 1 }, + { , "NORM", 1 }, { , "NORM", 1 }, + { , "NORM", 1 }, { , "NORM", 1 }, + { , "NORM", 1 }, { , "NORM", 1 }, + { , "NORM", 1 }, { , "NORM", 1 }, + { , "NORM", 1 }, + { , "BKSP", 1, color="grey20" } + }; + }; + row { + top= 20; + left= 1; + keys { + { , "TABK", 1, color="grey20" }, + { , "NORM", 1 }, { , "NORM", 1 }, + { , "NORM", 1 }, { , "NORM", 1 }, + { , "NORM", 1 }, { , "NORM", 1 }, + { , "NORM", 1 }, { , "NORM", 1 }, + { , "NORM", 1 }, { , "NORM", 1 }, + { , "NORM", 1 }, { , "NORM", 1 }, + { , "RTRN", 1, color="grey20" } + }; + }; + row { + top= 39; + left= 1; + keys { + { , "CAPS", 1, color="grey20" }, + { , "NORM", 1 }, { , "NORM", 1 }, + { , "NORM", 1 }, { , "NORM", 1 }, + { , "NORM", 1 }, { , "NORM", 1 }, + { , "NORM", 1 }, { , "NORM", 1 }, + { , "NORM", 1 }, { , "NORM", 1 }, + { , "NORM", 1 }, { , "NORM", 1 } + }; + }; + row { + top= 58; + left= 1; + keys { + { , "LFSH", 1, color="grey20" }, + { , "NORM", 1 }, { , "NORM", 1 }, + { , "NORM", 1 }, { , "NORM", 1 }, + { , "NORM", 1 }, { , "NORM", 1 }, + { , "NORM", 1 }, { , "NORM", 1 }, + { , "NORM", 1 }, { , "NORM", 1 }, + { , "NORM", 1 }, + { , "RTSH", 1, color="grey20" } + }; + }; + row { + top= 77; + left= 1; + keys { + { , "MODK", 1, color="grey20" }, + { , "SMOD", 1, color="grey20" }, + { , "SMOD", 1, color="grey20" }, + { , "SPCE", 1 }, + { , "SMOD", 1, color="grey20" }, + { , "SMOD", 1, color="grey20" }, + { , "SMOD", 1, color="grey20" }, + { , "SMOD", 1, color="grey20" } + }; + }; + }; // End of "Alpha" section + + section "Editing" { + key.color= "grey20"; + priority= 9; + top= 61; + left= 312; + width= 58; + height= 95; + row { + top= 1; + left= 1; + keys { + { , "NORM", 1 }, { , "NORM", 1 }, + { , "NORM", 1 } + }; + }; + row { + top= 20; + left= 1; + keys { + { , "NORM", 1 }, { , "NORM", 1 }, + { , "NORM", 1 } + }; + }; + row { + top= 58; + left= 20; + keys { + { , "NORM", 1 } + }; + }; + row { + top= 77; + left= 1; + keys { + { , "NORM", 1 }, { , "NORM", 1 }, + { , "NORM", 1 } + }; + }; + }; // End of "Editing" section + + section "Keypad" { + key.color= "grey20"; + priority= 10; + top= 61; + left= 376; + width= 77; + height= 95; + row { + top= 1; + left= 1; + keys { + { , "NORM", 1 }, { , "NORM", 1 }, + { , "NORM", 1 }, { , "NORM", 1 } + }; + }; + row { + top= 20; + left= 1; + keys { + { , "NORM", 1, color="white" }, + { , "NORM", 1, color="white" }, + { , "NORM", 1, color="white" }, + { , "KPAD", 1 } + }; + }; + row { + top= 39; + left= 1; + keys { + { , "NORM", 1, color="white" }, + { , "NORM", 1, color="white" }, + { , "NORM", 1, color="white" } + }; + }; + row { + top= 58; + left= 1; + keys { + { , "NORM", 1, color="white" }, + { , "NORM", 1, color="white" }, + { , "NORM", 1, color="white" }, + { , "KPAD", 1 } + }; + }; + row { + top= 77; + left= 1; + keys { + { , "KP0", 1, color="white" }, + { , "NORM", 1, color="white" } + }; + }; + }; // End of "Keypad" section + + solid "LedPanel" { + top= 22; + left= 377; + priority= 0; + color= "grey10"; + shape= "LEDS"; + }; + indicator "Num Lock" { + top= 37; + left= 382; + priority= 1; + onColor= "green"; + offColor= "green30"; + shape= "LED"; + }; + indicator "Caps Lock" { + top= 37; + left= 407; + priority= 2; + onColor= "green"; + offColor= "green30"; + shape= "LED"; + }; + indicator "Scroll Lock" { + top= 37; + left= 433; + priority= 3; + onColor= "green"; + offColor= "green30"; + shape= "LED"; + }; + text "NumLockLabel" { + top= 25; + left= 378; + priority= 4; + width= 19.8; + height= 10; + XFont= "-*-helvetica-medium-r-normal--*-120-*-*-*-*-iso8859-1"; + text= "Num\nLock"; + }; + text "CapsLockLabel" { + top= 25; + left= 403; + priority= 5; + width= 26.4; + height= 10; + XFont= "-*-helvetica-medium-r-normal--*-120-*-*-*-*-iso8859-1"; + text= "Caps\nLock"; + }; + text "ScrollLockLabel" { + top= 25; + left= 428; + priority= 6; + width= 39.6; + height= 10; + XFont= "-*-helvetica-medium-r-normal--*-120-*-*-*-*-iso8859-1"; + text= "Scroll\nLock"; + }; +}; + +}; diff --git a/.Xmodmap b/.Xmodmap new file mode 100644 index 0000000..ad8e5a2 --- /dev/null +++ b/.Xmodmap @@ -0,0 +1 @@ +keycode 94 = underscore F10 diff --git a/.Xresources b/.Xresources new file mode 100644 index 0000000..735f42d --- /dev/null +++ b/.Xresources @@ -0,0 +1,13 @@ +Xft.autohint: 0 +Xft.lcdfilter: lcddefaault +Xft.hintstyle: hintfull +Xft.hinting: 1 +Xft.antialias: 1 +Xft.rgba: vrgb + +! commented because I am not using urxvt currently +!URxvt*font: xft:DejaVu Sans Mono:size=11 +!URxvt*boldFont: xft:DejaVu Sans Mono:size=11 +!URxvt*foreground: White +!URxvt*background: Black +!URxvt.scrollstyle: plain diff --git a/.dir_colors b/.dir_colors new file mode 100644 index 0000000..518294f --- /dev/null +++ b/.dir_colors @@ -0,0 +1,482 @@ +# LS_COLORS +# Maintainer: Magnus Woldrich +# URL: https://github.com/trapd00r/LS_COLORS +# Version: master +# Updated: undefined +# +# This is a collection of extension:color mappings, suitable to use as your +# LS_COLORS environment variable. Most of them use the extended color map, +# described in the ECMA-48 document; in other words, you'll need a terminal +# with capabilities of displaying 256 colors. +# +# As of this writing, around 300 different filetypes/extensions is supported. +# That's indeed a lot of extensions, but there's a lot more! Therefore I need +# your help. +# +# Fork this project on github, add the extensions you are missing, and send me +# a pull request. +# +# For files that usually ends up next to each other, like html, css and js, +# try to pick colors that fit nicely together. Filetypes with multiple +# possible extensions, like htm and html, should have the same color. +# +# To install and use this file, put something like this is your shell resource +# file: +# +# eval $( dircolors -b $HOME/.LS_COLORS) +# +# where .LS_COLORS is this file. + +# {{{ Base +BLK 38;5;68 +CAPABILITY 38;5;17 +CHR 38;5;113;1 +DIR 38;5;33 +DOOR 38;5;127 +EXEC 38;5;174;1 +FIFO 38;5;126 +FILE 1 +LINK target +MULTIHARDLINK 38;5;220;1 +ORPHAN 38;5;196;38;5;232;1 +OTHER_WRITABLE 38;5;220;1 +SETGID 38;5;234;38;5;100;1 +SETUID 38;5;137 +SOCK 38;5;197 +STICKY 38;5;86;48;5;234 +STICKY_OTHER_WRITABLE 38;5;235;38;5;139 +# }}} +# Code, text, documents {{{ +.BAT 38;5;108 +.PL 38;5;160 +.asm 38;5;240;1 +.awk 38;5;148;1 +.bash 38;5;173 +.bat 38;5;108 +.c 38;5;110 +.cfg 38;5;63 +.coffee 38;5;94;1 +.cow 38;5;94;1 +.conf 38;5;63 +.cpp 38;5;24;1 +.cs 38;5;74;1 +.css 38;5;91 +.csv 38;5;78 +.ctp 38;5;95 +.diff 38;5;197 +.enc 38;5;192;3 +.eps 38;5;192 +.etx 38;5;172 +.ex 38;5;148;1 +.example 38;5;225;1 +.git 38;5;197 +.gitignore 38;5;240 +.go 38;5;117;1 +.h 38;5;81 +.hs 38;5;155;1 +.htm 38;5;125;1 +.html 38;5;125;1 +.info 38;5;101 +.ini 38;5;122 +.java 38;5;142;1 +.jhtm 38;5;125;1 +.js 38;5;42 +.jsm 38;5;42 +.jsm 38;5;42 +.json 38;5;13 +.jsp 38;5;45 +.lisp 38;5;204;1 +.log 38;5;190 +.lua 38;5;34;1 +.map 38;5;58;3 +.markdown 38;5;184 +.md 38;5;184 +.mf 38;5;220;3 +.mfasl 38;5;73 +.mi 38;5;124 +.mkd 38;5;184 +.mtx 38;5;36;3 +.nfo 38;5;220 +.o 38;5;240 +.pacnew 38;5;33 +.patch 38;5;5;1 +.pc 38;5;100 +.pfa 38;5;43 +.php 38;5;93 +.pid 38;5;160 +.pl 38;5;214 +.pm 38;5;197;1 +.pod 38;5;172;1 +.py 38;5;41 +.rb 38;5;192 +.rdf 38;5;144 +.rst 38;5;67 +.ru 38;5;142 +.sed 38;5;130;1 +.sfv 38;5;197 +.sh 38;5;113 +.signature 38;5;206 +.sql 38;5;222 +.srt 38;5;116 +.sty 38;5;58 +.sug 38;5;44 +.t 38;5;28;1 +.tcl 38;5;64;1 +.tdy 38;5;214 +.tex 38;5;172 +.textile 38;5;106 +.tfm 38;5;64 +.tfnt 38;5;140 +.theme 38;5;109 +.txt 38;5;192 +.urlview 38;5;85 +.vim 38;5;28 +.viminfo 38;5;240;1 +.xml 38;5;13 +.yml 38;5;208 +.zsh 38;5;173 + +# Build stuff +.1 38;5;196;1 +.1p 38;5;160 +.3p 38;5;160 +.am 38;5;242 +.in 38;5;242 +.old 38;5;242 +.out 38;5;46;1 + + + + +#}}} +# Pictures, icons {{{ +.bmp 38;5;62 +.cdr 38;5;59 +.gif 38;5;72 +.ico 38;5;73 +.jpeg 38;5;66 +.jpg 38;5;66 +.JPG 38;5;66 +.png 38;5;68;1 +.svg 38;5;24;1 +.xpm 38;5;36 +#}}} +# Emulator roms, emulator savegames {{{ +.32x 38;5;137 +.A64 38;5;82 +.a00 38;5;11 +.a52 38;5;112 +.a64 38;5;82 +.a78 38;5;112 +.adf 38;5;35 +.atr 38;5;213 +.cdi 38;5;124 +.fm2 38;5;35 +.gb 38;5;203 +.gba 38;5;205 +.gbc 38;5;204 +.gel 38;5;83 +.gg 38;5;138 +.ggl 38;5;83 +.j64 38;5;102 +.nds 38;5;193 +.nes 38;5;160 +.rom 38;5;59;1 +.sav 38;5;220 +.sms 38;5;33 +.st 38;5;208;1 +#}}} +# Images {{{ +.ipsw 38;5;146 +.iso 38;5;1 +.nrg 38;5;124 +.qcow 38;5;141 +#}}} +# Video {{{ +.VOB 38;5;137 +.IFO 38;5;240 +.BUP 38;5;241 +.MOV 38;5;42 +.asf 38;5;25 +.avi 38;5;114 +.flv 38;5;131 +.m2v 38;5;166 +.mkv 38;5;173 +.mov 38;5;42 +.mp4 38;5;9 +.mpg 38;5;38 +.mpeg 38;5;38 +.ogm 38;5;97 +.ogv 38;5;94 +.rmvb 38;5;112 +.sample 38;5;130;1 +.ts 38;5;39 +.vob 38;5;137 +.webm 38;5;109 +.wmv 38;5;113 +#}}} +# Music, audio {{{ +.S3M 38;5;71;1 +.aac 38;5;137 +.cue 38;5;112 +.dat 38;5;165 +.dts 38;5;100;1 +.fcm 38;5;41 +.flac 38;5;166;1 +.m3u 38;5;172 +.m4 38;5;196;3 +.m4a 38;5;137;1 +.mid 38;5;102 +.midi 38;5;102 +.mod 38;5;72 +.mp3 38;5;191 +.oga 38;5;95 +.ogg 38;5;96 +.s3m 38;5;71;1 +.sid 38;5;69;1 +.spl 38;5;173 +.wv 38;5;149 +.wvc 38;5;149 +#}}} +# Fonts {{{ +.afm 38;5;58 +.pfb 38;5;58 +.pfm 38;5;58 +.ttf 38;5;1 +.pcf 38;5;65 +.psf 38;5;64 +#}}} +# Backups, undo files, tempfiles {{{ +.bak 38;5;41;1 +.bin 38;5;249 +.swo 38;5;236 +.swp 38;5;241 +.tmp 38;5;244 +.un~ 38;5;240 +.zcompdump 38;5;240 +.zwc 38;5;240 +#}}} +# Databases {{{ +.db 38;5;60 +.dump 38;5;119 +.sqlite 38;5;60 +.typelib 38;5;60 + +#}}} +# Archives {{{ +.7z 38;5;40 +.a 38;5;46 +.arj 38;5;41 +.bz2 38;5;44 +.ipk 38;5;117 +.jad 38;5;50 +.jar 38;5;51 +.part 38;5;240;1 +.r00 38;5;235 +.r01 38;5;235 +.r02 38;5;235 +.r03 38;5;236 +.r04 38;5;237 +.r05 38;5;238 +.r06 38;5;239 +.r07 38;5;240 +.r08 38;5;241 +.r09 38;5;242 +.r10 38;5;243 +.r100 38;5;244 +.r101 38;5;240 +.r102 38;5;241 +.r103 38;5;242 +.r104 38;5;243 +.r105 38;5;244 +.r106 38;5;245 +.r107 38;5;246 +.r108 38;5;247 +.r109 38;5;248 +.r11 38;5;244 +.r110 38;5;249 +.r111 38;5;250 +.r112 38;5;251 +.r113 38;5;252 +.r114 38;5;253 +.r115 38;5;254 +.r116 38;5;255 +.r12 38;5;245 +.r13 38;5;246 +.r14 38;5;247 +.r15 38;5;248 +.r16 38;5;249 +.r17 38;5;250 +.r18 38;5;251 +.r19 38;5;252 +.r20 38;5;253 +.r21 38;5;254 +.r22 38;5;255 +.r25 38;5;255 +.r26 38;5;254 +.r27 38;5;253 +.r28 38;5;252 +.r29 38;5;251 +.r30 38;5;250 +.r31 38;5;249 +.r32 38;5;248 +.r33 38;5;247 +.r34 38;5;246 +.r35 38;5;245 +.r36 38;5;244 +.r37 38;5;243 +.r38 38;5;242 +.r39 38;5;241 +.r40 38;5;240 +.r41 38;5;239 +.r42 38;5;238 +.r43 38;5;237 +.r44 38;5;236 +.r45 38;5;235 +.r46 38;5;235 +.r47 38;5;235 +.r48 38;5;235 +.r49 38;5;235 +.r50 38;5;236 +.r51 38;5;237 +.r52 38;5;238 +.r53 38;5;239 +.r54 38;5;240 +.r55 38;5;241 +.r56 38;5;242 +.r57 38;5;243 +.r58 38;5;244 +.r59 38;5;245 +.r60 38;5;246 +.r61 38;5;247 +.r62 38;5;248 +.r63 38;5;249 +.r64 38;5;250 +.r65 38;5;251 +.r66 38;5;252 +.r67 38;5;253 +.r68 38;5;254 +.r69 38;5;255 +.r69 38;5;255 +.r70 38;5;254 +.r71 38;5;253 +.r72 38;5;252 +.r73 38;5;251 +.r74 38;5;250 +.r75 38;5;249 +.r76 38;5;248 +.r77 38;5;247 +.r78 38;5;246 +.r79 38;5;245 +.r80 38;5;244 +.r81 38;5;243 +.r82 38;5;242 +.r83 38;5;241 +.r84 38;5;240 +.r85 38;5;239 +.r86 38;5;238 +.r87 38;5;237 +.r88 38;5;236 +.r89 38;5;235 +.r90 38;5;235 +.r91 38;5;235 +.r92 38;5;236 +.r93 38;5;237 +.r94 38;5;238 +.r95 38;5;239 +.r96 38;5;240 +.r97 38;5;241 +.r98 38;5;242 +.r99 38;5;243 +.rar 38;5;106;1 +.tar 38;5;118 +.tar.gz 38;5;34 +.tgz 38;5;35;1 +.xz 38;5;118 +.zip 38;5;41 +.xpi 38;5;106 +#}}} +# {{{ Really compressed archives (documends, comics) +.pdf 38;5;203 +.djvu 38;5;141 +.cbr 38;5;140 +.cbz 38;5;140 +.chm 38;5;144 +#}}} +# Open document formats {{{ +.odt 38;5;111 +.ods 38;5;112 +.odp 38;5;166 +.odb 38;5;161 +#}}} +# /etc/hosts.{deny,allow} {{{ +.allow 38;5;112 +.deny 38;5;196 +#}}} +# other {{{ +.SKIP 38;5;244 +.def 38;5;136 +.directory 38;5;83 +.err 38;5;160;1 +.error 38;5;160;1 +.pi 38;5;126 +.properties 38;5;197;1 +.torrent 38;5;2 +.gp3 38;5;114 +.gp4 38;5;115 +.tg 38;5;99 +#}}} + +# {{{ TERM +TERM Eterm +TERM ansi +TERM color-xterm +TERM con132x25 +TERM con132x30 +TERM con132x43 +TERM con132x60 +TERM con80x25 +TERM con80x28 +TERM con80x30 +TERM con80x43 +TERM con80x50 +TERM con80x60 +TERM cons25 +TERM console +TERM cygwin +TERM dtterm +TERM eterm-color +TERM gnome +TERM gnome-256color +TERM jfbterm +TERM konsole +TERM kterm +TERM linux +TERM linux-c +TERM mach-color +TERM mlterm +TERM putty +TERM rxvt +TERM rxvt-256color +TERM rxvt-cygwin +TERM rxvt-cygwin-native +TERM rxvt-unicode +TERM rxvt-unicode-256color +TERM rxvt-unicode256 +TERM screen +TERM screen-256color +TERM screen-256color-bce +TERM screen-bce +TERM screen-w +TERM screen.rxvt +TERM screen.linux +TERM terminator +TERM vt100 +TERM xterm +TERM xterm-16color +TERM xterm-256color +TERM xterm-88color +TERM xterm-color +TERM xterm-debian +# }}} +# vim: set ft=dircolors fdm=marker et sw=2: diff --git a/.eclipse-dictionary b/.eclipse-dictionary new file mode 100644 index 0000000..0e2693d --- /dev/null +++ b/.eclipse-dictionary @@ -0,0 +1 @@ +downside diff --git a/.gemrc b/.gemrc new file mode 100644 index 0000000..d90ed0f --- /dev/null +++ b/.gemrc @@ -0,0 +1,2 @@ +# if a gem fails on documentation, uncomment this. +# gem: --no-document diff --git a/.git_template/hooks/pre-commit b/.git_template/hooks/pre-commit new file mode 100755 index 0000000..ad2218a --- /dev/null +++ b/.git_template/hooks/pre-commit @@ -0,0 +1,128 @@ +#!/bin/bash +# Copyright (C) 2016 Ian Kelling + +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at + +# http://www.apache.org/licenses/LICENSE-2.0 + +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# This is the git upstream example hook, but it's actually useful. + +# +# An example hook script to verify what is about to be committed. +# Called by "git commit" with no arguments. The hook should +# exit with non-zero status after issuing an appropriate message if +# it wants to stop the commit. +# +# To enable this hook, rename this file to "pre-commit". + +if git rev-parse --verify HEAD >/dev/null 2>&1 +then + against=HEAD +else + # Initial commit: diff against an empty tree object + against=4b825dc642cb6eb9a060e54bf8d69288fbee4904 +fi + +# If you want to allow non-ASCII filenames set this variable to true. +allownonascii=$(git config --bool hooks.allownonascii) + +# Redirect output to stderr. +exec 1>&2 + +# Cross platform projects tend to avoid non-ASCII filenames; prevent +# them from being added to the repository. We exploit the fact that the +# printable range starts at the space character and ends with tilde. +if [[ $allownonascii != true ]] && + # Note that the use of brackets around a tr range is ok here, (it's + # even required, for portability to Solaris 10's /usr/bin/tr), since + # the square bracket bytes happen to fall in the designated range. + test $(git diff --cached --name-only --diff-filter=A -z $against | + LC_ALL=C tr -d '[ -~]\0' | wc -c) != 0 +then + cat </dev/null; then + cat <<'EOF' +Whitespace issues found. We can't fix in a pre-commit hook for the first commit. +Either fix on your own. I suggest https://github.com/dlenski/wtf, from git root: +find . -not -name .git -type f -exec bash -c \ + 'grep -Il "" "$1" &>/dev/null && wtf.py -i -E lf "$1"' _ {} \; +or allow whitespace with: +git config hooks.allowwhitespace true, or export GIT_ALLOWWHITESPACE=true +EOF + echo "$ws_issues" + exit 1 +fi +echo "Fixing whitespace lines. To avoid this, do: +git config hooks.allowwhitespace true, or export GIT_ALLOWWHITESPACE=true" +export GIT_ALLOWWHITESPACE=ignore +if ! git diff-files --quiet . && \ + ! git diff-index --quiet --cached HEAD; then + # - dirty tree and dirty index + git commit -m "temporary commit of index while fixing whitespace" + git add -u :/ + git commit -m "temporary commit of non-index while fixing whitespace" + git rebase --whitespace=fix HEAD~2 + git reset HEAD~ && + git reset --soft HEAD~ +elif ! git diff-files --quiet .; then + # - dirty tree and clean index + git add -u :/ + git commit -m "temporary commit of non-index while fixing whitespace" + git rebase --whitespace=fix HEAD~ + git reset HEAD~ +elif ! git diff-index --quiet --cached HEAD; then + # - clean tree and dirty index + git commit -m "temporary commit of index while fixing whitespace" + git rebase --whitespace=fix HEAD~ + git reset --soft HEAD~ +fi diff --git a/.gitconfig b/.gitconfig new file mode 100644 index 0000000..0070361 --- /dev/null +++ b/.gitconfig @@ -0,0 +1,38 @@ +[user] + name = Ian Kelling + email = ian@iankelling.org +[alias] + co = checkout + s = status + ci = commit +[core] + excludesfile = /home/ian/.gitignore_global +[github] + user = ian-kelling + token = d2dc0c5c6fef5378cc896a617e53c1a9 +[credential] + helper = cache + + # new option, but not available yet on debian wheezy + # [push] +# default = simple + +# based on ghc advice, +# https://ghc.haskell.org/trac/ghc/wiki/Building/GettingTheSources +[diff] + ignoreSubmodules = dirty + tool = meld + +[gitreview] + username = iank +# this is for newer git version. Doesn't work for ubuntu 12.04's version +#[push] +# default = simple +[color] + ui = auto +# for hooks. http://stackoverflow.com/questions/2293498/git-commit-hooks-global-settings +[init] + templatedir = ~/.git_template +[difftool] + tool = meld + prompt = false diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..5a0a5e6 --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +/t.org +/old-unused +/.emacs.d +/repos diff --git a/.gitignore_global b/.gitignore_global new file mode 100644 index 0000000..4c5a3b9 --- /dev/null +++ b/.gitignore_global @@ -0,0 +1,5 @@ +\#*\# +/GPATH +/GRTAGS +/GTAGS +*.~undo-tree~ diff --git a/.gvimrc b/.gvimrc new file mode 100644 index 0000000..b676075 --- /dev/null +++ b/.gvimrc @@ -0,0 +1,50 @@ +set mousemodel=popup " right mouse button pops up a menu in the GUI +" set the X11 font to use +" +" this may need to be set for a newer host +" set guifont=DejaVu\ Sans\ Mono\ 11 +if $OS ==# 'Windows_NT' + if has("xterm_clipboard") + set guifont=DejaVu\ Sans\ Mono\ 12 + else + set guifont=DejaVu_Sans_Mono:h10:cANSI + endif + set winaltkeys=no +endif + +if hostname() ==# 'gd' + set guifont=DejaVu\ Sans\ Mono\ 13 +endif +if hostname() ==# 'jl' + set guifont=DejaVu\ Sans\ Mono\ 11 +endif + +set guicursor=a:blinkwait1000-blinkon10000-blinkoff100 +"here are the defaults: +"set guicursor=n-v-c:block-Cursor/lCursor,ve:ver35-Cursor,o:hor50-Cursor,i-ci:ver25-Cursor/lCursor,r-cr:hor20-Cursor/lCursor,sm:block-Cursor-blinkwait175-blinkoff150-blinkon175 + +"Crude way of maximizing when the console is small. optimized for my system. +if &columns < 60 || &lines <20 || exists("$DMAXVIM") + set columns=158 + set lines=51 +endif +"remove menu and button stuff. +set go-=m +set go-=T +" no right scrollbar +set go-=r +"use non gui tabline, stops maxmized kde bug. +set go-=e +"use console prompts +set go+=c +" no left scrollbar +set go-=L + +" Use a sufficiently wide window automatically when started as "gvimdiff" +if (&foldmethod == 'diff') + set columns=165 +endif + +" For bug 33327, add a mapping which allows shift-insert to function +" as expected in insert and command-line modes +map! * diff --git a/.hunspell_en_US b/.hunspell_en_US new file mode 100644 index 0000000..d1aa599 --- /dev/null +++ b/.hunspell_en_US @@ -0,0 +1,2 @@ +timestamp +mediawiki diff --git a/.hushlogin b/.hushlogin new file mode 100644 index 0000000..e69de29 diff --git a/.libao b/.libao new file mode 100644 index 0000000..25ede45 --- /dev/null +++ b/.libao @@ -0,0 +1 @@ +default_driver=pulse diff --git a/.mailcap b/.mailcap new file mode 100644 index 0000000..e0e4a99 --- /dev/null +++ b/.mailcap @@ -0,0 +1,2 @@ +# google mailcap for more info. +text/plain; g '%s'; edit=g '%s'; compose=g '%s'; needsterminal diff --git a/.mpv/config b/.mpv/config new file mode 100644 index 0000000..7eca9ae --- /dev/null +++ b/.mpv/config @@ -0,0 +1,2 @@ +# Write your default config options here! +save-position-on-quit diff --git a/.redshift.conf b/.redshift.conf new file mode 100644 index 0000000..cb1bf6b --- /dev/null +++ b/.redshift.conf @@ -0,0 +1,3 @@ +[redshift] +temp-day=5900 +temp-night=5400 diff --git a/.screenrc b/.screenrc new file mode 100644 index 0000000..7f584eb --- /dev/null +++ b/.screenrc @@ -0,0 +1,43 @@ +# turn off visual bell +vbell off + +# bufferfile /tmp/screen-exchange +# replace ctrl-A by ctrl-O +# escape ^Oo +# set a big scrolling buffer +defscrollback 20000 +# Set the caption on the bottom line +# %-w all window names & numbers up to the current one. %+w all after the current. +# +# +# modified from this +#caption always "%{= kw}%-w%{= kw}%n %t%{-}%+w %-= %u@%H - %LD %d %LM - %C" +caption always "%{= kw}%-w%{= kw}%n %t%{-}%+w %-= %h" +# useless stuff taken away. +# %u other users using this session or something +# %H host, doesn't change after ssh +# +# + +# make vim go away when it exits +altscreen on + +# syn with X paste buffer +#bindkey -m > eval "stuff ' '" writebuf "exec sh -c 'xsel -n < /tmp/screen-exchange'" +#screen -t shell1 + +startup_message off + +# terminfo and termcap for nice 256 color terminal +# allow bold colors - necessary for some reason +attrcolor b ".I" +# tell screen how to set colors. AB = background, AF=foreground +termcapinfo xterm|xterm-256color 'Co#256:AB=\E[48;5;%dm:AF=\E[38;5;%dm' +# erase background with current bg color. bce = background color erase +defbce "on" + +# make shift-pgup/pgdn work +termcapinfo xterm|xterm-256color ti@:te=\E[2J + +# can update the hardstatus (xterm title) with a command like this: +# hardstatus string "SCREEN @ %H: %-n - %t" diff --git a/.vim/.netrwhist b/.vim/.netrwhist new file mode 100644 index 0000000..d68b384 --- /dev/null +++ b/.vim/.netrwhist @@ -0,0 +1,4 @@ +let g:netrw_dirhistmax =10 +let g:netrw_dirhist_cnt =2 +let g:netrw_dirhist_1='/usr/share/X11/xkb/symbols' +let g:netrw_dirhist_2='/a/.vim' diff --git a/.vim/after/syntax/c.vim b/.vim/after/syntax/c.vim new file mode 100644 index 0000000..5988183 --- /dev/null +++ b/.vim/after/syntax/c.vim @@ -0,0 +1,3 @@ +if exists("cpre") + syn region c_Preprocessor_Conditional_Fold fold transparent start="^\s*#\s*if\|^\s*#\s*else" end="^\s*#\s*else\>\&\|^\s*#\s*endif\>" +endif diff --git a/.vim/autoload/SyntaxAttr.vim b/.vim/autoload/SyntaxAttr.vim new file mode 100644 index 0000000..81a8b0b --- /dev/null +++ b/.vim/autoload/SyntaxAttr.vim @@ -0,0 +1,65 @@ +" EXAMPLE SETUP +" +" Show the syntax group name of the item under cursor. +" map -a :call SyntaxAttr() + +function! SyntaxAttr() + let synid = "" + let guifg = "" + let guibg = "" + let gui = "" + + let id1 = synID(line("."), col("."), 1) + let tid1 = synIDtrans(id1) + + if synIDattr(id1, "name") != "" + let synid = "group: " . synIDattr(id1, "name") + if (tid1 != id1) + let synid = synid . '->' . synIDattr(tid1, "name") + endif + let id0 = synID(line("."), col("."), 0) + if (synIDattr(id1, "name") != synIDattr(id0, "name")) + let synid = synid . " (" . synIDattr(id0, "name") + let tid0 = synIDtrans(id0) + if (tid0 != id0) + let synid = synid . '->' . synIDattr(tid0, "name") + endif + let synid = synid . ")" + endif + endif + + " Use the translated id for all the color & attribute lookups; the linked id yields blank values. + if (synIDattr(tid1, "fg") != "" ) + let guifg = " guifg=" . synIDattr(tid1, "fg") . "(" . synIDattr(tid1, "fg#") . ")" + endif + if (synIDattr(tid1, "bg") != "" ) + let guibg = " guibg=" . synIDattr(tid1, "bg") . "(" . synIDattr(tid1, "bg#") . ")" + endif + if (synIDattr(tid1, "bold" )) + let gui = gui . ",bold" + endif + if (synIDattr(tid1, "italic" )) + let gui = gui . ",italic" + endif + if (synIDattr(tid1, "reverse" )) + let gui = gui . ",reverse" + endif + if (synIDattr(tid1, "inverse" )) + let gui = gui . ",inverse" + endif + if (synIDattr(tid1, "underline")) + let gui = gui . ",underline" + endif + if (gui != "" ) + let gui = substitute(gui, "^,", " gui=", "") + endif + + echohl MoreMsg + let message = synid . guifg . guibg . gui + if message == "" + echohl WarningMsg + let message = "" + endif + echo message + echohl None +endfunction diff --git a/.vim/colors/ir_black.vim b/.vim/colors/ir_black.vim new file mode 100644 index 0000000..6dc402d --- /dev/null +++ b/.vim/colors/ir_black.vim @@ -0,0 +1,212 @@ +" ir_black color scheme +" More at: http://blog.infinitered.com/entries/show/8 + + +" ******************************************************************************** +" Standard colors used in all ir_black themes: +" Note, x:x:x are RGB values +" +" normal: #f6f3e8 +" +" string: #A8FF60 168:255:96 +" string inner (punc, code, etc): #00A0A0 0:160:160 +" number: #FF73FD 255:115:253 +" comments: #7C7C7C 124:124:124 +" keywords: #96CBFE 150:203:254 +" operators: white +" class: #FFFFB6 255:255:182 +" method declaration name: #FFD2A7 255:210:167 +" regular expression: #E9C062 233:192:98 +" regexp alternate: #FF8000 255:128:0 +" regexp alternate 2: #B18A3D 177:138:61 +" variable: #C6C5FE 198:197:254 +" +" Misc colors: +" red color (used for whatever): #FF6C60 255:108:96 +" light red: #FFB6B0 255:182:176 +" +" brown: #E18964 good for special +" +" lightpurpleish: #FFCCFF +" +" Interface colors: +" background color: black +" cursor (where underscore is used): #FFA560 255:165:96 +" cursor (where block is used): white +" visual selection: #1D1E2C +" current line: #151515 21:21:21 +" search selection: #07281C 7:40:28 +" line number: #3D3D3D 61:61:61 + + +" ******************************************************************************** +" The following are the preferred 16 colors for your terminal +" Colors Bright Colors +" Black #4E4E4E #7C7C7C +" Red #FF6C60 #FFB6B0 +" Green #A8FF60 #CEFFAB +" Yellow #FFFFB6 #FFFFCB +" Blue #96CBFE #FFFFCB +" Magenta #FF73FD #FF9CFE +" Cyan #C6C5FE #DFDFFE +" White #EEEEEE #FFFFFF + + +" ******************************************************************************** +set background=dark +hi clear + +if exists("syntax_on") + syntax reset +endif + +let colors_name = "ir_black" + + +"hi Example guifg=NONE guibg=NONE gui=NONE ctermfg=NONE ctermbg=NONE cterm=NONE + +" General colors +hi Normal guifg=#f6f3e8 guibg=black gui=NONE ctermfg=NONE ctermbg=NONE cterm=NONE +hi NonText guifg=#070707 guibg=black gui=NONE ctermfg=black ctermbg=NONE cterm=NONE + +hi Cursor guifg=black guibg=white gui=NONE ctermfg=black ctermbg=white cterm=reverse +hi LineNr guifg=#3D3D3D guibg=black gui=NONE ctermfg=darkgray ctermbg=NONE cterm=NONE + +hi VertSplit guifg=#202020 guibg=#202020 gui=NONE ctermfg=darkgray ctermbg=darkgray cterm=NONE +hi StatusLine guifg=#CCCCCC guibg=#202020 gui=italic ctermfg=white ctermbg=darkgray cterm=NONE +hi StatusLineNC guifg=black guibg=#202020 gui=NONE ctermfg=blue ctermbg=darkgray cterm=NONE + +hi Folded guifg=#a0a8b0 guibg=#384048 gui=NONE ctermfg=NONE ctermbg=NONE cterm=NONE +hi Title guifg=#f6f3e8 guibg=NONE gui=bold ctermfg=NONE ctermbg=NONE cterm=NONE +hi Visual guifg=NONE guibg=#262D51 gui=NONE ctermfg=NONE ctermbg=darkgray cterm=NONE + +hi SpecialKey guifg=#808080 guibg=#343434 gui=NONE ctermfg=NONE ctermbg=NONE cterm=NONE + +hi WildMenu guifg=green guibg=yellow gui=NONE ctermfg=black ctermbg=yellow cterm=NONE +hi PmenuSbar guifg=black guibg=white gui=NONE ctermfg=black ctermbg=white cterm=NONE +"hi Ignore guifg=gray guibg=black gui=NONE ctermfg=NONE ctermbg=NONE cterm=NONE + +hi Error guifg=NONE guibg=NONE gui=undercurl ctermfg=white ctermbg=red cterm=NONE guisp=#FF6C60 " undercurl color +hi ErrorMsg guifg=white guibg=#FF6C60 gui=BOLD ctermfg=white ctermbg=red cterm=NONE +hi WarningMsg guifg=white guibg=#FF6C60 gui=BOLD ctermfg=white ctermbg=red cterm=NONE + +" Message displayed in lower left, such as --INSERT-- +hi ModeMsg guifg=black guibg=#C6C5FE gui=BOLD ctermfg=black ctermbg=cyan cterm=BOLD + +if version >= 700 " Vim 7.x specific colors + hi CursorLine guifg=NONE guibg=#121212 gui=NONE ctermfg=NONE ctermbg=NONE cterm=BOLD + hi CursorColumn guifg=NONE guibg=#121212 gui=NONE ctermfg=NONE ctermbg=NONE cterm=BOLD + hi MatchParen guifg=#f6f3e8 guibg=#857b6f gui=BOLD ctermfg=white ctermbg=darkgray cterm=NONE + hi Pmenu guifg=#f6f3e8 guibg=#444444 gui=NONE ctermfg=NONE ctermbg=NONE cterm=NONE + hi PmenuSel guifg=#000000 guibg=#cae682 gui=NONE ctermfg=NONE ctermbg=NONE cterm=NONE + hi Search guifg=NONE guibg=NONE gui=underline ctermfg=NONE ctermbg=NONE cterm=underline +endif + +" Syntax highlighting +hi Comment guifg=#7C7C7C guibg=NONE gui=NONE ctermfg=darkgray ctermbg=NONE cterm=NONE +hi String guifg=#A8FF60 guibg=NONE gui=NONE ctermfg=green ctermbg=NONE cterm=NONE +hi Number guifg=#FF73FD guibg=NONE gui=NONE ctermfg=magenta ctermbg=NONE cterm=NONE + +hi Keyword guifg=#96CBFE guibg=NONE gui=NONE ctermfg=blue ctermbg=NONE cterm=NONE +hi PreProc guifg=#96CBFE guibg=NONE gui=NONE ctermfg=blue ctermbg=NONE cterm=NONE +hi Conditional guifg=#6699CC guibg=NONE gui=NONE ctermfg=blue ctermbg=NONE cterm=NONE " if else end + +hi Todo guifg=#8f8f8f guibg=NONE gui=NONE ctermfg=red ctermbg=NONE cterm=NONE +hi Constant guifg=#99CC99 guibg=NONE gui=NONE ctermfg=cyan ctermbg=NONE cterm=NONE + +hi Identifier guifg=#C6C5FE guibg=NONE gui=NONE ctermfg=cyan ctermbg=NONE cterm=NONE +hi Function guifg=#FFD2A7 guibg=NONE gui=NONE ctermfg=brown ctermbg=NONE cterm=NONE +hi Type guifg=#FFFFB6 guibg=NONE gui=NONE ctermfg=yellow ctermbg=NONE cterm=NONE +hi Statement guifg=#6699CC guibg=NONE gui=NONE ctermfg=lightblue ctermbg=NONE cterm=NONE + +hi Special guifg=#E18964 guibg=NONE gui=NONE ctermfg=white ctermbg=NONE cterm=NONE +hi Delimiter guifg=#00A0A0 guibg=NONE gui=NONE ctermfg=cyan ctermbg=NONE cterm=NONE +hi Operator guifg=white guibg=NONE gui=NONE ctermfg=white ctermbg=NONE cterm=NONE + +hi link Character Constant +hi link Boolean Constant +hi link Float Number +hi link Repeat Statement +hi link Label Statement +hi link Exception Statement +hi link Include PreProc +hi link Define PreProc +hi link Macro PreProc +hi link PreCondit PreProc +hi link StorageClass Type +hi link Structure Type +hi link Typedef Type +hi link Tag Special +hi link SpecialChar Special +hi link SpecialComment Special +hi link Debug Special + + +" Special for Ruby +hi rubyRegexp guifg=#B18A3D guibg=NONE gui=NONE ctermfg=brown ctermbg=NONE cterm=NONE +hi rubyRegexpDelimiter guifg=#FF8000 guibg=NONE gui=NONE ctermfg=brown ctermbg=NONE cterm=NONE +hi rubyEscape guifg=white guibg=NONE gui=NONE ctermfg=cyan ctermbg=NONE cterm=NONE +hi rubyInterpolationDelimiter guifg=#00A0A0 guibg=NONE gui=NONE ctermfg=blue ctermbg=NONE cterm=NONE +hi rubyControl guifg=#6699CC guibg=NONE gui=NONE ctermfg=blue ctermbg=NONE cterm=NONE "and break, etc +"hi rubyGlobalVariable guifg=#FFCCFF guibg=NONE gui=NONE ctermfg=lightblue ctermbg=NONE cterm=NONE "yield +hi rubyStringDelimiter guifg=#336633 guibg=NONE gui=NONE ctermfg=lightgreen ctermbg=NONE cterm=NONE +"rubyInclude +"rubySharpBang +"rubyAccess +"rubyPredefinedVariable +"rubyBoolean +"rubyClassVariable +"rubyBeginEnd +"rubyRepeatModifier +"hi link rubyArrayDelimiter Special " [ , , ] +"rubyCurlyBlock { , , } + +hi link rubyClass Keyword +hi link rubyModule Keyword +hi link rubyKeyword Keyword +hi link rubyOperator Operator +hi link rubyIdentifier Identifier +hi link rubyInstanceVariable Identifier +hi link rubyGlobalVariable Identifier +hi link rubyClassVariable Identifier +hi link rubyConstant Type + + +" Special for Java +" hi link javaClassDecl Type +hi link javaScopeDecl Identifier +hi link javaCommentTitle javaDocSeeTag +hi link javaDocTags javaDocSeeTag +hi link javaDocParam javaDocSeeTag +hi link javaDocSeeTagParam javaDocSeeTag + +hi javaDocSeeTag guifg=#CCCCCC guibg=NONE gui=NONE ctermfg=darkgray ctermbg=NONE cterm=NONE +hi javaDocSeeTag guifg=#CCCCCC guibg=NONE gui=NONE ctermfg=darkgray ctermbg=NONE cterm=NONE +"hi javaClassDecl guifg=#CCFFCC guibg=NONE gui=NONE ctermfg=white ctermbg=NONE cterm=NONE + + +" Special for XML +hi link xmlTag Keyword +hi link xmlTagName Conditional +hi link xmlEndTag Identifier + + +" Special for HTML +hi link htmlTag Keyword +hi link htmlTagName Conditional +hi link htmlEndTag Identifier + + +" Special for Javascript +hi link javaScriptNumber Number + + +" Special for Python +"hi link pythonEscape Keyword + + +" Special for CSharp +hi link csXmlTag Keyword + + +" Special for PHP diff --git a/.vim/colors/leo.vim b/.vim/colors/leo.vim new file mode 100644 index 0000000..7d47ce1 --- /dev/null +++ b/.vim/colors/leo.vim @@ -0,0 +1,115 @@ +" Vim color file +" Maintainer: Lorenzo Leonini +" Last Change: 2008 Aug 13 +" URL: http://www.leonini.net + +" Description: +" A colored, contrasted theme for long programming sessions. +" For 256-colors term (xterm, Eterm, konsole, gnome-terminal, ...) +" Very good with Ruby, C, Lua, PHP, ... (but no language specific settings) + +" Note: +" If your term report 8 colors (but is 256 capable), put 'set t_Co=256' +" in your .vimrc + +" Tips: +" :verbose hi StatusLine +" Color numbers (0-255) see: +" http://www.calmar.ws/vim/256-xterm-24bit-rgb-color-chart.html + +if !has("gui_running") + if &t_Co != 256 + echomsg "err: Please use a 256-colors terminal (so that t_Co=256 could be set)." + echomsg "" + finish + end +endif + +let g:colors_name = "leo256" + +set background=dark +if v:version > 580 + highlight clear + if exists("syntax_on") + syntax reset + endif +endif + +hi Normal cterm=none ctermfg=255 ctermbg=16 guibg=#000000 guifg=#ffffff +hi CursorLine cterm=none ctermbg=233 guibg=#121212 +hi DiffAdd cterm=none ctermbg=235 +hi DiffChange cterm=none ctermbg=235 +hi DiffDelete cterm=none ctermfg=238 ctermbg=244 +hi DiffText cterm=bold ctermfg=255 ctermbg=196 +hi Directory cterm=none ctermfg=196 +hi ErrorMsg cterm=none ctermfg=255 ctermbg=160 +hi FoldColumn cterm=none ctermfg=110 ctermbg=16 guibg=#000000 +hi SignColumn cterm=none ctermfg=none ctermbg=16 guibg=#000000 +hi Folded cterm=none ctermfg=16 ctermbg=110 guifg=#000000 guibg=#87afd7 +hi IncSearch cterm=reverse +hi LineNr cterm=none ctermfg=124 guifg=#af0000 +hi ModeMsg cterm=bold +hi MoreMsg cterm=none ctermfg=40 +hi NonText cterm=none ctermfg=27 +hi Question cterm=none ctermfg=40 +hi Search cterm=none ctermfg=16 ctermbg=248 guifg=#000000 guibg=#a8a8a8 +hi SpecialKey cterm=none ctermfg=124 guifg=#af0000 +" grey style +"hi StatusLine cterm=none ctermfg=16 ctermbg=252 +"hi StatusLineNC cterm=none ctermfg=246 ctermbg=235 +" blue style +hi StatusLine cterm=none ctermfg=255 ctermbg=21 guibg=#FFFFFF guifg=#0000FF +hi StatusLineNC cterm=none ctermfg=252 ctermbg=17 guibg=#dddddd guifg=#0000aa +hi Title cterm=none ctermfg=33 +hi VertSplit cterm=none ctermfg=254 ctermbg=16 guibg=#EEEEEE guifg=#000000 +hi Visual cterm=reverse ctermbg=none +hi VisualNOS cterm=underline,bold +hi WarningMsg cterm=none ctermfg=255 +hi WildMenu cterm=none ctermfg=16 ctermbg=11 + +if v:version >= 700 + " light + "hi Pmenu cterm=none ctermfg=16 ctermbg=252 + "hi PmenuSel cterm=none ctermfg=255 ctermbg=21 + "hi PmenuSbar cterm=none ctermfg=240 ctermbg=240 + "hi PmenuThumb cterm=none ctermfg=255 ctermbg=255 + + "dark + hi Pmenu cterm=none ctermfg=255 ctermbg=235 guibg=#222222 guifg=#eeeeee + hi PmenuSel cterm=none ctermfg=255 ctermbg=21 guibg=#3333ff + hi PmenuSbar cterm=none ctermfg=240 ctermbg=240 guibg=#444444 + hi PmenuThumb cterm=none ctermfg=255 ctermbg=255 + + hi SpellBad cterm=none ctermfg=16 ctermbg=196 + hi SpellCap cterm=none ctermfg=16 ctermbg=196 + hi SpellLocal cterm=none ctermfg=16 ctermbg=196 + hi SpellRare cterm=none ctermfg=16 ctermbg=196 + hi TabLine cterm=none ctermfg=252 ctermbg=17 + hi TabLineSel cterm=none ctermfg=255 ctermbg=21 + hi TabLineFill cterm=none ctermfg=17 ctermbg=17 +endif + +hi Boolean cterm=none ctermfg=135 guifg=#af5fff +hi Character cterm=none ctermfg=184 +hi Comment cterm=none ctermfg=247 guifg=#A5A5A5 +hi Constant cterm=none ctermfg=226 guifg=#ffff00 +hi Conditional cterm=none ctermfg=154 guifg=#afff00 +hi Define cterm=bold ctermfg=27 guifg=#005fff +hi Delimiter cterm=none ctermfg=196 guifg=#af0000 +hi Exception cterm=bold ctermfg=226 guifg=#ffff00 +hi Error cterm=none ctermfg=255 ctermbg=9 +hi Keyword cterm=none ctermfg=159 guifg=#d7af00 +hi Function cterm=none ctermfg=red guifg=#ff0000 +hi Identifier cterm=none ctermfg=27 guifg=#005fff +hi Number cterm=none ctermfg=135 guifg=#af5fff +hi Operator cterm=none ctermfg=11 +hi PreProc cterm=none ctermfg=202 guifg=#ff5f00 +hi Special cterm=none ctermfg=206 ctermbg=234 guifg=#ff5fd7 +hi Statement cterm=none ctermfg=2 guifg=#00cd00 +hi String cterm=none ctermfg=224 ctermbg=234 guifg=#ffd7d7 guibg=#1c1c1c +hi Todo cterm=none ctermfg=0 ctermbg=11 guifg=#000000 guibg=#ffff00 +hi Type cterm=none ctermfg=75 guifg=#5fafff + +" ADDITIONNAL + +hi Repeat cterm=none ctermfg=142 guifg=#878700 diff --git a/.vim/colors/metacosm.vim b/.vim/colors/metacosm.vim new file mode 100644 index 0000000..c3f8848 Binary files /dev/null and b/.vim/colors/metacosm.vim differ diff --git a/.vim/colors/nightsky.vim b/.vim/colors/nightsky.vim new file mode 100644 index 0000000..4d0e247 --- /dev/null +++ b/.vim/colors/nightsky.vim @@ -0,0 +1,147 @@ +" Vim color file based on nightsky +" Maintainer: Ian Kelling +" Last Change: + + +" cool help screens +" :he group-name +" :he highlight-groups +" :he cterm-colors + +set background=dark +hi clear +if exists("syntax_on") + syntax reset +endif +let g:colors_name="northsky" + + +" Search & normal +hi Normal guifg=#eeeeee guibg=black +hi Search guibg=#3D5B8C guifg=yellow gui=bold +hi IncSearch guifg=bg guibg=cyan gui=bold +if &t_Co == "256" + hi Normal ctermfg=255 ctermbg=16 + hi Search ctermfg=226 ctermbg=60 + hi IncSearch ctermfg=16 ctermbg=51 +else + hi Normal ctermfg=lightgray ctermbg=black + hi Search ctermbg=darkblue ctermfg=yellow + hi IncSearch ctermfg=bg ctermbg=cyan +endif + +" highlight groups +hi Cursor guifg=bg guibg=fg +hi VertSplit guibg=#C0FFFF guifg=#075554 gui=none +hi Folded guifg=plum1 guibg=#061A3E +hi FoldColumn guibg=#800080 guifg=tan +hi ModeMsg guifg=#404040 guibg=#C0C0C0 +hi MoreMsg guifg=darkturquoise guibg=#188F90 +hi NonText guibg=#191919 guifg=#9FADC5 +hi Question guifg=#F4BB7E +hi SpecialKey guifg=#BF9261 +hi StatusLine guibg=#222222 guifg=#b0b0b0 gui=none +hi StatusLineNC guibg=#001111 guifg=DimGrey gui=none +hi Title guifg=#8DB8C3 +hi Visual gui=bold guifg=black guibg=#84AF84 +hi WarningMsg guifg=#F60000 gui=underline +if &t_Co == "256" + hi Cursor ctermfg=254 ctermbg=166 + hi VertSplit ctermfg=23 ctermbg=159 + hi Folded ctermfg=219 ctermbg=17 + hi FoldColumn ctermfg=180 ctermbg=90 + hi ModeMsg ctermfg=238 ctermbg=250 + hi MoreMsg ctermfg=44 ctermbg=30 + hi NonText ctermfg=146 ctermbg=234 + hi Question ctermfg=216 + hi SpecialKey ctermfg=137 + hi StatusLine ctermfg=145 ctermbg=235 + hi StatusLineNC ctermfg=242 ctermbg=16 + hi Title ctermfg=109 + hi Visual ctermfg=16 ctermbg=108 + hi WarningMsg ctermfg=196 +else + hi Cursor ctermfg=white ctermbg=red + hi VertSplit ctermfg=darkblue ctermbg=cyan + hi Folded ctermfg=lightmagenta ctermbg=bg + hi FoldColumn ctermfg=lightgray ctermbg=darkmagenta + hi ModeMsg ctermfg=black ctermbg=gray + hi MoreMsg ctermfg=cyan ctermbg=darkcyan + hi NonText ctermfg=gray ctermbg=darkgrey + hi Question ctermfg=yellow + hi SpecialKey ctermfg=brown + hi StatusLine ctermfg=lightgray ctermbg=darkgray + hi StatusLineNC ctermfg=darkgray ctermbg=black + hi Title ctermfg=blue + hi Visual ctermfg=black ctermbg=darkgreen + hi WarningMsg ctermfg=red +endif + +" syntax highlighting groups +hi Comment guifg=DarkGray +hi Constant guifg=#72A5E4 gui=bold +hi Number guifg=chartreuse2 gui=bold +hi Identifier guifg=#ADCBF1 +hi Statement guifg=yellow +hi PreProc guifg=#14967C +hi Type guifg=#FFAE66 +hi Special guifg=#EEBABA +hi Ignore guifg=grey60 +hi Todo guibg=#9C8C84 guifg=#244C0A +hi Label guifg=#ffc0c0 +if &t_Co == "256" + hi Comment ctermfg=248 + hi Constant ctermfg=74 + hi Number ctermfg=118 + hi Identifier ctermfg=153 + hi Statement ctermfg=226 + hi PreProc ctermfg=30 + hi Type ctermfg=215 + hi Special ctermfg=217 + hi Ignore ctermfg=246 + hi Todo ctermfg=22 ctermbg=138 + hi Label ctermfg=217 +else + hi Comment ctermfg=darkgray + hi Constant ctermfg=lightcyan + hi Number ctermfg=green + hi Identifier ctermfg=gray + hi Statement ctermfg=yellow + hi PreProc ctermfg=darkgreen + hi Type ctermfg=white "brown + hi Special ctermfg=brown "darkmagenta + hi Ignore ctermfg=gray + hi Todo ctermfg=darkblue ctermbg=darkgray + hi Label ctermfg=darkmagenta +endif + +" Vim defaults +hi ErrorMsg guifg=White guibg=Red +hi DiffAdd guibg=DarkBlue +hi DiffChange guibg=aquamarine4 +hi DiffDelete gui=bold guifg=Yellow guibg=DarkBlue +hi DiffText gui=bold guibg=#940303 +hi Directory guifg=Cyan +hi LineNr guifg=DarkGreen +hi WildMenu guifg=Black guibg=Yellow +hi lCursor guibg=SeaGreen1 guifg=NONE +hi Underlined gui=underline guifg=#80a0ff +hi Error guifg=White guibg=Red +if &t_Co == "256" + hi ErrorMsg ctermfg=231 ctermbg=196 + hi DiffAdd ctermbg=18 + hi DiffChange ctermbg=66 + hi DiffDelete ctermfg=226 ctermbg=18 + hi DiffText ctermbg=88 + hi Directory ctermfg=51 + hi LineNr ctermfg=22 + hi WildMenu ctermfg=16 ctermbg=226 + hi lCursor ctermbg=85 + hi Underlined ctermfg=111 + hi Error ctermfg=231 ctermbg=196 +else + hi lCursor ctermbg=lightgreen ctermfg=NONE +endif + + +" vim:sw=4 ts=4 sts=4 diff --git a/.vim/colors/refactor.vim b/.vim/colors/refactor.vim new file mode 100644 index 0000000..c01b060 --- /dev/null +++ b/.vim/colors/refactor.vim @@ -0,0 +1,84 @@ +set background=dark +hi clear +if exists("syntax_on") + syntax reset +endif +let g:colors_name = "RefractorMyCode" + +hi Comment guifg=#80a0ff +hi Constant guifg=#527023 +hi Cursor gui=bold guifg=black guibg=green +hi CursorColumn guibg=gray40 +hi CursorIM gui=None +hi CursorLine guibg=gray40 +hi DiffAdd guibg=darkblue +hi DiffChange guibg=darkmagenta +hi DiffDelete gui=bold guifg=blue guibg=darkcyan +hi DiffText gui=bold guibg=red +hi Directory guifg=cyan +hi Error guifg=white guibg=red +hi ErrorMsg guifg=white guibg=red +hi FoldColumn guifg=#3387CC guibg=grey +hi Folded guifg=#0a1926 guibg=darkgray +hi Identifier guifg=#40ffff +hi Ignore guifg=black +hi IncSearch gui=reverse +hi LineNr guifg=gray40 +hi MatchParen guibg=darkcyan +hi ModeMsg gui=bold +hi MoreMsg gui=bold guifg=seagreen +hi NonText gui=bold guifg=#cc0099 +hi Normal guifg=gray80 guibg=black +hi Pmenu guibg=magenta +hi PmenuSbar guibg=grey +hi PmenuSel guibg=darkgray +hi PmenuThumb gui=reverse +hi PreProc guifg=#AFC4DB +hi Question gui=bold guifg=green +hi Search gui=bold guifg=black guibg=red +hi SignColumn guifg=cyan guibg=grey +hi Special guifg=orange +hi SpecialKey guifg=cyan +hi SpellBad gui=undercurl +hi SpellCap gui=undercurl +hi SpellLocal gui=undercurl +hi SpellRare gui=undercurl +hi Statement guifg=#E28964 +hi StatusLine gui=bold,reverse guifg=#3387CC guibg=white +hi StatusLineNC gui=reverse +hi TabLine guifg=black guibg=darkgray +hi TabLineFill gui=reverse +hi TabLineSel gui=bold +hi Title gui=bold guifg=magenta +hi Todo gui=italic guifg=black guibg=yellow +hi Type guifg=#99CF50 +hi Underlined gui=underline guifg=#80a0ff +hi VertSplit gui=reverse +hi Visual gui=bold guifg=gray25 guibg=darkgray +hi VisualNOS gui=bold,underline +hi WarningMsg guifg=red +hi WildMenu guifg=black guibg=yellow +hi link Boolean Constant +hi link Character Constant +hi link Conditional Statement +hi link Debug Special +hi link Define PreProc +hi link Delimiter Special +hi link Exception Statement +hi link Float Constant +hi link Function Identifier +hi link Include PreProc +hi link Keyword Statement +hi link Label Statement +hi link Macro PreProc +hi link Number Constant +hi link Operator Statement +hi link PreCondit PreProc +hi link Repeat Statement +hi link SpecialChar Special +hi link SpecialComment Special +hi link StorageClass Type +hi link String Constant +hi link Structure Type +hi link Tag Special +hi link Typedef Type diff --git a/.vim/colors/vividchalk.vim b/.vim/colors/vividchalk.vim new file mode 100644 index 0000000..d628807 Binary files /dev/null and b/.vim/colors/vividchalk.vim differ diff --git a/.vim/doc/bufexplorer.txt b/.vim/doc/bufexplorer.txt new file mode 100644 index 0000000..1a909a4 --- /dev/null +++ b/.vim/doc/bufexplorer.txt @@ -0,0 +1,407 @@ +*bufexplorer.txt* Buffer Explorer Last Change: 21 Dec 2007 + +Buffer Explorer *buffer-explorer* *bufexplorer* + Version 7.1.7 + +Plugin for easily exploring (or browsing) Vim |:buffers|. + +|bufexplorer-usage| Usage +|bufexplorer-installation| Installation +|bufexplorer-customization| Customization +|bufexplorer-changelog| Change Log +|bufexplorer-todo| Todo +|bufexplorer-credits| Credits + +For Vim version 7.0 and above. +This plugin is only available if 'compatible' is not set. + +{Vi does not have any of this} + +============================================================================== +INSTALLATION *bufexplorer-installation* + +To install: + - Download the bufexplorer.zip. + - Extract the zip archive into your runtime directory. + The archive contains plugin/bufexplorer.vim, and doc/bufexplorer.txt. + - Start Vim or goto an existing instance of Vim. + - Execute the following command: +> + :helptag + + \be OR :BufExplorer + +If you would like to use something other than '\', you may simply change the +leader (see |mapleader|). + +Note: If the current buffer is modified when bufexplorer started, the current + window is always split and the new bufexplorer is displayed in that new + window. + +Commands to use once exploring: + + Opens the buffer that is under the cursor into the current + window. + Toggle help information. + Opens the buffer that is under the cursor into the current + window. + Opens the buffer that is under the cursor in another tab. + d |:wipeout| the buffer under the cursor from the list. + When a buffers is wiped, it will not be shown when unlisted + buffer are displayed. + D |:delete| the buffer under the cursor from the list. + The buffer's 'buflisted' is cleared. This allows for the buffer + to be displayed again using the 'show unlisted' command. + f Toggles whether you are taken to the active window when + selecting a buffer or not. + p Toggles the showing of a split filename/pathname. + q Quit exploring. + r Reverses the order the buffers are listed in. + R Toggles relative path/absolute path. + s Selects the order the buffers are listed in. Either by buffer + number, file name, file extension, most recently used (MRU), or + full path. + t Opens the buffer that is under the cursor in another tab. + u Toggles the showing of "unlisted" buffers. + +Once invoked, Buffer Explorer displays a sorted list (MRU is the default +sort method) of all the buffers that are currently opened. You are then +able to move the cursor to the line containing the buffer's name you are +wanting to act upon. Once you have selected the buffer you would like, +you can then either open it, close it(delete), resort the list, reverse +the sort, quit exploring and so on... + +=============================================================================== +CUSTOMIZATION *bufexplorer-customization* + + *g:bufExplorerDefaultHelp* +To control whether the default help is displayed or not, use: > + let g:bufExplorerDefaultHelp=0 " Do not show default help. + let g:bufExplorerDefaultHelp=1 " Show default help. +The default is to show the default help. + + *g:bufExplorerDetailedHelp* +To control whether detailed help is display by, use: > + let g:bufExplorerDetailedHelp=0 " Do not show detailed help. + let g:bufExplorerDetailedHelp=1 " Show detailed help. +The default is NOT to show detailed help. + + *g:bufExplorerFindActive* +To control whether you are taken to the active window when selecting a buffer, +use: > + let g:bufExplorerFindActive=0 " Do not go to active window. + let g:bufExplorerFindActive=1 " Go to active window. +The default is to be taken to the active window. + + *g:bufExplorerReverseSort* +To control whether to sort the buffer in reverse order or not, use: > + let g:bufExplorerReverseSort=0 " Do not sort in reverse order. + let g:bufExplorerReverseSort=1 " Sort in reverse order. +The default is NOT to sort in reverse order. + + *g:bufExplorerShowDirectories* +Directories usually show up in the list from using a command like ":e .". +To control whether to show directories in the buffer list or not, use: > + let g:bufExplorerShowDirectories=1 " Show directories. + let g:bufExplorerShowDirectories=0 " Don't show directories. +The default is to show directories. + + *g:bufExplorerShowRelativePath* +To control whether to show absolute paths or relative to the current +directory, use: > + let g:bufExplorerShowRelativePath=0 " Show absolute paths. + let g:bufExplorerShowRelativePath=1 " Show relative paths. +The default is to show absolute paths. + + *g:bufExplorerShowUnlisted* +To control whether to show unlisted buffer or not, use: > + let g:bufExplorerShowUnlisted=0 " Do not show unlisted buffers. + let g:bufExplorerShowUnlisted=1 " Show unlisted buffers. +The default is to NOT show unlisted buffers. + + *g:bufExplorerSortBy* +To control what field the buffers are sorted by, use: > + let g:bufExplorerSortBy='extension' " Sort by file extension. + let g:bufExplorerSortBy='fullpath' " Sort by full file path name. + let g:bufExplorerSortBy='mru' " Sort by most recently used. + let g:bufExplorerSortBy='name' " Sort by the buffer's name. + let g:bufExplorerSortBy='number' " Sort by the buffer's number. +The default is to sort by mru. + + *g:bufExplorerSplitOutPathName* +To control whether to split out the path and file name or not, use: > + let g:bufExplorerSplitOutPathName=1 " Split the path and file name. + let g:bufExplorerSplitOutPathName=0 " Don't split the path and file + " name. +The default is to split the path and file name. + +=============================================================================== +CHANGE LOG *bufexplorer-changelog* + +7.1.7 - Fixes: + * TaCahiroy fixed several issues related to opening a buffer in a + tab. +7.1.6 - Fixes: + * Removed ff=unix from modeline in bufexplorer.txt. Found by Bill + McCarthy. +7.1.5 - Fixes: + * Could not open unnamed buffers. Fixed by TaCahiroy. +7.1.4 - Fixes: + * Sometimes when a file's path has 'white space' in it, extra buffers + would be created containing each piece of the path. i.e: + opening c:\document and settings\test.txt would create a buffer + named "and" and a buffer named "Documents". This was reported and + fixed by TaCa Yoss. +7.1.3 - Fixes: + * Added code to allow only one instance of the plugin to run at a + time. Thanks Dennis Hostetler. +7.1.2 - Fixes: + * Fixed a jumplist issue spotted by JiangJun. I overlooked the + 'jumplist' and with a couple calls to 'keepjumps', everything is + fine again. + * Went back to just having a plugin file, no autoload file. By having + the autoload, WinManager was no longer working and without really + digging into the cause, it was easier to go back to using just a + plugin file. +7.1.1 - Fixes: + * A problem spotted by Thomas Arendsen Hein. + When running Vim (7.1.94), error E493 was being thrown. + Enhancements: + * Added 'D' for 'delete' buffer as the 'd' command was a 'wipe' + buffer. +7.1.0 - Another 'major' update, some by Dave Larson, some by me. + * Making use of 'autoload' now to make the plugin load quicker. + * Removed '\bs' and '\bv'. These are now controlled by the user. The + user can issue a ':sp' or ':vs' to create a horizontal or vertical + split window and then issue a '\be' + * Added handling of tabs. +7.0.17 - Fixed issue with 'drop' command. + Various enhancements and improvements. +7.0.16 - Fixed issue reported by Liu Jiaping on non Windows systems, which was + ... + Open file1, open file2, modify file1, open bufexplorer, you get the + following error: + + --------8<-------- + Error detected while processing function + 14_StartBufExplorer..14_SplitOpen: + line 4: + E37: No write since last change (add ! to override) + + But the worse thing is, when I want to save the current buffer and + type ':w', I get another error message: + E382: Cannot write, 'buftype' option is set + --------8<-------- + +7.0.15 - Thanks to Mark Smithfield for suggesting bufexplorer needed to handle + the ':args' command. +7.0.14 - Thanks to Randall Hansen for removing the requirement of terminal + versions to be recompiled with 'gui' support so the 'drop' command + would work. The 'drop' command is really not needed in terminal + versions. +7.0.13 - Fixed integration with WinManager. + Thanks to Dave Eggum for another update. + - Fix: The detailed help didn't display the mapping for toggling + the split type, even though the split type is displayed. + - Fixed incorrect description in the detailed help for toggling + relative or full paths. + - Deprecated s:ExtractBufferNbr(). Vim's str2nr() does the same + thing. + - Created a s:Set() function that sets a variable only if it hasn't + already been defined. It's useful for initializing all those + default settings. + - Removed checks for repetitive command definitions. They were + unnecessary. + - Made the help highlighting a little more fancy. + - Minor reverse compatibility issue: Changed ambiguous setting + names to be more descriptive of what they do (also makes the code + easier to follow): + Changed bufExplorerSortDirection to bufExplorerReverseSort + Changed bufExplorerSplitType to bufExplorerSplitVertical + Changed bufExplorerOpenMode to bufExplorerUseCurrentWindow + - When the BufExplorer window closes, all the file-local marks are + now deleted. This may have the benefit of cleaning up some of the + jumplist. + - Changed the name of the parameter for StartBufExplorer from + "split" to "open". The parameter is a string which specifies how + the buffer will be open, not if it is split or not. + - Deprecated DoAnyMoreBuffersExist() - it is a one line function + only used in one spot. + - Created four functions (SplitOpen(), RebuildBufferList(), + UpdateHelpStatus() and ReSortListing()) all with one purpose - to + reduce repeated code. + - Changed the name of AddHeader() to CreateHelp() to be more + descriptive of what it does. It now returns an array instead of + updating the window directly. This has the benefit of making the + code more efficient since the text the function returns is used a + little differently in the two places the function is called. + - Other minor simplifications. +7.0.12 - MAJOR Update. + This version will ONLY run with Vim version 7.0 or greater. + Dave Eggum has made some 'significant' updates to this latest + version: + - Added BufExplorerGetAltBuf() global function to be used in the + user’s rulerformat. + - Added g:bufExplorerSplitRight option. + - Added g:bufExplorerShowRelativePath option with mapping. + - Added current line highlighting. + - The split type can now be changed whether bufexplorer is opened + in split mode or not. + - Various major and minor bug fixes and speed improvements. + - Sort by extension. + Other improvements/changes: + - Changed the help key from '?' to to be more 'standard'. + - Fixed splitting of vertical bufexplorer window. + Hopefully I have not forgot something :) +7.0.11 - Fixed a couple of highlighting bugs, reported by David Eggum. He also + changed passive voice to active on a couple of warning messages. +7.0.10 - Fixed bug report by Xiangjiang Ma. If the 'ssl' option is set, + the slash character used when displaying the path was incorrect. +7.0.9 - Martin Grenfell found and eliminated an annoying bug in the + bufexplorer/winmanager integration. The bug was were an + annoying message would be displayed when a window was split or + a new file was opened in a new window. Thanks Martin! +7.0.8 - Thanks to Mike Li for catching a bug in the WinManager integration. + The bug was related to the incorrect displaying of the buffer + explorer's window title. +7.0.7 - Thanks to Jeremy Cowgar for adding a new enhancement. This + enhancement allows the user to press 'S', that is capital S, which + will open the buffer under the cursor in a newly created split + window. +7.0.6 - Thanks to Larry Zhang for finding a bug in the "split" buffer code. + If you force set g:bufExplorerSplitType='v' in your vimrc, and if you + tried to do a \bs to split the bufexplorer window, it would always + split horizontal, not vertical. He also found that I had a typeo in + that the variable g:bufExplorerSplitVertSize was all lower case in + the documentation which was incorrect. +7.0.5 - Thanks to Mun Johl for pointing out a bug that if a buffer was + modified, the '+' was not showing up correctly. +7.0.4 - Fixed a problem discovered first by Xiangjiang Ma. Well since I've + been using vim 7.0 and not 6.3, I started using a function (getftype) + that is not in 6.3. So for backward compatibility, I conditionaly use + this function now. Thus, the g:bufExplorerShowDirectories feature is + only available when using vim 7.0 and above. +7.0.3 - Thanks to Erwin Waterlander for finding a problem when the last + buffer was deleted. This issue got me to rewrite the buffer display + logic (which I've wanted to do for sometime now). + Also great thanks to Dave Eggum for coming up with idea for + g:bufExplorerShowDirectories. Read the above information about this + feature. +7.0.2 - Thanks to Thomas Arendsen Hein for finding a problem when a user + has the default help turned off and then brought up the explorer. An + E493 would be displayed. +7.0.1 - Thanks to Erwin Waterlander for finding a couple problems. + The first problem allowed a modified buffer to be deleted. Opps! The + second problem occurred when several files were opened, BufExplorer + was started, the current buffer was deleted using the 'd' option, and + then BufExplorer was exited. The deleted buffer was still visible + while it is not in the buffers list. Opps again! +7.0.0 - Thanks to Shankar R. for suggesting to add the ability to set + the fixed width (g:bufExplorerSplitVertSize) of a new window + when opening bufexplorer vertically and fixed height + (g:bufExplorerSplitHorzSize) of a new window when opening + bufexplorer horizontally. By default, the windows are normally + split to use half the existing width or height. +6.3.0 - Added keepjumps so that the jumps list would not get cluttered with + bufexplorer related stuff. +6.2.3 - Thanks to Jay Logan for finding a bug in the vertical split position + of the code. When selecting that the window was to be split + vertically by doing a '\bv', from then on, all splits, i.e. '\bs', + were split vertically, even though g:bufExplorerSplitType was not set + to 'v'. +6.2.2 - Thanks to Patrik Modesto for adding a small improvement. For some + reason his bufexplorer window was always showing up folded. He added + 'setlocal nofoldenable' and it was fixed. +6.2.1 - Thanks goes out to Takashi Matsuo for added the 'fullPath' sorting + logic and option. +6.2.0 - Thanks goes out to Simon Johann-Ganter for spotting and fixing a + problem in that the last search pattern is overridden by the search + pattern for blank lines. +6.1.6 - Thanks to Artem Chuprina for finding a pesky bug that has been around + for sometime now. The key mapping was causing the buffer + explored to close prematurely when vim was run in an xterm. The + key mapping is now removed. +6.1.5 - Thanks to Khorev Sergey. Added option to show default help or not. +6.1.4 - Thanks goes out to Valery Kondakoff for suggesting the addition of + setlocal nonumber and foldcolumn=0. This allows for line numbering + and folding to be turned off temporarily while in the explorer. +6.1.3 - Added folding. Did some code cleanup. Added the ability to force the + newly split window to be temporarily vertical, which was suggested by + Thomas Glanzmann. +6.1.2 - Now pressing the key will quit, just like 'q'. + Added folds to hide winmanager configuration. + If anyone had the 'C' option in their cpoptions they would receive + a E10 error on startup of BufExplorer. cpo is now saved, updated and + restored. Thanks to Charles E Campbell, Jr. + Attempted to make sure there can only be one BufExplorer window open + at a time. +6.1.1 - Thanks to Brian D. Goodwin for adding toupper to FileNameCmp. This + way buffers sorted by name will be in the correct order regardless of + case. +6.0.16 - Thanks to Andre Pang for the original patch/idea to get bufexplorer + to work in insertmode/modeless mode (evim). Added Initialize + and Cleanup autocommands to handle commands that need to be + performed when starting or leaving bufexplorer. +6.0.15 - Srinath Avadhanulax added a patch for winmanager.vim. +6.0.14 - Fix a few more bug that I thought I already had fixed. Thanks + to Eric Bloodworth for adding 'Open Mode/Edit in Place'. Added + vertical splitting. +6.0.13 - Thanks to Charles E Campbell, Jr. for pointing out some embarrassing + typos that I had in the documentation. I guess I need to run + the spell checker more :o) +6.0.12 - Thanks to Madoka Machitani, for the tip on adding the augroup command + around the MRUList autocommands. +6.0.11 - Fixed bug report by Xiangjiang Ma. '"=' was being added to the + search history which messed up hlsearch. +6.0.10 - Added the necessary hooks so that the Srinath Avadhanula's + winmanager.vim script could more easily integrate with this script. + Tried to improve performance. +6.0.9 - Added MRU (Most Recently Used) sort ordering. +6.0.8 - Was not resetting the showcmd command correctly. + Added nifty help file. +6.0.7 - Thanks to Brett Carlane for some great enhancements. Some are added, + some are not, yet. Added highlighting of current and alternate + filenames. Added splitting of path/filename toggle. Reworked + ShowBuffers(). + Changed my email address. +6.0.6 - Copyright notice added. Needed this so that it could be distributed + with Debian Linux. Fixed problem with the SortListing() function + failing when there was only one buffer to display. +6.0.5 - Fixed problems reported by David Pascoe, in that you where unable to + hit 'd' on a buffer that belonged to a files that no longer existed + and that the 'yank' buffer was being overridden by the help text when + the bufexplorer was opened. +6.0.4 - Thanks to Charles Campbell, Jr. for making this plugin more plugin + *compliant*, adding default keymappings of be and bs + as well as fixing the 'w:sortDirLabel not being defined' bug. +6.0.3 - Added sorting capabilities. Sort taken from explorer.vim. +6.0.2 - Can't remember. +6.0.1 - Initial release. + +=============================================================================== +TODO *bufexplorer-todo* + +- The issuing of a ':bd' command does not always remove the buffer number from + the MRU list. +- Look into adding '\bs' (buffer split) command back into the code. + +=============================================================================== +CREDITS *bufexplorer-credits* + +Author: Jeff Lanzarotta + +Credit must go out to Bram Moolenaar and all the Vim developers for +making the world's best editor (IMHO). I also want to thank everyone who +helped and gave me suggestions. I wouldn't want to leave anyone out so I +won't list names. + +=============================================================================== +vim:tw=78:noet:wrap:ts=8:ft=help:norl: diff --git a/.vim/doc/tags b/.vim/doc/tags new file mode 100644 index 0000000..6c0188f --- /dev/null +++ b/.vim/doc/tags @@ -0,0 +1,95 @@ +:CVSEdit vcscommand.txt /*:CVSEdit* +:CVSEditors vcscommand.txt /*:CVSEditors* +:CVSUnedit vcscommand.txt /*:CVSUnedit* +:CVSWatch vcscommand.txt /*:CVSWatch* +:CVSWatchAdd vcscommand.txt /*:CVSWatchAdd* +:CVSWatchOff vcscommand.txt /*:CVSWatchOff* +:CVSWatchOn vcscommand.txt /*:CVSWatchOn* +:CVSWatchRemove vcscommand.txt /*:CVSWatchRemove* +:CVSWatchers vcscommand.txt /*:CVSWatchers* +:VCSAdd vcscommand.txt /*:VCSAdd* +:VCSAnnotate vcscommand.txt /*:VCSAnnotate* +:VCSBlame vcscommand.txt /*:VCSBlame* +:VCSCommit vcscommand.txt /*:VCSCommit* +:VCSDelete vcscommand.txt /*:VCSDelete* +:VCSDiff vcscommand.txt /*:VCSDiff* +:VCSGotoOriginal vcscommand.txt /*:VCSGotoOriginal* +:VCSInfo vcscommand.txt /*:VCSInfo* +:VCSLock vcscommand.txt /*:VCSLock* +:VCSLog vcscommand.txt /*:VCSLog* +:VCSRemove vcscommand.txt /*:VCSRemove* +:VCSRevert vcscommand.txt /*:VCSRevert* +:VCSReview vcscommand.txt /*:VCSReview* +:VCSStatus vcscommand.txt /*:VCSStatus* +:VCSUnlock vcscommand.txt /*:VCSUnlock* +:VCSUpdate vcscommand.txt /*:VCSUpdate* +:VCSVimDiff vcscommand.txt /*:VCSVimDiff* +VCSCommandCVSDiffOpt vcscommand.txt /*VCSCommandCVSDiffOpt* +VCSCommandCVSExec vcscommand.txt /*VCSCommandCVSExec* +VCSCommandCommitOnWrite vcscommand.txt /*VCSCommandCommitOnWrite* +VCSCommandDeleteOnHide vcscommand.txt /*VCSCommandDeleteOnHide* +VCSCommandDiffSplit vcscommand.txt /*VCSCommandDiffSplit* +VCSCommandDisableAll vcscommand.txt /*VCSCommandDisableAll* +VCSCommandDisableExtensionMappings vcscommand.txt /*VCSCommandDisableExtensionMappings* +VCSCommandDisableMappings vcscommand.txt /*VCSCommandDisableMappings* +VCSCommandDisableMenu vcscommand.txt /*VCSCommandDisableMenu* +VCSCommandEdit vcscommand.txt /*VCSCommandEdit* +VCSCommandEnableBufferSetup vcscommand.txt /*VCSCommandEnableBufferSetup* +VCSCommandMapPrefix vcscommand.txt /*VCSCommandMapPrefix* +VCSCommandMappings vcscommand.txt /*VCSCommandMappings* +VCSCommandMenuPriority vcscommand.txt /*VCSCommandMenuPriority* +VCSCommandMenuRoot vcscommand.txt /*VCSCommandMenuRoot* +VCSCommandResultBufferNameExtension vcscommand.txt /*VCSCommandResultBufferNameExtension* +VCSCommandResultBufferNameFunction vcscommand.txt /*VCSCommandResultBufferNameFunction* +VCSCommandSVKExec vcscommand.txt /*VCSCommandSVKExec* +VCSCommandSVNDiffExt vcscommand.txt /*VCSCommandSVNDiffExt* +VCSCommandSVNDiffOpt vcscommand.txt /*VCSCommandSVNDiffOpt* +VCSCommandSVNExec vcscommand.txt /*VCSCommandSVNExec* +VCSCommandSplit vcscommand.txt /*VCSCommandSplit* +VCSCommandVCSTypeOverride vcscommand.txt /*VCSCommandVCSTypeOverride* +b:VCSCommandCommand vcscommand.txt /*b:VCSCommandCommand* +b:VCSCommandOriginalBuffer vcscommand.txt /*b:VCSCommandOriginalBuffer* +b:VCSCommandSourceFile vcscommand.txt /*b:VCSCommandSourceFile* +b:VCSCommandVCSType vcscommand.txt /*b:VCSCommandVCSType* +bufexplorer bufexplorer.txt /*bufexplorer* +bufexplorer-changelog bufexplorer.txt /*bufexplorer-changelog* +bufexplorer-credits bufexplorer.txt /*bufexplorer-credits* +bufexplorer-customization bufexplorer.txt /*bufexplorer-customization* +bufexplorer-installation bufexplorer.txt /*bufexplorer-installation* +bufexplorer-todo bufexplorer.txt /*bufexplorer-todo* +bufexplorer-usage bufexplorer.txt /*bufexplorer-usage* +bufexplorer.txt bufexplorer.txt /*bufexplorer.txt* +buffer-explorer bufexplorer.txt /*buffer-explorer* +cvscommand-changes vcscommand.txt /*cvscommand-changes* +g:bufExplorerDefaultHelp bufexplorer.txt /*g:bufExplorerDefaultHelp* +g:bufExplorerDetailedHelp bufexplorer.txt /*g:bufExplorerDetailedHelp* +g:bufExplorerFindActive bufexplorer.txt /*g:bufExplorerFindActive* +g:bufExplorerReverseSort bufexplorer.txt /*g:bufExplorerReverseSort* +g:bufExplorerShowDirectories bufexplorer.txt /*g:bufExplorerShowDirectories* +g:bufExplorerShowRelativePath bufexplorer.txt /*g:bufExplorerShowRelativePath* +g:bufExplorerShowUnlisted bufexplorer.txt /*g:bufExplorerShowUnlisted* +g:bufExplorerSortBy bufexplorer.txt /*g:bufExplorerSortBy* +g:bufExplorerSplitOutPathName bufexplorer.txt /*g:bufExplorerSplitOutPathName* +vcscommand vcscommand.txt /*vcscommand* +vcscommand-buffer-management vcscommand.txt /*vcscommand-buffer-management* +vcscommand-buffer-variables vcscommand.txt /*vcscommand-buffer-variables* +vcscommand-bugs vcscommand.txt /*vcscommand-bugs* +vcscommand-commands vcscommand.txt /*vcscommand-commands* +vcscommand-config vcscommand.txt /*vcscommand-config* +vcscommand-contents vcscommand.txt /*vcscommand-contents* +vcscommand-customize vcscommand.txt /*vcscommand-customize* +vcscommand-events vcscommand.txt /*vcscommand-events* +vcscommand-install vcscommand.txt /*vcscommand-install* +vcscommand-intro vcscommand.txt /*vcscommand-intro* +vcscommand-manual vcscommand.txt /*vcscommand-manual* +vcscommand-mappings vcscommand.txt /*vcscommand-mappings* +vcscommand-mappings-override vcscommand.txt /*vcscommand-mappings-override* +vcscommand-naming vcscommand.txt /*vcscommand-naming* +vcscommand-options vcscommand.txt /*vcscommand-options* +vcscommand-ssh vcscommand.txt /*vcscommand-ssh* +vcscommand-ssh-config vcscommand.txt /*vcscommand-ssh-config* +vcscommand-ssh-env vcscommand.txt /*vcscommand-ssh-env* +vcscommand-ssh-other vcscommand.txt /*vcscommand-ssh-other* +vcscommand-ssh-wrapper vcscommand.txt /*vcscommand-ssh-wrapper* +vcscommand-statusline vcscommand.txt /*vcscommand-statusline* +vcscommand.txt vcscommand.txt /*vcscommand.txt* diff --git a/.vim/doc/vcscommand.txt b/.vim/doc/vcscommand.txt new file mode 100644 index 0000000..4f38ab1 --- /dev/null +++ b/.vim/doc/vcscommand.txt @@ -0,0 +1,835 @@ +*vcscommand.txt* vcscommand +Copyright (c) Bob Hiestand + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to +deal in the Software without restriction, including without limitation the +rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +sell copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +IN THE SOFTWARE. + +For instructions on installing this file, type + :help add-local-help +inside Vim. + +Author: Bob Hiestand +Credits: Benji Fisher's excellent MatchIt documentation + +============================================================================== +1. Contents *vcscommand-contents* + + Installation : |vcscommand-install| + vcscommand Intro : |vcscommand| + vcscommand Manual : |vcscommand-manual| + Customization : |vcscommand-customize| + SSH "integration" : |vcscommand-ssh| + Changes from cvscommand : |cvscommand-changes| + Bugs : |vcscommand-bugs| + +============================================================================== + +2. vcscommand Installation *vcscommand-install* + +The vcscommand plugin comprises five files: vcscommand.vim, vcssvn.vim, +vcscvs.vim, vcssvk.vim and vcscommand.txt (this file). In order to install +the plugin, place the vcscommand.vim, vcssvn.vim, vcssvk.vim, and vcscvs.vim +files into a plugin directory in your runtime path (please see +|add-global-plugin| and |'runtimepath'|. + +This help file can be included in the VIM help system by copying it into a +'doc' directory in your runtime path and then executing the |:helptags| +command, specifying the full path of the 'doc' directory. Please see +|add-local-help| for more details. + +vcscommand may be customized by setting variables, creating maps, and +specifying event handlers. Please see |vcscommand-customize| for more +details. + +============================================================================== + +3. vcscommand Intro *vcscommand* + *vcscommand-intro* + +The vcscommand plugin provides global ex commands for manipulating +version-controlled source files, currently those controlled either by CVS or +Subversion. In general, each command operates on the current buffer and +accomplishes a separate source control function, such as update, commit, log, +and others (please see |vcscommand-commands| for a list of all available +commands). The results of each operation are displayed in a scratch buffer. +Several buffer variables are defined for those scratch buffers (please see +|vcscommand-buffer-variables|). + +The notion of "current file" means either the current buffer, or, in the case +of a directory buffer (such as Explorer or netrw buffers), the directory (and +all subdirectories) represented by the the buffer. + +For convenience, any vcscommand invoked on a vcscommand scratch buffer acts as +though it was invoked on the original file and splits the screen so that the +output appears in a new window. + +Many of the commands accept revisions as arguments. By default, most operate +on the most recent revision on the current branch if no revision is specified. + +Each vcscommand is mapped to a key sequence starting with the || +keystroke. The default mappings may be overridden by supplying different +mappings before the plugin is loaded, such as in the vimrc, in the standard +fashion for plugin mappings. For examples, please see +|vcscommand-mappings-override|. + +The vcscommand plugin may be configured in several ways. For more details, +please see |vcscommand-customize|. + +============================================================================== + +4. vcscommand Manual *vcscommand-manual* + +4.1 vcscommand commands *vcscommand-commands* + +vcscommand defines the following commands: + +|:VCSAdd| +|:VCSAnnotate| +|:VCSBlame| +|:VCSCommit| +|:VCSDelete| +|:VCSDiff| +|:VCSGotoOriginal| +|:VCSLog| +|:VCSRemove| +|:VCSRevert| +|:VCSReview| +|:VCSStatus| +|:VCSUpdate| +|:VCSVimDiff| + +The following commands are specific to CVS files: + +|:CVSEdit| +|:CVSEditors| +|:CVSUnedit| +|:CVSWatch| +|:CVSWatchAdd| +|:CVSWatchOn| +|:CVSWatchOff| +|:CVSWatchRemove| +|:CVSWatchers| + +:VCSAdd *:VCSAdd* + +This command adds the current file to source control. Please note, this does +not commit the newly-added file. All parameters to the command are passed to +the underlying VCS. + +:VCSAnnotate[!] *:VCSAnnotate* + +This command displays the current file with each line annotated with the +version in which it was most recently changed. If an argument is given, the +argument is used as a revision number to display. If not given an argument, +it uses the most recent version of the file (on the current branch, if under +CVS control). Additionally, if the current buffer is a VCSAnnotate buffer +already, the version number on the current line is used. + +If '!' is used, the view of the annotated buffer is split so that the +annotation is in a separate window from the content, and each is highlighted +separately. + +For CVS buffers, the 'VCSCommandCVSAnnotateParent' option, if set to non-zero, +will cause the above behavior to change. Instead of annotating the version on +the current line, the parent revision is used instead, crossing branches if +necessary. + +With no arguments the cursor will jump to the line in the annotated buffer +corresponding to the current line in the source buffer. + +:VCSBlame[!] *:VCSBlame* + +Alias for |:VCSAnnotate|. + +:VCSCommit[!] *:VCSCommit* + +This command commits changes to the current file to source control. + +If called with arguments, the arguments are the log message. + +If '!' is used, an empty log message is committed. + +If called with no arguments, this is a two-step command. The first step opens +a buffer to accept a log message. When that buffer is written, it is +automatically closed and the file is committed using the information from that +log message. The commit can be abandoned if the log message buffer is deleted +or wiped before being written. + +Alternatively, the mapping that is used to invoke :VCSCommit (by default +||cc, please see |vcscommand-mappings|) can be used in the log message +buffer in Normal mode to immediately commit. This is useful if the +|VCSCommandCommitOnWrite| variable is set to 0 to disable the normal +commit-on-write behavior. + +:VCSDelete *:VCSDelete* + +Deletes the current file and removes it from source control. All parameters +to the command are passed to the underlying VCS. + +:VCSDiff *:VCSDiff* + +With no arguments, this displays the differences between the current file and +its parent version under source control in a new scratch buffer. + +With one argument, the diff is performed on the current file against the +specified revision. + +With two arguments, the diff is performed between the specified revisions of +the current file. + +For CVS, this command uses the |VCSCommandCVSDiffOpt| variable to specify diff +options. If that variable does not exist, a plugin-specific default is used. +If you wish to have no options, then set it to the empty string. + +For SVN, this command uses the |VCSCommandSVNDiffOpt| variable to specify diff +options. If that variable does not exist, the SVN default is used. +Additionally, |VCSCommandSVNDiffExt| can be used to select an external diff +application. + +:VCSGotoOriginal *:VCSGotoOriginal* + +This command jumps to the source buffer if the current buffer is a VCS scratch +buffer. + +:VCSGotoOriginal! + +Like ":VCSGotoOriginal" but also executes :bufwipeout on all VCS scrach +buffers associated with the original file. + +:VCSInfo *:VCSInfo* + +This command displays extended information about the current file in a new +scratch buffer. + +:VCSLock *:VCSLock* + +This command locks the current file in order to prevent other users from +concurrently modifying it. The exact semantics of this command depend on the +underlying VCS. This does nothing in CVS. All parameters are passed to the +underlying VCS. + +:VCSLog *:VCSLog* + +Displays the version history of the current file in a new scratch buffer. If +there is one parameter supplied, it is taken as as a revision parameters to be +passed through to the underlying VCS. Otherwise, all parameters are passed to +the underlying VCS. + +:VCSRemove *:VCSRemove* + +Alias for |:VCSDelete|. + +:VCSRevert *:VCSRevert* + +This command replaces the current file with the most recent version from the +repository in order to wipe out any undesired changes. + +:VCSReview *:VCSReview* + +Displays a particular version of the current file in a new scratch buffer. If +no argument is given, the most recent version of the file on the current +branch is retrieved. + +:VCSStatus *:VCSStatus* + +Displays versioning information about the current file in a new scratch +buffer. All parameters are passed to the underlying VCS. + + +:VCSUnlock *:VCSUnlock* + +Unlocks the current file in order to allow other users from concurrently +modifying it. The exact semantics of this command depend on the underlying +VCS. All parameters are passed to the underlying VCS. + +:VCSUpdate *:VCSUpdate* + +Updates the current file with any relevant changes from the repository. This +intentionally does not automatically reload the current buffer, though vim +should prompt the user to do so if the underlying file is altered by this +command. + +:VCSVimDiff *:VCSVimDiff* + +Uses vimdiff to display differences between versions of the current file. + +If no revision is specified, the most recent version of the file on the +current branch is used. With one argument, that argument is used as the +revision as above. With two arguments, the differences between the two +revisions is displayed using vimdiff. + +With either zero or one argument, the original buffer is used to perform the +vimdiff. When the scratch buffer is closed, the original buffer will be +returned to normal mode. + +Once vimdiff mode is started using the above methods, additional vimdiff +buffers may be added by passing a single version argument to the command. +There may be up to 4 vimdiff buffers total. + +Using the 2-argument form of the command resets the vimdiff to only those 2 +versions. Additionally, invoking the command on a different file will close +the previous vimdiff buffers. + +:CVSEdit *:CVSEdit* + +This command performs "cvs edit" on the current file. Yes, the output buffer +in this case is almost completely useless. + +:CVSEditors *:CVSEditors* + +This command performs "cvs edit" on the current file. + +:CVSUnedit *:CVSUnedit* + +Performs "cvs unedit" on the current file. Again, yes, the output buffer here +is basically useless. + +:CVSWatch *:CVSWatch* + +This command takes an argument which must be one of [on|off|add|remove]. The +command performs "cvs watch" with the given argument on the current file. + +:CVSWatchAdd *:CVSWatchAdd* + +This command is an alias for ":CVSWatch add" + +:CVSWatchOn *:CVSWatchOn* + +This command is an alias for ":CVSWatch on" + +:CVSWatchOff *:CVSWatchOff* + +This command is an alias for ":CVSWatch off" + +:CVSWatchRemove *:CVSWatchRemove* + +This command is an alias for ":CVSWatch remove" + +:CVSWatchers *:CVSWatchers* + +This command performs "cvs watchers" on the current file. + +4.2 Mappings *vcscommand-mappings* + +By default, a mapping is defined for each command. These mappings execute the +default (no-argument) form of each command. + +||ca VCSAdd +||cn VCSAnnotate +||cN VCSAnnotate! +||cc VCSCommit +||cD VCSDelete +||cd VCSDiff +||cg VCSGotoOriginal +||cG VCSGotoOriginal! +||ci VCSInfo +||cl VCSLog +||cL VCSLock +||cr VCSReview +||cs VCSStatus +||cu VCSUpdate +||cU VCSUnlock +||cv VCSVimDiff + +Only for CVS buffers: + +||ce CVSEdit +||cE CVSEditors +||ct CVSUnedit +||cwv CVSWatchers +||cwa CVSWatchAdd +||cwn CVSWatchOn +||cwf CVSWatchOff +||cwf CVSWatchRemove + + *vcscommand-mappings-override* + +The default mappings can be overridden by user-provided instead by mapping to +CommandName. This is especially useful when these mappings collide with +other existing mappings (vim will warn of this during plugin initialization, +but will not clobber the existing mappings). + +There are three methods for controlling mapping: + +First, maps can be overriden for individual commands. For instance, to +override the default mapping for :VCSAdd to set it to '\add', add the +following to the vimrc: + +nmap \add VCSAdd + +Second, the default map prefix ('c') can be overridden by defining the +|VCSCommandMapPrefix| variable. + +Third, the entire set of default maps can be overridden by defining the +|VCSCommandMappings| variable. + + +4.3 Automatic buffer variables *vcscommand-buffer-variables* + +Several buffer variables are defined in each vcscommand result buffer. These +may be useful for additional customization in callbacks defined in the event +handlers (please see |vcscommand-events|). + +The following variables are automatically defined: + +b:VCSCommandOriginalBuffer *b:VCSCommandOriginalBuffer* + +This variable is set to the buffer number of the source file. + +b:VCSCommandCommand *b:VCSCommandCommand* + +This variable is set to the name of the vcscommand that created the result +buffer. + +b:VCSCommandSourceFile *b:VCSCommandSourceFile* + +This variable is set to the name of the original file under source control. + +b:VCSCommandVCSType *b:VCSCommandVCSType* + +This variable is set to the type of the source control. This variable is also +set on the original file itself. +============================================================================== + +5. Configuration and customization *vcscommand-customize* + *vcscommand-config* + +The vcscommand plugin can be configured in several ways: by setting +configuration variables (see |vcscommand-options|) or by defining vcscommand +event handlers (see |vcscommand-events|). Additionally, the vcscommand plugin +supports a customized status line (see |vcscommand-statusline| and +|vcscommand-buffer-management|). + +5.1 vcscommand configuration variables *vcscommand-options* + +Several variables affect the plugin's behavior. These variables are checked +at time of execution, and may be defined at the window, buffer, or global +level and are checked in that order of precedence. + + +The following variables are available: + +|VCSCommandCommitOnWrite| +|VCSCommandCVSDiffOpt| +|VCSCommandCVSExec| +|VCSCommandDeleteOnHide| +|VCSCommandDiffSplit| +|VCSCommandDisableAll| +|VCSCommandDisableMappings| +|VCSCommandDisableExtensionMappings| +|VCSCommandDisableMenu| +|VCSCommandEdit| +|VCSCommandEnableBufferSetup| +|VCSCommandMappings| +|VCSCommandMapPrefix| +|VCSCommandMenuPriority| +|VCSCommandMenuRoot| +|VCSCommandResultBufferNameExtension| +|VCSCommandResultBufferNameFunction| +|VCSCommandSplit| +|VCSCommandSVKExec| +|VCSCommandSVNDiffExt| +|VCSCommandSVNDiffOpt| +|VCSCommandSVNExec| +|VCSCommandVCSTypeOverride| + +VCSCommandCommitOnWrite *VCSCommandCommitOnWrite* + +This variable, if set to a non-zero value, causes the pending commit +to take place immediately as soon as the log message buffer is written. +If set to zero, only the VCSCommit mapping will cause the pending commit to +occur. If not set, it defaults to 1. + +VCSCommandCVSExec *VCSCommandCVSExec* + +This variable controls the executable used for all CVS commands If not set, +it defaults to "cvs". + +VCSCommandDeleteOnHide *VCSCommandDeleteOnHide* + +This variable, if set to a non-zero value, causes the temporary result buffers +to automatically delete themselves when hidden. + +VCSCommandCVSDiffOpt *VCSCommandCVSDiffOpt* + +This variable, if set, determines the options passed to the diff command of +CVS. If not set, it defaults to 'u'. + +VCSCommandDiffSplit *VCSCommandDiffSplit* + +This variable overrides the |VCSCommandSplit| variable, but only for buffers +created with |:VCSVimDiff|. + +VCSCommandDisableAll *VCSCommandDisableAll* + +This variable, if set, prevents the plugin or any extensions from loading at +all. This is useful when a single runtime distribution is used on multiple +systems with varying versions. + +VCSCommandDisableMappings *VCSCommandDisableMappings* + +This variable, if set to a non-zero value, prevents the default command +mappings from being set. This supercedes +|VCSCommandDisableExtensionMappings|. + +VCSCommandDisableExtensionMappings *VCSCommandDisableExtensionMappings* + +This variable, if set to a non-zero value, prevents the default command +mappings from being set for commands specific to an individual VCS. + +VCSCommandEdit *VCSCommandEdit* + +This variable controls whether the original buffer is replaced ('edit') or +split ('split'). If not set, it defaults to 'split'. + +VCSCommandDisableMenu *VCSCommandDisableMenu* + +This variable, if set to a non-zero value, prevents the default command menu +from being set. + +VCSCommandEnableBufferSetup *VCSCommandEnableBufferSetup* + +This variable, if set to a non-zero value, activates VCS buffer management +mode see (|vcscommand-buffer-management|). This mode means that the +'VCSCommandBufferInfo' variable is filled with version information if the file +is VCS-controlled. This is useful for displaying version information in the +status bar. + +VCSCommandMappings *VCSCommandMappings* + +This variable, if set, overrides the default mappings used for shortcuts. It +should be a List of 2-element Lists, each containing a shortcut and function +name pair. The value of the '|VCSCommandMapPrefix|' variable will be added to +each shortcut. + +VCSCommandMapPrefix *VCSCommandMapPrefix* + +This variable, if set, overrides the default mapping prefix ('c'). +This allows customization of the mapping space used by the vcscommand +shortcuts. + +VCSCommandMenuPriority *VCSCommandMenuPriority* + +This variable, if set, overrides the default menu priority '' (empty) + +VCSCommandMenuRoot *VCSCommandMenuRoot* + +This variable, if set, overrides the default menu root 'Plugin.VCS' + +VCSCommandResultBufferNameExtension *VCSCommandResultBufferNameExtension* + +This variable, if set to a non-blank value, is appended to the name of the VCS +command output buffers. For example, '.vcs'. Using this option may help +avoid problems caused by autocommands dependent on file extension. + +VCSCommandResultBufferNameFunction *VCSCommandResultBufferNameFunction* + +This variable, if set, specifies a custom function for naming VCS command +output buffers. This function is expected to return the new buffer name, and +will be passed the following arguments: + + command - name of the VCS command being executed (such as 'Log' or + 'Diff'). + + originalBuffer - buffer number of the source file. + + vcsType - type of VCS controlling this file (such as 'CVS' or 'SVN'). + + statusText - extra text associated with the VCS action (such as version + numbers). + +VCSCommandSplit *VCSCommandSplit* + +This variable controls the orientation of the various window splits that +may occur. + +If set to 'horizontal', the resulting windows will be on stacked on top of +one another. If set to 'vertical', the resulting windows will be +side-by-side. If not set, it defaults to 'horizontal' for all but +VCSVimDiff windows. VCSVimDiff windows default to the user's 'diffopt' +setting, if set, otherwise 'vertical'. + +VCSCommandSVKExec *VCSCommandSVKExec* + +This variable controls the executable used for all SVK commands If not set, +it defaults to "svk". + +VCSCommandSVNDiffExt *VCSCommandSVNDiffExt* + +This variable, if set, is passed to SVN via the --diff-cmd command to select +an external application for performing the diff. + +VCSCommandSVNDiffOpt *VCSCommandSVNDiffOpt* + +This variable, if set, determines the options passed with the '-x' parameter +to the SVN diff command. If not set, no options are passed. + +VCSCommandSVNExec *VCSCommandSVNExec* + +This variable controls the executable used for all SVN commands If not set, +it defaults to "svn". + +VCSCommandVCSTypeOverride *VCSCommandVCSTypeOverride* + +This variable allows the VCS type detection to be overridden on a path-by-path +basis. The value of this variable is expected to be a List of Lists. Each +item in the high-level List is a List containing two elements. The first +element is a regular expression that will be matched against the full file +name of a given buffer. If it matches, the second element will be used as the +VCS type. + +5.2 VCSCommand events *vcscommand-events* + +For additional customization, vcscommand can trigger user-defined events. +Event handlers are provided by defining User event autocommands (see +|autocommand|, |User|) in the vcscommand group with patterns matching the +event name. + +For instance, the following could be added to the vimrc to provide a 'q' +mapping to quit a vcscommand scratch buffer: + +augroup VCSCommand + au User VCSBufferCreated silent! nmap q :bwipeout +augroup END + +The following hooks are available: + +VCSBufferCreated This event is fired just after a vcscommand + result buffer is created and populated. It is + executed within the context of the vcscommand + buffer. The vcscommand buffer variables may + be useful for handlers of this event (please + see |vcscommand-buffer-variables|). + +VCSBufferSetup This event is fired just after vcscommand buffer + setup occurs, if enabled. + +VCSPluginInit This event is fired when the vcscommand plugin + first loads. + +VCSPluginFinish This event is fired just after the vcscommand + plugin loads. + +VCSVimDiffFinish This event is fired just after the VCSVimDiff + command executes to allow customization of, + for instance, window placement and focus. + +Additionally, there is another hook which is used internally to handle loading +the multiple scripts in order. This hook should probably not be used by an +end user without a good idea of how it works. Among other things, any events +associated with this hook are cleared after they are executed (during +vcscommand.vim script initialization). + +VCSLoadExtensions This event is fired just before the + VCSPluginFinish. It is used internally to + execute any commands from the VCS + implementation plugins that needs to be + deferred until the primary plugin is + initialized. + +5.3 vcscommand buffer naming *vcscommand-naming* + +vcscommand result buffers use the following naming convention: +[{VCS type} {VCS command} {Source file name}] + +If additional buffers are created that would otherwise conflict, a +distinguishing number is added: + +[{VCS type} {VCS command} {Source file name}] (1,2, etc) + +5.4 vcscommand status line support *vcscommand-statusline* + +It is intended that the user will customize the |'statusline'| option to +include vcscommand result buffer attributes. A sample function that may be +used in the |'statusline'| option is provided by the plugin, +VCSCommandGetStatusLine(). In order to use that function in the status line, do +something like the following: + +set statusline=%<%f\ %{VCSCommandGetStatusLine()}\ %h%m%r%=%l,%c%V\ %P + +of which %{VCSCommandGetStatusLine()} is the relevant portion. + +The sample VCSCommandGetStatusLine() function handles both vcscommand result +buffers and VCS-managed files if vcscommand buffer management is enabled +(please see |vcscommand-buffer-management|). + +5.5 vcscommand buffer management *vcscommand-buffer-management* + +The vcscommand plugin can operate in buffer management mode, which means that +it attempts to set a buffer variable ('VCSCommandBufferInfo') upon entry into +a buffer. This is rather slow because it means that the VCS will be invoked +at each entry into a buffer (during the |BufEnter| autocommand). + +This mode is disabled by default. In order to enable it, set the +|VCSCommandEnableBufferSetup| variable to a true (non-zero) value. Enabling +this mode simply provides the buffer variable mentioned above. The user must +explicitly include information from the variable in the |'statusline'| option +if they are to appear in the status line (but see |vcscommand-statusline| for +a simple way to do that). + +The 'VCSCommandBufferInfo' variable is a list which contains, in order, the +revision of the current file, the latest revision of the file in the +repository, and (for CVS) the name of the branch. If those values cannot be +determined, the list is a single element: 'Unknown'. + +============================================================================== + +6. SSH "integration" *vcscommand-ssh* + +The following instructions are intended for use in integrating the +vcscommand.vim plugin with an SSH-based CVS environment. + +Familiarity with SSH and CVS are assumed. + +These instructions assume that the intent is to have a message box pop up in +order to allow the user to enter a passphrase. If, instead, the user is +comfortable using certificate-based authentication, then only instructions +6.1.1 and 6.1.2 (and optionally 6.1.4) need to be followed; ssh should then +work transparently. + +6.1 Environment settings *vcscommand-ssh-env* + +6.1.1 CVSROOT should be set to something like: + + :ext:user@host:/path_to_repository + +6.1.2 CVS_RSH should be set to: + + ssh + + Together, those settings tell CVS to use ssh as the transport when + performing CVS calls. + +6.1.3 SSH_ASKPASS should be set to the password-dialog program. In my case, + running gnome, it's set to: + + /usr/libexec/openssh/gnome-ssh-askpass + + This tells SSH how to get passwords if no input is available. + +6.1.4 OPTIONAL. You may need to set SSH_SERVER to the location of the cvs + executable on the remote (server) machine. + +6.2 CVS wrapper program *vcscommand-ssh-wrapper* + +Now you need to convince SSH to use the password-dialog program. This means +you need to execute SSH (and therefore CVS) without standard input. The +following script is a simple perl wrapper that dissasociates the CVS command +from the current terminal. Specific steps to do this may vary from system to +system; the following example works for me on linux. + +#!/usr/bin/perl -w +use strict; +use POSIX qw(setsid); +open STDIN, '/dev/null'; +fork and do {wait; exit;}; +setsid; +exec('cvs', @ARGV); + +6.3 Configuring vcscommand.vim *vcscommand-ssh-config* + +At this point, you should be able to use your wrapper script to invoke CVS with +various commands, and get the password dialog. All that's left is to make CVS +use your newly-created wrapper script. + +6.3.1 Tell vcscommand.vim what CVS executable to use. The easiest way to do this + is globally, by putting the following in your .vimrc: + + let VCSCommandCVSExec=/path/to/cvs/wrapper/script + +6.4 Where to go from here *vcscommand-ssh-other* + +The script given above works even when non-SSH CVS connections are used, +except possibly when interactively entering the message for CVS commit log +(depending on the editor you use... VIM works fine). Since the vcscommand.vim +plugin handles that message without a terminal, the wrapper script can be used +all the time. + +This allows mixed-mode operation, where some work is done with SSH-based CVS +repositories, and others with pserver or local access. + +It is possible, though beyond the scope of the plugin, to dynamically set the +CVS executable based on the CVSROOT for the file being edited. The user +events provided (such as VCSBufferCreated and VCSBufferSetup) can be used to +set a buffer-local value (b:VCSCommandCVSExec) to override the CVS executable +on a file-by-file basis. Alternatively, much the same can be done (less +automatically) by the various project-oriented plugins out there. + +It is highly recommended for ease-of-use that certificates with no passphrase +or ssh-agent are employed so that the user is not given the password prompt +too often. + +============================================================================== + +7. Changes from cvscommand *cvscommand-changes* + +1. Require Vim 7 in order to leverage several convenient features; also +because I wanted to play with Vim 7. + +2. Renamed commands to start with 'VCS' instead of 'CVS'. The exceptions are +the 'CVSEdit' and 'CVSWatch' family of commands, which are specific to CVS. + +3. Renamed options, events to start with 'VCSCommand'. + +4. Removed option to jump to the parent version of the current line in an +annotated buffer, as opposed to the version on the current line. This made +little sense in the branching scheme used by subversion, where jumping to a +parent branch required finding a different location in the repository. It +didn't work consistently in CVS anyway. + +5. Removed option to have nameless scratch buffers. + +6. Changed default behavior of scratch buffers to split the window instead of +displaying in the current window. This may still be overridden using the +'VCSCommandEdit' option. + +7. Split plugin into multiple plugins. + +8. Added 'VCSLock' and 'VCSUnlock' commands. These are implemented for +subversion but not for CVS. These were not kept specific to subversion as they +seemed more general in nature and more likely to be supported by any future VCS +supported by this plugin. + +9. Changed name of buffer variables set by commands. + +'b:cvsOrigBuffNR' became 'b:VCSCommandOriginalBuffer' +'b:cvscmd' became 'b:VCSCommandCommand' + +10. Added new automatic variables to command result buffers. + +'b:VCSCommandSourceFile' +'b:VCSCommandVCSType' + +============================================================================== + +8. Known bugs *vcscommand-bugs* + +Please let me know if you run across any. + +CVSUnedit may, if a file is changed from the repository, provide prompt text +to determine whether the changes should be thrown away. Currently, that text +shows up in the CVS result buffer as information; there is no way for the user +to actually respond to the prompt and the CVS unedit command does nothing. If +this really bothers anyone, please let me know. + +VCSVimDiff, when using the original (real) source buffer as one of the diff +buffers, uses some hacks to try to restore the state of the original buffer +when the scratch buffer containing the other version is destroyed. There may +still be bugs in here, depending on many configuration details. + +vim:tw=78:ts=8:ft=help diff --git a/.vim/ftplugin/c.vim b/.vim/ftplugin/c.vim new file mode 100644 index 0000000..16ffc97 --- /dev/null +++ b/.vim/ftplugin/c.vim @@ -0,0 +1 @@ +setlocal foldmethod=syntax diff --git a/.vim/ftplugin/imath.vim b/.vim/ftplugin/imath.vim new file mode 100644 index 0000000..7e7f4b2 --- /dev/null +++ b/.vim/ftplugin/imath.vim @@ -0,0 +1,13 @@ +" my math filetype that extends txt for unicode/ascii math symbol abbreviations +ab pi π +ab sqrt √ +ab intg ∫ +ab ^2 ² +ab sigma σ +ab mew µ +ab half ½ +ab epsilon ε 03b5 +ab _0 ₀ +ab _1 ₁ +ab beta β +ab && ∩ diff --git a/.vim/ftplugin/java.vim b/.vim/ftplugin/java.vim new file mode 100644 index 0000000..7883de5 --- /dev/null +++ b/.vim/ftplugin/java.vim @@ -0,0 +1,16 @@ +" Javadoc comments (/** and */ pairs) and code sections (marked by {} pairs) mark the start and end of folds. All other +" lines simply take the fold level that is going so far. +function! MyFoldLevel( lineNumber ) + let thisLine = getline( a:lineNumber ) + " If the entire Javadoc comment or the {} pair is on one line, then don't create a fold for it. + if ( thisLine =~ '\%(\%(/\*\*\).*\%(\*/\)\)\|\%({.*}\)' ) + return '=' + elseif ( thisLine =~ '\%(^\s*/\*\*\s*$\)\|{' ) + return "a1" + elseif ( thisLine =~ '\%(^\s*\*/\s*$\)\|}' ) + return "s1" + endif + return '=' +endfunction +setlocal foldexpr=MyFoldLevel(v:lnum) +setlocal foldmethod=expr diff --git a/.vim/ftplugin/txt.vim b/.vim/ftplugin/txt.vim new file mode 100644 index 0000000..9b40fa7 --- /dev/null +++ b/.vim/ftplugin/txt.vim @@ -0,0 +1,2 @@ +setlocal tw=0 +setlocal foldmethod=indent diff --git a/.vim/misc/filetype.vim b/.vim/misc/filetype.vim new file mode 100644 index 0000000..d5d51de --- /dev/null +++ b/.vim/misc/filetype.vim @@ -0,0 +1,5 @@ +augroup filetypedetec +au BufNewFile,BufRead *.txt setf txt +au BufNewFile,BufRead *.R setf r +au BufNewFile,BufRead *.R set syntax=r +augroup END diff --git a/.vim/misc/sasvimrc b/.vim/misc/sasvimrc new file mode 100644 index 0000000..0ff2632 --- /dev/null +++ b/.vim/misc/sasvimrc @@ -0,0 +1,1106 @@ +" vim: set ff=unix ai si noet ts=4 sw=4 fdls=1 fdm=marker wrap tw=0 sm mat=3 spell tags=$HOME/.vim/vimrc.tags : +" +" Terry M P, personal vimrc file +" +" $Id: .vimrc,v 1.11 2008/11/14 07:42:37 Terry Exp $: +" +""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +" WARNING !!! +" This file must have UNIX end of lines to avoid errors when starting +" under unix. Use the pdos2unix and punix2dos sh scripts to convert or +" +" perl -p -e 's/\n/\r\n/' inputfile > outputfile # UNIX to DOS +" perl -p -e 's/\r\n/\n/' inputfile > outputfile # DOS to UNIX +" +" on the command line or vim it self. +""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +" Table of Contents +" |SETTINGS| --- Settings +" |GENERAL| --- General options +" |FORMATS| --- Configuration for various file formats +" |AUTOCMDS| --- Auto commands for calling format handler functions +" |HANDLERS| --- Handler functions for various file formats +" |INTERFACE| --- Interface specific settings +" |BINDS| --- Common Bindings +" |FUNCTIONS| --- Global helper functions +" |COMMANDS| --- Normal mode commands +" |MAPS| --- Key mappings +" |PLUGINS| --- Plugin specific configuration +" |Taglist| +" |NERDTree| +" |play| --- Misc stuff, usually notes / code snippets +" +""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +" Preferences +""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" + + +" *SETTINGS* {{{ + +" *GENERAL* {{{ + + " Don't be VI compatible - Keep this at top of file ! + " Also skip loading .exrc and friend sin the CWD. + set nocompatible + set noexrc + + " highlight matched text when searching + "if has('extra_search') + " set hlsearch + "endif + + " Ignore case when searching unless it starts with a Capitol + set ignorecase + set smartcase + + " Use the system clipboard as the default register, '*' + if has("clipboard") + set clipboard=unnamed,exclude:cons\|linux + endif + + " Make join commands smarter + set joinspaces + + " Kill visual bell + set visualbell t_vb= + + " Allow names with some spaces in path, like when using gf + set isfname+=32 + + " Show matching symbols Vi style + set showmatch + set matchtime=3 + set matchpairs=(:),{:},[:],<:> + + " How to display tabs when list is on and expand tab is off + set listchars=tab:\|\ + set nolist + + " Physical word wrapping + set textwidth=78 + + " Allow backspacing over everything in insert mode + set backspace=indent,eol,start + + " Allow keys to move to next logical line marker at EOL + set whichwrap=b,s,h,l,<,>,[,],~ + + " Set folding + if has("folding") + set foldlevelstart=99 + set foldmethod=indent + endif + + " Indentation settings (explictly) + set tabstop=8 + set shiftwidth=8 + set noexpandtab + + " Set minimal length of line numbering + set numberwidth=2 + + " Set tab menu 0=never, 1=when more then one, 2=always + set showtabline=1 + + " Preferred file formats, ffs + set fileformat=unix + set fileformats=unix,dos,mac + + + " Show status bar with file name e.t.c. + " 0 = never, 1 = if >= 2 window, 2 = always + set laststatus=2 + + " Show % of file in status bar + if has("cmdline_info") + set ruler + endif + + " Vim command line completion lists possible matches + set wildmode=list:full + + " Start with mouse support in all modes + set mouse=a + " Hide mouse pointer when typing in text + set mousehide + + " Allow split windows to shrink to this size + set winminheight=0 + + " Set spell checker language + if exists("+spell") + set spelllang=en_us,en_gb,de + set spell + " disable highlighting + " XXX see |MAPS| for a mapping to toggle this highlighting + set hl+=B:none,P:none,R:none,L:none + endif + + " Show function prototypes when doing ins-completion + set showfulltag + + " Settings for omni completion + if exists("+omnifunc") + set completeopt=menu + set infercase + "Enable syntax file based omni completion when no other method is set + if has("autocmd") + autocmd Filetype * + \ if &omnifunc == "" | + \ setlocal omnifunc=syntaxcomplete#Complete | + \ endif + endif + endif + + " Allow cursor to move virtually in =mode or =onemore past the EOL + "set virtualedit=onemore + + " UNIX: Include system tags file + if has("unix") + set tags+=~/.vim/systags + endif + + " Enable filetypes and plugins + filetype plugin indent on + + "Enable syntax related features + if has("syntax") + syntax on + endif + + " Automatically change to directories if possible. + if has("netbeans_intg") || has("sun_workshop") + set autochdir + elseif has("autocmd") + " Mimic the autochdir option with a function and an autocmd + function! My_Autochdir() + exec "cd %:p:h" + endfunction + autocmd BufEnter * call My_Autochdir() + endif + +" !GENERAL }}} + +" *FORMATS* {{{ + +" *AUTOCMDS* {{{ + + + if has("autocmd") +" XXX Document based formats + " make *.txt dos/win friendly + autocmd BufNewFile *.txt set ff=dos + autocmd BufNewFile,BufRead *.txt call TextFileHandler() + autocmd BufNewFile *.rtf call RtfFileHandler() + autocmd BufRead *.rtf call RtfFileHandler() + autocmd BufRead *.doc call DocFileHandler() + autocmd BufRead *.pdf call PdfFileHandler() + autocmd BufRead *.ps call PsFileHandler() + autocmd BufRead *.dvi call DviFileHandler() + autocmd BufNewFile,BufRead *.outline call My_OutlineMode() +" XXX Image file based formats + autocmd BufRead *.jpg,*.jpeg,*.png,*.tiff,*.bmp,*.gif call ImgFileHandler() + autocmd BufRead *.xpm call XImgFileHandler() +" XXX Code based formats + autocmd filetype ada call AdaFileHandler() + autocmd filetype asm call AsmFileHandler() + autocmd BufNewFile,BufRead *.c,*.h call CFileHandler() + autocmd filetype css call CSSFileHandler() + autocmd BufNewFile,BufRead *.cc,*.cxx,*.cpp,*.hh,*.hpp,*.hxx call CXXFileHandler() + autocmd BufNewFile,BufRead *.d call DFileHandler() + autocmd BufNewFile,BufRead *.el call ELispFileHandler() + autocmd BufNewFile,BufRead *.html,*.xhtml call HtmlFileHandler() + autocmd filetype java call JavaFileHandler() + autocmd filetype javascript call JavaScriptFileHandler() + autocmd BufNewFile,BufRead *.lua call LuaFileHandler() + autocmd filetype make call MakefileFileHandler() + autocmd filetype perl call PerlFileHandler() + autocmd filetype php call PhpFileHandler() + autocmd filetype python call PythonFileHandler() + autocmd filetype ruby call RubyFileHandler() + autocmd filetype scheme call SchemeFileHandler() + autocmd filetype sh call ShellFileHandler() + autocmd filetype sql call SqlFileHandler() + autocmd filetype tex call TexFileHanlder() + autocmd filetype nroff call TroffFileHandler() + autocmd filetype vim call VimFileHanlder() + autocmd filetype vb call VisualBasicFileHandler() +" XXX for use with other programs + autocmd BufNewFIle,BUfRead *.tmp call My_KNodeConfig() + endif + +" !AUTOCMDS }}} + +" *HANDLERS* {{{ + + function! PreHandlerHook() + setl autoindent + if exists("+spell") + setl spell + endif + endfunction + function! PostHandlerHook() + endfunction + +" XXX Document based formats + function! TextFileHandler() + call PreHandlerHook() + + " turn off some stuff when viewing Vim help files + if &ft == "help" + if exists("+spell") + setl nospell + endif + endif + setl fdm=expr + set fo+=tqn + set ai + " fixes gq from using c-keyword based indentation + set cinwords="" + + call PostHandlerHook() + endfunction + + function! RtfFileHandler() + call PreHandlerHook() + + let l:prompt = input("View or edit % [yes|no]?: ") + if l:prompt=="y" || l:prompt=="yes" || l:prompt=="Y" || l:prompt=="YES" + !{abiword "%" || wordpad.exe "%" || kword "%" || swriter "%"} & + q + endif + + call PostHandlerHook() + endfunction + + function! DocFileHandler() + call PreHandlerHook() + + if has("gui_running") || has("win32") + !{abiword "%" || kword "%" || swriter "%"} & + q + else + r!antiword -tf "%s" + endif + call PostHandlerHook() + endfunction + + function! PdfFileHandler() + call PreHandlerHook() + + if has("x11") + !{evince "%" || kpdf "%" || xpdf "%"} & + q + elseif has("win32") + !"Foxit Reader.exe" "%" & + q + else + echo "No text dump program setup available...." + endif + + call PostHandlerHook() + endfunction + + function! PsFileHandler() + call PreHandlerHook() + + let l:prompt = input("View or edit % [yes|no]?: ") + if l:prompt=="y" || l:prompt=="yes" || l:prompt=="Y" || l:prompt=="YES" + if has("x11") + !{evince "%" || kpdf "%" || xpdf "%"} & + q + elseif has("win32") + echo "Whats the ps viewer?" + else + echo "No text dump program installed...." + endif + endif + + call PostHandlerHook() + endfunction + + function! DviFileHandler() + call PreHandlerHook() + + let l:prompt = input("View % in Vim [yes|no]?: ") + if l:prompt=="y" || l:prompt=="yes" || l:prompt=="Y" || l:prompt=="YES" + " depends on the dvi2tty program + !dvi2tty -F'vim -c "setl ro fdl=99" -' "%" + q + else + if has("x11") + !{xdvi "%" || kdvi "%" || "%"} & + q + elseif has("win32") + !echo "Go look up how to open DVI on TexLive Win" + endif + endif + + call PostHandlerHook() + endfunction + +" XXX Image file based formats + function! ImgFileHandler() + call PreHandlerHook() + + if has("x11") + !xv "%" & + q + elseif has("win32") + !\%systemroot\%\system32\rundll32.exe \%systemroot\%\system32\shimgvw.dll,imageview_fullscreen "%" || \%systemroot\%\system32\mspaint.exe "%" + q + else + echo "no external viewer for text mode set...." + endif + + call PostHandlerHook() + endfunction + + function! XImgFileHandler() + call PreHandlerHook() + + let l:prompt = input("View or edit % [yes|no]?: ") + if l:prompt=="y" || l:prompt=="yes" || l:prompt=="Y" || l:prompt=="YES" + if has("x11") + !xv "%" & + q + endif + endif + + call PostHandlerHook() + endfunction + +" XXX Code based formats + function! AdaFileHandler() + call PreHandlerHook() + + call PostHandlerHook() + endfunction + + function! AsmFileHandler() + call PreHandlerHook() + + if exists("+spell") + setl nospell + endif + call PostHandlerHook() + endfunction + + function! CFileHandler() + call PreHandlerHook() + + setl tabstop=8 shiftwidth=8 noexpandtab + if has("folding") + setl foldmethod=syntax foldcolumn=1 + endif + setl matchpairs-=<:> + + if has("cindent") + " modify cindent to understand my switch...case and paren style + setl cinoptions+=:2,=2,g2,(0 + setl cinkeys-=0# + endif + + " highlight GNU Compiler stuff + let c_gnu=1 + " highlight preceding spaces before a tab as an error + let c_space_errors=1 + let c_no_trail_space_error=1 + " use C syntax in *.h rather then C++ syntax + if has("syntax") + let c_syntax_for_h=1 + + " allow doxygen highlighting + set syntax=c.doxygen + endif + + call PostHandlerHook() + endfunction + + function! CSSFileHandler() + call PreHandlerHook() + + setl tabstop=5 shiftwidth=5 expandtab + if has("folding") + setl foldmethod=indent + endif + + call PostHandlerHook() + endfunction + + function! CXXFileHandler() + call PreHandlerHook() + + setl tabstop=4 shiftwidth=4 expandtab + if has("folding") + setl foldmethod=syntax foldcolumn=1 + endif + setl matchpairs-=<:> + + if has("cindent") + " modify cindent to understand my switch...case / class member + " access specifier / paren styles and not force #directives into + " col 1 + setl cinoptions+=:2,=2,g2,h2,(0,#1 + setl cinkeys-=0# + endif + + if has("syntax") + " allow doxygen highlighting + set syntax=cpp.doxygen + endif + + call PostHandlerHook() + endfunction + + function! DFileHandler() + call PreHandlerHook() + call PostHandlerHook() + endfunction + + function! ELispFileHandler() + call PreHandlerHook() + call PostHandlerHook() + endfunction + + function! HtmlFileHandler() + call PreHandlerHook() + + if has("syntax") && &t_Co > 2 + syntax on + colo elflord + endif + setl tabstop=2 shiftwidth=2 expandtab + if has("folding") + setl foldmethod=indent + endif + filetype indent on + if exists("+omnifunc") " think twice about using this with other langs + imap + endif + + call PostHandlerHook() + endfunction + + function! JavaFileHandler() + call PreHandlerHook() + + setl tabstop=4 shiftwidth=4 expandtab + if has("folding") + setl foldmethod=indent + endif + setl matchpairs-=<:> + if exists("+spell") + setl nospell " FUBAR in Java + endif + " Highlight all identifiers in java.lang.* + let java_highlight_java_lang_ids=1 + + call PostHandlerHook() + endfunction + + function! JavaScriptFileHandler() + call PreHandlerHook() + + call PostHandlerHook() + endfunction + + function! LuaFileHandler() + call PreHandlerHook() + call PostHandlerHook() + endfunction + + function! MakefileFileHandler() + call PreHandlerHook() + + setl tabstop=4 shiftwidth=4 noexpandtab + if has("folding") + setl foldmethod=indent + endif + + call PostHandlerHook() + endfunction + + function! PerlFileHandler() + call PreHandlerHook() + + setl tabstop=4 shiftwidth=4 noexpandtab + if has("folding") + setl foldmethod=indent + let perl_fold=1 + let perl_fold_blocks=1 + endif + setl matchpairs-=<:> + + call PostHandlerHook() + endfunction + + function! PhpFileHandler() + call PreHandlerHook() + + setl tabstop=4 shiftwidth=4 expandtab + if has("folding") + setl foldmethod=indent + " allow code folding for classes and functions! + let php_folding=1 + endif + setl matchpairs-=<:> + " highlight HTML tags within strings + let php_htmlInStrings=1 + " disable short tags + let php_noShortTags=1 + + call PostHandlerHook() + endfunction + + function! PythonFileHandler() + call PreHandlerHook() + + setl tabstop=4 shiftwidth=4 expandtab + if has("folding") + setl foldmethod=marker + endif + setl matchpairs-=<:> + setl keywordprg=pydoc + + let python_highlight_all=1 + " slightly smarter indenting for (code\n morecode) situations + let g:pyindent_open_paren = '&sw + 1' + + call PostHandlerHook() + endfunction + + function! RubyFileHandler() + call PreHandlerHook() + + setl tabstop=2 shiftwidth=2 expandtab + if has("folding") + setl foldmethod=syntax + let ruby_fold=1 + endif + setl matchpairs-=<:> + filetype indent on + setl keywordprg=ri + + call PostHandlerHook() + endfunction + + function! SchemeFileHandler() + call PreHandlerHook() + + setl tabstop=4 shiftwidth=4 expandtab + if has("folding") + setl foldmethod=syntax + endif + setl matchpairs-=<:> + if exists("+spell") + setl nospell " FUBAR in Scheme + endif + call PostHandlerHook() + endfunction + + function! ShellFileHandler() + call PreHandlerHook() + + setl tabstop=4 shiftwidth=4 expandtab + if has("folding") + setl foldmethod=indent + let g:sh_fold_enabled=8 + endif + setl matchpairs-=<:> + + call PostHandlerHook() + endfunction + + function! SqlFileHandler() + call PreHandlerHook() + " We almost always work with MySQL, so default to it. + SQLSetType mysql + setl tabstop=2 shiftwidth=2 expandtab + setl matchpairs-=<:> + + call PostHandlerHook() + endfunction + + function! TexFileHanlder() + call PreHandlerHook() + if has("syntax") && &t_Co > 2 + syntax on + colo elflord + endif + setl fileformat=dos + setl tabstop=4 shiftwidth=4 softtabstop=4 noexpandtab + if has("folding") + setl foldmethod=indent + " syntax-based folding of parts, chapters, sections, etc + let g:tex_fold_enabled=1 + endif + setl matchpairs-=<:> + " fixes gq from using c-keyword based indentation + set cinwords="" + + call PostHandlerHook() + endfunction + + function! TroffFileHandler() + call PreHandlerHook() + + setl matchpairs-=<:> + if exists("+spell") + setl nospell " FUBAR in Java + endif + + call PostHandlerHook() + endfunction + + function! VimFileHanlder() + call PreHandlerHook() + + if has("syntax") && &t_Co > 2 + syntax on + colo elflord + endif + setl fileformat=unix + setl tabstop=4 shiftwidth=4 noexpandtab + if has("folding") + setl foldmethod=marker + endif + setl matchpairs-=<:> + + call PostHandlerHook() + endfunction + + function! VisualBasicFileHandler() + call PreHandlerHook() + + "setl fileformat=unix + setl matchpairs-=<:> + + call PostHandlerHook() + endfunction + +" XXX for use with other programs + " Settings for outlining ideas + function! My_OutlineMode() + call PreHandlerHook() + + setl tabstop=8 shiftwidth=8 noexpandtab + setl listchars =tab:\|\ " Mark \t's with |'s + setl list + if exists("+spell") + setl spell + endif + setl autoindent + if has("smartindent") + setl smartindent + endif + setl showmatch matchtime=3 + setl matchpairs+=(:),{:},[:],<:> + if has("folding") + " Fold by tabs + "setl foldmethod=expr + "setl foldexpr=getline(v:lnum)[0]==\"\\t\" + " Fold by braces + setl foldmethod=marker + setl foldmarker={,} + endif + + call PostHandlerHook() + endfunction + + " For the .tmp files created by knode + function! My_KNodeConfig() + call PreHandlerHook() + + setl textwidth=0 wrap + if exists("+spell") + setl spell + endif + setl autoindent + if has('smartindent') + smartindent + endif + if has("folding") + setl foldmethod=indent + endif + set ft=mail + + call PostHandlerHook() + endfunction + +" !HANDLERS }}} + +" !FORMATS }}} + +" *INTERFACE* {{{ + + + "set :command line height in lines + if has("gui_running") + set cmdheight=2 + else + set cmdheight=1 + endif + + + " GUI: Set options mainly used for for GVim + + " autoselect, console dialogs, tabpages, icon, menubar, show grey menu + " items, tearoff menu items, Toolbar, always right scrollbar. + set guioptions=aceimgtTr + + " Right click menu lists correction options when spell is set + set mousemodel=popup_setpos + + " Make mouse pointer an I-Beam in insert mode like most other programs + set mouseshape=i:beam + + + " X11: Specifics for GVim + if has("x11") + "I love this font!! + set guifont=Terminus\ 14 + "set lines=40 + "set columns=80 + + " WINDOWS: Specifics for GVim + elseif has("win32") + set guifont=Fixedsys:h11:cANSI + set lines=25 + set columns=80 + + endif + + function! SetGuiColo() " {{{ XXX DEPRECIATED + + if exists("*strftime") + let s:random = strftime("%S") + else " fall through to the else + let s:random = 61 + endif + + if s:random < 2 + colo ron + + elseif s:random < 4 + colo candycode + + elseif s:random < 6 + colo silent + + elseif s:random < 8 + colo default + + elseif s:random < 12 + colo denim + + elseif s:random < 14 + colo midnight2 + + elseif s:random < 16 + colo hhazure + + elseif s:random < 18 + colo rootwater + + elseif s:random < 20 + colo nightshimmer + + elseif s:random < 22 + colo murphy + + elseif s:random < 24 + colo coffee + + elseif s:random < 26 + colo professional + + elseif s:random < 28 + colo sf + + elseif s:random < 30 + colo my + + elseif s:random < 32 + colo vcbc + + elseif s:random < 34 + colo gobo + + elseif s:random < 36 + colo metacosm + + elseif s:random < 38 + colo blackboard + + elseif s:random < 40 + colo billw + + elseif s:random < 42 + colo dusk + + elseif s:random < 44 + colo desert + + elseif s:random < 46 + colo evening + + elseif s:random < 48 + colo golden + + elseif s:random < 50 + colo chela_light + + elseif s:random < 52 + colo camo + + elseif s:random < 54 + colo developer + + elseif s:random < 56 + colo neon + + elseif s:random < 58 + colo chlordane + + elseif s:random < 60 + colo shine + + else + colo default + + endif + endfunction " }}} + + function! SetConsoleColo() "{{{ XXX DEPRECIATED + + + " XXX override this for now + colo none + + return + if exists("*strftime") + let s:random = strftime("%S") + else " fall through to the else + let s:random = 61 + endif + + if s:random < 2 + colo astronaut + + elseif s:random < 4 + colo redblack + + elseif s:random < 6 + colo default + + elseif s:random < 8 + colo golden + + elseif s:random < 12 + colo candycode + + elseif s:random < 14 + colo murphy + + elseif s:random < 16 + colo my + + elseif s:random < 18 + colo c + + elseif s:random < 20 + colo elflord + + elseif s:random < 22 + colo relaxedgreen + + elseif s:random < 24 + colo astronaut + + elseif s:random < 26 + colo redblack + + elseif s:random < 28 + colo default + + elseif s:random < 30 + colo golden + + elseif s:random < 32 + colo candycode + + elseif s:random < 34 + colo elflord + + elseif s:random < 36 + colo c + + elseif s:random < 38 + elseif s:random < 40 + elseif s:random < 42 + colo relaxedgreen + + elseif s:random < 44 + colo redblack + + elseif s:random < 46 + colo default + + elseif s:random < 48 + colo candycode + + elseif s:random < 50 + colo golden + + elseif s:random < 52 + colo relaxedgreen + + elseif s:random < 54 + colo astronaut + + elseif s:random < 56 + colo my + + elseif s:random < 58 + colo astronaut + + elseif s:random < 60 + colo murphy + + else + colo default + + endif + + endfunction " }}} + + if !has("gui_running") + call SetConsoleColo() + endif + + +" !INTERFACE }}} + +" !SETTINGS }}} + +" |BINDS| {{{ + +" *FUNCTIONS* {{{ + +" XXX: Be sure to add ! to functions and commands in order to overwrite +" the definitions if this file is resourced after startup. + + +" Make current file executable +function! ChmodScript() + silent! execute ":!chmod +x %" +endfunction +command! Chmod call ChmodScript() + +" ROT13 encode/decode the current file +function! ROT13() + ggvGg? +endfunction + +" !FUNCTIONS }}} + +" *MAPS* {{{ + +"""" WARNING !!! +"""" NEVER MAP THE BACKSPACE KEY OR A MODIFIER + + " Use ";" as an alias for ":" -> it makes life so much easier + nnoremap ; : + + " show more data when we ask for a line count + nnoremap 2 + + " clear search highlighting when redrawing the screen + nnoremap :nohl + + " Make Escape toggle normal/insert mode -> I don't like this! + "nnoremap :startinsert + + " Combine [s and ]s with z= + " (e.g. move to miss spelled word in direction and get suggestions) + nnoremap [z [sz= + nnoremap ]z ]sz= + + " toggle spelling highlights on/off + nnoremap Z :set hl& + nnoremap z :set hl+=B:none,P:none,R:none,L:none + + " swap words under cursor with \xp or \gw (where \ = + noremap xp "_yiw:s/\(\%#\w\+\)\(\W\+\)\(\w\+\)/\3\2\1/ + noremap gw xp + + " Use emacs style movement commands in insert mode + " XXX: these redine Vim maps, ctrl-a => useless, ctrl-e => useful + "inoremap I + "inoremap A + + " F1 toggles spell checking for this buffer + if exists("+spell") + inoremap :set spell! set spell?i + nnoremap :set spell! set spell? + endif + + " F2 toggles line numbers + nnoremap :set number! set number? + inoremap :set number! set number?i + + " F3 turns on auto indentations + nnoremap :set smartindent autoindent + inoremap :set smartindent autoindenti + + " XXX make this toggle the nerd tree plugin + " F5 launches file manager in the current directory + nnoremap :OPEN %:p:h + inoremap :OPEN %:p:hi + +" !KEYS }}} + +" !BINDS }}} + +" *PLUGINS* {{{ + +" *Taglist* {{{ + + map tl :TlistToggle + let g:Tlist_Auto_Open=0 + let g:Tlist_GainFocus_On_ToggleOpen=1 + let g:Tlist_Enable_Fold_Column=0 + let g:Tlist_Exit_OnlyWindow=1 + let g:Tlist_Display_Prototype=1 + let g:Tlist_Show_Menu=1 + +" !Taglist }}} + +" *NERDTree* {{{ + +" !NERDTree }}} + +" !PLUGINS }}} + + + +""""" *play* {{{ +" Beautify omnicompletion popup +"highlight Pmenu guifg=white guibg=blue ctermfg=white ctermbg=blue + +" Fold paragraphs +"if has("folding") +" set foldexpr=getline(v:lnum)=~'^\\s*$'&&getline(v:lnum+1)=~'\\S'?'<1':1 +"endif + + if exists("*strftime") + iabbrev insert_date =strftime("%Y-%m-%d %H:%M:%S") + endif + + iabbrev teh the + iabbrev swtich switch + +""""" !play }}} diff --git a/.vim/misc/unix.vim b/.vim/misc/unix.vim new file mode 100644 index 0000000..f766e74 --- /dev/null +++ b/.vim/misc/unix.vim @@ -0,0 +1,3 @@ +" Settings for test script execution +" Always use "sh", don't use the value of "$SHELL". +set shell=sh diff --git a/.vim/plugin/matrix.vim b/.vim/plugin/matrix.vim new file mode 100644 index 0000000..9ed838d --- /dev/null +++ b/.vim/plugin/matrix.vim @@ -0,0 +1,325 @@ +" matrix.vim - Don Yang (uguu.org) +" +" Matrix screensaver for VIM. +" +"Usage: +" After loading the script, use :Matrix to start. +" Press any key a few times to exit. +" +" You will need to edit s:mindelay and s:maxdelay below to match your +" machine speed and window size. +" +"Known Issues: +" Sometimes you need to press keys a few times to exit instead of just +" once. Press and hold is another way to go... feels like getchar is +" checking for keypress state instead of keystroke availability. +" +" If the window is too small, script will not run. If the window is +" resized and become too small (less than 8 rows or 10 columns) after +" the script started, script will abort and *buffers may be lost*, so +" don't do that. Resizing the window to most other sizes will be fine. +" +" Doesn't work if multiple windows exist before script started. In +" that case the script will abort with error message. +" +" If the current buffer is modified, some error messages will appear +" before the script starts, and an extra window is left behind after +" the script exits. Workaround: save your buffers first. +" +"Other Info: +" Inspired by cmatrix... +" Didn't feel inspired enough to start using pico/nano, of course ^_^; +" +" 05/13/08 - disable cursorline, cursorcolumn and spell +" (thanks to Diederick Niehorster for the suggestion). +" 12/21/06 - multiwindow support by S. Lockwood-Childs. +" 10/03/05 - added silent! to cursor positioning code to stop drawing +" numbers during animation (thanks to David Eggum for the +" suggestion). +" 10/02/05 - disable showmatch +" 03/16/05 - make new buffer modifiable before running +" 01/27/05 - added sleep to consume less CPU +" removed frame counter +" 01/26/05 - initial version + + +" Speed range, must be positive. Lower delay = faster. +let s:mindelay = 1 +let s:maxdelay = 5 + +" Session file for preserving original window layout +let s:session_file = tempname() + + +function! s:Rand() + let b:seed = b:seed * 22695477 + 1 + if b:seed < 0 + return -b:seed + endif + return b:seed +endfunction + +function! s:CreateObject(i) + while 1 + let b:x{a:i} = s:Rand() % b:columns + if b:reserve{b:x{a:i}} > 4 + break + endif + endwhile + let b:y{a:i} = 1 + let b:t{a:i} = s:Rand() % b:s{b:x{a:i}} + let b:head{a:i} = s:Rand() % 4 + let b:len{a:i} = s:Rand() % b:h + 3 + let b:reserve{b:x{a:i}} = 1 - b:len{a:i} +endfunction + +function! s:DrawObject(i) + let x = b:x{a:i} * 2 + 1 + let y = b:y{a:i} + + " Draw head + if y <= b:h + if b:head{a:i} + silent! exec 'norm! :' . y . nr2char(13) . x . '|R' . b:d[s:Rand()%b:dl] . '_' . nr2char(27) + if y > 1 + silent! exec 'norm! kR' . ((s:Rand() % 2) ? '`' : ' ') . nr2char(27) + endif + else + let a = ((s:Rand() % 2) ? '`' : ' ') . nr2char(27) + silent! exec 'norm! :'. y . nr2char(13) . x . '|R' . b:d[s:Rand() % b:dl] . a + endif + else + if b:head{a:i} && y == b:h + 1 + silent! exec 'norm! :' . b:h . nr2char(13) . (x + 1) . '|R' . ((s:Rand() % 2) ? '`' : ' ') . nr2char(27) + endif + endif + + " Draw tail + let y = y - b:len{a:i} + if 1 <= y && y <= b:h + silent! exec 'norm! :'. y . nr2char(13) . x . '|R ' . nr2char(27) + endif + let b:reserve{b:x{a:i}} = y +endfunction + +function! s:Animate() + let i = 0 + + while i < b:objcount + " Animate object + if b:t{i} <= 0 + if b:y{i} - b:len{i} <= b:h + " Draw + call s:DrawObject(i) + let b:t{i} = b:s{b:x{i}} + let b:y{i} = b:y{i} + 1 + else + " Regenerate + call s:CreateObject(i) + endif + endif + + let b:t{i} = b:t{i} - 1 + let i = i + 1 + endwhile + redraw + if getchar(1) + let b:run = 0 + endif + sleep 20m +endfunction + +function! s:Reset() + " Clear screen + let b:w = winwidth(0) + let b:h = winheight(0) + exec 'norm! gg"_dG' . b:h . 'O' . nr2char(27) . 'gg' + redraw + if b:w < 10 || b:h < 8 + let b:run = 0 + return + endif + + " Set number of columns. This is rounded down due to line wrapping + " at the last column if the screen width is even. So you end up + " seeing the cursor blinking a lot at the right side of the screen. + " Alternatively, ':set rl' before running the script to have it + " blink on the left side. + let b:columns = (b:w - 1) / 2 + + " Initialize columns. + let i = 0 + while i < b:columns + " Set delay time. Each column gets the same delay time. + let b:s{i} = s:Rand() % (s:maxdelay - s:mindelay) + s:mindelay + + " Unreserve column + let b:reserve{i} = b:h + let i = i + 1 + endwhile + + " Initialize objects + let b:objcount = b:columns - 2 + let i = 0 + while i < b:objcount + call s:CreateObject(i) + let i = i + 1 + endwhile +endfunction + +function! s:Init() + " Create new buffer and hide the existing buffers. Hiding the + " existing buffers without switching to a new buffer preserves + " undo history. + exec 'mksession! ' . s:session_file + let s:num_orig_win = winnr("$") + + " move to top window, so created window will become window 1, + " then attempt to create new window + 1 wincmd w + silent! new + + " check that there really is an additional window + if winnr("$") != s:num_orig_win + 1 + return 1 + endif + let s:newbuf = bufnr('%') + + " close all but window 1, which is the new window + only + + setl bh=delete bt=nofile ma nolist nonu noro noswf tw=0 nowrap + + " Set GUI options + if has('gui') + let s:o_gcr = &gcr + let s:o_go = &go + set gcr=a:ver1-blinkon0 go= + endif + if has('cmdline_info') + let s:o_ru = &ru + let s:o_sc = &sc + set noru nosc + endif + if has('title') + let s:o_ts = &titlestring + exec 'set titlestring=\ ' + endif + if v:version >= 700 + let s:o_spell = &spell + let s:o_cul = &cul + let s:o_cuc = &cuc + set nospell nocul nocuc + endif + let s:o_ch = &ch + let s:o_ls = &ls + let s:o_lz = &lz + let s:o_siso = &siso + let s:o_sm = &sm + let s:o_smd = &smd + let s:o_so = &so + let s:o_ve = &ve + set ch=1 ls=0 lz nosm nosmd siso=0 so=0 ve=all + + " Initialize PRNG + let b:seed = localtime() + let b:run = 1 + + " Clear screen and initialize objects + call s:Reset() + + " Set colors. Output looks better if your color scheme has black + " background. I would rather not have the script change the + " current color scheme since there is no good way to restore them + " afterwards. + hi MatrixHidden ctermfg=Black ctermbg=Black guifg=#000000 guibg=#000000 + hi MatrixNormal ctermfg=DarkGreen ctermbg=Black guifg=#008000 guibg=#000000 + hi MatrixBold ctermfg=LightGreen ctermbg=Black guifg=#00ff00 guibg=#000000 + hi MatrixHead ctermfg=White ctermbg=Black guifg=#ffffff guibg=#000000 + sy match MatrixNormal /^.*/ contains=MatrixHidden + sy match MatrixHidden contained /.`/ contains=MatrixBold + sy match MatrixHidden contained /._/ contains=MatrixHead + sy match MatrixBold contained /.\(`\)\@=/ + sy match MatrixHead contained /.\(_\)\@=/ + + " Create random char dictionary + let b:d = '' + let i = 33 + while i < 127 + if i != 95 && i != 96 + let b:d = b:d . nr2char(i) + endif + let i = i + 1 + endwhile + let b:dl = strlen(b:d) + return 0 +endfunction + +function! s:Cleanup() + " Restore options + if has('gui') + let &gcr = s:o_gcr + let &go = s:o_go + unlet s:o_gcr s:o_go + endif + if has('cmdline_info') + let &ru = s:o_ru + let &sc = s:o_sc + unlet s:o_ru s:o_sc + endif + if has('title') + let &titlestring = s:o_ts + unlet s:o_ts + endif + if v:version >= 700 + let &spell = s:o_spell + let &cul = s:o_cul + let &cuc = s:o_cuc + unlet s:o_cul s:o_cuc + endif + let &ch = s:o_ch + let &ls = s:o_ls + let &lz = s:o_lz + let &siso = s:o_siso + let &sm = s:o_sm + let &smd = s:o_smd + let &so = s:o_so + let &ve = s:o_ve + unlet s:o_ch s:o_ls s:o_lz s:o_siso s:o_sm s:o_smd s:o_so s:o_ve + + " Restore old buffers + exec 'source ' . s:session_file + exec 'bwipe ' . s:newbuf + unlet s:newbuf + + " Clear keystroke + let c = getchar(0) +endfunction + +function! Matrix() + if s:Init() + echohl ErrorMsg + echon 'Can not create window' + echohl None + return + endif + + while b:run + if b:w != winwidth(0) || b:h != winheight(0) + call s:Reset() + else + call s:Animate() + endif + endwhile + + call s:Cleanup() +endfunction + + +if !has('virtualedit') || !has('windows') || !has('syntax') + echohl ErrorMsg + echon 'Not enough features, need at least +virtualedit, +windows and +syntax' + echohl None +else + command! Matrix call Matrix() +endif diff --git a/.vim/plugin/vcsbzr.vim b/.vim/plugin/vcsbzr.vim new file mode 100644 index 0000000..b8665b8 --- /dev/null +++ b/.vim/plugin/vcsbzr.vim @@ -0,0 +1,262 @@ +" vim600: set foldmethod=marker: +" +" BZR extension for VCSCommand. +" +" Maintainer: Bob Hiestand +" License: +" Copyright (c) Bob Hiestand +" +" Permission is hereby granted, free of charge, to any person obtaining a copy +" of this software and associated documentation files (the "Software"), to +" deal in the Software without restriction, including without limitation the +" rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +" sell copies of the Software, and to permit persons to whom the Software is +" furnished to do so, subject to the following conditions: +" +" The above copyright notice and this permission notice shall be included in +" all copies or substantial portions of the Software. +" +" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +" IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +" FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +" AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +" LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +" FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +" IN THE SOFTWARE. +" +" Section: Documentation {{{1 +" +" Options documentation: {{{2 +" +" VCSCommandBZRExec +" This variable specifies the BZR executable. If not set, it defaults to +" 'bzr' executed from the user's executable path. + +" Section: Plugin header {{{1 + +if exists('VCSCommandDisableAll') + finish +endif + +if v:version < 700 + echohl WarningMsg|echomsg 'VCSCommand requires at least VIM 7.0'|echohl None + finish +endif + +runtime plugin/vcscommand.vim + +if !executable(VCSCommandGetOption('VCSCommandBZRExec', 'bzr')) + " BZR is not installed + finish +endif + +let s:save_cpo=&cpo +set cpo&vim + +" Section: Variable initialization {{{1 + +let s:bzrFunctions = {} + +" Section: Utility functions {{{1 + +" Function: s:Executable() {{{2 +" Returns the executable used to invoke bzr suitable for use in a shell +" command. +function! s:Executable() + return shellescape(VCSCommandGetOption('VCSCommandBZRExec', 'bzr')) +endfunction + +" Function: s:DoCommand(cmd, cmdName, statusText) {{{2 +" Wrapper to VCSCommandDoCommand to add the name of the BZR executable to the +" command argument. +function! s:DoCommand(cmd, cmdName, statusText, options) + if VCSCommandGetVCSType(expand('%')) == 'BZR' + let fullCmd = s:Executable() . ' ' . a:cmd + return VCSCommandDoCommand(fullCmd, a:cmdName, a:statusText, a:options) + else + throw 'BZR VCSCommand plugin called on non-BZR item.' + endif +endfunction + +" Section: VCS function implementations {{{1 + +" Function: s:bzrFunctions.Identify(buffer) {{{2 +function! s:bzrFunctions.Identify(buffer) + let fileName = resolve(bufname(a:buffer)) + let l:save_bzr_log=$BZR_LOG + try + let $BZR_LOG=has("win32") || has("win95") || has("win64") || has("win16") ? "nul" : "/dev/null" + let statusText = s:VCSCommandUtility.system(s:Executable() . ' info -- "' . fileName . '"') + finally + let $BZR_LOG=l:save_bzr_log + endtry + if(v:shell_error) + return 0 + else + return 1 + endif +endfunction + +" Function: s:bzrFunctions.Add() {{{2 +function! s:bzrFunctions.Add(argList) + return s:DoCommand(join(['add'] + a:argList, ' '), 'add', join(a:argList, ' '), {}) +endfunction + +" Function: s:bzrFunctions.Annotate(argList) {{{2 +function! s:bzrFunctions.Annotate(argList) + if len(a:argList) == 0 + if &filetype == 'BZRannotate' + " Perform annotation of the version indicated by the current line. + let caption = matchstr(getline('.'),'\v^\s+\zs\d+') + let options = ' -r' . caption + else + let caption = '' + let options = '' + endif + elseif len(a:argList) == 1 && a:argList[0] !~ '^-' + let caption = a:argList[0] + let options = ' -r' . caption + else + let caption = join(a:argList, ' ') + let options = ' ' . caption + endif + + let resultBuffer = s:DoCommand('blame' . options, 'annotate', caption, {}) + if resultBuffer > 0 + normal 1G2dd + endif + return resultBuffer +endfunction + +" Function: s:bzrFunctions.Commit(argList) {{{2 +function! s:bzrFunctions.Commit(argList) + let resultBuffer = s:DoCommand('commit -F "' . a:argList[0] . '"', 'commit', '', {}) + if resultBuffer == 0 + echomsg 'No commit needed.' + endif +endfunction + +" Function: s:bzrFunctions.Delete() {{{2 +function! s:bzrFunctions.Delete(argList) + return s:DoCommand(join(['rm'] + a:argList, ' '), 'rm', join(a:argList, ' '), {}) +endfunction + +" Function: s:bzrFunctions.Diff(argList) {{{2 +function! s:bzrFunctions.Diff(argList) + if len(a:argList) == 0 + let revOptions = [] + let caption = '' + elseif len(a:argList) <= 2 && match(a:argList, '^-') == -1 + let revOptions = ['-r' . join(a:argList, '..')] + let caption = '(' . a:argList[0] . ' : ' . get(a:argList, 1, 'current') . ')' + else + " Pass-through + let caption = join(a:argList, ' ') + let revOptions = a:argList + endif + + return s:DoCommand(join(['diff'] + revOptions), 'diff', caption, {'allowNonZeroExit': 1}) +endfunction + +" Function: s:bzrFunctions.GetBufferInfo() {{{2 +" Provides version control details for the current file. Current version +" number and current repository version number are required to be returned by +" the vcscommand plugin. +" Returns: List of results: [revision, repository] + +function! s:bzrFunctions.GetBufferInfo() + let originalBuffer = VCSCommandGetOriginalBuffer(bufnr('%')) + let fileName = resolve(bufname(originalBuffer)) + let statusText = s:VCSCommandUtility.system(s:Executable() . ' status -S -- "' . fileName . '"') + let revision = s:VCSCommandUtility.system(s:Executable() . ' revno -- "' . fileName . '"') + if(v:shell_error) + return [] + endif + + " File not under BZR control. + if statusText =~ '^?' + return ['Unknown'] + endif + + let [flags, repository] = matchlist(statusText, '^\(.\{3}\)\s\+\(\S\+\)')[1:2] + if revision == '' + " Error + return ['Unknown'] + elseif flags =~ '^A' + return ['New', 'New'] + else + return [revision, repository] + endif +endfunction + +" Function: s:bzrFunctions.Info(argList) {{{2 +function! s:bzrFunctions.Info(argList) + return s:DoCommand(join(['version-info'] + a:argList, ' '), 'version-info', join(a:argList, ' '), {}) +endfunction + +" Function: s:bzrFunctions.Lock(argList) {{{2 +function! s:bzrFunctions.Lock(argList) + echomsg 'bzr lock is not necessary' +endfunction + +" Function: s:bzrFunctions.Log() {{{2 +function! s:bzrFunctions.Log(argList) + if len(a:argList) == 0 + let options = [] + let caption = '' + elseif len(a:argList) <= 2 && match(a:argList, '^-') == -1 + let options = ['-r' . join(a:argList, ':')] + let caption = options[0] + else + " Pass-through + let options = a:argList + let caption = join(a:argList, ' ') + endif + + let resultBuffer = s:DoCommand(join(['log', '-v'] + options), 'log', caption, {}) + return resultBuffer +endfunction + +" Function: s:bzrFunctions.Revert(argList) {{{2 +function! s:bzrFunctions.Revert(argList) + return s:DoCommand('revert', 'revert', '', {}) +endfunction + +" Function: s:bzrFunctions.Review(argList) {{{2 +function! s:bzrFunctions.Review(argList) + if len(a:argList) == 0 + let versiontag = '(current)' + let versionOption = '' + else + let versiontag = a:argList[0] + let versionOption = ' -r ' . versiontag . ' ' + endif + + return s:DoCommand('cat' . versionOption, 'review', versiontag, {}) +endfunction + +" Function: s:bzrFunctions.Status(argList) {{{2 +function! s:bzrFunctions.Status(argList) + let options = ['-S'] + if len(a:argList) != 0 + let options = a:argList + endif + return s:DoCommand(join(['status'] + options, ' '), 'status', join(options, ' '), {}) +endfunction + +" Function: s:bzrFunctions.Unlock(argList) {{{2 +function! s:bzrFunctions.Unlock(argList) + echomsg 'bzr unlock is not necessary' +endfunction +" Function: s:bzrFunctions.Update(argList) {{{2 +function! s:bzrFunctions.Update(argList) + return s:DoCommand('update', 'update', '', {}) +endfunction + +" Annotate setting {{{2 +let s:bzrFunctions.AnnotateSplitRegex = '^[^|]\+ | ' + +" Section: Plugin Registration {{{1 +let s:VCSCommandUtility = VCSCommandRegisterModule('BZR', expand(''), s:bzrFunctions, []) + +let &cpo = s:save_cpo diff --git a/.vim/plugin/vcscommand.vim b/.vim/plugin/vcscommand.vim new file mode 100644 index 0000000..98214f2 --- /dev/null +++ b/.vim/plugin/vcscommand.vim @@ -0,0 +1,1427 @@ +" vim600: set foldmethod=marker: +" +" Vim plugin to assist in working with files under control of various Version +" Control Systems, such as CVS, SVN, SVK, and git. +" +" Maintainer: Bob Hiestand +" License: +" Copyright (c) Bob Hiestand +" +" Permission is hereby granted, free of charge, to any person obtaining a copy +" of this software and associated documentation files (the "Software"), to +" deal in the Software without restriction, including without limitation the +" rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +" sell copies of the Software, and to permit persons to whom the Software is +" furnished to do so, subject to the following conditions: +" +" The above copyright notice and this permission notice shall be included in +" all copies or substantial portions of the Software. +" +" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +" IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +" FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +" AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +" LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +" FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +" IN THE SOFTWARE. +" +" Section: Documentation {{{1 +" +" Provides functions to invoke various source control commands on the current +" file (either the current buffer, or, in the case of an directory buffer, the +" directory and all subdirectories associated with the current buffer). The +" output of the commands is captured in a new scratch window. +" +" This plugin needs additional extension plugins, each specific to a source +" control system, to function. Several options include the name of the +" version control system in the option name. Such options use the placeholder +" text '{VCSType}', which would be replaced in actual usage with 'CVS' or +" 'SVN', for instance. +" +" Command documentation {{{2 +" +" VCSAdd Adds the current file to source control. +" +" VCSAnnotate[!] Displays the current file with each line annotated with the +" version in which it was most recently changed. If an +" argument is given, the argument is used as a revision +" number to display. If not given an argument, it uses the +" most recent version of the file on the current branch. +" Additionally, if the current buffer is a VCSAnnotate buffer +" already, the version number on the current line is used. +" +" If '!' is used, the view of the annotated buffer is split +" so that the annotation is in a separate window from the +" content, and each is highlighted separately. +" +" VCSBlame Alias for 'VCSAnnotate'. +" +" VCSCommit[!] Commits changes to the current file to source control. +" +" If called with arguments, the arguments are the log message. +" +" If '!' is used, an empty log message is committed. +" +" If called with no arguments, this is a two-step command. +" The first step opens a buffer to accept a log message. +" When that buffer is written, it is automatically closed and +" the file is committed using the information from that log +" message. The commit can be abandoned if the log message +" buffer is deleted or wiped before being written. +" +" VCSDelete Deletes the current file and removes it from source control. +" +" VCSDiff With no arguments, this displays the differences between +" the current file and its parent version under source +" control in a new scratch buffer. +" +" With one argument, the diff is performed on the +" current file against the specified revision. +" +" With two arguments, the diff is performed between the +" specified revisions of the current file. +" +" This command uses the 'VCSCommand{VCSType}DiffOpt' variable +" to specify diff options. If that variable does not exist, +" a plugin-specific default is used. If you wish to have no +" options, then set it to the empty string. +" +" VCSGotoOriginal Jumps to the source buffer if the current buffer is a VCS +" scratch buffer. If VCSGotoOriginal[!] is used, remove all +" VCS scratch buffers associated with the original file. +" +" VCSInfo Displays extended information about the current file in a +" new scratch buffer. +" +" VCSLock Locks the current file in order to prevent other users from +" concurrently modifying it. The exact semantics of this +" command depend on the underlying VCS. +" +" VCSLog Displays the version history of the current file in a new +" scratch buffer. +" +" VCSRemove Alias for 'VCSDelete'. +" +" VCSRevert Replaces the modified version of the current file with the +" most recent version from the repository. +" +" VCSReview Displays a particular version of the current file in a new +" scratch buffer. If no argument is given, the most recent +" version of the file on the current branch is retrieved. +" +" VCSStatus Displays versioning information about the current file in a +" new scratch buffer. +" +" VCSUnlock Unlocks the current file in order to allow other users from +" concurrently modifying it. The exact semantics of this +" command depend on the underlying VCS. +" +" VCSUpdate Updates the current file with any relevant changes from the +" repository. +" +" VCSVimDiff Uses vimdiff to display differences between versions of the +" current file. +" +" If no revision is specified, the most recent version of the +" file on the current branch is used. With one argument, +" that argument is used as the revision as above. With two +" arguments, the differences between the two revisions is +" displayed using vimdiff. +" +" With either zero or one argument, the original buffer is +" used to perform the vimdiff. When the scratch buffer is +" closed, the original buffer will be returned to normal +" mode. +" +" Once vimdiff mode is started using the above methods, +" additional vimdiff buffers may be added by passing a single +" version argument to the command. There may be up to 4 +" vimdiff buffers total. +" +" Using the 2-argument form of the command resets the vimdiff +" to only those 2 versions. Additionally, invoking the +" command on a different file will close the previous vimdiff +" buffers. +" +" Mapping documentation: {{{2 +" +" By default, a mapping is defined for each command. User-provided mappings +" can be used instead by mapping to CommandName, for instance: +" +" nmap ,ca VCSAdd +" +" The default mappings are as follow: +" +" ca VCSAdd +" cn VCSAnnotate +" cN VCSAnnotate! +" cc VCSCommit +" cD VCSDelete +" cd VCSDiff +" cg VCSGotoOriginal +" cG VCSGotoOriginal! +" ci VCSInfo +" cl VCSLog +" cL VCSLock +" cr VCSReview +" cs VCSStatus +" cu VCSUpdate +" cU VCSUnlock +" cv VCSVimDiff +" +" Options documentation: {{{2 +" +" Several variables are checked by the script to determine behavior as follow: +" +" VCSCommandCommitOnWrite +" This variable, if set to a non-zero value, causes the pending commit to +" take place immediately as soon as the log message buffer is written. If +" set to zero, only the VCSCommit mapping will cause the pending commit to +" occur. If not set, it defaults to 1. +" +" VCSCommandDeleteOnHide +" This variable, if set to a non-zero value, causes the temporary VCS result +" buffers to automatically delete themselves when hidden. +" +" VCSCommand{VCSType}DiffOpt +" This variable, if set, determines the options passed to the diff command +" of the underlying VCS. Each VCS plugin defines a default value. +" +" VCSCommandDiffSplit +" This variable overrides the VCSCommandSplit variable, but only for buffers +" created with VCSVimDiff. +" +" VCSCommandDisableAll +" This variable, if set, prevents the plugin or any extensions from loading +" at all. This is useful when a single runtime distribution is used on +" multiple systems with varying versions. +" +" VCSCommandDisableMappings +" This variable, if set to a non-zero value, prevents the default command +" mappings from being set. +" +" VCSCommandDisableExtensionMappings +" This variable, if set to a non-zero value, prevents the default command +" mappings from being set for commands specific to an individual VCS. +" +" VCSCommandDisableMenu +" This variable, if set to a non-zero value, prevents the default command +" menu from being set. +" +" VCSCommandEdit +" This variable controls whether to split the current window to display a +" scratch buffer ('split'), or to display it in the current buffer ('edit'). +" If not set, it defaults to 'split'. +" +" VCSCommandEnableBufferSetup +" This variable, if set to a non-zero value, activates VCS buffer management +" mode. This mode means that the buffer variable 'VCSRevision' is set if +" the file is VCS-controlled. This is useful for displaying version +" information in the status bar. Additional options may be set by +" individual VCS plugins. +" +" VCSCommandMappings +" This variable, if set, overrides the default mappings used for shortcuts. +" It should be a List of 2-element Lists, each containing a shortcut and +" function name pair. +" +" VCSCommandMapPrefix +" This variable, if set, overrides the default mapping prefix ('c'). +" This allows customization of the mapping space used by the vcscommand +" shortcuts. +" +" VCSCommandMenuPriority +" This variable, if set, overrides the default menu priority '' (empty) +" +" VCSCommandMenuRoot +" This variable, if set, overrides the default menu root 'Plugin.VCS' +" +" VCSCommandResultBufferNameExtension +" This variable, if set to a non-blank value, is appended to the name of the +" VCS command output buffers. For example, '.vcs'. Using this option may +" help avoid problems caused by autocommands dependent on file extension. +" +" VCSCommandResultBufferNameFunction +" This variable, if set, specifies a custom function for naming VCS command +" output buffers. This function will be passed the following arguments: +" +" command - name of the VCS command being executed (such as 'Log' or +" 'Diff'). +" +" originalBuffer - buffer number of the source file. +" +" vcsType - type of VCS controlling this file (such as 'CVS' or 'SVN'). +" +" statusText - extra text associated with the VCS action (such as version +" numbers). +" +" VCSCommandSplit +" This variable controls the orientation of the various window splits that +" may occur (such as with VCSVimDiff, when using a VCS command on a VCS +" command buffer, or when the 'VCSCommandEdit' variable is set to 'split'. +" If set to 'horizontal', the resulting windows will be on stacked on top of +" one another. If set to 'vertical', the resulting windows will be +" side-by-side. If not set, it defaults to 'horizontal' for all but +" VCSVimDiff windows. +" +" VCSCommandVCSTypeOverride +" This variable allows the VCS type detection to be overridden on a +" path-by-path basis. The value of this variable is expected to be a List +" of Lists. Each high-level List item is a List containing two elements. +" The first element is a regular expression that will be matched against the +" full file name of a given buffer. If it matches, the second element will +" be used as the VCS type. +" +" Event documentation {{{2 +" For additional customization, VCSCommand.vim uses User event autocommand +" hooks. Each event is in the VCSCommand group, and different patterns +" match the various hooks. +" +" For instance, the following could be added to the vimrc to provide a 'q' +" mapping to quit a VCS scratch buffer: +" +" augroup VCSCommand +" au VCSCommand User VCSBufferCreated silent! nmap q :bwipeout +" augroup END +" +" The following hooks are available: +" +" VCSBufferCreated This event is fired just after a VCS command +" output buffer is created. It is executed +" within the context of the new buffer. +" +" VCSBufferSetup This event is fired just after VCS buffer setup +" occurs, if enabled. +" +" VCSPluginInit This event is fired when the VCSCommand plugin +" first loads. +" +" VCSPluginFinish This event is fired just after the VCSCommand +" plugin loads. +" +" VCSVimDiffFinish This event is fired just after the VCSVimDiff +" command executes to allow customization of, +" for instance, window placement and focus. +" +" Section: Plugin header {{{1 + +" loaded_VCSCommand is set to 1 when the initialization begins, and 2 when it +" completes. This allows various actions to only be taken by functions after +" system initialization. + +if exists('VCSCommandDisableAll') + finish +endif + +if exists('loaded_VCSCommand') + finish +endif +let loaded_VCSCommand = 1 + +if v:version < 700 + echohl WarningMsg|echomsg 'VCSCommand requires at least VIM 7.0'|echohl None + finish +endif + +let s:save_cpo=&cpo +set cpo&vim + +" Section: Event group setup {{{1 + +augroup VCSCommand +augroup END + +augroup VCSCommandCommit +augroup END + +" Section: Plugin initialization {{{1 +silent do VCSCommand User VCSPluginInit + +" Section: Constants declaration {{{1 + +let g:VCSCOMMAND_IDENTIFY_EXACT = 1 +let g:VCSCOMMAND_IDENTIFY_INEXACT = -1 + +" Section: Script variable initialization {{{1 + +" Hidden functions for use by extensions +let s:VCSCommandUtility = {} + +" plugin-specific information: {vcs -> [script, {command -> function}, {key -> mapping}]} +let s:plugins = {} + +" temporary values of overridden configuration variables +let s:optionOverrides = {} + +" state flag used to vary behavior of certain automated actions +let s:isEditFileRunning = 0 + +" Section: Utility functions {{{1 + +" Function: s:ReportError(mapping) {{{2 +" Displays the given error in a consistent faction. This is intended to be +" invoked from a catch statement. + +function! s:ReportError(error) + echohl WarningMsg|echomsg 'VCSCommand: ' . a:error|echohl None +endfunction + +" Function: s:VCSCommandUtility.system(...) {{{2 +" Replacement for system() function. This version protects the quoting in the +" command line on Windows systems. + +function! s:VCSCommandUtility.system(...) + if (has("win32") || has("win64")) && &sxq !~ '"' + let save_sxq = &sxq + set sxq=\" + endif + try + return call('system', a:000) + finally + if exists("save_sxq") + let &sxq = save_sxq + endif + endtry +endfunction + +" Function: s:VCSCommandUtility.addMenuItem(shortcut, command) {{{2 +" Adds the given menu item. + +function! s:VCSCommandUtility.addMenuItem(shortcut, command) + if s:menuEnabled + exe 'amenu '.s:menuPriority.' '.s:menuRoot.'.'.a:shortcut.' '.a:command + endif +endfunction + +" Function: s:ClearMenu() {{{2 +" Removes all VCSCommand menu items +function! s:ClearMenu() + if s:menuEnabled + execute 'aunmenu' s:menuRoot + endif +endfunction + +" Function: s:CreateMapping(shortcut, expansion, display) {{{2 +" Creates the given mapping by prepending the contents of +" 'VCSCommandMapPrefix' (by default 'c') to the given shortcut and +" mapping it to the given plugin function. If a mapping exists for the +" specified shortcut + prefix, emit an error but continue. If a mapping +" exists for the specified function, do nothing. + +function! s:CreateMapping(shortcut, expansion, display) + let lhs = VCSCommandGetOption('VCSCommandMapPrefix', 'c') . a:shortcut + if !hasmapto(a:expansion) + try + execute 'nmap ' lhs a:expansion + catch /^Vim(.*):E227:/ + if(&verbose != 0) + echohl WarningMsg|echomsg 'VCSCommand: mapping ''' . lhs . ''' already exists, refusing to overwrite. The mapping for ' . a:display . ' will not be available.'|echohl None + endif + endtry + endif +endfunction + +" Function: s:ExecuteExtensionMapping(mapping) {{{2 +" Invokes the appropriate extension mapping depending on the type of the +" current buffer. + +function! s:ExecuteExtensionMapping(mapping) + let buffer = bufnr('%') + let vcsType = VCSCommandGetVCSType(buffer) + if !has_key(s:plugins, vcsType) + throw 'Unknown VCS type: ' . vcsType + endif + if !has_key(s:plugins[vcsType][2], a:mapping) + throw 'This extended mapping is not defined for ' . vcsType + endif + silent execute 'normal' ':' . s:plugins[vcsType][2][a:mapping] . "\" +endfunction + +" Function: s:ExecuteVCSCommand(command, argList) {{{2 +" Calls the indicated plugin-specific VCS command on the current buffer. +" Returns: buffer number of resulting output scratch buffer, or -1 if an error +" occurs. + +function! s:ExecuteVCSCommand(command, argList) + try + let buffer = bufnr('%') + + let vcsType = VCSCommandGetVCSType(buffer) + if !has_key(s:plugins, vcsType) + throw 'Unknown VCS type: ' . vcsType + endif + + let originalBuffer = VCSCommandGetOriginalBuffer(buffer) + let bufferName = bufname(originalBuffer) + + " It is already known that the directory is under VCS control. No further + " checks are needed. Otherwise, perform some basic sanity checks to avoid + " VCS-specific error messages from confusing things. + if !isdirectory(bufferName) + if !filereadable(bufferName) + throw 'No such file ' . bufferName + endif + endif + + let functionMap = s:plugins[vcsType][1] + if !has_key(functionMap, a:command) + throw 'Command ''' . a:command . ''' not implemented for ' . vcsType + endif + return functionMap[a:command](a:argList) + catch + call s:ReportError(v:exception) + return -1 + endtry +endfunction + +" Function: s:GenerateResultBufferName(command, originalBuffer, vcsType, statusText) {{{2 +" Default method of generating the name for VCS result buffers. This can be +" overridden with the VCSResultBufferNameFunction variable. + +function! s:GenerateResultBufferName(command, originalBuffer, vcsType, statusText) + let fileName = bufname(a:originalBuffer) + let bufferName = a:vcsType . ' ' . a:command + if strlen(a:statusText) > 0 + let bufferName .= ' ' . a:statusText + endif + let bufferName .= ' ' . fileName + let counter = 0 + let versionedBufferName = bufferName + while bufexists(versionedBufferName) + let counter += 1 + let versionedBufferName = bufferName . ' (' . counter . ')' + endwhile + return versionedBufferName +endfunction + +" Function: s:GenerateResultBufferNameWithExtension(command, originalBuffer, vcsType, statusText) {{{2 +" Method of generating the name for VCS result buffers that uses the original +" file name with the VCS type and command appended as extensions. + +function! s:GenerateResultBufferNameWithExtension(command, originalBuffer, vcsType, statusText) + let fileName = bufname(a:originalBuffer) + let bufferName = a:vcsType . ' ' . a:command + if strlen(a:statusText) > 0 + let bufferName .= ' ' . a:statusText + endif + let bufferName .= ' ' . fileName . VCSCommandGetOption('VCSCommandResultBufferNameExtension', '.vcs') + let counter = 0 + let versionedBufferName = bufferName + while bufexists(versionedBufferName) + let counter += 1 + let versionedBufferName = '(' . counter . ') ' . bufferName + endwhile + return versionedBufferName +endfunction + +" Function: s:EditFile(command, originalBuffer, statusText) {{{2 +" Creates a new buffer of the given name and associates it with the given +" original buffer. + +function! s:EditFile(command, originalBuffer, statusText) + let vcsType = getbufvar(a:originalBuffer, 'VCSCommandVCSType') + + " Protect against useless buffer set-up + let s:isEditFileRunning += 1 + try + let editCommand = VCSCommandGetOption('VCSCommandEdit', 'split') + if editCommand == 'split' + if VCSCommandGetOption('VCSCommandSplit', 'horizontal') == 'horizontal' + rightbelow split + else + vert rightbelow split + endif + endif + + enew + + call s:SetupScratchBuffer(a:command, vcsType, a:originalBuffer, a:statusText) + + finally + let s:isEditFileRunning -= 1 + endtry +endfunction + +" Function: s:SetupScratchBuffer(command, vcsType, originalBuffer, statusText) {{{2 +" Creates convenience buffer variables and the name of a vcscommand result +" buffer. + +function! s:SetupScratchBuffer(command, vcsType, originalBuffer, statusText) + let nameExtension = VCSCommandGetOption('VCSCommandResultBufferNameExtension', '') + if nameExtension == '' + let nameFunction = VCSCommandGetOption('VCSCommandResultBufferNameFunction', 's:GenerateResultBufferName') + else + let nameFunction = VCSCommandGetOption('VCSCommandResultBufferNameFunction', 's:GenerateResultBufferNameWithExtension') + endif + + let name = call(nameFunction, [a:command, a:originalBuffer, a:vcsType, a:statusText]) + + let b:VCSCommandCommand = a:command + let b:VCSCommandOriginalBuffer = a:originalBuffer + let b:VCSCommandSourceFile = bufname(a:originalBuffer) + let b:VCSCommandVCSType = a:vcsType + if a:statusText != '' + let b:VCSCommandStatusText = a:statusText + endif + + setlocal buftype=nofile + setlocal noswapfile + let &filetype = tolower(a:vcsType . a:command) + + if VCSCommandGetOption('VCSCommandDeleteOnHide', 0) + setlocal bufhidden=delete + endif + silent noautocmd file `=name` +endfunction + +" Function: s:SetupBuffer() {{{2 +" Attempts to set the b:VCSCommandBufferInfo variable + +function! s:SetupBuffer() + if (exists('b:VCSCommandBufferSetup') && b:VCSCommandBufferSetup) + " This buffer is already set up. + return + endif + + if !isdirectory(@%) && (strlen(&buftype) > 0 || !filereadable(@%)) + " No special status for special buffers other than directory buffers. + return + endif + + if !VCSCommandGetOption('VCSCommandEnableBufferSetup', 0) || s:isEditFileRunning > 0 + unlet! b:VCSCommandBufferSetup + return + endif + + try + let vcsType = VCSCommandGetVCSType(bufnr('%')) + let b:VCSCommandBufferInfo = s:plugins[vcsType][1].GetBufferInfo() + silent do VCSCommand User VCSBufferSetup + catch /No suitable plugin/ + " This is not a VCS-controlled file. + let b:VCSCommandBufferInfo = [] + endtry + + let b:VCSCommandBufferSetup = 1 +endfunction + +" Function: s:MarkOrigBufferForSetup(buffer) {{{2 +" Resets the buffer setup state of the original buffer for a given VCS scratch +" buffer. +" Returns: The VCS buffer number in a passthrough mode. + +function! s:MarkOrigBufferForSetup(buffer) + checktime + if a:buffer > 0 + let origBuffer = VCSCommandGetOriginalBuffer(a:buffer) + " This should never not work, but I'm paranoid + if origBuffer != a:buffer + call setbufvar(origBuffer, 'VCSCommandBufferSetup', 0) + endif + endif + return a:buffer +endfunction + +" Function: s:OverrideOption(option, [value]) {{{2 +" Provides a temporary override for the given VCS option. If no value is +" passed, the override is disabled. + +function! s:OverrideOption(option, ...) + if a:0 == 0 + call remove(s:optionOverrides[a:option], -1) + else + if !has_key(s:optionOverrides, a:option) + let s:optionOverrides[a:option] = [] + endif + call add(s:optionOverrides[a:option], a:1) + endif +endfunction + +" Function: s:WipeoutCommandBuffers() {{{2 +" Clears all current VCS output buffers of the specified type for a given source. + +function! s:WipeoutCommandBuffers(originalBuffer, VCSCommand) + let buffer = 1 + while buffer <= bufnr('$') + if getbufvar(buffer, 'VCSCommandOriginalBuffer') == a:originalBuffer + if getbufvar(buffer, 'VCSCommandCommand') == a:VCSCommand + execute 'bw' buffer + endif + endif + let buffer = buffer + 1 + endwhile +endfunction + +" Function: s:VimDiffRestore(vimDiffBuff) {{{2 +" Checks whether the given buffer is one whose deletion should trigger +" restoration of an original buffer after it was diffed. If so, it executes +" the appropriate setting command stored with that original buffer. + +function! s:VimDiffRestore(vimDiffBuff) + let s:isEditFileRunning += 1 + try + if exists('t:vcsCommandVimDiffSourceBuffer') + if a:vimDiffBuff == t:vcsCommandVimDiffSourceBuffer + " Original file is being removed. + unlet! t:vcsCommandVimDiffSourceBuffer + unlet! t:vcsCommandVimDiffRestoreCmd + unlet! t:vcsCommandVimDiffScratchList + else + let index = index(t:vcsCommandVimDiffScratchList, a:vimDiffBuff) + if index >= 0 + call remove(t:vcsCommandVimDiffScratchList, index) + if len(t:vcsCommandVimDiffScratchList) == 0 + if exists('t:vcsCommandVimDiffRestoreCmd') + " All scratch buffers are gone, reset the original. + " Only restore if the source buffer is still in Diff mode + + let sourceWinNR = bufwinnr(t:vcsCommandVimDiffSourceBuffer) + if sourceWinNR != -1 + " The buffer is visible in at least one window + let currentWinNR = winnr() + while winbufnr(sourceWinNR) != -1 + if winbufnr(sourceWinNR) == t:vcsCommandVimDiffSourceBuffer + execute sourceWinNR . 'wincmd w' + if getwinvar(0, '&diff') + execute t:vcsCommandVimDiffRestoreCmd + endif + endif + let sourceWinNR = sourceWinNR + 1 + endwhile + execute currentWinNR . 'wincmd w' + else + " The buffer is hidden. It must be visible in order to set the + " diff option. + let currentBufNR = bufnr('') + execute 'hide buffer' t:vcsCommandVimDiffSourceBuffer + if getwinvar(0, '&diff') + execute t:vcsCommandVimDiffRestoreCmd + endif + execute 'hide buffer' currentBufNR + endif + + unlet t:vcsCommandVimDiffRestoreCmd + endif + " All buffers are gone. + unlet t:vcsCommandVimDiffSourceBuffer + unlet t:vcsCommandVimDiffScratchList + endif + endif + endif + endif + finally + let s:isEditFileRunning -= 1 + endtry +endfunction + +" Section: Generic VCS command functions {{{1 + +" Function: s:VCSAnnotate(...) {{{2 +function! s:VCSAnnotate(bang, ...) + try + let line = line('.') + let currentBuffer = bufnr('%') + let originalBuffer = VCSCommandGetOriginalBuffer(currentBuffer) + + let annotateBuffer = s:ExecuteVCSCommand('Annotate', a:000) + if annotateBuffer == -1 + return -1 + endif + if a:bang == '!' && VCSCommandGetOption('VCSCommandDisableSplitAnnotate', 0) == 0 + let vcsType = VCSCommandGetVCSType(annotateBuffer) + let functionMap = s:plugins[vcsType][1] + let splitRegex = '' + if has_key(s:plugins[vcsType][1], 'AnnotateSplitRegex') + let splitRegex = s:plugins[vcsType][1]['AnnotateSplitRegex'] + endif + let splitRegex = VCSCommandGetOption('VCSCommand' . vcsType . 'AnnotateSplitRegex', splitRegex) + if splitRegex == '' + return annotateBuffer + endif + let originalFileType = getbufvar(originalBuffer, '&ft') + let annotateFileType = getbufvar(annotateBuffer, '&ft') + execute "normal 0zR\G/" . splitRegex . "/e\d" + call setbufvar('%', '&filetype', getbufvar(originalBuffer, '&filetype')) + set scrollbind + leftabove vert new + normal 0P + execute "normal" . col('$') . "\|" + call s:SetupScratchBuffer('annotate', vcsType, originalBuffer, 'header') + wincmd l + endif + + if currentBuffer == originalBuffer + " Starting from the original source buffer, so the + " current line is relevant. + if a:0 == 0 + " No argument list means that we're annotating + " the current version, so jumping to the same + " line is the expected action. + execute "normal" line . 'G' + if has('folding') + " The execution of the buffer created autocommand + " re-folds the buffer. Display the current line + " unfolded. + normal zv + endif + endif + endif + + return annotateBuffer + catch + call s:ReportError(v:exception) + return -1 + endtry +endfunction + +" Function: s:VCSCommit() {{{2 +function! s:VCSCommit(bang, message) + try + let vcsType = VCSCommandGetVCSType(bufnr('%')) + if !has_key(s:plugins, vcsType) + throw 'Unknown VCS type: ' . vcsType + endif + + let originalBuffer = VCSCommandGetOriginalBuffer(bufnr('%')) + + " Handle the commit message being specified. If a message is supplied, it + " is used; if bang is supplied, an empty message is used; otherwise, the + " user is provided a buffer from which to edit the commit message. + + if strlen(a:message) > 0 || a:bang == '!' + return s:VCSFinishCommit([a:message], originalBuffer) + endif + + call s:EditFile('commitlog', originalBuffer, '') + setlocal ft=vcscommit + + " Create a commit mapping. + + nnoremap VCSCommit :call VCSFinishCommitWithBuffer() + + silent 0put ='VCS: ----------------------------------------------------------------------' + silent put ='VCS: Please enter log message. Lines beginning with ''VCS:'' are removed automatically.' + silent put ='VCS: To finish the commit, Type cc (or your own VCSCommit mapping)' + + if VCSCommandGetOption('VCSCommandCommitOnWrite', 1) == 1 + setlocal buftype=acwrite + au VCSCommandCommit BufWriteCmd call s:VCSFinishCommitWithBuffer() + silent put ='VCS: or write this buffer' + endif + + silent put ='VCS: ----------------------------------------------------------------------' + $ + setlocal nomodified + silent do VCSCommand User VCSBufferCreated + catch + call s:ReportError(v:exception) + return -1 + endtry +endfunction + +" Function: s:VCSFinishCommitWithBuffer() {{{2 +" Wrapper for s:VCSFinishCommit which is called only from a commit log buffer +" which removes all lines starting with 'VCS:'. + +function! s:VCSFinishCommitWithBuffer() + setlocal nomodified + let currentBuffer = bufnr('%') + let logMessageList = getbufline('%', 1, '$') + call filter(logMessageList, 'v:val !~ ''^\s*VCS:''') + let resultBuffer = s:VCSFinishCommit(logMessageList, b:VCSCommandOriginalBuffer) + if resultBuffer >= 0 + execute 'bw' currentBuffer + endif + return resultBuffer +endfunction + +" Function: s:VCSFinishCommit(logMessageList, originalBuffer) {{{2 +function! s:VCSFinishCommit(logMessageList, originalBuffer) + let messageFileName = tempname() + call writefile(a:logMessageList, messageFileName) + try + let resultBuffer = s:ExecuteVCSCommand('Commit', [messageFileName]) + if resultBuffer < 0 + return resultBuffer + endif + return s:MarkOrigBufferForSetup(resultBuffer) + finally + call delete(messageFileName) + endtry +endfunction + +" Function: s:VCSGotoOriginal(bang) {{{2 +function! s:VCSGotoOriginal(bang) + let originalBuffer = VCSCommandGetOriginalBuffer(bufnr('%')) + if originalBuffer > 0 + let origWinNR = bufwinnr(originalBuffer) + if origWinNR == -1 + execute 'buffer' originalBuffer + else + execute origWinNR . 'wincmd w' + endif + if a:bang == '!' + let buffnr = 1 + let buffmaxnr = bufnr('$') + while buffnr <= buffmaxnr + if getbufvar(buffnr, 'VCSCommandOriginalBuffer') == originalBuffer + execute 'bw' buffnr + endif + let buffnr = buffnr + 1 + endwhile + endif + endif +endfunction + +function! s:VCSDiff(...) "{{{2 + let resultBuffer = s:ExecuteVCSCommand('Diff', a:000) + if resultBuffer > 0 + let &filetype = 'diff' + elseif resultBuffer == 0 + echomsg 'No differences found' + endif + return resultBuffer +endfunction + +function! s:VCSReview(...) "{{{2 + let resultBuffer = s:ExecuteVCSCommand('Review', a:000) + if resultBuffer > 0 + let &filetype = getbufvar(b:VCSCommandOriginalBuffer, '&filetype') + endif + return resultBuffer +endfunction + +" Function: s:VCSVimDiff(...) {{{2 +function! s:VCSVimDiff(...) + try + let vcsType = VCSCommandGetVCSType(bufnr('%')) + if !has_key(s:plugins, vcsType) + throw 'Unknown VCS type: ' . vcsType + endif + let originalBuffer = VCSCommandGetOriginalBuffer(bufnr('%')) + let s:isEditFileRunning = s:isEditFileRunning + 1 + try + " If there's already a VimDiff'ed window, restore it. + " There may only be one VCSVimDiff original window at a time. + + if exists('t:vcsCommandVimDiffSourceBuffer') && t:vcsCommandVimDiffSourceBuffer != originalBuffer + " Clear the existing vimdiff setup by removing the result buffers. + call s:WipeoutCommandBuffers(t:vcsCommandVimDiffSourceBuffer, 'vimdiff') + endif + + let orientation = &diffopt =~ 'horizontal' ? 'horizontal' : 'vertical' + let orientation = VCSCommandGetOption('VCSCommandSplit', orientation) + let orientation = VCSCommandGetOption('VCSCommandDiffSplit', orientation) + + " Split and diff + if(a:0 == 2) + " Reset the vimdiff system, as 2 explicit versions were provided. + if exists('t:vcsCommandVimDiffSourceBuffer') + call s:WipeoutCommandBuffers(t:vcsCommandVimDiffSourceBuffer, 'vimdiff') + endif + let resultBuffer = s:VCSReview(a:1) + if resultBuffer < 0 + echomsg 'Can''t open revision ' . a:1 + return resultBuffer + endif + let b:VCSCommandCommand = 'vimdiff' + diffthis + let t:vcsCommandVimDiffScratchList = [resultBuffer] + " If no split method is defined, cheat, and set it to vertical. + try + call s:OverrideOption('VCSCommandSplit', orientation) + let resultBuffer = s:VCSReview(a:2) + finally + call s:OverrideOption('VCSCommandSplit') + endtry + if resultBuffer < 0 + echomsg 'Can''t open revision ' . a:1 + return resultBuffer + endif + let b:VCSCommandCommand = 'vimdiff' + diffthis + let t:vcsCommandVimDiffScratchList += [resultBuffer] + else + " Add new buffer + call s:OverrideOption('VCSCommandEdit', 'split') + try + " Force splitting behavior, otherwise why use vimdiff? + call s:OverrideOption('VCSCommandSplit', orientation) + try + if(a:0 == 0) + let resultBuffer = s:VCSReview() + else + let resultBuffer = s:VCSReview(a:1) + endif + finally + call s:OverrideOption('VCSCommandSplit') + endtry + finally + call s:OverrideOption('VCSCommandEdit') + endtry + if resultBuffer < 0 + echomsg 'Can''t open current revision' + return resultBuffer + endif + let b:VCSCommandCommand = 'vimdiff' + diffthis + + if !exists('t:vcsCommandVimDiffSourceBuffer') + " New instance of vimdiff. + let t:vcsCommandVimDiffScratchList = [resultBuffer] + + " This could have been invoked on a VCS result buffer, not the + " original buffer. + wincmd W + execute 'buffer' originalBuffer + " Store info for later original buffer restore + let t:vcsCommandVimDiffRestoreCmd = + \ 'call setbufvar('.originalBuffer.', ''&diff'', '.getbufvar(originalBuffer, '&diff').')' + \ . '|call setbufvar('.originalBuffer.', ''&foldcolumn'', '.getbufvar(originalBuffer, '&foldcolumn').')' + \ . '|call setbufvar('.originalBuffer.', ''&foldenable'', '.getbufvar(originalBuffer, '&foldenable').')' + \ . '|call setbufvar('.originalBuffer.', ''&foldmethod'', '''.getbufvar(originalBuffer, '&foldmethod').''')' + \ . '|call setbufvar('.originalBuffer.', ''&foldlevel'', '''.getbufvar(originalBuffer, '&foldlevel').''')' + \ . '|call setbufvar('.originalBuffer.', ''&scrollbind'', '.getbufvar(originalBuffer, '&scrollbind').')' + \ . '|call setbufvar('.originalBuffer.', ''&wrap'', '.getbufvar(originalBuffer, '&wrap').')' + \ . '|if &foldmethod==''manual''|execute ''normal zE''|endif' + diffthis + wincmd w + else + " Adding a window to an existing vimdiff + let t:vcsCommandVimDiffScratchList += [resultBuffer] + endif + endif + + let t:vcsCommandVimDiffSourceBuffer = originalBuffer + + " Avoid executing the modeline in the current buffer after the autocommand. + + let currentBuffer = bufnr('%') + let saveModeline = getbufvar(currentBuffer, '&modeline') + try + call setbufvar(currentBuffer, '&modeline', 0) + silent do VCSCommand User VCSVimDiffFinish + finally + call setbufvar(currentBuffer, '&modeline', saveModeline) + endtry + return resultBuffer + finally + let s:isEditFileRunning = s:isEditFileRunning - 1 + endtry + catch + call s:ReportError(v:exception) + return -1 + endtry +endfunction + +" Section: Public functions {{{1 + +" Function: VCSCommandGetVCSType() {{{2 +" Sets the b:VCSCommandVCSType variable in the given buffer to the +" appropriate source control system name. +" +" This uses the Identify extension function to test the buffer. If the +" Identify function returns VCSCOMMAND_IDENTIFY_EXACT, the match is considered +" exact. If the Identify function returns VCSCOMMAND_IDENTIFY_INEXACT, the +" match is considered inexact, and is only applied if no exact match is found. +" Multiple inexact matches is currently considered an error. + +function! VCSCommandGetVCSType(buffer) + let vcsType = getbufvar(a:buffer, 'VCSCommandVCSType') + if strlen(vcsType) > 0 + return vcsType + endif + if exists("g:VCSCommandVCSTypeOverride") + let fullpath = fnamemodify(bufname(a:buffer), ':p') + for [path, vcsType] in g:VCSCommandVCSTypeOverride + if match(fullpath, path) > -1 + call setbufvar(a:buffer, 'VCSCommandVCSType', vcsType) + return vcsType + endif + endfor + endif + let matches = [] + for vcsType in keys(s:plugins) + let identified = s:plugins[vcsType][1].Identify(a:buffer) + if identified + if identified == g:VCSCOMMAND_IDENTIFY_EXACT + let matches = [vcsType] + break + else + let matches += [vcsType] + endif + endif + endfor + if len(matches) == 1 + call setbufvar(a:buffer, 'VCSCommandVCSType', matches[0]) + return matches[0] + elseif len(matches) == 0 + throw 'No suitable plugin' + else + throw 'Too many matching VCS: ' . join(matches) + endif +endfunction + +" Function: VCSCommandChdir(directory) {{{2 +" Changes the current directory, respecting :lcd changes. + +function! VCSCommandChdir(directory) + let command = 'cd' + if exists("*haslocaldir") && haslocaldir() + let command = 'lcd' + endif + execute command escape(a:directory, ' ') +endfunction + +" Function: VCSCommandChangeToCurrentFileDir() {{{2 +" Go to the directory in which the given file is located. + +function! VCSCommandChangeToCurrentFileDir(fileName) + let oldCwd = getcwd() + let newCwd = fnamemodify(resolve(a:fileName), ':p:h') + if strlen(newCwd) > 0 + call VCSCommandChdir(newCwd) + endif + return oldCwd +endfunction + +" Function: VCSCommandGetOriginalBuffer(vcsBuffer) {{{2 +" Attempts to locate the original file to which VCS operations were applied +" for a given buffer. + +function! VCSCommandGetOriginalBuffer(vcsBuffer) + let origBuffer = getbufvar(a:vcsBuffer, 'VCSCommandOriginalBuffer') + if origBuffer + if bufexists(origBuffer) + return origBuffer + else + " Original buffer no longer exists. + throw 'Original buffer for this VCS buffer no longer exists.' + endif + else + " No original buffer + return a:vcsBuffer + endif +endfunction + +" Function: VCSCommandRegisterModule(name, file, commandMap) {{{2 +" Allows VCS modules to register themselves. + +function! VCSCommandRegisterModule(name, path, commandMap, mappingMap) + let s:plugins[a:name] = [a:path, a:commandMap, a:mappingMap] + if !empty(a:mappingMap) + \ && !VCSCommandGetOption('VCSCommandDisableMappings', 0) + \ && !VCSCommandGetOption('VCSCommandDisableExtensionMappings', 0) + for shortcut in keys(a:mappingMap) + let expansion = ":call ExecuteExtensionMapping('" . shortcut . "')" + call s:CreateMapping(shortcut, expansion, a:name . " extension mapping " . shortcut) + endfor + endif + return s:VCSCommandUtility +endfunction + +" Function: VCSCommandDoCommand(cmd, cmdName, statusText, [options]) {{{2 +" General skeleton for VCS function execution. The given command is executed +" after appending the current buffer name (or substituting it for +" , if such a token is present). The output is captured in a +" new buffer. +" +" The optional 'options' Dictionary may contain the following options: +" allowNonZeroExit: if non-zero, if the underlying VCS command has a +" non-zero exit status, the command is still considered +" successfuly. This defaults to zero. +" Returns: name of the new command buffer containing the command results + +function! VCSCommandDoCommand(cmd, cmdName, statusText, options) + let allowNonZeroExit = 0 + if has_key(a:options, 'allowNonZeroExit') + let allowNonZeroExit = a:options.allowNonZeroExit + endif + + let originalBuffer = VCSCommandGetOriginalBuffer(bufnr('%')) + if originalBuffer == -1 + throw 'Original buffer no longer exists, aborting.' + endif + + let path = resolve(bufname(originalBuffer)) + + " Work with netrw or other systems where a directory listing is displayed in + " a buffer. + + if isdirectory(path) + let fileName = '.' + else + let fileName = fnamemodify(path, ':t') + endif + + if match(a:cmd, '') > 0 + let fullCmd = substitute(a:cmd, '', fileName, 'g') + else + let fullCmd = a:cmd . ' -- "' . fileName . '"' + endif + + " Change to the directory of the current buffer. This is done for CVS, but + " is left in for other systems as it does not affect them negatively. + + let oldCwd = VCSCommandChangeToCurrentFileDir(path) + try + let output = s:VCSCommandUtility.system(fullCmd) + finally + call VCSCommandChdir(oldCwd) + endtry + + " HACK: if line endings in the repository have been corrupted, the output + " of the command will be confused. + let output = substitute(output, "\r", '', 'g') + + if v:shell_error && !allowNonZeroExit + if strlen(output) == 0 + throw 'Version control command failed' + else + let output = substitute(output, '\n', ' ', 'g') + throw 'Version control command failed: ' . output + endif + endif + + if strlen(output) == 0 + " Handle case of no output. In this case, it is important to check the + " file status, especially since cvs edit/unedit may change the attributes + " of the file with no visible output. + + checktime + return 0 + endif + + call s:EditFile(a:cmdName, originalBuffer, a:statusText) + + silent 0put=output + + " The last command left a blank line at the end of the buffer. If the + " last line is folded (a side effect of the 'put') then the attempt to + " remove the blank line will kill the last fold. + " + " This could be fixed by explicitly detecting whether the last line is + " within a fold, but I prefer to simply unfold the result buffer altogether. + + if has('folding') + normal zR + endif + + $d + 1 + + " Define the environment and execute user-defined hooks. + + silent do VCSCommand User VCSBufferCreated + return bufnr('%') +endfunction + +" Function: VCSCommandGetOption(name, default) {{{2 +" Grab a user-specified option to override the default provided. Options are +" searched in the window, buffer, then global spaces. + +function! VCSCommandGetOption(name, default) + if has_key(s:optionOverrides, a:name) && len(s:optionOverrides[a:name]) > 0 + return s:optionOverrides[a:name][-1] + elseif exists('w:' . a:name) + return w:{a:name} + elseif exists('b:' . a:name) + return b:{a:name} + elseif exists('g:' . a:name) + return g:{a:name} + else + return a:default + endif +endfunction + +" Function: VCSCommandDisableBufferSetup() {{{2 +" Global function for deactivating the buffer autovariables. + +function! VCSCommandDisableBufferSetup() + let g:VCSCommandEnableBufferSetup = 0 + silent! augroup! VCSCommandPlugin +endfunction + +" Function: VCSCommandEnableBufferSetup() {{{2 +" Global function for activating the buffer autovariables. + +function! VCSCommandEnableBufferSetup() + let g:VCSCommandEnableBufferSetup = 1 + augroup VCSCommandPlugin + au! + au BufEnter * call s:SetupBuffer() + augroup END + + " Only auto-load if the plugin is fully loaded. This gives other plugins a + " chance to run. + if g:loaded_VCSCommand == 2 + call s:SetupBuffer() + endif +endfunction + +" Function: VCSCommandGetStatusLine() {{{2 +" Default (sample) status line entry for VCS-controlled files. This is only +" useful if VCS-managed buffer mode is on (see the VCSCommandEnableBufferSetup +" variable for how to do this). + +function! VCSCommandGetStatusLine() + if exists('b:VCSCommandCommand') + " This is a result buffer. Return nothing because the buffer name + " contains information already. + return '' + endif + + if exists('b:VCSCommandVCSType') + \ && exists('g:VCSCommandEnableBufferSetup') + \ && g:VCSCommandEnableBufferSetup + \ && exists('b:VCSCommandBufferInfo') + return '[' . join(extend([b:VCSCommandVCSType], b:VCSCommandBufferInfo), ' ') . ']' + else + return '' + endif +endfunction + +" Section: Command definitions {{{1 +" Section: Primary commands {{{2 +com! -nargs=* VCSAdd call s:MarkOrigBufferForSetup(s:ExecuteVCSCommand('Add', [])) +com! -nargs=* -bang VCSAnnotate call s:VCSAnnotate(, ) +com! -nargs=* -bang VCSBlame call s:VCSAnnotate(, ) +com! -nargs=? -bang VCSCommit call s:VCSCommit(, ) +com! -nargs=* VCSDelete call s:ExecuteVCSCommand('Delete', []) +com! -nargs=* VCSDiff call s:VCSDiff() +com! -nargs=0 -bang VCSGotoOriginal call s:VCSGotoOriginal() +com! -nargs=* VCSInfo call s:ExecuteVCSCommand('Info', []) +com! -nargs=* VCSLock call s:MarkOrigBufferForSetup(s:ExecuteVCSCommand('Lock', [])) +com! -nargs=* VCSLog call s:ExecuteVCSCommand('Log', []) +com! -nargs=* VCSRemove call s:ExecuteVCSCommand('Delete', []) +com! -nargs=0 VCSRevert call s:MarkOrigBufferForSetup(s:ExecuteVCSCommand('Revert', [])) +com! -nargs=? VCSReview call s:VCSReview() +com! -nargs=* VCSStatus call s:ExecuteVCSCommand('Status', []) +com! -nargs=* VCSUnlock call s:MarkOrigBufferForSetup(s:ExecuteVCSCommand('Unlock', [])) +com! -nargs=0 VCSUpdate call s:MarkOrigBufferForSetup(s:ExecuteVCSCommand('Update', [])) +com! -nargs=* VCSVimDiff call s:VCSVimDiff() + +" Section: VCS buffer management commands {{{2 +com! VCSCommandDisableBufferSetup call VCSCommandDisableBufferSetup() +com! VCSCommandEnableBufferSetup call VCSCommandEnableBufferSetup() + +" Allow reloading VCSCommand.vim +com! VCSReload let savedPlugins = s:plugins|let s:plugins = {}|call s:ClearMenu()|unlet! g:loaded_VCSCommand|runtime plugin/vcscommand.vim|for plugin in values(savedPlugins)|execute 'source' plugin[0]|endfor|unlet savedPlugins + +" Section: Plugin command mappings {{{1 +nnoremap VCSAdd :VCSAdd +nnoremap VCSAnnotate :VCSAnnotate +nnoremap VCSCommit :VCSCommit +nnoremap VCSDelete :VCSDelete +nnoremap VCSDiff :VCSDiff +nnoremap VCSGotoOriginal :VCSGotoOriginal +nnoremap VCSClearAndGotoOriginal :VCSGotoOriginal! +nnoremap VCSInfo :VCSInfo +nnoremap VCSLock :VCSLock +nnoremap VCSLog :VCSLog +nnoremap VCSRevert :VCSRevert +nnoremap VCSReview :VCSReview +nnoremap VCSSplitAnnotate :VCSAnnotate! +nnoremap VCSStatus :VCSStatus +nnoremap VCSUnlock :VCSUnlock +nnoremap VCSUpdate :VCSUpdate +nnoremap VCSVimDiff :VCSVimDiff + +" Section: Default mappings {{{1 + +let s:defaultMappings = [ + \['a', 'VCSAdd'], + \['c', 'VCSCommit'], + \['D', 'VCSDelete'], + \['d', 'VCSDiff'], + \['G', 'VCSClearAndGotoOriginal'], + \['g', 'VCSGotoOriginal'], + \['i', 'VCSInfo'], + \['L', 'VCSLock'], + \['l', 'VCSLog'], + \['N', 'VCSSplitAnnotate'], + \['n', 'VCSAnnotate'], + \['q', 'VCSRevert'], + \['r', 'VCSReview'], + \['s', 'VCSStatus'], + \['U', 'VCSUnlock'], + \['u', 'VCSUpdate'], + \['v', 'VCSVimDiff'], + \] + +if !VCSCommandGetOption('VCSCommandDisableMappings', 0) + for [s:shortcut, s:vcsFunction] in VCSCommandGetOption('VCSCommandMappings', s:defaultMappings) + call s:CreateMapping(s:shortcut, '' . s:vcsFunction, '''' . s:vcsFunction . '''') + endfor + unlet s:shortcut s:vcsFunction +endif +unlet s:defaultMappings + +" Section: Menu items {{{1 + +let s:menuEnabled = !VCSCommandGetOption('VCSCommandDisableMenu', 0) +let s:menuRoot = VCSCommandGetOption('VCSCommandMenuRoot', '&Plugin.VCS') +let s:menuPriority = VCSCommandGetOption('VCSCommandMenuPriority', '') + +for [s:shortcut, s:command] in [ + \['&Add', 'VCSAdd'], + \['A&nnotate', 'VCSAnnotate'], + \['&Commit', 'VCSCommit'], + \['Delete', 'VCSDelete'], + \['&Diff', 'VCSDiff'], + \['&Info', 'VCSInfo'], + \['&Log', 'VCSLog'], + \['Revert', 'VCSRevert'], + \['&Review', 'VCSReview'], + \['&Status', 'VCSStatus'], + \['&Update', 'VCSUpdate'], + \['&VimDiff', 'VCSVimDiff'] + \] + call s:VCSCommandUtility.addMenuItem(s:shortcut, s:command) +endfor +unlet s:shortcut s:command + +" Section: Autocommands to restore vimdiff state {{{1 +augroup VimDiffRestore + au! + au BufUnload * call s:VimDiffRestore(str2nr(expand(''))) +augroup END + +" Section: Optional activation of buffer management {{{1 + +if VCSCommandGetOption('VCSCommandEnableBufferSetup', 0) + call VCSCommandEnableBufferSetup() +endif + +" Section: VIM shutdown hook {{{1 + +" Close all result buffers when VIM exits, to prevent them from being restored +" via viminfo. + +" Function: s:CloseAllResultBuffers() {{{2 +" Closes all vcscommand result buffers. +function! s:CloseAllResultBuffers() + " This avoids using bufdo as that may load buffers already loaded in another + " vim process, resulting in an error. + let buffnr = 1 + let buffmaxnr = bufnr('$') + while buffnr <= buffmaxnr + if getbufvar(buffnr, 'VCSCommandOriginalBuffer') != "" + execute 'bw' buffnr + endif + let buffnr = buffnr + 1 + endwhile +endfunction + +augroup VCSCommandVIMShutdown + au! + au VimLeavePre * call s:CloseAllResultBuffers() +augroup END + +" Section: Plugin completion {{{1 + +let loaded_VCSCommand = 2 + +silent do VCSCommand User VCSPluginFinish + +let &cpo = s:save_cpo diff --git a/.vim/plugin/vcscvs.vim b/.vim/plugin/vcscvs.vim new file mode 100644 index 0000000..73d6a7f --- /dev/null +++ b/.vim/plugin/vcscvs.vim @@ -0,0 +1,449 @@ +" vim600: set foldmethod=marker: +" +" CVS extension for VCSCommand. +" +" Maintainer: Bob Hiestand +" License: +" Copyright (c) Bob Hiestand +" +" Permission is hereby granted, free of charge, to any person obtaining a copy +" of this software and associated documentation files (the "Software"), to +" deal in the Software without restriction, including without limitation the +" rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +" sell copies of the Software, and to permit persons to whom the Software is +" furnished to do so, subject to the following conditions: +" +" The above copyright notice and this permission notice shall be included in +" all copies or substantial portions of the Software. +" +" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +" IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +" FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +" AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +" LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +" FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +" IN THE SOFTWARE. +" +" Section: Documentation {{{1 +" +" Command documentation {{{2 +" +" The following commands only apply to files under CVS source control. +" +" CVSEdit Performs "cvs edit" on the current file. +" +" CVSEditors Performs "cvs editors" on the current file. +" +" CVSUnedit Performs "cvs unedit" on the current file. +" +" CVSWatch Takes an argument which must be one of [on|off|add|remove]. +" Performs "cvs watch" with the given argument on the current +" file. +" +" CVSWatchers Performs "cvs watchers" on the current file. +" +" CVSWatchAdd Alias for "CVSWatch add" +" +" CVSWatchOn Alias for "CVSWatch on" +" +" CVSWatchOff Alias for "CVSWatch off" +" +" CVSWatchRemove Alias for "CVSWatch remove" +" +" Mapping documentation: {{{2 +" +" By default, a mapping is defined for each command. User-provided mappings +" can be used instead by mapping to CommandName, for instance: +" +" nnoremap ,ce CVSEdit +" +" The default mappings are as follow: +" +" ce CVSEdit +" cE CVSEditors +" ct CVSUnedit +" cwv CVSWatchers +" cwa CVSWatchAdd +" cwn CVSWatchOn +" cwf CVSWatchOff +" cwr CVSWatchRemove +" +" Options documentation: {{{2 +" +" VCSCommandCVSExec +" This variable specifies the CVS executable. If not set, it defaults to +" 'cvs' executed from the user's executable path. +" +" VCSCommandCVSDiffOpt +" This variable, if set, determines the options passed to the cvs diff +" command. If not set, it defaults to 'u'. + +" Section: Plugin header {{{1 + +if exists('VCSCommandDisableAll') + finish +endif + +if v:version < 700 + echohl WarningMsg|echomsg 'VCSCommand requires at least VIM 7.0'|echohl None + finish +endif + +runtime plugin/vcscommand.vim + +if !executable(VCSCommandGetOption('VCSCommandCVSExec', 'cvs')) + " CVS is not installed + finish +endif + +let s:save_cpo=&cpo +set cpo&vim + +" Section: Variable initialization {{{1 + +let s:cvsFunctions = {} + +" Section: Utility functions {{{1 + +" Function: s:Executable() {{{2 +" Returns the executable used to invoke cvs suitable for use in a shell +" command. +function! s:Executable() + return shellescape(VCSCommandGetOption('VCSCommandCVSExec', 'cvs')) +endfunction + +" Function: s:DoCommand(cmd, cmdName, statusText, options) {{{2 +" Wrapper to VCSCommandDoCommand to add the name of the CVS executable to the +" command argument. +function! s:DoCommand(cmd, cmdName, statusText, options) + if VCSCommandGetVCSType(expand('%')) == 'CVS' + let fullCmd = s:Executable() . ' ' . a:cmd + let ret = VCSCommandDoCommand(fullCmd, a:cmdName, a:statusText, a:options) + + if ret > 0 + if getline(line('$')) =~ '^cvs \w\+: closing down connection' + $d + 1 + endif + + endif + + return ret + else + throw 'CVS VCSCommand plugin called on non-CVS item.' + endif +endfunction + +" Function: s:GetRevision() {{{2 +" Function for retrieving the current buffer's revision number. +" Returns: Revision number or an empty string if an error occurs. + +function! s:GetRevision() + if !exists('b:VCSCommandBufferInfo') + let b:VCSCommandBufferInfo = s:cvsFunctions.GetBufferInfo() + endif + + if len(b:VCSCommandBufferInfo) > 0 + return b:VCSCommandBufferInfo[0] + else + return '' + endif +endfunction + +" Section: VCS function implementations {{{1 + +" Function: s:cvsFunctions.Identify(buffer) {{{2 +function! s:cvsFunctions.Identify(buffer) + let fileName = resolve(bufname(a:buffer)) + if isdirectory(fileName) + let directoryName = fileName + else + let directoryName = fnamemodify(fileName, ':h') + endif + if strlen(directoryName) > 0 + let CVSRoot = directoryName . '/CVS/Root' + else + let CVSRoot = 'CVS/Root' + endif + if filereadable(CVSRoot) + return 1 + else + return 0 + endif +endfunction + +" Function: s:cvsFunctions.Add(argList) {{{2 +function! s:cvsFunctions.Add(argList) + return s:DoCommand(join(['add'] + a:argList, ' '), 'add', join(a:argList, ' '), {}) +endfunction + +" Function: s:cvsFunctions.Annotate(argList) {{{2 +function! s:cvsFunctions.Annotate(argList) + if len(a:argList) == 0 + if &filetype == 'CVSannotate' + " This is a CVSAnnotate buffer. Perform annotation of the version + " indicated by the current line. + let caption = matchstr(getline('.'),'\v^[0-9.]+') + + if VCSCommandGetOption('VCSCommandCVSAnnotateParent', 0) != 0 + if caption != '1.1' + let revmaj = matchstr(caption,'\v[0-9.]+\ze\.[0-9]+') + let revmin = matchstr(caption,'\v[0-9.]+\.\zs[0-9]+') - 1 + if revmin == 0 + " Jump to ancestor branch + let caption = matchstr(revmaj,'\v[0-9.]+\ze\.[0-9]+') + else + let caption = revmaj . "." . revmin + endif + endif + endif + + let options = ['-r' . caption] + else + " CVS defaults to pulling HEAD, regardless of current branch. + " Therefore, always pass desired revision. + let caption = '' + let options = ['-r' . s:GetRevision()] + endif + elseif len(a:argList) == 1 && a:argList[0] !~ '^-' + let caption = a:argList[0] + let options = ['-r' . caption] + else + let caption = join(a:argList) + let options = a:argList + endif + + let resultBuffer = s:DoCommand(join(['-q', 'annotate'] + options), 'annotate', caption, {}) + if resultBuffer > 0 + " Remove header lines from standard error + silent v/^\d\+\%(\.\d\+\)\+/d + endif + return resultBuffer +endfunction + +" Function: s:cvsFunctions.Commit(argList) {{{2 +function! s:cvsFunctions.Commit(argList) + let resultBuffer = s:DoCommand('commit -F "' . a:argList[0] . '"', 'commit', '', {}) + if resultBuffer == 0 + echomsg 'No commit needed.' + endif + return resultBuffer +endfunction + +" Function: s:cvsFunctions.Delete() {{{2 +" By default, use the -f option to remove the file first. If options are +" passed in, use those instead. +function! s:cvsFunctions.Delete(argList) + let options = ['-f'] + let caption = '' + if len(a:argList) > 0 + let options = a:argList + let caption = join(a:argList, ' ') + endif + return s:DoCommand(join(['remove'] + options, ' '), 'delete', caption, {}) +endfunction + +" Function: s:cvsFunctions.Diff(argList) {{{2 +function! s:cvsFunctions.Diff(argList) + if len(a:argList) == 0 + let revOptions = [] + let caption = '' + elseif len(a:argList) <= 2 && match(a:argList, '^-') == -1 + let revOptions = ['-r' . join(a:argList, ' -r')] + let caption = '(' . a:argList[0] . ' : ' . get(a:argList, 1, 'current') . ')' + else + " Pass-through + let caption = join(a:argList, ' ') + let revOptions = a:argList + endif + + let cvsDiffOpt = VCSCommandGetOption('VCSCommandCVSDiffOpt', 'u') + if cvsDiffOpt == '' + let diffOptions = [] + else + let diffOptions = ['-' . cvsDiffOpt] + endif + + return s:DoCommand(join(['diff'] + diffOptions + revOptions), 'diff', caption, {'allowNonZeroExit': 1}) +endfunction + +" Function: s:cvsFunctions.GetBufferInfo() {{{2 +" Provides version control details for the current file. Current version +" number and current repository version number are required to be returned by +" the vcscommand plugin. This CVS extension adds branch name to the return +" list as well. +" Returns: List of results: [revision, repository, branch] + +function! s:cvsFunctions.GetBufferInfo() + let originalBuffer = VCSCommandGetOriginalBuffer(bufnr('%')) + let fileName = bufname(originalBuffer) + if isdirectory(fileName) + let tag = '' + if filereadable(fileName . '/CVS/Tag') + let tagFile = readfile(fileName . '/CVS/Tag') + if len(tagFile) == 1 + let tag = substitute(tagFile[0], '^T', '', '') + endif + endif + return [tag] + endif + let realFileName = fnamemodify(resolve(fileName), ':t') + if !filereadable(fileName) + return ['Unknown'] + endif + let oldCwd = VCSCommandChangeToCurrentFileDir(fileName) + try + let statusText=s:VCSCommandUtility.system(s:Executable() . ' status -- "' . realFileName . '"') + if(v:shell_error) + return [] + endif + let revision=substitute(statusText, '^\_.*Working revision:\s*\(\d\+\%(\.\d\+\)\+\|New file!\)\_.*$', '\1', '') + + " We can still be in a CVS-controlled directory without this being a CVS + " file + if match(revision, '^New file!$') >= 0 + let revision='New' + elseif match(revision, '^\d\+\.\d\+\%(\.\d\+\.\d\+\)*$') <0 + return ['Unknown'] + endif + + let branch=substitute(statusText, '^\_.*Sticky Tag:\s\+\(\d\+\%(\.\d\+\)\+\|\a[A-Za-z0-9-_]*\|(none)\).*$', '\1', '') + let repository=substitute(statusText, '^\_.*Repository revision:\s*\(\d\+\%(\.\d\+\)\+\|New file!\|No revision control file\)\_.*$', '\1', '') + let repository=substitute(repository, '^New file!\|No revision control file$', 'New', '') + return [revision, repository, branch] + finally + call VCSCommandChdir(oldCwd) + endtry +endfunction + +" Function: s:cvsFunctions.Log() {{{2 +function! s:cvsFunctions.Log(argList) + if len(a:argList) == 0 + let options = [] + let caption = '' + elseif len(a:argList) <= 2 && match(a:argList, '^-') == -1 + let options = ['-r' . join(a:argList, ':')] + let caption = options[0] + else + " Pass-through + let options = a:argList + let caption = join(a:argList, ' ') + endif + + return s:DoCommand(join(['log'] + options), 'log', caption, {}) +endfunction + +" Function: s:cvsFunctions.Revert(argList) {{{2 +function! s:cvsFunctions.Revert(argList) + return s:DoCommand('update -C', 'revert', '', {}) +endfunction + +" Function: s:cvsFunctions.Review(argList) {{{2 +function! s:cvsFunctions.Review(argList) + if len(a:argList) == 0 + let versiontag = '(current)' + let versionOption = '' + else + let versiontag = a:argList[0] + let versionOption = ' -r ' . versiontag . ' ' + endif + + return s:DoCommand('-q update -p' . versionOption, 'review', versiontag, {}) +endfunction + +" Function: s:cvsFunctions.Status(argList) {{{2 +function! s:cvsFunctions.Status(argList) + return s:DoCommand(join(['status'] + a:argList, ' '), 'status', join(a:argList, ' '), {}) +endfunction + +" Function: s:cvsFunctions.Update(argList) {{{2 +function! s:cvsFunctions.Update(argList) + return s:DoCommand('update', 'update', '', {}) +endfunction + +" Section: CVS-specific functions {{{1 + +" Function: s:CVSEdit() {{{2 +function! s:CVSEdit() + return s:DoCommand('edit', 'cvsedit', '', {}) +endfunction + +" Function: s:CVSEditors() {{{2 +function! s:CVSEditors() + return s:DoCommand('editors', 'cvseditors', '', {}) +endfunction + +" Function: s:CVSUnedit() {{{2 +function! s:CVSUnedit() + return s:DoCommand('unedit', 'cvsunedit', '', {}) +endfunction + +" Function: s:CVSWatch(onoff) {{{2 +function! s:CVSWatch(onoff) + if a:onoff !~ '^\c\%(on\|off\|add\|remove\)$' + echoerr 'Argument to CVSWatch must be one of [on|off|add|remove]' + return -1 + end + return s:DoCommand('watch ' . tolower(a:onoff), 'cvswatch', '', {}) +endfunction + +" Function: s:CVSWatchers() {{{2 +function! s:CVSWatchers() + return s:DoCommand('watchers', 'cvswatchers', '', {}) +endfunction + +" Annotate setting {{{2 +let s:cvsFunctions.AnnotateSplitRegex = '): ' + +" Section: Command definitions {{{1 +" Section: Primary commands {{{2 +com! CVSEdit call s:CVSEdit() +com! CVSEditors call s:CVSEditors() +com! CVSUnedit call s:CVSUnedit() +com! -nargs=1 CVSWatch call s:CVSWatch() +com! CVSWatchAdd call s:CVSWatch('add') +com! CVSWatchOn call s:CVSWatch('on') +com! CVSWatchOff call s:CVSWatch('off') +com! CVSWatchRemove call s:CVSWatch('remove') +com! CVSWatchers call s:CVSWatchers() + +" Section: Plugin command mappings {{{1 + +let s:cvsExtensionMappings = {} +let mappingInfo = [ + \['CVSEdit', 'CVSEdit', 'e'], + \['CVSEditors', 'CVSEditors', 'E'], + \['CVSUnedit', 'CVSUnedit', 't'], + \['CVSWatchers', 'CVSWatchers', 'wv'], + \['CVSWatchAdd', 'CVSWatch add', 'wa'], + \['CVSWatchOff', 'CVSWatch off', 'wf'], + \['CVSWatchOn', 'CVSWatch on', 'wn'], + \['CVSWatchRemove', 'CVSWatch remove', 'wr'] + \] + +for [pluginName, commandText, shortCut] in mappingInfo + execute 'nnoremap ' . pluginName . ' :' . commandText . '' + if !hasmapto('' . pluginName) + let s:cvsExtensionMappings[shortCut] = commandText + endif +endfor + +" Section: Plugin Registration {{{1 +let s:VCSCommandUtility = VCSCommandRegisterModule('CVS', expand(''), s:cvsFunctions, s:cvsExtensionMappings) + +" Section: Menu items {{{1 +for [s:shortcut, s:command] in [ + \['CVS.&Edit', 'CVSEdit'], + \['CVS.Ed&itors', 'CVSEditors'], + \['CVS.Unedi&t', 'CVSUnedit'], + \['CVS.&Watchers', 'CVSWatchers'], + \['CVS.WatchAdd', 'CVSWatchAdd'], + \['CVS.WatchOn', 'CVSWatchOn'], + \['CVS.WatchOff', 'CVSWatchOff'], + \['CVS.WatchRemove', 'CVSWatchRemove'] + \] + call s:VCSCommandUtility.addMenuItem(s:shortcut, s:command) +endfor +unlet s:shortcut s:command + +let &cpo = s:save_cpo diff --git a/.vim/plugin/vcsgit.vim b/.vim/plugin/vcsgit.vim new file mode 100644 index 0000000..4e299d9 --- /dev/null +++ b/.vim/plugin/vcsgit.vim @@ -0,0 +1,247 @@ +" vim600: set foldmethod=marker: +" +" git extension for VCSCommand. +" +" Maintainer: Bob Hiestand +" License: +" Copyright (c) Bob Hiestand +" +" Permission is hereby granted, free of charge, to any person obtaining a copy +" of this software and associated documentation files (the "Software"), to +" deal in the Software without restriction, including without limitation the +" rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +" sell copies of the Software, and to permit persons to whom the Software is +" furnished to do so, subject to the following conditions: +" +" The above copyright notice and this permission notice shall be included in +" all copies or substantial portions of the Software. +" +" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +" IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +" FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +" AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +" LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +" FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +" IN THE SOFTWARE. +" +" Section: Documentation {{{1 +" +" Options documentation: {{{2 +" +" VCSCommandGitExec +" This variable specifies the git executable. If not set, it defaults to +" 'git' executed from the user's executable path. +" +" VCSCommandGitDiffOpt +" This variable, if set, determines the default options passed to the +" VCSDiff command. If any options (starting with '-') are passed to the +" command, this variable is not used. + +" Section: Plugin header {{{1 + +if exists('VCSCommandDisableAll') + finish +endif + +if v:version < 700 + echohl WarningMsg|echomsg 'VCSCommand requires at least VIM 7.0'|echohl None + finish +endif + +runtime plugin/vcscommand.vim + +if !executable(VCSCommandGetOption('VCSCommandGitExec', 'git')) + " git is not installed + finish +endif + +let s:save_cpo=&cpo +set cpo&vim + +" Section: Variable initialization {{{1 + +let s:gitFunctions = {} + +" Section: Utility functions {{{1 + +" Function: s:Executable() {{{2 +" Returns the executable used to invoke git suitable for use in a shell +" command. +function! s:Executable() + return shellescape(VCSCommandGetOption('VCSCommandGitExec', 'git')) +endfunction + +" Function: s:DoCommand(cmd, cmdName, statusText, options) {{{2 +" Wrapper to VCSCommandDoCommand to add the name of the git executable to the +" command argument. +function! s:DoCommand(cmd, cmdName, statusText, options) + if VCSCommandGetVCSType(expand('%')) == 'git' + let fullCmd = s:Executable() . ' ' . a:cmd + return VCSCommandDoCommand(fullCmd, a:cmdName, a:statusText, a:options) + else + throw 'git VCSCommand plugin called on non-git item.' + endif +endfunction + +" Section: VCS function implementations {{{1 + +" Function: s:gitFunctions.Identify(buffer) {{{2 +" This function only returns an inexact match due to the detection method used +" by git, which simply traverses the directory structure upward. +function! s:gitFunctions.Identify(buffer) + let oldCwd = VCSCommandChangeToCurrentFileDir(resolve(bufname(a:buffer))) + try + call s:VCSCommandUtility.system(s:Executable() . ' rev-parse --is-inside-work-tree') + if(v:shell_error) + return 0 + else + return g:VCSCOMMAND_IDENTIFY_INEXACT + endif + finally + call VCSCommandChdir(oldCwd) + endtry +endfunction + +" Function: s:gitFunctions.Add(argList) {{{2 +function! s:gitFunctions.Add(argList) + return s:DoCommand(join(['add'] + ['-v'] + a:argList, ' '), 'add', join(a:argList, ' '), {}) +endfunction + +" Function: s:gitFunctions.Annotate(argList) {{{2 +function! s:gitFunctions.Annotate(argList) + if len(a:argList) == 0 + if &filetype == 'gitannotate' + " Perform annotation of the version indicated by the current line. + let options = matchstr(getline('.'),'^\x\+') + else + let options = '' + endif + elseif len(a:argList) == 1 && a:argList[0] !~ '^-' + let options = a:argList[0] + else + let options = join(a:argList, ' ') + endif + + return s:DoCommand('blame ' . options, 'annotate', options, {}) +endfunction + +" Function: s:gitFunctions.Commit(argList) {{{2 +function! s:gitFunctions.Commit(argList) + try + return s:DoCommand('commit -F "' . a:argList[0] . '"', 'commit', '', {}) + catch /\m^Version control command failed.*nothing\%( added\)\? to commit/ + echomsg 'No commit needed.' + endtry +endfunction + +" Function: s:gitFunctions.Delete() {{{2 +" All options are passed through. +function! s:gitFunctions.Delete(argList) + let options = a:argList + let caption = join(a:argList, ' ') + return s:DoCommand(join(['rm'] + options, ' '), 'delete', caption, {}) +endfunction + +" Function: s:gitFunctions.Diff(argList) {{{2 +" Pass-through call to git-diff. If no options (starting with '-') are found, +" then the options in the 'VCSCommandGitDiffOpt' variable are added. +function! s:gitFunctions.Diff(argList) + let gitDiffOpt = VCSCommandGetOption('VCSCommandGitDiffOpt', '') + if gitDiffOpt == '' + let diffOptions = [] + else + let diffOptions = [gitDiffOpt] + for arg in a:argList + if arg =~ '^-' + let diffOptions = [] + break + endif + endfor + endif + + return s:DoCommand(join(['diff'] + diffOptions + a:argList), 'diff', join(a:argList), {}) +endfunction + +" Function: s:gitFunctions.GetBufferInfo() {{{2 +" Provides version control details for the current file. Current version +" number and current repository version number are required to be returned by +" the vcscommand plugin. This CVS extension adds branch name to the return +" list as well. +" Returns: List of results: [revision, repository, branch] + +function! s:gitFunctions.GetBufferInfo() + let oldCwd = VCSCommandChangeToCurrentFileDir(resolve(bufname('%'))) + try + let branch = substitute(s:VCSCommandUtility.system(s:Executable() . ' symbolic-ref -q HEAD'), '\n$', '', '') + if v:shell_error + let branch = 'DETACHED' + else + let branch = substitute(branch, '^refs/heads/', '', '') + endif + + let info = [branch] + + for method in split(VCSCommandGetOption('VCSCommandGitDescribeArgList', (',tags,all,always')), ',', 1) + if method != '' + let method = ' --' . method + endif + let tag = substitute(s:VCSCommandUtility.system(s:Executable() . ' describe' . method), '\n$', '', '') + if !v:shell_error + call add(info, tag) + break + endif + endfor + + return info + finally + call VCSCommandChdir(oldCwd) + endtry +endfunction + +" Function: s:gitFunctions.Log() {{{2 +function! s:gitFunctions.Log(argList) + return s:DoCommand(join(['log'] + a:argList), 'log', join(a:argList, ' '), {}) +endfunction + +" Function: s:gitFunctions.Revert(argList) {{{2 +function! s:gitFunctions.Revert(argList) + return s:DoCommand('checkout', 'revert', '', {}) +endfunction + +" Function: s:gitFunctions.Review(argList) {{{2 +function! s:gitFunctions.Review(argList) + if len(a:argList) == 0 + let revision = 'HEAD' + else + let revision = a:argList[0] + endif + + let oldCwd = VCSCommandChangeToCurrentFileDir(resolve(bufname(VCSCommandGetOriginalBuffer('%')))) + try + let prefix = s:VCSCommandUtility.system(s:Executable() . ' rev-parse --show-prefix') + finally + call VCSCommandChdir(oldCwd) + endtry + + let prefix = substitute(prefix, '\n$', '', '') + let blob = '"' . revision . ':' . prefix . '"' + return s:DoCommand('show ' . blob, 'review', revision, {}) +endfunction + +" Function: s:gitFunctions.Status(argList) {{{2 +function! s:gitFunctions.Status(argList) + return s:DoCommand(join(['status'] + a:argList), 'status', join(a:argList), {'allowNonZeroExit': 1}) +endfunction + +" Function: s:gitFunctions.Update(argList) {{{2 +function! s:gitFunctions.Update(argList) + throw "This command is not implemented for git because file-by-file update doesn't make much sense in that context. If you have an idea for what it should do, please let me know." +endfunction + +" Annotate setting {{{2 +let s:gitFunctions.AnnotateSplitRegex = ') ' + +" Section: Plugin Registration {{{1 +let s:VCSCommandUtility = VCSCommandRegisterModule('git', expand(''), s:gitFunctions, []) + +let &cpo = s:save_cpo diff --git a/.vim/plugin/vcshg.vim b/.vim/plugin/vcshg.vim new file mode 100644 index 0000000..2c616c0 --- /dev/null +++ b/.vim/plugin/vcshg.vim @@ -0,0 +1,273 @@ +" vim600: set foldmethod=marker: +" +" Mercurial extension for VCSCommand. +" +" Maintainer: Bob Hiestand +" License: +" Copyright (c) Bob Hiestand +" +" Permission is hereby granted, free of charge, to any person obtaining a copy +" of this software and associated documentation files (the "Software"), to +" deal in the Software without restriction, including without limitation the +" rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +" sell copies of the Software, and to permit persons to whom the Software is +" furnished to do so, subject to the following conditions: +" +" The above copyright notice and this permission notice shall be included in +" all copies or substantial portions of the Software. +" +" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +" IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +" FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +" AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +" LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +" FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +" IN THE SOFTWARE. +" +" Section: Documentation {{{1 +" +" Options documentation: {{{2 +" +" VCSCommandHGExec +" This variable specifies the mercurial executable. If not set, it defaults +" to 'hg' executed from the user's executable path. +" +" VCSCommandHGDiffExt +" This variable, if set, sets the external diff program used by Subversion. +" +" VCSCommandHGDiffOpt +" This variable, if set, determines the options passed to the hg diff +" command (such as 'u', 'w', or 'b'). + +" Section: Plugin header {{{1 + +if exists('VCSCommandDisableAll') + finish +endif + +if v:version < 700 + echohl WarningMsg|echomsg 'VCSCommand requires at least VIM 7.0'|echohl None + finish +endif + +runtime plugin/vcscommand.vim + +if !executable(VCSCommandGetOption('VCSCommandHGExec', 'hg')) + " HG is not installed + finish +endif + +let s:save_cpo=&cpo +set cpo&vim + +" Section: Variable initialization {{{1 + +let s:hgFunctions = {} + +" Section: Utility functions {{{1 + +" Function: s:Executable() {{{2 +" Returns the executable used to invoke hg suitable for use in a shell +" command. +function! s:Executable() + return shellescape(VCSCommandGetOption('VCSCommandHGExec', 'hg')) +endfunction + +" Function: s:DoCommand(cmd, cmdName, statusText, options) {{{2 +" Wrapper to VCSCommandDoCommand to add the name of the HG executable to the +" command argument. +function! s:DoCommand(cmd, cmdName, statusText, options) + if VCSCommandGetVCSType(expand('%')) == 'HG' + let fullCmd = s:Executable() . ' ' . a:cmd + return VCSCommandDoCommand(fullCmd, a:cmdName, a:statusText, a:options) + else + throw 'HG VCSCommand plugin called on non-HG item.' + endif +endfunction + +" Section: VCS function implementations {{{1 + +" Function: s:hgFunctions.Identify(buffer) {{{2 +function! s:hgFunctions.Identify(buffer) + let oldCwd = VCSCommandChangeToCurrentFileDir(resolve(bufname(a:buffer))) + try + call s:VCSCommandUtility.system(s:Executable() . ' root') + if(v:shell_error) + return 0 + else + return g:VCSCOMMAND_IDENTIFY_INEXACT + endif + finally + call VCSCommandChdir(oldCwd) + endtry +endfunction + +" Function: s:hgFunctions.Add() {{{2 +function! s:hgFunctions.Add(argList) + return s:DoCommand(join(['add -v'] + a:argList, ' '), 'add', join(a:argList, ' '), {}) +endfunction + +" Function: s:hgFunctions.Annotate(argList) {{{2 +function! s:hgFunctions.Annotate(argList) + if len(a:argList) == 0 + if &filetype == 'HGannotate' + " Perform annotation of the version indicated by the current line. + let caption = matchstr(getline('.'),'\v^\s+\zs\d+') + let options = ' -r' . caption + else + let caption = '' + let options = ' -un' + endif + elseif len(a:argList) == 1 && a:argList[0] !~ '^-' + let caption = a:argList[0] + let options = ' -un -r' . caption + else + let caption = join(a:argList, ' ') + let options = ' ' . caption + endif + + return s:DoCommand('blame' . options, 'annotate', caption, {}) +endfunction + +" Function: s:hgFunctions.Commit(argList) {{{2 +function! s:hgFunctions.Commit(argList) + try + return s:DoCommand('commit -v -l "' . a:argList[0] . '"', 'commit', '', {}) + catch /Version control command failed.*nothing changed/ + echomsg 'No commit needed.' + endtry +endfunction + +" Function: s:hgFunctions.Delete() {{{2 +function! s:hgFunctions.Delete(argList) + return s:DoCommand(join(['remove'] + a:argList, ' '), 'remove', join(a:argList, ' '), {}) +endfunction + +" Function: s:hgFunctions.Diff(argList) {{{2 +function! s:hgFunctions.Diff(argList) + if len(a:argList) == 0 + let revOptions = [] + let caption = '' + elseif len(a:argList) <= 2 && match(a:argList, '^-') == -1 + let revOptions = ['-r' . join(a:argList, ':')] + let caption = '(' . a:argList[0] . ' : ' . get(a:argList, 1, 'current') . ')' + else + " Pass-through + let caption = join(a:argList, ' ') + let revOptions = a:argList + endif + + let hgDiffExt = VCSCommandGetOption('VCSCommandHGDiffExt', '') + if hgDiffExt == '' + let diffExt = [] + else + let diffExt = ['--diff-cmd ' . hgDiffExt] + endif + + let hgDiffOpt = VCSCommandGetOption('VCSCommandHGDiffOpt', '') + if hgDiffOpt == '' + let diffOptions = [] + else + let diffOptions = ['-x -' . hgDiffOpt] + endif + + return s:DoCommand(join(['diff'] + diffExt + diffOptions + revOptions), 'diff', caption, {}) +endfunction + +" Function: s:hgFunctions.Info(argList) {{{2 +function! s:hgFunctions.Info(argList) + return s:DoCommand(join(['log --limit 1'] + a:argList, ' '), 'log', join(a:argList, ' '), {}) +endfunction + +" Function: s:hgFunctions.GetBufferInfo() {{{2 +" Provides version control details for the current file. Current version +" number and current repository version number are required to be returned by +" the vcscommand plugin. +" Returns: List of results: [revision, repository, branch] + +function! s:hgFunctions.GetBufferInfo() + let originalBuffer = VCSCommandGetOriginalBuffer(bufnr('%')) + let fileName = bufname(originalBuffer) + let statusText = s:VCSCommandUtility.system(s:Executable() . ' status -- "' . fileName . '"') + if(v:shell_error) + return [] + endif + + " File not under HG control. + if statusText =~ '^?' + return ['Unknown'] + endif + + let parentsText = s:VCSCommandUtility.system(s:Executable() . ' parents -- "' . fileName . '"') + let revision = matchlist(parentsText, '^changeset:\s\+\(\S\+\)\n')[1] + + let logText = s:VCSCommandUtility.system(s:Executable() . ' log -- "' . fileName . '"') + let repository = matchlist(logText, '^changeset:\s\+\(\S\+\)\n')[1] + + if revision == '' + " Error + return ['Unknown'] + elseif statusText =~ '^A' + return ['New', 'New'] + else + return [revision, repository] + endif +endfunction + +" Function: s:hgFunctions.Log(argList) {{{2 +function! s:hgFunctions.Log(argList) + if len(a:argList) == 0 + let options = [] + let caption = '' + elseif len(a:argList) <= 2 && match(a:argList, '^-') == -1 + let options = ['-r' . join(a:argList, ':')] + let caption = options[0] + else + " Pass-through + let options = a:argList + let caption = join(a:argList, ' ') + endif + + let resultBuffer = s:DoCommand(join(['log', '-v'] + options), 'log', caption, {}) + return resultBuffer +endfunction + +" Function: s:hgFunctions.Revert(argList) {{{2 +function! s:hgFunctions.Revert(argList) + return s:DoCommand('revert', 'revert', '', {}) +endfunction + +" Function: s:hgFunctions.Review(argList) {{{2 +function! s:hgFunctions.Review(argList) + if len(a:argList) == 0 + let versiontag = '(current)' + let versionOption = '' + else + let versiontag = a:argList[0] + let versionOption = ' -r ' . versiontag . ' ' + endif + + return s:DoCommand('cat' . versionOption, 'review', versiontag, {}) +endfunction + +" Function: s:hgFunctions.Status(argList) {{{2 +function! s:hgFunctions.Status(argList) + let options = ['-A', '-v'] + if len(a:argList) != 0 + let options = a:argList + endif + return s:DoCommand(join(['status'] + options, ' '), 'status', join(options, ' '), {}) +endfunction + +" Function: s:hgFunctions.Update(argList) {{{2 +function! s:hgFunctions.Update(argList) + return s:DoCommand('update', 'update', '', {}) +endfunction + +" Annotate setting {{{2 +let s:hgFunctions.AnnotateSplitRegex = '\d\+: ' + +" Section: Plugin Registration {{{1 +let s:VCSCommandUtility = VCSCommandRegisterModule('HG', expand(''), s:hgFunctions, []) + +let &cpo = s:save_cpo diff --git a/.vim/plugin/vcssvk.vim b/.vim/plugin/vcssvk.vim new file mode 100644 index 0000000..b7cc6c9 --- /dev/null +++ b/.vim/plugin/vcssvk.vim @@ -0,0 +1,257 @@ +" vim600: set foldmethod=marker: +" +" SVK extension for VCSCommand. +" +" Maintainer: Bob Hiestand +" License: +" Copyright (c) Bob Hiestand +" +" Permission is hereby granted, free of charge, to any person obtaining a copy +" of this software and associated documentation files (the "Software"), to +" deal in the Software without restriction, including without limitation the +" rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +" sell copies of the Software, and to permit persons to whom the Software is +" furnished to do so, subject to the following conditions: +" +" The above copyright notice and this permission notice shall be included in +" all copies or substantial portions of the Software. +" +" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +" IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +" FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +" AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +" LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +" FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +" IN THE SOFTWARE. +" +" Section: Documentation {{{1 +" +" Options documentation: {{{2 +" +" VCSCommandSVKExec +" This variable specifies the SVK executable. If not set, it defaults to +" 'svk' executed from the user's executable path. + +" Section: Plugin header {{{1 + +if exists('VCSCommandDisableAll') + finish +endif + +if v:version < 700 + echohl WarningMsg|echomsg 'VCSCommand requires at least VIM 7.0'|echohl None + finish +endif + +runtime plugin/vcscommand.vim + +if !executable(VCSCommandGetOption('VCSCommandSVKExec', 'svk')) + " SVK is not installed + finish +endif + +let s:save_cpo=&cpo +set cpo&vim + +" Section: Variable initialization {{{1 + +let s:svkFunctions = {} + +" Section: Utility functions {{{1 + +" Function: s:Executable() {{{2 +" Returns the executable used to invoke SVK suitable for use in a shell +" command. +function! s:Executable() + return shellescape(VCSCommandGetOption('VCSCommandSVKExec', 'svk')) +endfunction + +" Function: s:DoCommand(cmd, cmdName, statusText, options) {{{2 +" Wrapper to VCSCommandDoCommand to add the name of the SVK executable to the +" command argument. +function! s:DoCommand(cmd, cmdName, statusText, options) + if VCSCommandGetVCSType(expand('%')) == 'SVK' + let fullCmd = s:Executable() . ' ' . a:cmd + return VCSCommandDoCommand(fullCmd, a:cmdName, a:statusText, a:options) + else + throw 'SVK VCSCommand plugin called on non-SVK item.' + endif +endfunction + +" Section: VCS function implementations {{{1 + +" Function: s:svkFunctions.Identify(buffer) {{{2 +function! s:svkFunctions.Identify(buffer) + let fileName = resolve(bufname(a:buffer)) + if isdirectory(fileName) + let directoryName = fileName + else + let directoryName = fnamemodify(fileName, ':p:h') + endif + let statusText = s:VCSCommandUtility.system(s:Executable() . ' info -- "' . directoryName . '"', "no") + if(v:shell_error) + return 0 + else + return 1 + endif +endfunction + +" Function: s:svkFunctions.Add() {{{2 +function! s:svkFunctions.Add(argList) + return s:DoCommand(join(['add'] + a:argList, ' '), 'add', join(a:argList, ' '), {}) +endfunction + +" Function: s:svkFunctions.Annotate(argList) {{{2 +function! s:svkFunctions.Annotate(argList) + if len(a:argList) == 0 + if &filetype == 'SVKannotate' + " Perform annotation of the version indicated by the current line. + let caption = matchstr(getline('.'),'\v^\s+\zs\d+') + let options = ' -r' . caption + else + let caption = '' + let options = '' + endif + elseif len(a:argList) == 1 && a:argList[0] !~ '^-' + let caption = a:argList[0] + let options = ' -r' . caption + else + let caption = join(a:argList, ' ') + let options = ' ' . caption + endif + + let resultBuffer = s:DoCommand('blame' . options, 'annotate', caption, {}) + if resultBuffer > 0 + normal 1G2dd + endif + return resultBuffer +endfunction + +" Function: s:svkFunctions.Commit(argList) {{{2 +function! s:svkFunctions.Commit(argList) + let resultBuffer = s:DoCommand('commit -F "' . a:argList[0] . '"', 'commit', '', {}) + if resultBuffer == 0 + echomsg 'No commit needed.' + endif +endfunction + +" Function: s:svkFunctions.Delete() {{{2 +function! s:svkFunctions.Delete(argList) + return s:DoCommand(join(['delete'] + a:argList, ' '), 'delete', join(a:argList, ' '), {}) +endfunction + +" Function: s:svkFunctions.Diff(argList) {{{2 +function! s:svkFunctions.Diff(argList) + if len(a:argList) == 0 + let revOptions = [] + let caption = '' + elseif len(a:argList) <= 2 && match(a:argList, '^-') == -1 + let revOptions = ['-r' . join(a:argList, ':')] + let caption = '(' . a:argList[0] . ' : ' . get(a:argList, 1, 'current') . ')' + else + " Pass-through + let caption = join(a:argList, ' ') + let revOptions = a:argList + endif + + return s:DoCommand(join(['diff'] + revOptions), 'diff', caption, {}) +endfunction + +" Function: s:svkFunctions.GetBufferInfo() {{{2 +" Provides version control details for the current file. Current version +" number and current repository version number are required to be returned by +" the vcscommand plugin. +" Returns: List of results: [revision, repository] + +function! s:svkFunctions.GetBufferInfo() + let originalBuffer = VCSCommandGetOriginalBuffer(bufnr('%')) + let fileName = resolve(bufname(originalBuffer)) + let statusText = s:VCSCommandUtility.system(s:Executable() . ' status -v -- "' . fileName . '"') + if(v:shell_error) + return [] + endif + + " File not under SVK control. + if statusText =~ '^?' + return ['Unknown'] + endif + + let [flags, revision, repository] = matchlist(statusText, '^\(.\{3}\)\s\+\(\S\+\)\s\+\(\S\+\)\s\+\(\S\+\)\s')[1:3] + if revision == '' + " Error + return ['Unknown'] + elseif flags =~ '^A' + return ['New', 'New'] + else + return [revision, repository] + endif +endfunction + +" Function: s:svkFunctions.Info(argList) {{{2 +function! s:svkFunctions.Info(argList) + return s:DoCommand(join(['info'] + a:argList, ' '), 'info', join(a:argList, ' '), {}) +endfunction + +" Function: s:svkFunctions.Lock(argList) {{{2 +function! s:svkFunctions.Lock(argList) + return s:DoCommand(join(['lock'] + a:argList, ' '), 'lock', join(a:argList, ' '), {}) +endfunction + +" Function: s:svkFunctions.Log() {{{2 +function! s:svkFunctions.Log(argList) + if len(a:argList) == 0 + let options = [] + let caption = '' + elseif len(a:argList) <= 2 && match(a:argList, '^-') == -1 + let options = ['-r' . join(a:argList, ':')] + let caption = options[0] + else + " Pass-through + let options = a:argList + let caption = join(a:argList, ' ') + endif + + let resultBuffer = s:DoCommand(join(['log', '-v'] + options), 'log', caption, {}) + return resultBuffer +endfunction + +" Function: s:svkFunctions.Revert(argList) {{{2 +function! s:svkFunctions.Revert(argList) + return s:DoCommand('revert', 'revert', '', {}) +endfunction + +" Function: s:svkFunctions.Review(argList) {{{2 +function! s:svkFunctions.Review(argList) + if len(a:argList) == 0 + let versiontag = '(current)' + let versionOption = '' + else + let versiontag = a:argList[0] + let versionOption = ' -r ' . versiontag . ' ' + endif + + return s:DoCommand('cat' . versionOption, 'review', versiontag, {}) +endfunction + +" Function: s:svkFunctions.Status(argList) {{{2 +function! s:svkFunctions.Status(argList) + let options = ['-v'] + if len(a:argList) != 0 + let options = a:argList + endif + return s:DoCommand(join(['status'] + options, ' '), 'status', join(options, ' '), {}) +endfunction + +" Function: s:svkFunctions.Unlock(argList) {{{2 +function! s:svkFunctions.Unlock(argList) + return s:DoCommand(join(['unlock'] + a:argList, ' '), 'unlock', join(a:argList, ' '), {}) +endfunction +" Function: s:svkFunctions.Update(argList) {{{2 +function! s:svkFunctions.Update(argList) + return s:DoCommand('update', 'update', '', {}) +endfunction + +" Section: Plugin Registration {{{1 +let s:VCSCommandUtility = VCSCommandRegisterModule('SVK', expand(''), s:svkFunctions, []) + +let &cpo = s:save_cpo diff --git a/.vim/plugin/vcssvn.vim b/.vim/plugin/vcssvn.vim new file mode 100644 index 0000000..758f819 --- /dev/null +++ b/.vim/plugin/vcssvn.vim @@ -0,0 +1,284 @@ +" vim600: set foldmethod=marker: +" +" SVN extension for VCSCommand. +" +" Maintainer: Bob Hiestand +" License: +" Copyright (c) Bob Hiestand +" +" Permission is hereby granted, free of charge, to any person obtaining a copy +" of this software and associated documentation files (the "Software"), to +" deal in the Software without restriction, including without limitation the +" rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +" sell copies of the Software, and to permit persons to whom the Software is +" furnished to do so, subject to the following conditions: +" +" The above copyright notice and this permission notice shall be included in +" all copies or substantial portions of the Software. +" +" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +" IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +" FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +" AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +" LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +" FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +" IN THE SOFTWARE. +" +" Section: Documentation {{{1 +" +" Options documentation: {{{2 +" +" VCSCommandSVNExec +" This variable specifies the SVN executable. If not set, it defaults to +" 'svn' executed from the user's executable path. +" +" VCSCommandSVNDiffExt +" This variable, if set, sets the external diff program used by Subversion. +" +" VCSCommandSVNDiffOpt +" This variable, if set, determines the options passed to the svn diff +" command (such as 'u', 'w', or 'b'). + +" Section: Plugin header {{{1 + +if exists('VCSCommandDisableAll') + finish +endif + +if v:version < 700 + echohl WarningMsg|echomsg 'VCSCommand requires at least VIM 7.0'|echohl None + finish +endif + +runtime plugin/vcscommand.vim + +if !executable(VCSCommandGetOption('VCSCommandSVNExec', 'svn')) + " SVN is not installed + finish +endif + +let s:save_cpo=&cpo +set cpo&vim + +" Section: Variable initialization {{{1 + +let s:svnFunctions = {} + +" Section: Utility functions {{{1 + +" Function: s:Executable() {{{2 +" Returns the executable used to invoke git suitable for use in a shell +" command. +function! s:Executable() + return shellescape(VCSCommandGetOption('VCSCommandSVNExec', 'svn')) +endfunction + +" Function: s:DoCommand(cmd, cmdName, statusText, options) {{{2 +" Wrapper to VCSCommandDoCommand to add the name of the SVN executable to the +" command argument. +function! s:DoCommand(cmd, cmdName, statusText, options) + if VCSCommandGetVCSType(expand('%')) == 'SVN' + let fullCmd = s:Executable() . ' ' . a:cmd + return VCSCommandDoCommand(fullCmd, a:cmdName, a:statusText, a:options) + else + throw 'SVN VCSCommand plugin called on non-SVN item.' + endif +endfunction + +" Section: VCS function implementations {{{1 + +" Function: s:svnFunctions.Identify(buffer) {{{2 +function! s:svnFunctions.Identify(buffer) + let fileName = resolve(bufname(a:buffer)) + if isdirectory(fileName) + let directoryName = fileName + else + let directoryName = fnamemodify(fileName, ':h') + endif + if strlen(directoryName) > 0 + let svnDir = directoryName . '/.svn' + else + let svnDir = '.svn' + endif + if isdirectory(svnDir) + return 1 + else + return 0 + endif +endfunction + +" Function: s:svnFunctions.Add() {{{2 +function! s:svnFunctions.Add(argList) + return s:DoCommand(join(['add'] + a:argList, ' '), 'add', join(a:argList, ' '), {}) +endfunction + +" Function: s:svnFunctions.Annotate(argList) {{{2 +function! s:svnFunctions.Annotate(argList) + if len(a:argList) == 0 + if &filetype == 'SVNannotate' + " Perform annotation of the version indicated by the current line. + let caption = matchstr(getline('.'),'\v^\s+\zs\d+') + let options = ' -r' . caption + else + let caption = '' + let options = '' + endif + elseif len(a:argList) == 1 && a:argList[0] !~ '^-' + let caption = a:argList[0] + let options = ' -r' . caption + else + let caption = join(a:argList, ' ') + let options = ' ' . caption + endif + + return s:DoCommand('blame --non-interactive' . options, 'annotate', caption, {}) +endfunction + +" Function: s:svnFunctions.Commit(argList) {{{2 +function! s:svnFunctions.Commit(argList) + let resultBuffer = s:DoCommand('commit --non-interactive -F "' . a:argList[0] . '"', 'commit', '', {}) + if resultBuffer == 0 + echomsg 'No commit needed.' + endif +endfunction + +" Function: s:svnFunctions.Delete() {{{2 +function! s:svnFunctions.Delete(argList) + return s:DoCommand(join(['delete --non-interactive'] + a:argList, ' '), 'delete', join(a:argList, ' '), {}) +endfunction + +" Function: s:svnFunctions.Diff(argList) {{{2 +function! s:svnFunctions.Diff(argList) + if len(a:argList) == 0 + let revOptions = [] + let caption = '' + elseif len(a:argList) <= 2 && match(a:argList, '^-') == -1 + let revOptions = ['-r' . join(a:argList, ':')] + let caption = '(' . a:argList[0] . ' : ' . get(a:argList, 1, 'current') . ')' + else + " Pass-through + let caption = join(a:argList, ' ') + let revOptions = a:argList + endif + + let svnDiffExt = VCSCommandGetOption('VCSCommandSVNDiffExt', '') + if svnDiffExt == '' + let diffExt = [] + else + let diffExt = ['--diff-cmd ' . svnDiffExt] + endif + + let svnDiffOpt = VCSCommandGetOption('VCSCommandSVNDiffOpt', '') + if svnDiffOpt == '' + let diffOptions = [] + else + let diffOptions = ['-x -' . svnDiffOpt] + endif + + return s:DoCommand(join(['diff --non-interactive'] + diffExt + diffOptions + revOptions), 'diff', caption, {}) +endfunction + +" Function: s:svnFunctions.GetBufferInfo() {{{2 +" Provides version control details for the current file. Current version +" number and current repository version number are required to be returned by +" the vcscommand plugin. +" Returns: List of results: [revision, repository, branch] + +function! s:svnFunctions.GetBufferInfo() + let originalBuffer = VCSCommandGetOriginalBuffer(bufnr('%')) + let fileName = bufname(originalBuffer) + let statusText = s:VCSCommandUtility.system(s:Executable() . ' status --non-interactive -vu -- "' . fileName . '"') + if(v:shell_error) + return [] + endif + + " File not under SVN control. + if statusText =~ '^?' + return ['Unknown'] + endif + + let [flags, revision, repository] = matchlist(statusText, '^\(.\{9}\)\s*\(\d\+\)\s\+\(\d\+\)')[1:3] + if revision == '' + " Error + return ['Unknown'] + elseif flags =~ '^A' + return ['New', 'New'] + elseif flags =~ '*' + return [revision, repository, '*'] + else + return [revision, repository] + endif +endfunction + +" Function: s:svnFunctions.Info(argList) {{{2 +function! s:svnFunctions.Info(argList) + return s:DoCommand(join(['info --non-interactive'] + a:argList, ' '), 'info', join(a:argList, ' '), {}) +endfunction + +" Function: s:svnFunctions.Lock(argList) {{{2 +function! s:svnFunctions.Lock(argList) + return s:DoCommand(join(['lock --non-interactive'] + a:argList, ' '), 'lock', join(a:argList, ' '), {}) +endfunction + +" Function: s:svnFunctions.Log(argList) {{{2 +function! s:svnFunctions.Log(argList) + if len(a:argList) == 0 + let options = [] + let caption = '' + elseif len(a:argList) <= 2 && match(a:argList, '^-') == -1 + let options = ['-r' . join(a:argList, ':')] + let caption = options[0] + else + " Pass-through + let options = a:argList + let caption = join(a:argList, ' ') + endif + + let resultBuffer = s:DoCommand(join(['log --non-interactive', '-v'] + options), 'log', caption, {}) + return resultBuffer +endfunction + +" Function: s:svnFunctions.Revert(argList) {{{2 +function! s:svnFunctions.Revert(argList) + return s:DoCommand('revert', 'revert', '', {}) +endfunction + +" Function: s:svnFunctions.Review(argList) {{{2 +function! s:svnFunctions.Review(argList) + if len(a:argList) == 0 + let versiontag = '(current)' + let versionOption = '' + else + let versiontag = a:argList[0] + let versionOption = ' -r ' . versiontag . ' ' + endif + + return s:DoCommand('cat --non-interactive' . versionOption, 'review', versiontag, {}) +endfunction + +" Function: s:svnFunctions.Status(argList) {{{2 +function! s:svnFunctions.Status(argList) + let options = ['-u', '-v'] + if len(a:argList) != 0 + let options = a:argList + endif + return s:DoCommand(join(['status --non-interactive'] + options, ' '), 'status', join(options, ' '), {}) +endfunction + +" Function: s:svnFunctions.Unlock(argList) {{{2 +function! s:svnFunctions.Unlock(argList) + return s:DoCommand(join(['unlock --non-interactive'] + a:argList, ' '), 'unlock', join(a:argList, ' '), {}) +endfunction + +" Function: s:svnFunctions.Update(argList) {{{2 +function! s:svnFunctions.Update(argList) + return s:DoCommand('update --non-interactive', 'update', '', {}) +endfunction + +" Annotate setting {{{2 +let s:svnFunctions.AnnotateSplitRegex = '\s\+\S\+\s\+\S\+ ' + +" Section: Plugin Registration {{{1 +let s:VCSCommandUtility = VCSCommandRegisterModule('SVN', expand(''), s:svnFunctions, []) + +let &cpo = s:save_cpo diff --git a/.vim/readme-ian.txt b/.vim/readme-ian.txt new file mode 100644 index 0000000..15aa87e --- /dev/null +++ b/.vim/readme-ian.txt @@ -0,0 +1,47 @@ +" Note, this config is many years old and needs serious updating. + +notes for everything in .vim. + +.vim/unix.vim +this is just a vimrc to set nocomptable for testing + +not currently installed: + +ColorSamplerPack: {{{ +download from vim.org +cd ~/.vim +unzip ~/dt/ColorSamplerPack.zip +}}} +javacomplete - omnicompletion for java.{{{ +http://www.vim.org/scripts/script.php?script_id=1785 + +files are: + .vim/autoload/java_parser.vim + .vim/doc/javacomplete.txt + .vim/autoload/javacomplete.vim + .vim/autoload/Reflection.java + +install instructions are on the site, and in the vim documentation. +my install procedure: +download from website +in shell: +> unzip ~/dt/javacomplete.zip -d ~/.vim +> vim -c "helptags $HOME/.vim/doc" +add stuff to vimrc, has "javacomplete near added parts. +}}} + +{{{ syntaxattr.vim +get this file: +autoload/SyntaxAttr.vim + +add this to vimrc: + +autocmd FuncUndefined * exe 'runtime autoload/' . expand('') . '.vim' +map :call SyntaxAttr() + +}}} + +syntax/sh.vim, modified from official version to make highlighting better + + +" vim:sw=4 ts=4 sts=4 foldmethod=marker diff --git a/.vim/syntax/cvsannotate.vim b/.vim/syntax/cvsannotate.vim new file mode 100644 index 0000000..f35ed96 --- /dev/null +++ b/.vim/syntax/cvsannotate.vim @@ -0,0 +1,45 @@ +" Vim syntax file +" Language: CVS annotate output +" Maintainer: Bob Hiestand +" Remark: Used by the cvscommand plugin. Originally written by Mathieu +" Clabaut +" License: +" Copyright (c) Bob Hiestand +" +" Permission is hereby granted, free of charge, to any person obtaining a copy +" of this software and associated documentation files (the "Software"), to +" deal in the Software without restriction, including without limitation the +" rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +" sell copies of the Software, and to permit persons to whom the Software is +" furnished to do so, subject to the following conditions: +" +" The above copyright notice and this permission notice shall be included in +" all copies or substantial portions of the Software. +" +" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +" IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +" FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +" AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +" LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +" FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +" IN THE SOFTWARE. + +if version < 600 + syntax clear +elseif exists("b:current_syntax") + finish +endif + +syn match cvsDate /\d\d-...-\d\d/ contained +syn match cvsName /(\S* /hs=s+1,he=e-1 contained nextgroup=cvsDate +syn match cvsVer /^\d\+\(\.\d\+\)\+/ contained nextgroup=cvsName +syn region cvsHead start="^\d\+\.\d\+" end="):" contains=cvsVer,cvsName,cvsDate + +if !exists("did_cvsannotate_syntax_inits") + let did_cvsannotate_syntax_inits = 1 + hi link cvsDate Comment + hi link cvsName Type + hi link cvsVer Statement +endif + +let b:current_syntax="CVSAnnotate" diff --git a/.vim/syntax/gitannotate.vim b/.vim/syntax/gitannotate.vim new file mode 100644 index 0000000..77ad14e --- /dev/null +++ b/.vim/syntax/gitannotate.vim @@ -0,0 +1,44 @@ +" Vim syntax file +" Language: git annotate output +" Maintainer: Bob Hiestand +" Remark: Used by the vcscommand plugin. +" License: +" Copyright (c) Bob Hiestand +" +" Permission is hereby granted, free of charge, to any person obtaining a copy +" of this software and associated documentation files (the "Software"), to +" deal in the Software without restriction, including without limitation the +" rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +" sell copies of the Software, and to permit persons to whom the Software is +" furnished to do so, subject to the following conditions: +" +" The above copyright notice and this permission notice shall be included in +" all copies or substantial portions of the Software. +" +" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +" IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +" FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +" AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +" LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +" FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +" IN THE SOFTWARE. + +if exists("b:current_syntax") + finish +endif + +syn region gitName start="(\@<=" end="\( \d\d\d\d-\)\@=" contained +syn match gitCommit /^\^\?\x\+/ contained +syn match gitDate /\d\d\d\d-\d\d-\d\d \d\d:\d\d:\d\d [+-]\d\d\d\d/ contained +syn match gitLineNumber /\d\+)\@=/ contained +syn region gitAnnotation start="^" end=") " oneline keepend contains=gitCommit,gitLineNumber,gitDate,gitName + +if !exists("did_gitannotate_syntax_inits") + let did_gitannotate_syntax_inits = 1 + hi link gitName Type + hi link gitCommit Statement + hi link gitDate Comment + hi link gitLineNumber Label +endif + +let b:current_syntax="gitAnnotate" diff --git a/.vim/syntax/hgannotate.vim b/.vim/syntax/hgannotate.vim new file mode 100644 index 0000000..4e1d627 --- /dev/null +++ b/.vim/syntax/hgannotate.vim @@ -0,0 +1,40 @@ +" Vim syntax file +" Language: HG annotate output +" Maintainer: Bob Hiestand +" Remark: Used by the vcscommand plugin. +" License: +" Copyright (c) Bob Hiestand +" +" Permission is hereby granted, free of charge, to any person obtaining a copy +" of this software and associated documentation files (the "Software"), to +" deal in the Software without restriction, including without limitation the +" rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +" sell copies of the Software, and to permit persons to whom the Software is +" furnished to do so, subject to the following conditions: +" +" The above copyright notice and this permission notice shall be included in +" all copies or substantial portions of the Software. +" +" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +" IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +" FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +" AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +" LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +" FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +" IN THE SOFTWARE. + +if exists("b:current_syntax") + finish +endif + +syn match hgVer /\d\+/ contained +syn match hgName /^\s*\S\+/ contained +syn match hgHead /^\s*\S\+\s\+\d\+:/ contains=hgVer,hgName + +if !exists("did_hgannotate_syntax_inits") + let did_hgannotate_syntax_inits = 1 + hi link hgName Type + hi link hgVer Statement +endif + +let b:current_syntax="hgAnnotate" diff --git a/.vim/syntax/sh.vim b/.vim/syntax/sh.vim new file mode 100644 index 0000000..ea654d9 --- /dev/null +++ b/.vim/syntax/sh.vim @@ -0,0 +1,562 @@ +" modified to remove obnoxious overhighliting +" Vim syntax file +" Language: shell (sh) Korn shell (ksh) bash (sh) +" Maintainer: Dr. Charles E. Campbell, Jr. +" Previous Maintainer: Lennart Schultz +" Last Change: Sep 17, 2008 +" Version: 104 +" URL: http://mysite.verizon.net/astronaut/vim/index.html#vimlinks_syntax +" For options and settings, please use: :help ft-sh-syntax +" This file includes many ideas from Éric Brunet (eric.brunet@ens.fr) + +" For version 5.x: Clear all syntax items {{{1 +" For version 6.x: Quit when a syntax file was already loaded +if version < 600 + syntax clear +elseif exists("b:current_syntax") + finish +endif + +" handling /bin/sh with is_kornshell/is_sh {{{1 +" b:is_sh is set when "#! /bin/sh" is found; +" However, it often is just a masquerade by bash (typically Linux) +" or kornshell (typically workstations with Posix "sh"). +" So, when the user sets "is_bash" or "is_kornshell", +" a b:is_sh is converted into b:is_bash/b:is_kornshell, +" respectively. +if !exists("b:is_kornshell") && !exists("b:is_bash") + if exists("g:is_posix") && !exists("g:is_kornshell") + let g:is_kornshell= g:is_posix + endif + if exists("g:is_kornshell") + let b:is_kornshell= 1 + if exists("b:is_sh") + unlet b:is_sh + endif + elseif exists("g:is_bash") + let b:is_bash= 1 + if exists("b:is_sh") + unlet b:is_sh + endif + else + let b:is_sh= 1 + endif +endif + +" set up default g:sh_fold_enabled {{{1 +if !exists("g:sh_fold_enabled") + let g:sh_fold_enabled= 0 +elseif g:sh_fold_enabled != 0 && !has("folding") + let g:sh_fold_enabled= 0 + echomsg "Ignoring g:sh_fold_enabled=".g:sh_fold_enabled."; need to re-compile vim for +fold support" +endif +if !exists("s:sh_fold_functions") + let s:sh_fold_functions = 1 +endif +if !exists("s:sh_fold_heredoc") + let s:sh_fold_heredoc = 2 +endif +if !exists("s:sh_fold_ifdofor") + let s:sh_fold_ifdofor = 4 +endif +if g:sh_fold_enabled && &fdm == "manual" + set fdm=syntax +endif + +" sh syntax is case sensitive {{{1 +syn case match + +" Clusters: contains=@... clusters {{{1 +"================================== +syn cluster shErrorList contains=shDoError,shIfError,shInError,shCaseError,shEsacError,shCurlyError,shParenError,shTestError +if exists("b:is_kornshell") + syn cluster ErrorList add=shDTestError +endif +syn cluster shArithParenList contains=shArithmetic,shDeref,shDerefSimple,shEcho,shEscape,shNumber,shOperator,shPosnParm,shExSingleQuote,shRedir,shSingleQuote,shDoubleQuote,shStatement,shVariable,shAlias,shTest,shCtrlSeq,shSpecial,shParen +syn cluster shArithList contains=@shArithParenList,shParenError +syn cluster shCaseEsacList contains=shCaseStart,shCase,shCaseBar,shCaseIn,shComment,shDeref,shDerefSimple,shCaseCommandSub,shCaseExSingleQuote,shCaseSingleQuote,shCaseDoubleQuote,shCtrlSeq,@shErrorList,shStringSpecial +syn cluster shCaseList contains=@shCommandSubList,shCaseEsac,shColon,shCommandSub,shCommandSub,shComment,shDo,shEcho,shExpr,shFor,shHereDoc,shIf,shRedir,shSetList,shSource,shStatement,shVariable,shCtrlSeq +syn cluster shColonList contains=@shCaseList +syn cluster shCommandSubList contains=shArithmetic,shDeref,shDerefSimple,shEscape,shNumber,shOperator,shPosnParm,shExSingleQuote,shSingleQuote,shDoubleQuote,shStatement,shVariable,shSubSh,shAlias,shTest,shCtrlSeq,shSpecial +syn cluster shCurlyList contains=shNumber,shComma,shDeref,shDerefSimple,shDerefSpecial +syn cluster shDblQuoteList contains=shCommandSub,shDeref,shDerefSimple,shPosnParm,shExSingleQuote,shCtrlSeq,shSpecial +syn cluster shDerefList contains=shDeref,shDerefSimple,shDerefVar,shDerefSpecial,shDerefWordError,shDerefPPS +syn cluster shDerefVarList contains=shDerefOp,shDerefVarArray +syn cluster shEchoList contains=shArithmetic,shCommandSub,shDeref,shDerefSimple,shExpr,shExSingleQuote,shSingleQuote,shDoubleQuote,shCtrlSeq,shEchoQuote +syn cluster shExprList1 contains=shCharClass,shNumber,shOperator,shExSingleQuote,shSingleQuote,shDoubleQuote,shExpr,shDblBrace,shDeref,shDerefSimple,shCtrlSeq +syn cluster shExprList2 contains=@shExprList1,@shCaseList,shTest +syn cluster shFunctionList contains=@shCommandSubList,shCaseEsac,shColon,shCommandSub,shCommandSub,shComment,shDo,shEcho,shExpr,shFor,shHereDoc,shIf,shRedir,shSetList,shSource,shStatement,shVariable,shOperator,shCtrlSeq +if exists("b:is_kornshell") || exists("b:is_bash") + syn cluster shFunctionList add=shRepeat + syn cluster shFunctionList add=shDblBrace,shDblParen +endif +syn cluster shHereBeginList contains=@shCommandSubList +syn cluster shHereList contains=shBeginHere,shHerePayload +syn cluster shHereListDQ contains=shBeginHere,@shDblQuoteList,shHerePayload +syn cluster shIdList contains=shCommandSub,shWrapLineOperator,shSetOption,shDeref,shDerefSimple,shRedir,shExSingleQuote,shSingleQuote,shDoubleQuote,shExpr,shCtrlSeq,shStringSpecial +syn cluster shLoopList contains=@shCaseList,shTestOpr,shExpr,shDblBrace,shConditional,shCaseEsac,shTest,@shErrorList,shSet +syn cluster shSubShList contains=@shCaseList,shOperator +syn cluster shTestList contains=shCharClass,shComment,shCommandSub,shDeref,shDerefSimple,shDoubleQuote,shExpr,shExpr,shNumber,shOperator,shExSingleQuote,shSingleQuote,shTestOpr,shTest,shCtrlSeq + + +" Alias: {{{1 +" ===== +if exists("b:is_kornshell") || exists("b:is_bash") + syn match shStatement "\" + syn region shAlias matchgroup=shStatement start="\\s\+\(\w\+\)\@=" skip="\\$" end="\>\|`" + syn region shAlias matchgroup=shStatement start="\\s\+\(\w\+=\)\@=" skip="\\$" end="=" +endif + +" Error Codes: {{{1 +" ============ +syn match shDoError "\" +syn match shIfError "\" +syn match shInError "\" +syn match shCaseError ";;" +syn match shEsacError "\" +syn match shCurlyError "}" +syn match shParenError ")" +if exists("b:is_kornshell") + syn match shDTestError "]]" +endif +syn match shTestError "]" + +" Options: {{{1 +" ==================== +syn match shOption "\s\zs[-+][a-zA-Z0-9]\+\>" +syn match shOption "\s\zs--[^ \t$`'"|]\+" + +" File Redirection Highlighted As Operators: {{{1 +"=========================================== +syn match shRedir "\d\=>\(&[-0-9]\)\=" +syn match shRedir "\d\=>>-\=" +syn match shRedir "\d\=<\(&[-0-9]\)\=" +syn match shRedir "\d<<-\=" + +" Operators: {{{1 +" ========== +syn match shOperator "<<\|>>" contained +syn match shOperator "[!&;|]" contained +syn match shOperator "\[[[^:]\|\]]" contained +syn match shOperator "!\==" skipwhite nextgroup=shPattern +syn match shPattern "\<\S\+\())\)\@=" contained contains=shExSingleQuote,shSingleQuote,shDoubleQuote,shDeref + +" Subshells: {{{1 +" ========== +syn region shExpr transparent matchgroup=shExprRegion start="{" end="}" contains=@shExprList2 +syn region shSubSh transparent matchgroup=shSubShRegion start="(" end=")" contains=@shSubShList + +" Tests: {{{1 +"======= +"syn region shExpr transparent matchgroup=shRange start="\[" skip=+\\\\\|\\$+ end="\]" contains=@shTestList +syn region shExpr matchgroup=shRange start="\[" skip=+\\\\\|\\$+ end="\]" contains=@shTestList +syn region shTest transparent matchgroup=shStatement start="\" skip=+\\\\\|\\$+ matchgroup=NONE end="[;&|]"me=e-1 end="$" contains=@shExprList1 +syn match shTestOpr contained "<=\|>=\|!=\|==\|-.\>\|-\(nt\|ot\|ef\|eq\|ne\|lt\|le\|gt\|ge\)\>\|[!<>]" +syn match shTestOpr contained '=' skipwhite nextgroup=shTestDoubleQuote,shTestSingleQuote,shTestPattern +syn match shTestPattern contained '\w\+' +syn match shTestDoubleQuote contained '"[^"]*"' +syn match shTestSingleQuote contained '\\.' +syn match shTestSingleQuote contained "'[^']*'" +if exists("b:is_kornshell") || exists("b:is_bash") + syn region shDblBrace matchgroup=Delimiter start="\[\[" skip=+\\\\\|\\$+ end="\]\]" contains=@shTestList + syn region shDblParen matchgroup=Delimiter start="((" skip=+\\\\\|\\$+ end="))" contains=@shTestList +endif + +" Character Class In Range: {{{1 +" ========================= +syn match shCharClass contained "\[:\(backspace\|escape\|return\|xdigit\|alnum\|alpha\|blank\|cntrl\|digit\|graph\|lower\|print\|punct\|space\|upper\|tab\):\]" + +" Loops: do, if, while, until {{{1 +" ====== +if (g:sh_fold_enabled % (s:sh_fold_ifdofor * 2))/s:sh_fold_ifdofor + syn region shDo fold transparent matchgroup=shConditional start="\" matchgroup=shConditional end="\" contains=@shLoopList + syn region shIf fold transparent matchgroup=shConditional start="\#\=" +syn match shCtrlSeq "\\\d\d\d\|\\[abcfnrtv0]" contained +if exists("b:is_bash") + syn match shSpecial "\\\o\o\o\|\\x\x\x\|\\c.\|\\[abefnrtv]" contained +endif +if exists("b:is_bash") + syn region shExSingleQuote matchgroup=shOperator start=+\$'+ skip=+\\\\\|\\.+ end=+'+ contains=shStringSpecial,shSpecial +else + syn region shExSingleQuote matchGroup=Error start=+\$'+ skip=+\\\\\|\\.+ end=+'+ contains=shStringSpecial +endif +syn region shSingleQuote matchgroup=shOperator start=+'+ end=+'+ contains=shStringSpecial,@Spell +syn region shDoubleQuote matchgroup=shOperator start=+"+ skip=+\\"+ end=+"+ contains=@shDblQuoteList,shStringSpecial,@Spell +syn match shStringSpecial "[^[:print:] \t]" contained +syn match shStringSpecial "\%(\\\\\)*\\[\\"'`$()#]" +syn match shSpecial "[^\\]\zs\%(\\\\\)*\\[\\"'`$()#]" +syn match shSpecial "^\%(\\\\\)*\\[\\"'`$()#]" + +" Comments: {{{1 +"========== +syn cluster shCommentGroup contains=shTodo,@Spell +syn keyword shTodo contained COMBAK FIXME TODO XXX +syn match shComment "^\s*\zs#.*$" contains=@shCommentGroup +syn match shComment "\s\zs#.*$" contains=@shCommentGroup +syn match shQuickComment contained "#.*$" + +" Here Documents: {{{1 +" ========================================= +if version < 600 + syn region shHereDoc matchgroup=shRedir start="<<\s*\**END[a-zA-Z_0-9]*\**" matchgroup=shRedir end="^END[a-zA-Z_0-9]*$" contains=@shDblQuoteList + syn region shHereDoc matchgroup=shRedir start="<<-\s*\**END[a-zA-Z_0-9]*\**" matchgroup=shRedir end="^\s*END[a-zA-Z_0-9]*$" contains=@shDblQuoteList + syn region shHereDoc matchgroup=shRedir start="<<\s*\**EOF\**" matchgroup=shRedir end="^EOF$" contains=@shDblQuoteList + syn region shHereDoc matchgroup=shRedir start="<<-\s*\**EOF\**" matchgroup=shRedir end="^\s*EOF$" contains=@shDblQuoteList + syn region shHereDoc matchgroup=shRedir start="<<\s*\**\.\**" matchgroup=shRedir end="^\.$" contains=@shDblQuoteList + syn region shHereDoc matchgroup=shRedir start="<<-\s*\**\.\**" matchgroup=shRedir end="^\s*\.$" contains=@shDblQuoteList + +elseif (g:sh_fold_enabled % (s:sh_fold_heredoc * 2))/s:sh_fold_heredoc + syn region shHereDoc matchgroup=shRedir fold start="<<\s*\z(\S*\)" matchgroup=shRedir end="^\z1\s*$" contains=@shDblQuoteList + syn region shHereDoc matchgroup=shRedir fold start="<<\s*\"\z(\S*\)\"" matchgroup=shRedir end="^\z1\s*$" + syn region shHereDoc matchgroup=shRedir fold start="<<\s*'\z(\S*\)'" matchgroup=shRedir end="^\z1\s*$" + syn region shHereDoc matchgroup=shRedir fold start="<<-\s*\z(\S*\)" matchgroup=shRedir end="^\s*\z1\s*$" contains=@shDblQuoteList + syn region shHereDoc matchgroup=shRedir fold start="<<-\s*\"\z(\S*\)\"" matchgroup=shRedir end="^\s*\z1\s*$" + syn region shHereDoc matchgroup=shRedir fold start="<<-\s*'\z(\S*\)'" matchgroup=shRedir end="^\s*\z1\s*$" + syn region shHereDoc matchgroup=shRedir fold start="<<\s*\\\_$\_s*\z(\S*\)" matchgroup=shRedir end="^\z1\s*$" + syn region shHereDoc matchgroup=shRedir fold start="<<\s*\\\_$\_s*\"\z(\S*\)\"" matchgroup=shRedir end="^\z1\s*$" + syn region shHereDoc matchgroup=shRedir fold start="<<-\s*\\\_$\_s*'\z(\S*\)'" matchgroup=shRedir end="^\s*\z1\s*$" + syn region shHereDoc matchgroup=shRedir fold start="<<-\s*\\\_$\_s*\z(\S*\)" matchgroup=shRedir end="^\s*\z1\s*$" + syn region shHereDoc matchgroup=shRedir fold start="<<-\s*\\\_$\_s*\"\z(\S*\)\"" matchgroup=shRedir end="^\s*\z1\s*$" + syn region shHereDoc matchgroup=shRedir fold start="<<\s*\\\_$\_s*'\z(\S*\)'" matchgroup=shRedir end="^\z1\s*$" + syn region shHereDoc matchgroup=shRedir fold start="<<\\\z(\S*\)" matchgroup=shRedir end="^\z1\s*$" + +else + syn region shHereDoc matchgroup=shRedir start="<<\s*\\\=\z(\S*\)" matchgroup=shRedir end="^\z1\s*$" contains=@shDblQuoteList + syn region shHereDoc matchgroup=shRedir start="<<\s*\"\z(\S*\)\"" matchgroup=shRedir end="^\z1\s*$" + syn region shHereDoc matchgroup=shRedir start="<<-\s*\z(\S*\)" matchgroup=shRedir end="^\s*\z1\s*$" contains=@shDblQuoteList + syn region shHereDoc matchgroup=shRedir start="<<-\s*'\z(\S*\)'" matchgroup=shRedir end="^\s*\z1\s*$" + syn region shHereDoc matchgroup=shRedir start="<<\s*'\z(\S*\)'" matchgroup=shRedir end="^\z1\s*$" + syn region shHereDoc matchgroup=shRedir start="<<-\s*\"\z(\S*\)\"" matchgroup=shRedir end="^\s*\z1\s*$" + syn region shHereDoc matchgroup=shRedir start="<<\s*\\\_$\_s*\z(\S*\)" matchgroup=shRedir end="^\z1\s*$" + syn region shHereDoc matchgroup=shRedir start="<<-\s*\\\_$\_s*\z(\S*\)" matchgroup=shRedir end="^\s*\z1\s*$" + syn region shHereDoc matchgroup=shRedir start="<<-\s*\\\_$\_s*'\z(\S*\)'" matchgroup=shRedir end="^\s*\z1\s*$" + syn region shHereDoc matchgroup=shRedir start="<<\s*\\\_$\_s*'\z(\S*\)'" matchgroup=shRedir end="^\z1\s*$" + syn region shHereDoc matchgroup=shRedir start="<<\s*\\\_$\_s*\"\z(\S*\)\"" matchgroup=shRedir end="^\z1\s*$" + syn region shHereDoc matchgroup=shRedir start="<<-\s*\\\_$\_s*\"\z(\S*\)\"" matchgroup=shRedir end="^\s*\z1\s*$" + syn region shHereDoc matchgroup=shRedir start="<<\\\z(\S*\)" matchgroup=shRedir end="^\z1\s*$" +endif + +" Here Strings: {{{1 +" ============= +if exists("b:is_bash") + syn match shRedir "<<<" +endif + +" Identifiers: {{{1 +"============= +syn match shSetOption "\s\zs[-+][a-zA-Z0-9]\+\>" contained +syn match shVariable "\<\([bwglsav]:\)\=[a-zA-Z0-9.!@_%+,]*\ze=" nextgroup=shSetIdentifier +syn match shSetIdentifier "=" contained nextgroup=shPattern,shDeref,shDerefSimple,shDoubleQuote,shSingleQuote,shExSingleQuote + +" Functions: {{{1 +if !exists("g:is_posix") + syn keyword shFunctionKey function skipwhite skipnl nextgroup=shFunctionTwo +endif + +if exists("b:is_bash") + if (g:sh_fold_enabled % (s:sh_fold_functions * 2))/s:sh_fold_functions + syn region shFunctionOne fold matchgroup=shFunction start="^\s*\h[-a-zA-Z_0-9]*\s*()\_s*{" end="}" contains=@shFunctionList skipwhite skipnl nextgroup=shFunctionStart,shQuickComment + syn region shFunctionTwo fold matchgroup=shFunction start="\h[-a-zA-Z_0-9]*\s*\%(()\)\=\_s*{" end="}" contains=shFunctionKey,@shFunctionList contained skipwhite skipnl nextgroup=shFunctionStart,shQuickComment + else + syn region shFunctionOne matchgroup=shFunction start="^\s*\h[-a-zA-Z_0-9]*\s*()\_s*{" end="}" contains=@shFunctionList + syn region shFunctionTwo matchgroup=shFunction start="\h[-a-zA-Z_0-9]*\s*\%(()\)\=\_s*{" end="}" contains=shFunctionKey,@shFunctionList contained + endif +else + if (g:sh_fold_enabled % (s:sh_fold_functions * 2))/s:sh_fold_functions + syn region shFunctionOne fold matchgroup=shFunction start="^\s*\h\w*\s*()\_s*{" end="}" contains=@shFunctionList skipwhite skipnl nextgroup=shFunctionStart,shQuickComment + syn region shFunctionTwo fold matchgroup=shFunction start="\h\w*\s*\%(()\)\=\_s*{" end="}" contains=shFunctionKey,@shFunctionList contained skipwhite skipnl nextgroup=shFunctionStart,shQuickComment + else + syn region shFunctionOne matchgroup=shFunction start="^\s*\h\w*\s*()\_s*{" end="}" contains=@shFunctionList + syn region shFunctionTwo matchgroup=shFunction start="\h\w*\s*\%(()\)\=\_s*{" end="}" contains=shFunctionKey,@shFunctionList contained + endif +endif + +" Parameter Dereferencing: {{{1 +" ======================== +syn match shDerefSimple "\$\%(\h\w*\|\d\)" +syn region shDeref matchgroup=PreProc start="\${" end="}" contains=@shDerefList,shDerefVarArray +syn match shDerefSimple "\$[-#*@!?]" +syn match shDerefSimple "\$\$" +if exists("b:is_bash") || exists("b:is_kornshell") + syn region shDeref matchgroup=PreProc start="\${##\=" end="}" contains=@shDerefList + syn region shDeref matchgroup=PreProc start="\${\$\$" end="}" contains=@shDerefList +endif + +" bash: ${!prefix*} and ${#parameter}: {{{1 +" ==================================== +if exists("b:is_bash") + syn region shDeref matchgroup=PreProc start="\${!" end="\*\=}" contains=@shDerefList,shDerefOp + syn match shDerefVar contained "{\@<=!\w\+" nextgroup=@shDerefVarList +endif + +syn match shDerefSpecial contained "{\@<=[-*@?0]" nextgroup=shDerefOp +syn match shDerefSpecial contained "\({[#!]\)\@<=[[:alnum:]*@_]\+" nextgroup=@shDerefVarList,shDerefOp +syn match shDerefVar contained "{\@<=\w\+" nextgroup=@shDerefVarList + +" sh ksh bash : ${var[... ]...} array reference: {{{1 +syn region shDerefVarArray contained matchgroup=shDeref start="\[" end="]" contains=@shCommandSubList nextgroup=shDerefOp + +" Special ${parameter OPERATOR word} handling: {{{1 +" sh ksh bash : ${parameter:-word} word is default value +" sh ksh bash : ${parameter:=word} assign word as default value +" sh ksh bash : ${parameter:?word} display word if parameter is null +" sh ksh bash : ${parameter:+word} use word if parameter is not null, otherwise nothing +" ksh bash : ${parameter#pattern} remove small left pattern +" ksh bash : ${parameter##pattern} remove large left pattern +" ksh bash : ${parameter%pattern} remove small right pattern +" ksh bash : ${parameter%%pattern} remove large right pattern +syn cluster shDerefPatternList contains=shDerefPattern,shDerefString +syn match shDerefOp contained ":\=[-=?]" nextgroup=@shDerefPatternList +syn match shDerefOp contained ":\=+" nextgroup=@shDerefPatternList +if exists("b:is_bash") || exists("b:is_kornshell") + syn match shDerefOp contained "#\{1,2}" nextgroup=@shDerefPatternList + syn match shDerefOp contained "%\{1,2}" nextgroup=@shDerefPatternList + syn match shDerefPattern contained "[^{}]\+" contains=shDeref,shDerefSimple,shDerefPattern,shDerefString,shCommandSub,shDerefEscape nextgroup=shDerefPattern + syn region shDerefPattern contained start="{" end="}" contains=shDeref,shDerefSimple,shDerefString,shCommandSub nextgroup=shDerefPattern + syn match shDerefEscape contained '\%(\\\\\)*\\.' +endif +syn region shDerefString contained matchgroup=shOperator start=+\%(\\\)\@" +syn sync match shCaseEsacSync groupthere shCaseEsac "\" +syn sync match shDoSync grouphere shDo "\" +syn sync match shDoSync groupthere shDo "\" +syn sync match shForSync grouphere shFor "\" +syn sync match shForSync groupthere shFor "\" +syn sync match shIfSync grouphere shIf "\" +syn sync match shIfSync groupthere shIf "\" +syn sync match shUntilSync grouphere shRepeat "\" +syn sync match shWhileSync grouphere shRepeat "\" + +" Default Highlighting: {{{1 +" ===================== +hi def link shArithRegion shShellVariables +hi def link shBeginHere shRedir +hi def link shCaseBar shConditional +hi def link shCaseCommandSub shCommandSub +hi def link shCaseDoubleQuote shDoubleQuote +hi def link shCaseIn shConditional +hi def link shCaseSingleQuote shSingleQuote +hi def link shCaseStart shConditional +hi def link shCmdSubRegion shShellVariables +hi def link shColon shStatement +hi def link shDerefOp shOperator +hi def link shDerefPOL shDerefOp +hi def link shDerefPPS shDerefOp +hi def link shDeref shShellVariables +hi def link shDerefSimple shDeref +hi def link shDerefSpecial shDeref +hi def link shDerefString shDoubleQuote +hi def link shDerefVar shDeref +hi def link shDoubleQuote shString +hi def link shEcho shString +hi def link shEchoQuote shString +hi def link shEmbeddedEcho shString +hi def link shEscape shCommandSub +hi def link shExSingleQuote shSingleQuote +hi def link shFunction Function +hi def link shHereDoc shString +hi def link shHerePayload shHereDoc +hi def link shLoop shStatement +hi def link shOption shCommandSub +hi def link shPattern shString +hi def link shParen shArithmetic +hi def link shPosnParm shShellVariables +hi def link shQuickComment shComment +hi def link shRange shOperator +hi def link shRedir shOperator +hi def link shSetOption shOption +hi def link shSingleQuote shString +hi def link shSource shOperator +hi def link shStringSpecial shSpecial +hi def link shSubShRegion shOperator +hi def link shTestOpr shConditional +hi def link shTestPattern shString +hi def link shTestDoubleQuote shString +hi def link shTestSingleQuote shString +hi def link shVariable shSetList +hi def link shWrapLineOperator shOperator + +if exists("b:is_bash") + hi def link bashAdminStatement shStatement + hi def link bashSpecialVariables shShellVariables + hi def link bashStatement shStatement + hi def link shFunctionParen Delimiter + hi def link shFunctionDelim Delimiter +endif +if exists("b:is_kornshell") + hi def link kshSpecialVariables shShellVariables + hi def link kshStatement shStatement + hi def link shFunctionParen Delimiter +endif + +hi def link shCaseError Error +hi def link shCondError Error +hi def link shCurlyError Error +hi def link shDerefError Error +hi def link shDerefWordError Error +hi def link shDoError Error +hi def link shEsacError Error +hi def link shIfError Error +hi def link shInError Error +hi def link shParenError Error +hi def link shTestError Error +if exists("b:is_kornshell") + hi def link shDTestError Error +endif + +hi def link shArithmetic Special +hi def link shCharClass Identifier +hi def link shSnglCase Statement +hi def link shCommandSub Special +hi def link shComment Comment +hi def link shConditional Conditional +hi def link shCtrlSeq Special +hi def link shExprRegion Delimiter +hi def link shFunctionKey Function +hi def link shFunctionName Function +hi def link shNumber Number +hi def link shOperator Operator +hi def link shRepeat Repeat +hi def link shSet Statement +hi def link shSetList Identifier +hi def link shShellVariables PreProc +hi def link shSpecial Special +hi def link shStatement Statement +hi def link shString String +hi def link shTodo Todo +hi def link shAlias Identifier + +" Set Current Syntax: {{{1 +" =================== +if exists("b:is_bash") + let b:current_syntax = "bash" +elseif exists("b:is_kornshell") + let b:current_syntax = "ksh" +else + let b:current_syntax = "sh" +endif + +" vim: ts=16 fdm=marker diff --git a/.vim/syntax/svkannotate.vim b/.vim/syntax/svkannotate.vim new file mode 100644 index 0000000..d93e9dd --- /dev/null +++ b/.vim/syntax/svkannotate.vim @@ -0,0 +1,42 @@ +" Vim syntax file +" Language: SVK annotate output +" Maintainer: Bob Hiestand +" Remark: Used by the vcscommand plugin. +" License: +" Copyright (c) Bob Hiestand +" +" Permission is hereby granted, free of charge, to any person obtaining a copy +" of this software and associated documentation files (the "Software"), to +" deal in the Software without restriction, including without limitation the +" rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +" sell copies of the Software, and to permit persons to whom the Software is +" furnished to do so, subject to the following conditions: +" +" The above copyright notice and this permission notice shall be included in +" all copies or substantial portions of the Software. +" +" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +" IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +" FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +" AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +" LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +" FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +" IN THE SOFTWARE. + +if exists("b:current_syntax") + finish +endif + +syn match svkDate /\d\{4}-\d\{1,2}-\d\{1,2}/ skipwhite contained +syn match svkName /(\s*\zs\S\+/ contained nextgroup=svkDate skipwhite +syn match svkVer /^\s*\d\+/ contained nextgroup=svkName skipwhite +syn region svkHead start=/^/ end="):" contains=svkVer,svkName,svkDate oneline + +if !exists("did_svkannotate_syntax_inits") + let did_svkannotate_syntax_inits = 1 + hi link svkName Type + hi link svkDate Comment + hi link svkVer Statement +endif + +let b:current_syntax="svkAnnotate" diff --git a/.vim/syntax/svnannotate.vim b/.vim/syntax/svnannotate.vim new file mode 100644 index 0000000..87a63ab --- /dev/null +++ b/.vim/syntax/svnannotate.vim @@ -0,0 +1,40 @@ +" Vim syntax file +" Language: SVN annotate output +" Maintainer: Bob Hiestand +" Remark: Used by the vcscommand plugin. +" License: +" Copyright (c) Bob Hiestand +" +" Permission is hereby granted, free of charge, to any person obtaining a copy +" of this software and associated documentation files (the "Software"), to +" deal in the Software without restriction, including without limitation the +" rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +" sell copies of the Software, and to permit persons to whom the Software is +" furnished to do so, subject to the following conditions: +" +" The above copyright notice and this permission notice shall be included in +" all copies or substantial portions of the Software. +" +" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +" IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +" FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +" AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +" LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +" FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +" IN THE SOFTWARE. + +if exists("b:current_syntax") + finish +endif + +syn match svnName /\S\+/ contained +syn match svnVer /^\s*\zs\d\+/ contained nextgroup=svnName skipwhite +syn match svnHead /^\s*\d\+\s\+\S\+/ contains=svnVer,svnName + +if !exists("did_svnannotate_syntax_inits") + let did_svnannotate_syntax_inits = 1 + hi link svnName Type + hi link svnVer Statement +endif + +let b:current_syntax="svnAnnotate" diff --git a/.vim/syntax/vcscommit.vim b/.vim/syntax/vcscommit.vim new file mode 100644 index 0000000..80b4c6e --- /dev/null +++ b/.vim/syntax/vcscommit.vim @@ -0,0 +1,31 @@ +" Vim syntax file +" Language: VCS commit file +" Maintainer: Bob Hiestand (bob.hiestand@gmail.com) +" License: +" Copyright (c) Bob Hiestand +" +" Permission is hereby granted, free of charge, to any person obtaining a copy +" of this software and associated documentation files (the "Software"), to +" deal in the Software without restriction, including without limitation the +" rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +" sell copies of the Software, and to permit persons to whom the Software is +" furnished to do so, subject to the following conditions: +" +" The above copyright notice and this permission notice shall be included in +" all copies or substantial portions of the Software. +" +" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +" IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +" FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +" AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +" LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +" FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +" IN THE SOFTWARE. + +if exists("b:current_syntax") + finish +endif + +syntax region vcsComment start="^VCS: " end="$" +highlight link vcsComment Comment +let b:current_syntax = "vcscommit" diff --git a/.vimrc b/.vimrc new file mode 100644 index 0000000..aae9c9b --- /dev/null +++ b/.vimrc @@ -0,0 +1,435 @@ +" Note, this config is many years old and needs serious updating. + +" }}} +" vim:sw=4 ts=4 sts=4 foldmethod=marker +" MAPPINGS: {{{1 +set encoding=utf-8 "the world is big +" +" +" set tab stops to 4 +set sw=4 +set ts=4 +set sts=4 +" mapping that should change: -, +, _ +" j and k should go to first non-whitespace. +" |i_CTRL-Y| +" +" +" paste unnamed register +inoremap " + +" when pasting, don't yank the pasted over text +vnoremap p "_dP + +" save +inoremap :update + + +"swap " and ' +noremap " ' +noremap ' " + +" Make ctrl-n and ctrl-p cycle through buffers in cmd mode +nnoremap :bn +nnoremap :bp +" quick command line window. +noremap m q:k +" mark +noremap m +noremap , q:i +noremap Q , +noremap q: Q +" yank to end of line +map Y y$ +" Insert a single char +nmap ir + +" Previously unmammed keys. + +" yank document to clipboard +noremap - mzgg"+yG'zzz +" save +noremap :w +" current_file:line_number +nmap \x :let @"=expand("%:t") . ':' . line(".") +" split common files +noremap :tabe ~/.vimrc +noremap :tabe ~/t +" paste clipboard +noremap "+p +noremap "+P +" alt-shift-letter has some terminal incompatibilities, so +" this needs to find a new key: +inoremap + + +" yank clipboard +noremap "+y:let@*=@+ +" easier window, tab and quickfix cycling +noremap w +noremap :cn +noremap :cp +" needs new key + +"nohl +noremap :nohl +inoremap :nohl + +" make x and X not affect registers +noremap x "_x +noremap X "_X +"stop # from unindenting newlines with smartcase +inoremap # X# + +"make * and # in visual mode search for the selection, instead of word under cursor. +vnoremap * :call VSearch()/ +vnoremap # :call VSearch()? +function! s:VSearch() + let old = @" + norm! gvy + let @/ = '\V' . substitute(escape(@", '\'), '\n', '\\n', 'g') + let @" = old +endfunction + +" remove trailing whitespace +nnoremap :%s/\s\+$//:unlet! b:statusline_trailing_space_warning + +" easy vim.. use ctrl-o and ctrl-l to use normal mode. +noremap :call easyVim() +inoremap :call easyVim() +function! s:easyVim() +if !&insertmode + set insertmode + "menu and button stuff. + set go+=m + set go+=T + " right scrollbar + set go+=r + " left scrollbar + set go+=L +else + set noinsertmode + set go-=m + set go-=T + set go-=r + set go-=L +endif +endfunction + + +" found this to compile the current buffer, took a bit from it +"function Make() + "let curr_dir = expand('%:h') + "if curr_dir == '' + "let curr_dir = '.' + "endif + "echo curr_dir + "execute 'lcd ' . curr_dir + "execute 'make %:r.o' + "execute 'lcd -' +"endfun +"imap :wa:call Make() +"nmap :wa:call Make() + +" standard make +" haven't been using it so its getting kicked out +"inoremap :wa:make +"nnoremap :wa:make +inoremap gT +nnoremap gT +inoremap gt +nnoremap gt + +" used to have !silent, but if make fails without an error that vim can parse, +" it doesn't show any failure, which is extremely confusing. I'd like +" something that would be silent except for a failure. +command! -bar -complete=file -nargs=* Make lcd %:h | make | cw +nnoremap :wa:Make +inoremap :wa:Make + +nnoremap :!./run.sh +nnoremap :silent! !ctags -R .:redr! + +" Execute the current line. +nnoremap "pyy:@p +vnoremap :call ExecRegion('vis') +function! ExecRegion(type, ...) + if a:type == "vis" + " Yank and execute the visual region. + :'<,'> y p + @p + endif +endfun + + +" EX COMMANDS: {{{1 + + +" originally I was using a macro for this +" do yy@0 on the next line +" ggzn/^{{ nyyddnkk::r !date +"\%I:\%M \%p \%A \%D" < :call setline(".", strftime("%I:%M %p %A %d/%m/%y")) +command! T :call setline(".", strftime("%I:%M %p %A %d/%m/%y")) +" need to lookup the cross platform date for this one +command! D :r !date +"\%D" + +" for my super simple version control. +command! -nargs=* I w|!ii % +command! -nargs=* O w|!io % + + + +" ABREVIATIONS: {{{1 + +ab J) Ïåñ + + +" SETTINGS: {{{1 +"taken or modified from gentoo +set wildignore+=.info,.aux,.log,.dvi,.bbl,.out,.o,.lo "ignore some files for filename completion +" Terminal fixes +" todo: make this work like == screen* +if &term ==? "xterm" || &term ==? "screen" || &term == "xterm-color" || &term == "screen-bce" + set t_Sb=^[4%dm + set t_Sf=^[3%dm + set ttymouse=xterm2 + set term=xterm-color + set t_Co=256 "terminal colors +endif +set virtualedit=block "Allow visual block to move in empty space. +set showbreak=\ "show a single character on wrapped lines, uses the non-text highlight. + + +set ttimeoutlen=10 " 10 milliseconds for esc timeout +set nocompatible +" end of gentoo stuff + +" Allow split windows to shrink to this size +set winminheight=0 + +" show partial wrapped lines at the bottom +set display=lastline + +" show menu for completion +set wildmenu + +" was auto, but this caused new files created when writting which messes up +" my aufs +set bkc=yes + +" we can see what mode we are in from the cursor. +set nomodeline + +" +if v:version >= 701 + set diffopt=filler,context:1,vertical,foldcolumn:1 +endif + +" grep will sometimes skip displaying the file name if you +" search in a singe file. Set grep to always generate a file-name. +set grepprg=grep\ -nH\ $* +set report=0 " Show a 'N lines were changed' report always +set shiftround " < and > will hit indent levels instead of +-4 always +" note: for some reason, windows gvim didn't like ~/tmp to be windows +" directory link to ../m/tmp. I used a different dir. +set backupdir=~/.editor-backups " keep backup files in one directory. +set mouse=a " Enable the mouse in all terminals if possible +set laststatus=2 +set statusline=\|%n\|\ \ %f%M%R%h%W:%l\ \ \|%v»\ %P\|%<\ \ %{getcwd()} +set modeline " use modelines when root. security be damned. +set listchars=tab:._ "show tabs. +set foldignore= " don't ignore # when using foldmethod=indent + +filetype plugin on +filetype indent on +set autoindent +syntax enable +set hlsearch +"Tab settings, for reference. +"set shiftwidth=2 +"set noexpandtab +"set softtabstop=2 +"set tabstop=2 +"End tab settings. +set number +"viminfo settings +" the viminfo file deletes symlinks, so i moved it to tmp/ +set vi='100,<1000,s10,h,n~/.viminfo +set foldlevel=99 +set ic "set ignorecase +set scs "set smartcase +" allow backspacing over everything in insert mode +set backspace=indent,eol,start +set backup " keep a backup file +set history=1000 " keep 1000 lines of command line history +set showcmd " display incomplete commands +set incsearch " do incremental searching +colorscheme nightsky +set foldmethod=indent + +" Just need to define it. Picked single char 'y' cuz its the smallest +let c_no_comment_fold = 1 +let c_space_errors = 1 +"for folding C preprocessor if, from my syntax addition. +"the problem is that sometime +" let cpre + +"for easy x11 cutting and pasting, but it gets in the way. +"note: exclude must be the last option. +"set clipboard=autoselect,unnamed,exclude:cons\|linux + + +" for syntax highlighting +let is_bash = 1 + + + +if $OS ==# 'Windows_NT' + set directory=p:\tmp,. +endif + +" AUTOCOMMANDS: {{{1 + +if !exists("autocommands_loaded") + let autocommands_loaded = 1 + + + + + " au BufNewFile,BufRead /usr/src/linux*/** set patchmode=.orig +if v:version >= 701 + au BufReadPre * set numberwidth=3 +endif + "au BufEnter * syntax sync fromstart + " + "my attempt to have foldlevel=0 but still show the cursor. gives errors + "when opening help files, so avoid that. + au BufWinEnter * if &ft != 'help' | exe "normal zv" | endif + + " for highlighting c preprocessor conditionals + au BufNewFile,BufRead syn match prePConditional "^\s*#\s*\(ifndef\|else\|endif\|ifdef\)" + au BufNewFile,BufRead hi link prePConditional WarningMSG + " alternate version which highlights only certain things inside the main match + "syn match prePSub contained "[^# ]*\>" + "syn match prePConditional contains=prePSub "^\s*#\s*\(ifndef\|else\|endif\|ifdef\)" + "hi link prePSub DiffText + + " make shell scripts executable. todo: Make this into an ex command. + " au BufWritePost *.sh !/bin/bash -c 'if [ -x % ]; then exit; else /bin/chmod +x %; fi' + + " When editing a file, always jump to the last cursor position + " this is in the reference manual. + autocmd BufReadPost * + \ if ! exists("g:leave_my_cursor_position_alone") | + \ if line("'\"") > 0 && line ("'\"") <= line("$") | + \ exe "normal g'\"" | + \ endif | + \ endif +endif + +autocmd FuncUndefined * exe 'runtime autoload/' . expand('') . '.vim' +nnoremap :call SyntaxAttr() + +" HEX EDITING FUNCTION: {{{1 + +if has("autocmd") + " vim -b : edit binary using xxd-format! + + augroup Binary + au! + au BufReadPre *.bin,*.hex setlocal binary + au BufReadPost * + \ if &binary | exe "Hexmode" | endif + au BufWritePre * + \ if exists("b:editHex") && b:editHex && &binary | + \ exe "%!xxd -r" | + \ endif + au BufWritePost * + \ if exists("b:editHex") && b:editHex && &binary | + \ exe "%!xxd" | + \ exe "set nomod" | + \ endif + augroup END +endif + +command Hexmode call ToggleHex() +function ToggleHex() + " hex mode should be considered a read-only operation + " save values for modified and read-only for restoration later, + " and clear the read-only flag for now + let l:modified=&mod + let l:oldreadonly=&readonly + let &readonly=0 + if !exists("b:editHex") || !b:editHex + " save old options + let b:oldft=&ft + let b:oldbin=&bin + " set new options + setlocal binary " make sure it overrides any textwidth, etc. + let &ft="xxd" + " set status + let b:editHex=1 + " switch to hex editor + %!xxd + else + " restore old options + let &ft=b:oldft + if !b:oldbin + setlocal nobinary + endif + " set status + let b:editHex=0 + " return to normal editing + %!xxd -r + endif + " restore values for modified and read only state + let &mod=l:modified + let &readonly=l:oldreadonly +endfunction + +" Copy matches function {{{1 +" Copy matches of the last search to a register (default is the clipboard). +" Accepts a range (default is the current line). +" Matches are appended to the register and each match is terminated by \n. +" Usage: [RANGE]CopyMatches [REGISTER] +command! -nargs=0 -range -register CopyMatches call s:CopyMatches(, , "") +function! s:CopyMatches(line1, line2, reg) + let reg = a:reg != '' ? a:reg : '+' + for line in range(a:line1, a:line2) + let txt = getline(line) + let idx = match(txt, @/) + while idx > -1 + exec "let @".reg." .= matchstr(txt, @/, idx) . \"\n\"" + let end = matchend(txt, @/, idx) + let idx = match(txt, @/, end) + endwhile + endfor +endfunction + +" Miscelany {{{1 + + " trailing whitespace warning + set statusline+=\ \ %{StatuslineTrailingSpaceWarning()} + "recalculate the trailing whitespace warning when idle, and after saving + autocmd cursorhold,bufwritepost * unlet! b:statusline_trailing_space_warning + "return '[\s]' if trailing white space is detected + "return '' otherwise + function! StatuslineTrailingSpaceWarning() + if !exists("b:statusline_trailing_space_warning") + if search('\s\+$', 'nw') != 0 + let b:statusline_trailing_space_warning = '[\s]' + else + let b:statusline_trailing_space_warning = '' + endif + endif + return b:statusline_trailing_space_warning + endfunction diff --git a/.xbindkeysrc.scm b/.xbindkeysrc.scm new file mode 100644 index 0000000..95f2b98 --- /dev/null +++ b/.xbindkeysrc.scm @@ -0,0 +1,80 @@ + +;; left scroll = left/right, including alt/meta modifiers +(xbindkey '(b:11) "echo KeyStrPress Left KeyStrRelease Left | xmacroplay -d 1 :0") +(xbindkey '(b:10) "echo KeyStrPress Right KeyStrRelease Right | xmacroplay -d 1 :0") +(xbindkey '(control b:11) "echo KeyStrPress Left KeyStrRelease Left | xmacroplay -d 1 :0") +(xbindkey '(control b:10) "echo KeyStrPress Right KeyStrRelease Right | xmacroplay -d 1 :0") +(xbindkey '(control alt b:11) "echo KeyStrPress Left KeyStrRelease Left | xmacroplay -d 1 :0") +(xbindkey '(control alt b:10) "echo KeyStrPress Right KeyStrRelease Right | xmacroplay -d 1 :0") +(xbindkey '(alt b:11) "echo KeyStrPress Left KeyStrRelease Left | xmacroplay -d 1 :0") +(xbindkey '(alt b:10) "echo KeyStrPress Right KeyStrRelease Right | xmacroplay -d 1 :0") + + +;; i chose delay of 1 without really testing, and delay of 2 because +;; that is what worked with xdotool + +;; right mouse = up / down +(xbindkey '(b:13) "echo KeyStrPress Up KeyStrRelease Up | xmacroplay -d 1 :0") +(xbindkey '(b:14) "echo KeyStrPress Down KeyStrRelease Down | xmacroplay -d 1 :0") +;; ctrl+alt = scroll +(xbindkey '(control alt b:13) "echo KeyStrRelease Control_R KeyStrRelease Alt_L ButtonPress 4 ButtonRelease 4 KeyStrPress Control_R KeyStrPress Alt_L | xmacroplay -d 2 :0") +(xbindkey '(control alt b:14) "echo KeyStrRelease Control_R KeyStrRelease Alt_L ButtonPress 5 ButtonRelease 5 KeyStrPress Control_R KeyStrPress Alt_L | xmacroplay -d 2 :0") +;; ctrl = ctrl + up/down +(xbindkey '(control b:13) "echo KeyStrPress Up KeyStrRelease Up | xmacroplay -d 1 :0") +(xbindkey '(control b:14) "echo KeyStrPress Down KeyStrRelease Down | xmacroplay -d 1 :0") +;; alt = alt+scroll +(xbindkey '(alt b:13) "echo ButtonPress 4 ButtonRelease 4 | xmacroplay -d 1 :0") +(xbindkey '(alt b:14) "echo ButtonPress 5 ButtonRelease 5 | xmacroplay -d 1 :0") + + + + +;; disabled because xdotool is laggy on debian. worked on fedora. just using xmacro instead for now. +;; ;; right mouse = up / down +;; (xbindkey '(b:13) "xdotool key --delay 2 Up") +;; (xbindkey '(b:14) "xdotool key --delay 2 Down") +;; ;; ctrl+alt = scroll +;; (xbindkey '(control alt b:13) "xdotool click --clearmodifiers --delay 1 4") +;; (xbindkey '(control alt b:14) "xdotool click --clearmodifiers --delay 1 5") +;; ;; ctrl = ctrl+scroll +;; (xbindkey '(control b:13) "xdotool click --delay 2 4") +;; (xbindkey '(control b:14) "xdotool click --delay 2 5") +;; ;; alt = alt+scroll +;; (xbindkey '(alt b:13) "xdotool click --delay 2 4") +;; (xbindkey '(alt b:14) "xdotool click --delay 2 5") + + +;; ;; left scroll = left/right, including alt/meta modifiers +;; (xbindkey '(b:11) "xdotool key --delay 2 Left") +;; (xbindkey '(b:10) "xdotool key --delay 2 Right") +;; (xbindkey '(control b:11) "xdotool key --delay 2 Left") +;; (xbindkey '(control b:10) "xdotool key --delay 2 Right") +;; (xbindkey '(control alt b:11) "xdotool key --delay 2 Left") +;; (xbindkey '(control alt b:10) "xdotool key --delay 2 Right") +;; (xbindkey '(alt b:11) "xdotool key --delay 2 Left") +;; (xbindkey '(alt b:10) "xdotool key --delay 2 Right") + +;; default delay is 12, i change to 5 or else some faster scrolls do not register + + +;;started to define these, then figured there were so many of them, +;;and the only point was so that some default scroll keybind would work, +;;but I don't actually know of any, so disabled this +;; (xbindkey '(shift b:13) "xdotool click --delay 2 4") +;; (xbindkey '(shift b:14) "xdotool click --delay 2 5") +;; (xbindkey '(Mod4 b:13) "xdotool click --delay 2 4") +;; (xbindkey '(Mod4 b:14) "xdotool click --delay 2 5") +;; (xbindkey '(alt shift b:13) "xdotool click --delay 2 4") +;; (xbindkey '(alt shift b:14) "xdotool click --delay 2 5") +;; (xbindkey '(control shift b:13) "xdotool click --delay 2 4") +;; (xbindkey '(control shift b:14) "xdotool click --delay 2 5") +;; (xbindkey '(Mod4 shift b:13) "xdotool click --delay 2 4") +;; (xbindkey '(Mod4 shift b:14) "xdotool click --delay 2 5") +;; (xbindkey '(alt Mod4 b:13) "xdotool click --delay 2 4") +;; (xbindkey '(alt Mod4 b:14) "xdotool click --delay 2 5") +;; (xbindkey '(control Mod4 b:13) "xdotool click --delay 2 4") +;; (xbindkey '(control Mod4 b:14) "xdotool click --delay 2 5") +;; (xbindkey '(control alt shift b:13) "xdotool click --delay 2 4") +;; (xbindkey '(control alt shift b:14) "xdotool click --delay 2 5") +;; (xbindkey '(alt shift b:13) "xdotool click --delay 2 4") +;; (xbindkey '(alt shift b:14) "xdotool click --delay 2 5") diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..d645695 --- /dev/null +++ b/LICENSE @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/README b/README new file mode 100644 index 0000000..e842202 --- /dev/null +++ b/README @@ -0,0 +1,4 @@ +Misc config files that don't have their own repos. There is probably +some poorly documented, and some outdated, but also some stuff someone +could find useful. Some other config stuff has their own repos at +https://iankelling.org/git diff --git a/filesystem/etc/apt/apt.conf.d/02proxy b/filesystem/etc/apt/apt.conf.d/02proxy new file mode 100644 index 0000000..4b2e39e --- /dev/null +++ b/filesystem/etc/apt/apt.conf.d/02proxy @@ -0,0 +1,5 @@ +# after discovering apt would fail if the proxy was down. +# This overrides the hardcoded proxy setting done by fai. +# Figured I'd leave it as post install so I could adjust the +# detect script easier. +Acquire::http::Proxy-Auto-Detect "/etc/apt/detect-http-proxy"; diff --git a/filesystem/etc/apt/detect-http-proxy b/filesystem/etc/apt/detect-http-proxy new file mode 100755 index 0000000..7a97b95 --- /dev/null +++ b/filesystem/etc/apt/detect-http-proxy @@ -0,0 +1,19 @@ +#!/bin/bash +# based on +# http://askubuntu.com/questions/53443/how-do-i-ignore-a-proxy-if-not-available +# altered because testing a down proxy takes like 2 seconds, +# and we would do it like 100 times in a row. so cache a failed result +# locally for 1 hour. Also, using newer option based on man apt.conf. +proxy_host=faiserver +proxy_port=3142 +proxy_url=http://$proxy_host:$proxy_port +f=/tmp/apt_proxy_fail +if [[ ! -r $f ]] \ + || (( $(( $(date +%s) - $(stat -c %Y $f ) )) > 60*60 )); then + if host $proxy_host && nc -z $proxy_host $proxy_port; then + echo $proxy_url + else + touch $f + fi +fi +echo DIRECT diff --git a/filesystem/etc/logrotate.d/mylogs b/filesystem/etc/logrotate.d/mylogs new file mode 100644 index 0000000..b41feb8 --- /dev/null +++ b/filesystem/etc/logrotate.d/mylogs @@ -0,0 +1,8 @@ +/var/log/debian-auto-update.log { + size 10M + rotate 10 + compress + notifempty + sharedscripts + delaycompress +} diff --git a/filesystem/etc/synergy.conf b/filesystem/etc/synergy.conf new file mode 100644 index 0000000..8abb8de --- /dev/null +++ b/filesystem/etc/synergy.conf @@ -0,0 +1,16 @@ + +section: screens + treetowl: + frodo: + tp: +end + +section: links + tp: + right = frodo + treetowl: + left = frodo + frodo: + left = tp + right = treetowl +end diff --git a/filesystem/etc/updatedb.findutils.cron.local b/filesystem/etc/updatedb.findutils.cron.local new file mode 100644 index 0000000..176ab1e --- /dev/null +++ b/filesystem/etc/updatedb.findutils.cron.local @@ -0,0 +1,4 @@ +# noticed find slowing down my system, +# pstree lead back to /etc/cron.daily/locate, which +# says to consult /usr/share/doc/locate/README.Debian +PRUNEPATHS="$PRUNEPATHS /mnt" diff --git a/machine_specific/frodo/subdir_files/.mozilla/firefox/profiles.ini b/machine_specific/frodo/subdir_files/.mozilla/firefox/profiles.ini new file mode 100644 index 0000000..0661ce0 --- /dev/null +++ b/machine_specific/frodo/subdir_files/.mozilla/firefox/profiles.ini @@ -0,0 +1,8 @@ +[General] +StartWithLastProfile=1 + +[Profile0] +Name=default +IsRelative=1 +Path=frodo.default +Default=1 diff --git a/machine_specific/treetowl/filesystem/etc/btrbk.conf b/machine_specific/treetowl/filesystem/etc/btrbk.conf new file mode 100644 index 0000000..95093f8 --- /dev/null +++ b/machine_specific/treetowl/filesystem/etc/btrbk.conf @@ -0,0 +1,20 @@ +# note, I'm not using btrbk because of this bug +# https://github.com/digint/btrbk/issues/102 + +ssh_identity /root/.ssh/id_rsa +transaction_log /var/log/btrbk + +target_preserve_daily 10 +target_preserve_weekly 4 +target_preserve_monthly all + +# default is to do local snapshots, turn that off +snapshot_preserve_daily 0 +snapshot_preserve_weekly 0 +snapshot_preserve_monthly 0 + +# if something fails and it's not obvious, try doing +btrbk -l debug dryrun +volume /mnt/btrfs_root +subvolume i +target send-receive ssh://frodo/mnt/btrfs_root diff --git a/machine_specific/treetowl/filesystem/etc/cron.d/treetowl b/machine_specific/treetowl/filesystem/etc/cron.d/treetowl new file mode 100755 index 0000000..fabb24c --- /dev/null +++ b/machine_specific/treetowl/filesystem/etc/cron.d/treetowl @@ -0,0 +1,10 @@ +# runs every 10 minutes, every day 4 am, every sunday at 3 am +# stored for 3 days, 2 months, and unlimited respectively +#0 4 * * * x=$(/a/bin/small-backup --retry daily 2M 2>&1); [[ $? != 0 ]] && echo "$x" +#0 3 * * sun echo weekly backup results:; /a/bin/small-backup --retry weekly +#*/5 * * * * /a/bin/offlineimap_cronjob +#*/1 * * * * . /a/bin/log-quiet/log-once-function; unison ~/.mpv ssh://htpc/.mpv -batch -prefer ~/.mpv -silent 2>&1 | log-once unison-mpv +*/5 * * * * . /a/bin/dynamic-ip-update.sh +MAILTO="" +*/10 * * * * /a/bin/small-backup 10minutes 3D +*/10 * * * * /home/ian/.ssh/* /root/.ssh diff --git a/machine_specific/treetowl/subdir_files/.mozilla/firefox/profiles.ini b/machine_specific/treetowl/subdir_files/.mozilla/firefox/profiles.ini new file mode 100644 index 0000000..f47847d --- /dev/null +++ b/machine_specific/treetowl/subdir_files/.mozilla/firefox/profiles.ini @@ -0,0 +1,13 @@ +[General] +StartWithLastProfile=1 + +[Profile0] +Name=default +IsRelative=1 +Path=treetowl.default +Default=1 + +[Profile1] +Name=empty +IsRelative=1 +Path=empty.default diff --git a/machine_specific/x2/.Xmodmap b/machine_specific/x2/.Xmodmap new file mode 100644 index 0000000..649063d --- /dev/null +++ b/machine_specific/x2/.Xmodmap @@ -0,0 +1,21 @@ +!keycode 94 = underscore F10 +! on x200: +! 108 = alt_r +! 105 = control_r +! 37 = control_l +! 64 = alt_l +! 66 = caps lock +! instead of keycode, you can say +! keysym Alt_R = Control_L +! however, this seems confusing, and not idempotent +! although I havent tested for idempontency + +remove Lock = Caps_Lock +remove Control = Control_L +remove Mod1 = Alt_R +remove Control = Control_R +keycode 37 = End +keycode 105 = KP_Enter +keycode 66 = Home +keycode 108 = Control_L +add Control = Control_L diff --git a/subdir_files/.bazaar/authentication.conf b/subdir_files/.bazaar/authentication.conf new file mode 100644 index 0000000..3b8d3cb --- /dev/null +++ b/subdir_files/.bazaar/authentication.conf @@ -0,0 +1,4 @@ +[Launchpad] +host = .launchpad.net +scheme = ssh +user = iank diff --git a/subdir_files/.bazaar/bazaar.conf b/subdir_files/.bazaar/bazaar.conf new file mode 100644 index 0000000..1ca33b4 --- /dev/null +++ b/subdir_files/.bazaar/bazaar.conf @@ -0,0 +1,2 @@ +[DEFAULT] +launchpad_username = iank diff --git a/subdir_files/.config/beets/config.yaml b/subdir_files/.config/beets/config.yaml new file mode 100644 index 0000000..3452831 --- /dev/null +++ b/subdir_files/.config/beets/config.yaml @@ -0,0 +1,20 @@ +library: /a/bin/data/musiclibrary.blb +directory: /i/music +import: + log: /a/dt/beetlog.log + move: yes + quiet_fallback: skip + +# be a little more liberal for strong matches +match: + strong_rec_thresh: 0.07 +plugins: discogs duplicates web info +# all the usefull plugins I've used: +#plugins: copyartifacts chroma discogs duplicates web + +#duplicates: +# duplicates can be found based on tagged keys or a checksum program. +# the sugggested checksum program takes hours :( +# the default is tags, but it is broken. +# the default ffmpeg command, using the libav equivalent based on debian recommendations + #checksum: avconv -i {file} -f crc - diff --git a/subdir_files/.config/mpv/mpv.conf b/subdir_files/.config/mpv/mpv.conf new file mode 100644 index 0000000..fe2cd56 --- /dev/null +++ b/subdir_files/.config/mpv/mpv.conf @@ -0,0 +1 @@ +loop=inf diff --git a/subdir_files/.config/sakura/sakura.conf b/subdir_files/.config/sakura/sakura.conf new file mode 100644 index 0000000..86589e2 --- /dev/null +++ b/subdir_files/.config/sakura/sakura.conf @@ -0,0 +1,75 @@ +[sakura] +colorset1_fore=#c0c0c0 +colorset1_back=#212527 +colorset1_opacity=99 +colorset1_key=F1 +colorset2_fore=#c0c0c0 +colorset2_back=#000000 +colorset2_opacity=99 +colorset2_key=F2 +colorset3_fore=#c0c0c0 +colorset3_back=#000000 +colorset3_opacity=99 +colorset3_key=F3 +colorset4_fore=#c0c0c0 +colorset4_back=#000000 +colorset4_opacity=99 +colorset4_key=F4 +colorset5_fore=#c0c0c0 +colorset5_back=#000000 +colorset5_opacity=99 +colorset5_key=F5 +colorset6_fore=#c0c0c0 +colorset6_back=#000000 +colorset6_opacity=99 +colorset6_key=F6 +background=none +font=Ubuntu Mono,monospace 13 +show_always_first_tab=No +scrollbar=true +resize_grip=true +closebutton=true +tabs_on_bottom=false +less_questions=false +audible_bell=No +visible_bell=No +blinking_cursor=No +cursor_type=VTE_CURSOR_SHAPE_BLOCK +word_chars=-A-Za-z0-9,./?%&#_~ +palette=solarized_dark +add_tab_accelerator=5 +del_tab_accelerator=5 +switch_tab_accelerator=8 +move_tab_accelerator=5 +copy_accelerator=5 +scrollbar_accelerator=5 +open_url_accelerator=5 +font_size_accelerator=4 +set_tab_name_accelerator=5 +add_tab_key=T +del_tab_key=W +prev_tab_key=Left +next_tab_key=Right +copy_key=C +paste_key=V +scrollbar_key=S +set_tab_name_key=N +fullscreen_key=F11 +set_colorset_accelerator=5 +icon_file=terminal-tango.svg +forecolor=#c0c0c0 +backcolor=#000000 +opacity_level=99 +last_colorset=1 +colorset1_curs=rgb(255,255,255) +colorset2_curs=rgb(255,255,255) +colorset3_curs=rgb(255,255,255) +colorset4_curs=rgb(255,255,255) +colorset5_curs=rgb(255,255,255) +colorset6_curs=rgb(255,255,255) +urgent_bell=Yes +allow_bold=Yes +disable_numbered_tabswitch=false +scroll_lines=10000000 +increase_font_size_key=plus +decrease_font_size_key=minus diff --git a/subdir_files/.gnupg/gpg.conf b/subdir_files/.gnupg/gpg.conf new file mode 100644 index 0000000..4a977eb --- /dev/null +++ b/subdir_files/.gnupg/gpg.conf @@ -0,0 +1,12 @@ +# Note: initial files in this directory were created by running +# gpg -k + +# for aur, automatically dl & add gpg keys. +keyserver-options auto-key-retrieve +# start gpg agent on login +use-agent + +# standard short key ids are easy to collide +# https://security.stackexchange.com/questions/84280/short-openpgp-key-ids-are-insecure-how-to-configure-gnupg-to-use-long-key-ids-i +# https://evil32.com/ +keyid-format 0xlong diff --git a/subdir_files/.xmonad/xmonad.hs b/subdir_files/.xmonad/xmonad.hs new file mode 100644 index 0000000..b9c9e64 --- /dev/null +++ b/subdir_files/.xmonad/xmonad.hs @@ -0,0 +1,231 @@ +import XMonad +--import XMonad.Config.Gnome + +import Data.Monoid +import System.Exit + +-- to get mouse move with window +import XMonad.Actions.UpdatePointer + +-- needed for the panel toggle keybind +import XMonad.Hooks.ManageDocks + +-- not sure if this is redundant with Xfce import +import XMonad.Config.Desktop + +-- based on http://www.haskell.org/haskellwiki/Xmonad/Using_xmonad_in_XFCE +import XMonad.Hooks.EwmhDesktops +import XMonad.Config.Xfce +import XMonad.Hooks.ManageDocks + +import qualified XMonad.StackSet as W +import qualified Data.Map as M + +import XMonad.Actions.CycleWindows -- Reset the layouts on the current workspace to default + +import XMonad.Hooks.SetWMName + + +-- /usr/share/xmonad/xmonad.hs on fedora has integration with gnome etc. but I +-- had lots of problems with gnome integration. + +main = xmonad $ defaults + + +defaults = desktopConfig + { + terminal = "sakura" + , borderWidth = 0 + , modMask = mod4Mask + , keys = myKeys + --, logHook = myLogHook <+> logHook desktopConfig + , mouseBindings = myMouseBindings + + + -- manageDocks & ewmh stuff is based on xfce integration wiki page + , manageHook = manageDocks <+> myManageHook <+> manageHook defaultConfig + , logHook = ewmhDesktopsLogHook +-- todo, look into the suggested avoidStruts. my nieve attempt to integrate it failed + , layoutHook = myLayout + , handleEventHook = ewmhDesktopsEventHook +-- this makes some java programs work, like intellij idea, +-- but it also makes the ui buggy for some gtk apps, like transmission +-- and gnome-terminal +-- https://bbs.archlinux.org/viewtopic.php?pid=744577 + , startupHook = setWMName "LG3D" + -- combining the 2 with <+> didn't make java apps work. + --, startupHook = ewmhDesktopsStartup + +} + + +-- for android emulator buggy window +myManageHook = composeAll [ className =? "emulator64-arm" --> unfloat] + where unfloat = ask >>= doF . W.sink + +-- this is a nice idea but needs some tweaking cuz i don't want it to +-- have an affect when switching to a floating window, +-- and I remember sometimes being stuck in floating dialog boxes +-- myLogHook = updatePointer (Relative 0.5 0.5) + + + +myKeys conf@(XConfig {XMonad.modMask = modm}) = M.fromList $ + + +-- Move focus to the previous window +-- , ((modm, xK_q ), windows W.focusUp ) + + + [ ((modm, xK_q), io (exitWith ExitSuccess)) -- %! Quit xmonad + + , ((modm, xK_2), spawn "pavucontrol") + , ((modm, xK_3), spawn "firefox") + + , ((modm, xK_4), spawn "input-setup.sh") + + -- we would really want to keep track of which workspace is darkened, + -- and change things depending on where that workspace is + + -- fedora vs debian ordering +-- , ((modm, xK_w), spawn "redshift.sh 0") +-- , ((modm, xK_e), spawn "redshift.sh 2") +-- , ((modm, xK_r), spawn "redshift.sh 1") + , ((modm, xK_w), spawn "/a/bin/redshift.sh 2") + , ((modm, xK_e), spawn "/a/bin/redshift.sh 1") + , ((modm, xK_r), spawn "/a/bin/redshift.sh 0") + + -- Rotate through the available layout algorithms + , ((modm, xK_t ), sendMessage NextLayout) + + , ((modm , xK_Home ), sendMessage ToggleStruts) + +-- disabled default of cycling windows. instead use traditional stack based alt-tab behavior + , ((modm, xK_g ), cycleRecentWindows [xK_Super_L,xK_Super_R] xK_g xK_Tab) + + -- close focused window + , ((modm , xK_c ), kill) + + + -- Reset the layouts on the current workspace to default + , ((modm, xK_b ), setLayout $ XMonad.layoutHook conf) + + +-- todo, this is broken. not sure what it is supposed to do + , ((modm, xK_Tab ), cycleRecentWindows [xK_Super_L] xK_g xK_Tab) + + + -- todo, make the pointer follow the window for these + + -- fedora's order +-- , ((modm , xK_Delete), screenWorkspace 0 >>= flip whenJust (windows . W.shift)) +-- , ((modm , xK_parenleft), screenWorkspace 2 >>= flip whenJust (windows . W.shift)) +-- , ((modm , xK_parenright), screenWorkspace 1 >>= flip whenJust (windows . W.shift)) +-- debian's order + , ((modm , xK_Delete), screenWorkspace 2 >>= flip whenJust (windows . W.shift)) + , ((modm , xK_parenleft), screenWorkspace 1 >>= flip whenJust (windows . W.shift)) + , ((modm , xK_parenright), screenWorkspace 0 >>= flip whenJust (windows . W.shift)) + + -- Move focus to the next window + , ((0, xK_F8 ), windows W.focusDown) + + , ((modm , xK_6), windows $ W.greedyView "6") + +-- Swap the focused window with the next window + , ((modm, xK_asterisk ), windows W.swapDown ) + + -- Swap the focused window with the previous window + , ((modm, xK_9 ), windows W.swapUp ) + + +-- fedora's order +-- , ((modm , xK_u), screenWorkspace 0 >>= flip whenJust (windows . W.view)) +-- , ((modm , xK_i), screenWorkspace 2 >>= flip whenJust (windows . W.view)) +-- , ((modm , xK_o), screenWorkspace 1 >>= flip whenJust (windows . W.view)) +-- debian's order + , ((modm , xK_u), screenWorkspace 2 >>= flip whenJust (windows . W.view)) + , ((modm , xK_i), screenWorkspace 1 >>= flip whenJust (windows . W.view)) + , ((modm , xK_o), screenWorkspace 0 >>= flip whenJust (windows . W.view)) + + + -- Restart xmonad + , ((modm , xK_p), spawn "xmonad --recompile; xmonad --restart") + -- Push window back into tiling + , ((modm, xK_h ), withFocused $ windows . W.sink) + + -- this working is dependent upon env vars set in distro-start + , ((modm, xK_j ), spawn "emacsclient -c") + + + -- launch a terminal + , ((modm, xK_k), spawn $ XMonad.terminal conf) + + + , ((modm, xK_l), spawn "dmenu_run") + + -- Expand the master area + , ((modm, xK_n ), sendMessage Expand) + + -- Shrink the master area + , ((modm, xK_m ), sendMessage Shrink) + + -- Move focus to the master window + , ((modm, xK_y ), windows W.focusMaster ) + + + + -- Increment the number of windows in the master area + , ((modm , xK_comma ), sendMessage (IncMasterN 1)) + + -- Deincrement the number of windows in the master area + , ((modm , xK_period), sendMessage (IncMasterN (-1))) + + -- Swap the focused window and the master window + --, ((modm, xK_Return), windows W.swapMaster) +-- in recent versions, a different name works better + , ((modm, xK_Return), windows W.shiftMaster) + + ] + ++ + + + + -- open workspace, and send to workspace with same key plus control + [((m .|. modm, k), windows $ f i) + | (i, k) <- zip (XMonad.workspaces conf) [xK_f, xK_d, xK_s, xK_a, xK_z, xK_grave, xK_7, xK_0] + , (f, m) <- [(W.greedyView, 0), (W.shift, shiftMask)]] +-- fedora's default ordering of workspaces + -- xK_s, xK_f, xK_d, + + + + +myMouseBindings (XConfig {XMonad.modMask = modm}) = M.fromList $ + + -- mod-button1, Set the window to floating mode and move by dragging + [ ((modm, button1), (\w -> focus w >> mouseMoveWindow w + >> windows W.shiftMaster)) + + -- mod-button2, Raise the window to the top of the stack + , ((modm, button2), (\w -> focus w >> windows W.shiftMaster)) + + -- mod-button3, Set the window to floating mode and resize by dragging + , ((modm, button3), (\w -> focus w >> mouseResizeWindow w + >> windows W.shiftMaster)) + + -- you may also bind events to the mouse scroll wheel (button4 and button5) + ] + +myLayout = desktopLayoutModifiers $ Full ||| Mirror tiled ||| tiled + where + -- default tiling algorithm partitions the screen into two panes + tiled = Tall nmaster delta ratio + + -- The default number of windows in the master pane + nmaster = 1 + + -- Default proportion of screen occupied by master pane + ratio = 1/2 + + -- Percent of screen to increment by when resizing panes + delta = 3/100