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

neovim - Is there a way to overwrite vim's default command? - Stack Overflow #64

Open
yaohunzhanyue opened this issue Apr 8, 2020 · 0 comments
Labels

Comments

@yaohunzhanyue
Copy link
Owner

yaohunzhanyue commented Apr 8, 2020

https://stackoverflow.com/questions/61100302/is-there-a-way-to-overwrite-vims-default-command

I want to map :bd to :bd! using:

command! -nargs=* -complete=buffer bd :call bd!

but vim told me "User defined commands must start with an uppercase letter"


update solutions from answer:

cnoremap bd bd!

another way

cnoreabbrev <expr> bd getcmdtype() == ":" && getcmdline() == 'bd' ? 'bd!' : 'bd'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant