aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTeddy Wing2020-08-26 19:54:00 +0200
committerTeddy Wing2020-08-31 19:30:25 +0200
commit5c0e0ed3d35ebf2445901a664ae16d2f902b5a27 (patch)
tree82d85a2c545c27cfdfd76a6e8bf21881f7189df9
parent33fdb1443d13771c3daa4421cae9da3f667f5fc1 (diff)
downloaddotvim-5c0e0ed3d35ebf2445901a664ae16d2f902b5a27.tar.bz2
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 %:h<Tab><C-f>bbi_test<CR> 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.
-rw-r--r--ftplugin/go.vim4
1 files changed, 2 insertions, 2 deletions
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 <buffer> Zf <Plug>(go-imports)
nmap <buffer> <leader>z <Plug>(go-test)
nmap <buffer> <leader>Z <Plug>(go-test-func)
nnoremap <buffer> Zs :execute '!go test ' . fnameescape(expand('%:p:h'))<CR>
-nmap <buffer> z<C-^> <Plug>(go-alternate-edit)
-nmap <buffer> <C-w>z<C-^> <Plug>(go-alternate-vertical)
+nmap <buffer> z<C-^> :call go#alternate#Switch(1, 'edit')<CR>
+nmap <buffer> <C-w>z<C-^> :call go#alternate#Switch(1, 'vsplit')<CR>
nmap <buffer> Ze <Plug>(go-iferr)