Skip to content
This repository has been archived by the owner on Oct 7, 2021. It is now read-only.

Commit

Permalink
Merge pull request #4 from byronalley/add-paths
Browse files Browse the repository at this point in the history
Expand the paths checked for ruby-dictionary3
  • Loading branch information
takkii committed Oct 18, 2020
2 parents 0fc8d62 + 330defc commit 93c1a45
Showing 1 changed file with 16 additions and 14 deletions.
30 changes: 16 additions & 14 deletions rplugin/python3/deoplete/sources/totolot.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,22 @@

home = expanduser("~")

d1 = os.path.expanduser("~/.config/nvim/.cache/dein/repos/github.com/takkii/ruby-dictionary3/")
d2 = os.path.expanduser("~/.config/nvim/repos/github.com/takkii/ruby-dictionary3/")
d3 = os.path.expanduser("~/.cache/dein/repos/github.com/takkii/ruby-dictionary3/")

if os.path.exists(d1):
ruby_method = open(os.path.expanduser("~/.config/nvim/.cache/dein/repos/github.com/takkii/ruby-dictionary3/autoload/source/ruby_method_deoplete"))
rubymotion_method = open(os.path.expanduser("~/.config/nvim/.cache/dein/repos/github.com/takkii/ruby-dictionary3/autoload/source/rubymotion_method"))
elif os.path.exists(d2):
ruby_method = open(os.path.expanduser("~/.config/nvim/repos/github.com/takkii/ruby-dictionary3/autoload/source/ruby_method_deoplete"))
rubymotion_method = open(os.path.expanduser("~/.config/nvim/repos/github.com/takkii/ruby-dictionary3/autoload/source/rubymotion_method"))
elif os.path.exists(d3):
ruby_method = open(os.path.expanduser("~/.cache/dein/repos/github.com/takkii/ruby-dictionary3/autoload/source/ruby_method_deoplete"))
rubymotion_method = open(os.path.expanduser("~/.cache/dein/repos/github.com/takkii/ruby-dictionary3/autoload/source/rubymotion_method"))
else:
rel_path = "repos/github.com/takkii/ruby-dictionary3/"
paths = [os.path.expanduser(os.path.join(p, rel_path)) for p in [
"~/.cache/dein/",
"~/.local/share/dein/",
"~/.config/nvim/.cache/dein/",
"~/.config/nvim/",
"~/.vim/bundles"
]]

try:
path = next(p for p in paths if os.path.exists(p))

ruby_method = open(os.path.join(path, "autoload/source/ruby_method_deoplete"))
rubymotion_method = open(os.path.join(path, "autoload/source/rubymotion_method"))

except StopIteration:
print("Don't forget, Install dein plugin manager github repo takkii/ruby-dictionary3.")

index_ruby = list(ruby_method.readlines()) + list(rubymotion_method.readlines())
Expand Down

0 comments on commit 93c1a45

Please sign in to comment.