Skip to content

Commit

Permalink
Version 2.1.2
Browse files Browse the repository at this point in the history
Fixed a few issues.
 - Now centres (better) on tree window open.
 - Can be opened to default mode.
 - Tree now properly opens directories that are sub.
  • Loading branch information
Peter Antoine authored and vim-scripts committed Jun 14, 2013
1 parent 3bc1108 commit e554187
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 22 deletions.
7 changes: 4 additions & 3 deletions README.md
Original file line number Original file line Diff line number Diff line change
@@ -1,7 +1,7 @@
vimgitlog vimgitlog
========= =========


Version: 2.1.0 Version: 2.1.2


Git log and diff plugin for vim. Git log and diff plugin for vim.


Expand Down Expand Up @@ -44,8 +44,9 @@ Simply copy the contents of the plugin directory to the plugin directory in your


You will need to map the toggle function to use it. You will need to map the toggle function to use it.


map <silent> <f7> :call GITLOG_FilpWindows()<cr> let g:GITLOG_default_mode = 2
map <silent> <c-f7> :call GITLOG_ToggleWindows()<cr> map <silent> <f7> :call GITLOG_ToggleWindows()<cr>
map <silent> <c-f7> :call GITLOG_FlipWindows()<cr>


And the should be it. And the should be it.


Expand Down
12 changes: 10 additions & 2 deletions doc/gitlog.txt
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@




Author: Peter Antoine Author: Peter Antoine
Date: March 26, 2013 Date: May 21, 2013
Version: 2.1.0 Version: 2.1.2
HomePage: https://github.com/PAntoine/vimgitlog HomePage: https://github.com/PAntoine/vimgitlog




Expand Down Expand Up @@ -228,6 +228,14 @@ This will install GITLOG on the <f7> key.


============================================================================== ==============================================================================
7. History *gitlog-history* 7. History *gitlog-history*
2.1.2: May 21, 2013
PA: Fixed tree open.
PA: Fixed being able to open in any default mode.
PA: Made open tree view a bit better.

2.1.1: May 03, 2013
PA: Fixed silly start-up issue.

2.1.0: March 29, 2013 2.1.0: March 29, 2013
PA: Fixed empty directory issue. PA: Fixed empty directory issue.
PA: Added 'refresh' functions for tree. PA: Added 'refresh' functions for tree.
Expand Down
39 changes: 22 additions & 17 deletions plugin/gitlog.vim
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@
" "
" GLOBAL INITIALISERS " GLOBAL INITIALISERS
" {{{ " {{{

let s:tree_root = 0 let s:tree_root = 0
let s:current_root = 0 let s:current_root = 0
let s:directory_list = [[]] let s:directory_list = [[]]
Expand Down Expand Up @@ -74,9 +73,6 @@ else
let s:GITLOG_Open = 'v ' let s:GITLOG_Open = 'v '
endif endif


if !exists("g:GITLOG_default_mode")
let g:GITLOG_default_mode = 1
endif
" "
" }}} " }}}
" PUBLIC FUNCTIONS " PUBLIC FUNCTIONS
Expand Down Expand Up @@ -300,6 +296,7 @@ endfunction "}}}
" nothing " nothing
" "
function! GITLOG_FlipWindows() function! GITLOG_FlipWindows()
echo s:gitlog_last_state
if !exists("s:gitlog_loaded") if !exists("s:gitlog_loaded")
" load it on " load it on
call GITLOG_ToggleWindows(s:gitlog_last_state) call GITLOG_ToggleWindows(s:gitlog_last_state)
Expand Down Expand Up @@ -342,6 +339,12 @@ function! GITLOG_ToggleWindows(...)
let s:gitlog_loaded = 1 let s:gitlog_loaded = 1
endif endif
else else
if s:revision_file != ""
let s:revision_path = substitute(s:revision_file,s:repository_root,"","")
else
let s:revision_path = ''
endif

if s:GITLOG_OpenTreeWindow() if s:GITLOG_OpenTreeWindow()
let s:gitlog_loaded = 2 let s:gitlog_loaded = 2
endif endif
Expand Down Expand Up @@ -505,20 +508,9 @@ function! s:GITLOG_OpenTreeToFile(file_path)
endif endif


if (len(components) > 1) if (len(components) > 1)
let new_path = '.' let new_path = './'
for component in components for component in components
let found = 0 let found = 0
let new_path = new_path . "/" . component

" open the sub-directory if we need too
if found_item != {} && curent_directory == 0 && found_item.type == 'tree'
let found_item.child = GITLOG_MakeDirectory(new_path, found_item.parent)
let curent_directory = found_item.child

if curent_directory == 0
break
endif
endif


" now search the directory " now search the directory
for item in s:directory_list[curent_directory] for item in s:directory_list[curent_directory]
Expand All @@ -536,6 +528,18 @@ function! s:GITLOG_OpenTreeToFile(file_path)
endif endif
endfor endfor


let new_path = new_path . component . "/"

" open the sub-directory if we need too
if found_item != {} && curent_directory == 0 && found_item.type == 'tree'
let found_item.child = GITLOG_MakeDirectory(new_path, found_item.parent)
let curent_directory = found_item.child

if curent_directory == 0
break
endif
endif

" did we find it? " did we find it?
if found == 0 if found == 0
break break
Expand Down Expand Up @@ -599,6 +603,7 @@ function! s:GITLOG_OpenTreeWindow()


if found_item != {} if found_item != {}
call setpos('.',[0,found_item.lnum,0,0]) call setpos('.',[0,found_item.lnum,0,0])
exe "normal zz"
endif endif


" set the keys on the tree window " set the keys on the tree window
Expand Down Expand Up @@ -1067,7 +1072,7 @@ endfunction "}}}
" nothing " nothing
" "
function! GITLOG_MakeDirectory(path_name, parent_id) function! GITLOG_MakeDirectory(path_name, parent_id)
let run_command = "git --git-dir=" . s:repository_root . ".git --no-pager ls-tree " . s:gitlog_current_commit . " " . a:path_name . " --abbrev" let run_command = "git --git-dir=" . s:repository_root . ".git --no-pager ls-tree " . s:gitlog_current_commit . " " . a:path_name . " --abbrev"
let search_result = system(run_command) let search_result = system(run_command)


if v:shell_error if v:shell_error
Expand Down

0 comments on commit e554187

Please sign in to comment.