How to get rid of “Press ENTER or type command to continue”












2















I'm using ctags to code C++ with vim.



I set two shortcuts of ctags as below:



autocmd VimEnter * silent! !eval 'ctags -R --c++-kinds=+p --fields=+iaS --extras=+q --language-force=C++ -o newtags; mv newtags .tags' &
function! Jump(type)
if filereadable(".tags")
if a:type == "single"
execute "normal! 2<C-]>"
execute "normal :NERDTreeFind<CR>"
execute "normal :wincmd p<CR>"
else
execute "normal! g<C-]>"
"execute "normal :redraw!"
endif
else
execute "normal :echo 'tags file not ready'<CR>"
endif
endfunction
nnoremap <C-]> :call Jump('single')<CR>
nnoremap g<C-]> :call Jump('multi')<CR>


As the autocmd command may need some time to finish, I write a function Jump.



For now, everything works well except that I always get a Press ENTER or type command to continue after typing g<C-]>.



I've tried to add execute "normal :redraw!" but it doesn't seem to work...



Also, I cannot use silent too, because g<C-]> has some necessary output:
enter image description here



If I use silent, all the output above will disappear.










share|improve this question

























  • And you press the number on the output of g<C] and then get the "Press ENTER..." prompt?

    – Ralf
    Jan 15 at 11:55











  • @Ralf No, I simply press g<C] and then get that. I cannot understand because execute "normal :redraw!" works on my Mac OS but doesn't work on my ubuntu.

    – Yves
    Jan 15 at 12:14
















2















I'm using ctags to code C++ with vim.



I set two shortcuts of ctags as below:



autocmd VimEnter * silent! !eval 'ctags -R --c++-kinds=+p --fields=+iaS --extras=+q --language-force=C++ -o newtags; mv newtags .tags' &
function! Jump(type)
if filereadable(".tags")
if a:type == "single"
execute "normal! 2<C-]>"
execute "normal :NERDTreeFind<CR>"
execute "normal :wincmd p<CR>"
else
execute "normal! g<C-]>"
"execute "normal :redraw!"
endif
else
execute "normal :echo 'tags file not ready'<CR>"
endif
endfunction
nnoremap <C-]> :call Jump('single')<CR>
nnoremap g<C-]> :call Jump('multi')<CR>


As the autocmd command may need some time to finish, I write a function Jump.



For now, everything works well except that I always get a Press ENTER or type command to continue after typing g<C-]>.



I've tried to add execute "normal :redraw!" but it doesn't seem to work...



Also, I cannot use silent too, because g<C-]> has some necessary output:
enter image description here



If I use silent, all the output above will disappear.










share|improve this question

























  • And you press the number on the output of g<C] and then get the "Press ENTER..." prompt?

    – Ralf
    Jan 15 at 11:55











  • @Ralf No, I simply press g<C] and then get that. I cannot understand because execute "normal :redraw!" works on my Mac OS but doesn't work on my ubuntu.

    – Yves
    Jan 15 at 12:14














2












2








2








I'm using ctags to code C++ with vim.



I set two shortcuts of ctags as below:



autocmd VimEnter * silent! !eval 'ctags -R --c++-kinds=+p --fields=+iaS --extras=+q --language-force=C++ -o newtags; mv newtags .tags' &
function! Jump(type)
if filereadable(".tags")
if a:type == "single"
execute "normal! 2<C-]>"
execute "normal :NERDTreeFind<CR>"
execute "normal :wincmd p<CR>"
else
execute "normal! g<C-]>"
"execute "normal :redraw!"
endif
else
execute "normal :echo 'tags file not ready'<CR>"
endif
endfunction
nnoremap <C-]> :call Jump('single')<CR>
nnoremap g<C-]> :call Jump('multi')<CR>


As the autocmd command may need some time to finish, I write a function Jump.



For now, everything works well except that I always get a Press ENTER or type command to continue after typing g<C-]>.



I've tried to add execute "normal :redraw!" but it doesn't seem to work...



Also, I cannot use silent too, because g<C-]> has some necessary output:
enter image description here



If I use silent, all the output above will disappear.










share|improve this question
















I'm using ctags to code C++ with vim.



I set two shortcuts of ctags as below:



autocmd VimEnter * silent! !eval 'ctags -R --c++-kinds=+p --fields=+iaS --extras=+q --language-force=C++ -o newtags; mv newtags .tags' &
function! Jump(type)
if filereadable(".tags")
if a:type == "single"
execute "normal! 2<C-]>"
execute "normal :NERDTreeFind<CR>"
execute "normal :wincmd p<CR>"
else
execute "normal! g<C-]>"
"execute "normal :redraw!"
endif
else
execute "normal :echo 'tags file not ready'<CR>"
endif
endfunction
nnoremap <C-]> :call Jump('single')<CR>
nnoremap g<C-]> :call Jump('multi')<CR>


As the autocmd command may need some time to finish, I write a function Jump.



