[Tutor] editing scripts with Vim
dman
dman@dman.ddts.net
Tue, 23 Apr 2002 14:25:40 -0500
On Sun, Apr 21, 2002 at 07:37:38AM -0500, kent@springfed.com wrote:
| Howdy,
|=20
| Vim looks like a good free cross platform
| editor for editing Python.
It is!
| I seem to recall that Vim provided for
| highlighting a line of code and sending it
| to the interpreter, I can't find the reference.
|=20
| I would appreciate any hints and tips on
| setting up Vim for efficient programming.
In my .vimrc I have (amongst other stuff) :
~~~~~~~~~~~~~~~~~~~~~~
highlight Normal guibg=3Dblack guifg=3Dgrey90
set background=3Ddark " makes syntax highlighing lighter
syntax on
set autoindent
set tabstop=3D8 " Tabs are always 8 characters!!!
set softtabstop=3D4 shiftwidth=3D4 " default character indentation level
set expandtab " use spaces instead of tabs for indentation
set ruler " show cursor postion
set esckeys " allow cursor keys in insert mode
set showcmd " Show (partial) command in status line.
"set hlsearch " Highlight all matches of the last search pattern (so=
metimes annoying, good for code)
set showmatch " show matching parens/brackets
set backspace=3D2 " allows for backspace beyond current insert session
set joinspaces " insert 2 spaces after a period when joining lines
set fileformat=3Dunix " The Right Way(tm)
" Don't be noisy, don't flash the screen
set noerrorbells visualbell
" note : this only works for the console! it is reset when gvim starts
set t_vb=3D
set guioptions-=3DT " no toolbar, I don't use it anyways!
" enable the new filetype and indent plugins
filetype on
filetype plugin on
filetype indent on
set lcs=3Dtab:>-
set list
" this takes effect when the syntax file is loaded
let python_highlight_all=3D1
augroup Python
au!
au BufNewFile *.py 0read ~/util/templates/Python.py
" see also :help smartindent , cinwords
au FileType python set sts=3D4 sw=3D4 et tw=3D80 fo=3Dcroq2 hls fenc=3D=
utf-8
au FileType python set comments=3Db:#=20
" turn off the C preprocessor indenting
" (allow comments to be indented properly)
au FileType python inoremap # X=08#
au FileType python set foldmethod=3Dindent
" do I want everything collapsed when I open the file?
"au FileType python set foldenable
au FileType python set nofoldenable
augroup END
~~~~~~~~~~~~~~~~~~~~~~
(note between the 'X' and the '#' in the "inoremap" command is a
literal ^H (backspace) character, you type it by pressing ^V^H)
Once you've got this configuration, all you need to do is learn how to
use vim :-).
HTH,
-D
--=20
A wise servant will rule over a disgraceful son,
and will share the inheritance as one of the brothers.
Proverbs 17:2