Description
===========
Pydiction allows you to Tab-complete Python code in Vim, including keywords, the standard library, and third-party modules.
It consists of three main files:
python_pydiction.vim -- This is an ftplugin you put in your non-system ftplugin directory (i.e., ~/.vim/after/ftplugin/, on Unix or C:\vim\vimfiles\ftplugin\, on Windows)
complete-dict -- This is a vim dictionary file that consists of Python keywords and modules. This is what python_pydiction.vim looks at to know which things are completable.
pydiction.py -- (Not required) This is a Python script that was used to generate complete-dict. You can optionally run this script to add more modules to complete-dict.
Install Details
===============
Unix/Linux: Put python_pydiction.vim in ~/.vim/after/ftplugin/ (If this directory doesn't already exist, create it. Vim will know to look there automatically.)
Windows: Put python_pydiction.vim in C:\vim\vimfiles\ftplugin (Assuming you installed Vim to C:\vim\).
You may install the other files (complete-dict and pydiction.py) anywhere you want. For this example, we'll assume you put them in "C:\vim\vimfiles\ftplugin\pydiction\" (Do not put any file but python_pydiction.vim in the ftplugin\ directory, only .vim files should go there.)
In your vimrc file, first add the following line to enable filetype plugins:
filetype plugin on
then make sure you set "g:pydiction_location" to the full path of where you installed complete-dict, i.e.:
let g:pydiction_location = 'C:/vim/vimfiles/ftplugin/pydiction/complete-dict'
You can optionally set the height of the completion menu by setting "g:pydiction_menu_height" in your vimrc. For example:
let g:pydiction_menu_height = 20
The default menu height is 15.
Note: If you were using a version of Pydiction less than 1.0, make sure you delete the old pydiction way of doing things from your vimrc. You should ***NOT*** have this in your vimrc anymore:
if has("autocmd")
autocmd FileType python set complete+=k/path/to/pydiction iskeyword+=.,(
endif " has("autocmd")
Usage
=====
Type part of a Python keyword, module name, attribute or method in "insert mode" in Vim, then hit the TAB key and it will auto-complete.
For example, typing:
raw<Tab>
will bring up a menu of possibilities, such as:
raw_input(
raw_unicode_escape_decode(
raw_unicode_escape_encode(
Typing:
os.p<Tab>
pops up:
os.pardir
os.path
os.pathconf(
os.pathconf_names
os.pathsep
os.pipe(
...
Typing:
co<Tab>
pops up:
continue
coerce(
compile(
...
and so on.
As of Pydiction 1.2, there's support for completing modules that were imported via "from module import submodule". For example, you could do:
from xml.parsers import expat
expat.P<Tab>
which expands to:
expat.ParserCreate(
You can also now use Shift-Tab to Tab backwards through the popup menu.
If you feel you're getting different results in your completion menu, it's probably because you don't have Vim set to ignore case. You can remedy this with ":set noic"
Pydiction versus other forms of completion
==========================================
Pydiction can complete Python Keywords, as well as Python module names and their attributes and methods. It can also complete both the fully-qualified module names such as "module.method", as well as non-fully qualified names such as simply "method".
Pydiction only uses the "Tab" key to complete, uses a special dictionary file to complete from, and only attempts to complete while editing Python files. This has the advantages of only requiring one keystroke to do completion and of not polluting all of your completion menus that you may be using for other types of completion, such as Vim's regular omni-completion, or other completion scripts that you may be running.
Since pydiction uses a dictionary file of possible completion items, it can complete 3rd party modules much more accurately than other ways. You have full control over what it can and cannot complete. If it's unable to complete anything you can either use pydiction.py, to automatically add a new module's contents to the dictionary, or you can manually add them using a text editor. The dictionary is just a plain text file, which also makes it portable across all platforms. For example, if you're a PyQT user, you can add all the PyQT related modules to the dictionary file (complete-dict) by using pydiction.py. The latest default complete-dict already contains most of the standard library, all Python 2.x keywords, Pygame, OpenGL, wxPython, Twisted, PyQT4, ZSI, LDAP, numarray, PyGTK, MySQLdb, PyGreSQL, pyPgSQL, PythonCard, pyvorbis, bcrypt, openid, GnuPGInterface, OpenSSl, pygments and more.
Also, because pydiction uses a dictionary file, you don't have to import a module before you can complete it, nor do you even have to have the module installed on your machine. This makes completion very fast since it doesn't need to do any type deducing. It also frees you up to use pydiction as a way of looking up what a module or submodule without having to install it first.
If you want to, you can still use Vim 7's built-in omni-completion for Python (pythoncomplete.vim), and other forms of ins-completion, with Pydiction. In fact, they can all make a great team.
Pydiction knows when you're completing a callable method or not and, if you are, it will automatically insert an opening parentheses.
The Tab key will work as normal for everything else. Pydiction will only try to use the Tab key to complete Python code if you're editing a Python file and you first type part of some Python module or keyword.
Pydiction doesn't even require Python support to be compiled into your version of Vim.
python_pydiction.vim (filetype plugin)
======================================
Pydiction will make it so the Tab key on your keyboard is able to complete python code.
Version 1.0 and greater of Pydiction uses a new file called python_pydiction.vim, which is an ftplugin that only activates when you're editing a python file (e.g., you're editing a file with a ".py" extension or you've manually typed ":set filetype=python"). Past versions of pydiction didn't use a plugin and instead just required you to change the value of "isk" in your vimrc, which was not desirable. Version 1.0 and greater do not require you to manually change the value of isk. It now safely changes isk for you temporarily by only setting it while you're doing Tab-completion of Python code, and it automatically changes it back to its original value whenever Tab-completion isn't being activated. Again, only Tab-completion causes pydiction to activate; not even other forms of ins-completion, such as <Ctrl-x> or <Ctrl-n> completion will activate pydiction, so you're still free to use those other types of completion whenever you want to.
Pydiction works by using Vim's ins-completion functionality by temporarily remapping the Tab key to do the same thing as I_CTRL-X_CTRL_K (dictionary only completion). This means that whenever you're editing a Python file, and you start typing the name of a python keyword or module, you can press the Tab key to complete it. For example, if you type "os.pa" and then press Tab, Pydiction will pop up a completion menu in Vim that will look something like:
os.pardir
os.path
os.pathconf(
os.pathconf_names
os.path.
os.path.__all__
os.path.__builtins__
os.path.__doc__
...
Pressing Tab again while the menu is open will scroll down the menu so you can choose whatever item you want to go with, using the popup-menu keys:
CTRL-Y Accept the currently selected match and stop completion.
<Space> Accept the currently selected match and insert a space.
CTRL-E Close the menu and not accept any match.
....
hitting Enter will accept the currently selected match, stop completion, and
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
vim配置(c++)。。。。。。。。 (442个子文件)
_vimrc 6KB
adapter 33KB
algorithm 191KB
algorithm 121KB
algorithm 3KB
array 16KB
bitset 35KB
bitset 14KB
calloc_double_matrix.c 1KB
calloc_int_matrix.c 1KB
main.c 498B
cassert 2KB
cassert 223B
main.cc 503B
ccomplex 290B
cctype 3KB
cctype 1KB
cerrno 2KB
cerrno 692B
cfloat 2KB
cfloat 298B
ChangeLog 21KB
ciso646 301B
climits 2KB
climits 336B
clocale 2KB
clocale 705B
cmath 14KB
cmath 2KB
complete-dict 1.97MB
complex 40KB
complex 31KB
delayhlp.cpp 15KB
csetjmp 2KB
csetjmp 585B
csignal 2KB
csignal 610B
cstdarg 2KB
cstdarg 440B
cstddef 2KB
cstddef 592B
cstdio 4KB
cstdio 2KB
cstdlib 5KB
cstdlib 1KB
cstring 3KB
cstring 951B
README.csupport 7KB
customization.ctags 200B
ctime 2KB
ctime 758B
cwchar 6KB
cwchar 2KB
cwctype 3KB
cwctype 1KB
deque 43KB
deque 38KB
deque 3KB
EasyGrepFileAssociations 3KB
exception 10KB
exception 5KB
fstream 30KB
fstream 25KB
functional 34KB
functional 24KB
functional 2KB
customization.gvimrc 3KB
stl_algo.h 182KB
locale_facets.h 157KB
appdomain.h 122KB
sal.h 117KB
penwin.h 108KB
tchar.h 97KB
crtdefs.h 95KB
basic_string.h 90KB
intrin.h 87KB
comdefsp.h 77KB
wchar.h 74KB
comutil.h 58KB
stl_deque.h 53KB
stdio.h 47KB
stl_tree.h 46KB
stdlib.h 45KB
dvec.h 42KB
stl_list.h 40KB
crtdbg.h 38KB
stl_vector.h 34KB
ivec.h 32KB
boost_concept_check.h 31KB
stl_algobase.h 31KB
mbstring.h 31KB
wmiatlprov.h 28KB
ios_base.h 28KB
stl_map.h 27KB
stl_iterator.h 27KB
string.h 27KB
comip.h 26KB
stl_bvector.h 26KB
stl_multimap.h 25KB
stl_function.h 25KB
共 442 条
- 1
- 2
- 3
- 4
- 5
资源评论
- yangwen02282011-11-05很好用,不过也有一些地方是和自己的使用习惯不一样的,所以,修改了一些参数,现在用着很舒服。
- tianshilei19922012-09-02总体配置挺好的,但是有些习惯不一样,还需要修改一下~
- chenmo0746392017-08-25感觉还是不行,可能是我的vim版本不同,放弃了
Throughingzhou
- 粉丝: 0
- 资源: 1
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 卡方数据.sav
- Python实现基于Django框架的二手物品购物网站设计源码+数据库.zip
- 基于Python和Django的二手物品购物网站设计源码+数据库脚本.zip
- 【计算机毕业设计】基于h5的移动网赚项目小程序【源码+lw+部署文档+讲解】
- 【计算机毕业设计】基于ssm-vue的oa系统设计与实现【源码+lw+部署文档+讲解】
- 基于pytorch实现的YOLOV5+SORT的车辆行人目标识别及追踪系统源码.zip
- 【计算机毕业设计】基于servlet+jdbc的在线选房系统设计与实现【源码+lw+部署文档+讲解】
- 投身科技创新,勇担时代先锋.pptx
- 【计算机毕业设计】基于SSM的仿微博系统的设计与实现【源码+lw+部署文档+讲解】
- 使用 Web Components 实现,遵循 Material You 设计规范的 Web 前端组件库
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功