Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

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...
commit 51c7c2c6181d7df2b48cb4e8cae2df65a98c1037 1 parent 58849f1
Wenlong Che authored February 24, 2012 vim-scripts committed March 06, 2012
47  plugin/NERD_tree.vim
@@ -3581,40 +3581,31 @@ endfunction
3581 3581
 " CHE Wenlong add for trinity.vim
3582 3582
 " Begin
3583 3583
 function! s:GetEditWinNR()
3584  
-
3585  
-	let l:i = 1
3586  
-	let l:j = 1
3587  
-
3588  
-	let l:pluginList = [
  3584
+    let l:i = 1
  3585
+    let l:j = 1
  3586
+    let l:pluginList = [
3589 3587
             \ "__Tag_List__", 
3590  
-		    \ "_NERD_tree_", 
3591  
-		    \ "Source_Explorer"
3592  
-	    \]
3593  
-
3594  
-	while 1
3595  
-
  3588
+	    \ "_NERD_tree_", 
  3589
+	    \ "Source_Explorer"
  3590
+        \]
  3591
+    while 1
3596 3592
         for item in l:pluginList
3597  
-			if bufname(winbufnr(l:i)) ==# item
3598  
-                \ || getwinvar(l:i, '&previewwindow')
3599  
-				break
3600  
-			else
3601  
-				let l:j += 1
3602  
-			endif
3603  
-		endfor
3604  
-
3605  
-		if j >= len(l:pluginList)
  3593
+	    if bufname(winbufnr(l:i)) ==# item || getwinvar(l:i, '&previewwindow')
  3594
+		break
  3595
+	    else
  3596
+		let l:j += 1
  3597
+	    endif
  3598
+	endfor
  3599
+	if j >= len(l:pluginList)
3606 3600
             return l:i
3607  
-		else
3608  
-			let l:i += 1
  3601
+	else
  3602
+	    let l:i += 1
3609 3603
             let l:j = 0
3610  
-		endif
3611  
-
  3604
+	endif
3612 3605
         if l:i > winnr("$")
3613  
-			return -1
3614  
-		endif
3615  
-
  3606
+	    return -1
  3607
+	endif
3616 3608
 	endwhile
3617  
-
3618 3609
 endfunction
3619 3610
 " End
3620 3611
 
44  plugin/trinity.vim
@@ -2,11 +2,11 @@
2 2
 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
3 3
 
4 4
 " File Name:      trinity.vim
5  
-" Abstract:       A (G)VIM plugin which build the trinity of Source Explorer,  
  5
+" Abstract:       A (G)VIM plugin which build the trinity of Source Explorer,
6 6
 "                 TagList and NERD tree to be an IDE for software development.
7  
-" Author:         CHE Wenlong <chewenlong AT buaa.edu.cn>
8  
-" Version:        1.4
9  
-" Last Change:    March 3, 2009
  7
+" Author:         CHE Wenlong <wenlong.che@gmail.com>
  8
+" Version:        1.6
  9
+" Last Change:    February 23, 2012
10 10
 
11 11
 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
12 12
 
@@ -25,7 +25,7 @@ set cpoptions&vim
25 25
 
26 26
 " VIM version control {{{
27 27
 
28  
-" The VIM version control for running the Source Explorer
  28
+" The VIM version control for running the Trinity
29 29
 
30 30
 if v:version < 700
31 31
     " Tell the user what has happened
@@ -41,24 +41,30 @@ endif
41 41
 
42 42
 " User interface for switching all the three plugins
43 43
 
44  
-command! -nargs=0 -bar TrinityToggleAll 
  44
+command! -nargs=0 -bar TrinityToggleAll
45 45
     \ call <SID>Trinity_Toggle()
46 46
 
47 47
 " User interface for switching the TagList
48 48
 
49  
-command! -nargs=0 -bar TrinityToggleTagList 
  49
+command! -nargs=0 -bar TrinityToggleTagList
50 50
     \ call <SID>Trinity_ToggleTagList()
51 51
 
52 52
 " User interface for switching the Source Explorer
