Ubuntu1404: 将VIM打造为一个实用的PythonIDE
参考: http://www.tuicool.com/articles/ZRv6Rv
说明: 内容非原创, 主要是做了整合和梳理。 在 ubuntu14.04 & debian 8 下测试通过
安装验证&使用:
# usage shortcut : # type za to open and close a fold # Vertical Split : Ctrl+w + v # Horizontal Split: Ctrl+w + s # Close current windows: Ctrl+w + q # Ctrl+h move to left window # Ctrl+l move to right window # Ctrl+j move to down window # Ctrl+k move to up window # def<tab> auto stub out a method definition # type \td show TODO or FIXME in code # type \g show the diff you have done in code # type TAB show code completion tip # type \t show files in list mode # type \n show files of project in tree mode # type \8 check pep8 style
步骤:
sudo apt-get install python-setuptools sudo easy_install pip sudo apt-get install pep8 sudo apt-get install vim-nox sudo apt-get install build-essential openssl libreadline6 libreadline6-dev \ curl git-core zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-dev \ sqlite3 libxml2-dev libxslt-dev autoconf libc6-dev ncurses-dev automake \ libtool bison subversion nodejs curl -L https://get.rvm.io | bash -s stable --ruby sudo apt-get install ruby-dev ruby echo '[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"' >> ~/.bashrc ruby -v vim --version | grep ruby mkdir ~/.vim/ mkdir ~/.vim/{autoload,bundle} cd ~/.vim/ git init curl -LSso ~/.vim/autoload/pathogen.vim https://tpo.pe/pathogen.vim git submodule add http://github.com/tpope/vim-fugitive.git bundle/fugitive git submodule add https://github.com/msanders/snipmate.vim.git bundle/snipmate git submodule add https://github.com/tpope/vim-surround.git bundle/surround git submodule add https://github.com/tpope/vim-git.git bundle/git git submodule add https://github.com/ervandew/supertab.git bundle/supertab git submodule add https://github.com/wincent/Command-T.git bundle/command-t git submodule add https://github.com/mitechie/pyflakes-pathogen.git bundle/pyflakes git submodule add https://github.com/mileszs/ack.vim.git bundle/ack git submodule add https://github.com/sjl/gundo.vim.git bundle/gundo git submodule add https://github.com/fs111/pydoc.vim.git bundle/pydoc git submodule add https://github.com/vim-scripts/pep8.git bundle/pep8 git submodule add https://github.com/alfredodeza/pytest.vim.git bundle/py.test git submodule add https://github.com/reinh/vim-makegreen bundle/makegreen git submodule add https://github.com/vim-scripts/TaskList.vim.git bundle/tasklist git submodule add https://github.com/vim-scripts/The-NERD-tree.git bundle/nerdtree git submodule init git submodule update git submodule foreach git submodule init git submodule foreach git submodule update cd ~/.vim/bundle/command-t/ sudo apt-get install rake rake make mkdir ~/.vim/snippets vim ~/.vim/snippets/python.snippets snippet pdb import pdb; pdb.set_trace()
Vim 配置: vim ~/.vimrc
filetype off execute pathogen#infect() set foldmethod=indent set foldlevel=99 syntax on filetype on filetype plugin indent on let g:pyflakes_use_quickfix = 0 let g:pep8_map='<leader>8' au FileType python set omnifunc=pythoncomplete#Complete let g:SuperTabDefaultCompletionType = "context" set completeopt=menuone,longest,preview map <leader>n :NERDTreeToggle<CR> map <leader>j :RopeGotoDefinition<CR> map <leader>r :RopeRename<CR> nmap <leader>a <Esc>:Ack! map <c-j> <c-w>j map <c-k> <c-w>k map <c-l> <c-w>l map <c-h> <c-w>h map <leader>td <Plug>TaskList map <leader>g :GundoToggle<CR> set statusline+=%{exists('g:loaded_fugitive')?fugitive#statusline():''} " Execute the tests nmap <silent><Leader>tf <Esc>:Pytest file<CR> nmap <silent><Leader>tc <Esc>:Pytest class<CR> nmap <silent><Leader>tm <Esc>:Pytest method<CR> " cycle through test errors nmap <silent><Leader>tn <Esc>:Pytest next<CR> nmap <silent><Leader>tp <Esc>:Pytest previous<CR> nmap <silent><Leader>te <Esc>:Pytest error<CR>
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
· 浏览器原生「磁吸」效果!Anchor Positioning 锚点定位神器解析
· 没有源码,如何修改代码逻辑?
· 全程不用写代码,我用AI程序员写了一个飞机大战
· DeepSeek 开源周回顾「GitHub 热点速览」
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· 记一次.NET内存居高不下排查解决与启示
· 白话解读 Dapr 1.15:你的「微服务管家」又秀新绝活了