Skip to content

Fix shiftwidth=0 being ignored#88

Merged
othree merged 1 commit intoothree:masterfrom
neocryses:shiftwidth_fix
Sep 18, 2017
Merged

Fix shiftwidth=0 being ignored#88
othree merged 1 commit intoothree:masterfrom
neocryses:shiftwidth_fix

Conversation

@neocryses
Copy link
Copy Markdown
Contributor

Quoting from vim's 'options.txt' documentation, shiftwidth is:

  Number of spaces to use for each step of (auto)indent.  Used for
  |'cindent'|, |>>|, |<<|, etc.
  When zero the 'ts' value will be used.  Use the |shiftwidth()|
  function to get the effective shiftwidth value.

Which means if I have shiftwidth=0 and tabstop=2 in $MYVIMRC, shiftwidth should fallback to being set to 2, and auto indentation using = should indent with 2 spaces.

However with the minimal rc below, auto indenting an html file with gg=G removes all the indents. (Meaning every line will be at indentation level 0 after gg=G.)

filetype plugin indent on
syntax enable

" Using vim-plug as the plugin manager
call plug#begin('~/.vim/plugged/')
Plug  'othree/html5.vim'
call plug#end()

set shiftwidth=0
sed tabstop=2

This PR will fix that up.

@othree othree merged commit 916085d into othree:master Sep 18, 2017
@neocryses neocryses deleted the shiftwidth_fix branch September 18, 2017 12:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants