Setting this to a non-zero value other than tabstop will make the tab key (in insert mode) This is also used by things like the =, > and < commands. It's also measured in spaces, so if your code base indents with tab characters then you want shiftwidth to equal the number of tab characters times tabstop. The width of a hard tabstop measured in "spaces" - effectively the (maximum) width of an actual tab character. In case you need to make adjustments, or would simply like to understand what these options all mean, here's a breakdown of what each option means: tabstop To make any of these settings permanent add them to your vimrc. If you'd also like vim to only use space caharacters, never tab characters: set expandtabįinally, I also recommend setting tab stops to be different from the indentation width, in order to reduce the chance of tab characters masquerading as proper indents: set tabstop=8 softtabstop=0 If you want pressing the tab key to indent with 4 space characters:įirst, tell vim to use 4-space indents, and to intelligently use the tab key for indentation instead of for inserting tab characters (when at the beginning of a line): set shiftwidth=4 smarttab If you also want to use tabs for indentation, you should also set shiftwidth to be the same as tabstop: set shiftwidth=4 If your code requires use of actual tab characters these settings prevent unintentional insertion of spaces (these are the defaults, but you may want to set them defensively): set softtabstop=0 noexpandtab you want the tab key to generate an indent consisting of 4 space charactersĭepending on which behavior you need, one of the following sets of settings should work: If you want tab characters in your file to appear 4 character cells wide: set tabstop=4.you want tab characters in your file to appear 4 character cells wide?.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |