vim settings for python












6














I have the following settings file:



# ~/.vimrc
set tabstop=4
set shiftwidth=4
set smarttab
set expandtab
set softtabstop=4
set autoindent


How would I make these settings apply to python only? Also, how would I add python coloring (such as textmate does for each language) ?










share|improve this question



























    6














    I have the following settings file:



    # ~/.vimrc
    set tabstop=4
    set shiftwidth=4
    set smarttab
    set expandtab
    set softtabstop=4
    set autoindent


    How would I make these settings apply to python only? Also, how would I add python coloring (such as textmate does for each language) ?










    share|improve this question

























      6












      6








      6


      4





      I have the following settings file:



      # ~/.vimrc
      set tabstop=4
      set shiftwidth=4
      set smarttab
      set expandtab
      set softtabstop=4
      set autoindent


      How would I make these settings apply to python only? Also, how would I add python coloring (such as textmate does for each language) ?










      share|improve this question













      I have the following settings file:



      # ~/.vimrc
      set tabstop=4
      set shiftwidth=4
      set smarttab
      set expandtab
      set softtabstop=4
      set autoindent


      How would I make these settings apply to python only? Also, how would I add python coloring (such as textmate does for each language) ?







      python vim






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked May 25 '12 at 19:07









      David542

      32.5k90245451




      32.5k90245451
























          3 Answers
          3






          active

          oldest

          votes


















          4














          I have these lines in my config:



          filetype plugin indent on
          syntax on
          au BufNewFile,BufRead *.py set tabstop=4 softtabstop=4 shiftwidth=4 expandtab smarttab autoindent


          This may be what you're looking for with the coloring:
          Improved Python syntax, Blackboard color scheme






          share|improve this answer



















          • 2




            I don't think you need all the separators |, you can do it all in one set with set tabstop=4 softtabstop=4 shifwitdth=4 expandtab...
            – skeept
            May 26 '12 at 20:58










          • @skeept Thanks! I updated my answer (and my vim config) to remove the extra set's.
            – Justin Warkentin
            May 27 '12 at 21:51










          • The nicer autocommand is: autocmd FileType python set ...
            – Dave Halter
            May 27 '12 at 22:59



















          6














          Put them in vimfiles/ftplugin/python.vim (but change set to setlocal) and add filetype plugin on to .vimrc. For syntax highlighting, add syntax on to .vimrc.






          share|improve this answer





















          • It this ~/.vim/vimfiles/ftplugin/python.vim or where is the exact location of the file?
            – David542
            May 25 '12 at 19:18










          • You have to put it into ~/.vim/ftplugin/python.vim.
            – Dave Halter
            May 27 '12 at 22:58



















          0














          In addition to the above, try your hand at vim-janus which adds other goodies to vim.






          share|improve this answer





















            Your Answer






            StackExchange.ifUsing("editor", function () {
            StackExchange.using("externalEditor", function () {
            StackExchange.using("snippets", function () {
            StackExchange.snippets.init();
            });
            });
            }, "code-snippets");

            StackExchange.ready(function() {
            var channelOptions = {
            tags: "".split(" "),
            id: "1"
            };
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function() {
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled) {
            StackExchange.using("snippets", function() {
            createEditor();
            });
            }
            else {
            createEditor();
            }
            });

            function createEditor() {
            StackExchange.prepareEditor({
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader: {
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            },
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            });


            }
            });














            draft saved

            draft discarded


















            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f10760082%2fvim-settings-for-python%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            3 Answers
            3






            active

            oldest

            votes








            3 Answers
            3






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            4














            I have these lines in my config:



            filetype plugin indent on
            syntax on
            au BufNewFile,BufRead *.py set tabstop=4 softtabstop=4 shiftwidth=4 expandtab smarttab autoindent


            This may be what you're looking for with the coloring:
            Improved Python syntax, Blackboard color scheme






            share|improve this answer



















            • 2




              I don't think you need all the separators |, you can do it all in one set with set tabstop=4 softtabstop=4 shifwitdth=4 expandtab...
              – skeept
              May 26 '12 at 20:58










            • @skeept Thanks! I updated my answer (and my vim config) to remove the extra set's.
              – Justin Warkentin
              May 27 '12 at 21:51










            • The nicer autocommand is: autocmd FileType python set ...
              – Dave Halter
              May 27 '12 at 22:59
















            4














            I have these lines in my config:



            filetype plugin indent on
            syntax on
            au BufNewFile,BufRead *.py set tabstop=4 softtabstop=4 shiftwidth=4 expandtab smarttab autoindent


            This may be what you're looking for with the coloring:
            Improved Python syntax, Blackboard color scheme






            share|improve this answer



















            • 2




              I don't think you need all the separators |, you can do it all in one set with set tabstop=4 softtabstop=4 shifwitdth=4 expandtab...
              – skeept
              May 26 '12 at 20:58










            • @skeept Thanks! I updated my answer (and my vim config) to remove the extra set's.
              – Justin Warkentin
              May 27 '12 at 21:51










            • The nicer autocommand is: autocmd FileType python set ...
              – Dave Halter
              May 27 '12 at 22:59














            4












            4








            4






            I have these lines in my config:



            filetype plugin indent on
            syntax on
            au BufNewFile,BufRead *.py set tabstop=4 softtabstop=4 shiftwidth=4 expandtab smarttab autoindent


            This may be what you're looking for with the coloring:
            Improved Python syntax, Blackboard color scheme






            share|improve this answer














            I have these lines in my config:



            filetype plugin indent on
            syntax on
            au BufNewFile,BufRead *.py set tabstop=4 softtabstop=4 shiftwidth=4 expandtab smarttab autoindent


            This may be what you're looking for with the coloring:
            Improved Python syntax, Blackboard color scheme







            share|improve this answer














            share|improve this answer



            share|improve this answer








            edited May 27 '12 at 21:50

























            answered May 25 '12 at 19:10









            Justin Warkentin

            5,78742428




            5,78742428








            • 2




              I don't think you need all the separators |, you can do it all in one set with set tabstop=4 softtabstop=4 shifwitdth=4 expandtab...
              – skeept
              May 26 '12 at 20:58










            • @skeept Thanks! I updated my answer (and my vim config) to remove the extra set's.
              – Justin Warkentin
              May 27 '12 at 21:51










            • The nicer autocommand is: autocmd FileType python set ...
              – Dave Halter
              May 27 '12 at 22:59














            • 2




              I don't think you need all the separators |, you can do it all in one set with set tabstop=4 softtabstop=4 shifwitdth=4 expandtab...
              – skeept
              May 26 '12 at 20:58










            • @skeept Thanks! I updated my answer (and my vim config) to remove the extra set's.
              – Justin Warkentin
              May 27 '12 at 21:51










            • The nicer autocommand is: autocmd FileType python set ...
              – Dave Halter
              May 27 '12 at 22:59








            2




            2




            I don't think you need all the separators |, you can do it all in one set with set tabstop=4 softtabstop=4 shifwitdth=4 expandtab...
            – skeept
            May 26 '12 at 20:58




            I don't think you need all the separators |, you can do it all in one set with set tabstop=4 softtabstop=4 shifwitdth=4 expandtab...
            – skeept
            May 26 '12 at 20:58












            @skeept Thanks! I updated my answer (and my vim config) to remove the extra set's.
            – Justin Warkentin
            May 27 '12 at 21:51




            @skeept Thanks! I updated my answer (and my vim config) to remove the extra set's.
            – Justin Warkentin
            May 27 '12 at 21:51












            The nicer autocommand is: autocmd FileType python set ...
            – Dave Halter
            May 27 '12 at 22:59




            The nicer autocommand is: autocmd FileType python set ...
            – Dave Halter
            May 27 '12 at 22:59













            6














            Put them in vimfiles/ftplugin/python.vim (but change set to setlocal) and add filetype plugin on to .vimrc. For syntax highlighting, add syntax on to .vimrc.






            share|improve this answer





















            • It this ~/.vim/vimfiles/ftplugin/python.vim or where is the exact location of the file?
              – David542
              May 25 '12 at 19:18










            • You have to put it into ~/.vim/ftplugin/python.vim.
              – Dave Halter
              May 27 '12 at 22:58
















            6














            Put them in vimfiles/ftplugin/python.vim (but change set to setlocal) and add filetype plugin on to .vimrc. For syntax highlighting, add syntax on to .vimrc.






            share|improve this answer





















            • It this ~/.vim/vimfiles/ftplugin/python.vim or where is the exact location of the file?
              – David542
              May 25 '12 at 19:18










            • You have to put it into ~/.vim/ftplugin/python.vim.
              – Dave Halter
              May 27 '12 at 22:58














            6












            6








            6






            Put them in vimfiles/ftplugin/python.vim (but change set to setlocal) and add filetype plugin on to .vimrc. For syntax highlighting, add syntax on to .vimrc.






            share|improve this answer












            Put them in vimfiles/ftplugin/python.vim (but change set to setlocal) and add filetype plugin on to .vimrc. For syntax highlighting, add syntax on to .vimrc.







            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered May 25 '12 at 19:11









            Cat Plus Plus

            89.8k22166201




            89.8k22166201












            • It this ~/.vim/vimfiles/ftplugin/python.vim or where is the exact location of the file?
              – David542
              May 25 '12 at 19:18










            • You have to put it into ~/.vim/ftplugin/python.vim.
              – Dave Halter
              May 27 '12 at 22:58


















            • It this ~/.vim/vimfiles/ftplugin/python.vim or where is the exact location of the file?
              – David542
              May 25 '12 at 19:18










            • You have to put it into ~/.vim/ftplugin/python.vim.
              – Dave Halter
              May 27 '12 at 22:58
















            It this ~/.vim/vimfiles/ftplugin/python.vim or where is the exact location of the file?
            – David542
            May 25 '12 at 19:18




            It this ~/.vim/vimfiles/ftplugin/python.vim or where is the exact location of the file?
            – David542
            May 25 '12 at 19:18












            You have to put it into ~/.vim/ftplugin/python.vim.
            – Dave Halter
            May 27 '12 at 22:58




            You have to put it into ~/.vim/ftplugin/python.vim.
            – Dave Halter
            May 27 '12 at 22:58











            0














            In addition to the above, try your hand at vim-janus which adds other goodies to vim.






            share|improve this answer


























              0














              In addition to the above, try your hand at vim-janus which adds other goodies to vim.






              share|improve this answer
























                0












                0








                0






                In addition to the above, try your hand at vim-janus which adds other goodies to vim.






                share|improve this answer












                In addition to the above, try your hand at vim-janus which adds other goodies to vim.







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered May 25 '12 at 20:51









                Burhan Khalid

                121k13150210




                121k13150210






























                    draft saved

                    draft discarded




















































                    Thanks for contributing an answer to Stack Overflow!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid



                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.


                    To learn more, see our tips on writing great answers.





                    Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


                    Please pay close attention to the following guidance:


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid



                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.


                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function () {
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f10760082%2fvim-settings-for-python%23new-answer', 'question_page');
                    }
                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    Bressuire

                    Vorschmack

                    Quarantine