Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

README fix #71

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
250 changes: 105 additions & 145 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,32 +1,61 @@
# vim-buffet

**Note: this plugin has been renamed from `vim-workspace` and thus has also
<h1 align="center">
<br>
<img src="https://image.flaticon.com/icons/svg/531/531193.svg" alt="Markdownify" width="200">
<br>
vim-buffet
<br>
</h1>

<div align="center">
<b>Brings you the IDE-like tabs into Vim, for easy navigation, and a nice,
customizable look.</b>
</div>

<div align="center"> &nbsp; </div>

<p align="center">
<a href=""><img src="https://img.shields.io/badge/chat-gitter-orange"></a>
<a href="https://saythanks.io/to/amitmerchant1990">
<img src="https://img.shields.io/badge/SayThanks.io-%E2%98%BC-1EAEDB.svg">
</a>
</p>

<p align="center">
<a href="#installation">Installation</a> •
<a href="#usage">Usage</a> •
<a href="#recommendations">Recommendations</a> •
<a href="#faq">FAQ</a> •
<a href="#credits">Credits</a> •
<a href="#license">License</a>
</p>

**Note:** This plugin has been renamed from `vim-workspace` and thus has also
different prefix for the configuration and commands. Please revisit the README
and use the new names of the configuration parameters, highlight groups and
commands. Sorry for inconvenience.**
commands. Sorry for inconvenience.

If you are new to the Vim world, then welcome, and start by learning Vim's
notions of [buffers, windows](http://vimdoc.sourceforge.net/htmldoc/windows.html)
and [tabpages](http://vimdoc.sourceforge.net/htmldoc/tabpage.html).

But if you are an experienced Vim user, you might have got tired of `bn/bp/ls/Ctrl-^`.

`vim-buffet` brings the IDE-like tabs into Vim, for easy navigation, and a nice,
customizable look. It takes your buffers and tabs, and shows them combined in the
tabline. With this you always have your list of buffers visible, at the same
time not losing visibility into tabs. Moreover, `vim-buffet` provides handy
commands to boost navigation as well as a list of options to customize how the
tabline appears.

## Introduction

<h3 align="center">
<img
src="https://raw.githubusercontent.com/bagrat/vim-buffet/e915a9f0627228c317a7498c800208813c0298c3/demo.png"
alt="vim-buffet Screenshot"
/>
</h3>

Vim-buffet takes your buffers and tabs, and shows them combined in the
tabline. With this you always have your list of buffers visible, at the same
time not losing visibility into tabs. Moreover, `vim-buffet` provides handy
commands to boost navigation as well as a list of options to customize how the
tabline appears.

If you are new to the Vim world, then welcome, and start by learning Vim's
notions of [buffers, windows](http://vimdoc.sourceforge.net/htmldoc/windows.html)
and [tabpages](http://vimdoc.sourceforge.net/htmldoc/tabpage.html).

But if you are an experienced Vim user, you might have got tired of `bn/bp/ls/Ctrl-^`.

Take a look at the screenshot. The blue cuties are the tabpages. The tabpage
that has the buffers list coming next, is the current tabpage. The gray items
with names are the hidden/inactive buffers, and obviously, the green one is the
Expand All @@ -47,6 +76,8 @@ below.*
/>
</h3>



## Installation

Use your favourite plugin manager to install `vim-buffet`. If you do not have any
Expand All @@ -59,7 +90,10 @@ Plug 'bagrat/vim-buffet'
After installation, `vim-buffet` is enabled by default, so whenever you restart
Vim, you will see the new tabline!

## Commands


## Usage
### Commands

Apart from listing the buffers in the tabline, `vim-buffet` also provides some
handy commands to manipulate the buffers:
Expand All @@ -71,7 +105,7 @@ handy commands to manipulate the buffers:
in the list that has unsaved changes, those will not be wiped. To ignore any
changes and forcibly wipe all buffers except the current one, use `Bonly!`.

## Mappings
### Mappings

Mappings for switching buffers are also provided. You just need to add the following
mappings to your Vimrc file:
Expand All @@ -92,134 +126,44 @@ nmap <leader>0 <Plug>BuffetSwitch(10)
This will allow you to switch between buffers 1 - 10. You can get more `<Plug>`
mappings, or disable it completely, by configuring the `g:buffet_max_plug` option.

## Configuration
### Configuration

There are some configuration options that make it possible to customize how the
tabline works and looks like.

### Options

The following is the list of available options, that should be set in your
Vimrc file, using `let <optiona-name> = <option-value>`:

* `g:buffet_always_show_tabline` - if set to `0`, the tabline will only be shown if
there is more than one buffer or tab open.

Default:
```
let g:buffet_always_show_tabline = 1
```

* `g:buffet_powerline_separators` - if set to `1`, use powerline separators
in between buffers and tabs in the tabline (see the first screenshot).

Default:
```
let g:buffet_powerline_separators = 0
```

* `g:buffet_separator` - the character to be used for separating items in the tabline.

Default:
```
let g:buffet_separator = ""
```

* `g:buffet_show_index` - if set to `1`, show index before each buffer name. Index is
useful for switching between buffers quickly.

Default:
```
let g:buffet_show_index = 0
```

* `g:buffet_max_plug` - the maximum number of `<Plug>BuffetSwitch` provided. Mapping
will be disabled if the option is set to `0`.

Default:
```
let g:buffet_max_plug = 10
```

* `g:buffet_use_devicons` - if set to `1` and
[`vim-devicons`](https://github.com/ryanoasis/vim-devicons) plugin is
installed, show file type icons for each buffer in the tabline. If the
`vim-devicons` plugin is not present, the option will automatically default to
`0`.

Default:
```
let g:buffet_use_devicons = 1
```

*Note: you need to have `vim-devicons` loaded before `vim-buffet` in order to
make this work.*

* `g:buffet_tab_icon` - the character to be used as an icon for the tab items
in the tabline.

Default:
```
let g:buffet_tab_icon = "#"
```

* `g:buffet_new_buffer_name` - the character to be shown as the name of a new
buffer.

Default:
```
let g:buffet_new_buffer_name = "*"
```

* `g:buffet_modified_icon` - the character to be shown by the name of
a modified buffer.
Default:

```
let g:buffet_modified_icon = "+"
```

* `g:buffet_left_trun_icon` - the character to be shown by the count of
truncated buffers on the left.

Default:
```
let g:buffet_left_trunc_icon = "<"
```

* `g:buffet_right_trun_icon` - the character to be shown by the count of
truncated buffers on the right.

Default:
```
let g:buffet_right_trunc_icon = ">"
```

* `g:buffet_hidden_buffers` - the types of buffers to hide from the tabline

Default:
```
let g:buffet_hidden_buffers = ["terminal", "quickfix"]
```
Note: this has the side effect of making all matching buffers unlisted

### Colors
#### Options

| Options | Default | Descriptions |
| --- | --- | --- |
| `g:buffet_always_show_tabline` | 1 | Set to `0`, the tabline will only be shown if there is more than one buffer or tab open |
| `g:buffet_powerline_separators` | 0 | Set to `1`, use powerline separators in between buffers and tabs in the tabline (see the first screenshot) |
| `g:buffet_separator` | '' | The character to be used for separating items in the tabline |
| `g:buffet_show_index` | 0 | Set to `1`, show index before each buffer name. Index is useful for switching between buffers quickly |
| `g:buffet_max_plug` | 10 | The maximum number of `<Plug>BuffetSwitch` provided. Mapping will be disabled if the option is set to `0` |
| `g:buffet_use_devicons` | 1 | If set to `1` and [`vim-devicons`](https://github.com/ryanoasis/vim-devicons) plugin is installed, show file type icons for each buffer in the tabline. If the `vim-devicons` plugin is not present, the option will automatically default to `0` (*Note: you need to have `vim-devicons` loaded before `vim-buffet` in order to make this work*) |
| `g:buffet_tab_icon` | '#' | The character to be used as an icon for the tab items in the tabline |
| `g:buffet_new_buffer_name` | "\*" | The character to be shown as the name of a new buffer |
| `g:buffet_modified_icon` | "+" | The character to be shown by the name of a modified buffer |
| `g:buffet_left_trun_icon` | "<" | - the character to be shown by the count of truncated buffers on the left |
| `g:buffet_right_trun_icon` | ">" | the character to be shown by the count of truncated buffers on the right |
| `g:buffet_hidden_buffers` | ["terminal", "quickfix"] | the types of buffers to hide from the tabline (*Note: This has the side effect of making all matching buffers unlisted)* |

#### Colors

Of course, you can customize the colors of your tabline, to make it awesome and
yours. The following is the list of highlight groups, with self-explanatory
names:

* `BuffetCurrentBuffer` - the current buffer.
* `BuffetActiveBuffer` - an active buffer (a non-current buffer visible in
a non-current window).
* `BuffetBuffer` - a non-current and non-active buffer.
* `BuffetModCurrentBuffer` - the current buffer when modified.
* `BuffetModActiveBuffer` - a modified active buffer (a non-current buffer visible in
a non-current window).
* `BuffetModBuffer` - a modified non-current and non-active buffer.
* `BuffetTrunc` - the truncation indicator (count of truncated buffers
from the left or right).
* `BuffetTab` - a tab.
| Highlights | Descriptions |
| --- | --- |
| `BuffetCurrentBuffer` | The current buffer.
| `BuffetActiveBuffer` | An active buffer (a non-current buffer visible in a non-current window) |
| `BuffetBuffer` | A non-current and non-active buffer.
| `BuffetModCurrentBuffer` | The current buffer when modified.
| `BuffetModActiveBuffer` | A modified active buffer (a non-current buffer visible in a non-current window). |
| `BuffetModBuffer` | A modified non-current and non-active buffer.
| `BuffetTrunc` | The truncation indicator (count of truncated buffers from the left or right) |
| `BuffetTab` | A tab |

**Note:** To get your custom colors set, define a function with name
`g:BuffetSetCustomColors` and place your highlight group definitions inside
Expand All @@ -233,7 +177,9 @@ function! g:BuffetSetCustomColors()
endfunction
```

## Recommendations and FAQ


## Recommendations

Here are some recommended mappings to boost your navigation experience:

Expand All @@ -245,10 +191,11 @@ noremap <Leader><S-Tab> :Bw!<CR>
noremap <C-t> :tabnew split<CR>
```

### FAQ

#### **How do I get the look like in the screenshot?**

## FAQ
<details><summary><b>How do I get the look like in the screenshot?</b></summary>
<p>
First you will need a patched font, extended with `powerline` and `font-awesome`
symbols. Also, you will need the
[`vim-devicons`](https://github.com/ryanoasis/vim-devicons) installed, which
Expand All @@ -265,17 +212,22 @@ let g:buffet_right_trunc_icon = "\uf0a9"

*Note: you need to have `vim-devicons` loaded before `vim-buffet` in order to
make this work.*
</p>
</details>

#### **How to have the current buffer open in a new tab instead of a new one?**

<details><summary><b>How to have the current buffer open in a new tab instead of a new one?</b></summary>
<p>
Just add this mapping to your Vimrc:

```
map <C-t> :tab split<CR>
```
</p>
</details>

#### **I can only see the current active buffer in the tabline**

<details><summary><b>I can only see the current active buffer in the tabline</b></summary>
<p>
The reason is that you probably use some statusline plugin (e.g. lightline,
airline) that also has tabline support, which overrides vim-buffet. All you need
to do is disable the tabline of the statusline plugin. For Lightline, it should
Expand All @@ -284,8 +236,16 @@ be something like this:
```
let g:lightline.enable.tabline = 0
```
</p>
</details>



## Credits
<div>The icon in the header is made by <a href="https://www.flaticon.com/authors/freepik" title="Freepik">Freepik</a> from <a href="https://www.flaticon.com/" title="Flaticon">www.flaticon.com</a></div>



## License

See
[LICENSE](https://github.com/bagrat/vim-buffet/blob/master/LICENS://github.com/bagrat/vim-buffet/blob/master/LICENSE).
See [LICENSE](https://github.com/bagrat/vim-buffet/blob/master/LICENS://github.com/bagrat/vim-buffet/blob/master/LICENSE).
Loading