Code Monkey home page Code Monkey logo

vim-wintabs's Introduction

vim-wintabs

Wintabs is a per-window buffer manager for Vim. It creates "tabs" for each buffer opened in every Vim window, and displays these buffers either on tabline or statusline. It brings persistent contexts to Vim windows and tabs, making them more awesome.

Screenshots

Wintabs with two native Vim tabs, showing buffers and tabs on tabline:

image

Wintabs with two Vim windows, showing buffers on statusline. It nicely preserves window layout when switching/closing tabs:

image

Wintabs manages long tablines nicely (better than Vim does!):

image

Using Powerline fonts:

image

Installation

Use your favorite package manager to install. vim-wintabs-powerline is optional, used for Powerline style rendering.

pathogen

git clone https://github.com/zefei/vim-wintabs ~/.vim/bundle/vim-wintabs
git clone https://github.com/zefei/vim-wintabs-powerline ~/.vim/bundle/vim-wintabs-powerline

vundle

plugin 'zefei/vim-wintabs'
plugin 'zefei/vim-wintabs-powerline'

vim-plug

plug 'zefei/vim-wintabs'
plug 'zefei/vim-wintabs-powerline'

Usage

By default, wintabs maintains a list of buffers for each buffer opened in each window, and displays them on tabline. To navigate and manage these buffers, a few commands and key mappings are provided, and they are very similar to what Vim buffers/tabs have.

To make full use of wintabs, it is recommended to have the following commands or keys mapped, these are the essential ones:

commands             | mapping keys                 | replacing Vim commands
---------------------+------------------------------+-----------------------
:WintabsNext         | <Plug>(wintabs_next)         | :bnext!
:WintabsPrevious     | <Plug>(wintabs_previous)     | :bprevious!
:WintabsClose        | <Plug>(wintabs_close)        | :bdelete
:WintabsUndo         | <Plug>(wintabs_undo)         |
:WintabsOnly         | <Plug>(wintabs_only)         |
:WintabsCloseWindow  | <Plug>(wintabs_close_window) | :close, CTRL-W c
:WintabsOnlyWindow   | <Plug>(wintabs_only_window)  | :only, CTRL-W o
:WintabsCloseVimtab  | <Plug>(wintabs_close_vimtab) | :tabclose
:WintabsOnlyVimtab   | <Plug>(wintabs_only_vimtab)  | :tabonly

Below is an example of key mappings:

map <C-H> <Plug>(wintabs_previous)
map <C-L> <Plug>(wintabs_next)
map <C-T>c <Plug>(wintabs_close)
map <C-T>u <Plug>(wintabs_undo)
map <C-T>o <Plug>(wintabs_only)
map <C-W>c <Plug>(wintabs_close_window)
map <C-W>o <Plug>(wintabs_only_window)
command! Tabc WintabsCloseVimtab
command! Tabo WintabsOnlyVimtab

See :help wintabs-commands for all available commands and mappings.

Wintabs can display buffers on either tabline or statusline. It's recommended to use tabline if you typically work without using split windows; otherwise, statusline is recommended. If Wintabs is set to use statusline, it automatically moves your original statusline content to tabline.

Configuration

Wintabs has a handful of configuration options, see :help wintabs-options for details.

FAQ

Q: Does wintabs support Powerline fonts?

A: Yes. The vim-wintabs-powerline plugin provides a set of renderers for using Powerline fonts with wintabs.

Q: Does wintabs support Vim sessions?

A: Yes, as long as your sessionoptions contains "globals". Wintabs also supports xolox/vim-session out of the box.

Q: Does wintabs work with statusline/tabline plugins like airline?

A: Wintabs can work reasonably well with statusline/tabline plugins as long as you load wintabs after other plugins.

License

MIT License.

vim-wintabs's People

Contributors

adelarsq avatar cwillu avatar echuraev avatar noscript avatar zefei avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

vim-wintabs's Issues

:mkview followed by :loadview makes a buffer tab disappear

If I have multiple buffer tabs open, sometimes :mkview followed by :loadview makes one or more tabs (not the current one) disappear.

