2019年11月8日 星期五

如果自己編譯出特定版本的vim

會有這樣的需求,主要是因為有時候現有的環境內所提供的套件是有bug的,
這時候我們就會想降版和升版。

這邊我拿這次因為在ubuntu18,感覺vim有無法回復之前狀態的bug,所以想要降版到7.4。

step 1:
移除現有套件,要小心/usr/bin底下的vim不是真正的執行檔,他只是一個softlink。
等到一步步找到真的執行檔,再執行sudo apt-get remove移除他。
參考下面連結

step 2:
安裝特定版本的vim,

1. 拉code
git clone https://github.com/vim/vim.git

2. 安裝必要編譯過程中必要套件
sudo apt-get install libncurses5-dev libgnome2-dev libgnomeui-dev \
libgtk2.0-dev libatk1.0-dev libbonoboui2-dev \
libcairo2-dev libx11-dev libxpm-dev libxt-dev python-dev \
python3-dev ruby-dev lua5.1 liblua5.1-dev libperl-dev git liblua5.1-dev

3. 在git內拉到想要的板本
git tag -l
 git checkout <tag_name> -b <local_brach>

4. 
./configure –with-features=huge \
–enable-multibyte \
–enable-rubyinterp=yes \
–enable-pythoninterp=yes \
–with-python-config-dir=/usr/lib/python2.7/config \ # pay attention here check directory correct
–enable-python3interp=yes \
–with-python3-config-dir=/usr/lib/python3.5/config \
–enable-perlinterp=yes \
–enable-luainterp=yes \
–enable-gui=gtk2 \
–enable-cscope \
–prefix=/usr/local
透過./configure 檢查完環境,如果沒有錯誤,最後就是下make

5. vim編出來,會在src/vim