This file is indexed.

/usr/share/vim/cream/cream-server.vim is in cream 0.43-3.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
"
" cream-server.vim -- Manage multiple sessions
"
" Cream -- An easy-to-use configuration of the famous Vim text editor
" [ http://cream.sourceforge.net ] Copyright (C) 2001-2011 Steve Hall
"
" License:
" This program is free software; you can redistribute it and/or modify
" it under the terms of the GNU General Public License as published by
" the Free Software Foundation; either version 3 of the License, or
" (at your option) any later version.
" [ http://www.gnu.org/licenses/gpl.html ]
"
" This program is distributed in the hope that it will be useful, but
" WITHOUT ANY WARRANTY; without even the implied warranty of
" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
" General Public License for more details.
"
" You should have received a copy of the GNU General Public License
" along with this program; if not, write to the Free Software
" Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
" 02111-1307, USA.
"
" Description:
" We like single sessions of Vim. If second Vim session opened, open
" the file in first session, close and move it to forefront

function! Cream_singleserver_init()
" initialize environment state (default is off)

	" don't use in terminal!
	if !has("gui_running")
		return
	elseif has("mac")
		return
	endif

	if exists("g:CREAM_SINGLESERVER")
		if g:CREAM_SINGLESERVER != 1
			let g:CREAM_SINGLESERVER = 0
			set swapfile
		else
			let g:CREAM_SINGLESERVER = 1
			"*** disable swapfiles until we resolve this
			set noswapfile
			"***
		endif
	else
		let g:CREAM_SINGLESERVER = 0
		set swapfile
	endif
endfunction


" Singleserver toggle (called by menu)
function! Cream_singleserver_toggle()

	" don't use in terminal!
	if !has("gui_running")
		return
	elseif has("mac")
		return
	endif

	" should already be initialized, but check anyway
	if exists("g:CREAM_SINGLESERVER")
		if g:CREAM_SINGLESERVER == 1
			call confirm(
				\ "\n" .
				\ "Single-Session Mode off -- multiple Vim sessions allowed.\n" .
				\ "\n", "&Ok", 1, "Info")
			let g:CREAM_SINGLESERVER = 0
			" save global in viminfo
		else
			call confirm(
				\ "\n" .
				\ "Single-Session Mode *on* -- multiple files will always\n" .
				\ "be opened within a single session of Vim.\n" .
				\ "\n", "&Ok", 1, "Info")
			let g:CREAM_SINGLESERVER = 1
			" save global in viminfo
		endif
		" init autocommand group
		call Cream_singleserver_init()
		" forget last buffer so future sessions have no memory
		let g:CREAM_LAST_BUFFER = ""
		wviminfo!
	else
		" error
		call Cream_error_warning("g:CREAM_SINGLESERVER not initialized in Cream_singleserver_toggle()")
	endif
	call Cream_menu_settings_preferences()
endfunction

