Closed j0k4rX closed 3 years ago
I have an even better solution than that :)
diff --git a/cp.vim b/cp.vim
index 5a82aad..2d2f742 100644
--- a/cp.vim
+++ b/cp.vim
@@ -34,7 +34,7 @@ function! TermWrapper(command) abort
endfunction
command! -nargs=0 CompileAndRun call TermWrapper(printf('g++ -std=c++11 %s && ./a.out', expand('%')))
-command! -nargs=1 CompileAndRunWithFile call TermWrapper(printf('g++ -std=c++11 %s && ./a.out < %s', expand('%'), <args>))
+command! -nargs=1 -complete=file CompileAndRunWithFile call TermWrapper(printf('g++ -std=c++11 %s && ./a.out < %s', expand('%'), <q-args>))
autocmd FileType cpp nnoremap <leader>fw :CompileAndRun<CR>
" For those of you that like to use the default ./a.out
Note the -complete=file
and <q-args>
instead of args
. Let me know if this works.
it works!
Cool! Can you confirm that tab-completing filenames works as well?
yup.. tab-completing works too
When I trigger CompileAndRunWithFile via
F5
, the cursor comes after""
sign (in command mode)I wonder if there's a feature which puts cursor in between quotation signs.
PS: in Facebook HackerCup contest, multiple input files with different name is given. If I had the cursor in between
""
signs, I could just type the first character, presstab
to autocomplete andenter