From 4ffad3ac6c5259b975650cf1aeaaecb1fd255be3 Mon Sep 17 00:00:00 2001 From: shmibs Date: Wed, 28 May 2014 08:49:01 -0700 Subject: updated calc ans can now be used to refer to the previous answer value in a calculation --- .bash_aliases | 46 ++++++++++++++++++++++++++++++++++++++++++++ .bash_profile | 29 ++++++++++++++++++++++++++++ .bashrc | 44 +----------------------------------------- .config/herbstluftwm/calc.sh | 27 ++++++++++++++++---------- .profile | 29 ---------------------------- .vimrc | 25 +++++++++++++----------- .xinitrc | 4 ++++ 7 files changed, 111 insertions(+), 93 deletions(-) create mode 100644 .bash_aliases create mode 100644 .bash_profile delete mode 100644 .profile diff --git a/.bash_aliases b/.bash_aliases new file mode 100644 index 0000000..6d1796d --- /dev/null +++ b/.bash_aliases @@ -0,0 +1,46 @@ +#!/bin/bash + +export EDITOR="vim" +export PAGER="less -R" + +alias ls='ls --color=auto' +alias grep='grep --color=auto' +alias diff='colordiff' +alias less='less -R' + +alias vmount='udevil mount' +alias vumount='udevil umount' +alias def='sdcv' + +send() { + if [ "$1" ]; then + scp $@ shmibbles.me:/srv/http/tmp/ + if [ $? -eq 0 ]; then + for name in "$@" + do + name=$(echo "http://shmibbles.me/tmp/$(basename $name)" | sed 's/ /%20/g') + echo $name | tr -d '\n' | xclip -i -selection clipboard + echo $name | tr -d '\n' | xclip -i -selection primary + done + fi + else + echo "specify at least one file to send" + fi +} + +sendi() { + if [ "$1" ]; then + scp $@ shmibbles.me:/srv/http/img/ + if [ $? -eq 0 ]; then + for name in "$@" + do + name=$(echo "http://shmibbles.me/img/$(basename $name)" | sed 's/ /%20/g') + echo $name | tr -d '\n' | xclip -i -selection clipboard + echo $name | tr -d '\n' | xclip -i -selection primary + done + fi + else + echo "specify at least one file to send" + fi +} + diff --git a/.bash_profile b/.bash_profile new file mode 100644 index 0000000..f42c6a0 --- /dev/null +++ b/.bash_profile @@ -0,0 +1,29 @@ +# /home/shmibs/.bash_profile + +#Set our umask +umask 022 + +# Set our default path +PATH="/usr/local/sbin:/usr/local/bin:/usr/bin" +export PATH + +# Load profiles from /etc/profile.d +if test -d /etc/profile.d/; then + for profile in /etc/profile.d/*.sh; do + test -r "$profile" && . "$profile" + done + unset profile +fi + +# Source global bash config +if test "$PS1" && test "$BASH" && test -r /etc/bash.bashrc; then + . /etc/bash.bashrc +fi + +# Termcap is outdated, old, and crusty, kill it. +unset TERMCAP + +# Man is much better than us at figuring this out +unset MANPATH + +source ~/.bash_aliases diff --git a/.bashrc b/.bashrc index 5259146..9eca7d3 100644 --- a/.bashrc +++ b/.bashrc @@ -30,46 +30,4 @@ esac [ -r /usr/share/bash-completion/bash_completion ] && . /usr/share/bash-completion/bash_completion -export EDITOR="vim" -export PAGER="less -R" - -alias ls='ls --color=auto' -alias grep='grep --color=auto' -alias diff='colordiff' -alias less='less -R' - -alias vmount='udevil mount' -alias vumount='udevil umount' -alias def='sdcv' - -send() { - if [ "$1" ]; then - scp $@ shmibbles.me:/srv/http/tmp/ - if [ $? -eq 0 ]; then - for name in "$@" - do - name=$(echo "http://shmibbles.me/tmp/$(basename $name)" | sed 's/ /%20/g') - echo $name | tr -d '\n' | xclip -i -selection clipboard - echo $name | tr -d '\n' | xclip -i -selection primary - done - fi - else - echo "specify at least one file to send" - fi -} - -sendi() { - if [ "$1" ]; then - scp $@ shmibbles.me:/srv/http/img/ - if [ $? -eq 0 ]; then - for name in "$@" - do - name=$(echo "http://shmibbles.me/img/$(basename $name)" | sed 's/ /%20/g') - echo $name | tr -d '\n' | xclip -i -selection clipboard - echo $name | tr -d '\n' | xclip -i -selection primary - done - fi - else - echo "specify at least one file to send" - fi -} +source ~/.bash_aliases diff --git a/.config/herbstluftwm/calc.sh b/.config/herbstluftwm/calc.sh index 0f7ddfb..358f43d 100755 --- a/.config/herbstluftwm/calc.sh +++ b/.config/herbstluftwm/calc.sh @@ -8,19 +8,26 @@ e="2.7182818284590452353602874713526624977572471" while [ "$in" != "" ]; do in=$(echo "" | dmenu -q -h 18 -nb $1 -nf $2 -sb $3 -sf $4 -p "$prompt") - out=$(echo "pi=$pi; e=$e; $acc $in" | calc -p 2>&1 | tr -d "\n") - - if [ "$out" = "Missing operator" ]; then - out=$(echo "pi=$pi; e=$e; $in" | calc -p 2>&1) - fi + # replace "ans" with the previous value + in=$(echo $in | sed -e "s/ans/$acc/g") - # check for error output + out=$(echo "pi=$pi; e=$e; $acc $in" | calc -p 2>&1) + if [ "${?#0}" != "" ]; then out=$(echo "$out" | tr -d "\n") - prompt="calc: ($acc) err: $out" - else - acc=$out - prompt="calc: ($acc)" + if [ "$out" = "Missing operator" ]; then + out=$(echo "pi=$pi; e=$e; $in" | calc -p 2>&1) + if [ "${?#0}" != "" ]; then + out=$(echo "$out" | tr -d "\n") + prompt="calc: ($acc) err: $out" + else + acc=$out + prompt="calc: ($acc)" + fi + else + out=$(echo "$out" | tr -d "\n") + prompt="calc: ($acc) err: $out" + fi fi done diff --git a/.profile b/.profile deleted file mode 100644 index 42b0fb4..0000000 --- a/.profile +++ /dev/null @@ -1,29 +0,0 @@ -# /etc/profile - -#Set our umask -umask 022 - -# Set our default path -PATH="/usr/local/sbin:/usr/local/bin:/usr/bin" -export PATH - -# Load profiles from /etc/profile.d -if test -d /etc/profile.d/; then - for profile in /etc/profile.d/*.sh; do - test -r "$profile" && . "$profile" - done - unset profile -fi - -# Source global bash config -if test "$PS1" && test "$BASH" && test -r /etc/bash.bashrc; then - . /etc/bash.bashrc -fi - -# Termcap is outdated, old, and crusty, kill it. -unset TERMCAP - -# Man is much better than us at figuring this out -unset MANPATH - -export EDITOR="vim" diff --git a/.vimrc b/.vimrc index 2ff0919..a571715 100644 --- a/.vimrc +++ b/.vimrc @@ -7,20 +7,23 @@ set autoindent colorscheme anotherdark set background=dark -"tab controls to match pentadactyl -noremap :tabn -noremap :tabp -noremap :tabnew +"enable status-line +set laststatus=2 + +"allow edited background buffers +set hidden + +"buffer controls to match pentadactyl +noremap :bn +noremap :bp +noremap :badd +noremap :buffers:b "insert lines above and below with (=|+) "very hackish, but i couldn't think of a better way nnoremap = Oaj nnoremap + oak -"disable auto session save/load -let g:session_autosave = 'no' -let g:session_autoload = 'no' - "folds! nnoremap fo zO nnoremap fc zC @@ -28,8 +31,8 @@ nnoremap fm zM nnoremap fr zR "copy words from above and below the cursor -inoremap pumvisible() ? "\" : matchstr(getline(line('.')-1), '\%' . virtcol('.') . 'v\%(\k\+\\|.\)') -inoremap pumvisible() ? "\" : matchstr(getline(line('.')+1), '\%' . virtcol('.') . 'v\%(\k\+\\|.\)') +inoremap pumvisible() ? "\" : matchstr(getline(line('.')-1), '\%' . virtcol('.') . 'v\%(\k\+\\|.\)') +inoremap pumvisible() ? "\" : matchstr(getline(line('.')+1), '\%' . virtcol('.') . 'v\%(\k\+\\|.\)') "use the X clipboard for things when running in a virtual terminal, because yes if &term != "linux" @@ -90,5 +93,5 @@ endfunction function! Settings_vim() setlocal smartindent - noremap -- A" + noremap -- A" endfunction diff --git a/.xinitrc b/.xinitrc index 0119fc7..34f9988 100644 --- a/.xinitrc +++ b/.xinitrc @@ -16,6 +16,10 @@ export QT_IM_MODULE=fcitx export XMODIFIERS="@im=fcitx" fcitx & +#disable power saving +xset -dpms +xset s off + #urxvt daemon urxvtd & -- cgit v1.2.3