要額外安裝 vim-syntax-go 套件,並做些許設定
詳細步驟如下:
1、安裝 vim & vim-syntax-go
2、找到 go.vim 檔案 (在我的電腦裡是在 /usr/share/vim/addons/syntax 目錄中),並放到 ~/.vim/syntax 目錄中
3、編輯 ~/.vim/ftdetect/go.vim 檔案,並輸入以下內容
au BufRead,BufNewFile *.go set filetype=go
4、編輯 ~/.vimrc 檔案,輸入以下內容
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" size of a hard tabstop | |
set tabstop=4 | |
" size of an "indent" | |
set shiftwidth=4 | |
" a combination of spaces and tabs are used to simulate tab stops at a width | |
" other than the (hard)tabstop | |
set softtabstop=4 | |
set rtp+=/usr/share/vim/addons | |
filetype plugin indent on | |
syntax on |
最後登出再登入就完工囉!
沒有留言:
張貼留言