mirror of
https://github.com/SpaceVim/SpaceVim.git
synced 2025-01-23 06:50:04 +08:00
feat(winbar): add winbar plugin
This commit is contained in:
parent
1ddf8dadb3
commit
fdd5c39d40
@ -577,6 +577,16 @@ EOT
|
|||||||
_detact LICENSE
|
_detact LICENSE
|
||||||
_detact_bundle quickfix.nvim README.md
|
_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)
|
GitHub.vim)
|
||||||
git clone https://github.com/wsdjeg/GitHub.vim.git detach/$1
|
git clone https://github.com/wsdjeg/GitHub.vim.git detach/$1
|
||||||
cd detach/$1
|
cd detach/$1
|
||||||
|
2
.github/workflows/async.yml
vendored
2
.github/workflows/async.yml
vendored
@ -7,7 +7,7 @@ jobs:
|
|||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
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
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
|
@ -23,6 +23,7 @@ scriptencoding utf-8
|
|||||||
" 5. `enable_netrw`: enable/disable netrw, disabled by default.
|
" 5. `enable_netrw`: enable/disable netrw, disabled by default.
|
||||||
" 6. `enable_quickfix_key_bindings`: enable/disable quickfix.nvim, mappings
|
" 6. `enable_quickfix_key_bindings`: enable/disable quickfix.nvim, mappings
|
||||||
" for neovim quickfix window. This option is only for neovim.
|
" 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
|
" NOTE: the `enable_vimfiler_gitstatus` and `enable_filetree_gitstatus` option
|
||||||
" has been deprecated. Use layer option instead.
|
" has been deprecated. Use layer option instead.
|
||||||
@ -155,6 +156,7 @@ endif
|
|||||||
let s:enable_smooth_scrolling = 1
|
let s:enable_smooth_scrolling = 1
|
||||||
let s:enable_netrw = 0
|
let s:enable_netrw = 0
|
||||||
let s:enable_quickfix_key_bindings = 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_gitstatus = 0
|
||||||
let g:_spacevim_enable_filetree_filetypeicon = 0
|
let g:_spacevim_enable_filetree_filetypeicon = 0
|
||||||
@ -245,6 +247,9 @@ function! SpaceVim#layers#core#plugins() abort
|
|||||||
if s:enable_quickfix_key_bindings
|
if s:enable_quickfix_key_bindings
|
||||||
call add(plugins, [g:_spacevim_root_dir . 'bundle/quickfix.nvim' , { 'merged' : 0} ])
|
call add(plugins, [g:_spacevim_root_dir . 'bundle/quickfix.nvim' , { 'merged' : 0} ])
|
||||||
endif
|
endif
|
||||||
|
if s:enable_winbar
|
||||||
|
call add(plugins, [g:_spacevim_root_dir . 'bundle/winbar.nvim' , { 'merged' : 0} ])
|
||||||
|
endif
|
||||||
return plugins
|
return plugins
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
@ -1223,6 +1228,9 @@ function! SpaceVim#layers#core#set_variable(var) abort
|
|||||||
let s:enable_quickfix_key_bindings = get(a:var,
|
let s:enable_quickfix_key_bindings = get(a:var,
|
||||||
\ 'enable_quickfix_key_bindings',
|
\ 'enable_quickfix_key_bindings',
|
||||||
\ s:enable_quickfix_key_bindings)
|
\ s:enable_quickfix_key_bindings)
|
||||||
|
let s:enable_winbar = get(a:var,
|
||||||
|
\ 'enable_winbar',
|
||||||
|
\ s:enable_winbar)
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:defx_find_current_file() abort
|
function! s:defx_find_current_file() abort
|
||||||
|
36
bundle/winbar.nvim/README.md
Normal file
36
bundle/winbar.nvim/README.md
Normal 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)
|
||||||
|
|
44
bundle/winbar.nvim/lua/winbar/init.lua
Normal file
44
bundle/winbar.nvim/lua/winbar/init.lua
Normal 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
|
11
bundle/winbar.nvim/plugin/winbar.lua
Normal file
11
bundle/winbar.nvim/plugin/winbar.lua
Normal 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
|
@ -2287,6 +2287,7 @@ OPTIONS
|
|||||||
5. `enable_netrw`: enable/disable netrw, disabled by default.
|
5. `enable_netrw`: enable/disable netrw, disabled by default.
|
||||||
6. `enable_quickfix_key_bindings`: enable/disable quickfix.nvim, mappings
|
6. `enable_quickfix_key_bindings`: enable/disable quickfix.nvim, mappings
|
||||||
for neovim quickfix window. This option is only for neovim.
|
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
|
NOTE: the `enable_vimfiler_gitstatus` and `enable_filetree_gitstatus` option
|
||||||
has been deprecated. Use layer option instead.
|
has been deprecated. Use layer option instead.
|
||||||
|
Loading…
Reference in New Issue
Block a user