How to automatically set indentation of files in vim
This guide will teach you how to set the indentation of files in Vim automatically.
Posted in these interests:
This guide will teach you how to set the indentation of files in Vim automatically.
Since you're trying to configure vim I'll assume you want to edit the file in vim. The .vimrc file is usually located in your home directory.
vim ~/.vimrc
autocmd FileType python setl tabstop=4|setl shiftwidth=4|setl softtabstop=4
autocmd FileType html setl tabstop=2|setl shiftwidth=2|setl softtabstop=2
autocmd FileType javascript setl tabstop=2|setl shiftwidth=2|setl softtabstop=2
autocmd FileType css setl tabstop=2|setl shiftwidth=2|setl softtabstop=2
autocmd Filetype ruby setlocal tabstop=2|setl shiftwidth=2|setl softtabstop=2
Feel free to adjust the values based on your preferences and coding conventions you use.
Nothing says good morning quite like a breakfast sandwich. From the doughiness of the muffin to the eggs' fluffiness to the cheese's gooeyness, breakfast sandwiches are a great start to your morning.