Andrew Swistak 8 лет назад
Родитель
Сommit
1f50cb04bd

+ 2 - 0
bin/manage_dotfiles.sh

@@ -51,6 +51,8 @@ install_dotfiles() {
     'tmux.conf'
     'bashrc'
     'gitconfig'
+    'gitignore'
+    'git_template'
     'vim'
     'vimrc'
     'zshrc'

+ 8 - 0
git_template/hooks/ctags

@@ -0,0 +1,8 @@
+#!/bin/sh
+set -e
+PATH="/usr/local/bin:$PATH"
+dir="`git rev-parse --git-dir`"
+trap 'rm -f "$dir/$$.tags"' EXIT
+git ls-files | \
+  ctags --tag-relative=yes -L - -f"$dir/$$.tags" --languages=-javascript,sql
+mv "$dir/$$.tags" "$dir/tags"

+ 2 - 0
git_template/hooks/post-checkout

@@ -0,0 +1,2 @@
+#!/bin/sh
+.git/hooks/ctags >/dev/null 2>&1 &

+ 2 - 0
git_template/hooks/post-commit

@@ -0,0 +1,2 @@
+#!/bin/sh
+.git/hooks/ctags >/dev/null 2>&1 &

+ 2 - 0
git_template/hooks/post-merge

@@ -0,0 +1,2 @@
+#!/bin/sh
+.git/hooks/ctags >/dev/null 2>&1 &

+ 4 - 0
git_template/hooks/post-rewrite

@@ -0,0 +1,4 @@
+#!/bin/sh
+case "$1" in
+  rebase) exec .git/hooks/post-merge ;;
+esac

+ 4 - 6
gitconfig

@@ -9,11 +9,10 @@
   summary = true
 [interactive]
   singlekey = true
-[mergetool]
-  prompt = false
 [core]
   editor = mvim -f
   pager = less -F -X
+  excludesfile = ~/.gitignore
 [mergetool]
   prompt = false
   tool = gvimdiff
@@ -29,10 +28,7 @@
   ca = commit -a
   d = diff
   ch = checkout
-[difftool "gvimdiff"]
-  path = mvim
-[mergetool "gvimdiff"]
-  path = mvim
+  ctags = !.git/hooks/ctags
 [color]
   ui = auto
   diff = auto
@@ -43,3 +39,5 @@
 [url "github:"]
   insteadOf = git@github.com
   insteadOf = github.com
+[init]
+  templatedir = ~/.git_template