From 5c0e0ed3d35ebf2445901a664ae16d2f902b5a27 Mon Sep 17 00:00:00 2001 From: Teddy Wing Date: Wed, 26 Aug 2020 19:54:00 +0200 Subject: ftplugin/go.vim: Create test file on alternate if it doesn't exist When switching to a file's alternate (its test file), create the test if the file doesn't exist. By default, a warning is issued if the file doesn't exist. I wanted an easier way to create the test file. Previously I'd use: :e %:hbbi_test This uses the function that the `Plug` mappings call under the hood, and turns on the `-bang` argument to have it create the test file if it doesn't exist. --- ftplugin/go.vim | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'ftplugin') diff --git a/ftplugin/go.vim b/ftplugin/go.vim index dafb134..1dc680d 100644 --- a/ftplugin/go.vim +++ b/ftplugin/go.vim @@ -36,7 +36,7 @@ nmap Zf (go-imports) nmap z (go-test) nmap Z (go-test-func) nnoremap Zs :execute '!go test ' . fnameescape(expand('%:p:h')) -nmap z (go-alternate-edit) -nmap z (go-alternate-vertical) +nmap z :call go#alternate#Switch(1, 'edit') +nmap z :call go#alternate#Switch(1, 'vsplit') nmap Ze (go-iferr) -- cgit v1.2.3