aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xbash/.bashrc71
-rw-r--r--vim/.vimrc69
2 files changed, 75 insertions, 65 deletions
diff --git a/bash/.bashrc b/bash/.bashrc
index e8a61fc..247955a 100755
--- a/bash/.bashrc
+++ b/bash/.bashrc
@@ -5,14 +5,18 @@
5# If not running interactively, don't do anything 5# If not running interactively, don't do anything
6[[ $- != *i* ]] && return 6[[ $- != *i* ]] && return
7 7
8# Default PS1
8export PS1='[\d][\t]\u on \h\n\w $ ' 9export PS1='[\d][\t]\u on \h\n\w $ '
9 10
11# Additional local paths
10export PATH="$PATH:$HOME/.local/bin" 12export PATH="$PATH:$HOME/.local/bin"
11export PATH="$PATH:$HOME/.local/usr/bin" 13export PATH="$PATH:$HOME/.local/usr/bin"
12export PATH="$PATH:$HOME/.local/usr/local/bin" 14export PATH="$PATH:$HOME/.local/usr/local/bin"
13 15
16# Quit the shell like in vim
14alias :q="exit" 17alias :q="exit"
15 18
19# Keep OS compatibility
16case "$(uname)" in 20case "$(uname)" in
17 Linux) 21 Linux)
18 alias ls="ls --color=auto" 22 alias ls="ls --color=auto"
@@ -28,6 +32,7 @@ case "$(uname)" in
28 ;; 32 ;;
29esac 33esac
30 34
35# Colorfull manpages
31man() { 36man() {
32 env LESS_TERMCAP_mb=$'\E[01;31m' \ 37 env LESS_TERMCAP_mb=$'\E[01;31m' \
33 LESS_TERMCAP_md=$'\E[01;38;5;74m' \ 38 LESS_TERMCAP_md=$'\E[01;38;5;74m' \
@@ -39,6 +44,7 @@ man() {
39 man "$@" 44 man "$@"
40} 45}
41 46
47# Helpfull functions
42exists() { 48exists() {
43 hash $@ 2> /dev/null 49 hash $@ 2> /dev/null
44} 50}
@@ -61,57 +67,39 @@ is_alias() {
61 fi 67 fi
62} 68}
63 69
64if exists sudo; then 70# Set autocomplete for sudo
65 sudo() {
66 # Allow functions and aliasses to be executed with sudo
67 if is_function $1 2> /dev/null; then
68 tmpfile="/tmp/$(date +%s).sh"
69
70 echo "#!$usr/bin/bash" > "$tmpfile"
71 echo "usr=$usr" >> "$tmpfile"
72 type $1 | grep -v "is a function" >> "$tmpfile"
73 echo "$@" >> "$tmpfile"
74
75 chmod +x "$tmpfile"
76
77 $usr/bin/sudo "$tmpfile"
78
79 rm "$tmpfile"
80 elif is_alias $1 2> /dev/null; then
81 alias=$(type $1 2> /dev/null |
82 sed -n "s/^$1\ is\ aliased\ to\ \`\(.*\)'$/\1/p")
83
84 $usr/bin/sudo "$alias"
85 else
86 $usr/bin/sudo "$@"
87 fi
88 }
89fi
90
91if exists complete && exists sudo; then 71if exists complete && exists sudo; then
92 complete -cf sudo 72 complete -cf sudo
93fi 73fi
94 74
75# Jupiterbroadcasting live stream
95if exists mpv; then 76if exists mpv; then
96 alias jblive='mpv rtmp://videocdn-us.geocdn.scaleengine.net/jblive/live/jblive.stream' 77 alias jblive='mpv rtmp://videocdn-us.geocdn.scaleengine.net/jblive/live/jblive.stream'
97elif exists vlc; then 78elif exists vlc; then
98 alias jblive='vlc rtmp://videocdn-us.geocdn.scaleengine.net/jblive/live/jblive.stream' 79 alias jblive='vlc rtmp://videocdn-us.geocdn.scaleengine.net/jblive/live/jblive.stream'
99fi 80fi
100 81
101if exists vim; then 82# Set the default editor
83if exists nvim; then
84 export EDITOR="nvim"
85elif exists vim; then
102 export EDITOR="vim" 86 export EDITOR="vim"
103 vim() { 87elif exists vi; then
104 if [[ -z $@ ]]; then 88 export EDITOR="vi"
105 $usr/bin/vim
106 elif [[ -d $@ ]]; then
107 dir=$(pwd)
108 cd $@ && $usr/bin/vim && cd $dir
109 else
110 $usr/bin/vim $@
111 fi
112 }
113fi 89fi
114 90
91vim() {
92 if [[ -z $@ ]]; then
93 $EDITOR
94 elif [[ -d $@ ]]; then
95 dir=$(pwd)
96 cd $@ && $EDITOR && cd $dir
97 else
98 $EDITOR $@
99 fi
100}
101
102# Programming language specifics
115if exists go; then 103if exists go; then
116 export GOPATH="$HOME/programming/go" 104 export GOPATH="$HOME/programming/go"
117 export PATH="$PATH:$GOPATH/bin" 105 export PATH="$PATH:$GOPATH/bin"
@@ -122,12 +110,14 @@ if exists gem; then
122 export PATH="$PATH:$GEM_HOME" 110 export PATH="$PATH:$GEM_HOME"
123fi 111fi
124 112
113# Ezjail shortcuts
125if exists ezjail-admin && exists sudo; then 114if exists ezjail-admin && exists sudo; then
126 jl() { 115 jl() {
127 sudo ezjail-admin $1 $2\.tomvanderlee.com 116 sudo ezjail-admin $1 $2\.tomvanderlee.com
128 } 117 }
129fi 118fi
130 119
120# Showbanned ipadresses
131if exists pfctl && exists sudo; then 121if exists pfctl && exists sudo; then
132 showbanned () 122 showbanned ()
133 { 123 {
@@ -145,14 +135,17 @@ if exists pfctl && exists sudo; then
145 } 135 }
146fi 136fi
147 137
138# Always use pacaur even if it is not installed
148if (exists pacman && ! exists pacaur) && exists sudo; then 139if (exists pacman && ! exists pacaur) && exists sudo; then
149 alias pacaur="sudo pacman" 140 alias pacaur="sudo pacman"
150fi 141fi
151 142
143# Set the default pager
152if exists less; then 144if exists less; then
153 export PAGER="less" 145 export PAGER="less"
154fi 146fi
155 147
148# Pip upgrade script
156if exists pip; then 149if exists pip; then
157 pip() { 150 pip() {
158 if [[ "$1" == "upgrade" ]] || [[ "$1" == "update" ]]; then 151 if [[ "$1" == "upgrade" ]] || [[ "$1" == "update" ]]; then
@@ -170,10 +163,12 @@ if exists pip; then
170 } 163 }
171fi 164fi
172 165
166# Fancy bash prompt
173if exists liquidprompt; then 167if exists liquidprompt; then
174 source liquidprompt 168 source liquidprompt
175fi 169fi
176 170
171# Fancy system info
177if exists archey3; then 172if exists archey3; then
178 archey3 173 archey3
179elif exists screenfetch; then 174elif exists screenfetch; then
diff --git a/vim/.vimrc b/vim/.vimrc
index 20d49fb..cde36c1 100644
--- a/vim/.vimrc
+++ b/vim/.vimrc
@@ -1,11 +1,11 @@
1execute pathogen#infect() 1silent! execute pathogen#infect()
2 2
3""" DEFAULT VIM SETTINGS 3""" DEFAULT VIM SETTINGS
4 4
5" Reload vimrc on save 5" Reload vimrc on save
6augroup reload_vimrc " { 6augroup reload_vimrc " {
7 autocmd! 7 autocmd!
8 autocmd BufWritePost $MYVIMRC source $MYVIMRC 8 autocmd BufWritePost $MYVIMRC source $MYVIMRC
9augroup END " } 9augroup END " }
10 10
11let mapleader=" " 11let mapleader=" "
@@ -14,9 +14,15 @@ syntax on
14filetype plugin indent on 14filetype plugin indent on
15 15
16" Set colorscheme when the terminal has 256 color support 16" Set colorscheme when the terminal has 256 color support
17if &t_Co == 256 17try
18 colorscheme Benokai 18 if (&t_Co == 256) && match($TERM, "256color") >= 0
19endif 19 colorscheme Benokai
20 else
21 throw "nocolor"
22 endif
23catch
24 colorscheme desert
25endtry
20 26
21" Some vim settings 27" Some vim settings
22set number 28set number
@@ -30,7 +36,6 @@ set listchars=trail:·,tab:▸\ ,eol:¬
30set scrolloff=1 36set scrolloff=1
31set backspace=indent,eol,start 37set backspace=indent,eol,start
32set cursorline 38set cursorline
33set cursorcolumn
34 39
35" Disable ex mode 40" Disable ex mode
36nnoremap Q <Nop> 41nnoremap Q <Nop>
@@ -56,30 +61,40 @@ noremap! <Right> <Esc>
56 61
57" Append modeline when pressing <leader> ml 62" Append modeline when pressing <leader> ml
58function! AppendModeline() 63function! AppendModeline()
59 let l:modeline = printf(" vim: set ts=%d sw=%d tw=%d %set :", 64 let l:modeline = printf(" vim: set ts=%d sw=%d tw=%d %set :",
60 \ &tabstop, &shiftwidth, &textwidth, &expandtab ? '' : 'no') 65 \ &tabstop, &shiftwidth, &textwidth, &expandtab ? '' : 'no')
61 let l:modeline = substitute(&commentstring, "%s", l:modeline, "") 66 let l:modeline = substitute(&commentstring, "%s", l:modeline, "")
62 call append(line("$"), l:modeline) 67 call append(line("$"), l:modeline)
63endfunction 68endfunction
64nnoremap <silent> <Leader>ml :call AppendModeline()<CR> 69nnoremap <silent> <Leader>ml :call AppendModeline()<CR>
65 70
71" NeoVIM specifics
72if has('nvim')
73 nmap <BS> <C-W>h
74 tnoremap <Esc> <C-\><C-n>
75endif
76
66""" PLUGIN SPECIFIC SETTINGS 77""" PLUGIN SPECIFIC SETTINGS
67 78
68" NERDTree: 79if exists("g:loaded_pathogen")
69" Open NERDTree when no file is specified 80
70autocmd StdinReadPre * let s:std_in=1 81 " NERDTree: