Reputation: 582
I want to use tabs(not spaces) in vim for both indentation and when I specifically press <Tab>
. I changed my .vimrc
after looking up on the internet but doesn't seem to work.
.vimrc
au BufNewFile,BufRead *.py,*.pyw,*.c,*.h,*.pyx match BadWhitespace /\s\+$/
\ set tabstop=4
\ set shiftwidth=4
\ set softtabstop=4
\ set textwidth=79
\ set noexpandtab
\ set autoindent
\ set fileformat=unix
set encoding=utf-8
Tabs are inserted when i use <C-v><Tab>
but otherwise spaces are inserted instead of tabs.
Upvotes: 1
Views: 1397
Reputation: 47099
You need <bar>
(|
) between each command, and you can join the set
s together:
au BufNewFile,BufRead *.py,*.pyw,*.c,*.h,*.pyx match BadWhitespace /\s\+$/ |
\ setlocal tabstop=4 shiftwidth=4 softtabstop=4 noexpandtab autoindent
\ textwidth=79 fileformat=unix
set encoding=utf-8
You can show trailing whitespaces with the listchars trail
:
set listchars+=trail:-
Upvotes: 2