vim-ansible-yaml icon indicating copy to clipboard operation
vim-ansible-yaml copied to clipboard

Use 2 spaces instead of 4

Open MartinDelille opened this issue 7 years ago • 3 comments
trafficstars

Would it be possible to configure the plugin to use 2 spaces instead of 4? It looks like everyone is using 2 spaces by the way.

MartinDelille avatar Jun 20 '18 09:06 MartinDelille

Have you try overriding it in your own vimrc file?

codeinabox avatar Jun 20 '18 11:06 codeinabox

Ok it works if I add this to the vimrc file:

set tabstop=2
set softtabstop=2
set shiftwidth=2
set expandtab
set smarttab
set autoindent

The problem is that I have globally 2 spaces and for other language I have other convention (4 hard tab for C++ for example).

Any idea how to apply this 2 soft spaces setup only for yaml files?

MartinDelille avatar Jun 22 '18 10:06 MartinDelille

Sure, I believe the filetype is ansible so you could add the following to a file called ~/.vim/after/ftplugin/ansible.vim

setlocal tabstop=2
setlocal softtabstop=2
setlocal shiftwidth=2
setlocal expandtab
setlocal smarttab
setlocal autoindent

codeinabox avatar Jun 22 '18 10:06 codeinabox