function! Cream_singleserver()
" merge a second instance of Vim into the first one

	" don't use in terminal!
	if !has("gui_running")
		return
	elseif has("mac")
		return
	endif
    "" don't use if not initialized
    "if !exists("g:CREAM_SINGLESERVER")
    "    return
    "endif
    "" don't use if off
    "if g:CREAM_SINGLESERVER != 1
    "    return
    "endif
    "
    "" don't use if separate server over-ride on (see Cream_session_new() )
    "if exists("g:CREAM_SERVER_OVERRIDE")
    "    " reset
    "    unlet g:CREAM_SERVER_OVERRIDE
    "    return
    "endif

	"" option 1 (slow) {{{1
	"" collect servernames (separated by "\n", should be just one)
	"let myserverlist = serverlist()
	"" count
	"let servercount = MvNumberOfElements(myserverlist, "\n")
	"" get this server's name
	"let myserverid = v:servername

	"if servercount > 1
	"    " iterate through servernames until reaching one not equal to mine
	"    let i = 0
	"    while i < servercount
	"        let myserver = MvElementAt(myserverlist, "\n", i)
	"        if v:servername != myserver
	"            let myfile = expand("%:p")
	"            "*** no need to alter, Vim will re-handle
	"            "" windows slash to backslash (if exist, ie ":set shellslash")
	"            "if has("win32")
	"            "    let myfile = substitute(myfile,'/','\\','g')
	"            "endif
	"            "***
	"            if myfile != ""
	"                " escape
	"                let myfile = escape(myfile, " ")
	"                " solve buffer not found errors from second session startup
	"                let g:CREAM_LAST_BUFFER = ""
	"                let mycmd = "\<M-o>\<M-o>:edit " . "+" . line(".") . " " . myfile . "\<CR>"
	"            else
	"                let mycmd = "\<M-o>\<M-o>:call Cream_file_new()\<CR>"
	"            endif
	"            call remote_send(myserver, mycmd)
	"            "if has("win32")
	"            "\  has("
	"                call remote_expr(myserver, "foreground()")
	"            "else
	"            "    call foreground()
	"            "endif
	"            call Cream_exit()
	"            " we're toast at this point, but let's keep good form ;)
	"            break
	"        endif
	"        let i = i + 1
	"    endwhile
	"    ""*** DEBUG:
	"    "call confirm(
	"    "    \ "\n" .
	"    "    \ "  myserverlist = " . myserverlist . "\n" .
	"    "    \ "  servercount  = " . servercount . "\n" .
	"    "    \ "\n" .
	"    "    \ "  myserver     = " . myserver . "\n" .
	"    "    \ "  myfile       = " . myfile . "\n" .
	"    "    \ "  mycmd        = " . mycmd . "\n" .
	"    "    \ "\n", "&Ok", 1, "Info")
	"    ""***
	"endif 
	" 1}}}

	"" option 2 (do better guessing) {{{1
	"if v:servername !=? "GVIM"
	"
	"    " get opened file name
	"    let myfile = expand("%:p")
	"    " if have file, open it
	"    if myfile != ""
	"        " reverse backslashes
	"        let myfile = substitute(myfile, '\\', '/', 'g')
	"        " escape
	"        let myfile = escape(myfile, ' ')
	"        " solve buffer not found errors from second session startup
	"        let g:CREAM_LAST_BUFFER = ""
	"        " edit current file, maintain this position
	"        let mycmd = '<C-b>:edit ' . '+' . line('.') . ' ' . myfile . '<CR>'
	"    " open new buffer
	"    else
	"        let mycmd = '<C-b>:call Cream_file_new()<CR>'
	"    endif
	"    call remote_send('GVIM', mycmd)
	"    call remote_expr('GVIM', 'foreground()')
	"    call Cream_exit()
	"
	"end 
	" 1}}}

	" option 3 (just become the server) {{{1
	if v:servername !=? "CREAM"

		if !Cream_buffer_isnewunmod()

			" get opened file name
			let myfile = expand("%:p")
			" reverse backslashes
			let myfile = substitute(myfile, '\\', '/', 'g')
			" escape
			let myfile = escape(myfile, ' ')
			" solve buffer not found errors from second session startup
			let g:CREAM_LAST_BUFFER = ""
			""*** not needed, we're only concerned about variable space
			"" write the viminfo so it's remembered!
			"wviminfo!
			""***
			" edit current file, maintain this position
			let mycmd = "<C-\\><C-n>:edit +" . line('.') . ' ' . myfile . '<CR>'
		" open new buffer
		else
			let mycmd = "<C-\\><C-n>:call Cream_file_new()<CR>"
		endif
		call remote_send('CREAM', mycmd)
		" Fix tabs (last bit clears the line :)
		let mycmd = "<C-\\><C-n>:call Cream_tabpages_refresh()<CR><C-\\><C-n>:<CR>"
		call remote_send('CREAM', mycmd)

		call remote_foreground('CREAM')
		call Cream_exit()

		call Cream_menu_settings_preferences()

	end
	" 1}}}

endfunction

" vim:foldmethod=marker