Skip to content

Commit

Permalink
Merge pull request #10 from dpi0/docs/improve-readme
Browse files Browse the repository at this point in the history
Improve README.md with a better presentation
  • Loading branch information
itmecho authored Sep 27, 2024
2 parents 7d2d9b9 + 295ad31 commit 7c90ed0
Showing 1 changed file with 81 additions and 49 deletions.
130 changes: 81 additions & 49 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,27 +1,47 @@
# Neoterm
<div align = "center">

Simple neovim terminal plugin written in lua. Terminal runs in a floating window in a configurable position.
<h1>Neoterm.nvim</h1>

Requires `neovim` 0.7+ for access to the lua autocmd API.
<p align="center">
<img src="https://img.shields.io/github/stars/itmecho/neoterm.nvim?style=flat-square&color=yellow" alt="Stars">
<img src="https://img.shields.io/github/forks/itmecho/neoterm.nvim?style=flat-square" alt="Forks">
<img src="https://img.shields.io/github/contributors/itmecho/neoterm.nvim?style=flat-square&color=pink" alt="Contributors">
<img src="https://img.shields.io/github/license/itmecho/neoterm.nvim?style=flat-square" alt="License">
</p>

# Usage
<h4>Simple floating terminal plugin for neovim written in Lua.</h4>

Neoterm provides both vim commands as well as a lua API
![title](https://github.com/user-attachments/assets/00d9942a-d650-42a3-b81e-cc9ba69fa11d)

## Commands
</div>

Neoterm provides the following commands

| Command | Description |
| -------------------- | -------------------------------------------------------------------------------------- |
| `NeotermOpen` | Open the neoterm window |
| `NeotermClose` | Close the neoterm window |
| `NeotermToggle` | Toggle the neoterm window |
| `NeotermRun <args>` | Run the given command in the neoterm window |
| `NeotermRerun` | Run the previous command again |
| `NeotermExit` | Close the neoterm window and delete the terminal buffer |
## ⚡ Installation

Requires `neovim` 0.7+ for access to the Lua Autocmd API.

[lazy.nvim](https://github.com/folke/lazy.nvim)

```lua
{
'itmecho/neoterm.nvim',
}
```

## Lua API
[packer.nvim](https://github.com/wbthomason/packer.nvim)

```lua
use {
'itmecho/neoterm.nvim',
}
```


## 💡 Usage

Neoterm provides both vim commands as well as a Lua API.

### Configuration

The following functions are available on the neoterm module. They map directly to the commands above

Expand Down Expand Up @@ -49,7 +69,33 @@ neoterm.rerun()
neoterm.exit()
```

# Example Keybindings
### Deprecation Notice

> [!WARNING]
> The `mode` option is deprecated. Please use the new `position` option instead.
#### Migration Guide

- `mode = vertical``position = right`

- `mode = horizontal``position = bottom`

- `mode = fullscreen``position = fullscreen`

### Commands

Neoterm provides the following commands

| Command | Description |
| -------------------- | -------------------------------------------------------------------------------------- |
| `NeotermOpen` | Open the neoterm window |
| `NeotermClose` | Close the neoterm window |
| `NeotermToggle` | Toggle the neoterm window |
| `NeotermRun <args>` | Run the given command in the neoterm window |
| `NeotermRerun` | Run the previous command again |
| `NeotermExit` | Close the neoterm window and delete the terminal buffer |

### Example Vim Keybindings

```vim
nnoremap <leader>tt <cmd>NeotermToggle<CR>
Expand All @@ -61,62 +107,48 @@ tnoremap <leader>tt <cmd>NeotermToggle<CR>
tnoremap <leader>tx <cmd>NeotermExit<CR>
```

# Screenshots
## 🔍 Screenshots

## Right (default)
### `right`
```lua
require('neoterm').open()
-- or
require('neoterm').open({ position = 'right' })
-- or
require('neoterm').open({ position = 2 })
```
![position-right](https://github.com/user-attachments/assets/f60ded98-8be4-4dd6-a77b-757ece4f5d84)

## Top
![position-right](https://github.com/user-attachments/assets/edcb4bcd-12a7-40b7-b95d-7658c835f69c)

### `top`
```lua
require('neoterm').open({ position = 'top', height = 0.6 })
```
![position-top](https://github.com/user-attachments/assets/3aba21d5-b0b2-4250-a415-cc478916c90a)

## Bottom
![position-top](https://github.com/user-attachments/assets/18a984a2-4ea5-4f9c-a123-4631ac25bcb2)

### `bottom`
```lua
require('neoterm').open({ position = 'bottom' })
--or
require('neoterm').open({ position = 3 })
```
![position-bottom](https://github.com/user-attachments/assets/4c3f557c-44ca-4894-a75d-ef45a3943942)

## Left
```lua
require('neoterm').open({ position = 'left', width = 0.7 })
```
![position-left](https://github.com/user-attachments/assets/812a7d5b-31ed-4061-9bc8-93236b0763f4)
![position-bottom](https://github.com/user-attachments/assets/9a40db31-22b2-4e6d-9213-744e0de73498)

## Center
```lua
require('neoterm').open({ position = 'left', width = 0.6, height = 0.6 })
```
![position-center](https://github.com/user-attachments/assets/4cbbf668-c7d4-43ee-a9a6-2e5a6ba3b9fb)

## Fullscreen
### `left`
```lua
require('neoterm').open({ position = 'fullscreen' })
require('neoterm').open({ position = 'left', width = 0.3 })
-- or
require('neoterm').open({ position = 0 })
require('neoterm').open({ position = 4 })
```
![position-fullscreen](https://github.com/user-attachments/assets/9423e593-2c86-48aa-8cba-49024c38e3be)

![position-left](https://github.com/user-attachments/assets/9d0de2ad-af8d-4c3f-a4a8-908dc907aa14)

## Deprecation Notice
## Contributors

> [!WARNING]
> The `mode` option is deprecated. Please use the new `position` option instead.
Thanks to all contributors!

#### Migration Guide

- `mode = vertical``position = right`

- `mode = horizontal``position = bottom`

- `mode = fullscreen``position = fullscreen`
<a href="https://github.com/itmecho/neoterm.nvim/graphs/contributors">
<img src="https://contrib.rocks/image?repo=itmecho/neoterm.nvim" />
</a>

0 comments on commit 7c90ed0

Please sign in to comment.