A Neovim plugin for creating beautiful code screenshots using goshot.
You should be able to install this plugin using your favorite package manager. For copy to clipboard to work, you may need to install xclip
, wl-clipboard
, or pbcopy
on your system.
The plugin can automatically install the goshot
binary for you, or you can install it manually and ensure it's in your PATH
.
Using lazy.nvim:
{
"watzon/goshot.nvim",
cmd = "Goshot",
opts = {
binary = "goshot", -- Path to goshot binary (default: "goshot")
auto_install = false, -- Automatically install goshot if not found (default: false)
},
}
Using packer.nvim:
use({
"watzon/goshot.nvim",
cmd = "Goshot",
config = function()
require("goshot").setup({
binary = "goshot", -- Path to goshot binary (default: "goshot")
auto_install = false, -- Automatically install goshot if not found (default: false)
})
end,
})
The plugin provides the following commands:
-
:Goshot [options]
- Create a screenshot of the current buffer or visual selection. Since it uses thegoshot
binary, any options supplied in your config file will be used, leading to more reproducible screenshots. See the goshot wiki for more details. -
:GoshotInstall
- Install or update the goshot binary. This will download the latest release from GitHub and install it in your Neovim data directory.
" Create a screenshot of the entire buffer
:Goshot
" Create a screenshot with a specific theme
:Goshot -t dracula
" Create a screenshot with custom styling
:Goshot -t dracula --corner-radius 8 --background "#282a36"
" Create a screenshot of selected lines (in visual mode)
:'<,'>Goshot
You can use the :Goshot
command in visual mode to capture only the selected lines. Simply:
- Enter visual mode (
v
,V
, or<C-v>
) - Select the lines you want to capture
- Type
:Goshot
(it will automatically add the'<,'>
range)
The plugin will automatically pass the correct line range to goshot.
The plugin can be configured with the following options:
require("goshot").setup({
-- Path to the goshot binary
-- If not found in PATH and auto_install is true, will be installed automatically
binary = "goshot",
-- Whether to automatically install goshot if not found
auto_install = false,
})