How to edit Makefiles in QtCreator



  • My standard project settings replace tabs with spaces. However, when editing Makefiles qtcreator should not remove tabs as they have special meaning as a separator. Any idea how to make QtCreator leave tabs unchanged when editing Makefiles but use spaces otherwise? I'v checked with KDevelop3/4 they don't show this behavior.



  • Are you using home-brew makefiles? Usually you shouldn't be tinkering with the autogenerated ones, as your changes will be overwritten anyway. As for the editor behavior, check the latest creator release (2.3 beta) maybe they fixed it there.



  • Yes, it's a custom Makefile project, no qmake involved. Checked with 2.2.1 which lets you - at least - copy tabs but when I save the file it converts tabs to spaces again, although it does that with newly edited lines only. ?!. There's vi to work around the issue.
    Nobody using qtcreator with custom Makefiles?


  • Moderators

    You can uncheck "Insert spaces instead of tabs" in your Tools -> Options... -> Text Editor -> Behavior tab. That may help.

    Edit: Formatting.



  • That doesn't suit the use case where you want tabs to be converted to spaces in your c code.


  • Moderators

    [quote author="Franzk" date="1311179339"]That doesn't suit the use case where you want tabs to be converted to spaces in your c code.[/quote]

    Granted, but it is a temporary workaround that allows editing of tab-sensitive files. It's not perfect, but it beats having to dig out an external editor.



  • A very late answer to this question, since I saw this thread recently, but maybe someone still is interested.

    A workaround for this and to have "Insert spaces instead of tabs" option enabled is to edit the Makefiles in fakevim mode. When a "real tab" is needed inserting the combination <ctrl>-v,<tab> will give a "real tab" just as it does in the real vim.

    Kind regards,
    Znahoj


  • Moderators

    ... adding a generic highlighter for Makefiles does help a bit. Tools->Options->Text Editor->generic highlighter and download more definitons. By default we do not ship the Makefile definition file.



  • I know this is an old post but I want to describe a situation in this area which happened to me.
    I spent few hours finding why my deb package build for Harmattan is incomplete (It didn't contain *harmattan.desktop, icon and app binary files).

    At the end I found that rules file contained spaces instead of tabs in lines where make install was called and thus no file beside copyright and changelog files was copied.

    Off course it was me who changed the file, but I didn't expect such a situation...


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.