Skip to content

Commit

Permalink
feat: Focus outline if already open
Browse files Browse the repository at this point in the history
closes #71
  • Loading branch information
hedyhli committed May 29, 2024
1 parent dbd8368 commit e0b8634
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions lua/outline/sidebar.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit e0b8634

Please sign in to comment.