Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Kind support filtering and format #30

Closed
petobens opened this issue Sep 3, 2015 · 9 comments
Closed

Kind support filtering and format #30

petobens opened this issue Sep 3, 2015 · 9 comments

Comments

@petobens
Copy link

petobens commented Sep 3, 2015

Hi @Shougo, thank you very much for adding kind support (following our discussion here).

I have a few questions:

i) In the mentioned issue you said:

If you want to filter by kind, you must use "converter_abbr_word".

Generally I want to filter by candidate but maybe I want to filter by kind. So: is it possible to switch the converter within the unite buffer? i.e pressing something like <C-s> and switch from the default converter to abbr_word?

ii) Consider the following foo.py file:

def foo(x):
    return x

y = 3

When I run :Unite tag/include I get the following unite buffer:

screenshot-03-09-2015_11-33-43

Instead of showing k:f and k:v is possible to directly display function and variable (i think that a) it is better to show the full kind instead of the abbreviation and b) there is no need to show k: since it is clear that this third column of the unite buffer displays the tag kind).

iii) When I run :Unite tag/include in my vimrc file I get:

screenshot-03-09-2015_11-38-06

Can the syntax highlighting and the spacing between columns be improved?

@Shougo
Copy link
Collaborator

Shougo commented Sep 6, 2015

Generally I want to filter by candidate but maybe I want to filter by kind. So: is it possible to switch the converter within the unite buffer? i.e pressing something like and switch from the default converter to abbr_word?

:help unite#mappings#set_current_matchers()

@Shougo
Copy link
Collaborator

Shougo commented Sep 6, 2015

Instead of showing k:f and k:v is possible to directly display function and variable (i think that a) it is better to show the full kind instead of the abbreviation and b) there is no need to show k: since it is clear that this third column of the unite buffer displays the tag kind).

I don't think so. Tag information has just the abbr.
You should read the real tag file.
And I think it is better to filter by kind.

@Shougo Shougo closed this as completed in 0ff5d2b Sep 6, 2015
@Shougo
Copy link
Collaborator

Shougo commented Sep 6, 2015

Can the syntax highlighting and the spacing between columns be improved?

Fixed.

@petobens
Copy link
Author

petobens commented Sep 6, 2015

Thanks @Shougo for your replies. Two nits:

i) If I set

    inoremap <silent><buffer><expr> <C-c> unite#mappings#set_current_converters(
            \ empty(unite#mappings#get_current_converters()) ?
            \ ['converter_abbr_word'] : [])

and press <C-c> in the unite-tag buffer I can filter by kind. However when I press <C-c> again I cannot use the default converter. Isn't the mapping suppose to toggle between the default converter and converter_abbr_word?

ii) With the following minimal vimrc:

set nocompatible

let $ONEDRIVE_HOME = expand('C:/OD/Users/Pedro')
let $DOTVIM = expand('$ONEDRIVE_HOME/vimfiles')

set runtimepath+=$DOTVIM/bundle/unite
set runtimepath+=$DOTVIM/bundle/neoinclude
set runtimepath+=$DOTVIM/bundle/unite-tag
set runtimepath+=$DOTVIM/bundle/vimproc
filetype plugin indent on

nnoremap <silent> ,te :NeoIncludeMakeCache<CR>:Unite
            \ tag/include<CR>

If I open the vimrc_min file I press ,te I see the word pat: in the unite-tag buffer. Is it possible to suppress this? (and only show the actual matched pattern).

screenshot-06-09-2015_01-36-54

@Shougo
Copy link
Collaborator

Shougo commented Sep 6, 2015

If I open the vimrc_min file I press ,te I see the word pat: in the unite-tag buffer. Is it possible to suppress this? (and only show the actual matched pattern).

You should execute syntax enable.
It is concealed by syntax.

And, you should change g:unite_source_tag_max_fname_length or g:unite_source_tag_max_name_length.
If you can disable show location feature by g:unite_source_tag_show_location.

Important: Please read the documentation.

@Shougo
Copy link
Collaborator

Shougo commented Sep 6, 2015

and press <C-c> in the unite-tag buffer I can filter by kind. However when I press <C-c> again I cannot use the default converter. Isn't the mapping suppose to toggle between the default converter and converter_abbr_word?

Because, you are wrong. You must change default matcher behavior.

inoremap <silent><buffer><expr> <C-c> unite#mappings#set_current_matchers(
            \ empty(unite#mappings#get_current_matchers()) ?
            \ ['converter_abbr_word', 'matcher_default'] : [])

@petobens
Copy link
Author

petobens commented Sep 6, 2015

I'm sorry @Shougo but I'm afraid I don't quite understand. Consider the following minimal vimrc:

set nocompatible

let $ONEDRIVE_HOME = expand('C:/OD/Users/Pedro')
let $DOTVIM = expand('$ONEDRIVE_HOME/vimfiles')

set runtimepath+=$DOTVIM/bundle/unite
set runtimepath+=$DOTVIM/bundle/neoinclude
set runtimepath+=$DOTVIM/bundle/unite-tag
set runtimepath+=$DOTVIM/bundle/vimproc

filetype plugin indent on
syntax enable

nnoremap <silent> ,te :NeoIncludeMakeCache<CR>:Unite
            \ tag/include<CR>
au FileType unite
    \ inoremap <silent><buffer><expr> <C-c> unite#mappings#set_current_matchers(
    \ empty(unite#mappings#get_current_matchers()) ?
    \ ['converter_abbr_word', 'matcher_default'] : [])

Now as in the GIF, open Gvim, edit the vimrc_min file and press ,te. You will see that

i) even though syntax is enable the ,te candidate show the word pat:.

ii) If I now switch to insert mode and start searching for var then there are no candidates (which is correct since I'm using the default matcher). Now if I press <C-c> the matcher switches and I can filter by kind (therefore when I search for var the Unite buffer correctly displays candidates). However if in the same Unite buffer I now erase the prompt and press <C-c> one last tim then the matcher is not toggled: I'm still filtering by kind (searching for var return candidates filterd by kind when and I expect no candidates to be shown since I should be using the default matcher). So the problem is that the second time I press <C-c> the default matcher is not restored.

Sorry for being such a nuisance and thanks in advance for the help.

blahh

Shougo added a commit that referenced this issue Sep 7, 2015
Shougo added a commit that referenced this issue Sep 7, 2015
@Shougo
Copy link
Collaborator

Shougo commented Sep 7, 2015

@petobens Confirmed. Fixed the problems. Please update unite-tag and unite.vim.

@petobens
Copy link
Author

petobens commented Sep 7, 2015

@Shougo it is working perfectly now. Thank you for the fix! :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants