feat: Focus outline if already open

closes #71
This commit is contained in:
~hedy
2024-05-30 07:52:51 +08:00
parent dbd836893f
commit e0b86347ad
3 changed files with 15 additions and 0 deletions

View File

@@ -12,6 +12,14 @@
### Others
-->
## Main branch
### Features
- `OutlineOpen` (and `outline.open`) will now focus on the outline is already
open when run.
([#71](https://github.com/hedyhli/outline.nvim/issues/71))
## v1.0.0
### Breaking changes

View File

@@ -591,6 +591,9 @@ future.
:OutlineOpen " opens with 'topleft vsplit'
```
If the outline is already open, running this command without bang will focus
on the outline window.
- **:OutlineClose**: Close outline
- **:OutlineFocus**: Toggle focus between outline and code/source window

View File

@@ -600,6 +600,10 @@ function Sidebar:open(opts)
if not cfg.o.outline_window.focus_on_open or not opts.focus_outline then
vim.fn.win_gotoid(self.code.win)
end
else
if cfg.o.outline_window.focus_on_open and opts.focus_outline then
self:focus()
end
end
end