Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1057939
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T17:56:55+00:00 2026-05-16T17:56:55+00:00

I prefer to use tab than white space (may be a little different from

  • 0

I prefer to use tab than white space(may be a little different from most of others)

But I found, when I hit Enter at the end of line, it will add some white spaces, but not tab. So, I have to delete them and press tab.

I want to know how to set vim as:

  1. use only tab to indent the lines
  2. a tab looks like 4-spaces, but actually is a tab
  3. when hit enter at the end of a line, the new line is started with only tabs

I’ve googled for this for a while, but not found a good answer. Thank you in advance


UPDATE

The answer @Alok has provided works well in most of cases. But I just found, sometimes, it depends on the file type. For example, if you are editing a haml file, and there is a haml.vim in your vimfiles/indent/, then all the tabs will be converted to space. So if you want it to be tab only, you should modify(or delete) the corresponding indent file.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T17:56:56+00:00Added an answer on May 16, 2026 at 5:56 pm

    The settings you are looking for are:

    set autoindent
    set noexpandtab
    set tabstop=4
    set shiftwidth=4
    

    As single line:

    set autoindent noexpandtab tabstop=4 shiftwidth=4
    

    autoindent can be replaced with smartindent or cindent, depending upon your tastes. Also look at filetype plugin indent on.

    http://vim.wikia.com/wiki/Indenting_source_code

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Most C++ users that learned C prefer to use the printf / scanf family
For several reasons I prefer to configure my editor to insert spaces when TAB
I want to start/stop a deployment in weblogic 9 server. I prefer to use
Actually I'm always using Generic Collections and I frequently use List<>. Some scenarios I
I have a font that I wish to use on a website, and I
I have a linux console application - a scientific simulation program that I use.
It doesn't seem that PHP is short on XML-RPC solutions. I would prefer to
I'm quite new to android dev and would like to know, how can I
I recently signed up for an Amazon EC2 server, and plan to upload my
I was just wondering if it's possible to still show the built-in progress bar,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.