Skip to content

Commit 9b19d51

Browse files
committed
feat: set filetype to markdown and text wrapping
1 parent 49fa6b8 commit 9b19d51

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

rplugin/python3/plugin.py

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1-
import pynvim
2-
import copilot
3-
import dotenv
41
import os
52
import time
63

4+
import copilot
5+
import dotenv
6+
import pynvim
7+
78
dotenv.load_dotenv()
89

910

@@ -15,12 +16,13 @@ def __init__(self, nvim: pynvim.Nvim):
1516
if self.copilot.github_token is None:
1617
req = self.copilot.request_auth()
1718
self.nvim.out_write(
18-
f"Please visit {req['verification_uri']} and enter the code {req['user_code']}\n")
19+
f"Please visit {req['verification_uri']} and enter the code {req['user_code']}\n"
20+
)
1921
current_time = time.time()
20-
wait_until = current_time + req['expires_in']
22+
wait_until = current_time + req["expires_in"]
2123
while self.copilot.github_token is None:
22-
self.copilot.poll_auth(req['device_code'])
23-
time.sleep(req['interval'])
24+
self.copilot.poll_auth(req["device_code"])
25+
time.sleep(req["interval"])
2426
if time.time() > wait_until:
2527
self.nvim.out_write("Timed out waiting for authentication\n")
2628
return
@@ -42,6 +44,9 @@ def copilotChat(self, args: list[str]):
4244
# Create a new scratch buffer to hold the chat
4345
self.nvim.command("enew")
4446
self.nvim.command("setlocal buftype=nofile bufhidden=hide noswapfile")
47+
# Set filetype as markdown and wrap
48+
self.nvim.command("setlocal filetype=markdown")
49+
self.nvim.command("setlocal wrap")
4550
if self.nvim.current.line != "":
4651
self.nvim.command("normal o")
4752
for token in self.copilot.ask(prompt, code, language=file_type):

0 commit comments

Comments
 (0)