Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 20 additions & 5 deletions .config/nvim/lua/config/autocmds.lua
Original file line number Diff line number Diff line change
Expand Up @@ -156,23 +156,38 @@ vim.api.nvim_create_autocmd("QuitPre", {
-- terminal is in normal mode. Useful visual reminder so you don't start typing
-- and then wonder why text is not showing up.

-- Custom highlight group we'll use in a moment
vim.api.nvim_set_hl(0, "TermCursorLine", { bg = "#5f0000" })
-- Custom highlight group we'll use in a moment. It uses the current
-- colorscheme's Comment color
local comment_fg = vim.api.nvim_get_hl(0, { name = "Comment" }).fg
vim.api.nvim_set_hl(0, "TermCursorLine", { bg = comment_fg })

-- winhighlight lets us render CursorLin higlights with TermCursorLine's
-- attributes, but just local to that window (here, the terminal)
local function apply_term_winhl()
if vim.bo.buftype == "terminal" then
vim.wo.winhighlight = "CursorLine:TermCursorLine"
if vim.bo.buftype ~= "terminal" then
return
end
-- toggleterm sets its own winhighlight (Normal:ToggleTermNNormal, etc.) to
-- give terminals a distinct background. Append our mapping instead of
-- overwriting so we don't clobber it.
local existing = vim.wo.winhighlight
if existing:find("CursorLine:TermCursorLine", 1, true) then
return
end
vim.wo.winhighlight = (existing == "" and "" or existing .. ",")
.. "CursorLine:TermCursorLine"
end

local group = vim.api.nvim_create_augroup("ToggleTermCursorLine", { clear = true })

-- Catch new terminals and existing ones
vim.api.nvim_create_autocmd({ "TermOpen", "WinEnter", "BufWinEnter" }, {
group = group,
callback = apply_term_winhl,
callback = function()
-- defer applying the window-specific highlighting so toggleterm's own
-- winhighlight setup runs first on TermOpen
vim.schedule(apply_term_winhl)
end,
})

-- Toggle cursorline only inside terminal windows
Expand Down
3 changes: 3 additions & 0 deletions .config/nvim/lua/plugins/pasteimg.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
return {
"daler/pasteimg.nvim",
}
18 changes: 18 additions & 0 deletions docs/changelog.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,24 @@
Changelog
=========

2026-05-28
----------

**vim**

- Add [pasteimg](https://github.com/daler/pasteimg.nvim) plugin
- Improve toggleterm "non-insert mode" cursorline:
- use the Comment color of the initially-loaded colorscheme instead of a hard-coded red
- don't clobber the custom background that toggleterm sets

2026-05-07
----------

**vim**

Color the cursorline in toggleterm terminal when it's not in insert mode. Gives
a visual reminder of when typing won't do what you expect.

2026-05-07
----------

Expand Down
37 changes: 24 additions & 13 deletions docs/nvim-plugins.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1085,6 +1085,10 @@ the terminal use.
terminal, or use :kbd:`a` or :kbd:`i` in the terminal to get back to insert
mode.

Starting from 2026-05-07, when the terminal is not in insert mode, the
terminal-specific cursorline will be a different color to help indicate the
status.

.. list-table::
:header-rows: 1
:align: left
Expand Down Expand Up @@ -1480,20 +1484,16 @@ and this:
.. plugin-metadata::
:name: treesj

.. _imgclip_ref:
.. _pasteimg_ref:

``img-clip.nvim``
``pasteimg.nvim``
~~~~~~~~~~~~~~~~~

`img-clip.nvim <https://github.com/HakonHarnes/img-clip.nvim>`__ lets you paste
an image on your clipboard into a Markdown, Latex, or ReST file.

It detects what sort of image is on the clipboard, pastes it into a file in the
current directory (that you name at the prompt), and inserts it as an image
link into the document.
`pasteimg.nvim <https://github.com/daler/pasteimg.nvim>`__ supports pasting
images to a remote system over SSH by locally converting the image to base64
text on the clipboard.

On Mac, it needs `pngpaste <https://github.com/jcsalterego/pngpaste>`__ to be
installed and on your PATH.
See the docs for the plugin on how to set it up, including a macOS Shortcut.

.. list-table::
:header-rows: 1
Expand All @@ -1502,11 +1502,14 @@ installed and on your PATH.
* - command
- description

* - :kbd:`<leader>P`
- Paste image on clipboard
* - ``:PasteImgFromPayload`` on a line
- Converts the base64 text on the line to an image, saves it, and inserts a link to it.

.. plugin-metadata::
:name: img-clip
:name: pasteimg

.. _imgclip_ref:


.. colorschemes_ref:

Expand Down Expand Up @@ -1611,6 +1614,14 @@ Deprecated plugins
:name: vim-sleuth
:deprecation: vim-sleuth would often get things wrong. indent-o-matic's simpler algorithm seems to work better.

``img-clip.nvim``
~~~~~~~~~~~~~~~~~

.. plugin-metadata::
:name: img-clip.nvim
:deprecation: This was only included for a short time; it didn't work on remote systems so I wrote :ref:`pasteimg_ref` and used that instead.


Notes on tried plugins
----------------------

Expand Down
Loading