فهرست منبع

Initial commit

control 4 سال پیش
کامیت
298414a852
7فایلهای تغییر یافته به همراه337 افزوده شده و 0 حذف شده
  1. 39 0
      aliases
  2. 2 0
      inputrc
  3. 24 0
      nvim
  4. 132 0
      parrot-prompt
  5. 93 0
      powerline
  6. 4 0
      tmux.conf
  7. 43 0
      vimrc

+ 39 - 0
aliases

@@ -0,0 +1,39 @@
+alias la="ls -lah"
+alias oo="open . || xdg-open ."
+alias ex="exit"
+alias qq="exit"
+alias mv="mv -iv"
+alias cp="cp -riv"
+alias mkdir="mkdir -vp"
+alias rm="rm -i"
+alias b="cd .."
+alias bls="cd .. && ls"
+alias bb="cd ../../"
+alias bbls="cd ../../ && ls"
+alias cl="clear"
+alias cdl="cd && cl"
+alias v="vi"
+alias vi="vim"
+alias vim="nvim -R"
+alias vime="nvim"
+alias py="python"
+alias py2="python2"
+alias py3="python3"
+
+alias internetSpeedTest="wget -O /dev/null http://speedtest.wdc01.softlayer.com/downloads/test10.zip"
+alias ufwcmd="echo 'ufw allow proto tcp from 0.0.0.0 port 00 to 0.0.0.0 port 00 comment'"
+alias weather="curl http://wttr.in/hk"
+alias publicip="curl ipinfo.io"
+
+alias graph="git log --all --decorate --oneline --graph"
+alias gs="git status"
+alias gl="git log"
+alias gd="git diff"
+alias ga="git add ."
+alias gb="git branch"
+alias gch="git checkout"
+alias gp="git push"
+alias gc="git commit -am 'quick updates'"
+alias gcp="git commit -am 'quick updates' && git push"
+
+export EDITOR=/usr/bin/nvim

+ 2 - 0
inputrc

@@ -0,0 +1,2 @@
+set show-all-if-ambiguous on
+set completion-ignore-case on

+ 24 - 0
nvim

@@ -0,0 +1,24 @@
+" located in ~/.config/nvim/init.vim
+
+set nocompatible            " disable compatibility to old-time vi
+set showmatch               " show matching 
+set ignorecase              " case insensitive 
+set mouse=v                 " middle-click paste with 
+set hlsearch                " highlight search 
+set incsearch               " incremental search
+set tabstop=4               " number of columns occupied by a tab 
+set softtabstop=4           " see multiple spaces as tabstops so <BS> does the right thing
+set expandtab               " converts tabs to white space
+set shiftwidth=4            " width for autoindents
+set autoindent              " indent a new line the same amount as the line just typed
+set number                  " add line numbers
+set wildmode=longest,list   " get bash-like tab completions
+filetype plugin indent on   "allow auto-indenting depending on file type
+syntax on                   " syntax highlighting
+set mouse=a                 " enable mouse click
+set clipboard=unnamedplus   " using system clipboard
+filetype plugin on
+set cursorline              " highlight current cursorline
+set ttyfast                 " Speed up scrolling in Vim
+" set spell                 " enable spell check (may need to download language package)
+" set noswapfile            " disable creating swap file

+ 132 - 0
parrot-prompt

@@ -0,0 +1,132 @@
+# ~/.bashrc: executed by bash(1) for non-login shells.
+# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
+# for examples
+
+# If not running interactively, don't do anything
+case $- in
+    *i*) ;;
+      *) return;;
+esac
+
+export PATH=/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games:/usr/share/games:/usr/local/sbin:/usr/sbin:/sbin:~/.local/bin:/snap/bin:$PATH
+
+# don't put duplicate lines or lines starting with space in the history.
+# See bash(1) for more options
+HISTCONTROL=ignoreboth
+
+# append to the history file, don't overwrite it
+shopt -s histappend
+
+# for setting history length see HISTSIZE and HISTFILESIZE in bash(1)
+HISTSIZE=1000
+HISTFILESIZE=2000
+
+# check the window size after each command and, if necessary,
+# update the values of LINES and COLUMNS.
+shopt -s checkwinsize
+
+# If set, the pattern "**" used in a pathname expansion context will
+# match all files and zero or more directories and subdirectories.
+#shopt -s globstar
+
+# make less more friendly for non-text input files, see lesspipe(1)
+#[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"
+
+# set variable identifying the chroot you work in (used in the prompt below)
+if [ -z "${debian_chroot:-}" ] && [ -r /etc/debian_chroot ]; then
+    debian_chroot=$(cat /etc/debian_chroot)
+fi
+
+# set a fancy prompt (non-color, unless we know we "want" color)
+case "$TERM" in
+    xterm-color) color_prompt=yes;;
+esac
+
+# uncomment for a colored prompt, if the terminal has the capability; turned
+# off by default to not distract the user: the focus in a terminal window
+# should be on the output of commands, not on the prompt
+force_color_prompt=yes
+
+if [ -n "$force_color_prompt" ]; then
+    if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then
+	# We have color support; assume it's compliant with Ecma-48
+	# (ISO/IEC-6429). (Lack of such support is extremely rare, and such
+	# a case would tend to support setf rather than setaf.)
+	color_prompt=yes
+    else
+	color_prompt=
+    fi
+fi
+
+if [ "$color_prompt" = yes ]; then
+    PS1="\[\033[0;31m\]\342\224\214\342\224\200\$([[ \$? != 0 ]] && echo \"[\[\033[0;31m\]\342\234\227\[\033[0;37m\]]\342\224\200\")[$(if [[ ${EUID} == 0 ]]; then echo '\[\033[01;31m\]root\[\033[01;33m\]@\[\033[01;96m\]\h'; else echo '\[\033[0;39m\]\u\[\033[01;33m\]@\[\033[01;96m\]\h'; fi)\[\033[0;31m\]]\342\224\200[\[\033[0;32m\]\w\[\033[0;31m\]]\n\[\033[0;31m\]\342\224\224\342\224\200\342\224\200\342\225\274 \[\033[0m\]\[\e[01;33m\]\\$\[\e[0m\]"
+else
+    PS1='┌──[\u@\h]─[\w]\n└──╼ \$ '
+fi
+
+# Set 'man' colors
+if [ "$color_prompt" = yes ]; then
+	man() {
+	env \
+	LESS_TERMCAP_mb=$'\e[01;31m' \
+	LESS_TERMCAP_md=$'\e[01;31m' \
+	LESS_TERMCAP_me=$'\e[0m' \
+	LESS_TERMCAP_se=$'\e[0m' \
+	LESS_TERMCAP_so=$'\e[01;44;33m' \
+	LESS_TERMCAP_ue=$'\e[0m' \
+	LESS_TERMCAP_us=$'\e[01;32m' \
+	man "$@"
+	}
+fi
+
+unset color_prompt force_color_prompt
+
+# If this is an xterm set the title to user@host:dir
+case "$TERM" in
+xterm*|rxvt*)
+    PS1="\[\033[0;31m\]\342\224\214\342\224\200\$([[ \$? != 0 ]] && echo \"[\[\033[0;31m\]\342\234\227\[\033[0;37m\]]\342\224\200\")[$(if [[ ${EUID} == 0 ]]; then echo '\[\033[01;31m\]root\[\033[01;33m\]@\[\033[01;96m\]\h'; else echo '\[\033[0;39m\]\u\[\033[01;33m\]@\[\033[01;96m\]\h'; fi)\[\033[0;31m\]]\342\224\200[\[\033[0;32m\]\w\[\033[0;31m\]]\n\[\033[0;31m\]\342\224\224\342\224\200\342\224\200\342\225\274 \[\033[0m\]\[\e[01;33m\]\\$\[\e[0m\]"
+    ;;
+*)
+    ;;
+esac
+
+# enable color support of ls and also add handy aliases
+if [ -x /usr/bin/dircolors ]; then
+    test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
+    alias ls='ls --color=auto'
+    alias dir='dir --color=auto'
+    alias vdir='vdir --color=auto'
+
+    alias grep='grep --color=auto'
+    alias fgrep='fgrep --color=auto'
+    alias egrep='egrep --color=auto'
+fi
+
+# some more ls aliases
+alias ll='ls -lh'
+alias la='ls -lha'
+alias l='ls -CF'
+alias em='emacs -nw'
+alias dd='dd status=progress'
+alias _='sudo'
+alias _i='sudo -i'
+
+# Alias definitions.
+# You may want to put all your additions into a separate file like
+# ~/.bash_aliases, instead of adding them here directly.
+# See /usr/share/doc/bash-doc/examples in the bash-doc package.
+
+if [ -f ~/.bash_aliases ]; then
+    . ~/.bash_aliases
+fi
+
+# enable programmable completion features (you don't need to enable
+# this, if it's already enabled in /etc/bash.bashrc and /etc/profile
+# sources /etc/bash.bashrc).
+if ! shopt -oq posix; then
+  if [ -f /usr/share/bash-completion/bash_completion ]; then
+    . /usr/share/bash-completion/bash_completion
+  elif [ -f /etc/bash_completion ]; then
+    . /etc/bash_completion
+  fi
+fi

+ 93 - 0
powerline

