I'm back

2007-04-06 Thread Thomas Köhler
Hello all,
I just wanted to let you know that I am back on the vim and
vim-dev mailinglists. I won't have time to write many mails, but
my colleagues at work started to ask me a lot of questions about
vim when they found out that I wrote syn on and colorscheme
koehler in root's vimrc of all servers so I thought it might be
good to get back to the old habit of learning by reading the
solutions of fellow vim users to the questions of other vim
users. :-)
I might as well throw in a few mails, but as I only read my
private mail on the weekends there will be only a few mails from
me...

Ciao,
Thomas

-- 
 Thomas Köhler   Email:   [EMAIL PROTECTED]
  WWW:  http://gott-gehabt.de
 IRC:   tkoehler
 PGP public key available from Homepage!


signature.asc
Description: Digital signature


Re: How to modify code so that only one space is between two characters or words?

2007-04-06 Thread Eric Leenman

[...]
You could use a Search/Replace on the full text.  This does end up 
modifying your base text, so be sure to only use it on modifiable buffers.

For example:
- all lines containing the char : followed with zero or more then one 
space(s) and then in

should become:  untouched what is here: in(untouched what is here
 aaa : in std_logic;
 bb : in std_logic_vector(7 downto 0);

:%s/: \+in/: in/g

or, if you want to overwrite all whitespace (spaces, tabs, other 
unprintable characters), use:


:%s/:\s\+in/: in/g


Thanks,

This works for all lines containing one or more spaces.
Why doesn't it work for lines which have no space between : and in?
So when it'saaa :in std_logic;

_
MSN is giving away a trip to Vegas to see Elton John.  Enter to win today. 
http://msnconcertcontest.com?icid-nceltontagline




Re: creating your own indent markers

2007-04-06 Thread Dimitar
May be what you need is:

:help cinoptions-values

if you are using cindent

Regards,
Dimitar

* Eric Leenman [EMAIL PROTECTED] [070406 08:10]:
 Hi,
 
 Is it possible to redefine (or adjust) some of the indent markers.
 I have code containing  ( at the end
 I.e:
 port map (
  aa = bb,
  cc = dd);
 
 
 when I indent the file with gg=G it get indented so that
 aa is below the ( character and not indented two spaces from port map.
 (I've showned it below but not sure it's aligned right when displayed in all 
 mail clients)
 port map (
   aa = bb,
   cc = dd);
 
 Can you tell vim that it should indent from the p of port iso the (?
 
 Rgds,
 Eric
 
 _
 Download Messenger. Join the i?m Initiative. Help make a difference today. 
 http://im.live.com/messenger/im/home/?source=TAGHM_APR07


Re: How to modify code so that only one space is between two characters or words?

2007-04-06 Thread Matthew Winn
On Fri, 06 Apr 2007 05:52:33 +, Eric Leenman
[EMAIL PROTECTED] wrote:

 :%s/:\s\+in/: in/g
 
 This works for all lines containing one or more spaces.
 Why doesn't it work for lines which have no space between : and in?

Use :%s/:\s*in/: in/g instead (replace the \+ with *: \+ means one
or more, * means zero or more).

-- 
Matthew Winn


答复: How to open a BIG file quickly?

2007-04-06 Thread 陈方荣

 -邮件原件-
 发件人: Jean-Rene David [mailto:[EMAIL PROTECTED]
 发送时间: 2007年4月6日 :00:09
 收件人: Vim
 主题: Re: How to open a BIG file quickly?
 
 * Tom Purl [2007.04.05 12:00]:
   I need to do that quite often. They are usually
   log files from a long running program in debug
   mode.
 
  Actually, you can think of a log file as a sort
  of flat file database.  Here's an example
 
 I appreciate all the help but I really don't have
 a problem with large files. I *do* preprocess my
 large files with grep/awk/perl in all sorts of
 ways and *do* use vim to view and edit the
 resulting chunks.
 
 I am not the OP, and I was just mentioning log
 files because someone sounded surprised one might
 legitimately need to edit a 1GB file.
 
 And before somebody mentions it, I do know about
 logrotate... :-)
 
 --
 JR

Thank you all for the help.
I'm a new user to GVIM, so I think I can use GVIM to open any files.

Thanks to Christian Ebert [EMAIL PROTECTED] for giving the URL:
  Try http://www.vim.org/scripts/script.php?script_id=1506.
It works.

I think that grep/awk/perl can handle this case. (I'm a M$ user. :( ,and not 
install Cygwin, o(∩_∩)o... ) I'll study that.

Please close this topic.

--
Regards
Chenfangrong




replace word from buffer

2007-04-06 Thread meino . cramer
Hi,

 is there a way to do this more effectively?

 I often get in the situation of yanking a word
 into the buffer, search another word I want to
 replace with the contents of the buffer, delete
 the found word and paste the contents of the buffer
 at the place of the previously found word.

 Despite the fact, that -- without the yank-ring
 script -- you have to keep an eye on what is
 in what buffer, it would be more effective
 if one could do the following:
  
 ywyank replacement word
 /word find word (word) to be replaced
 cwchange word under cursor with that in buffer

 I know, that cw is another command, which is wrong in 
 this case...I only needed a name for what I want to do and
 cw keeps track of the length of the replaced word and the
 replacement.

 Thank you very much for any helpful hint :)   !

 Keep editing!
 mcc
-- 
Please don't send me any Word- or Powerpoint-Attachments
unless it's absolutely neccessary. - Send simply Text.
See http://www.gnu.org/philosophy/no-word-attachments.html
In a world without fences and walls nobody needs gates and windows.


Re: replace word from buffer

2007-04-06 Thread Dimitar
What I do is

ye  yank
/word   search
vep paste

Gruss,
Dimitar

* [EMAIL PROTECTED] [EMAIL PROTECTED] [070406 09:00]:
 Hi,
 
  is there a way to do this more effectively?
 
  I often get in the situation of yanking a word
  into the buffer, search another word I want to
  replace with the contents of the buffer, delete
  the found word and paste the contents of the buffer
  at the place of the previously found word.
 
  Despite the fact, that -- without the yank-ring
  script -- you have to keep an eye on what is
  in what buffer, it would be more effective
  if one could do the following:
   
  ywyank replacement word
  /word find word (word) to be replaced
  cwchange word under cursor with that in buffer
 
  I know, that cw is another command, which is wrong in 
  this case...I only needed a name for what I want to do and
  cw keeps track of the length of the replaced word and the
  replacement.
 
  Thank you very much for any helpful hint :)   !
 
  Keep editing!
  mcc
 -- 
 Please don't send me any Word- or Powerpoint-Attachments
 unless it's absolutely neccessary. - Send simply Text.
 See http://www.gnu.org/philosophy/no-word-attachments.html
 In a world without fences and walls nobody needs gates and windows.


Re: replace word from buffer

2007-04-06 Thread Dimitar
A search and replace would be of course sometimes better:

:%s/old_word/new_word/gc

:help :s
:help s_flags

Dimitar



* [EMAIL PROTECTED] [EMAIL PROTECTED] [070406 09:00]:
 Hi,
 
  is there a way to do this more effectively?
 
  I often get in the situation of yanking a word
  into the buffer, search another word I want to
  replace with the contents of the buffer, delete
  the found word and paste the contents of the buffer
  at the place of the previously found word.
 
  Despite the fact, that -- without the yank-ring
  script -- you have to keep an eye on what is
  in what buffer, it would be more effective
  if one could do the following:
   
  ywyank replacement word
  /word find word (word) to be replaced
  cwchange word under cursor with that in buffer
 
  I know, that cw is another command, which is wrong in 
  this case...I only needed a name for what I want to do and
  cw keeps track of the length of the replaced word and the
  replacement.
 
  Thank you very much for any helpful hint :)   !
 
  Keep editing!
  mcc
 -- 
 Please don't send me any Word- or Powerpoint-Attachments
 unless it's absolutely neccessary. - Send simply Text.
 See http://www.gnu.org/philosophy/no-word-attachments.html
 In a world without fences and walls nobody needs gates and windows.


Re: replace word from buffer

2007-04-06 Thread Gary Johnson
On 2007-04-06, [EMAIL PROTECTED] wrote:
 Hi,
 
  is there a way to do this more effectively?
 
  I often get in the situation of yanking a word
  into the buffer, search another word I want to
  replace with the contents of the buffer, delete
  the found word and paste the contents of the buffer
  at the place of the previously found word.
 
  Despite the fact, that -- without the yank-ring
  script -- you have to keep an eye on what is
  in what buffer, it would be more effective
  if one could do the following:
   
  ywyank replacement word
  /word find word (word) to be replaced
  cwchange word under cursor with that in buffer
 
  I know, that cw is another command, which is wrong in 
  this case...I only needed a name for what I want to do and
  cw keeps track of the length of the replaced word and the
  replacement.
 
  Thank you very much for any helpful hint :)   !

