gelguy / Cmd2.vim

cmdline-mode enhancement for Vim
MIT License
94 stars 4 forks source link

Integration with Airline #3

Closed alem0lars closed 9 years ago

alem0lars commented 9 years ago

I've installed both Cmd2 and airline plugins.

The problem here is that Cmd2 replaces airline as statusbar when autocompleting. I'd like instead that Cmd2 displays autocomplete results inside the airline.

Is that possible?

Thanks, Alessandro

gelguy commented 9 years ago

This is meant to be consistent with vim's wildmenu. When wildmenu is open, the statusline is replaced with the menu options.

It is not possible to integrate with airline at the moment. To do so, the render function of Cmd2 needs to be modified, but I have no plans to do this at the moment. Forks are welcome.

I do plan to include a feature where you can do more advanced customisation of the current menuline (currently you can only change the colours and separators). Using this, it should be possible to have a menuline that looks similar to the airline statusbar.

gelguy commented 9 years ago

The custom renderer feature has been added in 379ecc4b3910d686a9b3fd9f75e369cf2419e63b.

To use the Airline menu, include the following entry in the Cmd2_options dictionary:

        \  '_suggest_render': 'Cmd2#render#New().WithInsertCursor().WithAirlineMenu()',

The menu colours will now need to be changed. To use the default airline theme colours, use

        \ 'menu_hl': 'airline_x',
        \ 'menu_selected_hl': 'airline_y',
        \ 'menu_separator_hl': 'airline_x',

You can set your custom colours if these are not to your liking.

alem0lars commented 9 years ago

Thanks, it's almost working now.

However I'm having some color issues in the status line (it's white):

2015-07-08-081829_1440x900_scrot

This is the relevant config:

" {{{ Options.

let g:Cmd2_cmd_mappings = {
      \ 'iw': {'command': 'iw', 'type': 'text', 'flags': 'Cpv'},
      \ 'ap': {'command': 'ap', 'type': 'line', 'flags': 'pv'},
      \ '^': {'command': '^', 'type': 'normal!', 'flags': 'r'},
      \ 'w': {'command': 'Cmd2#functions#Cword',
          \ 'type': 'function', 'flags': 'Cr'},
      \ }

let g:Cmd2_options = {
      \   '_complete_ignorecase': 1,
      \   '_complete_uniq_ignorecase': 0,
      \   '_quicksearch_ignorecase': 1,
      \   '_complete_start_pattern': '\<\(\k\+\(_\|\#\)\)\?',
      \   '_complete_fuzzy': 1,
      \   '_suggest_render': 'Cmd2#render#New().WithInsertCursor().WithAirlineMenu()',
      \   'menu_hl': 'airline_x',
      \   'menu_selected_hl': 'airline_y',
      \   'menu_separator_hl': 'airline_x',
      \ }

" Character to type to start wildcard expansion in the command-line.
set wildcharm=<Tab>

" }}}

" {{{ Configure hotkeys.

" : or /: Enable Cmd2 automatically.
nmap : :<F11>
nmap / /<F11>

" <F11>: Enable Cmd2 manually.
cmap <F11> <Plug>(Cmd2Suggest)

" <Tab>: Perform completion using Cmd2.
cmap <expr> <Tab> Cmd2#ext#complete#InContext() ?
      \ '\<Plug>(Cmd2Complete)' :
      \ '\<Tab>'

" }}}
gelguy commented 9 years ago

This should be due to the colorscheme used. The airline_x and airline_y highlights are either not set, or are not matching with the airline highlight.

Can you try changing airline_x to airline_c and airline_y to airline_b?

Also, can I confirm which colorscheme you are using?

alem0lars commented 9 years ago

jellybeans both as vim colorscheme and airline theme.

gelguy commented 9 years ago

It is working fine on my setup.

Can you test with other colorschemes to see if this occurs throughout?

If the problem persists, a minimal .vimrc would be good to troubleshoot.

alem0lars commented 9 years ago

Ok thanks a lot for the awesome support :)

I'm closing this issue now since the feature has been implemented :smiley: