Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

implove log source define.

  • Loading branch information...
commit 1ccfbb825bc14492ffb76ab8d36078db5f089898 1 parent 6af9177
@hrsh7th authored
View
2  autoload/unite/kinds/vcs/log.vim
@@ -2,7 +2,7 @@ let s:save_cpo = &cpo
set cpo&vim
function! unite#kinds#vcs#log#define()
- return [s:kind]
+ return [s:kind] + unite#kinds#vcs#get_kinds('vcs/log')
endfunction
let s:kind = {
View
12 autoload/unite/sources/vcs/log.vim
@@ -13,13 +13,16 @@ let s:source = {
function! s:source.gather_candidates(args, context)
if !a:context.is_redraw
let path = vcs#target(a:args)
- if vcs#detect(path) == ''
+ let type = vcs#detect(path)
+ if type == ''
call unite#print_message('[vcs/log] vcs not detected: ' . path)
return []
endif
let a:context.source__path = path
+ let a:context.source__type = type
else
let path = a:context.source__path
+ let type = a:context.source__type
endif
let root = vcs#vcs('root', [path])
@@ -30,6 +33,11 @@ function! s:source.gather_candidates(args, context)
let revisionlen = max(map(copy(logs), "strlen(v:val.revision)"))
let datelen = max(map(copy(logs), "strlen(split(v:val.date, ' ')[0])"))
let authorlen = max(map(copy(logs), "strlen(split(v:val.author, ' ')[0])"))
+
+ let kind = 'vcs/log'
+ if len(keys(unite#get_kinds(kind . '/' . type))) > 0
+ let kind = kind . '/' . type
+ endif
return map(logs, "{
\ 'word': s:padding(v:val.revision, revisionlen) . ' | '. s:padding(v:val.date, datelen) . ' | '. s:padding(v:val.author, authorlen) . ' | ' . v:val.message,
\ 'source__path': path,
@@ -38,7 +46,7 @@ function! s:source.gather_candidates(args, context)
\ 'action__prev_revision': v:val.prev_revision,
\ 'action__author': v:val.author,
\ 'action__message': v:val.message,
- \ 'kind': 'vcs/log'
+ \ 'kind': kind
\ }")
endfunction
Please sign in to comment.
Something went wrong with that request. Please try again.