Permalink
Browse files

Update dotfiles

  • Loading branch information...
1 parent 1ae7864 commit 8d86c77cf7970065d15ef8d6827d86968b7dd00a @mason-larobina committed Jul 5, 2012
Showing with 3,824 additions and 103 deletions.
  1. +8 −3 .Xresources
  2. +0 −7 .alias
  3. +56 −39 .bashrc
  4. +5 −0 .config/awesome/rc.lua
  5. +1 −0 .gitignore
  6. +140 −52 .vimrc
  7. +4 −2 .xinitrc
  8. +33 −0 bin/bash_colours.sh
  9. +2,127 −0 bin/git-completion.bash
  10. +1,450 −0 bin/markdown
  11. 0 {.bin → bin}/ws
View
@@ -2,9 +2,10 @@
! === X f t ==================================================================
-Xft.antialias: 1
+Xft.antialias: true
Xft.autohint: 0
-Xft.dpi: 112
+!Xft.dpi: 112
+Xft.dpi: 90
Xft.hinting: 1
Xft.hintstyle: hintfull
Xft.lcdfilter: lcddefault
@@ -14,7 +15,8 @@ Xft.rgba: rgb
URxvt.cursorBlink: true
URxvt.depth: 24
-URxvt.font: xft:Terminus:pixelsize=13
+URxvt.font: xft:Terminus:pixelsize=13:antialias=false
+!URxvt.font: xft:Monospace:pixelsize=20
URxvt.inheritPixmap: true
URxvt.internalBorder: 4
URxvt.loginShell: true
@@ -73,3 +75,6 @@ URxvt.cutchars: `"()'*<>[]{|}"
URxvt.matcher.pattern.1: \\bwww\\.[\\w-]\\.[\\w./?&@#-]*[\\w/-]
URxvt.matcher.button: 1
URxvt.urlLauncher: luakit
+
+
+xscreensaver.splash: false
View
7 .alias
@@ -1,7 +0,0 @@
-alias ls='ls --color=auto'
-alias l='ls --color=auto -al'
-alias xr='xrdb -all ~/.Xresources'
-alias py='python'
-alias tu='cd ~/src/uzbl && make test-uzbl-browser-sandbox'
-alias ack="ack -a -C 3"
-alias pr="python -m cProfile"
View
95 .bashrc
@@ -1,9 +1,15 @@
# Export environ vars.
export EDITOR="vim"
-export PATH="/home/$USER/.bin:$PATH"
+export PATH="~/bin:$PATH"
export XDG_DATA_HOME="/home/$USER/.local/share"
export XDG_CONFIG_HOME="/home/$USER/.config"
export XDG_CACHE_HOME="/home/$USER/.cache"
+export XDG_DOWNLOAD_DIR="/home/$USER/downloads"
+
+# Erase history duplicates, store 10k lines, append hist
+export HISTCONTROL=erasedups
+export HISTSIZE=10000
+shopt -s histappend
# Check for an interactive session
[ -z "$PS1" ] && return
@@ -13,41 +19,52 @@ keychain id_dsa
. ~/.keychain/$HOSTNAME-sh
clear
-source ~/.alias
-
-txtblk='\e[0;30m' # Black - Regular
-txtred='\e[0;31m' # Red
-txtgrn='\e[0;32m' # Green
-txtylw='\e[0;33m' # Yellow
-txtblu='\e[0;34m' # Blue
-txtpur='\e[0;35m' # Purple
-txtcyn='\e[0;36m' # Cyan
-txtwht='\e[0;37m' # White
-bldblk='\e[1;30m' # Black - Bold
-bldred='\e[1;31m' # Red
-bldgrn='\e[1;32m' # Green
-bldylw='\e[1;33m' # Yellow
-bldblu='\e[1;34m' # Blue
-bldpur='\e[1;35m' # Purple
-bldcyn='\e[1;36m' # Cyan
-bldwht='\e[1;37m' # White
-unkblk='\e[4;30m' # Black - Underline
-undred='\e[4;31m' # Red
-undgrn='\e[4;32m' # Green
-undylw='\e[4;33m' # Yellow
-undblu='\e[4;34m' # Blue
-undpur='\e[4;35m' # Purple
-undcyn='\e[4;36m' # Cyan
-undwht='\e[4;37m' # White
-bakblk='\e[40m' # Black - Background
-bakred='\e[41m' # Red
-badgrn='\e[42m' # Green
-bakylw='\e[43m' # Yellow
-bakblu='\e[44m' # Blue
-bakpur='\e[45m' # Purple
-bakcyn='\e[46m' # Cyan
-bakwht='\e[47m' # White
-txtrst='\e[0m' # Text Reset
-
-PS1="\[${txtblk}\]\w\[${txtrst}\] \[${txtblu}\]>\[${txtrst}\] "
-PS2="\[${txtblk}\]. \[${txtrst}\]"
+alias ls='ls --color=auto'
+alias l='ls --color=auto -Glh'
+alias xr='xrdb -all ~/.Xresources'
+alias ack="ack -a -C 3"
+alias mklk="make clean && USE_UNIQUE=0 USE_LUAJIT=1 CC=clang make luakit -j4"
+
+# Load colours for PS1
+. ~/bin/bash_colours.sh
+
+function minutes_since_last_commit {
+ now=`date +%s`
+ last_commit=`git log --pretty=format:'%at' -1`
+ seconds_since_last_commit=$((now-last_commit))
+ minutes_since_last_commit=$((seconds_since_last_commit/60))
+ echo $minutes_since_last_commit
+}
+
+grb_git_prompt() {
+ local g="$(__gitdir)"
+ if [ -n "$g" ]; then
+ local LAST=`minutes_since_last_commit`
+
+ if [ "$LAST" -gt 43200 ]; then
+ local COLOR=${txtred}
+ local SINCE_LAST_COMMIT="${COLOR}$((LAST/43200))M${txtrst}"
+
+ elif [ "$LAST" -gt 1440 ]; then
+ local COLOR=${txtblu}
+ local SINCE_LAST_COMMIT="${COLOR}$((LAST/1440))d${txtrst}"
+
+ elif [ "$LAST" -gt 60 ]; then
+ local COLOR=${txtpur}
+ local SINCE_LAST_COMMIT="${COLOR}$((LAST/60))h${txtrst}"
+
+ else
+ local COLOR=${txtgrn}
+ local SINCE_LAST_COMMIT="${COLOR}${LAST}m${txtrst}"
+ fi
+
+ # The __git_ps1 function inserts the current git branch where %s is
+ local GIT_PROMPT=`__git_ps1 "(%s ${SINCE_LAST_COMMIT})"`
+ echo "${GIT_PROMPT} "
+ fi
+}
+
+PS1="\[${txtgrn}\]\w\[${txtrst}\] \$(grb_git_prompt)\[${txtblu}\]>\[${txtrst}\] "
+PS2="\[${txtgrn}\]. \[${txtrst}\]"
+
+source ~/bin/git-completion.bash
View
@@ -147,6 +147,7 @@ for s = 1, screen.count() do
-- Create the wibox
mywibox[s] = awful.wibox({ position = "top", screen = s })
+
-- Add widgets to the wibox - order matters
mywibox[s].widgets = {
{
@@ -205,6 +206,10 @@ globalkeys = awful.util.table.join(
-- Standard program
awful.key({ modkey, }, "Return", function () awful.util.spawn(terminal) end),
+ awful.key({ modkey, }, "l", function () awful.util.spawn("luakit") end),
+ awful.key({ modkey, }, "t", function () awful.util.spawn("thunar") end),
+ awful.key({ modkey, }, "a", function () awful.util.spawn(terminal .. " -e alsamixer") end),
+ awful.key({ modkey, }, "w", function () awful.util.spawn(terminal .. " -e wicd-curses") end),
awful.key({ modkey, "Control" }, "r", awesome.restart),
awful.key({ modkey, "Shift" }, "q", awesome.quit),
View
@@ -0,0 +1 @@
+*
View
192 .vimrc
@@ -7,84 +7,172 @@ set backspace=indent,eol,start
" Backup original files to ~/.vimbak
set backup
-set backupdir=~/.vimbak,.
+set backupdir=~/.vimbak
+set directory=~/.vimbak
-set history=50 " keep 50 lines of command line history
-set ruler " show the cursor position all the time
-set showcmd " display incomplete commands
-set incsearch " do incremental searching
+set history=500 " keep 50 lines of command line history
+set showcmd " display incomplete commands
+set incsearch " match while typing
+"set showmatch " breifly jump to matching brackets on insert
set title " set the title to something sensible
set hlsearch " match all find occurances
set number " show line numbers
-set smartcase
-set foldmethod=marker
-set ts=8 sts=4 sw=4 et
+set scrolloff=3 " keep 3 lines of context around cursor
+set laststatus=2 " always show status line
+set ignorecase smartcase " ignore case unless upper chars in search
+set autoindent
-" Don't use Ex mode, use Q for formatting
-map Q gq
+set expandtab
+set tabstop=4
+set softtabstop=4
+set shiftwidth=4
-" CTRL-U in insert mode deletes a lot. Use CTRL-G u to first break undo,
-" so that you can undo CTRL-U after inserting a line break.
-inoremap <C-U> <C-G>u<C-U>
+set foldmethod=marker
-nnoremap <silent><F3> :set number!<CR>
-noremap <silent><F10> :set spell!<CR>
-noremap <silent><F9> :set paste!<CR>
+" use emacs-style tab completion when selecting files, etc
+set wildmode=longest,list
+set wildmenu
-" In many terminal emulators the mouse works just fine, thus enable it.
-"if has('mouse')
-" set mouse=a
-"endif
+let mapleader = ","
-" Switch syntax highlighting on, when the terminal has colors
+" Switch syntax highlighting on
" Also switch on highlighting the last used search pattern.
-if &t_Co > 2 || has("gui_running")
- syntax on
- set hlsearch
-endif
+syntax on
-" Only do this part when compiled with support for autocommands.
-if has("autocmd")
+" Enable file type detection.
+" Use the default filetype settings, so that mail gets 'tw' set to 72,
+" 'cindent' is on in C files, etc.
+" Also load indent files, to automatically do language-dependent indenting.
+filetype plugin indent on
- " Enable file type detection.
- " Use the default filetype settings, so that mail gets 'tw' set to 72,
- " 'cindent' is on in C files, etc.
- " Also load indent files, to automatically do language-dependent indenting.
- filetype plugin indent on
+" escape from insert mode with jk or kj
+inoremap jk <Esc>
+inoremap kj <Esc>
- " Put these in an autocmd group, so that we can delete them easily.
- augroup vimrcEx
- au!
+set statusline=%<%f\ (%{&ft})\ %-4(%m%)%=%-19(%3l,%02c%03V%)
- " For all text files set 'textwidth' to 78 characters.
- autocmd FileType text setlocal textwidth=78
-
- " When editing a file, always jump to the last known cursor position.
- " Don't do it when the position is invalid or when inside an event handler
- " (happens when dropping a file on gvim).
- " Also don't do it when the mark is in the first line, that is the default
- " position when opening a file.
- autocmd BufReadPost *
- \ if line("'\"") > 1 && line("'\"") <= line("$") |
- \ exe "normal! g`\"" |
- \ endif
+" Don't use Ex mode, use Q for formatting
+map Q gq
- augroup END
+" CTRL-U in insert mode deletes a lot. Use CTRL-G u to first break undo, so
+" that you can undo CTRL-U after inserting a line break.
+inoremap <C-U> <C-G>u<C-U>
-else
+nnoremap <silent><F3> :set number!<CR>
+noremap <silent><F10> :set spell!<CR>
+noremap <silent><F9> :set paste!<CR>
- set autoindent " always set autoindenting on
+" In many terminal emulators the mouse works just fine, thus enable it.
+if has('mouse')
+ set mouse=a
+endif
-endif " has("autocmd")
+augroup vimrcEx
+ " For all text files set 'textwidth' to 78 characters.
+ autocmd FileType text setlocal textwidth=78
+
+ " When editing a file, always jump to the last known cursor position.
+ " Don't do it when the position is invalid or when inside an event handler
+ " (happens when dropping a file on gvim).
+ " Also don't do it when the mark is in the first line, that is the default
+ " position when opening a file.
+ autocmd BufReadPost *
+ \ if line("'\"") > 1 && line("'\"") <= line("$") |
+ \ exe "normal! g`\"" |
+ \ endif
+
+ " Leave the return key alone when in command line windows, since it's used
+ " to run commands there.
+ autocmd! CmdwinEnter * :unmap <cr>
+ autocmd! CmdwinLeave * :call MapCR()
+augroup END
+
+" Move around splits with <c-hjkl>
+nnoremap <c-j> <c-w>j
+nnoremap <c-k> <c-w>k
+nnoremap <c-h> <c-w>h
+nnoremap <c-l> <c-w>l
+
+" Can't be bothered to understand ESC vs <c-c> in insert mode
+imap <c-c> <esc>
+
+" Clear the search buffer when hitting return
+function! MapCR()
+ nnoremap <cr> :nohlsearch<cr>
+endfunction
+call MapCR()
" Convenient command to see the difference between the current buffer and the
" file it was loaded from, thus the changes you made.
" Only define it when not defined already.
if !exists(":DiffOrig")
command DiffOrig vert new | set bt=nofile | r # | 0d_ | diffthis
- \ | wincmd p | diffthis
+ \ | wincmd p | diffthis
endif
if &t_Co == 256
+ "colorscheme railscast
colorscheme myxoria256
endif
+
+"function! SuperCleverTab()
+" if strpart(getline('.'), 0, col('.') - 1) =~ '^\s*$'
+" return "\<Tab>"
+" else
+" if &omnifunc != ''
+" return "\<C-X>\<C-O>"
+" elseif &dictionary != ''
+" return "\<C-K>"
+" else
+" return "\<C-N>"
+" endif
+" endif
+"endfunction
+"inoremap <Tab> <C-R>=SuperCleverTab()<cr>
+
+function! InsertTabWrapper()
+ let col = col('.') - 1
+ if !col || getline('.')[col - 1] !~ '\k'
+ return "\<tab>"
+ else
+ return "\<c-p>"
+ endif
+endfunction
+inoremap <tab> <c-r>=InsertTabWrapper()<cr>
+inoremap <s-tab> <c-n>
+
+" Disable arrow keys
+map <Left> <Nop>
+map <Right> <Nop>
+map <Up> <Nop>
+map <Down> <Nop>
+map <ESC>Od <Nop>
+map <ESC>Oc <Nop>
+map <ESC>Oa <Nop>
+map <ESC>Ob <Nop>
+
+cnoremap %% <C-R>=expand('%:h').'/'<cr>
+map <leader>e :edit %%
+map <leader>v :view %%
+
+let Tlist_Exit_OnlyWindow=1
+let Tlist_Enable_Fold_Column=0
+let Tlist_Use_Right_Window=0
+let Tlist_Display_Prototype=0
+let Tlist_GainFocus_On_ToggleOpen=1
+let Tlist_WinWidth=30
+nnoremap <silent><F8> :TlistToggle<CR>
+
+highlight OverLength ctermbg=red ctermfg=white guibg=#592929
+match OverLength /\%79v.\+/
+
+function! RenameFile()
+    let old_name = expand('%')
+    let new_name = input('New file name: ', expand('%'), 'file')
+    if new_name != '' && new_name != old_name
+        exec ':saveas ' . new_name
+        exec ':silent !rm ' . old_name
+        redraw!
+    endif
+endfunction
+map <leader>n :call RenameFile()<cr>
Oops, something went wrong.

0 comments on commit 8d86c77

Please sign in to comment.