Actually, cw isn't wrong, it's just incomplete.  Yanked but not 
deleted text goes automatically into the 0 (zero, not oh) register 
unless you specified some other register.  So yw yanks the 
replacement word into both the unnamed register and register 0.  
Then all you have to do is specify register 0 as the source of the 
replacement text when you type cw by following cw with ^R0 
where by ^R I means Ctrl-R.

You can read more about these registers under

:help registers

sections 1. and 2., and about using Ctrl-R under

:help i_CTRL-R

HTH,
Gary

-- 
Gary Johnson | Agilent Technologies
[EMAIL PROTECTED] | Mobile Broadband Division
 | Spokane, Washington, USA


Tab completion and UTF-8

2007-04-06 Thread Bertram Scharpf
Hi,

as already remarked in Tip #102, the provided versions do
not handle UTF-8 characters correctly. As it is not possible
to add a tip note currently, I post my new version here.

  function InsertMatch( direction)
if match(getline( '.'),'\k\%'.virtcol('.').'v') = 0
  let dir = a:direction
else
  let dir = 0
end
if dir  0
  return \c-p
elseif dir  0
  return \c-n
else
  return \tab
endif
  endfunction

  inoremap tab   c-r=InsertMatch( -1)cr
  inoremap s-tab c-r=InsertMatch( +1)cr

