Hacker News new | comments | show | ask | jobs | submit login

You can get rid of the global variable by testing the actual settings instead:

    function! NumberToggle()
        if (!&number && !&relativenumber)
            set number
            set norelativenumber
        elseif (&number && !&relativenumber)
            set relativenumber
        else
            set nonumber
            set norelativenumber
        endif
        set foldcolumn=0
    endfunc



Thanks! It was my first attempt writing a vim function, so wasn't exactly sure. This looks much better.




Applications are open for YC Winter 2018

Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | DMCA | Apply to YC | Contact

Search: