Reputation: 1211
Below is example text I put in vim, only spaces used no tabs.
dog;
dogcat
dogcatmoose
box
box car
woop
woopadoop
Lets say I highlight all code, and use indention >
what happens is the following:
dog;
dogcat
dogcatmoose
box
box car
woop
woopadoop
Original spacing is not preserved. I dont want that, I want spacing to be preserved so it looks like this:
dog;
dogcat
dogcatmoose
box
box car
woop
woopadoop
I tested with tabs instead of spaces. When using tabs, indention preserves the tabs. Here is my vimrc. IS there some value in here causing this problem? Is there a value I can add to fix the problem?
set number
set nowrap
set linebreak
set tabstop=4
set softtabstop=4
set shiftwidth=4
set shiftround
set expandtab
set title
set mouse=a
set hlsearch
set smarttab
set autoindent
set smartindent
set background=dark
filetype indent on
set filetype=html
set smartindent
set nocompatible
filetype off
set nobackup noswapfile
set clipboard=unnamed
let &colorcolumn=join(range(81,999),",")
highlight ColorColumn ctermbg=235 guibg=#2c2d27
"Stop vm from indenting on comment out sections starting with "#"
set indentkeys-=0#
Upvotes: 0
Views: 84
Reputation: 13929
My suggestion is to get rid of set shiftround
.
It seems like set shiftround
coupled with set shiftwidth=4
is causing the behaviour. shiftround
tries to indent the text to multiples of 4 (which is set by shiftwidth
), while your text is indented with 2 spaces. So when you do >
, shiftround
makes all the lines have the same 4-space indent. You can experiment this with the same text but with 4-space indentation; your setting will preserve the indentation.
Upvotes: 1