Merge pull request #1539 from icymind/master

add option 'keymap_ignored_filetypes' for tabline extensions
This commit is contained in:
Christian Brabandt 2017-08-24 18:15:18 +02:00 committed by GitHub
commit ab6acdee41
2 changed files with 7 additions and 3 deletions

View File

@ -6,6 +6,7 @@ scriptencoding utf-8
let s:buffer_idx_mode = get(g:, 'airline#extensions#tabline#buffer_idx_mode', 0) let s:buffer_idx_mode = get(g:, 'airline#extensions#tabline#buffer_idx_mode', 0)
let s:show_tab_type = get(g:, 'airline#extensions#tabline#show_tab_type', 1) let s:show_tab_type = get(g:, 'airline#extensions#tabline#show_tab_type', 1)
let s:buffers_label = get(g:, 'airline#extensions#tabline#buffers_label', 'buffers') let s:buffers_label = get(g:, 'airline#extensions#tabline#buffers_label', 'buffers')
let s:keymap_ignored_filetypes = get(g:, 'airline#extensions#tabline#keymap_ignored_filetypes', ['vimfiler', 'nerdtree'])
let s:spc = g:airline_symbols.space let s:spc = g:airline_symbols.space
let s:current_bufnr = -1 let s:current_bufnr = -1
@ -160,8 +161,8 @@ function! s:get_visible_buffers()
endfunction endfunction
function! s:select_tab(buf_index) function! s:select_tab(buf_index)
" no-op when called in the NERDTree buffer " no-op when called in 'keymap_ignored_filetypes'
if exists('t:NERDTreeBufName') && bufname('%') == t:NERDTreeBufName if count(s:keymap_ignored_filetypes, &ft)
return return
endif endif

View File

@ -700,13 +700,16 @@ with the middle mouse button to delete that buffer.
nmap <leader>- <Plug>AirlineSelectPrevTab nmap <leader>- <Plug>AirlineSelectPrevTab
nmap <leader>+ <Plug>AirlineSelectNextTab nmap <leader>+ <Plug>AirlineSelectNextTab
Note: Mappings will be ignored within a NERDTree buffer. Note: Mappings will be ignored within "g:airline#extensions#tabline#keymap_ignored_filetypes".
Note: In buffer_idx_mode these mappings won't change the Note: In buffer_idx_mode these mappings won't change the
current tab, but switch to the buffer visible in that tab. current tab, but switch to the buffer visible in that tab.
Use |gt| for switching tabs. Use |gt| for switching tabs.
In tabmode, those mappings will switch to the specified tab. In tabmode, those mappings will switch to the specified tab.
* define the set of filetypes which are ignored selectTab keymappings
let g:airline#extensions#tabline#keymap_ignored_filetypes = ['vimfiler', 'nerdtree']
* change the display format of the buffer index > * change the display format of the buffer index >
let g:airline#extensions#tabline#buffer_idx_format = { let g:airline#extensions#tabline#buffer_idx_format = {
\ '0': '0 ', \ '0': '0 ',