Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

new option to control the height of the pydoc window 'g:pydoc_wh'

implemented by Matthias Vogelgesang
  • Loading branch information...
commit 1f4713ee34e4ff5c4109e9fd5067fd1147427ca2 1 parent 113b21e
André Kelpe authored April 11, 2010

Showing 1 changed file with 57 additions and 52 deletions. Show diff stats Hide diff stats

  1. 109  pydoc.vim
109  pydoc.vim
@@ -29,65 +29,70 @@
29 29
 
30 30
 set switchbuf=useopen
31 31
 function! ShowPyDoc(name, type)
32  
-	if !exists('g:pydoc_cmd')
33  
-		let g:pydoc_cmd = 'pydoc'
34  
-	endif
35  
-
36  
-	if bufloaded("__doc__") >0
37  
-		let l:buf_is_new = 0
38  
-	else
39  
-		let l:buf_is_new = 1
40  
-	endif
41  
-
42  
-	if bufnr("__doc__") >0
43  
-			exe "sb __doc__"
44  
-	else
45  
-			exe 'split __doc__'
46  
-	endif
47  
-	setlocal noswapfile
48  
-	set buftype=nofile
49  
-	setlocal modifiable
50  
-	normal ggdG
51  
-	let s:name2 = substitute(a:name, '(.*', '', 'g' )
52  
-	if a:type==1
53  
-		execute  "silent read ! " . g:pydoc_cmd . " " . s:name2 
54  
-	else 
55  
-		execute  "silent read ! " . g:pydoc_cmd . " -k " . s:name2 
56  
-	endif	
57  
-	setlocal nomodified
58  
-	set filetype=man
59  
-	normal 1G
60  
-	if !exists('g:pydoc_highlight')
61  
-		let g:pydoc_highlight = 1
62  
-	endif
63  
-	if g:pydoc_highlight == 1
64  
-		call Highlight(s:name2)
65  
-	endif	
66  
-
67  
-	let l:line = getline(2)
68  
-	if l:line =~ "^no Python documentation found for.*$" 
69  
-		if l:buf_is_new
70  
-			execute "bd!"
71  
-		else
72  
-			normal u
73  
-		endif
74  
-		redraw
75  
-		echohl WarningMsg | echo l:line | echohl None
76  
-	endif
  32
+    if !exists('g:pydoc_cmd')
  33
+        let g:pydoc_cmd = 'pydoc'
  34
+    endif
  35
+
  36
+    if bufloaded("__doc__") >0
  37
+        let l:buf_is_new = 0
  38
+    else
  39
+        let l:buf_is_new = 1
  40
+    endif
  41
+
  42
+    if bufnr("__doc__") >0
  43
+        execute "sb __doc__"
  44
+    else
  45
+        execute 'split __doc__'
  46
+    endif
  47
+    setlocal noswapfile
  48
+    set buftype=nofile
  49
+    setlocal modifiable
  50
+    normal ggdG
  51
+    let s:name2 = substitute(a:name, '(.*', '', 'g' )
  52
+    if a:type==1
  53
+        execute  "silent read ! " . g:pydoc_cmd . " " . s:name2 
  54
+    else 
  55
+        execute  "silent read ! " . g:pydoc_cmd . " -k " . s:name2 
  56
+    endif	
  57
+    setlocal nomodified
  58
+    set filetype=man
  59
+    normal 1G
  60
+
  61
+    if !exists('g:pydoc_wh')
  62
+        let g:pydoc_wh = 10
  63
+    end
  64
+    resize -999
  65
+    execute "silent resize +" . g:pydoc_wh 
  66
+
  67
+    if !exists('g:pydoc_highlight')
  68
+        let g:pydoc_highlight = 1
  69
+    endif
  70
+    if g:pydoc_highlight == 1
  71
+        call Highlight(s:name2)
  72
+    endif	
  73
+
  74
+    let l:line = getline(2)
  75
+    if l:line =~ "^no Python documentation found for.*$" 
  76
+        if l:buf_is_new
  77
+            execute "bd!"
  78
+        else
  79
+            normal u
  80
+        endif
  81
+        redraw
  82
+        echohl WarningMsg | echo l:line | echohl None
  83
+    endif
77 84
 endfunction
78 85
 
79 86
 
80 87
 function! Highlight(name)
81  
-	exe "sb __doc__"
82  
-	set filetype=man
83  
-	syn on
84  
-	exe 'syntax keyword pydoc '.s:name2
85  
-	hi pydoc gui=reverse
  88
+    execute "sb __doc__"
  89
+    set filetype=man
  90
+    syn on
  91
+    execute 'syntax keyword pydoc '.s:name2
  92
+    hi pydoc gui=reverse
86 93
 endfunction
87 94
 
88 95
 
89  
-
90  
-
91 96
 "mappings
92 97
 au FileType python,man map <buffer> <leader>pw :call ShowPyDoc('<C-R><C-W>', 1)<CR>
93 98
 au FileType python,man map <buffer> <leader>pW :call ShowPyDoc('<C-R><C-A>', 1)<CR>

0 notes on commit 1f4713e

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