How to get rid of “Press ENTER or type command to continue”
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:
If I use silent
, all the output above will disappear.
vimscript ctags
add a comment |
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:
If I use silent
, all the output above will disappear.
vimscript ctags
And you press the number on the output ofg<C]
and then get the "Press ENTER..." prompt?
– Ralf
Jan 15 at 11:55
@Ralf No, I simply pressg<C]
and then get that. I cannot understand becauseexecute "normal :redraw!"
works on my Mac OS but doesn't work on my ubuntu.
– Yves
Jan 15 at 12:14
add a comment |
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:
If I use silent
, all the output above will disappear.
vimscript ctags
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:
If I use silent
, all the output above will disappear.
vimscript ctags
vimscript ctags
edited Jan 15 at 11:50
Yves
asked Jan 15 at 11:06
YvesYves
1295
1295
And you press the number on the output ofg<C]
and then get the "Press ENTER..." prompt?
– Ralf
Jan 15 at 11:55
@Ralf No, I simply pressg<C]
and then get that. I cannot understand becauseexecute "normal :redraw!"
works on my Mac OS but doesn't work on my ubuntu.
– Yves
Jan 15 at 12:14
add a comment |
And you press the number on the output ofg<C]
and then get the "Press ENTER..." prompt?
– Ralf
Jan 15 at 11:55
@Ralf No, I simply pressg<C]
and then get that. I cannot understand becauseexecute "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
add a comment |
1 Answer
1
active
oldest
votes
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
Wonderful! It works.
– Yves
Jan 15 at 12:52
add a comment |
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
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
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
Wonderful! It works.
– Yves
Jan 15 at 12:52
add a comment |
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
Wonderful! It works.
– Yves
Jan 15 at 12:52
add a comment |
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
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
answered Jan 15 at 12:38
RalfRalf
3,7451318
3,7451318
Wonderful! It works.
– Yves
Jan 15 at 12:52
add a comment |
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
add a comment |
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.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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
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 becauseexecute "normal :redraw!"
works on my Mac OS but doesn't work on my ubuntu.– Yves
Jan 15 at 12:14