Commit Graph

179 Commits

Author SHA1 Message Date
mrmr1993
ada8cd7641 Use variables in the tabs tabline builder to track position 2018-03-15 17:41:08 +00:00
mrmr1993
349d01ba39 Generate tabs directly in tabline/builder.build 2018-03-15 17:38:19 +00:00
mrmr1993
3f87d28abb Move insert_tabs into tabs tabline builder prototype
Also move evaluate_tabline and strchars methods that it uses
2018-03-15 17:05:58 +00:00
mrmr1993
71814fb19f Add get_title and get_group to tabs tabline builder 2018-03-15 17:04:19 +00:00
mrmr1993
b99da65412 Create insert_tabs function on builder for tabs tabline 2018-03-15 16:58:04 +00:00
mrmr1993
6286b6d8d8 Move get_group into its own function for tabs 2018-03-15 16:58:04 +00:00
mrmr1993
5907d3909e Add dedicated tabline builder 2018-03-15 16:38:36 +00:00
mrmr1993
57f2619c67 Remove unused variable b_tabline 2018-03-15 15:42:51 +00:00
mrmr1993
1837b2ee39 Use the size of the seperators to get the tabline's remaining space 2018-03-15 15:42:51 +00:00
mrmr1993
d3ec54d42e Remove magic contant for skipped_tabs_marker in tabline calculation 2018-03-15 15:18:57 +00:00
mrmr1993
2b0fe51f99 Replace %= with empty string in evaluate_tabline 2018-03-15 14:36:39 +00:00
mrmr1993
a8f92cc68a Rename skipped_tabs_marker to overflow_marker
This is set to g:airline_symbols.ellipsis, which this commit also adds.
2018-03-15 14:21:16 +00:00
mrmr1993
88dedb586a Update tabs tabline when the width of the terminal changes 2018-03-14 15:25:03 +00:00
mrmr1993
5d2d764368 Use strchars to calculate string lengths
This also adds a compatability wrapper, so that versions older than
Vim 7.3 are supported.

This is inspired by, and includes s:strchars from, @ruipgpinheiro's
commit e2d1295a3d3708e8d2a5eb30cac840fc9520bb8b
2018-03-14 15:13:40 +00:00
mrmr1993
6819443d6a Fix typo in evaluating %( %) rules 2018-03-14 15:07:41 +00:00
mrmr1993
980e78b4bf Add configurable variable airline#extensions#tabline#skipped_tabs_marker 2018-03-14 15:07:32 +00:00
mrmr1993
7480245ebf Calculate used length of tabs directly as they are added 2018-03-14 14:51:09 +00:00
mrmr1993
f93894f6ac Move tab title generation into its own function 2018-03-14 13:55:30 +00:00
mrmr1993
e1a4cd764f Adjust tab columns to allow for ellipsis and the left/right split 2018-03-13 00:57:48 +00:00
mrmr1993
d29c7b27fa Evaluate tabline fragments to get the length of tab titles 2018-03-12 21:55:27 +00:00
mrmr1993
3305410982 Move tabline evaluation into its own function 2018-03-12 21:55:27 +00:00
mrmr1993
e0791cc1a0 Use the partially built tabline to calculate space left for tabs 2018-03-12 21:55:25 +00:00
mrmr1993
7a286639c5 Attach tabs to tabline last 2018-03-12 21:52:12 +00:00
mrmr1993
2711c73a47 Pass the available space for tabs as an argument to |get_visible_tabs| 2018-03-12 21:48:40 +00:00
mrmr1993
cf47d63f71 Fix formatting in clipped tab bar 2018-03-12 21:48:40 +00:00
mrmr1993
abd310bb31 Show current tab in the middle of the tabline
This is heavily based on 3cc1dcb697,
mostly by copying the get_visible_buffers function and making some
tweaks
2018-03-12 21:48:35 +00:00
mrmr1993
f60cf736db Add a get_tabs function to abstract over tabs 2018-03-12 21:47:08 +00:00
mg979
26aa528c42 Made s:variables local
Moved small functions out of main function
2018-03-07 02:21:52 +01:00
Christian Brabandt
167602d5b9
tabline: get correct buffer name
When the uniq_tail formatter is used, the buffer name is not refreshed
when running through the duplicates. Fix that by getting the correct
buffer name again.

