Advertisement
v1ral_ITS

zshrc tue oct 2

Oct 2nd, 2018
180
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 13.64 KB | None | 0 0
  1. function git_time_since_commit() {
  2.     if git rev-parse --git-dir > /dev/null 2>&1; then
  3.         # Only proceed if there is actually a commit.
  4.         if git log -n 1  > /dev/null 2>&1; then
  5.             # Get the last commit.
  6.             last_commit=`git log --pretty=format:'%at' -1 2> /dev/null`
  7.             now=`date +%s`
  8.             seconds_since_last_commit=$((now-last_commit))
  9.  
  10.             # Totals
  11.             MINUTES=$((seconds_since_last_commit / 60))
  12.             HOURS=$((seconds_since_last_commit/3600))
  13.  
  14.             # Sub-hours and sub-minutes
  15.             DAYS=$((seconds_since_last_commit / 86400))
  16.             SUB_HOURS=$((HOURS % 24))
  17.             SUB_MINUTES=$((MINUTES % 60))
  18.  
  19.             if [[ -n $(git status -s 2> /dev/null) ]]; then
  20.                 if [ "$MINUTES" -gt 30 ]; then
  21.                     COLOR="$ZSH_THEME_GIT_TIME_SINCE_COMMIT_LONG"
  22.                 elif [ "$MINUTES" -gt 10 ]; then
  23.                     COLOR="$ZSH_THEME_GIT_TIME_SHORT_COMMIT_MEDIUM"
  24.                 else
  25.                     COLOR="$ZSH_THEME_GIT_TIME_SINCE_COMMIT_SHORT"
  26.                 fi
  27.             else
  28.                 COLOR="$ZSH_THEME_GIT_TIME_SINCE_COMMIT_NEUTRAL"
  29.             fi
  30.  
  31.             if [ "$HOURS" -gt 24 ]; then
  32.                 echo "($COLOR${DAYS}d${SUB_HOURS}h${SUB_MINUTES}m%{$reset_color%}|"
  33.             elif [ "$MINUTES" -gt 60 ]; then
  34.                 echo "($COLOR${HOURS}h${SUB_MINUTES}m%{$reset_color%}|"
  35.             else
  36.                 echo "($COLOR${MINUTES}m%{$reset_color%}|"
  37.             fi
  38.         else
  39.             COLOR="$ZSH_THEME_GIT_TIME_SINCE_COMMIT_NEUTRAL"
  40.             echo "($COLOR~|"
  41.         fi
  42.     fi
  43. }
  44. function prompt_char() {
  45.   git branch >/dev/null 2>/dev/null && echo "%{$fg[green]%}±%{$reset_color%}" && return
  46.   hg root >/dev/null 2>/dev/null && echo "%{$fg_bold[red]%}☿%{$reset_color%}" && return
  47.   echo "%{$fg[cyan]%}◯ %{$reset_color%}"
  48. }
  49.  
  50. # Colors vary depending on time lapsed.
  51. ZSH_THEME_GIT_TIME_SINCE_COMMIT_SHORT="%{$fg[green]%}"
  52. ZSH_THEME_GIT_TIME_SHORT_COMMIT_MEDIUM="%{$fg[yellow]%}"
  53. ZSH_THEME_GIT_TIME_SINCE_COMMIT_LONG="%{$fg[red]%}"
  54. ZSH_THEME_GIT_TIME_SINCE_COMMIT_NEUTRAL="%{$fg[cyan]%}"
  55.  
  56. # Determine the time since last commit. If branch is clean,
  57. # use a neutral color, otherwise colors will vary according to time.# /etc/zsh/zshrc: system-wide .zshrc file for zsh(1).
  58. #
  59. # This file is sourced only for interactive shells. It
  60. # should contain commands to set up aliases, functions,
  61. # options, key bindings, etc.
  62. #
  63. # Global Order: zshenv, zprofile, zshrc, zlogin
  64.  
  65. READNULLCMD=${PAGER:-/usr/bin/pager}
  66.  
  67. # An array to note missing features to ease diagnosis in case of problems.
  68. typeset -ga debian_missing_features
  69.  
  70. if [[ -z "${DEBIAN_PREVENT_KEYBOARD_CHANGES-}" ]] &&
  71.    [[ "$TERM" != 'emacs' ]]
  72. then
  73.  
  74.     typeset -A key
  75.     key=(
  76.         BackSpace  "${terminfo[kbs]}"
  77.         Home       "${terminfo[khome]}"
  78.         End        "${terminfo[kend]}"
  79.         Insert     "${terminfo[kich1]}"
  80.         Delete     "${terminfo[kdch1]}"
  81.         Up         "${terminfo[kcuu1]}"
  82.         Down       "${terminfo[kcud1]}"
  83.         Left       "${terminfo[kcub1]}"
  84.         Right      "${terminfo[kcuf1]}"
  85.         PageUp     "${terminfo[kpp]}"
  86.         PageDown   "${terminfo[knp]}"
  87.     )
  88.  
  89.     function bind2maps () {
  90.         local i sequence widget
  91.         local -a maps
  92.  
  93.         while [[ "$1" != "--" ]]; do
  94.             maps+=( "$1" )
  95.             shift
  96.         done
  97.         shift
  98.  
  99.         sequence="${key[$1]}"
  100.         widget="$2"
  101.  
  102.         [[ -z "$sequence" ]] && return 1
  103.  
  104.         for i in "${maps[@]}"; do
  105.             bindkey -M "$i" "$sequence" "$widget"
  106.         done
  107.     }
  108.  
  109.     bind2maps emacs             -- BackSpace   backward-delete-char
  110.     bind2maps       viins       -- BackSpace   vi-backward-delete-char
  111.     bind2maps             vicmd -- BackSpace   vi-backward-char
  112.     bind2maps emacs             -- Home        beginning-of-line
  113.     bind2maps       viins vicmd -- Home        vi-beginning-of-line
  114.     bind2maps emacs             -- End         end-of-line
  115.     bind2maps       viins vicmd -- End         vi-end-of-line
  116.     bind2maps emacs viins       -- Insert      overwrite-mode
  117.     bind2maps             vicmd -- Insert      vi-insert
  118.     bind2maps emacs             -- Delete      delete-char
  119.     bind2maps       viins vicmd -- Delete      vi-delete-char
  120.     bind2maps emacs viins vicmd -- Up          up-line-or-history
  121.     bind2maps emacs viins vicmd -- Down        down-line-or-history
  122.     bind2maps emacs             -- Left        backward-char
  123.     bind2maps       viins vicmd -- Left        vi-backward-char
  124.     bind2maps emacs             -- Right       forward-char
  125.     bind2maps       viins vicmd -- Right       vi-forward-char
  126.  
  127.     # Make sure the terminal is in application mode, when zle is
  128.     # active. Only then are the values from $terminfo valid.
  129.     if (( ${+terminfo[smkx]} )) && (( ${+terminfo[rmkx]} )); then
  130.         function zle-line-init () {
  131.             emulate -L zsh
  132.             printf '%s' ${terminfo[smkx]}
  133.         }
  134.         function zle-line-finish () {
  135.             emulate -L zsh
  136.             printf '%s' ${terminfo[rmkx]}
  137.         }
  138.         zle -N zle-line-init
  139.         zle -N zle-line-finish
  140.     else
  141.         for i in {s,r}mkx; do
  142.             (( ${+terminfo[$i]} )) || debian_missing_features+=($i)
  143.         done
  144.         unset i
  145.     fi
  146.  
  147.     unfunction bind2maps
  148.  
  149. fi # [[ -z "$DEBIAN_PREVENT_KEYBOARD_CHANGES" ]] && [[ "$TERM" != 'emacs' ]]
  150.  
  151. zstyle ':completion:*:sudo:*' command-path /usr/local/sbin \
  152.                                            /usr/local/bin  \
  153.                                            /usr/sbin       \
  154.                                            /usr/bin        \
  155.                                            /sbin           \
  156.                                            /bin            \
  157.                                            /usr/X11R6/bin
  158.  
  159. (( ${+aliases[run-help]} )) && unalias run-help
  160. autoload -Uz run-help
  161.  
  162. # If you don't want compinit called here, place the line
  163. # skip_global_compinit=1
  164. # in your $ZDOTDIR/.zshenv or $ZDOTDIR/.zprofile
  165. if [[ -z "$skip_global_compinit" ]]; then
  166.   autoload -U compinit
  167.   compinit
  168. fi
  169. # Set up the prompt
  170.  
  171. autoload -Uz promptinit
  172. promptinit
  173. prompt agnoster
  174.  
  175. setopt histignorealldups sharehistory
  176.  
  177. # Use emacs keybindings even if our EDITOR is set to vi
  178. bindkey -e
  179.  
  180. # Keep 1000 lines of history within the shell and save it to ~/.zsh_history:
  181. HISTSIZE=1000
  182. SAVEHIST=1000
  183. HISTFILE=~/.zsh_history
  184.  
  185. # Use modern completion system
  186. autoload -Uz compinit
  187. compinit
  188.  
  189. zstyle ':completion:*' auto-description 'specify: %d'
  190. zstyle ':completion:*' completer _expand _complete _correct _approximate
  191. zstyle ':completion:*' format 'Completing %d'
  192. zstyle ':completion:*' group-name ''
  193. zstyle ':completion:*' menu select=2
  194. eval "$(dircolors -b)"
  195. zstyle ':completion:*:default' list-colors ${(s.:.)LS_COLORS}
  196. zstyle ':completion:*' list-colors ''
  197. zstyle ':completion:*' list-prompt %SAt %p: Hit TAB for more, or the character to insert%s
  198. zstyle ':completion:*' matcher-list '' 'm:{a-z}={A-Z}' 'm:{a-zA-Z}={A-Za-z}' 'r:|[._-]=* r:|=* l:|=*'
  199. zstyle ':completion:*' menu select=long
  200. zstyle ':completion:*' select-prompt %SScrolling active: current selection at %p%s
  201. zstyle ':completion:*' use-compctl false
  202. zstyle ':completion:*' verbose true
  203.  
  204. zstyle ':completion:*:*:kill:*:processes' list-colors '=(#b) #([0-9]#)*=0=01;31'
  205. zstyle ':completion:*:kill:*' command 'ps -u $USER -o pid,%cpu,tty,cputime,cmd'
  206.         #----------------------------
  207. # EXPORTED ITEMS AND ALIASES #
  208. #----------------------------
  209. # export GOPATH=$HOME/go
  210. # Normal color names
  211. CYAN="$(printf '\033[0;36m')"
  212. BLUE="$(printf '\033[0;34m')"
  213. BROWN="$(printf '\033[0;33m')"
  214. DARKGRAY="$(printf '\033[0;30m')"
  215. GRAY="$(printf '\033[0;37m')"
  216. GREEN="$(printf '\033[1;32m')"
  217. LIGHTBLUE="$(printf '\033[0;94m')"
  218. MAGENTA="$(printf '\033[1;35m')"
  219. PURPLE="$(printf '\033[0;35m')"
  220. RED="$(printf '\033[1;31m')"
  221. YELLOW="$(printf '\033[1;33m')"
  222. WHITE="$(printf '\033[1;37m')"
  223.  
  224. # Markup
  225. BOLD="${WHITE}"
  226.  
  227. # With background
  228. BG_BLUE="$(printf '\033[0;44m')"
  229.  
  230. # Semantic names
  231. HEADER="${WHITE}"
  232. NORMAL="$(printf '\033[0m')"
  233. WARNING="${RED}"
  234. SECTION="${YELLOW}"
  235. NOTICE="${YELLOW}"
  236. OK="${GREEN}"
  237. BAD="${RED}"
  238.  
  239. white='\033[0m'
  240. red='\033[31m'
  241. green='\033[32m'
  242. orange='\033[33m'
  243. blue='\033[34m'
  244. blink='\e[5m'
  245. purple='\033[35m'
  246. cyan='\033[36m'
  247. gray='\033[37m'
  248. # If you come from bash you might have to change your $PATH.
  249. PATH=$HOME/bin:/usr/local/bin:$PATH:/imp/bin/src:/imp/Tether/node/deps/uv/src/ares/c-ares:$HOME/Cl0neMast3r:/imp/.local/bin:/imp/UMS-7.4.0/ums-7.4.0
  250.  
  251. # Path to your oh-my-zsh installation.
  252. ZSH="/imp/.oh-my-zsh"
  253. SAVE_FILE="$HOME/tracked-scripts"
  254. # Set name of the theme to load. Optionally, if you set this to "random"
  255. # it'll load a random theme each time that oh-my-zsh is loaded.
  256. # See https://github.com/robbyrussell/oh-my-zsh/wiki/Themes
  257. ZSH_THEME="agnoster"
  258.  
  259. # Set list of themes to load
  260. # Setting this variable when ZSH_THEME=random
  261. # cause zsh load theme from this variable instead of
  262. # looking in ~/.oh-my-zsh/themes/
  263. # An empty array have no effect
  264. # ZSH_THEME_RANDOM_CANDIDATES=( "robbyrussell" "agnoster" )
  265.  
  266. # Uncomment the following line to use case-sensitive completion.
  267. # CASE_SENSITIVE="true"
  268.  
  269. # Uncomment the following line to use hyphen-insensitive completion. Case
  270. # sensitive completion must be off. _ and - will be interchangeable.
  271. # HYPHEN_INSENSITIVE="true"
  272.  
  273. # Uncomment the following line to disable bi-weekly auto-update checks.
  274. # DISABLE_AUTO_UPDATE="true"
  275.  
  276. # Uncomment the following line to change how often to auto-update (in days).
  277. # export UPDATE_ZSH_DAYS=13
  278.  
  279. # Uncomment the following line to disable colors in ls.
  280. # DISABLE_LS_COLORS="true"
  281.  
  282. # Uncomment the following line to disable auto-setting terminal title.
  283. # DISABLE_AUTO_TITLE="true"
  284.  
  285. # Uncomment the following line to enable command auto-correction.
  286. # ENABLE_CORRECTION="true"
  287.  
  288. # Uncomment the following line to display red dots whilst waiting for completion.
  289. # COMPLETION_WAITING_DOTS="true"
  290.  
  291. # Uncomment the following line if you want to disable marking untracked files
  292. # under VCS as dirty. This makes repository status check for large repositories
  293. # much, much faster.
  294. # DISABLE_UNTRACKED_FILES_DIRTY="true"
  295.  
  296. # Uncomment the following line if you want to change the command execution time
  297. # stamp shown in the history command output.
  298. # You can set one of the optional three formats:
  299. # "mm/dd/yyyy"|"dd.mm.yyyy"|"yyyy-mm-dd"
  300. # or set a custom format using the strftime function format specifications,
  301. # see 'man strftime' for details.
  302. # HIST_STAMPS="mm/dd/yyyy"
  303.  
  304. # Would you like to use another custom folder than $ZSH/custom?
  305. # ZSH_CUSTOM=/path/to/new-custom-folder
  306.  
  307. # Which plugins would you like to load? (plugins can be found in ~/.oh-my-zsh/plugins/*)
  308. # Custom plugins may be added to ~/.oh-my-zsh/custom/plugins/
  309. # Example format: plugins=(rails git textmate ruby lighthouse)
  310. # Add wisely, as too many plugins slow down shell startup.
  311. plugins=(
  312.   adb
  313.   coffee
  314.   catimg
  315.   history
  316.   copyfile
  317.   ant
  318.   debian
  319.   httpie
  320.   sudo
  321.   oc
  322.   nanorc
  323.   git
  324. )
  325.  
  326. source $ZSH/oh-my-zsh.sh
  327. setopt auto_cd
  328. setopt multios
  329. setopt prompt_subst
  330. alias colors='cat $HOME/colors'
  331. alias itso=source
  332. alias 'sss=service --status-all'
  333. alias 'rm=rm -rf'
  334. alias 'HD=$HOME/Desktop'
  335. alias 'cpp=clippaste'
  336. alias 'cpc=clipcopy'
  337. alias 'hts=history'
  338. alias ''
  339. alias 'its.mkpw=apg'
  340. alias 'its.mkpw=apg /imperial/bin/its.mkpw'
  341. alias '..=cd ..; clear; ls'
  342. alias 'nautsc=~/.local/share/nautilus/scripts'
  343. alias 'ifc=ifconfig'
  344. alias 'clipc=clipcopy'
  345. alias 'clipp=clippaste'
  346. alias 'itmed=/media/$(echo `whoami`)'
  347. alias 'wget=wget2 -c --force-progress $*'
  348. alias 'cp=cp -gR -r -u -v'
  349. alias 'pv=pv -tpeba'
  350. alias 'music=USER='/media/"$(echo $LOGNAME)"/MUSIC/music'; ls $USER'
  351. alias 'song=USER='/media/"$(echo $LOGNAME)"/MUSIC/music'; read song < <( zenity --title "ITS Music"  --width=560 --text "Play Songs"  --forms --add-entry "SONG:" ); mpv $USER/$song '
  352. alias 'mv=mv -g'
  353. alias 'gxm=gxmessage -title "ITS_ imperialerial TeK. Solutions" -center -geometry 500x500'
  354. alias itsearch='cd /; sudo find . -print | grep -FzZ "$*" | grep "$*"'
  355. alias 'apts=apt search $*'
  356. alias 'TORB=/imperial/.local/share/torbrowser/tor-browser-linux64-8.0.1_en-US/tor-browser_en-US'
  357. alias 'dr3=cat /imperial/.local/share/torbrowser/tor-browser-linux64-8.0.1_en-US/tor-browser_en-US/.dr3'
  358. alias '7zl=7z l $*'
  359. alias 'sit=sizeit $*'
  360. alias 'media.space=df -ah /media/imperial/** /'
  361. alias 'fsp=media.space'
  362. alias 'kl=keep list'
  363. alias 'kn=keep new'
  364. alias 'jj=java -jar $*'
  365. alias 'ddl=drivedl $*'
  366. alias 'mp4v=mv *.mp4 $*'
  367. wine_exes=/media/$(echo `whoami`)/SD_CARD/wine-executalbes
  368. alias 'ses=service stop $*'
  369. alias 'se=service $*'
  370. alias 'sdcmv=mv -gt /media/imperial/SD_CARD/ $*'
  371. alias 'a=alias'
  372. MUSIC=/media/$(echo `whoami`)/MY_MUSIC
  373. MERKURY=/media/imperial/MERKURY
  374. home=/imperial
  375. alias 'findexes=find . -type -f -executable'
  376. alias 'findexes=find . -type f -executable'
  377. alias 'sadbp=sudo adb push $*'
  378. alias 'sadbs=sudo adb shell'
  379. alias 'sadbp=sudo adb pull $*'
  380. alias 'sadb=sudo adb $*'
  381. alias 'ff=firefox $*'
  382. alias 'findmp4=sudo find / -iname "*.mp4"'
  383. alias 'itx=its.chx $*'
  384. DLS=/imperial/Downloads
  385. httpservdir=/usr/local/lib/node_modules/http-server
  386. alias 'rmdu=sudo fdupes -rsnASdNI'
  387. alias 'ac=cat $*'
  388. ISOS=/media/imperial/MY_BACKUPS/isos
  389. BACKUPS=/media/imperial/MY_BACKUPS
  390. xvid=/media/imperial/MEDIA/xvids
  391. alias 'la=ls -a'
  392. alias 'sadbpu=sudo adb push $*'
  393. alias 'sse=sudo service $*'
  394. alias 'sdpki=sudo dpkg -i $*'
  395. alias 'spt=sudo apt $*'
  396. APT=/etc/apt
  397. alias 'mp3v=mv *.mp3 $*'
  398. alias 'itpc=pcmanfm $*'
  399. nginx_dir=/etc/nginx
  400. alias 'ffp=ffplay $*'
  401. alias 'snan=sudo nano $*'
  402. alias 'srm=sudo rm $*'
  403. alias 'psx=ps -aux'
  404. alias 'mpl=mplayer $*'
  405. itslogo
  406. ISOS=/media/imperial/BACKUPS/isos
  407. ISOS=/media/imperial/MY_BACKUPS/isos
  408. ARMITAGE=/usr/share/armitage
  409. alias 'snin=sudo nano $*'
  410. XVIDS=/media/imperial/MEDIA/x
  411. alias 'wp=whitep'
  412. alias 'serve=gatling -p $*'
  413. alias 'itx=dtrx $*'
  414. alias 'chrom=chromium-browser $*'
  415. alias 'ebi=echobatch'
  416. alias 'itsys=systemctl $*'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement