vim-test #

Using vim-test with #vim, #til how to scroll the :terminal. Just hit <C-o>. Scroll a bit. Then i to get back into insert mode.

On Neovim the "basic" and "neovim" strategies will run test commands using Neovim's terminal, and leave you in insert mode, so that you can just press "Enter" to close the terminal session and go back to editing. If you want to scroll through the test command output, you'll have to first switch to normal mode. The built-in mapping for exiting terminal insert mode is CTRL-\ CTRL-n, which is difficult to press, so I recommend mapping it to CTRL-o:

Enum.find |> Enum.into #

Instead of doing a series of Enum.find across an #elixir list, pipe the contents of the find straight into Enum.into to produce a %{} that's easier to pluck values out of.

list = [
  {
    "img",
    [
      {"alt", "a shadow"},
      {"src", "..."},
      {"width", "792"},
      {"height", "528"}
    ],
    []
  }
]

with {"img", attrs, _} <- Enum.find(list, fn {tag, _, _} -> tag == "img" end),
     %{"alt" => alt, "src" => src} <- Enum.into(attrs, %{}) do
  "![#{alt}](#{src})"
end