Browse Source

update shells

Cullum Smith 2 years ago
parent
commit
82dc730ce1
9 changed files with 139 additions and 21 deletions
  1. 21
    6
      bash/.bashrc
  2. 80
    0
      ksh/.kshrc
  3. 1
    0
      ksh/.profile
  4. 2
    0
      tmux/.tmux.conf
  5. 14
    0
      vi/.exrc
  6. 1
    0
      vim/.vimrc
  7. 0
    7
      xdg/.config/user-dirs.dirs
  8. 6
    3
      zsh/.zshenv
  9. 14
    5
      zsh/.zshrc

+ 21
- 6
bash/.bashrc View File

@@ -1,14 +1,19 @@
1 1
 [ -f "$HOME/.bashrc.local" ] && source "$HOME/.bashrc.local"
2 2
 
3
+case "$(command -v vim)" in
4
+  */vim) VIM=vim ;;
5
+  *)     VIM=vi  ;;
6
+esac
7
+
3 8
 export PATH=$HOME/bin:/opt/local/bin:/opt/local/sbin:$PATH
4 9
 export MANPATH=/opt/local/share/man:$MANPATH
5
-export EDITOR=vim
10
+export EDITOR=$VIM
6 11
 export PAGER=less
7 12
 export LESS='-iMRS -x2'
8 13
 export LANG=en_US.UTF-8
9 14
 export CLICOLOR=1
10
-export HISTFILESIZE=20000
11
-export HISTSIZE=10000
15
+HISTFILESIZE=20000
16
+HISTSIZE=10000
12 17
 
13 18
 complete -c man which
14 19
 complete -cf sudo
@@ -17,13 +22,15 @@ shopt -s histappend
17 22
 shopt -s cmdhist
18 23
 shopt -s checkwinsize
19 24
 
20
-alias ls='ls -FhH'
25
+case "$(uname)" in
26
+  Linux)   alias ls='ls -FhH --color=auto' ;;
27
+  OpenBSD) command -v colorls > /dev/null && alias ls='colorls -FhH' ;;
28
+esac
21 29
 alias ll='ls -l'
22 30
 alias la='ls -lA'
23 31
 alias ..='cd ..'
24 32
 alias ...='cd ...'
25 33
 alias grep='grep --color=auto'
26
-alias svim='sudo -E vim'
27 34
 alias mkdir='mkdir -p'
28 35
 alias df='df -h'
29 36
 alias du='du -ch'
@@ -31,8 +38,10 @@ alias weather='curl http://wttr.in/New_York'
31 38
 command -v neomutt > /dev/null && alias mutt='neomutt'
32 39
 if [ "$(uname)" = 'OpenBSD' ] ; then
33 40
   alias svim='doas vim'
41
+  alias svi='doas vi'
34 42
 else
35 43
   alias svim='sudo -E vim'
44
+  alias svi='sudo -E vi'
36 45
 fi
37 46
 
38 47
 # colored man pages
@@ -46,7 +55,13 @@ man() {
46 55
     command man "$@"
47 56
 }
48 57
 
49
-PS1="\A \[\e[32m\]\u@\h\[\e[m\]:\[\e[34m\]\w\\[\e[32m\]\$ \[\e[m\]"
58
+_PS1_CLEAR=$'\e[0m'
59
+_PS1_BLUE=$'\e[34m'
60
+case "$(id -u)" in
61
+  0) _PS1_COLOR=$'\e[1;31m' ;;
62
+  *) _PS1_COLOR=$'\e[32m' ;;
63
+esac
64
+PS1='\A ${_PS1_COLOR}\u@\h$_PS1_CLEAR:$_PS1_BLUE\w$_PS1_COLOR\$$_PS1_CLEAR '
50 65
 
51 66
 if command -v dircolors > /dev/null && [ -f $HOME/.dircolors ] ; then
52 67
   eval "$(dircolors "$HOME/.dircolors")"

+ 80
- 0
ksh/.kshrc View File

