Skip to content

Commit

Permalink
Set up neotest-haskell + neotest bindings (#100)
Browse files Browse the repository at this point in the history
* wip -- plugins and bindings

* update inputs

* Add the nice parts of neotest conf to custom-neotest

* Add more useful bindings

output pane toggle + clear, summary pane toggle
  • Loading branch information
jisantuc authored Sep 11, 2024
1 parent 3e1236b commit 002e590
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 6 deletions.
3 changes: 3 additions & 0 deletions attrs/vimPlugins.nix
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ with vimPlugins;
luasnip
markdown-preview-nvim
markdownNvimPlugin
neotest
neotest-haskell
neotest-python
nvim-cmp
nvim-dap
nvim-dap-ui
Expand Down
10 changes: 10 additions & 0 deletions dotfiles/neovim/ftplugin/haskell.lua
Original file line number Diff line number Diff line change
@@ -1 +1,11 @@
vim.opt.colorcolumn = "120"

require("neotest").setup {
adapters = {
require("neotest-haskell") {
build_tools = { "cabal" },
frameworks = { "hspec", "tasty", "sydtest" },
},
}
}

1 change: 1 addition & 0 deletions dotfiles/neovim/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ require("completion-config")
require("custom-dap-config")
require("custom-lsp-config")
require("custom-luasnip")
require("custom-neotest")
require("custom-rest-nvim")
require("custom-treesitter")
require("custom-vimwiki")
Expand Down
18 changes: 18 additions & 0 deletions dotfiles/neovim/lua/custom-neotest.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
vim.api.nvim_set_keymap("n", "<leader>tr",
"<cmd>lua require('neotest').run.run()<CR>",
{ noremap = true, desc = "Run nearest test" })
vim.api.nvim_set_keymap("n", "<leader>tt",
"<cmd>lua require('neotest').run.run_last()<CR>",
{ noremap = true, desc = "Re-run last test" })
vim.api.nvim_set_keymap("n", "<leader>tf",
"<cmd>lua require('neotest').run.run(vim.fn.expand('%'))<CR>",
{ noremap = true, desc = "Run all tests in file" })
vim.api.nvim_set_keymap("n", "<leader>tot",
"<cmd>lua require('neotest').output_panel.toggle()<CR>",
{ noremap = true, desc = "Toggle test output pane" })
vim.api.nvim_set_keymap("n", "<leader>toc",
"<cmd>lua require('neotest').output_panel.clear()<CR>",
{ noremap = true, desc = "Clear test output pane" })
vim.api.nvim_set_keymap("n", "<leader>ts",
"<cmd>lua require('neotest').summary.toggle()<CR>",
{ noremap = true, desc = "Toggle test summary pane" })
12 changes: 6 additions & 6 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 002e590

Please sign in to comment.