From 14fd7d4326579569f27cf3ff415f626c0be3ad8b Mon Sep 17 00:00:00 2001 From: Tom van der Lee Date: Tue, 25 Aug 2015 13:07:31 +0200 Subject: Added nvim as default editor if exists --- bash/.bashrc | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) (limited to 'bash') diff --git a/bash/.bashrc b/bash/.bashrc index e8a61fc..7e460bb 100755 --- a/bash/.bashrc +++ b/bash/.bashrc @@ -98,20 +98,25 @@ elif exists vlc; then alias jblive='vlc rtmp://videocdn-us.geocdn.scaleengine.net/jblive/live/jblive.stream' fi -if exists vim; then +if exists nvim; then + export EDITOR="nvim" +elif exists vim; then export EDITOR="vim" - vim() { - if [[ -z $@ ]]; then - $usr/bin/vim - elif [[ -d $@ ]]; then - dir=$(pwd) - cd $@ && $usr/bin/vim && cd $dir - else - $usr/bin/vim $@ - fi - } +elif exists vi; then + export EDITOR="vi" fi +vim() { + if [[ -z $@ ]]; then + $EDITOR + elif [[ -d $@ ]]; then + dir=$(pwd) + cd $@ && $EDITOR && cd $dir + else + $EDITOR $@ + fi +} + if exists go; then export GOPATH="$HOME/programming/go" export PATH="$PATH:$GOPATH/bin" -- cgit v1.2.3 From 8b225133c9d7da23ce32e222858ed0fa6051d98d Mon Sep 17 00:00:00 2001 From: Tom van der Lee Date: Tue, 25 Aug 2015 13:18:05 +0200 Subject: Added comments to bashrc --- bash/.bashrc | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'bash') diff --git a/bash/.bashrc b/bash/.bashrc index 7e460bb..c71c184 100755 --- a/bash/.bashrc +++ b/bash/.bashrc @@ -5,14 +5,18 @@ # If not running interactively, don't do anything [[ $- != *i* ]] && return +# Default PS1 export PS1='[\d][\t]\u on \h\n\w $ ' +# Additional local paths export PATH="$PATH:$HOME/.local/bin" export PATH="$PATH:$HOME/.local/usr/bin" export PATH="$PATH:$HOME/.local/usr/local/bin" +# Quit the shell like in vim alias :q="exit" +# Keep OS compatibility case "$(uname)" in Linux) alias ls="ls --color=auto" @@ -28,6 +32,7 @@ case "$(uname)" in ;; esac +# Colorfull manpages man() { env LESS_TERMCAP_mb=$'\E[01;31m' \ LESS_TERMCAP_md=$'\E[01;38;5;74m' \ @@ -39,6 +44,7 @@ man() { man "$@" } +# Helpfull functions exists() { hash $@ 2> /dev/null } @@ -61,6 +67,7 @@ is_alias() { fi } +# Execute functions and aliasses with sudo if exists sudo; then sudo() { # Allow functions and aliasses to be executed with sudo @@ -88,16 +95,19 @@ if exists sudo; then } fi +# Set autocomplete for sudo if exists complete && exists sudo; then complete -cf sudo fi +# Jupiterbroadcasting live stream if exists mpv; then alias jblive='mpv rtmp://videocdn-us.geocdn.scaleengine.net/jblive/live/jblive.stream' elif exists vlc; then alias jblive='vlc rtmp://videocdn-us.geocdn.scaleengine.net/jblive/live/jblive.stream' fi +# Set the default editor if exists nvim; then export EDITOR="nvim" elif exists vim; then @@ -117,6 +127,7 @@ vim() { fi } +# Programming language specifics if exists go; then export GOPATH="$HOME/programming/go" export PATH="$PATH:$GOPATH/bin" @@ -127,12 +138,14 @@ if exists gem; then export PATH="$PATH:$GEM_HOME" fi +# Ezjail shortcuts if exists ezjail-admin && exists sudo; then jl() { sudo ezjail-admin $1 $2\.tomvanderlee.com } fi +# Showbanned ipadresses if exists pfctl && exists sudo; then showbanned () { @@ -150,14 +163,17 @@ if exists pfctl && exists sudo; then } fi +# Always use pacaur even if it is not installed if (exists pacman && ! exists pacaur) && exists sudo; then alias pacaur="sudo pacman" fi +# Set the default pager if exists less; then export PAGER="less" fi +# Pip upgrade script if exists pip; then pip() { if [[ "$1" == "upgrade" ]] || [[ "$1" == "update" ]]; then @@ -175,10 +191,12 @@ if exists pip; then } fi +# Fancy bash prompt if exists liquidprompt; then source liquidprompt fi +# Fancy system info if exists archey3; then archey3 elif exists screenfetch; then -- cgit v1.2.3 From ef52a18605b17a67eeed0a5772fb60d6d0106899 Mon Sep 17 00:00:00 2001 From: Tom van der Lee Date: Tue, 25 Aug 2015 13:43:50 +0200 Subject: Removed sudo function --- bash/.bashrc | 28 ---------------------------- 1 file changed, 28 deletions(-) (limited to 'bash') diff --git a/bash/.bashrc b/bash/.bashrc index c71c184..247955a 100755 --- a/bash/.bashrc +++ b/bash/.bashrc @@ -67,34 +67,6 @@ is_alias() { fi } -# Execute functions and aliasses with sudo -if exists sudo; then - sudo() { - # Allow functions and aliasses to be executed with sudo - if is_function $1 2> /dev/null; then - tmpfile="/tmp/$(date +%s).sh" - - echo "#!$usr/bin/bash" > "$tmpfile" - echo "usr=$usr" >> "$tmpfile" - type $1 | grep -v "is a function" >> "$tmpfile" - echo "$@" >> "$tmpfile" - - chmod +x "$tmpfile" - - $usr/bin/sudo "$tmpfile" - - rm "$tmpfile" - elif is_alias $1 2> /dev/null; then - alias=$(type $1 2> /dev/null | - sed -n "s/^$1\ is\ aliased\ to\ \`\(.*\)'$/\1/p") - - $usr/bin/sudo "$alias" - else - $usr/bin/sudo "$@" - fi - } -fi - # Set autocomplete for sudo if exists complete && exists sudo; then complete -cf sudo -- cgit v1.2.3