Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

enter input mode when press ctrl-[xvt] #10

Merged
merged 4 commits into from
Mar 13, 2018
Merged

Conversation

hiberabyss
Copy link
Contributor

Provide a way to enter input mode even with let g:ctrlp_cmdpalette_execute = 1 set.

@fisadev
Copy link
Owner

fisadev commented Nov 2, 2017

thanks for your contribution! But I'm not sure I understand what it does exactly. Could you explain to me what changes in behavior? Sorry, I'm not an expert on vim internals by any means :)

@hiberabyss
Copy link
Contributor Author

Hi @fisadev ,

Sorry for the late reply.

In most cases, I just want to execute command without any arguments, then I could just set let g:ctrlp_cmdpalette_execute = 1.

However, in some cases, I may also want to execute vim command with arguments. With this pull request:

  • When press <Enter>, the vim command will be executed directly;
  • When press with <c-x> <c-v> <c-t>, the vim command will not be executed, it stays at the command line and waiting for use's input.

Thanks!

@hiberabyss
Copy link
Contributor Author

Hi @fisadev ,

Is there any suggestion for this PR?
Thanks!

@fisadev
Copy link
Owner

fisadev commented Mar 13, 2018

Just to be sure, this won't break the default behavior when not using g:ctrlp_cmdpalette_execute = 1., am I right? The default behavior is to not to execute the command on enter, leaving the prompt for the user to add parameters if he wants to.

call feedkeys("\<CR>", 'n')
endif
call remove(s:cmdpalette_commands, index(s:cmdpalette_commands, a:str))
call insert(s:cmdpalette_commands, a:str)
if a:mode != 'e'
call feedkeys(" ", 'n')
endif
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A small detail: please change these tabs to spaces ;) (using tabs makes it look with a different indentation level depending on the tool)

@fisadev
Copy link
Owner

fisadev commented Mar 13, 2018

(Also, sorry for the delays, having some very busy weeks)

@hiberabyss
Copy link
Contributor Author

Hi @fisadev ,

Have updated the code to use whitespace instead of tab.

For your question, the default behavior is not changed when with g:ctrlp_cmdpalette_execute = 0 except that a whitespace is appended.

Thanks!

@fisadev fisadev merged commit 65adcf7 into fisadev:master Mar 13, 2018
@fisadev
Copy link
Owner

fisadev commented Mar 13, 2018

Merged! Thanks a lot for the work done :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants