From 19c7641731be82c4e21f08282ec75a66f06cd0a3 Mon Sep 17 00:00:00 2001 From: mats cronqvist Date: Fri, 11 Sep 2015 16:36:05 +0200 Subject: [PATCH] synch dotfiles --- .bashrc | 37 +++++++++++++++++++------------------ .emacs | 42 +++++++++++++++++++++++------------------- .fgrep.sh | 14 ++++++++------ user_default.erl | 8 ++++---- 4 files changed, 54 insertions(+), 47 deletions(-) diff --git a/.bashrc b/.bashrc index dff581c..24ca5f2 100644 --- a/.bashrc +++ b/.bashrc @@ -5,8 +5,6 @@ # one path to rule them all export PATH=/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin [ -d /opt/bin ] && export PATH=$PATH:/opt/bin -CU=$(brew --prefix coreutils) -[ -n "$CU" ] && export PATH=$CU/libexec/gnubin:$PATH # one locale to rule them all unset LC_ALL @@ -25,11 +23,14 @@ set +f shopt -s checkwinsize # check for GNU ls -LS=ls ; [ `which gls 2> /dev/null` ] && LS=gls -DIRCOLS=dircolors ; [ `which gdircolors 2> /dev/null` ] && DIRCOLS=gdircolors +CU=$(brew --prefix coreutils) +[ -n "$CU" ] && export PATH=$CU/libexec/gnubin:$PATH +GREP=grep ; [ $(which ggrep) ] && GREP=ggrep +LS=ls ; [ $(which gls) ] && LS=gls +DIRCOLORS=dircolors ; [ $(which gdircolors) ] && DIRCOLORS=gdircolors +bash_completion=$(brew --prefix)/etc/bash_completion # Enable sane completion -bash_completion=$(brew --prefix)/etc/bash_completion [ -f $bash_completion ] && . $bash_completion # define some git helpers @@ -96,19 +97,19 @@ else fi # macos doesn't have pgrep/pkill -grep() { $(brew --prefix grep)/bin/ggrep --color=auto "$@"; } -fgrep() { ~/.fgrep.sh "$@"; } -tmx() { ~/.tmux.sh; } -pgrep() { ps -ef > $$ ; egrep -i "$1" $$ ; rm $$ ; } -pkill() { pgrep "$1" | awk '{print $2}' | xargs sudo kill -9 ; } -dir() { $LS --color=$lscols -lFh "$@";} -dirt() { dir -rt "$@";} -dird() { dir -d "$@";} -dira() { for d in "${@:-.}"; do (cd "$d";pwd; dird .*); done;} -rea() { history | egrep "${@:-}";} -m() { less "$@";} -e() { emacs -nw "$@";} -c() { cat "$@";} +function grep() { $GREP --color=auto "$@"; } +function fgrep() { ~/.fgrep.sh "$@"; } +function tmx() { ~/.tmux.sh; } +function pgrep() { ps -ef > $$ ; egrep -i "$1" $$ ; rm $$ ; } +function pkill() { pgrep "$1" | awk '{print $2}' | xargs sudo kill -9 ; } +function dir() { $LS --color=$lscols -lFh "$@";} +function dirt() { dir -rt "$@";} +function dird() { dir -d "$@";} +function dira() { for d in "${@:-.}"; do (cd "$d";pwd; dird .*); done;} +function rea() { history | egrep "${@:-}";} +function m() { less "$@";} +function e() { emacs -nw "$@";} +function c() { cat "$@";} ## history # lots of history diff --git a/.emacs b/.emacs index 095439b..0ff1f24 100644 --- a/.emacs +++ b/.emacs @@ -1,5 +1,10 @@ ;; -*- mode: lisp -*- +(defvar my-packages + '(magit highlight-parentheses rw-hunspell markdown-mode + purescript-mode sml-modeline js2-mode flymake-jshint json-mode) + "my packages, to be installed by package") + ;; try to find and add my favourite paths (let ((ps (list "~/elisp/*.el" "~/git/distel/elisp/*.el" @@ -7,11 +12,11 @@ "echo -n `/usr/local/bin/brew --prefix erlang`") "/lib/erlang/lib/tools-*/emacs/*.el")))) (dolist (f0 (nreverse ps)) - (let ((f (car (file-expand-wildcards f0)))) + (let ((f (car (ignore-errors (file-expand-wildcards f0))))) (when (and (stringp f) (file-exists-p f)) (add-to-list 'load-path (file-name-directory f)))))) -; turn on good shit +;; turn on good shit (set-language-environment "ASCII") (show-paren-mode t) (transient-mark-mode t) @@ -33,16 +38,6 @@ (if (member 'tango-dark (custom-available-themes)) (load-theme 'tango-dark))) -; init package handler -(if (locate-library "package") - (progn - (require 'package) - (package-initialize) - (setq package-archives - '(("gnu" . "http://elpa.gnu.org/packages/") - ("marmalade" . "https://marmalade-repo.org/packages/") - ("melpa" . "http://melpa.milkbox.net/packages/"))))) - (setq-default indent-tabs-mode nil) @@ -369,16 +364,25 @@ (erc :server "irc.freenode.net" :nick "massemanet") (erc :server "irc.hq.kred" :nick "masse")) +;; init package handler +(if (locate-library "package") + (progn + (require 'package) + (package-initialize) + (setq package-archives + '(("gnu" . "http://elpa.gnu.org/packages/") + ("marmalade" . "https://marmalade-repo.org/packages/") + ("melpa" . "http://melpa.milkbox.net/packages/"))))) + +;;my pyckages (defun my-elpa () (interactive) (package-refresh-contents) - (dolist (p '(magit highlight-parentheses rw-hunspell markdown-mode - sml-modeline js2-mode flymake-jshint json-mode)) - (progn - (if (package-installed-p p) - (message "already installed %s" p) - (package-install p))))) - + (dolist (p my-packages) + (if (not (package-installed-p p)) + (package-install p))) + (dolist (p (package-menu--find-upgrades)) + (package-install p))) ;; automatically added stuff diff --git a/.fgrep.sh b/.fgrep.sh index 2b5b083..e6dd297 100755 --- a/.fgrep.sh +++ b/.fgrep.sh @@ -5,11 +5,13 @@ set -f [ -z "$1" ] && set +f && exit 1 [ -n "$2" ] && d="$2" || d="." [ -n "$3" ] && n="-name $3" -find "$d" -path "*/.svn" -prune -o \ - -path "*/.git" -prune -o \ +find "$d" \ + -path "*/.svn" -prune -o \ + -path "*/.git" -prune -o \ -path "*/.eunit" -prune -o \ - -path "*/.deps" -prune -o \ - -path "*/deps" -prune -o \ - -path "*~" -prune -o \ - -type f $n -exec grep -inIH "$1" {} \; + -path "*/.deps" -prune -o \ + -path "*/#*" -prune -o \ + -path "*~" -prune -o \ + -type f $n \ + -exec grep -inIH "$1" {} \; set +f diff --git a/user_default.erl b/user_default.erl index b3bc7bc..5302ba5 100644 --- a/user_default.erl +++ b/user_default.erl @@ -122,16 +122,16 @@ ineti() -> ineti(P) -> {_Fam,Type} = proplists:get_value(type,P), - [Status|_] = proplists:get_value(status,P), + [Status|_] = proplists:get_value(status,P), {LIP,LPort} = proplists:get_value(local,P), - Sent = proplists:get_value(sent,P), - Recvd = proplists:get_value(received,P), + Sent = proplists:get_value(sent,P), + Recvd = proplists:get_value(received,P), {RIP,RPort} = case proplists:get_value(remote,P) of enotconn -> {"*","*"}; {Rip,Rp} -> {inet_parse:ntoa(Rip),integer_to_list(Rp)} end, - io:fwrite("~14s:~-5w ~14s:~-5s ~w ~w ~w ~w~n", + io:fwrite("~15s:~-5w ~15s:~-5s ~7w ~9w ~w/~w~n", [inet_parse:ntoa(LIP),LPort,RIP,RPort,Type,Status,Sent,Recvd]). ports() ->