public
Description: My unix dot configs
Homepage: http://blog.naxsoft.com/
Clone URL: git://github.com/igouss/dotfiles.git
igouss (author)
Sun Aug 24 18:47:43 -0700 2008
commit  30e34fafa188f58189357f884f2712422be6853a
tree    c9272545ea15e5be5e879ed1ae6740ec820d48be
parent  83c172026aeea582754993299a5003340b34eecd
...
30
31
32
33
 
 
 
 
34
35
36
...
51
52
53
 
...
30
31
32
 
33
34
35
36
37
38
39
...
54
55
56
57
0
@@ -30,7 +30,10 @@ alias co="git checkout"
0
 alias clean="git clean -n -d"
0
 alias clean!="git clean -d"
0
 alias push="git push"
0
-alias reset="git reset HEAD^"
0
+#alias reset="git reset HEAD^"
0
+alias reset="git reset --hard HEAD^"
0
+alias grm="git ls-files -deleted | xargs git rm"
0
+alias append="git commit --amend"
0
 
0
 alias vimm="vim +Vexplore"
0
 alias netstat="netstat -nal -p tcp && netstat -nal -p udp"
0
@@ -51,3 +54,4 @@ ruby -e'include Math;(-7..30).each{|y|s="";\
0
 ((sin(x/8.0)+2+sin(y*x/2.0))**       \
0
 (sin(y/7.0)+1)*12/16.0)]};puts s}'
0
 alias
0
+alias  =clear
0
...
26
27
28
29
30
31
32
...
126
127
128
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
129
...
26
27
28
 
29
30
31
...
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
0
@@ -26,7 +26,6 @@ set statusline=[%l,%c\ %P%M]\ %f\ %r%h%w
0
 set title
0
 set icon
0
 set autoread
0
-set autochdir
0
 set smartcase
0
 set wildmenu
0
 " allow ESC-sequenzes in 'insert-mode'
0
@@ -126,4 +125,129 @@ set statusline=%<[%n]\ %F\ \ Filetype=\%Y\ \ %r\ %1*%m%*%w%=%(Line:\ %l%)%4(%)Co
0
 " set statusline=[%n]\ %<%f\ %((%1*%M%*%R%Y)%)\ %=%-19(\LINE\ [%3l/%3L]\ COL\ [%02c%03V]%)\ ascii['%02b']\ %P
0
 " set statusline=%<[%n]\ %F\ \ Filetype=\%Y\ \ Fileformat=%{Fileformat()}\ \ %r\ %1*%m%*%w%=%(Column:\ %c%V%)%4(%)%-10(Line:\ %l%)\ %4(%)%p%% 
0
 " set statusline=%4*%m%3*%<%F%3*%=Christian\ Schneider\ %5*\ Line\et
0
+function! GuiTabLabel()
0
+  " add the tab number
0
+  let label = '['.tabpagenr()
0
0
+  " modified since the last save?
0
+  let buflist = tabpagebuflist(v:lnum)
0
+  for bufnr in buflist
0
+    if getbufvar(bufnr, '&modified')
0
+      let label .= '*'
0
+      break
0
+    endif
0
+  endfor
0
0
+  " count number of open windows in the tab
0
+  let wincount = tabpagewinnr(v:lnum, '$')
0
+  if wincount > 1
0
+    let label .= ', '.wincount
0
+  endif
0
+  let label .= '] '
0
0
+  " add the file name without path information
0
+  let n = bufname(buflist[tabpagewinnr(v:lnum) - 1])
0
+  let label .= fnamemodify(n, ':t')
0
0
+  return label
0
+endfunction
0
+
0
+function! s:SID_PREFIX()
0
+ return matchstr(expand('<sfile>'), '<SNR>\d\+_')
0
+endfunction
0
+
0
+function! s:GetTabVar(tabnr, varname)
0
+  " Wrapper for non standard (my own) built-in function gettabvar().
0
+  return exists('*gettabvar') ? gettabvar(a:tabnr, a:varname) : ''
0
+endfunction
0
+
0
+" VCS branch name  "{{{2
0
+" Returns the name of the current branch of the given directory.
0
+" BUGS: git is only supported.
0
+let s:_vcs_branch_name_cache = {}  " dir_path = [branch_name, key_file_mtime]
0
+
0
+
0
+function! s:vcs_branch_name(dir)
0
+  let cache_entry = get(s:_vcs_branch_name_cache, a:dir, 0)
0
+  if cache_entry is 0
0
+   \ || cache_entry[1] < getftime(s:_vcs_branch_name_key_file(a:dir))
0
+    unlet cache_entry
0
+    let cache_entry = s:_vcs_branch_name(a:dir)
0
+    let s:_vcs_branch_name_cache[a:dir] = cache_entry
0
+  endif
0
+
0
+  return cache_entry[0]
0
+endfunction
0
+
0
+
0
+function! s:_vcs_branch_name_key_file(dir)
0
+  return a:dir . '/.git/HEAD'
0
+endfunction
0
+
0
+
0
+function! s:_vcs_branch_name(dir)
0
+  let head_file = s:_vcs_branch_name_key_file(a:dir)
0
+  let branch_name = ''
0
+
0
+  if filereadable(head_file)
0
+    let ref_info = s:first_line(head_file)
0
+    if ref_info =~ '^\x\{40}$'
0
+      let remote_refs_dir = a:dir . '/.git/refs/remotes/'
0
+      let remote_branches = split(glob(remote_refs_dir . '**'), "\n")
0
+      call filter(remote_branches, 's:first_line(v:val) ==# ref_info')
0
+      if 1 <= len(remote_branches)
0
+        let branch_name = 'remote: '. remote_branches[0][len(remote_refs_dir):]
0
+      endif
0
+    else
0
+      let branch_name = matchlist(ref_info, '^ref: refs/heads/\(\S\+\)$')[1]
0
+      if branch_name == ''
0
+        let branch_name = ref_info
0
+      endif
0
+    endif
0
+  endif
0
+
0
+  return [branch_name, getftime(head_file)]
0
+endfunction
0
+
0
+function! s:first_line(file)
0
+  let lines = readfile(a:file, '', 1)
0
+  return 1 <= len(lines) ? lines[0] : ''
0
+endfunction
0
+
0
+
0
+
0
+
0
+function! s:MyTabLine()  "{{{
0
+  let s = ''
0
+
0
+  for i in range(1, tabpagenr('$'))
0
+    let bufnrs = tabpagebuflist(i)
0
+    let curbufnr = bufnrs[tabpagewinnr(i) - 1]  " first window, first appears
0
+
0
+    let no = (i <= 10 ? i-1 : '#')  " display 0-origin tabpagenr.
0
+    let mod = len(filter(bufnrs, 'getbufvar(v:val, "&modified")')) ? '+' : ' '
0
+    let title = s:GetTabVar(i, 'title')
0
+    let title = len(title) ? title : fnamemodify(s:GetTabVar(i, 'cwd'), ':t')
0
+    let title = len(title) ? title : fnamemodify(bufname(curbufnr),':t')
0
+    let title = len(title) ? title : '[No Name]'
0
+
0
+    let s .= '%'.i.'T'
0
+    let s .= '%#' . (i == tabpagenr() ? 'TabLineSel' : 'TabLine') . '#'
0
+    let s .= no
0
+    let s .= mod
0
+    let s .= title
0
+    let s .= '%#TabLineFill#'
0
+    let s .= '  '
0
+  endfor
0
+
0
+  let s .= '%#TabLineFill#%T'
0
+  let s .= '%=%#TabLine#'
0
+  let s .= '| '
0
+  let s .= '%999X'
0
+  let branch_name = s:vcs_branch_name(getcwd())
0
+  let s .= (branch_name != '' ? branch_name : '?')
0
+  let s .= '%X'
0
+  return s
0
+endfunction "}}}
0
+let &tabline = '%!' . s:SID_PREFIX() . 'MyTabLine()'
0
 

Comments