From e92461b88e8b15f435afc940b6293f4cda43596b Mon Sep 17 00:00:00 2001 From: Anton Bobov Date: Thu, 14 Nov 2013 11:28:27 +0600 Subject: Remove unused vim plugins. --- files/.vim/autoload/csapprox.vim | 810 ------------------- files/.vim/autoload/pythoncomplete.vim | 606 -------------- files/.vim/doc/CSApprox.txt | 599 -------------- files/.vim/doc/imaps.txt | 116 --- files/.vim/doc/imaps.txt.gz | Bin 1995 -> 0 bytes files/.vim/doc/matchit.txt | 406 ---------- files/.vim/doc/project.txt | 710 ---------------- files/.vim/ftplugin/html_snip_helper.vim | 10 - files/.vim/ftplugin/python.vim | 4 - files/.vim/ftplugin/worklist.vim | 5 - files/.vim/indent/python.vim | 196 ----- files/.vim/indent/tex.vim | 139 ---- files/.vim/plugin/CSApprox.vim | 987 ----------------------- files/.vim/plugin/SyntaxFolds.vim | 323 -------- files/.vim/plugin/XMLFolding.vim | 105 --- files/.vim/plugin/filebrowser.vim | 251 ------ files/.vim/plugin/imaps.vim | 831 ------------------- files/.vim/plugin/libList.vim | 249 ------ files/.vim/plugin/matchit.vim | 812 ------------------- files/.vim/plugin/project.vim | 1293 ------------------------------ files/.vim/plugin/remoteOpen.vim | 163 ---- files/.vim/syntax/python.vim | 13 - files/.vim/syntax/worklist.vim | 19 - 23 files changed, 8647 deletions(-) delete mode 100644 files/.vim/autoload/csapprox.vim delete mode 100644 files/.vim/autoload/pythoncomplete.vim delete mode 100644 files/.vim/doc/CSApprox.txt delete mode 100644 files/.vim/doc/imaps.txt delete mode 100644 files/.vim/doc/imaps.txt.gz delete mode 100644 files/.vim/doc/matchit.txt delete mode 100644 files/.vim/doc/project.txt delete mode 100644 files/.vim/ftplugin/html_snip_helper.vim delete mode 100644 files/.vim/ftplugin/python.vim delete mode 100644 files/.vim/ftplugin/worklist.vim delete mode 100644 files/.vim/indent/python.vim delete mode 100644 files/.vim/indent/tex.vim delete mode 100644 files/.vim/plugin/CSApprox.vim delete mode 100644 files/.vim/plugin/SyntaxFolds.vim delete mode 100755 files/.vim/plugin/XMLFolding.vim delete mode 100644 files/.vim/plugin/filebrowser.vim delete mode 100644 files/.vim/plugin/imaps.vim delete mode 100644 files/.vim/plugin/libList.vim delete mode 100644 files/.vim/plugin/matchit.vim delete mode 100644 files/.vim/plugin/project.vim delete mode 100644 files/.vim/plugin/remoteOpen.vim delete mode 100644 files/.vim/syntax/python.vim delete mode 100644 files/.vim/syntax/worklist.vim (limited to 'files/.vim') diff --git a/files/.vim/autoload/csapprox.vim b/files/.vim/autoload/csapprox.vim deleted file mode 100644 index baf1887..0000000 --- a/files/.vim/autoload/csapprox.vim +++ /dev/null @@ -1,810 +0,0 @@ -let s:rgb = {} - -let s:rgb["alice blue"] = "#f0f8ff" -let s:rgb["aliceblue"] = "#f0f8ff" -let s:rgb["antique white"] = "#faebd7" -let s:rgb["antiquewhite"] = "#faebd7" -let s:rgb["antiquewhite1"] = "#ffefdb" -let s:rgb["antiquewhite2"] = "#eedfcc" -let s:rgb["antiquewhite3"] = "#cdc0b0" -let s:rgb["antiquewhite4"] = "#8b8378" -let s:rgb["aquamarine"] = "#7fffd4" -let s:rgb["aquamarine1"] = "#7fffd4" -let s:rgb["aquamarine2"] = "#76eec6" -let s:rgb["aquamarine3"] = "#66cdaa" -let s:rgb["aquamarine4"] = "#458b74" -let s:rgb["azure"] = "#f0ffff" -let s:rgb["azure1"] = "#f0ffff" -let s:rgb["azure2"] = "#e0eeee" -let s:rgb["azure3"] = "#c1cdcd" -let s:rgb["azure4"] = "#838b8b" -let s:rgb["beige"] = "#f5f5dc" -let s:rgb["bisque"] = "#ffe4c4" -let s:rgb["bisque1"] = "#ffe4c4" -let s:rgb["bisque2"] = "#eed5b7" -let s:rgb["bisque3"] = "#cdb79e" -let s:rgb["bisque4"] = "#8b7d6b" -let s:rgb["black"] = "#000000" -let s:rgb["blanched almond"] = "#ffebcd" -let s:rgb["blanchedalmond"] = "#ffebcd" -let s:rgb["blue violet"] = "#8a2be2" -let s:rgb["blue"] = "#0000ff" -let s:rgb["blue1"] = "#0000ff" -let s:rgb["blue2"] = "#0000ee" -let s:rgb["blue3"] = "#0000cd" -let s:rgb["blue4"] = "#00008b" -let s:rgb["blueviolet"] = "#8a2be2" -let s:rgb["brown"] = "#a52a2a" -let s:rgb["brown1"] = "#ff4040" -let s:rgb["brown2"] = "#ee3b3b" -let s:rgb["brown3"] = "#cd3333" -let s:rgb["brown4"] = "#8b2323" -let s:rgb["burlywood"] = "#deb887" -let s:rgb["burlywood1"] = "#ffd39b" -let s:rgb["burlywood2"] = "#eec591" -let s:rgb["burlywood3"] = "#cdaa7d" -let s:rgb["burlywood4"] = "#8b7355" -let s:rgb["cadet blue"] = "#5f9ea0" -let s:rgb["cadetblue"] = "#5f9ea0" -let s:rgb["cadetblue1"] = "#98f5ff" -let s:rgb["cadetblue2"] = "#8ee5ee" -let s:rgb["cadetblue3"] = "#7ac5cd" -let s:rgb["cadetblue4"] = "#53868b" -let s:rgb["chartreuse"] = "#7fff00" -let s:rgb["chartreuse1"] = "#7fff00" -let s:rgb["chartreuse2"] = "#76ee00" -let s:rgb["chartreuse3"] = "#66cd00" -let s:rgb["chartreuse4"] = "#458b00" -let s:rgb["chocolate"] = "#d2691e" -let s:rgb["chocolate1"] = "#ff7f24" -let s:rgb["chocolate2"] = "#ee7621" -let s:rgb["chocolate3"] = "#cd661d" -let s:rgb["chocolate4"] = "#8b4513" -let s:rgb["coral"] = "#ff7f50" -let s:rgb["coral1"] = "#ff7256" -let s:rgb["coral2"] = "#ee6a50" -let s:rgb["coral3"] = "#cd5b45" -let s:rgb["coral4"] = "#8b3e2f" -let s:rgb["cornflower blue"] = "#6495ed" -let s:rgb["cornflowerblue"] = "#6495ed" -let s:rgb["cornsilk"] = "#fff8dc" -let s:rgb["cornsilk1"] = "#fff8dc" -let s:rgb["cornsilk2"] = "#eee8cd" -let s:rgb["cornsilk3"] = "#cdc8b1" -let s:rgb["cornsilk4"] = "#8b8878" -let s:rgb["cyan"] = "#00ffff" -let s:rgb["cyan1"] = "#00ffff" -let s:rgb["cyan2"] = "#00eeee" -let s:rgb["cyan3"] = "#00cdcd" -let s:rgb["cyan4"] = "#008b8b" -let s:rgb["dark blue"] = "#00008b" -let s:rgb["dark cyan"] = "#008b8b" -let s:rgb["dark goldenrod"] = "#b8860b" -let s:rgb["dark gray"] = "#a9a9a9" -let s:rgb["dark green"] = "#006400" -let s:rgb["dark grey"] = "#a9a9a9" -let s:rgb["dark khaki"] = "#bdb76b" -let s:rgb["dark magenta"] = "#8b008b" -let s:rgb["dark olive green"] = "#556b2f" -let s:rgb["dark orange"] = "#ff8c00" -let s:rgb["dark orchid"] = "#9932cc" -let s:rgb["dark red"] = "#8b0000" -let s:rgb["dark salmon"] = "#e9967a" -let s:rgb["dark sea green"] = "#8fbc8f" -let s:rgb["dark slate blue"] = "#483d8b" -let s:rgb["dark slate gray"] = "#2f4f4f" -let s:rgb["dark slate grey"] = "#2f4f4f" -let s:rgb["dark turquoise"] = "#00ced1" -let s:rgb["dark violet"] = "#9400d3" -let s:rgb["dark yellow"] = "#bbbb00" -let s:rgb["darkblue"] = "#00008b" -let s:rgb["darkcyan"] = "#008b8b" -let s:rgb["darkgoldenrod"] = "#b8860b" -let s:rgb["darkgoldenrod1"] = "#ffb90f" -let s:rgb["darkgoldenrod2"] = "#eead0e" -let s:rgb["darkgoldenrod3"] = "#cd950c" -let s:rgb["darkgoldenrod4"] = "#8b6508" -let s:rgb["darkgray"] = "#a9a9a9" -let s:rgb["darkgreen"] = "#006400" -let s:rgb["darkgrey"] = "#a9a9a9" -let s:rgb["darkkhaki"] = "#bdb76b" -let s:rgb["darkmagenta"] = "#8b008b" -let s:rgb["darkolivegreen"] = "#556b2f" -let s:rgb["darkolivegreen1"] = "#caff70" -let s:rgb["darkolivegreen2"] = "#bcee68" -let s:rgb["darkolivegreen3"] = "#a2cd5a" -let s:rgb["darkolivegreen4"] = "#6e8b3d" -let s:rgb["darkorange"] = "#ff8c00" -let s:rgb["darkorange1"] = "#ff7f00" -let s:rgb["darkorange2"] = "#ee7600" -let s:rgb["darkorange3"] = "#cd6600" -let s:rgb["darkorange4"] = "#8b4500" -let s:rgb["darkorchid"] = "#9932cc" -let s:rgb["darkorchid1"] = "#bf3eff" -let s:rgb["darkorchid2"] = "#b23aee" -let s:rgb["darkorchid3"] = "#9a32cd" -let s:rgb["darkorchid4"] = "#68228b" -let s:rgb["darkred"] = "#8b0000" -let s:rgb["darksalmon"] = "#e9967a" -let s:rgb["darkseagreen"] = "#8fbc8f" -let s:rgb["darkseagreen1"] = "#c1ffc1" -let s:rgb["darkseagreen2"] = "#b4eeb4" -let s:rgb["darkseagreen3"] = "#9bcd9b" -let s:rgb["darkseagreen4"] = "#698b69" -let s:rgb["darkslateblue"] = "#483d8b" -let s:rgb["darkslategray"] = "#2f4f4f" -let s:rgb["darkslategray1"] = "#97ffff" -let s:rgb["darkslategray2"] = "#8deeee" -let s:rgb["darkslategray3"] = "#79cdcd" -let s:rgb["darkslategray4"] = "#528b8b" -let s:rgb["darkslategrey"] = "#2f4f4f" -let s:rgb["darkturquoise"] = "#00ced1" -let s:rgb["darkviolet"] = "#9400d3" -let s:rgb["darkyellow"] = "#bbbb00" -let s:rgb["deep pink"] = "#ff1493" -let s:rgb["deep sky blue"] = "#00bfff" -let s:rgb["deeppink"] = "#ff1493" -let s:rgb["deeppink1"] = "#ff1493" -let s:rgb["deeppink2"] = "#ee1289" -let s:rgb["deeppink3"] = "#cd1076" -let s:rgb["deeppink4"] = "#8b0a50" -let s:rgb["deepskyblue"] = "#00bfff" -let s:rgb["deepskyblue1"] = "#00bfff" -let s:rgb["deepskyblue2"] = "#00b2ee" -let s:rgb["deepskyblue3"] = "#009acd" -let s:rgb["deepskyblue4"] = "#00688b" -let s:rgb["dim gray"] = "#696969" -let s:rgb["dim grey"] = "#696969" -let s:rgb["dimgray"] = "#696969" -let s:rgb["dimgrey"] = "#696969" -let s:rgb["dodger blue"] = "#1e90ff" -let s:rgb["dodgerblue"] = "#1e90ff" -let s:rgb["dodgerblue1"] = "#1e90ff" -let s:rgb["dodgerblue2"] = "#1c86ee" -let s:rgb["dodgerblue3"] = "#1874cd" -let s:rgb["dodgerblue4"] = "#104e8b" -let s:rgb["firebrick"] = "#b22222" -let s:rgb["firebrick1"] = "#ff3030" -let s:rgb["firebrick2"] = "#ee2c2c" -let s:rgb["firebrick3"] = "#cd2626" -let s:rgb["firebrick4"] = "#8b1a1a" -let s:rgb["floral white"] = "#fffaf0" -let s:rgb["floralwhite"] = "#fffaf0" -let s:rgb["forest green"] = "#228b22" -let s:rgb["forestgreen"] = "#228b22" -let s:rgb["gainsboro"] = "#dcdcdc" -let s:rgb["ghost white"] = "#f8f8ff" -let s:rgb["ghostwhite"] = "#f8f8ff" -let s:rgb["gold"] = "#ffd700" -let s:rgb["gold1"] = "#ffd700" -let s:rgb["gold2"] = "#eec900" -let s:rgb["gold3"] = "#cdad00" -let s:rgb["gold4"] = "#8b7500" -let s:rgb["goldenrod"] = "#daa520" -let s:rgb["goldenrod1"] = "#ffc125" -let s:rgb["goldenrod2"] = "#eeb422" -let s:rgb["goldenrod3"] = "#cd9b1d" -let s:rgb["goldenrod4"] = "#8b6914" -let s:rgb["gray"] = "#bebebe" -let s:rgb["gray0"] = "#000000" -let s:rgb["gray1"] = "#030303" -let s:rgb["gray10"] = "#1a1a1a" -let s:rgb["gray100"] = "#ffffff" -let s:rgb["gray11"] = "#1c1c1c" -let s:rgb["gray12"] = "#1f1f1f" -let s:rgb["gray13"] = "#212121" -let s:rgb["gray14"] = "#242424" -let s:rgb["gray15"] = "#262626" -let s:rgb["gray16"] = "#292929" -let s:rgb["gray17"] = "#2b2b2b" -let s:rgb["gray18"] = "#2e2e2e" -let s:rgb["gray19"] = "#303030" -let s:rgb["gray2"] = "#050505" -let s:rgb["gray20"] = "#333333" -let s:rgb["gray21"] = "#363636" -let s:rgb["gray22"] = "#383838" -let s:rgb["gray23"] = "#3b3b3b" -let s:rgb["gray24"] = "#3d3d3d" -let s:rgb["gray25"] = "#404040" -let s:rgb["gray26"] = "#424242" -let s:rgb["gray27"] = "#454545" -let s:rgb["gray28"] = "#474747" -let s:rgb["gray29"] = "#4a4a4a" -let s:rgb["gray3"] = "#080808" -let s:rgb["gray30"] = "#4d4d4d" -let s:rgb["gray31"] = "#4f4f4f" -let s:rgb["gray32"] = "#525252" -let s:rgb["gray33"] = "#545454" -let s:rgb["gray34"] = "#575757" -let s:rgb["gray35"] = "#595959" -let s:rgb["gray36"] = "#5c5c5c" -let s:rgb["gray37"] = "#5e5e5e" -let s:rgb["gray38"] = "#616161" -let s:rgb["gray39"] = "#636363" -let s:rgb["gray4"] = "#0a0a0a" -let s:rgb["gray40"] = "#666666" -let s:rgb["gray41"] = "#696969" -let s:rgb["gray42"] = "#6b6b6b" -let s:rgb["gray43"] = "#6e6e6e" -let s:rgb["gray44"] = "#707070" -let s:rgb["gray45"] = "#737373" -let s:rgb["gray46"] = "#757575" -let s:rgb["gray47"] = "#787878" -let s:rgb["gray48"] = "#7a7a7a" -let s:rgb["gray49"] = "#7d7d7d" -let s:rgb["gray5"] = "#0d0d0d" -let s:rgb["gray50"] = "#7f7f7f" -let s:rgb["gray51"] = "#828282" -let s:rgb["gray52"] = "#858585" -let s:rgb["gray53"] = "#878787" -let s:rgb["gray54"] = "#8a8a8a" -let s:rgb["gray55"] = "#8c8c8c" -let s:rgb["gray56"] = "#8f8f8f" -let s:rgb["gray57"] = "#919191" -let s:rgb["gray58"] = "#949494" -let s:rgb["gray59"] = "#969696" -let s:rgb["gray6"] = "#0f0f0f" -let s:rgb["gray60"] = "#999999" -let s:rgb["gray61"] = "#9c9c9c" -let s:rgb["gray62"] = "#9e9e9e" -let s:rgb["gray63"] = "#a1a1a1" -let s:rgb["gray64"] = "#a3a3a3" -let s:rgb["gray65"] = "#a6a6a6" -let s:rgb["gray66"] = "#a8a8a8" -let s:rgb["gray67"] = "#ababab" -let s:rgb["gray68"] = "#adadad" -let s:rgb["gray69"] = "#b0b0b0" -let s:rgb["gray7"] = "#121212" -let s:rgb["gray70"] = "#b3b3b3" -let s:rgb["gray71"] = "#b5b5b5" -let s:rgb["gray72"] = "#b8b8b8" -let s:rgb["gray73"] = "#bababa" -let s:rgb["gray74"] = "#bdbdbd" -let s:rgb["gray75"] = "#bfbfbf" -let s:rgb["gray76"] = "#c2c2c2" -let s:rgb["gray77"] = "#c4c4c4" -let s:rgb["gray78"] = "#c7c7c7" -let s:rgb["gray79"] = "#c9c9c9" -let s:rgb["gray8"] = "#141414" -let s:rgb["gray80"] = "#cccccc" -let s:rgb["gray81"] = "#cfcfcf" -let s:rgb["gray82"] = "#d1d1d1" -let s:rgb["gray83"] = "#d4d4d4" -let s:rgb["gray84"] = "#d6d6d6" -let s:rgb["gray85"] = "#d9d9d9" -let s:rgb["gray86"] = "#dbdbdb" -let s:rgb["gray87"] = "#dedede" -let s:rgb["gray88"] = "#e0e0e0" -let s:rgb["gray89"] = "#e3e3e3" -let s:rgb["gray9"] = "#171717" -let s:rgb["gray90"] = "#e5e5e5" -let s:rgb["gray91"] = "#e8e8e8" -let s:rgb["gray92"] = "#ebebeb" -let s:rgb["gray93"] = "#ededed" -let s:rgb["gray94"] = "#f0f0f0" -let s:rgb["gray95"] = "#f2f2f2" -let s:rgb["gray96"] = "#f5f5f5" -let s:rgb["gray97"] = "#f7f7f7" -let s:rgb["gray98"] = "#fafafa" -let s:rgb["gray99"] = "#fcfcfc" -let s:rgb["green yellow"] = "#adff2f" -let s:rgb["green"] = "#00ff00" -let s:rgb["green1"] = "#00ff00" -let s:rgb["green2"] = "#00ee00" -let s:rgb["green3"] = "#00cd00" -let s:rgb["green4"] = "#008b00" -let s:rgb["greenyellow"] = "#adff2f" -let s:rgb["grey"] = "#bebebe" -let s:rgb["grey0"] = "#000000" -let s:rgb["grey1"] = "#030303" -let s:rgb["grey10"] = "#1a1a1a" -let s:rgb["grey100"] = "#ffffff" -let s:rgb["grey11"] = "#1c1c1c" -let s:rgb["grey12"] = "#1f1f1f" -let s:rgb["grey13"] = "#212121" -let s:rgb["grey14"] = "#242424" -let s:rgb["grey15"] = "#262626" -let s:rgb["grey16"] = "#292929" -let s:rgb["grey17"] = "#2b2b2b" -let s:rgb["grey18"] = "#2e2e2e" -let s:rgb["grey19"] = "#303030" -let s:rgb["grey2"] = "#050505" -let s:rgb["grey20"] = "#333333" -let s:rgb["grey21"] = "#363636" -let s:rgb["grey22"] = "#383838" -let s:rgb["grey23"] = "#3b3b3b" -let s:rgb["grey24"] = "#3d3d3d" -let s:rgb["grey25"] = "#404040" -let s:rgb["grey26"] = "#424242" -let s:rgb["grey27"] = "#454545" -let s:rgb["grey28"] = "#474747" -let s:rgb["grey29"] = "#4a4a4a" -let s:rgb["grey3"] = "#080808" -let s:rgb["grey30"] = "#4d4d4d" -let s:rgb["grey31"] = "#4f4f4f" -let s:rgb["grey32"] = "#525252" -let s:rgb["grey33"] = "#545454" -let s:rgb["grey34"] = "#575757" -let s:rgb["grey35"] = "#595959" -let s:rgb["grey36"] = "#5c5c5c" -let s:rgb["grey37"] = "#5e5e5e" -let s:rgb["grey38"] = "#616161" -let s:rgb["grey39"] = "#636363" -let s:rgb["grey4"] = "#0a0a0a" -let s:rgb["grey40"] = "#666666" -let s:rgb["grey41"] = "#696969" -let s:rgb["grey42"] = "#6b6b6b" -let s:rgb["grey43"] = "#6e6e6e" -let s:rgb["grey44"] = "#707070" -let s:rgb["grey45"] = "#737373" -let s:rgb["grey46"] = "#757575" -let s:rgb["grey47"] = "#787878" -let s:rgb["grey48"] = "#7a7a7a" -let s:rgb["grey49"] = "#7d7d7d" -let s:rgb["grey5"] = "#0d0d0d" -let s:rgb["grey50"] = "#7f7f7f" -let s:rgb["grey51"] = "#828282" -let s:rgb["grey52"] = "#858585" -let s:rgb["grey53"] = "#878787" -let s:rgb["grey54"] = "#8a8a8a" -let s:rgb["grey55"] = "#8c8c8c" -let s:rgb["grey56"] = "#8f8f8f" -let s:rgb["grey57"] = "#919191" -let s:rgb["grey58"] = "#949494" -let s:rgb["grey59"] = "#969696" -let s:rgb["grey6"] = "#0f0f0f" -let s:rgb["grey60"] = "#999999" -let s:rgb["grey61"] = "#9c9c9c" -let s:rgb["grey62"] = "#9e9e9e" -let s:rgb["grey63"] = "#a1a1a1" -let s:rgb["grey64"] = "#a3a3a3" -let s:rgb["grey65"] = "#a6a6a6" -let s:rgb["grey66"] = "#a8a8a8" -let s:rgb["grey67"] = "#ababab" -let s:rgb["grey68"] = "#adadad" -let s:rgb["grey69"] = "#b0b0b0" -let s:rgb["grey7"] = "#121212" -let s:rgb["grey70"] = "#b3b3b3" -let s:rgb["grey71"] = "#b5b5b5" -let s:rgb["grey72"] = "#b8b8b8" -let s:rgb["grey73"] = "#bababa" -let s:rgb["grey74"] = "#bdbdbd" -let s:rgb["grey75"] = "#bfbfbf" -let s:rgb["grey76"] = "#c2c2c2" -let s:rgb["grey77"] = "#c4c4c4" -let s:rgb["grey78"] = "#c7c7c7" -let s:rgb["grey79"] = "#c9c9c9" -let s:rgb["grey8"] = "#141414" -let s:rgb["grey80"] = "#cccccc" -let s:rgb["grey81"] = "#cfcfcf" -let s:rgb["grey82"] = "#d1d1d1" -let s:rgb["grey83"] = "#d4d4d4" -let s:rgb["grey84"] = "#d6d6d6" -let s:rgb["grey85"] = "#d9d9d9" -let s:rgb["grey86"] = "#dbdbdb" -let s:rgb["grey87"] = "#dedede" -let s:rgb["grey88"] = "#e0e0e0" -let s:rgb["grey89"] = "#e3e3e3" -let s:rgb["grey9"] = "#171717" -let s:rgb["grey90"] = "#e5e5e5" -let s:rgb["grey91"] = "#e8e8e8" -let s:rgb["grey92"] = "#ebebeb" -let s:rgb["grey93"] = "#ededed" -let s:rgb["grey94"] = "#f0f0f0" -let s:rgb["grey95"] = "#f2f2f2" -let s:rgb["grey96"] = "#f5f5f5" -let s:rgb["grey97"] = "#f7f7f7" -let s:rgb["grey98"] = "#fafafa" -let s:rgb["grey99"] = "#fcfcfc" -let s:rgb["honeydew"] = "#f0fff0" -let s:rgb["honeydew1"] = "#f0fff0" -let s:rgb["honeydew2"] = "#e0eee0" -let s:rgb["honeydew3"] = "#c1cdc1" -let s:rgb["honeydew4"] = "#838b83" -let s:rgb["hot pink"] = "#ff69b4" -let s:rgb["hotpink"] = "#ff69b4" -let s:rgb["hotpink1"] = "#ff6eb4" -let s:rgb["hotpink2"] = "#ee6aa7" -let s:rgb["hotpink3"] = "#cd6090" -let s:rgb["hotpink4"] = "#8b3a62" -let s:rgb["indian red"] = "#cd5c5c" -let s:rgb["indianred"] = "#cd5c5c" -let s:rgb["indianred1"] = "#ff6a6a" -let s:rgb["indianred2"] = "#ee6363" -let s:rgb["indianred3"] = "#cd5555" -let s:rgb["indianred4"] = "#8b3a3a" -let s:rgb["ivory"] = "#fffff0" -let s:rgb["ivory1"] = "#fffff0" -let s:rgb["ivory2"] = "#eeeee0" -let s:rgb["ivory3"] = "#cdcdc1" -let s:rgb["ivory4"] = "#8b8b83" -let s:rgb["khaki"] = "#f0e68c" -let s:rgb["khaki1"] = "#fff68f" -let s:rgb["khaki2"] = "#eee685" -let s:rgb["khaki3"] = "#cdc673" -let s:rgb["khaki4"] = "#8b864e" -let s:rgb["lavender blush"] = "#fff0f5" -let s:rgb["lavender"] = "#e6e6fa" -let s:rgb["lavenderblush"] = "#fff0f5" -let s:rgb["lavenderblush1"] = "#fff0f5" -let s:rgb["lavenderblush2"] = "#eee0e5" -let s:rgb["lavenderblush3"] = "#cdc1c5" -let s:rgb["lavenderblush4"] = "#8b8386" -let s:rgb["lawn green"] = "#7cfc00" -let s:rgb["lawngreen"] = "#7cfc00" -let s:rgb["lemon chiffon"] = "#fffacd" -let s:rgb["lemonchiffon"] = "#fffacd" -let s:rgb["lemonchiffon1"] = "#fffacd" -let s:rgb["lemonchiffon2"] = "#eee9bf" -let s:rgb["lemonchiffon3"] = "#cdc9a5" -let s:rgb["lemonchiffon4"] = "#8b8970" -let s:rgb["light blue"] = "#add8e6" -let s:rgb["light coral"] = "#f08080" -let s:rgb["light cyan"] = "#e0ffff" -let s:rgb["light goldenrod yellow"] = "#fafad2" -let s:rgb["light goldenrod"] = "#eedd82" -let s:rgb["light gray"] = "#d3d3d3" -let s:rgb["light green"] = "#90ee90" -let s:rgb["light grey"] = "#d3d3d3" -let s:rgb["light magenta"] = "#ffbbff" -let s:rgb["light pink"] = "#ffb6c1" -let s:rgb["light red"] = "#ffbbbb" -let s:rgb["light salmon"] = "#ffa07a" -let s:rgb["light sea green"] = "#20b2aa" -let s:rgb["light sky blue"] = "#87cefa" -let s:rgb["light slate blue"] = "#8470ff" -let s:rgb["light slate gray"] = "#778899" -let s:rgb["light slate grey"] = "#778899" -let s:rgb["light steel blue"] = "#b0c4de" -let s:rgb["light yellow"] = "#ffffe0" -let s:rgb["lightblue"] = "#add8e6" -let s:rgb["lightblue1"] = "#bfefff" -let s:rgb["lightblue2"] = "#b2dfee" -let s:rgb["lightblue3"] = "#9ac0cd" -let s:rgb["lightblue4"] = "#68838b" -let s:rgb["lightcoral"] = "#f08080" -let s:rgb["lightcyan"] = "#e0ffff" -let s:rgb["lightcyan1"] = "#e0ffff" -let s:rgb["lightcyan2"] = "#d1eeee" -let s:rgb["lightcyan3"] = "#b4cdcd" -let s:rgb["lightcyan4"] = "#7a8b8b" -let s:rgb["lightgoldenrod"] = "#eedd82" -let s:rgb["lightgoldenrod1"] = "#ffec8b" -let s:rgb["lightgoldenrod2"] = "#eedc82" -let s:rgb["lightgoldenrod3"] = "#cdbe70" -let s:rgb["lightgoldenrod4"] = "#8b814c" -let s:rgb["lightgoldenrodyellow"] = "#fafad2" -let s:rgb["lightgray"] = "#d3d3d3" -let s:rgb["lightgreen"] = "#90ee90" -let s:rgb["lightgrey"] = "#d3d3d3" -let s:rgb["lightmagenta"] = "#ffbbff" -let s:rgb["lightpink"] = "#ffb6c1" -let s:rgb["lightpink1"] = "#ffaeb9" -let s:rgb["lightpink2"] = "#eea2ad" -let s:rgb["lightpink3"] = "#cd8c95" -let s:rgb["lightpink4"] = "#8b5f65" -let s:rgb["lightred"] = "#ffbbbb" -let s:rgb["lightsalmon"] = "#ffa07a" -let s:rgb["lightsalmon1"] = "#ffa07a" -let s:rgb["lightsalmon2"] = "#ee9572" -let s:rgb["lightsalmon3"] = "#cd8162" -let s:rgb["lightsalmon4"] = "#8b5742" -let s:rgb["lightseagreen"] = "#20b2aa" -let s:rgb["lightskyblue"] = "#87cefa" -let s:rgb["lightskyblue1"] = "#b0e2ff" -let s:rgb["lightskyblue2"] = "#a4d3ee" -let s:rgb["lightskyblue3"] = "#8db6cd" -let s:rgb["lightskyblue4"] = "#607b8b" -let s:rgb["lightslateblue"] = "#8470ff" -let s:rgb["lightslategray"] = "#778899" -let s:rgb["lightslategrey"] = "#778899" -let s:rgb["lightsteelblue"] = "#b0c4de" -let s:rgb["lightsteelblue1"] = "#cae1ff" -let s:rgb["lightsteelblue2"] = "#bcd2ee" -let s:rgb["lightsteelblue3"] = "#a2b5cd" -let s:rgb["lightsteelblue4"] = "#6e7b8b" -let s:rgb["lightyellow"] = "#ffffe0" -let s:rgb["lightyellow1"] = "#ffffe0" -let s:rgb["lightyellow2"] = "#eeeed1" -let s:rgb["lightyellow3"] = "#cdcdb4" -let s:rgb["lightyellow4"] = "#8b8b7a" -let s:rgb["lime green"] = "#32cd32" -let s:rgb["limegreen"] = "#32cd32" -let s:rgb["linen"] = "#faf0e6" -let s:rgb["magenta"] = "#ff00ff" -let s:rgb["magenta1"] = "#ff00ff" -let s:rgb["magenta2"] = "#ee00ee" -let s:rgb["magenta3"] = "#cd00cd" -let s:rgb["magenta4"] = "#8b008b" -let s:rgb["maroon"] = "#b03060" -let s:rgb["maroon1"] = "#ff34b3" -let s:rgb["maroon2"] = "#ee30a7" -let s:rgb["maroon3"] = "#cd2990" -let s:rgb["maroon4"] = "#8b1c62" -let s:rgb["medium aquamarine"] = "#66cdaa" -let s:rgb["medium blue"] = "#0000cd" -let s:rgb["medium orchid"] = "#ba55d3" -let s:rgb["medium purple"] = "#9370db" -let s:rgb["medium sea green"] = "#3cb371" -let s:rgb["medium slate blue"] = "#7b68ee" -let s:rgb["medium spring green"] = "#00fa9a" -let s:rgb["medium turquoise"] = "#48d1cc" -let s:rgb["medium violet red"] = "#c71585" -let s:rgb["mediumaquamarine"] = "#66cdaa" -let s:rgb["mediumblue"] = "#0000cd" -let s:rgb["mediumorchid"] = "#ba55d3" -let s:rgb["mediumorchid1"] = "#e066ff" -let s:rgb["mediumorchid2"] = "#d15fee" -let s:rgb["mediumorchid3"] = "#b452cd" -let s:rgb["mediumorchid4"] = "#7a378b" -let s:rgb["mediumpurple"] = "#9370db" -let s:rgb["mediumpurple1"] = "#ab82ff" -let s:rgb["mediumpurple2"] = "#9f79ee" -let s:rgb["mediumpurple3"] = "#8968cd" -let s:rgb["mediumpurple4"] = "#5d478b" -let s:rgb["mediumseagreen"] = "#3cb371" -let s:rgb["mediumslateblue"] = "#7b68ee" -let s:rgb["mediumspringgreen"] = "#00fa9a" -let s:rgb["mediumturquoise"] = "#48d1cc" -let s:rgb["mediumvioletred"] = "#c71585" -let s:rgb["midnight blue"] = "#191970" -let s:rgb["midnightblue"] = "#191970" -let s:rgb["mint cream"] = "#f5fffa" -let s:rgb["mintcream"] = "#f5fffa" -let s:rgb["misty rose"] = "#ffe4e1" -let s:rgb["mistyrose"] = "#ffe4e1" -let s:rgb["mistyrose1"] = "#ffe4e1" -let s:rgb["mistyrose2"] = "#eed5d2" -let s:rgb["mistyrose3"] = "#cdb7b5" -let s:rgb["mistyrose4"] = "#8b7d7b" -let s:rgb["moccasin"] = "#ffe4b5" -let s:rgb["navajo white"] = "#ffdead" -let s:rgb["navajowhite"] = "#ffdead" -let s:rgb["navajowhite1"] = "#ffdead" -let s:rgb["navajowhite2"] = "#eecfa1" -let s:rgb["navajowhite3"] = "#cdb38b" -let s:rgb["navajowhite4"] = "#8b795e" -let s:rgb["navy blue"] = "#000080" -let s:rgb["navy"] = "#000080" -let s:rgb["navyblue"] = "#000080" -let s:rgb["old lace"] = "#fdf5e6" -let s:rgb["oldlace"] = "#fdf5e6" -let s:rgb["olive drab"] = "#6b8e23" -let s:rgb["olivedrab"] = "#6b8e23" -let s:rgb["olivedrab1"] = "#c0ff3e" -let s:rgb["olivedrab2"] = "#b3ee3a" -let s:rgb["olivedrab3"] = "#9acd32" -let s:rgb["olivedrab4"] = "#698b22" -let s:rgb["orange red"] = "#ff4500" -let s:rgb["orange"] = "#ffa500" -let s:rgb["orange1"] = "#ffa500" -let s:rgb["orange2"] = "#ee9a00" -let s:rgb["orange3"] = "#cd8500" -let s:rgb["orange4"] = "#8b5a00" -let s:rgb["orangered"] = "#ff4500" -let s:rgb["orangered1"] = "#ff4500" -let s:rgb["orangered2"] = "#ee4000" -let s:rgb["orangered3"] = "#cd3700" -let s:rgb["orangered4"] = "#8b2500" -let s:rgb["orchid"] = "#da70d6" -let s:rgb["orchid1"] = "#ff83fa" -let s:rgb["orchid2"] = "#ee7ae9" -let s:rgb["orchid3"] = "#cd69c9" -let s:rgb["orchid4"] = "#8b4789" -let s:rgb["pale goldenrod"] = "#eee8aa" -let s:rgb["pale green"] = "#98fb98" -let s:rgb["pale turquoise"] = "#afeeee" -let s:rgb["pale violet red"] = "#db7093" -let s:rgb["palegoldenrod"] = "#eee8aa" -let s:rgb["palegreen"] = "#98fb98" -let s:rgb["palegreen1"] = "#9aff9a" -let s:rgb["palegreen2"] = "#90ee90" -let s:rgb["palegreen3"] = "#7ccd7c" -let s:rgb["palegreen4"] = "#548b54" -let s:rgb["paleturquoise"] = "#afeeee" -let s:rgb["paleturquoise1"] = "#bbffff" -let s:rgb["paleturquoise2"] = "#aeeeee" -let s:rgb["paleturquoise3"] = "#96cdcd" -let s:rgb["paleturquoise4"] = "#668b8b" -let s:rgb["palevioletred"] = "#db7093" -let s:rgb["palevioletred1"] = "#ff82ab" -let s:rgb["palevioletred2"] = "#ee799f" -let s:rgb["palevioletred3"] = "#cd6889" -let s:rgb["palevioletred4"] = "#8b475d" -let s:rgb["papaya whip"] = "#ffefd5" -let s:rgb["papayawhip"] = "#ffefd5" -let s:rgb["peach puff"] = "#ffdab9" -let s:rgb["peachpuff"] = "#ffdab9" -let s:rgb["peachpuff1"] = "#ffdab9" -let s:rgb["peachpuff2"] = "#eecbad" -let s:rgb["peachpuff3"] = "#cdaf95" -let s:rgb["peachpuff4"] = "#8b7765" -let s:rgb["peru"] = "#cd853f" -let s:rgb["pink"] = "#ffc0cb" -let s:rgb["pink1"] = "#ffb5c5" -let s:rgb["pink2"] = "#eea9b8" -let s:rgb["pink3"] = "#cd919e" -let s:rgb["pink4"] = "#8b636c" -let s:rgb["plum"] = "#dda0dd" -let s:rgb["plum1"] = "#ffbbff" -let s:rgb["plum2"] = "#eeaeee" -let s:rgb["plum3"] = "#cd96cd" -let s:rgb["plum4"] = "#8b668b" -let s:rgb["powder blue"] = "#b0e0e6" -let s:rgb["powderblue"] = "#b0e0e6" -let s:rgb["purple"] = "#a020f0" -let s:rgb["purple1"] = "#9b30ff" -let s:rgb["purple2"] = "#912cee" -let s:rgb["purple3"] = "#7d26cd" -let s:rgb["purple4"] = "#551a8b" -let s:rgb["red"] = "#ff0000" -let s:rgb["red1"] = "#ff0000" -let s:rgb["red2"] = "#ee0000" -let s:rgb["red3"] = "#cd0000" -let s:rgb["red4"] = "#8b0000" -let s:rgb["rosy brown"] = "#bc8f8f" -let s:rgb["rosybrown"] = "#bc8f8f" -let s:rgb["rosybrown1"] = "#ffc1c1" -let s:rgb["rosybrown2"] = "#eeb4b4" -let s:rgb["rosybrown3"] = "#cd9b9b" -let s:rgb["rosybrown4"] = "#8b6969" -let s:rgb["royal blue"] = "#4169e1" -let s:rgb["royalblue"] = "#4169e1" -let s:rgb["royalblue1"] = "#4876ff" -let s:rgb["royalblue2"] = "#436eee" -let s:rgb["royalblue3"] = "#3a5fcd" -let s:rgb["royalblue4"] = "#27408b" -let s:rgb["saddle brown"] = "#8b4513" -let s:rgb["saddlebrown"] = "#8b4513" -let s:rgb["salmon"] = "#fa8072" -let s:rgb["salmon1"] = "#ff8c69" -let s:rgb["salmon2"] = "#ee8262" -let s:rgb["salmon3"] = "#cd7054" -let s:rgb["salmon4"] = "#8b4c39" -let s:rgb["sandy brown"] = "#f4a460" -let s:rgb["sandybrown"] = "#f4a460" -let s:rgb["sea green"] = "#2e8b57" -let s:rgb["seagreen"] = "#2e8b57" -let s:rgb["seagreen1"] = "#54ff9f" -let s:rgb["seagreen2"] = "#4eee94" -let s:rgb["seagreen3"] = "#43cd80" -let s:rgb["seagreen4"] = "#2e8b57" -let s:rgb["seashell"] = "#fff5ee" -let s:rgb["seashell1"] = "#fff5ee" -let s:rgb["seashell2"] = "#eee5de" -let s:rgb["seashell3"] = "#cdc5bf" -let s:rgb["seashell4"] = "#8b8682" -let s:rgb["sienna"] = "#a0522d" -let s:rgb["sienna1"] = "#ff8247" -let s:rgb["sienna2"] = "#ee7942" -let s:rgb["sienna3"] = "#cd6839" -let s:rgb["sienna4"] = "#8b4726" -let s:rgb["sky blue"] = "#87ceeb" -let s:rgb["skyblue"] = "#87ceeb" -let s:rgb["skyblue1"] = "#87ceff" -let s:rgb["skyblue2"] = "#7ec0ee" -let s:rgb["skyblue3"] = "#6ca6cd" -let s:rgb["skyblue4"] = "#4a708b" -let s:rgb["slate blue"] = "#6a5acd" -let s:rgb["slate gray"] = "#708090" -let s:rgb["slate grey"] = "#708090" -let s:rgb["slateblue"] = "#6a5acd" -let s:rgb["slateblue1"] = "#836fff" -let s:rgb["slateblue2"] = "#7a67ee" -let s:rgb["slateblue3"] = "#6959cd" -let s:rgb["slateblue4"] = "#473c8b" -let s:rgb["slategray"] = "#708090" -let s:rgb["slategray1"] = "#c6e2ff" -let s:rgb["slategray2"] = "#b9d3ee" -let s:rgb["slategray3"] = "#9fb6cd" -let s:rgb["slategray4"] = "#6c7b8b" -let s:rgb["slategrey"] = "#708090" -let s:rgb["snow"] = "#fffafa" -let s:rgb["snow1"] = "#fffafa" -let s:rgb["snow2"] = "#eee9e9" -let s:rgb["snow3"] = "#cdc9c9" -let s:rgb["snow4"] = "#8b8989" -let s:rgb["spring green"] = "#00ff7f" -let s:rgb["springgreen"] = "#00ff7f" -let s:rgb["springgreen1"] = "#00ff7f" -let s:rgb["springgreen2"] = "#00ee76" -let s:rgb["springgreen3"] = "#00cd66" -let s:rgb["springgreen4"] = "#008b45" -let s:rgb["steel blue"] = "#4682b4" -let s:rgb["steelblue"] = "#4682b4" -let s:rgb["steelblue1"] = "#63b8ff" -let s:rgb["steelblue2"] = "#5cacee" -let s:rgb["steelblue3"] = "#4f94cd" -let s:rgb["steelblue4"] = "#36648b" -let s:rgb["tan"] = "#d2b48c" -let s:rgb["tan1"] = "#ffa54f" -let s:rgb["tan2"] = "#ee9a49" -let s:rgb["tan3"] = "#cd853f" -let s:rgb["tan4"] = "#8b5a2b" -let s:rgb["thistle"] = "#d8bfd8" -let s:rgb["thistle1"] = "#ffe1ff" -let s:rgb["thistle2"] = "#eed2ee" -let s:rgb["thistle3"] = "#cdb5cd" -let s:rgb["thistle4"] = "#8b7b8b" -let s:rgb["tomato"] = "#ff6347" -let s:rgb["tomato1"] = "#ff6347" -let s:rgb["tomato2"] = "#ee5c42" -let s:rgb["tomato3"] = "#cd4f39" -let s:rgb["tomato4"] = "#8b3626" -let s:rgb["turquoise"] = "#40e0d0" -let s:rgb["turquoise1"] = "#00f5ff" -let s:rgb["turquoise2"] = "#00e5ee" -let s:rgb["turquoise3"] = "#00c5cd" -let s:rgb["turquoise4"] = "#00868b" -let s:rgb["violet red"] = "#d02090" -let s:rgb["violet"] = "#ee82ee" -let s:rgb["violetred"] = "#d02090" -let s:rgb["violetred1"] = "#ff3e96" -let s:rgb["violetred2"] = "#ee3a8c" -let s:rgb["violetred3"] = "#cd3278" -let s:rgb["violetred4"] = "#8b2252" -let s:rgb["wheat"] = "#f5deb3" -let s:rgb["wheat1"] = "#ffe7ba" -let s:rgb["wheat2"] = "#eed8ae" -let s:rgb["wheat3"] = "#cdba96" -let s:rgb["wheat4"] = "#8b7e66" -let s:rgb["white smoke"] = "#f5f5f5" -let s:rgb["white"] = "#ffffff" -let s:rgb["whitesmoke"] = "#f5f5f5" -let s:rgb["yellow green"] = "#9acd32" -let s:rgb["yellow"] = "#ffff00" -let s:rgb["yellow1"] = "#ffff00" -let s:rgb["yellow2"] = "#eeee00" -let s:rgb["yellow3"] = "#cdcd00" -let s:rgb["yellow4"] = "#8b8b00" -let s:rgb["yellowgreen"] = "#9acd32" - -if has('mac') && !has('macunix') - let s:rgb["dark gray"] = "0x808080" - let s:rgb["darkgray"] = "0x808080" - let s:rgb["dark grey"] = "0x808080" - let s:rgb["darkgrey"] = "0x808080" - let s:rgb["gray"] = "0xc0c0c0" - let s:rgb["grey"] = "0xc0c0c0" - let s:rgb["light gray"] = "0xe0e0e0" - let s:rgb["lightgray"] = "0xe0e0e0" - let s:rgb["light grey"] = "0xe0e0e0" - let s:rgb["lightgrey"] = "0xe0e0e0" - let s:rgb["dark red"] = "0x800000" - let s:rgb["darkred"] = "0x800000" - let s:rgb["red"] = "0xdd0806" - let s:rgb["light red"] = "0xffa0a0" - let s:rgb["lightred"] = "0xffa0a0" - let s:rgb["dark blue"] = "0x000080" - let s:rgb["darkblue"] = "0x000080" - let s:rgb["blue"] = "0x0000d4" - let s:rgb["light blue"] = "0xa0a0ff" - let s:rgb["lightblue"] = "0xa0a0ff" - let s:rgb["dark green"] = "0x008000" - let s:rgb["darkgreen"] = "0x008000" - let s:rgb["green"] = "0x006411" - let s:rgb["light green"] = "0xa0ffa0" - let s:rgb["lightgreen"] = "0xa0ffa0" - let s:rgb["dark cyan"] = "0x008080" - let s:rgb["darkcyan"] = "0x008080" - let s:rgb["cyan"] = "0x02abea" - let s:rgb["light cyan"] = "0xa0ffff" - let s:rgb["lightcyan"] = "0xa0ffff" - let s:rgb["dark magenta"] = "0x800080" - let s:rgb["darkmagenta"] = "0x800080" - let s:rgb["magenta"] = "0xf20884" - let s:rgb["light magenta"] = "0xf0a0f0" - let s:rgb["lightmagenta"] = "0xf0a0f0" - let s:rgb["brown"] = "0x804040" - let s:rgb["yellow"] = "0xfcf305" - let s:rgb["light yellow"] = "0xffffa0" - let s:rgb["lightyellow"] = "0xffffa0" - let s:rgb["orange"] = "0xfc8000" - let s:rgb["purple"] = "0xa020f0" - let s:rgb["slateblue"] = "0x6a5acd" - let s:rgb["violet"] = "0x8d38c9" -endif - -function! csapprox#rgb() - return s:rgb -endfunction diff --git a/files/.vim/autoload/pythoncomplete.vim b/files/.vim/autoload/pythoncomplete.vim deleted file mode 100644 index 1474493..0000000 --- a/files/.vim/autoload/pythoncomplete.vim +++ /dev/null @@ -1,606 +0,0 @@ -"pythoncomplete.vim - Omni Completion for python -" Maintainer: Aaron Griffin -" Version: 0.8 -" Last Updated: 8 Oct 2007 -" -" Changes -" TODO: -" User defined docstrings aren't handled right... -" 'info' item output can use some formatting work -" Add an "unsafe eval" mode, to allow for return type evaluation -" Complete basic syntax along with import statements -" i.e. "import url" -" Continue parsing on invalid line?? -" -" v 0.8 -" * Fixed an issue where the FIRST assignment was always used instead of -" using a subsequent assignment for a variable -" * Fixed a scoping issue when working inside a parameterless function -" -" -" v 0.7 -" * Fixed function list sorting (_ and __ at the bottom) -" * Removed newline removal from docs. It appears vim handles these better in -" recent patches -" -" v 0.6: -" * Fixed argument completion -" * Removed the 'kind' completions, as they are better indicated -" with real syntax -" * Added tuple assignment parsing (whoops, that was forgotten) -" * Fixed import handling when flattening scope -" -" v 0.5: -" Yeah, I skipped a version number - 0.4 was never public. -" It was a bugfix version on top of 0.3. This is a complete -" rewrite. -" - -if !has('python') - echo "Error: Required vim compiled with +python" - finish -endif - -function! pythoncomplete#Complete(findstart, base) - "findstart = 1 when we need to get the text length - if a:findstart == 1 - let line = getline('.') - let idx = col('.') - while idx > 0 - let idx -= 1 - let c = line[idx] - if c =~ '\w' - continue - elseif ! c =~ '\.' - let idx = -1 - break - else - break - endif - endwhile - - return idx - "findstart = 0 when we need to return the list of completions - else - "vim no longer moves the cursor upon completion... fix that - let line = getline('.') - let idx = col('.') - let cword = '' - while idx > 0 - let idx -= 1 - let c = line[idx] - if c =~ '\w' || c =~ '\.' || c == '(' - let cword = c . cword - continue - elseif strlen(cword) > 0 || idx == 0 - break - endif - endwhile - execute "python vimcomplete('" . cword . "', '" . a:base . "')" - return g:pythoncomplete_completions - endif -endfunction - -function! s:DefPython() -python << PYTHONEOF -import sys, tokenize, cStringIO, types -from token import NAME, DEDENT, NEWLINE, STRING - -debugstmts=[] -def dbg(s): debugstmts.append(s) -def showdbg(): - for d in debugstmts: print "DBG: %s " % d - -def vimcomplete(context,match): - global debugstmts - debugstmts = [] - try: - import vim - def complsort(x,y): - try: - xa = x['abbr'] - ya = y['abbr'] - if xa[0] == '_': - if xa[1] == '_' and ya[0:2] == '__': - return xa > ya - elif ya[0:2] == '__': - return -1 - elif y[0] == '_': - return xa > ya - else: - return 1 - elif ya[0] == '_': - return -1 - else: - return xa > ya - except: - return 0 - cmpl = Completer() - cmpl.evalsource('\n'.join(vim.current.buffer),vim.eval("line('.')")) - all = cmpl.get_completions(context,match) - all.sort(complsort) - dictstr = '[' - # have to do this for double quoting - for cmpl in all: - dictstr += '{' - for x in cmpl: dictstr += '"%s":"%s",' % (x,cmpl[x]) - dictstr += '"icase":0},' - if dictstr[-1] == ',': dictstr = dictstr[:-1] - dictstr += ']' - #dbg("dict: %s" % dictstr) - vim.command("silent let g:pythoncomplete_completions = %s" % dictstr) - #dbg("Completion dict:\n%s" % all) - except vim.error: - dbg("VIM Error: %s" % vim.error) - -class Completer(object): - def __init__(self): - self.compldict = {} - self.parser = PyParser() - - def evalsource(self,text,line=0): - sc = self.parser.parse(text,line) - src = sc.get_code() - dbg("source: %s" % src) - try: exec(src) in self.compldict - except: dbg("parser: %s, %s" % (sys.exc_info()[0],sys.exc_info()[1])) - for l in sc.locals: - try: exec(l) in self.compldict - except: dbg("locals: %s, %s [%s]" % (sys.exc_info()[0],sys.exc_info()[1],l)) - - def _cleanstr(self,doc): - return doc.replace('"',' ').replace("'",' ') - - def get_arguments(self,func_obj): - def _ctor(obj): - try: return class_ob.__init__.im_func - except AttributeError: - for base in class_ob.__bases__: - rc = _find_constructor(base) - if rc is not None: return rc - return None - - arg_offset = 1 - if type(func_obj) == types.ClassType: func_obj = _ctor(func_obj) - elif type(func_obj) == types.MethodType: func_obj = func_obj.im_func - else: arg_offset = 0 - - arg_text='' - if type(func_obj) in [types.FunctionType, types.LambdaType]: - try: - cd = func_obj.func_code - real_args = cd.co_varnames[arg_offset:cd.co_argcount] - defaults = func_obj.func_defaults or '' - defaults = map(lambda name: "=%s" % name, defaults) - defaults = [""] * (len(real_args)-len(defaults)) + defaults - items = map(lambda a,d: a+d, real_args, defaults) - if func_obj.func_code.co_flags & 0x4: - items.append("...") - if func_obj.func_code.co_flags & 0x8: - items.append("***") - arg_text = (','.join(items)) + ')' - - except: - dbg("arg completion: %s: %s" % (sys.exc_info()[0],sys.exc_info()[1])) - pass - if len(arg_text) == 0: - # The doc string sometimes contains the function signature - # this works for alot of C modules that are part of the - # standard library - doc = func_obj.__doc__ - if doc: - doc = doc.lstrip() - pos = doc.find('\n') - if pos > 0: - sigline = doc[:pos] - lidx = sigline.find('(') - ridx = sigline.find(')') - if lidx > 0 and ridx > 0: - arg_text = sigline[lidx+1:ridx] + ')' - if len(arg_text) == 0: arg_text = ')' - return arg_text - - def get_completions(self,context,match): - dbg("get_completions('%s','%s')" % (context,match)) - stmt = '' - if context: stmt += str(context) - if match: stmt += str(match) - try: - result = None - all = {} - ridx = stmt.rfind('.') - if len(stmt) > 0 and stmt[-1] == '(': - result = eval(_sanitize(stmt[:-1]), self.compldict) - doc = result.__doc__ - if doc == None: doc = '' - args = self.get_arguments(result) - return [{'word':self._cleanstr(args),'info':self._cleanstr(doc)}] - elif ridx == -1: - match = stmt - all = self.compldict - else: - match = stmt[ridx+1:] - stmt = _sanitize(stmt[:ridx]) - result = eval(stmt, self.compldict) - all = dir(result) - - dbg("completing: stmt:%s" % stmt) - completions = [] - - try: maindoc = result.__doc__ - except: maindoc = ' ' - if maindoc == None: maindoc = ' ' - for m in all: - if m == "_PyCmplNoType": continue #this is internal - try: - dbg('possible completion: %s' % m) - if m.find(match) == 0: - if result == None: inst = all[m] - else: inst = getattr(result,m) - try: doc = inst.__doc__ - except: doc = maindoc - typestr = str(inst) - if doc == None or doc == '': doc = maindoc - - wrd = m[len(match):] - c = {'word':wrd, 'abbr':m, 'info':self._cleanstr(doc)} - if "function" in typestr: - c['word'] += '(' - c['abbr'] += '(' + self._cleanstr(self.get_arguments(inst)) - elif "method" in typestr: - c['word'] += '(' - c['abbr'] += '(' + self._cleanstr(self.get_arguments(inst)) - elif "module" in typestr: - c['word'] += '.' - elif "class" in typestr: - c['word'] += '(' - c['abbr'] += '(' - completions.append(c) - except: - i = sys.exc_info() - dbg("inner completion: %s,%s [stmt='%s']" % (i[0],i[1],stmt)) - return completions - except: - i = sys.exc_info() - dbg("completion: %s,%s [stmt='%s']" % (i[0],i[1],stmt)) - return [] - -class Scope(object): - def __init__(self,name,indent): - self.subscopes = [] - self.docstr = '' - self.locals = [] - self.parent = None - self.name = name - self.indent = indent - - def add(self,sub): - #print 'push scope: [%s@%s]' % (sub.name,sub.indent) - sub.parent = self - self.subscopes.append(sub) - return sub - - def doc(self,str): - """ Clean up a docstring """ - d = str.replace('\n',' ') - d = d.replace('\t',' ') - while d.find(' ') > -1: d = d.replace(' ',' ') - while d[0] in '"\'\t ': d = d[1:] - while d[-1] in '"\'\t ': d = d[:-1] - self.docstr = d - - def local(self,loc): - self._checkexisting(loc) - self.locals.append(loc) - - def copy_decl(self,indent=0): - """ Copy a scope's declaration only, at the specified indent level - not local variables """ - return Scope(self.name,indent) - - def _checkexisting(self,test): - "Convienance function... keep out duplicates" - if test.find('=') > -1: - var = test.split('=')[0].strip() - for l in self.locals: - if l.find('=') > -1 and var == l.split('=')[0].strip(): - self.locals.remove(l) - - def get_code(self): - # we need to start with this, to fix up broken completions - # hopefully this name is unique enough... - str = '"""'+self.docstr+'"""\n' - for l in self.locals: - if l.startswith('import'): str += l+'\n' - str += 'class _PyCmplNoType:\n def __getattr__(self,name):\n return None\n' - for sub in self.subscopes: - str += sub.get_code() - for l in self.locals: - if not l.startswith('import'): str += l+'\n' - - return str - - def pop(self,indent): - #print 'pop scope: [%s] to [%s]' % (self.indent,indent) - outer = self - while outer.parent != None and outer.indent >= indent: - outer = outer.parent - return outer - - def currentindent(self): - #print 'parse current indent: %s' % self.indent - return ' '*self.indent - - def childindent(self): - #print 'parse child indent: [%s]' % (self.indent+1) - return ' '*(self.indent+1) - -class Class(Scope): - def __init__(self, name, supers, indent): - Scope.__init__(self,name,indent) - self.supers = supers - def copy_decl(self,indent=0): - c = Class(self.name,self.supers,indent) - for s in self.subscopes: - c.add(s.copy_decl(indent+1)) - return c - def get_code(self): - str = '%sclass %s' % (self.currentindent(),self.name) - if len(self.supers) > 0: str += '(%s)' % ','.join(self.supers) - str += ':\n' - if len(self.docstr) > 0: str += self.childindent()+'"""'+self.docstr+'"""\n' - if len(self.subscopes) > 0: - for s in self.subscopes: str += s.get_code() - else: - str += '%spass\n' % self.childindent() - return str - - -class Function(Scope): - def __init__(self, name, params, indent): - Scope.__init__(self,name,indent) - self.params = params - def copy_decl(self,indent=0): - return Function(self.name,self.params,indent) - def get_code(self): - str = "%sdef %s(%s):\n" % \ - (self.currentindent(),self.name,','.join(self.params)) - if len(self.docstr) > 0: str += self.childindent()+'"""'+self.docstr+'"""\n' - str += "%spass\n" % self.childindent() - return str - -class PyParser: - def __init__(self): - self.top = Scope('global',0) - self.scope = self.top - - def _parsedotname(self,pre=None): - #returns (dottedname, nexttoken) - name = [] - if pre == None: - tokentype, token, indent = self.next() - if tokentype != NAME and token != '*': - return ('', token) - else: token = pre - name.append(token) - while True: - tokentype, token, indent = self.next() - if token != '.': break - tokentype, token, indent = self.next() - if tokentype != NAME: break - name.append(token) - return (".".join(name), token) - - def _parseimportlist(self): - imports = [] - while True: - name, token = self._parsedotname() - if not name: break - name2 = '' - if token == 'as': name2, token = self._parsedotname() - imports.append((name, name2)) - while token != "," and "\n" not in token: - tokentype, token, indent = self.next() - if token != ",": break - return imports - - def _parenparse(self): - name = '' - names = [] - level = 1 - while True: - tokentype, token, indent = self.next() - if token in (')', ',') and level == 1: - names.append(name) - name = '' - if token == '(': - level += 1 - elif token == ')': - level -= 1 - if level == 0: break - elif token == ',' and level == 1: - pass - else: - name += str(token) - return names - - def _parsefunction(self,indent): - self.scope=self.scope.pop(indent) - tokentype, fname, ind = self.next() - if tokentype != NAME: return None - - tokentype, open, ind = self.next() - if open != '(': return None - params=self._parenparse() - - tokentype, colon, ind = self.next() - if colon != ':': return None - - return Function(fname,params,indent) - - def _parseclass(self,indent): - self.scope=self.scope.pop(indent) - tokentype, cname, ind = self.next() - if tokentype != NAME: return None - - super = [] - tokentype, next, ind = self.next() - if next == '(': - super=self._parenparse() - elif next != ':': return None - - return Class(cname,super,indent) - - def _parseassignment(self): - assign='' - tokentype, token, indent = self.next() - if tokentype == tokenize.STRING or token == 'str': - return '""' - elif token == '(' or token == 'tuple': - return '()' - elif token == '[' or token == 'list': - return '[]' - elif token == '{' or token == 'dict': - return '{}' - elif tokentype == tokenize.NUMBER: - return '0' - elif token == 'open' or token == 'file': - return 'file' - elif token == 'None': - return '_PyCmplNoType()' - elif token == 'type': - return 'type(_PyCmplNoType)' #only for method resolution - else: - assign += token - level = 0 - while True: - tokentype, token, indent = self.next() - if token in ('(','{','['): - level += 1 - elif token in (']','}',')'): - level -= 1 - if level == 0: break - elif level == 0: - if token in (';','\n'): break - assign += token - return "%s" % assign - - def next(self): - type, token, (lineno, indent), end, self.parserline = self.gen.next() - if lineno == self.curline: - #print 'line found [%s] scope=%s' % (line.replace('\n',''),self.scope.name) - self.currentscope = self.scope - return (type, token, indent) - - def _adjustvisibility(self): - newscope = Scope('result',0) - scp = self.currentscope - while scp != None: - if type(scp) == Function: - slice = 0 - #Handle 'self' params - if scp.parent != None and type(scp.parent) == Class: - slice = 1 - p = scp.params[0] - i = p.find('=') - if i != -1: p = p[:i] - newscope.local('%s = %s' % (scp.params[0],scp.parent.name)) - for p in scp.params[slice:]: - i = p.find('=') - if len(p) == 0: continue - if i == -1: - newscope.local('%s = _PyCmplNoType()' % p) - else: - newscope.local('%s = %s' % (p[:i],_sanitize(p[i+1]))) - - for s in scp.subscopes: - ns = s.copy_decl(0) - newscope.add(ns) - for l in scp.locals: newscope.local(l) - scp = scp.parent - - self.currentscope = newscope - return self.currentscope - - #p.parse(vim.current.buffer[:],vim.eval("line('.')")) - def parse(self,text,curline=0): - self.curline = int(curline) - buf = cStringIO.StringIO(''.join(text) + '\n') - self.gen = tokenize.generate_tokens(buf.readline) - self.currentscope = self.scope - - try: - freshscope=True - while True: - tokentype, token, indent = self.next() - #dbg( 'main: token=[%s] indent=[%s]' % (token,indent)) - - if tokentype == DEDENT or token == "pass": - self.scope = self.scope.pop(indent) - elif token == 'def': - func = self._parsefunction(indent) - if func == None: - print "function: syntax error..." - continue - freshscope = True - self.scope = self.scope.add(func) - elif token == 'class': - cls = self._parseclass(indent) - if cls == None: - print "class: syntax error..." - continue - freshscope = True - self.scope = self.scope.add(cls) - - elif token == 'import': - imports = self._parseimportlist() - for mod, alias in imports: - loc = "import %s" % mod - if len(alias) > 0: loc += " as %s" % alias - self.scope.local(loc) - freshscope = False - elif token == 'from': - mod, token = self._parsedotname() - if not mod or token != "import": - print "from: syntax error..." - continue - names = self._parseimportlist() - for name, alias in names: - loc = "from %s import %s" % (mod,name) - if len(alias) > 0: loc += " as %s" % alias - self.scope.local(loc) - freshscope = False - elif tokentype == STRING: - if freshscope: self.scope.doc(token) - elif tokentype == NAME: - name,token = self._parsedotname(token) - if token == '=': - stmt = self._parseassignment() - dbg("parseassignment: %s = %s" % (name, stmt)) - if stmt != None: - self.scope.local("%s = %s" % (name,stmt)) - freshscope = False - except StopIteration: #thrown on EOF - pass - except: - dbg("parse error: %s, %s @ %s" % - (sys.exc_info()[0], sys.exc_info()[1], self.parserline)) - return self._adjustvisibility() - -def _sanitize(str): - val = '' - level = 0 - for c in str: - if c in ('(','{','['): - level += 1 - elif c in (']','}',')'): - level -= 1 - elif level == 0: - val += c - return val - -sys.path.extend(['.','..']) -PYTHONEOF -endfunction - -call s:DefPython() -" vim: set et ts=4: diff --git a/files/.vim/doc/CSApprox.txt b/files/.vim/doc/CSApprox.txt deleted file mode 100644 index d91bb62..0000000 --- a/files/.vim/doc/CSApprox.txt +++ /dev/null @@ -1,599 +0,0 @@ -*CSApprox.txt* Bringing GVim colorschemes to the terminal! - - *csapprox* *csapprox.vim* - - _____ ____ ___ ~ - / ___// __// _ | ___ ___ ____ ___ __ __ ~ - / /__ _\ \ / __ | / _ \ / _ \ / __// _ \ \ \ / ~ - \___//___//_/ |_|/ .__// .__//_/ \___//_\_\ ~ - /_/ /_/ ~ - For Vim version 7.0 or newer - Last changed 01 Apr 2009 - - By Matt Wozniski - mjw@drexel.edu - - Reference Manual~ - - *csapprox-toc* - -1. Introduction |csapprox-intro| -2. Requirements |csapprox-requirements| -3. Configuration |csapprox-configure| -4. Rationale/Design |csapprox-design| -5. Known Bugs and Limitations |csapprox-limitations| -6. Appendix - Terminals and Palettes |csapprox-terminal-list| -7. Changelog |csapprox-changelog| -8. Contact Info |csapprox-author| - -The functionality mentioned here is a plugin, see |add-plugin|. -You can avoid loading this plugin by setting the "CSApprox_loaded" global -variable in your |vimrc| file: > - :let g:CSApprox_loaded = 1 - -============================================================================== -1. Introduction *csapprox-intro* - -It's hard to find colorschemes for terminal Vim. Most colorschemes are -written to only support GVim, and don't work at all in terminal Vim. - -This plugin makes GVim-only colorschemes Just Work in terminal Vim, as long -as the terminal supports 88 or 256 colors - and most do these days. This -usually requires no user interaction (but see below for what to do if things -don't Just Work). After getting this plugin happily installed, any time you -use :colorscheme it will do its magic and make the colorscheme Just Work. - -Whenever you change colorschemes using the :colorscheme command this script -will be executed. It will take the colors that the scheme specified for use -in the GUI and use an approximation algorithm to try to gracefully degrade -them to the closest color available in your terminal. If you are running in -a GUI or if your terminal doesn't support 88 or 256 colors, no changes are -made. Also, no changes will be made if the colorscheme seems to have been -high color already. - -If for some reason this transparent method isn't suitable to you (for instance -if your environment can't be configured to meet the |csapprox-requirements|, -or you need to work in Vim 6), another option is also available: using the -|:CSApproxSnapshot| command to create a new GUI/88-/256-color terminal -colorscheme. To use this command, a user would generally start GVim, choose a -colorscheme that sets up the desired colors, and then use |:CSApproxSnapshot| -to create a new colorscheme based on those colors that works in high color -terminals. This method is more flexible than the transparent mode and works -in more places, but also requires more user intervention, and makes it harder -to deal with colorschemes being updated and such. - *:CSApproxSnapshot* -The full syntax for the command is: > - :CSApproxSnapshot[!] /path/to/new/colorscheme -< For example: > - :CSApproxSnapshot ~/.vim/colors/foobar.vim -< -NOTE: The generated colorscheme will only work in 88- and 256-color terminals, - and in GVim. It will not work at all in a terminal with 16 or fewer - colors. There's just no reliable way to approximate down from - 16,777,216 colors to 16 colors, especially without there being any - standard for what those 16 colors look like other than 'orange-ish', - 'red-ish', etc. - -NOTE: Although :CSApproxSnapshot can be used in both GVim and terminal Vim, - the resulting colors might be slightly off when run from terminal Vim. - I can find no way around this; Vim internally sets different colors when - running in a terminal than running in the GUI, and there's no way for - terminal Vim to figure out what color would have been used in GVim. - -============================================================================== -2. Requirements *csapprox-requirements* - -For CSApprox to work, there are 2 major requirements that must be met. - -a) GUI support *csapprox-gui-support* *csapprox-+gui* - -If CSApprox is being used to adjust a scheme's colors transparently, then the -terminal "vim" binary that is being run must be built with GUI support (see -|csapprox-limitations| for an explanation). If |:CSApproxSnapshot| is being -used to create a terminal colorscheme for high color terminals, then the -"vim" binary being used to create the scheme must be built with +gui, but the -scheme can be used in terminal "vim" binaries that weren't built with +gui. -NOTE that creating snapshots with GVim will work better than making them with -Vim, and (obviously) all "gvim" binaries are built with +gui. - -Unfortunately, several Linux distributions only include GUI support in their -"gvim" binary, and not in their "vim" binary. You can check if GUI support is -available with the following command: - :echo has('gui') - -If that prints 0, the first thing to try would be searching for a larger vim -package provided by your distribution, like "vim-enhanced" on RedHat/CentOS -or "vim-gtk" or "vim-gnome" on Debian/Ubuntu. - -If you are unable to obtain a "vim" binary that includes GUI support, but -have a "gvim" binary available, you can probably launch Vim with GUI support -anyway by calling gvim with the |-v| flag in the shell: > - gvim -v - -If the above works, you can remove the need to call "gvim -v" instead of "vim" -all the time by creating a symbolic link from your "gvim" binary to "vim" -somewhere in your $PATH, for example: - sudo ln -s $(which gvim) $(which vim) - -If launching as "gvim -v" doesn"t work, and no package with GUI support is -available, you will need to compile Vim yourself and ensure that GUI support -is included to use CSApprox in its transparent mode, or create a snapshotted -scheme from GVim to use its snapshot mode. If this is inconvenient for you, -make sure that the Vim maintainer for your distribution knows it; they made a -conscious decision to build "vim" without +gui and "gvim" without terminal -support. - -b) Properly configured terminal *csapprox-terminal* - -As said above, many modern terminals support 88 or 256 colors, but most of -these default to setting $TERM to something generic (usually "xterm"). Since -Vim uses the value of the "colors" attribute for the current $TERM in terminfo -to figure out the number of colors used internally as 't_Co', this plugin will -either need for 't_Co' to be set to 88 or 256 in |vimrc|, or for $TERM to be -set to something that implies high color support. Possible choices include -"xterm-256color" for 256 color support and "rxvt-unicode" for 88 color -support. - *csapprox-palettes* -Also, there are three different 256 color cube palettes available and CSApprox -has no way to tell which you're using unless $TERM is set to something that is -specific to the terminal, like "konsole-256color" or "Eterm". Because of this, the -most sane behavior is assuming the user is using the most popular palette, -which is used by all but Konsole and Eterm, whenever $TERM is set to something -generic like "xterm" or "screen". You can override this default, however - -see |csapprox-configure|. - *csapprox-terminal-example* -To turn on high color support without fixing $TERM, you can change t_Co in -your .vimrc, and set either CSApprox_konsole or CSApprox_eterm if appropriate. -One way would be to put something like this into your |vimrc|: -> - if (&term == 'xterm' || &term =~? '^screen') && hostname() == 'my-machine' - " On my machine, I use Konsole with 256 color support - set t_Co=256 - let g:CSApprox_konsole = 1 - endif - -Gnome Terminal, as of the time that I am writing this, doesn't support having -the terminal emulator set $TERM to something adequately descriptive. In cases -like this, something like the following would be appropriate: -> - if &term =~ '^\(xterm\|screen\)$' && $COLORTERM == 'gnome-terminal' - set t_Co=256 - endif - -============================================================================== -3. Configuration *csapprox-configure* - -There are several global variables that can be set to configure the behavior -of CSApprox. They are listed roughly based on the likelihood that the end -user might want to know about them. - -g:CSApprox_loaded *g:CSApprox_loaded* - If set in your |vimrc|, CSApprox is not loaded. Has no effect on - snapshotted schemes. - -g:CSApprox_verbose_level *g:CSApprox_verbose_level* - When CSApprox is run, the 'verbose' option will be temporarily raised to - the value held in this variable unless it is already greater. The default - value is 1, which allows CSApprox to default to warning whenever something - is wrong, even if it is recoverable, but allows the user to quiet us if he - wants by changing this variable to 0. The most important messages will be - shown at verbosity level 1; some less important ones will be shown at - higher verbosity levels. Has no effect on snapshotted schemes. - -g:CSApprox_eterm *g:CSApprox_eterm* - If set to a non-zero number, CSApprox will use the Eterm palette when - 'term' is set to "xterm" or begins with "screen". Otherwise, the xterm - palette would be used. This also affects snapshotted schemes. - -g:CSApprox_konsole *g:CSApprox_konsole* - If set to a non-zero number, CSApprox will use the Konsole palette when - 'term' is set to "xterm" or begins with "screen". Otherwise, the xterm - palette would be used. This also affects snapshotted schemes. - -g:CSApprox_attr_map *g:CSApprox_attr_map* - Since some attributes (like 'guisp') can't be used in a terminal, and - others (like 'italic') are often very ugly in terminals, a generic way to - map between a requested attribute and another attribute is included. This - variable should be set to a Dictionary, where the keys are strings - representing the attributes the author wanted set, and the values are the - strings that the user wants set instead. If a value is '', it means the - attribute should just be ignored. The default is to replace 'italic' with - 'underline', and to use 'fg' instead of 'sp': > - let g:CSApprox_attr_map = { 'italic' : 'underline', 'sp' : 'fg' } -< - Your author prefers disabling bold and italic entirely, so uses this: > - let g:CSApprox_attr_map = { 'bold' : '', 'italic' : '', 'sp' : 'fg' } -< - - Note: This transformation is considered at the time a snapshotted scheme - is created, rather than when it is used. - - Note: You can only map an attribute representing a color to another - attribute representing a color; likewise with boolean attributes. - After all, sp -> bold and italic -> fg would be nonsensical. - - *g:CSApprox_hook_pre* *g:CSApprox_hook_{scheme}_pre* - *g:CSApprox_hook_post* *g:CSApprox_hook_{scheme}_post* -g:CSApprox_hook_pre -g:CSApprox_hook_post -g:CSApprox_hook_{scheme}_pre -g:CSApprox_hook_{scheme}_post *csapprox-hooks* - These variables provide a method for adjusting tweaking the approximation - algorithm, either for all schemes, or on a per scheme basis. For - snapshotted schemes, these will only take effect when the snapshotted - scheme is created, rather than when it is used. Each of these variables - may be set to either a String containing a command to be :execute'd, or a - List of such Strings. The _pre hooks are executed before any - approximations have been done. In order to affect the approximation at - this stage, you would need to change the gui colors for a group; the cterm - colors will then be approximated from those gui colors. Example: -> - let g:CSApprox_hook_pre = 'hi Comment guibg=#ffddff' -< - The advantage to tweaking the colors at this stage is that CSApprox will - handle approximating the given gui colors to the proper cterm colors, - regardless of the number of colors the terminal supports. The - disadvantage is that certain things aren't possible, including clearing - the background or foreground color for a group, selecting a precise cterm - color to be used, and overriding the mappings made by g:CSApprox_attr_map. - Another notable disadvantage is that overriding things at this level will - actually affect the gui colors, in case the :gui is used to start gvim - from the running vim instance. - - To overcome these disadvantages, the _post hooks are provided. These - hooks will be executed only after all approximations have been completed. - At this stage, in order to have changes appear the cterm* colors must be - modified. For example: - *csapprox-transparency* -> - let g:CSApprox_hook_post = ['hi Normal ctermbg=NONE ctermfg=NONE', - \ 'hi NonText ctermbg=NONE ctermfg=NONE' ] -< - Setting g:CSApprox_hook_post as shown above will clear the background of - the Normal and NonText groups, forcing the terminal's default background - color to be used instead, including any pseudotransparency done by that - terminal emulator. As noted, though, the _post functions do not allow - CSApprox to approximate the colors. This may be desired, but if this is - an inconvenience the function named by g:CSApprox_approximator_function - can still be called manually. For example: -> - let g:CSApprox_hook_post = 'exe "hi Comment ctermbg="' - \ . '. g:CSApprox_approximator_function(0xA0,0x50,0x35)' -< - The _{scheme}_ versions are exactly like their counterparts, except that - they will only be executed if the value of g:colors_name matches the - scheme name embedded in the variable name. They will be executed after - the corresponding hook without _{scheme}_, which provides a way to - override a less specific hook with a more specific one. For example, to - clear the Normal and NonText groups, but only for the colorscheme - "desert", one could do the following: -> - let g:CSApprox_hook_desert_post = ['hi Normal ctermbg=NONE ctermfg=NONE', - \ 'hi NonText ctermbg=NONE ctermfg=NONE' ] -< - One final example: If you want CSApprox to be active for nearly all - colorschemes, but want one or two particular schemes to be ignored, you - can take advantage of the CSApprox logic that skips over any color scheme - that is already high color by setting a color to a number above 255. Note - that most colors greater than 15 will work, but some will not - 256 should - always work. For instance, you can prevent CSApprox from modifying the - colors of the zellner colorscheme like this: -> - let g:CSApprox_hook_zellner_pre = 'hi _FakeGroup ctermbg=256' -< - NOTE: Any characters that would stop the string stored in g:colors_name - from being a valid variable name will be removed before the - _{scheme}_ hook is searched. Basically, this means that first all - characters that are neither alphanumeric nor underscore will be - removed, then any leading digits will be removed. So, for a - colorscheme named "123 foo_bar-baz456.vim", the hook searched for - will be, eg, g:CSApprox_hook_foo_barbaz456_post - -g:CSApprox_use_showrgb *g:CSApprox_use_showrgb* - By default, CSApprox will use a built in mapping of color names to values. - This optimization greatly helps speed, but means that colors addressed by - name might not match up perfectly between gvim (which uses the system's - real rgb database) and CSApprox (which uses the builtin database). To - force CSApprox to try the systemwide database first, and only fall back on - the builtin database if it isn't available, set this variable non-zero. - -g:CSApprox_approximator_function *g:CSApprox_approximator_function* - If the default approximation function doesn't work well enough, the user - (or another author wishing to extend this plugin) can write another - approximation function. This function should take three numbers, - representing r, g, and b in decimal, and return the index on the color - cube that best matches those colors. Assigning a |Funcref| to this - variable will override the default approximator with the one the Funcref - references. This option will take effect at the time a snapshotted scheme - is created, rather than when it's used. - -g:CSApprox_redirfallback *g:CSApprox_redirfallback* - Until Vim 7.2.052, there was a bug in the Vim function synIDattr() that - made it impossible to determine syntax information about the |guisp| - attribute. CSApprox includes a workaround for this problem, as well as a - test that ought to disable this workaround if synIDattr() works properly. - If this test should happen to give improper results somehow, the user can - force the behavior with this variable. When set to 1, the workaround will - always be used, and when set to 0, synIDattr() is blindly used. Needless - to say, if this automatic detection should ever fail, the author would - like to be notified! This option will take effect at the time a - snapshotted scheme is created, rather than when it's used. - -============================================================================== -4. Rationale/Design *csapprox-design* - -There is a wealth of colorschemes available for Vim. Unfortunately, since -traditional terminal emulators have only supported 2, 8 or 16 colors, -colorscheme authors have tended to avoid writing colorschemes for terminal -Vim, sticking instead to GVim. Even now that nearly every popular terminal -supports either 88 or 256 colors, few colorschemes are written to support -them. This may be because the terminal color codes are just numbers from 0 to -87 or 255 with no semantic meaning, or because the same number doesn't yield -the same color in all terminals, or simply because the colorscheme author -doesn't use the terminal and doesn't want to take the time to support -terminals. - -Whatever the reason, this leaves users of many modern terminal emulators in -the awkward position of having a terminal emulator that supports many colors, -but having very few colorschemes that were written to utilize those colors. - -This is where CSApprox comes in. It attempts to fill this void allowing GVim -colorschemes to be used in terminal Vim. CSApprox has two distinct modes of -operation. In the first mode, it attempts to make GVim colorschemes -transparently backwards compatible with terminal Vim in a high color terminal. -Basically, whenever a colorscheme is run it should set some colors for the -GUI, and this script will then run and attempt to figure out the closest color -available in the terminal's color palette to the color the scheme author asked -for. Unfortunately, this does not work well all the time, and it has some -limitations (see |csapprox-limitations|). Most of the time, however, this -gives a very close approximation to the GVim colors without requiring any -changes to the colorscheme, or any user interaction. It only requires that -the plugin be installed on the machine where Vim is being run, and that the -user's environment meets the needs specified at |csapprox-requirements|. In -the event that this doesn't work, a second option - using :CSApproxSnapshot -to create a new, 88-/256-color capable colorscheme - is available. - -Ideally, the aim is for CSApprox to be completely transparent to the user. -This is why the approach I take is entirely different from the GuiColorScheme -script, which will break on any but the simplest colorschemes. Unfortunately, -given the difficulty of determining exactly which terminal emulator the user -is running, and what features it supports, and which color palette it's using, -perfect transparency is difficult. So, to this end, I've attempted to default -to settings that make it unlikely that this script ever makes things worse -(this is why I chose not to override t_Co to 256 myself), and I've attempted -to make it easy to override my choice of defaults when necessary (through -g:CSApprox_approximator_function, g:CSApprox_konsole, g:CSApprox_eterm, -g:CSApprox_attr_map, etc). - -In the event that the transparent solution is undesirable, or that the user's -environment can't be configured to allow it (no GVim and no Vim with +gui, for -instance), |:CSApproxSnapshot| should provide a workable alternative - less -cool, and less flexible, but it will work in more environments, and the -snapshotted colorscheme will even work in Vim 6. - -If any of my design choices seem to be causing extra work with no real -advantages, though, I'd like to hear about it. Feel free to email me with any -improvements or complaints. - -============================================================================== -5. Known Bugs and Limitations *csapprox-limitations* - -GUI support is required for transparently adapting schemes. - - There is nothing I can do about this given my chosen design. CSApprox works - by being notified every time a colorscheme sets some GUI colors, then - approximating those colors to similar terminal colors. Unfortunately, when - Vim is not built with GUI support, it doesn't bother to store the GUI - colors, so querying for them fails. This leaves me completely unable to - tell what the colorscheme was trying to do. See |csapprox-+gui| for some - potential workarounds if your distribution doesn't provide a Vim with +gui. - -User intervention is sometimes required for information about the terminal. - - This is really an insurmountable problem. Unfortunately, most terminal - emulators default to setting $TERM to 'xterm', even when they're not really - compatible with an xterm. $TERM is really the only reliable way to - find anything at all out about the terminal you're running in, so there's no - way to know if the terminal supports 88 or 256 colors without either the - terminal telling me (using $TERM) or the user telling me (using 't_Co'). - Similarly, unless $TERM is set to something that implies a certain color - palette ought to be used, there's no way for me to know, so I'm forced to - default to the most common, xterm's palette, and allow the user to override - my choice with |g:CSApprox_konsole| or |g:CSApprox_eterm|. An example of - configuring Vim to work around a terminal where $TERM is set to something - generic without configuring the terminal properly is shown at - |csapprox-terminal-example|. - -Some colorschemes could fail to be converted if they try to be too smart. - - A colorscheme could decide to only set colors for the mode Vim is running - in. If a scheme only sets GUI colors when the GUI is running, instead of - using the usual approach of setting all colors and letting Vim choose which - to use, my approach falls apart. My method for figuring out what the scheme - author wants the scheme to look like absolutely depends upon him setting the - GUI colors in all modes. Fortunately, the few colorschemes that do this - seem to be, by and large, intended for 256 color terminals already, meaning - that skipping them is the proper behavior. Note that this will only affect - transparently adapted schemes and snapshots made from terminal Vim; - snapshots made from GVim are immune to this problem. - -Transparently adapting schemes is slow. - - For me, it takes Vim's startup time from 0.15 seconds to 0.35 seconds. This - is probably still acceptable, but it is definitely worth trying to cut down - on this time in future versions. Snapshotted schemes are faster to use, - since all of the hard evaluations are made when they're made instead of when - they're used. - - NOTE: As of CSApprox 3.50, the overhead is down to about 0.10 seconds on my - test machine. - -============================================================================== -6. Appendix - Terminals and Palettes *csapprox-terminal-list* - -What follows is a list of terminals known to have and known not to have high -color support. This list is certainly incomplete; feel free to contact me -with more to add to either list. - - *csapprox-terminals-good* -------------------------------- Good Terminals ------------------------------- - -The most recent versions of each of these terminals can be compiled with -either 88 or 256 color support. - - *csapprox-xterm* -xterm: - 256 color palette - Colors composed of: [ 0x00, 0x5F, 0x87, 0xAF, 0xD7, 0xFF ] - Greys composed of: [ 0x08, 0x12, 0x1C, 0x26, 0x30, 0x3A, 0x44, 0x4E, - 0x58, 0x62, 0x6C, 0x76, 0x80, 0x8A, 0x94, 0x9E, - 0xA8, 0xB2, 0xBC, 0xC6, 0xD0, 0xDA, 0xE4, 0xEE ] - - *csapprox-urxvt* -rxvt-unicode (urxvt): - 88 colors by default (but a patch is available to use xterm's palette) - Colors composed of: [ 0x00, 0x8B, 0xCD, 0xFF ] - Greys composed of: [ 0x2E, 0x5C, 0x73, 0x8B, 0xA2, 0xB9, 0xD0, 0xE7 ] - - *csapprox-pterm* *csapprox-putty* -PuTTY (pterm; putty.exe): - 256 colors; same palette as xterm - - *csapprox-mrxvt* -Mrxvt (mrxvt): - 256 colors; same palette as xterm - - *csapprox-gnome-terminal* -GNOME Terminal (gnome-terminal): - 256 colors; same palette as xterm - - *csapprox-roxterm* -ROXTerm (roxterm): - 256 colors; same palette as xterm - - *csapprox-xfce4-terminal* -Terminal (xfce4-terminal): - 256 colors; same palette as xterm - - *csapprox-iterm.app* -iTerm (iTerm.app): - 256 colors; same palette as xterm - *csapprox-konsole* -Konsole (konsole): - 256 color palette - Colors composed of: [ 0x00, 0x33, 0x66, 0x99, 0xCC, 0xFF ] - Same greyscales as xterm - You should set the g:CSApprox_konsole variable unless $TERM begins with - 'konsole', case insensitive - - *csapprox-eterm* -eterm (Eterm): - 256 color palette - Colors composed of: [ 0x00, 0x2A, 0x55, 0x7F, 0xAA, 0xD4 ] - Same greyscales as xterm - You should set the g:CSApprox_eterm variable unless $TERM begins with - 'eterm', case insensitive - - *csapprox-screen* -GNU Screen (screen): - 256 color support. Internally, uses the xterm palette, but this is only - relevant when running screen inside a terminal with fewer than 256 colors, - in which case screen will attempt to map between its own 256 color cube - and the colors supported by the real terminal to the best of its ability, - in much the same way as CSApprox maps between GUI and terminal colors. - - *csapprox-terminals-bad* --------------------------------- Bad Terminals ------------------------------- -This is a list of terminals known _not_ to have high color support. If any of -these terminals have high color support added at some point in the future, -please tell me and I'll update this information. - - *csapprox-terminal.app* -Terminal.app (as of OS X 10.5.2) - - *csapprox-aterm* -aterm (as of version 1.00.01) - - *csapprox-xiterm* -xiterm (as of version 0.5) - - *csapprox-wterm* -wterm (as of version 6.2.9) - - *csapprox-mlterm* -mlterm (as of version 2.9.4) - - *csapprox-kterm* -kterm (as of version 6.2.0) - -============================================================================== -7. Changelog *csapprox-changelog* - - 3.50 01 Apr 2009 Fix a major regression that prevented the Eterm and - Konsole colors from being correctly snapshotted - - Fix a related bug causing incorrect terminal colors - after calling :CSApproxSnapshot - - Fix a bug causing black to be used instead of dark grey - - Have snapshots calculate g:colors_name programmatically - - Introduce many tweaks for better speed - - Clarify some things at :help csapprox-terminal-example - - Default to using our own list of rgb.txt colors rather - than searching, for performance. Add a new variable, - g:CSApprox_use_showrgb, which forces us to try finding - the colors using the "showrgb" program instead, and fall - back on our own list if it isn't available - - Remove g:CSApprox_extra_rgb_txt_dirs - not needed in - light of the above change - - 3.05 31 Jan 2009 Fix a harmless "Undefined variable" error in - :CSApproxSnapshot - - Fix a behavioral bug when dumping out colors defined - external to the scheme. - - 3.00 21 Jan 2009 Update the docs for better info on :CSApproxSnapshot - - Allow snapshotted schemes to work on Vim 6, and work - properly in Konsole and Eterm (thanks David Majnemer!) - - Fix a bug causing a syntax error when using GVim while - CSApprox was loaded. (thanks again, David Majnemer!) - - 2.00 14 Dec 2008 Add a hooks system, allowing users to specify a command - to run, either before or after the approximation - algorithm is run, for all schemes or one specific one. - - Also rewrite :CSApproxSnapshot to be more maintainable - and less of a hack, and fix several bugs that it - contained. - - 1.50 19 Nov 2008 Add CSApproxSnapshot command, as an alternative solution - when the user has gvim or a vim with gui support, but - sometimes needs to use a vim without gui support. - - 1.10 28 Oct 2008 Enable running on systems with no rgb.txt (Penn Su) - Begin distributing a copy of rgb.txt with CSApprox - - 1.00 04 Oct 2008 First public release - - 0.90 14 Sep 2008 Initial beta release - -============================================================================== -8. Contact Info *csapprox-author* - -Your author, a Vim nerd with some free time, was sick of seeing terminals -always get the short end of the stick. He'd like to be notified of any -problems you find - after all, he took the time to write all this lovely -documentation, and this plugin, which took more time than you could possibly -imagine to get working transparently for every colorscheme he could get his -hands on. You can contact him with any problems or praises at mjw@drexel.edu - -============================================================================== -vim:tw=78:fo=tcq2:isk=!-~,^*,^\|,^\":ts=8:ft=help:norl: diff --git a/files/.vim/doc/imaps.txt b/files/.vim/doc/imaps.txt deleted file mode 100644 index 087b3db..0000000 --- a/files/.vim/doc/imaps.txt +++ /dev/null @@ -1,116 +0,0 @@ - IMAP -- A fluid replacement for :imap - *imaps.txt* - Srinath Avadhanula - - - - Abstract - ======== -This plugin provides a function IMAP() which emulates vims |:imap| function. The -motivation for providing this plugin is that |:imap| suffers from problems -which get increasingly annoying with a large number of mappings. - -Consider an example. If you do > - imap lhs something - - -then a mapping is set up. However, there will be the following problems: -1. The 'ttimeout' option will generally limit how easily you can type the lhs. - if you type the left hand side too slowly, then the mapping will not be - activated. - -2. If you mistype one of the letters of the lhs, then the mapping is deactivated - as soon as you backspace to correct the mistake. - -3. The characters in lhs are shown on top of each other. This is fairly - distracting. This becomes a real annoyance when a lot of characters initiate - mappings. - -This script provides a function IMAP() which does not suffer from these -problems. - - - - *imaps.txt-toc* -|im_1| Using IMAP - -================================================================================ -Viewing this file - -This file can be viewed with all the sections and subsections folded to ease -navigation. By default, vim does not fold help documents. To create the folds, -press za now. The folds are created via a foldexpr which can be seen in the -last section of this file. - -See |usr_28.txt| for an introduction to folding and |fold-commands| for key -sequences and commands to work with folds. - -================================================================================ -Using IMAP *im_1* *imaps-usage* - - - -Each call to IMAP is made using the syntax: > - call IMAP (lhs, rhs, ft [, phs, phe]) - - -This is equivalent to having map to for all files of type . - -Some characters in the have special meaning which help in cursor placement -as described in |imaps-placeholders|. The optional arguments define these -special characters. - -Example One: > - call IMAP ("bit`", "\\begin{itemize}\\\item <++>\\\end{itemize}<++>", "tex") - - -This effectively sets up the map for "bit`" whenever you edit a latex file. When -you type in this sequence of letters, the following text is inserted: > - \begin{itemize} - \item * - \end{itemize}<++> - -where * shows the cursor position. The cursor position after inserting the text -is decided by the position of the first "place-holder". Place holders are -special characters which decide cursor placement and movement. In the example -above, the place holder characters are <+ and +>. After you have typed in the -item, press and you will be taken to the next set of <++>'s. Therefore by -placing the <++> characters appropriately, you can minimize the use of movement -keys. - -Set g:Imap_UsePlaceHolders to 0 to disable placeholders altogether. - -Set g:Imap_PlaceHolderStart and g:Imap_PlaceHolderEnd to something else if you -want different place holder characters. Also, b:Imap_PlaceHolderStart and -b:Imap_PlaceHolderEnd override the values of g:Imap_PlaceHolderStart and -g:Imap_PlaceHolderEnd respectively. This is useful for setting buffer specific -place holders. - -Example Two: You can use the command to insert dynamic elements such as -dates. > - call IMAP ('date`', "\=strftime('%b %d %Y')\", '') - - - -With this mapping, typing date` will insert the present date into the file. - -================================================================================ -About this file - -This file was created automatically from its XML variant using db2vim. db2vim is -a python script which understands a very limited subset of the Docbook XML 4.2 -DTD and outputs a plain text file in vim help format. - -db2vim can be obtained via anonymous CVS from sourceforge.net. Use - -cvs -d:pserver:anonymous@cvs.vim-latex.sf.net:/cvsroot/vim-latex co db2vim - -Or you can visit the web-interface to sourceforge CVS at: -http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/vim-latex/db2vim/ - -The following modelines should nicely fold up this help manual. - -vim:ft=help:fdm=expr:nowrap -vim:foldexpr=getline(v\:lnum-1)=~'-\\{80}'?'>2'\:getline(v\:lnum-1)=~'=\\{80}'?'>1'\:getline(v\:lnum)=~'=\\{80}'?'0'\:getline(v\:lnum)=~'-\\{80}'?'1'\:'=' -vim:foldtext=substitute(v\:folddashes.substitute(getline(v\:foldstart),'\\s*\\*.*',"",""),'^--','--\ \ \ \ ','') -================================================================================ diff --git a/files/.vim/doc/imaps.txt.gz b/files/.vim/doc/imaps.txt.gz deleted file mode 100644 index fbb8ea8..0000000 Binary files a/files/.vim/doc/imaps.txt.gz and /dev/null differ diff --git a/files/.vim/doc/matchit.txt b/files/.vim/doc/matchit.txt deleted file mode 100644 index 8a3a96e..0000000 --- a/files/.vim/doc/matchit.txt +++ /dev/null @@ -1,406 +0,0 @@ -*matchit.txt* Extended "%" matching - -For instructions on installing this file, type - :help matchit-install -inside Vim. - -For Vim version 6.3. Last change: 2007 Aug 29 - - - VIM REFERENCE MANUAL by Benji Fisher - -*matchit* *matchit.vim* - -1. Extended matching with "%" |matchit-intro| -2. Activation |matchit-activate| -3. Configuration |matchit-configure| -4. Supporting a New Language |matchit-newlang| -5. Known Bugs and Limitations |matchit-bugs| - -The functionality mentioned here is a plugin, see |add-plugin|. -This plugin is only available if 'compatible' is not set. -You can avoid loading this plugin by setting the "loaded_matchit" variable -in your |vimrc| file: > - :let loaded_matchit = 1 - -{Vi does not have any of this} - -============================================================================== -1. Extended matching with "%" *matchit-intro* - - *matchit-%* -% Cycle forward through matching groups, such as "if", "else", "endif", - as specified by |b:match_words|. - - *g%* *v_g%* *o_g%* -g% Cycle backwards through matching groups, as specified by - |b:match_words|. For example, go from "if" to "endif" to "else". - - *[%* *v_[%* *o_[%* -[% Go to [count] previous unmatched group, as specified by - |b:match_words|. Similar to |[{|. - - *]%* *v_]%* *o_]%* -]% Go to [count] next unmatched group, as specified by - |b:match_words|. Similar to |]}|. - - *v_a%* -a% In Visual mode, select the matching group, as specified by - |b:match_words|, containing the cursor. Similar to |v_a[|. - A [count] is ignored, and only the first character of the closing - pattern is selected. - -In Vim, as in plain vi, the percent key, |%|, jumps the cursor from a brace, -bracket, or paren to its match. This can be configured with the 'matchpairs' -option. The matchit plugin extends this in several ways: - - You can match whole words, such as "if" and "endif", not just - single characters. You can also specify a |regular-expression|. - You can define groups with more than two words, such as "if", - "else", "endif". Banging on the "%" key will cycle from the "if" to - the first "else", the next "else", ..., the closing "endif", and back - to the opening "if". Nested structures are skipped. Using |g%| goes - in the reverse direction. - By default, words inside comments and strings are ignored, unless - the cursor is inside a comment or string when you type "%". If the - only thing you want to do is modify the behavior of "%" so that it - behaves this way, you do not have to define |b:match_words|, since the - script uses the 'matchpairs' option as well as this variable. - -See |matchit-details| for details on what the script does, and |b:match_words| -for how to specify matching patterns. - -MODES: *matchit-modes* *matchit-v_%* *matchit-o_%* - -Mostly, % and related motions (|g%| and |[%| and |]%|) work just like built-in -|motion| commands in |Operator-pending| and |Visual| modes. However, you -cannot make these motions |linewise| or |characterwise|, since the |:omap|s -that define them start with "v" in order to make the default behavior -inclusive. (See |o_v|.) In other words, "dV%" will not work. The -work-around is to go through Visual mode: "V%d" will work. - -LANGUAGES: *matchit-languages* - -Currently, the following languages are supported: Ada, ASP with VBS, Csh, -DTD, Entity, Essbase, Fortran, HTML, JSP (same as HTML), LaTeX, Lua, Pascal, -SGML, Shell, Tcsh, Vim, XML. Other languages may already have support via -the default |filetype-plugin|s in the standard vim distribution. - -To support a new language, see |matchit-newlang| below. - -DETAILS: *matchit-details* *matchit-parse* - -Here is an outline of what matchit.vim does each time you hit the "%" key. If -there are |backref|s in |b:match_words| then the first step is to produce a -version in which these back references have been eliminated; if there are no -|backref|s then this step is skipped. This step is called parsing. For -example, "\(foo\|bar\):end\1" is parsed to yield -"\(foo\|bar\):end\(foo\|bar\)". This can get tricky, especially if there are -nested groups. If debugging is turned on, the parsed version is saved as -|b:match_pat|. - - *matchit-choose* -Next, the script looks for a word on the current line that matches the pattern -just constructed. It includes the patterns from the 'matchpairs' option. -The goal is to do what you expect, which turns out to be a little complicated. -The script follows these rules: - - Insist on a match that ends on or after the cursor. - Prefer a match that includes the cursor position (that is, one that - starts on or before the cursor). - Prefer a match that starts as close to the cursor as possible. - If more than one pattern in |b:match_words| matches, choose the one - that is listed first. - -Examples: - - Suppose you > - :let b:match_words = '<:>,:' -< and hit "%" with the cursor on or before the "<" in "a is born". - The pattern '<' comes first, so it is preferred over '', which - also matches. If the cursor is on the "t", however, then '' is - preferred, because this matches a bit of text containing the cursor. - If the two groups of patterns were reversed then '<' would never be - preferred. - - Suppose you > - :let b:match_words = 'if:end if' -< (Note the space!) and hit "%" with the cursor at the end of "end if". - Then "if" matches, which is probably not what you want, but if the - cursor starts on the "end " then "end if" is chosen. (You can avoid - this problem by using a more complicated pattern.) - -If there is no match, the cursor does not move. (Before version 1.13 of the -script, it would fall back on the usual behavior of |%|). If debugging is -turned on, the matched bit of text is saved as |b:match_match| and the cursor -column of the start of the match is saved as |b:match_col|. - -Next, the script looks through |b:match_words| (original and parsed versions) -for the group and pattern that match. If debugging is turned on, the group is -saved as |b:match_ini| (the first pattern) and |b:match_tail| (the rest). If -there are |backref|s then, in addition, the matching pattern is saved as -|b:match_word| and a table of translations is saved as |b:match_table|. If -there are |backref|s, these are determined from the matching pattern and -|b:match_match| and substituted into each pattern in the matching group. - -The script decides whether to search forwards or backwards and chooses -arguments for the |searchpair()| function. Then, the cursor is moved to the -start of the match, and |searchpair()| is called. By default, matching -structures inside strings and comments are ignored. This can be changed by -setting |b:match_skip|. - -============================================================================== -2. Activation *matchit-activate* - -You can use this script as a plugin, by copying it to your plugin directory. -See |add-global-plugin| for instructions. You can also add a line to your -|vimrc| file, such as > - :source $VIMRUNTIME/macros/matchit.vim -or > - :runtime macros/matchit.vim -Either way, the script should start working the next time you start up Vim. - -(Earlier versions of the script did nothing unless a |buffer-variable| named -|b:match_words| was defined. Even earlier versions contained autocommands -that set this variable for various file types. Now, |b:match_words| is -defined in many of the default |filetype-plugin|s instead.) - -For a new language, you can add autocommands to the script or to your vimrc -file, but the recommended method is to add a line such as > - let b:match_words = '\:\' -to the |filetype-plugin| for your language. See |b:match_words| below for how -this variable is interpreted. - -TROUBLESHOOTING *matchit-troubleshoot* - -The script should work in most installations of Vim. It may not work if Vim -was compiled with a minimal feature set, for example if the |+syntax| option -was not enabled. If your Vim has support for syntax compiled in, but you do -not have |syntax| highlighting turned on, matchit.vim should work, but it may -fail to skip matching groups in comments and strings. If the |filetype| -mechanism is turned off, the |b:match_words| variable will probably not be -defined automatically. - -============================================================================== -3. Configuration *matchit-configure* - -There are several variables that govern the behavior of matchit.vim. Note -that these are variables local to the buffer, not options, so use |:let| to -define them, not |:set|. Some of these variables have values that matter; for -others, it only matters whether the variable has been defined. All of these -can be defined in the |filetype-plugin| or autocommand that defines -|b:match_words| or "on the fly." - -The main variable is |b:match_words|. It is described in the section below on -supporting a new language. - - *MatchError* *matchit-hl* *matchit-highlight* -MatchError is the highlight group for error messages from the script. By -default, it is linked to WarningMsg. If you do not want to be bothered by -error messages, you can define this to be something invisible. For example, -if you use the GUI version of Vim and your command line is normally white, you -can do > - :hi MatchError guifg=white guibg=white -< - *b:match_ignorecase* -If you > - :let b:match_ignorecase = 1 -then matchit.vim acts as if 'ignorecase' is set: for example, "end" and "END" -are equivalent. If you > - :let b:match_ignorecase = 0 -then matchit.vim treats "end" and "END" differently. (There will be no -b:match_infercase option unless someone requests it.) - - *b:match_debug* -Define b:match_debug if you want debugging information to be saved. See -|matchit-debug|, below. - - *b:match_skip* -If b:match_skip is defined, it is passed as the skip argument to -|searchpair()|. This controls when matching structures are skipped, or -ignored. By default, they are ignored inside comments and strings, as -determined by the |syntax| mechanism. (If syntax highlighting is turned off, -nothing is skipped.) You can set b:match_skip to a string, which evaluates to -a non-zero, numerical value if the match is to be skipped or zero if the match -should not be skipped. In addition, the following special values are -supported by matchit.vim: - s:foo becomes (current syntax item) =~ foo - S:foo becomes (current syntax item) !~ foo - r:foo becomes (line before cursor) =~ foo - R:foo becomes (line before cursor) !~ foo -(The "s" is meant to suggest "syntax", and the "r" is meant to suggest -"regular expression".) - -Examples: - - You can get the default behavior with > - :let b:match_skip = 's:comment\|string' -< - If you want to skip matching structures unless they are at the start - of the line (ignoring whitespace) then you can > - :let b:match_skip = 'R:^\s*' -< Do not do this if strings or comments can span several lines, since - the normal syntax checking will not be done if you set b:match_skip. - - In LaTeX, since "%" is used as the comment character, you can > - :let b:match_skip = 'r:%' -< Unfortunately, this will skip anything after "\%", an escaped "%". To - allow for this, and also "\\%" (an excaped backslash followed by the - comment character) you can > - :let b:match_skip = 'r:\(^\|[^\\]\)\(\\\\\)*%' -< - See the $VIMRUNTIME/ftplugin/vim.vim for an example that uses both - syntax and a regular expression. - -============================================================================== -4. Supporting a New Language *matchit-newlang* - *b:match_words* -In order for matchit.vim to support a new language, you must define a suitable -pattern for |b:match_words|. You may also want to set some of the -|matchit-configure| variables, as described above. If your language has a -complicated syntax, or many keywords, you will need to know something about -Vim's |regular-expression|s. - -The format for |b:match_words| is similar to that of the 'matchpairs' option: -it is a comma (,)-separated list of groups; each group is a colon(:)-separated -list of patterns (regular expressions). Commas and backslashes that are part -of a pattern should be escaped with backslashes ('\:' and '\,'). It is OK to -have only one group; the effect is undefined if a group has only one pattern. -A simple example is > - :let b:match_words = '\:\,' - \ . '\:\:\:\' -(In Vim regular expressions, |\<| and |\>| denote word boundaries. Thus "if" -matches the end of "endif" but "\" does not.) Then banging on the "%" -key will bounce the cursor between "if" and the matching "endif"; and from -"while" to any matching "continue" or "break", then to the matching "endwhile" -and back to the "while". It is almost always easier to use |literal-string|s -(single quotes) as above: '\' rather than "\\" and so on. - -Exception: If the ":" character does not appear in b:match_words, then it is -treated as an expression to be evaluated. For example, > - :let b:match_words = 'GetMatchWords()' -allows you to define a function. This can return a different string depending -on the current syntax, for example. - -Once you have defined the appropriate value of |b:match_words|, you will -probably want to have this set automatically each time you edit the -appropriate file type. The recommended way to do this is by adding the -definition to a |filetype-plugin| file. - -Tips: Be careful that your initial pattern does not match your final pattern. -See the example above for the use of word-boundary expressions. It is usually -better to use ".\{-}" (as many as necessary) instead of ".*" (as many as -possible). See |\{-|. For example, in the string "label", "<.*>" -matches the whole string whereas "<.\{-}>" and "<[^>]*>" match "" and -"". - - *matchit-spaces* *matchit-s:notend* -If "if" is to be paired with "end if" (Note the space!) then word boundaries -are not enough. Instead, define a regular expression s:notend that will match -anything but "end" and use it as follows: > - :let s:notend = '\%(\:\' -< *matchit-s:sol* -This is a simplified version of what is done for Ada. The s:notend is a -|script-variable|. Similarly, you may want to define a start-of-line regular -expression > - :let s:sol = '\%(^\|;\)\s*' -if keywords are only recognized after the start of a line or after a -semicolon (;), with optional white space. - - *matchit-backref* *matchit-\1* -In any group, the expressions |\1|, |\2|, ..., |\9| refer to parts of the -INITIAL pattern enclosed in |\(|escaped parentheses|\)|. These are referred -to as back references, or backrefs. For example, > - :let b:match_words = '\:\(h\)\1\>' -means that "bo" pairs with "ho" and "boo" pairs with "hoo" and so on. Note -that "\1" does not refer to the "\(h\)" in this example. If you have -"\(nested \(parentheses\)\) then "\d" refers to the d-th "\(" and everything -up to and including the matching "\)": in "\(nested\(parentheses\)\)", "\1" -refers to everything and "\2" refers to "\(parentheses\)". If you use a -variable such as |s:notend| or |s:sol| in the previous paragraph then remember -to count any "\(" patterns in this variable. You do not have to count groups -defined by |\%(\)|. - -It should be possible to resolve back references from any pattern in the -group. For example, > - :let b:match_words = '\(foo\)\(bar\):more\1:and\2:end\1\2' -would not work because "\2" cannot be determined from "morefoo" and "\1" -cannot be determined from "andbar". On the other hand, > - :let b:match_words = '\(\(foo\)\(bar\)\):\3\2:end\1' -should work (and have the same effect as "foobar:barfoo:endfoobar"), although -this has not been thoroughly tested. - -You can use |zero-width| patterns such as |\@<=| and |\zs|. (The latter has -not been thouroughly tested in matchit.vim.) For example, if the keyword "if" -must occur at the start of the line, with optional white space, you might use -the pattern "\(^\s*\)\@<=if" so that the cursor will end on the "i" instead of -at the start of the line. For another example, if HTML had only one tag then -one could > - :let b:match_words = '<:>,<\@<=tag>:<\@<=/tag>' -so that "%" can bounce between matching "<" and ">" pairs or (starting on -"tag" or "/tag") between matching tags. Without the |\@<=|, the script would -bounce from "tag" to the "<" in "", and another "%" would not take you -back to where you started. - -DEBUGGING *matchit-debug* *:MatchDebug* - -If you are having trouble figuring out the appropriate definition of -|b:match_words| then you can take advantage of the same information I use when -debugging the script. This is especially true if you are not sure whether -your patterns or my script are at fault! To make this more convenient, I have -made the command :MatchDebug, which defines the variable |b:match_debug| and -creates a Matchit menu. This menu makes it convenient to check the values of -the variables described below. You will probably also want to read -|matchit-details| above. - -Defining the variable |b:match_debug| causes the script to set the following -variables, each time you hit the "%" key. Several of these are only defined -if |b:match_words| includes |backref|s. - - *b:match_pat* -The b:match_pat variable is set to |b:match_words| with |backref|s parsed. - *b:match_match* -The b:match_match variable is set to the bit of text that is recognized as a -match. - *b:match_col* -The b:match_col variable is set to the cursor column of the start of the -matching text. - *b:match_wholeBR* -The b:match_wholeBR variable is set to the comma-separated group of patterns -that matches, with |backref|s unparsed. - *b:match_iniBR* -The b:match_iniBR variable is set to the first pattern in |b:match_wholeBR|. - *b:match_ini* -The b:match_ini variable is set to the first pattern in |b:match_wholeBR|, -with |backref|s resolved from |b:match_match|. - *b:match_tail* -The b:match_tail variable is set to the remaining patterns in -|b:match_wholeBR|, with |backref|s resolved from |b:match_match|. - *b:match_word* -The b:match_word variable is set to the pattern from |b:match_wholeBR| that -matches |b:match_match|. - *b:match_table* -The back reference '\'.d refers to the same thing as '\'.b:match_table[d] in -|b:match_word|. - -============================================================================== -5. Known Bugs and Limitations *matchit-bugs* - -Just because I know about a bug does not mean that it is on my todo list. I -try to respond to reports of bugs that cause real problems. If it does not -cause serious problems, or if there is a work-around, a bug may sit there for -a while. Moral: if a bug (known or not) bothers you, let me know. - -The various |:vmap|s defined in the script (%, |g%|, |[%|, |]%|, |a%|) may -have undesired effects in Select mode |Select-mode-mapping|. At least, if you -want to replace the selection with any character in "ag%[]" there will be a -pause of |'updatetime'| first. - -It would be nice if "\0" were recognized as the entire pattern. That is, it -would be nice if "foo:\end\0" had the same effect as "\(foo\):\end\1". I may -try to implement this in a future version. (This is not so easy to arrange as -you might think!) - -============================================================================== -vim:tw=78:fo=tcq2: diff --git a/files/.vim/doc/project.txt b/files/.vim/doc/project.txt deleted file mode 100644 index 8f85c23..0000000 --- a/files/.vim/doc/project.txt +++ /dev/null @@ -1,710 +0,0 @@ -*project.txt* Plugin for managing multiple projects with multiple sources - For Vim version 6.x and Vim version 7.x. - Last Change: Fri 13 Oct 2006 10:20:13 AM EDT - - - By Aric Blumer - aricvim email-at-sign charter.net - - *project* *project-plugin* - Contents: - - Commands...................|project-invoking| - Inheritance.............|project-inheritance| - Mappings...................|project-mappings| - Adding Mappings.....|project-adding-mappings| - Settings...................|project-settings| - Example File................|project-example| - Tips...........................|project-tips| - - -You can use this plugin's basic functionality to set up a list of -frequently-accessed files for easy navigation. The list of files will be -displayed in a window on the left side of the Vim window, and you can press - or double-click on filenames in the list to open the files. I find -this easier to use than having to navigate a directory hierarchy with the -|file-explorer|. - -You can also instruct the Plugin to change to a directory and to run Vim -scripts when you select a file. These scripts can, for example, modify the -environment to include compilers in $PATH. This makes it very easy to use -quickfix with multiple projects that use different environments. - -Other features include: - o Loading/Unloading all the files in a Project (\l, \L, \w, and \W) - o Grepping all the files in a Project (\g and \G) - o Running a user-specified script on a file (can be used to launch an - external program on the file) (\1 through \9) - o Running a user-specified script on all the files in a Project - (\f1-\f9 and \F1-\F9) - o High degree of user-configurability - o Also works with |netrw| using the XXXX://... notation where XXXX is - ftp, rcp, scp, or http. - -All of this is specified within a simple text file and a few global variables -in your vimrc file. - -You must set 'nocompatible' in your |vimrc| file to use this plugin. You can -stop the plugin from being loaded by setting the "loaded_project" variable: > - :let loaded_project = 1 - - -============================================================================== -COMMANDS *project-invoking* - -You can use the plugin by placing it in your plugin directory (e.g., -~/.vim/plugin). See |add-global-plugin|. When you start vim the next time, you -then enter the command > - :Project -or > - :Project {file} - -If you do not specify the filename, $HOME/.vimprojects is used. - -To have Vim come up with the Project Window enabled automatically (say, from a -GUI launcher), run Vim like this: [g]vim +Project - -Note that you can invoke :Project on only one file at a time. If you wish to -change the Project File, do a :bwipe in the Project Buffer, then re-invoke the -Plugin as described above. - -Several Projects can be kept and displayed in the same file, each in a fold -delimited by { and } (see |fold.txt|). There can be any number of nested -folds to provide you with a Project hierarchy. Any line without a { or a } in -the file is considered to be a filename. Blank lines are ignored, and any -text after a # is ignored. - -Because the plugin uses standard Vim folds, you can use any of the -|fold-commands|. You can double-click on the first line of a fold to open and -close it. You can select a file to open by putting the cursor on its name and -pressing or by double-clicking on it. The plugin will create a new -window to the right or use the |CTRL-W_p| equivalent if it exists. - - *project-syntax* -Each Project Entry has this form: - -project_entry ::= - ={projpath} [{options}] { - [ filename ] - [ project_entry ] - } - -{options} is one or more of the following (on the same line): - CD={path} - in={filename} - out={filename} - filter="{pat}" - flags={flag} - -Note that a project_entry can reside within a project_entry. This allows you -to set up a hierarchy within your Project. - -The will be displayed in the foldtext and cannot contain "=". -There can be no space character directly on either side of the =. - -The {projpath} is the path in which the files listed in the Project's fold -will be found, and it may contain environment variables. If the path is a -relative path, then the plugin constructs the whole path from the Project's -parent, grandparent, etc., all the way up the hierarchy. An outermost -project_entry must have an absolute path. See the |project-inheritance| -example below. {projpath} may contain spaces, but they must be escaped like -normal Vim escapes. Here are two examples of the same directory: -> - Example=/my/directory/with\ spaces { - } - Example="/my/directory/with spaces" { - } - -I recommend this for Windows®: > - - Example="c:\My Documents" { - } - -But Vim is smart enough to do this, too: > - - Example=c:\My\ Documents { - } - -CD= provides the directory that Vim will change to when you select a file in -that fold (using |:cd|). This allows you, for example, to enter |:make| to use -the local Makefile. A CD=. means that Vim will make {projpath} or its -inherited equivalent the current working directory. When CD is omitted, the -directory is not changed. There can be no space on either side of the =. The -value of CD can also be a relative path from a parent's CD. See the -|project-inheritance| example below. This directive is ignored for |netrw| -projects. Spaces are allowed in the path as for {projpath}. - -in= and out= provide the means to run arbitrary Vim scripts whenever you enter -or leave a file's buffer (see the |BufEnter| and |BufLeave| autocommand -events). The idea is to have a Vim script that sets up or tears down the -environment for the Project like this: - -in.vim: > - let $PROJECT_HOME='~/my_project' - " Put the compiler in $PATH - if $PATH !~ '/path/to/my/compiler' - let $PATH=$PATH.':/path/to/my/compiler' - endif - -out.vim: > - " Remove compiler from $PATH - if $PATH =~ '/path/to/my/compiler' - let $PATH=substitute($PATH, ':/path/to/my/compiler', '', 'g') - endif - -Then you can use :make with the proper environment depending on what file you -are currently editing. If the path to the script is relative, then it is -relative from {projpath}. These directives are inherited by Subprojects -unless the Subproject specifies its own. For use with |netrw| projects, the -paths specified for in= and out= must be absolute and local. - -filter= specifies a |glob()| file pattern. It is used to regenerate the list -of files in a Project fold when using the \r (r) map in the -Project Window. The filter value must be in quotes because it can contain -multiple file patterns. If filter is omitted, then the * pattern is used. -There can be no space on either side of the =. A Subproject will inherit the -filter of its parent unless it specifies its own filter. - -flags= provides the means to enable/disable features for a particular fold. -The general mnemonic scheme is for lower case to turn something off and upper -case to turn something on. {flag} can contain any of the following -characters: - - flag Description ~ - - l Turn off recursion for this fold for \L. Subfolds are also - blocked from the recursion. - - r Turn off refresh. When present, do not refresh this fold when - \r or \R is used. This does not affect subfold recursion. - - S Turn on sorting for refresh and create. - - s Turn off sorting for refresh and create. - - T Turn on top gravity. Forces folds to the top of the current - fold when refreshing. It has the same affect as the 'T' flag - in g:proj_flags, but controls the feature on a per-fold basis. - - t Turn off top gravity. Forces folds to the bottom of the - current fold when refreshing. - - w Turn off recursion for this fold for \W. Subfolds are also - blocked from the recursion. - - -Flags are not inherited by Subprojects. - -Any text outside a fold is ignored. - - -============================================================================== -INHERITANCE *project-inheritance* - -It's best to show inheritance by comparing these two Project Files: -> - Parent=~/my_project CD=. filter="Make* *.mk" flags=r { - Child1=c_code { - } - Child2=include CD=. filter="*.h" { - } - } - -Child1's path is "~/my_project/c_code" because ~/my_project is inherited. It -also inherits the CD from Parent. Since Parent has CD=., the Parent's cwd is -"~/my_project". Child1 therefore inherits a CD of "~/my_project". Finally, -Child1 inherits the filter from Parent. The flags are not inherited. - -Child2 only inherits the "~/my_project" from Parent. - -Thus, the example above is exactly equivalent to this: -> - Parent=~/my_project CD=. filter="Make* *.mk" flags=r { - Child1=~/my_project/c_code CD=~/my_project filter="Make* *.mk" { - } - Child2=~/my_project/include CD=~/my_project/include filter="*.h" { - } - } - -(For a real Project, Child1 would not want to inherit its parent's filter, but -this example shows the concept.) You can always enter \i to display what the -cursor's project inherits. - - -============================================================================== -MAPPINGS *project-mappings* - -Map Action ~ - -\r Refreshes the Project fold that the cursor is in by placing in the - fold all the files that match the filter. The Project is refreshed - using an indent of one space for every foldlevel in the hierarchy. - - You may place a "# pragma keep" (without the quotes) at the end of a - line, and the file entry on that line will not be removed when you - refresh. This is useful, for example, when you have . as an entry so - you can easily browse the directory. - - Note that this mapping is actually r, and the default of - || is \. - - This does not work for Projects using |netrw|. - -\R Executes \r recursively in the current fold and all folds below. - This does not work for Projects using |netrw|. - -\c Creates a Project fold entry. It asks for the description, the path - to the files, the CD parameter, and the filename |glob()| pattern. - From this information, it will create the Project Entry below the - cursor. - - This does not work for Projects using |netrw|. - -\C Creates a Project fold entry like \c, but recursively includes all the - subdirectories. - - - Select a file to open in the |CTRL-W_p| window or in a new window. If - the cursor is on a fold, open or close it. - - -\s - Same as but horizontally split the target window. - s is provided for those terminals that don't recognize - . - -\S - Load all files in a project by doing horizontal splits. - - -\o - Same as but ensure that the opened file is the only other - window. o is provided for those terminals that don't - recognize . - - -\v - Same as but only display the file--the cursor stays in the - Project Window. - -<2-LeftMouse> - (Double-click) If on a closed fold, open it. If on an open fold - boundary, close it. If on a filename, open the file in the |CTRL-W_p| - window or in a new window. - - - Same as . - - - Same as . - - - Increase the width of the Project Window by g:proj_window_increment or - toggle between a width of - g:proj_window_width + g:proj_window_increment - and - g:proj_window_width. - - Whether you toggle or monotonically increase the width is determined - by the 't' flag of the g:proj_flags variable (see |project-flags|). - - Note that a Right Mouse click will not automatically place the cursor - in the Project Window if it is in a different window. The window will - go back to the g:proj_window_width width when you leave the window. - - Same as - - -\ - Move the text or fold under the cursor up one row. This may not work - in a terminal because the terminal is unaware of this key combination. - is provided for those terminals that don't recognize - . - - - -\ - Move the text or fold under the cursor down one row. This may not work - in a terminal because the terminal is unaware of this key combination. - is provided for those terminals that don't - recognize . - -\i Show in the status line the completely resolved and inherited - parameters for the fold the cursor is in. This is intended for - debugging your relative path and inherited parameters for manually - entered Projects. - -\I Show in the status line the completely resolved filename. Uses the - Project_GetFname(line('.')) function. - -\1 - \9 - Run the command specified in g:proj_run{x} where {x} is the number - of the key. See the documentation of g:proj_run1 below. - -\f1-\f9 - Run the command specified in g:proj_run_fold{x} where {x} is the - number of the key. The command is run on the files at the current - Project level. See the |project-settings| below. - -\F1-\F9 - Run the command specified in g:proj_run_fold{x} where {x} is the - number of the key. The command is run on the files at the current - Project level and all Subprojects. See the |project-settings| below. - -\0 Display the commands that are defined for \1 through \9. - -\f0 Display the commands that are defined for \f1 through \f9 and \F1 - through \F0. Same as \F0. - -\l Load all the files in the current Project level into Vim. While files - are being loaded, you may press any key to stop. - -\L Load all the files in the current Project and all Subprojects into - Vim. Use this mapping with caution--I wouldn't suggest using \L to - load a Project with thousands of files. (BTW, my Project file has more - than 5,300 files in it!) While files are being loaded, you may press - any key to stop. - -\w Wipe all the files in the current Project level from Vim. (If files - are modified, they will be saved first.) While files are being wiped, - you may press any key to stop. - -\W Wipe all the files in the current Project and all Subprojects from - Vim. (If files are modified, they will be saved first.) While files - are being wiped, you may press any key to stop. - -\g Grep all the files in the current Project level. - -\G Grep all the files in the current Project level and all Subprojects. - -\e Set up the Environment for the Project File as though you had selected - it with . This allows you to do a \e and a :make without - having to open any files in the project. - -\E Explore (using |file-explorer|) the directory of the project the - cursor is in. Does not work with netrw. - - When the 'g' flag is present in g:proj_flags (see |project-flags|) - this key toggles the Project Window open and closed. You may remap - this toggle function by putting the following in your vimrc and - replacing P with whatever key combination you wish: - - nmap P ToggleProject - -Note that the Project Plugin remaps :help because the Help Window and the -Project Window get into a fight over placement. The mapping avoids the -problem. - -============================================================================== -ADDING MAPPINGS *project-adding-mappings* - -You can add your own mappings or change the mappings of the plugin by placing -them in the file $HOME/.vimproject_mappings. This file, if it exists, will be -sourced when the plugin in loaded. Here is an example that will count the -number of entries in a project when you press \K (Kount, C is taken :-): > - - function! s:Wc() - let b:loadcount=0 - function! SpawnExec(infoline, fname, lineno, data) - let b:loadcount = b:loadcount + 1 - if getchar(0) != 0 | let b:stop_everything=1 | endif - endfunction - call Project_ForEach(1, line('.'), "*SpawnExec", 0, '') - delfunction SpawnExec - echon b:loadcount." Files\r" - unlet b:loadcount - if exists("b:stop_everything") - unlet b:stop_everything - echon "Aborted.\r" - endif - endfunction - - nnoremap K :call Wc() - -Here's another example of how I integrated the use of perforce with the plugin -in my $HOME/.vimproject_mappings: -> - function! s:DoP4(cmd) - let name=Project_GetFname(line('.')) - let dir=substitute(name, '\(.*\)/.*', '\1', 'g') - exec 'cd '.dir - exec "!".a:cmd.' '.Project_GetFname(line('.')) - cd - - endfunction - - nmap \pa :call DoP4("p4add") - nmap \pe :call DoP4("p4edit") -< -(Note that I CD to the directory the file is in so I can pick of the $P4CONFIG -file. See the perforce documentation.) - -This creates the mappings \pe to check out the file for edit and \pa to add -the file to the depot. - -Here is another example where I remap the mapping to use an external -program to launch a special kind of file (in this case, it launches ee to view -a jpg file). It is a bit contrived, but it works. -> - let s:sid = substitute(maparg('', 'n'), '.*\(.\{-}\)_.*', '\1', '') - function! s:LaunchOrWhat() - let fname=Project_GetFname(line('.')) - if fname =~ '\.jpg$' - exec 'silent! !ee "'.fname.'"&' - else - call {s:sid}_DoFoldOrOpenEntry('', 'e') - endif - endfunction - nnoremap \|:call LaunchOrWhat() -< -If the file ends in .jpg, the external program is launched, otherwise the -original mapping of is run. - -============================================================================== -SETTINGS *project-settings* - -You can set these variables in your vimrc file before the plugin is loaded to -change its default behavior - -g:proj_window_width - The width of the Project Window that the plugin attempts to maintain. - Default: 24 - - The Project Plugin is not always successful in keeping the window - where I want it with the size specified here, but it does a decent - job. - -g:proj_window_increment - The increment by which to increase the width of the Project Window - when pressing or clicking the . Default: 100 - (See |project-mappings|.) - - *project-flags* -g:proj_flags - Default: "imst" - Various flags to control the behavior of the Project Plugin. This - variable can contain any of the following character flags. - - flag Description ~ - - b When present, use the |browse()| when selecting directories - for \c and \C. This is off by default for Windows, because - the windows browser does not allow you to select directories. - - c When present, the Project Window will automatically close when - you select a file. - - F Float the Project Window. That is, turn off automatic - resizing and placement. This allows placement between other - windows that wish to share similar placement at the side of - the screen. It is also particularly helpful for external - window managers. - - g When present, the mapping for will be created to toggle - the Project Window open and closed. - - i When present, display the filename and the current working - directory in the command line when a file is selected for - opening. - - l When present, the Project Plugin will use the |:lcd| command - rather than |:cd| to change directories when you select a file - to open. This flag is really obsolete and not of much use - because of L below. - - L Similar to l, but install a BufEnter/Leave |:autocommand| to - ensure that the current working directory is changed to the - one specified in the fold CD specification whenever that - buffer is active. (|:lcd| only changes the CWD for a window, - not a buffer.) - - m Turn on mapping of the |CTRL-W_o| and |CTRL-W_CTRL_O| normal - mode commands to make the current buffer the only visible - buffer, but keep the Project Window visible, too. - - n When present, numbers will be turned on for the project - window. - - s When present, the Project Plugin will use syntax highlighting - in the Project Window. - - S Turn on sorting for refresh and create. - - t When present, toggle the size of the window rather than just - increase the size when pressing or right-clicking. - See the entry for in |project-mappings|. - - T When present, put Subproject folds at the top of the fold when - refreshing. - - v When present, use :vimgrep rather than :grep when using \G. - -g:proj_run1 ... g:proj_run9 - Contains a Vim command to execute on the file. See the - mappings of \1 to \9 above. - - %f is replaced with the full path and filename - %F is replaced with the full path and filename with spaces - quoted - %n is replaced with the filename alone - %N is replaced with the filename alone with spaces quoted - %h is replaced with the home directory - %H is replaced with the home directory with spaces quoted - %r is replaced with the directory relative to the CD path - %R is replaced with the directory relative to the CD path - with spaces quoted - %d is replaced with the CD directory. - %D is replaced with the CD directory.with spaces quoted - %% is replaced with a single % that is not used in - expansion. - - (Deprecated: %s is also replaced with the full path and - filename for backward compatibility.) - - For example, gvim will be launched on the file under the - cursor when you enter \3 if the following is in your vimrc - file: > - let g:proj_run3='silent !gvim %f' -< Here are a few other examples: > - let g:proj_run1='!p4 edit %f' - let g:proj_run2='!p4 add %f' - let g:proj_run4="echo 'Viewing %f'|sil !xterm -e less %f &" -< - On Windows systems you will want to put the %f, %h, and %d in - single quotes to avoid \ escaping. - -g:proj_run_fold1 ... g:proj_run_fold9 - Contains a Vim command to execute on the files in a fold. See - the mappings of \f1 to \f9 and \F1 to \F9 above. - - %f is the filename, %h is replaced with the project home - directory, and %d is replaced with the CD directory. Multiple - filenames can be handled in two ways: - - The first (default) way is to have %f replaced with all the - absolute filenames, and the command is run once. The second - is to have the command run for each of the non-absolute - filenames (%f is replaced with one filename at a time). To - select the second behavior, put an '*' character at the - beginning of the g:proj_run_fold{x} variable. (The '*' is - stripped before the command is run.) - - For example, note the difference between the following: > - let g:proj_run_fold3="*echo '%h/%f'" - let g:proj_run_fold4="echo '%f'" -< - Note that on Windows systems, you will want the %f, %h, and %c - within single quotes, or the \ in the paths will cause - problems. The alternative is to put them in |escape()|. - - -============================================================================== -PROJECT EXAMPLE FILE *project-example* - -Here is an example ~/.vimprojects file: > - - 1 My Project=~/c/project CD=. in=in.vim out=out.vim flags=r { - 2 Makefile - 3 in.vim - 4 out.vim - 5 GUI Files=. filter="gui*.c gui*.h" { - 6 gui_window.c - 7 gui_dialog.c - 8 gui_list.c - 9 gui.h # Header file - 10 } - 11 Database Files=. filter="data*.c data*.h" { - 12 data_read.c - 13 data_write.c - 14 data.h - 15 } - 16 OS-Specific Files { - 17 Win32=. filter="os_win32*.c os_win32*.h" { - 18 os_win32_gui.c - 19 os_win32_io.c - 20 } - 21 Unix=. filter="os_unix*.c os_unix*.h" { - 22 os_unix_gui.c - 23 os_unix_io.c - 24 } - 25 } - 26 } - -(Don't type in the line numbers, of course.) - - -============================================================================== -TIPS ON USING PROJECT PLUGIN *project-tips* - -1. You can create a Project Entry by entering this: > - - Label=~/wherever CD=. filter="*.c *.h" { - } -< - Then you can put the cursor in the fold and press \r. The script will fill - in the files (C files in this case) from this directory for you. This is - equivalent to \c without any dialogs. - -2. You can edit the Project File at any time to add, remove, or reorder files - in the Project list. - -3. If the Project Window ever gets closed, you can just enter > - :Project -< to bring it back again. (You don't need to give it the filename; the - plugin remembers.) - - If you have the 'm' flag set in g:proj_flags, then you get the Project - Window to show up again by pressing |CTRL-W_o|. This, of course, will - close any other windows that may be open that the cursor is not in. - -4. Adding files to a Project is very easy. To add, for example, the 'more.c' - file to the Project, just insert the filename in the Project Entry then - hit on it. - -5. When |quickfix| loads files, it is not equivalent to pressing on - a filename, so the directory will not be changed and the scripts will not - be run. (If I could make this otherwise, I would.) The solution is to use - the \L key to load all of the files in the Project before running - quickfix. - -6. If the Project window gets a bit cluttered with folds partially - open/closed, you can press |zM| to close everything and tidy it up. - -7. For advanced users, I am exporting the function Project_GetAllFnames() - which returns all the filenames within a fold and optionally all its - Subprojects. Also, I export Project_ForEach() for running a function for - each filename in the project. See the code for examples on how to use - these. Finally, I export Project_GetFname(line_number) so that you can - write your own mappings and get the filename for it. - -8. Some people have asked how to do a global mapping to take the cursor to - the Project window. One of my goals for the plugin is for it to be as - self-contained as possible, so I'm not going to add it by default. But you - can put this in your vimrc: -> - nmap P :Project - -< -9. You can put the . entry in a project, and it will launch the - |file-explorer| plugin on the directory. To avoid removal when you - refresh, make the entry look like this: -> - . # pragma keep -< -============================================================================== -THANKS - - The following people have sent me patches to help with the Project - Plugin development: - - Tomas Zellerin - Lawrence Kesteloot - Dave Eggum - A Harrison - Thomas Link - Richard Bair - Eric Arnold - Peter Jones - Eric Van Dewoestine - - - vim:ts=8 sw=8 noexpandtab tw=78 ft=help: diff --git a/files/.vim/ftplugin/html_snip_helper.vim b/files/.vim/ftplugin/html_snip_helper.vim deleted file mode 100644 index 2e54570..0000000 --- a/files/.vim/ftplugin/html_snip_helper.vim +++ /dev/null @@ -1,10 +0,0 @@ -" Helper function for (x)html snippets -if exists('s:did_snip_helper') || &cp || !exists('loaded_snips') - finish -endif -let s:did_snip_helper = 1 - -" Automatically closes tag if in xhtml -fun! Close() - return stridx(&ft, 'xhtml') == -1 ? '' : ' /' -endf diff --git a/files/.vim/ftplugin/python.vim b/files/.vim/ftplugin/python.vim deleted file mode 100644 index 1bd39d7..0000000 --- a/files/.vim/ftplugin/python.vim +++ /dev/null @@ -1,4 +0,0 @@ -setlocal tags+=$HOME/.vim/tags/python.ctags -" Tag list settings -let g:Tlist_Show_One_File = 1 -let g:Tlist_GainFocus_On_ToggleOpen = 1 diff --git a/files/.vim/ftplugin/worklist.vim b/files/.vim/ftplugin/worklist.vim deleted file mode 100644 index 41c35ad..0000000 --- a/files/.vim/ftplugin/worklist.vim +++ /dev/null @@ -1,5 +0,0 @@ -setl foldmethod=expr -setl foldexpr=getline(v:lnum)=~'^\\s*$'&&getline(v:lnum+1)=~'\\S'?'<1':1 -setl textwidth=72 -setl spell -setl nonumber diff --git a/files/.vim/indent/python.vim b/files/.vim/indent/python.vim deleted file mode 100644 index 32c773c..0000000 --- a/files/.vim/indent/python.vim +++ /dev/null @@ -1,196 +0,0 @@ -" Python indent file -" Language: Python -" Maintainer: Eric Mc Sween -" Original Author: David Bustos -" Last Change: 2004 Jun 07 - -" Only load this indent file when no other was loaded. -if exists("b:did_indent") - finish -endif -let b:did_indent = 1 - -setlocal expandtab -setlocal nolisp -setlocal autoindent -setlocal indentexpr=GetPythonIndent(v:lnum) -setlocal indentkeys=!^F,o,O,<:>,0),0],0},=elif,=except - -let s:maxoff = 50 - -" Find backwards the closest open parenthesis/bracket/brace. -function! s:SearchParensPair() - let line = line('.') - let col = col('.') - - " Skip strings and comments and don't look too far - let skip = "line('.') < " . (line - s:maxoff) . " ? dummy :" . - \ 'synIDattr(synID(line("."), col("."), 0), "name") =~? ' . - \ '"string\\|comment"' - - " Search for parentheses - call cursor(line, col) - let parlnum = searchpair('(', '', ')', 'bW', skip) - let parcol = col('.') - - " Search for brackets - call cursor(line, col) - let par2lnum = searchpair('\[', '', '\]', 'bW', skip) - let par2col = col('.') - - " Search for braces - call cursor(line, col) - let par3lnum = searchpair('{', '', '}', 'bW', skip) - let par3col = col('.') - - " Get the closest match - if par2lnum > parlnum || (par2lnum == parlnum && par2col > parcol) - let parlnum = par2lnum - let parcol = par2col - endif - if par3lnum > parlnum || (par3lnum == parlnum && par3col > parcol) - let parlnum = par3lnum - let parcol = par3col - endif - - " Put the cursor on the match - if parlnum > 0 - call cursor(parlnum, parcol) - endif - return parlnum -endfunction - -" Find the start of a multi-line statement -function! s:StatementStart(lnum) - let lnum = a:lnum - while 1 - if getline(lnum - 1) =~ '\\$' - let lnum = lnum - 1 - else - call cursor(lnum, 1) - let maybe_lnum = s:SearchParensPair() - if maybe_lnum < 1 - return lnum - else - let lnum = maybe_lnum - endif - endif - endwhile -endfunction - -" Find the block starter that matches the current line -function! s:BlockStarter(lnum, block_start_re) - let lnum = a:lnum - let maxindent = 10000 " whatever - while lnum > 1 - let lnum = prevnonblank(lnum - 1) - if indent(lnum) < maxindent - if getline(lnum) =~ a:block_start_re - return lnum - else - let maxindent = indent(lnum) - " It's not worth going further if we reached the top level - if maxindent == 0 - return -1 - endif - endif - endif - endwhile - return -1 -endfunction - -function! GetPythonIndent(lnum) - - " First line has indent 0 - if a:lnum == 1 - return 0 - endif - - " If we can find an open parenthesis/bracket/brace, line up with it. - call cursor(a:lnum, 1) - let parlnum = s:SearchParensPair() - if parlnum > 0 - let parcol = col('.') - let closing_paren = match(getline(a:lnum), '^\s*[])}]') != -1 - if match(getline(parlnum), '[([{]\s*$', parcol - 1) != -1 - if closing_paren - return indent(parlnum) - else - return indent(parlnum) + &shiftwidth - endif - else - if closing_paren - return parcol - 1 - else - return parcol - endif - endif - endif - - " Examine this line - let thisline = getline(a:lnum) - let thisindent = indent(a:lnum) - - " If the line starts with 'elif' or 'else', line up with 'if' or 'elif' - if thisline =~ '^\s*\(elif\|else\)\>' - let bslnum = s:BlockStarter(a:lnum, '^\s*\(if\|elif\)\>') - if bslnum > 0 - return indent(bslnum) - else - return -1 - endif - endif - - " If the line starts with 'except' or 'finally', line up with 'try' - " or 'except' - if thisline =~ '^\s*\(except\|finally\)\>' - let bslnum = s:BlockStarter(a:lnum, '^\s*\(try\|except\)\>') - if bslnum > 0 - return indent(bslnum) - else - return -1 - endif - endif - - " Examine previous line - let plnum = a:lnum - 1 - let pline = getline(plnum) - let sslnum = s:StatementStart(plnum) - - " If the previous line is blank, keep the same indentation - if pline =~ '^\s*$' - return -1 - endif - - " If this line is explicitly joined, try to find an indentation that looks - " good. - if pline =~ '\\$' - let compound_statement = '^\s*\(if\|while\|for\s.*\sin\|except\)\s*' - let maybe_indent = matchend(getline(sslnum), compound_statement) - if maybe_indent != -1 - return maybe_indent - else - return indent(sslnum) + &sw * 2 - endif - endif - - " If the previous line ended with a colon, indent relative to - " statement start. - if pline =~ ':\s*$' - return indent(sslnum) + &sw - endif - - " If the previous line was a stop-execution statement or a pass - if getline(sslnum) =~ '^\s*\(break\|continue\|raise\|return\|pass\)\>' - " See if the user has already dedented - if indent(a:lnum) > indent(sslnum) - &sw - " If not, recommend one dedent - return indent(sslnum) - &sw - endif - " Otherwise, trust the user - return -1 - endif - - " In all other cases, line up with the start of the previous statement. - return indent(sslnum) -endfunction diff --git a/files/.vim/indent/tex.vim b/files/.vim/indent/tex.vim deleted file mode 100644 index 5823dae..0000000 --- a/files/.vim/indent/tex.vim +++ /dev/null @@ -1,139 +0,0 @@ -" Vim indent file -" Language: LaTeX -" Maintainer: Johannes Tanzler -" Created: Sat, 16 Feb 2002 16:50:19 +0100 -" Last Change: Sun, 17 Feb 2002 00:09:11 +0100 -" Last Update: 18th feb 2002, by LH : -" (*) better support for the option -" (*) use some regex instead of several '||'. -" Version: 0.02 -" URL: comming soon: http://www.unet.univie.ac.at/~a9925098/vim/indent/tex.vim - -" --> If you're a Vim guru & and you find something that could be done in a -" better (perhaps in a more Vim-ish or Vi-ish) way, please let me know! - -" Options: {{{ -" -" To set the following options (ok, currently it's just one), add a line like -" let g:tex_indent_items = 1 -" to your ~/.vimrc. -" -" * g:tex_indent_items -" -" If this variable is set, item-environments are indented like Emacs does -" it, i.e., continuation lines are indented with a shiftwidth. -" -" NOTE: I've already set the variable below; delete the corresponding line -" if you don't like this behaviour. -" -" Per default, it is unset. -" -" set unset -" ---------------------------------------------------------------- -" \begin{itemize} \begin{itemize} -" \item blablabla \item blablabla -" bla bla bla bla bla bla -" \item blablabla \item blablabla -" bla bla bla bla bla bla -" \end{itemize} \end{itemize} -" -" -" This option applies to itemize, description, enumerate, and -" thebibliography. -" -" }}} - -" Delete the next line to avoid the special indention of items -if !exists("g:tex_indent_items") - let g:tex_indent_items = 1 -endif - -if exists("b:did_indent") | finish -endif -let b:did_indent = 1 - - -setlocal indentexpr=GetTeXIndent() -setlocal nolisp -setlocal nosmartindent -setlocal autoindent -setlocal indentkeys+=},=\\item,=\\bibitem - - -" Only define the function once -if exists("*GetTeXIndent") | finish -endif - - - -function GetTeXIndent() - - " Find a non-blank line above the current line. - let lnum = prevnonblank(v:lnum - 1) - - " At the start of the file use zero indent. - if lnum == 0 | return 0 - endif - - let ind = indent(lnum) - let line = getline(lnum) " last line - let cline = getline(v:lnum) " current line - - " Do not change indentation of commented lines. - if line =~ '^\s*%' - return ind - endif - - " Add a 'shiftwidth' after beginning of environments. - " Don't add it for \begin{document} and \begin{verbatim} - ""if line =~ '^\s*\\begin{\(.*\)}' && line !~ 'verbatim' - " LH modification : \begin does not always start a line - if line =~ '\\begin{\(.*\)}' && line !~ 'verbatim' - \ && line !~ 'document' - - let ind = ind + &sw - - if g:tex_indent_items == 1 - " Add another sw for item-environments - if line =~ 'itemize\|description\|enumerate\|thebibliography' - let ind = ind + &sw - endif - endif - endif - - - " Subtract a 'shiftwidth' when an environment ends - if cline =~ '^\s*\\end' && cline !~ 'verbatim' - \&& cline !~ 'document' - - if g:tex_indent_items == 1 - " Remove another sw for item-environments - if cline =~ 'itemize\|description\|enumerate\|thebibliography' - let ind = ind - &sw - endif - endif - - let ind = ind - &sw - endif - - - " Special treatment for 'item' - " ---------------------------- - - if g:tex_indent_items == 1 - - " '\item' or '\bibitem' itself: - if cline =~ '^\s*\\\(bib\)\=item' - let ind = ind - &sw - endif - - " lines following to '\item' are intented once again: - if line =~ '^\s*\\\(bib\)\=item' - let ind = ind + &sw - endif - - endif - - return ind -endfunction - diff --git a/files/.vim/plugin/CSApprox.vim b/files/.vim/plugin/CSApprox.vim deleted file mode 100644 index 0cb727f..0000000 --- a/files/.vim/plugin/CSApprox.vim +++ /dev/null @@ -1,987 +0,0 @@ -" CSApprox: Make gvim-only colorschemes Just Work terminal vim -" Maintainer: Matthew Wozniski (mjw@drexel.edu) -" Date: Wed, 01 Apr 2009 22:10:19 -0400 -" Version: 3.50 -" History: :help csapprox-changelog -" -" Long Description: -" It's hard to find colorschemes for terminal Vim. Most colorschemes are -" written to only support GVim, and don't work at all in terminal Vim. -" -" This plugin makes GVim-only colorschemes Just Work in terminal Vim, as long -" as the terminal supports 88 or 256 colors - and most do these days. This -" usually requires no user interaction (but see below for what to do if things -" don't Just Work). After getting this plugin happily installed, any time you -" use :colorscheme it will do its magic and make the colorscheme Just Work. -" -" Whenever you change colorschemes using the :colorscheme command this script -" will be executed. It will take the colors that the scheme specified for use -" in the GUI and use an approximation algorithm to try to gracefully degrade -" them to the closest color available in your terminal. If you are running in -" a GUI or if your terminal doesn't support 88 or 256 colors, no changes are -" made. Also, no changes will be made if the colorscheme seems to have been -" high color already. -" -" License: -" Copyright (c) 2009, Matthew J. Wozniski -" All rights reserved. -" -" Redistribution and use in source and binary forms, with or without -" modification, are permitted provided that the following conditions are met: -" * Redistributions of source code must retain the above copyright notice, -" this list of conditions and the following disclaimer. -" * Redistributions in binary form must reproduce the above copyright -" notice, this list of conditions and the following disclaimer in the -" documentation and/or other materials provided with the distribution. -" * The names of the contributors may not be used to endorse or promote -" products derived from this software without specific prior written -" permission. -" -" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER ``AS IS'' AND ANY EXPRESS -" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES -" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN -" NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY DIRECT, INDIRECT, -" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -" LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, -" OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -" LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -" NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, -" EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -" {>1} Basic plugin setup - -" {>2} Check preconditions -" Quit if the user doesn't want or need us or is missing the gui feature. We -" need +gui to be able to check the gui color settings; vim doesn't bother to -" store them if it is not built with +gui. -if !has('gui') || exists('g:CSApprox_loaded') - " XXX This depends upon knowing the default for g:CSApprox_verbose_level - let s:verbose = 1 - if exists("g:CSApprox_verbose_level") - let s:verbose = g:CSApprox_verbose_level - endif - - if ! has('gui') && s:verbose > 0 - echomsg "CSApprox needs gui support - not loading." - echomsg " See :help |csapprox-+gui| for possible workarounds." - endif - - unlet s:verbose - - finish -endif - -" {1} Mark us as loaded, and disable all compatibility options for now. -let g:CSApprox_loaded = 1 - -let s:savecpo = &cpo -set cpo&vim - -" {>1} Built-in approximation algorithm - -" {>2} Cube definitions -let s:xterm_colors = [ 0x00, 0x5F, 0x87, 0xAF, 0xD7, 0xFF ] -let s:eterm_colors = [ 0x00, 0x2A, 0x55, 0x7F, 0xAA, 0xD4 ] -let s:konsole_colors = [ 0x00, 0x33, 0x66, 0x99, 0xCC, 0xFF ] -let s:xterm_greys = [ 0x08, 0x12, 0x1C, 0x26, 0x30, 0x3A, - \ 0x44, 0x4E, 0x58, 0x62, 0x6C, 0x76, - \ 0x80, 0x8A, 0x94, 0x9E, 0xA8, 0xB2, - \ 0xBC, 0xC6, 0xD0, 0xDA, 0xE4, 0xEE ] - -let s:urxvt_colors = [ 0x00, 0x8B, 0xCD, 0xFF ] -let s:urxvt_greys = [ 0x2E, 0x5C, 0x73, 0x8B, - \ 0xA2, 0xB9, 0xD0, 0xE7 ] - -" {>2} Integer comparator -" Used to sort the complete list of possible colors -function! s:IntCompare(i1, i2) - return a:i1 == a:i2 ? 0 : a:i1 > a:i2 ? 1 : -1 -endfunc - -" {>2} Approximator -" Takes 3 decimal values for r, g, and b, and returns the closest cube number. -" Uses &term to determine which cube should be used, though if &term is set to -" "xterm" or begins with "screen", the variables g:CSApprox_eterm and -" g:CSApprox_konsole can be used to select a different palette. -" -" This approximator considers closeness based upon the individiual components. -" For each of r, g, and b, it finds the closest cube component available on -" the cube. If the three closest matches can combine to form a valid color, -" this color is used, otherwise we repeat the search with the greys removed, -" meaning that the three new matches must make a valid color when combined. -function! s:ApproximatePerComponent(r,g,b) - let hex = printf("%02x%02x%02x", a:r, a:g, a:b) - - let greys = (&t_Co == 88 ? s:urxvt_greys : s:xterm_greys) - - if &t_Co == 88 - let colors = s:urxvt_colors - let type = 'urxvt' - elseif ((&term ==# 'xterm' || &term =~# '^screen' || &term==# 'builtin_gui') - \ && exists('g:CSApprox_konsole') && g:CSApprox_konsole) - \ || &term =~? '^konsole' - let colors = s:konsole_colors - let type = 'konsole' - elseif ((&term ==# 'xterm' || &term =~# '^screen' || &term==# 'builtin_gui') - \ && exists('g:CSApprox_eterm') && g:CSApprox_eterm) - \ || &term =~? '^eterm' - let colors = s:eterm_colors - let type = 'eterm' - else - let colors = s:xterm_colors - let type = 'xterm' - endif - - if !exists('s:approximator_cache_'.type) - let s:approximator_cache_{type} = {} - endif - - let rv = get(s:approximator_cache_{type}, hex, -1) - if rv != -1 - return rv - endif - - " Only obtain sorted list once - if !exists("s:".type."_greys_colors") - let s:{type}_greys_colors = sort(greys + colors, "s:IntCompare") - endif - - let greys_colors = s:{type}_greys_colors - - let r = s:NearestElemInList(a:r, greys_colors) - let g = s:NearestElemInList(a:g, greys_colors) - let b = s:NearestElemInList(a:b, greys_colors) - - let len = len(colors) - if (r == g && g == b && index(greys, r) != -1) - let rv = 16 + len * len * len + index(greys, r) - else - let r = s:NearestElemInList(a:r, colors) - let g = s:NearestElemInList(a:g, colors) - let b = s:NearestElemInList(a:b, colors) - let rv = index(colors, r) * len * len - \ + index(colors, g) * len - \ + index(colors, b) - \ + 16 - endif - - let s:approximator_cache_{type}[hex] = rv - return rv -endfunction - -" {>2} Color comparator -" Finds the nearest element to the given element in the given list -function! s:NearestElemInList(elem, list) - let len = len(a:list) - for i in range(len-1) - if (a:elem <= (a:list[i] + a:list[i+1]) / 2) - return a:list[i] - endif - endfor - return a:list[len-1] -endfunction - -" {>1} Collect info for the set highlights - -" {>2} Determine if synIDattr is usable -" synIDattr() couldn't support 'guisp' until 7.2.052. This function returns -" true if :redir is needed to find the 'guisp' attribute, false if synIDattr() -" is functional. This test can be overridden by setting the global variable -" g:CSApprox_redirfallback to 1 (to force use of :redir) or to 0 (to force use -" of synIDattr()). -function! s:NeedRedirFallback() - if !exists("g:CSApprox_redirfallback") - let g:CSApprox_redirfallback = (v:version == 702 && !has('patch52')) - \ || v:version < 702 - endif - return g:CSApprox_redirfallback -endfunction - -" {>2} Collect and store the highlights -" Get a dictionary containing information for every highlight group not merely -" linked to another group. Return value is a dictionary, with highlight group -" numbers for keys and values that are dictionaries with four keys each, -" 'name', 'term', 'cterm', and 'gui'. 'name' holds the group name, and each -" of the others holds highlight information for that particular mode. -function! s:Highlights(modes) - let rv = {} - - let i = 0 - while 1 - let i += 1 - - " Only interested in groups that exist and aren't linked - if synIDtrans(i) == 0 - break - endif - - " Handle vim bug allowing groups with name == "" to be created - if synIDtrans(i) != i || len(synIDattr(i, "name")) == 0 - continue - endif - - let rv[i] = {} - let rv[i].name = synIDattr(i, "name") - - for where in a:modes - let rv[i][where] = {} - for attr in [ "bold", "italic", "reverse", "underline", "undercurl" ] - let rv[i][where][attr] = synIDattr(i, attr, where) - endfor - - for attr in [ "fg", "bg" ] - let rv[i][where][attr] = synIDattr(i, attr.'#', where) - endfor - - if where == "gui" - let rv[i][where]["sp"] = s:SynGuiSp(i, rv[i].name) - else - let rv[i][where]["sp"] = -1 - endif - - for attr in [ "fg", "bg", "sp" ] - if rv[i][where][attr] == -1 - let rv[i][where][attr] = '' - endif - endfor - endfor - endwhile - - return rv -endfunction - -" {>2} Retrieve guisp - -" Get guisp using whichever method is specified by _redir_fallback -function! s:SynGuiSp(idx, name) - if !s:NeedRedirFallback() - return s:SynGuiSpAttr(a:idx) - else - return s:SynGuiSpRedir(a:name) - endif -endfunction - -" {>3} Implementation for retrieving guisp with redir hack -function! s:SynGuiSpRedir(name) - redir => temp - exe 'sil hi ' . a:name - redir END - let temp = matchstr(temp, 'guisp=\zs.*') - if len(temp) == 0 || temp[0] =~ '\s' - let temp = "" - else - " Make sure we can handle guisp='dark red' - let temp = substitute(temp, '[\x00].*', '', '') - let temp = substitute(temp, '\s*\(c\=term\|gui\).*', '', '') - let temp = substitute(temp, '\s*$', '', '') - endif - return temp -endfunction - -" {>3} Implementation for retrieving guisp with synIDattr() -function! s:SynGuiSpAttr(idx) - return synIDattr(a:idx, 'sp#', 'gui') -endfunction - -" {>1} Handle color names - -" Place to store rgb.txt name to color mappings - lazy loaded if needed -let s:rgb = {} - -" {>2} Builtin gui color names -" gui_x11.c and gui_gtk_x11.c have some default colors names that are searched -" if the x server doesn't know about a color. If 'showrgb' is available, -" we'll default to using these color names and values, and overwrite them with -" other values if 'showrgb' tells us about those colors. -let s:rgb_defaults = { "lightred" : "#FFBBBB", - \ "lightgreen" : "#88FF88", - \ "lightmagenta" : "#FFBBFF", - \ "darkcyan" : "#008888", - \ "darkblue" : "#0000BB", - \ "darkred" : "#BB0000", - \ "darkmagenta" : "#BB00BB", - \ "darkgrey" : "#BBBBBB", - \ "darkyellow" : "#BBBB00", - \ "gray10" : "#1A1A1A", - \ "grey10" : "#1A1A1A", - \ "gray20" : "#333333", - \ "grey20" : "#333333", - \ "gray30" : "#4D4D4D", - \ "grey30" : "#4D4D4D", - \ "gray40" : "#666666", - \ "grey40" : "#666666", - \ "gray50" : "#7F7F7F", - \ "grey50" : "#7F7F7F", - \ "gray60" : "#999999", - \ "grey60" : "#999999", - \ "gray70" : "#B3B3B3", - \ "grey70" : "#B3B3B3", - \ "gray80" : "#CCCCCC", - \ "grey80" : "#CCCCCC", - \ "gray90" : "#E5E5E5", - \ "grey90" : "#E5E5E5" } - -" {>2} Colors that vim will use by name in one of the default schemes, either -" for bg=light or for bg=dark. This lets us avoid loading the entire rgb.txt -" database when the scheme itself doesn't ask for colors by name. -let s:rgb_presets = { "black" : "#000000", - \ "blue" : "#0000ff", - \ "brown" : "#a52a2a", - \ "cyan" : "#00ffff", - \ "darkblue" : "#00008b", - \ "darkcyan" : "#008b8b", - \ "darkgrey" : "#a9a9a9", - \ "darkmagenta" : "#8b008b", - \ "green" : "#00ff00", - \ "grey" : "#bebebe", - \ "grey40" : "#666666", - \ "grey90" : "#e5e5e5", - \ "lightblue" : "#add8e6", - \ "lightcyan" : "#e0ffff", - \ "lightgrey" : "#d3d3d3", - \ "lightmagenta" : "#ffbbff", - \ "magenta" : "#ff00ff", - \ "red" : "#ff0000", - \ "seagreen" : "#2e8b57", - \ "white" : "#ffffff", - \ "yellow" : "#ffff00" } - -" {>2} Find available color names -" Find the valid named colors. By default, use our own rgb list, but try to -" retrieve the system's list if g:CSApprox_use_showrgb is set to true. Store -" the color names and color values to the dictionary s:rgb - the keys are -" color names (in lowercase), the values are strings representing color values -" (as '#rrggbb'). -function! s:UpdateRgbHash() - try - if !exists("g:CSApprox_use_showrgb") || !g:CSApprox_use_showrgb - throw "Not using showrgb" - endif - - " We want to use the 'showrgb' program, if it's around - let lines = split(system('showrgb'), '\n') - - if v:shell_error || !exists('lines') || empty(lines) - throw "'showrgb' didn't give us an rgb.txt" - endif - - let s:rgb = copy(s:rgb_defaults) - - " fmt is (blanks?)(red)(blanks)(green)(blanks)(blue)(blanks)(name) - let parsepat = '^\s*\(\d\+\)\s\+\(\d\+\)\s\+\(\d\+\)\s\+\(.*\)$' - - for line in lines - let v = matchlist(line, parsepat) - if len(v) < 0 - throw "CSApprox: Bad RGB line: " . string(line) - endif - let s:rgb[tolower(v[4])] = printf("#%02x%02x%02x", v[1], v[2], v[3]) - endfor - catch - try - let s:rgb = csapprox#rgb() - catch - echohl ErrorMsg - echomsg "Can't call rgb() from autoload/csapprox.vim" - echomsg "Named colors will not be available!" - echohl None - endtry - endtry - - return 0 -endfunction - -" {>1} Derive and set cterm attributes - -" {>2} Attribute overrides -" Allow the user to override a specified attribute with another attribute. -" For example, the default is to map 'italic' to 'underline' (since many -" terminals cannot display italic text, and gvim itself will replace italics -" with underlines where italicizing is impossible), and to replace 'sp' with -" 'fg' (since terminals can't use one color for the underline and another for -" the foreground, we color the entire word). This default can of course be -" overridden by the user, by setting g:CSApprox_attr_map. This map must be -" a dictionary of string keys, representing the same attributes that synIDattr -" can look up, to string values, representing the attribute mapped to or an -" empty string to disable the given attribute entirely. -function! s:attr_map(attr) - let rv = get(g:CSApprox_attr_map, a:attr, a:attr) - - return rv -endfunction - -function! s:NormalizeAttrMap(map) - let old = copy(a:map) - let new = filter(a:map, '0') - - let valid_attrs = [ 'bg', 'fg', 'sp', 'bold', 'italic', - \ 'reverse', 'underline', 'undercurl' ] - - let colorattrs = [ 'fg', 'bg', 'sp' ] - - for olhs in keys(old) - if olhs ==? 'inverse' - let nlhs = 'reverse' - endif - - let orhs = old[olhs] - - if orhs ==? 'inverse' - let nrhs = 'reverse' - endif - - let nlhs = tolower(olhs) - let nrhs = tolower(orhs) - - try - if index(valid_attrs, nlhs) == -1 - echomsg "CSApprox: Bad attr map (removing unrecognized attribute " . olhs . ")" - elseif nrhs != '' && index(valid_attrs, nrhs) == -1 - echomsg "CSApprox: Bad attr map (removing unrecognized attribute " . orhs . ")" - elseif nrhs != '' && !!(index(colorattrs, nlhs)+1) != !!(index(colorattrs, nrhs)+1) - echomsg "CSApprox: Bad attr map (removing " . olhs . "; type mismatch with " . orhs . ")" - elseif nrhs == 'sp' - echomsg "CSApprox: Bad attr map (removing " . olhs . "; can't map to 'sp')" - else - let new[nlhs] = nrhs - endif - catch - echo v:exception - endtry - endfor -endfunction - -" {>2} Normalize the GUI settings of a highlight group -" If the Normal group is cleared, set it to gvim's default, black on white -" Though this would be a really weird thing for a scheme to do... *shrug* -function! s:FixupGuiInfo(highlights) - if a:highlights[s:hlid_normal].gui.bg == '' - let a:highlights[s:hlid_normal].gui.bg = 'white' - endif - - if a:highlights[s:hlid_normal].gui.fg == '' - let a:highlights[s:hlid_normal].gui.fg = 'black' - endif -endfunction - -" {>2} Map gui settings to cterm settings -" Given information about a highlight group, replace the cterm settings with -" the mapped gui settings, applying any attribute overrides along the way. In -" particular, this gives special treatment to the 'reverse' attribute and the -" 'guisp' attribute. In particular, if the 'reverse' attribute is set for -" gvim, we unset it for the terminal and instead set ctermfg to match guibg -" and vice versa, since terminals can consider a 'reverse' flag to mean using -" default-bg-on-default-fg instead of current-bg-on-current-fg. We also -" ensure that the 'sp' attribute is never set for cterm, since no terminal can -" handle that particular highlight. If the user wants to display the guisp -" color, he should map it to either 'fg' or 'bg' using g:CSApprox_attr_map. -function! s:FixupCtermInfo(highlights) - for hl in values(a:highlights) - - if !has_key(hl, 'cterm') - let hl["cterm"] = {} - endif - - " Find attributes to be set in the terminal - for attr in [ "bold", "italic", "reverse", "underline", "undercurl" ] - let hl.cterm[attr] = '' - if hl.gui[attr] == 1 - if s:attr_map(attr) != '' - let hl.cterm[ s:attr_map(attr) ] = 1 - endif - endif - endfor - - for color in [ "bg", "fg" ] - let eff_color = color - if hl.cterm['reverse'] - let eff_color = (color == 'bg' ? 'fg' : 'bg') - endif - - let hl.cterm[color] = get(hl.gui, s:attr_map(eff_color), '') - endfor - - if hl.gui['sp'] != '' && s:attr_map('sp') != '' - let hl.cterm[s:attr_map('sp')] = hl.gui['sp'] - endif - - if hl.cterm['reverse'] && hl.cterm.bg == '' - let hl.cterm.bg = 'fg' - endif - - if hl.cterm['reverse'] && hl.cterm.fg == '' - let hl.cterm.fg = 'bg' - endif - - if hl.cterm['reverse'] - let hl.cterm.reverse = '' - endif - endfor -endfunction - -" {>2} Set cterm colors for a highlight group -" Given the information for a single highlight group (ie, the value of -" one of the items in s:Highlights() already normalized with s:FixupCtermInfo -" and s:FixupGuiInfo), handle matching the gvim colors to the closest cterm -" colors by calling the appropriate approximator as specified with the -" g:CSApprox_approximator_function variable and set the colors and attributes -" appropriately to match the gui. -function! s:SetCtermFromGui(hl) - let hl = a:hl - - " Set up the default approximator function, if needed - if !exists("g:CSApprox_approximator_function") - let g:CSApprox_approximator_function=function("s:ApproximatePerComponent") - endif - - " Clear existing highlights - exe 'hi ' . hl.name . ' cterm=NONE ctermbg=NONE ctermfg=NONE' - - for which in [ 'bg', 'fg' ] - let val = hl.cterm[which] - - " Skip unset colors - if val == -1 || val == "" - continue - endif - - " Try translating anything but 'fg', 'bg', #rrggbb, and rrggbb from an - " rgb.txt color to a #rrggbb color - if val !~? '^[fb]g$' && val !~ '^#\=\x\{6}$' - try - " First see if it is in our preset-by-vim rgb list - let val = s:rgb_presets[tolower(val)] - catch - " Then try loading and checking our real rgb list - if empty(s:rgb) - call s:UpdateRgbHash() - endif - try - let val = s:rgb[tolower(val)] - catch - " And then barf if we still haven't found it - if &verbose - echomsg "CSApprox: Colorscheme uses unknown color \"" . val . "\"" - endif - continue - endtry - endtry - endif - - if val =~? '^[fb]g$' - exe 'hi ' . hl.name . ' cterm' . which . '=' . val - let hl.cterm[which] = val - elseif val =~ '^#\=\x\{6}$' - let val = substitute(val, '^#', '', '') - let r = str2nr(val[0:1], 16) - let g = str2nr(val[2:3], 16) - let b = str2nr(val[4:5], 16) - let hl.cterm[which] = g:CSApprox_approximator_function(r, g, b) - exe 'hi ' . hl.name . ' cterm' . which . '=' . hl.cterm[which] - else - throw "Internal error handling color: " . val - endif - endfor - - " Finally, set the attributes - let attrs = [ 'bold', 'italic', 'underline', 'undercurl' ] - call filter(attrs, 'hl.cterm[v:val] == 1') - - if !empty(attrs) - exe 'hi ' . hl.name . ' cterm=' . join(attrs, ',') - endif -endfunction - - -" {>1} Top-level control - -" Cache the highlight ID of the normal group; it's used often and won't change -let s:hlid_normal = hlID('Normal') - -" {>2} Builtin cterm color names above 15 -" Vim defines some color name to high color mappings internally (see -" syntax.c:do_highlight). Since we don't want to overwrite a colorscheme that -" was actually written for a high color terminal with our choices, but have no -" way to tell if a colorscheme was written for a high color terminal, we fall -" back on guessing. If any highlight group has a cterm color set to 16 or -" higher, we assume that the user has used a high color colorscheme - unless -" that color is one of the below, which vim can set internally when a color is -" requested by name. -let s:presets_88 = [] -let s:presets_88 += [32] " Brown -let s:presets_88 += [72] " DarkYellow -let s:presets_88 += [84] " Gray -let s:presets_88 += [84] " Grey -let s:presets_88 += [82] " DarkGray -let s:presets_88 += [82] " DarkGrey -let s:presets_88 += [43] " LightBlue -let s:presets_88 += [61] " LightGreen -let s:presets_88 += [63] " LightCyan -let s:presets_88 += [74] " LightRed -let s:presets_88 += [75] " LightMagenta -let s:presets_88 += [78] " LightYellow - -let s:presets_256 = [] -let s:presets_256 += [130] " Brown -let s:presets_256 += [130] " DarkYellow -let s:presets_256 += [248] " Gray -let s:presets_256 += [248] " Grey -let s:presets_256 += [242] " DarkGray -let s:presets_256 += [242] " DarkGrey -let s:presets_256 += [ 81] " LightBlue -let s:presets_256 += [121] " LightGreen -let s:presets_256 += [159] " LightCyan -let s:presets_256 += [224] " LightRed -let s:presets_256 += [225] " LightMagenta -let s:presets_256 += [229] " LightYellow - -" {>2} Wrapper around :exe to allow :executing multiple commands. -" "cmd" is the command to be :executed. -" If the variable is a String, it is :executed. -" If the variable is a List, each element is :executed. -function! s:exe(cmd) - if type(a:cmd) == type('') - exe a:cmd - else - for cmd in a:cmd - call s:exe(cmd) - endfor - endif -endfunction - -" {>2} Function to handle hooks -" Prototype: HandleHooks(type [, scheme]) -" "type" is the type of hook to be executed, ie. "pre" or "post" -" "scheme" is the name of the colorscheme that is currently active, if known -" -" If the variables g:CSApprox_hook_{type} and g:CSApprox_hook_{scheme}_{type} -" exist, this will :execute them in that order. If one does not exist, it -" will silently be ignored. -" -" If the scheme name contains characters that are invalid in a variable name, -" they will simply be removed. Ie, g:colors_name = "123 foo_bar-baz456" -" becomes "foo_barbaz456" -" -" NOTE: Exceptions will be printed out, rather than end processing early. The -" rationale is that it is worse for the user to fix the hook in an editor with -" broken colors. :) -function! s:HandleHooks(type, ...) - let type = a:type - let scheme = (a:0 == 1 ? a:1 : "") - let scheme = substitute(scheme, '[^[:alnum:]_]', '', 'g') - let scheme = substitute(scheme, '^\d\+', '', '') - - for cmd in [ 'g:CSApprox_hook_' . type, - \ 'g:CSApprox_' . scheme . '_hook_' . type, - \ 'g:CSApprox_hook_' . scheme . '_' . type ] - if exists(cmd) - try - call s:exe(eval(cmd)) - catch - echomsg "Error processing " . cmd . ":" - echomsg v:exception - endtry - endif - endfor -endfunction - -" {>2} Main function -" Wrapper around the actual implementation to make it easier to ensure that -" all temporary settings are restored by the time we return, whether or not -" something was thrown. Additionally, sets the 'verbose' option to the max of -" g:CSApprox_verbose_level (default 1) and &verbose for the duration of the -" main function. This allows us to default to a message whenever any error, -" even a recoverable one, occurs, meaning the user quickly finds out when -" something's wrong, but makes it very easy for the user to make us silent. -function! s:CSApprox() - try - let savelz = &lz - - set lz - - if exists("g:CSApprox_attr_map") && type(g:CSApprox_attr_map) == type({}) - call s:NormalizeAttrMap(g:CSApprox_attr_map) - else - let g:CSApprox_attr_map = { 'italic' : 'underline', 'sp' : 'fg' } - endif - - " colors_name must be unset and reset, or vim will helpfully reload the - " colorscheme when we set the background for the Normal group. - " See the help entries ':hi-normal-cterm' and 'g:colors_name' - if exists("g:colors_name") - let colors_name = g:colors_name - unlet g:colors_name - endif - - " Similarly, the global variable "syntax_cmd" must be set to something vim - " doesn't recognize, lest vim helpfully switch all colors back to the - " default whenever the Normal group is changed (in syncolor.vim)... - if exists("g:syntax_cmd") - let syntax_cmd = g:syntax_cmd - endif - let g:syntax_cmd = "PLEASE DON'T CHANGE ANY COLORS!!!" - - " Set up our verbosity level, if needed. - " Default to 1, so the user can know if something's wrong. - if !exists("g:CSApprox_verbose_level") - let g:CSApprox_verbose_level = 1 - endif - - call s:HandleHooks("pre", (exists("colors_name") ? colors_name : "")) - - " Set 'verbose' set to the maximum of &verbose and CSApprox_verbose_level - exe max([&vbs, g:CSApprox_verbose_level]) 'verbose call s:CSApproxImpl()' - - call s:HandleHooks("post", (exists("colors_name") ? colors_name : "")) - finally - if exists("colors_name") - let g:colors_name = colors_name - endif - - unlet g:syntax_cmd - if exists("syntax_cmd") - let g:syntax_cmd = syntax_cmd - endif - - let &lz = savelz - endtry -endfunction - -" {>2} CSApprox implementation -" Verifies that the user has not started the gui, and that vim recognizes his -" terminal as having enough colors for us to go on, then gathers the existing -" highlights and sets the cterm colors to match the gui colors for all those -" highlights (unless the colorscheme was already high-color). -function! s:CSApproxImpl() - " Return if not running in an 88/256 color terminal - if &t_Co != 256 && &t_Co != 88 - if &verbose && !has('gui_running') - echomsg "CSApprox skipped; terminal only has" &t_Co "colors, not 88/256" - echomsg "Try checking :help csapprox-terminal for workarounds" - endif - - return - endif - - " Get the current highlight colors - let highlights = s:Highlights(["gui"]) - - let hinums = keys(highlights) - - " Make sure that the script is not already 256 color by checking to make - " sure that no groups are set to a value above 256, unless the color they're - " set to can be set internally by vim (gotten by scraping - " color_numbers_{88,256} in syntax.c:do_highlight) - " - " XXX: s:inhibit_hicolor_test allows this test to be skipped for snapshots - if !exists("s:inhibit_hicolor_test") || !s:inhibit_hicolor_test - for hlid in hinums - for type in [ 'bg', 'fg' ] - let color = synIDattr(hlid, type, 'cterm') - - if color > 15 && index(s:presets_{&t_Co}, str2nr(color)) < 0 - " The value is set above 15, and wasn't set by vim. - if &verbose >= 2 - echomsg 'CSApprox: Exiting - high' type 'color found for' highlights[hlid].name - endif - return - endif - endfor - endfor - endif - - call s:FixupGuiInfo(highlights) - call s:FixupCtermInfo(highlights) - - " We need to set the Normal group first so 'bg' and 'fg' work as colors - call insert(hinums, remove(hinums, index(hinums, string(s:hlid_normal)))) - - " then set each color's cterm attributes to match gui - for hlid in hinums - call s:SetCtermFromGui(highlights[hlid]) - endfor -endfunction - -" {>2} Write out the current colors to an 88/256 color colorscheme file. -" "file" - destination filename -" "overwrite" - overwrite an existing file -function! s:CSApproxSnapshot(file, overwrite) - let force = a:overwrite - let file = fnamemodify(a:file, ":p") - - if empty(file) - throw "Bad file name: \"" . file . "\"" - elseif (filewritable(fnamemodify(file, ':h')) != 2) - throw "Cannot write to directory \"" . fnamemodify(file, ':h') . "\"" - elseif (glob(file) || filereadable(file)) && !force - " TODO - respect 'confirm' here and prompt if it's set. - echohl ErrorMsg - echomsg "E13: File exists (add ! to override)" - echohl None - return - endif - - " Sigh... This is basically a bug, but one that I have no chance of fixing. - " Vim decides that Pmenu should be highlighted in 'LightMagenta' in terminal - " vim and as 'Magenta' in gvim... And I can't ask it what color it actually - " *wants*. As far as I can see, there's no way for me to learn that - " I should output 'Magenta' when 'LightMagenta' is provided by vim for the - " terminal. - if !has('gui_running') - echohl WarningMsg - echomsg "Warning: The written colorscheme may have incorrect colors" - echomsg " when CSApproxSnapshot is used in terminal vim!" - echohl None - endif - - let save_t_Co = &t_Co - let s:inhibit_hicolor_test = 1 - if exists("g:CSApprox_konsole") - let save_CSApprox_konsole = g:CSApprox_konsole - endif - if exists("g:CSApprox_eterm") - let save_CSApprox_eterm = g:CSApprox_eterm - endif - - " Needed just like in CSApprox() - if exists("g:colors_name") - let colors_name = g:colors_name - unlet g:colors_name - endif - - " Needed just like in CSApprox() - if exists("g:syntax_cmd") - let syntax_cmd = g:syntax_cmd - endif - let g:syntax_cmd = "PLEASE DON'T CHANGE ANY COLORS!!!" - - try - let lines = [] - let lines += [ '" This scheme was created by CSApproxSnapshot' ] - let lines += [ '" on ' . strftime("%a, %d %b %Y") ] - let lines += [ '' ] - let lines += [ 'hi clear' ] - let lines += [ 'if exists("syntax_on")' ] - let lines += [ ' syntax reset' ] - let lines += [ 'endif' ] - let lines += [ '' ] - let lines += [ 'if v:version < 700' ] - let lines += [ ' let g:colors_name = expand(":t:r")' ] - let lines += [ ' command! -nargs=+ CSAHi exe "hi" substitute(substitute(, "undercurl", "underline", "g"), "guisp\\S\\+", "", "g")' ] - let lines += [ 'else' ] - let lines += [ ' let g:colors_name = expand(":t:r")' ] - let lines += [ ' command! -nargs=+ CSAHi exe "hi" ' ] - let lines += [ 'endif' ] - let lines += [ '' ] - - let lines += [ 'if 0' ] - for round in [ 'konsole', 'eterm', 'xterm', 'urxvt' ] - sil! unlet g:CSApprox_eterm - sil! unlet g:CSApprox_konsole - - if round == 'konsole' - let g:CSApprox_konsole = 1 - elseif round == 'eterm' - let g:CSApprox_eterm = 1 - endif - - if round == 'urxvt' - set t_Co=88 - else - set t_Co=256 - endif - - call s:CSApprox() - - let highlights = s:Highlights(["term", "cterm", "gui"]) - call s:FixupGuiInfo(highlights) - - if round == 'konsole' || round == 'eterm' - let lines += [ 'elseif has("gui_running") || (&t_Co == ' . &t_Co - \ . ' && (&term ==# "xterm" || &term =~# "^screen")' - \ . ' && exists("g:CSApprox_' . round . '")' - \ . ' && g:CSApprox_' . round . ')' - \ . ' || &term =~? "^' . round . '"' ] - else - let lines += [ 'elseif has("gui_running") || &t_Co == ' . &t_Co ] - endif - - let hinums = keys(highlights) - - call insert(hinums, remove(hinums, index(hinums, string(s:hlid_normal)))) - - for hlnum in hinums - let hl = highlights[hlnum] - let line = ' CSAHi ' . hl.name - for type in [ 'term', 'cterm', 'gui' ] - let attrs = [ 'reverse', 'bold', 'italic', 'underline', 'undercurl' ] - call filter(attrs, 'hl[type][v:val] == 1') - let line .= ' ' . type . '=' . (empty(attrs) ? 'NONE' : join(attrs, ',')) - if type != 'term' - let line .= ' ' . type . 'bg=' . (len(hl[type].bg) ? hl[type].bg : 'bg') - let line .= ' ' . type . 'fg=' . (len(hl[type].fg) ? hl[type].fg : 'fg') - if type == 'gui' && hl.gui.sp !~ '^\s*$' - let line .= ' ' . type . 'sp=' . hl[type].sp - endif - endif - endfor - let lines += [ line ] - endfor - endfor - let lines += [ 'endif' ] - let lines += [ '' ] - let lines += [ 'if 1' ] - let lines += [ ' delcommand CSAHi' ] - let lines += [ 'endif' ] - call writefile(lines, file) - finally - let &t_Co = save_t_Co - - if exists("save_CSApprox_konsole") - let g:CSApprox_konsole = save_CSApprox_konsole - endif - if exists("save_CSApprox_eterm") - let g:CSApprox_eterm = save_CSApprox_eterm - endif - - if exists("colors_name") - let g:colors_name = colors_name - endif - - unlet g:syntax_cmd - if exists("syntax_cmd") - let g:syntax_cmd = syntax_cmd - endif - - call s:CSApprox() - - unlet s:inhibit_hicolor_test - endtry -endfunction - -" {>2} Snapshot user command -command! -bang -nargs=1 -complete=file -bar CSApproxSnapshot - \ call s:CSApproxSnapshot(, strlen("")) - -" {>1} Hooks - -" {>2} Autocmds -" Set up an autogroup to hook us on the completion of any :colorscheme command -augroup CSApprox - au! - au ColorScheme * call s:CSApprox() - "au User CSApproxPost highlight Normal ctermbg=none | highlight NonText ctermbg=None -augroup END - -" {>2} Execute -" The last thing to do when sourced is to run and actually fix up the colors. -if !has('gui_running') - call s:CSApprox() -endif - -" {>1} Restore compatibility options -let &cpo = s:savecpo -unlet s:savecpo - - -" {0} vim:sw=2:sts=2:et:fdm=expr:fde=substitute(matchstr(getline(v\:lnum),'^\\s*"\\s*{\\zs.\\{-}\\ze}'),'^$','=','') diff --git a/files/.vim/plugin/SyntaxFolds.vim b/files/.vim/plugin/SyntaxFolds.vim deleted file mode 100644 index 27c622c..0000000 --- a/files/.vim/plugin/SyntaxFolds.vim +++ /dev/null @@ -1,323 +0,0 @@ -" ============================================================================== -" File: syntaxFolds.vim -" Author: Srinath Avadhanula -" ( srinath@fastmail.fm ) -" Last Change: Sun Oct 27 01:00 AM 2002 PST -" Description: Emulation of the syntax folding capability of vim using manual -" folding -" -" This script provides an emulation of the syntax folding of vim using manual -" folding. Just as in syntax folding, the folds are defined by regions. Each -" region is specified by a call to FoldRegions() which accepts 4 parameters: -" -" call FoldRegions(startpat, endpat, startoff, endoff) -" -" startpat: a line matching this pattern defines the beginning of a fold. -" endpat : a line matching this pattern defines the end of a fold. -" startoff: this is the offset from the starting line at which folding will -" actually start -" endoff : like startoff, but gives the offset of the actual fold end from -" the line satisfying endpat. -" startoff and endoff are necessary when the folding region does -" not have a specific end pattern corresponding to a start -" pattern. for example in latex, -" \begin{section} -" defines the beginning of a section, but its not necessary to -" have a corresponding -" \end{section} -" the section is assumed to end 1 line _before_ another section -" starts. -" startskip: a pattern which defines the beginning of a "skipped" region. -" -" For example, suppose we define a \itemize fold as follows: -" startpat = '^\s*\\item', -" endpat = '^\s*\\item\|^\s*\\end{\(enumerate\|itemize\|description\)}', -" startoff = 0, -" endoff = -1 -" -" This defines a fold which starts with a line beginning with an -" \item and ending one line before a line beginning with an -" \item or \end{enumerate} etc. -" -" Then, as long as \item's are not nested things are fine. -" However, once items begin to nest, the fold started by one -" \item can end because of an \item in an \itemize -" environment within this \item. i.e, the following can happen: -" -" \begin{itemize} -" \item Some text <------- fold will start here -" This item will contain a nested item -" \begin{itemize} <----- fold will end here because next line contains \item... -" \item Hello -" \end{itemize} <----- ... instead of here. -" \item Next item of the parent itemize -" \end{itemize} -" -" Therefore, in order to completely define a folding item which -" allows nesting, we need to also define a "skip" pattern. -" startskip and end skip do that. -" Leave '' when there is no nesting. -" endskip: the pattern which defines the end of the "skip" pattern for -" nested folds. -" -" Example: -" 1. A syntax fold region for a latex section is -" startpat = "\\section{" -" endpat = "\\section{" -" startoff = 0 -" endoff = -1 -" startskip = '' -" endskip = '' -" Note that the start and end patterns are thus the same and endoff has a -" negative value to capture the effect of a section ending one line before -" the next starts. -" 2. A syntax fold region for the \itemize environment is: -" startpat = '^\s*\\item', -" endpat = '^\s*\\item\|^\s*\\end{\(enumerate\|itemize\|description\)}', -" startoff = 0, -" endoff = -1, -" startskip = '^\s*\\begin{\(enumerate\|itemize\|description\)}', -" endskip = '^\s*\\end{\(enumerate\|itemize\|description\)}' -" Note the use of startskip and endskip to allow nesting. -" -" -" Each time a call is made to FoldRegions(), all the regions (which might be -" disjoint, but not nested) are folded up. -" Nested folds can be created by successive calls to FoldRegions(). The first -" call defines the region which is deepest in the folding. See MakeTexFolds() -" for an idea of how this works for latex files. - -" Function: AddSyntaxFoldItem (start, end, startoff, endoff [, skipStart, skipEnd]) {{{ -function! AddSyntaxFoldItem(start, end, startoff, endoff, ...) - if a:0 > 0 - let skipStart = a:1 - let skipEnd = a:2 - else - let skipStart = '' - let skipEnd = '' - end - if !exists('b:numFoldItems') - let b:numFoldItems = 0 - end - let b:numFoldItems = b:numFoldItems + 1 - - exe 'let b:startPat_'.b:numFoldItems.' = a:start' - exe 'let b:endPat_'.b:numFoldItems.' = a:end' - exe 'let b:startOff_'.b:numFoldItems.' = a:startoff' - exe 'let b:endOff_'.b:numFoldItems.' = a:endoff' - exe 'let b:skipStartPat_'.b:numFoldItems.' = skipStart' - exe 'let b:skipEndPat_'.b:numFoldItems.' = skipEnd' -endfunction - - -" }}} -" Function: MakeSyntaxFolds (force) {{{ -" Description: This function calls FoldRegions() several times with the -" parameters specifying various regions resulting in a nested fold -" structure for the file. -function! MakeSyntaxFolds(force, ...) - if exists('b:doneFolding') && a:force == 0 - return - end - - let skipEndPattern = '' - if a:0 > 0 - let line1 = a:1 - let skipEndPattern = '\|'.a:2 - else - let line1 = 1 - let r = line('.') - let c = virtcol('.') - - setlocal fdm=manual - normal! zE - end - if !exists('b:numFoldItems') - b:numFoldItems = 1000000 - end - - let i = 1 - - let maxline = line('.') - - while exists('b:startPat_'.i) && i <= b:numFoldItems - exe 'let startPat = b:startPat_'.i - exe 'let endPat = b:endPat_'.i - exe 'let startOff = b:startOff_'.i - exe 'let endOff = b:endOff_'.i - - let skipStart = '' - let skipEnd = '' - if exists('b:skipStartPat_'.i) - exe 'let skipStart = b:skipStartPat_'.i - exe 'let skipEnd = b:skipEndPat_'.i - end - exe line1 - let lastLoc = line1 - - if skipStart != '' - call InitStack('BeginSkipArray') - call FoldRegionsWithSkip(startPat, endPat, startOff, endOff, skipStart, skipEnd, 1, line('$')) - " call PrintError('done folding ['.startPat.']') - else - call FoldRegionsWithNoSkip(startPat, endPat, startOff, endOff, 1, line('$'), '') - end - - let i = i + 1 - endwhile - - exe maxline - - if a:0 == 0 - exe r - exe "normal! ".c."|" - if foldlevel(r) > 1 - exe "normal! ".(foldlevel(r) - 1)."zo" - end - let b:doneFolding = 0 - end -endfunction - - -" }}} -" FoldRegionsWithSkip: folding things such as \item's which can be nested. {{{ -function! FoldRegionsWithSkip(startpat, endpat, startoff, endoff, startskip, endskip, line1, line2) - exe a:line1 - " count the regions which have been skipped as we go along. do not want to - " create a fold which with a beginning or end line in one of the skipped - " regions. - let skippedRegions = '' - - " start searching for either the starting pattern or the end pattern. - while search(a:startskip.'\|'.a:endskip, 'W') - - if getline('.') =~ a:endskip - - let lastBegin = Pop('BeginSkipArray') - " call PrintError('popping '.lastBegin.' from stack and folding till '.line('.')) - call FoldRegionsWithNoSkip(a:startpat, a:endpat, a:startoff, a:endoff, lastBegin, line('.'), skippedRegions) - let skippedRegions = skippedRegions.lastBegin.','.line('.').'|' - - - " if this is the beginning of a skip region, then, push this line as - " the beginning of a skipped region. - elseif getline('.') =~ a:startskip - - " call PrintError('pushing '.line('.').' ['.getline('.').'] into stack') - call Push('BeginSkipArray', line('.')) - - end - endwhile - - " call PrintError('with skip starting at '.a:line1.' returning at line# '.line('.')) -endfunction - -" }}} -" FoldRegionsWithNoSkip: folding things such as \sections which do not nest. {{{ -function! FoldRegionsWithNoSkip(startpat, endpat, startoff, endoff, line1, line2, skippedRegions) - exe a:line1 - - " call PrintError('line1 = '.a:line1.', searching from '.line('.').'... for ['.a:startpat.'') - let lineBegin = s:MySearch(a:startpat, 'in') - " call PrintError('... and finding it at '.lineBegin) - - while lineBegin <= a:line2 - if IsInSkippedRegion(lineBegin, a:skippedRegions) - let lineBegin = s:MySearch(a:startpat, 'out') - " call PrintError(lineBegin.' is being skipped') - continue - end - let lineEnd = s:MySearch(a:endpat, 'out') - while IsInSkippedRegion(lineEnd, a:skippedRegions) && lineEnd <= a:line2 - let lineEnd = s:MySearch(a:endpat, 'out') - endwhile - if lineEnd > a:line2 - exe (lineBegin + a:startoff).','.a:line2.' fold' - break - else - " call PrintError ('for ['.a:startpat.'] '.(lineBegin + a:startoff).','.(lineEnd + a:endoff).' fold') - exe (lineBegin + a:startoff).','.(lineEnd + a:endoff).' fold' - end - - " call PrintError('line1 = '.a:line1.', searching from '.line('.').'... for ['.a:startpat.'') - let lineBegin = s:MySearch(a:startpat, 'in') - " call PrintError('... and finding it at '.lineBegin) - endwhile - - exe a:line2 - return -endfunction - -" }}} -" InitStack: initialize a stack {{{ -function! InitStack(name) - exe 'let s:'.a:name.'_numElems = 0' -endfunction -" }}} -" Push: push element into stack {{{ -function! Push(name, elem) - exe 'let numElems = s:'.a:name.'_numElems' - let numElems = numElems + 1 - exe 'let s:'.a:name.'_Element_'.numElems.' = a:elem' - exe 'let s:'.a:name.'_numElems = numElems' -endfunction -" }}} -" Pop: pops element off stack {{{ -function! Pop(name) - exe 'let numElems = s:'.a:name.'_numElems' - if numElems == 0 - return '' - else - exe 'let ret = s:'.a:name.'_Element_'.numElems - let numElems = numElems - 1 - exe 'let s:'.a:name.'_numElems = numElems' - return ret - end -endfunction -" }}} -" MySearch: just like search(), but returns large number on failure {{{ -function! MySearch(pat, opt) - if a:opt == 'in' - if getline('.') =~ a:pat - let ret = line('.') - else - let ret = search(a:pat, 'W') - end - else - normal! $ - let ret = search(a:pat, 'W') - end - - if ret == 0 - let ret = line('$') + 1 - end - return ret -endfunction -" }}} -" Function: IsInSkippedRegion (lnum, regions) {{{ -" Description: finds whether a given line number is within one of the regions -" skipped. -function! IsInSkippedRegion(lnum, regions) - let i = 1 - let subset = s:Strntok(a:regions, '|', i) - while subset != '' - let n1 = s:Strntok(subset, ',', 1) - let n2 = s:Strntok(subset, ',', 2) - if a:lnum >= n1 && a:lnum <= n2 - return 1 - end - - let subset = s:Strntok(a:regions, '|', i) - let i = i + 1 - endwhile - - return 0 -endfunction " }}} -" Function: Strntok (string, tok, n) {{{ -" extract the n^th token from s seperated by tok. -" example: Strntok('1,23,3', ',', 2) = 23 -fun! Strntok(s, tok, n) - return matchstr( a:s.a:tok[0], '\v(\zs([^'.a:tok.']*)\ze['.a:tok.']){'.a:n.'}') -endfun " }}} - -" vim600:fdm=marker diff --git a/files/.vim/plugin/XMLFolding.vim b/files/.vim/plugin/XMLFolding.vim deleted file mode 100755 index ec5487b..0000000 --- a/files/.vim/plugin/XMLFolding.vim +++ /dev/null @@ -1,105 +0,0 @@ -" About XMLFolding Script {{{ - -" XMLFolding version 1.1 - May 13th, 2006 -" Author: Thadeu Aparecido Coelho de Paula -" E-mail: thadeudepaula@gmail.com -" WebPage: http://mundolivre.hostrixonline.com -" -" This is my first vim script... at this point I already worked three -" continual weeks to make it. Never give up your objectives! -" I hope that you enjoy it, and use it to accomplish your projects! -" -" This script is under GNU Public License... use it, change it, sell it but -" never forget to mention the original author" -" -" Made using Vim 6.04 on Debian GNU/Linux -" -" This Script supports: -" -" Folding of comments "" -" Folding of open/close tags in different lines "<> " -" Folding between CDATA markers "" - -" }}} - -" Howto {{{ - - " Installing {{{ -" Copy this file for any location yow want to... I suggest that you put it on -" your ~/.vim/plugin directory. -" -" To load this script in your vim session, type on normal mode: -" :so ~/.vim/script/XMLFolding.vim -" (If you saved on local where I suggested!) - -"}}} - - " How to load this script automaticaly? {{{ -"You can use this script more easily configuring your vim to run it on start... -"You'll need to put this line in your /etc/vim/vimrc or ~/.vimrc: - -" au BufNewFile,BufRead *.xml,*.htm,*.html so ~/.vim/plugin/XMLFolding.vim - -" The "*.xml,*.html" can be changed for the file extensions that you want to -" use with this script. - "}}} - - " Limitatios... i.e, when the fold won't occurs {{{ - -" The syntax need to be perfectly to match correctly... the tags needs to be -" nested correctly... -" All the tags nested in the same line will not be folded... like this: -" -" blablablablablablaasdsad -" -" -" In this example only "start" will be folded... -" -" An other problem will occur when you end the line closing a tag different -" than the open tag that starts the line, because the matches ignore the lines -" that starts opening a tag and ends closing a tag... -" -" asdasdsd -" -" -" This will cause an error, because MATCHES ARE NOT MADE BY THE CONTENT OF A -" TAG, but by the presence of start and end aspect: <----> independent -" of the tag content... if it encounter an incorrect nesting, the folding for -" the document will be broken. -" -" This way, the script serves as an validator, limited but functional! - - "}}} - - -"}}} - -" Folding def commands {{{ - - " Basic vim commands for folding definition {{{ -syn sync fromstart -set foldmethod=syntax - "}}} - - " Matches and regions {{{ - -syn region XMLFold start=+^<\([^/?!><]*[^/]>\)\&.*\(<\1\|[[:alnum:]]\)$+ end=+^$+ fold transparent keepend extend - -syn match XMLCData "" fold transparent extend - -syn match XMLCommentFold "" fold transparent extend - - - "}}} - - " Label shown for folded lines {{{ -set foldtext=XMLFoldLabel() - fun! XMLFoldLabel() - let getcontent = substitute(getline(v:foldstart), "^[[:space:]]*", "", 'g') - let linestart = substitute(v:folddashes, ".", '»', 'g') - return linestart . " " . getcontent -endfunction - - "}}} - -"}}} diff --git a/files/.vim/plugin/filebrowser.vim b/files/.vim/plugin/filebrowser.vim deleted file mode 100644 index e9de049..0000000 --- a/files/.vim/plugin/filebrowser.vim +++ /dev/null @@ -1,251 +0,0 @@ -" filebrowser.vim: utility file for vim 6.2+ -" -" Copyright: Srinath Avadhanula -" Parts of this file are taken from explorer.vim which is a plugin file -" distributed with vim under the Vim charityware license. -" License: distributed under the Vim charityware license. -" -" Settings: -" FB_CallBackFunction: the function name which gets called when the user -" presses on a file-name in the file browser. -" FB_AllowRegexp: A filename has to match this regexp to be displayed. -" FB_RejectRegexp: If a filename matches this regexp, then its not displayed. -" (Both these regexps are '' by default which means no filtering is -" done). - -" line continuation used here. -let s:save_cpo = &cpo -set cpo&vim - -"====================================================================== -" Globally visible functions (API) -"====================================================================== -" FB_OpenFileBrowser: opens a new buffer and displays the file list {{{ -" Description: -function! FB_OpenFileBrowser(dir) - if !isdirectory(a:dir) - return - endif - if exists('s:FB_BufferNumber') - if bufwinnr(s:FB_BufferNumber) != -1 - execute bufwinnr(s:FB_BufferNumber).' wincmd w' - return - endif - execute 'aboveleft split #'.s:FB_BufferNumber - else - aboveleft split __Choose_File__ - let s:FB_BufferNumber = bufnr('%') - endif - call FB_DisplayFiles(a:dir) -endfunction " }}} -" FB_DisplayFiles: displays the files in a given directory {{{ -" Description: -" Call this function only when the cursor is in a temporary buffer -function! FB_DisplayFiles(dir) - if !isdirectory(a:dir) - return - endif - call s:FB_SetSilentSettings() - " make this a "scratch" buffer - call s:FB_SetScratchSettings() - - let allowRegexp = s:FB_GetVar('FB_AllowRegexp', '') - let rejectRegexp = s:FB_GetVar('FB_RejectRegexp', '') - - " change to the directory to make processing simpler. - execute "lcd ".a:dir - " delete everything in the buffer. - " IMPORTANT: we need to be in a scratch buffer - 0,$ d_ - - let allFilenames = glob('*') - let dispFiles = "" - let subDirs = "../\n" - - let i = 1 - while 1 - let filename = s:FB_Strntok(allFilenames, "\n", i) - if filename == '' - break - endif - if isdirectory(filename) - let subDirs = subDirs.filename."/\n" - else - if allowRegexp != '' && filename !~ allowRegexp - elseif rejectRegexp != '' && filename =~ rejectRegexp - else - let dispFiles = dispFiles.filename."\n" - endif - endif - let i = i + 1 - endwhile - 0put!=dispFiles - 0put!=subDirs - " delte the last empty line resulting from the put - $ d_ - - call s:FB_SetHighlighting() - call s:FB_DisplayHelp() - call s:FB_SetMaps() - - " goto the first file/directory - 0 - call search('^"=', 'w') - normal! j: - - set nomodified nomodifiable - - call s:FB_ResetSilentSettings() -endfunction " }}} -" FB_SetVar: sets script local variables from outside this script {{{ -" Description: -function! FB_SetVar(varname, value) - let s:{a:varname} = a:value -endfunction " }}} - -" FB_SetHighlighting: sets syntax highlighting for the buffer {{{ -" Description: -" Origin: from explorer.vim in vim -function! FB_SetHighlighting() - " Set up syntax highlighting - " Something wrong with the evaluation of the conditional though... - if has("syntax") && exists("g:syntax_on") && !has("syntax_items") - syn match browseSynopsis "^\"[ -].*" - syn match browseDirectory "[^\"].*/ " - syn match browseDirectory "[^\"].*/$" - syn match browseCurDir "^\"= .*$" - syn match browseSortBy "^\" Sorted by .*$" contains=browseSuffixInfo - syn match browseSuffixInfo "(.*)$" contained - syn match browseFilter "^\" Not Showing:.*$" - syn match browseFiletime "«\d\+$" - - "hi def link browseSynopsis PreProc - hi def link browseSynopsis Special - hi def link browseDirectory Directory - hi def link browseCurDir Statement - hi def link browseSortBy String - hi def link browseSuffixInfo Type - hi def link browseFilter String - hi def link browseFiletime Ignore - hi def link browseSuffixes Type - endif -endfunction " }}} -" FB_SetMaps: sets buffer local maps {{{ -" Description: -function! FB_SetMaps() - nnoremap q :bdelete - nnoremap C :call FB_DisplayFiles(getcwd()) - nnoremap :bdelete - nnoremap :call FB_EditEntry() - nnoremap ? :call FB_ToggleHelp() - - " lock the user in this window - nnoremap -endfunction " }}} -" FB_SetSilentSettings: some settings which make things silent {{{ -" Description: -" Origin: from explorer.vim distributed with vim. -function! FB_SetSilentSettings() - let s:save_report=&report - let s:save_showcmd = &sc - set report=10000 noshowcmd -endfunction -" FB_ResetSilentSettings: reset settings set by FB_SetSilentSettings -" Description: -function! FB_ResetSilentSettings() - let &report=s:save_report - let &showcmd = s:save_showcmd -endfunction " }}} -" FB_SetScratchSettings: makes the present buffer a scratch buffer {{{ -" Description: -function! FB_SetScratchSettings() - " Turn off the swapfile, set the buffer type so that it won't get - " written, and so that it will get deleted when it gets hidden. - setlocal noreadonly modifiable - setlocal noswapfile - setlocal buftype=nowrite - setlocal bufhidden=delete - " Don't wrap around long lines - setlocal nowrap -endfunction - -" }}} -" FB_ToggleHelp: toggles verbosity of help {{{ -" Description: -function! FB_ToggleHelp() - let s:FB_VerboseHelp = 1 - s:FB_GetVar('FB_VerboseHelp', 0) - - call FB_DisplayFiles('.') -endfunction " }}} -" FB_DisplayHelp: displays a helpful header {{{ -" Description: -function! FB_DisplayHelp() - let verboseHelp = s:FB_GetVar('FB_VerboseHelp', 0) - if verboseHelp - let txt = - \ "\" : on file, choose the file and quit\n" - \ ."\" on dir, enter directory\n" - \ ."\" q/: quit without choosing\n" - \ ."\" C: change directory to getcwd()\n" - \ ."\" ?: toggle help verbosity\n" - \ ."\"= ".getcwd() - else - let txt = "\" ?: toggle help verbosity\n" - \ ."\"= ".getcwd() - endif - 0put!=txt -endfunction " }}} - -" Handles various actions in the file-browser -" FB_EditEntry: handles the user pressing on a line {{{ -" Description: -function! FB_EditEntry() - let line = getline('.') - - if isdirectory(line) - call FB_DisplayFiles(line) - endif - - " If the user has a call back function defined on choosing a file, handle - " it. - let cbf = s:FB_GetVar('FB_CallBackFunction', '') - if cbf != '' && line !~ '^" ' && filereadable(line) - let fname = fnamemodify(line, ':p') - bdelete - - let arguments = s:FB_GetVar('FB_CallBackFunctionArgs', '') - if arguments != '' - let arguments = ','.arguments - endif - call Tex_Debug('arguments = '.arguments, 'fb') - call Tex_Debug("call ".cbf."('".fname."'".arguments.')', 'fb') - exec "call ".cbf."('".fname."'".arguments.')' - endif -endfunction " }}} - -" FB_Strntok (string, tok, n) {{{ -" extract the n^th token from s seperated by tok. -" example: FB_Strntok('1,23,3', ',', 2) = 23 -fun! FB_Strntok(s, tok, n) - return matchstr( a:s.a:tok[0], '\v(\zs([^'.a:tok.']*)\ze['.a:tok.']){'.a:n.'}') -endfun " }}} -" FB_GetVar: gets the most local value of a variable {{{ -function! FB_GetVar(name, default) - if exists('s:'.a:name) - return s:{a:name} - 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 - -" }}} - -let &cpo = s:save_cpo - -" vim:fdm=marker:ff=unix:noet:ts=4:sw=4:nowrap diff --git a/files/.vim/plugin/imaps.vim b/files/.vim/plugin/imaps.vim deleted file mode 100644 index d871aa1..0000000 --- a/files/.vim/plugin/imaps.vim +++ /dev/null @@ -1,831 +0,0 @@ -" File: imaps.vim -" Authors: Srinath Avadhanula -" Benji Fisher -" -" WWW: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/vim-latex/vimfiles/plugin/imaps.vim?only_with_tag=MAIN -" -" Description: insert mode template expander with cursor placement -" while preserving filetype indentation. -" -" $Id: imaps.vim 997 2006-03-20 09:45:45Z srinathava $ -" -" Documentation: {{{ -" -" Motivation: -" this script provides a way to generate insert mode mappings which do not -" suffer from some of the problem of mappings and abbreviations while allowing -" cursor placement after the expansion. It can alternatively be thought of as -" a template expander. -" -" Consider an example. If you do -" -" imap lhs something -" -" then a mapping is set up. However, there will be the following problems: -" 1. the 'ttimeout' option will generally limit how easily you can type the -" lhs. if you type the left hand side too slowly, then the mapping will not -" be activated. -" 2. if you mistype one of the letters of the lhs, then the mapping is -" deactivated as soon as you backspace to correct the mistake. -" -" If, in order to take care of the above problems, you do instead -" -" iab lhs something -" -" then the timeout problem is solved and so is the problem of mistyping. -" however, abbreviations are only expanded after typing a non-word character. -" which causes problems of cursor placement after the expansion and invariably -" spurious spaces are inserted. -" -" Usage Example: -" this script attempts to solve all these problems by providing an emulation -" of imaps wchich does not suffer from its attendant problems. Because maps -" are activated without having to press additional characters, therefore -" cursor placement is possible. furthermore, file-type specific indentation is -" preserved, because the rhs is expanded as if the rhs is typed in literally -" by the user. -" -" The script already provides some default mappings. each "mapping" is of the -" form: -" -" call IMAP (lhs, rhs, ft) -" -" Some characters in the RHS have special meaning which help in cursor -" placement. -" -" Example One: -" -" call IMAP ("bit`", "\\begin{itemize}\\\item <++>\\\end{itemize}<++>", "tex") -" -" This effectively sets up the map for "bit`" whenever you edit a latex file. -" When you type in this sequence of letters, the following text is inserted: -" -" \begin{itemize} -" \item * -" \end{itemize}<++> -" -" where * shows the cursor position. The cursor position after inserting the -" text is decided by the position of the first "place-holder". Place holders -" are special characters which decide cursor placement and movement. In the -" example above, the place holder characters are <+ and +>. After you have typed -" in the item, press and you will be taken to the next set of <++>'s. -" Therefore by placing the <++> characters appropriately, you can minimize the -" use of movement keys. -" -" NOTE: Set g:Imap_UsePlaceHolders to 0 to disable placeholders altogether. -" Set -" g:Imap_PlaceHolderStart and g:Imap_PlaceHolderEnd -" to something else if you want different place holder characters. -" Also, b:Imap_PlaceHolderStart and b:Imap_PlaceHolderEnd override the values -" of g:Imap_PlaceHolderStart and g:Imap_PlaceHolderEnd respectively. This is -" useful for setting buffer specific place hoders. -" -" Example Two: -" You can use the command to insert dynamic elements such as dates. -" call IMAP ('date`', "\=strftime('%b %d %Y')\", '') -" -" sets up the map for date` to insert the current date. -" -"--------------------------------------%<-------------------------------------- -" Bonus: This script also provides a command Snip which puts tearoff strings, -" '----%<----' above and below the visually selected range of lines. The -" length of the string is chosen to be equal to the longest line in the range. -" Recommended Usage: -" '<,'>Snip -"--------------------------------------%<-------------------------------------- -" }}} - -" line continuation used here. -let s:save_cpo = &cpo -set cpo&vim - -" ============================================================================== -" Script Options / Variables -" ============================================================================== -" Options {{{ -if !exists('g:Imap_StickyPlaceHolders') - let g:Imap_StickyPlaceHolders = 1 -endif -if !exists('g:Imap_DeleteEmptyPlaceHolders') - let g:Imap_DeleteEmptyPlaceHolders = 1 -endif -" }}} -" Variables {{{ -" s:LHS_{ft}_{char} will be generated automatically. It will look like -" s:LHS_tex_o = 'fo\|foo\|boo' and contain all mapped sequences ending in "o". -" s:Map_{ft}_{lhs} will be generated automatically. It will look like -" s:Map_c_foo = 'for(<++>; <++>; <++>)', the mapping for "foo". -" -" }}} - -" ============================================================================== -" functions for easy insert mode mappings. -" ============================================================================== -" IMAP: Adds a "fake" insert mode mapping. {{{ -" For example, doing -" IMAP('abc', 'def' ft) -" will mean that if the letters abc are pressed in insert mode, then -" they will be replaced by def. If ft != '', then the "mapping" will be -" specific to the files of type ft. -" -" Using IMAP has a few advantages over simply doing: -" imap abc def -" 1. with imap, if you begin typing abc, the cursor will not advance and -" long as there is a possible completion, the letters a, b, c will be -" displayed on on top of the other. using this function avoids that. -" 2. with imap, if a backspace or arrow key is pressed before completing -" the word, then the mapping is lost. this function allows movement. -" (this ofcourse means that this function is only limited to -" left-hand-sides which do not have movement keys or unprintable -" characters) -" It works by only mapping the last character of the left-hand side. -" when this character is typed in, then a reverse lookup is done and if -" the previous characters consititute the left hand side of the mapping, -" the previously typed characters and erased and the right hand side is -" inserted - -" IMAP: set up a filetype specific mapping. -" Description: -" "maps" the lhs to rhs in files of type 'ft'. If supplied with 2 -" additional arguments, then those are assumed to be the placeholder -" characters in rhs. If unspecified, then the placeholder characters -" are assumed to be '<+' and '+>' These placeholder characters in -" a:rhs are replaced with the users setting of -" [bg]:Imap_PlaceHolderStart and [bg]:Imap_PlaceHolderEnd settings. -" -function! IMAP(lhs, rhs, ft, ...) - - " Find the place holders to save for IMAP_PutTextWithMovement() . - if a:0 < 2 - let phs = '<+' - let phe = '+>' - else - let phs = a:1 - let phe = a:2 - endif - - let hash = s:Hash(a:lhs) - let s:Map_{a:ft}_{hash} = a:rhs - let s:phs_{a:ft}_{hash} = phs - let s:phe_{a:ft}_{hash} = phe - - " Add a:lhs to the list of left-hand sides that end with lastLHSChar: - let lastLHSChar = a:lhs[strlen(a:lhs)-1] - let hash = s:Hash(lastLHSChar) - if !exists("s:LHS_" . a:ft . "_" . hash) - let s:LHS_{a:ft}_{hash} = escape(a:lhs, '\') - else - let s:LHS_{a:ft}_{hash} = escape(a:lhs, '\') .'\|'. s:LHS_{a:ft}_{hash} - endif - - " map only the last character of the left-hand side. - if lastLHSChar == ' ' - let lastLHSChar = '' - end - exe 'inoremap ' - \ escape(lastLHSChar, '|') - \ '=LookupCharacter("' . - \ escape(lastLHSChar, '\|"') . - \ '")' -endfunction - -" }}} -" IMAP_list: list the rhs and place holders corresponding to a:lhs {{{ -" -" Added mainly for debugging purposes, but maybe worth keeping. -function! IMAP_list(lhs) - let char = a:lhs[strlen(a:lhs)-1] - let charHash = s:Hash(char) - if exists("s:LHS_" . &ft ."_". charHash) && a:lhs =~ s:LHS_{&ft}_{charHash} - let ft = &ft - elseif exists("s:LHS__" . charHash) && a:lhs =~ s:LHS__{charHash} - let ft = "" - else - return "" - endif - let hash = s:Hash(a:lhs) - return "rhs = " . s:Map_{ft}_{hash} . " place holders = " . - \ s:phs_{ft}_{hash} . " and " . s:phe_{ft}_{hash} -endfunction -" }}} -" LookupCharacter: inserts mapping corresponding to this character {{{ -" -" This function extracts from s:LHS_{&ft}_{a:char} or s:LHS__{a:char} -" the longest lhs matching the current text. Then it replaces lhs with the -" corresponding rhs saved in s:Map_{ft}_{lhs} . -" The place-holder variables are passed to IMAP_PutTextWithMovement() . -function! s:LookupCharacter(char) - if IMAP_GetVal('Imap_FreezeImap', 0) == 1 - return a:char - endif - let charHash = s:Hash(a:char) - - " The line so far, including the character that triggered this function: - let text = strpart(getline("."), 0, col(".")-1) . a:char - " Prefer a local map to a global one, even if the local map is shorter. - " Is this what we want? Do we care? - " Use '\V' (very no-magic) so that only '\' is special, and it was already - " escaped when building up s:LHS_{&ft}_{charHash} . - if exists("s:LHS_" . &ft . "_" . charHash) - \ && text =~ "\\C\\V\\(" . s:LHS_{&ft}_{charHash} . "\\)\\$" - let ft = &ft - elseif exists("s:LHS__" . charHash) - \ && text =~ "\\C\\V\\(" . s:LHS__{charHash} . "\\)\\$" - let ft = "" - else - " If this is a character which could have been used to trigger an - " abbreviation, check if an abbreviation exists. - if a:char !~ '\k' - let lastword = matchstr(getline('.'), '\k\+$', '') - call IMAP_Debug('getting lastword = ['.lastword.']', 'imap') - if lastword != '' - " An extremeley wierd way to get around the fact that vim - " doesn't have the equivalent of the :mapcheck() function for - " abbreviations. - let _a = @a - exec "redir @a | silent! iab ".lastword." | redir END" - let abbreviationRHS = matchstr(@a."\n", "\n".'i\s\+'.lastword.'\s\+@\?\zs.*\ze'."\n") - - call IMAP_Debug('getting abbreviationRHS = ['.abbreviationRHS.']', 'imap') - - if @a =~ "No abbreviation found" || abbreviationRHS == "" - let @a = _a - return a:char - endif - - let @a = _a - let abbreviationRHS = escape(abbreviationRHS, '\<"') - exec 'let abbreviationRHS = "'.abbreviationRHS.'"' - - let lhs = lastword.a:char - let rhs = abbreviationRHS.a:char - let phs = IMAP_GetPlaceHolderStart() - let phe = IMAP_GetPlaceHolderEnd() - else - return a:char - endif - else - return a:char - endif - endif - " Find the longest left-hand side that matches the line so far. - " matchstr() returns the match that starts first. This automatically - " ensures that the longest LHS is used for the mapping. - if !exists('lhs') || !exists('rhs') - let lhs = matchstr(text, "\\C\\V\\(" . s:LHS_{ft}_{charHash} . "\\)\\$") - let hash = s:Hash(lhs) - let rhs = s:Map_{ft}_{hash} - let phs = s:phs_{ft}_{hash} - let phe = s:phe_{ft}_{hash} - endif - - if strlen(lhs) == 0 - return a:char - endif - " enough back-spaces to erase the left-hand side; -1 for the last - " character typed: - let bs = substitute(strpart(lhs, 1), ".", "\", "g") - return bs . IMAP_PutTextWithMovement(rhs, phs, phe) -endfunction - -" }}} -" IMAP_PutTextWithMovement: returns the string with movement appended {{{ -" Description: -" If a:str contains "placeholders", then appends movement commands to -" str in a way that the user moves to the first placeholder and enters -" insert or select mode. If supplied with 2 additional arguments, then -" they are assumed to be the placeholder specs. Otherwise, they are -" assumed to be '<+' and '+>'. These placeholder chars are replaced -" with the users settings of [bg]:Imap_PlaceHolderStart and -" [bg]:Imap_PlaceHolderEnd. -function! IMAP_PutTextWithMovement(str, ...) - - " The placeholders used in the particular input string. These can be - " different from what the user wants to use. - if a:0 < 2 - let phs = '<+' - let phe = '+>' - else - let phs = escape(a:1, '\') - let phe = escape(a:2, '\') - endif - - let text = a:str - - " The user's placeholder settings. - let phsUser = IMAP_GetPlaceHolderStart() - let pheUser = IMAP_GetPlaceHolderEnd() - - " Problem: depending on the setting of the 'encoding' option, a character - " such as "\xab" may not match itself. We try to get around this by - " changing the encoding of all our strings. At the end, we have to - " convert text back. - let phsEnc = s:Iconv(phs, "encode") - let pheEnc = s:Iconv(phe, "encode") - let phsUserEnc = s:Iconv(phsUser, "encode") - let pheUserEnc = s:Iconv(pheUser, "encode") - let textEnc = s:Iconv(text, "encode") - if textEnc != text - let textEncoded = 1 - else - let textEncoded = 0 - endif - - let pattern = '\V\(\.\{-}\)' .phs. '\(\.\{-}\)' .phe. '\(\.\*\)' - " If there are no placeholders, just return the text. - if textEnc !~ pattern - call IMAP_Debug('Not getting '.phs.' and '.phe.' in '.textEnc, 'imap') - return text - endif - " Break text up into "initial <+template+> final"; any piece may be empty. - let initialEnc = substitute(textEnc, pattern, '\1', '') - let templateEnc = substitute(textEnc, pattern, '\2', '') - let finalEnc = substitute(textEnc, pattern, '\3', '') - - " If the user does not want to use placeholders, then remove all but the - " first placeholder. - " Otherwise, replace all occurences of the placeholders here with the - " user's choice of placeholder settings. - if exists('g:Imap_UsePlaceHolders') && !g:Imap_UsePlaceHolders - let finalEnc = substitute(finalEnc, '\V'.phs.'\.\{-}'.phe, '', 'g') - else - let finalEnc = substitute(finalEnc, '\V'.phs.'\(\.\{-}\)'.phe, - \ phsUserEnc.'\1'.pheUserEnc, 'g') - endif - - " The substitutions are done, so convert back, if necessary. - if textEncoded - let initial = s:Iconv(initialEnc, "decode") - let template = s:Iconv(templateEnc, "decode") - let final = s:Iconv(finalEnc, "decode") - else - let initial = initialEnc - let template = templateEnc - let final = finalEnc - endif - - " Build up the text to insert: - " 1. the initial text plus an extra character; - " 2. go to Normal mode with , so it works even if 'insertmode' - " is set, and mark the position; - " 3. replace the extra character with tamplate and final; - " 4. back to Normal mode and restore the cursor position; - " 5. call IMAP_Jumpfunc(). - let template = phsUser . template . pheUser - " Old trick: insert and delete a character to get the same behavior at - " start, middle, or end of line and on empty lines. - let text = initial . "X\\:call IMAP_Mark('set')\\"_s" - let text = text . template . final - let text = text . "\\:call IMAP_Mark('go')\" - let text = text . "i\=IMAP_Jumpfunc('', 1)\" - - call IMAP_Debug('IMAP_PutTextWithMovement: text = ['.text.']', 'imap') - return text -endfunction - -" }}} -" IMAP_Jumpfunc: takes user to next <+place-holder+> {{{ -" Author: Luc Hermitte -" Arguments: -" direction: flag for the search() function. If set to '', search forwards, -" if 'b', then search backwards. See the {flags} argument of the -" |search()| function for valid values. -" inclusive: In vim, the search() function is 'exclusive', i.e we always goto -" next cursor match even if there is a match starting from the -" current cursor position. Setting this argument to 1 makes -" IMAP_Jumpfunc() also respect a match at the current cursor -" position. 'inclusive'ness is necessary for IMAP() because a -" placeholder string can occur at the very beginning of a map which -" we want to select. -" We use a non-zero value only in special conditions. Most mappings -" should use a zero value. -function! IMAP_Jumpfunc(direction, inclusive) - - " The user's placeholder settings. - let phsUser = IMAP_GetPlaceHolderStart() - let pheUser = IMAP_GetPlaceHolderEnd() - - let searchString = '' - " If this is not an inclusive search or if it is inclusive, but the - " current cursor position does not contain a placeholder character, then - " search for the placeholder characters. - if !a:inclusive || strpart(getline('.'), col('.')-1) !~ '\V\^'.phsUser - let searchString = '\V'.phsUser.'\_.\{-}'.pheUser - endif - - " If we didn't find any placeholders return quietly. - if searchString != '' && !search(searchString, a:direction) - return '' - endif - - " Open any closed folds and make this part of the text visible. - silent! foldopen! - - " Calculate if we have an empty placeholder or if it contains some - " description. - let template = - \ matchstr(strpart(getline('.'), col('.')-1), - \ '\V\^'.phsUser.'\zs\.\{-}\ze\('.pheUser.'\|\$\)') - let placeHolderEmpty = !strlen(template) - - " If we are selecting in exclusive mode, then we need to move one step to - " the right - let extramove = '' - if &selection == 'exclusive' - let extramove = 'l' - endif - - " Select till the end placeholder character. - let movement = "\v/\\V".pheUser."/e\".extramove - - " First remember what the search pattern was. s:RemoveLastHistoryItem will - " reset @/ to this pattern so we do not create new highlighting. - let g:Tex_LastSearchPattern = @/ - - " Now either goto insert mode or select mode. - if placeHolderEmpty && g:Imap_DeleteEmptyPlaceHolders - " delete the empty placeholder into the blackhole. - return movement."\"_c\:".s:RemoveLastHistoryItem."\" - else - return movement."\\:".s:RemoveLastHistoryItem."\gv\" - endif - -endfunction - -" }}} -" Maps for IMAP_Jumpfunc {{{ -" -" These mappings use and thus provide for easy user customization. When -" the user wants to map some other key to jump forward, he can do for -" instance: -" nmap ,f IMAP_JumpForward -" etc. - -" jumping forward and back in insert mode. -imap IMAP_JumpForward =IMAP_Jumpfunc('', 0) -imap IMAP_JumpBack =IMAP_Jumpfunc('b', 0) - -" jumping in normal mode -nmap IMAP_JumpForward i=IMAP_Jumpfunc('', 0) -nmap IMAP_JumpBack i=IMAP_Jumpfunc('b', 0) - -" deleting the present selection and then jumping forward. -vmap IMAP_DeleteAndJumpForward "_i=IMAP_Jumpfunc('', 0) -vmap IMAP_DeleteAndJumpBack "_i=IMAP_Jumpfunc('b', 0) - -" jumping forward without deleting present selection. -vmap IMAP_JumpForward i=IMAP_Jumpfunc('', 0) -vmap IMAP_JumpBack `=IMAP_Jumpfunc('b', 0) - -" }}} -" Default maps for IMAP_Jumpfunc {{{ -" map only if there is no mapping already. allows for user customization. -" NOTE: Default mappings for jumping to the previous placeholder are not -" provided. It is assumed that if the user will create such mappings -" hself if e so desires. -if !hasmapto('IMAP_JumpForward', 'i') - imap IMAP_JumpForward -endif -if !hasmapto('IMAP_JumpForward', 'n') - nmap IMAP_JumpForward -endif -if exists('g:Imap_StickyPlaceHolders') && g:Imap_StickyPlaceHolders - if !hasmapto('IMAP_JumpForward', 'v') - vmap IMAP_JumpForward - endif -else - if !hasmapto('IMAP_DeleteAndJumpForward', 'v') - vmap IMAP_DeleteAndJumpForward - endif -endif -" }}} - -nmap