53 53
 
54  
-command! -nargs=0 -bar TrinityToggleSourceExplorer 
  54
+command! -nargs=0 -bar TrinityToggleSourceExplorer
55 55
     \ call <SID>Trinity_ToggleSourceExplorer()
56 56
 
57 57
 " User interface for switching the NERD tree
58 58
 
59  
-command! -nargs=0 -bar TrinityToggleNERDTree 
  59
+command! -nargs=0 -bar TrinityToggleNERDTree
60 60
     \ call <SID>Trinity_ToggleNERDTree()
61 61
 
  62
+" User interface for updating window positions
  63
+" e.g. open/close Quickfix
  64
+
  65
+command! -nargs=0 -bar TrinityUpdateWindow
  66
+    \ call <SID>Trinity_UpdateWindow()
  67
+
62 68
 " }}}
63 69
 
64 70
 " Global variables {{{
@@ -71,12 +77,12 @@ let s:Trinity_logPath        = "./trinity.log"
71 77
 let s:tag_list_switch        = 0
72 78
 let s:tag_list_title         = "__Tag_List__"
73 79
 
74  
-let s:source_explorer_switch = 0
75  
-let s:source_explorer_title  = "Source_Explorer"
76  
-
77 80
 let s:nerd_tree_switch       = 0
78 81
 let s:nerd_tree_title        = "_NERD_tree_"
79 82
 
  83
+let s:source_explorer_switch = 0
  84
+let s:source_explorer_title  = "Source_Explorer"
  85
+
80 86
 " }}}
81 87
 
82 88
 " Trinity_InitTagList() {{{
@@ -88,7 +94,7 @@ function! <SID>Trinity_InitTagList()
88 94
     " Split to the right side of the screen
89 95
     let g:Tlist_Use_Left_Window = 1
90 96
     " Set the window width
91  
-    let g:Tlist_WinWidth = 24
  97
+    let g:Tlist_WinWidth = 40
92 98
     " Sort by the order
93 99
     let g:Tlist_Sort_Type = "order"
94 100
     " Do not display the help info
@@ -159,7 +165,7 @@ endfunction " }}}
159 165
 
160 166
 " Trinity_Debug() {{{
161 167
 
162  
-" Log the supplied debug information along with the time 
  168
+" Log the supplied debug information along with the time
163 169
 
164 170
 function! <SID>Trinity_Debug(log)
165 171
 
@@ -179,7 +185,7 @@ endfunction " }}}
179 185
 
180 186
 " Trinity_GetEditWinNR() {{{
181 187
 
182  
-" Get the edit winindow NR
  188
+" Get the edit window NR
183 189
 
184 190
 function! <SID>Trinity_GetEditWinNR()
185 191
 
@@ -187,8 +193,8 @@ function! <SID>Trinity_GetEditWinNR()
187 193
     let l:j = 1
188 194
 
189 195
     let l:pluginList = [
190  
-            \ s:tag_list_title, 
191  
-            \ s:source_explorer_title, 
  196
+            \ s:tag_list_title,
  197
+            \ s:source_explorer_title,
192 198
             \ s:nerd_tree_title
193 199
         \]
194 200
 
@@ -224,7 +230,7 @@ endfunction " }}}
224 230
 
225 231
 function! <SID>Trinity_UpdateWindow()
226 232
 
227  
-    let l:i       = 1
  233
+    let l:i = 1
228 234
     let l:rtn = -1
229 235
 
230 236
     let l:tag_list_winnr = 0
@@ -237,7 +243,7 @@ function! <SID>Trinity_UpdateWindow()
237 243
             let l:tag_list_winnr = l:i
238 244
         endif
239 245
 
240  
-        if bufname(winbufnr(l:i)) ==# s:source_explorer_title 
  246
+        if bufname(winbufnr(l:i)) ==# s:source_explorer_title
241 247
                 \ || getwinvar(l:i, '&previewwindow')
242 248
             let l:source_explorer_winnr = l:i
243 249
         endif

0 notes on commit 51c7c2c

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