Want to read Slashdot from your mobile device? Point it at m.slashdot.org and keep reading!

 



Forgot your password?
typodupeerror
×
User Journal

Journal sillypixie's Journal: VI gurus - help? 2

Has anyone out there seen a case where vi inserts ever more tabs into a pasted piece of code in insert mode?

The following two octal dumps were made by pasting the same copied code twice - first into a redirected cat file called shorttest1, and later into vi, saved as shorttest2

Right around line 0000060 in each file, although slashdot takes it out and moves the whole line to the left, there is a place in the pasted content where there are 8 spaces. On line 0000200, there are also 8 spaces - but in the vi file, a tab has been prepended. The next time there are 8 spaces, 2 tabs are prepended. After that, 3 tabs are prepended. And so on... Always the 8 spaces remain.

I have to assume this is a botched attempt at replacing the 8 spaces with a tab.

Anyone been here seen this and can help?

Thanks for your time.

Pixie


ps - I can't find a fixed-width font that will show the code in columnar form. Sigh. Perhaps if you paste it somewhere fixed width, it will make sense.

$ vi -h
VIM - Vi IMproved 6.3 (2004 June 7, compiled Aug 29 2007 17:32:14)

$ od -c shorttest1
0000000 f u n c t i o n w f A d d C u
0000020 s t o m V a r i a b l e ( & $ m
0000040 a g i c W o r d s ) { \n
0000060 f o r e a c h ( $ G L
0000100 O B A L S [ ' w g C u s t o m V
0000120 a r i a b l e s ' ] a s $ v
0000140 a r ) $ m a g i c W o r d s [
0000160 ] = " M A G _ $ v a r " ; \n
0000200 r e t u r n t
0000220 r u e ; \n } \n
0000240 \n f u n c t i o n w f A d d C
0000260 u s t o m V a r i a b l e I D (
0000300 & $ v a r i a b l e s ) { \n
0000320 f o r e a c h ( $
0000340 G L O B A L S [ ' w g C u s t o
0000360 m V a r i a b l e s ' ] a s
0000400 $ v a r ) $ v a r i a b l e s
0000420 [ ] = c o n s t a n t ( " M
0000440 A G _ $ v a r " ) ; \n
0000460 r e t u r n t r u e ; \n
0000500 } \n
0000512
$ od -c shorttest2
0000000 f u n c t i o n w f A d d C u
0000020 s t o m V a r i a b l e ( & $ m
0000040 a g i c W o r d s ) { \n
0000060 f o r e a c h ( $ G L
0000100 O B A L S [ ' w g C u s t o m V
0000120 a r i a b l e s ' ] a s $ v
0000140 a r ) $ m a g i c W o r d s [
0000160 ] = " M A G _ $ v a r " ; \n
0000200 \t r e t u r n
0000220 t r u e ; \n \t \t
0000240 } \n \t \t \t \n \t \t \t f u n c t
0000260 i o n w f A d d C u s t o m V
0000300 a r i a b l e I D ( & $ v a r i
0000320 a b l e s ) { \n \t \t \t
0000340 f o r e a c h ( $ G L
0000360 O B A L S [ ' w g C u s t o m V
0000400 a r i a b l e s ' ] a s $ v
0000420 a r ) $ v a r i a b l e s [ ]
0000440 = c o n s t a n t ( " M A G
0000460 _ $ v a r " ) ; \n \t \t \t \t
0000500 r e t u r n t r u
0000520 e ; \n \t \t \t \t \t
0000540 } \n \n

This discussion has been archived. No new comments can be posted.

VI gurus - help?

Comments Filter:

The moon is made of green cheese. -- John Heywood

Working...