-
-
Notifications
You must be signed in to change notification settings - Fork 53
fix(pattern): create custom doc only in valid rtp's #104
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
Conversation
autoload/doge/pattern.vim
Outdated
@@ -185,6 +185,9 @@ function! doge#pattern#custom(name) abort | |||
let l:path = '' | |||
for l:p in ['~/.vim', '~/vimfiles'] | |||
if isdirectory(expand(l:p)) | |||
if has('nvim') && match(&runtimepath, expand(l:p)) == -1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess we can just do it like this:
if isdirectory(expand(l:p)) && match(&runtimepath, expand(l:p)) >= 0
" ...
endif
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, that looks cleaner.
a4ea2a6
to
9604d8b
Compare
Ok, I'm failing to adjust the test to pass. Optimally, this should fullfill following testcases
I'll look into that later today. Is it even possible to create directories in the Dockerfile? |
@Sh3Rm4n Just let me do the tests. I'm quick with it. I'll merge this later. |
What exactly do you want to test here?
When no matching file is in the runpath ... then what? |
Sorry for not being clear about what I want to test.
With the So as this conditional is no longer executed: vim-doge/autoload/doge/pattern.vim Line 187 in 9604d8b
it will hit this conditional vim-doge/autoload/doge/pattern.vim Line 192 in 9604d8b
And for vim-doge/autoload/doge/pattern.vim Line 205 in 9604d8b
But there could also be the case, that any (n)vim session with no matching runtimepath exists, e.g. In conclusion, with this change we are forced to test all these paths, so that the CI is passing for vim7, vim8, nvim-0.2 and nvim-0.4. I hope I made it a bit more clear now. |
@Sh3Rm4n Well, since you seem to know the ins and outs, I suggest you write the tests. Mention me when you're done and I'll review it again. |
Before I go about writing the tests, is it possible to create directories or files in the CI container? https://travis-ci.com/github/kkoomen/vim-doge/jobs/397935105#L268 This is where I gave up, because I do not know how to test it otherwise. |
@Sh3Rm4n No need to create those directories . When we create a doc standard we open a new file with a given path but don't save it. The user can choose to save it. If those directories don't exists then the user should create it first, vim-doge is not responsible whether those directories exists or not, hence why we check the current buffer's path via You can remove all the Also, use more modern syntax such as using |
4802770
to
e6f4647
Compare
Should be ready for review. |
@Sh3Rm4n Sorry for force-pushing and screwing up the PR. I can't (force) push to your fork. Can you recreate the fork based off the new master branch and then download the following vim-doge.patch
Then after downloading it, run: EDIT: nevermind, I'll add a new PR myself, see #116 |
Prelude
By contributing to DoGe you agree to the following statements
Why this PR?
This handles the special case, when .vim runtimepaths are lying around
on the system, but are not added in the runtimepath of the running
(neo)vim instances itself.
I had a
~/.vim
folder lying around in my system.Executing
:DogeCreateDocStandard ...
opened~/.vim/after/ftplugin/...
,I use neovim and the
~/.vim
folder is no longer included in my runtimepath setup,so I added this check.