[kwlug-disc] Syntax and indenting in vim 8.0 driving me crazy ...

doug moen doug at moens.org
Tue Feb 20 12:43:52 EST 2018


I have autoindent turned on by default, but it gets in the way if I paste
text from the clipboard.
So I got used to typing
   :se noai
to turn off autoindent, and
   :se ai
to turn it back on.

On 20 February 2018 at 12:20, Khalid Baheyeldin <kb at 2bits.com> wrote:

> That helps a lot Doug!
>
> Thanks!
>
> On Tue, Feb 20, 2018 at 11:51 AM, doug moen <doug at moens.org> wrote:
>
>> Here are my settings for autoindentation, taken from my .vimrc file.
>>
>> " turn on autoindent
>> set ai
>>
>> " convert tabs into spaces during text entry (but not when reading a file)
>> set expandtab
>>
>> " If I edit a file containing tabs, this controls the tab indentation
>> when the text is displayed.
>> " If I type Tab, it indents to the next multiple of 4 (converting the tab
>> to spaces)
>> set tabstop=4
>>
>> " This is the 'shift width'.
>> " During text entry, ^T indents to the next shift-width column,
>> " and ^D undents to the previous shift-width column.
>> " The >> operator indents the selected lines by shift-width spaces,
>> " and << undents by the same amount.
>> set sw=4
>>
>>
>> On 20 February 2018 at 11:09, Khalid Baheyeldin <kb at 2bits.com> wrote:
>>
>>> An update ...
>>>
>>> Thanks to Paul Nijjar, I now have a solution (of sorts).
>>>
>>> By having this line in my .vimrc, the syntax highlighting is restored.
>>>
>>> :syntax on
>>>
>>> Autoindents are disabled, but that is better than frustratingly wrong
>>> autointendation.
>>>
>>>
>>> On Mon, Feb 19, 2018 at 6:27 PM, Khalid Baheyeldin <kb at 2bits.com> wrote:
>>>
>>>> For an editor, I have been using vi (then vim) for 31 years.
>>>>
>>>> For a long time I had my own customizations in .vimrc, or under .vim
>>>> directory.
>>>> But some time ago I discovered that I don't need these customization,
>>>> since the default syntax, tab width, ..etc. all worked well.
>>>>
>>>> On my Ubuntu 16.04 boxes (this laptop, servers, ...etc.), I have vim
>>>> 7.4, and all is good.
>>>>
>>>> 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.
>>>>
>>>> The packages I have installed are: vim, vim-common, vim-runtime and
>>>> vim-tiny. /usr/bin/vi symlinks to /usr/bin/vim.basic.
>>>>
>>>> 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.
>>>>
>>>> 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.
>>>>
>>>> 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.
>>>>
>>>> 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.
>>>>
>>>> So:
>>>>
>>>> Anyone encounter this issue?
>>>>
>>>> What are good ways to solve it, other than the duplicating above?
>>>>
>>>> --
>>>> Khalid M. Baheyeldin
>>>> 2bits.com, Inc.
>>>> Fast Reliable Drupal
>>>> Drupal optimization, development, customization and consulting.
>>>> Simplicity is prerequisite for reliability. --  Edsger W.Dijkstra
>>>> Simplicity is the ultimate sophistication. --   Leonardo da Vinci
>>>> For every complex problem, there is an answer that is clear, simple,
>>>> and wrong." -- H.L. Mencken
>>>>
>>>
>>>
>>>
>>> --
>>> Khalid M. Baheyeldin
>>> 2bits.com, Inc.
>>> Fast Reliable Drupal
>>> Drupal optimization, development, customization and consulting.
>>> Simplicity is prerequisite for reliability. --  Edsger W.Dijkstra
>>> Simplicity is the ultimate sophistication. --   Leonardo da Vinci
>>> For every complex problem, there is an answer that is clear, simple, and
>>> wrong." -- H.L. Mencken
>>>
>>> _______________________________________________
>>> kwlug-disc mailing list
>>> kwlug-disc at kwlug.org
>>> http://kwlug.org/mailman/listinfo/kwlug-disc_kwlug.org
>>>
>>>
>>
>
>
> --
> Khalid M. Baheyeldin
> 2bits.com, Inc.
> Fast Reliable Drupal
> Drupal optimization, development, customization and consulting.
> Simplicity is prerequisite for reliability. --  Edsger W.Dijkstra
> Simplicity is the ultimate sophistication. --   Leonardo da Vinci
> For every complex problem, there is an answer that is clear, simple, and
> wrong." -- H.L. Mencken
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://kwlug.org/pipermail/kwlug-disc_kwlug.org/attachments/20180220/6cb64353/attachment.htm>


More information about the kwlug-disc mailing list