@@ -0,0 +1,80 @@
1
+[ -f "$HOME/.kshrc.local" ] && source "$HOME/.kshrc.local"
2
+
3
+case "$(command -v vim)" in
4
+  */vim) VIM=vim ;;
5
+  *)     VIM=vi  ;;
6
+esac
7
+
8
+export PATH=$HOME/bin:/opt/local/bin:/opt/local/sbin:$PATH
9
+export MANPATH=/opt/local/share/man:$MANPATH
10
+export EDITOR=$VIM
11
+export FCEDIT=$VIM
12
+export PAGER=less
13
+export LESS='-iMRS -x2'
14
+export LANG=en_US.UTF-8
15
+export CLICOLOR=1
16
+
17
+HISTFILE=$HOME/.ksh_history
18
+HISTSIZE=20000
19
+
20
+set -o emacs
21
+
22
+case "$(uname)" in
23
+  Linux)   alias ls='ls -FhH --color=auto' ;;
24
+  OpenBSD) command -v colorls > /dev/null && alias ls='colorls -FhH' ;;
25
+esac
26
+alias ll='ls -l'
27
+alias la='ls -lA'
28
+alias ..='cd ..'
29
+alias ...='cd ...'
30
+alias grep='grep --color=auto'
31
+alias mkdir='mkdir -p'
32
+alias df='df -h'
33
+alias du='du -ch'
34
+alias weather='curl http://wttr.in/New_York'
35
+command -v neomutt > /dev/null && alias mutt='neomutt'
36
+if [ "$(uname)" = 'OpenBSD' ] ; then
37
+  alias svim='doas vim'
38
+  alias svi='doas vi'
39
+else
40
+  alias svim='sudo -E vim'
41
+  alias svi='sudo -E vi'
42
+fi
43
+
44
+# colored man pages
45
+man() {
46
+    LESS_TERMCAP_md=$'\e[01;31m' \
47
+    LESS_TERMCAP_me=$'\e[0m' \
48
+    LESS_TERMCAP_se=$'\e[0m' \
49
+    LESS_TERMCAP_so=$'\e[01;47;30m' \
50
+    LESS_TERMCAP_ue=$'\e[0m' \
51
+    LESS_TERMCAP_us=$'\e[01;32m' \
52
+    command man "$@"
53
+}
54
+
55
+if command -v dircolors > /dev/null && [ -f $HOME/.dircolors ] ; then
56
+  eval "$(dircolors "$HOME/.dircolors")"
57
+fi
58
+
59
+# colored prompt
60
+case "$KSH_VERSION" in
61
+  *PD*) # pdksh (OpenBSD)
62
+    _PS1_CLEAR='\033[0m'
63
+    _PS1_BLUE='\033[34m'
64
+    case "$(id -u)" in
65
+      0) _PS1_COLOR='\033[1;31m' ;;
66
+      *) _PS1_COLOR='\033[32m' ;;
67
+    esac
68
+    PS1='\A $_PS1_COLOR\u@\h$_PS1_CLEAR:$_PS1_BLUE\w$_PS1_COLOR\$$_PS1_CLEAR '
69
+    ;;
70
+  *)    # OS X (ksh93)
71
+    _PS1_HOST=$(hostname -s)
72
+    _PS1_CLEAR=$'\E[0m'
73
+    _PS1_BLUE=$'\E[34m'
74
+    case "$(id -u)" in
75
+      0) _PS1_COLOR=$'\E[1;31m' ; _PS1_CHAR='#' ;;
76
+      *) _PS1_COLOR=$'\E[32m' ; _PS1_CHAR='$' ;;
77
+    esac
78
+    PS1='$(date "+%H:%M") $_PS1_COLOR$USER@$_PS1_HOST$_PS1_CLEAR:$_PS1_BLUE${PWD/#$HOME/\~}$_PS1_COLOR$_PS1_CHAR$_PS1_CLEAR '
79
+    ;;
80
+esac

+ 1
- 0
ksh/.profile View File

@@ -0,0 +1 @@
1
+export ENV=$HOME/.kshrc

+ 2
- 0
tmux/.tmux.conf View File

@@ -5,6 +5,8 @@ bind h select-pane -L
5 5
 bind j select-pane -D
6 6
 bind k select-pane -U
7 7
 bind l select-pane -R
8
+bind-key -T copy-mode-vi 'v' send -X begin-selection
9
+bind-key -T copy-mode-vi 'y' send -X copy-selection
8 10
 
9 11
 # zenburn
10 12
 setw -g clock-mode-colour colour117

+ 14
- 0
vi/.exrc View File

@@ -0,0 +1,14 @@
1
+set showmode
2
+set showmatch
3
+set ruler
4
+set shiftwidth=2
5
+set tabstop=2
6
+set verbose
7
+set leftright
8
+set extended
9
+set iclower
10
+set searchincr
11
+set tildeop
12
+set report=1
13
+set cedit=\
14
+set filec=\

+ 1
- 0
vim/.vimrc View File

@@ -31,6 +31,7 @@ set hidden            " hide buffers instead of closing them
31 31
 set wildmenu          " autocomplete for command menu
32 32
 set completeopt=menu,menuone,longest,preview
33 33
 set timeoutlen=1000 ttimeoutlen=0
34
+set mouse=
34 35
 
