免責聲明

Disclaimer (免責聲明)
繼續閱覽代表您接受以上的免責聲明.
To continue reading means you accept the above disclaimer.

2015年7月3日 星期五

vim indent for python, ftplugin


[ex1.py]
#!/usr/bin/env python

"""
Python docString :description about ex1.py
"""

# vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4

# ======= write your code below =========

....

# =======================================




//=== https://github.com/tarmack/vim-python-ftplugin
https://github.com/tarmack/vim-python-ftplugin.git

need pyflakes for python syntax check
$ sudo apt-get install pyflakes



//=== https://wiki.python.org/moin/Vim

"""...
A useful addition to Python source files is this comment:
# vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4

This may need the modeline option enabled in your ~/.vimrc file:
set modeline
(In Debian and Ubuntu, for example, the modeline option has been disabled for security reasons.)

The above # vim: ... text, when embedded in a source file, tells Vim that when the file is loaded, tabs are always expanded to spaces and that the width of each tab is four characters. Type the following in command mode to achieve the same effect:

:set tabstop=8 expandtab shiftwidth=4 softtabstop=4

Or:
:set ts=8 et sw=4 sts=4


... An alternative method is adding...

set tabstop=8
set expandtab
set softtabstop=4
set shiftwidth=4
filetype indent on
...to your ~/.vimrc file.
[but this will effect other types of files such as .js, .php, .c ...]


..."""

----->

"""...
add the following to ~/.vim/ftplugin/python.vim. Create the directory and/or file if it does not already exist.

set tabstop=8
set expandtab
set shiftwidth=4
set softtabstop=4

..."""


http://vim.wikia.com/wiki/Keep_your_vimrc_file_clean

"""...
move all the language-specific stuff from your .vimrc file into a file named
.vim/ftplugin/language.vim
(or $HOME/vimfiles/ftplugin/language.vim on Windows).


" File ~/.vimrc
" ($HOME/_vimrc on Windows)
" Global settings for all files (but may be overridden in ftplugin).
set tabstop=2
set shiftwidth=2
set noexpandtab



" File ~/.vim/ftplugin/python.vim
" ($HOME/vimfiles/ftplugin/python.vim on Windows)
" Python specific settings.
setlocal tabstop=4
setlocal shiftwidth=4
setlocal expandtab
setlocal autoindent
setlocal smarttab
setlocal formatoptions=croql


...
if there is a filetype plugin distributed with Vim that you want to completely disable, make your own (perhaps empty) settings file and adding this line:

let b:did_ftplugin = 1


..."""




//=== ftplugin !== ftp plugin

ftplugin: file type plugin
--> http://vim.wikia.com/wiki/File_type_plugins

"""...
A file type plugin (ftplugin) is a script that is run automatically
when Vim detects the type of file when the file is created or opened.

The type can be detected from the file name (for example, file sample.c has file type c),
or from the file contents.


...
to disable all ftplugins, or disable a particular default ftplugin,
see :help :filetype and :help ftplugin-overrule.




..."""



ftp plugin for vim
--> http://www.marksanborn.net/software/modify-remote-files-with-vims-built-in-ftp-plugin/

$ vim ftp://username@yourdomain.com//the/path/to/yourfile.php






沒有留言:

張貼留言