Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/brglng/vim-sidebar-manager
The missing sidebar manager for Vim/Neovim
https://github.com/brglng/vim-sidebar-manager
neovim plugin sidebar vim
Last synced: about 2 hours ago
JSON representation
The missing sidebar manager for Vim/Neovim
- Host: GitHub
- URL: https://github.com/brglng/vim-sidebar-manager
- Owner: brglng
- License: mpl-2.0
- Created: 2020-02-15T14:15:09.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2023-10-13T10:39:47.000Z (about 1 year ago)
- Last Synced: 2024-05-13T21:56:32.556Z (6 months ago)
- Topics: neovim, plugin, sidebar, vim
- Language: Vim Script
- Homepage:
- Size: 36.1 KB
- Stars: 37
- Watchers: 4
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# vim-sidebar-manager
A sidebar manger for Vim/Neovim to mimic an IDE-like UI layout.
## TL;DR
![Screencast](https://github.com/brglng/images/raw/master/vim-sidebar-manager/screencast.webp)
## Motivation
We have a lot of plugins who open windows at your editor's side. I would call
them "sidebars". Unfortunately, those plugins do no cooperate with each other.
For example, if you have NERDTree and Tagbar installed, and configured to open
at the same side, they can open simultaneously, and you have to control each
of them individually. I think a better approach would be to "switch" them.
That is, when you switch to NERDTree, Tagbar is closed automatically, and when
you switch to Tagbar, NERDTree is closed automatically. As a result, it gives
you a feeling that there is always a bar at a side, where there are several
pages that can be switched back and forth. That's pretty much like a typical
UI layout of an IDE. What's more, I want to use the same key for switching
and toggling. I wrote a lot of code to implement this behavior in the past
years, and finally noticed that an abstraction layer can be made, and that's
this plugin.## Example
Here's an example of configuration for NERDTree, Tagbar and Undotree at the
left side.```vim
let g:NERDTreeWinPos = 'left'
let g:NERDTreeWinSize = 40
let g:NERDTreeQuitOnOpen = 0
let g:tagbar_left = 1
let g:tagbar_width = 40
let g:tagbar_autoclose = 0
let g:tagbar_autofocus = 1
let g:undotree_SetFocusWhenToggle = 1
let g:undotree_SplitWidth = 40let g:sidebars = {
\ 'nerdtree': {
\ 'position': 'left',
\ 'check_win': {nr -> getwinvar(nr, '&filetype') ==# 'nerdtree'},
\ 'open': 'NERDTree',
\ 'close': 'NERDTreeClose'
\ },
\ 'tagbar': {
\ 'position': 'left',
\ 'check_win': {nr -> bufname(winbufnr(nr)) =~ '__Tagbar__'},
\ 'open': 'TagbarOpen',
\ 'close': 'TagbarClose'
\ },
\ 'undotree': {
\ 'position': 'left',
\ 'check_win': {nr -> getwinvar(nr, '&filetype') ==# 'undotree'},
\ 'open': 'UndotreeShow',
\ 'close': 'UndotreeHide'
\ }
\ }noremap :call sidebar#toggle('nerdtree')
noremap :call sidebar#toggle('tagbar')
noremap :call sidebar#toggle('undotree')let g:startify_session_before_save = ['call sidebar#close_all()']
```Notes:
- `vim-sidebar-manager` is designed to be **non-intrusive**, that is, it
**does not** actually move your windows or change your windows' sizes.
The `position` field in each sidebar description is only a flag for
recognition. If you want them to open at the same side, you have to adjust
the individual plugins' configurations.- The `check_win` field must be a Funcref who takes the `winnr` as an argument
and returns a boolean (number) to indicate whether or not the window
corresponding to this `nr` is the specific kind of sidebar window .- The `open` and `close` fields can be either a string of command or a
Funcref.For more examples, please refer to the [Wiki page](https://github.com/brglng/vim-sidebar-manager/wiki/Examples)