LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   Vim not putting tabs in Makefile (https://www.linuxquestions.org/questions/programming-9/vim-not-putting-tabs-in-makefile-30774/)

sarin 09-20-2002 07:08 AM

Vim not putting tabs in Makefile
 
Hi,

I was making a small Makefile and I got this error.

Makefile:14: *** missing separator. Stop.

I tried all that I knew and finally found that a tab was put as some spaces by vim. I opened it in pico and inserted a tab and eveything worked fine. Does anyone know how to tell vim to put a tab and not that many spaces?

--Sarin

PS: On a second thought, this should have gone to software or general section :o. Lets hope acid won't see this :D.

unSpawn 09-20-2002 10:16 AM

If I'm right it's "noexpandtab" or "et" (in vim type ":help et").
In your ~/.vimrc or other resource, add line (w/o quotes):
"set noexpandtab". Don't forget to source it or make an alias or script for it like:alias vim='vim -s<resource> $@'.

I'd say this definately is programming related, tho everyone should benefit from getting to know Vi (better)...

sarin 09-21-2002 12:37 AM

Thanks, It worked.
--Sarin

tarkalak 11-18-2011 08:38 AM

ather way
 
Add this to .vimrc
It will tell vim to not expand tabs for make regardless of your tab settings.

"This is for setting Makefiles with tabs not spaces
autocmd FileType make setlocal noexpandtab

zeozod 01-14-2018 11:36 PM

a better way
 
Rather than changing settings around for makefiles, you can always set vim to expandtabs, but then use a <C-v><C-i> whenever you really want to insert a tab, like when writing makefile rules.

astrogeek 01-14-2018 11:59 PM

Welcome to LQ zeozod.

You have replied to a 15 year old thread, which was last replied 7 years ago.

While your post may be relevant, it is preferred that you open your own threads for your own questions to assure that the details are current and specific to your own issues, and to attract the attention of currently active members.

Please review the Site FAQ for guidance in posting your questions and general forum usage.

dugan 01-15-2018 12:58 PM

Since it hasn't been said in the last 15 years:

Code:

autocmd filetype=make setlocal noexpandtab


All times are GMT -5. The time now is 11:19 PM.