Python x Vi-Editor combined are like a match in heaven for every programmer. It's amazing how fast you are able to write code if you know how to use Vim properly.
You can simply edit the .vimrc file in order to make it as easy as possible to code, e.g. on your Raspberry Pi.
Navigate to the root directory and open the .vimrc file. If the file does not exist yet, simply generate it. In this case I want to do this on a Raspberry Pi.
root@raspberrypi:/home/pi cd
root@raspberrypi:~# vi .vimrc
Here I want to provide a seamless coding experience in Python. I also want to display the HTML-files nicely as well.
So my goal is to make sure the right indentation is used without having to think about it. Changing the color scheme permanently is implemented as well.
" set colorscheme for Vim-Editor
colo industry
" enable syntax
syntax on
" 2 spaces indent in .html file
autocmd BufRead,BufNewFile *.html setlocal tabstop=2 shiftwidth=2 softtabstop=2
" 4 spaces indent in python script
filetype plugin indent on
" show existing with 4 spaces indent
set tabstop=4
" when indenting with '>', use 4 spaces indent
set shiftwidth=4
" on pressing tabulator, insert 4 spaces
set expandtab
I want the indentation in my HTML-files to be set to two spaces since it makes the code more readable. I use 4 spaces of indentation in my python scripts because this is highly recommended in the PEP-8.
Of course you can always change and customize these values up to your personal preferences.