<div dir="ltr"><div><div><div><div>You can map a couple of function keys to do that for you. Less keystrokes.<br><br>But here is what I experienced relating to this: <br><br>I had that issue of pasting autoindent for a long time.<br></div>Until I deleted all my .vimrc file and .vim directory, and hence only using the default vim settings.<br></div>No more pasting issues, until vim 8.0!<br><br></div>Now, when I created a new .vim, with only this in it:<br><br>:syntax on<br>set ai<br>set expandtab<br>set tabstop=2<br>set sw=2<br>set incsearch<br><br></div>I don't have indenting of pasted stuff anymore, neither on 7.4 (Ubuntu 16.04) nor 8.0 (Raspian 9).<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Feb 20, 2018 at 12:43 PM, doug moen <span dir="ltr"><<a href="mailto:doug@moens.org" target="_blank">doug@moens.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div><div><div><div>I have autoindent turned on by default, but it gets in the way if I paste text from the clipboard.<br></div>So I got used to typing<br></div> :se noai<br></div>to turn off autoindent, and<br></div> :se ai<br></div>to turn it back on.<br></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">On 20 February 2018 at 12:20, Khalid Baheyeldin <span dir="ltr"><<a href="mailto:kb@2bits.com" target="_blank">kb@2bits.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>That helps a lot Doug!<br><br></div>Thanks!<br></div><div class="m_-2411754676758757951HOEnZb"><div class="m_-2411754676758757951h5"><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Feb 20, 2018 at 11:51 AM, doug moen <span dir="ltr"><<a href="mailto:doug@moens.org" target="_blank">doug@moens.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>Here are my settings for autoindentation, taken from my .vimrc file.<br><br></div>" turn on autoindent<br><div>set ai<br><br></div><div>" convert tabs into spaces during text entry (but not when reading a file)<br></div><div>set expandtab<br><br></div><div>" If I edit a file containing tabs, this controls the tab indentation when the text is displayed.<br></div><div>" If I type Tab, it indents to the next multiple of 4 (converting the tab to spaces)<br></div><div>set tabstop=4<br><br></div><div>" This is the 'shift width'.<br></div><div>" During text entry, ^T indents to the next shift-width column,<br></div><div>" and ^D undents to the previous shift-width column.<br></div><div>" The >> operator indents the selected lines by shift-width spaces,<br></div><div>" and << undents by the same amount.<br></div><div>set sw=4<br><br></div></div><div class="gmail_extra"><br><div class="gmail_quote"><div><div class="m_-2411754676758757951m_-8177441539880099535h5">On 20 February 2018 at 11:09, Khalid Baheyeldin <span dir="ltr"><<a href="mailto:kb@2bits.com" target="_blank">kb@2bits.com</a>></span> wrote:<br></div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="m_-2411754676758757951m_-8177441539880099535h5"><div dir="ltr"><div>An update ... <br><br>Thanks to Paul Nijjar, I now have a solution (of sorts).<br><br>By having this line in my .vimrc, the syntax highlighting is restored.<br><br></div>:syntax on<br><br><div>Autoindents are disabled, but that is better than frustratingly wrong autointendation.<br><br><span class="m_-2411754676758757951m_-8177441539880099535m_-586701605489602418m_-2255589676048847695gmail-im"></span></div></div><div class="m_-2411754676758757951m_-8177441539880099535m_-586701605489602418HOEnZb"><div class="m_-2411754676758757951m_-8177441539880099535m_-586701605489602418h5"><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Feb 19, 2018 at 6:27 PM, Khalid Baheyeldin <span dir="ltr"><<a href="mailto:kb@2bits.com" target="_blank">kb@2bits.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">For an editor, I have been using vi (then vim) for 31 years.<br clear="all"><div><br></div><div>For a long time I had my own customizations in .vimrc, or under .vim directory.<br></div><div>But some time ago I discovered that I don't need these customization, since the default syntax, tab width, ..etc. all worked well.<br><br></div><div>On my Ubuntu 16.04 boxes (this laptop, servers, ...etc.), I have vim 7.4, and all is good.<br><br></div><div>When I got the new Raspberry Pi 3, I installed the latest Raspian on it, and that happened to be version 9. It came with vim 8.0.<br><br></div><div>The packages I have installed are: vim, vim-common, vim-runtime and vim-tiny. /usr/bin/vi symlinks to /usr/bin/vim.basic.<br><br></div><div>On the Ubuntu machines, with vim 7.4, it all works well. Syntax and indenting work correctly for the files I used on a daily basis, such as config files, .yaml, python, c, and php. I don't have a .vimrc file anymore.<br><br></div><div>However, on Raspian 9's vim 8.0, syntax highlighting is correct, but indentation is wrong and it forces wrong indents when I add lines, ...etc.<br><br></div><div>So, I thought that I would override indentation on the RPi using a .vimrc file. The problem is: once I have a .vimrc or .vim directory, all syntax highlighting goes away completely, even if the .vimrc file is empty! That is not the behaviour on Ubuntu: a .vimrc does not cause syntax highlighting to be disabled. <br><br></div><div>One way to solve this is to copy all the syntax stuff from /usr/share/vim80/* into my .vimrc directory, and edit it to remove the offending indentation. But that would be duplication, and not the proper way of doing this.<br><br></div><div>So:<br><br></div><div>Anyone encounter this issue? <br></div><div><br>What are good ways to solve it, other than the duplicating above?<span class="m_-2411754676758757951m_-8177441539880099535m_-586701605489602418m_-2255589676048847695HOEnZb"><font color="#888888"><br><br></font></span></div><span class="m_-2411754676758757951m_-8177441539880099535m_-586701605489602418m_-2255589676048847695HOEnZb"><font color="#888888"><div>-- <br><div class="m_-2411754676758757951m_-8177441539880099535m_-586701605489602418m_-2255589676048847695m_-423353960660878904gmail_signature" data-smartmail="gmail_signature">Khalid M. Baheyeldin<br><a href="http://2bits.com" target="_blank">2bits.com</a>, Inc.<br>Fast Reliable Drupal<br>Drupal optimization, development, customization and consulting.<br>Simplicity is prerequisite for reliability. -- Edsger W.Dijkstra<br>Simplicity is the ultimate sophistication. -- Leonardo da Vinci<br>For every complex problem, there is an answer that is clear, simple, and wrong." -- H.L. Mencken<br></div>
</div></font></span></div>
</blockquote></div><br><br clear="all"><br>-- <br><div class="m_-2411754676758757951m_-8177441539880099535m_-586701605489602418m_-2255589676048847695gmail_signature" data-smartmail="gmail_signature">Khalid M. Baheyeldin<br><a href="http://2bits.com" target="_blank">2bits.com</a>, Inc.<br>Fast Reliable Drupal<br>Drupal optimization, development, customization and consulting.<br>Simplicity is prerequisite for reliability. -- Edsger W.Dijkstra<br>Simplicity is the ultimate sophistication. -- Leonardo da Vinci<br>For every complex problem, there is an answer that is clear, simple, and wrong." -- H.L. Mencken<br></div>
</div>
</div></div><br></div></div><span>______________________________<wbr>_________________<br>
kwlug-disc mailing list<br>
<a href="mailto:kwlug-disc@kwlug.org" target="_blank">kwlug-disc@kwlug.org</a><br>
<a href="http://kwlug.org/mailman/listinfo/kwlug-disc_kwlug.org" rel="noreferrer" target="_blank">http://kwlug.org/mailman/listi<wbr>nfo/kwlug-disc_kwlug.org</a><br>
<br></span></blockquote></div><br></div>
</blockquote></div><br><br clear="all"><br>-- <br><div class="m_-2411754676758757951m_-8177441539880099535gmail_signature" data-smartmail="gmail_signature">Khalid M. Baheyeldin<br><a href="http://2bits.com" target="_blank">2bits.com</a>, Inc.<br>Fast Reliable Drupal<br>Drupal optimization, development, customization and consulting.<br>Simplicity is prerequisite for reliability. -- Edsger W.Dijkstra<br>Simplicity is the ultimate sophistication. -- Leonardo da Vinci<br>For every complex problem, there is an answer that is clear, simple, and wrong." -- H.L. Mencken<br></div>
</div>
</div></div></blockquote></div><br></div>
</div></div></blockquote></div><br><br clear="all"><br>-- <br><div class="gmail_signature" data-smartmail="gmail_signature">Khalid M. Baheyeldin<br><a href="http://2bits.com" target="_blank">2bits.com</a>, Inc.<br>Fast Reliable Drupal<br>Drupal optimization, development, customization and consulting.<br>Simplicity is prerequisite for reliability. -- Edsger W.Dijkstra<br>Simplicity is the ultimate sophistication. -- Leonardo da Vinci<br>For every complex problem, there is an answer that is clear, simple, and wrong." -- H.L. Mencken<br></div>
</div>