Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not able to do anything with file named "[test].md" (m, o , enter do not work) #492

Closed
netei opened this issue Sep 25, 2015 · 3 comments
Closed
Assignees
Labels

Comments

@netei
Copy link

netei commented Sep 25, 2015

Whenever you name a file [test].md, it is not possible to do anything with it inside NerdTree (pressing m and any other keys has absolutely no effect)

This seems to come from the function UI._stripMarkup, specifically this line : https://github.com/scrooloose/nerdtree/blob/8c7534bc9e1d0c2f18bf94c1440c4ae6b102b5d6/lib/nerdtree/ui.vim#L359

function! s:UI._stripMarkup(line, removeLeadingSpaces)
    let line = a:line
    "remove the tree parts and the leading space
    let line = substitute (line, g:NERDTreeUI.MarkupReg(),"","")

    "strip off any read only flag
    let line = substitute (line, ' \[RO\]', "","")

    "strip off any bookmark flags
    let line = substitute (line, ' {[^}]*}', "","")

    "strip off any executable flags
    let line = substitute (line, '*\ze\($\| \)', "","")

    "strip off any generic flags
    let line = substitute (line, '\[[^]]*\]', "","")

    let wasdir = 0
    if line =~# '/$'
        let wasdir = 1
    endif
    let line = substitute (line,' -> .*',"","") " remove link to
    if wasdir ==# 1
        let line = substitute (line, '/\?$', '/', "")
    endif

    if a:removeLeadingSpaces
        let line = substitute (line, '^ *', '', '')
    endif

    return line
endfunction

I guess the changes that should be made to make this work would be huge (because the filename should not be extracted from the view layer, but from an other layer)

@netei netei changed the title Not able to do anything with file named "[test].md" Not able to do anything with file named "[test].md" (m, o , enter do not work) Sep 25, 2015
@lifecrisis lifecrisis added the bug label Jun 25, 2017
@lifecrisis
Copy link
Contributor

lifecrisis commented Jun 25, 2017

This issue is directly related to #680. It is a confirmed bug. I independently discovered the problem with _stripMarkup() previously, and this user has reached the same conclusion.

Also related to #391.

@PhilRunninger PhilRunninger self-assigned this Aug 13, 2018
@PhilRunninger PhilRunninger added the PR Under Review Coding is finished, and a pull request has been created and is being reviewed. label Aug 13, 2018
@PhilRunninger
Copy link
Member

@netei , would you be willing to test the pull request #868 I've put together for this issue? Details are in the PR. Thanks.

@PhilRunninger
Copy link
Member

Fixed in #868.

@PhilRunninger PhilRunninger removed the PR Under Review Coding is finished, and a pull request has been created and is being reviewed. label Oct 25, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants