Timeline for How to run vimscript function on visually selected lines of text?
Current License: CC BY-SA 4.0
11 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Mar 26, 2021 at 10:24 | comment | added | Tomáš Bažant |
@statox how do i apply = indentation on '<-1,'>+1 ? Typing '<-1,'>+1= on selected lines does not work
|
|
Mar 26, 2021 at 9:53 | comment | added | statox |
Rather than counting the white-spaces and all of that I have two suggestions: After using !xmlformat maybe you can use '<='> to align the text you previously formatted OR maybe if you use something like '<-1,'>+1!xmlformat the external program takes into consideration the surrounding lines and adapt the indentation? Otherwise if you want more details on how to accept a range in a function have a look at :h function-range-example (I'm pretty sure we have other questions about range functions too)
|
|
Mar 26, 2021 at 9:32 | comment | added | Tomáš Bažant | @statox: i've updated the problem description, would be nice if you can have a look | |
Mar 26, 2021 at 8:28 | history | edited | Tomáš Bažant | CC BY-SA 4.0 |
added 166 characters in body
|
Mar 26, 2021 at 7:55 | history | edited | Tomáš Bažant | CC BY-SA 4.0 |
added 278 characters in body
|
Mar 25, 2021 at 15:18 | comment | added | statox | Right @Rich I was just giving more details as I think it can be confusing for someone who doesn't know that :) But your point about editing the question if that doesn't work is still completely relevant | |
Mar 25, 2021 at 15:13 | comment | added | Rich |
@statox: Yes, but you don't need to type the colon or the range, simply pressing ! directly from the visual selection will add both automatocally. (I know you know this already.)
|
|
Mar 25, 2021 at 14:52 | comment | added | Maxim Kim | Question header is quite different to the body I would say. There is a way to run a vimscript function on visually selected lines but here it is about filtering of visual selection using external tool. | |
Mar 25, 2021 at 14:34 | comment | added | statox |
To more precisely I think Rich means using :'<,'>!xmlformat after a visual selection: '< and '> are marks which refer to the last visually selected text.
|
|
Mar 25, 2021 at 14:22 | comment | added | Rich |
Does simply typing !xmlformat work? If not, maybe you could edit the question to explain why. :help v_!
|
|
Mar 25, 2021 at 14:06 | history | asked | Tomáš Bažant | CC BY-SA 4.0 |