Skip to content
This repository has been archived by the owner on Sep 28, 2022. It is now read-only.

Address FileNotFoundError #131

Merged
merged 1 commit into from
Jul 13, 2020
Merged

Address FileNotFoundError #131

merged 1 commit into from
Jul 13, 2020

Conversation

nickolashkraus
Copy link
Contributor

This pull request addresses an issue that may arise when using nerdtree-git-plugin in conjunction with nerdtree, syntastic, and fzf.

"<redacted>" 247L, 6784C written
syntastic: error: checker output:
Traceback (most recent call last):
  File "/<redacted>/.vim/bundle/syntastic/syntax_checkers/python/compile.py", line 11, in <module>
    compile(open(argv[1]).read(), argv[1], 'exec', 0, 1)
FileNotFoundError: [Errno 2] No such file or directory: 'NERD_tree_1'

Problem
2019-11-21 09 56 04

This only occurs, however, when opening a file with FZF or with :e, then opening NERDTree. This is caused by bug in s:FileUpdate (also addressed here.

When a file is opened in this way and the NERDTree is opened, the nodes are not populated and therefore b:NERDTree.root.findNode returns {}.

This causes execution to return without returning the to the previous window after a call to g:NERDTree.CursorToTreeWin().

This issue then manifests when Syntastic executes. Within the call stack, the filename is derived from the % register instead of the buffer number (which is used to determine the filetype and subsequent checkers). Since, % has been changed to NERD_tree_1, the checker, specifically the Python compiler, fails.

The solution is to refactor the function such that

exec l:altwinnr . 'wincmd w'
exec l:winnr . 'wincmd w'

are always called.

Solution
2019-11-21 10 11 27

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants