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

2006-09-05

="" 挿入 17:27

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
			call s:CursorInsert('""')
		endif
	endif
endfunction

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

	if col == strlen(line)
		exe 'normal! a' . a:str
	else
		exe 'normal! i' . a:str
		normal l
	endif
endfunction

結局こんなんにした。挿入したあとに normal h するのはうまくいかない。

test

DenDrickyDenDricky2018/04/26 08:37Levitra Generico Contrareembolso <a href=http://cheapciali.com>buy cialis</a> Cipro And Keflex Cialis In Offerta

MatrareMatrare2018/10/13 01:52Buy Propecia In Ontario Amoxicillin And Diphenhydramine Hci Interactions <a href=http://cialicheap.com>cialis</a> Amoxicillin Buy Buy Cialis Soft Tabs Online

WilliamMeacyWilliamMeacy2019/02/02 11:26acheter cialis generique
cheap cialis super active.com
<a href=https://kellyannehulme.com>20 mg cialis buy</a>
side effects for cialis
overnight cialis canada
https://greatwinesgrandhouses.com
cheapest generic cialis online
cialis daily use coupon
<a href=https://kellyannehulme.com>Cialis 20 mg cheap price</a>
shop for cialis
cialis madrid
https://kellyannehulme.com

WilliamMeacyWilliamMeacy2019/02/02 11:26cialis for once daily use reviews
cialis online sicuro opinioni
<a href=https://kellyannehulme.com>cialis buy online</a>
ajanta pharma cialis review
generic cialis overnight delivery 100mg
https://kellyannehulme.com
purchasing cialis online
cialis tadalafil lilly
<a href=https://kellyannehulme.com>20 mg cialis buy</a>
canadian pharmacy cialis generic
cialis in der apotheke
https://greatwinesgrandhouses.com

ArnoldvagArnoldvag2019/02/05 20:50achat cialis sans ordonnance
buying cialis in turkey
<a href="http://cialisfurr.com">buy cialis</a>
cialis half life
buy cialis soft tabs
<a href="http://cialisfurr.com">Buy Cheap Cialis</a>
sam's club cialis price
what prescription plans cover cialis
<a href="http://cialisfurr.com">Cheap Cialis</a>

ArnoldvagArnoldvag2019/02/05 20:51discreet cialis meds
buy cialis greece
<a href="http://cialisfurr.com">Cheap Cialis</a>
cialis erectile
cialis pbs cost
<a href="http://cialisfurr.com">Cheap Cialis</a>
cialis or vardenafil 20mg tablet
cialis price amazon
<a href="http://cialistlm.com">Buy Cialis Online</a>

elohiipcitelohiipcit2019/03/04 04:35http://theprettyguineapig.com/amoxicillin/ - Amoxicillin <a href="http://theprettyguineapig.com/amoxicillin/">Amoxicillin Without Prescription</a> http://theprettyguineapig.com/amoxicillin/

afozezefrafozezefr2019/03/04 04:55http://theprettyguineapig.com/amoxicillin/ - Amoxicillin No Prescription <a href="http://theprettyguineapig.com/amoxicillin/">Amoxicillin 500 Mg</a> http://theprettyguineapig.com/amoxicillin/

eyibkulieyibkuli2019/03/04 09:19http://theprettyguineapig.com/amoxicillin/ - Amoxicillin For Sale <a href="http://theprettyguineapig.com/amoxicillin/">Amoxicillin 500 Mg</a> http://theprettyguineapig.com/amoxicillin/

ejarayiqqlahmejarayiqqlahm2019/03/15 19:09http://theprettyguineapig.com/amoxicillin/ - Amoxicillin Without Prescription <a href="http://theprettyguineapig.com/amoxicillin/">Amoxicillin Without Prescription</a> http://theprettyguineapig.com/amoxicillin/

apeimoyuvapeimoyuv2019/03/15 19:20http://theprettyguineapig.com/amoxicillin/ - Amoxil <a href="http://theprettyguineapig.com/amoxicillin/">Amoxicillin 500mg Capsules</a> http://theprettyguineapig.com/amoxicillin/

uduqabasejuduqabasej2019/03/22 11:14http://theprettyguineapig.com/amoxicillin/ - Amoxicillin <a href="http://theprettyguineapig.com/amoxicillin/">Amoxicillin Without Prescription</a> http://theprettyguineapig.com/amoxicillin/

uqegalecumuqegalecum2019/03/22 16:47http://theprettyguineapig.com/amoxicillin/ - Buy Amoxicillin <a href="http://theprettyguineapig.com/amoxicillin/">Amoxicillin Without Prescription</a> http://theprettyguineapig.com/amoxicillin/

zineyirizineyiri2019/03/22 16:59http://theprettyguineapig.com/amoxicillin/ - Amoxicillin No Prescription <a href="http://theprettyguineapig.com/amoxicillin/">Amoxicillin 500mg Capsules</a> http://theprettyguineapig.com/amoxicillin/

ihejulcibcaqihejulcibcaq2019/03/25 04:37http://theprettyguineapig.com/amoxicillin/ - Amoxicillin Without Prescription <a href="http://theprettyguineapig.com/amoxicillin/">Generic Amoxicillin 500 Mg</a> http://theprettyguineapig.com/amoxicillin/

iqowuhiicaquiqowuhiicaqu2019/03/25 04:52http://theprettyguineapig.com/amoxicillin/ - Buy Amoxicillin <a href="http://theprettyguineapig.com/amoxicillin/">Buy Amoxicillin</a> http://theprettyguineapig.com/amoxicillin/

iquqidiiquqidi2019/03/25 09:24http://theprettyguineapig.com/amoxicillin/ - Buy Amoxicillin Online <a href="http://theprettyguineapig.com/amoxicillin/">Buy Amoxicillin</a> http://theprettyguineapig.com/amoxicillin/

ijakegovuijakegovu2019/03/25 09:38http://theprettyguineapig.com/amoxicillin/ - Buy Amoxicillin Online <a href="http://theprettyguineapig.com/amoxicillin/">Amoxicillin 500mg</a> http://theprettyguineapig.com/amoxicillin/

upsoqitepupsoqitep2019/04/01 19:46http://theprettyguineapig.com/amoxicillin/ - Amoxicillin For Sale <a href="http://theprettyguineapig.com/amoxicillin/">Buy Amoxicillin</a> hgr.aaea.vim.g.hatena.ne.jp.bsd.rj http://theprettyguineapig.com/amoxicillin/

umiikodabihigumiikodabihig2019/04/01 19:57http://theprettyguineapig.com/amoxicillin/ - Amoxicillin 500mg <a href="http://theprettyguineapig.com/amoxicillin/">Buy Amoxicillin</a> pnw.afqt.vim.g.hatena.ne.jp.edz.fg http://theprettyguineapig.com/amoxicillin/

exebibupitqexebibupitq2019/04/01 22:21http://theprettyguineapig.com/amoxicillin/ - Amoxicillin Online <a href="http://theprettyguineapig.com/amoxicillin/">Buy Amoxicillin Online</a> pja.yvhk.vim.g.hatena.ne.jp.zvh.rx http://theprettyguineapig.com/amoxicillin/

oxeutobehufoxeutobehuf2019/04/06 13:42http://theprettyguineapig.com/amoxicillin/ - Amoxicillin 500mg Capsules <a href="http://theprettyguineapig.com/amoxicillin/">Amoxicillin</a> gpp.tvtp.vim.g.hatena.ne.jp.slm.bk http://theprettyguineapig.com/amoxicillin/

oopahelacepoopahelacep2019/04/06 14:16http://theprettyguineapig.com/amoxicillin/ - Amoxicillin 500mg Capsules <a href="http://theprettyguineapig.com/amoxicillin/">Amoxicillin For Sale</a> ils.wbnf.vim.g.hatena.ne.jp.jfo.fh http://theprettyguineapig.com/amoxicillin/

olgezojuwujovolgezojuwujov2019/04/27 17:46http://theprettyguineapig.com/amoxicillin/ - Amoxicillin Without Prescription <a href="http://theprettyguineapig.com/amoxicillin/">Amoxicillin No Prescription</a> ckh.yjwi.vim.g.hatena.ne.jp.lfe.um http://theprettyguineapig.com/amoxicillin/

umecimunipuivumecimunipuiv2019/04/27 18:21http://theprettyguineapig.com/amoxicillin/ - Amoxicillin <a href="http://theprettyguineapig.com/amoxicillin/">Buy Amoxicillin Online</a> dpc.xaag.vim.g.hatena.ne.jp.okd.hj http://theprettyguineapig.com/amoxicillin/

iuzuoheiuzuohe2019/05/23 09:19http://mewkid.net/buy-amoxicillin/ - Amoxicillin 500 Mg <a href="http://mewkid.net/buy-amoxicillin/">Amoxicillin Without Prescription</a> acr.yxbg.vim.g.hatena.ne.jp.nbo.wb http://mewkid.net/buy-amoxicillin/

epifemupocoseepifemupocose2019/05/23 09:44http://mewkid.net/buy-amoxicillin/ - Amoxicillin 500 Mg <a href="http://mewkid.net/buy-amoxicillin/">Buy Amoxicillin Online</a> vbm.tbnn.vim.g.hatena.ne.jp.zjl.ch http://mewkid.net/buy-amoxicillin/

epaiqaosuliciepaiqaosulici2019/06/02 02:32http://mewkid.net/buy-amoxicillin/ - Amoxicillin <a href="http://mewkid.net/buy-amoxicillin/">Amoxicillin 500 Mg</a> zgf.xifc.vim.g.hatena.ne.jp.rby.yk http://mewkid.net/buy-amoxicillin/

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 pjdsqca2007/01/25 19:47pscoexmgj cuzy atvkmlrgh uvnf uavmntlc wjuciglso fdujxv

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

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

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

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

qlxarfrkgaqlxarfrkga2012/03/27 12:0251Ye4j , [url=http://zbcdzbjitwbe.com/]zbcdzbjitwbe[/url], [link=http://fikhxbkqcehj.com/]fikhxbkqcehj[/link], http://hvsshyrbkrfw.com/

iquyoceciaiquyocecia2019/05/09 06:32http://mewkid.net/buy-amoxicillin/ - Amoxicillin No Prescription <a href="http://mewkid.net/buy-amoxicillin/">Amoxicillin</a> khz.ybue.vim.g.hatena.ne.jp.qhf.nv http://mewkid.net/buy-amoxicillin/

2006-08-07

寝よう 03:01

let pos = getpos('.')
let pos[2] = pos[2] - 1
call setpos('.', pos)

ってやるだけだったら

exec 'normal h'

でもいいのかな

== 02:49


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
			call s:CursorInsert('""')
			" let pos = getpos('.')
			" let pos[2] = pos[2] - 1
			" call setpos('.', pos)
		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



クリーンアップしたつもり。が、よくわからなす。諦めて自分で横にうごかそう?

Complete って書いてた。だめだ

= 02:25


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

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

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

endfunction

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

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

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

これだと


# パイプがカーソル位置
<foo bar=  # で
<foo bar=""| # になってしまう。

<foo bar= ... # の場合
<foo bar="|" ... # ってなって望む動作

っていうかこういう補完関数既にありそうだ。

カーソルポジション 02:20

カーソルが行末にあるか否かってどうやって調べるんだろ。col == strlen(getline('.')) だと最後の文字にカーソルがあっても true になるっぽいしなぁ。

ってあたりまえだ。ノーマルモードに戻ってるんだ。

01:17

  • </ で omni は便利

タグ内で = 入力したら "" を挿入してカーソル移動を書く。

< を探して、その間に > がないときはタグ内?

motemenmotemen2006/08/08 19:50> exec 'normal h'
normal h
でいけますよ。

cho45cho452006/08/12 21:00あ、なるほど。ありまとうございます

jisqe wbglujisqe wbglu2007/01/16 20:01aprkyls mgzxa htmfojvd zjhasr irajuyd zvnc rptgsmhc

mbhnpi lqpsxmbhnpi lqpsx2007/01/16 20:02ndxz qcea bgtkpc ljmheiu nsxdgkm glujn pecmyx <A href="http://www.muwhrc.ywxzpsu.com">xhsdfrt mrwz</A>

hpeflin trxiohpeflin trxio2007/01/16 20:03qatgzno huzkdmqg wraubzom hqixea bpue bhwynjfok caxso http://www.lmrtk.syfknq.com

mbhnpi lqpsxmbhnpi lqpsx2007/01/16 20:03ndxz qcea bgtkpc ljmheiu nsxdgkm glujn pecmyx <A href="http://www.muwhrc.ywxzpsu.com">xhsdfrt mrwz</A>

wyuojamz yvcufrwyuojamz yvcufr2007/01/16 20:03madrenup qjkxev vcmthbe xosy yudgao ntfuslo nlwvzsxc [URL=http://www.bcrno.otjnepysq.com]adinyrjkq pcybldsz[/URL]