Bertram


-- 
Bertram Scharpf
Stuttgart, Deutschland/Germany
http://www.bertram-scharpf.de


compiler plugin for the ARM compiler

2007-04-06 Thread Sibin P. Thomas
Hi,

Is a compiler plugin for the ARM compiler (armcc) already available?
(Couldn't find it in the Vim site) 

I am basically looking for the errorformat for the ARM compiler.

Regards,
Sibin


DISCLAIMER:
This message (including attachment if any) is confidential and may be 
privileged. Before opening attachments please check them for viruses and 
defects. MindTree Consulting Limited (MindTree) will not be responsible for any 
viruses or defects or any forwarded attachments emanating either from within 
MindTree or outside. If you have received this message by mistake please notify 
the sender by return  e-mail and delete this message from your system. Any 
unauthorized use or dissemination of this message in whole or in part is 
strictly prohibited.  Please note that e-mails are susceptible to change and 
MindTree shall not be liable for any improper, untimely or incomplete 
transmission.


Re: how to replace ESC to some other key?

2007-04-06 Thread Yakov Lerner

On 4/6/07, Taylor Venable [EMAIL PROTECTED] wrote:

On Wed, 4 Apr 2007 10:22:43 -0400
Yakov Lerner [EMAIL PROTECTED] wrote:

 On 4/4/07, wangxu [EMAIL PROTECTED] wrote:
  ESC is so far from the center of the keyboard.
  Can I replace this key to Caps Lock,for example?

 I heard some people use Tab as a substitute for Esc. Weird.
 But it's easier to do in platform-independent way.

 Yakov

If Wikipedia is correct in that vi was originally written on ADM-3A
terminals (I think I also read that on here at one time as well) and
that this particular terminal had it's escape key where nearly all
modern keyboards have a tab key, it kinda makes sense.

Here's the page, for reference: http://en.wikipedia.org/wiki/Vi


Indeed. And it didn't have tab key, did it ?

I use the  mini-keyboard (measures 29x11cm).
I love it becaise everything is nearby. Fingers need to traver less.
And takes less space on the crammed desktop :-)

Another nice relevant link is this keyboard:

   http://www.engadget.com/tag/optimus
   optimis keyboard where every key is a [color] display

Yakov


RE: copy pasting HTML code into vim

2007-04-06 Thread Gene Kwiecinski
Let's say I open up a webpage, select some text and paste it into vim.
Then
all I see in vim is the text I see on the browser. While this is OK
most of
the times, sometimes I wish there is a way to paste the actual HTML
code
directly into the vim.

Selecting view source of the webpage and then copy pasting into vim
will
work. But it is very cumbersome and time consuming. So this is not an
option for me.