@@ -0,0 +1,93 @@
+#!/usr/bin/env bash
+
+## Uncomment to disable git info
+#POWERLINE_GIT=0
+
+__powerline() {
+    # Colors
+    COLOR_RESET='\[\033[m\]'
+    COLOR_CWD=${COLOR_CWD:-'\[\033[0;34m\]'} # blue
+    COLOR_GIT=${COLOR_GIT:-'\[\033[0;36m\]'} # cyan
+    COLOR_SUCCESS=${COLOR_SUCCESS:-'\[\033[0;32m\]'} # green
+    COLOR_FAILURE=${COLOR_FAILURE:-'\[\033[0;31m\]'} # red
+
+    # Symbols
+    SYMBOL_GIT_BRANCH=${SYMBOL_GIT_BRANCH:-⑂}
+    SYMBOL_GIT_MODIFIED=${SYMBOL_GIT_MODIFIED:-*}
+    SYMBOL_GIT_PUSH=${SYMBOL_GIT_PUSH:-↑}
+    SYMBOL_GIT_PULL=${SYMBOL_GIT_PULL:-↓}
+
+    if [[ -z "$PS_SYMBOL" ]]; then
+      case "$(uname)" in
+          Darwin)   PS_SYMBOL='';;
+          Linux)    PS_SYMBOL='$';;
+          *)        PS_SYMBOL='%';;
+      esac
+    fi
+
+    __git_info() { 
+        [[ $POWERLINE_GIT = 0 ]] && return # disabled
+        hash git 2>/dev/null || return # git not found
+        local git_eng="env LANG=C git"   # force git output in English to make our work easier
+
+        # get current branch name
+        local ref=$($git_eng symbolic-ref --short HEAD 2>/dev/null)
+
+        if [[ -n "$ref" ]]; then
+            # prepend branch symbol
+            ref=$SYMBOL_GIT_BRANCH$ref
+        else
+            # get tag name or short unique hash
+            ref=$($git_eng describe --tags --always 2>/dev/null)
+        fi
+
+        [[ -n "$ref" ]] || return  # not a git repo
+
+        local marks
+
+        # scan first two lines of output from `git status`
+        while IFS= read -r line; do
+            if [[ $line =~ ^## ]]; then # header line
+                [[ $line =~ ahead\ ([0-9]+) ]] && marks+=" $SYMBOL_GIT_PUSH${BASH_REMATCH[1]}"
+                [[ $line =~ behind\ ([0-9]+) ]] && marks+=" $SYMBOL_GIT_PULL${BASH_REMATCH[1]}"
+            else # branch is modified if output contains more lines after the header line
+                marks="$SYMBOL_GIT_MODIFIED$marks"
+                break
+            fi
+        done < <($git_eng status --porcelain --branch 2>/dev/null)  # note the space between the two <
+
+        # print the git branch segment without a trailing newline
+        printf " $ref$marks"
+    }
+
+    ps1() {
+        # Check the exit code of the previous command and display different
+        # colors in the prompt accordingly. 
+        if [ $? -eq 0 ]; then
+            local symbol="$COLOR_SUCCESS $PS_SYMBOL $COLOR_RESET"
+        else
+            local symbol="$COLOR_FAILURE $PS_SYMBOL $COLOR_RESET"
+        fi
+
+        local cwd="$COLOR_CWD\w$COLOR_RESET"
+        # Bash by default expands the content of PS1 unless promptvars is disabled.
+        # We must use another layer of reference to prevent expanding any user
+        # provided strings, which would cause security issues.
+        # POC: https://github.com/njhartwell/pw3nage
+        # Related fix in git-bash: https://github.com/git/git/blob/9d77b0405ce6b471cb5ce3a904368fc25e55643d/contrib/completion/git-prompt.sh#L324
+        if shopt -q promptvars; then
+            __powerline_git_info="$(__git_info)"
+            local git="$COLOR_GIT\${__powerline_git_info}$COLOR_RESET"
+        else
+            # promptvars is disabled. Avoid creating unnecessary env var.
+            local git="$COLOR_GIT$(__git_info)$COLOR_RESET"
+        fi
+
+        PS1="$cwd$git$symbol"
+    }
+
+    PROMPT_COMMAND="ps1${PROMPT_COMMAND:+; $PROMPT_COMMAND}"
+}
+
+__powerline
+unset __powerline

+ 4 - 0
tmux.conf

@@ -0,0 +1,4 @@
+set -g default-command /bin/bash
+set -g default-shell /bin/bash
+set -g default-terminal "xterm-256color"
+set -g pane-border-status bottom

+ 43 - 0
vimrc

@@ -0,0 +1,43 @@
+" Turn on syntax highlighting
+syntax on
+
+" Automatically wrap text that extends beyond the screen length
+set wrap
+
+" Tabs 
+set tabstop=8 softtabstop=0 expandtab shiftwidth=4 smarttab
+
+" Show line numbers
+set number 
+
+" Display different types of white spaces 
+set list 
+set listchars=tab:›\ ,trail:•,extends:#,nbsp:.
+
+" Set status line display
+set statusline=%F%m%r%h%w\ [FORMAT=%{&ff}]\ [TYPE=%Y]\ [POS=%l,%v][%p%%]\ [BUFFER=%n]\ %{strftime('%c')}
+
+" Encoding 
+set encoding=utf-8
+
+"Highlight matching search patterns 
+set hlsearch
+
+" Enable incremental search 
+set incsearch
+
+" Include matching uppercase words with lowercase search terms 
+set ignorecase 
+
+" Include only uppercase words with uppercases search term 
+set smartcase 
+
+" Highlight matching pairs of brackets. Use the '%' character to jump between them.
+set matchpairs+=<:>
+
+" Speed up scrolling 
+set ttyfast
+
+" Fixes common backspace problems 
+set backspace=indent,eol,start
+