Ubuntu Forums ubuntu.com - launchpad.net - ubuntu help  

Go Back   Ubuntu Forums > The Ubuntu Forum Community > Forum Archive > Main Support Categories > General Help
Register Reset Password Forum Help Forum Council Search Today's Posts Mark Forums Read

Hello, Unregistered You are browsing a READ only archive of the main support categories pre 4/21/2008. You will not be able to post or reply any threads in this section.
Ubuntu 9.10 is out!!!

When downloading Ubuntu 9.10 please consider using bittorrent to get your copy of Ubuntu.

The Ubuntu Developers Summit for Lucid Lynx will be held the week of 16-Nov-2009 till 20-Nov-2009 in Dallas, TX USA. Visit the the Ubuntu wiki for more information about UDS and how to participate remotely.

General Help
All your general support questions for Ubuntu, Kubuntu, Edubuntu and Xubuntu.

 
Thread Tools Display Modes
Old July 28th, 2006   #1
jordilin
100% Pure Ubuntu
 
jordilin's Avatar
 
Join Date: Oct 2005
Location: @ /home
Beans: 884
Ubuntu Karmic Koala (testing)
enabling indentation in VIM when using python

When I open a python file with vim and start coding it does not indent code after the colon ":". I have installed vim-python. Anyone knows how to do it?
jordilin is offline   Reply With Quote
Old July 28th, 2006   #2
hw-tph
Dipped in Ubuntu
 
hw-tph's Avatar
 
Join Date: Jan 2005
Location: Sweden
Beans: 586
Re: enabling indentation in VIM when using python

vim-python is useful for actually scripting vim itself using Python, just so you know. To enable automatic indenting in vim/gvim, some features must be enabled in your personal configuration file. There are lots of different sorts of indenting in vim, but I prefer to use autoindent and smartindent. The filetype must be set too - this happens automatically if you launch (g)vim with a *.py file as argument or you can set it using :set filetype=python.

Here is my current ~/.vimrc for reference:
Code:
set nocompatible
syntax on
set background=light

set showmatch
set ignorecase
set showmode
set ts=4
set sw=4
set autoindent
set smartindent

" Mappings
nmap <C-N> :noh <CR>
The keymapping command at the bottom makes all highlighted search matches go away by a simple Ctrl+N keypress.

Since I want the same settings for gvim, I source my .vimrc in my ~/.gvimrc:
Code:
so ~/.vimrc   " Grab the console vim settings
colo buttercream
set guifont=Bitstream\ Vera\ Sans\ Mono\ 9

Håkan
hw-tph is offline   Reply With Quote
Old July 28th, 2006   #3
jordilin
100% Pure Ubuntu
 
jordilin's Avatar
 
Join Date: Oct 2005
Location: @ /home
Beans: 884
Ubuntu Karmic Koala (testing)
Re: enabling indentation in VIM when using python

Thanks hw-tph,
jordilin is offline   Reply With Quote

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 04:06 AM.


vBulletin ©2000 - 2009, Jelsoft Enterprises Ltd. Ubuntu Logo, Ubuntu and Canonical © Canonical Ltd. Tango Icons © Tango Desktop Project. lingonberry