mirror of
https://github.com/neovim/neovim.git
synced 2025-09-06 03:18:16 +00:00
Merge pull request #35130 from bfredl/cringe
fix(options): make 'cdhome' take effect on any platform
This commit is contained in:
@@ -1244,12 +1244,11 @@ A jump table for the options with a short description can be found at |Q_op|.
|
|||||||
This probably only matters for Turkish.
|
This probably only matters for Turkish.
|
||||||
|
|
||||||
*'cdhome'* *'cdh'* *'nocdhome'* *'nocdh'*
|
*'cdhome'* *'cdh'* *'nocdhome'* *'nocdh'*
|
||||||
'cdhome' 'cdh' boolean (default off)
|
'cdhome' 'cdh' boolean (default on on Unix, off on Windows)
|
||||||
global
|
global
|
||||||
When on, |:cd|, |:tcd| and |:lcd| without an argument changes the
|
When on, |:cd|, |:tcd| and |:lcd| without an argument changes the
|
||||||
current working directory to the |$HOME| directory like in Unix.
|
current working directory to the |$HOME| directory like in Unix.
|
||||||
When off, those commands just print the current directory name.
|
When off, those commands just print the current directory name.
|
||||||
On Unix this option has no effect.
|
|
||||||
This option cannot be set from a |modeline| or in the |sandbox|, for
|
This option cannot be set from a |modeline| or in the |sandbox|, for
|
||||||
security reasons.
|
security reasons.
|
||||||
|
|
||||||
|
3
runtime/lua/vim/_meta/options.lua
generated
3
runtime/lua/vim/_meta/options.lua
generated
@@ -700,12 +700,11 @@ vim.go.cmp = vim.go.casemap
|
|||||||
--- When on, `:cd`, `:tcd` and `:lcd` without an argument changes the
|
--- When on, `:cd`, `:tcd` and `:lcd` without an argument changes the
|
||||||
--- current working directory to the `$HOME` directory like in Unix.
|
--- current working directory to the `$HOME` directory like in Unix.
|
||||||
--- When off, those commands just print the current directory name.
|
--- When off, those commands just print the current directory name.
|
||||||
--- On Unix this option has no effect.
|
|
||||||
--- This option cannot be set from a `modeline` or in the `sandbox`, for
|
--- This option cannot be set from a `modeline` or in the `sandbox`, for
|
||||||
--- security reasons.
|
--- security reasons.
|
||||||
---
|
---
|
||||||
--- @type boolean
|
--- @type boolean
|
||||||
vim.o.cdhome = false
|
vim.o.cdhome = true
|
||||||
vim.o.cdh = vim.o.cdhome
|
vim.o.cdh = vim.o.cdhome
|
||||||
vim.go.cdhome = vim.o.cdhome
|
vim.go.cdhome = vim.o.cdhome
|
||||||
vim.go.cdh = vim.go.cdhome
|
vim.go.cdh = vim.go.cdhome
|
||||||
|
@@ -6105,11 +6105,7 @@ bool changedir_func(char *new_dir, CdScope scope)
|
|||||||
|
|
||||||
// For UNIX ":cd" means: go to home directory.
|
// For UNIX ":cd" means: go to home directory.
|
||||||
// On other systems too if 'cdhome' is set.
|
// On other systems too if 'cdhome' is set.
|
||||||
#if defined(UNIX)
|
|
||||||
if (*new_dir == NUL) {
|
|
||||||
#else
|
|
||||||
if (*new_dir == NUL && p_cdh) {
|
if (*new_dir == NUL && p_cdh) {
|
||||||
#endif
|
|
||||||
// Use NameBuff for home directory name.
|
// Use NameBuff for home directory name.
|
||||||
expand_env("$HOME", NameBuff, MAXPATHL);
|
expand_env("$HOME", NameBuff, MAXPATHL);
|
||||||
new_dir = NameBuff;
|
new_dir = NameBuff;
|
||||||
@@ -6148,13 +6144,11 @@ bool changedir_func(char *new_dir, CdScope scope)
|
|||||||
void ex_cd(exarg_T *eap)
|
void ex_cd(exarg_T *eap)
|
||||||
{
|
{
|
||||||
char *new_dir = eap->arg;
|
char *new_dir = eap->arg;
|
||||||
#if !defined(UNIX)
|
|
||||||
// for non-UNIX ":cd" means: print current directory unless 'cdhome' is set
|
// for non-UNIX ":cd" means: print current directory unless 'cdhome' is set
|
||||||
if (*new_dir == NUL && !p_cdh) {
|
if (*new_dir == NUL && !p_cdh) {
|
||||||
ex_pwd(NULL);
|
ex_pwd(NULL);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
CdScope scope = kCdScopeGlobal;
|
CdScope scope = kCdScopeGlobal;
|
||||||
switch (eap->cmdidx) {
|
switch (eap->cmdidx) {
|
||||||
|
@@ -1005,12 +1005,16 @@ local options = {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
abbreviation = 'cdh',
|
abbreviation = 'cdh',
|
||||||
defaults = false,
|
defaults = {
|
||||||
|
condition = 'MSWIN',
|
||||||
|
if_false = true,
|
||||||
|
if_true = false,
|
||||||
|
doc = [[on on Unix, off on Windows]],
|
||||||
|
},
|
||||||
desc = [=[
|
desc = [=[
|
||||||
When on, |:cd|, |:tcd| and |:lcd| without an argument changes the
|
When on, |:cd|, |:tcd| and |:lcd| without an argument changes the
|
||||||
current working directory to the |$HOME| directory like in Unix.
|
current working directory to the |$HOME| directory like in Unix.
|
||||||
When off, those commands just print the current directory name.
|
When off, those commands just print the current directory name.
|
||||||
On Unix this option has no effect.
|
|
||||||
This option cannot be set from a |modeline| or in the |sandbox|, for
|
This option cannot be set from a |modeline| or in the |sandbox|, for
|
||||||
security reasons.
|
security reasons.
|
||||||
]=],
|
]=],
|
||||||
|
Reference in New Issue
Block a user