On 2019-04-04, chrisheithoff wrote:
> Instead of writing your own Python autocmd, have you already been
> aware of the Vim filetype plugin for Python already does? 
> 
> See the ftplugin/python.vim script in the Vim runtime path.

Good point.  If you want to add to or modify the settings in that
file, _don't_modify_that_file_.  Any changes you make to that file
may be lost the next time you update Vim.  Instead, put your
settings into an after plugin you create, in this case,
~/.vim/after/ftplugin/python.vim.  Also, for filetype-specific
settings, you should use setlocal rather than set, e.g.,

    setlocal tabstop=4
    setlocal softtabstop=4
    setlocal shiftwidth=4
    setlocal textwidth=79
    setlocal expandtab
    setlocal autoindent
    setlocal fileformat=unix

See:

    :help ftplugin-overrule

The above will work fine, but to do it "right", the after/ftplugin
file should look like this:

    let s:save_cpo = &cpo
    set cpo-=C

    setlocal tabstop=4
    setlocal softtabstop=4
    setlocal shiftwidth=4
    setlocal textwidth=79
    setlocal expandtab
    setlocal autoindent
    setlocal fileformat=unix

    let b:undo_ftplugin = (exists("b:undo_ftplugin") ? b:undo_ftplugin . "|" : 
"")
        \ . "setlocal tabstop< softtabstop< shiftwidth< textwidth< expandtab< 
autoindent< fileformat<"

    let &cpo = s:save_cpo
    unlet s:save_cpo

See:

    :help undo_ftplugin
    :help filetype-plugin
    :help use-cpo-save

Regards,
Gary

-- 
-- 
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to