mirror of
https://github.com/SpaceVim/SpaceVim.git
synced 2025-01-23 10:40:03 +08:00
refactor(scrollbar): detach scrollbar
This commit is contained in:
parent
2c92c0b51f
commit
c4b045cc6d
@ -436,7 +436,9 @@ EOT
|
|||||||
_checkdir autoload/SpaceVim/plugins/
|
_checkdir autoload/SpaceVim/plugins/
|
||||||
_detact autoload/SpaceVim/plugins/scrollbar.vim
|
_detact autoload/SpaceVim/plugins/scrollbar.vim
|
||||||
_detact LICENSE
|
_detact LICENSE
|
||||||
_default_readme "scrollbar.vim" "floating scrollbar support for neovim/vim[wip]"
|
_detact_bundle scrollbar.vim README.md
|
||||||
|
_checkdir plugin
|
||||||
|
_detact_bundle scrollbar.vim plugin/scrollbar.vim
|
||||||
;;
|
;;
|
||||||
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
|
||||||
|
@ -113,6 +113,10 @@ function! SpaceVim#layers#ui#plugins() abort
|
|||||||
call add(plugins, [g:_spacevim_root_dir . 'bundle/vim-airline-themes',
|
call add(plugins, [g:_spacevim_root_dir . 'bundle/vim-airline-themes',
|
||||||
\ { 'merged' : 0}])
|
\ { 'merged' : 0}])
|
||||||
endif
|
endif
|
||||||
|
if s:enable_scrollbar
|
||||||
|
call add(plugins, [g:_spacevim_root_dir . 'bundle/scrollbar.vim',
|
||||||
|
\ { 'merged' : 0}])
|
||||||
|
endif
|
||||||
|
|
||||||
return plugins
|
return plugins
|
||||||
|
|
||||||
@ -171,20 +175,8 @@ function! SpaceVim#layers#ui#config() abort
|
|||||||
noremap <silent> <F2> :TagbarToggle<CR>
|
noremap <silent> <F2> :TagbarToggle<CR>
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" this options only support neovim now.
|
|
||||||
augroup spacevim_layer_ui
|
augroup spacevim_layer_ui
|
||||||
autocmd!
|
autocmd!
|
||||||
let events = join(filter( ['BufEnter','WinEnter', 'QuitPre', 'CursorMoved', 'VimResized', 'FocusGained', 'WinScrolled' ], 'exists("##" . v:val)'), ',')
|
|
||||||
if s:enable_scrollbar && SpaceVim#plugins#scrollbar#usable()
|
|
||||||
exe printf('autocmd %s * call SpaceVim#plugins#scrollbar#show()',
|
|
||||||
\ events)
|
|
||||||
autocmd WinLeave,BufLeave,BufWinLeave,FocusLost
|
|
||||||
\ * call SpaceVim#plugins#scrollbar#clear()
|
|
||||||
" why this autocmd is needed?
|
|
||||||
"
|
|
||||||
" because the startify use noautocmd enew
|
|
||||||
autocmd User Startified call s:clear_previous_scrollbar()
|
|
||||||
endif
|
|
||||||
if !empty(s:cursorword_exclude_filetypes)
|
if !empty(s:cursorword_exclude_filetypes)
|
||||||
exe printf('autocmd FileType %s let b:cursorword = 0',
|
exe printf('autocmd FileType %s let b:cursorword = 0',
|
||||||
\ join(s:cursorword_exclude_filetypes, ','))
|
\ join(s:cursorword_exclude_filetypes, ','))
|
||||||
@ -642,11 +634,6 @@ function! SpaceVim#layers#ui#set_variable(var) abort
|
|||||||
\ ))
|
\ ))
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:clear_previous_scrollbar() abort
|
|
||||||
let bufnr = bufnr('#')
|
|
||||||
call SpaceVim#plugins#scrollbar#clear(bufnr)
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
function! SpaceVim#layers#ui#health() abort
|
function! SpaceVim#layers#ui#health() abort
|
||||||
call SpaceVim#layers#ui#plugins()
|
call SpaceVim#layers#ui#plugins()
|
||||||
call SpaceVim#layers#ui#config()
|
call SpaceVim#layers#ui#config()
|
||||||
|
35
bundle/scrollbar.vim/README.md
Normal file
35
bundle/scrollbar.vim/README.md
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
# scrollbar.vim
|
||||||
|
|
||||||
|
> _scrollbar.vim_ is floating scrollbar plugin for vim and 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 `scrollbar.vim` in SpaceVim:
|
||||||
|
|
||||||
|
```toml
|
||||||
|
[[layers]]
|
||||||
|
name = 'ui'
|
||||||
|
enable_scrollbar = true
|
||||||
|
```
|
||||||
|
|
||||||
|
2. Using `scrollbar.vim` without SpaceVim:
|
||||||
|
|
||||||
|
```
|
||||||
|
Plug 'wsdjeg/scrollbar.vim'
|
||||||
|
```
|
||||||
|
|
||||||
|
## Feedback
|
||||||
|
|
||||||
|
The development of this plugin is in [`SpaceVim/bundle/scrollbar.vim`](https://github.com/SpaceVim/SpaceVim/tree/master/bundle/scrollbar.vim) directory.
|
||||||
|
|
||||||
|
If you encounter any bugs or have suggestions, please file an issue in the [issue tracker](https://github.com/SpaceVim/SpaceVim/issues)
|
26
bundle/scrollbar.vim/plugin/scrollbar.vim
Normal file
26
bundle/scrollbar.vim/plugin/scrollbar.vim
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
"=============================================================================
|
||||||
|
" scrollbar.vim --- scrollbar plugin for vim and neovim
|
||||||
|
" Copyright (c) 2016-2019 Wang Shidong & Contributors
|
||||||
|
" Author: Wang Shidong < wsdjeg@outlook.com >
|
||||||
|
" URL: https://spacevim.org
|
||||||
|
" License: GPLv3
|
||||||
|
"=============================================================================
|
||||||
|
|
||||||
|
function! s:clear_previous_scrollbar() abort
|
||||||
|
let bufnr = bufnr('#')
|
||||||
|
call SpaceVim#plugins#scrollbar#clear(bufnr)
|
||||||
|
endfunction
|
||||||
|
augroup spacevim_scrollbar
|
||||||
|
autocmd!
|
||||||
|
let events = join(filter( ['BufEnter','WinEnter', 'QuitPre', 'CursorMoved', 'VimResized', 'FocusGained', 'WinScrolled' ], 'exists("##" . v:val)'), ',')
|
||||||
|
if SpaceVim#plugins#scrollbar#usable()
|
||||||
|
exe printf('autocmd %s * call SpaceVim#plugins#scrollbar#show()',
|
||||||
|
\ events)
|
||||||
|
autocmd WinLeave,BufLeave,BufWinLeave,FocusLost
|
||||||
|
\ * call SpaceVim#plugins#scrollbar#clear()
|
||||||
|
" why this autocmd is needed?
|
||||||
|
"
|
||||||
|
" because the startify use noautocmd enew
|
||||||
|
autocmd User Startified call s:clear_previous_scrollbar()
|
||||||
|
endif
|
||||||
|
augroup end
|
Loading…
Reference in New Issue
Block a user