Wouldn't think so.  That's a function of the browser (what yanks the
text into the buffer to begin with), and not 'vim' (which only gets
what's handed to it).

Were you to put the yanked text to 'notepad', 'textpad', etc., it'd be
the same thing, just the plain unadorned text.

GIGO (garbage in, garbage out).


Fwiw, just use shortcuts to get to the source, whether
altvs/alt, ^S, ^U, whatever your particular browser needs to
get there.  Can quite often be done in literally just 1 keystroke, so
I'm not sure why you say this is not an option for me.  Finding the
section of the source you want to cp *might* be more difficult if there
be a lot of repetitive words/phrases and you have a hard time isolating
the section, but a simple find-text (^F, etc.) should do the job
fairly well.  No?

And don't forget, quite a lot of times what's displayed by the c/p text
is incomplete, as you'd likely need the stylesheet (.css file) to make
sense of different classes, etc.  That's why I usually just pig the
whole page and all associated files, and *then* worry about narrowing it
down to the text I need.


Re: copy pasting HTML code into vim

2007-04-06 Thread Reid Thompson

Gene Kwiecinski wrote:

Let's say I open up a webpage, select some text and paste it into vim.


Then
  

all I see in vim is the text I see on the browser. While this is OK


most of
  

the times, sometimes I wish there is a way to paste the actual HTML


code
  

directly into the vim.



  

Selecting view source of the webpage and then copy pasting into vim


will
  

work. But it is very cumbersome and time consuming. So this is not an
option for me.



Wouldn't think so.  That's a function of the browser (what yanks the
text into the buffer to begin with), and not 'vim' (which only gets
what's handed to it).

Were you to put the yanked text to 'notepad', 'textpad', etc., it'd be
the same thing, just the plain unadorned text.

GIGO (garbage in, garbage out).


Fwiw, just use shortcuts to get to the source, whether
altvs/alt, ^S, ^U, whatever your particular browser needs to
get there.  Can quite often be done in literally just 1 keystroke, so
I'm not sure why you say this is not an option for me.  Finding the
section of the source you want to cp *might* be more difficult if there
be a lot of repetitive words/phrases and you have a hard time isolating
the section, but a simple find-text (^F, etc.) should do the job
fairly well.  No?

And don't forget, quite a lot of times what's displayed by the c/p text
is incomplete, as you'd likely need the stylesheet (.css file) to make
sense of different classes, etc.  That's why I usually just pig the
whole page and all associated files, and *then* worry about narrowing it
down to the text I need.
  

curl www.yahoo.com | vim -

or from within vim

:r !curl www.yahoo.com


Re: copy pasting HTML code into vim

2007-04-06 Thread Reid Thompson

Reid Thompson wrote:

Gene Kwiecinski wrote:

Let's say I open up a webpage, select some text and paste it into vim.

Then

all I see in vim is the text I see on the browser. While this is OK

most of

the times, sometimes I wish there is a way to paste the actual HTML

code

directly into the vim.



Selecting view source of the webpage and then copy pasting into vim

will

work. But it is very cumbersome and time consuming. So this is not an
option for me.


Wouldn't think so. That's a function of the browser (what yanks the
text into the buffer to begin with), and not 'vim' (which only gets
what's handed to it).

Were you to put the yanked text to 'notepad', 'textpad', etc., it'd be
the same thing, just the plain unadorned text.

GIGO (garbage in, garbage out).


Fwiw, just use shortcuts to get to the source, whether
altvs/alt, ^S, ^U, whatever your particular browser needs to
get there. Can quite often be done in literally just 1 keystroke, so
I'm not sure why you say this is not an option for me. Finding the
section of the source you want to cp *might* be more difficult if there
be a lot of repetitive words/phrases and you have a hard time isolating
the section, but a simple find-text (^F, etc.) should do the job
fairly well. No?

And don't forget, quite a lot of times what's displayed by the c/p text
is incomplete, as you'd likely need the stylesheet (.css file) to make
sense of different classes, etc. That's why I usually just pig the
whole page and all associated files, and *then* worry about narrowing it
down to the text I need.

curl www.yahoo.com | vim -

or from within vim

:r !curl www.yahoo.com

you may want to pass the -s parameter to curl to not show the progess meter


RE: copy pasting HTML code into vim

2007-04-06 Thread Timothy Adams
This is a clipboard thing - windows for instance copies stuff in many forms and 
pastes it in the form most acceptable to the receiving app - plaintext for vim, 
html/rtf for a word processor... Dunno if there's a way for vim to say gimme 
html.

I would try looking at your browser. In firefox, for example, you can select a 
source editor in about:config

Set view_source.editor.external to true, and view_source.editor.path to your 
path to the vim binary.

Then when you do view source, it'll popup in vim. You can /search for the text 
you wanted, yank it with its enclosing html, and paste it into a split buffer. 
You can do all this without having to use the mouse (assuming you have a view 
source hotkey), so I don't think it's too cumbersome.

I know in lynx you can select a source editor as well, although I don't recall 
how right now, and probably in all other major browsers as well.

*tim* 

-Original Message-
From: news [mailto:[EMAIL PROTECTED] On Behalf Of Kamaraju S Kusumanchi
Sent: Thursday, April 05, 2007 11:15 PM
To: vim@vim.org
Subject: copy pasting HTML code into vim

Let's say I open up a webpage, select some text and paste it into vim. Then all 
I see in vim is the text I see on the browser. While this is OK most of the 
times, sometimes I wish there is a way to paste the actual HTML code directly 
into the vim.

Selecting view source of the webpage and then copy pasting into vim will 
work. But it is very cumbersome and time consuming. So this is not an option 
for me.

Currently the editor in docs.google.com does what I need, Is there any way the 
same can be achieved by vim?

thanks
raju

--
Kamaraju S Kusumanchi
http://www.people.cornell.edu/pages/kk288/
http://malayamaarutham.blogspot.com/



Silly Question

2007-04-06 Thread Dudley Fox

Has anyone else heard of the vi name game?

I was talking to an old crusty developer, and he said they used to
open a random (unimportant) text file in vi. Then before typing in
their name (and only their name, no going into insert mode first),
they would have to guess what their name would tell vi to do. Then
type in their name, and see if they were right. They assumed a vanilla
vi with no mappings etc.

For instance my name: Dudley
1. D - Would delete to the end of line
2. u - undo the deletion
3. dl - delete to the end of the line
4. e - jump to the end of the next word
5. y - start a yank, but never complete it since no follow up key was pressed.


Dang I was wrong about step 3, it will only delete the next character
not the entire line.

Enjoy,
Dudley


Re: Python crash

2007-04-06 Thread Aaron Griffin

On 4/5/07, Chuck Mason [EMAIL PROTECTED] wrote:


/nodefaultlib:python24.lib

That's 2.4 right?

The point is that vim.command() is not thread-safe.  I tried this in
pearl (5.8) as well with the same result.  Except that perl's VIM::Msg
works in a thread (albeit things seem unstable) and VIM::DoCommand does
not.


What do you need separate thread in a text editor for, anyway?


RE: Silly Question

2007-04-06 Thread Max Dyckhoff
Max: insert an 'x' on the line in the middle of the current buffer
Dyckhoff: delete to end of line and insert ff on a new line above ('k' goes 
up a line, 'o' starts insertion on new line below)

:)

I think it would be fun to find a real name which did something actually 
interesting in vim.

Max

-Original Message-
From: Dudley Fox [mailto:[EMAIL PROTECTED]
Sent: Friday, April 06, 2007 8:50 AM
To: vim@vim.org
Subject: Silly Question

Has anyone else heard of the vi name game?

I was talking to an old crusty developer, and he said they used to
open a random (unimportant) text file in vi. Then before typing in
their name (and only their name, no going into insert mode first),
they would have to guess what their name would tell vi to do. Then
type in their name, and see if they were right. They assumed a vanilla
vi with no mappings etc.

For instance my name: Dudley
1. D - Would delete to the end of line
2. u - undo the deletion
3. dl - delete to the end of the line
4. e - jump to the end of the next word
5. y - start a yank, but never complete it since no follow up key was pressed.


Dang I was wrong about step 3, it will only delete the next character
not the entire line.

Enjoy,
Dudley


RE: copy pasting HTML code into vim

2007-04-06 Thread Gene Kwiecinski
In Firefox, you can select some part of the text, right-click on it and
one of the options is view selection source - like view source but
the relevant piece of it is already selected. That's a decent way of
replacing find-next in the source view.

Ooh, ooh, what he said...

I'm so in the habit of just pigging the entire page and looking at the
source offline later, that I never hit on this particular nicety.  Yep,
that works all a treat!  :D

As for how to feed that to 'vim', though...


RE: copy pasting HTML code into vim

2007-04-06 Thread Timothy Adams
For some reason, even if you set up vim as your source editor, view selection 
source still opens in firefox's default viewer... sux 

-Original Message-
From: Gene Kwiecinski [mailto:[EMAIL PROTECTED] 
Sent: Friday, April 06, 2007 12:43 PM
To: Vincent BEFFARA; vim@vim.org; Kamaraju S Kusumanchi
Subject: RE: copy pasting HTML code into vim

In Firefox, you can select some part of the text, right-click on it and 
one of the options is view selection source - like view source but 
the relevant piece of it is already selected. That's a decent way of 
replacing find-next in the source view.

Ooh, ooh, what he said...

I'm so in the habit of just pigging the entire page and looking at the source 
offline later, that I never hit on this particular nicety.  Yep, that works all 
a treat!  :D

As for how to feed that to 'vim', though...


Vim freezes system ?!

2007-04-06 Thread meino . cramer
Hi,

 I did th3 follwing: With a program, which generates random numbers in
 different formats, I created a file, which consists of _one_ line of
 2097152 characters (0-9,A-F).

 To split the line into lines of 72 characters each, I started vim and
 let it read the file.

 I postioned the cursor at position 0 and entered the following in
 normal mode:

 qq72rightireturnesc0q

 Then I did a 

 [EMAIL PROTECTED]

 After only 10 or 15 (guessed) executions of the macro the system
 freezes while constantly swapping (?) and became unuseable and did no
 longer respond.

 Even the mouse pointer was nearly unmoveable...

 After heavily and constantly trying I managed to kill the X-session
 and to 'killall -9 vim' from the console to get back my computer.

 I am using an up-to-date version of Gentoo and vim (not gvim).  My
 system runs an AMD 64 X2 3800+ CPU and uses a Seagate 200GB harddisk
 (dma enabled). It needs a lot of load to bring the system to its
 knees.

 May be it was wrong what I did in the sense of there are better
 UNIX tools to reformat such a file or better commands in vim to
 accomplish this,...

 ...but in a critical moment it may be that I would have lost my work
 (other open applikations) due to the need of killing X.


 Keep editing! ;)
 mcc







-- 
Please don't send me any Word- or Powerpoint-Attachments
unless it's absolutely neccessary. - Send simply Text.
See http://www.gnu.org/philosophy/no-word-attachments.html
In a world without fences and walls nobody needs gates and windows.


Re: Silly Question

2007-04-06 Thread Mikolaj Machowski
On piątek 06 kwiecień 2007, vim@vim.org wrote:
 Has anyone else heard of the vi name game?

Sure :)

Mikolaj just inserts kolaj at the beginning of middle line of screen.

m.



Re: Folding in vim helpfiles

2007-04-06 Thread Mikolaj Machowski
On piątek 06 kwiecień 2007, vim@vim.org wrote:
 After looking at foldutil.vim and AutoFold.vim I'm not sure what the
 best way is going to be for exploiting the outline format of helpfiles
 to automatically create folds.

 Has anyone done this before?  Ideally, I'd like to use this with the
 foldlist.vim plugin to have something like a left-side nav-bar while
 reading helpfiles.

AFAIR Chip Campbell on his page had special version of help.vim with
folding, extended highlighting etc.

m.



Re: Silly Question

2007-04-06 Thread Silent1

brendon i lucked out, i just got errors :)


Re: Silly Question

2007-04-06 Thread Jason Keen

Jason joins the current line and the next, then insert son before
the start of the appended line.


RE: copy pasting HTML code into vim

2007-04-06 Thread Kamaraju S Kusumanchi
Gene Kwiecinski wrote:

In Firefox, you can select some part of the text, right-click on it and
one of the options is view selection source - like view source but
the relevant piece of it is already selected. That's a decent way of
replacing find-next in the source view.

Wow! This is indeed awesome!

raju
-- 
Kamaraju S Kusumanchi
http://www.people.cornell.edu/pages/kk288/
http://malayamaarutham.blogspot.com/



Re: Vim freezes system ?!

2007-04-06 Thread Tim Chase

I did th3 follwing: With a program, which generates random
numbers in different formats, I created a file, which consists
of _one_ line of 2097152 characters (0-9,A-F).

To split the line into lines of 72 characters each, I started
vim and let it read the file.

I postioned the cursor at position 0 and entered the following
in normal mode:

qq72rightireturnesc0q

Then I did a

[EMAIL PROTECTED]

After only 10 or 15 (guessed) executions of the macro the
system freezes while constantly swapping (?) and became
unuseable and did no longer respond.



While I don't know what went hooey on your machine, a couple ideas:

1) turn off syntax highlighting.  Vim seems to wheeze when 
syntax-highlighting long lines.


2) To split the line like you describe, you might try

