Thread: problem with Makefile separator

  1. #1
    Registered User
    Join Date
    Dec 2006
    Posts
    20

    problem with Makefile separator

    Hi All

    I recently changed my vim config file. Now when I hit tab it will produce 4 spaces.

    But now I get a problem with Makefiles, it really seem to need a tab character (\t doesn't work)

    Is there anyway I can keep my vim configuration an work with Makefiles without the tab character ?

    Or is there a way to start vim without reading .vimrc or can I somehow tell vi to restore the tab for the current session... ?

    Thx a lot
    LuCa

  2. #2
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,895
    Yes, Make is picky.

    Anyway, this is a tech issue about vim configuration and should be in the tech board.
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

  3. #3
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,660
    Moved
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  4. #4
    The Artful Lurker Deckard's Avatar
    Join Date
    Jan 2002
    Posts
    633
    I have my system setup to do just that. Here's the .vimrc from my home directory:

    Code:
    " .vimrc
    " Last updated August 14, 2005 by jdeckard
    set shiftwidth=3
    set shiftround
    set expandtab
    set noautoindent
    set nocindent
    
    " Enable file type detection
    filetype on
    I'm guessing you'll want to set shiftwidth to four. Vim's file type detection knows to use spaces for .c files and hard tabs for Makefiles. If you feel the need to change the default behavior any further, take a look at $VIMRUNTIME/filetype.vim and $VIMRUNTIME/syntax/lpc.vim.
    Jason Deckard

  5. #5
    Registered User
    Join Date
    Dec 2006
    Posts
    20
    thnx.

    however it doesn't seem to work, I don't get tabs when I'm working on a Makefile
    This is what I have so far:
    Code:
    set expandtab
    set tabstop=2
    set shiftwidth=4
    set shiftround
    set noautoindent
    set nocindent
    
    " The opposite is 'set wrapscan' while searching for strings....
    set nowrapscan
    
    " Source in your custom filetypes as given below -
    so $HOME/.vim/myfiletypes.vim
    " turn on syntax highlighting
    syntax on
    
    highlight Normal guibg=Black
    
    " enable command line history
    set history=100
    
    " Enable file type detection
    filetype on
    Any suggestions why it doesn't work ?
    Is there a way to check vi's assumptions (also usefull with color-highligting) ?

    LuCa

  6. #6
    The Artful Lurker Deckard's Avatar
    Join Date
    Jan 2002
    Posts
    633
    Code:
    " Source in your custom filetypes as given below -
    so $HOME/.vim/myfiletypes.vim
    That looks suspicious. Could it be overriding the vim defaults? Also, try :help from within vim. If that doesn't work, let me know what version you're running.
    Jason Deckard

  7. #7
    Registered User
    Join Date
    Dec 2006
    Posts
    20
    I actually never used the :help function, but I must admit it is usefull!
    Anyway, when I added
    Code:
     filetype plugin indent on
    it worked!!

    Thanks a lot
    LuCa

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. WS_POPUP, continuation of old problem
    By blurrymadness in forum Windows Programming
    Replies: 1
    Last Post: 04-20-2007, 06:54 PM
  2. Problem with makefile, how to use the -lm oh this?
    By Nazgulled in forum C Programming
    Replies: 1
    Last Post: 04-07-2006, 01:29 PM
  3. Laptop Problem
    By Boomba in forum Tech Board
    Replies: 1
    Last Post: 03-07-2006, 06:24 PM
  4. Replies: 5
    Last Post: 11-07-2005, 11:34 PM
  5. beginner problem
    By The_Nymph in forum C Programming
    Replies: 4
    Last Post: 03-05-2002, 05:46 PM