Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

update fuzzyfinder_textmate to display relative paths in the status l…

…ine with %f
  • Loading branch information...
commit b9d541db520268aa6c7e2cb29effe66e05a4d72b 1 parent 0dd4743
Seth Chandler authored

Showing 1 changed file with 31 additions and 0 deletions. Show diff stats Hide diff stats

  1. 31  fuzzyfinder_textmate.vim
31  fuzzyfinder_textmate.vim
@@ -17,6 +17,33 @@ function! s:HighlightError()
17 17
   syntax clear
18 18
   syntax match Error  /^.*$/
19 19
 endfunction
  20
+
  21
+function! s:OpenBuffer(nr, mode)
  22
+  execute printf([
  23
+        \   ':%sbuffer',
  24
+        \   ':%ssbuffer',
  25
+        \   ':vertical :%ssbuffer',
  26
+        \   ':tab :%ssbuffer',
  27
+        \ ][a:mode], a:nr)
  28
+endfunction
  29
+
  30
+function! s:OpenFile(path, mode)
  31
+  let nr = bufnr('^' . a:path . '$')
  32
+  if nr > -1
  33
+    call s:OpenBuffer(nr, a:mode)
  34
+  else
  35
+    execute [
  36
+          \   ':edit ',
  37
+          \   ':split ',
  38
+          \   ':vsplit ',
  39
+          \   ':tabedit ',
  40
+          \ ][a:mode] . s:EscapeFilename(a:path)
  41
+  endif
  42
+endfunction
  43
+
  44
+function! s:EscapeFilename(fn)
  45
+  return escape(a:fn, " \t\n*?[{`$%#'\"|!<")
  46
+endfunction
20 47
 " ------------------------------------------------------------------------------------
21 48
 " }}}
22 49
 " ====================================================================================
@@ -132,6 +159,10 @@ RUBY
132 159
     call g:FuzzyFinderMode.TextMate.launch(a:initial_text, a:partial_matching)
133 160
   endfunction
134 161
 
  162
+  function! g:FuzzyFinderMode.TextMate.on_open(expr, mode)
  163
+    call s:OpenFile(fnamemodify(a:expr, ':~:.'), a:mode)
  164
+  endfunction
  165
+
135 166
   let g:FuzzyFinderOptions.TextMate = copy(g:FuzzyFinderOptions.File)
136 167
 endfunction "}}}
137 168
 

0 notes on commit b9d541d

Please sign in to comment.
Something went wrong with that request. Please try again.