35 36
 set smartindent       " autoindent
36 37
 set expandtab         " replace hard tabs with spaces

+ 0
- 7
xdg/.config/user-dirs.dirs View File

@@ -1,10 +1,3 @@
1
-# This file is written by xdg-user-dirs-update
2
-# If you want to change or add directories, just edit the line you're
3
-# interested in. All local changes will be retained on the next run
4
-# Format is XDG_xxx_DIR="$HOME/yyy", where yyy is a shell-escaped
5
-# homedir-relative path, or XDG_xxx_DIR="/yyy", where /yyy is an
6
-# absolute path. No other format is supported.
7
-#
8 1
 XDG_DESKTOP_DIR="$HOME/.desktop"
9 2
 XDG_DOWNLOAD_DIR="$HOME/download"
10 3
 XDG_PICTURES_DIR="$HOME/img"

+ 6
- 3
zsh/.zshenv View File

@@ -1,12 +1,15 @@
1 1
 [ -f "$HOME/.zshenv.local" ] && source "$HOME/.zshenv.local"
2 2
 
3
+case "$(command -v vim)" in
4
+  */vim) VIM=vim ;;
5
+  *)     VIM=vi  ;;
6
+esac
7
+
3 8
 export PATH=$HOME/bin:/opt/local/bin:/opt/local/sbin:$PATH
4 9
 export MANPATH=/opt/local/share/man:$MANPATH
5 10
 export FPATH=/opt/local/share/zsh/site-functions:$FPATH
6
-export EDITOR=vim
11
+export EDITOR=$VIM
7 12
 export PAGER=less
8 13
 export LESS='-iMRS -x2'
9 14
 export LANG=en_US.UTF-8
10
-export HISTFILESIZE=20000
11
-export HISTSIZE=10000
12 15
 export CLICOLOR=1

+ 14
- 5
zsh/.zshrc View File

@@ -8,8 +8,7 @@ compinit
8 8
 setopt completealiases
9 9
 
10 10
 HISTFILE=$HOME/.zsh_history
11
-HISTSIZE=10000
12
-SAVEHIST=20000
11
+HISTSIZE=20000
13 12
 setopt appendhistory
14 13
 setopt hist_ignore_dups
15 14
 setopt hist_ignore_space
@@ -19,18 +18,22 @@ zle -N up-line-or-beginning-search
19 18
 zle -N down-line-or-beginning-search
20 19
 bindkey "\e[A" up-line-or-beginning-search
21 20
 bindkey "\e[B" down-line-or-beginning-search
21
+bindkey "${terminfo[khome]}" beginning-of-line
22
+bindkey "${terminfo[kend]}" end-of-line
22 23
 
23 24
 setopt rm_star_silent
24 25
 setopt nomatch
25 26
 unsetopt beep notify
26 27
 
27
-alias ls='ls -FhH'
28
+case "$(uname)" in
29
+  Linux)   alias ls='ls -FhH --color=auto' ;;
30
+  OpenBSD) command -v colorls > /dev/null && alias ls='colorls -FhH' ;;
31
+esac
28 32
 alias ll='ls -l'
29 33
 alias la='ls -lA'
30 34
 alias ..='cd ..'
31 35
 alias ...='cd ...'
32 36
 alias grep='grep --color=auto'
33
-alias svim='sudo -E vim'
34 37
 alias mkdir='mkdir -p'
35 38
 alias df='df -h'
36 39
 alias du='du -ch'
@@ -38,8 +41,10 @@ alias weather='curl http://wttr.in/New_York'
38 41
 command -v neomutt > /dev/null && alias mutt='neomutt'
39 42
 if [ "$(uname)" = 'OpenBSD' ] ; then
40 43
   alias svim='doas vim'
44
+  alias svi='doas vi'
41 45
 else
42 46
   alias svim='sudo -E vim'
47
+  alias svi='sudo -E vi'
43 48
 fi
44 49
 
45 50
 # colored man pages
@@ -53,8 +58,12 @@ man() {
53 58
   command man "$@"
54 59
 }
55 60
 
61
+case "$(id -u)" in
62
+  0) _PS1_COLOR=9 ;;
63
+  *) _PS1_COLOR=green ;;
64
+esac
56 65
 RPS1='%F{blue}%~%f'
57
-PS1='%T %F{green}%n@%m%#%f '
66
+PS1="%T %F{$_PS1_COLOR}%n@%m%#%f "
58 67
 
59 68
 if command -v dircolors > /dev/null && [ -f $HOME/.dircolors ] ; then
60 69
   eval "$(dircolors "$HOME/.dircolors")"

Loading…
Cancel
Save