From 5923f706617b966f114656c78bd60108d4ab1dde Mon Sep 17 00:00:00 2001 From: Pierre Habouzit Date: Wed, 18 Mar 2009 12:46:32 +0100 Subject: [PATCH] import all my dotfiles, awesome included. Signed-off-by: Pierre Habouzit --- +bin/git-new-workdir | 82 +++++ +bin/git-up | 100 +++++++ +bin/gitk | 4 + +bin/madconf | 26 ++ XCompose | 12 + Xkeyboard | 25 ++ Xresources | 79 +++++ Xsession | 13 + bash_profile | 18 ++ caffrc | 7 + config/awesome/rc.lua | 479 ++++++++++++++++++++++++++++++ config/terminfo/r/rxvt-unicode | Bin 0 -> 2165 bytes config/zsh/10_zshopts | 182 ++++++++++++ config/zsh/20_environment | 21 ++ config/zsh/30_binds | 27 ++ config/zsh/40_completion | 43 +++ config/zsh/50_aliases | 69 +++++ config/zsh/60_prompt | 85 ++++++ devscripts | 19 ++ gitconfig | 58 ++++ gnupg/gpg.conf | 16 + gtkrc | 11 + gtkrc-2.0 | 1 + pbuilder/B90_list_missing | 15 + pbuilder/B91_lintian | 7 + pbuilder/C10_launch_shell | 10 + pbuilder/D10_use_result | 9 + pbuilderrc | 66 ++++ quiltrc | 5 + reportbugrc | 7 + screenrc | 51 ++++ signature | 3 + signature.is | 7 + signature.pv | 5 + ssh/authorized_keys | 2 + ssh/config | 58 ++++ ssh/environment | 1 + toprc | 14 + vim/filetype.vim | 51 ++++ vim/ftplugin/debhints.vim | 51 ++++ vim/ftplugin/dosini.vim | 45 +++ vim/ftplugin/gitcommit.vim | 70 +++++ vim/ftplugin/html.vim | 1 + vim/ftplugin/mail/Mail_Re_set.vim | 310 +++++++++++++++++++ vim/ftplugin/man.vim | 178 +++++++++++ vim/ftplugin/smarty.vim | 1 + vim/ftplugin/tex.vim | 5 + vim/ftplugin/xhtml.vim | 1 + vim/ftplugin/xml.vim | 1 + vim/indent/mail.vim | 101 +++++++ vim/jptemplate/c/inc | 2 + vim/jptemplate/c/main | 4 + vim/jptemplate/cpp | 1 + vim/jptemplate/tex/frame | 3 + vim/jptemplate/tex/itemize | 6 + vim/plugin/BlockComment.vim | 234 +++++++++++++++ vim/plugin/ZoomWin.vim | 203 +++++++++++++ vim/plugin/file:line.vim | 19 ++ vim/plugin/jptemplate.vim | 203 +++++++++++++ vim/plugin/vis.vim | 300 +++++++++++++++++++ vim/syntax/actionscript.vim | 154 ++++++++++ vim/syntax/c.vim | 18 ++ vim/syntax/debhints.vim | 30 ++ vim/syntax/javascript.vim | 137 +++++++++ vim/syntax/mail.vim | 13 + vim/syntax/make.vim | 137 +++++++++ vim/syntax/massif.vim | 35 +++ vimrc | 456 ++++++++++++++++++++++++++++ zshenv | 45 +++ zshrc | 25 ++ 70 files changed, 4477 insertions(+) create mode 100755 +bin/git-new-workdir create mode 100755 +bin/git-up create mode 100755 +bin/gitk create mode 100755 +bin/madconf create mode 100644 XCompose create mode 100644 Xkeyboard create mode 100644 Xresources create mode 100755 Xsession create mode 100644 bash_profile create mode 100644 caffrc create mode 100644 config/awesome/rc.lua create mode 100644 config/terminfo/r/rxvt-unicode create mode 100644 config/zsh/10_zshopts create mode 100644 config/zsh/20_environment create mode 100644 config/zsh/30_binds create mode 100644 config/zsh/40_completion create mode 100644 config/zsh/50_aliases create mode 100644 config/zsh/60_prompt create mode 100644 devscripts create mode 100644 gitconfig create mode 100644 gnupg/gpg.conf create mode 100644 gtkrc create mode 120000 gtkrc-2.0 create mode 100755 pbuilder/B90_list_missing create mode 100755 pbuilder/B91_lintian create mode 100755 pbuilder/C10_launch_shell create mode 100755 pbuilder/D10_use_result create mode 100644 pbuilderrc create mode 100644 quiltrc create mode 100644 reportbugrc create mode 100644 screenrc create mode 100644 signature create mode 100644 signature.is create mode 100644 signature.pv create mode 100644 ssh/authorized_keys create mode 100644 ssh/config create mode 100644 ssh/environment create mode 100644 toprc create mode 100644 vim/filetype.vim create mode 100644 vim/ftplugin/debhints.vim create mode 100644 vim/ftplugin/dosini.vim create mode 100644 vim/ftplugin/gitcommit.vim create mode 120000 vim/ftplugin/html.vim create mode 100644 vim/ftplugin/mail/Mail_Re_set.vim create mode 100644 vim/ftplugin/man.vim create mode 120000 vim/ftplugin/smarty.vim create mode 100644 vim/ftplugin/tex.vim create mode 120000 vim/ftplugin/xhtml.vim create mode 120000 vim/ftplugin/xml.vim create mode 100644 vim/indent/mail.vim create mode 100644 vim/jptemplate/c/inc create mode 100644 vim/jptemplate/c/main create mode 120000 vim/jptemplate/cpp create mode 100644 vim/jptemplate/tex/frame create mode 100644 vim/jptemplate/tex/itemize create mode 100644 vim/plugin/BlockComment.vim create mode 100644 vim/plugin/ZoomWin.vim create mode 100644 vim/plugin/file:line.vim create mode 100644 vim/plugin/jptemplate.vim create mode 100644 vim/plugin/vis.vim create mode 100644 vim/syntax/actionscript.vim create mode 100644 vim/syntax/c.vim create mode 100644 vim/syntax/debhints.vim create mode 100644 vim/syntax/javascript.vim create mode 100644 vim/syntax/mail.vim create mode 100644 vim/syntax/make.vim create mode 100644 vim/syntax/massif.vim create mode 100644 vimrc create mode 100644 zshenv create mode 100644 zshrc diff --git a/+bin/git-new-workdir b/+bin/git-new-workdir new file mode 100755 index 0000000..2838546 --- /dev/null +++ b/+bin/git-new-workdir @@ -0,0 +1,82 @@ +#!/bin/sh + +usage () { + echo "usage:" $@ + exit 127 +} + +die () { + echo $@ + exit 128 +} + +if test $# -lt 2 || test $# -gt 3 +then + usage "$0 []" +fi + +orig_git=$1 +new_workdir=$2 +branch=$3 + +# want to make sure that what is pointed to has a .git directory ... +git_dir=$(cd "$orig_git" 2>/dev/null && + git rev-parse --git-dir 2>/dev/null) || + die "\"$orig_git\" is not a git repository!" + +case "$git_dir" in +.git) + git_dir="$orig_git/.git" + ;; +.) + git_dir=$orig_git + ;; +esac + +# don't link to a configured bare repository +isbare=$(git --git-dir="$git_dir" config --bool --get core.bare) +if test ztrue = z$isbare +then + die "\"$git_dir\" has core.bare set to true," \ + " remove from \"$git_dir/config\" to use $0" +fi + +# don't link to a workdir +if test -L "$git_dir/config" +then + die "\"$orig_git\" is a working directory only, please specify" \ + "a complete repository." +fi + +# don't recreate a workdir over an existing repository +if test -e "$new_workdir" +then + die "destination directory '$new_workdir' already exists." +fi + +# make sure the the links use full paths +git_dir=$(cd "$git_dir"; pwd) + +# create the workdir +mkdir -p "$new_workdir/.git" || die "unable to create \"$new_workdir\"!" + +# create the links to the original repo. explictly exclude index, HEAD and +# logs/HEAD from the list since they are purely related to the current working +# directory, and should not be shared. +for x in config refs logs/refs objects info hooks packed-refs remotes rr-cache +do + case $x in + */*) + mkdir -p "$(dirname "$new_workdir/.git/$x")" + ;; + esac + ln -s "$git_dir/$x" "$new_workdir/.git/$x" +done + +# now setup the workdir +cd "$new_workdir" +# copy the HEAD from the original repository as a default branch +cp "$git_dir/HEAD" .git/HEAD +# checkout the branch (either the same as HEAD from the original repository, or +# the one that was asked for) +git checkout -f $branch diff --git a/+bin/git-up b/+bin/git-up new file mode 100755 index 0000000..06a2c71 --- /dev/null +++ b/+bin/git-up @@ -0,0 +1,100 @@ +#!/bin/sh + +OPTIONS_SPEC="\ +$(basename $0) [options] [ []] +-- +k,gitk visualize unmerged differences +r,rebase perform a rebase +m,merge perform a merge +" +SUBDIRECTORY_OK=t +. git-sh-setup +require_work_tree + +lbranch=$(git symbolic-ref HEAD | sed -e s~refs/heads/~~) +remote=$(git config --get "branch.$lbranch.remote" || echo origin) +branch=$(git config --get "branch.$lbranch.merge" || echo "refs/heads/$lbranch") + +case "$(git config --bool --get madcoder.up-gitk)" in + true) gitk=gitk;; + *) gitk=: +esac +case "$(git config --bool --get "branch.$lbranch.rebase")" in + true) action=rebase;; + *) action=;; +esac + +while test $# != 0; do + case "$1" in + -k|--gitk) + shift; gitk=gitk;; + --no-gitk) + shift; gitk=:;; + -r|--rebase) + shift; action=rebase;; + --no-rebase) + shift; rebase=${rebase#rebase};; + -m|--merge) + shift; action=merge;; + --no-merge) + shift; rebase=${rebase#merge};; + --) + shift; break;; + *) + usage;; + esac +done + +case $# in + 0) ;; + 1) remote="$1";; + 2) remote="$1"; branch="$2";; + *) usage;; +esac + +git fetch "${remote}" +if test `git rev-list .."${remote}/${branch#refs/heads/}" -- | wc -l` = 0; then + echo "Current branch $lbranch is up to date." + exit 0 +fi + +$gitk HEAD..."${remote}/${branch#refs/heads/}" -- +if test -z "$action"; then + echo -n "(r)ebase/(m)erge/(q)uit ? " + read ans + case "$ans" in + r*) action=rebase;; + m*) action=merge;; + *) exit 0;; + esac +fi + +unclean= +git rev-parse --verify HEAD > /dev/null && \ + git update-index --refresh && \ + git diff-files --quiet && \ + git diff-index --cached --quiet HEAD -- || unclean=t + +case "$action" in + rebase) + test -z "$unclean" || git stash save "git-up stash" + git rebase "${remote}/${branch#refs/heads/}" + ;; + merge) + test -z "$unclean" || git stash save "git-up stash" + git merge "${remote}/${branch#refs/heads/}" + ;; + *) + echo 1>&2 "no action specified" + exit 1 + ;; +esac + +if test -n "$unclean"; then + if test -d "$(git rev-parse --git-dir)/../.dotest"; then + echo "" + echo "run 'git stash apply' when rebase is finished" + else + git stash apply + fi +fi diff --git a/+bin/gitk b/+bin/gitk new file mode 100755 index 0000000..ed958e6 --- /dev/null +++ b/+bin/gitk @@ -0,0 +1,4 @@ +#!/bin/sh +gitk=~/dev/scm/git/gitk-git/gitk-wish +test -x $gitk && exec $gitk "$@" +/usr/bin/gitk "$@" diff --git a/+bin/madconf b/+bin/madconf new file mode 100755 index 0000000..1e35d64 --- /dev/null +++ b/+bin/madconf @@ -0,0 +1,26 @@ +#!/bin/bash + +dotfiles="$(dirname "$(dirname "$(readlink -f "$0")")")" + +dot_ln() { + rel="$(echo "${1#$dotfiles/}" | sed -e 's~[^/]\+~..~g')/" + ln -s "${rel#../}${1#$HOME/}" "$HOME/$2" +} + +find $dotfiles -mindepth 1 -type d \( -name '[+.]*' -prune -o -print \) | while read d; do + mkdir -p "$HOME/.${d#$dotfiles/}" +done + +find $dotfiles -mindepth 1 -maxdepth 1 -type d -name '+*' | while read d; do + rm -f "$HOME/${d#$dotfiles/+}" + dot_ln "$d" "${d#$dotfiles/+}" +done + +find $dotfiles -mindepth 1 \( -name '[+.]*' -prune -o -not -type d -print \) | while read f; do + rm -f "$HOME/.${f#$dotfiles/}" + dot_ln "$f" ".${f#$dotfiles/}" +done + +for cache in zsh rlwrap ccache; do + mkdir -p "$HOME/.cache/$cache" +done diff --git a/XCompose b/XCompose new file mode 100644 index 0000000..c412a9b --- /dev/null +++ b/XCompose @@ -0,0 +1,12 @@ +include "%L" + + <3> : "…" U2026 # HORIZONTAL ELLIPSIS + : "ij" U0133 # LATIN SMALL LIGATURE IJ + : "‽" U203D # INTERROBANG + : "‽" U203D # INTERROBANG + <8> <8> : "∞" + <3> : "❤" + : "←" + : "→" + : "↑" + : "↓" diff --git a/Xkeyboard b/Xkeyboard new file mode 100644 index 0000000..cf78dba --- /dev/null +++ b/Xkeyboard @@ -0,0 +1,25 @@ +default xkb_keymap "mad_fr" { + xkb_keycodes { include "xfree86+aliases(qwerty)" }; + xkb_types { include "complete" }; + xkb_compat { include "complete" }; + xkb_symbols { + include "pc(pc105)+us+inet(logiaccess)" + key { [ Super_L, Super_L ] }; + key { [ Super_L, Super_L ] }; + + key { [ Multi_key, Multi_key ] }; + key { [ Multi_key, Multi_key ] }; + key { [ Insert, Insert ] }; + key { [ Multi_key, Multi_key ] }; + modifier_map Lock { }; + modifier_map Control { , Control_L }; + modifier_map Mod1 { , Alt_L }; + modifier_map Mod2 { Num_Lock }; + modifier_map Mod3 { }; + modifier_map Mod4 { , , Super_L }; + modifier_map Mod5 { }; + }; + xkb_geometry { include "pc(pc105)" }; +}; + +// vim:set ft=xkb: diff --git a/Xresources b/Xresources new file mode 100644 index 0000000..df3bffd --- /dev/null +++ b/Xresources @@ -0,0 +1,79 @@ +Xft.dpi: 75 + +/* XTerm */ +*VT100*font: -xos4-terminus-medium-r-normal-*-*-*-*-*-c-*-iso10646-1 +*VT100*font2: -xos4-terminus-medium-r-normal-*-*-*-*-*-c-*-iso10646-1 +*VT100*font3: -xos4-terminus-medium-r-normal-*-*-*-*-*-c-*-iso10646-1 +*VT100*font4: -xos4-terminus-medium-r-normal-*-*-*-*-*-c-*-iso10646-1 +*VT100*font5: -xos4-terminus-medium-r-normal-*-*-*-*-*-c-*-iso10646-1 +*VT100*font6: -xos4-terminus-medium-r-normal-*-*-*-*-*-c-*-iso10646-1 + +*metaSendsEscape: true + +*VT100*boldColors: true +*VT100*boldMode: false +*VT100*colorBDMode: true + +*VT100*foreground: rgb:bb/bb/bb +*VT100*background: rgb:0/0/0f + +*VT100*color0: rgb:0/0/0 +*VT100*color1: rgb:b2/18/18 +*VT100*color2: rgb:18/b2/18 +*VT100*color3: rgb:b2/68/18 +*VT100*color4: rgb:30/30/b0 +*VT100*color5: rgb:b2/18/b2 +*VT100*color6: rgb:18/b2/b2 +*VT100*color7: rgb:b2/b2/b2 +*VT100*color8: rgb:68/68/68 +*VT100*color9: rgb:ff/54/54 +*VT100*color10: rgb:54/ff/54 +*VT100*color11: rgb:ff/ff/54 +*VT100*color12: rgb:5c/80/ff +*VT100*color13: rgb:ff/54/ff +*VT100*color14: rgb:54/ff/ff +*VT100*color15: rgb:ff/ff/ff + +*charClass: 33:48,35:48,37-38:48,43-47:48,58:48,61:48,63-64:48,95:48,126:48 + +URxvt.cutchars: "`\"'()*,;<>[]{|}" +URxvt.font: -xos4-terminus-*-r-*-*-*-*-*-*-*-*-iso10646-* +URxvt.boldFfont: -xos4-terminus-*-r-*-*-*-*-*-*-*-*-iso10646-* +URxvt.color0: rgb:0/0/0 +URxvt.color1: rgb:b2/18/18 +URxvt.color2: rgb:18/b2/18 +URxvt.color3: rgb:b2/68/18 +URxvt.color4: rgb:30/30/b0 +URxvt.color5: rgb:b2/18/b2 +URxvt.color6: rgb:18/b2/b2 +URxvt.color7: rgb:b2/b2/b2 +URxvt.color8: rgb:68/68/68 +URxvt.color9: rgb:ff/54/54 +URxvt.color10: rgb:54/ff/54 +URxvt.color11: rgb:ff/ff/54 +URxvt.color12: rgb:5c/80/ff +URxvt.color13: rgb:ff/54/ff +URxvt.color14: rgb:54/ff/ff +URxvt.color15: rgb:ff/ff/ff +URxvt.foreground: rgb:bb/bb/bb +URxvt.background: rgb:0/0/0f +URxvt.colorBD: white +URxvt.intensityStyles: true + +URxvt.borderLess: true +URxvt.perl-ext: default + +URxvt.reverseVideo: false +URxvt.scrollstyle: plain +URxvt.scrollBar: false +URxvt.scrollTtyOutput: false +URxvt.scrollWithBuffer: false +URxvt.scrollTtyKeypress: true +URxvt.saveLines: 20000 +URxvt.insecure: true +URxvt.meta8: false +URxvt.mouseWheelScrollPage: false + +URxvt.cursorColor: rgb:bb/bb/bb +URxvt.pointerColor: rgb:bb/bb/bb +URxvt.secondaryScroll: true diff --git a/Xsession b/Xsession new file mode 100755 index 0000000..467207d --- /dev/null +++ b/Xsession @@ -0,0 +1,13 @@ +#! /bin/zsh + +. ~/.zsh/20_environment + +xkbcomp -w 0 -R/usr/share/X11/xkb ~/.Xkeyboard :0 + +for applet in kerneloops-applet nm-applet klipper unclutter; do + which $applet 1>/dev/null 2>&1 && (sleep 3 && $applet)& +done + +xsetroot -solid rgb:00/00/0f +xscreensaver -nosplash &! +exec awesome diff --git a/bash_profile b/bash_profile new file mode 100644 index 0000000..404c346 --- /dev/null +++ b/bash_profile @@ -0,0 +1,18 @@ +# ~/.bash_profile: executed by bash(1) for login shells. +# see /usr/share/doc/bash/examples/startup-files for examples. +# the files are located in the bash-doc package. + +# the default umask is set in /etc/login.defs +#umask 022 + +[ -x /bin/zsh ] && exec zsh -i + +# include .bashrc if it exists +if [ -f ~/.bashrc ]; then + . ~/.bashrc +fi + +# set PATH so it includes user's private bin if it exists +if [ -d ~/bin ] ; then + PATH=~/bin:"${PATH}" +fi diff --git a/caffrc b/caffrc new file mode 100644 index 0000000..e0f5221 --- /dev/null +++ b/caffrc @@ -0,0 +1,7 @@ +# .caffrc -- vim:syntax=perl: +# This file is in perl(1) format - see caff(1) for details. + +$CONFIG{'owner'} = 'Pierre habouzit'; +$CONFIG{'email'} = 'madcoder@debian.org'; +$CONFIG{'keyid'} = [ qw{BC6AFB5BA1EE761C} ]; +$CONFIG{'keyserver'} = 'pgpkeys.mit.edu'; diff --git a/config/awesome/rc.lua b/config/awesome/rc.lua new file mode 100644 index 0000000..cccf459 --- /dev/null +++ b/config/awesome/rc.lua @@ -0,0 +1,479 @@ +-- awesome 3 configuration file + +-- Include awesome library, with lots of useful function! +require("awful") +require("eminent") +require("wicked") +require("beautiful") + +function table.append(t, ...) + for _, v in ipairs({...}) do + table.insert(t, v) + end +end + +terminal = "x-terminal-emulator" +lock = 'xscreensaver-command -lock' +beautiful.init(awful.util.getdir("config").."/theme") + +-- {{{ Modkeys +modkey = "Mod4" +shift = "Shift" +alt = "Mod1" +control = "Control" + +k_n = {} +k_m = {modkey} +k_ms = {modkey, shift} +k_ma = {modkey, alt} +k_mc = {modkey, control} +k_a = {alt} +k_ac = {alt, control} +k_c = {control} +k_cs = {control, shift} +k_s = {shift} + +-- }}} + +-- {{{ Markup helper functions +-- Inline markup is a tad ugly, so use these functions +-- to dynamically create markup. +function fg(color, text) + return ''..text..'' +end + +function heading(text) + return fg(beautiful.fg_focus, text) +end + +-- }}} +-- {{{ Functions +-- Toggle whether we're viewing a tag +function tag_toggleview(tag) + tag:view(not tag:isselected()) +end + +-- Get the screen number we're on +function getscreen() + local sel = client.focus + return (sel and sel.screen) or mouse.screen +end + +-- Move current client to a specific screen +function client_movetoscreen(i) + client.focus.screen = i +end + +-- }}} +-- {{{ Set tag names + +for s = 1, screen.count() do + eminent.newtag(s, 5) + for i = 1, 10 do + eminent.tag.name(i, s, 'work-'..i) + end +end + +-- }}} +-- {{{ Taglist + +maintaglist = {} +maintaglist.buttons = { + button(k_n, 1, awful.tag.viewonly), + button(k_s, 1, awful.client.toggletag) +} + +-- }}} +-- {{{ Widgets + +-- {{{ Load Averages Widget + +loadwidget = widget({ + type = 'textbox', + name = 'gpuwidget', + align = 'right' +}) + +wicked.register(loadwidget, 'function', function (widget, args) + -- Use /proc/loadavg to get the average system load on 1, 5 and 15 minute intervals + local f = io.open('/proc/loadavg') + local n = f:read() + f:close() + + -- Find the third space + local pos = n:find(' ', n:find(' ', n:find(' ')+1)+1) + + return heading('Load')..': '..n:sub(1,pos-1) + +end, 2) + +-- }}} +-- {{{ CPU Usage Widget + +cputextwidget = widget({ + type = 'textbox', + name = 'cputextwidget', + align = 'right' +}) + +cputextwidget.text = heading('CPU')..': 00% ' +wicked.register(cputextwidget, 'cpu', function (widget, args) + local r = tonumber(args[1]) + local percent = args[1]..'%' + if r < 10 then + percent = '0'..percent + end + if r < 25 then + percent = fg('green', percent) + elseif r < 50 then + percent = fg('yellow', percent) + elseif r < 75 then + percent = fg('orange', percent) + else + percent = fg('red', percent) + end + return heading('CPU')..': '..percent..' ' +end, 2) + +-- }}} +-- {{{ CPU Graph Widget + +cpugraphwidget = widget({ + type = 'graph', + name = 'cpugraphwidget', + align = 'right' +}) + +cpugraphwidget.height = 0.85 +cpugraphwidget.width = 45 +cpugraphwidget.bg = '#333333' +cpugraphwidget.border_color = '#0a0a0a' +cpugraphwidget.grow = 'right' + +cpugraphwidget:plot_properties_set('cpu', { + fg = '#AEC6D8', + fg_center = '#285577', + fg_end = '#285577', + vertical_gradient = false +}) + +wicked.register(cpugraphwidget, 'cpu', '$1', 2, 'cpu') + +-- }}} +-- {{{ Memory Usage Widget + +memtextwidget = widget({ + type = 'textbox', + name = 'memtextwidget', + align = 'right' +}) + +memtextwidget.text = heading('MEM')..': ' +wicked.register(memtextwidget, 'mem', function (widget, args) + -- Add extra preceding zeroes when needed + local r = tonumber(args[1]) + local percent = args[1]..'%' + if r < 10 then + percent = '0'..percent + end + if r < 50 then + percent = fg('green', percent) + elseif r < 80 then + percent = fg('orange', percent) + else + percent = fg('red', percent) + end + return heading('MEM')..': '..percent..' '..args[2]..'M' +end, 2) + +-- }}} +-- {{{ Battery widget +--[[ +batterywidget = widget({ + type = 'textbox', + name = 'batterywidget', + align = 'right' +}) + +function batterywidget_update() + local v = io.popen("powersave -b|sed -ne 's/.*Remaining percent: \\(.*\\)/\\1/p'"):read() + local r = tonumber(v) + + percent = v + if r < 10 then + percent = fg('red', percent) + elseif r < 25 then + percent = fg('orange', percent) + else + percent = fg('green', percent) + end + batterywidget.text = heading('BAT')..': '..percent +end +batterywidget_update() +awful.hooks.timer.register(30, batterywidget_update) +--]] +-- }}} +-- {{{ spacers + +rspacer = widget({ type = 'textbox', name = 'rspacer', align = 'right' }) +rspacer.text = " │ " + +-- }}} +-- {{{ Clock +clockwidget = widget({ type = "textbox", name = "clockwidget", align = "right" }) +clock_update = function() + clockwidget.text = fg("#dddddd", os.date("%a %d %b - %H:%M")) +end +clock_update() +awful.hooks.timer.register(10, clock_update) + +-- }}} + +mymenubox = widget{ type = "textbox", name = "mytextbox", align = "left" } +mysystray = widget{ type = "systray", name = "mysystray", align = "right" } + +-- {{{ Statusbar + +mainstatusbar = {} + +for s = 1, screen.count() do + mainstatusbar[s] = wibox{ + position = "top", + height = 18, + name = "mainstatusbar" .. s, + } + + mainstatusbar[s].widgets = { + awful.widget.taglist.new(s, awful.widget.taglist.label.noempty, maintaglist.buttons), + maintaglist, + mymenubox, + + rspacer, loadwidget, + rspacer, cputextwidget, cpugraphwidget, + rspacer, memtextwidget, + rspacer, clockwidget, + s == 1 and rspacer or nil, + s == 1 and mysystray or nil, + } + mainstatusbar[s].screen = s +end + +-- }}} +-- }}} + +-- {{{ Keys +---- {{{ Global keys + +local hist = os.getenv("HOME") .. "/.cache/awesome/history" +globalkeys = { + -- Mod+{A/S}: Switch to prev/next tag + key(k_m, "Left", eminent.tag.prev), + key(k_m, "Right", eminent.tag.next), + + -- Mod+Shift+{A/S}: Move window to Prev/Next tag + key(k_ms, "Left", function() + awful.client.movetotag(eminent.tag.getprev()) + eminent.tag.prev() + end), + key(k_ms, "Right", function() + awful.client.movetotag(eminent.tag.getnext()) + eminent.tag.next() + end), + + -- Mod+Shift_{E/D}: move window to next/prev screen + key(k_mc, "Right", function() + local s = getscreen() + 1 + while s > screen.count() do + s = s-screen.count() + end + client_movetoscreen(s) + end), + key(k_mc, "Left", function() + local s = getscreen() - 1 + while s < 1 do + s = s+screen.count() + end + client_movetoscreen(s) + end), + + + -- Focus Prev/Next window + key(k_m, "j", + function () + awful.client.focus.byidx(1) + if client.focus then client.focus:raise() end + end), + key(k_m, "k", + function () + awful.client.focus.byidx(-1) + if client.focus then client.focus:raise() end + end), + + -- Swap window with the Prev/Next one + key(k_ms, "j", function () awful.client.swap.byidx(1) end), + key(k_ms, "k", function () awful.client.swap.byidx(-1) end), + + -- Mod+{E/D}: Switch to next/previous screen + key(k_m, "Tab", function () awful.screen.focus(1) end), + key(k_ms, "Tab", function () awful.screen.focus(-1) end), + + -- Mod+Enter: Launch a new terminal + key(k_m, "Return", function() awful.util.spawn(terminal) end), + key(k_ac, "Delete", awesome.restart), + key(k_m, "F12", function() awful.util.spawn(lock) end), + + -- Layout manipulation + key(k_m, "l", function () awful.tag.incmwfact(0.05) end), + key(k_m, "h", function () awful.tag.incmwfact(-0.05) end), + key(k_ms, "h", function () awful.tag.incnmaster(1) end), + key(k_ms, "l", function () awful.tag.incnmaster(-1) end), + key(k_mc, "h", function () awful.tag.incncol(1) end), + key(k_mc, "l", function () awful.tag.incncol(-1) end), + + -- Menu + key(k_m, "r", + function () + awful.prompt.run({ prompt = "Run: " }, + mymenubox, + awful.util.spawn, + awful.completion.bash, + awful.util.getdir("cache").."/commands") + end), + key(k_m, "F4", + function () + awful.prompt.run({ prompt = "Run Lua code: " }, + mymenubox, + awful.util.eval, + awful.prompt.bash, + awful.util.getdir("cache").."/lua_commands") + end), +} + +-- Mod+#: Switch to tag +-- Mod+Shift+#: Toggle tag display +-- Mod+Control+#: Move client to tag +-- Mod+Alt+#: Toggle client on tag + +for i = 1, 10 do + table.append(globalkeys, + key(k_m, i % 10, + function() + eminent.tag.goto(i, nil, true) + end), + + key(k_ms, i % 10, + function () + local t = eminent.tag.getn(i, nil, true) + if t ~= nil then t.selected = not t.selected end + end), + key(k_mc, i % 10, + function () + local t = eminent.tag.getn(i, nil, true) + if t ~= nil then awful.client.movetotag(t) end + end) + ) +end + +---- }}} +---- {{{ Client hotkeys + +clientkeys = { + key(k_m, "i", function (c) + if mymenubox.text then + mymenubox.text = "" + else + mymenubox.text = "Class: " .. c.class .. " Instance: ".. c.instance + end + end), + + -- Client manipulation + key(k_m, "c", function (c) c:kill() end), + key(k_m, "o", awful.client.floating.toggle), + key(k_m, "t", awful.client.togglemarked), + key(k_m, "F11", function (c) c.fullscreen = not c.fullscreen end) +} + +---- }}} + +root.keys(globalkeys) +-- }}} +-- {{{ Hooks + +awful.hooks.focus.register(function (c) + if not awful.client.ismarked(c) then + c.border_color = beautiful.border_focus + end +end) + +awful.hooks.unfocus.register(function (c) + if not awful.client.ismarked(c) then + c.border_color = beautiful.border_normal + end +end) + +awful.hooks.marked.register(function (c) + c.border_color = beautiful.border_marked +end) + +awful.hooks.unmarked.register(function (c) + c.border_color = beautiful.border_focus +end) + +-- Hook function to execute when the mouse enters a client. +awful.hooks.mouse_enter.register(function (c) + -- Sloppy focus + client.focus = c +end) + +awful.hooks.manage.register(function (c, startup) + if not startup and awful.client.focus.filter(c) then + c.screen = mouse.screen + end + + -- Add mouse bindings + c:buttons{ + button({ }, 1, function (c) client.focus = c; c:raise() end), + button(k_a, 1, awful.mouse.client.move), + button(k_a, 3, awful.mouse.client.resize) + } + + -- Create border + c.border_width = beautiful.border_width + c.border_color = beautiful.border_normal + + -- Make certain windows floating + local name = c.name:lower() + if name:find('pinentry') + then + c.floating = true + end + + -- Focus new clients + client.focus = c + c:keys(clientkeys) + c.size_hints_honor = false +end) + +-- Hook function to execute when arranging the screen +-- (tag switch, new client, etc) +awful.hooks.arrange.register(function (screen) + local sel = client.focus + if not sel then + sel = awful.client.focus.history.get(screen, 0) + if sel then client.focus = sel end + end + --[[ + if sel then + local m_c = mouse.coords() + + if m_c.x < sel.x - 1 or m_c.x > sel.x + sel.width + 1 or + m_c.y < sel.y - 1 or m_c.y > sel.y + sel.height + 1 then + if #m_c.buttons == 0 then + mouse.coords{x = sel.x + 5, y = sel.y + 5} + end + end + end + ]]-- +end) + +-- }}} diff --git a/config/terminfo/r/rxvt-unicode b/config/terminfo/r/rxvt-unicode new file mode 100644 index 0000000000000000000000000000000000000000..dd651dcccc4e245f68db1427b9e5bd62a1530976 GIT binary patch literal 2165 zcmb_cO=w(I6h8O8k*fHEf~91rrkYz~nl|(PW+pz9v1zPBOi3_WLnlg-PMVo!W-^&f z{xcB;7cHU?L{Om%5nPDi%9SYMLS1y>R>4gdBDA1rg$m{Qo%7z9q-iNa?{L2JopaB* zKj+*xEy|<)^cYpuwODO=v3_`=QanAIpIYB;wAQC;VU_i0RDSZylm-G#NM;B%87rHF^0rjv7g1rzP z`=Iwj4v2kFbt+q>Rj=w-18P{ERAXvVO=GSEsj3CFDse%uq25sEBOb1_8#mR5>SOhp z`a*rJzE?l0pVXx&I{MvGpk7E*plR)wIip+G@f7qFdaHek zXXzf)V+pbXS%Azz=4pIFKj)XJ$&Ja=B8Oovl{q=4!S1`Fed}VR3P3X?b~N zWp#CJZGFAb*w{FH^hn>KW1anpXA8%R{8~>z&~3pIL2-+Q_!iPnrwvT{m}Zs&*i7<} zBomK;%VkT?ZHcv|=eD%dmY&; literal 0 HcmV?d00001 diff --git a/config/zsh/10_zshopts b/config/zsh/10_zshopts new file mode 100644 index 0000000..a367d09 --- /dev/null +++ b/config/zsh/10_zshopts @@ -0,0 +1,182 @@ +#! /bin/zsh + +if test -x =dircolors; then + eval "`dircolors`" + export LS_COLORS="*.ogm=01;35:${LS_COLORS}" + export ZLS_COLORS=$LS_COLORS +fi + +autoload -U is-at-least + +#[ a ]########################################################################## +setopt aliases # expand aliases +setopt all_export # define = export +#setopt always_last_prompt # +setopt always_to_end # always go to end of word after completion +setopt append_history # append to history, dont truncate it +setopt auto_cd # do cd path if only 'path' is given as command +setopt auto_continue # send SIGCONT to jobs disowned +setopt auto_list # list choice on ambiguous command +setopt auto_menu # show menu for completion +setopt no_autoname_dirs # after foo=/absolute/path, ~foo may expand to + # /absolute/path, but `%~' in prompt won't give + # `~foo' until `~foo' has been used (rtfm closely) +setopt auto_param_keys # remove trailing spaces after completion if needed +setopt auto_param_slash # add slash for directories +setopt auto_pushd # cd = pushd +setopt auto_remove_slash # remove slash on dirs if word separator added +setopt auto_resume # simgle word resume if possible + +#[ b ]########################################################################## +setopt bad_pattern # warn on bad file patterns +setopt bang_hist # yeah ! expansion +setopt bare_glob_qual # () is quaifier list +setopt no_bash_auto_list # auto_list is sufficient, i want it on first tab +setopt beep # beep me o yeah +setopt no_bg_nice # don't renice jobs in bg +setopt no_brace_ccl # don't expand of {adasd} +setopt no_bsd_echo # dont want BSD echo compat + +#[ c ]########################################################################## +setopt case_glob # case sensitive globbing +setopt c_bases # understand 12#120 as 120 in base 12 +setopt no_cdable_vars # dont add ~ automagically +setopt no_chase_dots # foo/bar/.. is foo/ even if bar is a symlink +setopt chase_links # cd to a symlink is in fact cd to the true dir +setopt check_jobs # check jobs on exit +setopt clobber # redirection can create files +setopt complete_aliases # dont replace alias before completion +setopt complete_in_word # we want completion to be done from cursor in word +setopt correct # try to correct command line +setopt no_correct_all # don't coorect args +setopt no_csh_junkiehistory # csh sucks +setopt no_csh_junkie_loops # want do /list/; done +setopt no_csh_junkie_quotes # csh quote rules sucks too +setopt no_csh_nullcmd # want to keep my (READ)?NULLCMD settings +setopt no_csh_null_glob # don't erase not matched globs silently + +#[ d-g ]######################################################################## +setopt no_dvorak # use only regular (qw|az)erty +setopt no_emacs # use rather bindkeys that builtin +setopt equals # perform = file expansions +setopt no_err_exit # don't weant to see exit status even if nonzero +setopt no_err_return # no return from a function with non 0 ending cmds +setopt exec # sure we want to exec commands +setopt extended_glob # #,~,^ expansion +setopt no_extended_history # regular history +setopt no_flow_control # ignore ^S/^Q +setopt function_argzero # $0 == name of script +setopt glob # sure i want globbing +setopt no_global_export # local vars are not globals one +setopt global_rcs # use global rcs +setopt no_glob_assign # no globbing on foo=*, use foo=(*) +setopt no_glob_complete # don't generate matches and cycle through them +setopt no_glob_dots # not require . in filename to be match explicitely +setopt no_glob_subst # no recursive expansion + +#[ h-j ]######################################################################## +setopt hash_cmds # do not always search through path, hash cmds +setopt hash_dirs # hash directories holding commands too +setopt hash_list_all # verify path hash on completion +setopt hist_allow_clobber # add | to redirections in history +setopt no_hist_beep # don't beep on history expansion errors +#setopt hist_expire_dups_first +setopt hist_find_no_dups # don't show dups even if not contiguous +setopt hist_ignore_all_dups # ignore all -- even non contiguous -- dups +#setopt hist_ignore_dups # ignore contiguous dups +setopt no_hist_ignore_space # historify commands with spaces too +setopt hist_no_functions # don't save functions defs in history +setopt hist_no_store # remove hists access cmds from hist +setopt hist_reduce_blanks # remove superfluous blanks +setopt hist_save_no_dups # no dups on history saving +setopt hist_verify # some expansion gadget +setopt no_hup # don't SIGHUP bg cmds on logout +setopt no_ignore_braces # do braces expansion +setopt no_ignore_eof # don't ignore ^D +setopt no_inc_appendhistory # dont' append incrementally +#setopt interactive +setopt interactive_comments # allow comments in interactive shell + +#[ k-o ]######################################################################## +setopt no_ksh_arrays # don't emulate ksh arrays +setopt no_ksh_autoload # don't do some dark autoload on function call +setopt no_ksh_glob # ignore @ before () +setopt ksh_option_print # modify setopt output +setopt no_ksh_typeset # use zsh typeset +setopt list_ambiguous # unambiguous prefix completion is done silently +setopt no_list_beep # don't beep for completion +setopt list_packed # different width for completion +setopt no_list_rows_first # sort by colums +setopt list_types # show types of listing files +#setopt local_* # used in functions RTFM +#setopt login # don't have to do it myself +setopt long_list_jobs # list jobs in long format +setopt magic_equal_subst # foo= is file expanded +setopt no_mail_warning # auto-explained +setopt mark_dirs # adds / on dirs in filename completion +setopt no_menu_complete # don't show menu on ambiguous completion +setopt monitor # job control +setopt multios # multi redirection allowed +setopt nonomatch # do not print error on non matched patterns +setopt notify # notify immediately, not on next prompt +setopt no_null_glob # don't delete not matched globs +setopt numeric_glob_sort # sort in numeric order rather than lexicographic +setopt no_octal_zeroes # 010 = 9 sucks +setopt no_overstrike # dont start le in overstrike mode + +#[ p-r ]######################################################################## +setopt path_dirs # search in path even if cmd has '/' in it +setopt no_posix_builtins # yeah don't like posix, i'm a rebel +setopt print_eight_bit # just to be sure +#setopt privileged # +setopt no_prompt_bang # dont perform history expansion in prompt +setopt no_prompt_cr # don'tprint before prompt ---> see precmd ! +setopt prompt_percent # expand % escapes in prompt +setopt prompt_subst # subts in prompt +setopt pushd_ignore_dups # ignore dups in pushd +#setopt pushd_minus # exchange +/- +setopt pushd_silent # don't print stack after push/pop +setopt pushd_to_home # pushd == pushd $HOME +setopt rc_expand_param # some expansion trick for arrays in params +setopt rc_quotes # '' == ' in 'quoted exprs +setopt rcs # source all /etc rcs +setopt no_rec_exact # recognize exact match even if ambiguous +#setopt restricted # +setopt no_rm_star_silent # ask user before rm foo/* +setopt no_rm_star_wait # dont't idle 10 seconds + +#[ s-z ]######################################################################## +setopt no_share_history # traditional bash-history +setopt no_sh_file_expansion # dont expand filnames first +setopt no_sh_glob # allow globbing with [(|)<] +#setopt shin_stdin # +setopt no_sh_nullcmd # use my NULLCMD +setopt sh_option_letters # interprete single option letters a la ksh +setopt short_loops # short loops +setopt no_sh_word_split # `s="a b"; a=($s)' => array of length 1, not 2 +#setopt single_command # +setopt no_single_line_zle # use multiline editor +setopt no_sun_keyboard_hack # i don't use sun kb +setopt transient_rprompt # better for cut/paste +#setopt typeset_silent # +#setopt unset # +#setopt verbose # +setopt vi # use bindkeys +setopt no_xtrace # do not debug by default +setopt zle # use zsh le + +is-at-least 4.3.0 && { + unsetopt hist_save_by_copy +} + +[ -w $zsh_cache ] && HISTFILE=$zsh_cache/history + +HISTSIZE=10000 # size of history +LISTMAX=1000 # never ask +NULLCMD='cat' # use cat for > null commands +REPORTTIME=2 # report time if execution exceeds amount of seconds +SAVEHIST=10000 # maximum of history events to be save +LOGCHECK=60 +watch=(notme) # watch login/logout +WORDCHARS="*?_-.[]~/&;!#$%^(){}<>" + # part of word in line editor diff --git a/config/zsh/20_environment b/config/zsh/20_environment new file mode 100644 index 0000000..7de3640 --- /dev/null +++ b/config/zsh/20_environment @@ -0,0 +1,21 @@ +#! /bin/zsh + +export EMAIL="pierre.habouzit@m4x.org" +export FULLNAME="Pierre Habouzit" + +export DEBEMAIL="madcoder@debian.org" +export DEBFULLNAME=$FULLNAME + +export CVS_RSH="ssh" +export MANWIDTH=80 +export EDITOR=vim +export VISUAL=vim +export CCACHE_DIR=$HOME/.cache/ccache +export CCACHE_NOCOMPRESS=NoThanks + +export RLWRAP_HOME=~/.cache/rlwrap/ +export GTK_IM_MODULE=xim + +export LC_MESSAGES=C +export LC_ALL= +unset VERBOSE diff --git a/config/zsh/30_binds b/config/zsh/30_binds new file mode 100644 index 0000000..58fe1c7 --- /dev/null +++ b/config/zsh/30_binds @@ -0,0 +1,27 @@ +#! /bin/zsh + +zmodload -i zsh/complist + +bindkey "^[[3~" delete-char +bindkey "^[[5~" backward-word +bindkey "^[[6~" forward-word + +bindkey "^[[A" history-beginning-search-backward +bindkey "^[[B" history-beginning-search-forward + +bindkey "^A" beginning-of-line +bindkey "^[[7~" beginning-of-line +bindkey "^E" end-of-line +bindkey "[8~" end-of-line +bindkey "^K" kill-line +bindkey "^L" clear-screen +bindkey "^R" history-incremental-search-backward +bindkey "^U" kill-whole-line +bindkey "^V" quoted-insert +bindkey "^W" backward-kill-word + +bindkey -M menuselect "h" backward-char +bindkey -M menuselect "j" down-line-or-history +bindkey -M menuselect "k" up-line-or-history +bindkey -M menuselect "l" forward-char +bindkey -M menuselect "u" undo diff --git a/config/zsh/40_completion b/config/zsh/40_completion new file mode 100644 index 0000000..8483231 --- /dev/null +++ b/config/zsh/40_completion @@ -0,0 +1,43 @@ +#! /bin/zsh + +zstyle ':completion:*' add-space true +zstyle ':completion:*' completer _expand _complete _match _prefix _approximate _list +zstyle ':completion:*' menu select=1 +zstyle ':completion:*' file-sort name +zstyle ':completion:*' list-colors ${(s.:.)ZLS_COLORS} +zstyle ':completion:*' matcher-list 'r:|[._-]=** r:|=**' 'l:|=** r:|=**' +zstyle ':completion:*' menu select +zstyle ':completion:*:approximate:*' max-errors 'reply=( $(( ($#PREFIX+$#SUFFIX)/3 )) numeric )' + +#[ Formats ]#################################################################### +zstyle ':completion:*' group 1 +zstyle ':completion:*' format '%B---- %d%b' +zstyle ':completion:*:corrections' format '%B---- %d (errors %e)%b' +zstyle ':completion:*:descriptions' format "%B---- %d%b" +zstyle ':completion:*:messages' format '%B%U---- %d%u%b' +zstyle ':completion:*:warnings' format "%B$fg[red]%}---- no match for: $fg[white]%d%b" +zstyle ':completion:*' group-name '' + +#[ Kill ]####################################################################### +zstyle ':completion:*:processes' command 'ps -au$USER -o pid,time,cmd|grep -v "ps -au$USER -o pid,time,cmd"' +zstyle ':completion:*:*:kill:*:processes' list-colors '=(#b) #([0-9]#)[ 0-9:]#([^ ]#)*=01;30=01;31=01;38' + +#[ hosts and users ]############################################################ +zstyle ':completion:*:hosts' list-colors '=(#b)(*)(.madism.org)=01;30=01;31' '=[^.]#=01;31' + +users=(root sab madcoder x2000habouzit habouzit) +zstyle ':completion:*' users $users + +zstyle ':completion:*:*:[ak]dvi:*' file-patterns \ + '*.dvi:dvi-files:DVI\ files *(-/):directories:Directories' '*:all-files' +zstyle ':completion:*:*:kghostview:*' file-patterns \ + '*.(ps|pdf)(|.gz|.bz2):pspdf-files:PostScript\ or\ PDF\ files *(-/):directories:Directories' '*:all-files' +zstyle ':completion:*:*:swfplayer:*' file-patterns \ + '*.swf:swf-files:Swf\ files *(-/):directories:Directories' '*:all-files' + +zstyle ':completion:*' file-patterns \ + '%p:globbed-files: *(-/):directories:Directories' '*:all-files' + +#[ ignores for vim ]############################################################ + +zstyle ':completion:*:*:vi(m|):*:*files' ignored-patterns '*?.(aux|dvi|ps|pdf|bbl|toc|lot|lof|o|cm?)' diff --git a/config/zsh/50_aliases b/config/zsh/50_aliases new file mode 100644 index 0000000..e829180 --- /dev/null +++ b/config/zsh/50_aliases @@ -0,0 +1,69 @@ +#!/bin/zsh + +autoload zmv +alias mmv='noglob zmv -W' + +alias su='export XAUTHORITY=${HOME}/.Xauthority ; sudo -s' +alias sudo='export XAUTHORITY=${HOME}/.Xauthority ; sudo' + +alias du="du -hcs" +alias df="df -h" + +case "${$(ls --version | head -1)##* }" in + [0-5].*) + alias ls="ls -bCF --color=auto" + ;; + *) + alias ls="ls --group-directories-first -bCF --color=auto" + ;; +esac + +alias la="ls --color=always -a" +alias ll="ls --color=always -l" +alias lla="ls --color=always -la" +alias lal="ls --color=always -la" + +alias egrep='egrep --color=tty -d skip' +alias fgrep='fgrep --color=tty -d skip' +alias grep='grep --color=tty -d skip' + +alias md='mkdir' +alias rd='rmdir' +alias rm='rm -i' +alias s2disk='sudo s2disk' +alias s2both='sudo s2both' +alias s2ram='sudo s2ram' + +alias v=vim +alias m=madmutt +cvi () { + vim -O ${${1%.[hc]}%.}.{h,c} +} +xvi () { + vim -O ${${${1%.h}%.cpp}%.}.{h,cpp} +} +ovi () { + vim -O ${${1%.ml}%.}.ml{i,} +} + +alias br='bts --mbox show' + +upload() { + debsign *.changes + dput -e 0 gluck_delayed *.changes +} + +conf_push () { + echo -n "PUSHING TO $1" + rsync -au --exclude=.git --delete ~madcoder/.madconf/ "$1":.madconf/ + ssh "$1" LC_ALL=C .madconf/bin/madconf + echo "." +} + +dict () { dictl "$@" 2>&1 | colorit | less -R ; } + +vman() { + if /usr/bin/man "$@" > /dev/null; then + vim -m -n --noplugin -c "set ft=man" -c "noremap q :q" -c "Man $@" + fi +} diff --git a/config/zsh/60_prompt b/config/zsh/60_prompt new file mode 100644 index 0000000..70f9c98 --- /dev/null +++ b/config/zsh/60_prompt @@ -0,0 +1,85 @@ +#! /bin/zsh + +autoload colors && colors + +precmd() { + local git_dir branch + + psvar=() + git_dir=$(git rev-parse --git-dir 2> /dev/null) || return + if test -d "$git_dir/rebase-apply"; then + if test -f "$git_dir/rebase-apply/rebasing"; then + psvar[3]="rebase" + elif test -f "$git_dir/rebase-apply/applying"; then + psvar[3]="am" + else + psvar[3]="am/rebase" + fi + branch="$(git symbolic-ref HEAD 2>/dev/null)" + elif test -f "$git_dir/rebase-merge/interactive"; then + psvar[3]="rebase -i" + branch="$(cat "$git_dir/rebase-merge/head-name")" + elif test -d "$git_dir/rebase-merge"; then + psvar[3]="rebase -m" + branch="$(cat "$git_dir/rebase-merge/head-name")" + elif test -f "$git_dir/MERGE_HEAD"; then + psvar[3]="merge" + branch="$(git symbolic-ref HEAD 2>/dev/null)" + else + test -f "$git_dir/BISECT_LOG" && psvar[3]="bisect" + branch="$(git symbolic-ref HEAD 2>/dev/null)" || \ + branch="$(git describe --exact-match HEAD 2>/dev/null)" || \ + branch="$(cut -c1-7 "$git_dir/HEAD")..." + fi + + psvar[1]="${$(readlink -f ${git_dir:h})/$HOME/~}" + psvar[2]="${branch#refs/heads/}" +} + +_mad_prompt_setup() { + local rst + local -a pcc + + rst="%{$reset_color%}" + pcc[1]="%{$reset_color${1:-$fg_no_bold[green]}%}" + pcc[2]="%{$reset_color${2:-$fg_no_bold[yellow]}%}" + pcc[3]="%{$reset_color${3:-$fg_no_bold[cyan]}%}" + pcc[4]="%{$reset_color${4:-$fg_bold[red]}%}" + +#%{$'\e[s\e[A\e[4Dblah\e[u'$reset_color%} +#%{$'\e[400C\e[20D'%}"──────────────────── + PROMPT="\ +$pcc[1]┌─(%B%T$pcc[1])──%(1v.<$pcc[3]%1v %B%U%2v%u%(3v.$pcc[4] <%3v>.)$pcc[1]>.)── +$pcc[1]└[$pcc[2]%{%(?..%S)%}%m%s$pcc[1]] $rst" + RPROMPT="$pcc[1](%B%~$pcc[1])$rst" + POSTEDIT=$reset_color +} + +if [ $UID -eq 0 ]; then + PATH=~root/bin:/usr/local/sbin:/usr/sbin:/sbin:$PATH + PROMPT="%{$reset_color$fg_bold[yellow]%}[%{$fg_bold[red]%}%n %m%{$fg_bold[yellow]%}]%{$reset_color%} " + RPROMPT="%{$reset_color$fg_no_bold[red]%}(%{$fg_bold[red]%}%~%{$fg_no_bold[red]%})%{$reset_color%} " +else + PATH="/usr/lib/ccache:${HOME}/bin:${PATH}" + _mad_prompt_setup +fi + +case "$TERM" in + screen) + PROMPT="${PROMPT}%{kzsh\\%}" + + preexec () { + local CMD=${1[(wr)^(*=*|sudo|exec|-*)]} + echo -ne "\ek$CMD\e\\" + } + ;; + xterm|rxvt-unicode) + PROMPT="${PROMPT}%{]2;zsh%}" + + preexec () { + local CMD=${1[(wr)^(*=*|sudo|exec|-*)]} + echo -ne "\e]2;$CMD\007" + } + ;; + *);; +esac diff --git a/devscripts b/devscripts new file mode 100644 index 0000000..e4b7ff4 --- /dev/null +++ b/devscripts @@ -0,0 +1,19 @@ +#!/bin/sh + +# use ccache in debuild +export DEBUILD_PRESERVE_ENVVARS=CCACHE_DIR,CCACHE_NOCOMPRESS,MAKE,MAKEFLAGS,DEB_BUILD_OPTIONS +export DEBUILD_SET_ENVVAR_PATH="/usr/lib/ccache:/usr/sbin:/usr/bin:/sbin:/bin" + +# debsign +export DEBSIGN_KEYID=madcoder@debian.org + +# for dch +export DEBCHANGE_RELEASE_HEURISTIC=changelog + +# for bts +export BTS_CACHE=yes +export BTS_CACHE_MODE=mbox + +# for nmudiff +export NMUDIFF_NEWREPORT=no +export NMUDIFF_MUTT=no diff --git a/gitconfig b/gitconfig new file mode 100644 index 0000000..d445115 --- /dev/null +++ b/gitconfig @@ -0,0 +1,58 @@ +[madcoder] + up-gitk=true + +[alias] + co=checkout -m + ci=commit -s + st=!git -p status + pop=reset HEAD~1 + unstash=stash apply + amend=commit -s --amend + squash=commit -s --amend -C HEAD + p=!git push origin HEAD + debtag=!git tag -f -a -s -m `git-symbolic-ref HEAD | sed -e 's~refs/heads/~~'`/`dpkg-parsechangelog | sed -n 's/^Version: \\(.*:\\)\\?//p'` `git-symbolic-ref HEAD | sed -e 's~refs/heads/~~'`/`dpkg-parsechangelog | sed -n 's/^Version: \\(.*:\\)\\?//p'` + b64=commit -sm'64bits fix' + send=send-email --annotate --compose -C -C -M -n --to + stage=add + unstage=reset HEAD -- + track=add -N + untrack=rm --cached + +[core] + #editor=gvim -f + editor=vim + excludesfile=/home/madcoder/.git-excludes + +[user] + name = Pierre Habouzit + email = madcoder@debian.org + +[color] + ui = auto + diff = auto + branch = auto + status = auto + pager = true + interactive = auto + +[color "diff"] + meta = green + frag = yellow + old = magenta + new = bold cyan +; message = bold + +[color "status"] + header = bold blue + added = green + changed = bold red + untracked = bold yellow +[merge] + verbosity = 1 + renameLimit = 10000 +[clean] + requireForce = false +[pack] + threads = 0 +[status] + submodulesummary = 1 diff --git a/gnupg/gpg.conf b/gnupg/gpg.conf new file mode 100644 index 0000000..9e4d17d --- /dev/null +++ b/gnupg/gpg.conf @@ -0,0 +1,16 @@ +#keyserver keyring.debian.org +#keyserver-options auto-key-retrieve +keyserver subkeys.pgp.net + +use-agent + +no-default-keyring +keyring pubring.gpg +#keyring /usr/share/keyrings/debian-archive-keyring.gpg +#keyring /usr/share/keyrings/debian-keyring.gpg +primary-keyring pubring.gpg + +utf8-strings + +default-key A1EE761C +encrypt-to A1EE761C diff --git a/gtkrc b/gtkrc new file mode 100644 index 0000000..7857c4d --- /dev/null +++ b/gtkrc @@ -0,0 +1,11 @@ +include "/usr/share/themes/Clearlooks/gtk-2.0/gtkrc" + +style "user-font" +{ + font_name="DejaVu Sans 11" +} +widget_class "*" style "user-font" + +gtk-theme-name="Clearlooks" +gtk-font-name="DejaVu Sans 11" +gtk-key-theme-name="Emacs" diff --git a/gtkrc-2.0 b/gtkrc-2.0 new file mode 120000 index 0000000..c3e14d0 --- /dev/null +++ b/gtkrc-2.0 @@ -0,0 +1 @@ +gtkrc \ No newline at end of file diff --git a/pbuilder/B90_list_missing b/pbuilder/B90_list_missing new file mode 100755 index 0000000..e6ec629 --- /dev/null +++ b/pbuilder/B90_list_missing @@ -0,0 +1,15 @@ +#!/bin/sh + +# Depends on CDBS module in debian/rules: +# include /usr/share/cdbs/1/rules/utils.mk + +cd /tmp/buildd/*/debian/.. + +fakeroot debian/rules -q list-missing 2>/dev/null || { + if [ "$?" = "1" ]; then + echo "I: checking for missing files." + fakeroot debian/rules list-missing || true + fi +} + +#EOF diff --git a/pbuilder/B91_lintian b/pbuilder/B91_lintian new file mode 100755 index 0000000..1800bfc --- /dev/null +++ b/pbuilder/B91_lintian @@ -0,0 +1,7 @@ +#!/bin/sh +# run lintian + +echo "I: installing lintian and running it on the package" +apt-get install -y --force-yes lintian &>/dev/null +lintian --allow-root --color=always -I /tmp/buildd/*.changes | tee /tmp/buildd/lintian + diff --git a/pbuilder/C10_launch_shell b/pbuilder/C10_launch_shell new file mode 100755 index 0000000..027a8d2 --- /dev/null +++ b/pbuilder/C10_launch_shell @@ -0,0 +1,10 @@ +#!/bin/sh +# invoke shell if build fails. + +echo "I: installing necessary tools to work in the damn chroot" +apt-get install -y --force-yes vim zsh &>/dev/null +dpkg --purge nvi + +cd /tmp/buildd/*/debian/.. + +/bin/zsh < /dev/tty > /dev/tty diff --git a/pbuilder/D10_use_result b/pbuilder/D10_use_result new file mode 100755 index 0000000..e778a8c --- /dev/null +++ b/pbuilder/D10_use_result @@ -0,0 +1,9 @@ +#!/bin/sh + +echo "I: adding ${LOCALREPO} in sources.list" +echo "deb ftp://mirror.corp/debian sid main" > /etc/apt/sources.list +echo "deb file://${LOCALREPO} ./" >> /etc/apt/sources.list + +echo "I: running apt-get update" +apt-get update &>/dev/null + diff --git a/pbuilderrc b/pbuilderrc new file mode 100644 index 0000000..cffd162 --- /dev/null +++ b/pbuilderrc @@ -0,0 +1,66 @@ +#! /bin/sh + +die() { + echo $1 1>&2 + exit ${2:-"1"} +} + +nofail() { + $@ || true +} + +silent() { + $@ &> /dev/null +} + +create_dir() { + dir="$1" + user="${2:-root}" + group="${3:-root}" + [ -d "$dir" ] || nofail silent install -d "$dir" -o "$user" -g "$group" +} + +# +# hack so that build result is in $(package)_$(version) dir +# +export LOCALREPO="${HOME}/debian/results" +mkdir -p ${LOCALREPO} +silent pushd ${LOCALREPO} +dpkg-scanpackages . /dev/null > Packages 2>/dev/null +silent popd + +[ -f changelog ] && cd .. + +if [ -f debian/changelog ]; then + pkg_version=`dpkg-parsechangelog | sed -n 's/^Version: //p'` + pkg_source=`dpkg-parsechangelog | sed -n 's/^Source: //p'` + [ -n "${pkg_source}" -a -n "${pkg_version}" ] || die "Cannot understand package version/source" + BUILDRESULT="${LOCALREPO}/${pkg_source}_${pkg_version}" + mkdir -p $BUILDRESULT +fi + +# +# Configuration +# +APTCACHE="/var/cache/apt/archives" +DISTRIBUTION="sid" +HOOKDIR=${HOME}/.pbuilder/ +#PDEBUILD_PBUILDER=cowbuilder + +# +# ccache +# +export CCACHE_DIR="/var/cache/pbuilder/ccache" +export PATH="/usr/lib/ccache:$PATH" +EXTRAPACKAGES="$EXTRAPACKAGES ccache" +BINDMOUNTS="$BINDMOUNTS $CCACHE_DIR $LOCALREPO" +if test -d /srv/nfs/debian; then + BINDMOUNTS="$BINDMOUNTS /srv/nfs/debian" +fi +create_dir "$CCACHE_DIR" 1234 1234 + +#BASETGZ=/var/cache/pbuilder/base-stable-i386.tgz +#BASETGZ=/var/cache/pbuilder/base-i386.tgz +#BASETGZ=/var/cache/pbuilder/etch.tgz + +export debian_chroot="pbuild$$" diff --git a/quiltrc b/quiltrc new file mode 100644 index 0000000..08731bb --- /dev/null +++ b/quiltrc @@ -0,0 +1,5 @@ +QUILT_PATCH_OPTS="--unified-reject-files" +QUILT_DIFF_ARGS="--no-timestamps --no-index -p ab --color=auto" +QUILT_REFRESH_ARGS="--no-timestamps --no-index" +#QUILT_PATCHES="debian/patches" +QUILT_COLORS="diff_hdr=1;32:diff_add=1;34:diff_rem=1;31:diff_hunk=1;33:diff_ctx=35:diff_cctx=33" diff --git a/reportbugrc b/reportbugrc new file mode 100644 index 0000000..a90a1b9 --- /dev/null +++ b/reportbugrc @@ -0,0 +1,7 @@ +# reportbug preferences file +# Version of reportbug this preferences file was written by +reportbug_version "3.15" +# default operating mode: one of: novice, standard, advanced, expert +mode standard +# default user interface +ui text diff --git a/screenrc b/screenrc new file mode 100644 index 0000000..0b7cfd0 --- /dev/null +++ b/screenrc @@ -0,0 +1,51 @@ + +autodetach on +defscrollback 5000 +escape ^aa +nonblock on +obuflimit 1024 +startup_message off +vbell off +zombie cr + + +# Support alternate screens so that, for example, when you +# quit out of vi, the display is redrawn as it was before vi +# redrew the full screen. +altscreen on + +# +# Kludges +# + +# find a free shell +bind s select zsh +bind c screen 0 +bind ^c screen 0 +bind 0 select 0 + +# +# Colors +# + +sorendition "=b rW" +caption always "%{= kg}[%{kB} %c %{kg}][%= %{kw}%-w%{kr}[%{kW}%n %t%{kr}]%{kw}%+w %=%{kg}][%{kB} %l %{kg}]%{kw}" + +# +# Shift PgUp/PgDn +# + +bindkey "^[[5;2~" eval "copy" "stuff ^b" +bindkey -m "^[[5;2~" stuff ^b +bindkey -m "^[[6;2~" stuff ^f + +# xterm understands both im/ic and doesn't have a status line. +# Note: Do not specify im and ic in the real termcap/info file as +# some programs (e.g. vi) will not work anymore. +termcap xterm hs@:cs=\E[%i%d;%dr:im=\E[4h:ei=\E[4l +terminfo xterm hs@:cs=\E[%i%p1%d;%p2%dr:im=\E[4h:ei=\E[4l +# 80/132 column switching must be enabled for ^AW to work +termcapinfo xterm Z0=\E[?3h:Z1=\E[?3l:is=\E[r\E[m\E[2J\E[H\E[?7h\E[?1;4;6l +# Make the output buffer large for (fast) xterms. +termcapinfo xterm* OL=100 + diff --git a/signature b/signature new file mode 100644 index 0000000..f68aeb8 --- /dev/null +++ b/signature @@ -0,0 +1,3 @@ +·O· Pierre Habouzit +··O madcoder@debian.org +OOO http://www.madism.org diff --git a/signature.is b/signature.is new file mode 100644 index 0000000..85fc098 --- /dev/null +++ b/signature.is @@ -0,0 +1,7 @@ +Intersec +Pierre Habouzit +Tél : +33 (0)1 5570 3346 +Mob : +33 (0)6 1636 8131 +Fax : +33 (0)1 5570 3332 +37 Rue Pierre Lhomme +92400 Courbevoie diff --git a/signature.pv b/signature.pv new file mode 100644 index 0000000..513b38e --- /dev/null +++ b/signature.pv @@ -0,0 +1,5 @@ +·O· Pierre Habouzit +··O madcoder@debian.org +OOO http://www.madism.org +-- + [-- This mail is private and should not ever be declassified --] diff --git a/ssh/authorized_keys b/ssh/authorized_keys new file mode 100644 index 0000000..12f51cd --- /dev/null +++ b/ssh/authorized_keys @@ -0,0 +1,2 @@ +ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAyYvz6t9Ul7PW1vlLO8tM3UnkeoWGgJWujK3WXEoE3T2zW3mrvaPOf4GcjXqzNJY/1LGYXQny9i9FE1owzCX9amNcpDmKpuL2C56bMrK2oM2V6sl6NF6rbXaGB211sTqllB4exHhtV7F21IiiteFoXs3Bv060ruECCNPPtijXVA0cU1oxEDa1oy0rbjUGD8oeaB/vftgAFk2KW7Wx5jqLk8Cu5viK2a+Sj8RaiclFY+CaPHpfBpgJSsO6kPks+YKHNhQBgBdDfjh5psQ2YlEsrzTWEfCfVHxzcLmWpDAWSlomgpWbfV1zKdhzYhz2Tpt+DaPzNCiAdDiRyPeAknj6VQ== madcoder@artemis +ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAzeuXc+l1NCBj/k94K/pfTT83dkp2ktvWxZbTUpwxySwRbmxCKccVd8hqwomCihMfONAVz+gMX4RWJNyPlcoE/R7nEpMPzR9aMoCLkWOETrZmRcCefM/ekLjPIT1YCN7eSQ7kfd3kaWj6CLxsxoWOLtLA9wB1o3DJ0EnmDFL3bhdtz4AqT4n3Ide2TAZ6C+do7bYBfVHAiTBCrbEctMTUEpVqdvXM9HPFueYNZgTYDVcckJd7MxVpdV63m4ms5ZeOpb4gBmjyCeE6fp5bo+ZeOzkT2nB5rnM5HrPT9JwKqBBkcFh8Wc4YGKW5e1wXmP6F7RF3csg6fhNZUrVpeNZ0Yw== madcoder@laphroaig diff --git a/ssh/config b/ssh/config new file mode 100644 index 0000000..fcaef81 --- /dev/null +++ b/ssh/config @@ -0,0 +1,58 @@ +HashKnownHosts no +ControlMaster auto +ControlPath ~/.ssh/ssh_control_%h_%p_%r +VerifyHostKeyDNS yes + +Host * + Compression yes + +Host *.inria.fr + User habouzit + +#--- intersec --- +Host demo-sfr + Hostname localhost + Port 2222 + User intersec + +Host *.intersec.com + Port 2222 + User madcoder + +Host beacon + Hostname beacon.intersec.eu + Port 2222 + User madcoder + +Host pap + Hostname localhost + Port 2222 + +Host rudy + HostName rudy.intersec.com + Port 2222 + User madcoder + +Host rood + HostName rood.intersec.com + Port 2222 + User madcoder + +#--- madism --- +Host *.madism.org + User madcoder + ForwardAgent yes + +Host pan + Port 2222 + HostName pan.madism.org + +#--- X --- +Host *.polytechnique.org + User x2000habouzit + +#--- DEBIAN --- +Host *.debian.org + User madcoder + +# vim: set syntax=sshconfig: diff --git a/ssh/environment b/ssh/environment new file mode 100644 index 0000000..6c89372 --- /dev/null +++ b/ssh/environment @@ -0,0 +1 @@ +SSH_ASKPASS=ssh-askpass diff --git a/toprc b/toprc new file mode 100644 index 0000000..904c854 --- /dev/null +++ b/toprc @@ -0,0 +1,14 @@ +RCfile for "top with windows" # shameless braggin' +Id:a, Mode_altscr=1, Mode_irixps=1, Delay_time=1.000, Curwin=0 +Def fieldscur=AEHIOQTWKNMXbcdfgjplrsuvyz + winflags=32568, sortindx=10, maxtasks=0 + summclr=1, msgsclr=1, headclr=3, taskclr=1 +Job fieldscur=ABXcefgjlrstuvyzMKNHIWOPQD + winflags=32304, sortindx=0, maxtasks=0 + summclr=6, msgsclr=6, headclr=7, taskclr=6 +Mem fieldscur=ANOPQRSTUVXbcdefgjlmyzWHIK + winflags=32568, sortindx=13, maxtasks=0 + summclr=5, msgsclr=5, headclr=4, taskclr=5 +Usr fieldscur=DEFGABXchijlopqrstuvyzMKNW + winflags=32560, sortindx=4, maxtasks=0 + summclr=3, msgsclr=3, headclr=2, taskclr=3 diff --git a/vim/filetype.vim b/vim/filetype.vim new file mode 100644 index 0000000..0cb4c21 --- /dev/null +++ b/vim/filetype.vim @@ -0,0 +1,51 @@ +if exists("did_load_filetypes") + finish +endif + +augroup filetypedetect + au BufRead,BufNewFile *.JS setf javascript + au BufRead,BufNewFile *.jas setf asm + au BufRead,BufNewFile *.swfml setf xml + au BufRead,BufNewFile *.hx setf haxe + + au BufRead,BufNewFile *.tpl setf xhtml + + au BufRead,BufNewFile massif.*.txt setf massif + + " HTML (.shtml and .stm for server side) + au BufNewFile,BufRead *.html,*.htm,*.shtml,*.stm call s:FThtml() + + au BufNewFile,BufRead {mad,}mutt{ng,}-*-\w\+ setf mail + + au BufNewFile,BufRead */X11/xkb/* setf xkb + + au BufNewFile,BufRead *.as setf actionscript + + au BufNewFile,BufRead *.dox setf doxygen + + au BufNewFile,BufRead *.iop setf d + + au BufNewFile,BufRead .gitsendemail.* setf gitsendemail + + " Distinguish between HTML, XHTML and Django + fun! s:FThtml() + let n = 1 + while n < 10 && n < line("$") + if getline(n) =~ '' + setf htmldjango + return + endif + let n = n + 1 + endwhile + setf html + endfun + +augroup END diff --git a/vim/ftplugin/debhints.vim b/vim/ftplugin/debhints.vim new file mode 100644 index 0000000..609710e --- /dev/null +++ b/vim/ftplugin/debhints.vim @@ -0,0 +1,51 @@ +" Vim filetype plugin file (GUI menu, folding and completion) + +if exists("b:did_ftplugin") + finish +endif +let b:did_ftplugin=1 + +" {{{1 Local settings (do on every load) +if !exists("g:debchangelog_fold_disable") + setlocal foldmethod=expr +endif +setlocal foldexpr=DebHintsFold(v:lnum) + +setlocal comments=:# + +" Clean unloading +let b:undo_ftplugin = "setlocal tw< comments< foldmethod< foldexpr< foldtext<" +" }}}1 + +if exists("g:did_debhints_ftplugin") + finish +endif + +" Don't load another plugin (this is global) +let g:did_debhints_ftplugin = 1 + +" {{{1 folding + +function! DebHintsFold(lnum) + let line = getline(a:lnum) + let prevl = getline(a:lnum - 1) + if line =~ '^ *finished *$' + return '>1' + endif + if line =~ '^# *[0-9]\{8\}$' + return '>1' " beginning of a new day + endif + if line == '' && prevl == '' + return '1' + endif + if prevl == '' || prevl =~ '^#[0-9]\{8\}$' + return '>2' " beginning of a new hint chunk + endif + return '=' +endfunction + +" }}} +silent! normal zo + +" vim: set foldmethod=marker: + diff --git a/vim/ftplugin/dosini.vim b/vim/ftplugin/dosini.vim new file mode 100644 index 0000000..e80ed37 --- /dev/null +++ b/vim/ftplugin/dosini.vim @@ -0,0 +1,45 @@ +" Vim filetype plugin file (GUI menu, folding and completion) + +if exists("b:did_ftplugin") + finish +endif +let b:did_ftplugin=1 + +" {{{1 Local settings (do on every load) +if !exists("g:debchangelog_fold_disable") + setlocal foldmethod=expr +endif +setlocal foldexpr=DosiniFold(v:lnum) + +setlocal comments=:# + +" Clean unloading +let b:undo_ftplugin = "setlocal tw< comments< foldmethod< foldexpr< foldtext<" +" }}}1 + +if exists("g:did_dosini_ftplugin") + finish +endif + +" Don't load another plugin (this is global) +let g:did_dosini_ftplugin = 1 + +" {{{1 folding + +function! DosiniFold(lnum) + let line = getline(a:lnum) + let prevl = getline(a:lnum - 1) + if line =~ '^ *\[' + return '>1' + endif + if line == '' && prevl == '' + return '>0' + endif + return '=' +endfunction + +" }}} +silent! normal zo + +" vim: set foldmethod=marker: + diff --git a/vim/ftplugin/gitcommit.vim b/vim/ftplugin/gitcommit.vim new file mode 100644 index 0000000..86880fa --- /dev/null +++ b/vim/ftplugin/gitcommit.vim @@ -0,0 +1,70 @@ +"============================================================================= +" Copyright: Copyright © Pierre Habouzit +" Permission is hereby granted to use and distribute this code, +" with or without modifications, provided that this copyright +" notice is copied with it. Like anything else that's free, +" git.vim is provided *as is* and comes with no +" warranty of any kind, either expressed or implied. In no +" event will the copyright holder be liable for any damages +" resulting from the use of this software. +" Description: git-commit(1) helper +" Maintainer: Pierre Habouzit +" Last Changed: Mon, 26 Nov 2007 10:06:15 +0100 +" Usage: This file should live in your ftplugin directory. +" +" The configurations variables are: +" +" g:git_diff_opts - options to add to git diff, +" (default "-C -C") +" g:git_diff_spawn_mode - use auto-split on commit ? +" * 1 == hsplit +" * 2 == vsplit +" * none else (default) +" +" The default keymaping is: +" +" gd - view the diff in a hsplit +" ghd - view the diff in a hsplit +" gvd - view the diff in a vsplit +"========================================================================={{{= + +if exists("b:did_ftplugin") | finish | endif + +let b:did_ftplugin = 1 + +setlocal tw=74 +setlocal nowarn nowb + +function! Git_diff_windows(vertsplit, auto, opts) + if a:vertsplit + rightbelow vnew + else + rightbelow new + endif + silent! setlocal ft=diff previewwindow bufhidden=delete nobackup noswf nobuflisted nowrap buftype=nofile + exe "normal :r!cd .. && LANG=C git diff --stat -p --cached ".a:opts."\no\1GddO\" + setlocal nomodifiable + noremap q :bw + if a:auto + redraw! + wincmd p + redraw! + endif +endfunction + +noremap gd :call Git_diff_windows(0, 0) +noremap ghd :call Git_diff_windows(0, 0) +noremap gvd :call Git_diff_windows(1, 0) + +if !exists("g:git_diff_opts") + let g:git_diff_opts = "-C -C" +endif +if exists("g:git_diff_spawn_mode") + if g:git_diff_spawn_mode == 1 + call Git_diff_windows(0, 1, g:git_diff_opts) + elseif g:git_diff_spawn_mode == 2 + call Git_diff_windows(1, 1, g:git_diff_opts) + endif +endif + +" }}} diff --git a/vim/ftplugin/html.vim b/vim/ftplugin/html.vim new file mode 120000 index 0000000..2b44ad4 --- /dev/null +++ b/vim/ftplugin/html.vim @@ -0,0 +1 @@ +/usr/share/vim-scripts/ftplugin/xml.vim \ No newline at end of file diff --git a/vim/ftplugin/mail/Mail_Re_set.vim b/vim/ftplugin/mail/Mail_Re_set.vim new file mode 100644 index 0000000..ff80f5e --- /dev/null +++ b/vim/ftplugin/mail/Mail_Re_set.vim @@ -0,0 +1,310 @@ +"=============================================================== +" File : Mail_Re_set.vim +" Initial Author: Dominique Baldo +" Maintained by : Luc Hermitte +" +" URL: http://hermitte.free.fr/vim/ressources/vimfiles/ftplugin/mail/Mail_Re_set.vim +" Version : 2.0 +" Last update : 15th Oct 2003 +"--------------------------------------------------------------- +" Purpose : Merge the occurencies of "Re:" and "Re[n]" within +" e-mails'subject in only one. +" +" Calling conv. : Source this file and invoke :MailCondenseRe +" define -> nnoremap ,re :MailCondenseRe +" Installation : {{{1 +" * Drop this file into {rtp}/ftplugin/mail/ +" * There are two available options you can customize into your .vimrc : +" + Customize the way you want the "Re" string to be built thanks to +" g:mail_re_fmt or b:mail_re_fmt : +" "Re:" -- use "Re:" +" "Re[]:" -- use "Re[n]:" when {n}>1 ; "Re:" when {n}=1 +" "Re[1]:" -- use "Re[n]:" even when {n}>1 +" "Mimic:" -- use what the correspondant used [default] +" + Customize the placement order between "Re:" and "[TAGS]" thanks to +" g:mail_tag_placement or b:mail_tag_placement : +" "detect_news" -- use "Re: [TAG]" for usenet, "[TAG] Re:" otherwise +" [default] +" "tag_second" -- use "Re: [TAG]" ; seems to be the right option on +" usenet according to trn +" "tag_first" -- use "[TAG] Re:" ; seems to be the option used on +" tagged mailing lists +" }}}1 +"--------------------------------------------------------------- +" History: {{{1 +" * Ver 2.0 : Also merges the various forward indicators +" * Ver 1.4d : Fix a bug when g:mail_tag_placement is set +" Use "normal!" instead of "normal" +" New kind of whitespace managed: some people composing +" their messages from yahogroups web site may use very odd +" whitespace characters to write "Re :" +" * Ver 1.4c : Fix a small bug +" * Ver 1.4b : "Rép:" added to the list of "Re:" equivalents +" * ver 1.4 : "Re:" can be placed before or after the first [tag] present +" according to g:mail_tag_placement +" * ver 1.3 : Requires VIM 6.x +" Export a command: :MailCondenseRe +" count the Re: thanks to the global length of strings +" The subject build can be customized thanks to g:mail_re_fmt +" or b:mail_re_fmt. +" The "Re:" will be placed after the [Tags] if present. +" * ver 1.2 : Translation of the comments +" * ver 1.1 : Handle "Réf" produced by some french e-mailers +" Answer by "Re:" most of the time +" * ver 1.0 : Replace "Re: Re: ..." n times by "Re[n]:" +" +" TODO: {{{1 +" * Add an option to add equivalents to "Re:" -- only "Réf.:" and "Rép:" are +" supported at this time. +" * Support "Re: Fwd: Fw: " +" }}}1 +"=============================================================== +if exists("b:loaded_local_Mail_Re_set_vim") | finish | endif +let b:loaded_local_Mail_Re_set_vim = 1 + +command! -b -nargs=0 MailCondenseRe :call Mail_Merge_Re_n_Fwd(1,0) +command! -b -nargs=0 MailCondenseFwd :call Mail_Merge_Re_n_Fwd(0,1) +command! -b -nargs=0 MailCondenseReAndFwd :call Mail_Merge_Re_n_Fwd(1,1) +"=============================================================== +" Global definitions {{{1 +if exists("g:loaded_Mail_Re_set_vim") | finish | endif +let g:loaded_Mail_Re_set_vim = 1 +"=============================================================== +" Options {{{2 +"--------------------------------------------------------------- +" Function: s:SetVar() to global or default {{{3 +function! s:SetVar(var,default) + if exists('b:'.a:var) | let s:{a:var} = b:{a:var} + elseif exists('g:'.a:var) | let s:{a:var} = g:{a:var} + else | exe "let s:{a:var} =".a:default + " Rem: doing :exe to dequote a:default + endif +endfunction +command! -nargs=+ SetVar :call SetVar() +" }}}3 +"--------------------------------------------------------------- +SetVar mail_re_fmt 'Mimic:' +" SetVar mail_re_fmt 'Re[1]:' +" Possible formats : +" "Re:" -- use "Re:" +" "Re[]:" -- use "Re[n]:" when {n}>1 ; "Re:" when {n}=1 +" "Re[1]:" -- use "Re[n]:" even when {n}>1 +" "Mimic:" -- use what the correspondant used +" In order to override the default, set g:mail_re_fmt or b:mail_re_fmt to one +" of the previous values. + +SetVar mail_tag_placement 'tag_second' +" Possible values : +" "detect_news" -- use "Re: [TAG]" for usenet, "[TAG] Re:" otherwise +" "tag_second" -- use "Re: [TAG]" ; seems the right option on usenet +" accordingto trn +" "tag_first" -- use "[TAG] Re:" ; seems the option used on taggued +" mailing lists + +"--------------------------------------------------------------- +delcommand SetVar +" Options }}}2 +"=============================================================== +" Functions {{{2 +"--------------------------------------------------------------- +" Function: ErrorMsg(msg) {{{3 +function! s:ErrorMsg(msg) + if has('gui_running') + call confirm(a:msg, '&Ok', 1, "Error") + else + echohl ErrorMsg + echo a:msg + echohl None + endif +endfunction +command! -buffer -nargs=1 MailErrMsg :call ErrorMsg() +" }}}3 +"--------------------------------------------------------------- +" Function: InsertReToSubject(Re_expr, Subject, Tag) {{{3 +" Purpose: Add the Re expression to the subject according to the possible +" presence of tags in the subject. +" So, "[Tag] subject" will be changed to "[Tag] Re: subject" and +" not "Re: [Tag] subject" +function! s:InsertReToSubject(Re_expr, Subject, Tag) + let tag = (''!=a:Tag) ? a:Tag . ' ' : a:Tag + if "detect_news" == s:mail_tag_placement + normal! 1G + let l = search('^\s*$') + let l = search('^Newsgroups:', 'bW') + let tag_after = (0!=l) ? 1 : 0 + elseif "tag_second" == s:mail_tag_placement | let tag_after = 1 + elseif "tag_first" == s:mail_tag_placement | let tag_after = 0 + else | let tag_after = 0 + MailErrMsg "<".s:mail_tag_placement."> is not a valid value for mail_tag_placement" + " behave as tag first ! + endif + if tag_after + return 'Subject: '.a:Re_expr. tag . a:Subject + else + return 'Subject: '. tag .a:Re_expr. a:Subject + endif + " return substitute(a:Subject, '^\(\[.*\] \=\)\=', ' \1'.a:Re_expr, '') +endfunction +" }}}3 +"--------------------------------------------------------------- +" Function : MergeRe(string) {{{3 +" Purpose : Substitute "Re:Re:Re:Re" by "Re:" and "Re:Re[2]" by "Re[3]" +let s:tag = '\[.\{-}\]' +let s:Re = '\1) ? 1 : 0 + elseif "Re:" ==s:mail_re_fmt | let do_num = 0 + else | MailErrMsg "<".s:mail_re_fmt."> is not a valid value for mail_re_fmt" + " behave as "mimic" ! + let do_num = (""!=num) ? 1 : 0 + endif + + " Build the subject of the response {{{4 + if 1==do_num + " add num to n (the number of "Re:") + let n = n + n2 + let subject = s:InsertReToSubject('Re['.n.']: ', subject, tag) + " let subject = 'Subject: '.tag.'Re['.n.']: ' .subject + " let subject = 'Subject: '.'Re['.n.']: '.tag .subject + else + let subject = s:InsertReToSubject('Re: ', subject, tag) + " let subject = 'Subject: '.tag.'Re: ' .subject + " let subject = 'Subject: '.'Re: '.tag .subject + endif + + " Finally, we return the new subject {{{4 + return subject +endf +" }}}3 +"--------------------------------------------------------------- +" Function : MergeFwd(string) {{{3 +" Purpose : Substitute "Fwd:Fwd:Fwd:Fwd" by "Fwd:" +let s:Fwd = '\ +" Last Change: 2006 Dec 04 + +" To make the ":Man" command available before editing a manual page, source +" this script from your startup vimrc file. + +" If 'filetype' isn't "man", we must have been called to only define ":Man". +if &filetype == "man" + + " Only do this when not done yet for this buffer + if exists("b:did_ftplugin") + finish + endif + let b:did_ftplugin = 1 + + " allow dot and dash in manual page name. + setlocal iskeyword+=\.,- + + " Add mappings, unless the user didn't want this. + if !exists("no_plugin_maps") && !exists("no_man_maps") + if !hasmapto('ManBS') + nmap h ManBS + endif + nnoremap ManBS :%s/.\b//g:setl nomod'' + + nnoremap :call PreGetPage(v:count) + nnoremap :call PopPage() + endif + +endif + +if exists(":Man") != 2 + com -nargs=+ Man call s:GetPage() + nmap K :call PreGetPage(0) +endif + +" Define functions only once. +if !exists("s:man_tag_depth") + +let s:man_tag_depth = 0 + +if !has("win32") && $OSTYPE !~ 'cygwin\|linux' && system('uname -s') =~ "SunOS" && system('uname -r') =~ "^5" + let s:man_sect_arg = "-s" + let s:man_find_arg = "-l" +else + let s:man_sect_arg = "" + let s:man_find_arg = "-w" +endif + +func PreGetPage(cnt) + if a:cnt == 0 + let old_isk = &iskeyword + setl iskeyword+=(,) + let str = expand("") + let &l:iskeyword = old_isk + let page = substitute(str, '(*\(\k\+\).*', '\1', '') + let sect = substitute(str, '\(\k\+\)(\([^()]*\)).*', '\2', '') + if match(sect, '^[0-9 ]\+$') == -1 + let sect = "" + endif + if sect == page + let sect = "" + endif + else + let sect = a:cnt + let page = expand("") + endif + call s:GetPage(sect, page) +endfunc + +func GetCmdArg(sect, page) + if a:sect == '' + return a:page + endif + return s:man_sect_arg.' '.a:sect.' '.a:page +endfunc + +func FindPage(sect, page) + let where = system("/usr/bin/man ".s:man_find_arg.' '.s:GetCmdArg(a:sect, a:page)) + if where !~ "^/" + if matchstr(where, " [^ ]*$") !~ "^ /" + return 0 + endif + endif + return 1 +endfunc + +func GetPage(...) + if a:0 >= 2 + let sect = a:1 + let page = a:2 + elseif a:0 >= 1 + let sect = "" + let page = a:1 + else + return + endif + + " To support: nmap K :Man + if page == '' + let page = expand('') + endif + + if sect != "" && s:FindPage(sect, page) == 0 + let sect = "" + endif + if s:FindPage(sect, page) == 0 + echo "\nCannot find a '".page."'." + return + endif + exec "let s:man_tag_buf_".s:man_tag_depth." = ".bufnr("%") + exec "let s:man_tag_lin_".s:man_tag_depth." = ".line(".") + exec "let s:man_tag_col_".s:man_tag_depth." = ".col(".") + let s:man_tag_depth = s:man_tag_depth + 1 + + " Use an existing "man" window if it exists, otherwise open a new one. + if &filetype != "man" + let thiswin = winnr() + exe "norm! \b" + if winnr() > 1 + exe "norm! " . thiswin . "\w" + while 1 + if &filetype == "man" + break + endif + exe "norm! \w" + if thiswin == winnr() + break + endif + endwhile + endif + if &filetype != "man" + new + setl nonu fdc=0 + endif + endif + silent exec "edit $HOME/".page.".".sect."~" + " Avoid warning for editing the dummy file twice + setl buftype=nofile noswapfile + + setl ma + silent exec "norm 1GdG" + let $MANWIDTH = 80 + silent exec "r!/usr/bin/man ".s:GetCmdArg(sect, page)." | col -b" + " Remove blank lines from top and bottom. + while getline(1) =~ '^\s*$' + silent norm ggdd + endwhile + while getline('$') =~ '^\s*$' + silent norm Gdd + endwhile + 1 + setl ft=man nomod + setl bufhidden=hide + setl nobuflisted +endfunc + +func PopPage() + if s:man_tag_depth > 0 + let s:man_tag_depth = s:man_tag_depth - 1 + exec "let s:man_tag_buf=s:man_tag_buf_".s:man_tag_depth + exec "let s:man_tag_lin=s:man_tag_lin_".s:man_tag_depth + exec "let s:man_tag_col=s:man_tag_col_".s:man_tag_depth + exec s:man_tag_buf."b" + exec s:man_tag_lin + exec "norm ".s:man_tag_col."|" + exec "unlet s:man_tag_buf_".s:man_tag_depth + exec "unlet s:man_tag_lin_".s:man_tag_depth + exec "unlet s:man_tag_col_".s:man_tag_depth + unlet s:man_tag_buf s:man_tag_lin s:man_tag_col + endif +endfunc + +endif + +" vim: set sw=2: diff --git a/vim/ftplugin/smarty.vim b/vim/ftplugin/smarty.vim new file mode 120000 index 0000000..2b44ad4 --- /dev/null +++ b/vim/ftplugin/smarty.vim @@ -0,0 +1 @@ +/usr/share/vim-scripts/ftplugin/xml.vim \ No newline at end of file diff --git a/vim/ftplugin/tex.vim b/vim/ftplugin/tex.vim new file mode 100644 index 0000000..2821d2b --- /dev/null +++ b/vim/ftplugin/tex.vim @@ -0,0 +1,5 @@ +set sw=2 +set iskeyword+=: + +map \ll +imap it Tex_InsertItemOnThisLine diff --git a/vim/ftplugin/xhtml.vim b/vim/ftplugin/xhtml.vim new file mode 120000 index 0000000..2b44ad4 --- /dev/null +++ b/vim/ftplugin/xhtml.vim @@ -0,0 +1 @@ +/usr/share/vim-scripts/ftplugin/xml.vim \ No newline at end of file diff --git a/vim/ftplugin/xml.vim b/vim/ftplugin/xml.vim new file mode 120000 index 0000000..2b44ad4 --- /dev/null +++ b/vim/ftplugin/xml.vim @@ -0,0 +1 @@ +/usr/share/vim-scripts/ftplugin/xml.vim \ No newline at end of file diff --git a/vim/indent/mail.vim b/vim/indent/mail.vim new file mode 100644 index 0000000..433c7ea --- /dev/null +++ b/vim/indent/mail.vim @@ -0,0 +1,101 @@ +" Vim indent file + +if exists("b:did_indent") + finish +endif + +let b:did_indent = 1 + +if !exists("g:mail_itemize_chars") + let g:mail_itemize_chars='o*+-' +endif + +let s:item_cap_re='^ *\(['.g:mail_itemize_chars.']\) .*$' +let s:item_re='^ *['.g:mail_itemize_chars.'] ' +let s:void_re='^\([>}].*\| *\)$' + +setlocal nocindent +setlocal comments=n:},n:> +setlocal nolisp +setlocal nosmartindent +setlocal noautoindent +setlocal indentexpr=GetMailIndent() +setlocal indentkeys=!^F,*,o,O, + +" Only define the function once. +if exists("*GetMailIndent") + finish +endif + +function! s:GetItemIndent(lnum) + let lnum = a:lnum + let char = substitute(getline(lnum), s:item_cap_re, '\1', '') + let maxind = 100 + let lastind = -1 + + while lnum >= 1 + let lnum = lnum - 1 + let line = getline(lnum) + let ind = indent(lnum) + + if line =~ s:void_re + return lastind < 0 ? 2 : lastind + end + + if ind < maxind + let maxind = ind + + if line =~ s:item_re + if lastind < 0 + let lastind = ind + 4 + end + + if char == substitute(line, s:item_cap_re, '\1', '') + return ind + end + end + + end + endwhile +endfunction + +function GetMailIndent() + if v:lnum <= 1 + return 0 + end + + let ind2 = indent(v:lnum - 2) + let ind1 = indent(v:lnum - 1) + let pre2 = getline(v:lnum - 2) + let pre1 = getline(v:lnum - 1) + let cur = getline(v:lnum) + + if cur =~ s:void_re || pre1 == '-- ' || cur =~ '-- ' + return 0 + endif + + let ind = ind1 + + if pre1 =~ s:item_re + let ind = ind + 2 + elseif pre2 =~ s:void_re || (ind2 <= 2 && pre2 =~ '[^a-zA-Z0-9]$') + let ind = ind - 2 + end + + let len = strlen(pre1) + strlen( substitute(cur, '^ *\([^ ]*\).*$', '\1', '') ) + if pre1 =~ '[^a-zA-Z0-9]$' && len + 1 < &tw + if ind1 <= 2 && pre1 !~ s:item_re + let ind = 2 + else + let ind = 0 + end + end + + if cur =~ s:item_re + let ind = s:GetItemIndent(v:lnum) + end + + return ind +endfunction + +" vim: set sts=2 sw=2: diff --git a/vim/jptemplate/c/inc b/vim/jptemplate/c/inc new file mode 100644 index 0000000..c2b8f7b --- /dev/null +++ b/vim/jptemplate/c/inc @@ -0,0 +1,2 @@ +#include <${header}> +${cursor} diff --git a/vim/jptemplate/c/main b/vim/jptemplate/c/main new file mode 100644 index 0000000..4f0c5d1 --- /dev/null +++ b/vim/jptemplate/c/main @@ -0,0 +1,4 @@ +int main(int argc, char **argv) +{ + ${cursor} +} diff --git a/vim/jptemplate/cpp b/vim/jptemplate/cpp new file mode 120000 index 0000000..3410062 --- /dev/null +++ b/vim/jptemplate/cpp @@ -0,0 +1 @@ +c \ No newline at end of file diff --git a/vim/jptemplate/tex/frame b/vim/jptemplate/tex/frame new file mode 100644 index 0000000..c8d222e --- /dev/null +++ b/vim/jptemplate/tex/frame @@ -0,0 +1,3 @@ +\begin{frame}{${Frame Title}} + ${cursor} +\end{frame} diff --git a/vim/jptemplate/tex/itemize b/vim/jptemplate/tex/itemize new file mode 100644 index 0000000..14209f7 --- /dev/null +++ b/vim/jptemplate/tex/itemize @@ -0,0 +1,6 @@ +\begin{itemize} + \item${cursor} + \item + \item + \item +\end{itemize} diff --git a/vim/plugin/BlockComment.vim b/vim/plugin/BlockComment.vim new file mode 100644 index 0000000..165bb14 --- /dev/null +++ b/vim/plugin/BlockComment.vim @@ -0,0 +1,234 @@ +" BlockComment.vim +" Author: Chris Russell +" Version: 1.1 +" License: GPL v2.0 +" +" Description: +" This script defineds functions and key mappings to block comment code. +" +" Help: +" In brief, use '.c' to comment and '.C' to uncomment. +" +" Both commenting and uncommenting can be run on N lines at a time by +" using a number before the command. They both support visual mode and +" ranges. +" +" This script will not comment lines with an indent level less that the +" initial line of the comment to preserve the control structure of code. +" +" Installation: +" Simply drop this file into your plugin directory. +" +" Changelog: +" 2002-11-08 v1.1 +" Convert to Unix eol +" 2002-11-05 v1.0 +" Initial release +" +" TODO: +" Add more file types +" + + +"-------------------------------------------------- +" Avoid multiple sourcing +"-------------------------------------------------- +if exists( "loaded_block_comment" ) + finish +endif +let loaded_block_comment = 1 + + +"-------------------------------------------------- +" Key mappings +"-------------------------------------------------- +noremap .c :call Comment() +noremap .C :call UnComment() + + +"-------------------------------------------------- +" Set comment characters by filetype +"-------------------------------------------------- +function! CommentStr() + let s:comment_pad = '--------------------------------------------------' + if &ft == "vim" + let s:comment_strt = '"' + let s:comment_mid0 = '" ' + let s:comment_mid1 = '"' + let s:comment_stop = ' ' + let s:comment_bkup = 0 + elseif &ft == "c" || &ft == "css" + let s:comment_strt = '/*' + let s:comment_mid0 = '* ' + let s:comment_mid1 = '*' + let s:comment_stop = '*/' + let s:comment_bkup = 1 + let s:comment_strtbak = '/ *' + let s:comment_stopbak = '* /' + elseif &ft == "cpp" || &ft == "java" || &ft == "javascript" || &ft == "php" + let s:comment_strt = '//' + let s:comment_mid0 = '// ' + let s:comment_mid1 = '//' + let s:comment_stop = ' ' + let s:comment_bkup = 0 + elseif &ft == "tex" + let s:comment_strt = '%' + let s:comment_mid0 = '% ' + let s:comment_mid1 = '%' + let s:comment_stop = ' ' + let s:comment_bkup = 0 + elseif &ft == "asm" || &ft == "lisp" || &ft == "scheme" + let s:comment_strt = ';' + let s:comment_mid0 = '; ' + let s:comment_mid1 = ';' + let s:comment_stop = ' ' + let s:comment_bkup = 0 + elseif &ft == "vb" + let s:comment_strt = '\'' + let s:comment_mid0 = '\' ' + let s:comment_mid1 = '\'' + let s:comment_stop = ' ' + let s:comment_bkup = 0 + elseif &ft == "html" || &ft == "xml" || &ft == "entity" + let s:comment_strt = '' + let s:comment_bkup = 1 + let s:comment_strtbak = '< !--' + let s:comment_stopbak = '-- >' + else + let s:comment_strt = '#' + let s:comment_mid0 = '# ' + let s:comment_mid1 = '#' + let s:comment_stop = ' ' + let s:comment_bkup = 0 + endif +endfunction + +"-------------------------------------------------- +" Comment a block of code +"-------------------------------------------------- +function! Comment() range + " range variables + let l:firstln = a:firstline + let l:lastln = a:lastline + " get comment chars + call CommentStr() + " get tab indent level + let l:indent = indent( l:firstln ) / &tabstop + " loop to get padding str + let l:pad = "" + let l:i = 0 + while l:i < l:indent + let l:pad = l:pad . "\t" + let l:i = l:i + 1 + endwhile + " loop for each line + let l:block = 0 + let l:midline = l:firstln + while l:midline <= l:lastln + " get line + let l:line = getline( l:midline ) + " check if padding matches + if strpart( l:line, 0, l:indent ) == l:pad + " start comment block + if l:block == 0 + call append( l:midline - 1, l:pad . s:comment_strt . s:comment_pad ) + let l:midline = l:midline + 1 + let l:lastln = l:lastln + 1 + let l:block = 1 + endif + " append comment between indent and code + let l:line = strpart( l:line, l:indent ) + " handle comments within comments + if s:comment_bkup == 1 + let l:line = substitute( l:line, escape( s:comment_strt, '\*^$.~[]' ), s:comment_strtbak, "g" ) + let l:line = substitute( l:line, escape( s:comment_stop, '\*^$.~[]' ), s:comment_stopbak, "g" ) + endif + call setline( l:midline, l:pad . s:comment_mid0 . l:line ) + " else end block + elseif l:block == 1 + call append( l:midline - 1, l:pad . s:comment_mid1 . s:comment_pad . s:comment_stop ) + let l:midline = l:midline + 1 + let l:lastln = l:lastln + 1 + let l:block = 0 + endif + let l:midline = l:midline + 1 + endwhile + " end block + if l:block == 1 + call append( l:lastln, l:pad . s:comment_mid1 . s:comment_pad . s:comment_stop ) + endif + " return to first line of comment + execute l:firstln +endfunction + +"-------------------------------------------------- +" Uncomment a block of code +"-------------------------------------------------- +function! UnComment() range + " range variables + let l:firstln = a:firstline + let l:lastln = a:lastline + " get comment chars + call CommentStr() + " get length of comment string + let l:clen = strlen( s:comment_mid0 ) + " loop for each line + let l:midline = l:firstln + while l:midline <= l:lastln + " get indent level - process indent for each line instead of by block + let l:indent = indent( l:midline ) / &tabstop + let l:line = getline( l:midline ) + " begin comment block line - delete line + if strpart( l:line, l:indent ) == s:comment_strt . s:comment_pad + execute l:midline . "d" + let l:midline = l:midline - 1 + let l:lastln = l:lastln - 1 + " end comment block line - delete line + elseif strpart( l:line, l:indent ) == s:comment_mid1 . s:comment_pad . s:comment_stop + execute l:midline . "d" + let l:midline = l:midline - 1 + let l:lastln = l:lastln - 1 + " commented code line - remove comment + elseif strpart( l:line, l:indent, l:clen ) == s:comment_mid0 + let l:pad = strpart( l:line, 0, l:indent ) + let l:line = strpart( l:line, l:indent + l:clen ) + " handle comments within comments + if s:comment_bkup == 1 + let l:line = substitute( l:line, escape( s:comment_strtbak, '\*^$.~[]' ), s:comment_strt, "g" ) + let l:line = substitute( l:line, escape( s:comment_stopbak, '\*^$.~[]' ), s:comment_stop, "g" ) + endif + call setline( l:midline, l:pad . l:line ) + endif + let l:midline = l:midline + 1 + endwhile + " look at line above block + let l:indent = indent( l:firstln - 1 ) / &tabstop + let l:line = getline( l:firstln - 1 ) + " abandoned begin comment block line - delete line + if strpart( l:line, l:indent ) == s:comment_strt . s:comment_pad + execute ( l:firstln - 1 ) . "d" + let l:firstln = l:firstln - 1 + let l:lastln = l:lastln - 1 + " abandoned commented code line - insert end comment block line + elseif strpart( l:line, l:indent, l:clen ) == s:comment_mid0 + let l:pad = strpart( l:line, 0, l:indent ) + call append( l:firstln - 1, l:pad . s:comment_mid1 . s:comment_pad . s:comment_stop ) + let l:lastln = l:lastln + 1 + endif + " look at line belowe block + let l:indent = indent( l:lastln + 1 ) / &tabstop + let l:line = getline( l:lastln + 1 ) + " abandoned end comment block line - delete line + if strpart( l:line, l:indent ) == s:comment_mid1 . s:comment_pad . s:comment_stop + execute ( l:lastln + 1 ) . "d" + let l:lastln = l:lastln - 1 + " abandoned commented code line - insert begin comment block line + elseif strpart( l:line, l:indent, l:clen ) == s:comment_mid0 + let l:pad = strpart( l:line, 0, l:indent ) + call append( l:lastln, l:pad . s:comment_strt . s:comment_pad ) + endif +endfunction + diff --git a/vim/plugin/ZoomWin.vim b/vim/plugin/ZoomWin.vim new file mode 100644 index 0000000..c11d54a --- /dev/null +++ b/vim/plugin/ZoomWin.vim @@ -0,0 +1,203 @@ +" ZoomWin: Brief-like ability to zoom into/out-of a window +" Author: Ron Aaron +" modified by Charles Campbell +" Version: 19 +" History: see :he zoomwin-history + +" --------------------------------------------------------------------- +if &cp || exists("s:loaded_zoomwin") + finish +endif +let s:loaded_zoomwin= 1 + +" --------------------------------------------------------------------- +" Public Interface: +if !hasmapto("ZoomWin") + nmap o ZoomWin +endif +nnoremap