On 2018-12-03, Magnus Woldrich wrote:
> Hi list,
> 
> I'd like to stop vim from modifying the first n columns of a buffer, no
> matter what I do in it.
> 
> Consider the following data, where the number isn't vims internal line
> numbers, but actual data:
> 
>   50 ./bin/
>   51 ./cgi/
>   52 ./dev/
>   53 ./devlaleh/
>   54 ./emu/
>   55 ./etc/
> 
> Now, I'd want to perform any action in this buffer, for example a simple:
> 
> :%s/ /_/
> 
> and I need vim to *think* that the buffer starts at column 9.
> 
> I know that I can solve this with mappings and functions, but this isn't
> an option in this case.
> 
> How would I go about solving this please?

There are a couple of ways to do that.

One would be to delete the first 8 columns of the buffer into
a register, then put them back when you're done editing.  E.g.,
in normal mode,

    gg8|<C-v>0G"ad

where <C-v> is the single character Ctrl-V, do your editing, then

    gg0"aP

Another would be to prefix your patterns with at atom that matches
after a specific column, e.g.,

    :%s/\%>8c /_/

See

    :help /\%>c

Regards,
Gary

-- 
-- 
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 [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to