技術分享教學

Mac Vim Nice Ui Setting

Mac Vim Nice Ui Setting

ctags 安裝

#要先確定安裝homebrew
brew install ctags
alias ctags="`brew --prefix`/bin/ctags"

update: ubuntu ctags

sudo apt-get install exuberant-ctags

 

安裝 vundle

git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim

 

設定.vimrc檔內容

set nocompatible
filetype off
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim

"-------------- PLUGINS STARTS -----------------
call vundle#begin()

Plugin 'VundleVim/Vundle.vim'
Plugin 'vim-airline/vim-airline'
Plugin 'vim-airline/vim-airline-themes'
Plugin 'altercation/vim-colors-solarized'
Plugin 'scrooloose/nerdtree'
Plugin 'jistr/vim-nerdtree-tabs'
Plugin 'scrooloose/syntastic'
Plugin 'xolox/vim-misc'
Plugin 'xolox/vim-easytags'
Plugin 'majutsushi/tagbar'
Plugin 'ctrlpvim/ctrlp.vim'
Plugin 'vim-scripts/a.vim'
Plugin 'airblade/vim-gitgutter'
Plugin 'tpope/vim-fugitive'
Plugin 'Raimondi/delimitMate'
Plugin 'christoomey/vim-tmux-navigator'
Plugin 'jez/vim-c0'
Plugin 'jez/vim-ispc'
Plugin 'kchmck/vim-coffee-script'
Plugin 'flazz/vim-colorschemes'

call vundle#end()
"-------------- PLUGINS END --------------------
filetype plugin indent on

" 檔案編碼
set encoding=utf-8
set fileencodings=utf-8,cp950

"----- GENERAL SETTINGS-------
set laststatus=2
let g:airline_powerline_fonts = 1
let g:airline_detect_paste=1
let g:airline#extensions#tabline#enabled = 1
let g:airline_theme='powerlineish'
let g:Tlist_Ctags_Cmd='/usr/local/bin/ctags'

let g:solarized_termcolors=256


"---------NERD-TREE SETTINGS----------
nmap <silent> <leader>t :NERDTreeTabsToggle<CR>
let g:nerdtree_tabs_open_on_console_startup = 1



" 編輯喜好設定
" set ai           " 自動縮排
set shiftwidth=4 " 設定縮排寬度 = 4
set tabstop=4    " tab 的字元數
set softtabstop=4
set expandtab   " 用 space 代替 tab
set t_Co=256
set ruler        " 顯示右下角設定值
set backspace=2  " 在 insert 也可用 backspace
set ic           " 設定搜尋忽略大小寫
set ru           " 第幾行第幾個字
set hlsearch     " 設定高亮度顯示搜尋結果
set incsearch    " 在關鍵字還沒完全輸入完畢前就顯示結果
set smartindent  " 設定 smartindent
set confirm      " 操作過程有衝突時,以明確的文字來詢問
set history=100  " 保留 100 個使用過的指令
set cursorline   " 顯示目前的游標位置
set laststatus=2
colorscheme molokai
syntax on
set guifont=Source\ Code\ Pro\ for\ Powerline:h16
set background=dark
vim +PluginInstall +qall

 

復制color theme 到正確位罝

mkdir ~/.vim/colors
cp -rf ~/.vim/bundle/vim-colorschemes/colors/* ~/.vim/colors

設定fonts

# clone
git clone https://github.com/powerline/fonts.git --depth=1
# install
cd fonts
./install.sh
# clean-up a bit
cd ..
rm -rf fonts

設定mac 中的iterm2或是term使用 powerline 字型

terminal set up text font

完成畫面

Mac Vim Nice Ui Setting result

參考連結

  1. https://github.com/VundleVim/Vundle.vim
  2. https://github.com/vim-airline/vim-airline
  3. https://github.com/powerline/fonts
  4. https://gist.github.com/nazgob/1570678