Re: empty bufname('%') for quick fix, location list and preview window.

2013-05-18 Thread Zhao Cai
Noted. Sorry about that! Thanks.
On May 14, 2013, at 6:13 AM, Shlomi Fish shlo...@shlomifish.org wrote:

 Hi Zhao,
 
 first of all:
 
 Please don't start a new topic by replying to an existing message, because
 this will put it under an existing thread in threaded, tree-like mailers.
 Instead, write a new message to boston...@mail.pm.org .
 
 The problem is that are the In-Reply-To headers:
 
 https://duckduckgo.com/?q=%22in-reply-to%22%20header
 
 On Sun, 12 May 2013 16:49:23 -0400
 Zhao Cai zhao...@gmx.com wrote:
 
 Hello, :)
 
 `bufname('%')` for quickfix, location list and preview window are empty in my
 environment( MacVim ). Is it a bug? or by design? Do you have the same issue?
 or just me?
 
 :echo bufname('%')
 
 Seems to return the right thing for a regular file here on /usr/bin/gvim on
 Mageia Linux 3. Are you trying it on special buffers?
 
 Regards,
 
   Shlomi Fish
 
 
 -- 
 -
 Shlomi Fish   http://www.shlomifish.org/
 Beginners Site for the Vim text editor - http://vim.begin-site.org/
 
 He says “One and one and one is three”.
 Got to be good‐looking ’cause he’s so hard to see.
— The Beatles, “Come Together”
 
 Please reply to list if it's a mailing list post - http://shlom.in/reply .
 
 -- 
 -- 
 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
 
 --- 
 You received this message because you are subscribed to the Google Groups 
 vim_use group.
 To unsubscribe from this group and stop receiving emails from it, send an 
 email to vim_use+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/groups/opt_out.
 
 

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

--- 
You received this message because you are subscribed to the Google Groups 
vim_use group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_use+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: empty bufname('%') for quick fix, location list and preview window.

2013-05-15 Thread Ben Fritz
On Tuesday, May 14, 2013 2:45:16 PM UTC-5, Christian Brabandt wrote:
 
 Anyway, I am not aware of any option you can check to differentiate 
 
 between quickfix and location lists. You could try to check the 
 
 w:quickfix_title variable, it could give a clue.
 

I did this differently. In an ftplugin file for qf type, I actually store off 
the current window number, call :copen, and check to see whether the current 
window number is still the same. Note you need to have a guard variable to 
prevent recursion.

if buftype=='quickfix'
  if !exists('s:processing')
let listbufnr = bufnr(%)
let numwindows = winnr('$')
let curwin = winnr()
let s:processing = 1
copen
call setbufvar(listbufnr, 'errorlist_type', (curwin == winnr() ? quickfix' 
: 'location'))
 close the quickfix list if it was closed when we began
if numwindows != winnr('$')
  cclose
endif
 return to quickfix/location list
exe curwin 'wincmd w'
unlet s:processing
  endif
endif

Now b:errorlist_type holds the type of quickfix list.

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

--- 
You received this message because you are subscribed to the Google Groups 
vim_use group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_use+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: empty bufname('%') for quick fix, location list and preview window.

2013-05-15 Thread Zhao Cai
Thanks. That is one of a way to do it. 

another way I notice it to parse the `ls` result. I have something like this in 
my environment (MacVim).

  16  a-  [Location List]  line 0
  17 %a-  [Quickfix List]  line 1   

Do you get the same results? 

Thanks.

On May 15, 2013, at 11:18 AM, Ben Fritz fritzophre...@gmail.com wrote:

 On Tuesday, May 14, 2013 2:45:16 PM UTC-5, Christian Brabandt wrote:
 
 Anyway, I am not aware of any option you can check to differentiate 
 
 between quickfix and location lists. You could try to check the 
 
 w:quickfix_title variable, it could give a clue.
 
 
 I did this differently. In an ftplugin file for qf type, I actually store 
 off the current window number, call :copen, and check to see whether the 
 current window number is still the same. Note you need to have a guard 
 variable to prevent recursion.
 
 if buftype=='quickfix'
  if !exists('s:processing')
let listbufnr = bufnr(%)
let numwindows = winnr('$')
let curwin = winnr()
let s:processing = 1
copen
call setbufvar(listbufnr, 'errorlist_type', (curwin == winnr() ? quickfix' 
 : 'location'))
 close the quickfix list if it was closed when we began
if numwindows != winnr('$')
  cclose
endif
 return to quickfix/location list
exe curwin 'wincmd w'
unlet s:processing
  endif
 endif
 
 Now b:errorlist_type holds the type of quickfix list.
 
 -- 
 -- 
 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
 
 --- 
 You received this message because you are subscribed to the Google Groups 
 vim_use group.
 To unsubscribe from this group and stop receiving emails from it, send an 
 email to vim_use+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/groups/opt_out.
 
 

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

--- 
You received this message because you are subscribed to the Google Groups 
vim_use group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_use+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: empty bufname('%') for quick fix, location list and preview window.