fixes #1680
2018-03-06 11:23:38 +01:00
mg979
63111e9810 Removed fnamemodify() in path check for buflist.vim 2018-03-04 00:31:25 +01:00
mg979
2e2a66c5a0 Restored old variable name for g:airline#extensions#tabline#excludes
Made check case sensitive
2018-03-03 23:53:10 +01:00
mg979
3ebbc57725 Changed buflist.vim algorithm 2018-03-03 23:39:14 +01:00
erfanio
8c634887bf Fix white space in tabline when showing buffers 2018-02-08 19:02:35 -08:00
Christian Brabandt
9a2ed35ff9
tabline: do not confuse Vim
looks like this:
```
let a=(condition ? s:var:'')
```
confuses older Vims and it complains about a missing colon. So make
parsing a bit easier and add a space in front of the second colon.

fixes #1629
2018-01-08 13:46:08 +01:00
Christian Brabandt
02816a3cb6
tabline: missing spaces
commit ab49a1c7ae changed that no leading whitespace was added.
While this removed a double space in front of the current active
selected buffer, it removed one space too much for the non-current
buffers in the bufferline.

So partly reverse it and only add the space, if the highlighting groups
between each item did not change.
2018-01-08 09:48:36 +01:00
Christian Brabandt
182675dc10
tabline: revert default buffer_idx_mode
commit 2e3cdeb unintentionally changed the default for the
buffer_idx_mode in the tabline.

Revert it back to be disabled by default

fixes #1628
2018-01-07 09:51:08 +01:00
Christian Brabandt
ab49a1c7ae
tabline: do not add extra space before buffer name
there was a space too much added in the tabline. Fix that
2018-01-05 22:13:47 +01:00
Christian Brabandt
5db4c408bd
Update copyright notifications 2018-01-05 10:37:59 +01:00
Christian Brabandt
c17ad9a123
Merge pull request #1426 from lynnard/master
Fix problems with AirlineSelect{Prev,Next}Tab
2018-01-04 21:15:00 +01:00
Christian Brabandt
73d8abff2f
Merge pull request #1617 from kyleholzinger/master
Add formatter for js files
2018-01-04 21:14:00 +01:00
Christian Brabandt
d283a25e3f
tabline: only show buffer label, if they were drawn
closes #1558
2018-01-04 20:56:09 +01:00
Christian Brabandt
ce83c39bed
tabline: allow custom formatter for tabnr_type
closes #1418
2018-01-04 20:41:55 +01:00
Christian Brabandt
c518f79aab
tabline: allow to show buffers label at start 2018-01-04 19:38:07 +01:00
Christian Brabandt
9d28f0dcc7
tabline: allow to show current buffer/tab at first position
This will make highlighting more consistent. Always first item is the
one where the cursor is.
2018-01-04 19:32:29 +01:00
Christian Brabandt
30652c05c4
tabline: correct order of tab/buffer labels 2018-01-04 19:09:02 +01:00
Christian Brabandt
3b631ef0c4
tabline: refactor label function 2018-01-04 18:43:03 +01:00
Christian Brabandt
3985ece131
tabline: add [buffers]/[tabs] labels consistently
previously, when both tabs and buffers were displayed in the tabline, it
was not immediately obvious which side belongs to a buffer and which one
to a tab. Therefore, add [buffers]/[tabs] labels consistently.
2018-01-04 18:34:48 +01:00
Christian Brabandt
503b9977fb
tabline: refactor s:variables 2018-01-04 18:20:25 +01:00
Christian Brabandt
69aa1e93b3
tabline: add more try/catch for mappings
similar to 2e3cdeb808 add a couple of more try catch statements
around the map_keys() function
2018-01-04 18:15:40 +01:00
Christian Brabandt
645f65d8d9
ctrlspace: wrong separator
under certains circumstances it could happen that for the vim-ctrlspace
tabline extension a tabline group was redefined which would cause a
separator having foreground and background color swapped. This was
caused by using the 'pos' parameter for the right side wrongly.

fixes #1559
2018-01-04 18:07:03 +01:00
Christian Brabandt
45236ba7c7
ctrlspace: refactor s:variables 2018-01-04 17:27:34 +01:00
Christian Brabandt
d78f686ce5
tabline: remove some more s:vars 2018-01-04 14:35:10 +01:00
Christian Brabandt
6ba65b2c8c
tabline: remove s:show_tab_type variable 2018-01-04 14:30:16 +01:00
Christian Brabandt
708c76e22c
tabline: do not cache s:buffer_idx_mode 2018-01-04 14:23:50 +01:00
Christian Brabandt
d03c3fa7b9
tabline: remove l: variable prefix 2018-01-04 14:20:36 +01:00
Christian Brabandt
2e3cdeb808
tabline: try/catch mapping of the keys
fixes #1621
2018-01-04 14:11:11 +01:00
Kyle Holzinger
a3d5e84417 Add formatter for js files 2017-12-28 15:43:13 -05:00
Shohei Fujii
b044b4b204 collapse fname in tabline when using unique_tail formatter 2017-10-30 20:00:05 +09:00
icymind
b6a98bcd10 add option 'keymap_ignored_filetypes' for tabline extensions 2017-08-24 23:22:16 +08:00
tenfy
c0695feb13 Fixes #1515. The tabline will no update when use ctrlspace together.
Do not update tabline when the new buffer is no add to BufferList yes.
It will update by other event later.
2017-08-08 15:07:54 +08:00
Christian Brabandt
62952b3887
tabline: only map keys if not done yet
Should improve performance by not steadily remapping keys
2017-06-27 14:44:03 +02:00
Lingnan Dai
7f19896dc6 Fix problems with AirlineSelect{Prev,Next}Tab
Use the entire list of buffers instead of the currently visible ones
2017-02-28 15:56:37 +00:00
Christian Brabandt
706cee277a Add tab indicator for tabline when buffers are shown
closes #1329
2016-12-16 23:42:58 +01:00
Sam Fuller
7cb5c24151 prevent windows from closing on middle_click
Adding an option to prevent windows from being closed when a buffer in
the tabline is middle clicked and the clicked buffer is currently open
in a window.

When this option is enabled, instead of closing the window a new buffer
will be opened in all of the windows editing the clicked buffer instead.

This is my first pull request AND my first experience with vimscript, so
my apologies if this is a bit sloppy 😄
2016-12-09 13:20:48 +01:00
Shaun Brady
718107c107 Make ...#excludes|exclude_preview runtime configurable
airline#extensions#tabline#excludes and
airline#extensions#tabline#exclude_preview previously had no impact if
changed after vim load.  This fixes that.
2016-12-03 23:40:15 -05:00
Christian Brabandt
04be981de9 make ...#fnamemod configurable during runtime
airline#extensions#tabline#fnamemod would be initialized and could not
be changed during runtime, so fix that.

closes #1347
2016-12-02 13:40:34 +01:00
mhartington
ee8173e41d
feat(): allow for buffer index formatting 2016-11-25 12:36:55 -05:00
thawk
45d77ca909 Add 'scriptencoding utf-8' to all scripts 2016-09-24 08:16:30 +08:00
Christian Brabandt
a6c04644ef Map keys in ctrlspace mode
fixes #1181
2016-07-03 21:09:42 +02:00
Harm te Hennepe
74aacca55d update ctrlspace bufferline to use clickbuf() 2016-06-02 16:00:00 +02:00
Daniel Hahler
5652b576b0 Add bang to function definitions
This makes it easier to reload the files, e.g. via vim-scriptease's
`:Runtime`.
2016-04-20 21:10:28 +02:00
Christian Brabandt
3f2247593a Merge pull request #1117 from 987poiuytrewq/middle_click_buffers
Make middle clickable buffers (only Neovim)
2016-04-19 23:33:11 +02:00
Duncan Williams
0c251e20a7 Add middle click to close buffer functionality
Extended the left click to switch buffer functionality to also
support middle click to delete buffer

documentation of clickable buffers
2016-04-19 20:49:01 +01:00
Shane Smith
a79e35b5e3 Fix tabs theming 2016-04-11 18:22:42 -04:00
Harm te Hennepe
bc7aa0c812 tablineat() support with ctrlspace tabline 2016-03-19 17:38:53 +01:00
Christian Brabandt
d8d08ada7b Make clickable buffers (only Neovim)
fixes #369
2016-03-02 18:47:09 +01:00
Christian Brabandt
a45a96c881 Merge pull request #1063 from sappo/master
Various ctrlspace tabline improvements
2016-03-01 20:40:20 +01:00
Kevin Sapper
ab948735be Problem: Cannot disable tabs for ctrlspace tabline
Solution: Implement the show_tabs option which is used by the default
tabline.
2016-02-25 11:35:52 +01:00
Kevin Sapper
2f2797becb Problem: Cannot disable displaying buffers for ctrlspace tabline
Solution: Implement the show_buffers option which is used by the default
airline tab as well.
2016-02-25 11:19:52 +01:00
Kevin Sapper
ad5194244b Problem: Cannot switch position of tabs and buffers for ctrlspace
tabline
Solution: Add a new option which inverses the position of buffer and
tabs

If switch_buffer_and_tabs is 0 (default) buffer are on the left and tabs
on the right else if is 1 the order is reversed.
2016-02-25 11:03:50 +01:00
Yegor Pomortsev
7453b5e15c Fix buffer modified highlighting being set from wrong buffer
Fixes #1055, cased by refactoring in e4ef624 (#952)
2016-02-24 16:45:17 -08:00
rosston
63f9abd3f2 Fix highlighting of current/modified buffer.
Fixes broken variable reference caused by e4ef624 (#952).
2016-02-22 23:07:27 -05:00
Kevin Sapper
e7edb4c75a Problem: Cannot rename the labels for buffers and tabs
Solution: Add an option for the user to configure those labels and make
the current values the default ones.
2016-02-22 08:30:20 +01:00
Bailey Ling
e6ab7bdf6d show tabs on the left when in tabs mode, splits on the right (#1043) 2016-02-21 15:03:55 -05:00
Bailey Ling
8c080fdf80 Merge pull request #952 from chrisbra/buffer_line
Always display buffer list in tabline
2016-02-20 20:10:12 -05:00
Shanti Bouchez-Mongardé
faa7a18242 Make tabline compatible with bufmru 2016-02-16 21:16:55 +01:00
Christian Brabandt
a2f54ef6e6 add feedback from PR 2016-02-15 20:01:34 +01:00
Christian Brabandt
2c5aa75d5f update according to PR comments 2016-02-11 21:31:42 +01:00
Bailey Ling
e4ef624ea8 tabline for combined buffers/tabs
This is a new tabline extension, that displays both the buffers open and
the available tabs. This has been requested by #639 and fixes #639.

This is based on blings work on branch spike.

This uses the new highlight groups tab*_right, so that the separators
have the correct color. Also this makes some configuration variable
obsolete and therefore, they have been removed.

remove unused combined config variable, remove space after tab
2016-02-10 20:22:35 +01:00
Christian Brabandt
31906ac7b2 Some improvements for the buflist implementation
This should make the buflist algorithm faster.
Also there is an alternative implementation in branch 535 available,
which avoids looping over the complete range, I'll stay with the current
approach, as it does not depend on BufAdd/BufDelete autocommands.

details:
instead of testing for buflisted() and bufexists() we only test for
buflisted() because, this also tests for the existence of the buffer.
Also instead of a second loop of the exclude patterns, we'll join all
of them together with '\|' and check if they match the current buffer.
The rest of the conditions have been joined into a single condition.

This together made up an improvement of
Orig:
FUNCTION  airline#extensions#tabline#buflist#list()
Called 94 times
Total time:   0.267305
 Self time:   0.267305

New:
FUNCTION  airline#extensions#tabline#buflist#list()
Called 85 times
Total time:   0.124572
 Self time:   0.124572
2016-02-09 19:41:17 +01:00
Kevin Sapper
a65000211f Problem: Load check variables has changed
Solution: Use the current one from ctrlspace 5.0 + minor style fixes

Problem: CtrlSpace 5.0 does no longer work with airline
Solution: Modify the ctrlspace extension to call the new APIs

The statusline work fine but the custom ctrlspace function
somehow/somewhere gets overridden and I could not figure out where.
Therefore the user must add

let g:CtrlSpaceStatuslineFunction = "airline#extensions#ctrlspace#statusline()"

to its .vimrc.

Problem: Ctrlspace 5.0 does not integrate well into tabline
Solution: Write a tabline extensions for ctrlspace 5.0.

The extensions is capable of showing both tabs and buffers, but only the
buffers of a current tab are shown.
2016-02-08 08:36:25 +01:00
Christian Brabandt
3f927b587d Revert "remove wrong backslash"
This reverts commit da3f3bf1d7.
2016-02-04 19:03:25 +01:00
Christian Brabandt
da3f3bf1d7 remove wrong backslash 2016-02-04 16:25:27 +01:00
Christian Brabandt
5923ced2b0 clarify buffer_idx mode mappings
Also add mappings for tabmode as suggested.
2016-01-22 20:20:18 +01:00
Christian Brabandt
6c1fb7e275 use silent flag for AirlineSelectTab mappings 2016-01-20 20:07:45 +01:00
Christian Brabandt
db6bf458fb Check window size
Before setting showtabline option, make sure, there is enough room
fixes #863
2016-01-17 18:35:24 +01:00
Bailey Ling
048b24a916 happy 2016! 2016-01-14 21:38:38 -05:00
poppyschmo
a58b3cba55 Sweep tabline of unlisted buffers on each BufLeave 2015-09-25 14:11:07 -07:00
Bailey Ling
cdc6d98a09 Merge pull request #788 from toupeira/patch-1
Remove trailing slashes in unique_tail formatter
2015-07-08 22:28:28 -04:00
Enrico Ghirardi
317e5fa47a Tabline: add exclude_preview option to hide preview buffer 2015-06-28 22:34:37 +02:00