Skip to content

Instantly share code, notes, and snippets.

@eu81273
Last active November 2, 2023 06:51
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save eu81273/d6f1038495492f31a564 to your computer and use it in GitHub Desktop.
Save eu81273/d6f1038495492f31a564 to your computer and use it in GitHub Desktop.
Tig 모든 기본 설정 + 커스텀
# Tig 기본 설정
# 'man tigrc' 를 커맨드라인에서 입력하면 전체 매뉴얼을 볼 수 있다.
# 매뉴얼 한글 번역 http://ujuc.github.io/2016/02/10/tig-manual/
# 설정
# --------
# 여기에 있는 대부분의 설정들은 toggle-* 이나 옵션 메뉴(기본값은 'o' 키)를 통해 토글할 수 있다.
# 뷰 설정
#
# 지원되는 컬럼 유형과 옵션들:
#
# author
# ㄴdisplay (enum) [no|full|abbreviated|email|email-user] : 작성자 정보를 표시하는가?
# (예: author:display=full)
#
# commit-title
# ㄴ display (bool) : 커밋 타이틀 표시하는가?
# ㄴ graph (enum) [no|v2|v1] : 커밋 그래프를 보여주는가? (main view만 해당, 낮은 버전은 yes/no)
# ㄴ refs (bool) : 브랜치와 태그, 리모트를 보여주는가? (main view만 해당)
# ㄴ overflow (boolint) : 넘치는 부분에 대해 하이라이팅하는가? 활성화하면 기본값은 50이다.
# (예: commit-title:display=yes,graph=yes,refs=yes,overflow=no)
#
# date
# ㄴ display (enum) [no|default|local|relative|short] : 날짜를 보여주는가?
# (예: date:display=default)
#
# file-name
# ㄴ display (enum) [no|always|auto] : 파일명을 보여주는가?
# (예: file-name:display=auto)
#
# file-size
# ㄴ display (enum) [no|default|units] : 파일 사이즈를 보여주는가?
# (예: file-size:display=default)
#
# id
# ㄴ display (bool) : commit/tree ID를 보여주는가?
# (예: id:display=yes)
#
# line-number
# ㄴ display (bool) : 줄번호를 표시하는가?
# ㄴ interval (int) : 줄번호 표시 간격. 기본값은 5
# (예: line-number:display=yes,interval=5)
#
# mode
# ㄴ display (bool) : 파일 모드를 표시하는가?
# (예: mode:display=yes)
#
# status
# ㄴ display (enum) [no|short|long] : status label을 표시하는가?
# (예: status:display=long)
#
# text
# ㄴ display (bool) : 텍스트를 표시하는가?
# ㄴ commit-title-overflow (boolint) : log view 및 diff view 에서 넘치는 부분을 하이라이팅하는가?
# (예: text:display=yes)
#
# 모든 컬럼들은 최대 너비를 설정하기위한 width 옵션을 지원한다. 0으로 설정하면 사이즈를 자동으로 조절한다.
set blame-view = date:default author:display=email-user file-name:auto id:yes,color line-number:no,interval=5 text:display=yes
set grep-view = file-name:no line-number:yes,interval=1 text:display=yes
set main-view = line-number:no,interval=5 id:display=yes,width=10 date:display=relative author:display=email-user commit-title:display=yes,graph=yes,refs=yes,overflow=no
set refs-view = date:display=relative author:display=email-user ref commit-title:display=yes
set stash-view = line-number:no,interval=5 id:no date:default author:display=email-user commit-title:display=yes
set status-view = line-number:no,interval=5 status:display=long file-name:display=always
set tree-view = line-number:no,interval=5 mode author:display=email-user file-size date:default id:no file-name:display=always
# 페이저 기반 뷰들
set pager-view = line-number:no,interval=5 text
set stage-view = line-number:no,interval=5 text
set log-view = line-number:no,interval=5 text
set blob-view = line-number:no,interval=5 text
set diff-view = line-number:no,interval=5 text:yes,commit-title-overflow=no
# UI 표시 설정
set show-changes = yes # 메인 뷰에서 커밋들의 변경사항들을 표시하는가?
set wrap-lines = no # 페이저 기반 뷰에서 긴 줄을 감싸는가?
set tab-size = 4 # 탭을 확장할 때 몇 개의 공백을 사용하는가?
set line-graphics = utf-8 # 그래프 표시방법 -> ascii, default, utf-8
set truncation-delimiter = utf-8 # width 속성으로 글자를 자를 때 표시할 기호
# 타입 기반 레퍼런스명 포맷
# ㄴ head : 현재 HEAD.
# ㄴ tag : 서명된 태그.
# ㄴ local-tag : 서명되지 않은 태그.
# ㄴ remote : 리모트.
# ㄴ tracked-remote : 현재 HEAD에 트랙되고 있는 리모트
# ㄴ replace : 교체된 레퍼런스
# ㄴ branch : 다른 레퍼런스.
#
# 만약 local-tag 를 위한 포맷이 정의되지 않으면 tag 가 사용된다.
# 유사하게, tracked-remote 포맷이 없으면 remote 가 사용된다.
# 레퍼런스 타입을 보여주지 않으려면 hide:remote 과 같이 hide: 프리픽스를 사용하면 된다.
# 포맷 문자열의 리스트 구분은 스페이스(공백)으로 한다.
set reference-format = [branch] <tag> {remote} ~replace~
# Git으로 부터 어떻게 정보를 읽을지를 조절하는 설정들
set commit-order = auto # Enum: auto, default, topo, date, reverse (main view)
set status-show-untracked-dirs = yes # 트래킹하고 있지 않은 디렉토리의 파일들도 보여주는가? (status)
set ignore-space = no # Enum: no, all, some, at-eol (diff)
set show-notes = yes # `--show-notes=...` 를 전달하는가? (diff)
set diff-context = 6 # diff changes 를 보여줄 때 라인 수 (diff)
#set diff-options = -C # `tig show` 명령을 위한 사용자 정의 옵션 (git-diff)
#set blame-options = -C -C -C # `tig blame` 명령을 위한 사용자 정의 옵션 (git-blame)
#set log-options = --pretty=raw # `tig log` 명령을 위한 사용자 정의 옵션 (git-log)
#set main-options = -n 1000 # `tig` 명령을 위한 사용자 정의 옵션 (git-log)
#set mailmap = yes # 캐노니컬 이름과 이메일 주소를 보여주기 위해 .mailmap 를 사용하는가?
# Misc
set refresh-mode = after-command # Enum: manual, auto, after-command, periodic
set refresh-interval = 1 # 리프레시 주기 (초)
set ignore-case = yes # 검색시 대소문자를 무시하는가?
# set wrap-search = yes # 검색시에 화면의 위 아래를 감싸는가?
set focus-child = yes # 하위 화면이 열리면 포커스를 이동하는가?
set horizontal-scroll = 50% # 스크롤하기 위한 컬럼 수의 가로 너비 비율
set split-view-height = 70% # 위아래로 화면을 나눌 때, 아래쪽 화면의 높이
# set split-view-width = 50% # Width of right-most view for vertical splits
set vertical-split = vertical # Enum: horizontal, vertical, auto; 가로 너비가 허용되면 좌우 분할로 자동 변경되게 하려면 auto 를 사용한다.
set editor-line-number = yes # 에디터에 라인 번호를 자동으로 넘기는가? diff 등에서 해당 라인 위치까지 바로 이동하고 싶을 때 사용한다.
set mouse = no # 마우스를 사용하도록 하는가?
set mouse-scroll = 3 # 마우스로 스크롤할 때 한번에 넘길 라인수
# 사용자 정의 커맨드 (가장 유용한 부분)
# -----------------------------------
#
# 이 커맨드들은 Tig 안에서 바로 쉘 커맨드를 실행할 수 있게 해준다.
# 별도의 규정이 없는 한, 커맨드들은 포어그라운드에서 실행되어 콘솔 출력을 함께 보여준다.
# 여러개의 커맨드 옵션들을 지정할 수도 있는데, 예를 들어 "?<git commit" 와 같은 경우 실행할 지를 사용자에게 묻고 난 후,
# 실행이 끝나면 Tig 를 종료시킬 것이다. (? 는 묻는 것이고, < 는 종료이므로..)
#
# ! 기본값으로, 커맨드를 포어그라운드에서 실행하고 결과를 보여준다.
# @ 커맨드를 백그라운드에서 실행하고 결과도 보여주지 않는다.
# ? 커맨드를 실행하기 전에 사용자에게 실행할지를 묻는다.
# < 커맨드 실행을 마치면 Tig를 종료한다.
#
#
# 사용자 정의 커맨드를 실행할 키를 바인드할 때는 "bind 키를-바인드할-화면 바인드할-키 커맨드" 의 순서로 선언하게 된다.
# 키를 바인드할 화면은 main, diff, log, tree, blob, blame, refs, pager, help, status, stage, stash, grep 이 있고,
# 모든 화면에서 바인드할 경우, generic 을 화면명으로 지정하면 된다.
# 바인드할 키는 대소문자, <C-D>, ^d, <Down> 등으로 표기한다.
# 사용 가능한 키 바인딩:
# <Enter>, <Space>, <Backspace>, <Tab>, <Escape> 또는 <Esc>, <Left>, <Right>, <Up>, <Down>, <Insert> 또는 <Ins>,
# <Delete> 또는 <Del>, <Hash>, <LessThan> 또는 <LT>, <Home>, <End>, <PageUp> 또는 <PgUp>, <PageDown> 또는 <PgDown>,
# <F1>, <F2>, <F3>, <F4>, <F5>, <F6>, <F7>, <F8>, <F9>, <F10>, <F11>, <F12>
#
# 사용자 정의 커맨드는 Tig의 내부 상태값을 옵션으로 참조할 수 있는데, 아래와 같은 값들이 존재한다.
#
# %(head) : 현재 ref ID. 기본값은 HEAD.
# %(commit) : 현재 커밋 ID
# %(blob) : 현재 blob ID.
# %(branch) : 현재 브랜치명.
# %(remote) : 현재 리모트명.
# %(tag) : 현재 태그명.
# %(stash) : 현재 스태시(stash)명.
# %(directory) : tree view 에서의 현재 디렉토리 경로. 비어있으면 루트 디렉토리.
# %(file) : 현재 선택된 파일.
# %(ref) : The reference given to blame or HEAD if undefined.
# %(revargs) : The revision arguments passed on the command line.
# %(fileargs) : The file arguments passed on the command line.
# %(cmdlineargs) : All other options passed on the command line.
# %(diffargs) : The diff options from `diff-options` or `TIG_DIFF_OPTS`
# %(prompt) : 인자값을 입력받기 위한 프롬프트.
bind main C ?git cherry-pick %(commit) # 체리픽 (해당 커밋을 현재 브랜치에 새로 커밋)
bind main <Hash> !@bash -c "echo -n %(commit) | pbcopy" # 현재 커밋의 해시를 복사
bind main <C-R> ?git reset --hard %(commit) # 현재 커밋의 해시까지 리셋
bind main R ?git rebase -i %(commit) # 커밋의 순서를 재정렬하고 첨삭
bind main ! ?git rebase --abort # 리베이스를 취소
bind main U ?git rebase --continue # 리베이스 계속
bind main <C-L> ?git pull --autostash --rebase %(remote) %(branch) # 리모트의 현재 브랜치에서 변경사항 가져오기
bind main L ?git pull --rebase %(remote) "%(prompt Branch name to pull : )" # 리모트에서 변경사항 가져오기
# bind main P ?git push %(remote) "%(prompt Branch name to push : )" # 리모트에 변경사항 커밋
bind main <C-P> ?git push %(remote) %(branch) # 리모트 현재 브랜치에 변경사항 커밋
# bind main <C-P> ?git push --force %(remote) "%(prompt Branch name to +push : )" # 리모트에 변경사항 커밋
bind main T !git tag "%(prompt Tag name : )" %(commit) # 해당 커밋에 태그 추가
bind main <C-T> ?git push %(remote) %(tag) # 리모트에 현재 태그 커밋
bind main B ?git checkout -b "%(prompt Branch name to create : )" # 입력한 브랜치 생성하고 체크아웃하기
bind status C !git commit # 스테이지(인덱스)에 올라간 파일 로컬에 커밋하기
bind status S ?git stash save --keep-index "%(prompt Stash name : )" # 스테이지 올라가지 않은 파일 스테시에 올리기
bind stash P ?git stash pop %(stash) # 스테시에서 꺼내오기
bind stash ! ?git stash drop %(stash) # 스테시 초기화하기
bind refs C ?git checkout %(branch) # 선택한 브랜치 체크아웃하기
bind refs B ?git branch "%(prompt Branch name to create : )" # 입력한 브랜치 생성하고 체크아웃하기
bind refs ! ?git branch -D %(branch) # 선택한 브랜치 삭제하기
# 기본 커맨드
# ---------------
# 화면 전환 키 설정
bind generic m view-main
bind generic d view-diff
bind generic l view-log
bind generic t view-tree
bind generic f view-blob
bind generic b view-blame
bind generic r view-refs
bind generic p view-pager
bind generic h view-help
bind generic s view-status
# bind generic S view-status
bind generic c view-stage
# bind generic y view-stash
bind generic y none # 기본 키바인딩을 제거
bind generic S view-stash
bind generic g view-grep
# 화면 조작 키 설정
bind generic <Enter> enter # 선택된 엔트리를 열거나 들어간다.
bind generic <Down> next # 다음으로 이동한다.
# bind generic <C-N> next
# bind generic J next
bind generic <Up> previous # 이전으로 이동한다.
# bind generic <C-P> previous
# bind generic K previous
# bind generic , parent
bind generic <Tab> view-next # 다음 뷰로 포커서를 이동
# bind generic R refresh
bind generic <F5> refresh # 화면 리프레시
bind generic O maximize # 현재 화면을 전체화면으로 본다.
bind generic q view-close # 현재 화면을 닫는다.
bind generic Q quit # 모든 화면을 닫고 종료한다.
bind generic <C-N> none # 기존 바인딩 제거
bind generic J none # 기존 바인딩 제거
bind generic <C-P> none # 기존 바인딩 제거
bind generic K none # 기존 바인딩 제거
bind generic , none # 기존 바인딩 제거
bind generic R none # 기존 바인딩 제거
bind generic <LT> none # 기존 바인딩 제거
# 커서 및 방향 키 설정
# bind generic j move-down
# bind generic k move-up
#bind generic 키값 move-half-page-down
#bind generic 키값 move-half-page-up
bind generic <PgDown> move-page-down
bind generic <C-D> move-page-down
bind generic <Space> move-page-down
bind generic <PgUp> move-page-up
bind generic <C-U> move-page-up
bind generic - move-page-up
bind generic <Home> move-first-line
bind generic <End> move-last-line
bind generic j none # 기존 바인딩 제거
bind generic k none # 기존 바인딩 제거
# 스크롤 관련 키 설정
bind generic | scroll-first-col
bind generic <Left> scroll-left
bind generic <Right> scroll-right
bind generic <Ins> scroll-line-up
# bind generic <C-Y> scroll-line-up
bind generic <Del> scroll-line-down
# bind generic <C-E> scroll-line-down
bind generic <SBack> scroll-page-up
bind generic <SFwd> scroll-page-down
# 검색 관련 키 설정
bind generic / search
# bind generic 키값 search-back
# bind generic n find-next
# bind generic N find-prev
bind generic . find-next
bind generic , find-prev
# 검색 중 사용되는 네이게이션 키 설정
# bind search <Down> find-next
# bind search <C-N> find-next
# bind search <C-J> find-next
# bind search <Up> find-prev
# bind search <C-P> find-prev
# bind search <C-K> find-prev
# 옵션 조작 키 설정
bind generic o options # 옵션 메뉴 열기
# 옵션을 쉽게 끄고 켜기 위한 키 바인딩
bind generic I :toggle sort-order # 오름차순/내림차순
bind generic i :toggle sort-field # 정렬 기준 필드
bind generic <Hash> :toggle line-number # 줄번호
bind generic D :toggle date # 날짜
bind generic A :toggle author # 저작자
bind generic ~ :toggle line-graphics # 그래픽 모드
bind generic F :toggle file-name # 이름
# bind generic 키값 :toogle show-changes # 로컬 변경사항 표시
bind generic W :toggle ignore-space # diff 화면에서 공백 무시
# bind generic 키값 :toggle commit-order # 커밋 순서 정렬
bind generic X :toggle id # 커밋 ID 표시
bind generic $ :toggle commit-title-overflow # 커밋 제목 넘침 하이라이팅
# bind generic 키값 :toggle file-size # 파일 크기 형식
# bind generic 키값 :toggle status # 상태 표시
# bind generic 키값 :toggle status-untracked-dirs # 트래킹하지 않는 디렉토리의 파일 표시
# bind generic 키값 :toggle vertical-split # 좌우로 창 나누기
bind generic % :toggle file-filter
# 기타 키 설정
bind generic e edit # 에디터로 편집한다.
bind generic : prompt # 프롬프트를 연다.
bind generic <C-L> screen-redraw # 화면을 다시 그린다.
bind generic z stop-loading # 로딩을 중단한다.
bind generic v show-version # Tig 버전을 표시한다.
# 화면별 키 설정
bind status u status-update # 파일을 인덱스에 추가/삭제한다.
bind status ! status-revert # 파일의 변경 사항을 Revert 한다.
bind status M status-merge # git-mergetool(1) 을 연다.
# bind status 키값 :toggle status # 짧은/긴 status label 을 표시한다.
bind stage u status-update # 변경 사항 chunk를 Stage/unstage 한다.
bind stage 1 stage-update-line # 변경 사항 중 현재 라인만 Stage/unstage 한다.
bind stage ! status-revert # 현재 변경사항 chunk를 원복한다.
bind stage \ stage-split-chunk # 현재 변경사항 chunk를 나눈다.
bind stage @ :/^@@ # 다음 변경 사항 chunk로 이동한다.
bind stage [ :toggle diff-context -1 # Diff 주변 라인들을 덜 보여준다.
bind stage ] :toggle diff-context +1 # Diff 주변 라인들을 더 보여준다.
bind stage <Down> move-down
bind stage <Up> move-up
bind diff @ :/^@@ # 다음 chunk로 점프한다.
bind diff [ :toggle diff-context -1
bind diff ] :toggle diff-context +1
bind diff <Down> move-down
bind diff <Up> move-up
bind blob <Down> move-down
bind blob <Up> move-up
bind main G :toggle commit-title-graph # Toggle revision graph visualization
bind main F :toggle commit-title-refs # Toggle reference display (tags/branches)
# 색상 설정
# ------
# UI 의 색상들도 변경가능하다. 게다가 pager, blob, diff, stage 화면 요소의 색상들도
# 큰 따옴표로 감싼 텍스트 매칭으로 찾아서 새로운 색으로 지정해줄 수 있다.
#
# 아래와 같이 설정하면 Signed-off-by 라는 문구가 있는 줄의 색상을 글자는 노란색,
# 배경은 기본색으로 지정하게 된다.
#
# color " Signed-off-by" yellow default
#
# 위에서 보면 처음에 네 칸의 공백을 두고 있는데, Git 에서 커밋 메시지에 자동으로
# 네 개의 공백을 추가하기 때문이다.
#
# 아래와 같이 화면의 이름을 프리픽스로 붙이면 해당 화면에만 해당하는 색상을 지정해줄 수 있다.
#
# color grep.file blue default
#
color "diff --" yellow default
color "--- " yellow default
color "+++ " yellow default
color "@@" magenta default
color "+" green default
color " +" green default
color "-" red default
color " -" red default
color "index " blue default
color "old file mode " yellow default
color "new file mode " yellow default
color "deleted file mode " yellow default
color "copy from " yellow default
color "copy to " yellow default
color "rename from " yellow default
color "rename to " yellow default
color "similarity " yellow default
color "dissimilarity " yellow default
color "diff-tree " blue default
color "Author: " cyan default
color "Commit: " magenta default
color "Tagger: " magenta default
color "Merge: " blue default
color "Date: " yellow default
color "AuthorDate: " yellow default
color "CommitDate: " yellow default
color "TaggerDate: " yellow default
color "Refs: " red default
color "Reflog: " red default
color "Reflog message: " yellow default
color "stash@{" magenta default
color "commit " green default
color "parent " blue default
color "tree " blue default
color "author " green default
color "committer " magenta default
color " Signed-off-by" yellow default
color " Acked-by" yellow default
color " Tested-by" yellow default
color " Reviewed-by" yellow default
color default default default normal
color cursor white green bold
color status green default
color delimiter magenta default
color date blue default
color mode cyan default
color id magenta default
color overflow red default
color header yellow default
color section cyan default
color directory yellow default
color file default default
color grep.file blue default
color file-size default default
color line-number cyan default
color title-blur white blue
color title-focus white blue bold
color main-commit default default
color main-tag magenta default bold
color main-local-tag magenta default
color main-remote yellow default
color main-replace cyan default
color main-tracked yellow default bold
color main-ref cyan default
color main-head cyan default bold
color stat-none default default
color stat-staged magenta default
color stat-unstaged magenta default
color stat-untracked magenta default
color help-group blue default
color help-action yellow default
color diff-stat blue default
color palette-0 magenta default
color palette-1 yellow default
color palette-2 cyan default
color palette-3 green default
color palette-4 default default
color palette-5 white default
color palette-6 red default
# color palette-7 magenta default bold
# color palette-8 yellow default bold
# color palette-9 cyan default bold
# color palette-10 green default bold
# color palette-11 default default bold
# color palette-12 white default bold
# color palette-13 red default bold
color graph-commit red default
# color search-result black yellow
# git configuration 으로부터 읽은 색상들 매핑. "no" 라고 설정하면 비활성화된다.
set git-colors = \
branch.current=main-head \
branch.local=main-ref \
branch.plain=main-ref \
branch.remote=main-remote \
\
diff.meta=diff-header \
diff.meta=diff-index \
diff.meta=diff-oldmode \
diff.meta=diff-newmode \
diff.frag=diff-chunk \
diff.old=diff-del \
diff.new=diff-add \
\
grep.filename=grep.file \
grep.linenumber=grep.line-number \
grep.separator=grep.delimiter \
\
status.branch=status.header \
status.added=stat-staged \
status.updated=stat-staged \
status.changed=stat-unstaged \
status.untracked=stat-untracked
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment