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

Major fixes, among them windows file handling #44

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

eyalk11
Copy link

@eyalk11 eyalk11 commented Dec 5, 2021

Hi,
I solved here few errors, some of which I didn't create an issue.
curbuf handling was problematic in a way I don't fully remember. I think it threw an error about out of index of buffers. you probably saw it.

fixing issue #43, windows file operation not working and fixing windows 1 fixes windows file handling issue #43.
It really solved FS operations in windows. The thing to note is that you do replace \\ with \\\\ before calling vim commands , otherwise \\ becomes \ and it becomes magic.

The silent thing is needed because of errors from time to time.
The missing return caused an error as well.

@eyalk11
Copy link
Author

eyalk11 commented Dec 5, 2021

You may also want to look at the panel commit I left out , which contains some of my preferences , but these are not strictly errors, so I left them out.





@property
def cur_buf(self):
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you elaborate what issues you encountered. We already have a a gen_new_buf function called by on_bufenter, which should guarantee that all call to cur_buf to be valid.

@@ -420,6 +420,7 @@ def abbrev_cwd(self, width):
return '/'.join(sp).ljust(width)
else:
total += len(sp[i]) - 1
return res[-1 * width:]
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suppose we never reach this point. Did you encounter any issue or did you see lsp warning? If it's the later, maybe it's ok to just return res?

@@ -178,11 +178,11 @@ def on_stderr(job_id, err_msg):
pickle.dump(arguments, f)

if sudo:
Vim.AsyncRun('sudo {} {} {}'.format(self.ServerCmd, cmd, fname),
Vim.AsyncRun('sudo {} {} {}'.format(self.ServerCmd, cmd, fname).replace('\\','\\\\'),
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's better to put the replace in Vim.AsyncRun

on_exit=on_exit,
term=True)
else:
Vim.AsyncRun('{} {} {}'.format(self.ServerCmd, cmd, fname),
Vim.AsyncRun('{} {} {}'.format(self.ServerCmd, cmd, fname).replace('\\','\\\\'),
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here.

@@ -197,6 +197,7 @@ def mv(self, src_arr, dst, sudo=False, on_exit=None):

@classmethod
def cp(self, src_arr, dst, sudo=False, on_exit=None):
print("uuu",src_arr,dst)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove.

@property
def cur_buf(self):
return self._bufs[Vim.current.buffer.number]
if Vim.current.buffer.number in self._bufs:
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you encounter a key not found error here?

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