-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 0dbe458
Showing
6 changed files
with
239 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/venv |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2021 Takayuki Kamiyama | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)[![MIT License](http://img.shields.io/badge/license-MIT-blue.svg?style=flat)](LICENSE)[![GitHub release](https://img.shields.io/github/release/takkii/go_straight.svg?style=flat)](GitHub)[![GitHub Status](https://img.shields.io/github/last-commit/takkii/go_straight.svg?style=flat)](GitHub) | ||
|
||
<div align="center"><img src="https://github.com/takkii/Bignyanco/blob/master/images/python_ruby.gif" alt="Python¤ÈRuby" title="logo"></div> | ||
|
||
※ 日本語 | ||
|
||
### totolotとは違い、go_straightは自分以外の変更を受け付けません。PRはすべて拒否します。 | ||
|
||
※ 英語 | ||
|
||
### Unlike totolot, go_straight does not accept changes other than its own; it rejects all PR. | ||
|
||
```markdown | ||
※ 日本語 | ||
すべては自分の開発スタイルのためです。 | ||
|
||
※ 英語 | ||
It's all about my development style. | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,126 @@ | ||
import sys, traceback | ||
import subprocess, platform | ||
import importlib, site | ||
|
||
|
||
class InstallerClass: | ||
msgpy = ['python3', '-m', 'pip', 'uninstall', 'msgpack-python'] | ||
msg = ['python3', '-m', 'pip', 'install', 'msgpack==1.0.0'] | ||
nump = ['python3', '-m', 'pip', 'install', 'numpy'] | ||
pyn = ['python3', '-m', 'pip', 'install', 'pynvim'] | ||
pan = ['python3', '-m', 'pip', 'install', 'pandas'] | ||
|
||
msgpy_win = ['python', '-m', 'pip', 'uninstall', 'msgpack-python'] | ||
msg_win = ['python', '-m', 'pip', 'install', 'msgpack==1.0.0'] | ||
nump_win = ['python', '-m', 'pip', 'install', 'numpy'] | ||
pyn_win = ['python', '-m', 'pip', 'install', 'pynvim'] | ||
pan_win = ['python', '-m', 'pip', 'install', 'pandas'] | ||
|
||
def msgpy_win_method(self): | ||
try: | ||
ret_msgpy_win = subprocess.run(self.msgpy_win, encoding='utf-8', stderr=subprocess.PIPE) | ||
print(ret_msgpy_win) | ||
except Exception: | ||
traceback.print_exc() | ||
|
||
def msg_win_method(self): | ||
try: | ||
ret_msg_win = subprocess.run(self.msg_win, encoding='utf-8', stderr=subprocess.PIPE) | ||
print(ret_msg_win) | ||
except Exception: | ||
traceback.print_exc() | ||
|
||
def nump_win_method(self): | ||
try: | ||
ret_nump_win = subprocess.run(self.nump_win, encoding='utf-8', stderr=subprocess.PIPE) | ||
print(ret_nump_win) | ||
except Exception: | ||
traceback.print_exc() | ||
|
||
def pyn_win_method(self): | ||
try: | ||
ret_pyn_win = subprocess.run(self.pyn_win, encoding='utf-8', stderr=subprocess.PIPE) | ||
print(ret_pyn_win) | ||
except Exception: | ||
traceback.print_exc() | ||
|
||
def pan_win_method(self): | ||
try: | ||
ret_pan_win = subprocess.run(self.pan_win, encoding='utf-8', stderr=subprocess.PIPE) | ||
print(ret_pan_win) | ||
except Exception: | ||
traceback.print_exc() | ||
|
||
def msgpy_method(self): | ||
try: | ||
ret_msgpy = subprocess.run(self.msgpy, encoding='utf-8', stderr=subprocess.PIPE) | ||
print(ret_msgpy) | ||
except Exception: | ||
traceback.print_exc() | ||
|
||
def msg_method(self): | ||
try: | ||
ret_msg = subprocess.run(self.msg, encoding='utf-8', stderr=subprocess.PIPE) | ||
print(ret_msg) | ||
except Exception: | ||
traceback.print_exc() | ||
|
||
def nump_method(self): | ||
try: | ||
ret_nump = subprocess.run(self.nump, encoding='utf-8', stderr=subprocess.PIPE) | ||
print(ret_nump) | ||
except Exception: | ||
traceback.print_exc() | ||
|
||
def pyn_method(self): | ||
try: | ||
ret_pyn = subprocess.run(self.pyn, encoding='utf-8', stderr=subprocess.PIPE) | ||
print(ret_pyn) | ||
except Exception: | ||
traceback.print_exc() | ||
|
||
def pan_method(self): | ||
try: | ||
ret_pan = subprocess.run(self.pan, encoding='utf-8', stderr=subprocess.PIPE) | ||
print(ret_pan) | ||
except Exception: | ||
traceback.print_exc() | ||
|
||
|
||
if sys.version_info[0] == 2: | ||
print("This installer is Python2 not supported.") | ||
|
||
elif sys.version_info[0] == 3: | ||
pf = platform.system() | ||
if pf == 'Windows': | ||
InstClass = InstallerClass() | ||
InstClass.msgpy_win_method() | ||
InstClass.msg_win_method() | ||
InstClass.nump_win_method() | ||
InstClass.pyn_win_method() | ||
InstClass.pan_win_method() | ||
|
||
elif pf == 'Darwin': | ||
InstClass = InstallerClass() | ||
InstClass.msgpy_method() | ||
InstClass.msg_method() | ||
InstClass.nump_method() | ||
InstClass.pyn_method() | ||
InstClass.pan_method() | ||
|
||
elif pf == 'Linux': | ||
InstClass = InstallerClass() | ||
InstClass.msgpy_method() | ||
InstClass.msg_method() | ||
InstClass.nump_method() | ||
InstClass.pyn_method() | ||
InstClass.pan_method() | ||
|
||
else: | ||
print("Installer does not support OS other than Windows, MacOS and Linux kernel.") | ||
|
||
|
||
else: | ||
print("A version other than Python2 and Python3. Does not match.") | ||
|
||
importlib.reload(site) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
msgpack-python | ||
msgpack == 1.0.0 | ||
numpy | ||
pynvim | ||
pandas |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
import os | ||
import re | ||
import traceback | ||
from os.path import expanduser | ||
|
||
import pandas as pd | ||
from deoplete.source.base import Base | ||
|
||
# ------------------------------- KEYWORD ------------------------------------------------------------------------- | ||
|
||
|
||
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: | ||
print("Don't forget, Install dein plugin manager github repo takkii/ruby-dictionary3.") | ||
|
||
index_ruby = list(ruby_method.readlines()) + list(rubymotion_method.readlines()) | ||
Seri = pd.Series(index_ruby) | ||
sort_ruby = Seri.sort_index() | ||
data_ruby = list(map(lambda s: s.rstrip(), sort_ruby)) | ||
ruby_method.close() | ||
rubymotion_method.close() | ||
|
||
|
||
# ------------------------------- KEYWORD ------------------------------------------------------------------------- | ||
|
||
class Source(Base): | ||
def __init__(self, vim): | ||
super().__init__(vim) | ||
self.name = 'go_straight' | ||
self.filetypes = ['ruby'] | ||
self.mark = '[ Go_Straight ]' | ||
rubymatch = [r'\.[a-zA-Z0-9_?!]*|[a-zA-Z]\w*::\w*'] | ||
regexmatch = [r'[<a-zA-Z(?: .+?)?>.*?<\/a-zA-Z>]'] | ||
self.input_pattern = '|'.join(rubymatch + regexmatch) | ||
self.rank = 500 | ||
|
||
def get_complete_position(self, context): | ||
m = re.search('[a-zA-Z0-9_?!]*$', context['input']) | ||
return m.start() if m else -1 | ||
|
||
def gather_candidates(self, context): | ||
try: | ||
dic = data_ruby | ||
dic_sort = sorted(dic, key=lambda dic: dic[0]) | ||
return dic_sort | ||
except Exception: | ||
traceback.print_exc() |