ubuntu 下配置vim for python

时间:2023-03-08 19:26:57
  1. apt-get install vim-gnome
  2. apt-get install ctags
  3. apt-get install vim-scripts
  4. vim-addons install taglist
  5. 安装pydictionhttp://www.vim.org/scripts/script.php?script_id=850
  6. unzip pydiction-1.2.3.zip
pydiction
├── after
│   └── ftplugin
│   └── python_pydiction.vim
├── complete-dict
├── pydiction.py
├── README
└── README.md
  1. cp after/ftplugin/python_pydiction.vim ~/.vim/after/ftplugin(如果/after/ftplugin不存在,则创建)
  2. cp complete-dict ~/.vim/tools/pydiction/complete-dict
  3. cp pydiction.py ~/.vim
.vim
├── after
│   └── ftplugin
│   └── python_pydiction.vim
├── doc
│   ├── taglist.txt -> /usr/share/vim-scripts/doc/taglist.txt
│   └── tags
├── plugin
│   └── taglist.vim -> /usr/share/vim-scripts/plugin/taglist.vim
├── pydiction.py
└── tools
└── pydiction
└── complete-dict

编辑~/.vimrc文件

  1 let Tlist_Auto_Highlight_Tag=1
2 let Tlist_Auto_Open=1
3 let Tlist_Auto_Update=1
4 let Tlist_Display_Tag_Scope=1
5 let Tlist_Exit_OnlyWindow=1
6 let Tlist_Enable_Dold_Column=1
7 let Tlist_File_Fold_Auto_Close=1
8 let Tlist_Show_One_File=1
9 let Tlist_Use_Right_Window=1
10 let Tlist_Use_SingleClick=1
11 nnoremap <silent> <F8> :TlistToggle<CR>
12 filetype plugin on
13 autocmd FileType python set omnifunc=pythoncomplete#Complete
14 autocmd FileType javascrīpt set omnifunc=javascriptcomplete#CompleteJS
15 autocmd FileType html set omnifunc=htmlcomplete#CompleteTags
16 autocmd FileType css set omnifunc=csscomplete#CompleteCSS
17 autocmd FileType xml set omnifunc=xmlcomplete#CompleteTags
18 autocmd FileType php set omnifunc=phpcomplete#CompletePHP
19 autocmd FileType c set omnifunc=ccomplete#Complete
20 let g:pydiction_location='~/.vim/tools/pydiction/complete-dict'
21 set autoindent
22 set tabstop=4
23 set shiftwidth=4