Setup Development Environment on Mac OS for Vim and Git
1. For mac os x
/.bash_profile
if
[ -f ~/.prompt ]; then
. ~/.prompt
fi
2. Enable git prompt
/.prompt
#
add git prompt
function parse_git_branch {
git branch --no-color 2>
/dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/'
}
function
proml {
local BLUE="\[\033[0;34m\]"
local LBLUE="\[\033[1;34m\]"
local RED="\[\033[0;31m\]"
local LRED="\[\033[1;31m\]"
local GREEN="\[\033[0;32m\]"
local
LGREEN="\[\033[1;32m\]"
local
WHITE="\[\033[1;37m\]"
local LGRAY="\[\033[0;37m\]"
local
YELLOW="\[\033[0;33m\]"
local
LYELLOW="\[\033[1;33m\]"
case
$TERM in
xterm*)
TITLEBAR='\[\033]0;\u@\h:\w\007\]'
;;
*)
TITLEBAR=""
;;
esac
PS1="${TITLEBAR}\
$LGRAY[$LRED\$(date +%H:%M)$LGRAY]\
$LGRAY[$LYELLOW\u@\h: $LBLUE\w $LGREEN\$(parse_git_branch)$LGRAY]\
$WHITE \$ $LGRAY"
PS2='> '
PS4='+ '
}
proml
3. Setup
Vundle:
$ git clone https://github.com/VundleVim/Vundle.vim.git
~/.vim/bundle/Vundle.vim
Ref:
GitHub
VundleVim/Vundle.vim
Vundle.vim -
Vundle, the plug-in manager for Vim
4. /.vimrc
```
set
nocompatible " be
iMproved, required
filetype
off " required
" set the
runtime path to include Vundle and initialize
set
rtp+=~/.vim/bundle/Vundle.vim/
call
vundle#begin()
Plugin
'gmarik/Vundle.vim'
Plugin
'Lokaltog/vim-easymotion'
Plugin
'Lokaltog/vim-powerline'
Plugin
'tpope/vim-fugitive'
Plugin
'mileszs/ack.vim'
Plugin
'hrp/EnhancedCommentify'
Plugin
'greyblake/vim-preview'
Plugin
'mattn/emmet-vim'
Plugin
'Valloric/YouCompleteMe'
Plugin
'vim-scripts/indentpython.vim'
Plugin
'nvie/vim-flake8'
Plugin
'scrooloose/syntastic'
Plugin
'fatih/vim-go'
call
vundle#end()
set
laststatus=2
set t_Co=256
let
g:Powline_symbols='fancy'
let
python_highlight_all=1
let
g:EasyMotion_leader_key=','
let
g:go_def_mapping_enabled = 1
filetype
plugin indent on
set
backspace=2
set sw=4
set ts=4
set et
set hls
set autoindent
set nu
set
nofoldenable
au
BufNewFile,BufRead *.py
\ set tabstop=4 |
\ set softtabstop=4 |
\ set shiftwidth=4 |
\ set textwidth=79 |
\ set expandtab |
\ set autoindent |
\ set fileformat=unix
syntax on
syntax enable
match Error
/\s\+$/
```
5. Install
Vundle
Open vim and :
jump to command line then type: VundleInstall
Tip: how to
auto correct indent
- Type
"v"
- Up or down select
section
- Type "="
. ~/.prompt
fi
function parse_git_branch {
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/'
}
local BLUE="\[\033[0;34m\]"
local LBLUE="\[\033[1;34m\]"
local RED="\[\033[0;31m\]"
local LRED="\[\033[1;31m\]"
local GREEN="\[\033[0;32m\]"
local LGREEN="\[\033[1;32m\]"
local WHITE="\[\033[1;37m\]"
local LGRAY="\[\033[0;37m\]"
local YELLOW="\[\033[0;33m\]"
local LYELLOW="\[\033[1;33m\]"
xterm*)
TITLEBAR='\[\033]0;\u@\h:\w\007\]'
;;
*)
TITLEBAR=""
;;
esac
$LGRAY[$LRED\$(date +%H:%M)$LGRAY]\
$LGRAY[$LYELLOW\u@\h: $LBLUE\w $LGREEN\$(parse_git_branch)$LGRAY]\
$WHITE \$ $LGRAY"
PS2='> '
PS4='+ '
}
proml