Python-mode: don't show line numbers

Created on 18 Dec 2013  路  8Comments  路  Source: python-mode/python-mode

I'm new to this vim plugin. When I open a Python source, line numbers are shown automatically. How to switch them off? I don't want to see the line numbers. Thanks.

Most helpful comment

setlocal nonumber
by default would be good. Simpler way to change the setting would be even better!

All 8 comments

You can disable default options by using g:pymode_options = 0.

See vim help on python mode: :help g:pymode_options

Setup default python options                                'g:pymode_options'                       

    let g:pymode_options = 1                                                                                            

If this option is set to 1, pymode will enable the following options for         
python buffers:                                                                                                         

    setlocal complete+=t                                                                                                
    setlocal formatoptions-=t                                                                                           
    if v:version > 702 && !&relativenumber                                      
        setlocal number                                                                                                 
    endif                                                                                                               
    setlocal nowrap                                                                                                     
    setlocal textwidth=79                                                                                               
    setlocal commentstring=#%s                                                                                          
    setlocal define=^\s*\\(def\\\\|class\\)       

Thanks. For reference, here is my solution then:

" remove automatic line numbers and put everything else back
let g:pymode_options = 0
setlocal complete+=t
setlocal formatoptions-=t
"if v:version > 702 && !&relativenumber
"    setlocal number
"endif
setlocal nowrap
setlocal textwidth=79
setlocal commentstring=#%s
setlocal define=^\s*\\(def\\\\|class\\)

@jabbalaci: A simpler way is to add the following:

autocmd FileType python setlocal nonumber

@nidico This does not seem to work for me. I suppose the FileType hook is executed before the python-mode sets it to number again. When I set it to relativenumber that seems to be picked up and since python-mode checks this setting before changing it it leaves it as-is. That confirms my suspicion that the autocmd is executed too early.

Any ideas how to make sure the command is executed after pymode is done?

Any better solution than @lodagro's and @jabbalaci's work-around to set nonumber? Alternatively, if disabling the pymode options would not drop set define=^\s*\\(def\\\\|class\\), that approach would work: At least for me, the only pymode option I really "need" is the define setting, and therefore it should not be part of these optional settings.

setlocal nonumber
by default would be good. Simpler way to change the setting would be even better!

Actually @nidico's solution did work for me and was not overwritten like what happened to @Leonidas-from-XIV

This is working for me:
:set nonumber

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Ins1ne picture Ins1ne  路  10Comments

timfeirg picture timfeirg  路  4Comments

lyneca picture lyneca  路  4Comments

kryptek picture kryptek  路  10Comments

klen picture klen  路  3Comments