好多人说OS X(其实指的是macbook)才是程序员的标配,其实我是一个坚实的Linux党,碍于国内的环境,用QQ的太多,所以只能以OS X作为一个解决方案了。

先说下我的基本开发工具部署吧,说明下,严重OCD晚期,所以尽可能的少用第三方软件。。。。

工具介绍:

1.开发工具:

Xcode, Android Studio,Vim

2.管理工具:

Neyong Compare,Sequel Pro,

3.必备工具:

ShadowsocksX,Virtual Box

4.实用工具:

CleanMyMac,Photoshop CC 2015,MplayerX(偶尔看看美剧www)

配置介绍:

1.Vim配置,自动添加标题,ASD分别是编译执行和分开的两个功能,如图吧:


2.终端配置,只能说不想用iTerm(OCD...)


3.各种运行环境,这个是重点。由于我的严重OCD,我的各种环境(PHP,Node.js,...)都是配置在Virtual Box中,然后共享了Public目录,虚拟机中用NFS开机挂载,然后就类似vagrant科科,主要便于管理。。。如图:


下面把我的 .vimrc 贴出来吧:

.vimrc:

set nocompatible
set nu
set noswapfile
set cursorline
set cindent
set backspace=2
set tabstop=4
set shiftwidth=4
set completeopt=menu

let Tlist_Show_One_File=1
let Tlist_Exit_OnlyWindow=1
let Tlist_Use_Right_Window=1
let Tlist_Auto_Open=0
let g:winManagerWindowLayout='FileExplorer|TagList'
let g:winManagerWidth=30

syntax on

autocmd BufNewFile,BufRead * exec ":call AddTitle()"



func! CompileGcc()
    w
    !clear && echo -e '\033[0;32;1m>>>编译结果:\033[0m' && gcc -Wall -g % -o %<
endfunc


func! CompileGpp()
    w
    !clear && echo -e '\033[0;32;1m>>>编译结果:\033[0m' && g++ -Wall -g % -o %<
endfunc


func! RunResultOfGNU()
    !clear && echo -e '\033[0;32;1m>>>运行结果:\033[0m' && ./%<
endfunc


func! RunPython()
    !clear && python %
endfunc


func! CompileJava()
    !clear && javac %
endfunc


func! CompileCode()
        w
        if &filetype == "cpp"
                call CompileGpp()
        elseif &filetype == "c"
                call CompileGcc()
        elseif &filetype == "python"
                call RunPython()
        elseif &filetype == "java"
                call CompileJava()
        endif
endfunc

func! BuildAll()
        w
        if &filetype == "cpp"
                exec "!clear && echo -e '\033[0;32;1m>>>编译结果:\033[0m' && g++ -Wall -lm -g % -o %< && echo -e '\033[0;32;1m>>>运行结果:\033[0m' && ./%<"
        elseif &filetype == "c"
                exec "!clear && echo -e '\033[0;32;1m>>>编译结果:\033[0m' && gcc -Wall -lm -g % -o %< && echo -e '\033[0;32;1m>>>运行结果:\033[0m' && ./%<"
        endif
endfunc


func! AddTitleA()
	if getline(1) != "/**" && getline(2) != "        Author: SpringHack - springhack@live.cn"
		if getline(1) != ""
			call append(0,"/**")
		else
			call setline(1,"/**")
		endif
		call append(1,"        Author: SpringHack - springhack@live.cn")
		call append(2,"        Last modified: ".strftime("%Y-%m-%d %H:%M:%S"))
		call append(3,"        Filename: ".expand("%"))
		call append(4,"        Description: Created by SpringHack using vim automatically.")
		call append(5,"**/")
	endif
	call setline(3,"        Last modified: ".strftime("%Y-%m-%d %H:%M:%S"))
	call setline(4,"        Filename: ".expand("%"))
endfunc

func! AddTitleB()
	if getline(1) != "<!--" && getline(2) != "        Author: SpringHack - springhack@live.cn"
		if getline(1) != ""
			call append(0,"<!--")
		else
			call setline(1,"<!--")
		endif
		call append(1,"        Author: SpringHack - springhack@live.cn")
		call append(2,"        Last modified: ".strftime("%Y-%m-%d %H:%M:%S"))
		call append(3,"        Filename: ".expand("%"))
		call append(4,"        Description: Created by SpringHack using vim automatically.")
		call append(5,"-->")
		call append(6,"<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">")
		call append(7,"<html xmlns=\"https://www.w3.org/1999/xhtml\">")
		call append(8,"	<head>")
		call append(9,"		<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />")
		call append(10,"		<title>Index</title>")
		call append(11,"	</head>")
		call append(12,"	<body>")
		call append(13,"	</body>")
		call append(14,"</html>")
	endif
	call setline(3,"        Last modified: ".strftime("%Y-%m-%d %H:%M:%S"))
	call setline(4,"        Filename: ".expand("%"))
endfunc

func! AddTitleC()
	if getline(1) != "<?php /**" && getline(2) != "        Author: SpringHack - springhack@live.cn"
		if getline(1) != ""
			call append(0,"<?php /**")
		else
			call setline(1,"<?php /**")
		endif
		call append(1,"        Author: SpringHack - springhack@live.cn")
		call append(2,"        Last modified: ".strftime("%Y-%m-%d %H:%M:%S"))
		call append(3,"        Filename: ".expand("%"))
		call append(4,"        Description: Created by SpringHack using vim automatically.")
		call append(5,"**/ ?>")
	endif
	call setline(3,"        Last modified: ".strftime("%Y-%m-%d %H:%M:%S"))
	call setline(4,"        Filename: ".expand("%"))
endfunc

func! AddTitle()
	let setA = ["h","c","cpp","js","css","java"]
	let setB = ["htm","html"]
	for i in range(1,len(setA))
		if &filetype == get(setA,i-1)
			call AddTitleA()
		endif
	endfor
	for i in range(1,len(setB))
		if &filetype == get(setB,i-1)
			call AddTitleB()
		endif
	endfor
	if &filetype == "php"
		call AddTitleC()
	endif
	w
endfunc

command A :call BuildAll()

command S :call CompileCode()

command D :call RunResultOfGNU()

还有,友人要这个,FBI.sh,内容放倒 .bash_profile 就OK了0.0:

.bash_profile

# ~/.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:/sbin:/usr/sbin:/Users/SpringHack/Library/Android/sdk/platform-tools:/Users/SpringHack/Library/Android/ndk

# 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
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 ls='ls -G'
alias ll='ls -lG'
alias la='ls -AG'
alias l='ls -CFG'

# 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
#!/bin/bash

#Functions define
function center()
{
	_STR=$1
	LEN=`echo $_STR | wc -c`
	COLS=`tput cols`
	HOLD_COL=`expr $COLS - $LEN`
	NEW_COL=`expr $HOLD_COL / 2`
	blank $NEW_COL
	echo -ne $_STR
	blank `expr $COLS - $NEW_COL - $LEN + 1`
	echo
}

function center_2()
{
	_STR=$1
	LEN=`echo $_STR | wc -c`
	COLS=`tput cols`
	HOLD_COL=`expr $COLS - $LEN`
	NEW_COL=`expr $HOLD_COL / 2`
	blank $NEW_COL
	echo -ne $2
	echo -ne "\033[40;37m"
	blank `expr $COLS - $NEW_COL - $LEN + 1`
	echo
}

function blank()
{
	NUMS=$1
	for ((i=1;i<=$NUMS;i=$i+1))
	do
		echo -n " "
	done
}

#Start show background 
echo -ne "\033[40;37m"
blank `tput cols`

#Start show title
center_2 "FBI Warning" "\033[41;37;1mFBI Warning\033[0m"
echo -ne "\033[40;37m"

#Start show content
center "Federal Law provides severe civil and criminal penalties for"
center "the unauthorized reproduction,distribution ,or exhibition of"
center "copyrighted motion pictures (Title 17, United states Code,"
center "Sections 501 and 508). The Federal Bureau of investigation"
center "investigates allegations of criminal copyright infringement"
center "(Ttitle 17, United States Code, Section 506)."
blank `tput cols`
echo -e "\033[0m"