:s/.\{72}/\r/g

(adjust the 72 for the number of characters you want on each 
line).  I don't know if it's any faster, but it can hardly be 
worse ;)


3) you might try cranking back your 'undolevels'.  I'm not sure 
it would help a great deal, but if the other two don't have a 
deep impact, it might help.


HTH,

-tim








Re: copy pasting HTML code into vim

2007-04-06 Thread Dudley Fox

On 4/6/07, Kamaraju S Kusumanchi [EMAIL PROTECTED] wrote:

Gene Kwiecinski wrote:

In Firefox, you can select some part of the text, right-click on it and
one of the options is view selection source - like view source but
the relevant piece of it is already selected. That's a decent way of
replacing find-next in the source view.

Wow! This is indeed awesome!


Sweet! It works in Seamonkey as well.

Thanks for the tip,
Dudley



raju
--
Kamaraju S Kusumanchi
http://www.people.cornell.edu/pages/kk288/
http://malayamaarutham.blogspot.com/




Re: Vim freezes system ?!

2007-04-06 Thread Yakov Lerner

On 4/6/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:

Hi,

 I did th3 follwing: With a program, which generates random numbers in
 different formats, I created a file, which consists of _one_ line of
 2097152 characters (0-9,A-F).

 To split the line into lines of 72 characters each, I started vim and
 let it read the file.

 I postioned the cursor at position 0 and entered the following in
 normal mode:

 qq72rightireturnesc0q

 Then I did a

 [EMAIL PROTECTED]

 After only 10 or 15 (guessed) executions of the macro the system
 freezes while constantly swapping (?) and became unuseable and did no
 longer respond.

 Even the mouse pointer was nearly unmoveable...

 After heavily and constantly trying I managed to kill the X-session
 and to 'killall -9 vim' from the console to get back my computer.


Hello Meino the vim killer Cramer,
I tried your scenario. You need to add 'set ul=-1' to disable undoes, and
'set lz' to disable excess redraws. Even then, vim goes rather slow at
this task.

Indeed, vim grows to 1000MB vm/rss size
size in matter of one minute without ul=-1 (, and growing very fast. )

To make editing of 2MB-long line manageable, I did:
  vim -u NONE file
 :set ul=-1 : disable undos
 :set lz
NOte that 2MB is already large file. You are now in the area where you want
take large file precautions wrt to performance.

This makes vim stay stable in memory size (although still rather large, 632mb).
But it's still slow at splitting 2mb-long lines. It took vim ~4 minutes to
split ~100 lines. So, for a whole 2mb data, it will take vim about
2 hours. You better try this kind of task with perl or C. Or just add
sensible newlines when generating your data.

Yakov

BTW your disk size is irrelevant.
What is  relevant is your RAM size and swap size.


Re: Vim freezes system ?!

2007-04-06 Thread Tim Chase

 The problem I have with my kind of splitting a line is not that it
 does not work -- it is the deadly side effect it caused.

 My opinion is, that it should not be possible to kill a system
 (...too big words, I know, but...) by simply submitting
 a sub-optimal command to a text editor.


As you killed it, there's no way to know if the process would 
have been seen to completion.  *nix-like OSes shouldn't allow you 
to drag the system to its knees without affording other processes 
(such as X) timeslices of the CPU.  You didn't mention how much 
memory your system has, but the specs are otherwise well within 
tolerances.  I suspect you may have found a pessimal (opposite of 
 optimal) solution to your problem and that Vim+Gentoo would 
