Author Topic: Vim and Python  (Read 11542 times)

b4sil

  • Newbie
  • *
  • Posts: 6
    • View Profile
on: September 30, 2013, 03:27:17 PM
Hi Guys,

I am not sure you are using vim as your programming env or scripting env but would like to share my vim and python integration as a post configuration after backbox installed.

As you know long time ago, vim related plugins and their installation etc was bit painful. But now it is pretty clean.

I use vundle not pathogen

you can use below command to touch vundle clone

git clone https://github.com/gmarik/vundle.git ~/.vim/bundle/vundle

Then add fallowings to your ~/.vimrc file if you dont have just create.


Quote
set nocompatible
filetype off

set rtp+=~/.vim/bundle/vundle/
call vundle#rc()

" let Vundle manage Vundle
" required!
Bundle 'gmarik/vundle'

" The bundles you install will be listed here

filetype plugin indent on

" The rest of your config follows here

Now we have vundle for vim plugins. From now on all you have to do is add the plugin name to your ~/.vimrc and install it.

Assume i want to add a python-mode plugin to my vim. To do so, just adding
Quote
Bundle 'klen/python-mode
' into ~/.vimrc
then i run vim and :BundleInstall command.

The name of the plugin is the name of the relative path of git url i would say to make it simple.

From same example python-mode git repo is

https://github.com/klen/python-mode

My vimrc is given below, you can notice the plugin i am currently using. Of course you can try different plugins too. If you see any interesting work just let me know :)

Quote
set nocompatible
filetype off

set rtp+=~/.vim/bundle/vundle/
call vundle#rc()

" let Vundle manage Vundle
" required!
Bundle 'gmarik/vundle'

" The bundles you install will be listed here

filetype plugin indent on

" The rest of your config follows here

"Bundle List
Bundle 'Lokaltog/powerline', {'rtp':'powerline/bindings/vim/'}
" Powerline setup
set guifont=DejaVu\ Sans\ Mono\ for\ Powerline\ 9
set laststatus=2

Bundle 'tpope/vim-fugitive'

Bundle 'scrooloose/nerdtree'

Bundle 'klen/python-mode'

" Python-mode
" " Activate rope
" " Keys:
" " K             Show python docs
" " <Ctrl-Space>  Rope autocomplete
" " <Ctrl-c>g     Rope goto definition
" " <Ctrl-c>d     Rope show documentation
" " <Ctrl-c>f     Rope find occurrences
" " <Leader>b     Set, unset breakpoint (g:pymode_breakpoint enabled)
" " [[            Jump on previous class or function (normal, visual, operator
" modes)
" " ]]            Jump on next class or function (normal, visual, operator
" modes)
" " [M            Jump on previous class or method (normal, visual, operator
" modes)
" " ]M            Jump on next class or method (normal, visual, operator
" modes)
let g:pymode_rope = 0
"
" " Documentation
let g:pymode_doc = 1
let g:pymode_doc_key = 'K'
"
" "Linting
let g:pymode_lint = 1
let g:pymode_lint_checker = "pyflakes,pep8"
" " Auto check on save
let g:pymode_lint_write = 1
"
" " Support virtualenv
let g:pymode_virtualenv = 1
"
" " Enable breakpoints plugin
let g:pymode_breakpoint = 1
let g:pymode_breakpoint_key = '<leader>b'
"
" " syntax highlighting
let g:pymode_syntax = 1
let g:pymode_syntax_all = 1
let g:pymode_syntax_indent_errors = g:pymode_syntax_all
let g:pymode_syntax_space_errors = g:pymode_syntax_all
"
" " Don't autofold code
let g:pymode_folding = 0


set term=xterm-256color


Bundle 'davidhalter/jedi-vim'
Bundle 'myusuf3/numbers.vim'
Bundle 'spf13/vim-colors'
Bundle 'spf13/PIV'
Bundle 'vim-ruby/vim-ruby'
Bundle 'tpope/vim-rails'
Bundle 'altercation/vim-colors-solarized'

syntax enable
if has('gui_running')
       set background=light
    else
           set background=light
   endif
   set t_Co=256
   let g:solarized_termcolors=256
   colorscheme solarized
« Last Edit: September 30, 2013, 03:28:48 PM by b4sil »



ZEROF

  • Hero Member
  • *****
  • Posts: 1247
    • View Profile
    • Pen Tester
Reply #1 on: September 30, 2013, 08:59:36 PM
Thank you for sharing with us.


Don't ask, read : http://wiki.backbox.org
or just run sudo rm -rf /*


ostendali

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 588
    • View Profile
Reply #2 on: October 03, 2013, 05:37:00 PM
never used vim, I am still at vi, thought.....
any improvement in vim :P