2013-05-15 Thread Christian Brabandt
Hi Zhao!

On Mi, 15 Mai 2013, Zhao Cai wrote:

 Thanks. That is one of a way to do it. 
 
 another way I notice it to parse the `ls` result. I have something like this 
 in my environment (MacVim).
 
   16  a-  [Location List]  line 0
   17 %a-  [Quickfix List]  line 1   
 
 Do you get the same results? 

Not necessarily, since those strings can be localized.

regards,
Christian
-- 
Erst wenn es um unbedeutenden Kleinkram geht, werden
Auseinandersetzungen wirklich bitter.
-- Henry A. Kissinger

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

--- 
You received this message because you are subscribed to the Google Groups 
vim_use group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_use+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: empty bufname('%') for quick fix, location list and preview window.

2013-05-14 Thread Shlomi Fish
Hi Zhao,

first of all:

Please don't start a new topic by replying to an existing message, because
this will put it under an existing thread in threaded, tree-like mailers.
Instead, write a new message to boston...@mail.pm.org .

The problem is that are the In-Reply-To headers:

https://duckduckgo.com/?q=%22in-reply-to%22%20header

On Sun, 12 May 2013 16:49:23 -0400
Zhao Cai zhao...@gmx.com wrote:

 Hello, :)
 
 `bufname('%')` for quickfix, location list and preview window are empty in my
 environment( MacVim ). Is it a bug? or by design? Do you have the same issue?
 or just me?

:echo bufname('%')

Seems to return the right thing for a regular file here on /usr/bin/gvim on
Mageia Linux 3. Are you trying it on special buffers?

Regards,

Shlomi Fish


-- 
-
Shlomi Fish   http://www.shlomifish.org/
Beginners Site for the Vim text editor - http://vim.begin-site.org/

He says “One and one and one is three”.
Got to be good‐looking ’cause he’s so hard to see.
— The Beatles, “Come Together”

Please reply to list if it's a mailing list post - http://shlom.in/reply .

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

--- 
You received this message because you are subscribed to the Google Groups 
vim_use group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_use+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: empty bufname('%') for quick fix, location list and preview window.

2013-05-14 Thread Zhao Cai
Hi, Christian

I should state the purpose in the original post. What I was trying to do is to 
tell the difference between location list and quick fix and make a local 
powerline theme for each of them. But I can not find the way to differentiate 
quick fix window from location list.

Thanks. 

Cheers,
Zhao 

On May 14, 2013, at 7:16 AM, Christian Brabandt cbli...@256bit.org wrote:

 Hi Zhao!
 
 On So, 12 Mai 2013, Zhao Cai wrote:
 
 Hello, :)
 
 `bufname('%')` for quickfix, location list and preview window are empty in 
 my environment( MacVim ). Is it a bug? or by design? Do you have the same 
 issue? or just me?
 
 Of course. The quickfix, location list and preview windows don't have 
 names, unless you give them one (:h :file_f). But you usually don't need 
 that.
 
 The main question is, why do you think you need the buffer name of a 
 special window? So what problem are you really trying to solve?
 
 regards,
 Christian
 -- 
 Jede Generation lacht über Moden, aber folgt den neuen treu.
   -- Henry David Thoreau
 
 -- 
 -- 
 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
 
 --- 
 You received this message because you are subscribed to the Google Groups 
 vim_use group.
 To unsubscribe from this group and stop receiving emails from it, send an 
 email to vim_use+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/groups/opt_out.
 
 

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

--- 
You received this message because you are subscribed to the Google Groups 
vim_use group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_use+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: empty bufname('%') for quick fix, location list and preview window.

2013-05-14 Thread Christian Brabandt
Hi Zhao!

On Di, 14 Mai 2013, Zhao Cai wrote:

 I should state the purpose in the original post. What I was trying to
 do is to tell the difference between location list and quick fix and
 make a local powerline theme for each of them. But I can not find the
 way to differentiate quick fix window from location list.

Ah, I see the problem. The statusline for Quickfix Buffers contains '%t' 
which according to the help should output the buffer name, but the 
buffer name for quickfix and location lists is empty. That is, Vim 
treats those buffers special and in case of location and quickfix lists 
returns location list/quickfix list instead of the buffer name.

Anyway, I am not aware of any option you can check to differentiate 
between quickfix and location lists. You could try to check the 
w:quickfix_title variable, it could give a clue.

regards,
Christian
-- 
Die Keuschheit wohnt weder in den obern noch untern Ständen - sondern
in den mittlern.
-- Jean Paul

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

--- 
You received this message because you are subscribed to the Google Groups 
vim_use group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_use+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: empty bufname('%') for quick fix, location list and preview window.

2013-05-12 Thread Zhao Cai
Hello, :)

`bufname('%')` for quickfix, location list and preview window are empty in my 
environment( MacVim ). Is it a bug? or by design? Do you have the same issue? 
or just me?


Thanks if you can give me a hint.

Zhao


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

--- 
You received this message because you are subscribed to the Google Groups 
vim_use group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_use+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.