Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/kode-team/mastodon.nvim
Mastodon client for Neovim
https://github.com/kode-team/mastodon.nvim
lua mastodon mastodon-client neovim neovim-plugin
Last synced: about 17 hours ago
JSON representation
Mastodon client for Neovim
- Host: GitHub
- URL: https://github.com/kode-team/mastodon.nvim
- Owner: kode-team
- Created: 2022-11-14T10:04:03.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2023-09-30T08:53:21.000Z (over 1 year ago)
- Last Synced: 2024-04-13T14:06:11.480Z (10 months ago)
- Topics: lua, mastodon, mastodon-client, neovim, neovim-plugin
- Language: Lua
- Homepage:
- Size: 9 MB
- Stars: 75
- Watchers: 4
- Forks: 5
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Mastodon Client for Neovim
![GitHub Workflow Status](https://img.shields.io/github/workflow/status/ellisonleao/nvim-plugin-template/default?style=for-the-badge)
![Lua](https://img.shields.io/badge/Made%20with%20Lua-blueviolet.svg?style=for-the-badge&logo=lua)mastodon.nvim is Mastodon Client for Neovim.
## Demo
* Loading bookmarks
![Loading bookmarks](assets/keymap-for-load-bookmark.gif)
* Adding bookmark
![Adding bookmark](assets/keymap-for-add-bookmark.gif)
* Reloading statuses
![Reloading statuses](assets/keymap-for-reload-status.gif)
* Replying to status
![Replying to status](assets/keymap-for-reply.gif)
* Switching account
![Selecting Account](assets/keymap-for-select-account.gif)
## Requirements
* Neovim >= 0.8
* Neovim plugin
* nvim-lua/plenary.nvim
* rcarriga/nvim-notify
* kkharji/sqlite.lua## Installation
### using packer.nvim
If you are using packer.nvim, you can install this plugin as below:
```lua
use {
"kode-team/mastodon.nvim",
requires = {
"nvim-lua/plenary.nvim",
"rcarriga/nvim-notify",
"kkharji/sqlite.lua",
},
config = function()
require("mastodon").setup()
end
}
```### using lazy.nvim
If you are using lazy.nvim, you can install this plugin as below:
```lua
{
"kode-team/mastodon.nvim",
dependencies = {
"nvim-lua/plenary.nvim",
"rcarriga/nvim-notify",
"kkharji/sqlite.lua",
},
config = function()
require("mastodon").setup()
end
}
```(thanks to @kimusan)
## Usage
### (Important) Adding mastodon account
Before using this plugin, you need to add your mastodon account using `MastodonAddAccount` command. With this command, you can switch to the account using `MastodonSelectAccount`
For the detail, follow the guide below:
(Click me)
1) Go to `/settings/applications`, and Click `New Application` button
![adding-account-browser-step-1](assets/adding-account-browser-1.png)
2) Fill in the form freely and Check proper permissions as below
![adding-account-browser-step-2](assets/adding-account-browser-2.png)
3) After creating new application, Copy the `ACCESS TOKEN`
![adding-account-browser-step-3](assets/adding-account-browser-3.png)
4) Go back to the neovim, and Enter `:MastodonAddAccount`
![adding-account-cmd-step-1](assets/adding-account-cmd-1.png)
5) Enter your mastodon instance's url
![adding-account-cmd-step-2](assets/adding-account-cmd-2.png)
6) Enter your access token
![adding-account-cmd-step-3](assets/adding-account-cmd-3.png)
7) After adding account, make sure that your mastodon account is available. Switch to your account using `:MastodonSelectAccount` command, and Watch your home timeline using `:MastodonLoadHomeTimeline` command. That's all!
### Loading Timeline
With `MastodonLoadHomeTimeline` command, you can see your account's home timeline.
### Switching to another account
If you want to switch to another account, you can use `MastodonSelectAccount` command.
## Keymap
### Buffer-wide / System-wide keymap
> **Buffer-wide or system-wide keymap starts with `,m`**
For buffer-wide keymap, you can call those keymap within only `Mastodon Buffer`:
* `,mr` - Refreshes current `Mastodon Buffer`
For system-wide keymap, you can call those keymap in anywhere:
* `,mw` - alias for `MastodonTootMessage` command
* `,ms` - alias for `MastodonSelectAccount` command
* `,mh` - alias for `MastodonLoadHomeTimeline` command
* `,mf` - alias for `MastodonLoadFavourites` command
* `,mb` - alias for `MastodonLoadBookmarks` command### Status-wide keymap
> **Status-wide keymap starts with `,t`**
Within `Mastodon Buffer`, each line has metadata which includes status's id and url. Through those status-wide keymap, the keymap takes status's id from current line's metadata, and fetches status, and enable you take action:
* `,tr` - Enables you to reply current status
* `,tb` - Enables you to add current status to bookmarks
* `,tf` - Enables you to add current status to favourites
* `,tB` - Enables you to boost current status
* `,tv` - Enables you to see current status's raw data## Configuration
```lua
require("mastodon").setup({
keymaps = {
["buffer-wide-keymaps"] = {
["reload-statuses"] = ",mr",
["scroll-to-top"] = ",mk",
["scroll-to-bottom"] = ",mj",["reply"] = ",tr",
["bookmark"] = ",tb",
["favourite"] = ",tf",
["boost"] = ",tB",
["print"] = ",tv",
},
["system-wide-keymaps"] = {
["home-timeline"] = ",mh",
["bookmarks"] = ",mb",
["favourites"] = ",mf",
["mentions"] = ",mR",["post-message"] = ",mw",
["select-account"] = ",ms",
},
}
})
```# Explanation for developers
## Project Structure
```sh
.
├── Makefile
├── README.md
├── lua
│ ├── mastodon
│ │ ├── actions.lua
│ │ ├── api_client.lua
│ │ ├── commands.lua
│ │ ├── db_client.lua
│ │ ├── parser.lua
│ │ ├── renderer.lua
│ │ └── utils.lua
│ └── mastodon.lua
```## Testing
Just run commands as below:
```sh
$ make
```