diff options
67 files changed, 1995 insertions, 1 deletions
diff --git a/base/Xresources b/base/Xresources new file mode 100644 index 0000000..95aceef --- /dev/null +++ b/base/Xresources @@ -0,0 +1,28 @@ +utohint: 0 +Xft.antialias: 1 +Xft.hinting: true +Xft.hintstyle: hintslight +Xft.dpi: 96 +Xft.rgba: rgb +Xft.lcdfilter: lcddefault + +*color4: royalblue +*color12: #5895cf + +Rxvt.background: #1a1a1a +Rxvt.foreground: white +Rxvt.scrollBar: false +Rxvt.font: xft:Inconsolata:size=11:autohint=true +!Rxvt.letterSpace: 0 +Rxvt.fade: 25 + +URxvt*urgentOnBell: true +URxvt*transparent: true +URxvt*shading: 15 + +XTerm*background: rgb:1a/1a/1a +XTerm*foreground: white +XTerm*scrollBar: false +XTerm*faceName: xft:Inconsolata:size=12:autohint=true +XTerm*bellIsUrgent: true +XTerm*eightBitInput: false diff --git a/base/bash_aliases b/base/bash_aliases new file mode 100644 index 0000000..9cc0035 --- /dev/null +++ b/base/bash_aliases @@ -0,0 +1,2 @@ +alias open=gnome-open +alias g="gvim --remote-silent" diff --git a/base/bash_logout b/base/bash_logout new file mode 100644 index 0000000..09df5b1 --- /dev/null +++ b/base/bash_logout @@ -0,0 +1,6 @@ +# ~/.bash_logout: executed by bash(1) when login shell exits. + +# when leaving the console clear the screen to increase privacy +if [ "$SHLVL" = 1 ]; then + [ -x /usr/bin/clear_console ] && /usr/bin/clear_console -q +fi diff --git a/base/bashrc b/base/bashrc new file mode 100644 index 0000000..3642bd7 --- /dev/null +++ b/base/bashrc @@ -0,0 +1,126 @@ +# ~/.bashrc: executed by bash(1) for non-login shells. +# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc) +# for examples + +# If not running interactively, don't do anything +[ -z "$PS1" ] && return + +# don't put duplicate lines in the history. See bash(1) for more options +# ... or force ignoredups and ignorespace +HISTCONTROL=ignoredups:ignorespace + +# append to the history file, don't overwrite it +shopt -s histappend + +# for setting history length see HISTSIZE and HISTFILESIZE in bash(1) +HISTSIZE=1000 +HISTFILESIZE=2000 + +# check the window size after each command and, if necessary, +# update the values of LINES and COLUMNS. +shopt -s checkwinsize + +# make less more friendly for non-text input files, see lesspipe(1) +[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)" + +# set variable identifying the chroot you work in (used in the prompt below) +if [ -z "$debian_chroot" ] && [ -r /etc/debian_chroot ]; then + debian_chroot=$(cat /etc/debian_chroot) +fi + +# set a fancy prompt (non-color, unless we know we "want" color) +case "$TERM" in + xterm-color) color_prompt=yes;; +esac + +# uncomment for a colored prompt, if the terminal has the capability; turned +# off by default to not distract the user: the focus in a terminal window +# should be on the output of commands, not on the prompt +#force_color_prompt=yes + +if [ -n "$force_color_prompt" ]; then + if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then + # We have color support; assume it's compliant with Ecma-48 + # (ISO/IEC-6429). (Lack of such support is extremely rare, and such + # a case would tend to support setf rather than setaf.) + color_prompt=yes + else + color_prompt= + fi +fi + +GIT_PS1_SHOWDIRTYSTATE=1 + +if [ "$color_prompt" = yes ]; then + PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ ' +else + PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w$(__git_ps1 " (%s)")\$ ' +fi +unset color_prompt force_color_prompt + +# If this is an xterm set the title to user@host:dir +case "$TERM" in +xterm*|rxvt*) + PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1" + ;; +*) + ;; +esac + +# enable color support of ls and also add handy aliases +if [ -x /usr/bin/dircolors ]; then + test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)" + alias ls='ls --color=auto' + #alias dir='dir --color=auto' + #alias vdir='vdir --color=auto' + + alias grep='grep --color=auto' + alias fgrep='fgrep --color=auto' + alias egrep='egrep --color=auto' +fi + +# some more ls aliases +alias ll='ls -alF' +alias la='ls -A' +alias l='ls -CF' + +# Add an "alert" alias for long running commands. Use like so: +# sleep 10; alert +alias alert='notify-send --urgency=low -i "$([ $? = 0 ] && echo terminal || echo error)" "$(history|tail -n1|sed -e '\''s/^\s*[0-9]\+\s*//;s/[;&|]\s*alert$//'\'')"' + +# Alias definitions. +# You may want to put all your additions into a separate file like +# ~/.bash_aliases, instead of adding them here directly. +# See /usr/share/doc/bash-doc/examples in the bash-doc package. + +if [ -f ~/.bash_aliases ]; then + . ~/.bash_aliases +fi + +# enable programmable completion features (you don't need to enable +# this, if it's already enabled in /etc/bash.bashrc and /etc/profile +# sources /etc/bash.bashrc). +if [ -f /etc/bash_completion ] && ! shopt -oq posix; then + . /etc/bash_completion +fi + +# Personal Settings +export EDITOR=vim +export MAILDIR=$HOME/.maildir/INBOX + +if [ -f ~/.shell_pathes ]; then + source ~/.shell_pathes +fi + +# Host Specific Settings +if [ -f ~/.host-specific/bashrc ]; then + source ~/.host-specific/bashrc +fi + +if [ -f ~/.host-specific/shell_pathes ]; then + source ~/.host-specific/shell_pathes +fi + +if [ -f ~/.host-specific/bash_aliases ]; then + source ~/.host-specific/bash_aliases +fi diff --git a/base/config/.nolink b/base/config/.nolink new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/base/config/.nolink diff --git a/base/config/i3/.nolink b/base/config/i3/.nolink new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/base/config/i3/.nolink diff --git a/base/config/i3/autostart.d/.nolink b/base/config/i3/autostart.d/.nolink new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/base/config/i3/autostart.d/.nolink diff --git a/base/config/i3/autostart.d/10_xautolock b/base/config/i3/autostart.d/10_xautolock new file mode 100644 index 0000000..29e7f8e --- /dev/null +++ b/base/config/i3/autostart.d/10_xautolock @@ -0,0 +1,2 @@ +exec --no-startup-id xautolock -time 5 -locker lock -corners 0-00 + diff --git a/base/config/i3/autostart.d/20_gpg-agent b/base/config/i3/autostart.d/20_gpg-agent new file mode 100644 index 0000000..cec15e2 --- /dev/null +++ b/base/config/i3/autostart.d/20_gpg-agent @@ -0,0 +1,2 @@ +exec --no-startup-id gpg-agent --daemon --enable-ssh-support --write-env-file "${HOME}/.gpg-agent-info" + diff --git a/base/config/i3/autostart.d/50_pidgin b/base/config/i3/autostart.d/50_pidgin new file mode 100644 index 0000000..3edf586 --- /dev/null +++ b/base/config/i3/autostart.d/50_pidgin @@ -0,0 +1,2 @@ +exec pidgin + diff --git a/base/config/i3/config.d/.nolink b/base/config/i3/config.d/.nolink new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/base/config/i3/config.d/.nolink diff --git a/base/config/i3/config.d/00_base_config b/base/config/i3/config.d/00_base_config new file mode 100644 index 0000000..fd7df1c --- /dev/null +++ b/base/config/i3/config.d/00_base_config @@ -0,0 +1,146 @@ +# +# This is my base i3 config which is shared between all hosts. +# + +set $mod Mod4 +floating_modifier $mod + +## Visual Settings +font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1 +hide_edge_borders both + +## Bindings to start programs +bindsym $mod+space exec dmenu_run +bindsym $mod+Return exec i3-sensible-terminal + +# kill focused window +bindsym $mod+Shift+Q kill + + +## Bindings to control windows + +### Focus Commands +bindsym $mod+h focus left +bindsym $mod+j focus down +bindsym $mod+k focus up +bindsym $mod+l focus right +bindsym Mod1+Tab focus right +bindsym Mod1+Shift+Tab focus left +bindsym $mod+a focus parent +bindsym $mod+d focus child + +### Window Moving Commands +bindsym $mod+Shift+H move left +bindsym $mod+Shift+J move down +bindsym $mod+Shift+K move up +bindsym $mod+Shift+L move right + +### Floating Windows +bindsym $mod+Shift+space floating toggle +bindsym $mod+Tab focus mode_toggle + +## Layout Commands +bindsym $mod+s layout stacking +bindsym $mod+w layout tabbed +bindsym $mod+e layout default +bindsym $mod+v split v +bindsym $mod+Shift+V split h +bindsym $mod+f fullscreen + + +## Bindings to control workspaces + +### Switch Workspaces +bindsym $mod+1 workspace number 1 +bindsym $mod+2 workspace number 2 +bindsym $mod+3 workspace number 3 +bindsym $mod+4 workspace number 4 +bindsym $mod+5 workspace number 5 +bindsym $mod+6 workspace number 6 +bindsym $mod+7 workspace number 7 +bindsym $mod+8 workspace number 8 +bindsym $mod+9 workspace number 9 +bindsym $mod+0 workspace number 10 +bindsym $mod+Left workspace prev_on_output +bindsym $mod+Right workspace next_on_output + +### Move container to workspace +bindsym $mod+Shift+exclam move workspace number 1 +bindsym $mod+Shift+at move workspace number 2 +bindsym $mod+Shift+numbersign move workspace number 3 +bindsym $mod+Shift+dollar move workspace number 4 +bindsym $mod+Shift+percent move workspace number 5 +bindsym $mod+Shift+asciicircum move workspace number 6 +bindsym $mod+Shift+ampersand move workspace number 7 +bindsym $mod+Shift+asterisk move workspace number 8 +bindsym $mod+Shift+parenleft move workspace number 9 +bindsym $mod+Shift+parenright move workspace number 10 +bindsym $mod+Shift+Left move workspace prev +bindsym $mod+Shift+Right move workspace next + +### Move workspace to different monitor +bindsym $mod+Mod1+Left move workspace to output left +bindsym $mod+Mod1+Right move workspace to output right + +workspace_auto_back_and_forth yes +workspace_layout stacking + +### Scratchpad +bindsym $mod+Shift+minus move scratchpad +bindsym $mod+minus scratchpad show + + +## Bindings to contorl the session +bindsym $mod+Shift+C exec "make_i3_config > $HOME/.config/i3/config"; reload +bindsym $mod+Shift+R restart +bindsym $mod+Shift+E exit +bindsym Control+mod1+l exec xautolock -locknow + + +## Alternative modes + +### Resize Mode +bindsym $mod+r mode "resize" +mode "resize" { + bindsym h resize shrink left 10 px or 10 ppt + bindsym Shift+H resize grow left 10 px or 10 ppt + bindsym j resize shrink down 10 px or 10 ppt + bindsym Shift+j resize grow down 10 px or 10 ppt + bindsym k resize shrink up 10 px or 10 ppt + bindsym Shift+K resize grow up 10 px or 10 ppt + bindsym l resize shrink right 10 px or 10 ppt + bindsym Shift+L resize grow right 10 px or 10 ppt + + bindsym Return mode "default" + bindsym Escape mode "default" +} + + +## i3bar Settings +bar { + status_command conky-i3bar + position top + tray_output primary + font xft:Inconsolata 10 +} + + +## Misc. Bindings + +## sshclip +bindsym $mod+g exec sshclip + +### Music +bindsym $mod+End exec xmms2 toggle +bindsym $mod+Home exec xmms2 next + +### Volume +bindsym $mod+Prior exec pactl set-sink-volume -- 0 "+2%" +bindsym $mod+Next exec pactl set-sink-volume -- 0 "-2%" + + +## Specific Window Settings +for_window [class="Gcalctool"] floating enable +for_window [class="Gnome-calculator"] floating enable + + diff --git a/base/conkyrc b/base/conkyrc new file mode 100644 index 0000000..1bac737 --- /dev/null +++ b/base/conkyrc @@ -0,0 +1,21 @@ +out_to_x no +own_window no +out_to_console yes +background no +max_text_width 0 +use_spacer left + +update_interval 1.0 +cpu_avg_samples 2 +net_avg_samples 2 + +TEXT +${if_xmms2_connected}${xmms2_title} - ${xmms2_artist} | ${endif}\ +✉ ${new_mails $HOME/.maildir/INBOX/}/${mails $HOME/.maildir/INBOX} | \ +/home ${fs_free /home} | \ +RAM ${memperc}% | \ +BATT ${battery BAT0} | \ +${execi 300 weatherbar.sh} | \ +${loadavg 1} | \ +♪ ${exec pactl list sinks | awk '/Volume: 0:/ {print substr($3, 1, index($3, "%") - 1)}'|head -n 1} | \ +${time %a %d %b %Y} ${time %H:%M:%S} diff --git a/base/conkyrc-json b/base/conkyrc-json new file mode 100644 index 0000000..e164a10 --- /dev/null +++ b/base/conkyrc-json @@ -0,0 +1,40 @@ +out_to_x no +own_window no +out_to_console yes +background no +max_text_width 0 +use_spacer left + +update_interval 2.0 +cpu_avg_samples 2 +net_avg_samples 2 + +TEXT +[ +${if_xmms2_connected} +${if_match "${xmms2_status}" == "Playing"} +{ "full_text":"${xmms2_smart}" }, +${endif} +${endif} + +{ "full_text": "✉ ${new_mails $HOME/.maildir/INBOX/}/${mails $HOME/.maildir/INBOX}", + "color": ${if_match ${new_mails $HOME/.maildir/INBOX/}>0}"\#00ff00"${else}"\#ffffff"${endif} }, + +{ "full_text":"/home ${fs_free /home}", + "color": ${if_match ${fs_free_perc /home}<5}"\#ff0000"${else}"\#ffffff"${endif} }, + +{ "full_text":"RAM ${memperc}%", + "color":${if_match ${memperc}<90}"\#ffffff"${else}"\#ff0000"${endif} }, + +{ "full_text":"BATT ${battery BAT0}" }, + +{ "full_text":"${execi 300 weatherbar.sh}" }, + +{ "full_text":"${loadavg 1}" }, + +{ "full_text":"♪ ${exec pactl list sinks | awk '/Volume: 0:/ {print substr($3, 1, index($3, "%") - 1)}'|head -n 1}" }, + +{ "full_text":"${time %a %d %b %Y} ${time %H:%M:%S}", + "short_text":"${time %H:%M:%S}" } + +], diff --git a/base/fonts.config b/base/fonts.config new file mode 100644 index 0000000..3e39a3a --- /dev/null +++ b/base/fonts.config @@ -0,0 +1,34 @@ +<?xml version="1.0"?> +<!DOCTYPE fontconfig SYSTEM "fonts.dtd"> +<fontconfig> + <match target="font"> + <edit mode="assign" name="hinting" > + <bool>true</bool> + </edit> + </match> + <match target="font" > + <edit mode="assign" name="autohint" > + <bool>true</bool> + </edit> + </match> + <match target="font"> + <edit mode="assign" name="hintstyle" > + <const>hintslight</const> + </edit> + </match> + <match target="font"> + <edit mode="assign" name="rgba" > + <const>rgb</const> + </edit> + </match> + <match target="font"> + <edit mode="assign" name="antialias" > + <bool>true</bool> + </edit> + </match> + <match target="font"> + <edit mode="assign" name="lcdfilter"> + <const>lcddefault</const> + </edit> + </match> +</fontconfig> diff --git a/base/gnupg/.nolink b/base/gnupg/.nolink new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/base/gnupg/.nolink diff --git a/base/gnupg/gpg.conf b/base/gnupg/gpg.conf new file mode 100644 index 0000000..757c9c3 --- /dev/null +++ b/base/gnupg/gpg.conf @@ -0,0 +1,8 @@ +keyserver hkp://subkeys.pgp.net +keyserver hkp://pgp.mit.edu +keyserver-options auto-key-retrieve + +personal-digest-preferences SHA256 +cert-digest-algo SHA256 +default-preference-list SHA512 SHA384 SHA256 SHA224 AES256 AES192 AES CAST5 ZLIB BZIP2 ZIP Uncompressed + diff --git a/base/local/.nolink b/base/local/.nolink new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/base/local/.nolink diff --git a/base/local/share/.nolink b/base/local/share/.nolink new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/base/local/share/.nolink diff --git a/base/local/share/applications/.nolink b/base/local/share/applications/.nolink new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/base/local/share/applications/.nolink diff --git a/base/mailcap b/base/mailcap new file mode 100644 index 0000000..720c93b --- /dev/null +++ b/base/mailcap @@ -0,0 +1,4 @@ +text/calendar; mutt-ical.py -i -e "jesse@jesterpm.net" %s +application/ics; mutt-ical.py -i -e "jesse@jesterpm.net" %s + +text/html; pandoc -f html -t markdown --reference-links; copiousoutput; compose=vim %s diff --git a/base/muttrc b/base/muttrc new file mode 100644 index 0000000..be1282a --- /dev/null +++ b/base/muttrc @@ -0,0 +1,61 @@ +# +# Mutt settings common everywhere +# + +# Mailbox Settings +set mbox_type="Maildir" +set folder="~/.maildir" + +# Mutt settings +set header_cache=~/.maildir/mutt_cache/ +set delete=yes +unset confirmappend +set sort=threads +set sort_aux = last-date-received +set pager_stop=yes +set mark_old = no +unset markers +set text_flowed=yes +set display_filter="~/bin/mutt-display-filter.sh" + +# Headers +ignore * +unignore date from: to: cc subject X-Spam-Status +set forward_format="Fwd: %s" + +# Macros +macro pager <Up> "<previous-line>" "Previous line" +macro pager <Down> "<next-line>" "Next line" + +macro index c "<change-folder>?<toggle-mailboxes>" "open a different folder" +macro pager c "<change-folder>?<toggle-mailboxes>" "open a different folder" +macro index C "<copy-message>?<toggle-mailboxes>" "copy a message to a mailbox" +macro index M "<save-message>?<toggle-mailboxes>" "move a message to a mailbox" +macro index e "<save-message>+archived<enter>" "Archive a message." +macro pager e "<save-message>+archived<enter>" "Archive a message." +macro index S "<save-message>+spam<enter>" "Report message as spam." +macro index d "<save-message>+trash<enter>" "Move to trash" +macro pager d "<save-message>+trash<enter>" "Move to trash" + +macro index \es <change-folder>'=search'<enter><shell-escape>'mairix ' 'Enter Mairix search term' + +# Colors +color index brightwhite default ~N +color index brightwhite default ~O + +# colors +color normal white black +color attachment brightyellow black +color hdrdefault white black +color indicator black white +color markers brightred black +color quoted green black +color signature cyan black +color status black white +color tilde blue black +color tree red black + +# Grab any host-specific settings +source ~/.host-specific/muttrc + +source ~/.mutt/aliases diff --git a/base/offlineimap/.nolink b/base/offlineimap/.nolink new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/base/offlineimap/.nolink diff --git a/base/offlineimap/helper.py b/base/offlineimap/helper.py new file mode 100644 index 0000000..9cb94d8 --- /dev/null +++ b/base/offlineimap/helper.py @@ -0,0 +1,26 @@ +#!/usr/bin/python + +import os, subprocess,sys + + +def mailpasswd(file): + path = os.getenv("HOME") + "/.offlineimap/" + file + ".gpg" + args = ["gpg", "--use-agent", "--quiet", "--batch", "-d", path] + try: + return subprocess.check_output(args).strip() + except subprocess.CalledProcessError: + return "" + +def prime_gpg_agent(): + ret = False + i = 1 + while not ret: + ret = (mailpasswd("prime") == "prime") + if i > 2: + from offlineimap.ui import getglobalui + sys.stderr.write("Error reading in passwords. Terminating.\n") + getglobalui().terminate() + i += 1 + return ret + +prime_gpg_agent() diff --git a/base/offlineimaprc b/base/offlineimaprc new file mode 100644 index 0000000..ce7106e --- /dev/null +++ b/base/offlineimaprc @@ -0,0 +1,24 @@ +[general] +accounts = Jesterpm.net +pythonfile = ~/.offlineimap/helper.py + +[Account Jesterpm.net] +localrepository = Local +remoterepository = Remote +#autorefresh = 5 +status_backend = sqlite + +[Repository Local] +type = Maildir +localfolders = ~/.maildir + +[Repository Remote] +type = IMAP +remotehost = californium.jesterpm.net +remoteusereval = "jesse" +remotepasseval = mailpasswd("password") +folderfilter = lambda folder: folder not in ['sent', 'search'] +ssl = yes +maxconnections = 2 +#holdconnectionopen = false +#idlefolders = ['INBOX', 'dc206'] diff --git a/base/screenrc b/base/screenrc new file mode 100644 index 0000000..c958003 --- /dev/null +++ b/base/screenrc @@ -0,0 +1 @@ +vbell off diff --git a/base/vim/after/syntax/html.vim b/base/vim/after/syntax/html.vim new file mode 100644 index 0000000..20740b2 --- /dev/null +++ b/base/vim/after/syntax/html.vim @@ -0,0 +1,23 @@ +" Vim syntax file +" Language: HTML (version 5) +" Maintainer: Rodrigo Machado <rcmachado@gmail.com> +" URL: http://rm.blog.br/vim/syntax/html.vim +" Last Change: 2009 Aug 19 +" License: Public domain +" (but let me know if you liked it :) ) +" +" Note: This file just adds the new tags from HTML 5 +" and don't replace default html.vim syntax file + +" HTML 5 tags +syn keyword htmlTagName contained article aside audio bb canvas command datagrid +syn keyword htmlTagName contained datalist details dialog embed figure footer +syn keyword htmlTagName contained header hgroup keygen mark meter nav output +syn keyword htmlTagName contained progress time ruby rt rp section time video + +" HTML 5 arguments +syn keyword htmlArg contained autofocus placeholder min max step +syn keyword htmlArg contained contenteditable contextmenu draggable hidden item +syn keyword htmlArg contained itemprop list subject spellcheck +" this doesn't work because default syntax file alredy define a 'data' attribute +syn match htmlArg "\<\(data-[\-a-zA-Z0-9_]\+\)=" contained diff --git a/base/vim/doc/.gitignore b/base/vim/doc/.gitignore new file mode 100644 index 0000000..6e92f57 --- /dev/null +++ b/base/vim/doc/.gitignore @@ -0,0 +1 @@ +tags diff --git a/base/vim/doc/git-vim.txt b/base/vim/doc/git-vim.txt new file mode 100644 index 0000000..5fba807 --- /dev/null +++ b/base/vim/doc/git-vim.txt @@ -0,0 +1,95 @@ +*git-vim.txt* Git Bindings for Vim + +============================================================================== +CONTENTS *git-vim-contents* + + 1. Introduction.............................|git-vim| + 2. Commands.................................|git-vim-commands| + 3. Keymaps..................................|git-vim-keymaps| + 4. License..................................|git-vim-license| + +============================================================================== +1. Introduction *git-vim* + +Git-vim provides: + +* Plugin files for calling git functions from inside Vim +* Syntax files for git displays + +============================================================================== +2. Commands *git-vim-commands* + +:GitAdd <file> + git-add <file> or current file if not specified. + +:GitCommit <args> + git-commit. + +:GitStatus + Show git-status of current file or repository. + +:GitLog + Show git-log of current file or repository. + +:GitCheckout <args> + git-checkout. Completes git commits. + +:GitDiff <args> + git-diff. Completes git commits. + +:GitPull <args> + git-pull. + +:GitPullRebase + git-pull —rebase. + +:GitPush <args> + git-push. Defaults to +git push origin <current-branch>+. + +:GitCatFile <args> + git-cat-file. + +:Git <args> + Does any git command. + +:GitVimDiffMerge + Experimental. Call this command on unmerged file to enter vimdiff mode. + +:GitVimDiffMergeDone + Call this command after merging. + +============================================================================== +3. Keymaps *git-vim-keymaps* + +<Leader>gd + :GitDiff + +<Leader>gD + :GitDiff —cached + +<Leader>gs + :GitStatus + +<Leader>gl + :GitLog + +<Leader>ga + :GitAdd + +<Leader>gA + :GitAdd <cfile> + +<Leader>gc + :GitCommit + +In the git-status buffer: + +<Enter> + :GitAdd <cfile> + +============================================================================== +4. License *git-vim-license* + +The MIT License + + vim:tw=78:ts=8:ft=help diff --git a/base/vim/ftdetect/markdown.vim b/base/vim/ftdetect/markdown.vim new file mode 100644 index 0000000..1c5a36a --- /dev/null +++ b/base/vim/ftdetect/markdown.vim @@ -0,0 +1,6 @@ +autocmd BufNewFile,BufRead *.markdown,*.md,*.mdown,*.mkd,*.mkdn + \ if &ft =~# '^\%(conf\|modula2\)$' | + \ set ft=markdown | + \ else | + \ setf markdown | + \ endif diff --git a/base/vim/ftdetect/mediawiki.vim b/base/vim/ftdetect/mediawiki.vim new file mode 100644 index 0000000..2f1bc69 --- /dev/null +++ b/base/vim/ftdetect/mediawiki.vim @@ -0,0 +1,6 @@ +if has("autocmd") + au BufRead,BufNewFile *.wiki set filetype=mediawiki + au BufRead,BufNewFile *.wikipedia.org* set filetype=mediawiki + au BufRead,BufNewFile *.wikibooks.org* set filetype=mediawiki + au BufRead,BufNewFile *.wikimedia.org* set filetype=mediawiki +endif diff --git a/base/vim/ftplugin/mail.vim b/base/vim/ftplugin/mail.vim new file mode 100644 index 0000000..0495ccf --- /dev/null +++ b/base/vim/ftplugin/mail.vim @@ -0,0 +1 @@ +setl fo+=aw diff --git a/base/vim/ftplugin/markdown.vim b/base/vim/ftplugin/markdown.vim new file mode 100644 index 0000000..022da06 --- /dev/null +++ b/base/vim/ftplugin/markdown.vim @@ -0,0 +1,21 @@ +" Vim filetype plugin +" Language: Markdown +" Maintainer: Tim Pope <vimNOSPAM@tpope.org> + +if exists("b:did_ftplugin") + finish +endif + +runtime! ftplugin/html.vim ftplugin/html_*.vim ftplugin/html/*.vim + +setlocal comments=fb:*,fb:-,fb:+,n:> commentstring=>\ %s +setlocal formatoptions+=tcqln formatoptions-=r formatoptions-=o +setlocal formatlistpat=^\\s*\\d\\+\\.\\s\\+\\\|^[-*+]\\s\\+ + +if exists('b:undo_ftplugin') + let b:undo_ftplugin .= "|setl cms< com< fo< flp<" +else + let b:undo_ftplugin = "setl cms< com< fo< flp<" +endif + +" vim:set sw=2: diff --git a/base/vim/plugin/git.vim b/base/vim/plugin/git.vim new file mode 100644 index 0000000..a88329b --- /dev/null +++ b/base/vim/plugin/git.vim @@ -0,0 +1,372 @@ +" Author: motemen <motemen@gmail.com> +" License: The MIT License +" URL: http://github.com/motemen/git-vim/ + +if !exists('g:git_command_edit') + let g:git_command_edit = 'new' +endif + +if !exists('g:git_bufhidden') + let g:git_bufhidden = '' +endif + +if !exists('g:git_bin') + let g:git_bin = 'git' +endif + +if !exists('g:git_author_highlight') + let g:git_author_highlight = { } +endif + +if !exists('g:git_highlight_blame') + let g:git_highlight_blame = 0 +endif + +if !exists('g:git_no_map_default') || !g:git_no_map_default + nnoremap <Leader>gd :GitDiff<Enter> + nnoremap <Leader>gD :GitDiff --cached<Enter> + nnoremap <Leader>gs :GitStatus<Enter> + nnoremap <Leader>gl :GitLog<Enter> + nnoremap <Leader>ga :GitAdd<Enter> + nnoremap <Leader>gA :GitAdd <cfile><Enter> + nnoremap <Leader>gc :GitCommit<Enter> + nnoremap <Leader>gp :GitPullRebase<Enter> + nnoremap <Leader>gb :GitBlame<Enter> +endif + +" Ensure b:git_dir exists. +function! s:GetGitDir() + if !exists('b:git_dir') + let b:git_dir = s:SystemGit('rev-parse --git-dir') + if !v:shell_error + let b:git_dir = fnamemodify(split(b:git_dir, "\n")[0], ':p') . '/' + endif + endif + return b:git_dir +endfunction + +" Returns current git branch. +" Call inside 'statusline' or 'titlestring'. +function! GitBranch() + let git_dir = <SID>GetGitDir() + + if strlen(git_dir) && filereadable(git_dir . '/HEAD') + let lines = readfile(git_dir . '/HEAD') + if !len(lines) + return '' + else + return matchstr(lines[0], 'refs/heads/\zs.\+$') + endif + else + return '' + endif +endfunction + +" List all git local branches. +function! ListGitBranches(arg_lead, cmd_line, cursor_pos) + let branches = split(s:SystemGit('branch'), '\n') + if v:shell_error + return [] + endif + + return map(branches, 'matchstr(v:val, ''^[* ] \zs.*'')') +endfunction + +" List all git commits. +function! ListGitCommits(arg_lead, cmd_line, cursor_pos) + let commits = split(s:SystemGit('log --pretty=format:%h')) + if v:shell_error + return [] + endif + + let commits = ['HEAD'] + ListGitBranches(a:arg_lead, a:cmd_line, a:cursor_pos) + commits + + if a:cmd_line =~ '^GitDiff' + " GitDiff accepts <commit>..<commit> + if a:arg_lead =~ '\.\.' + let pre = matchstr(a:arg_lead, '.*\.\.\ze') + let commits = map(commits, 'pre . v:val') + endif + endif + + return filter(commits, 'match(v:val, ''\v'' . a:arg_lead) == 0') +endfunction + +" Show diff. +function! GitDiff(args) + let git_output = s:SystemGit('diff ' . a:args . ' -- ' . s:Expand('%')) + if !strlen(git_output) + echo "No output from git command" + return + endif + + call <SID>OpenGitBuffer(git_output) + setlocal filetype=git-diff +endfunction + +" Show Status. +function! GitStatus() + let git_output = s:SystemGit('status') + call <SID>OpenGitBuffer(git_output) + setlocal filetype=git-status + nnoremap <buffer> <Enter> :GitAdd <cfile><Enter>:call <SID>RefreshGitStatus()<Enter> + nnoremap <buffer> - :silent !git reset HEAD -- =expand('<cfile>')<Enter><Enter>:call <SID>RefreshGitStatus()<Enter> +endfunction + +function! s:RefreshGitStatus() + let pos_save = getpos('.') + GitStatus + call setpos('.', pos_save) +endfunction + +" Show Log. +function! GitLog(args) + let git_output = s:SystemGit('log ' . a:args . ' -- ' . s:Expand('%')) + call <SID>OpenGitBuffer(git_output) + setlocal filetype=git-log +endfunction + +" Add file to index. +function! GitAdd(expr) + let file = s:Expand(strlen(a:expr) ? a:expr : '%') + + call GitDoCommand('add ' . file) +endfunction + +" Commit. +function! GitCommit(args) + let git_dir = <SID>GetGitDir() + + let args = a:args + + if args !~ '\v\k@<!(-a|--all)>' && s:SystemGit('diff --cached --stat') =~ '^\(\s\|\n\)*$' + let args .= ' -a' + endif + + " Create COMMIT_EDITMSG file + let editor_save = $EDITOR + let $EDITOR = '' + let git_output = s:SystemGit('commit ' . args) + let $EDITOR = editor_save + + let cur_dir = getcwd() + execute printf('%s %sCOMMIT_EDITMSG', g:git_command_edit, git_dir) + execute printf("lcd %s", cur_dir) + + setlocal filetype=git-status bufhidden=wipe + augroup GitCommit + autocmd BufWritePre <buffer> g/^#\|^\s*$/d | setlocal fileencoding=utf-8 + execute printf("autocmd BufEnter <buffer> lcd %s", cur_dir) + execute printf("autocmd BufWritePost <buffer> call GitDoCommand('commit %s -F ' . expand('%%')) | autocmd! GitCommit * <buffer>", args) + augroup END +endfunction + +" Checkout. +function! GitCheckout(args) + call GitDoCommand('checkout ' . a:args) +endfunction + +" Push. +function! GitPush(args) +" call GitDoCommand('push ' . a:args) + " Wanna see progress... + let args = a:args + if args =~ '^\s*$' + let args = 'origin ' . GitBranch() + endif + execute '!' g:git_bin 'push' args +endfunction + +" Pull. +function! GitPull(args) +" call GitDoCommand('pull ' . a:args) + " Wanna see progress... + execute '!' g:git_bin 'pull' a:args +endfunction + +" Show commit, tree, blobs. +function! GitCatFile(file) + let file = s:Expand(a:file) + let git_output = s:SystemGit('cat-file -p ' . file) + if !strlen(git_output) + echo "No output from git command" + return + endif + + call <SID>OpenGitBuffer(git_output) +endfunction + +" Show revision and author for each line. +function! GitBlame(...) + let git_output = s:SystemGit('blame -- ' . expand('%')) + if !strlen(git_output) + echo "No output from git command" + return + endif + + let l:git_blame_width = 20 + if strlen(a:1) + let l:git_blame_width = a:1 + elseif exists('g:git_blame_width') && g:git_blame_width + let l:git_blame_width = g:git_blame_width + endif + + setlocal noscrollbind + + " :/ + let git_command_edit_save = g:git_command_edit + let g:git_command_edit = 'leftabove vnew' + call <SID>OpenGitBuffer(git_output) + let g:git_command_edit = git_command_edit_save + + setlocal modifiable + silent %s/\d\d\d\d\zs \+\d\+).*// + exe 'vertical resize ' . git_blame_width + setlocal nomodifiable + setlocal nowrap scrollbind + + if g:git_highlight_blame + call s:DoHighlightGitBlame() + endif + + wincmd p + setlocal nowrap scrollbind + + syncbind +endfunction + +" Experimental +function! s:DoHighlightGitBlame() + for l in range(1, line('$')) + let line = getline(l) + let [commit, author] = matchlist(line, '\(\x\+\) (\(.\{-}\)\s* \d\d\d\d-\d\d-\d\d')[1:2] + call s:LoadSyntaxRuleFor({ 'author': author }) + endfor +endfunction + +function! s:LoadSyntaxRuleFor(params) + let author = a:params.author + let name = 'gitBlameAuthor_' . substitute(author, '\s', '_', 'g') + if (!hlID(name)) + if has_key(g:git_author_highlight, author) + execute 'highlight' name g:git_author_highlight[author] + else + let [n1, n2] = [0, 1] + for c in split(author, '\zs') + let n1 = (n1 + char2nr(c)) % 8 + let n2 = (n2 + char2nr(c) * 3) % 8 + endfor + if n1 == n2 + let n1 = (n2 + 1) % 8 + endif + execute 'highlight' name printf('ctermfg=%d ctermbg=%d', n1, n2) + endif + execute 'syntax match' name '"\V\^\x\+ (' . escape(author, '\') . '\.\*"' + endif +endfunction + +function! GitDoCommand(args) + let git_output = s:SystemGit(a:args) + let git_output = substitute(git_output, '\n*$', '', '') + if v:shell_error + echohl Error + echo git_output + echohl None + else + echo git_output + endif +endfunction + +function! s:SystemGit(args) + " workardound for MacVim, on which shell does not inherit environment + " variables + if has('mac') && &shell =~ 'sh$' + return system('EDITOR="" '. g:git_bin . ' ' . a:args) + else + return system(g:git_bin . ' ' . a:args) + endif +endfunction + +" Show vimdiff for merge. (experimental) +function! GitVimDiffMerge() + let file = s:Expand('%') + let filetype = &filetype + let t:git_vimdiff_original_bufnr = bufnr('%') + let t:git_vimdiff_buffers = [] + + topleft new + setlocal buftype=nofile + file `=':2:' . file` + call add(t:git_vimdiff_buffers, bufnr('%')) + execute 'silent read!git show :2:' . file + 0d + diffthis + let &filetype = filetype + + rightbelow vnew + setlocal buftype=nofile + file `=':3:' . file` + call add(t:git_vimdiff_buffers, bufnr('%')) + execute 'silent read!git show :3:' . file + 0d + diffthis + let &filetype = filetype +endfunction + +function! GitVimDiffMergeDone() + if exists('t:git_vimdiff_original_bufnr') && exists('t:git_vimdiff_buffers') + if getbufline(t:git_vimdiff_buffers[0], 1, '$') == getbufline(t:git_vimdiff_buffers[1], 1, '$') + execute 'sbuffer ' . t:git_vimdiff_original_bufnr + 0put=getbufline(t:git_vimdiff_buffers[0], 1, '$') + normal! jdG + update + execute 'bdelete ' . t:git_vimdiff_buffers[0] + execute 'bdelete ' . t:git_vimdiff_buffers[1] + close + else + echohl Error + echo 'There still remains conflict' + echohl None + endif + endif +endfunction + +function! s:OpenGitBuffer(content) + if exists('b:is_git_msg_buffer') && b:is_git_msg_buffer + enew! + else + execute g:git_command_edit + endif + + setlocal buftype=nofile readonly modifiable + execute 'setlocal bufhidden=' . g:git_bufhidden + + silent put=a:content + keepjumps 0d + setlocal nomodifiable + + let b:is_git_msg_buffer = 1 +endfunction + +function! s:Expand(expr) + if has('win32') + return substitute(expand(a:expr), '\', '/', 'g') + else + return expand(a:expr) + endif +endfunction + +command! -nargs=1 -complete=customlist,ListGitCommits GitCheckout call GitCheckout(<q-args>) +command! -nargs=* -complete=customlist,ListGitCommits GitDiff call GitDiff(<q-args>) +command! GitStatus call GitStatus() +command! -nargs=? GitAdd call GitAdd(<q-args>) +command! -nargs=* GitLog call GitLog(<q-args>) +command! -nargs=* GitCommit call GitCommit(<q-args>) +command! -nargs=1 GitCatFile call GitCatFile(<q-args>) +command! -nargs=? GitBlame call GitBlame(<q-args>) +command! -nargs=+ Git call GitDoCommand(<q-args>) +command! GitVimDiffMerge call GitVimDiffMerge() +command! GitVimDiffMergeDone call GitVimDiffMergeDone() +command! -nargs=* GitPull call GitPull(<q-args>) +command! GitPullRebase call GitPull('--rebase') +command! -nargs=* GitPush call GitPush(<q-args>) diff --git a/base/vim/plugin/scratch.vim b/base/vim/plugin/scratch.vim new file mode 100644 index 0000000..9b83ea4 --- /dev/null +++ b/base/vim/plugin/scratch.vim @@ -0,0 +1,134 @@ +" scratch.vim +" Author: Abhilash Koneri (abhilash_koneri at hotmail dot com) +" Improved By: Hari Krishna Dara (hari_vim at yahoo dot com) +" Last Change: 25-Feb-2004 @ 09:48 +" Created: 17-Aug-2002 +" Version: 1.0.0 +" Download From: +" http://www.vim.org/script.php?script_id=389 +"---------------------------------------------------------------------- +" This is a simple plugin that creates a scratch buffer for your +" vim session and helps to access it when you need it. +" +" If you like the custom mappings provided in the script - hitting +" <F8> should create a new scratch buffer. You can do your scribes +" here and if you want to get rid of it, hit <F8> again inside scratch buffer +" window. If you want to get back to the scratch buffer repeat <F8>. Use +" <Plug>ShowScratchBuffer and <Plug>InsShowScratchBuffer to customize these +" mappings. +" +" If you want to designate a file into which the scratch buffer contents +" should automatically be dumped to, when Vim exits, set its path to +" g:scratchBackupFile global variable. This file can be accessed just in case +" you happen to have some important information in the scratch buffer and quit +" Vim (or shutdown the m/c) forgetting to copy it over. The target file is +" force overwritten using the :write! command so make sure you set a file name +" that can accidentally be used for other purposes (especially when you use +" relative paths). I recommend a value of '/tmp/scratch.txt'. +" CAUTION: This feature works only when Vim generates VimLeavePre autocommad. +" +" Custom mappings +" --------------- +" The ones defined below are not very ergonomic! +"---------------------------------------------------------------------- +"Standard Inteface: <F8> to make a new ScratchBuffer, <F8>-again to hide one + +if exists('loaded_scratch') + finish +endif +let loaded_scratch = 1 + +" Make sure line-continuations won't cause any problem. This will be restored +" at the end +let s:save_cpo = &cpo +set cpo&vim + +if (! exists("no_plugin_maps") || ! no_plugin_maps) && + \ (! exists("no_scratch_maps") || ! no_scratch_maps) + if !hasmapto('<Plug>ShowScratchBuffer',"n") + nmap <unique> <silent> <F8> <Plug>ShowScratchBuffer + endif + if !hasmapto('<Plug>InsShowScratchBuffer',"i") + imap <unique> <silent> <F8> <Plug>InsShowScratchBuffer + endif +endif + +" User Overrideable Plugin Interface +nmap <script> <silent> <Plug>ShowScratchBuffer + \ :silent call <SID>ShowScratchBuffer()<cr> +imap <script> <silent> <Plug>InsShowScratchBuffer + \ <c-o>:silent call <SID>ShowScratchBuffer()<cr> + +command! -nargs=0 Scratch :call <SID>ShowScratchBuffer() + +if !exists('g:scratchBackupFile') + let g:scratchBackupFile = '' " So that users can easily find this var. +endif +aug ScratchBackup + au! + au VimLeavePre * :call <SID>BackupScratchBuffer() +aug END + +let s:SCRATCH_BUFFER_NAME="[Scratch]" +if !exists('s:buffer_number') " Supports reloading. + let s:buffer_number = -1 +endif + +"---------------------------------------------------------------------- +" Diplays the scratch buffer. Creates one if it is an already +" present +"---------------------------------------------------------------------- +function! <SID>ShowScratchBuffer() + if(s:buffer_number == -1 || bufexists(s:buffer_number) == 0) + " Temporarily modify isfname to avoid treating the name as a pattern. + let _isf = &isfname + set isfname-=\ + set isfname-=[ + if exists('+shellslash') + exec "sp \\\\". s:SCRATCH_BUFFER_NAME + else + exec "sp \\". s:SCRATCH_BUFFER_NAME + endif + let &isfname = _isf + let s:buffer_number = bufnr('%') + else + let buffer_win=bufwinnr(s:buffer_number) + if(buffer_win == -1) + exec 'sb '. s:buffer_number + else + exec buffer_win.'wincmd w' + endif + endif + " Do setup always, just in case. + setlocal buftype=nofile + setlocal bufhidden=hide + setlocal nobuflisted + setlocal noswapfile + setlocal noro + nmap <buffer> <silent> <Plug>ShowScratchBuffer :hide<cr> + imap <buffer> <silent> <Plug>InsShowScratchBuffer <c-o>:hide<cr> + command! -buffer -nargs=0 Scratch :hide +endfunction + +function! s:BackupScratchBuffer() + if s:buffer_number != -1 && exists('g:scratchBackupFile') && + \ g:scratchBackupFile != '' + exec 'split #' . s:buffer_number + " Avoid writing empty scratch buffers. + if line('$') > 1 || getline(1) !~ '^\s*$' + let _cpo=&cpo + try + set cpo-=A + exec 'write!' g:scratchBackupFile + finally + let &cpo=_cpo + endtry + endif + endif +endfunction + +" Restore cpo. +let &cpo = s:save_cpo +unlet s:save_cpo + +" vim6: sw=2 et diff --git a/base/vim/syntax/git-diff.vim b/base/vim/syntax/git-diff.vim new file mode 100644 index 0000000..54a97ec --- /dev/null +++ b/base/vim/syntax/git-diff.vim @@ -0,0 +1,8 @@ +runtime syntax/diff.vim + +syntax match gitDiffStatLine /^ .\{-}\zs[+-]\+$/ contains=gitDiffStatAdd,gitDiffStatDelete +syntax match gitDiffStatAdd /+/ contained +syntax match gitDiffStatDelete /-/ contained + +highlight gitDiffStatAdd ctermfg=2 +highlight gitDiffStatDelete ctermfg=5 diff --git a/base/vim/syntax/git-log.vim b/base/vim/syntax/git-log.vim new file mode 100644 index 0000000..571b28a --- /dev/null +++ b/base/vim/syntax/git-log.vim @@ -0,0 +1,3 @@ +syntax match gitLogCommit +^commit \x\{40}+ + +highlight link gitLogCommit Statement diff --git a/base/vim/syntax/git-status.vim b/base/vim/syntax/git-status.vim new file mode 100644 index 0000000..4cf05e5 --- /dev/null +++ b/base/vim/syntax/git-status.vim @@ -0,0 +1,18 @@ +runtime syntax/diff.vim +setlocal filetype= + +syntax match gitStatusComment +^#.*+ contains=ALL + +syntax match gitStatusBranch +On branch .\++ + +syntax match gitStatusUndracked +\t\zs.\++ +syntax match gitStatusNewFile +\t\zsnew file: .\++ +syntax match gitStatusModified +\t\zsmodified: .\++ + +highlight link gitStatusComment Comment + +highlight link gitStatusBranch Title + +highlight link gitStatusUndracked diffOnly +highlight link gitStatusNewFile diffAdded +highlight link gitStatusModified diffChanged diff --git a/base/vim/syntax/markdown.vim b/base/vim/syntax/markdown.vim new file mode 100644 index 0000000..5700d4b --- /dev/null +++ b/base/vim/syntax/markdown.vim @@ -0,0 +1,130 @@ +" Vim syntax file +" Language: Markdown +" Maintainer: Tim Pope <vimNOSPAM@tpope.org> +" Filenames: *.markdown + +if exists("b:current_syntax") + finish +endif + +if !exists('main_syntax') + let main_syntax = 'markdown' +endif + +runtime! syntax/html.vim +unlet! b:current_syntax + +if !exists('g:markdown_fenced_languages') + let g:markdown_fenced_languages = [] +endif +for s:type in map(copy(g:markdown_fenced_languages),'matchstr(v:val,"[^=]*$")') + if s:type =~ '\.' + let b:{matchstr(s:type,'[^.]*')}_subtype = matchstr(s:type,'\.\zs.*') + endif + exe 'syn include @markdownHighlight'.substitute(s:type,'\.','','g').' syntax/'.matchstr(s:type,'[^.]*').'.vim' + unlet! b:current_syntax +endfor +unlet! s:type + +syn sync minlines=10 +syn case ignore + +syn match markdownValid '[<>]\c[a-z/$!]\@!' +syn match markdownValid '&\%(#\=\w*;\)\@!' + +syn match markdownLineStart "^[<@]\@!" nextgroup=@markdownBlock + +syn cluster markdownBlock contains=markdownH1,markdownH2,markdownH3,markdownH4,markdownH5,markdownH6,markdownBlockquote,markdownListMarker,markdownOrderedListMarker,markdownCodeBlock,markdownRule +syn cluster markdownInline contains=markdownLineBreak,markdownLinkText,markdownItalic,markdownBold,markdownCode,markdownEscape,@htmlTop,markdownError + +syn match markdownH1 "^.\+\n=\+$" contained contains=@markdownInline,markdownHeadingRule +syn match markdownH2 "^.\+\n-\+$" contained contains=@markdownInline,markdownHeadingRule + +syn match markdownHeadingRule "^[=-]\+$" contained + +syn region markdownH1 matchgroup=markdownHeadingDelimiter start="##\@!" end="#*\s*$" keepend oneline contains=@markdownInline contained +syn region markdownH2 matchgroup=markdownHeadingDelimiter start="###\@!" end="#*\s*$" keepend oneline contains=@markdownInline contained +syn region markdownH3 matchgroup=markdownHeadingDelimiter start="####\@!" end="#*\s*$" keepend oneline contains=@markdownInline contained +syn region markdownH4 matchgroup=markdownHeadingDelimiter start="#####\@!" end="#*\s*$" keepend oneline contains=@markdownInline contained +syn region markdownH5 matchgroup=markdownHeadingDelimiter start="######\@!" end="#*\s*$" keepend oneline contains=@markdownInline contained +syn region markdownH6 matchgroup=markdownHeadingDelimiter start="#######\@!" end="#*\s*$" keepend oneline contains=@markdownInline contained + +syn match markdownBlockquote ">\s" contained nextgroup=@markdownBlock + +syn region markdownCodeBlock start=" \|\t" end="$" contained + +" TODO: real nesting +syn match markdownListMarker "\%(\t\| \{0,4\}\)[-*+]\%(\s\+\S\)\@=" contained +syn match markdownOrderedListMarker "\%(\t\| \{0,4}\)\<\d\+\.\%(\s*\S\)\@=" contained + +syn match markdownRule "\* *\* *\*[ *]*$" contained +syn match markdownRule "- *- *-[ -]*$" contained + +syn match markdownLineBreak " \{2,\}$" + +syn region markdownIdDeclaration matchgroup=markdownLinkDelimiter start="^ \{0,3\}!\=\[" end="\]:" oneline keepend nextgroup=markdownUrl skipwhite +syn match markdownUrl "\S\+" nextgroup=markdownUrlTitle skipwhite contained +syn region markdownUrl matchgroup=markdownUrlDelimiter start="<" end=">" oneline keepend nextgroup=markdownUrlTitle skipwhite contained +syn region markdownUrlTitle matchgroup=markdownUrlTitleDelimiter start=+"+ end=+"+ keepend contained +syn region markdownUrlTitle matchgroup=markdownUrlTitleDelimiter start=+'+ end=+'+ keepend contained +syn region markdownUrlTitle matchgroup=markdownUrlTitleDelimiter start=+(+ end=+)+ keepend contained + +syn region markdownLinkText matchgroup=markdownLinkTextDelimiter start="!\=\[\%(\_[^]]*]\%( \=[[(]\)\)\@=" end="\]\%( \=[[(]\)\@=" keepend nextgroup=markdownLink,markdownId skipwhite contains=@markdownInline,markdownLineStart +syn region markdownLink matchgroup=markdownLinkDelimiter start="(" end=")" contains=markdownUrl keepend contained +syn region markdownId matchgroup=markdownIdDelimiter start="\[" end="\]" keepend contained +syn region markdownAutomaticLink matchgroup=markdownUrlDelimiter start="<\%(\w\+:\|[[:alnum:]_+-]\+@\)\@=" end=">" keepend oneline + +syn region markdownItalic start="\S\@<=\*\|\*\S\@=" end="\S\@<=\*\|\*\S\@=" keepend contains=markdownLineStart +syn region markdownItalic start="\S\@<=_\|_\S\@=" end="\S\@<=_\|_\S\@=" keepend contains=markdownLineStart +syn region markdownBold start="\S\@<=\*\*\|\*\*\S\@=" end="\S\@<=\*\*\|\*\*\S\@=" keepend contains=markdownLineStart +syn region markdownBold start="\S\@<=__\|__\S\@=" end="\S\@<=__\|__\S\@=" keepend contains=markdownLineStart +syn region markdownBoldItalic start="\S\@<=\*\*\*\|\*\*\*\S\@=" end="\S\@<=\*\*\*\|\*\*\*\S\@=" keepend contains=markdownLineStart +syn region markdownBoldItalic start="\S\@<=___\|___\S\@=" end="\S\@<=___\|___\S\@=" keepend contains=markdownLineStart +syn region markdownCode matchgroup=markdownCodeDelimiter start="`" end="`" keepend contains=markdownLineStart +syn region markdownCode matchgroup=markdownCodeDelimiter start="`` \=" end=" \=``" keepend contains=markdownLineStart +syn region markdownCode matchgroup=markdownCodeDelimiter start="^\s*\zs```.*$" end="^```\ze\s*$" keepend + +if main_syntax ==# 'markdown' + for s:type in g:markdown_fenced_languages + exe 'syn region markdownHighlight'.substitute(matchstr(s:type,'[^=]*$'),'\..*','','').' matchgroup=markdownCodeDelimiter start="^\s*\zs```'.matchstr(s:type,'[^=]*').'\>.*$" end="^```\ze\s*$" keepend contains=@markdownHighlight'.substitute(matchstr(s:type,'[^=]*$'),'\.','','g') + endfor + unlet! s:type +endif + +syn match markdownEscape "\\[][\\`*_{}()#+.!-]" +syn match markdownError "\w\@<=_\w\@=" + +hi def link markdownH1 htmlH1 +hi def link markdownH2 htmlH2 +hi def link markdownH3 htmlH3 +hi def link markdownH4 htmlH4 +hi def link markdownH5 htmlH5 +hi def link markdownH6 htmlH6 +hi def link markdownHeadingRule markdownRule +hi def link markdownHeadingDelimiter Delimiter +hi def link markdownOrderedListMarker markdownListMarker +hi def link markdownListMarker htmlTagName +hi def link markdownBlockquote Comment +hi def link markdownRule PreProc + +hi def link markdownLinkText htmlLink +hi def link markdownIdDeclaration Typedef +hi def link markdownId Type +hi def link markdownAutomaticLink markdownUrl +hi def link markdownUrl Float +hi def link markdownUrlTitle String +hi def link markdownIdDelimiter markdownLinkDelimiter +hi def link markdownUrlDelimiter htmlTag +hi def link markdownUrlTitleDelimiter Delimiter + +hi def link markdownItalic htmlItalic +hi def link markdownBold htmlBold +hi def link markdownBoldItalic htmlBoldItalic +hi def link markdownCodeDelimiter Delimiter + +hi def link markdownEscape Special +hi def link markdownError Error + +let b:current_syntax = "markdown" + +" vim:set sw=2: diff --git a/base/vim/syntax/mediawiki.vim b/base/vim/syntax/mediawiki.vim new file mode 100644 index 0000000..5551dc5 --- /dev/null +++ b/base/vim/syntax/mediawiki.vim @@ -0,0 +1,293 @@ +" mediawiki.vim (formerly named Wikipedia.vim) +" +" Vim syntax file +" Language: MediaWiki, http://www.mediawiki.org/ +" Maintainer: This syntax file needs a maintainer in order to ship +" with Vim. Please contact [[User:Unforgettableid]] if you want +" to volunteer. +" Home: http://en.wikipedia.org/wiki/Wikipedia:Text_editor_support#Vim +" Last Change: 2011 Sep 19 +" Credits: [[User:Aepd87]], [[User:Danny373]], [[User:Ingo Karkat]], et al. +" +" Published on Wikipedia in 2003-04 and declared authorless. +" +" Based on the HTML syntax file. Probably too closely based, in fact. +" There may well be name collisions everywhere, but ignorance is bliss, +" so they say. +" +" To do: plug-in support for downloading and uploading to the server. + +if !exists("main_syntax") + if version < 600 + syntax clear + elseif exists("b:current_syntax") + finish + endif + let main_syntax = "html" +endif + +syntax case ignore +if v:version >= 700 + syntax spell toplevel +endif + +" Mark illegal characters +sy match htmlError "[<>&]" + +" Tags +sy region htmlString contained start=+"+ end=+"+ contains=htmlSpecialChar,@htmlPreproc +sy region htmlString contained start=+'+ end=+'+ contains=htmlSpecialChar,@htmlPreproc +sy match htmlValue contained "=[\t ]*[^'" \t>][^ \t>]*"hs=s+1 contains=@htmlPreproc +sy region htmlEndTag start=+</+ end=+>+ contains=htmlTagN,htmlTagError +sy region htmlTag start=+<[^/]+ end=+>+ contains=htmlTagN,htmlString,htmlArg,htmlValue,htmlTagError,htmlEvent,htmlCssDefinition,@htmlPreproc,@htmlArgCluster +sy match htmlTagN contained +<\s*[-a-zA-Z0-9]\++hs=s+1 contains=htmlTagName,htmlSpecialTagName,@htmlTagNameCluster +sy match htmlTagN contained +</\s*[-a-zA-Z0-9]\++hs=s+2 contains=htmlTagName,htmlSpecialTagName,@htmlTagNameCluster +sy match htmlTagError contained "[^>]<"ms=s+1 + +" Allowed HTML tag names +sy keyword htmlTagName contained big blockquote br caption center cite code +sy keyword htmlTagName contained dd del div dl dt font hr ins li +sy keyword htmlTagName contained ol p pre rb rp rt ruby s small span strike sub +sy keyword htmlTagName contained sup table td th tr tt ul var +sy match htmlTagName contained "\<\(b\|i\|u\|h[1-6]\|em\|strong\)\>" +" Allowed Wiki tag names +sy keyword htmlTagName contained math nowiki references source syntaxhighlight + +" Allowed arg names +sy keyword htmlArg contained align lang dir width height nowrap bgcolor clear +sy keyword htmlArg contained noshade cite datetime size face color type start +sy keyword htmlArg contained value compact summary border frame rules +sy keyword htmlArg contained cellspacing cellpadding valign char charoff +sy keyword htmlArg contained colgroup col span abbr axis headers scope rowspan +sy keyword htmlArg contained colspan id class name style title + +" Special characters +sy match htmlSpecialChar "&#\=[0-9A-Za-z]\{1,8};" + +" Comments +sy region htmlComment start=+<!+ end=+>+ contains=htmlCommentPart,htmlCommentError +sy match htmlCommentError contained "[^><!]" +sy region htmlCommentPart contained start=+--+ end=+--\s*+ contains=@htmlPreProc +sy region htmlComment start=+<!DOCTYPE+ keepend end=+>+ + +if !exists("html_no_rendering") + sy cluster htmlTop contains=@Spell,htmlTag,htmlEndTag,htmlSpecialChar,htmlPreProc,htmlComment,htmlLink,@htmlPreproc + + sy region htmlBold start="<b\>" end="</b>"me=e-4 contains=@htmlTop,htmlBoldUnderline,htmlBoldItalic + sy region htmlBold start="<strong\>" end="</strong>"me=e-9 contains=@htmlTop,htmlBoldUnderline,htmlBoldItalic + sy region htmlBoldUnderline contained start="<u\>" end="</u>"me=e-4 contains=@htmlTop,htmlBoldUnderlineItalic + sy region htmlBoldItalic contained start="<i\>" end="</i>"me=e-4 contains=@htmlTop,htmlBoldItalicUnderline + sy region htmlBoldItalic contained start="<em\>" end="</em>"me=e-5 contains=@htmlTop,htmlBoldItalicUnderline + sy region htmlBoldUnderlineItalic contained start="<i\>" end="</i>"me=e-4 contains=@htmlTop + sy region htmlBoldUnderlineItalic contained start="<em\>" end="</em>"me=e-5 contains=@htmlTop + sy region htmlBoldItalicUnderline contained start="<u\>" end="</u>"me=e-4 contains=@htmlTop,htmlBoldUnderlineItalic + + sy region htmlUnderline start="<u\>" end="</u>"me=e-4 contains=@htmlTop,htmlUnderlineBold,htmlUnderlineItalic + sy region htmlUnderlineBold contained start="<b\>" end="</b>"me=e-4 contains=@htmlTop,htmlUnderlineBoldItalic + sy region htmlUnderlineBold contained start="<strong\>" end="</strong>"me=e-9 contains=@htmlTop,htmlUnderlineBoldItalic + sy region htmlUnderlineItalic contained start="<i\>" end="</i>"me=e-4 contains=@htmlTop,htmlUnderlineItalicBold + sy region htmlUnderlineItalic contained start="<em\>" end="</em>"me=e-5 contains=@htmlTop,htmlUnderlineItalicBold + sy region htmlUnderlineItalicBold contained start="<b\>" end="</b>"me=e-4 contains=@htmlTop + sy region htmlUnderlineItalicBold contained start="<strong\>" end="</strong>"me=e-9 contains=@htmlTop + sy region htmlUnderlineBoldItalic contained start="<i\>" end="</i>"me=e-4 contains=@htmlTop + sy region htmlUnderlineBoldItalic contained start="<em\>" end="</em>"me=e-5 contains=@htmlTop + + sy region htmlItalic start="<i\>" end="</i>"me=e-4 contains=@htmlTop,htmlItalicBold,htmlItalicUnderline + sy region htmlItalic start="<em\>" end="</em>"me=e-5 contains=@htmlTop + sy region htmlItalicBold contained start="<b\>" end="</b>"me=e-4 contains=@htmlTop,htmlItalicBoldUnderline + sy region htmlItalicBold contained start="<strong\>" end="</strong>"me=e-9 contains=@htmlTop,htmlItalicBoldUnderline + sy region htmlItalicBoldUnderline contained start="<u\>" end="</u>"me=e-4 contains=@htmlTop + sy region htmlItalicUnderline contained start="<u\>" end="</u>"me=e-4 contains=@htmlTop,htmlItalicUnderlineBold + sy region htmlItalicUnderlineBold contained start="<b\>" end="</b>"me=e-4 contains=@htmlTop + sy region htmlItalicUnderlineBold contained start="<strong\>" end="</strong>"me=e-9 contains=@htmlTop + + sy region htmlH1 start="<h1\>" end="</h1>"me=e-5 contains=@htmlTop + sy region htmlH2 start="<h2\>" end="</h2>"me=e-5 contains=@htmlTop + sy region htmlH3 start="<h3\>" end="</h3>"me=e-5 contains=@htmlTop + sy region htmlH4 start="<h4\>" end="</h4>"me=e-5 contains=@htmlTop + sy region htmlH5 start="<h5\>" end="</h5>"me=e-5 contains=@htmlTop + sy region htmlH6 start="<h6\>" end="</h6>"me=e-5 contains=@htmlTop +endif + + +" No htmlTop and wikiPre inside HTML preformatted areas, because +" MediaWiki renders everything in there literally (HTML tags and +" entities, too): <pre> tags work as the combination of <nowiki> and +" the standard HTML <pre> tag: the content will preformatted, and it +" will not be parsed, but shown as in the wikitext source. +" +" With wikiPre, indented lines would be rendered differently from +" unindented lines. +sy match htmlPreTag /<pre>/ contains=htmlTag +sy match htmlPreEndTag /<\/pre>/ contains=htmlEndTag +sy match wikiNowikiTag /<nowiki>/ contains=htmlTag +sy match wikiNowikiEndTag /<\/nowiki>/ contains=htmlEndTag +sy match wikiSourceTag /<source\s\+[^>]\+>/ contains=htmlTag +sy match wikiSourceEndTag /<\/source>/ contains=htmlEndTag +sy match wikiSyntaxHLTag /<syntaxhighlight\s\+[^>]\+>/ contains=htmlTag +sy match wikiSyntaxHLEndTag /<\/syntaxhighlight>/ contains=htmlEndTag + +" Note: Cannot use 'start="<pre>"rs=e', so still have the <pre> tag +" highlighted correctly via separate sy-match. Unfortunately, this will +" also highlight <pre> tags inside the preformatted region. +sy region htmlPre start="<pre>" end="<\/pre>"me=e-6 contains=htmlPreTag +sy region wikiNowiki start="<nowiki>" end="<\/nowiki>"me=e-9 contains=wikiNowikiTag +sy region wikiSource start="<source\s\+[^>]\+>" keepend end="<\/source>"me=e-9 contains=wikiSourceTag +sy region wikiSyntaxHL start="<syntaxhighlight\s\+[^>]\+>" keepend end="<\/syntaxhighlight>"me=e-18 contains=wikiSyntaxHLTag + +sy include @TeX syntax/tex.vim +sy region wikiTeX matchgroup=htmlTag start="<math>" end="<\/math>" contains=@texMathZoneGroup,wikiNowiki,wikiNowikiEndTag +sy region wikiRef matchgroup=htmlTag start="<ref>" end="<\/ref>" contains=wikiNowiki,wikiNowikiEndTag + +sy cluster wikiTop contains=@Spell,wikiLink,wikiNowiki,wikiNowikiEndTag + +sy region wikiItalic start=+'\@<!'''\@!+ end=+''+ oneline contains=@wikiTop,wikiItalicBold +sy region wikiBold start=+'''+ end=+'''+ oneline contains=@wikiTop,wikiBoldItalic +sy region wikiBoldAndItalic start=+'''''+ end=+'''''+ oneline contains=@wikiTop + +sy region wikiBoldItalic contained start=+'\@<!'''\@!+ end=+''+ oneline contains=@wikiTop +sy region wikiItalicBold contained start=+'''+ end=+'''+ oneline contains=@wikiTop + +sy region wikiH1 start="^=" end="=" oneline contains=@wikiTop +sy region wikiH2 start="^==" end="==" oneline contains=@wikiTop +sy region wikiH3 start="^===" end="===" oneline contains=@wikiTop +sy region wikiH4 start="^====" end="====" oneline contains=@wikiTop +sy region wikiH5 start="^=====" end="=====" oneline contains=@wikiTop +sy region wikiH6 start="^======" end="======" oneline contains=@wikiTop + +sy region wikiLink start="\[\[" end="\]\]\(s\|'s\|es\|ing\|\)" oneline contains=wikiLink,wikiNowiki,wikiNowikiEndTag + +sy region wikiLink start="\[http:" end="\]" oneline contains=wikiNowiki,wikiNowikiEndTag +sy region wikiLink start="\[https:" end="\]" oneline contains=wikiNowiki,wikiNowikiEndTag +sy region wikiLink start="\[ftp:" end="\]" oneline contains=wikiNowiki,wikiNowikiEndTag +sy region wikiLink start="\[gopher:" end="\]" oneline contains=wikiNowiki,wikiNowikiEndTag +sy region wikiLink start="\[news:" end="\]" oneline contains=wikiNowiki,wikiNowikiEndTag +sy region wikiLink start="\[mailto:" end="\]" oneline contains=wikiNowiki,wikiNowikiEndTag + +sy region wikiTemplate start="{{" end="}}" contains=wikiNowiki,wikiNowikiEndTag + +sy match wikiParaFormatChar /^[\:|\*|;|#]\+/ +sy match wikiParaFormatChar /^-----*/ +sy match wikiPre /^\ .*$/ contains=wikiNowiki,wikiNowikiEndTag + + +" HTML highlighting + +if version < 508 + command! -nargs=+ HtmlHiLink hi link <args> +else + command! -nargs=+ HtmlHiLink hi def link <args> +endif + +if version >= 508 || !exists("did_html_syn_inits") + HtmlHiLink htmlTag Function + HtmlHiLink htmlEndTag Identifier + HtmlHiLink htmlArg Type + HtmlHiLink htmlTagName htmlStatement + HtmlHiLink htmlSpecialTagName Exception + HtmlHiLink htmlValue String + HtmlHiLink htmlSpecialChar Special + + if !exists("html_no_rendering") + HtmlHiLink htmlTitle Title + HtmlHiLink htmlH1 htmlTitle + HtmlHiLink htmlH2 htmlTitle + HtmlHiLink htmlH3 htmlTitle + HtmlHiLink htmlH4 htmlTitle + HtmlHiLink htmlH5 htmlTitle + HtmlHiLink htmlH6 htmlTitle + + HtmlHiLink htmlPreProc PreProc + HtmlHiLink htmlHead htmlPreProc + HtmlHiLink htmlPreProcAttrName htmlPreProc + HtmlHiLink htmlPreStmt htmlPreProc + + HtmlHiLink htmlSpecial Special + HtmlHiLink htmlCssDefinition htmlSpecial + HtmlHiLink htmlEvent htmlSpecial + HtmlHiLink htmlSpecialChar htmlSpecial + + HtmlHiLink htmlComment Comment + HtmlHiLink htmlCommentPart htmlComment + HtmlHiLink htmlCssStyleComment htmlComment + + HtmlHiLink htmlString String + HtmlHiLink htmlPreAttr htmlString + HtmlHiLink htmlValue htmlString + + HtmlHiLink htmlError Error + HtmlHiLink htmlBadArg htmlError + HtmlHiLink htmlBadTag htmlError + HtmlHiLink htmlCommentError htmlError + HtmlHiLink htmlPreError htmlError + HtmlHiLink htmlPreProcAttrError htmlError + HtmlHiLink htmlTagError htmlError + + HtmlHiLink htmlStatement Statement + + HtmlHiLink htmlConstant Constant + + HtmlHiLink htmlBoldItalicUnderline htmlBoldUnderlineItalic + HtmlHiLink htmlUnderlineItalicBold htmlBoldUnderlineItalic + HtmlHiLink htmlUnderlineBoldItalic htmlBoldUnderlineItalic + HtmlHiLink htmlItalicBoldUnderline htmlBoldUnderlineItalic + HtmlHiLink htmlItalicUnderlineBold htmlBoldUnderlineItalic + + HtmlHiLink htmlItalicBold htmlBoldItalic + HtmlHiLink htmlItalicUnderline htmlUnderlineItalic + HtmlHiLink htmlUnderlineBold htmlBoldUnderline + + HtmlHiLink htmlLink Underlined + + if !exists("html_my_rendering") + hi def htmlBold term=bold cterm=bold gui=bold + hi def htmlBoldUnderline term=bold,underline cterm=bold,underline gui=bold,underline + hi def htmlBoldItalic term=bold,italic cterm=bold,italic gui=bold,italic + hi def htmlBoldUnderlineItalic term=bold,italic,underline cterm=bold,italic,underline gui=bold,italic,underline + hi def htmlUnderline term=underline cterm=underline gui=underline + hi def htmlUnderlineItalic term=italic,underline cterm=italic,underline gui=italic,underline + hi def htmlItalic term=italic cterm=italic gui=italic + endif + + endif " !exists("html_no_rendering") + + if version < 508 + let did_html_syn_inits = 1 + endif + +endif " version >= 508 || !exists("did_html_syn_inits") + +" Wiki highlighting + +HtmlHiLink wikiItalic htmlItalic +HtmlHiLink wikiBold htmlBold +HtmlHiLink wikiBoldItalic htmlBoldItalic +HtmlHiLink wikiItalicBold htmlBoldItalic +HtmlHiLink wikiBoldAndItalic htmlBoldItalic + +HtmlHiLink wikiH1 htmlTitle +HtmlHiLink wikiH2 htmlTitle +HtmlHiLink wikiH3 htmlTitle +HtmlHiLink wikiH4 htmlTitle +HtmlHiLink wikiH5 htmlTitle +HtmlHiLink wikiH6 htmlTitle + +HtmlHiLink wikiLink htmlLink +HtmlHiLink wikiTemplate htmlSpecial +HtmlHiLink wikiParaFormatChar htmlSpecial +HtmlHiLink wikiPre htmlConstant +HtmlHiLink wikiRef htmlComment + +HtmlHiLink wikiSource wikiPre +HtmlHiLink wikiSyntaxHL wikiPre + + +let b:current_syntax = "html" + +delcommand HtmlHiLink + +if main_syntax == "html" + unlet main_syntax +endif + +" vim: set et sts=2 sw=2: diff --git a/base/vimrc b/base/vimrc new file mode 100644 index 0000000..7e68671 --- /dev/null +++ b/base/vimrc @@ -0,0 +1,142 @@ +" Setting editor defaults +set nu +syntax on +set bg=dark +set diffopt=filler,iwhite " keep files synced and ignore whitespace +set expandtab " Get rid of tabs altogether and replace with spaces +"set guioptions-=m " Remove menu from the gui +set guioptions-=T " Remove toolbar +set hidden " hide buffers instead of closing +set history=50 " keep 50 lines of command line history +set ignorecase " Do case insensitive matching +set smartcase " Ignore case only when doing a lowercase search +set incsearch " Incremental search +set linebreak " This displays long lines as wrapped at word boundries +set matchtime=10 " Time to flash the brack with showmatch +set nobackup " Don't keep a backup file +set nocompatible " Use Vim defaults (much better!) +set hlsearch " Use highlighted search (I am blind) +set t_Co=256 " Set terminal to use 256 colors +set backspace=indent,eol,start +set clipboard=unnamed " Use system clipboard for all cut/copy operations +set ruler +set foldmethod=indent +set nofen +set mouse=a +set spell spelllang=en +set wildmode=list:longest,full +set nomousehide +set sessionoptions+=resize,winpos +set listchars=tab:>-,trail:. +set list +set colorcolumn=100 + +" Status Line Settings +set laststatus=2 " always have status bar +set statusline= +set statusline+=%n\ +set statusline+=%<%f\ %h%m%r +set statusline+=%= +set statusline+=%-14.(%l,%c%V%)\ %P + +" filetypes +filetype plugin on +filetype indent on +filetype on + +"Set colorscheme. +colorscheme slate + +" Turn off highlighting after search +map ,, :nohl<CR> + +" Remove all trailing whitespaces +map <Leader>s :%s/\s\+$//g <cr> + +" toggle line number with F11 or Ctrl-L +map <F11> : set number! <cr> +map <C-L> : set number! <cr> + +" Move between split windows +map O5B <C-W>j +map O5A <C-W>k +map O5D <C-W>h +map O5C <C-W>l +imap O5B <C-W>j +imap O5A <C-W>k +imap O5D <C-W>h +imap O5C <C-W>l + +"Set tab to 4 spaces +set shiftwidth=4 +set softtabstop=4 +set tabstop=4 +set smarttab + +" Paste from GUI into vim and not lose indendation +" F7 to toggle paste mode +map <F7> :set invpaste<CR> +set pastetoggle=<F7> + +"normal mode maps + +" Switch to/from header file +map <F4> :e %:p:s,.h$,.X123X,:s,.cpp$,.h,:s,.X123X$,.cpp,<CR> + +"Map \e to edit a file from the directory of the current buffer +if has("unix") + nmap <Leader>e :e <C-R>=expand("%:p:h") . "/"<CR> +else + nmap <Leader>,e :e <C-R>=expand("%:p:h") . "\\"<CR> +endif + +cabbr <expr> %% expand('%:p:h') + +"When editing a file, make screen display the name of the file you are editing +function! SetTitle() + if $TERM =~ "^screen" + let l:title = 'vi: ' . expand('%:t') + + if (l:title != 'vi: __Tag_List__') + let l:truncTitle = strpart(l:title, 0, 15) + silent exe '!echo -e -n "\033k' . l:truncTitle . '\033\\"' + endif + endif +endfunction + +" Run it every time we change buffers +autocmd BufEnter,BufFilePost * call SetTitle() + +perl <<EOT + # Get the user name, should probably get the home dir... + my $home_dir = (getpwuid($<))[7]; + + if ( -e $home_dir ) { + my $temp_location = "$home_dir/.vim-tmp"; + my $tmp_dir = $temp_location . '/vXXX'; + my $swp_dir = $temp_location . '/swps'; + + # If the location doesn't exist, create it + mkdir $temp_location unless ( -e $temp_location ); + + mkdir $tmp_dir unless ( -e $tmp_dir ); + mkdir $swp_dir unless ( -e $swp_dir ); + + # Set TMPDIR and directory to the new location + VIM::DoCommand("let \$TMPDIR = '" . $tmp_dir . "'") if ( -w $tmp_dir ); + VIM::DoCommand("set directory=" . $swp_dir) if ( -w $swp_dir ); + } +EOT + +" Scratch Plugin +let g:scratchBackupFile="/tmp/scratch.txt" + +iab --> → + +" Quicker compile & check +map <C-x> :silent make<Enter>:copen<Enter><C-w><C-w>:redraw<Enter> + +" Load host-specific settings +set runtimepath^=~/.host-specific/vim, +set runtimepath+=~/.host-specific/vim/after +source ~/.host-specific/vimrc diff --git a/base/weatherrc b/base/weatherrc new file mode 100644 index 0000000..d14c702 --- /dev/null +++ b/base/weatherrc @@ -0,0 +1,6 @@ +[default] +alert = False +city = Seattle +id = KSEA +metric = True +zones = WAZ508,WAZ505,WAZ509 diff --git a/base/xsession b/base/xsession new file mode 100644 index 0000000..84e8af6 --- /dev/null +++ b/base/xsession @@ -0,0 +1,44 @@ +# Set my editor and terminal +export TERMINAL=urxvt +export EDITOR=vim + +if [ -f ~/.shell_pathes ]; then + source ~/.shell_pathes +fi + +# Host Specific Settings +if [ -f ~/.host-specific/shell_pathes ]; then + source ~/.host-specific/shell_pathes +fi + +# Some X Stuff +xsetroot -solid "#333333" +ulimit -c unlimited + +# Startup applications +/usr/lib/gnome-settings-daemon/gnome-settings-daemon & +/usr/lib/notification-daemon/notification-daemon & +(sleep 8; start-pulseaudio-x11) & +(sleep 60; update-notifier) & +(sleep 5; gnome-sound-applet) & +(sleep 5; nm-applet) & +(sleep 5; system-config-printer-applet) & +#eval $(gnome-keyring-daemon -s --components=pkcs11,secrets,ssh,gpg) & +(sleep 5; nitrogen --restore) & +gtk-theme-switch2 -i Ambiance +xrdb $HOME/.Xresources + +# Host Specific Settings +if [ -f $HOME/.host-specific/xsession ]; then + source $HOME/.host-specific/xsession +fi + +# Make the i3 config + +make_i3_config > $HOME/.config/i3/config + +if [ -x ~/dev/i3/i3 ]; then + exec ~/dev/i3/i3 +else + exec i3 +fi diff --git a/base/zshrc b/base/zshrc new file mode 100644 index 0000000..e69dec8 --- /dev/null +++ b/base/zshrc @@ -0,0 +1,53 @@ +# +# .zshrc is sourced in interactive shells. +# It should contain commands to set up aliases, +# functions, options, key bindings, etc. +# + +# Load this first or the work desktop cries +source ~/.host-specific/zshrc + +autoload -U compinit +compinit + +#allow tab completion in the middle of a word +setopt COMPLETE_IN_WORD + +## keep background processes at full speed +#setopt NOBGNICE +## restart running processes on exit +#setopt HUP + +## history +#setopt APPEND_HISTORY +## for sharing history between zsh processes +#setopt INC_APPEND_HISTORY +#setopt SHARE_HISTORY + +## never ever beep ever +#setopt NO_BEEP + +## automatically decide when to page a list of completions +#LISTMAX=0 + +## disable mail checking +#MAILCHECK=0 + +# autoload -U colors +colors + +# Fix keys +bindkey 'OH' beginning-of-line +bindkey '[1~' beginning-of-line +bindkey 'OF' end-of-line +bindkey '[4~' end-of-line +bindkey '[3~' delete-char + +zstyle ':completion:*' completer _complete _ignored _files + +source ~/.bash_aliases +source ~/.host-specific/bash_aliases + +[[ -a ~/.shell_pathes ]] && source ~/.shell_pathes +[[ -a ~/.host-specific/shell_pathes ]] && source ~/.host-specific/shell_pathes + diff --git a/host-overrides/bismuth.jesterpm.net/config/.nolink b/host-overrides/bismuth.jesterpm.net/config/.nolink new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/host-overrides/bismuth.jesterpm.net/config/.nolink diff --git a/host-overrides/bismuth.jesterpm.net/config/i3/.nolink b/host-overrides/bismuth.jesterpm.net/config/i3/.nolink new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/host-overrides/bismuth.jesterpm.net/config/i3/.nolink diff --git a/host-overrides/bismuth.jesterpm.net/config/i3/autostart.d/.nolink b/host-overrides/bismuth.jesterpm.net/config/i3/autostart.d/.nolink new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/host-overrides/bismuth.jesterpm.net/config/i3/autostart.d/.nolink diff --git a/host-overrides/bismuth.jesterpm.net/config/i3/autostart.d/10_xautolock b/host-overrides/bismuth.jesterpm.net/config/i3/autostart.d/10_xautolock new file mode 100644 index 0000000..ef9dc0c --- /dev/null +++ b/host-overrides/bismuth.jesterpm.net/config/i3/autostart.d/10_xautolock @@ -0,0 +1,2 @@ +exec --no-startup-id xautolock -time 20 -locker lock -corners 0-00 + diff --git a/host-overrides/bismuth.jesterpm.net/config/i3/config.d/.nolink b/host-overrides/bismuth.jesterpm.net/config/i3/config.d/.nolink new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/host-overrides/bismuth.jesterpm.net/config/i3/config.d/.nolink diff --git a/host-overrides/bismuth.jesterpm.net/config/i3/config.d/50_bismuth.jesterpm.net b/host-overrides/bismuth.jesterpm.net/config/i3/config.d/50_bismuth.jesterpm.net new file mode 100644 index 0000000..bd87162 --- /dev/null +++ b/host-overrides/bismuth.jesterpm.net/config/i3/config.d/50_bismuth.jesterpm.net @@ -0,0 +1,7 @@ +## This config is specific to Bismuth + +workspace "1: irssi" output VGA-0 +workspace "2: web" output VGA-0 +workspace "3: dev" output VGA-0 +workspace "10: April" output VGA-0 + diff --git a/host-overrides/jesterpm.net/config/.nolink b/host-overrides/jesterpm.net/config/.nolink new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/host-overrides/jesterpm.net/config/.nolink diff --git a/host-overrides/jesterpm.net/config/i3/.nolink b/host-overrides/jesterpm.net/config/i3/.nolink new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/host-overrides/jesterpm.net/config/i3/.nolink diff --git a/host-overrides/jesterpm.net/config/i3/autostart.d/.nolink b/host-overrides/jesterpm.net/config/i3/autostart.d/.nolink new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/host-overrides/jesterpm.net/config/i3/autostart.d/.nolink diff --git a/host-overrides/jesterpm.net/config/i3/config.d/.nolink b/host-overrides/jesterpm.net/config/i3/config.d/.nolink new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/host-overrides/jesterpm.net/config/i3/config.d/.nolink diff --git a/host-overrides/jesterpm.net/gitconfig b/host-overrides/jesterpm.net/gitconfig new file mode 100644 index 0000000..8dc5fd1 --- /dev/null +++ b/host-overrides/jesterpm.net/gitconfig @@ -0,0 +1,5 @@ +[user] + name = Jesse Morgan + email = jesse@jesterpm.net +[color] + ui = true diff --git a/host-overrides/jesterpm.net/host-specific/bashrc b/host-overrides/jesterpm.net/host-specific/bashrc new file mode 100644 index 0000000..295e969 --- /dev/null +++ b/host-overrides/jesterpm.net/host-specific/bashrc @@ -0,0 +1,10 @@ +# +# Settings specific to my personal machines +# + +# Mail Stuff +export MAILUSER="jesse" +export MAILNAME="Jesse Morgan" +export MAILHOST="jesterpm.net" +export MAIL=$HOME/.maildir/INBOX +export MAILDIR=$MAIL diff --git a/host-overrides/jesterpm.net/host-specific/muttrc b/host-overrides/jesterpm.net/host-specific/muttrc new file mode 100644 index 0000000..806ba60 --- /dev/null +++ b/host-overrides/jesterpm.net/host-specific/muttrc @@ -0,0 +1,16 @@ +# Mutt settings specific to my computers. + +set from="Jesse Morgan <jesse@jesterpm.net>" +set crypt_autosign +set sendmail="msmtp" + +set postponed="+postponed" +set record="+sent-`date +%Y`" + +mailboxes =INBOX =archived =dc206 =probably-spam =theclymb + +subscribe list@dc206.org +subscribe bugtraq@securityfocus.com +subscribe members@kc4x4sar.org +subscribe hub@kc4x4sar.org +subscribe i3-discuss@i3.zekjur.net diff --git a/host-overrides/jesterpm.net/host-specific/shell_pathes b/host-overrides/jesterpm.net/host-specific/shell_pathes new file mode 100644 index 0000000..3e5c62a --- /dev/null +++ b/host-overrides/jesterpm.net/host-specific/shell_pathes @@ -0,0 +1,6 @@ +# PATH changes +export PATH=$HOME/opt/bin:$PATH + +# CLASSPATH +export CLASSPATH=$HOME/development/classes:$CLASSPATH + diff --git a/host-overrides/jesterpm.net/host-specific/vim/ftplugin/java.vim b/host-overrides/jesterpm.net/host-specific/vim/ftplugin/java.vim new file mode 100644 index 0000000..f0934a2 --- /dev/null +++ b/host-overrides/jesterpm.net/host-specific/vim/ftplugin/java.vim @@ -0,0 +1,3 @@ +" Set the makeprg +set makeprg=javac\ -sourcepath\ src\ -d\ ~/development/classes\ % + diff --git a/host-overrides/jesterpm.net/host-specific/vimrc b/host-overrides/jesterpm.net/host-specific/vimrc new file mode 100644 index 0000000..a499745 --- /dev/null +++ b/host-overrides/jesterpm.net/host-specific/vimrc @@ -0,0 +1,23 @@ +set tags+=~/development/lib/*/tags +set tags+=../tags + +function! InsertJavaPackage() + let filename = expand("%") + let filename = substitute(filename, "\.java$", "", "") + let dir = getcwd() . "/" . filename + let dir = substitute(dir, "^.*\/src\/", "", "") + let dir = substitute(dir, "\/[^\/]*$", "", "") + let dir = substitute(dir, "\/", ".", "g") + let filename = substitute(filename, "^.*\/", "", "") + let dir = "package " . dir . ";" + let result = append(0, "\/*") + let result = append(1, " * Copyright " . strftime("%Y") ." Jesse Morgan") + let result = append(2, " */") + let result = append(4, [dir, "", "\/**", " * ", " * @author Jesse Morgan <jesse@jesterpm.net>", " */", "class " . filename . " {", " ", "}"]) + exe "normal 12G" +endfunction + +autocmd BufNewFile *.java call InsertJavaPackage() +"autocmd filetype java setlocal makeprg=ant +"autocmd filetype java setlocal efm=\ %#[javac]\ %#%f:%l:%c:%*\\d:%*\\d:\ %t%[%^:]%#:%m,\%A\ %#[javac]\ %f:%l:\ %m,%-Z\ %#[javac]\ %p^,%-C%.%# + diff --git a/host-overrides/jesterpm.net/local/.nolink b/host-overrides/jesterpm.net/local/.nolink new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/host-overrides/jesterpm.net/local/.nolink diff --git a/host-overrides/jesterpm.net/local/share/.nolink b/host-overrides/jesterpm.net/local/share/.nolink new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/host-overrides/jesterpm.net/local/share/.nolink diff --git a/host-overrides/jesterpm.net/local/share/applications/.nolink b/host-overrides/jesterpm.net/local/share/applications/.nolink new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/host-overrides/jesterpm.net/local/share/applications/.nolink diff --git a/host-overrides/jesterpm.net/local/share/applications/gnome-terminal.desktop b/host-overrides/jesterpm.net/local/share/applications/gnome-terminal.desktop new file mode 100755 index 0000000..267922b --- /dev/null +++ b/host-overrides/jesterpm.net/local/share/applications/gnome-terminal.desktop @@ -0,0 +1,28 @@ +[Desktop Entry] +Name=Terminal +Comment=Use the command line +TryExec=gnome-terminal +Exec=gnome-terminal +Icon=utilities-terminal +Type=Application +X-GNOME-DocPath=gnome-terminal/index.html +X-GNOME-Bugzilla-Bugzilla=GNOME +X-GNOME-Bugzilla-Product=gnome-terminal +X-GNOME-Bugzilla-Component=BugBuddyBugs +X-GNOME-Bugzilla-Version=3.4.1.1 +Categories=GNOME;GTK;Utility;TerminalEmulator; +StartupNotify=true +OnlyShowIn=GNOME;Unity; +Keywords=Run; +Actions=New;VIM +X-Ubuntu-Gettext-Domain=gnome-terminal + +[Desktop Action New] +Name=New Terminal +Exec=gnome-terminal +OnlyShowIn=Unity + +[Desktop Action VIM] +Name=VIM Terminal +Exec=gnome-terminal -e vim --window-with-profile=BlackWhite +OnlyShowIn=Unity diff --git a/host-overrides/jesterpm.net/ssh/.nolink b/host-overrides/jesterpm.net/ssh/.nolink new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/host-overrides/jesterpm.net/ssh/.nolink diff --git a/host-overrides/jesterpm.net/ssh/config b/host-overrides/jesterpm.net/ssh/config new file mode 100644 index 0000000..416f1f8 --- /dev/null +++ b/host-overrides/jesterpm.net/ssh/config @@ -0,0 +1 @@ +User jesse @@ -64,10 +64,14 @@ def makeLinks(dotfiles, prefix, nice, pretend): else: try: + fileExists = os.path.lexists(realDest) if not pretend: success = makeLink(src, realDest, nice) - print "%50s => %s" % (realDest, src) + if fileExists: + print "%50s !=> %s" % (realDest, src) + else: + print "%50s => %s" % (realDest, src) except IOError,e: print "Not linking %s to %s because IOError: %s" % (realDest, src, str(e)) |