have happily carried out your instructions, even if it involved 
heaps of memory and hours of CPU burn.  Additionally, as your 
line(s) got shorter, I suspect the time to process each 
subsequent line would diminish.


So no, in general, it shouldn't kill a system, but it sounded 
like your system was doing exactly what you asked of it.  X 
responded (albeit slowly) and you were able to get to a console 
and start bustin' heads.  That's kudos to an OS that can be 
functional even under heavy load.  It also sounded like Vim was 
doing what you asked of it (though perhaps not optimally), which 
caused it chug on the CPU.


It would be akin to writing a Python program that spun in a tight 
infinite loop:


while True: pass

and dragged your system to its knees...it's not Python's problem 
per-se, as it's your script/commands that are the problem.  Thus, 
I recommend a better algorithm, such as a :s as suggested before.


Just my perspective.

-tim





Re: Vim freezes system ?!

2007-04-06 Thread Yakov Lerner

On 4/6/07, Yakov Lerner [EMAIL PROTECTED] wrote:

... It took vim ~4 minutes to split ~100 lines.


Typo here. This should have been:
It took vim ~4 minutes to split ~1000 lines.


Re: Vim freezes system ?!

2007-04-06 Thread Yakov Lerner

On 4/6/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:

Hi Yakov the vim healer Lerner :)

memory size is 2GB Dual channel RAM, swap is 1G...

For me it is not a problem to fail with one task
(splitting a long line)...there are always
better solutions to discover on UNIX systems... :))

The problem I see is, that it is that easy to
stop a system by submitting the wrong command
to a text editor...


Aha, so you didn't try to edit a file.

You tried to find a scenario to push vim
beyond it's and your system's memory capacities.

OK, you succeeded.

Yakov


Re: Silly Question

2007-04-06 Thread Dudley Fox

On 4/6/07, Mikolaj Machowski [EMAIL PROTECTED] wrote:

On piątek 06 kwiecień 2007, vim@vim.org wrote:
 Has anyone else heard of the vi name game?

Sure :)

Mikolaj just inserts kolaj at the beginning of middle line of screen.

m.


I didn't know about the M command. I never needed it before. I even
learned something new from a silly question. What a great mailing
list!

Enjoy,
Dudley


Re: Silly Question

2007-04-06 Thread Yakov Lerner

Yakov (without quotes) inserts kov after the 1st
char.

Now, who won ?


Re: Vim freezes system ?!

2007-04-06 Thread Yakov Lerner

On 4/6/07, Yakov Lerner [EMAIL PROTECTED] wrote:

On 4/6/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
 Hi,

  I did th3 follwing: With a program, which generates random numbers in
  different formats, I created a file, which consists of _one_ line of
  2097152 characters (0-9,A-F).

  To split the line into lines of 72 characters each, I started vim and
  let it read the file.

  I postioned the cursor at position 0 and entered the following in
  normal mode:

  qq72rightireturnesc0q

  Then I did a

  [EMAIL PROTECTED]

  After only 10 or 15 (guessed) executions of the macro the system
  freezes while constantly swapping (?) and became unuseable and did no
  longer respond.

  Even the mouse pointer was nearly unmoveable...

  After heavily and constantly trying I managed to kill the X-session
  and to 'killall -9 vim' from the console to get back my computer.

Hello Meino the vim killer Cramer,
I tried your scenario. You need to add 'set ul=-1' to disable undoes, and
'set lz' to disable excess redraws. Even then, vim goes rather slow at
this task.

Indeed, vim grows to 1000MB vm/rss size
size in matter of one minute without ul=-1 (, and growing very fast. )


The thing I find strange here is that values of 'maxmem', 'maxmemtot' were:

   :set mm? mmt?
 maxmem=643272
 maxmemtot=643272

, yet vim grew  past x2.5 times that limits (with default 'ul')
without messages.
Is this expected behaviour ?

Yakov


Re: Silly Question

2007-04-06 Thread Mikolaj Machowski
On piątek 06 kwiecień 2007, vim@vim.org wrote:
 On 4/6/07, Mikolaj Machowski [EMAIL PROTECTED] wrote:
  On piątek 06 kwiecień 2007, vim@vim.org wrote:
   Has anyone else heard of the vi name game?
 
  Sure :)
 
  Mikolaj just inserts kolaj at the beginning of middle line of
  screen.

 I didn't know about the M command. I never needed it before. I even
 learned something new from a silly question. What a great mailing
 list!

H and L are even more useful :)

m.



Re: Vim freezes system ?!

2007-04-06 Thread A.J.Mechelynck

[EMAIL PROTECTED] wrote:

