1"
2" Filename: cream-devel.vim
3"
4" Description: Development related tools.
5"
6" Cream -- An easy-to-use configuration of the famous Vim text editor
7" [ http://cream.sourceforge.net ] Copyright (C) 2001-2011 Steve Hall
8"
9" License:
10" This program is free software; you can redistribute it and/or modify
11" it under the terms of the GNU General Public License as published by
12" the Free Software Foundation; either version 3 of the License, or
13" (at your option) any later version.
14" [ http://www.gnu.org/licenses/gpl.html ]
15"
16" This program is distributed in the hope that it will be useful, but
17" WITHOUT ANY WARRANTY; without even the implied warranty of
18" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
19" General Public License for more details.
20"
21" You should have received a copy of the GNU General Public License
22" along with this program; if not, write to the Free Software
23" Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
24" 02111-1307, USA.
25"
26
27if !exists("g:cream_dev")
28	finish
29endif
30
31" TestCow() {{{1
32function! TestCow(...)
33" Displays the values of any number of arguments passed. (Useful for
34" dumping an unknown list of variables without regard!)
35
36	if a:0 > 0
37		let x = ""
38		let i = 0
39		while exists("a:{i}")
40			let x = x . "\n a:" . i . " = " . a:{i}
41			let i = i+1
42		endwhile
43		call confirm(
44			\ x . "\n" .
45			\ "\n", "&Ok", 1, "Info")
46	endif
47
48endfunction
49
50" mappings {{{1
51" minimize Vim
52
53" * Remember: we map Ctrl+Shift+V to start Vim in the window manager
54" * Note: <M-v> destroys the German � so we double it
55imap <silent> <M-v>v     <C-b>:suspend<CR>
56imap <silent> <M-V>V     <C-b>:suspend<CR>
57imap <silent> <M-v><M-v> <C-b>:suspend<CR>
58imap <silent> <M-V><M-V> <C-b>:suspend<CR>
59
60" Cream_source_self() {{{1
61if !exists("*Cream_source_self")
62" Source the current file. (Function check wrapper ensures this works
63" even in the same file as this function definition.)
64
65	function! Cream_source_self(mode)
66	" source the current file as a Vim script
67
68		if &filetype != "vim"
69			call confirm(
70				\ "Can only source Vim files.\n" .
71				\ "\n", "&Ok", 1, "Info")
72			return
73		endif
74
75		silent! update
76
77		let n = Cream_source(expand("%"))
78		if n == 1
79			echo "Source successful."
80		else
81			call confirm(
82				\ "Source errored.\n" .
83				\ "\n", "&Ok", 1, "Info")
84		endif
85
86		if a:mode == "v"
87			normal gv
88		endif
89
90	endfunction
91	imap <silent> <M-F12> <C-b>:call Cream_source_self("i")<CR>
92	vmap <silent> <M-F12> :<C-u>call Cream_source_self("v")<CR>
93
94endif
95
96" 1}}}
97" vim:foldmethod=marker
98