tool:使用github與neobundle管理vimrc
使用github與neobundle管理vimrc
0x00前言
vim是資訊人員很熟悉的編輯器,客製化的設定檔與plugin可以讓自己有個習慣的工作環境,除了舒適順手也提升了工作效率
然而在各機器之間,我們會希望能一致使用自己熟悉的vim設定
本篇利用NeoBundle管理vim plugin,並搭配github達到跨電腦、平台的同步設定
0x01安裝步驟
Step1.編寫vimrc,自動安裝NeoBundle
由於若是在不同機器使用vim每次都要先去git clone NeoBundle這個步驟有點麻煩,因此直接將他寫進vimrc,讓他在使用vim自動檢查NeoBundle,若不存在則安裝
let iCanHazNeoBundle=1
let neobundle_readme=expand('~/.vim/bundle/neobundle.vim/README.md')
if !filereadable(neobundle_readme)
echo "Installing NeoBundle.."
echo ""
silent !mkdir -p ~/.vim/bundle
silent !git clone https://github.com/Shougo/neobundle.vim ~/.vim/bundle/neobundle.vim
let iCanHazNeoBundle=0
endif
程式碼部分是去檢查neobundle.vim/README.md可不可讀,如果不行就去git clone NeoBundle,短短幾行可以省下每次去找repo clone的時間
這部分參考網路,從Vundle修正為NeoBundle的版本的
Step2.編寫vimrc,設定NeoBundle
" Note: Skip initialization for vim-tiny or vim-small.
if 0 | endif
if &compatible
set nocompatible " Be iMproved
endif
" Required:
set runtimepath^=~/.vim/bundle/neobundle.vim/
" Required:
call neobundle#begin(expand('~/.vim/bundle/'))
" Let NeoBundle manage NeoBundle
" Required:
NeoBundleFetch 'Shougo/neobundle.vim'
" My Bundles here:
" Refer to |:NeoBundle-examples|.
" Note: You don't set neobundle setting in .gvimrc!
call neobundle#end()
" Required:
filetype plugin indent on
" If there are uninstalled bundles found on startup,
" this will conveniently prompt you to install them.
NeoBundleCheck
在begin和end中間可以放入自己要用的plugin
格式為
NeoBundle 'githubauthor/repo'
Step3.安裝Plugin
開啟vim後,輸入
:NeoBundleInstall
就會自動安裝自己寫在.vimrc的套件了
若要查看目前套件可使用
:NeoBundleList
Step4.更新到github
git add . git commit -m "message" git push
git pull
0x02參考資料
tool/使用github與neobundle管理vimrc.txt · 上一次變更: 由 127.0.0.1
