├── .gitignore ├── LICENSE ├── README.md ├── autoload └── lightline │ └── asyncrun.vim ├── images └── screenshot.png └── plugin └── lightline └── asyncrun.vim /.gitignore: -------------------------------------------------------------------------------- 1 | # Swap 2 | [._]*.s[a-v][a-z] 3 | [._]*.sw[a-p] 4 | [._]s[a-v][a-z] 5 | [._]sw[a-p] 6 | 7 | # Session 8 | Session.vim 9 | 10 | # Temporary 11 | .netrwhist 12 | *~ 13 | # Auto-generated tag files 14 | tags 15 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 Alberto Montes 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # lightline-asyncrun 2 | 3 | This plugin allows you to add a simple indicator on the vim's lightline to see 4 | if there is any async job running in the background. 5 | 6 | ![Screenshot](images/screenshot.png) 7 | 8 | # Installation 9 | 10 | You can install it using the Vim's plugin manager of your choice. 11 | For example with [Vundle](https://github.com/VundleVim/Vundle.vim): 12 | 13 | ```viml 14 | " Dependencies 15 | Plugin 'itchyny/lightline.vim' 16 | Plugin 'skywind3000/asyncrun.vim' 17 | " Plugin 18 | Plugin 'albertomontesg/lightline-asyncrun' 19 | ``` 20 | 21 | # Integration with lightline 22 | 23 | 1. Register the component: 24 | 25 | ```viml 26 | let g:lightline.component_expand = { 27 | \ 'asyncrun_status': 'lightline#asyncrun#status', 28 | \ } 29 | ``` 30 | 31 | 2. Add the components to the lightline: 32 | 33 | ```viml 34 | let g:lightline.active = { 35 | \ 'right': [ 36 | \ ['percent', 'lineinfo'], 37 | \ ['fileformat', 'fileencoding', 'filetype'], 38 | \ ['asyncrun_status'] 39 | \ ]} 40 | ``` 41 | 42 | # Configuration 43 | 44 | ### `g:lightline#asyncrun#indicator_none` 45 | 46 | The indicator where there is no jobs running. Default is `No Jobs`. 47 | 48 | ### `g:lightline#asyncrun#indicator_run` 49 | 50 | The indicator where there is one job running. Default is `Running...`. 51 | 52 | 53 | 54 | # Aknowledgements 55 | 56 | This plugin is completely inspired by the plugin [lightline-ale](https://github.com/maximbaz/lightline-ale) by [Maxim Baz](https://github.com/maximbaz). 57 | 58 | # License 59 | 60 | [MIT](https://github.com/albertomontesg/lightline-asyncrun/blob/master/LICENSE) 61 | -------------------------------------------------------------------------------- /autoload/lightline/asyncrun.vim: -------------------------------------------------------------------------------- 1 | 2 | let s:indicator_run = get(g:, 'lightline#asyncrun#indicator_run', 'Running...') 3 | let s:indicator_none = get(g:, 'lightline#asyncrun#indicator_none', 'No Jobs') 4 | 5 | function! lightline#asyncrun#status() 6 | let l:status = asyncrun#status() 7 | if l:status == 'none' 8 | return s:indicator_none 9 | elseif l:status == 'run' 10 | return s:indicator_run 11 | else 12 | return l:status 13 | endif 14 | endfunc 15 | -------------------------------------------------------------------------------- /images/screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/albertomontesg/lightline-asyncrun/08b3756bb5a31011a4a415c224db9acb2edb22db/images/screenshot.png -------------------------------------------------------------------------------- /plugin/lightline/asyncrun.vim: -------------------------------------------------------------------------------- 1 | augroup lightline#asyncrun 2 | autocmd! 3 | autocmd User AsyncRunStart call lightline#update() 4 | autocmd User AsyncRunStop call lightline#update() 5 | augroup END 6 | --------------------------------------------------------------------------------