| Register | FAQ | Calendar | Search | Today's Posts | Mark Forums Read |
|
#1
| |||
| |||
| Hi everyone ! Sorry to bother you, I was reffered to here by a friend. He said that people on this group sometimes help confused people (like me :-( I'm editing a file (not a programming language source, but some coordinates in a fem file, not important) ... and some things in a file always go in a row, ex. coordinates, some commands etc. x290.5 y17.5 z22.243234 (no spaces allowed) so, if the last one is x then y will always come next. Now, looking at this type of file is tiresome, so I'm trying to write a plugin which will enable me that if in the last row the first char is x, to insert in this one y ... and so on. (the coordinates are just an example, form-station-wl are another pair). This doesn't seem too difficult, I think I will be able to get it to work with a system of if loops. But what I can't understand is how to "grab" the first character in previous row, so I can if char=="x" execute ... Please help, I would be more than grateful on all your suggestions. Lana |
|
#2
| |||
| |||
| Lana <lana@sorry_no_mail_-_i_hate_spam.com> wrote: > But what I can't understand is how to "grab" the first character in > previous row, so I can > if char=="x" > execute ... In Vim: if strpart(getline(line(".")-1), 0, 1) == "x" exe ... endif Johannes |
![]() |
| Thread Tools | |
| Display Modes | |
In an effort to better serve ads to our visitors, cookies are used on objectmix.com. For more information, check out our Privacy Policy.