Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. QML syntax highlighting in Vim
Forum Updated to NodeBB v4.3 + New Features

QML syntax highlighting in Vim

Scheduled Pinned Locked Moved QML and Qt Quick
10 Posts 5 Posters 17.8k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    aalpert
    wrote on 20 Jul 2010, 04:42 last edited by
    #1

    While Qt Quick includes using Qt Creator as the tool for creating complete QML applications, no one is forcing you to use it. For those still using Vim for editing QML, I've made available "the vim syntax highlighting file":http://gitorious.org/qt-qml-demo-playground/qt-qml-demo-playground/blobs/master/qml.vim I've been using. Enjoy!

    1 Reply Last reply
    0
    • M Offline
      M Offline
      mgran
      wrote on 27 Jul 2010, 14:04 last edited by
      #2

      Thanks! We will make the syntax highlight here on this forum/qtdevnet work with QML as well.

      Project Manager - Qt Development Frameworks

      1 Reply Last reply
      0
      • G Offline
        G Offline
        gustavo
        wrote on 5 Aug 2010, 19:36 last edited by
        #3

        Interesting! I've also made mine. You can find it "here":http://www.cecm.usp.br/~gustavo/arquivos/vim/syntax/qml.vim if you prefer an alternative syntax highlighting file.

        There's an indent file for qml too. It's "here":http://www.cecm.usp.br/~gustavo/arquivos/vim/indent/qml.vim. Actually, it's mostly based on a javascript indent file found on vim website.

        1 Reply Last reply
        0
        • M Offline
          M Offline
          mgran
          wrote on 6 Aug 2010, 09:50 last edited by
          #4

          Cheers, we have a feature request logged here: "http://bugreports.qt.nokia.com/browse/QTWEBSITE-53":http://bugreports.qt.nokia.com/browse/QTWEBSITE-53.

          My questions is: We're using "@" as the general code tag on devnet, do you guys think we need to add another code tag for js/qml or would they coexist ok with just one?

          Project Manager - Qt Development Frameworks

          1 Reply Last reply
          0
          • A Offline
            A Offline
            aalpert
            wrote on 6 Aug 2010, 10:07 last edited by
            #5

            If there's no reason to make a separate code tag due to the implementation, I see no reason they can't coexist. QML is just another language, from the perspective of reading code listings. And QML doesn't use the '@' character specially.

            1 Reply Last reply
            0
            • M Offline
              M Offline
              mgran
              wrote on 6 Aug 2010, 10:20 last edited by
              #6

              Ok, we'll make a syntax highlighting file that takes care of C++ (with Qt classes), JavaScript and QML whenever it's invoked by a pair of @'s.

              Here is another question: Qt has 7832 functions last time I "checked":http://doc.qt.nokia.com/4.7-snapshot/functions.html. Adding them all to the syntax file bloats it quite a bit. How would you rate the value of having those in there?

              Project Manager - Qt Development Frameworks

              1 Reply Last reply
              0
              • M Offline
                M Offline
                mgran
                wrote on 6 Aug 2010, 10:30 last edited by
                #7

                Hum, with caching, minimizing and gz compression I guess it's not a big deal. It would add 34k to the first page load and stay cached in the browser for a year.

                Project Manager - Qt Development Frameworks

                1 Reply Last reply
                0
                • G Offline
                  G Offline
                  gustavo
                  wrote on 6 Aug 2010, 16:33 last edited by
                  #8

                  I'm not sure, but maybe highlighting all the 7832 Qt functions would made code less readable, a bit visually polluted.

                  1 Reply Last reply
                  0
                  • I Offline
                    I Offline
                    ivan
                    wrote on 6 Aug 2010, 16:54 last edited by
                    #9

                    Thanks a bunch for this Alan.

                    I know we should (as you said at aKademy) use Qt Creator, but for us Vim-addicts, this is a much better solution :)

                    @Marius

                    For me, the function highlighting is not that important, especially if it is not context sensitive. Usually, I just put all Qt and KDE classes along with a few macros (Q_OBJECT, Q_...) and leave the methods out.

                    Although, if "highlighting" would also mean links from methods to the docs... that could be quite useful.

                    Ivan Čukić | ivan.cukic(at)kde.org | KDE e.V.
                    Qt Ambassador (from the old Nokia days)

                    1 Reply Last reply
                    0
                    • B Offline
                      B Offline
                      bbeck
                      wrote on 6 May 2011, 16:00 last edited by
                      #10

                      I was wondering if you have already or were planning on pushing this upstream to the vim team?

                      1 Reply Last reply
                      0

                      • Login

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • Users
                      • Groups
                      • Search
                      • Get Qt Extensions
                      • Unsolved