Permalink
Browse files

Version 1.6

Add one new user interface named 'TrinityUpdateWindow' for updating Trinity window positions. e.g. when you use Quickfix together with Trinity, you may need to call this function for recover the window positions.
  • Loading branch information...
wesleyche authored and vim-scripts committed Feb 24, 2012
1 parent 03f0fd8 commit a46b15998a7213aaa6ffd0c706f50438bbd8d218
Showing with 44 additions and 47 deletions.
  1. +19 −28 plugin/NERD_tree.vim
  2. +25 −19 plugin/trinity.vim
View
@@ -3581,40 +3581,31 @@ endfunction
" CHE Wenlong add for trinity.vim
" Begin
function! s:GetEditWinNR()
-
- let l:i = 1
- let l:j = 1
-
- let l:pluginList = [
+ let l:i = 1
+ let l:j = 1
+ let l:pluginList = [
\ "__Tag_List__",
- \ "_NERD_tree_",
- \ "Source_Explorer"
- \]
-
- while 1
-
+ \ "_NERD_tree_",
+ \ "Source_Explorer"
+ \]
+ while 1
for item in l:pluginList
- if bufname(winbufnr(l:i)) ==# item
- \ || getwinvar(l:i, '&previewwindow')
- break
- else
- let l:j += 1
- endif
- endfor
-
- if j >= len(l:pluginList)
+ if bufname(winbufnr(l:i)) ==# item || getwinvar(l:i, '&previewwindow')
+ break
+ else
+ let l:j += 1
+ endif
+ endfor
+ if j >= len(l:pluginList)
return l:i
- else
- let l:i += 1
+ else
+ let l:i += 1
let l:j = 0
- endif
-
+ endif
if l:i > winnr("$")
- return -1
- endif
-
+ return -1
+ endif
endwhile
-
endfunction
" End
View
@@ -2,11 +2,11 @@
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" File Name: trinity.vim
-" Abstract: A (G)VIM plugin which build the trinity of Source Explorer,
+" Abstract: A (G)VIM plugin which build the trinity of Source Explorer,
" TagList and NERD tree to be an IDE for software development.
-" Author: CHE Wenlong <chewenlong AT buaa.edu.cn>
-" Version: 1.4
-" Last Change: March 3, 2009
+" Author: CHE Wenlong <wenlong.che@gmail.com>
+" Version: 1.6
+" Last Change: February 23, 2012
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
@@ -25,7 +25,7 @@ set cpoptions&vim
" VIM version control {{{
-" The VIM version control for running the Source Explorer
+" The VIM version control for running the Trinity
if v:version < 700
" Tell the user what has happened
@@ -41,24 +41,30 @@ endif
" User interface for switching all the three plugins
-command! -nargs=0 -bar TrinityToggleAll
+command! -nargs=0 -bar TrinityToggleAll
\ call <SID>Trinity_Toggle()
" User interface for switching the TagList
-command! -nargs=0 -bar TrinityToggleTagList
+command! -nargs=0 -bar TrinityToggleTagList
\ call <SID>Trinity_ToggleTagList()
" User interface for switching the Source Explorer
-command! -nargs=0 -bar TrinityToggleSourceExplorer
+command! -nargs=0 -bar TrinityToggleSourceExplorer
\ call <SID>Trinity_ToggleSourceExplorer()
" User interface for switching the NERD tree
-command! -nargs=0 -bar TrinityToggleNERDTree
+command! -nargs=0 -bar TrinityToggleNERDTree
\ call <SID>Trinity_ToggleNERDTree()
+" User interface for updating window positions
+" e.g. open/close Quickfix
+
+command! -nargs=0 -bar TrinityUpdateWindow
+ \ call <SID>Trinity_UpdateWindow()
+
" }}}
" Global variables {{{
@@ -71,12 +77,12 @@ let s:Trinity_logPath = "./trinity.log"
let s:tag_list_switch = 0
let s:tag_list_title = "__Tag_List__"
-let s:source_explorer_switch = 0
-let s:source_explorer_title = "Source_Explorer"
-
let s:nerd_tree_switch = 0
let s:nerd_tree_title = "_NERD_tree_"
+let s:source_explorer_switch = 0
+let s:source_explorer_title = "Source_Explorer"
+
" }}}
" Trinity_InitTagList() {{{
@@ -88,7 +94,7 @@ function! <SID>Trinity_InitTagList()
" Split to the right side of the screen
let g:Tlist_Use_Left_Window = 1
" Set the window width
- let g:Tlist_WinWidth = 24
+ let g:Tlist_WinWidth = 40
" Sort by the order
let g:Tlist_Sort_Type = "order"
" Do not display the help info
@@ -159,7 +165,7 @@ endfunction " }}}
" Trinity_Debug() {{{
-" Log the supplied debug information along with the time
+" Log the supplied debug information along with the time
function! <SID>Trinity_Debug(log)
@@ -179,16 +185,16 @@ endfunction " }}}
" Trinity_GetEditWinNR() {{{
-" Get the edit winindow NR
+" Get the edit window NR
function! <SID>Trinity_GetEditWinNR()
let l:i = 1
let l:j = 1
let l:pluginList = [
- \ s:tag_list_title,
- \ s:source_explorer_title,
+ \ s:tag_list_title,
+ \ s:source_explorer_title,
\ s:nerd_tree_title
\]
@@ -224,7 +230,7 @@ endfunction " }}}
function! <SID>Trinity_UpdateWindow()
- let l:i = 1
+ let l:i = 1
let l:rtn = -1
let l:tag_list_winnr = 0
@@ -237,7 +243,7 @@ function! <SID>Trinity_UpdateWindow()
let l:tag_list_winnr = l:i
endif
- if bufname(winbufnr(l:i)) ==# s:source_explorer_title
+ if bufname(winbufnr(l:i)) ==# s:source_explorer_title
\ || getwinvar(l:i, '&previewwindow')
let l:source_explorer_winnr = l:i
endif

0 comments on commit a46b159

Please sign in to comment.