├── README.md ├── aria2.conf ├── bash_profile ├── bashrc ├── curlrc ├── editorconfig ├── gitconfig ├── gitignore_global ├── gtab.list ├── hadolint.yaml ├── inputrc ├── irssi_config ├── lftprc ├── markdownlintrc ├── php_cs ├── setup.sh ├── ssh_config ├── tcshrc ├── tigrc ├── tmux.conf ├── vimrc ├── w3mconfig ├── wgetrc ├── xinputrc └── zshrc /README.md: -------------------------------------------------------------------------------- 1 | # Unitial 2 | 3 | Automatically initialize the environment for Unix-like operating systems! 4 | 5 | ## Introduction 6 | 7 | Unitial is a shell scripts and a collection of configurations designed to set up a productive environment for Unix-like operating systems. Although not fully tested, it should work on FreeBSD, most Linux distributions, and macOS. Feel free to fork, contribute via pull requests, and provide feedback, but please retain the author information. Questions and suggestions are welcome. 8 | 9 | ## Requirements 10 | 11 | - FreeBSD: No additional requirements; please use the built-in `fetch` command. 12 | - Other Unix environments: Ensure `curl` or `wget` is installed so that the installation script can download other files properly. 13 | 14 | ## Installation 15 | 16 | To install with `curl`: 17 | 18 | ```sh 19 | curl -Lo- https://github.com/PeterDaveHello/Unitial/raw/master/setup.sh | bash 20 | ``` 21 | 22 | To install with `wget`: 23 | 24 | ```sh 25 | wget -O- https://github.com/PeterDaveHello/Unitial/raw/master/setup.sh | bash 26 | ``` 27 | 28 | For FreeBSD users without both `wget` and `curl`, try: 29 | 30 | ```sh 31 | fetch -o- https://github.com/PeterDaveHello/Unitial/raw/master/setup.sh | bash 32 | ``` 33 | 34 | (You can replace the URL with a shorter one: https://git.io/Unitial) 35 | 36 | The installation process will complete in seconds. 37 | 38 | If you know how to use git and have already installed it, you can also clone this repo, but there is no need. 39 | 40 | ## What's in it? 41 | 42 | - Shell configurations (Bash, tcsh, csh, zsh): 43 | - Auto completion 44 | - Useful aliases 45 | - Keymap issue fixes for many users (note: BASH is the primary shell, and zsh is used less often, so bash features are more comprehensive) 46 | - Vim: Useful settings, status bar, and comfortable color scheme 47 | - Git: Helpful aliases and settings, gitignore (global), auto-completion, diff-highlight 48 | - SSH: Valuable settings, including optimization for X11 forwarding, TCPKeepalive, compression, and multiplexing! 49 | - irssi: Connection info for OFTC and Freenode, channel config example 50 | - tmux: Informative status bar including average load, color adjustment 51 | - Others: 52 | - aria2c: Optimized download settings for improved performance and user experience 53 | - wget: Enhanced download reliability, user agent configuration, and retry options 54 | - curl: Improved connection handling, user agent customization, and retry strategies 55 | - tig: Personalized colors and line graphics for better readability 56 | - w3m: Tailored colors and appearance for an enhanced browsing experience 57 | - php_cs: Custom PHP-CS-Fixer rules for consistent coding style 58 | - markdownlint: Configured Markdown linting rules for better writing quality 59 | - editorconfig: Consistent coding styles across different file types 60 | - lftp: Debugging options and user agent customization for better file transfers 61 | - gtab: Fine-tuned input method settings for efficient text input 62 | - inputrc: User-friendly keybindings for readline 63 | - xinputrc: Input method settings (commented out by default) for potential customization 64 | - hadolint: Linter rules for Dockerfiles 65 | -------------------------------------------------------------------------------- /aria2.conf: -------------------------------------------------------------------------------- 1 | continue 2 | human-readable 3 | check-certificate 4 | 5 | log-level=warn 6 | min-split-size=1M 7 | split=15 8 | max-connection-per-server=15 9 | max-concurrent-downloads=15 10 | file-allocation=falloc 11 | user-agent=Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:128.0) Gecko/20100101 Firefox/128.0 12 | -------------------------------------------------------------------------------- /bash_profile: -------------------------------------------------------------------------------- 1 | 2 | source ~/.bashrc 3 | -------------------------------------------------------------------------------- /bashrc: -------------------------------------------------------------------------------- 1 | 2 | #append command history instead of overwrite 3 | shopt -s histappend 4 | 5 | #unalias all the alias(es) before set anything 6 | unalias -a 7 | 8 | #don't save duplicates records and lines started with space in bash history 9 | HISTCONTROL=ignoreboth 10 | 11 | #expand the history size 12 | HISTFILESIZE=2000 13 | HISTSIZE=1000 14 | 15 | PROMPT_DIRTRIM=5 16 | 17 | export PATH="$HOME/bin:$HOME/go/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:$PATH" 18 | 19 | #set default charset and language 20 | locale=en_US.UTF-8 21 | export LANG=$locale 22 | export LANGUAGE=$locale 23 | export LC_ALL=$locale 24 | 25 | #set default editor 26 | export EDITOR=vim 27 | 28 | #GPG passphrase input workaround 29 | export GPG_TTY 30 | PG_TTY=$(tty) 31 | 32 | #tmux color issue 33 | alias tmux='\tmux -2' 34 | 35 | #uniq unicode issue 36 | alias uniq='LC_ALL=C uniq' 37 | 38 | # some setting which depends on OS 39 | os=$(uname) 40 | if [ "$os" = "FreeBSD" ] || [ "$os" = "Darwin" ]; then 41 | datetime='date +%m/%d@%H:%M:%S' 42 | alias ls='\ls -F' 43 | alias free='\freecolor -tm' 44 | export CLICOLOR='yes' 45 | export LSCOLORS='gxfxcxdxbxegedabagacad' 46 | else 47 | datetime='date +%m/%d@%H:%M:%S' 48 | alias ls='\ls -F --color=auto' 49 | alias free='\free -h' 50 | export LS_COLORS='rs=0:di=01;36:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=36;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arj=01;31:*.taz=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.zip=01;31:*.iso=01;31:*.z=01;31:*.Z=01;31:*.dz=01;31:*.gz=01;31:*.lz=01;31:*.xz=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.snap=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.jpg=01;35:*.jpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.webm=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.axv=01;35:*.anx=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=00;36:*.au=00;36:*.flac=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:*.axa=00;36:*.oga=00;36:*.spx=00;36:*.xspf=00;36:' 51 | fi 52 | 53 | ###alias### 54 | 55 | #ls 56 | alias l='ls -C' 57 | alias ll='ls -lh' 58 | alias la='ls -A' 59 | alias lal='ls -lha' 60 | 61 | #grep 62 | alias g='\grep --color=auto' 63 | alias grep='\grep --color=auto' 64 | alias fgrep='\fgrep --color=auto' 65 | alias egrep='\egrep --color=auto' 66 | 67 | #network tool 68 | alias p='ping' 69 | alias n='nslookup' 70 | alias d='dig' 71 | alias t='mtr' 72 | alias ssh='ssh -v' 73 | 74 | #cd 75 | alias cd..='\cd ..' 76 | alias cd...='\cd ../..' 77 | alias ..='\cd ..' 78 | alias ...='\cd ../..' 79 | alias ....='\cd ../../..' 80 | alias .....='\cd ../../../..' 81 | 82 | #other alias 83 | alias c='clear' 84 | alias sudo='\sudo -E' 85 | alias less='\less -R' 86 | alias du='\du -h' 87 | alias df='\df -hT' 88 | alias wgetncc='wget --no-check-certificate' 89 | alias last='\last | less' 90 | alias tree='\tree -C' 91 | alias optipng='\optipng -o7 -zm1-9 -preserve' 92 | 93 | ###alias### 94 | 95 | if [ -e ~/.bash_history ]; then 96 | # network-related commands or tools which need auto completion 97 | complete -W "$(grep '^ssh ' ~/.bash_history | sort -u | sed 's/^ssh //')" ssh 98 | complete -W "$(grep '^sftp ' ~/.bash_history | sort -u | sed 's/^sftp //')" sftp 99 | complete -W "$(grep '^ping ' ~/.bash_history | sort -u | sed 's/^ping //')" ping 100 | complete -W "$(grep '^dig ' ~/.bash_history | sort -u | sed 's/^dig //')" dig 101 | complete -W "$(grep '^telnet ' ~/.bash_history | sort -u | sed 's/^telnet //')" telnet 102 | complete -W "$(grep '^mosh ' ~/.bash_history | sort -u | sed 's/^mosh //')" mosh 103 | complete -W "$(grep '^xfreerdp ' ~/.bash_history | sort -u | sed 's/^xfreerdp //')" xfreerdp 104 | fi 105 | 106 | #git auto completion 107 | if [ -e ~/.git-completion.bash ]; then 108 | source ~/.git-completion.bash 109 | fi 110 | 111 | function repeat() { 112 | local i=$1 113 | shift 114 | for n in $(seq "$i"); do 115 | $@ 116 | done 117 | } 118 | 119 | function retry() { 120 | local i=$1 121 | shift 122 | for n in $(seq "$i"); do 123 | $@ && break 124 | done 125 | } 126 | 127 | function man() { 128 | env LESS_TERMCAP_mb=$'\E[01;31m' \ 129 | LESS_TERMCAP_md=$'\E[01;38;5;74m' \ 130 | LESS_TERMCAP_me=$'\E[0m' \ 131 | LESS_TERMCAP_se=$'\E[0m' \ 132 | LESS_TERMCAP_so=$'\E[38;5;246m' \ 133 | LESS_TERMCAP_ue=$'\E[0m' \ 134 | LESS_TERMCAP_us=$'\E[04;36m' \ 135 | man "$@" 136 | } 137 | 138 | function returncode() { 139 | returncode=$? 140 | if [ $returncode != 0 ]; then 141 | echo "[$($datetime) $returncode]" 142 | else 143 | echo "" 144 | fi 145 | } 146 | 147 | function enable-prompt-color() { 148 | if [[ ${EUID} == 0 ]]; then 149 | PS1='${debian_chroot:+($debian_chroot)}\[\033[01;31m\]\h\[\033[01;36m\] \w \$\[\033[00m\] \[\033[01;31m\]$(returncode)\[\033[0;37m\]' 150 | else 151 | PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[01;36m\] \w \$\[\033[00m\] \[\033[01;31m\]$(returncode)\[\033[0;37m\]' 152 | fi 153 | } 154 | 155 | function disable-prompt-color() { 156 | if [[ ${EUID} == 0 ]]; then 157 | # show root@ when we don't have colors 158 | PS1='\u@\h \W \$ $(returncode)' 159 | else 160 | PS1='\u@\h \w \$ $(returncode)' 161 | fi 162 | } 163 | 164 | enable-prompt-color 165 | 166 | # automatically enable bash-completion in interactive shells 167 | if ! shopt -oq posix; then 168 | if [ -s "/usr/share/bash-completion/bash_completion" ]; then 169 | source "/usr/share/bash-completion/bash_completion" 170 | elif [ -s "/etc/bash_completion" ]; then 171 | source "/etc/bash_completion" 172 | elif [ -s "/usr/local/share/bash-completion/bash_completion" ]; then 173 | source "/usr/local/share/bash-completion/bash_completion" 174 | elif [ -s "/usr/local/etc/bash_completion" ]; then 175 | source "/usr/local/etc/bash_completion" 176 | fi 177 | fi 178 | 179 | if [ -r ~/.colorEcho ]; then 180 | source ~/.colorEcho 181 | fi 182 | -------------------------------------------------------------------------------- /curlrc: -------------------------------------------------------------------------------- 1 | user-agent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:128.0) Gecko/20100101 Firefox/128.0" 2 | 3 | retry = 5 4 | retry-delay = 5 5 | connect-timeout = 30 6 | 7 | # follow location redirection 8 | location 9 | 10 | # auto request compreesed data and auto decompress 11 | compressed 12 | 13 | # create directory if create-dirs (when using `-o`) 14 | create-dirs 15 | 16 | # auto set the previous url as referer if been redirected 17 | referer = ";auto" 18 | 19 | # curl should exit with non-zero status code if something wrong 20 | fail 21 | -------------------------------------------------------------------------------- /editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | charset = utf-8 5 | indent_style = space 6 | insert_final_newline = true 7 | trim_trailing_whitespace = true 8 | 9 | [*.{php,py}] 10 | indent_size = 4 11 | 12 | [*.{js,css,html,json,md,yml,java,cpp,sh}] 13 | indent_size = 2 14 | 15 | [Makefile] 16 | indent_style = tab 17 | -------------------------------------------------------------------------------- /gitconfig: -------------------------------------------------------------------------------- 1 | 2 | [color] 3 | ui = true 4 | [alias] 5 | ad = add --all . 6 | br = branch 7 | bl = blame 8 | chp = cherry-pick 9 | chpa = cherry-pick --abort 10 | chpc = cherry-pick --continue 11 | ci = commit -v 12 | cia = commit -v --amend 13 | cim = commit -m 14 | cis = commit -v -S 15 | cias = commit -v --amend -S 16 | cims = commit -m -S 17 | cl = clone 18 | cl1 = clone --depth 1 19 | cl10 = clone --depth 10 20 | co = checkout 21 | cob = checkout -b 22 | df = diff 23 | dfc = diff --cached 24 | dfw = diff -w 25 | dfcw = diff --cached -w 26 | dfs = diff --stat --summary 27 | fh = fetch 28 | fhu = fetch upstream 29 | mg = merge 30 | rb = rebase 31 | rba = rebase --abort 32 | rbc = rebase --continue 33 | rbi = rebase -i 34 | rbm = "!fn(){ branch=''; if git show-ref --verify --quiet refs/heads/master; then branch='master'; elif git show-ref --verify --quiet refs/heads/main; then branch='main'; fi; if [ -n '$branch' ]; then git rebase $branch $1; else echo 'Both master and main branch not found!' >&2; return 1; fi; };fn" 35 | rmt = remote 36 | rmtv = remote -v 37 | rmta = remote add 38 | rmtau = remote add upstream 39 | rs = reset 40 | rst = reset 41 | rsh = reset --hard 42 | rv = revert 43 | rvt = revert 44 | pl = pull 45 | plr = pull --rebase 46 | ps = push 47 | sh = stash 48 | sm = submodule 49 | st = status 50 | serve = !git daemon --reuseaddr --verbose --base-path=. --export-all ./.git 51 | lg = log 52 | lgp = log -p 53 | lgpw = log -p -w 54 | lgs = log --stat --summary 55 | lgt = log --abbrev-commit --decorate --graph --color --pretty='format:%C(yellow)%h%Creset% s %C(magenta)%an%Creset %C(green)%ar%Creset' 56 | lgf = log --follow 57 | lgpf = log -p --follow 58 | lgpwf = log -p -w --follow 59 | lgsf = log --stat --summary --follow 60 | lgtf = log --abbrev-commit --decorate --graph --color --pretty='format:%C(yellow)%h%Creset% s %C(magenta)%an%Creset %C(green)%ar%Creset' --follow 61 | pushall = "!fn(){ for a in `git remote`; do git push $a $(git rev-parse --abbrev-ref HEAD); done; };fn" 62 | pullall = "!fn(){ for a in `git remote`; do git pull $a $(git rev-parse --abbrev-ref HEAD); done; };fn" 63 | fetchall = "!fn(){ for a in `git remote`; do git fetch $a; done; };fn" 64 | fetchmulti = "!fn(){ for a in $@; do git fetch $a; done; };fn" 65 | fetchpr = "!fn(){ for a in $@; do git fetch origin pull/$a/head:$a -f; done; };fn" 66 | fetchmr = "!fn(){ for a in $@; do git fetch origin merge-requests/$a/head:$a -f; done; };fn" 67 | cleanup = "!fn(){ for a in `git remote`; do git remote prune $a; done && git reflog expire --verbose --all --expire=now && git gc --prune=now --aggressive ;};fn" 68 | [push] 69 | # for only push to current branch 70 | default = tracking 71 | [core] 72 | editor = vim 73 | excludesfile = ~/.gitignore_global 74 | pager = ~/.git/contrib/diff-highlight | less 75 | preloadindex = true 76 | autocrlf = false 77 | ignorecase = false 78 | fscache = true 79 | quotepath = false 80 | [mergetool] 81 | keepBackup = false 82 | [gui] 83 | encoding = utf-8 84 | [i18n] 85 | commitencoding = utf-8 86 | logoutputencoding = utf-8 87 | [help] 88 | autocorrect = 10 89 | [credential] 90 | helper = cache --timeout=600 91 | [branch "master"] 92 | rebase = true 93 | [branch "dev"] 94 | rebase = true 95 | [branch] 96 | autosetuprebase = always 97 | sort = -committerdate 98 | [url "git@github.com:"] 99 | #insteadOf = git://github.com/ 100 | #insteadOf = http://github.com/ 101 | #insteadOf = https://github.com/ 102 | [grep] 103 | lineNumber = true 104 | [diff] 105 | compactionHeuristic = true 106 | [tag] 107 | sort = -version:refname 108 | -------------------------------------------------------------------------------- /gitignore_global: -------------------------------------------------------------------------------- 1 | 2 | .*.sw[a-z] 3 | *.nfs.* 4 | *.out 5 | *.exe 6 | 7 | .php_cs.cache 8 | 9 | .DS_Store 10 | 11 | npm-debug.log 12 | -------------------------------------------------------------------------------- /gtab.list: -------------------------------------------------------------------------------- 1 | EN e !EN gcin-tray.png 2 | 符號表 4 !SYMBOL_TABLE symbol_table.png 3 | 符號小鍵盤 , symbols.gtab symbols.png 4 | !注音 3 !PHO juyin.png 5 | 詞音/拼音 6 !TSIN tsin.png 6 | !新酷音 [ chewing-module.so chewing.png 7 | !倉頡 1 cj.gtab cj.png 8 | !倉五 2 cj5.gtab cj5.png 9 | !亂倉打鳥 \ NewCJ3.gtab NewCJ3.png 10 | !五四三倉頡 2 cj543.gtab cj543.png 11 | !速成/簡易 - simplex.gtab simplex.png 12 | !標點簡易 - simplex-punc.gtab simplex-punc.png 13 | !大易 7 dayi3.gtab dayi3.png 14 | !行列 8 ar30.gtab ar30.png 15 | !行列大字集 8 ar30-big.gtab ar30-big.png 16 | !行列33 8 ar33.gtab ar33.png 17 | !行列符號 8 array-symbols.gtab array-symbols.png 18 | !嘸蝦米 9 noseeing.gtab noseeing.png 19 | !帶調粵拼 ] jyutping.gtab jyutping.png 20 | !內碼 0 intcode-module.so intcode.png 21 | !日本anthy = anthy-module.so kana-nippon.png 22 | !hangul / hangul.gtab hangul.png 23 | !greek ` greek.gtab greek.png 24 | !latin-letters [ latin-letters.gtab latin-letters.png 25 | !En-words [ vocabulary.gtab vocabulary.png 26 | !russian ? russian.gtab russian.png 27 | -------------------------------------------------------------------------------- /hadolint.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | failure-threshold: warning 3 | ignored: 4 | - DL3008 # apt pin version warning 5 | - DL3013 # pip pin version warning 6 | - DL3016 # npm pin version warning 7 | - DL3018 # apk pin version warning 8 | - DL3028 # gem pin version warning 9 | - DL3033 # yum pin version warning 10 | - DL3041 # dnf pin version warning 11 | override: 12 | warning: 13 | - DL3009 # apt-get lists clean up 14 | - DL3015 # Avoid additional apt packages 15 | - DL3019 # apk auto index update and clean up 16 | - DL3060 # yarn cache cleanup 17 | -------------------------------------------------------------------------------- /inputrc: -------------------------------------------------------------------------------- 1 | 2 | #bindkey in bash 3 | 4 | #bind home,end,pageup,pagedown,insert,delete 5 | "\e[1~": beginning-of-line 6 | "\e[2~": overwrite-mode 7 | "\e[3~": delete-char 8 | "\e[4~": end-of-line 9 | "\e[5C~": forward-word 10 | "\e[5D~": backward-word 11 | 12 | #bind shift-tab to autocomplete 13 | "\e[Z": menu-complete 14 | set visible-stats on 15 | set show-all-if-ambiguous on 16 | set completion-ignore-case on 17 | #set mark-symlinked-directories on 18 | 19 | -------------------------------------------------------------------------------- /irssi_config: -------------------------------------------------------------------------------- 1 | servers = ( 2 | { 3 | address = "irc.freenode.net"; 4 | chatnet = "freenode"; 5 | port = "6667"; 6 | autoconnect = "yes"; 7 | }, 8 | { 9 | address = "irc.oftc.net"; 10 | chatnet = "oftc"; 11 | port = "6667"; 12 | autoconnect = "no"; 13 | } 14 | ); 15 | 16 | chatnets = { 17 | freenode = { type = "IRC"; }; 18 | oftc = { type = "IRC"; }; 19 | }; 20 | 21 | channels = ( 22 | { name = "#freenode"; chatnet = "freenode"; autojoin = "No"; }, 23 | ); 24 | -------------------------------------------------------------------------------- /lftprc: -------------------------------------------------------------------------------- 1 | debug 3 2 | 3 | set dns:order "inet inet6" 4 | set http:user-agent "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:128.0) Gecko/20100101 Firefox/128.0" 5 | -------------------------------------------------------------------------------- /markdownlintrc: -------------------------------------------------------------------------------- 1 | { 2 | "default": true, 3 | "line-length": false, 4 | "ul-start-left": false, 5 | "no-hard-tabs": true, 6 | "no-bare-urls": false, 7 | "no-inline-html": false, 8 | "commands-show-output": false, 9 | "no-trailing-spaces": { "br_spaces": 0 } 10 | } 11 | 12 | -------------------------------------------------------------------------------- /php_cs: -------------------------------------------------------------------------------- 1 | in(__DIR__); 5 | 6 | return PhpCsFixer\Config::create() 7 | ->setRules(array( 8 | '@Symfony' => true, 9 | 'single_quote' => false, 10 | 'ordered_imports' => true, 11 | 'increment_style' => false, 12 | 'align_multiline_comment' => true, 13 | 'single_line_comment_style' => true, 14 | 'method_chaining_indentation' => true, 15 | 'concat_space' => array('spacing' => 'one'), 16 | 'multiline_comment_opening_closing' => true, 17 | 'trailing_comma_in_multiline_array' => false, 18 | 'method_argument_space' => ['ensure_fully_multiline' => true], 19 | 'no_useless_else' => true, 20 | 'no_useless_return' => true, 21 | 'no_short_echo_tag' => true, 22 | 'no_superfluous_elseif' => true, 23 | 'no_unneeded_curly_braces' => true, 24 | 'no_unneeded_final_method' => true, 25 | )) 26 | ->setFinder($finder); 27 | -------------------------------------------------------------------------------- /setup.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | CAT="/bin/cat" 4 | CHMOD="/bin/chmod" 5 | MKDIR="/bin/mkdir" 6 | TOUCH="/usr/bin/touch" 7 | 8 | github_base='https://raw.githubusercontent.com/' 9 | repo_path='PeterDaveHello/Unitial/master/' 10 | 11 | os="$(uname)" 12 | if [ "$os" = "FreeBSD" ]; then 13 | ECHO="echo" 14 | ${ECHO} -e "\n\e[1;36;40mYour operating system is $os\n\e[0m" 15 | ${ECHO} -e "\n\e[1;36;40mSuppose you have 'fetch' to download files!\n\e[0m" 16 | download_o='fetch -o' 17 | else 18 | ECHO="/bin/echo" 19 | ${ECHO} -e "\n\e[1;36;40mYour operating system is $os\n\e[0m" 20 | if type "curl" > /dev/null 2>&1; then 21 | download_o='curl --compressed -#o' 22 | elif type "wget" > /dev/null 2>&1; then 23 | download_o='wget --no-timestamping --no-verbose -O ' 24 | else 25 | echo "Unitial needs 'wget' or 'curl' to download the assets." 1>&2 26 | fi 27 | fi 28 | 29 | ${ECHO} -e "\n\e[1;36;40mUnitial is started to initial your Unix-like working environment\n\nPlease wait...\n\n\e[0m" 30 | 31 | ${ECHO} -e "\n\e[1;36;40mDownload and setup configs from server...\n\e[0m" 32 | for file in gitconfig tcshrc bashrc bash_profile inputrc vimrc zshrc gitignore_global tmux.conf xinputrc wgetrc curlrc tigrc editorconfig php_cs markdownlintrc lftprc; do 33 | ${download_o} - "${github_base}${repo_path}${file}" | ${CAT} >> ~/."$file" & 34 | done 35 | 36 | ${MKDIR} -p ~/.irssi/ ~/.git/contrib/ ~/.vim/colors/ ~/.vim/swp/ ~/.vim/bak/ ~/.vim/undo/ ~/.aria2/ ~/.w3m/ ~/.hadolint/ 37 | 38 | ${download_o} ~/.w3m/config "${github_base}${repo_path}w3mconfig" & 39 | ${download_o} ~/.irssi/config "${github_base}${repo_path}irssi_config" & 40 | ${download_o} ~/.aria2/aria2.conf "${github_base}${repo_path}aria2.conf" & 41 | ${download_o} ~/.hadolint/hadolint.yaml "${github_base}${repo_path}hadolint.yaml" & 42 | 43 | ${download_o} ~/.colorEcho "${github_base}PeterDaveHello/ColorEchoForShell/master/dist/ColorEcho.bash" & 44 | 45 | ${MKDIR} -p ~/.gcin/ 46 | ${download_o} ~/.gcin/gtab.list "${github_base}${repo_path}gtab.list" & 47 | 48 | ${MKDIR} -p -m 700 ~/.ssh/.tmp_session/ 49 | ${CHMOD} 700 ~/.ssh/ 50 | ${download_o} - "${github_base}${repo_path}ssh_config" | ${CAT} >> ~/.ssh/config & 51 | ${TOUCH} ~/.ssh/authorized_keys 52 | ${CHMOD} 600 ~/.ssh/config ~/.ssh/authorized_keys 53 | 54 | wait 55 | 56 | ${ECHO} -e "\n\e[1;36;40mAdd some color setting which depends on your OS...\n\e[0m" 57 | if [ "$os" = "FreeBSD" ] || [ "$os" = "Darwin" ]; then 58 | ${ECHO} -e "\n#color setting\nalias ls='\ls -F'" >> ~/.zshrc 59 | ${ECHO} -e "\n#color setting\nalias ls '\ls -F'" >> ~/.tcshrc 60 | else 61 | ${ECHO} -e "\n#color setting\nalias ls='\ls -F --color=auto'" >> ~/.zshrc 62 | ${ECHO} -e "\n#color setting\nalias ls '\ls -F --color=auto'" >> ~/.tcshrc 63 | fi 64 | 65 | if [ "$os" = "FreeBSD" ]; then 66 | ${ECHO} -e "\n\e[1;36;40mAdd FreeBSD's package mirror setting...\n\e[0m" 67 | ${ECHO} -e "\n#package mirror setting\nexport PACKAGEROOT=http://ftp.tw.freebsd.org" >> ~/.bashrc 68 | ${ECHO} -e "\n#package mirror setting\nexport PACKAGEROOT=http://ftp.tw.freebsd.org" >> ~/.zshrc 69 | ${ECHO} -e "\n#package mirror setting\nsetenv PACKAGEROOT http://ftp.tw.freebsd.org" >> ~/.tcshrc 70 | fi 71 | 72 | if command -v git; then 73 | git_version="v$(git --version | awk '{gsub(/\.windows.+/, "", $0); print $3}')" 74 | else 75 | git_version="master" 76 | fi 77 | 78 | ${ECHO} -e "\n\e[1;36;40mDownload VIM color scheme - Kolor from server...\n\e[0m" 79 | ${download_o} ~/.vim/colors/kolor.vim "${github_base}zeis/vim-kolor/master/colors/kolor.vim" & 80 | ${ECHO} -e "\n\e[1;36;40mDownload git contrib - diff-highlight from server...\n\e[0m" 81 | ${download_o} ~/.git/contrib/diff-highlight "${github_base}git/git/v2.13.2/contrib/diff-highlight/diff-highlight" && ${CHMOD} +x ~/.git/contrib/diff-highlight & 82 | ${ECHO} -e "\n\e[1;36;40mDownload git's auto completion configs from server...\n\e[0m" 83 | git_auto_complete_path="${github_base}git/git/${git_version}/contrib/completion/git-completion." 84 | ${download_o} ~/.git-completion.bash "${git_auto_complete_path}bash" & 85 | ${download_o} ~/.git-completion.tcsh "${git_auto_complete_path}tcsh" & 86 | ${download_o} ~/.git-completion.zsh "${git_auto_complete_path}zsh" & 87 | 88 | wait 89 | 90 | if [ "$os" = "FreeBSD" ] && [ -r /usr/local/share/certs/ca-root-nss.crt ]; then 91 | ${ECHO} -e "\n\e[1;36;40mAdd ca-certificate path for FreeBSD's wget & aria2...\n\e[0m" 92 | ${ECHO} -e "\nca-certificate=/usr/local/share/certs/ca-root-nss.crt" >> ~/.wgetrc 93 | ${ECHO} -e "\nca-certificate=/usr/local/share/certs/ca-root-nss.crt" >> ~/.aria2/aria2.conf 94 | fi 95 | 96 | ${ECHO} -e "\n\e[1;36;40mUnitial installation was finished!\n\nPlease terminate all other works and restart your shell or re-login.\n\e[0m" 97 | -------------------------------------------------------------------------------- /ssh_config: -------------------------------------------------------------------------------- 1 | Host * 2 | GSSAPIAuthentication no 3 | AddressFamily inet 4 | TCPKeepAlive yes 5 | ServerAliveInterval 55 6 | Compression yes 7 | #LogLevel DEBUG 8 | 9 | #reuse connections 10 | ControlMaster auto 11 | ControlPersist 600 12 | ControlPath ~/.ssh/.tmp_session/%h_%p_%r 13 | 14 | Host ec2-*.compute.amazonaws.com 15 | # Note that this "%C" work on OpenSSH v6.7+, so comment out, disablle multiplexing by default. 16 | # This will generates a hash from the concatenation of %l%h%p%r, 17 | # SO it'll help if you got "ControlPath domain.blah.blah ... too long for Unix domain socket" problem. 18 | 19 | # Need OpenSSH v6.7+ : (e.g. on Ubuntu 16.04 or homebrew) 20 | #ControlPath ~/.ssh/.tmp_session/%C 21 | # For OpenSSH < v6.7 : 22 | ControlMaster no 23 | 24 | Host do.not.use.multiplexing 25 | ControlMaster no 26 | 27 | Host for.x11.forwarding 28 | ForwardX11 yes 29 | ForwardX11Trusted yes 30 | 31 | Host internal 32 | ProxyCommand ssh jumphost.internal -W %h:%p 33 | 34 | Host internal2 35 | ProxyJump jumphost.internal # OpenSSH v7.3+ shortcut 36 | -------------------------------------------------------------------------------- /tcshrc: -------------------------------------------------------------------------------- 1 | 2 | #unalias all the alias(es) before set anything 3 | unalias * 4 | 5 | #set default charset and language 6 | setenv LANG en_US.UTF-8 7 | setenv LC_ALL en_US.UTF-8 8 | 9 | #show all options like bash when ambiguous 10 | set autolist=ambiguous 11 | 12 | #default editor 13 | setenv EDITOR vim 14 | setenv VISUAL vim 15 | 16 | #bindkey 17 | bindkey "\e[1~" beginning-of-line 18 | bindkey "\e[1~" beginning-of-line 19 | bindkey "\e[2~" quoted-insert 20 | bindkey "\e[3~" delete-char 21 | bindkey "\e[4~" end-of-line 22 | bindkey "\e[5C" forward-word 23 | bindkey "\e[5D" backward-word 24 | bindkey "^W" backward-delete-word 25 | bindkey -k up history-search-backward 26 | bindkey -k down history-search-forward 27 | 28 | #tmux color issue 29 | alias tmux '\tmux -2' 30 | 31 | #uniq unicode issue 32 | alias uniq 'LC_ALL=C uniq' 33 | 34 | 35 | ###alias### 36 | 37 | #ls 38 | alias ls '\ls -GF' 39 | alias l 'ls -C' 40 | alias ll 'ls -lh' 41 | alias la 'ls -A' 42 | alias lal 'ls -lha' 43 | 44 | #grep 45 | alias g '\grep --color=auto' 46 | alias grep '\grep --color=auto' 47 | alias fgrep '\fgrep --color=auto' 48 | alias egrep '\egrep --color=auto' 49 | 50 | #network tool 51 | alias p 'ping' 52 | alias n 'nslookup' 53 | alias d 'dig' 54 | alias t 'mtr' 55 | alias ssh 'ssh -v' 56 | 57 | 58 | #cd 59 | alias cd.. '\cd ..' 60 | alias cd... '\cd ../..' 61 | alias .. '\cd ..' 62 | alias ... '\cd ../..' 63 | alias .... '\cd ../../..' 64 | alias ..... '\cd ../../../..' 65 | 66 | #other alias 67 | alias c 'clear' 68 | alias sudo '\sudo -E' 69 | alias less '\less -R' 70 | alias du '\du -h' 71 | alias df '\df -hT' 72 | alias free '\free -h' 73 | alias wgetncc 'wget --no-check-certificate' 74 | alias last '\last | less' 75 | alias tree '\tree -C' 76 | alias optipng '\optipng -o7 -zm1-9 -preserve' 77 | 78 | ###alias### 79 | 80 | #load git auto completion script 81 | if ( -e ~/.git-completion.tcsh && -e ~/.git-completion.bash ) then 82 | source ~/.git-completion.tcsh 83 | endif 84 | -------------------------------------------------------------------------------- /tigrc: -------------------------------------------------------------------------------- 1 | color date yellow default 2 | color author green default 3 | set line-graphics = yes 4 | -------------------------------------------------------------------------------- /tmux.conf: -------------------------------------------------------------------------------- 1 | set -g status-bg cyan 2 | #setw -g window-status-current-fg white 3 | #set -g pane-border-fg white 4 | #set -g pane-active-border-fg cyan 5 | setw -g clock-mode-colour cyan 6 | 7 | set -g status-interval 60 8 | set -g status-right-length 50 9 | set -g status-right "#(hostname -s), #(uptime | rev | awk '{print $2, $3}' | rev) %m/%d %H:%M" 10 | 11 | #display traffic of default interface in vnstat 12 | #set -g status-right "#(hostname -s), #(vnstat --oneline | cut -d';' -f 4,5), #(uptime | rev | awk '{print $2, $3}' | rev) %m/%d %H:%M" 13 | -------------------------------------------------------------------------------- /vimrc: -------------------------------------------------------------------------------- 1 | 2 | " charset 3 | set encoding=utf-8 "enc, vim buffer charset, NOT the file's charset 4 | set fileencoding=utf-8 "fenc, default save charset 5 | "fencs, default opening charset priority (as auto detection) 6 | set fileencodings=utf-8,utf-16le,big5,gb2312,gb18030,gbk,default 7 | 8 | " enable features which are not Vi compatible but really really nice. 9 | set nocompatible "nocp 10 | 11 | " default no bomb for utf-8 12 | set nobomb 13 | 14 | " expand TABs to spaces 15 | set expandtab "et 16 | " set TAB's width 17 | set tabstop=4 "ts 18 | " auto indent width 19 | set shiftwidth=4 "sw 20 | 21 | " use the indent of the previous line for a newly created line 22 | set autoindent "ai 23 | 24 | " 256 color mode 25 | set t_Co=256 26 | 27 | " show the ruler for the cursor 28 | set ruler "ru 29 | " show line numbers 30 | set number "nu 31 | 32 | " show the search results before stop typing 33 | set incsearch "is 34 | " highlight search results 35 | set hlsearch "hls 36 | " case-insensitive search 37 | set ignorecase "ic 38 | " smart search (override 'ic' when pattern has uppers) 39 | set smartcase "scs 40 | 41 | " enable backspace in insert mode 42 | set backspace=2 "bs 43 | 44 | " file formats priority when try to read a file 45 | set fileformats=unix,dos,mac "ffs 46 | 47 | " indicates a fast terminal connection 48 | set ttyfast "tf 49 | 50 | " don't redrawnscreen while executing macros, registers and other commands 51 | set lazyredraw "lz 52 | 53 | " enable window title 54 | set title 55 | 56 | " Increase the max tab pages to be opened 57 | set tabpagemax=30 "tpm 58 | 59 | " set windows title back to path instead of default 'Thanks for Flying Vim' 60 | let &titleold=getcwd() 61 | 62 | " set statusbar 63 | set statusline+=%f "filename 64 | set statusline+=%m "modified flag 65 | set statusline+=%r "read only flag 66 | set statusline+=\ \%y "filetype 67 | set statusline+=%= "left/right separator 68 | set statusline+=%#warningmsg# "show the errors/warning in the status line 69 | set statusline+=%h "help file flag 70 | set statusline+=%* "color off 71 | set statusline+=\ [%{&ff}\]\ "fileformat (unix, dos, mac ...) 72 | set statusline+=%=%{\"[\".(&fenc==\"\"?&enc:&fenc).((exists(\"+bomb\")\ &&\ &bomb)?\",B\":\"\").\"]\ \"} "file charset 73 | set statusline+=[%l,%c] "cursor line,column 74 | set statusline+=\ \[%L\ lines\] "total lines 75 | set statusline+=\ [%P] "percent through file 76 | set statusline+=\ %a "if open multiple files, show current file and and the number of all files 77 | 78 | " display a status line at the bottom of the window 79 | set laststatus=2 "ls 80 | 81 | " show as much as possible of the last line, instead of '@' symbol 82 | set display+=lastline 83 | 84 | " set code folding feature 85 | set foldmethod=indent "fdm 86 | set foldnestmax=5 "fdn max fold level 87 | set foldlevel=5 "fdl default fold level 88 | 89 | " set scroll offset(the min number of lines above and below cursor) to 2 90 | set scrolloff=2 "so 91 | 92 | " enable mouse in all mode 93 | " set mouse=a 94 | 95 | " hichlight current line 96 | set cursorline 97 | 98 | " highlight syntax 99 | syntax on 100 | 101 | " color scheme 102 | colorscheme kolor 103 | 104 | " make whitespaces and TABs visible 105 | "l 106 | set list 107 | "lcs 108 | set listchars=tab:>-,trail:· 109 | highlight SpecialKey guifg=DarkGray 110 | 111 | " set temp dirs, can speedup 100x when working on fuse via internet or nfs 112 | "set backupdir=~/.vim/bak/ 113 | "set directory=~/.vim/swp/ 114 | "set undodir=~/.vim/undo/ 115 | 116 | " map hot key +m to switch paste mode 117 | map :set paste!set paste? 118 | " map hot key +n to switch if shows line numbers 119 | map :set nu!set nu? 120 | " map hot key +h to switch if highlights current working column 121 | map :set cursorcolumn!set cursorcolumn? 122 | " map hot key +h to switch if highlights current working line 123 | map :set cursorline!set cursorline? 124 | 125 | " map tab / shift-tab to add/remove indent in normal & visual modes 126 | nmap v> 127 | nmap v< 128 | vmap >gv 129 | vmap :w :make 133 | " map F10 to execute filename(without ext.) as external command (usually for c & cpp) 134 | map :!./%< 135 | " map F11 = F9 + F10 136 | map :w :make :!./%< 137 | 138 | "=== manually setting filetype ===" 139 | " au, autocommand 140 | autocmd BufRead,BufNewFile *.cpp set filetype=cpp 141 | autocmd BufRead,BufNewFile *.plt set filetype=gnuplot 142 | autocmd BufRead,BufNewFile *.md set filetype=markdown 143 | autocmd BufRead,BufNewFile named.conf* set filetype=named 144 | autocmd BufRead,BufNewFile *.pac set filetype=javascript 145 | autocmd BufRead,BufNewFile .php_cs,.php_cs.dist set filetype=php 146 | autocmd BufRead,BufNewFile Dockerfile* set filetype=dockerfile 147 | 148 | "=== setting depends on filetype ===" 149 | " au, autocommand 150 | autocmd FileType make,gitconfig,gitcommit,apache,dockerfile,go setlocal et! 151 | autocmd FileType gitcommit setlocal cc=50,72 | setlocal textwidth=72 | highlight ColorColumn ctermbg=cyan 152 | autocmd FileType html,css,javascript,yaml,json,typescript setlocal sw=2 ts=2 153 | autocmd FileType fstab setlocal sw=8 ts=8 154 | 155 | " set makeprg(depends on filetype) if makefile is not exist 156 | if !filereadable('makefile') && !filereadable('Makefile') 157 | autocmd FileType c setlocal makeprg=gcc\ %\ -o\ %< 158 | autocmd FileType cpp setlocal makeprg=g++\ %\ -o\ %< 159 | autocmd FileType sh setlocal makeprg=bash\ -n\ % 160 | autocmd FileType php setlocal makeprg=php\ -l\ % 161 | endif 162 | 163 | " set Netrw's default style to tree style listing 164 | let g:netrw_liststyle=3 165 | 166 | "=== IF YOU WANT TO USE THE FOLLOWING FEATURE, PLEASE UNCOMMENT IT BY YOURSELF ===" 167 | 168 | " remember and go to the last used location automatically. 169 | "autocmd BufReadPost * if line("'\"") > 0|if line("'\"") <= line("$")|exe("norm '\"")|else|exe "norm $"|endif|endif 170 | 171 | " auto remove trailing whitespace when saving file 172 | "autocmd BufWritePre * :%s/\s\+$//e 173 | -------------------------------------------------------------------------------- /w3mconfig: -------------------------------------------------------------------------------- 1 | visited_color magenta 2 | visited_anchor 1 3 | active_color cyan 4 | active_style 1 5 | bg_color terminal 6 | mark_color cyan 7 | form_color red 8 | image_color green 9 | anchor_color cyan 10 | basic_color terminal 11 | color 1 12 | user_agent Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:128.0) Gecko/20100101 Firefox/128.0 13 | -------------------------------------------------------------------------------- /wgetrc: -------------------------------------------------------------------------------- 1 | robots = off 2 | no_parent = on 3 | recursive = off 4 | timestamping = on 5 | adjust_extension = on 6 | user_agent = Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:128.0) Gecko/20100101 Firefox/128.0 7 | 8 | tries = 5 9 | timeout = 30 10 | waitretry = 5 11 | retry_connrefused = on 12 | -------------------------------------------------------------------------------- /xinputrc: -------------------------------------------------------------------------------- 1 | #run_im gcin 2 | #run_im fcitx 3 | -------------------------------------------------------------------------------- /zshrc: -------------------------------------------------------------------------------- 1 | 2 | #load script 3 | fpath=(~/ $fpath) 4 | 5 | #unalias all the alias(es) before set anything 6 | unalias -m "*" 7 | 8 | #default charset and language 9 | LANG='en_US.UTF-8' 10 | LC_ALL='en_US.UTF-8' 11 | 12 | #set default editor 13 | export EDITOR='vim' 14 | 15 | #GPG passphrase input workaround 16 | export GPG_TTY=`tty` 17 | 18 | #tmux color issue 19 | alias tmux='\tmux -2' 20 | 21 | #uniq unicode issue 22 | alias uniq='LC_ALL=C uniq' 23 | 24 | ## Completions 25 | autoload -U compinit 26 | compinit -C 27 | 28 | ## case-insensitive (all),partial-word and then substring completion 29 | zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z}' \ 30 | 'r:|[._-]=* r:|=*' 'l:|=* r:|=*' 31 | 32 | ###alias### 33 | 34 | #ls 35 | alias l='ls -C' 36 | alias ll='ls -lh' 37 | alias la='ls -A' 38 | alias lal='ls -lha' 39 | 40 | #grep 41 | alias g='\grep --color=auto' 42 | alias grep='\grep --color=auto' 43 | alias fgrep='\fgrep --color=auto' 44 | alias egrep='\egrep --color=auto' 45 | 46 | #network tool 47 | alias p='ping' 48 | alias n='nslookup' 49 | alias d='dig' 50 | alias t='mtr' 51 | alias ssh='ssh -v' 52 | 53 | #cd 54 | alias cd..='\cd ..' 55 | alias cd...='\cd ../..' 56 | alias ..='\cd ..' 57 | alias ...='\cd ../..' 58 | alias ....='\cd ../../..' 59 | alias .....='\cd ../../../..' 60 | 61 | #other alias 62 | alias c='clear' 63 | alias sudo='\sudo -E' 64 | alias less='\less -R' 65 | alias df='\df -hT' 66 | alias du='\du -h' 67 | alias free='\free -h' 68 | alias wgetncc='wget --no-check-certificate' 69 | alias last='\last | less' 70 | alias tree='\tree -C' 71 | alias optipng='\optipng -o7 -zm1-9 -preserve' 72 | 73 | ###alias### 74 | 75 | source ~/.colorEcho 76 | --------------------------------------------------------------------------------