Skip to content

Wrong output when piping to 'unexpand' #166

@rekolteur

Description

@rekolteur

Hello,

I have a file with :

# PATH=$(echo -n $PATH | \
#        awk -v RS=: -v ORS=: '!x[$0]++' | \
#        sed "s/\(.*\).\{1\}/\1/")

# PS1='\h\$ '
PS1=k$\

if [ ! -d /tmp/alpha ]; then
        mkdir /tmp/alpha
        chmod 0700 /tmp/alpha

The command :
:%!unexpand -t4

unexpands correctly those lines (gives me 2 tabs after the '#' character):

#        awk -v RS=: -v ORS=: '!x[$0]++' | \
#        sed "s/\(.*\).\{1\}/\1/")

but does not unexpands those lines (still 8 spaces):

        mkdir /tmp/alpha
        chmod 0700 /tmp/alpha

I also tested with
:%!unexpand -a -t4

I have no such problems with vim, nvi (provided by voidlinux) and in CLI (unexpand -t4 file.txt > alpha.txt ; alpha.txt has the correct tabs).

Thank you and keep up the great job!

EDIT

I had set expandtab in $HOME/.nexrc when I did my tests.
If I disable this option, then :%!unexpand -t4 works as expected.

I can live with that, one just has to have it in mind.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions