Friday, December 7, 2012

Re: calling a function on bufenter,bufnew,bufread

On 2012-12-07, Chris Lott wrote:
> On Fri, Dec 7, 2012 at 10:32 AM, Marcin Szamotulski wrote:
> > On 06:46 Fri 07 Dec , Chris Lott wrote:
> >> function! WW()
> >> :set showtabline=0
> >> :set noshowmode
> >> :set laststatus=0
> >> :set noruler
> >> :set noshowcmd
> >> :call VimWriteRoom()
> >> endfunction
> >>
> >> nnoremap WW :call WW()<CR>
>
> > Some time ago I used vimperator too, and I also had some additional
> > settings for it. As far as I recall vimperator has its own file type,
> > but I might be wrong. If it has you could use FileType autocommand
> > event.
>
> The filetype is set to text. Using the proposed solution of:
>
> au BufNewFile,BufEnter,BufRead vimperator.txt call WW()
>
> almost works: instead of nothing happening when I invoke the
> vimperator file, the screen flashes and then it's as if nothing
> happened. So the function is now being called. But, as usual, if I
> call WW() manually at that point, things work as they are supposed to.
> I guess it must be something in the VimWriteRoom() function, which
> comes from a plugin. I'll dig around in there and see if I can find
> anything.

After you've opened vimperator.txt, you can determine how those
options were set last with the :verbose command, like this:

:verbose set ruler?

That should tell you if your settings are being overridden by the
later execution of an autocommand or filetype plugin.

You can also record the execution of certain points in your code
by embedding commands like this:

echomsg "At point A"

and seeing which ones were executed and in which order with

:messages

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: