Wednesday, November 23, 2011

Re: calling a function automatically and "mark not set"

On 2011-11-23, Chris Lott wrote:
> 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

The | has to be escaped with a backslash, too:

set breakat=\ \|@-+;:,./?^I

See

:help option-backslash

> 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

I don't know why you're getting this error number. When I try
executing that line from the command line I get

E492: Not an editor command: done

> 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?

Regards,
Gary

--
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