Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
vim: indenting based on filetype
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Portage & Programming
View previous topic :: View next topic  
Author Message
juniper
l33t
l33t


Joined: 22 Oct 2004
Posts: 943
Location: we the north

PostPosted: Thu Jul 28, 2011 9:12 am    Post subject: vim: indenting based on filetype Reply with quote

I want vim to do the following on launch

:set wrap
:set linebreak
:set nolist
:set textwidth=0

but I only want this when I load up python code. I would ordinarily just put that in my .vimrc file, but how do I tell it only for python files?
Back to top
View user's profile Send private message
netfab
Veteran
Veteran


Joined: 03 Mar 2005
Posts: 1902
Location: 127.0.0.1

PostPosted: Thu Jul 28, 2011 10:55 am    Post subject: Reply with quote

http://vim.wikia.com/wiki/Indenting_source_code#Different_settings_for_different_file_types
Back to top
View user's profile Send private message
Naib
Watchman
Watchman


Joined: 21 May 2004
Posts: 6051
Location: Removed by Neddy

PostPosted: Thu Jul 28, 2011 11:13 am    Post subject: Reply with quote

Code:


" PYTHON VIM stuff
augroup PyShebang
  autocmd BufNewFile *.py
  \0put = '#!/usr/bin/env python' |
  \1put = '#-*- coding: utf-8 -*-' |
  \ $put = '' |
  \ $put = '' |
  \ $put = '# vim: set et sts=4 sw=4 ts=4 tw=120:' |

augroup END

autocmd BufRead *.py set smartindent cinwords=if,elif,else,for,while,try,except,finally,def,class
autocmd BufReadPost *.py source H:\vimfiles\plugin\python_fold.vimx


I have that in my vimrc file
_________________
Quote:
Removed by Chiitoo
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Portage & Programming All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum