Vim and Python
Upcoming SlideShare
Loading in...5
×
 

Vim and Python

on

  • 3,476 views

(Level: Beginner)...

(Level: Beginner)

Abstract: Vim makes for a great editing experience for Python projects. In this session Derek will show you:

- Vim basics and modes
- Vim plugins that are useful for - Python development
- How to organise your plugins
- How to script Vim with Python.

Statistics

Views

Total Views
3,476
Slideshare-icon Views on SlideShare
3,401
Embed Views
75

Actions

Likes
0
Downloads
11
Comments
2

4 Embeds 75

http://python.ie 46
http://localhost:8000 17
http://www.python.ie 10
http://localhost 2

Accessibility

Categories

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel

12 of 2

  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    Vim and Python Vim and Python Presentation Transcript

    • Vim and PythonDerek McLoughlinJolt Online Gaming 8th June 2011
    • Overview● Intro● Why use Vim?● Basic Vim concepts● Vim is a Game● General Plugins● Python Plugins● How to Organise your plugins● Resources
    • Why Vim?● Its fast.● Its portable. Linux, Windows, Mac, DOS, VMS● Its everywhere – even on production systems● Its very configurable● Its very extensible
    • Basic Concepts #1 - Modes● Vim is modal● It has 5 modes ● Normal ● Insert ● Ex ● Visual ● Select● Youll find yourself pressing <ESC> a lot :-)
    • Basic Concepts #2 - Commands● Commands follow a pattern: Number + Command + Destination● E.g. ● 5dw – delete 5 words ● 6w – move forward 6 words ● 7x – delete 7 characters
    • Vim is a Game (that you play on text)● When you play a PC game (e.g. Minecraft) you forget that you need to press specific keys to do something – WASD. After a while, those actions are programmed into your finger muscles.● You “do”. You dont “think”.● You can practice Vim movements this with Vim Tetris● Movement keys are always on the right hand.
    • Vim Leverages Unix● Example: ● :%!sort ● :<,>!sort ● :%!awk {print $3} ● :%!sed s/foo/bar/
    • General PluginsNerdTree NerdCommenterNerdTree NerdCommenterBufferlist MatchitCommand-T SnipMateAck FugativeTagging & Tagbar ExtraditeDBExt GitvRails.vim
    • Python Plugins● Python Match● RopeVim● PyFlakes● Pydoc● Pep-8
    • Organising Plugins● Old School – all plugins in same folder – a mess! ● .vim -> doc -> ftplugin -> plugin● Use Pathogen● Use Vundle
    • Scripting Vim● Vim has an in-built scripting language ● VimScript or VimL● Its ugly.● Use Python instead!
    • Example*function! GetHTML()python << EOFimport vim, BeautifulSoup, urllibhandle = urllib.urlopen(vim.current.line)soup =BeautifulSoup.BeautifulSoup(handle.read())vim.current.buffer[:] =soup.prettify().split(n)EOFendfunction* I took this from:http://www.builderau.com.au/program/python/soa/Extending-Vim-with-Python/0,2000064084,339283181,00.htm
    • Vim is Charityware● Donations to Vim go to a charity that helps orphans in Uganda.● If you do like Vim and you feel it is making you more productive, then please donate to this charity.● The details are on the Vim website.
    • Vim Resources● Vim - www.vim.org● VimCasts - www.vimcasts.org● Vim Quick Reference Card - ● http://tnerual.eriogerg.free.fr/vim.html ● Jolt Online Gaming version!!!● Books ● Hacking Vim - Packt Publishing ● Byte of Vim - http://www.swaroopch.com/notes/Vim ● Older online book - ftp://ftp.vim.org/pub/vim/doc/book/vimbook-OPL.pdf
    • Why Not Vim?● Terse● Modal● Steep-ish learning curve...
    • Learning curves of editors
    • What to do if Vim isnt for you● Notwithstanding the last slide...● Try Emacs● Seriously, its a good editor.● Org-mode is a great way to get into Emacs gently● Use the Emacs Starter Kit