I use “:set ai sw=4” and “:set number” (and some other cmd) commands each time when I open any file in VIM.
For every new instance of VIM I have to enter set of commands. Is there any way where I can put these commands and VIM will execute it every time while opening any file like default settings.
Just paste those lines on the file
~/.vimrcand they’ll be executed everytime VIM is openned. If it does not exist, create one.Two recommendations:
Use a plugin that will auto-load
.vimrcwhen you save it. Being confortable with editting.vimrcis very important. Building it up with your preferences and key-mappings as you learn VIM is one of the reasons it is so powerful.Google now for some ready
.vimrcsetups as they override some not-so-optimal VIM configurations. For example, you probably won’t want that annoying bell beep, among many other things.