Skip to content

Commit

Permalink
Reopen file if it's not found in tabs
Browse files Browse the repository at this point in the history
Such as file is not opened in a tab, but exists in buffer.
  • Loading branch information
wooparadog committed Oct 25, 2019
1 parent 86d9d63 commit 0c190a3
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions ropevim.py
Original file line number Diff line number Diff line change
Expand Up @@ -244,13 +244,17 @@ def find_file(self, filename, readonly=False, other=False, force=False):
if filename not in self.filenames() or force:
self._open_file(filename, new=other)
else:
found = False
for tab in vim.tabpages:
for win in tab.windows:
if self._samefile(win.buffer.name, filename):
vim.current.tabpage = tab
vim.current.window = win
vim.current.buffer = win.buffer
found = True
break
if not found:
self._open_file(filename, new=other)

if readonly:
vim.command('set nomodifiable')
Expand Down

0 comments on commit 0c190a3

Please sign in to comment.