Created
December 8, 2016 14:37
-
-
Save soardex/fbad6dce6eb165131ff967d3ba61e721 to your computer and use it in GitHub Desktop.
Show List Of Whitespace And Expand Tabs On VIM
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" answer from http://stackoverflow.com/a/2159997/1406063 | |
" use 4 spaces for tabs | |
set tabstop=4 softtabstop=4 shiftwidth=4 | |
" display indentation guides | |
set list listchars=tab:❘-,trail:·,extends:»,precedes:«,nbsp:× | |
" convert spaces to tabs when reading file | |
autocmd! bufreadpost * set noexpandtab | retab! 4 | |
" convert tabs to spaces before writing file | |
autocmd! bufwritepre * set expandtab | retab! 4 | |
" convert spaces to tabs after writing file (to show guides again) | |
autocmd! bufwritepost * set noexpandtab | retab! 4 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment