Friday, October 9, 2015

Re: Switching off auto-indent within vim script...

Thanks guys for the pointer to :set paste.  Also appreciate the help debugging the issue with my script Ben.

On Fri, Oct 9, 2015 at 7:26 AM, Ben Fritz <fritzophrenic@gmail.com> wrote:
On Thursday, October 8, 2015 at 4:56:20 PM UTC-5, Sonny Chee wrote:
> Hey Guys,
>
> When I want to insert text from my clipboard, I turn off auto-indenting with the following:
>
> :setl noai nocin nosi inde=
>
> That works great.
>
> I'm working on a vimscript that inserts (prettily) formatted text into a buffer.  I tried to execute the above before the inserts with the following:
>
>     execute "normal :setl noai nocin nosi inde="
>     execute 'normal! ' . l:start . 'Gg0o' . "\t" . join(l:cols, "\n\t, ")
>
>
> But all of the text is auto-indented.  Any help would be appreciated....

I second the suggestion to use :set paste instead.

However, your script isn't working, because there is no "enter" command sent to execute the command-line. You COULD insert a "\<CR>" at the end of your first normal command to accomplish that.

But that's pointless. You're using the "execute" ex command to use the "normal" ex command that does a ":" to go into the command-line mode where you execute...ex commands.

Instead of all that, why not just use "setl noai nocin nosi inde=" directly?

--
--
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 a topic in the Google Groups "vim_use" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/vim_use/JPptXTuUuxI/unsubscribe.
To unsubscribe from this group and all its topics, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Sonny.
----------------------------------------------------------------------------
Be true to your work, your word, and your friend. Henry David Thoreau.

--
--
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 vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments: