Wednesday, November 23, 2011

calling a function automatically and "mark not set"

I have the following function defined in my .vimrc for use when
writing prose (markdown text):

function! Softwrap()
set formatoptions=1
set linebreak
set wrap
set nolist
set breakat=\ |@-+;:,./?^I
nnoremap j gj
nnoremap k gk
vnoremap j gj
vnoremap k gk
set foldcolumn=0
endfunction

I want to call it automatically when I enter files with the .mtxt
extension, so I have this in my .vimrc:
autocmd BufRead *\.mtxt call Softwrap()

However, when I open such a file I get these errors:

Error detected while processing function Softwrap:
line 5:
E20: Mark not set
E20: Mark not set
E20: Mark not set
E20: Mark not set
E20: Mark not set
E20: Mark not set
E20: Mark not set

Maybe related, that filetype also has an autocmd in .vimrc to set the filetype:
autocmd BufNewFile,BufReadPost *.mkd,*.markdown,*.mdown,*.mtxt set filetype=mkd


Can anyone tell me what I am doing wrong?

c
--
Chris Lott

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

No comments:

Post a Comment