zoukankan      html  css  js  c++  java
  • Python tab 命令补全,以及 vim 补全

    在python 命令行中,使用补全

    python 查看 packages 的目录

    可用 sys.path 查看。

    /usr/lib/python2.7/site-packages

    vim tab.py

    #!/usr/bin/env python 
    # python startup file 
    import sys
    import readline
    import rlcompleter
    import atexit
    import os
    # tab completion 
    readline.parse_and_bind('tab: complete')
    # history file 
    histfile = os.path.join(os.environ['HOME'], '.pythonhistory')
    try:
        readline.read_history_file(histfile)
    except IOError:
        pass
    atexit.register(readline.write_history_file, histfile)
    del os, histfile, readline, rlcompleter
    

      

    在 vim 中使用 命令补全

    使用 Pydiction 来实现 vim 中python 代码的补全。

    下载地址 http://www.vim.org/scripts/script.php?script_id=850

    下载最新版本的 Pydiction

    解压 pydiction

    将 python_pydiction.vim 文件拷贝到 vim plugin 目录中。

    mkdir -p ~/.vim/after/ftplugin/pydiction

    cp python_pydiction.vim ~/.vim/after/ftplugin/

    cp complete-dict pydiction.py ~/.vim/after/ftplugin/pydiction/

    vi ~/.vimrc

    filetype plugin on

    let g:pydiction_location = '/root/.vim/after/ftplugin/pydiction/complete-dict'

    执行完毕以后~既可在 vim 中使用 python tab 补全

  • 相关阅读:
    改变标题栏颜色和顶部栏颜色
    listview崩溃问题
    android欢迎界面
    ASZ参考代码
    shape的使用
    listview加边框
    toolbar左边有一小段空白
    as用百度地图不联网就gg
    OOM-OutOfMemory
    java reference定位
  • 原文地址:https://www.cnblogs.com/jicki/p/5548615.html
Copyright © 2011-2022 走看看