Automatisk radbrytning i Vim?
Postat: 03 okt 2008, 15:54
Rubriken säger allt. Hur får jag till det?
Forum för Ubuntus svenska gemenskap
https://ubuntu-se.servebbs.org/
Kod: Markera allt
:set textwidth=55
Vill ha:Hej! Jag het
er Emil
Hej! Jag
heter Emil
Ah! Lär bättra på mina svenska-kunskaper känner jag.maths57 skrev:Du menar avstavning?
http://www.linux.ie/articles/tutorials/vi2.php skrev: There is one mildly annoying thing about vi, which is that for the most part you don't know for certain if one line of text is displayed as just one line or whether it might be so long as to wrap around and be displayed on the screen as being two or more lines. This can be extremely annoying if for example you delete four lines and, due to word wrap, you really only should have deleted two.
For this reason it would be rather nice to know where the lines end and how to do something about it.
Doing the first is quite simple - type :set list to see where the lines end (which will be indicated with dollar signs, tabs indicated with '^I') and :set nolist to get the display back to normal.
Getting vi to do something about it preemptively is rather simple too. All that you need do is type :set wrapmargin=1 to make vi force lines not to wrap, this is a really useful command which probably should be included in your .exrc file.
If for some reason you want to undo this, just type :set wrapmargin=0. You could also use :set wrap and :set nowrap for turning wordwrap on and off.
Kod: Markera allt
:set nowrap
Kod: Markera allt
:set linebreak
Kod: Markera allt
set: wrap lbr
Stämmer bra. Det är dock som det ska...Konservburk skrev:Är det inte så att det bara ser ut som två rader fast det egentligen är en enda lång rad?
Precis vad jag var ute efter!Konservburk skrev: Vill du att fusk-radbrytningarna (wrap) inte ska ske mitt i ord så gör du så här istället:Kod: Markera allt
:set linebreak
Gjorde även det vad jag ville åt.maths57 skrev:Eller prövaKod: Markera allt
set: wrap lbr