Can't quit vim but still need to tweet? Yap's got you covered.
Finally, you can chase that sweet monetization payout without ever leaving your beloved text editor. Post directly to X (formerly Twitter) from the comfort of your modal editing paradise.
- Post tweets using the
:Yap
command - Multi-line tweet composer with text wrapping
- Real-time character count display
- OAuth 1.0a authentication
- Secure credential management via environment variables
- Character count validation
- 500 posts per month (X API limit - after that you're back to the web app like a caveman)
- Neovim 0.7+ (obviously)
curl
andopenssl
(you probably have these)- X Developer account with API credentials
- An irrepressible need to share your thoughts without leaving the terminal
Using lazy.nvim
{
"carldaws/yap.nvim",
opts = {},
cmd = "Yap",
}
Using packer.nvim
use {
"carldaws/yap.nvim",
config = function()
require("yap").setup()
end,
}
- Go to X Developer Portal
- Create a new app (or use an existing one)
- In your app settings, ensure you have Read and Write permissions (you'll have to setup the app as if you'll use Sign in with X to enable read and write permissions)
- Get the access token and secret for your account by going to the Keys and tokens section of the app on your developer dashboard
- Make a note of the following credentials:
- API Key (Consumer Key)
- API Secret (Consumer Secret)
- Access Token
- Access Token Secret
There are two ways to provide your X API credentials:
Add these to your shell configuration (~/.bashrc
, ~/.zshrc
, etc.):
export X_API_KEY="your_api_key_here"
export X_API_SECRET="your_api_secret_here"
export X_ACCESS_TOKEN="your_access_token_here"
export X_ACCESS_TOKEN_SECRET="your_access_token_secret_here"
require("yap").setup({
api_key = "your_api_key_here",
api_secret = "your_api_secret_here",
access_token = "your_access_token_here",
access_token_secret = "your_access_token_secret_here",
post_key = "<C-p>", -- Optional: customize the keybind (default: <C-p>)
})
Security Note:
- NEVER commit credentials directly in your config if your dotfiles are public
- Environment variables are the safer option for most users
- Consider using a local, untracked file to store credentials if you must use setup options
:Yap
Opens a floating window where you can compose your tweet:
- Write multi-line tweets with proper text wrapping
- See real-time character count in the window title
- Press
<C-p>
(or your custom keybind) in normal mode to post - Press
:q
to cancel
:Yap Just posted a tweet without leaving Neovim. I am become productivity, destroyer of context switches.
Posts the text immediately without opening the composer.
:Yap vim > emacs
<C-p>
- Post the tweet (customizable viapost_key
option):q
- Cancel and close the composer:Send
- Alternative command to post the tweet
Tweets are limited to 280 characters, just like the real thing. The composer shows a real-time character count, and the plugin will show an error if you exceed this limit.
Remember: X's free tier gives you 500 posts per month. Use them wisely, or you'll be reduced to posting through a... shudders ...web browser.
- Ensure all four credentials are provided either via environment variables or setup options
- Environment variables must be exported (use
export
in your shell config) - Restart Neovim after setting environment variables
- Verify your credentials are correct
- Ensure your app has Read and Write permissions
- Check that your access tokens haven't been revoked
Check your internet connection and ensure X's API is accessible from your network.
MIT