For now, everything works well except that I always get a Press ENTER or type command to continue after typing g<C-]>.



I've tried to add execute "normal :redraw!" but it doesn't seem to work...



Also, I cannot use silent too, because g<C-]> has some necessary output:
enter image description here



If I use silent, all the output above will disappear.







vimscript ctags






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Jan 15 at 11:50







Yves

















asked Jan 15 at 11:06









YvesYves

1295




1295













  • And you press the number on the output of g<C] and then get the "Press ENTER..." prompt?

    – Ralf
    Jan 15 at 11:55











  • @Ralf No, I simply press g<C] and then get that. I cannot understand because execute "normal :redraw!" works on my Mac OS but doesn't work on my ubuntu.

    – Yves
    Jan 15 at 12:14



















  • And you press the number on the output of g<C] and then get the "Press ENTER..." prompt?

    – Ralf
    Jan 15 at 11:55











  • @Ralf No, I simply press g<C] and then get that. I cannot understand because execute "normal :redraw!" works on my Mac OS but doesn't work on my ubuntu.

    – Yves
    Jan 15 at 12:14

















And you press the number on the output of g<C] and then get the "Press ENTER..." prompt?

– Ralf
Jan 15 at 11:55





And you press the number on the output of g<C] and then get the "Press ENTER..." prompt?

– Ralf
Jan 15 at 11:55













@Ralf No, I simply press g<C] and then get that. I cannot understand because execute "normal :redraw!" works on my Mac OS but doesn't work on my ubuntu.

– Yves
Jan 15 at 12:14





@Ralf No, I simply press g<C] and then get that. I cannot understand because execute "normal :redraw!" works on my Mac OS but doesn't work on my ubuntu.

– Yves
Jan 15 at 12:14










1 Answer
1






active

oldest

votes


















3














Could you try the following. It directly uses :tag and :tjump instead of using the mappings. I also removed the unneeded execute ... stuff.



function! Jump(type)
if filereadable(".tags")
if a:type == "single"
execute "tag " . expand("<cword>")
NERDTreeFind
wincmd p
else
execute "tjump " . expand("<cword>")
endif
else
echo 'tags file not ready'
endif
endfunction





share|improve this answer
























  • Wonderful! It works.

    – Yves
    Jan 15 at 12:52












Your Answer








StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "599"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fvi.stackexchange.com%2fquestions%2f18575%2fhow-to-get-rid-of-press-enter-or-type-command-to-continue%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









3














Could you try the following. It directly uses :tag and :tjump instead of using the mappings. I also removed the unneeded execute ... stuff.



function! Jump(type)
if filereadable(".tags")
if a:type == "single"
execute "tag " . expand("<cword>")
NERDTreeFind
wincmd p
else
execute "tjump " . expand("<cword>")
endif
else
echo 'tags file not ready'
endif
endfunction





share|improve this answer
























  • Wonderful! It works.

    – Yves
    Jan 15 at 12:52
















3














Could you try the following. It directly uses :tag and :tjump instead of using the mappings. I also removed the unneeded execute ... stuff.



function! Jump(type)
if filereadable(".tags")
if a:type == "single"
execute "tag " . expand("<cword>")
NERDTreeFind
wincmd p
else
execute "tjump " . expand("<cword>")
endif
else
echo 'tags file not ready'
endif
endfunction





share|improve this answer
























  • Wonderful! It works.

    – Yves
    Jan 15 at 12:52














3












3








3







Could you try the following. It directly uses :tag and :tjump instead of using the mappings. I also removed the unneeded execute ... stuff.



function! Jump(type)
if filereadable(".tags")
if a:type == "single"
execute "tag " . expand("<cword>")
NERDTreeFind
wincmd p
else
execute "tjump " . expand("<cword>")
endif
else
echo 'tags file not ready'
endif
endfunction





share|improve this answer













Could you try the following. It directly uses :tag and :tjump instead of using the mappings. I also removed the unneeded execute ... stuff.



function! Jump(type)
if filereadable(".tags")
if a:type == "single"
execute "tag " . expand("<cword>")
NERDTreeFind
wincmd p
else
execute "tjump " . expand("<cword>")
endif
else
echo 'tags file not ready'
endif
endfunction






share|improve this answer












share|improve this answer



share|improve this answer










answered Jan 15 at 12:38









RalfRalf

3,7451318




3,7451318













  • Wonderful! It works.

    – Yves
    Jan 15 at 12:52



















  • Wonderful! It works.

    – Yves
    Jan 15 at 12:52

















Wonderful! It works.

– Yves
Jan 15 at 12:52





Wonderful! It works.

– Yves
Jan 15 at 12:52


















draft saved

draft discarded




















































Thanks for contributing an answer to Vi and Vim Stack Exchange!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fvi.stackexchange.com%2fquestions%2f18575%2fhow-to-get-rid-of-press-enter-or-type-command-to-continue%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Bressuire

Cabo Verde

Gyllenstierna