Skip to content

Support for URI decoding #15

@tapayne88

Description

@tapayne88

Hi 👋

I'm wondering what your view is on supporting the URI decoding of filenames. I'm trying open filenames like this

/Users/thomas.payne/git/yarn-pnp-demo/.yarn/cache/%40testing-library-react-npm-11.2.7-3a0469c756-389c9f3e83.zip%3A%3Anode_modules/%40testing-library/react/types/index.d.ts

I have a little function that I can wrap these up with but it would be super handy if vim-rzip could do the URI decoding for me that way I could drop my custom URI scheme yarnpnp:

function! YarnPnPRead(uri)
    let l:parsed_uri = substitute(a:uri, '%\([a-fA-F0-9][a-fA-F0-9]\)', '\=nr2char("0x" . submatch(1))', "g")
    let l:zipfile_uri = substitute(l:parsed_uri, '^yarnpnp', 'zipfile', "g")
    call rzip#Read(l:zipfile_uri, 1)
endfunction

augroup YarnPnP
    autocmd!
    autocmd BufReadCmd yarnpnp:*,yarnpnp:*/* call YarnPnPRead(expand('<amatch>'))
augroup END

What do you think?

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