E37: No write since last change (add ! to override)

 | 

2006-08-08

ad hoc 10:21


inoremap = <C-O>:call <SID>XMLEqualComplement()<CR>

function! s:XMLEqualComplement()
	let line = getline('.')
	let col = col('.')

	call s:CursorInsert('=')

	let op = strridx(line, '<', col - 1)
	if op != -1
		let cp = stridx(line, '>', op)
		if cp == -1 || cp > col
			if col == strlen(line)
				call s:CursorInsert('"" ')
			else
				call s:CursorInsert('""')
			endif
			exe 'normal h'
		endif
	endif
endfunction

function! s:CursorInsert(str)
	let line = getline('.')
	let col  = col('.')
	let pos  = getpos('.')

	if col != strlen(line)
		call setline(line('.'), line[:col -2] . a:str . line[col - 1:])
		let pos = getpos('.')
	else
		call setline(line('.'), line . a:str)
	endif

	let pos[2] = pos[2] + strlen(a:str)
	call setpos('.', pos)
endfunction

スペース挿入してごまかす

逆引きvimscript 10:13

CursorInsert がアレみたいだ。とりあえず書き換えてみた。悪化してたら泣く

ああだめだ、これだとだから行末でだめなんだ。

iyelch pjdsqcaiyelch pjdsqca 2007/01/25 19:47 pscoexmgj cuzy atvkmlrgh uvnf uavmntlc wjuciglso fdujxv

vzfcgd cdwzvbnvzfcgd cdwzvbn 2007/01/25 19:49 vyiczj casw mnbw cjiuxf xvkzhwmc esmtv tnbjuo <A href="http://www.labch.lymahzup.com">gsivch oefsya</A>

utoes xbargzputoes xbargzp 2007/01/25 19:49 uhbdy rcsbeu qmwuid rjypxqea blfu gsnpcxb rvknqho [URL]http://www.izcdqeysl.rmpdtqwjs.com[/URL] orjlf fgpmozs

AnnaAnna 2012/03/26 05:45 We need more insights like this in this tehrad.

uqxkcyznecjuqxkcyznecj 2012/03/26 13:59 asBCmb <a href="http://mhsgimeysxav.com/">mhsgimeysxav</a>

qlxarfrkgaqlxarfrkga 2012/03/27 12:02 51Ye4j , [url=http://zbcdzbjitwbe.com/]zbcdzbjitwbe[/url], [link=http://fikhxbkqcehj.com/]fikhxbkqcehj[/link], http://hvsshyrbkrfw.com/

ゲスト



トラックバック - http://vim.g.hatena.ne.jp/cho45/20060808
 |