Skip to content

Commit

Permalink
Update readme.md
Browse files Browse the repository at this point in the history
  • Loading branch information
pablopunk committed Jan 24, 2024
1 parent b0adfc1 commit 78d9579
Showing 1 changed file with 54 additions and 43 deletions.
97 changes: 54 additions & 43 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,40 @@
![before-after](./art/before-after-light.png#gh-light-mode-only)
![before-after](./art/before-after-dark.png#gh-dark-mode-only)


- [Installation](#installation)
- [Lazy.nvim](#lazynvim)
- [Packer.nvim](#packernvim)
- [Features](#features)
- [Only show the buffers you need](#only-show-the-buffers-you-need)
- [🔭 Telescope integration]()
- [Customization](#customization)
- [Utils](#utils)
- [Inspiration](#inspiration)


## Installation

Use your favorite package manager. Calling the `setup()` function is optional.

### Lazy.nvim

```lua
{
"pablopunk/unclutter.nvim",
dependencies = { "nvim-tree/nvim-web-devicons" }, -- optional, to show icons on tabs
}
```

### Packer.nvim

```lua
use {
"pablopunk/unclutter.nvim",
requires = { "nvim-tree/nvim-web-devicons" }, -- optional, to show icons on tabs
}
```

## Features

You're working on a large project and you're jumping through function definitions and index files that endup cluttering your tabline. *Unclutter.nvim* will:
Expand All @@ -23,27 +57,35 @@ A minimal tabline with icons will show:

Every other buffer will be closed at the time you leave it (`BufLeave`).

[🔭 Telescope integration](#telescopenvim-integration)
### 🔭 `telescope.nvim` integration

## Installation
If you use [telescope.nvim](https://github.com/nvim-telescope/telescope.nvim), you can use it to list all your `unclutter.nvim` in a floating window:

Use your favorite package manager. Calling the `setup()` function is optional.
```lua
require('unclutter').telescope()
```

### Lazy.nvim
Of course, you can map it to whatever you want:

```lua
{
"pablopunk/unclutter.nvim",
dependencies = { "nvim-tree/nvim-web-devicons" }, -- optional, to show icons on tabs
}
vim.keymap.set("n", "<leader>b", require("unclutter").telescope, { noremap = true })
```

### Packer.nvim
![telescope integration](./art/telescope-integration.png)

You can customize the format of the telescope results:

```lua
use {
"pablopunk/unclutter.nvim",
requires = { "nvim-tree/nvim-web-devicons" }, -- optional, to show icons on tabs
unclutter.telescope { format = "compact" } -- DEFAULT: folder/file.js
unclutter.telescope { format = "cwd" } -- path/folder/file.js
unclutter.telescope { format = "filename" } -- file.js
```

If you want to use the telescope integration without the tabline, you can disable it:

```lua
require('unclutter').setup {
tabline = false,
}
```

Expand Down Expand Up @@ -92,37 +134,6 @@ vim.keymap.set("n", "gp", unclutter.prev, { noremap = true })

I personally have a map to save a file to disk (`<c-s>` will `:w`) so the buffer will be kept in the tabline whenever I do `<c-s>`.

## `telescope.nvim` integration

If you use [telescope.nvim](https://github.com/nvim-telescope/telescope.nvim), you can use it to list all your `unclutter.nvim` in a floating window:

```lua
require('unclutter').telescope()
```

Of course, you can map it to whatever you want:

```lua
vim.keymap.set("n", "<leader>b", require("unclutter").telescope, { noremap = true })
```

![telescope integration](./art/telescope-integration.png)

You can customize the format of the telescope results:

```lua
unclutter.telescope { format = "compact" } -- DEFAULT: folder/file.js
unclutter.telescope { format = "cwd" } -- path/folder/file.js
unclutter.telescope { format = "filename" } -- file.js
```

If you want to use the telescope integration without the tabline, you can disable it:

```lua
require('unclutter').setup {
tabline = false,
}
```

## Inspiration

Expand Down

0 comments on commit 78d9579

Please sign in to comment.