autocmd error in vim

101 views
Skip to first unread message

Rudra Banerjee

unread,
Sep 24, 2012, 9:49:17 AM9/24/12
to v...@vim.org
my .vimrc has the structure:
" Fortran stuff
:let fortran_do_enddo=1
:let fortran_more_precise=1
:let fortran_free_source=1
:let fortran_have_tabs=1
autocmd BufNewFile *.f90 call New_Fortran_File()
fun! New_Fortran_File()
:0put='!This is file : ' . expand('%')
:put='Implicit None'
exe ":3"
endf

which is working fine with gvim, but if I use vim, its giving error.
The error prompt is coming in non f90 file also. as:
$ vi i
Error detected while processing /home/rudra/.vimrc:
line 31:
E488: Trailing characters: :0put='!This is file : ' . expand('%')
line 32:
E488: Trailing characters: :put='Implicit None'
Press ENTER or type command to continue

My vim is up-to-date
$ vi --version
VIM - Vi IMproved 7.3 (2010 Aug 15, compiled Aug 28 2012 13:51:59)
Included patches: 1-415, 417-638

Does it mean vi(m) do not support autocmd? Or I am doing something
wrong?
Please help.
If needed, I am posting my full vimrc:

set autoindent
set smartindent
"set hlsearch
set incsearch
set ignorecase
set smartcase
set novisualbell
set paste
set ruler
set expandtab
set smarttab
set shiftwidth=3
set softtabstop=3
"set mouse=a "enable mouse
set nu "show line number
"set cul "highlight current line

if version >= 700
set spell spl=en_us
set nospell
nmap <F12> :set spell!
endif

" Fortran stuff
:let fortran_do_enddo=1
:let fortran_more_precise=1
:let fortran_free_source=1
:let fortran_have_tabs=1
autocmd BufNewFile *.f90 call New_Fortran_File()
fun! New_Fortran_File()
:0put='!This is file : ' . expand('%')
:put='Implicit None'
exe ":3"
endf
filetype on
filetype plugin on
filetype indent on

syntax enable


"latex only
let g:tex_flavor='latex'

" Always jump to last edited line
if has("autocmd")
au BufReadPost * if line("'\"") > 0 && line("'\"") <= line("$")
\| exe "normal! g'\"" | endif
endif

"let g:Imap_UsePlaceHolders = 0
set sw=2
set iskeyword+=:


rudra

unread,
Sep 24, 2012, 10:14:38 AM9/24/12
to vim...@googlegroups.com, v...@vim.org
Hello friends,
You may ignore this post.
This problem is solved once I installed vi-enhanced. I only had vi-minimal before. But both were showing vim as version.

Tony Mechelynck

unread,
Sep 24, 2012, 10:01:40 PM9/24/12
to vim...@googlegroups.com, rudra
On one of the :version lines you snipped, vim-minimal probably said
"Tiny version without GUI" where vim-enhanced says "Huge version without
GUI" (or maybe Big rather than Huge) and gvim (which you can also
install together with the other two, and even run in console mode) "Huge
version with GTK2 GUI" or similar.

"Tiny" and "Small" builds of Vim have no expression evaluation, and that
makes a huge difference. To them, anything from if to endif is a
nestable comment, and outside of such a "comment", a :let command gives
an error.


Best regards,
Tony.
--
No letters of the alphabet were harmed in the creation of this message.

Reply all
Reply to author
Forward
0 new messages