1
0
mirror of https://github.com/SpaceVim/SpaceVim.git synced 2025-01-23 01:00:06 +08:00

feat(winbar): add winbar plugin

This commit is contained in:
Eric Wong 2025-01-14 22:49:16 +08:00
parent 1ddf8dadb3
commit fdd5c39d40
7 changed files with 111 additions and 1 deletions

View File

@ -577,6 +577,16 @@ EOT
_detact LICENSE
_detact_bundle quickfix.nvim README.md
;;
winbar.nvim)
git clone https://github.com/wsdjeg/winbar.nvim.git detach/$1
cd detach/$1
_checkdir plugin
_checkdir lua/winbar
_detact_bundle winbar.nvim lua/winbar/init.lua
_detact_bundle winbar.nvim plugin/winbar.lua
_detact LICENSE
_detact_bundle winbar.nvim README.md
;;
GitHub.vim)
git clone https://github.com/wsdjeg/GitHub.vim.git detach/$1
cd detach/$1

View File

@ -7,7 +7,7 @@ jobs:
strategy:
fail-fast: false
matrix:
detachPlugin: ["FlyGrep.vim", "dein-ui.vim", "vim-todo", "iedit.vim", "scrollbar.vim", "vim-chat", "vim-cheat", "xmake.vim", "GitHub.vim", "JavaUnit.vim", "git.vim", "cpicker.nvim", "SourceCounter.vim", "vim-zettelkasten", "format.nvim", "record-key.nvim", "quickfix.nvim"]
detachPlugin: ["FlyGrep.vim", "dein-ui.vim", "vim-todo", "iedit.vim", "scrollbar.vim", "vim-chat", "vim-cheat", "xmake.vim", "GitHub.vim", "JavaUnit.vim", "git.vim", "cpicker.nvim", "SourceCounter.vim", "vim-zettelkasten", "format.nvim", "record-key.nvim", "quickfix.nvim", "winbar.nvim"]
runs-on: ubuntu-latest
steps:
- name: Checkout

View File

@ -23,6 +23,7 @@ scriptencoding utf-8
" 5. `enable_netrw`: enable/disable netrw, disabled by default.
" 6. `enable_quickfix_key_bindings`: enable/disable quickfix.nvim, mappings
" for neovim quickfix window. This option is only for neovim.
" 7. `enable_winbar`: enable/disable `wsdjeg/winbar.nvim`
"
" NOTE: the `enable_vimfiler_gitstatus` and `enable_filetree_gitstatus` option
" has been deprecated. Use layer option instead.
@ -155,6 +156,7 @@ endif
let s:enable_smooth_scrolling = 1
let s:enable_netrw = 0
let s:enable_quickfix_key_bindings = 0
let s:enable_winbar = 0
let g:_spacevim_enable_filetree_gitstatus = 0
let g:_spacevim_enable_filetree_filetypeicon = 0
@ -245,6 +247,9 @@ function! SpaceVim#layers#core#plugins() abort
if s:enable_quickfix_key_bindings
call add(plugins, [g:_spacevim_root_dir . 'bundle/quickfix.nvim' , { 'merged' : 0} ])
endif
if s:enable_winbar
call add(plugins, [g:_spacevim_root_dir . 'bundle/winbar.nvim' , { 'merged' : 0} ])
endif
return plugins
endfunction
@ -1223,6 +1228,9 @@ function! SpaceVim#layers#core#set_variable(var) abort
let s:enable_quickfix_key_bindings = get(a:var,
\ 'enable_quickfix_key_bindings',
\ s:enable_quickfix_key_bindings)
let s:enable_winbar = get(a:var,
\ 'enable_winbar',
\ s:enable_winbar)
endfunction
function! s:defx_find_current_file() abort

View File

@ -0,0 +1,36 @@
# winbar.nvim
> _winbar.nvim_ is a plugin which provides default winbar for neovim.
[![](https://spacevim.org/img/build-with-SpaceVim.svg)](https://spacevim.org)
[![GPLv3 License](https://img.spacevim.org/license-GPLv3-blue.svg)](LICENSE)
<!-- vim-markdown-toc GFM -->
- [Install](#install)
- [Feedback](#feedback)
<!-- vim-markdown-toc -->
## Install
1. Using `winbar.nvim` in SpaceVim:
```toml
[[layers]]
name = 'core'
enable_winbar = true
```
2. Using `winbar.nvim` without SpaceVim:
```
Plug 'wsdjeg/winbar.nvim'
```
## Feedback
The development of this plugin is in [`SpaceVim/bundle/winbar.nvim`](https://github.com/SpaceVim/SpaceVim/tree/master/bundle/winbar.nvim) directory.
If you encounter any bugs or have suggestions, please file an issue in the [issue tracker](https://github.com/SpaceVim/SpaceVim/issues)

View File

@ -0,0 +1,44 @@
--=============================================================================
-- init.lua --- winbar plugin
-- Copyright 2025 Eric Wong
-- Author: Eric Wong < wsdjeg@outlook.com >
-- URL: https://spacevim.org
-- License: GPLv3
--=============================================================================
local M = {}
local default_conf = {
winbar_seperator = '>',
excluded_filetypes = {},
}
local function redraw_winbar()
local file_name = vim.fn.expand('%:t')
if file_name == '' then
return
end
local value = '%#SpaceVim_winbar#' .. file_name .. ' ' .. default_conf.winbar_seperator
vim.api.nvim_set_option_value('winbar', value, { scope = 'local' })
end
function M.setup(opt)
if type(opt) == 'table' then
default_conf = vim.tbl_deep_extend('force', {}, default_conf, opt)
end
local augroup = vim.api.nvim_create_augroup('winbar.nvim', {
clear = true,
})
vim.api.nvim_create_autocmd({ 'WinEnter' }, {
group = augroup,
pattern = '*',
callback = function(e)
redraw_winbar()
end,
})
end
return M

View File

@ -0,0 +1,11 @@
--=============================================================================
-- winbar.lua --- winbar plugin
-- Copyright 2025 Eric Wong
-- Author: Eric Wong < wsdjeg@outlook.com >
-- URL: https://spacevim.org
-- License: GPLv3
--=============================================================================
if vim.fn.exists('+winbar') == 1 then
require('winbar').setup()
end

View File

@ -2287,6 +2287,7 @@ OPTIONS
5. `enable_netrw`: enable/disable netrw, disabled by default.
6. `enable_quickfix_key_bindings`: enable/disable quickfix.nvim, mappings
for neovim quickfix window. This option is only for neovim.
7. `enable_winbar`: enable/disable `wsdjeg/winbar.nvim`
NOTE: the `enable_vimfiler_gitstatus` and `enable_filetree_gitstatus` option
has been deprecated. Use layer option instead.