]> git.zndr.dk Git - dotfiles.git/commitdiff
Effortless Ctags with Git
authorJannik ZANDER <jannikz@gmail.com>
Thu, 12 May 2016 20:45:44 +0000 (22:45 +0200)
committerJannik ZANDER <jannikz@gmail.com>
Thu, 12 May 2016 20:45:44 +0000 (22:45 +0200)
.git_template/hooks/ctags [new file with mode: 0755]
.git_template/hooks/post-checkout [new file with mode: 0755]
.git_template/hooks/post-commit [new file with mode: 0755]
.git_template/hooks/post-merge [new file with mode: 0755]
.git_template/hooks/post-rewrite [new file with mode: 0755]
.gitconfig
.vimrc

diff --git a/.git_template/hooks/ctags b/.git_template/hooks/ctags
new file mode 100755 (executable)
index 0000000..1ac991e
--- /dev/null
@@ -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 -L - -f"$dir/$$.tags" --languages=-javascript,sql
+mv "$dir/$$.tags" "$dir/tags"
diff --git a/.git_template/hooks/post-checkout b/.git_template/hooks/post-checkout
new file mode 100755 (executable)
index 0000000..84f17ed
--- /dev/null
@@ -0,0 +1,2 @@
+#!/bin/sh
+.git/hooks/ctags >/dev/null 2>&1 &
diff --git a/.git_template/hooks/post-commit b/.git_template/hooks/post-commit
new file mode 100755 (executable)
index 0000000..84f17ed
--- /dev/null
@@ -0,0 +1,2 @@
+#!/bin/sh
+.git/hooks/ctags >/dev/null 2>&1 &
diff --git a/.git_template/hooks/post-merge b/.git_template/hooks/post-merge
new file mode 100755 (executable)
index 0000000..84f17ed
--- /dev/null
@@ -0,0 +1,2 @@
+#!/bin/sh
+.git/hooks/ctags >/dev/null 2>&1 &
diff --git a/.git_template/hooks/post-rewrite b/.git_template/hooks/post-rewrite
new file mode 100755 (executable)
index 0000000..fe8972d
--- /dev/null
@@ -0,0 +1,4 @@
+#!/bin/sh
+case "$1" in
+  rebase) exec .git/hooks/post-merge ;;
+esac
index e11463a8b8e90f17da1524567076dc8fe6a2cbc2..0901b624f335c30728c1e53d19038b63a83f6266 100644 (file)
@@ -1,3 +1,53 @@
+[init]
+       templatedir = ~/.git_template
+[core]
+       # Use custom `.gitignore`
+       excludesfile = ~/.gitignore_global
+       # Treat spaces before tabs and all kinds of trailing whitespace as an error
+       # [default] trailing-space: looks for spaces at the end of a line
+       # [default] space-before-tab: looks for spaces before tabs at the beginning of a line
+       whitespace = space-before-tab,-indent-with-non-tab,trailing-space
+       # utocrlf = input
+       editor = git-editor.sh
+[color]
+       # Use colors in Git commands that are capable of colored output when
+       # outputting to the terminal. (This is the default setting in Git = 1.8.4.)
+       ui = auto
+[color "branch"]
+       current = yellow reverse
+       local = yellow
+       remote = green
+[color "diff"]
+       meta = yellow bold
+       frag = magenta bold # line info
+       old = red # deletions
+       new = green # additions
+[color "status"]
+       added = yellow
+       changed = green
+       untracked = cyan
+[help]
+       # Automatically correct and execute mistyped commands
+       autocorrect = 1
+[diff]
+       tool = git-difftool
+       # Detect copies as well as renames
+       renames = copies
+       prompt = false
+[difftool "git-difftool"]
+       cmd = git-difftool.sh $LOCAL $REMOTE
+[merge]
+       tool = git-mergetool
+       # Include summaries of merged commits in newly created merge commit messages
+       log = true
+       prompt = false
+[mergetool "git-mergetool"]
+       cmd = git-mergetool.sh $LOCAL $REMOTE $BASE $MERGED
+[push]
+       default = simple
+[apply]
+       # Detect whitespace errors when applying a patch
+       whitespace = fix
 [alias]
        # View abbreviated SHA, description, and history graphs
        lg = !"git lg1"
        co = checkout
        cobr = checkout -b
        root = rev-parse --show-toplevel
-[apply]
-       # Detect whitespace errors when applying a patch
-       whitespace = fix
-[core]
-       # Use custom `.gitignore`
-       excludesfile = ~/.gitignore_global
-       # Treat spaces before tabs and all kinds of trailing whitespace as an error
-       # [default] trailing-space: looks for spaces at the end of a line
-       # [default] space-before-tab: looks for spaces before tabs at the beginning of a line
-       whitespace = space-before-tab,-indent-with-non-tab,trailing-space
-       # utocrlf = input
-       editor = git-editor.sh
-[color]
-       # Use colors in Git commands that are capable of colored output when
-       # outputting to the terminal. (This is the default setting in Git = 1.8.4.)
-       ui = auto
-[color "branch"]
-       current = yellow reverse
-       local = yellow
-       remote = green
-[color "diff"]
-       meta = yellow bold
-       frag = magenta bold # line info
-       old = red # deletions
-       new = green # additions
-[color "status"]
-       added = yellow
-       changed = green
-       untracked = cyan
-[help]
-       # Automatically correct and execute mistyped commands
-       autocorrect = 1
-[diff]
-       tool = git-difftool
-       # Detect copies as well as renames
-       renames = copies
-       prompt = false
-[difftool "git-difftool"]
-       cmd = git-difftool.sh $LOCAL $REMOTE
-[merge]
-       tool = git-mergetool
-       # Include summaries of merged commits in newly created merge commit messages
-       log = true
-       prompt = false
-[mergetool "git-mergetool"]
-       cmd = git-mergetool.sh $LOCAL $REMOTE $BASE $MERGED
-[push]
-    default = simple
+       ctags = !.git/hooks/ctags
 [include]
        # Local/private config goes in the include
        path = ~/.gitconfig_local
+
diff --git a/.vimrc b/.vimrc
index 9448ac650cc2247bd0df3a77e0b4a0e871f09698..3a01c355294ef52eeb153b023beb90bafe9647ca 100644 (file)
--- a/.vimrc
+++ b/.vimrc
@@ -1,9 +1,7 @@
 set nocompatible
 
-"------------------------------------------------------------------------------
-" For plug 
-"------------------------------------------------------------------------------
-"
+"-----------plugin manager----------------
+
 if empty(glob('$HOME/.vim/autoload/plug.vim'))
   silent !curl -fLo $HOME/.vim/autoload/plug.vim --create-dirs
     \ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
@@ -12,63 +10,28 @@ endif
 
 call plug#begin('$HOME/.vim/plugged')
 
-Plug 'thanthese/Tortoise-Typing'
+Plug 'tpope/vim-sensible'
+Plug 'tpope/vim-ragtag'
+Plug 'tpope/vim-repeat'
+Plug 'tpope/vim-surround'
+Plug 'tpope/vim-fugitive'
 Plug 'altercation/vim-colors-solarized'
-Plug 'plasticboy/vim-markdown'
-Plug 'vim-airline/vim-airline'
-Plug 'vim-airline/vim-airline-themes'
+"Plug 'vim-airline/vim-airline'
+"Plug 'vim-airline/vim-airline-themes'
 Plug 'mileszs/ack.vim'
 Plug 'brandonbloom/csearch.vim'
 Plug 'chazy/cscope_maps'
-Plug 'vim-scripts/taglist.vim'
+"Plug 'vim-scripts/taglist.vim'
 "Plug 'airblade/vim-gitgutter'
 Plug 'junegunn/fzf.vim'
 Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' }
-Plug 'tpope/vim-surround'
-Plug 'tpope/vim-ragtag'
+Plug 'thanthese/Tortoise-Typing'
 
 call plug#end()
 
-"------------------------------------------------------------------------------
-" Regular setting
-"------------------------------------------------------------------------------
-"
-set backspace=2
-set autoindent
-set nobackup
-set noswapfile
-set nowb
-set encoding=utf-8
-set expandtab
-set hidden
-set hlsearch
-set incsearch
-set ignorecase
-set smartcase
-set laststatus=2
-set number
-set ruler
-set mouse=a
-set shiftwidth=2
-set softtabstop=2
-set expandtab
-set showcmd
-set showmatch
-set visualbell t_vb=
-set modeline
-set modelines=1
-set so=7
-set wildmenu
-set nostartofline
-set confirm
-set cmdheight=2
-set notimeout 
-set ttimeout 
-set ttimeoutlen=4000
-set tags+=tags;
+"---------------------------------------------
 
 " For color
-syntax enable
 set background=dark
 let g:solarized_menu=0
 try
@@ -77,6 +40,7 @@ catch
   colorscheme default
 endtry
 
+" For fonts
 if has("gui_running")
   if has("gui_gtk2")
     set guifont=Inconsolata\ 12
@@ -88,20 +52,22 @@ if has("gui_running")
 endif
 
 " For markdown
-let g:vim_markdown_folding_disabled = 1
+autocmd BufNewFile,BufReadPost *.md set filetype=markdown
+let g:markdown_fenced_languages = ['html', 'python', 'bash=sh']
+let g:markdown_syntax_conceal = 0
 
 " For taglist
-let Tlist_Compact_Format = 1
-let Tlist_GainFocus_On_ToggleOpen = 1
-let Tlist_Close_On_Select = 1
-nnoremap <C-l> :TlistToggle<CR>
+"let Tlist_Compact_Format = 1
+"let Tlist_GainFocus_On_ToggleOpen = 1
+"let Tlist_Close_On_Select = 1
+"nnoremap <C-l> :TlistToggle<CR>
 
 " %s is replaced with fzf command
 "let g:fzf_launcher = 'xterm -e bash -ic %s'
 let g:fzf_launcher = "In_a_new_term_function %s"
 
 "For airline
-let g:airline#extensions#tabline#enabled = 1
+"let g:airline#extensions#tabline#enabled = 1
 
 " Easy escape
 inoremap jj           <ESC>