Skip to content

dirh, prevd, and nextd do not work as usual after builtin cd #4869

@mumeiyamibito

Description

@mumeiyamibito

Hi

I'm using fish-shell 2.7.1 on LinuxMint 18.3 (64 bit) (4.13.0-37-generic).

I used the following function to list files after changing directory.

function cd
	if count $argv > /dev/null
		builtin cd "$argv"; and ls
	else
		builtin cd ~; and ls
	end
end

By the function, I was able to display file list on current directory. But commands dirh, prevd, and nextd did not work as usual.

I checked this function by turning it on and off, and it seemed that it was caused by builtin cd. Below is the result of builtin cd to dirh.
Normal cd

$ cd /tmp
$ mkdir a b
$ dirh
 1) /home/mumeiyamibito
    /tmp

$ cd a
$ dirh
 2) /home/mumeiyamibito
 1) /tmp
    /tmp/a

$ cd ../b
$ dirh
 3) /home/mumeiyamibito
 2) /tmp
 1) /tmp/a
    /tmp/b

builtin cd

$ cd /tmp
$ dirh
 1) /home/mumeiyamibito
    /tmp

$ builtin cd a
$ dirh
 1) /home/mumeiyamibito
    /tmp/a

$ builtin cd ../b
$ dirh
 1) /home/mumeiyamibito
    /tmp/b

How can I resolve this problem?

Thanks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions