unchangeable lines

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

unchangeable lines

vstenbock
Is it possible to mark some lines as unchangeable ?

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/CANXeduMrp7iYOQK0O8YxgTnkOUSTKraepLtEahMbr3GZeUbkJA%40mail.gmail.com.
Reply | Threaded
Open this post in threaded view
|

Re: unchangeable lines

Christian Brabandt

On Fr, 27 Dez 2019, Vladimir Stenbock wrote:

> Is it possible to mark some lines as unchangeable ?

This is not possible. A custom handmade plugin might work around this by
saving/restoring of lines, but in the core, Vim does not support this.

Best,
Christian
--
Eine Erfolgsformel kann ich dir nicht geben; aber ich kann dir sagen,
was zum Mißerfolg führt: Der Versuch, jedem gerecht zu werden.
                -- Herbert Swope

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/20191227075846.GN9787%40256bit.org.
Reply | Threaded
Open this post in threaded view
|

Re: unchangeable lines

Efraim Yawitz
I wonder if this could be easily hacked into the code of vim by creating a new syntax group called Unchangeable or something and adding code to make it uneditable.

Maybe for now, create a syntax group and highlight it in a way that it reminds you not to change that text.

On Fri, 27 Dec 2019 at 09:58, Christian Brabandt <[hidden email]> wrote:

On Fr, 27 Dez 2019, Vladimir Stenbock wrote:

> Is it possible to mark some lines as unchangeable ?

This is not possible. A custom handmade plugin might work around this by
saving/restoring of lines, but in the core, Vim does not support this.

Best,
Christian
--
Eine Erfolgsformel kann ich dir nicht geben; aber ich kann dir sagen,
was zum Mißerfolg führt: Der Versuch, jedem gerecht zu werden.
                -- Herbert Swope

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/20191227075846.GN9787%40256bit.org.

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/CAPKXbB6iCUF-Xy%3D_OvgZSCW3nn4UknDcTsxaBWjz%3D80eaY%2By1g%40mail.gmail.com.
Reply | Threaded
Open this post in threaded view
|

Re: unchangeable lines

Salman Halim
Might be useful. I currently use something such as the InlineEdit plugin to extract the lines I want to modify. (This also helps in big files where syntax highlighting is slow.)

How would this be persisted? If it adds markers within the same file, the file won't be compatible with other editors. Maybe a second file would be saved alongside the main file, but with a different extension to indicate that it contains metadata. (Abc.txt and ABC.txt.vimmetadata)

For a Vim-script solution, you'd probably have to remap every single command that can change text (i, a, c, d, r, their upper-case variants, etc.) that would have to check to see whether the range of lines affected contains any of the fixed lines and abort if so. 

--

Salman

On Sun, Dec 29, 2019, 10:44 Efraim Yawitz <[hidden email]> wrote:
I wonder if this could be easily hacked into the code of vim by creating a new syntax group called Unchangeable or something and adding code to make it uneditable.

Maybe for now, create a syntax group and highlight it in a way that it reminds you not to change that text.

On Fri, 27 Dec 2019 at 09:58, Christian Brabandt <[hidden email]> wrote:

On Fr, 27 Dez 2019, Vladimir Stenbock wrote:

> Is it possible to mark some lines as unchangeable ?

This is not possible. A custom handmade plugin might work around this by
saving/restoring of lines, but in the core, Vim does not support this.

Best,
Christian
--
Eine Erfolgsformel kann ich dir nicht geben; aber ich kann dir sagen,
was zum Mißerfolg führt: Der Versuch, jedem gerecht zu werden.
                -- Herbert Swope

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/20191227075846.GN9787%40256bit.org.

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/CAPKXbB6iCUF-Xy%3D_OvgZSCW3nn4UknDcTsxaBWjz%3D80eaY%2By1g%40mail.gmail.com.

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/CANuxnEcm0hAYwayF_dfcUhsT6mHPZ4YeTOUH%2BicgWi2RUopqWw%40mail.gmail.com.
Reply | Threaded
Open this post in threaded view
|

Re: unchangeable lines

Richard Mitchell
This probably isn't what the original poster had in mind, but this made me think what if vim could use a template file that acted as a mask?

Anywhere characters (X for example) existed in the mask file, those positions would not be changeable in the 'edit' file.

If the movement commands skipped over the masked positions, you'd have a really handy tool for editing forms.

I don't know to who this would appeal, can't imagine there are a lot of people jonesing over a modal editor for forms instead of an html form and mouse.



On Sunday, December 29, 2019 at 10:59:14 AM UTC-5, Salman Halim wrote:
Might be useful. I currently use something such as the InlineEdit plugin to extract the lines I want to modify. (This also helps in big files where syntax highlighting is slow.)

How would this be persisted? If it adds markers within the same file, the file won't be compatible with other editors. Maybe a second file would be saved alongside the main file, but with a different extension to indicate that it contains metadata. (Abc.txt and ABC.txt.vimmetadata)

For a Vim-script solution, you'd probably have to remap every single command that can change text (i, a, c, d, r, their upper-case variants, etc.) that would have to check to see whether the range of lines affected contains any of the fixed lines and abort if so. 

--

Salman

On Sun, Dec 29, 2019, 10:44 Efraim Yawitz <<a href="javascript:" target="_blank" gdf-obfuscated-mailto="q0JXiZSDCQAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">efraim...@...> wrote:
I wonder if this could be easily hacked into the code of vim by creating a new syntax group called Unchangeable or something and adding code to make it uneditable.

Maybe for now, create a syntax group and highlight it in a way that it reminds you not to change that text.

On Fri, 27 Dec 2019 at 09:58, Christian Brabandt <<a href="javascript:" rel="nofollow" target="_blank" gdf-obfuscated-mailto="q0JXiZSDCQAJ" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">cbl...@...> wrote:

On Fr, 27 Dez 2019, Vladimir Stenbock wrote:

> Is it possible to mark some lines as unchangeable ?

This is not possible. A custom handmade plugin might work around this by
saving/restoring of lines, but in the core, Vim does not support this.

Best,
Christian
--
Eine Erfolgsformel kann ich dir nicht geben; aber ich kann dir sagen,
was zum Mißerfolg führt: Der Versuch, jedem gerecht zu werden.
                -- Herbert Swope

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit <a href="http://www.vim.org/maillist.php" rel="nofollow" target="_blank" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fwww.vim.org%2Fmaillist.php\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNH_i_vTWvOy2_ml2WNZwm9vDnSvaA&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fwww.vim.org%2Fmaillist.php\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNH_i_vTWvOy2_ml2WNZwm9vDnSvaA&#39;;return true;">http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to <a href="javascript:" rel="nofollow" target="_blank" gdf-obfuscated-mailto="q0JXiZSDCQAJ" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">vim...@googlegroups.com.
To view this discussion on the web visit <a href="https://groups.google.com/d/msgid/vim_use/20191227075846.GN9787%40256bit.org" rel="nofollow" target="_blank" onmousedown="this.href=&#39;https://groups.google.com/d/msgid/vim_use/20191227075846.GN9787%40256bit.org&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/msgid/vim_use/20191227075846.GN9787%40256bit.org&#39;;return true;">https://groups.google.com/d/msgid/vim_use/20191227075846.GN9787%40256bit.org.

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit <a href="http://www.vim.org/maillist.php" rel="nofollow" target="_blank" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fwww.vim.org%2Fmaillist.php\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNH_i_vTWvOy2_ml2WNZwm9vDnSvaA&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fwww.vim.org%2Fmaillist.php\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNH_i_vTWvOy2_ml2WNZwm9vDnSvaA&#39;;return true;">http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to <a href="javascript:" rel="nofollow" target="_blank" gdf-obfuscated-mailto="q0JXiZSDCQAJ" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">vim...@googlegroups.com.
To view this discussion on the web visit <a href="https://groups.google.com/d/msgid/vim_use/CAPKXbB6iCUF-Xy%3D_OvgZSCW3nn4UknDcTsxaBWjz%3D80eaY%2By1g%40mail.gmail.com?utm_medium=email&amp;utm_source=footer" rel="nofollow" target="_blank" onmousedown="this.href=&#39;https://groups.google.com/d/msgid/vim_use/CAPKXbB6iCUF-Xy%3D_OvgZSCW3nn4UknDcTsxaBWjz%3D80eaY%2By1g%40mail.gmail.com?utm_medium\x3demail\x26utm_source\x3dfooter&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/msgid/vim_use/CAPKXbB6iCUF-Xy%3D_OvgZSCW3nn4UknDcTsxaBWjz%3D80eaY%2By1g%40mail.gmail.com?utm_medium\x3demail\x26utm_source\x3dfooter&#39;;return true;">https://groups.google.com/d/msgid/vim_use/CAPKXbB6iCUF-Xy%3D_OvgZSCW3nn4UknDcTsxaBWjz%3D80eaY%2By1g%40mail.gmail.com.

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/8d7f9c26-ac19-42c1-ba7c-231263c2abb2%40googlegroups.com.
Reply | Threaded
Open this post in threaded view
|

Re: unchangeable lines

Erik Christiansen
In reply to this post by Efraim Yawitz
On 29.12.19 17:43, Efraim Yawitz wrote:
> I wonder if this could be easily hacked into the code of vim by creating a
> new syntax group called Unchangeable or something and adding code to make
> it uneditable.

Or more easily in the folding code? That already treats an arbitrary
number of lines as a single unit when a fold is closed. To make a fold
immutable, its fold status would admittedly need to be checked by all
edit operations - when the fold is open - a condition when it is hardly
distinguishable from any other text.

If done there, the immutable text would inherently still be able to be
moved, like any other closed fold, without needing to toggle the
immutability tag on the fold, I figure.

The various existing foldmethods would seem well suited to delimiting
protected text. But how to add the protecting metadata in anything other
than an easily circumvented way is difficult to imagine.

Erik

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/20200102064551.GB3705%40ratatosk.