vim-airline / vim-airline

lean & mean status/tabline for vim that's light as air
MIT License
17.77k stars 1.1k forks source link

tabline enable let vnew work in a wrong way #1846

Closed roachsinai closed 5 years ago

roachsinai commented 5 years ago

environment

➜  ~ vim --version
VIM - Vi IMproved 8.1 (2018 May 18, compiled Dec  8 2018 11:23:48)
包含补丁: 1-570
编译者 Arch Linux
巨型版本 with GTK3 GUI.  可使用(+)与不可使用(-)的功能:
+acl               +extra_search      +mouse_netterm     +tag_old_static
+arabic            +farsi             +mouse_sgr         -tag_any_white
+autocmd           +file_in_path      -mouse_sysmouse    +tcl/dyn
+autochdir         +find_in_path      +mouse_urxvt       +termguicolors
-autoservername    +float             +mouse_xterm       +terminal
+balloon_eval      +folding           +multi_byte        +terminfo
+balloon_eval_term -footer            +multi_lang        +termresponse
+browse            +fork()            -mzscheme          +textobjects
++builtin_terms    +gettext           +netbeans_intg     +timers
+byte_offset       -hangul_input      +num64             +title
+channel           +iconv             +packages          +toolbar
+cindent           +insert_expand     +path_extra        +user_commands
+clientserver      +job               +perl/dyn          +vartabs
+clipboard         +jumplist          +persistent_undo   +vertsplit
+cmdline_compl     +keymap            +postscript        +virtualedit
+cmdline_hist      +lambda            +printer           +visual
+cmdline_info      +langmap           +profile           +visualextra
+comments          +libcall           +python/dyn        +viminfo
+conceal           +linebreak         +python3/dyn       +vreplace
+cryptv            +lispindent        +quickfix          +wildignore
+cscope            +listcmds          +reltime           +wildmenu
+cursorbind        +localmap          +rightleft         +windows
+cursorshape       +lua/dyn           +ruby/dyn          +writebackup
+dialog_con_gui    +menu              +scrollbind        +X11
+diff              +mksession         +signs             -xfontset
+digraphs          +modify_fname      +smartindent       +xim
+dnd               +mouse             +startuptime       -xpm
-ebcdic            +mouseshape        +statusline        +xsmp_interact
+emacs_tags        +mouse_dec         -sun_workshop      +xterm_clipboard
+eval              +mouse_gpm         +syntax            -xterm_save
+ex_extra          -mouse_jsbterm     +tag_binary        
     系统 vimrc 文件: "/etc/vimrc"
     用户 vimrc 文件: "$HOME/.vimrc"
 第二用户 vimrc 文件: "~/.vim/vimrc"
      用户 exrc 文件: "$HOME/.exrc"
    系统 gvimrc 文件: "/etc/gvimrc"
    用户 gvimrc 文件: "$HOME/.gvimrc"
第二用户 gvimrc 文件: "~/.vim/gvimrc"
       defaults file: "$VIMRUNTIME/defaults.vim"
        系统菜单文件: "$VIMRUNTIME/menu.vim"
         $VIM 预设值: "/usr/share/vim"
编译方式: gcc -c -I. -Iproto -DHAVE_CONFIG_H -DFEAT_GUI_GTK  -I/usr/include/gtk-3.0 -I/usr/include/pango-1.0 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/lib/libffi-3.2.1/include -I/usr/include/fribidi -I/usr/include/cairo -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/harfbuzz -I/usr/include/uuid -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/libmount -I/usr/include/blkid -I/usr/include/gio-unix-2.0 -I/usr/include/libdrm -I/usr/include/atk-1.0 -I/usr/include/at-spi2-atk/2.0 -I/usr/include/at-spi-2.0 -I/usr/include/dbus-1.0 -I/usr/lib/dbus-1.0/include -pthread  -D_FORTIFY_SOURCE=2  -march=x86-64 -mtune=generic -O2 -pipe -fstack-protector-strong -fno-plt -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1       
链接方式: gcc   -L. -Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now -fstack-protector -rdynamic -Wl,-export-dynamic -Wl,-E -Wl,-rpath,/usr/lib/perl5/5.28/core_perl/CORE  -Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now -L/usr/local/lib -Wl,--as-needed -o vim   -lgtk-3 -lgdk-3 -lpangocairo-1.0 -lpango-1.0 -latk-1.0 -lcairo-gobject -lcairo -lgdk_pixbuf-2.0 -lgio-2.0 -lgobject-2.0 -lglib-2.0  -lSM -lICE -lXt -lX11 -lXdmcp -lSM -lICE  -lm -ltinfo -lelf -lnsl    -lacl -lattr -lgpm -ldl   -Wl,-E -Wl,-rpath,/usr/lib/perl5/5.28/core_perl/CORE -Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now -fstack-protector-strong -L/usr/local/lib  -L/usr/lib/perl5/5.28/core_perl/CORE -lperl -lpthread -ldl -lm -lcrypt -lutil -lc   -L/usr/lib -ltclstub8.6 -ldl -lz -lpthread -lm 
"This unsets the "last search pattern" register by hitting return
nnoremap <CR> :noh<CR><CR>

nmap <C-Up> [e
nmap <C-Down> ]e
" Bubble multiple lines, similar to Eclipse (requires unimpaired.vim)
vmap <C-Up> [egv
vmap <C-Down> ]egv
" Duplicate lines, similar to Eclipse
noremap <C-S-Up> YP
noremap <C-S-Down> YP
" 定义快捷键在结对符之间跳转
nmap <Leader>M %

" 开启实时搜索功能
set incsearch
" 搜索时大小写不敏感
set ignorecase
" 关闭兼容模式
set nocompatible
" vim 自身命令行模式智能补全
set wildmenu

" 缩进
xnoremap < <gv
xnoremap > >gv

" Vim Splits - Move Faster and More Naturally
nnoremap <C-J> <C-W><C-J>
nnoremap <C-K> <C-W><C-K>
nnoremap <C-L> <C-W><C-L>
nnoremap <C-H> <C-W><C-H>

" 不允许隐藏被修改过的 buffer
set nohidden
" normal 模式下使用 bl 列出 Buffer 列表
nnoremap <silent> bl :ls<CR>
" normal 模式下使用 bo 打开一个新 Buffer
nnoremap <silent> bo :enew<CR>
" normal 模式下使用 bn 切换到下一个 Buffer
nnoremap <silent> bn :bnext<CR>
" normal 模式下使用 bp 切换到上一个 Buffer
nnoremap <silent> bp :bprevious<CR>
" normal 模式下使用 bd 关闭当前 Buffer
nnoremap <silent> bd :bdelete<CR>
" delete buffer without losing the split window
nnoremap <silent> <leader>bd :bp\|bd #<CR>

 if empty(glob('~/.vim/autoload/plug.vim'))
  silent !curl -fLo ~/.vim/autoload/plug.vim --create-dirs
    \ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
  autocmd VimEnter * PlugInstall --sync | source $MYVIMRC
endif

" 开启语法高亮功能
" syntax enable
" 允许用指定语法高亮配色方案替换默认方案
" syntax on

call plug#begin('~/.vim/plugged')
" Plug 'VundleVim/Vundle.vim'
"Plug 'altercation/vim-colors-solarized'
"Plug 'tomasr/molokai'
Plug 'vim-scripts/phd'
"Plug 'dracula/vim'
"Plug 'nanotech/jellybeans.vim'
"Plug 'w0ng/vim-hybrid'
Plug 'rakr/vim-one'
"Plug 'mhartington/oceanic-next'
"Plug 'Lokaltog/vim-powerline'
"Plug 'powerline/powerline'
"Plug 'powerline/powerline', {'rtp': 'powerline/bindings/vim/'}
Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes'
Plug 'octol/vim-cpp-enhanced-highlight'
" Plug 'majutsushi/tagbar'
"Plug 'vim-scripts/indexer.tar.gz'
" 插件列表结束
call plug#end()

" True color support
if (empty($TMUX))
  if (has("termguicolors"))
    set termguicolors
  endif
endif
" 配色方案
set background=dark
"colorscheme solarized
"colorscheme molokai
"colorscheme dracula
"colorscheme jellybeans
"colorscheme hybrid
colorscheme one

" 设置状态栏主题风格
"
let g:airline_powerline_fonts = 1
let g:airline_theme='one'
"let g:airline_theme='luna'
"let g:powerline_left_sep = ""
"打开tabline功能,方便查看Buffer和切换
let g:airline#extensions#tabline#enabled = 1
let g:airline#extensions#tabline#buffer_nr_show = 1

if you are using terminal:

what I do

I opened a file name temp.txt, want to open a new file temp.py beside it in a vertical window.

actual behavior

screenshot_20181225_021129

expected behavior

screenshot_20181225_021233

If I comment these two lines below, I get what expected:

let g:airline#extensions#tabline#enabled = 1
let g:airline#extensions#tabline#buffer_nr_show = 1
roachsinai commented 5 years ago

I use :vnew temp.py to create the new file.

chrisbra commented 5 years ago

Well, that is what the tabline is for. If you do not want that, do not enable it.