On 2021-12-10, バクダンくん wrote:
> On Windows and other non-Unix system, :cd without an argument just
> prints the current working directory instead of moving to the home
> directory. It is confusing and inconvenient for me using Vim on
> various OSs including Windows. Also, there is no reason to use :cd
> for this purpose because :pwd can be used on all environment.
The reason for using :cd this way on Windows is that this is how cd
works at the Command Prompt, so it is more natural for Windows
users.
> So I added 'cdhome' option to add a way to make its behavior the
> same with the Unix way.
How about putting this in your vimrc instead. It avoids Yet Another
Option.
if has("win32")
cabbrev <expr> cd ((getcmdtype() == ':' && getcmdpos() <= 3) ? 'Cd' :
'cd')
command! -nargs=? -complete=file Cd if !empty(expand("<args>")) | cd
<args> | else | cd $USERPROFILE | endif
endif
I think I got that right. I tested it on Linux, without the
outer if/endif.
Regards,
Gary
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/vim_dev/20211211055550.GA7422%40phoenix.