Skip to main content
Topic solved
This topic has been marked as solved and requires no further attention.
Topic: vim question - wrap (Read 301 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

vim question - wrap

I am certain there is a setting for doing this, having seen so many personalized .vimrc scripts
Yet, I cannot find anything for this, so I have to ask, since there is no way I will ever find it (I have spent like 4 hours reading random threads lol)

I have set wrap. A line starts from 0 character in the line, so the wrap in 2nd line starts from 0 character, all good.
But if a line starts from a tab/indentation, it wraps from 0 character in the line, making the whole text look ugly and hard to look at first glance.

See attached image. Look at packet for example. The line below should start on the same vertical line with packet, but it starts 4 characters behind. Same for the other categories (Link, Listener), the wrapped line(s) always start from 0. My goal is to get them to start from whatever the start of the line is. Any help is appreciated, as I have so much text ported from Windows which is just impossible to read in vim, yet Notepad++ had this feature this I ask, and I cannot convert >10k+ lines :(

Re: vim question - wrap

Reply #1
It may not be quite what you're looking for, but in vim, when you're in normal mode you can use gq<motion> to change the text within the motion to be put on lines that are set to your maximum line width (which is 80 by default I believe). gqq will do this for your current line. If the text starts with white space it respects it (because it is just another character).

Re: vim question - wrap

Reply #2
It's an interesting workaround, as with a macro I could speed up conversion. But sadly it creates newlines, and its not the target result

Thank you for the command, especially `gqq`, it is good to know. But I hope some1 can find some kind of setting so I permanently change vimrc without manually changing anything. I'm sure I'm not alone in this vim target behaviour

Re: vim question - wrap

Reply #3
I think I found it here the command is:

Code: [Select]
set breakindent

 

Re: vim question - wrap

Reply #4
It works!
I didn't expect it to be so simple, expected it to be some autistic bash script or sth

Thank you very much. To understand how much you helped me with this simple thing:
I used windows 7 (for over 7 years?) and I have accumulated many text files needed for my work and hobbies. While I could open them with vim, since the formating was different, I couldnt write on them (without making them unreadable on windows) and so, I had to reboot to windows and write whatever new stuff I wanted to add -_-

You pretty much solved this problem, as I now can write onto these windows files from my linux <3