Add a custom tmux strategy for vim-test
This commit is contained in:
parent
3382627d6f
commit
b11a558f66
|
@ -1,23 +1,24 @@
|
|||
local map = vim.api.nvim_set_keymap
|
||||
local set = vim.keymap.set
|
||||
|
||||
local options = {
|
||||
silent = true,
|
||||
}
|
||||
|
||||
map("n", "<leader>tf", ":TestFile<CR>", options)
|
||||
map("n", "<leader>tg", ":TestVisit<CR>", options)
|
||||
map("n", "<leader>tl", ":TestLast<CR>", options)
|
||||
map("n", "<leader>tn", ":TestNearest<CR>", options)
|
||||
map("n", "<leader>ts", ":TestSuite<CR>", options)
|
||||
set("n", "<leader>tf", ":TestFile<CR>", options)
|
||||
set("n", "<leader>tg", ":TestVisit<CR>", options)
|
||||
set("n", "<leader>tl", ":TestLast<CR>", options)
|
||||
set("n", "<leader>tn", ":TestNearest<CR>", options)
|
||||
set("n", "<leader>ts", ":TestSuite<CR>", options)
|
||||
|
||||
vim.cmd [[
|
||||
let test#echo_command = 0
|
||||
let test#strategy = "neovim_sticky"
|
||||
|
||||
let g:test#neovim_sticky#kill_previous = 1
|
||||
let g:test#neovim_sticky#reopen_window = 1
|
||||
let g:test#preserve_screen = 0
|
||||
|
||||
let test#php#phpunit#executable = './run test'
|
||||
let test#php#phpunit#options = '--colors=always --testdox'
|
||||
|
||||
function! TmuxStrategy(cmd)
|
||||
let l:escaped_cmd = substitute(a:cmd, ' ', '\\ ', 'g')
|
||||
|
||||
execute 'silent !tmux send-keys -t .bottom ' . l:escaped_cmd . ' Enter'
|
||||
endfunction
|
||||
|
||||
let g:test#custom_strategies = {'tmux': function('TmuxStrategy')}
|
||||
let g:test#strategy = 'tmux'
|
||||
]]
|
||||
|
|
Loading…
Reference in a new issue