Hi,

 I did th3 follwing: With a program, which generates random numbers in
 different formats, I created a file, which consists of _one_ line of
 2097152 characters (0-9,A-F).

 To split the line into lines of 72 characters each, I started vim and
 let it read the file.

 I postioned the cursor at position 0 and entered the following in
 normal mode:

 qq72rightireturnesc0q

 Then I did a 


 [EMAIL PROTECTED]

 After only 10 or 15 (guessed) executions of the macro the system
 freezes while constantly swapping (?) and became unuseable and did no
 longer respond.

 Even the mouse pointer was nearly unmoveable...

 After heavily and constantly trying I managed to kill the X-session
 and to 'killall -9 vim' from the console to get back my computer.

 I am using an up-to-date version of Gentoo and vim (not gvim).  My
 system runs an AMD 64 X2 3800+ CPU and uses a Seagate 200GB harddisk
 (dma enabled). It needs a lot of load to bring the system to its
 knees.

 May be it was wrong what I did in the sense of there are better
 UNIX tools to reformat such a file or better commands in vim to
 accomplish this,...

 ...but in a critical moment it may be that I would have lost my work
 (other open applikations) due to the need of killing X.


 Keep editing! ;)
 mcc


Try Ctrl-Alt-F2 to get to a text console without killing X. Then enter a login 
name and password.


On Linux, you normally have six text consoles just waiting there for you to 
log in, even while X is running. Ctrl-Alt-F1 (/dev/tty1) normally has the last 
page of your boot sequence log, so you may (or may not, after all) want to 
leave that one in peace. Ctrl-Alt-F2 to Ctrl-Alt-F6 are the other five 
(/dev/tty2 to /dev/tty6). /dev/tty7 is what the X server video output goes to 
(and, IIUC, where its keyboard input comes from), so you hit Ctrl-Alt-F7 to go 
back to X after having used a text terminal. (The X server display input is 
normally called :0 ).


There are more possible terminals (/dev/tty8 to /dev/tty12, maybe), but since 
there is no getty (or, more often, mingetty) program listening there, you 
can't log into them. You _can_, if you wish, redirect a program's sysout 
and/or syserr to them, and look at the latest page of output by means of the 
appropriate Ctrl-Alt-Fn keychord. For instance, /dev/tty10 (Ctrl-Alt-F10) is 
usually the syslog listing, at least in the Linux distros that I use.


Best regards,
Tony.
--
hundred-and-one symptoms of being an internet addict:
164. You got out to buy software, instead of going out for a beer.


Re: Vim freezes system ?!

2007-04-06 Thread A.J.Mechelynck

Yakov Lerner wrote:

On 4/6/07, Yakov Lerner [EMAIL PROTECTED] wrote:

On 4/6/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
 Hi,

  I did th3 follwing: With a program, which generates random numbers in
  different formats, I created a file, which consists of _one_ line of
  2097152 characters (0-9,A-F).

  To split the line into lines of 72 characters each, I started vim and
  let it read the file.

  I postioned the cursor at position 0 and entered the following in
  normal mode:

  qq72rightireturnesc0q

  Then I did a

  [EMAIL PROTECTED]

  After only 10 or 15 (guessed) executions of the macro the system
  freezes while constantly swapping (?) and became unuseable and did no
  longer respond.

  Even the mouse pointer was nearly unmoveable...

  After heavily and constantly trying I managed to kill the X-session
  and to 'killall -9 vim' from the console to get back my computer.

Hello Meino the vim killer Cramer,
I tried your scenario. You need to add 'set ul=-1' to disable undoes, and
'set lz' to disable excess redraws. Even then, vim goes rather slow at
this task.

Indeed, vim grows to 1000MB vm/rss size
size in matter of one minute without ul=-1 (, and growing very fast. )


The thing I find strange here is that values of 'maxmem', 'maxmemtot' were:

   :set mm? mmt?
 maxmem=643272
 maxmemtot=643272

, yet vim grew  past x2.5 times that limits (with default 'ul')
without messages.
Is this expected behaviour ?

Yakov



I have
  maxmapdepth=1000
  maxmempattern=1000
  maxmem=249
  maxmemtot=249

which strikes me as strange (even though the last three are in KB) since I 
never set them and the docs say maxmem is usually at least 256 and maxmemtot 
at least 2048. And I don't have a tiny bitty box: my total installed RAM is 2 GB.


Best regards,
Tony.
--
We don't care.  We don't have to.  We're the Phone Company.


I'm back

2007-04-06 Thread Thomas Köhler
Hello all,
I just wanted to let you know that I am back on the vim and
vim-dev mailinglists. I won't have time to write many mails, but
my colleagues at work started to ask me a lot of questions about
vim when they found out that I wrote syn on and colorscheme
koehler in root's vimrc of all servers so I thought it might be
good to get back to the old habit of learning by reading the
solutions of fellow vim users to the questions of other vim
users. :-)
I might as well throw in a few mails, but as I only read my
private mail on the weekends there will be only a few mails from
me...

Ciao,
Thomas

-- 
 Thomas Köhler   Email:   [EMAIL PROTECTED]
  WWW:  http://gott-gehabt.de
 IRC:   tkoehler
 PGP public key available from Homepage!


signature.asc
Description: Digital signature