【tig】main-view 頁(yè)面增加 commitID 數(shù)據(jù)

問(wèn)題

在使用 tig 命令時(shí),默認(rèn)在 main-view 的界面中是沒(méi)有 commit-ID 數(shù)據(jù)的,只有選中某個(gè) commit 才會(huì)在底部出現(xiàn)當(dāng)條 commit 的 commit-ID,對(duì)于有時(shí)想一眼看清log的整體 commit-ID 信息很不方便。

默認(rèn) tig 的 main-view 界面如下:

F7319856E91A33F4B18888B368894617.jpg

main-view 配置

通過(guò)man tig,發(fā)現(xiàn) tig 是可以提供一個(gè) tigrc 配置文件的!

8D996816BFC8C33C175DD77B0A479461.jpg

有配置文件就應(yīng)該有對(duì)應(yīng)的配置, man 里提供的太少信息,網(wǎng)上找到設(shè)置的對(duì)應(yīng)網(wǎng)址說(shuō)明:
http://jonas.nitro.dk/tig/tigrc.5.html

里面說(shuō)的比較清楚,main-view 支持的 設(shè)置有:

  • author: 作者
  • date: 日期
  • commit-title: commit 信息
  • id: commit-ID
  • line-number: 行號(hào)

可以看出,我們需要配置的支持是 id,因此可以在 $HOME/.tigrc 里增加配置:

set main-view-id = yes,color

表示開(kāi)啟 commit-ID,同時(shí)開(kāi)啟顏色支持。打開(kāi) tig 效果如下:

81F6A90C8C2EB174BA200D1721B87998.jpg

但我希望能把 commit-ID 放到 commit 信息旁邊,所以需要重新配置 main-view 的顯示:

# 重設(shè) main-view,增加 commit Id 信息
set main-view = date:default author:abbreviated id:yes,color \
                line-number:no,interval=1 \
                commit-title:graph=v2,refs=yes,overflow=no

配置的參數(shù)意義,請(qǐng)參考 http://jonas.nitro.dk/tig/tigrc.5.html 里面的說(shuō)明。配置后顯示如下:

5D77DD2B6661102A79AB654C47B46A08.jpg

此時(shí)目的達(dá)到。

修改其他配置

tig 默認(rèn)的 tab-size 顯示是 8 個(gè)空格,如果修改的話,在 $HOME/.tigrc 中增加:

set tab-size = 4

界面的移動(dòng):

# 綁定一下常用操作
bind generic H scroll-left
bind generic L scroll-right

bind main    G move-last-line
bind generic G move-last-line
bind generic J move-page-down
bind generic K move-page-up
bind generic <C-f> move-page-down
bind generic <C-b> move-page-up

bind generic g  none
bind generic gg move-first-line
bind generic gj next
bind generic gk previous
bind generic gp parent
bind generic gP back
bind generic gn view-next

我的 $HOME/.tigrc 配置如下, GitHub 鏈接 【tigrc

#
# To use these keybindings copy the file to your HOME directory and include
# it from your ~/.tigrc file:
# 配置參考: http://jonas.nitro.dk/tig/tigrc.5.html

# 綁定一下常用操作
# bind generic j move-down
# bind generic k move-up
bind generic H scroll-left
bind generic L scroll-right

bind main    G move-last-line
bind generic G move-last-line
bind generic J move-page-down
bind generic K move-page-up
bind generic <C-f> move-page-down
bind generic <C-b> move-page-up

bind generic g  none
bind generic gg move-first-line
bind generic gj next
bind generic gk previous
bind generic gp parent
bind generic gP back
bind generic gn view-next

# 設(shè)置 tab-size 為 4,默認(rèn)為 8
set tab-size = 4

# 設(shè)置 blame-view 界面顯示
set blame-view-id = yes,color
set blame-view-line-number = yes,interval=1

# 重設(shè) main-view,增加 commit Id 信息
set main-view = date:default author:abbreviated id:yes,color \
                line-number:no,interval=1 \
                commit-title:graph=v2,refs=yes,overflow=no

# 重設(shè) tree-view 界面
set tree-view = date:default author:abbreviated id:yes,color \
                line-number:no,interval=5 \
                mode file-size:units,width=0 \
                file-name

關(guān)注 【https://github.com/bbxytl/b-dotfiles】 了解更多好用的配置。

?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書(shū)系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

  • Spring Cloud為開(kāi)發(fā)人員提供了快速構(gòu)建分布式系統(tǒng)中一些常見(jiàn)模式的工具(例如配置管理,服務(wù)發(fā)現(xiàn),斷路器,智...
    卡卡羅2017閱讀 136,534評(píng)論 19 139
  • Android 自定義View的各種姿勢(shì)1 Activity的顯示之ViewRootImpl詳解 Activity...
    passiontim閱讀 178,917評(píng)論 25 709
  • Spring Boot 參考指南 介紹 轉(zhuǎn)載自:https://www.gitbook.com/book/qbgb...
    毛宇鵬閱讀 47,261評(píng)論 6 342
  • 因?yàn)樵奶L(zhǎng)超出字?jǐn)?shù),Lesson 3 就放在另一篇文章里 How to Use Git and GitHub 標(biāo)...
    赤樂(lè)君閱讀 5,493評(píng)論 1 5
  • Xcode的快捷鍵 作用Cmd + Shift + O(O是字母) 快速查找類,即快速跳轉(zhuǎn)到指定類的源代碼...
    Skipper_1_422閱讀 616評(píng)論 0 0

友情鏈接更多精彩內(nèi)容