It seems to matter which buffer is active - doing this in a particular buffer might make two buffers in the same window disappear. But doing it in one of those buffers doesn't make any buffers disappear.

I've tracked it down to the command :doautoall SessionLoadPost at the end of a view script (running only that triggers the behavior). However, calling all the functions listed in :autocmd SessionLoadPost does not trigger the behavior. Also, I looked at the session string before triggering and it looks correct.

I'm using g:wintabs_display = 'statusline' and vim-wintabs-powerline.

Memoization broke first edited file

This diff:
* d9bc6d0 (TMP5) memoize get_bufline (by Zefei Xuan 2 weeks ago)

Seems to have broken the experience where you open up vim, and then do :e someExistingFile.txt. The file doesn't show up in the statusline. It acts as if it's an empty/non-listed/non-named file.
Can you confirm?

Allow overriding buf_label specifically

I wanted to change the format of buffer labels beyond the format string you've defined, but this required duplicating a chunk of code in my vimrc to get back the highlighting behavior. (It was also a bit confusing, since at first I copied vim-wintabs code, only to realize I needed to copy vim-wintabs-powerline code.)

Can you add a hook for customizing only buf_label?

If you're curious, the label I want is not only the file, but its parent directory name (one level only, so each buffer label has exactly one /).

Love the plugin, it's quickly becoming one of my favorites!

After closing a tab, the tabbing order doesn't flow correctly

How to reproduce:
open files
file1 > file2 > file3 > file4
close file2,
re-open file2,
file1 > file3 >file4 >file2
now the order tabbing from left to right jumps from 1 to 4, then back to 2 and 3
shouldn't it just follow the normal order from left to right?

Suggestion for "vsplit or open existing"

It's really common for modern editors to encourage each file to be open in one "window" or viewport. Vim stands at odds against this so much of the time. Thankfully WinTabs helps bring Vim closer to a modern editor. There is one area where it could stand to improve. It seems there should be a command for the following features:

  • "(vertical/horizontal) split file x into new split if the file is not already open in an existing window, or focus existing window and switch to existing buffer, if that file is already open in a window or tab (or native Vim tab even)"
  • "Open file x into currently (or most recently focused) window if it is not already opened in an existing window, or switch to an existing window/buffer, if that file is already open in a window or tab (or native Vim tab even)"

Render multiple tabs per window / split in tabline.

I created this mock of what an ideal Wintabs renderer might look like. In this mock, the (awesome) existing feature of Wintabs rendering multiple tabs per window, is performed in the tabline. This allows the bottom statusline to be occupied by airline.

  • Also note that because of the way these tabs are rendered, resizing the NERDTree causes the tabs to always render over their respective window. If you dynamically resize, then the tabline would ideally draw and update to create the feel of a "modern" editor such as Atom.
  • One challenge here is that it's not clear how this would work with horizontal splits. I have a couple proposed solutions.
    a. Don't support multiple tabs per horizontal split (many editors don't anyways) - this is just to make implementation easier.
    b. When split, use the statusline under the top window, to render the tabs for the split below the statusline (which is a little strange conceptually, but creates the appropriate visual look that people expect to see).

I might prefer a above, because there's an upcoming neovim feature called "tabat", which allows you to receive clicks at certain locations in the tabline. That would allow the tabs to be clickable! (And even handling the click on a little close button per tab perhaps). This would not be possible with the statusline approach for horizotal splits (b above) so it might make sense to just not even support it. To be clear, even with b, you could support horizontal splits, but it would be more like each vertical split may have several tabs, and within each of those tabs could exist many horizontal splits. (That would be the hierarchy of WinTabs windows - vertical splits contain many tabs, and each tab contains many horizontal splits).

Thoughts? Is there a better way to achieve this?

wintabsdreaming

Add FzF support for wintab buffers

I did some digging through the vim-wintabs source code and found the variable w:wintabs_buflist which is a array of buffer numbers that map to the buffers of a specific split.

I thought it would be great to have a FzF command to quickly fuzzy search for all wintab buffers that are assigned to the current split. So I quickly hacked together the following fzf snippet:

    function! s:WintabsBuffers()
      if exists("w:wintabs_buflist")
        call fzf#run({
        \ 'source': map(copy(w:wintabs_buflist), 'bufname(v:val)'),
        \ 'sink':   'e',
        \ 'window':  'enew' })
      else
        echo "wintabs not loaded"
      endif
    endfunction

    command! -nargs=* WintabsChose call s:WintabsBuffers()

Somehow (not sure if this is a bug) I noticed that the w:wintabs_buflist variable on vim enter is not an empty list (e.g. not set), which seems strange and requires me to have the exists("w:wintabs_buflist") failsafe (correct me if wrong)

I was wondering as seeing as wintabs already has integration with plugins like xolox session if integrating the above is of interest to you.

Suggestion for "new tab" shortcut

What vim command would you recommend for vim-wintabs "new tab" equivalent. I've tried :enew (mapping command + n to this), but it doesn't actually recreate the notion of "new tab" because if my current buffer has unsaved changes, it complains that there are unsaved changes. Do you have another suggestion for a command for opening a "new tab".

Error running :helptags

Hi, I'm getting the following error while installing the vim-wintabs plugin:

[2014-09-23 13:13:57] > Error running :helptags /Users/cezar/.vim/bundle/vim-wintabs/doc
[2014-09-23 13:13:57] :helptags /Users/cezar/.vim/bundle/vim-abolish/doc

I am using VIM - Vi IMproved 7.4 (2013 Aug 10, compiled Oct 31 2013 19:59:09) on OSX. And I am installing it with Plugin 'zefei/vim-wintabs'

Format option for displaying vim tabs with separator

You can set option g:wintabs_ui_show_vimtab_name equal 2. Then vim tabs will be displayed in this way: <tab_number>:<tab_name>. User is not able to customize the separator between number and name.

We had a discussion with Zefei (@zefei) how it should be implemented in pull request #7. All discussion you can read here.

The summary of this discussion is:
"A good way to make format option for displaying vim tabs would be to allow user to free form the tab name like "%d: %n"."

WintabsClose doesn't delete buffers

Is there a reason why? The docs claim that this is a replacement for :bd but it only disassociates them with the tab. If you're using session management you will end up having lots of zombie buffers.

Colors and styles support

I have installed a colorscheme called vim-one and my panel looks like this:
image

I wonder how can I remove the underline from the unselected tabs (besides changing the colorscheme itself, of course)? Or it is the thing that this plugin shouldn't do?

Buffer number

Is there a way to display buffer number along with file name in wintab above. This would be very helpful when switching buffers.

Win tabs not showing all opened files when opening multiple files quickly (e.g. with fzf)

I am writing a little bit of Vim script where there is a function that takes a list of file names, and I want it to open all of those files as buffers in the current tab. (The purpose of the script is to be able to select multiple filenames with fzf and open them all at once in new buffers)

To simulate such behaviour, we can run something like this.

vi 
:for name in ['tsconfig.json', 'tslint.json']
  execute 'e ' . fnameescape(name)
endfor

Ideally this should open up two buffers, and show both in the tab line. The above script only appears to leave the last of the two files in the tab line.

split windows and buffers (when using g:wintabs_display = 'tabline')

Hi,

I'm trying to get wintabs to work reliably with split windows, without setting g:wintabs_display = 'statusline', as I don't want to have the statusline move position to the top of the window.

I've tried setting:

au BufEnter,WinEnter * WintabsAll

This works, but when I start using tabs (`:tabnew') then switching tabs doesn't limit the buffers which are shown to just that tab; it seems to use all buffers.

I feel as though I am close with using WintabsAll, but just needs limiting the tabs. That way (for me at least), the default configuration just works.

Any pointers on how to achieve this would be welcomed.

Thanks!

persistence of folds between tabs (or buffers in a window)

Hello,
the plugin looks very cool. I am very interested in the idea of
using multiple tabs within a window in vim, in addition to the normal tabs
of vim.

The reason I want to have multiple tabs per window is primarily to keep
the folds (im usually using manual folds) updated. And it seems that unfortunately this
plugin does not do what I hoped for.

What I really want is to preserve the exact view of the file
and update the folded lines dynamically as edits are made, as is done when a window is open in the current window or any other tab. So if a fold is present, and 3 new lines are added above the fold, the fold should be moved down 3 lines

I've used :mkview which kind of works, but does not update the folds like it would
if a window had remained open

I've also used this
https://vim.fandom.com/wiki/Avoid_scrolling_when_switch_buffers
but the problem with this is it does not update folded lines.

The problem I'm trying to explain can be produced as follows:

save the following as 'test.vim' and run this command with either neovim or vim
nvim -u NONE -S test.vim
vim -u NONE -S test.vim

" remove the files if they exist
:!rm filea.txt
:!rm fileb.txt
" create a test file (filea.txt)
:e filea.txt
normal! idont fold me
normal! 2odont fold me
normal! 4ofoldme
normal! 3odont fold me
" go to line 4
normal! 4gg
:set foldmethod=manual
" fold down 3 lines (all of the 'fold me' lines are now folded)
normal! zf3j

" make a split and send it to the next tab
" (just to reference at the end)
:sp
wincmd T
" return to the original tab
normal! gT

" create a vertical split
:vs

" open a new file in the first window and do some editing
:e fileb.txt
normal! ihello
:w

" go to the other window (with filea.txt)
wincmd w
" insert a new line
normal! 3gg
normal! onew line that should not be folded
:w

" now go back to the previous window
wincmd p
" and switch to the file a buffer
:b filea.txt
" actual behaviour:
" 'foldme' is visible in the current window
" desired behaviour:
" 'foldme should be hidden, as it is in the other window'
"
" notice that in the other tab (press gt)
" the fold has been properly updated even
" though that window was not in view when the
" edit was made

I'm considering writing my own plugin which achieves this with a set of floating windows in neovim. I think I would
make floating windows that are in a location that is off screen somewhere.
do you have any thoughts on this? I wish that I did not have to rely on floating windows and a neovim specific
solution to this problem. I think what I want could be achieved if there were somehow a way to hide windows
or set their height to 0, so the folds will still be updated as if they were open, just in another tab somewhere, but I want to be able to reference them quickly like your plugin does.

Cannot WintabsClose the final modified buffer in a window.

If you open Vim, and modify the default non-named buffer. It will show up as a wintab, but then if you try to WintabsClose it, you will get an error message:

screen shot 2018-02-03 at 10 50 41 pm

set hidden
let g:tabSystem = 'wintabs'
let g:wintabs_autoclose=1
let g:wintabs_autoclose_vim=1
let g:wintabs_switchbuf='useopen,usetab'
let g:wintabs_ui_modified*
let g:wintabs_ui_active_higroup = 'TabLineSel'

Note that let g:wintabs_autoclose=2 does work, but let g:wintabs_autoclose=1 does not.

Request: Ability to click on statusline buffers

It would be awesome if I could click on a buffer item in the statusline of a window and have that window switch to that buffer. Is this possible? I imagine it would be if there is a way to make an area within the statusline clickable and associate some function to the mouse event.

w:wintabs_buflist not set on VimEnter / plugin init when g:wintabs_display = 'none'

Observed behavior:

There seems to be a bug in how w:wintabs_buflist is set. If g:wintabs_display is either tabline or statusline it behaves as expected and w:wintabs_buflist is set whenever vim is opened and a file is opened in a buffer.

If however g:wintabs_display is set to none then vim-wintabs does not refresh the buflist it seems, and requires manualy invoking one of the wintabs navigation commands (WintabsNext / WintabsPrevious) to initialize the w:wintabs_buflist dictionary, which also only contains the current buffer in that case. Strange enough invoking WintabsRefresh does not work but WintabsNext does init the variable.

Expected behavior:

w:wintabs_buflist is set and behaves consistently regardless of the setting of g:wintabs_display

Reproduction steps:

Using the following minimal vimrc:

set nocompatible               " Be iMproved

"Note: install vim-plug if not present
if empty(glob('~/.config/nvim/autoload/plug.vim'))
  silent !curl -fLo ~/.config/nvim/autoload/plug.vim --create-dirs
    \ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim

  autocmd VimEnter * PlugInstall
endif

"Note: Skip initialization for vim-tiny or vim-small.
if !1 | finish | endif
if has('vim_starting')
  set nocompatible               " Be iMproved
  " Required:
  call plug#begin()
endif

Plug 'zefei/vim-wintabs'

" Add plugins to &runtimepath
call plug#end()

if has_key(g:plugs, 'vim-wintabs')
  let g:wintabs_display = 'none'
endif

invoked using: nvim -u ./minimal_vimrc.vim

  1. type the following in the commandline: :echo w:wintabs_buflist => expect error to be shown
  2. open any file, for example neovim config: :e ~/.config/nvim/init.vim
  3. redo step 1 => expect the same error to be shown
  4. open another file :e ~/.zshrc
  5. redo step 1 => expect the same error to be shown
  6. type the following in the command line: :WintabsNext
  7. redo step 1 => expect the variable to contain a single buffer (instead of two)

[Feature Request/Discussion] Use fzf for selecting an open buffer

Note : this is just a discussion with some thoughts, I'm not sure what I am proposing exactly the best solution that is possible.

Problem

What I'm trying to do is, what I have a lot of Vim tabs and buffers and each tab open, I would like to jump to an existing buffer by typing in the file name (hopefully in a fuzzy way for speed).

Potential solution

Have some way of listing the buffers opened by win tabs, so that they can be sent into a fzf window. The user can then use fzf to fuzzy search for the open buffer. When the user presses enter, Vim would then jump to the existing open buffer, without creating a new one.

Other notes

I'm thinking that it is possible this use case is very specific to my own workflow, and may not be useful for anyone else. Or maybe this could be made more general to suit a greater range of use cases provide greater number of people.

What are everyone's thoughts on this?

buffers for each tab rather than window

Hi,
The default behavior is that opened buffers can be accessed in the window that they have been opened.
I have a question if it is possible to make default behavior such that if I open in one tab few buffers they
will be accessible in all windows in that tab?

Support displaying vimtabs when statusline display is enabled

When g:wintabs_display is set to statusline, I'd like a way to surface the vimtabs display as part of the tabline. Currently, vimtabs are not displayed anywhere.

More specifically, I'm using airline and can add a custom addition to the statusline (I'm okay with doing some configuring work). Not sure if this is possible, but I'd like a function I can call to render the vimtabs display (customized with g:wintabs_ui_vimtab_name_format, in my case) inside of airline. Is it possible?

P.S. Thanks for your great extension, it's exactly what I've been looking for!

Error when closing tab with unsaved changes

How to replicate:

  1. Configure vimrc
let g:wintabs_autoclose_vim = 1
let g:wintabs_autoclose_vimtab = 1
let g:wintabs_autoclose = 2
  1. run vim
  2. Type :tabedit
  3. Insert some text and go back to normal mode
  4. type call wintabs#close()
  5. Do not save changes to 'Untitled'
  6. See the error below

screen shot 2018-07-17 at 9 49 30 am

Can't undo after changing tab

Lets say I have two tab, A and B.

If I save buffer in tab A, and change to tab B, and switch back to tab A, I can't undo what I has edit before in tab A.

Vim will say "Already at oldest change".

[question] change buffer status line colours

Hello. Can anyone advise me how to change the background color of the statusbar. I looked in renderer.vim as per the help page but I couldn't understand how it works.
I'm using taboo for a tab line at the top and wintabs for a buffer line below, the latter of which sticks out due to its black coloured background, however.

This plugin overrides the airline theme for the tabline

Before installing this plug in:

screen shot 2018-06-27 at 1 41 53 pm

After installing this plugin:

screen shot 2018-06-27 at 1 40 49 pm

Semi minimal vimrc that replicates this behaviour

set encoding=utf-8
" Vundle
" {{{

set nocompatible              " be iMproved, required
filetype off                  " required
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" alternatively, pass a path where Vundle should install plugins
" call vundle#begin('~/some/path/here')

" let Vundle manage Vundle, required
Plugin 'VundleVim/Vundle.vim'

" PLUGINS GO HERE
" {
"
" Themes
Plugin 'chriskempson/base16-vim'

" Airline
Plugin 'vim-airline/vim-airline'
Plugin 'vim-airline/vim-airline-themes'

" Wintabs (must be after vim-airline)
" --------------- Comment out the next two lines to get the tabline theme back
Plugin 'zefei/vim-wintabs'
Plugin 'zefei/vim-wintabs-powerline'

" Miscellaneous
Plugin 'xolox/vim-misc'
Plugin 'dylan-chong/vim-session'

" }

call vundle#end()            " required
filetype plugin indent on    " required

" }}}


" Plugin Config
" {{{

" Vim Airline Plugin
let g:airline_detect_modified=0
let g:airline_powerline_fonts=1
let g:airline_theme='base16'
set laststatus=2 " Always show status line


" }}}



" Coloring
" {{{

" General
syntax on
let g:enable_bold_font = 1

" Colorscheme
set background=dark
let base16colorspace=256  " Access colors present in 256 colorspace
colorscheme base16-materia

" Highlight line/column
" set cursorline

" End column
hi ColorColumn ctermbg=52
" Highlight only if there is a character on the column
cal matchadd('ColorColumn', '\%81v', 100)

" }}}




" Other
" {{{
"

" Get bg color to work in tmux
set t_ut=

" Colors in neovim
set termguicolors

" }}}

When restoring from Vim session, buffers from other tabs are copied into the active tab

" Vim Session
" Settings to get it to work like vim-obsession (save session in current directory)
let g:session_autosave_silent = 1
let g:session_autoload = 'no'
let g:session_autosave = 'yes'
let g:session_lock_enabled = 0
let g:session_directory = './'
let g:session_default_name = 'Session'
let g:session_autosave_periodic = 0
let g:session_autosave_only_with_explicit_session = 1

" Win Tabs
let g:wintabs_ui_vimtab_name_format = '%t'
let g:wintabs_autoclose_vim = 1
let g:wintabs_autoclose_vimtab = 1
let g:wintabs_autoclose = 2
if !has('idea')
  " Change tabs
  nnoremap <Leader>gh gT
  nnoremap <Leader>g<Left> gT
  nnoremap <Leader>gl gt
  nnoremap <Leader>g<Right> gt

  " Change buffers
  nmap gh <Plug>(wintabs_previous)
  nmap g<Left> <Plug>(wintabs_previous)
  nmap gl <Plug>(wintabs_next)
  nmap g<Right> <Plug>(wintabs_next)

  " Other buffer stuff
  nmap <Leader>wu <Plug>(wintabs_undo)
  nmap <Leader>wm :WintabsMove<Space>
  nmap <Leader>wo <Plug>(wintabs_only)
  nnoremap <Leader>wO :tabonly<Bar>call<Space>wintabs#only()<Bar>only

  " Override q,q!,wq to avoid accidentally closing all of the buffers in the
  " tab
  function! SaveAndCloseCurrentBuffer()
    :up
    call wintabs#close()
  endfunction
  call CommandCabbr('q', 'call wintabs#close()')
  call CommandCabbr('q!', 'call wintabs#close()')
  call CommandCabbr('wq', 'call SaveAndCloseCurrentBuffer()')
endif
" Show git commit file in tabline
let g:wintabs_ignored_filetypes = []
autocmd FileType gitcommit set buflisted
" Fix this plugin overriding the styling for vim-airline
call g:Base16hi(
      \ 'TablineSel',
      \ g:base16_gui00,
      \ g:base16_gui0D,
      \ g:base16_cterm00,
      \ g:base16_cterm0D,
      \ 'bold',
      \ ''
      \ )
call g:Base16hi(
      \ 'Tabline',
      \ g:base16_gui04,
      \ g:base16_gui02,
      \ g:base16_cterm04,
      \ g:base16_cterm02,
      \ '',
      \ ''
      \ )
let g:wintabs_powerline_sep_buffer = ''
let g:wintabs_powerline_sep_tab = ''
" Reinitialise when reloading vimrc to make it look right
call wintabs_powerline#init()

Steps to reproduce the bug:

  1. Add the above code to your vimrc
  2. Run touch a b c; vim
  3. Inside Vim run :e a then :tabe b then :tabe c
  4. Save the session with :SaveSession
  5. :wqa
  6. Reopen Vim with the session vim -S

The session will load with the current files/configuration:

tab1
- a

tab2
- b

tab3
- c (active)
- a
- b

In the third tab, files a and b should not be there

Wintabs functions called too many times.

I opened a file with 1000 lines, and moved the cursor downwards from top to bottom.

I am using Wintabs' statusline mode. I had two splits open, in one split I had two buffers, in the other split I had one buffer.

I also have airline rendering in the tabline so it shouldn't be touching the statusline. I activated airline to use as a comparison since it does update with every cursor movement and wintabs should not (I'm just moving the cursor through a single file one thousand lines long).

I would expect pretty much no work to be done while moving the cursor in wintabs, but the function:FUNCTION wintabs#element#slice() was called 25,000 times, and consumed 7 seconds of work (SELF time). FUNCTION wintabs#element#len() was called 200,000 times and consumed 4 seconds of time while scrolling from top to bottom in the file.

g:wintabs_ui_active_left Not applied to first tab

I believe the first wintab doesn't show the active_left character:

let g:wintabs_display='statusline'
set hidden
let g:wintabs_autoclose=2
let g:wintabs_autoclose_vim=1
let g:wintabs_autoclose_vimtab=1
let g:wintabs_switchbuf='useopen,usetab'
let g:wintabs_ui_active_higroup = 'TabLineSel'



" If doing some custom rendered GUI use a not-actually space.
" let intertabSpace= ' '
let intertabSpace= ' '
let activeWinTabChar = '|'
" This must be different to distinguish.
let activeVimTabChar = '|'
let activeWinTabChar = '▎'
" This must be different to distinguish.
let activeVimTabChar = '▍'
let g:wintabs_ui_sep_leftmost=intertabSpace
let g:wintabs_ui_sep_inbetween=intertabSpace
let g:wintabs_ui_active_right=intertabSpace
let g:wintabs_ui_active_left=activeVimTabChar 
let g:wintabs_ui_sep_rightmost=intertabSpace
let g:wintabs_ui_modified=' ◎'
let g:wintabs_ignored_filetypes=[]
" Annotating the active vimtab makes it always available for detection
let g:wintabs_ui_active_vimtab_left=activeVimTabChar
let g:wintabs_ui_active_vimtab_right=intertabSpace

let g:wintabs_ui_arrow_left='«'
let g:wintabs_ui_arrow_right='»'

Improved/customizable truncation.

This sequence of screenshots shows what happens when truncating tabs.

There's one (perhaps, bug?) issue with truncation: that is, when shrinking, the highlighting colorscheme (if active) is not applied, and left separator disappears.

I'm thinking that the following might be good improvements:

  1. The color should probably remain highlighted as it was.
  2. The left separator should probably remain.
  3. It would be nice to be able to customize the truncation token. Right now, I'm not sure where <l# comes from. If configurable, I would likely set the truncation token to the single character ellipsis, and I might even prefer to have the ellipsis after the left separator, so in my case it might look like: |…ckage.json, where | is the left separator. I realize that the left separator won't always look great when truncated, but it does in my specific setup.

screen shot 2017-02-26 at 6 44 32 pm

screen shot 2017-02-26 at 6 44 41 pm

screen shot 2017-02-26 at 6 44 51 pm

screen shot 2017-02-26 at 6 45 00 pm

Add a way to integrate with vim-airline

Currently this plug-in overrides the status line (when using the status line option)

it would be nice if there was a way to show the tabs in the status line, without overwriting the status line. For example by doing something like

let g:airline_section_x = whatever_needs_to_be_here_to show all of the buffers

Open several files in several wintabs

Hi there,
first of all, thank you for your work. Wintabs is awesome :-)

I am wondering if there is any way to open several files from the command line so that each of them goes to a different wintab. If I naively run

vim file1 file2 file3

What I get is each file in a buffer but just the first one is shown as a wintab (the others are not shown in the tabline). Is there any way to run

vim -c "some commands" file1 file2 file3

so that vim opens each one on a visible wintab?

Thanks!

Al.

Strange marks in tabline

Hi
I installed the plugin and I am using default settings.
However, when I open buffer I see strange marks like 'Pi', please see the picture below
strangeMarksInTabs

Is it normal? Can I disable it?

Vim error with switchbuf="useopen" in vimdiff

When setting g:wintabs_switchbuf="useopen", vimdiff file.a file.b results in a VIM error:

continuing in function wintabs#ui#get_tabline[2]..<SNR>53_get_bufline[5]..wintabs#memoize#call[5]..<SNR>53_get_bufline_non_memoized
Error detected while processing function <lambda>1[1]..<SNR>26_open_buffer_in:
line    2:
E16: Invalid range: 2wincmd w

And only one window visible.

Minimal .vimrc:

set nocompatible
silent! call plug#begin('~/.vim/plugged')
let g:wintabs_switchbuf="useopen"
Plug 'zefei/vim-wintabs'
call plug#end()
$ vim --version
VIM - Vi IMproved 8.1 (2018 May 18, compiled Aug 17 2019 13:55:59)
Included patches: 1-1846
Modified by Gentoo-8.1.1846
Compiled by portage@jentoo
Huge version without GUI.  Features included (+) or not (-):
+acl               -farsi             -mouse_sysmouse    -tag_any_white
+arabic            +file_in_path      +mouse_urxvt       -tcl
+autocmd           +find_in_path      +mouse_xterm       +termguicolors
+autochdir         +float             +multi_byte        +terminal
-autoservername    +folding           +multi_lang        +terminfo
-balloon_eval      -footer            -mzscheme          +termresponse
+balloon_eval_term +fork()            +netbeans_intg     +textobjects
-browse            -gettext           +num64             +textprop
++builtin_terms    -hangul_input      +packages          +timers
+byte_offset       +iconv             +path_extra        +title
+channel           +insert_expand     -perl              -toolbar
+cindent           +job               +persistent_undo   +user_commands
+clientserver      +jumplist          +postscript        +vartabs
+clipboard         +keymap            +printer           +vertsplit
+cmdline_compl     +lambda            +profile           +virtualedit
+cmdline_hist      +langmap           +python/dyn        +visual
+cmdline_info      +libcall           +python3/dyn       +visualextra
+comments          +linebreak         +quickfix          +viminfo
+conceal           +lispindent        +reltime           +vreplace
+cryptv            +listcmds          +rightleft         +wildignore
+cscope            +localmap          -ruby              +wildmenu
+cursorbind        +lua               +scrollbind        +windows
+cursorshape       +menu              +signs             +writebackup
+dialog_con        +mksession         +smartindent       +X11
+diff              +modify_fname      -sound             +xfontset
+digraphs          +mouse             +spell             -xim
-dnd               -mouseshape        +startuptime       -xpm
-ebcdic            +mouse_dec         +statusline        +xsmp_interact
+emacs_tags        -mouse_gpm         -sun_workshop      +xterm_clipboard
+eval              -mouse_jsbterm     +syntax            -xterm_save
+ex_extra          +mouse_netterm     +tag_binary
+extra_search      +mouse_sgr         -tag_old_static
   system vimrc file: "/etc/vim/vimrc"
     user vimrc file: "$HOME/.vimrc"
 2nd user vimrc file: "~/.vim/vimrc"
      user exrc file: "$HOME/.exrc"
       defaults file: "$VIMRUNTIME/defaults.vim"
  fall-back for $VIM: "/usr/share/vim"

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.