Browse Source

vim: update plugins

master
Maxim Likhachev 3 years ago
parent
commit
093f6997ef
  1. 2
      etc/soft/nvim/+ftplugin/haskell.vim
  2. 2
      etc/soft/nvim/+ftplugin/janet.vim
  3. 32
      etc/soft/nvim/+plugins/aw-watcher-vim/README.md
  4. 163
      etc/soft/nvim/+plugins/aw-watcher-vim/plugin/activitywatch.vim
  5. 11
      etc/soft/nvim/+plugins/dhall-vim/LICENSE
  6. 15
      etc/soft/nvim/+plugins/dhall-vim/README.md
  7. 13
      etc/soft/nvim/+plugins/dhall-vim/after/syntax/haskell.vim
  8. BIN
      etc/soft/nvim/+plugins/dhall-vim/dhall-syntax.png
  9. 39
      etc/soft/nvim/+plugins/dhall-vim/doc/dhall.txt
  10. 1
      etc/soft/nvim/+plugins/dhall-vim/ftdetect/dhall.vim
  11. 43
      etc/soft/nvim/+plugins/dhall-vim/ftplugin/dhall.vim
  12. 64
      etc/soft/nvim/+plugins/dhall-vim/syntax/dhall.vim
  13. 2
      etc/soft/nvim/+plugins/impatient.nvim/LICENSE
  14. 33
      etc/soft/nvim/+plugins/impatient.nvim/Makefile
  15. 805
      etc/soft/nvim/+plugins/impatient.nvim/README.md
  16. 465
      etc/soft/nvim/+plugins/impatient.nvim/lua/impatient.lua
  17. 248
      etc/soft/nvim/+plugins/impatient.nvim/lua/impatient/profile.lua
  18. 280
      etc/soft/nvim/+plugins/impatient.nvim/test/impatient_spec.lua
  19. 43
      etc/soft/nvim/+plugins/impatient.nvim/test/lua/plugins.lua
  20. 10
      etc/soft/nvim/+plugins/impatient.nvim/test/preload.lua
  21. 19
      etc/soft/nvim/+plugins/janet.vim/LICENSE
  22. 3
      etc/soft/nvim/+plugins/janet.vim/Makefile
  23. 20
      etc/soft/nvim/+plugins/janet.vim/README.md
  24. 8
      etc/soft/nvim/+plugins/janet.vim/ftdetect/janet.vim
  25. 26
      etc/soft/nvim/+plugins/janet.vim/ftplugin/janet.vim
  26. 324
      etc/soft/nvim/+plugins/janet.vim/indent/janet.vim
  27. 143
      etc/soft/nvim/+plugins/janet.vim/scripts/gen.janet
  28. 128
      etc/soft/nvim/+plugins/janet.vim/syntax/janet.vim
  29. 50
      etc/soft/nvim/+plugins/lualine.nvim/CONTRIBUTING.md
  30. 2
      etc/soft/nvim/+plugins/lualine.nvim/LICENSE
  31. 38
      etc/soft/nvim/+plugins/lualine.nvim/Makefile
  32. 927
      etc/soft/nvim/+plugins/lualine.nvim/README.md
  33. 361
      etc/soft/nvim/+plugins/lualine.nvim/THEMES.md
  34. 997
      etc/soft/nvim/+plugins/lualine.nvim/doc/lualine.txt
  35. 62
      etc/soft/nvim/+plugins/lualine.nvim/examples/bubbles.lua
  36. 221
      etc/soft/nvim/+plugins/lualine.nvim/examples/evil_lualine.lua
  37. 124
      etc/soft/nvim/+plugins/lualine.nvim/examples/slanted-gaps.lua
  38. 629
      etc/soft/nvim/+plugins/lualine.nvim/lua/lualine.lua
  39. 289
      etc/soft/nvim/+plugins/lualine.nvim/lua/lualine/component.lua
  40. 131
      etc/soft/nvim/+plugins/lualine.nvim/lua/lualine/components/branch/git_branch.lua
  41. 25
      etc/soft/nvim/+plugins/lualine.nvim/lua/lualine/components/branch/init.lua
  42. 192
      etc/soft/nvim/+plugins/lualine.nvim/lua/lualine/components/buffers/buffer.lua
  43. 238
      etc/soft/nvim/+plugins/lualine.nvim/lua/lualine/components/buffers/init.lua
  44. 59
      etc/soft/nvim/+plugins/lualine.nvim/lua/lualine/components/diagnostics/config.lua
  45. 111
      etc/soft/nvim/+plugins/lualine.nvim/lua/lualine/components/diagnostics/init.lua
  46. 111
      etc/soft/nvim/+plugins/lualine.nvim/lua/lualine/components/diagnostics/sources.lua
  47. 138
      etc/soft/nvim/+plugins/lualine.nvim/lua/lualine/components/diff/git_diff.lua
  48. 93
      etc/soft/nvim/+plugins/lualine.nvim/lua/lualine/components/diff/init.lua
  49. 7
      etc/soft/nvim/+plugins/lualine.nvim/lua/lualine/components/encoding.lua
  50. 30
      etc/soft/nvim/+plugins/lualine.nvim/lua/lualine/components/fileformat.lua
  51. 105
      etc/soft/nvim/+plugins/lualine.nvim/lua/lualine/components/filename.lua
  52. 25
      etc/soft/nvim/+plugins/lualine.nvim/lua/lualine/components/filesize.lua
  53. 76
      etc/soft/nvim/+plugins/lualine.nvim/lua/lualine/components/filetype.lua
  54. 11
      etc/soft/nvim/+plugins/lualine.nvim/lua/lualine/components/hostname.lua
  55. 9
      etc/soft/nvim/+plugins/lualine.nvim/lua/lualine/components/location.lua
  56. 4
      etc/soft/nvim/+plugins/lualine.nvim/lua/lualine/components/mode.lua
  57. 15
      etc/soft/nvim/+plugins/lualine.nvim/lua/lualine/components/progress.lua
  58. 11
      etc/soft/nvim/+plugins/lualine.nvim/lua/lualine/components/searchcount.lua
  59. 48
      etc/soft/nvim/+plugins/lualine.nvim/lua/lualine/components/special/eval_func_component.lua
  60. 21
      etc/soft/nvim/+plugins/lualine.nvim/lua/lualine/components/special/function_component.lua
  61. 37
      etc/soft/nvim/+plugins/lualine.nvim/lua/lualine/components/special/vim_var_component.lua
  62. 180
      etc/soft/nvim/+plugins/lualine.nvim/lua/lualine/components/tabs/init.lua
  63. 119
      etc/soft/nvim/+plugins/lualine.nvim/lua/lualine/components/tabs/tab.lua
  64. 64
      etc/soft/nvim/+plugins/lualine.nvim/lua/lualine/components/windows/init.lua
  65. 35
      etc/soft/nvim/+plugins/lualine.nvim/lua/lualine/components/windows/window.lua
  66. 141
      etc/soft/nvim/+plugins/lualine.nvim/lua/lualine/config.lua
  67. 9
      etc/soft/nvim/+plugins/lualine.nvim/lua/lualine/extensions/aerial.lua
  68. 11
      etc/soft/nvim/+plugins/lualine.nvim/lua/lualine/extensions/chadtree.lua
  69. 11
      etc/soft/nvim/+plugins/lualine.nvim/lua/lualine/extensions/fern.lua
  70. 17
      etc/soft/nvim/+plugins/lualine.nvim/lua/lualine/extensions/fugitive.lua
  71. 46
      etc/soft/nvim/+plugins/lualine.nvim/lua/lualine/extensions/fzf.lua
  72. 16
      etc/soft/nvim/+plugins/lualine.nvim/lua/lualine/extensions/man.lua
  73. 19
      etc/soft/nvim/+plugins/lualine.nvim/lua/lualine/extensions/mundo.lua
  74. 11
      etc/soft/nvim/+plugins/lualine.nvim/lua/lualine/extensions/neo-tree.lua
  75. 15
      etc/soft/nvim/+plugins/lualine.nvim/lua/lualine/extensions/nerdtree.lua
  76. 18
      etc/soft/nvim/+plugins/lualine.nvim/lua/lualine/extensions/nvim-dap-ui.lua
  77. 11
      etc/soft/nvim/+plugins/lualine.nvim/lua/lualine/extensions/nvim-tree.lua
  78. 16
      etc/soft/nvim/+plugins/lualine.nvim/lua/lualine/extensions/overseer.lua
  79. 34
      etc/soft/nvim/+plugins/lualine.nvim/lua/lualine/extensions/quickfix.lua
  80. 9
      etc/soft/nvim/+plugins/lualine.nvim/lua/lualine/extensions/symbols-outline.lua
  81. 16
      etc/soft/nvim/+plugins/lualine.nvim/lua/lualine/extensions/toggleterm.lua
  82. 474
      etc/soft/nvim/+plugins/lualine.nvim/lua/lualine/highlight.lua
  83. 38
      etc/soft/nvim/+plugins/lualine.nvim/lua/lualine/themes/16color.lua
  84. 43
      etc/soft/nvim/+plugins/lualine.nvim/lua/lualine/themes/OceanicNext.lua
  85. 6
      etc/soft/nvim/+plugins/lualine.nvim/lua/lualine/themes/PaperColor.lua
  86. 43
      etc/soft/nvim/+plugins/lualine.nvim/lua/lualine/themes/Tomorrow.lua
  87. 174
      etc/soft/nvim/+plugins/lualine.nvim/lua/lualine/themes/auto.lua
  88. 8
      etc/soft/nvim/+plugins/lualine.nvim/lua/lualine/themes/ayu.lua
  89. 40
      etc/soft/nvim/+plugins/lualine.nvim/lua/lualine/themes/ayu_dark.lua
  90. 40
      etc/soft/nvim/+plugins/lualine.nvim/lua/lualine/themes/ayu_light.lua
  91. 40
      etc/soft/nvim/+plugins/lualine.nvim/lua/lualine/themes/ayu_mirage.lua
  92. 92
      etc/soft/nvim/+plugins/lualine.nvim/lua/lualine/themes/base16.lua
  93. 38
      etc/soft/nvim/+plugins/lualine.nvim/lua/lualine/themes/codedark.lua
  94. 48
      etc/soft/nvim/+plugins/lualine.nvim/lua/lualine/themes/dracula.lua
  95. 53
      etc/soft/nvim/+plugins/lualine.nvim/lua/lualine/themes/everforest.lua
  96. 29
      etc/soft/nvim/+plugins/lualine.nvim/lua/lualine/themes/gruvbox-material.lua
  97. 7
      etc/soft/nvim/+plugins/lualine.nvim/lua/lualine/themes/gruvbox.lua
  98. 48
      etc/soft/nvim/+plugins/lualine.nvim/lua/lualine/themes/gruvbox_dark.lua
  99. 47
      etc/soft/nvim/+plugins/lualine.nvim/lua/lualine/themes/gruvbox_light.lua
  100. 48
      etc/soft/nvim/+plugins/lualine.nvim/lua/lualine/themes/horizon.lua
  101. Some files were not shown because too many files have changed in this diff Show More

2
etc/soft/nvim/+ftplugin/haskell.vim

@ -6,7 +6,7 @@ set shiftwidth=8 @@ -6,7 +6,7 @@ set shiftwidth=8
set formatprg=stylish-haskell
runtime syntax/custom/HaskellConceal.vim
" runtime! syntax/custom/HaskellConceal.vim
" =============================================================================
" Descriptions: Provide a function providing folding information for haskell

2
etc/soft/nvim/+ftplugin/janet.vim

@ -0,0 +1,2 @@ @@ -0,0 +1,2 @@
" runtime syntax/custom/RainbowParenthsis.vim

32
etc/soft/nvim/+plugins/aw-watcher-vim/README.md

@ -1,32 +0,0 @@ @@ -1,32 +0,0 @@
aw-watcher-vim
==============
### Installation
This plugin depends on curl, so make sure that it's installed and available in your PATH
It is recommended to have a vim runtime manager to make it easier to install (such as Pathogen or Vundle)
Then simply clone this repository to the bundle folder in your vim config folder (usually `~/.vim/bundle` or `~/.config/nvim/bundle` for neovim)
### Usage
Once installed in the bundle directory, it should load automatically if you have a vim runtime manager
```
:AWStart - start logging if not already logging
:AWStop - stop logging if logging
:AWStatus - verify that the watcher is running
```
If aw-watcher-vim loses connection it will give you an error message and stop logging. You then need to either run :AWStart or restart vim to start logging again
### Configuration
The following global variables are available:
| Variable Name | Description | Default Value |
|--------------------|------------------------------------------------|---------------|
| `g:aw_apiurl_host` | Sets the _host_ of the Api Url | `127.0.0.1` |
| `g:aw_apiurl_port` | Sets the _port_ of the Api Url | `5600` |
| `g:aw_api_timeout` | Sets the _timeout_ seconds of the Api request | `2.0` |

163
etc/soft/nvim/+plugins/aw-watcher-vim/plugin/activitywatch.vim

@ -1,163 +0,0 @@ @@ -1,163 +0,0 @@
if exists("g:loaded_activitywatch")
finish
endif
let g:loaded_activitywatch = 1
" compatibility mode which set this script to run with default vim settings
let s:save_cpo = &cpo
set cpo&vim
let s:nvim = has('nvim')
let s:last_heartbeat = localtime()
let s:file = ''
let s:language = ''
let s:project = ''
let s:connected = 0
let s:apiurl_host = get(g:, 'aw_apiurl_host', '127.0.0.1')
let s:apiurl_port = get(g:, 'aw_apiurl_port', '5600')
let s:api_timeout = get(g:, 'aw_api_timeout', 2)
let s:base_apiurl = printf('http://%s:%s/api/0', s:apiurl_host, s:apiurl_port)
let s:hostname = get(g:, 'aw_hostname', hostname())
let s:bucketname = printf('aw-watcher-vim_%s', s:hostname)
let s:bucket_apiurl = printf('%s/buckets/%s', s:base_apiurl, s:bucketname)
let s:heartbeat_apiurl = printf('%s/heartbeat?pulsetime=30', s:bucket_apiurl)
" dict of all responses
" the key is the jobid and the value the HTTP status code
let s:http_response_code = {}
function! HTTPPostJson(url, data)
let l:req = ['curl', '-s', a:url,
\ '-H', 'Content-Type: application/json',
\ '-X', 'POST',
\ '-d', json_encode(a:data),
\ '-o', '/dev/null',
\ '-m', s:api_timeout,
\ '-w', "%{http_code}"]
if s:nvim
let l:req_job = jobstart(l:req,
\ {"detach": 1,
\ "on_stdout": "HTTPPostOnStdoutNeovim",
\ "on_exit": "HTTPPostOnExitNeovim",
\ })
else
let l:req_job = job_start(l:req,
\ {"out_cb": "HTTPPostOnStdoutVim",
\ "close_cb": "HTTPPostOnExitVim",
\ "in_mode": "raw",
\ })
endif
endfunc
function! HTTPPostOnExitNeovim(jobid, exitcode, eventtype)
let l:jobid_str = printf('%d', a:jobid)
let l:status_code = str2nr(s:http_response_code[l:jobid_str][0])
call HTTPPostOnExit(l:jobid_str, l:status_code)
endfunc
function! HTTPPostOnExitVim(jobmsg)
" cut out channelnum from string 'channel X running'
let l:jobid_str = substitute(a:jobmsg, '[ A-Za-z]*', '', "g")
let l:status_code = str2nr(s:http_response_code[l:jobid_str])
call HTTPPostOnExit(l:jobid_str, l:status_code)
endfunc
function! HTTPPostOnExit(jobid_str, status_code)
if a:status_code == 0
" We cannot connect to aw-server
echoerr "aw-watcher-vim: Failed to connect to aw-server, logging will be disabled. You can retry to connect with ':AWStart'"
let s:connected = 0
elseif a:status_code >= 100 && a:status_code < 300 || a:status_code == 304
" We are connected!
let s:connected = 1
else
" aw-server didn't like our request
echoerr printf("aw-watcher-vim: aw-server did not accept our request with status code %d. See aw-server logs for reason or stop aw-watcher-vim with :AWStop", a:status_code)
endif
" Cleanup response code
unlet s:http_response_code[a:jobid_str]
endfunc
function! HTTPPostOnStdoutVim(jobmsg, data)
" cut out channelnum from string 'channel X running'
let l:jobid_str = substitute(a:jobmsg, '[ A-Za-z]*', '', "g")
let s:http_response_code[l:jobid_str] = a:data
"echo printf('aw-watcher-vim job %d stdout: %s', l:jobid_str, json_encode(a:data))
endfunc
function! HTTPPostOnStdoutNeovim(jobid, data, event)
if a:data != ['']
let l:jobid_str = printf('%d', a:jobid)
let s:http_response_code[l:jobid_str] = a:data
"echo printf('aw-watcher-vim job %d stdout: %s', a:jobid, json_encode(a:data))
endif
endfunc
function! s:CreateBucket()
let l:body = {
\ 'name': s:bucketname,
\ 'hostname': s:hostname,
\ 'client': 'aw-watcher-vim',
\ 'type': 'app.editor.activity'
\}
call HTTPPostJson(s:bucket_apiurl, l:body)
endfunc
function! s:Heartbeat()
" Only send heartbeats if we can connect to aw-server
if s:connected < 1
return
endif
let l:duration = 0
let l:localtime = localtime()
let l:timestamp = strftime('%FT%H:%M:%S%z')
let l:file = expand('%p')
let l:language = &filetype
let l:project = getcwd()
" Only send heartbeat if data was changed or more than 1 second has passed
" since last heartbeat
if s:file != l:file ||
\ s:language != l:language ||
\ s:project != l:project ||
\ l:localtime - s:last_heartbeat > 1
let l:req_body = {
\ 'duration': 0,
\ 'timestamp': l:timestamp,
\ 'data': {
\ 'file': l:file,
\ 'language': l:language,
\ 'project': l:project
\ }
\}
call HTTPPostJson(s:heartbeat_apiurl, l:req_body)
let s:file = l:file
let s:language = l:language
let s:project = l:project
let s:last_heartbeat = l:localtime
endif
endfunc
function! AWStart()
call s:CreateBucket()
endfunc
function! AWStop()
let s:connected = 0
endfunc
augroup ActivityWatch
autocmd VimEnter * call AWStart()
autocmd BufEnter,CursorMoved,CursorMovedI * call s:Heartbeat()
autocmd CmdlineEnter,CmdlineChanged * call s:Heartbeat()
augroup END
command! AWHeartbeat call s:Heartbeat()
command! AWStart call AWStart()
command! AWStop call AWStop()
command! AWStatus echom printf('aw-watcher-vim running: %b', s:connected)
" reset compatibility mode
let &cpo = s:save_cpo

11
etc/soft/nvim/+plugins/dhall-vim/LICENSE

@ -1,11 +0,0 @@ @@ -1,11 +0,0 @@
Copyright Vanessa McHale (c) 2018
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

15
etc/soft/nvim/+plugins/dhall-vim/README.md

@ -1,15 +0,0 @@ @@ -1,15 +0,0 @@
# dhall-vim
This package provides syntax highlighting for
[Dhall](https://hackage.haskell.org/package/dhall), a configuration language.
## Installation
Using [vim-plug](https://github.com/junegunn/vim-plug):
```vim
Plug 'vmchale/dhall-vim'
```
## Screenshot
![Syntax highlighting demonstration](https://github.com/vmchale/dhall-vim/raw/master/dhall-syntax.png)

13
etc/soft/nvim/+plugins/dhall-vim/after/syntax/haskell.vim

@ -1,13 +0,0 @@ @@ -1,13 +0,0 @@
" store and remove current syntax value
let old_syntax = b:current_syntax
unlet b:current_syntax
syn include @dhall syntax/dhall.vim
unlet b:current_syntax
syn region dhallBlock matchgroup=quasiQuote start=/\[\$\?staticDhallExpression|/ end=/|\]/ contains=@dhall
hi def link quasiQuote Underlined
" restore current syntax value
let b:current_syntax = old_syntax

BIN
etc/soft/nvim/+plugins/dhall-vim/dhall-syntax.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 128 KiB

39
etc/soft/nvim/+plugins/dhall-vim/doc/dhall.txt

@ -1,39 +0,0 @@ @@ -1,39 +0,0 @@
*dhall* Dhall syntax highlighting for Vim
____
=====================================================================
CONTENTS *DhallContents*
1. Config ......................................... ❘DhallConfig❘
2. License ....................................... ❘DhallLicense❘
======================================================================
Section 1: Config *DhallConfig*
----------------------------------------------------------------------
*'g:dhall_use_ctags'*
Values: 0, 1
Default: ''
Generate tags file for vim on write, using universal ctags. >
let g:dhall_use_ctags=1
<
*'g:dhall_format'*
Values: 0, 1
Default: ''
Format Dhall files on write >
let g:dhall_format=1
<
*'g:dhall_strip_whitespace'*
Values: 0, 1
Default: ''
To enable whitespace stripping >
let g:dhall_strip_whitespace=1
<
======================================================================
Section 2: License *DhallLicense*
This plugin is licensed under the BDS3 license.

1
etc/soft/nvim/+plugins/dhall-vim/ftdetect/dhall.vim

@ -1 +0,0 @@ @@ -1 +0,0 @@
autocmd BufNewFile,BufRead *.dhall set filetype=dhall

43
etc/soft/nvim/+plugins/dhall-vim/ftplugin/dhall.vim

@ -1,43 +0,0 @@ @@ -1,43 +0,0 @@
if exists('b:dhall_ftplugin')
finish
endif
let b:dhall_ftplugin = 1
setlocal commentstring=--\ %s
set smarttab
if exists('g:dhall_use_ctags')
if g:dhall_use_ctags == 1
autocmd BufWritePost *.dhall silent !ctags -R .
endif
endif
function! StripTrailingWhitespace()
let myline=line('.')
let mycolumn = col('.')
exec 'silent %s/ *$//'
call cursor(myline, mycolumn)
endfunction
if exists('g:dhall_strip_whitespace')
if g:dhall_strip_whitespace == 1
au BufWritePre *.dhall silent! call StripTrailingWhitespace()
endif
endif
function! DhallFormat()
let cursor = getpos('.')
exec 'normal! gg'
exec 'silent !dhall format ' . expand('%')
exec 'e'
call setpos('.', cursor)
endfunction
if exists('g:dhall_format')
if g:dhall_format == 1
au BufWritePost *.dhall call DhallFormat()
endif
endif
au BufNewFile,BufRead *.dhall setl shiftwidth=2

64
etc/soft/nvim/+plugins/dhall-vim/syntax/dhall.vim

@ -1,64 +0,0 @@ @@ -1,64 +0,0 @@
scriptencoding utf-8
if exists('b:current_syntax')
finish
endif
syntax match dhallInterpolation "\v\$\{([^\}]|\n)*\}"
syntax keyword dhallTodo TODO FIXME
syntax match dhallBrackets "[<>|]"
syntax match dhallOperator "+\|*\|#"
syntax match dhallOperator "//\|⫽"
syntax match dhallOperator "/\\\|∧"
syntax match dhallOperator "//\\\\\|⩓"
syntax match dhallNumber "\v[0-9]"
syntax match dhallNumber "\v\+[0-9]"
syntax match dhallIndex "\v\@[0-9]+" contains=dhallNumber
syntax match dhallLambda "∀\|λ\|→\|->\|\\"
syntax match dhallType "\v[A-Z][a-z0-9A-Z_]*"
syntax match dhallSpecialLabel "\v`[A-Z][a-z]*`"
syntax match dhallLabel "\v[A-Z][a-z]*/[a-z_][A-Za-z0-9\.\-]*"
syntax match dhallLabel "\v[a-z_][A-Za-z0-9\-]*"
syntax match dhallType "\v[a-zA-Z]+\.[A-Z][a-z0-9A-Z_]*"
syntax match dhallParens "(\|)\|\[\|\]\|,"
syntax match dhallRecord "{\|}\|:"
syntax keyword dhallKeyword let in forall constructors if then else merge env as with
syntax match dhallEsc +\\["\\abfnrtv$/]+
syntax match dhallSingleSpecial +'''+
syntax match dhallSingleSpecial +''${+
syntax match dhallComment '\v--.*$' contains=@Spell,dhallTodo
syntax region dhallMultilineComment start="{-" end="-}" contains=@Spell,dhallTodo,dhallMultilineComment
syntax match dhallUrl "https://[a-zA-Z0-9/.\-_\?\=\&]*"
syntax match dhallUrl "http://[a-zA-Z0-9/.\-_\?\=\&]*"
syntax match dhallUrl "/[a-zA-Z0-9/.\-_]*"
syntax match dhallUrl "\.\./[a-zA-Z0-9/.\-_]*"
syntax match dhallUrl "\./[a-zA-Z0-9/.\-_]*"
syntax region dhallString start=+''+ end=+''+ contains=@Spell,dhallInterpolation,dhallSingleSpecial
syntax region dhallString start=+"+ end=+"+ contains=dhallInterpolation,dhallEsc
syntax region dhallString start=+"/+ end=+"+ contains=dhallInterpolation,dhallEsc
syntax keyword dhallBool True False
syntax match dhallHash "sha256:[a-f0-9]+"
highlight link dhallSingleSpecial Special
highlight link dhallIndex Special
highlight link dhallSpecialLabel Operator
highlight link dhallEsc Special
highlight link dhallInterpolation Special
highlight link dhallTodo Todo
highlight link dhallBrackets Operator
highlight link dhallBool Underlined
highlight link dhallUrl String
highlight link dhallOperator Operator
highlight link dhallNumber Number
highlight link dhallLambda Special
highlight link dhallString String
highlight link dhallLabel Identifier
highlight link dhallRecord Special
highlight link dhallKeyword Keyword
highlight link dhallType Structure
highlight link dhallParens Special
highlight link dhallComment Comment
highlight link dhallMultilineComment Comment
highlight link dhallHash Keyword
let b:current_syntax = 'dhall'

2
etc/soft/nvim/+plugins/train.nvim/LICENSE → etc/soft/nvim/+plugins/impatient.nvim/LICENSE

@ -1,6 +1,6 @@ @@ -1,6 +1,6 @@
MIT License
Copyright (c) 2017 TJ DeVries
Copyright (c) 2022 Lewis Russell
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal

33
etc/soft/nvim/+plugins/impatient.nvim/Makefile

@ -0,0 +1,33 @@ @@ -0,0 +1,33 @@
.DEFAULT_GOAL := test
NEOVIM_BRANCH := master
FILTER=.*
NEOVIM := neovim-$(NEOVIM_BRANCH)
.PHONY: neovim
neovim: $(NEOVIM)
$(NEOVIM):
git clone --depth 1 https://github.com/neovim/neovim --branch $(NEOVIM_BRANCH) $@
make -C $@
export VIMRUNTIME=$(PWD)/$(NEOVIM)/runtime
.PHONY: test
test: $(NEOVIM)
$(NEOVIM)/.deps/usr/bin/busted \
-v \
--lazy \
--helper=$(PWD)/test/preload.lua \
--output test.busted.outputHandlers.nvim \
--lpath=$(PWD)/$(NEOVIM)/?.lua \
--lpath=$(PWD)/$(NEOVIM)/build/?.lua \
--lpath=$(PWD)/$(NEOVIM)/runtime/lua/?.lua \
--lpath=$(PWD)/?.lua \
--lpath=$(PWD)/lua/?.lua \
--filter=$(FILTER) \
$(PWD)/test
-@stty sane

805
etc/soft/nvim/+plugins/impatient.nvim/README.md

@ -0,0 +1,805 @@ @@ -0,0 +1,805 @@
# impatient.nvim
[![CI](https://github.com/lewis6991/impatient.nvim/workflows/CI/badge.svg?branch=main)](https://github.com/lewis6991/impatient.nvim/actions?query=workflow%3ACI)
Speed up loading Lua modules in Neovim to improve startup time.
## Optimisations
This plugin does several things to speed loading Lua modules and files.
### Implements a chunk cache
This is done by using `loadstring` to compile the Lua modules to bytecode and stores them in a cache file. The cache is invalidated using as hash consisting of:
- The modified time (`sec` and `nsec`) of the file path.
- The file size.
The cache file is located in `$XDG_CACHE_HOME/nvim/luacache_chunks`.
### Implements a module resolution cache
This is done by maintaining a table of module name to path. The cache is invalidated only if a path no longer exists.
The cache file is located in `$XDG_CACHE_HOME/nvim/luacache_modpaths`.
**Note**: This optimization breaks the loading order guarantee of the paths in `'runtimepath'`.
If you rely on this ordering then you can disable this cache (`_G.__luacache_config = { modpaths = { enable = false } }`.
See configuration below for more details.
## Requirements
- Neovim v0.7
## Installation
[packer.nvim](https://github.com/wbthomason/packer.nvim):
```lua
-- Is using a standard Neovim install, i.e. built from source or using a
-- provided appimage.
use 'lewis6991/impatient.nvim'
```
## Setup
To use impatient, you need only to include it near the top of your `init.lua` or `init.vim`.
init.lua:
```lua
require('impatient')
```
init.vim:
```viml
lua require('impatient')
```
## Commands
`:LuaCacheClear`:
Remove the loaded cache and delete the cache file. A new cache file will be created the next time you load Neovim.
`:LuaCacheLog`:
View log of impatient.
`:LuaCacheProfile`:
View profiling data. To enable, Impatient must be setup with:
```viml
lua require'impatient'.enable_profile()
```
## Configuration
Unlike most plugins which provide a `setup()` function, Impatient uses a configuration table stored in the global state, `_G.__luacache_config`.
If you modify the default configuration, it must be done before `require('impatient')` is run.
Default config:
```lua
_G.__luacache_config = {
chunks = {
enable = true,
path = vim.fn.stdpath('cache')..'/luacache_chunks',
},
modpaths = {
enable = true,
path = vim.fn.stdpath('cache')..'/luacache_modpaths',
}
}
require('impatient')
```
## Performance Example
Measured on a M1 MacBook Air.
<details>
<summary>Standard</summary>
```
────────────┬────────────┐
Resolve │ Load │
────────────┼────────────┼─────────────────────────────────────────────────────────────────
Time │ Time │ Module
────────────┼────────────┼─────────────────────────────────────────────────────────────────
54.337ms │ 34.257ms │ Total
────────────┼────────────┼─────────────────────────────────────────────────────────────────
7.264ms │ 0.470ms │ octo.colors
3.154ms │ 0.128ms │ diffview.bootstrap
2.086ms │ 0.231ms │ gitsigns
0.320ms │ 0.982ms │ octo.date
0.296ms │ 1.004ms │ octo.writers
0.322ms │ 0.893ms │ octo.utils
0.293ms │ 0.854ms │ vim.diagnostic
0.188ms │ 0.819ms │ vim.lsp.util
0.261ms │ 0.739ms │ vim.lsp
0.330ms │ 0.620ms │ octo.model.octo-buffer
0.392ms │ 0.422ms │ packer.load
0.287ms │ 0.436ms │ octo.reviews
0.367ms │ 0.325ms │ octo
0.309ms │ 0.381ms │ octo.graphql
0.454ms │ 0.221ms │ octo.base64
0.295ms │ 0.338ms │ octo.reviews.file-panel
0.305ms │ 0.306ms │ octo.reviews.file-entry
0.183ms │ 0.386ms │ vim.treesitter.query
0.418ms │ 0.149ms │ vim.uri
0.342ms │ 0.213ms │ octo.config
0.110ms │ 0.430ms │ nvim-lsp-installer.ui.status-win
0.296ms │ 0.209ms │ octo.window
0.202ms │ 0.288ms │ vim.lsp.rpc
0.352ms │ 0.120ms │ octo.gh
0.287ms │ 0.184ms │ octo.reviews.layout
0.209ms │ 0.260ms │ vim.lsp.handlers
0.108ms │ 0.360ms │ luasnip.nodes.snippet
0.243ms │ 0.212ms │ dirvish
0.289ms │ 0.159ms │ octo.mappings
0.228ms │ 0.220ms │ trouble.view
0.145ms │ 0.293ms │ plenary.job
0.188ms │ 0.244ms │ vim.lsp.diagnostic
0.032ms │ 0.391ms │ packer_compiled
0.188ms │ 0.228ms │ vim.lsp.buf
0.186ms │ 0.227ms │ vim.lsp.protocol
0.141ms │ 0.264ms │ nvim-treesitter.install
0.205ms │ 0.190ms │ vim.lsp._snippet
0.114ms │ 0.281ms │ colorizer
0.124ms │ 0.262ms │ nvim-treesitter.parsers
0.331ms │ 0.052ms │ octo.model.body-metadata
0.325ms │ 0.054ms │ octo.constants
0.296ms │ 0.081ms │ octo.reviews.renderer
0.326ms │ 0.050ms │ octo.model.thread-metadata
0.258ms │ 0.117ms │ trouble
0.106ms │ 0.267ms │ cmp.core
0.286ms │ 0.085ms │ octo.completion
0.120ms │ 0.250ms │ luasnip
0.286ms │ 0.084ms │ octo.ui.bubbles
0.068ms │ 0.298ms │ diffview.utils
0.325ms │ 0.039ms │ octo.model.title-metadata
0.126ms │ 0.234ms │ treesitter-context
0.282ms │ 0.073ms │ octo.signs
0.299ms │ 0.043ms │ octo.folds
0.112ms │ 0.228ms │ luasnip.util.util
0.181ms │ 0.156ms │ vim.treesitter.languagetree
0.260ms │ 0.073ms │ vim.keymap
0.101ms │ 0.231ms │ cmp.entry
0.182ms │ 0.145ms │ vim.treesitter.highlighter
0.191ms │ 0.121ms │ trouble.util
0.190ms │ 0.119ms │ vim.lsp.codelens
0.190ms │ 0.117ms │ vim.lsp.sync
0.197ms │ 0.105ms │ vim.highlight
0.170ms │ 0.132ms │ spellsitter
0.086ms │ 0.213ms │ github_dark
0.200ms │ 0.099ms │ persistence
0.100ms │ 0.196ms │ cmp.view.custom_entries_view
0.118ms │ 0.176ms │ nvim-treesitter.configs
0.090ms │ 0.201ms │ gitsigns.git
0.114ms │ 0.170ms │ nvim-lsp-installer.ui.display
0.217ms │ 0.064ms │ plenary.async.async
0.195ms │ 0.078ms │ vim.lsp.log
0.191ms │ 0.081ms │ trouble.renderer
0.122ms │ 0.150ms │ nvim-treesitter.ts_utils
0.235ms │ 0.035ms │ plenary
0.100ms │ 0.168ms │ cmp.source
0.191ms │ 0.076ms │ vim.treesitter
0.106ms │ 0.160ms │ lspconfig.util
0.118ms │ 0.147ms │ nvim-treesitter.query
0.088ms │ 0.176ms │ gitsigns.config
0.108ms │ 0.150ms │ cmp
0.193ms │ 0.063ms │ trouble.providers
0.206ms │ 0.050ms │ tmux.version.parse
0.103ms │ 0.151ms │ cmp.view.wildmenu_entries_view
0.070ms │ 0.178ms │ diffview.path
0.189ms │ 0.058ms │ trouble.providers.lsp
0.096ms │ 0.147ms │ luasnip.util.parser
0.093ms │ 0.150ms │ gitsigns.manager
0.097ms │ 0.145ms │ null-ls.utils
0.155ms │ 0.087ms │ plenary.async.control
0.105ms │ 0.135ms │ nvim-lsp-installer.installers.std
0.107ms │ 0.130ms │ lspconfig.configs
0.097ms │ 0.140ms │ null-ls.helpers.generator_factory
0.188ms │ 0.047ms │ trouble.providers.telescope
0.191ms │ 0.040ms │ trouble.config
0.099ms │ 0.131ms │ cmp.utils.window
0.096ms │ 0.133ms │ luasnip.nodes.choiceNode
0.192ms │ 0.036ms │ trouble.providers.qf
0.104ms │ 0.124ms │ cmp.utils.keymap
0.089ms │ 0.139ms │ gitsigns.hunks
0.104ms │ 0.122ms │ nvim-lsp-installer.process
0.096ms │ 0.129ms │ null-ls.sources
0.116ms │ 0.108ms │ nvim-lsp-installer
0.096ms │ 0.128ms │ luasnip.nodes.dynamicNode
0.162ms │ 0.062ms │ tmux.copy
0.197ms │ 0.025ms │ trouble.folds
0.156ms │ 0.066ms │ plenary.async.util
0.150ms │ 0.071ms │ cmp.utils.highlight
0.105ms │ 0.116ms │ nvim-lsp-installer.server
0.118ms │ 0.100ms │ nvim-treesitter.utils
0.182ms │ 0.035ms │ trouble.providers.diagnostic
0.103ms │ 0.114ms │ luasnip.nodes.node
0.185ms │ 0.031ms │ trouble.colors
0.180ms │ 0.035ms │ vim.ui
0.162ms │ 0.053ms │ spaceless
0.118ms │ 0.097ms │ nvim-treesitter.shell_command_selectors
0.160ms │ 0.053ms │ tmux.wrapper.tmux
0.182ms │ 0.031ms │ vim.treesitter.language
0.178ms │ 0.035ms │ trouble.text
0.157ms │ 0.054ms │ plenary.vararg.rotate
0.106ms │ 0.104ms │ nvim-lsp-installer.installers.context
0.181ms │ 0.028ms │ tmux
0.158ms │ 0.050ms │ nvim-treesitter-playground
0.067ms │ 0.140ms │ diffview.oop
0.158ms │ 0.047ms │ tmux.resize
0.166ms │ 0.039ms │ tmux.log.convert
0.161ms │ 0.044ms │ tmux.layout
0.155ms │ 0.048ms │ plenary.async.structs
0.101ms │ 0.102ms │ cmp.view
0.096ms │ 0.105ms │ luasnip.util.environ
0.145ms │ 0.055ms │ plenary.async
0.163ms │ 0.037ms │ tmux.navigation.navigate
0.179ms │ 0.020ms │ tmux.keymaps
0.155ms │ 0.044ms │ plenary.functional
0.102ms │ 0.097ms │ cmp.matcher
0.103ms │ 0.095ms │ cmp.view.ghost_text_view
0.106ms │ 0.091ms │ colorizer.nvim
0.168ms │ 0.029ms │ tmux.log
0.106ms │ 0.090ms │ nvim-lsp-installer._generated.filetype_map
0.122ms │ 0.073ms │ nvim-treesitter.info
0.098ms │ 0.097ms │ null-ls.client
0.105ms │ 0.089ms │ nvim-lsp-installer.log
0.170ms │ 0.024ms │ tmux.navigation
0.109ms │ 0.084ms │ nvim-lsp-installer.servers
0.098ms │ 0.095ms │ null-ls.helpers.diagnostics
0.160ms │ 0.033ms │ tmux.configuration.options
0.100ms │ 0.091ms │ cmp.utils.misc
0.044ms │ 0.148ms │ lewis6991
0.104ms │ 0.088ms │ colorizer.trie
0.163ms │ 0.028ms │ ts_context_commentstring
0.054ms │ 0.136ms │ cmp-rg
0.130ms │ 0.060ms │ nvim-treesitter.query_predicates
0.151ms │ 0.039ms │ plenary.reload
0.096ms │ 0.094ms │ luasnip.nodes.insertNode
0.160ms │ 0.028ms │ tmux.layout.parse
0.096ms │ 0.093ms │ luasnip.nodes.restoreNode
0.166ms │ 0.022ms │ tmux.configuration.validate
0.100ms │ 0.088ms │ cmp.view.native_entries_view
0.155ms │ 0.033ms │ plenary.tbl
0.126ms │ 0.062ms │ lspconfig.server_configurations.sumneko_lua
0.029ms │ 0.160ms │ cmp_buffer.buffer
0.105ms │ 0.083ms │ cmp.utils.str
0.162ms │ 0.025ms │ tmux.log.severity
0.164ms │ 0.024ms │ tmux.wrapper.nvim
0.107ms │ 0.081ms │ nvim-lsp-installer.ui.status-win.components.settings-schema
0.021ms │ 0.167ms │ lewis6991.null-ls
0.163ms │ 0.024ms │ tmux.configuration
0.116ms │ 0.071ms │ nvim-treesitter.tsrange
0.161ms │ 0.026ms │ tmux.log.channels
0.094ms │ 0.091ms │ gitsigns.debug
0.163ms │ 0.021ms │ plenary.vararg
0.166ms │ 0.018ms │ tmux.version
0.160ms │ 0.022ms │ tmux.configuration.logging
0.155ms │ 0.026ms │ plenary.errors
0.127ms │ 0.053ms │ nvim-treesitter
0.094ms │ 0.085ms │ null-ls.info
0.100ms │ 0.079ms │ cmp.config
0.095ms │ 0.084ms │ null-ls.diagnostics
0.055ms │ 0.123ms │ cmp_path
0.139ms │ 0.038ms │ plenary.async.tests
0.098ms │ 0.078ms │ null-ls.config
0.100ms │ 0.076ms │ cmp.view.docs_view
0.102ms │ 0.074ms │ cmp.utils.feedkeys
0.089ms │ 0.085ms │ gitsigns.current_line_blame
0.127ms │ 0.047ms │ null-ls
0.107ms │ 0.066ms │ nvim-lsp-installer.installers
0.095ms │ 0.078ms │ luasnip.util.mark
0.106ms │ 0.066ms │ nvim-lsp-installer.fs
0.142ms │ 0.030ms │ persistence.config
0.100ms │ 0.070ms │ cmp.config.default
0.078ms │ 0.091ms │ foldsigns
0.120ms │ 0.048ms │ lua-dev
0.113ms │ 0.053ms │ nvim-lsp-installer.ui
0.029ms │ 0.138ms │ lewis6991.status
0.118ms │ 0.047ms │ lspconfig
0.113ms │ 0.051ms │ nvim-lsp-installer.jobs.outdated-servers
0.105ms │ 0.058ms │ nvim-lsp-installer.installers.npm
0.106ms │ 0.057ms │ nvim-lsp-installer.core.receipt
0.101ms │ 0.061ms │ cmp.utils.char
0.091ms │ 0.071ms │ gitsigns.signs
0.097ms │ 0.065ms │ luasnip.nodes.util
0.126ms │ 0.034ms │ treesitter-context.utils
0.096ms │ 0.065ms │ lua-dev.config
0.109ms │ 0.052ms │ nvim-lsp-installer.core.fetch
0.103ms │ 0.055ms │ cmp.types.lsp
0.099ms │ 0.059ms │ luasnip.nodes.functionNode
0.090ms │ 0.067ms │ gitsigns.util
0.110ms │ 0.047ms │ nvim-lsp-installer.jobs.outdated-servers.cargo
0.096ms │ 0.061ms │ luasnip.config
0.100ms │ 0.057ms │ cmp.utils.async
0.101ms │ 0.055ms │ cmp.context
0.091ms │ 0.064ms │ gitsigns.highlight
0.094ms │ 0.061ms │ lua-dev.sumneko
0.094ms │ 0.061ms │ gitsigns.subprocess
0.067ms │ 0.088ms │ cmp_luasnip
0.105ms │ 0.050ms │ nvim-lsp-installer.data
0.105ms │ 0.049ms │ nvim-lsp-installer.installers.pip3
0.120ms │ 0.034ms │ lspconfig.server_configurations.bashls
0.107ms │ 0.046ms │ nvim-lsp-installer.core.clients.github
0.107ms │ 0.045ms │ nvim-lsp-installer.installers.shell
0.099ms │ 0.053ms │ cmp.config.compare
0.109ms │ 0.043ms │ lspconfig.server_configurations.clangd
0.115ms │ 0.036ms │ lspconfig.server_configurations.vimls
0.097ms │ 0.054ms │ luasnip.util.pattern_tokenizer
0.097ms │ 0.053ms │ null-ls.helpers.make_builtin
0.101ms │ 0.049ms │ cmp.utils.api
0.118ms │ 0.032ms │ lspconfig.server_configurations.jedi_language_server
0.106ms │ 0.043ms │ nvim-lsp-installer.jobs.outdated-servers.pip3
0.106ms │ 0.043ms │ nvim-lsp-installer.jobs.outdated-servers.gem
0.108ms │ 0.040ms │ nvim-lsp-installer._generated.language_autocomplete_map
0.104ms │ 0.043ms │ nvim-lsp-installer.installers.composer
0.101ms │ 0.046ms │ cmp.config.mapping
0.047ms │ 0.100ms │ cmp_nvim_lsp_signature_help
0.109ms │ 0.037ms │ nvim-lsp-installer.servers.sumneko_lua
0.115ms │ 0.028ms │ nvim-treesitter.caching
0.096ms │ 0.047ms │ null-ls.state
0.090ms │ 0.053ms │ gitsigns.debounce
0.059ms │ 0.084ms │ cmp_tmux.tmux
0.096ms │ 0.045ms │ null-ls.builtins.diagnostics.flake8
0.106ms │ 0.034ms │ nvim-lsp-installer.jobs.pool
0.106ms │ 0.033ms │ nvim-lsp-installer.ui.status-win.server_hints
0.105ms │ 0.034ms │ nvim-lsp-installer.installers.gem
0.107ms │ 0.032ms │ nvim-lsp-installer.jobs.outdated-servers.npm
0.106ms │ 0.031ms │ nvim-lsp-installer.jobs.outdated-servers.git
0.114ms │ 0.022ms │ nvim-lsp-installer.servers.jedi_language_server
0.105ms │ 0.031ms │ nvim-lsp-installer.jobs.outdated-servers.composer
0.098ms │ 0.038ms │ null-ls.methods
0.109ms │ 0.026ms │ nvim-lsp-installer.jobs.outdated-servers.version-check-result
0.106ms │ 0.029ms │ nvim-lsp-installer.settings
0.107ms │ 0.027ms │ cmp.utils.debug
0.103ms │ 0.031ms │ cmp.types.cmp
0.070ms │ 0.064ms │ diffview.events
0.108ms │ 0.026ms │ nvim-lsp-installer.platform
0.097ms │ 0.037ms │ null-ls.helpers.command_resolver
0.104ms │ 0.029ms │ cmp.config.sources
0.107ms │ 0.026ms │ nvim-lsp-installer.jobs.outdated-servers.github_release_file
0.099ms │ 0.033ms │ cmp.utils.cache
0.107ms │ 0.025ms │ nvim-lsp-installer.path
0.101ms │ 0.030ms │ cmp.utils.autocmd
0.097ms │ 0.034ms │ null-ls.logger
0.100ms │ 0.031ms │ cmp.utils.event
0.088ms │ 0.042ms │ gitsigns.cache
0.103ms │ 0.027ms │ cmp.utils.pattern
0.108ms │ 0.022ms │ nvim-lsp-installer.jobs.outdated-servers.jdtls
0.103ms │ 0.027ms │ cmp.utils.buffer
0.095ms │ 0.034ms │ luasnip.nodes.textNode
0.096ms │ 0.033ms │ luasnip.util.dict
0.108ms │ 0.021ms │ nvim-lsp-installer.servers.bashls
0.108ms │ 0.021ms │ nvim-lsp-installer.ui.state
0.110ms │ 0.018ms │ nvim-lsp-installer.servers.vimls
0.101ms │ 0.027ms │ null-ls.helpers.range_formatting_args_factory
0.057ms │ 0.071ms │ cmp_treesitter.lru
0.105ms │ 0.022ms │ nvim-lsp-installer.dispatcher
0.097ms │ 0.030ms │ luasnip.extras.filetype_functions
0.103ms │ 0.024ms │ luasnip.session
0.105ms │ 0.021ms │ nvim-lsp-installer.core.clients.crates
0.105ms │ 0.021ms │ nvim-lsp-installer.jobs.outdated-servers.github_tag
0.110ms │ 0.016ms │ cmp.types
0.105ms │ 0.021ms │ nvim-lsp-installer.core.clients.eclipse
0.105ms │ 0.021ms │ nvim-lsp-installer.notify
0.089ms │ 0.036ms │ gitsigns.status
0.096ms │ 0.029ms │ null-ls.builtins.diagnostics.teal
0.097ms │ 0.027ms │ null-ls.builtins
0.103ms │ 0.021ms │ cmp.types.vim
0.060ms │ 0.062ms │ cmp_tmux.source
0.100ms │ 0.022ms │ null-ls.helpers
0.098ms │ 0.024ms │ null-ls.builtins.diagnostics.gitlint
0.065ms │ 0.056ms │ cmp_treesitter
0.024ms │ 0.097ms │ buftabline.buftab
0.095ms │ 0.026ms │ null-ls.builtins.diagnostics.shellcheck
0.095ms │ 0.026ms │ null-ls.builtins.diagnostics.luacheck
0.097ms │ 0.021ms │ null-ls.helpers.formatter_factory
0.097ms │ 0.022ms │ luasnip.util.events
0.097ms │ 0.021ms │ luasnip.util.types
0.096ms │ 0.022ms │ luasnip.util.functions
0.037ms │ 0.078ms │ cmp_cmdline
0.032ms │ 0.083ms │ cmp_buffer.source
0.040ms │ 0.074ms │ lewis6991.cmp
0.060ms │ 0.054ms │ cmp_treesitter.treesitter
0.089ms │ 0.025ms │ gitsigns.message
0.039ms │ 0.073ms │ cmp_nvim_lsp.source
0.055ms │ 0.054ms │ buftabline.build
0.026ms │ 0.083ms │ lewis6991.lsp
0.051ms │ 0.055ms │ cmp_nvim_lua
0.033ms │ 0.065ms │ cleanfold
0.071ms │ 0.025ms │ cmp_tmux
0.043ms │ 0.053ms │ cmp_nvim_lsp
0.058ms │ 0.033ms │ cmp-spell
0.043ms │ 0.037ms │ cmp_emoji
0.029ms │ 0.049ms │ lewis6991.floating_man
0.032ms │ 0.042ms │ cmp_buffer.timer
0.024ms │ 0.050ms │ lewis6991.treesitter
0.019ms │ 0.054ms │ lewis6991.cmp_gh
0.025ms │ 0.046ms │ buftabline.buffers
0.021ms │ 0.048ms │ lewis6991.telescope
0.024ms │ 0.031ms │ buftabline
0.035ms │ 0.019ms │ cmp_buffer
0.019ms │ 0.035ms │ buftabline.utils
0.021ms │ 0.030ms │ buftabline.highlights
0.020ms │ 0.032ms │ buftabline.tabpage-tab
0.019ms │ 0.030ms │ buftabline.options
0.020ms │ 0.026ms │ buftabline.tabpages
────────────┴────────────┴─────────────────────────────────────────────────────────────────
```
</details>
Total resolve: 54.337ms, total load: 34.257ms
<details>
<summary>With cache</summary>
```
────────────┬────────────┐
Resolve │ Load │
────────────┼────────────┼─────────────────────────────────────────────────────────────────
Time │ Time │ Module
────────────┼────────────┼─────────────────────────────────────────────────────────────────
6.357ms │ 6.796ms │ Total
────────────┼────────────┼─────────────────────────────────────────────────────────────────
0.041ms │ 2.021ms │ octo.writers
0.118ms │ 0.160ms │ lewis6991.plugins
0.050ms │ 0.144ms │ octo.date
0.035ms │ 0.153ms │ octo.utils
0.057ms │ 0.099ms │ octo.model.octo-buffer
0.047ms │ 0.105ms │ packer
0.058ms │ 0.080ms │ octo.colors
0.121ms │ 0.015ms │ gitsigns.cache
0.082ms │ 0.037ms │ packer.load
0.107ms │ 0.008ms │ gitsigns.debounce
0.048ms │ 0.064ms │ octo.config
0.048ms │ 0.061ms │ octo.graphql
0.049ms │ 0.051ms │ octo
0.043ms │ 0.057ms │ vim.diagnostic
0.085ms │ 0.013ms │ gitsigns.highlight
0.065ms │ 0.032ms │ octo.base64
0.035ms │ 0.060ms │ vim.lsp
0.056ms │ 0.035ms │ octo.gh
0.045ms │ 0.045ms │ octo.mappings
0.026ms │ 0.060ms │ octo.reviews
0.037ms │ 0.045ms │ packer.plugin_utils
0.030ms │ 0.049ms │ octo.reviews.file-panel
0.018ms │ 0.056ms │ vim.lsp.util
0.043ms │ 0.030ms │ packer.log
0.036ms │ 0.032ms │ packer.util
0.032ms │ 0.035ms │ octo.reviews.file-entry
0.021ms │ 0.045ms │ packer_compiled
0.052ms │ 0.014ms │ octo.model.body-metadata
0.033ms │ 0.027ms │ octo.reviews.layout
0.014ms │ 0.047ms │ nvim-treesitter.parsers
0.035ms │ 0.024ms │ vim.lsp.handlers
0.014ms │ 0.044ms │ nvim-lsp-installer.ui.status-win
0.046ms │ 0.012ms │ octo.completion
0.037ms │ 0.021ms │ octo.constants
0.032ms │ 0.025ms │ lewis6991
0.040ms │ 0.017ms │ persistence
0.030ms │ 0.026ms │ diffview.utils
0.035ms │ 0.020ms │ packer.result
0.015ms │ 0.040ms │ gitsigns.config
0.031ms │ 0.024ms │ packer.async
0.041ms │ 0.013ms │ vim.uri
0.044ms │ 0.010ms │ octo.model.thread-metadata
0.018ms │ 0.035ms │ gitsigns.debug
0.023ms │ 0.030ms │ github_dark
0.030ms │ 0.023ms │ packer.jobs
0.039ms │ 0.013ms │ buftabline.build
0.037ms │ 0.014ms │ octo.model.title-metadata
0.025ms │ 0.025ms │ vim.lsp.buf
0.022ms │ 0.027ms │ gitsigns
0.027ms │ 0.022ms │ lewis6991.status
0.016ms │ 0.032ms │ gitsigns.git
0.026ms │ 0.020ms │ octo.window
0.033ms │ 0.012ms │ octo.folds
0.037ms │ 0.008ms │ trouble.providers.lsp
0.016ms │ 0.028ms │ vim.lsp.protocol
0.028ms │ 0.016ms │ octo.signs
0.028ms │ 0.014ms │ null-ls
0.027ms │ 0.014ms │ octo.reviews.renderer
0.018ms │ 0.024ms │ trouble.view
0.017ms │ 0.025ms │ luasnip.nodes.snippet
0.023ms │ 0.018ms │ colorizer.nvim
0.017ms │ 0.024ms │ vim.lsp._snippet
0.015ms │ 0.025ms │ nvim-treesitter.install
0.018ms │ 0.022ms │ plenary.async.structs
0.018ms │ 0.021ms │ dirvish
0.027ms │ 0.012ms │ octo.ui.bubbles
0.019ms │ 0.020ms │ treesitter-context
0.015ms │ 0.024ms │ vim.lsp.diagnostic
0.016ms │ 0.023ms │ vim.lsp.rpc
0.022ms │ 0.016ms │ trouble
0.022ms │ 0.016ms │ null-ls.helpers.generator_factory
0.020ms │ 0.017ms │ luasnip
0.014ms │ 0.023ms │ plenary.job
0.026ms │ 0.011ms │ lewis6991.cmp
0.027ms │ 0.010ms │ trouble.providers
0.022ms │ 0.014ms │ nvim-treesitter.query
0.018ms │ 0.018ms │ vim.treesitter.highlighter
0.017ms │ 0.018ms │ nvim-treesitter.shell_command_selectors
0.014ms │ 0.021ms │ nvim-treesitter.configs
0.025ms │ 0.010ms │ lewis6991.floating_man
0.022ms │ 0.012ms │ vim.keymap
0.013ms │ 0.021ms │ cmp.entry
0.024ms │ 0.010ms │ lspconfig.server_configurations.bashls
0.018ms │ 0.016ms │ gitsigns.hunks
0.017ms │ 0.017ms │ gitsigns.status
0.014ms │ 0.019ms │ cmp.core
0.018ms │ 0.015ms │ spellsitter
0.014ms │ 0.019ms │ colorizer
0.024ms │ 0.009ms │ diffview.bootstrap
0.016ms │ 0.016ms │ null-ls.utils
0.021ms │ 0.011ms │ nvim-treesitter.info
0.022ms │ 0.010ms │ vim.highlight
0.016ms │ 0.016ms │ null-ls.info
0.019ms │ 0.013ms │ cmp_path
0.026ms │ 0.006ms │ cmp.utils.autocmd
0.021ms │ 0.011ms │ foldsigns
0.014ms │ 0.018ms │ lewis6991.null-ls
0.018ms │ 0.013ms │ cmp.view
0.017ms │ 0.014ms │ null-ls.client
0.016ms │ 0.015ms │ gitsigns.manager
0.013ms │ 0.018ms │ cmp.view.custom_entries_view
0.015ms │ 0.015ms │ nvim-lsp-installer.ui.display
0.020ms │ 0.010ms │ null-ls.methods
0.016ms │ 0.014ms │ plenary.async.control
0.019ms │ 0.011ms │ null-ls.diagnostics
0.014ms │ 0.015ms │ luasnip.util.util
0.017ms │ 0.013ms │ gitsigns.current_line_blame
0.013ms │ 0.016ms │ buftabline.buftab
0.015ms │ 0.015ms │ trouble.util
0.015ms │ 0.015ms │ luasnip.config
0.019ms │ 0.010ms │ plenary.async.async
0.018ms │ 0.012ms │ nvim-treesitter.tsrange
0.021ms │ 0.007ms │ cmp_nvim_lua
0.014ms │ 0.015ms │ vim.treesitter.query
0.015ms │ 0.014ms │ cmp.source
0.014ms │ 0.015ms │ vim.treesitter.languagetree
0.012ms │ 0.016ms │ nvim-lsp-installer._generated.filetype_map
0.015ms │ 0.014ms │ nvim-lsp-installer.servers
0.014ms │ 0.014ms │ lspconfig.util
0.011ms │ 0.017ms │ cmp
0.015ms │ 0.013ms │ cmp.view.wildmenu_entries_view
0.021ms │ 0.007ms │ lspconfig.server_configurations.jedi_language_server
0.015ms │ 0.013ms │ lua-dev
0.018ms │ 0.010ms │ gitsigns.util
0.014ms │ 0.014ms │ vim.lsp.codelens
0.017ms │ 0.011ms │ plenary.async.util
0.013ms │ 0.014ms │ null-ls.sources
0.015ms │ 0.012ms │ nvim-treesitter.query_predicates
0.013ms │ 0.015ms │ luasnip.nodes.choiceNode
0.015ms │ 0.013ms │ null-ls.helpers.diagnostics
0.017ms │ 0.011ms │ trouble.renderer
0.015ms │ 0.013ms │ luasnip.nodes.node
0.014ms │ 0.013ms │ lua-dev.sumneko
0.013ms │ 0.014ms │ cmp.utils.window
0.021ms │ 0.006ms │ treesitter-context.utils
0.018ms │ 0.009ms │ cleanfold
0.015ms │ 0.012ms │ nvim-treesitter.ts_utils
0.012ms │ 0.015ms │ nvim-lsp-installer.installers.std
0.015ms │ 0.012ms │ nvim-lsp-installer.server
0.014ms │ 0.012ms │ lewis6991.lsp
0.016ms │ 0.011ms │ gitsigns.signs
0.020ms │ 0.006ms │ buftabline
0.019ms │ 0.007ms │ plenary.tbl
0.013ms │ 0.013ms │ nvim-lsp-installer
0.018ms │ 0.008ms │ plenary
0.015ms │ 0.010ms │ cmp_luasnip
0.019ms │ 0.007ms │ null-ls.logger
0.016ms │ 0.010ms │ vim.lsp.sync
0.016ms │ 0.010ms │ spaceless
0.017ms │ 0.009ms │ gitsigns.subprocess
0.016ms │ 0.009ms │ plenary.functional
0.016ms │ 0.010ms │ buftabline.buffers
0.016ms │ 0.009ms │ vim.lsp.log
0.019ms │ 0.006ms │ cmp_tmux
0.013ms │ 0.012ms │ luasnip.nodes.dynamicNode
0.017ms │ 0.008ms │ vim.treesitter
0.013ms │ 0.013ms │ nvim-lsp-installer.process
0.013ms │ 0.012ms │ luasnip.util.environ
0.015ms │ 0.009ms │ lewis6991.treesitter
0.015ms │ 0.010ms │ null-ls.config
0.019ms │ 0.006ms │ ts_context_commentstring
0.013ms │ 0.012ms │ cmp_buffer.buffer
0.018ms │ 0.007ms │ null-ls.builtins.diagnostics.shellcheck
0.015ms │ 0.010ms │ null-ls.helpers.make_builtin
0.012ms │ 0.012ms │ diffview.path
0.016ms │ 0.008ms │ null-ls.builtins.diagnostics.gitlint
0.017ms │ 0.007ms │ trouble.providers.telescope
0.013ms │ 0.011ms │ diffview.oop
0.015ms │ 0.010ms │ cmp-rg
0.013ms │ 0.011ms │ cmp.utils.keymap
0.014ms │ 0.011ms │ nvim-treesitter
0.018ms │ 0.007ms │ cmp.utils.highlight
0.016ms │ 0.008ms │ lspconfig.server_configurations.sumneko_lua
0.015ms │ 0.009ms │ colorizer.trie
0.016ms │ 0.007ms │ plenary.vararg.rotate
0.015ms │ 0.009ms │ trouble.config
0.011ms │ 0.012ms │ lspconfig.configs
0.014ms │ 0.009ms │ null-ls.helpers.command_resolver
0.016ms │ 0.007ms │ cmp_tmux.source
0.016ms │ 0.007ms │ lspconfig
0.017ms │ 0.006ms │ plenary.vararg
0.012ms │ 0.011ms │ nvim-lsp-installer.installers.context
0.014ms │ 0.009ms │ cmp.view.native_entries_view
0.014ms │ 0.009ms │ cmp.config.default
0.017ms │ 0.006ms │ tmux.version.parse
0.016ms │ 0.007ms │ gitsigns.message
0.017ms │ 0.006ms │ persistence.config
0.013ms │ 0.010ms │ cmp_nvim_lsp_signature_help
0.012ms │ 0.010ms │ cmp.view.docs_view
0.017ms │ 0.006ms │ cmp.config.sources
0.013ms │ 0.009ms │ luasnip.nodes.restoreNode
0.014ms │ 0.009ms │ vim.ui
0.013ms │ 0.010ms │ luasnip.nodes.insertNode
0.013ms │ 0.010ms │ null-ls.state
0.014ms │ 0.008ms │ lspconfig.server_configurations.vimls
0.016ms │ 0.006ms │ plenary.errors
0.014ms │ 0.008ms │ null-ls.builtins.diagnostics.flake8
0.016ms │ 0.006ms │ null-ls.helpers
0.015ms │ 0.008ms │ null-ls.builtins.diagnostics.luacheck
0.014ms │ 0.008ms │ luasnip.util.mark
0.015ms │ 0.008ms │ cmp.utils.buffer
0.012ms │ 0.010ms │ nvim-lsp-installer.log
0.015ms │ 0.007ms │ luasnip.nodes.util
0.015ms │ 0.007ms │ null-ls.builtins.diagnostics.teal
0.016ms │ 0.006ms │ null-ls.helpers.range_formatting_args_factory
0.012ms │ 0.010ms │ nvim-treesitter.utils
0.015ms │ 0.007ms │ cmp.utils.event
0.013ms │ 0.009ms │ tmux.wrapper.tmux
0.015ms │ 0.007ms │ nvim-treesitter-playground
0.012ms │ 0.010ms │ cmp_buffer.source
0.015ms │ 0.007ms │ cmp_treesitter
0.013ms │ 0.009ms │ luasnip.util.parser
0.015ms │ 0.006ms │ trouble.providers.qf
0.014ms │ 0.008ms │ lewis6991.telescope
0.014ms │ 0.007ms │ cmp_tmux.tmux
0.014ms │ 0.007ms │ cmp_nvim_lsp.source
0.015ms │ 0.006ms │ plenary.reload
0.014ms │ 0.008ms │ buftabline.highlights
0.015ms │ 0.006ms │ trouble.providers.diagnostic
0.015ms │ 0.007ms │ nvim-lsp-installer.core.clients.github
0.014ms │ 0.007ms │ nvim-lsp-installer.installers.shell
0.016ms │ 0.005ms │ cmp-spell
0.014ms │ 0.007ms │ null-ls.builtins
0.013ms │ 0.008ms │ cmp_treesitter.lru
0.016ms │ 0.005ms │ buftabline.tabpages
0.015ms │ 0.006ms │ buftabline.options
0.016ms │ 0.005ms │ lua-dev.config
0.015ms │ 0.006ms │ nvim-lsp-installer.jobs.outdated-servers.cargo
0.014ms │ 0.007ms │ diffview.events
0.013ms │ 0.008ms │ nvim-lsp-installer.fs
0.013ms │ 0.008ms │ cmp.utils.feedkeys
0.013ms │ 0.007ms │ nvim-treesitter.caching
0.013ms │ 0.008ms │ nvim-lsp-installer._generated.language_autocomplete_map
0.013ms │ 0.007ms │ cmp.view.ghost_text_view
0.013ms │ 0.008ms │ cmp_nvim_lsp
0.013ms │ 0.007ms │ luasnip.nodes.functionNode
0.013ms │ 0.007ms │ nvim-lsp-installer.jobs.outdated-servers
0.012ms │ 0.008ms │ nvim-lsp-installer.ui.status-win.components.settings-schema
0.012ms │ 0.009ms │ lewis6991.cmp_gh
0.015ms │ 0.006ms │ luasnip.util.dict
0.013ms │ 0.007ms │ plenary.async
0.014ms │ 0.006ms │ nvim-lsp-installer.installers.composer
0.013ms │ 0.007ms │ cmp_treesitter.treesitter
0.014ms │ 0.006ms │ nvim-lsp-installer.jobs.outdated-servers.gem
0.015ms │ 0.005ms │ nvim-lsp-installer.platform
0.014ms │ 0.006ms │ buftabline.utils
0.013ms │ 0.007ms │ trouble.text
0.011ms │ 0.008ms │ cmp.config
0.013ms │ 0.006ms │ trouble.colors
0.012ms │ 0.007ms │ cmp.utils.misc
0.012ms │ 0.008ms │ nvim-lsp-installer.installers.npm
0.013ms │ 0.007ms │ lspconfig.server_configurations.clangd
0.012ms │ 0.007ms │ cmp_cmdline
0.011ms │ 0.008ms │ cmp.types.lsp
0.014ms │ 0.006ms │ vim.treesitter.language
0.014ms │ 0.006ms │ cmp.config.mapping
0.015ms │ 0.004ms │ luasnip.util.events
0.014ms │ 0.005ms │ luasnip.extras.filetype_functions
0.012ms │ 0.007ms │ cmp.utils.async
0.012ms │ 0.007ms │ cmp.config.compare
0.013ms │ 0.005ms │ cmp_emoji
0.015ms │ 0.004ms │ cmp_buffer
0.011ms │ 0.007ms │ nvim-lsp-installer.core.receipt
0.012ms │ 0.007ms │ nvim-lsp-installer.ui
0.013ms │ 0.006ms │ cmp.utils.api
0.012ms │ 0.007ms │ nvim-lsp-installer.core.fetch
0.013ms │ 0.005ms │ nvim-lsp-installer.jobs.pool
0.011ms │ 0.007ms │ nvim-lsp-installer.installers
0.012ms │ 0.007ms │ nvim-lsp-installer.data
0.013ms │ 0.006ms │ cmp.matcher
0.014ms │ 0.005ms │ tmux
0.011ms │ 0.008ms │ tmux.copy
0.013ms │ 0.005ms │ luasnip.util.types
0.014ms │ 0.004ms │ nvim-lsp-installer.servers.jedi_language_server
0.014ms │ 0.004ms │ nvim-lsp-installer.servers.vimls
0.014ms │ 0.004ms │ cmp.utils.cache
0.013ms │ 0.006ms │ luasnip.util.pattern_tokenizer
0.012ms │ 0.006ms │ luasnip.nodes.textNode
0.013ms │ 0.005ms │ null-ls.helpers.formatter_factory
0.013ms │ 0.006ms │ plenary.async.tests
0.013ms │ 0.005ms │ nvim-lsp-installer.jobs.outdated-servers.version-check-result
0.012ms │ 0.005ms │ nvim-lsp-installer.settings
0.011ms │ 0.006ms │ cmp.context
0.011ms │ 0.006ms │ cmp.utils.str
0.013ms │ 0.004ms │ luasnip.session
0.013ms │ 0.005ms │ nvim-lsp-installer.jobs.outdated-servers.composer
0.012ms │ 0.006ms │ nvim-lsp-installer.servers.sumneko_lua
0.012ms │ 0.005ms │ cmp_buffer.timer
0.011ms │ 0.006ms │ cmp.utils.char
0.013ms │ 0.004ms │ cmp.utils.pattern
0.011ms │ 0.006ms │ nvim-lsp-installer.installers.pip3
0.013ms │ 0.004ms │ luasnip.util.functions
0.013ms │ 0.005ms │ tmux.log.channels
0.012ms │ 0.005ms │ tmux.navigation
0.013ms │ 0.005ms │ trouble.folds
0.012ms │ 0.005ms │ nvim-lsp-installer.ui.status-win.server_hints
0.012ms │ 0.005ms │ nvim-lsp-installer.jobs.outdated-servers.pip3
0.012ms │ 0.005ms │ nvim-lsp-installer.jobs.outdated-servers.npm
0.011ms │ 0.006ms │ cmp.utils.debug
0.013ms │ 0.004ms │ nvim-lsp-installer.notify
0.011ms │ 0.006ms │ tmux.layout
0.013ms │ 0.004ms │ nvim-lsp-installer.servers.bashls
0.012ms │ 0.004ms │ nvim-lsp-installer.dispatcher
0.012ms │ 0.005ms │ buftabline.tabpage-tab
0.012ms │ 0.005ms │ nvim-lsp-installer.path
0.010ms │ 0.006ms │ tmux.resize
0.013ms │ 0.004ms │ cmp.types.vim
0.012ms │ 0.004ms │ nvim-lsp-installer.ui.state
0.011ms │ 0.005ms │ nvim-lsp-installer.installers.gem
0.012ms │ 0.005ms │ tmux.configuration.options
0.012ms │ 0.005ms │ nvim-lsp-installer.jobs.outdated-servers.git
0.012ms │ 0.004ms │ nvim-lsp-installer.jobs.outdated-servers.github_release_file
0.012ms │ 0.005ms │ cmp.types.cmp
0.013ms │ 0.004ms │ cmp.types
0.011ms │ 0.005ms │ tmux.log
0.011ms │ 0.005ms │ tmux.navigation.navigate
0.012ms │ 0.005ms │ tmux.configuration
0.012ms │ 0.004ms │ nvim-lsp-installer.jobs.outdated-servers.github_tag
0.011ms │ 0.005ms │ tmux.layout.parse
0.012ms │ 0.004ms │ nvim-lsp-installer.jobs.outdated-servers.jdtls
0.011ms │ 0.005ms │ tmux.log.convert
0.011ms │ 0.005ms │ tmux.log.severity
0.011ms │ 0.004ms │ tmux.version
0.012ms │ 0.004ms │ nvim-lsp-installer.core.clients.eclipse
0.011ms │ 0.004ms │ nvim-lsp-installer.core.clients.crates
0.011ms │ 0.004ms │ tmux.configuration.logging
0.011ms │ 0.004ms │ tmux.wrapper.nvim
0.011ms │ 0.004ms │ tmux.configuration.validate
0.011ms │ 0.004ms │ tmux.keymaps
────────────┴────────────┴─────────────────────────────────────────────────────────────────
```
</details>
Total resolve: 6.357ms, total load: 6.796ms
## Relevant Neovim PR's
[libs: vendor libmpack and libmpack-lua](https://github.com/neovim/neovim/pull/15566) [merged]
[fix(vim.mpack): rename pack/unpack => encode/decode](https://github.com/neovim/neovim/pull/16175) [merged]
[fix(runtime): add compressed representation to &rtp](https://github.com/neovim/neovim/pull/15867) [merged]
[fix(runtime): don't use regexes inside lua require'mod'](https://github.com/neovim/neovim/pull/15973) [merged]
[fix(lua): restore priority of the preloader](https://github.com/neovim/neovim/pull/17302) [merged]
[refactor(lua): call loadfile internally instead of luaL_loadfile](https://github.com/neovim/neovim/pull/17200) [merged]
[feat(lua): startup profiling](https://github.com/neovim/neovim/pull/15436)
## Credit
All credit goes to @bfredl who implemented the majority of this plugin in https://github.com/neovim/neovim/pull/15436.

465
etc/soft/nvim/+plugins/impatient.nvim/lua/impatient.lua

@ -0,0 +1,465 @@ @@ -0,0 +1,465 @@
local vim = vim
local api = vim.api
local uv = vim.loop
local _loadfile = loadfile
local get_runtime = api.nvim__get_runtime
local fs_stat = uv.fs_stat
local mpack = vim.mpack
local loadlib = package.loadlib
local std_cache = vim.fn.stdpath('cache')
local sep = vim.loop.os_uname().sysname:match('Windows') and '\\' or '/'
local std_dirs = {
['<APPDIR>'] = os.getenv('APPDIR'),
['<VIMRUNTIME>'] = os.getenv('VIMRUNTIME'),
['<STD_DATA>'] = vim.fn.stdpath('data'),
['<STD_CONFIG>'] = vim.fn.stdpath('config'),
}
local function modpath_mangle(modpath)
for name, dir in pairs(std_dirs) do
modpath = modpath:gsub(dir, name)
end
return modpath
end
local function modpath_unmangle(modpath)
for name, dir in pairs(std_dirs) do
modpath = modpath:gsub(name, dir)
end
return modpath
end
-- Overridable by user
local default_config = {
chunks = {
enable = true,
path = std_cache .. sep .. 'luacache_chunks',
},
modpaths = {
enable = true,
path = std_cache.. sep .. 'luacache_modpaths',
},
}
-- State used internally
local default_state = {
chunks = {
cache = {},
profile = nil,
dirty = false,
get = function(self, path)
return self.cache[modpath_mangle(path)]
end,
set = function(self, path, chunk)
self.cache[modpath_mangle(path)] = chunk
end
},
modpaths = {
cache = {},
profile = nil,
dirty = false,
get = function(self, mod)
if self.cache[mod] then
return modpath_unmangle(self.cache[mod])
end
end,
set = function(self, mod, path)
self.cache[mod] = modpath_mangle(path)
end
},
log = {}
}
---@diagnostic disable-next-line: undefined-field
local M = vim.tbl_deep_extend('keep', _G.__luacache_config or {}, default_config, default_state)
_G.__luacache = M
local function log(...)
M.log[#M.log+1] = table.concat({string.format(...)}, ' ')
end
local function print_log()
for _, l in ipairs(M.log) do
print(l)
end
end
local function hash(modpath)
local stat = fs_stat(modpath)
if stat then
return stat.mtime.sec..stat.mtime.nsec..stat.size
end
error('Could not hash '..modpath)
end
local function profile(m, entry, name, loader)
if m.profile then
local mp = m.profile
mp[entry] = mp[entry] or {}
if not mp[entry].loader and loader then
mp[entry].loader = loader
end
if not mp[entry][name] then
mp[entry][name] = uv.hrtime()
end
end
end
local function mprofile(mod, name, loader)
profile(M.modpaths, mod, name, loader)
end
local function cprofile(path, name, loader)
if M.chunks.profile then
path = modpath_mangle(path)
end
profile(M.chunks, path, name, loader)
end
function M.enable_profile()
local P = require('impatient.profile')
M.chunks.profile = {}
M.modpaths.profile = {}
loadlib = function(path, fun)
cprofile(path, 'load_start')
local f, err = package.loadlib(path, fun)
cprofile(path, 'load_end', 'standard')
return f, err
end
P.setup(M.modpaths.profile)
api.nvim_create_user_command('LuaCacheProfile', function()
P.print_profile(M, std_dirs)
end, {})
end
local function get_runtime_file_from_parent(basename, paths)
-- Look in the cache to see if we have already loaded a parent module.
-- If we have then try looking in the parents directory first.
local parents = vim.split(basename, sep)
for i = #parents, 1, -1 do
local parent = table.concat(vim.list_slice(parents, 1, i), sep)
local ppath = M.modpaths:get(parent)
if ppath then
if (ppath:sub(-9) == (sep .. 'init.lua')) then
ppath = ppath:sub(1, -10) -- a/b/init.lua -> a/b
else
ppath = ppath:sub(1, -5) -- a/b.lua -> a/b
end
for _, path in ipairs(paths) do
-- path should be of form 'a/b/c.lua' or 'a/b/c/init.lua'
local modpath = ppath..sep..path:sub(#('lua'..sep..parent)+2)
if fs_stat(modpath) then
return modpath, 'cache(p)'
end
end
end
end
end
local rtp = vim.split(vim.o.rtp, ',')
-- Make sure modpath is in rtp and that modpath is in paths.
local function validate_modpath(modpath, paths)
local match = false
for _, p in ipairs(paths) do
if vim.endswith(modpath, p) then
match = true
break
end
end
if not match then
return false
end
for _, dir in ipairs(rtp) do
if vim.startswith(modpath, dir) then
return fs_stat(modpath) ~= nil
end
end
return false
end
local function get_runtime_file_cached(basename, paths)
local modpath, loader
local mp = M.modpaths
if mp.enable then
local modpath_cached = mp:get(basename)
if modpath_cached then
modpath, loader = modpath_cached, 'cache'
else
modpath, loader = get_runtime_file_from_parent(basename, paths)
end
if modpath and not validate_modpath(modpath, paths) then
modpath = nil
-- Invalidate
mp.cache[basename] = nil
mp.dirty = true
end
end
if not modpath then
-- What Neovim does by default; slowest
modpath, loader = get_runtime(paths, false, {is_lua=true})[1], 'standard'
end
if modpath then
mprofile(basename, 'resolve_end', loader)
if mp.enable and loader ~= 'cache' then
log('Creating cache for module %s', basename)
mp:set(basename, modpath)
mp.dirty = true
end
end
return modpath
end
local function extract_basename(pats)
local basename
-- Deconstruct basename from pats
for _, pat in ipairs(pats) do
for i, npat in ipairs{
-- Ordered by most specific
'lua'.. sep ..'(.*)'..sep..'init%.lua',
'lua'.. sep ..'(.*)%.lua'
} do
local m = pat:match(npat)
if i == 2 and m and m:sub(-4) == 'init' then
m = m:sub(0, -6)
end
if not basename then
if m then
basename = m
end
elseif m and m ~= basename then
-- matches are inconsistent
return
end
end
end
return basename
end
local function get_runtime_cached(pats, all, opts)
local fallback = false
if all or not opts or not opts.is_lua then
-- Fallback
fallback = true
end
local basename
if not fallback then
basename = extract_basename(pats)
end
if fallback or not basename then
return get_runtime(pats, all, opts)
end
return {get_runtime_file_cached(basename, pats)}
end
-- Copied from neovim/src/nvim/lua/vim.lua with two lines changed
local function load_package(name)
local basename = name:gsub('%.', sep)
local paths = {"lua"..sep..basename..".lua", "lua"..sep..basename..sep.."init.lua"}
-- Original line:
-- local found = vim.api.nvim__get_runtime(paths, false, {is_lua=true})
local found = {get_runtime_file_cached(basename, paths)}
if #found > 0 then
local f, err = loadfile(found[1])
return f or error(err)
end
local so_paths = {}
for _,trail in ipairs(vim._so_trails) do
local path = "lua"..trail:gsub('?', basename) -- so_trails contains a leading slash
table.insert(so_paths, path)
end
-- Original line:
-- found = vim.api.nvim__get_runtime(so_paths, false, {is_lua=true})
found = {get_runtime_file_cached(basename, so_paths)}
if #found > 0 then
-- Making function name in Lua 5.1 (see src/loadlib.c:mkfuncname) is
-- a) strip prefix up to and including the first dash, if any
-- b) replace all dots by underscores
-- c) prepend "luaopen_"
-- So "foo-bar.baz" should result in "luaopen_bar_baz"
local dash = name:find("-", 1, true)
local modname = dash and name:sub(dash + 1) or name
local f, err = loadlib(found[1], "luaopen_"..modname:gsub("%.", "_"))
return f or error(err)
end
return nil
end
local function load_from_cache(path)
local mc = M.chunks
local cache = mc:get(path)
if not cache then
return nil, string.format('No cache for path %s', path)
end
local mhash, codes = unpack(cache)
if mhash ~= hash(path) then
mc:set(path)
mc.dirty = true
return nil, string.format('Stale cache for path %s', path)
end
local chunk = loadstring(codes)
if not chunk then
mc:set(path)
mc.dirty = true
return nil, string.format('Cache error for path %s', path)
end
return chunk
end
local function loadfile_cached(path)
cprofile(path, 'load_start')
local chunk, err
if M.chunks.enable then
chunk, err = load_from_cache(path)
if chunk and not err then
log('Loaded cache for path %s', path)
cprofile(path, 'load_end', 'cache')
return chunk
end
log(err)
end
chunk, err = _loadfile(path)
if not err and M.chunks.enable then
log('Creating cache for path %s', path)
M.chunks:set(path, {hash(path), string.dump(chunk)})
M.chunks.dirty = true
end
cprofile(path, 'load_end', 'standard')
return chunk, err
end
function M.save_cache()
local function _save_cache(t)
if not t.enable then
return
end
if t.dirty then
log('Updating chunk cache file: %s', t.path)
local f = assert(io.open(t.path, 'w+b'))
f:write(mpack.encode(t.cache))
f:flush()
t.dirty = false
end
end
_save_cache(M.chunks)
_save_cache(M.modpaths)
end
local function clear_cache()
local function _clear_cache(t)
t.cache = {}
os.remove(t.path)
end
_clear_cache(M.chunks)
_clear_cache(M.modpaths)
end
local function init_cache()
local function _init_cache(t)
if not t.enable then
return
end
if fs_stat(t.path) then
log('Loading cache file %s', t.path)
local f = assert(io.open(t.path, 'rb'))
local ok
ok, t.cache = pcall(function()
return mpack.decode(f:read'*a')
end)
if not ok then
log('Corrupted cache file, %s. Invalidating...', t.path)
os.remove(t.path)
t.cache = {}
end
t.dirty = not ok
end
end
if not uv.fs_stat(std_cache) then
vim.fn.mkdir(std_cache, 'p')
end
_init_cache(M.chunks)
_init_cache(M.modpaths)
end
local function setup()
init_cache()
-- Usual package loaders
-- 1. package.preload
-- 2. vim._load_package
-- 3. package.path
-- 4. package.cpath
-- 5. all-in-one
-- Override default functions
for i, loader in ipairs(package.loaders) do
if loader == vim._load_package then
package.loaders[i] = load_package
break
end
end
vim._load_package = load_package
vim.api.nvim__get_runtime = get_runtime_cached
loadfile = loadfile_cached
local augroup = api.nvim_create_augroup('impatient', {})
api.nvim_create_user_command('LuaCacheClear', clear_cache, {})
api.nvim_create_user_command('LuaCacheLog' , print_log , {})
api.nvim_create_autocmd({'VimEnter', 'VimLeave'}, {
group = augroup,
callback = M.save_cache
})
api.nvim_create_autocmd('OptionSet', {
group = augroup,
pattern = 'runtimepath',
callback = function()
rtp = vim.split(vim.o.rtp, ',')
end
})
end
setup()
return M

248
etc/soft/nvim/+plugins/impatient.nvim/lua/impatient/profile.lua

@ -0,0 +1,248 @@ @@ -0,0 +1,248 @@
local M = {}
local sep = vim.loop.os_uname().sysname:match('Windows') and '\\' or '/'
local api, uv = vim.api, vim.loop
local function load_buffer(title, lines)
local bufnr = api.nvim_create_buf(false, false)
api.nvim_buf_set_lines(bufnr, 0, 0, false, lines)
api.nvim_buf_set_option(bufnr, 'bufhidden', 'wipe')
api.nvim_buf_set_option(bufnr, 'buftype', 'nofile')
api.nvim_buf_set_option(bufnr, 'swapfile', false)
api.nvim_buf_set_option(bufnr, "modifiable", false)
api.nvim_buf_set_name(bufnr, title)
api.nvim_set_current_buf(bufnr)
end
local function time_tostr(x)
if x == 0 then
return '?'
end
return string.format('%8.3fms', x)
end
local function mem_tostr(x)
local unit = ''
for _, u in ipairs{'K', 'M', 'G'} do
if x < 1000 then
break
end
x = x / 1000
unit = u
end
return string.format('%1.1f%s', x, unit)
end
function M.print_profile(I, std_dirs)
local mod_profile = I.modpaths.profile
local chunk_profile = I.chunks.profile
if not mod_profile and not chunk_profile then
print('Error: profiling was not enabled')
return
end
local total_resolve = 0
local total_load = 0
local modules = {}
for path, m in pairs(chunk_profile) do
m.load = m.load_end - m.load_start
m.load = m.load / 1000000
m.path = path or '?'
end
local module_content_width = 0
local unloaded = {}
for module, m in pairs(mod_profile) do
local module_dot = module:gsub(sep, '.')
m.module = module_dot
if not package.loaded[module_dot] and not package.loaded[module] then
unloaded[#unloaded+1] = m
else
m.resolve = 0
if m.resolve_start and m.resolve_end then
m.resolve = m.resolve_end - m.resolve_start
m.resolve = m.resolve / 1000000
end
m.loader = m.loader or m.loader_guess
local path = I.modpaths.cache[module]
local path_prof = chunk_profile[path]
m.path = path or '?'
if path_prof then
chunk_profile[path] = nil
m.load = path_prof.load
m.ploader = path_prof.loader
else
m.load = 0
m.ploader = 'NA'
end
total_resolve = total_resolve + m.resolve
total_load = total_load + m.load
if #module > module_content_width then
module_content_width = #module
end
modules[#modules+1] = m
end
end
table.sort(modules, function(a, b)
return (a.resolve + a.load) > (b.resolve + b.load)
end)
local paths = {}
local total_paths_load = 0
for _, m in pairs(chunk_profile) do
paths[#paths+1] = m
total_paths_load = total_paths_load + m.load
end
table.sort(paths, function(a, b)
return a.load > b.load
end)
local lines = {}
local function add(fmt, ...)
local args = {...}
for i, a in ipairs(args) do
if type(a) == 'number' then
args[i] = time_tostr(a)
end
end
lines[#lines+1] = string.format(fmt, unpack(args))
end
local time_cell_width = 12
local loader_cell_width = 11
local time_content_width = time_cell_width - 2
local loader_content_width = loader_cell_width - 2
local module_cell_width = module_content_width + 2
local tcwl = string.rep('', time_cell_width)
local lcwl = string.rep('', loader_cell_width)
local mcwl = string.rep('', module_cell_width+2)
local n = string.rep('', 200)
local module_cell_format = '%-'..module_cell_width..'s'
local loader_format = '%-'..loader_content_width..'s'
local line_format = '%s │ %s │ %s │ %s │ %s │ %s'
local row_fmt = line_format:format(
' %'..time_content_width..'s',
loader_format,
'%'..time_content_width..'s',
loader_format,
module_cell_format,
'%s')
local title_fmt = line_format:format(
' %-'..time_content_width..'s',
loader_format,
'%-'..time_content_width..'s',
loader_format,
module_cell_format,
'%s')
local title1_width = time_cell_width+loader_cell_width-1
local title1_fmt = ('%s │ %s │'):format(
' %-'..title1_width..'s', '%-'..title1_width..'s')
add('Note: this report is not a measure of startup time. Only use this for comparing')
add('between cached and uncached loads of Lua modules')
add('')
add('Cache files:')
for _, f in ipairs{ I.chunks.path, I.modpaths.path } do
local size = vim.loop.fs_stat(f).size
add(' %s %s', f, mem_tostr(size))
end
add('')
add('Standard directories:')
for alias, path in pairs(std_dirs) do
add(' %-12s -> %s', alias, path)
end
add('')
add('%s─%s┬%s─%s┐', tcwl, lcwl, tcwl, lcwl)
add(title1_fmt, 'Resolve', 'Load')
add('%s┬%s┼%s┬%s┼%s┬%s', tcwl, lcwl, tcwl, lcwl, mcwl, n)
add(title_fmt, 'Time', 'Method', 'Time', 'Method', 'Module', 'Path')
add('%s┼%s┼%s┼%s┼%s┼%s', tcwl, lcwl, tcwl, lcwl, mcwl, n)
add(row_fmt, total_resolve, '', total_load, '', 'Total', '')
add('%s┼%s┼%s┼%s┼%s┼%s', tcwl, lcwl, tcwl, lcwl, mcwl, n)
for _, p in ipairs(modules) do
add(row_fmt, p.resolve, p.loader, p.load, p.ploader, p.module, p.path)
end
add('%s┴%s┴%s┴%s┴%s┴%s', tcwl, lcwl, tcwl, lcwl, mcwl, n)
if #paths > 0 then
add('')
add(n)
local f3 = ' %'..time_content_width..'s │ %'..loader_content_width..'s │ %s'
add('Files loaded with no associated module')
add('%s┬%s┬%s', tcwl, lcwl, n)
add(f3, 'Time', 'Loader', 'Path')
add('%s┼%s┼%s', tcwl, lcwl, n)
add(f3, total_paths_load, '', 'Total')
add('%s┼%s┼%s', tcwl, lcwl, n)
for _, p in ipairs(paths) do
add(f3, p.load, p.loader, p.path)
end
add('%s┴%s┴%s', tcwl, lcwl, n)
end
if #unloaded > 0 then
add('')
add(n)
add('Modules which were unable to loaded')
add(n)
for _, p in ipairs(unloaded) do
lines[#lines+1] = p.module
end
add(n)
end
load_buffer('Impatient Profile Report', lines)
end
M.setup = function(profile)
local _require = require
require = function(mod)
local basename = mod:gsub('%.', sep)
if not profile[basename] then
profile[basename] = {}
profile[basename].resolve_start = uv.hrtime()
profile[basename].loader_guess = ''
end
return _require(mod)
end
-- Add profiling around all the loaders
local pl = package.loaders
for i = 1, #pl do
local l = pl[i]
pl[i] = function(mod)
local basename = mod:gsub('%.', sep)
profile[basename].loader_guess = i == 1 and 'preloader' or 'loader #'..i
return l(mod)
end
end
end
return M

280
etc/soft/nvim/+plugins/impatient.nvim/test/impatient_spec.lua

@ -0,0 +1,280 @@ @@ -0,0 +1,280 @@
local helpers = require('test.functional.helpers')()
local clear = helpers.clear
local exec_lua = helpers.exec_lua
local eq = helpers.eq
local cmd = helpers.command
local nvim07
local function gen_exp(exp)
local neovim_dir = nvim07 and 'neovim-v0.7.0' or 'neovim-master'
local cwd = exec_lua('return vim.loop.cwd()')
local exp1 = {}
for _, v in pairs(exp) do
if type(v) == 'string' then
v = v:gsub('{CWD}', cwd)
v = v:gsub('{NVIM}', neovim_dir)
exp1[#exp1+1] = v
end
end
return exp1
end
local gen_exp_cold = function()
return gen_exp{
'Creating cache for module plugins',
'No cache for path ./test/lua/plugins.lua',
'Creating cache for path ./test/lua/plugins.lua',
'Creating cache for module telescope',
'No cache for path {CWD}/scratch/telescope.nvim/lua/telescope/init.lua',
'Creating cache for path {CWD}/scratch/telescope.nvim/lua/telescope/init.lua',
'Creating cache for module telescope/_extensions',
'No cache for path {CWD}/scratch/telescope.nvim/lua/telescope/_extensions/init.lua',
'Creating cache for path {CWD}/scratch/telescope.nvim/lua/telescope/_extensions/init.lua',
'Creating cache for module gitsigns',
'No cache for path {CWD}/scratch/gitsigns.nvim/lua/gitsigns.lua',
'Creating cache for path {CWD}/scratch/gitsigns.nvim/lua/gitsigns.lua',
'Creating cache for module plenary/async/async',
'No cache for path {CWD}/scratch/plenary.nvim/lua/plenary/async/async.lua',
'Creating cache for path {CWD}/scratch/plenary.nvim/lua/plenary/async/async.lua',
'Creating cache for module plenary/vararg',
'No cache for path {CWD}/scratch/plenary.nvim/lua/plenary/vararg/init.lua',
'Creating cache for path {CWD}/scratch/plenary.nvim/lua/plenary/vararg/init.lua',
'Creating cache for module plenary/vararg/rotate',
'No cache for path {CWD}/scratch/plenary.nvim/lua/plenary/vararg/rotate.lua',
'Creating cache for path {CWD}/scratch/plenary.nvim/lua/plenary/vararg/rotate.lua',
'Creating cache for module plenary/tbl',
'No cache for path {CWD}/scratch/plenary.nvim/lua/plenary/tbl.lua',
'Creating cache for path {CWD}/scratch/plenary.nvim/lua/plenary/tbl.lua',
'Creating cache for module plenary/errors',
'No cache for path {CWD}/scratch/plenary.nvim/lua/plenary/errors.lua',
'Creating cache for path {CWD}/scratch/plenary.nvim/lua/plenary/errors.lua',
'Creating cache for module plenary/functional',
'No cache for path {CWD}/scratch/plenary.nvim/lua/plenary/functional.lua',
'Creating cache for path {CWD}/scratch/plenary.nvim/lua/plenary/functional.lua',
'Creating cache for module plenary/async/util',
'No cache for path {CWD}/scratch/plenary.nvim/lua/plenary/async/util.lua',
'Creating cache for path {CWD}/scratch/plenary.nvim/lua/plenary/async/util.lua',
'Creating cache for module plenary/async/control',
'No cache for path {CWD}/scratch/plenary.nvim/lua/plenary/async/control.lua',
'Creating cache for path {CWD}/scratch/plenary.nvim/lua/plenary/async/control.lua',
'Creating cache for module plenary/async/structs',
'No cache for path {CWD}/scratch/plenary.nvim/lua/plenary/async/structs.lua',
'Creating cache for path {CWD}/scratch/plenary.nvim/lua/plenary/async/structs.lua',
'Creating cache for module gitsigns/status',
'No cache for path {CWD}/scratch/gitsigns.nvim/lua/gitsigns/status.lua',
'Creating cache for path {CWD}/scratch/gitsigns.nvim/lua/gitsigns/status.lua',
'Creating cache for module gitsigns/git',
'No cache for path {CWD}/scratch/gitsigns.nvim/lua/gitsigns/git.lua',
'Creating cache for path {CWD}/scratch/gitsigns.nvim/lua/gitsigns/git.lua',
'Creating cache for module plenary/job',
'No cache for path {CWD}/scratch/plenary.nvim/lua/plenary/job.lua',
'Creating cache for path {CWD}/scratch/plenary.nvim/lua/plenary/job.lua',
'Creating cache for module gitsigns/debug',
'No cache for path {CWD}/scratch/gitsigns.nvim/lua/gitsigns/debug.lua',
'Creating cache for path {CWD}/scratch/gitsigns.nvim/lua/gitsigns/debug.lua',
'Creating cache for module gitsigns/util',
'No cache for path {CWD}/scratch/gitsigns.nvim/lua/gitsigns/util.lua',
'Creating cache for path {CWD}/scratch/gitsigns.nvim/lua/gitsigns/util.lua',
'Creating cache for module gitsigns/hunks',
'No cache for path {CWD}/scratch/gitsigns.nvim/lua/gitsigns/hunks.lua',
'Creating cache for path {CWD}/scratch/gitsigns.nvim/lua/gitsigns/hunks.lua',
'Creating cache for module gitsigns/signs',
'No cache for path {CWD}/scratch/gitsigns.nvim/lua/gitsigns/signs.lua',
'Creating cache for path {CWD}/scratch/gitsigns.nvim/lua/gitsigns/signs.lua',
'Creating cache for module gitsigns/config',
'No cache for path {CWD}/scratch/gitsigns.nvim/lua/gitsigns/config.lua',
'Creating cache for path {CWD}/scratch/gitsigns.nvim/lua/gitsigns/config.lua',
'Creating cache for module gitsigns/manager',
'No cache for path {CWD}/scratch/gitsigns.nvim/lua/gitsigns/manager.lua',
'Creating cache for path {CWD}/scratch/gitsigns.nvim/lua/gitsigns/manager.lua',
'Creating cache for module gitsigns/cache',
'No cache for path {CWD}/scratch/gitsigns.nvim/lua/gitsigns/cache.lua',
'Creating cache for path {CWD}/scratch/gitsigns.nvim/lua/gitsigns/cache.lua',
'Creating cache for module gitsigns/debounce',
'No cache for path {CWD}/scratch/gitsigns.nvim/lua/gitsigns/debounce.lua',
'Creating cache for path {CWD}/scratch/gitsigns.nvim/lua/gitsigns/debounce.lua',
'Creating cache for module gitsigns/highlight',
'No cache for path {CWD}/scratch/gitsigns.nvim/lua/gitsigns/highlight.lua',
'Creating cache for path {CWD}/scratch/gitsigns.nvim/lua/gitsigns/highlight.lua',
'Creating cache for module spellsitter',
'No cache for path {CWD}/scratch/spellsitter.nvim/lua/spellsitter.lua',
'Creating cache for path {CWD}/scratch/spellsitter.nvim/lua/spellsitter.lua',
'Creating cache for module vim/treesitter/query',
'No cache for path {CWD}/{NVIM}/runtime/lua/vim/treesitter/query.lua',
'Creating cache for path {CWD}/{NVIM}/runtime/lua/vim/treesitter/query.lua',
'Creating cache for module vim/treesitter/language',
'No cache for path {CWD}/{NVIM}/runtime/lua/vim/treesitter/language.lua',
'Creating cache for path {CWD}/{NVIM}/runtime/lua/vim/treesitter/language.lua',
'Creating cache for module vim/treesitter',
'No cache for path {CWD}/{NVIM}/runtime/lua/vim/treesitter.lua',
'Creating cache for path {CWD}/{NVIM}/runtime/lua/vim/treesitter.lua',
'Creating cache for module vim/treesitter/languagetree',
'No cache for path {CWD}/{NVIM}/runtime/lua/vim/treesitter/languagetree.lua',
'Creating cache for path {CWD}/{NVIM}/runtime/lua/vim/treesitter/languagetree.lua',
'Creating cache for module colorizer',
'No cache for path {CWD}/scratch/nvim-colorizer.lua/lua/colorizer.lua',
'Creating cache for path {CWD}/scratch/nvim-colorizer.lua/lua/colorizer.lua',
'Creating cache for module colorizer/nvim',
'No cache for path {CWD}/scratch/nvim-colorizer.lua/lua/colorizer/nvim.lua',
'Creating cache for path {CWD}/scratch/nvim-colorizer.lua/lua/colorizer/nvim.lua',
'Creating cache for module colorizer/trie',
'No cache for path {CWD}/scratch/nvim-colorizer.lua/lua/colorizer/trie.lua',
'Creating cache for path {CWD}/scratch/nvim-colorizer.lua/lua/colorizer/trie.lua',
'Creating cache for module lspconfig',
'No cache for path {CWD}/scratch/nvim-lspconfig/lua/lspconfig.lua',
'Creating cache for path {CWD}/scratch/nvim-lspconfig/lua/lspconfig.lua',
'Creating cache for module lspconfig/configs',
'No cache for path {CWD}/scratch/nvim-lspconfig/lua/lspconfig/configs.lua',
'Creating cache for path {CWD}/scratch/nvim-lspconfig/lua/lspconfig/configs.lua',
'Creating cache for module lspconfig/util',
'No cache for path {CWD}/scratch/nvim-lspconfig/lua/lspconfig/util.lua',
'Creating cache for path {CWD}/scratch/nvim-lspconfig/lua/lspconfig/util.lua',
'Creating cache for module vim/lsp',
'No cache for path {CWD}/{NVIM}/runtime/lua/vim/lsp.lua',
'Creating cache for path {CWD}/{NVIM}/runtime/lua/vim/lsp.lua',
'Creating cache for module vim/lsp/handlers',
'No cache for path {CWD}/{NVIM}/runtime/lua/vim/lsp/handlers.lua',
'Creating cache for path {CWD}/{NVIM}/runtime/lua/vim/lsp/handlers.lua',
'Creating cache for module vim/lsp/log',
'No cache for path {CWD}/{NVIM}/runtime/lua/vim/lsp/log.lua',
'Creating cache for path {CWD}/{NVIM}/runtime/lua/vim/lsp/log.lua',
'Creating cache for module vim/lsp/protocol',
'No cache for path {CWD}/{NVIM}/runtime/lua/vim/lsp/protocol.lua',
'Creating cache for path {CWD}/{NVIM}/runtime/lua/vim/lsp/protocol.lua',
'Creating cache for module vim/lsp/util',
'No cache for path {CWD}/{NVIM}/runtime/lua/vim/lsp/util.lua',
'Creating cache for path {CWD}/{NVIM}/runtime/lua/vim/lsp/util.lua',
'Creating cache for module vim/lsp/_snippet',
'No cache for path {CWD}/{NVIM}/runtime/lua/vim/lsp/_snippet.lua',
'Creating cache for path {CWD}/{NVIM}/runtime/lua/vim/lsp/_snippet.lua',
'Creating cache for module vim/highlight',
'No cache for path {CWD}/{NVIM}/runtime/lua/vim/highlight.lua',
'Creating cache for path {CWD}/{NVIM}/runtime/lua/vim/highlight.lua',
'Creating cache for module vim/lsp/rpc',
'No cache for path {CWD}/{NVIM}/runtime/lua/vim/lsp/rpc.lua',
'Creating cache for path {CWD}/{NVIM}/runtime/lua/vim/lsp/rpc.lua',
'Creating cache for module vim/lsp/sync',
'No cache for path {CWD}/{NVIM}/runtime/lua/vim/lsp/sync.lua',
'Creating cache for path {CWD}/{NVIM}/runtime/lua/vim/lsp/sync.lua',
'Creating cache for module vim/lsp/buf',
'No cache for path {CWD}/{NVIM}/runtime/lua/vim/lsp/buf.lua',
'Creating cache for path {CWD}/{NVIM}/runtime/lua/vim/lsp/buf.lua',
'Creating cache for module vim/lsp/diagnostic',
'No cache for path {CWD}/{NVIM}/runtime/lua/vim/lsp/diagnostic.lua',
'Creating cache for path {CWD}/{NVIM}/runtime/lua/vim/lsp/diagnostic.lua',
'Creating cache for module vim/lsp/codelens',
'No cache for path {CWD}/{NVIM}/runtime/lua/vim/lsp/codelens.lua',
'Creating cache for path {CWD}/{NVIM}/runtime/lua/vim/lsp/codelens.lua',
'Creating cache for module bufferline',
'No cache for path {CWD}/scratch/bufferline.nvim/lua/bufferline.lua',
'Creating cache for path {CWD}/scratch/bufferline.nvim/lua/bufferline.lua',
'Creating cache for module bufferline/constants',
'No cache for path {CWD}/scratch/bufferline.nvim/lua/bufferline/constants.lua',
'Creating cache for path {CWD}/scratch/bufferline.nvim/lua/bufferline/constants.lua',
'Creating cache for module bufferline/utils',
'No cache for path {CWD}/scratch/bufferline.nvim/lua/bufferline/utils.lua',
'Creating cache for path {CWD}/scratch/bufferline.nvim/lua/bufferline/utils.lua',
'Updating chunk cache file: scratch/cache/nvim/luacache_chunks',
'Updating chunk cache file: scratch/cache/nvim/luacache_modpaths'
}
end
local gen_exp_hot = function()
return gen_exp{
'Loading cache file scratch/cache/nvim/luacache_chunks',
'Loading cache file scratch/cache/nvim/luacache_modpaths',
'Loaded cache for path ./test/lua/plugins.lua',
'Loaded cache for path {CWD}/scratch/telescope.nvim/lua/telescope/init.lua',
'Loaded cache for path {CWD}/scratch/telescope.nvim/lua/telescope/_extensions/init.lua',
'Loaded cache for path {CWD}/scratch/gitsigns.nvim/lua/gitsigns.lua',
'Loaded cache for path {CWD}/scratch/plenary.nvim/lua/plenary/async/async.lua',
'Loaded cache for path {CWD}/scratch/plenary.nvim/lua/plenary/vararg/init.lua',
'Loaded cache for path {CWD}/scratch/plenary.nvim/lua/plenary/vararg/rotate.lua',
'Loaded cache for path {CWD}/scratch/plenary.nvim/lua/plenary/tbl.lua',
'Loaded cache for path {CWD}/scratch/plenary.nvim/lua/plenary/errors.lua',
'Loaded cache for path {CWD}/scratch/plenary.nvim/lua/plenary/functional.lua',
'Loaded cache for path {CWD}/scratch/plenary.nvim/lua/plenary/async/util.lua',
'Loaded cache for path {CWD}/scratch/plenary.nvim/lua/plenary/async/control.lua',
'Loaded cache for path {CWD}/scratch/plenary.nvim/lua/plenary/async/structs.lua',
'Loaded cache for path {CWD}/scratch/gitsigns.nvim/lua/gitsigns/status.lua',
'Loaded cache for path {CWD}/scratch/gitsigns.nvim/lua/gitsigns/git.lua',
'Loaded cache for path {CWD}/scratch/plenary.nvim/lua/plenary/job.lua',
'Loaded cache for path {CWD}/scratch/gitsigns.nvim/lua/gitsigns/debug.lua',
'Loaded cache for path {CWD}/scratch/gitsigns.nvim/lua/gitsigns/util.lua',
'Loaded cache for path {CWD}/scratch/gitsigns.nvim/lua/gitsigns/hunks.lua',
'Loaded cache for path {CWD}/scratch/gitsigns.nvim/lua/gitsigns/signs.lua',
'Loaded cache for path {CWD}/scratch/gitsigns.nvim/lua/gitsigns/config.lua',
'Loaded cache for path {CWD}/scratch/gitsigns.nvim/lua/gitsigns/manager.lua',
'Loaded cache for path {CWD}/scratch/gitsigns.nvim/lua/gitsigns/cache.lua',
'Loaded cache for path {CWD}/scratch/gitsigns.nvim/lua/gitsigns/debounce.lua',
'Loaded cache for path {CWD}/scratch/gitsigns.nvim/lua/gitsigns/highlight.lua',
'Loaded cache for path {CWD}/scratch/spellsitter.nvim/lua/spellsitter.lua',
'Loaded cache for path {CWD}/{NVIM}/runtime/lua/vim/treesitter/query.lua',
'Loaded cache for path {CWD}/{NVIM}/runtime/lua/vim/treesitter/language.lua',
'Loaded cache for path {CWD}/{NVIM}/runtime/lua/vim/treesitter.lua',
'Loaded cache for path {CWD}/{NVIM}/runtime/lua/vim/treesitter/languagetree.lua',
'Loaded cache for path {CWD}/scratch/nvim-colorizer.lua/lua/colorizer.lua',
'Loaded cache for path {CWD}/scratch/nvim-colorizer.lua/lua/colorizer/nvim.lua',
'Loaded cache for path {CWD}/scratch/nvim-colorizer.lua/lua/colorizer/trie.lua',
'Loaded cache for path {CWD}/scratch/nvim-lspconfig/lua/lspconfig.lua',
'Loaded cache for path {CWD}/scratch/nvim-lspconfig/lua/lspconfig/configs.lua',
'Loaded cache for path {CWD}/scratch/nvim-lspconfig/lua/lspconfig/util.lua',
'Loaded cache for path {CWD}/{NVIM}/runtime/lua/vim/lsp.lua',
'Loaded cache for path {CWD}/{NVIM}/runtime/lua/vim/lsp/handlers.lua',
'Loaded cache for path {CWD}/{NVIM}/runtime/lua/vim/lsp/log.lua',
'Loaded cache for path {CWD}/{NVIM}/runtime/lua/vim/lsp/protocol.lua',
'Loaded cache for path {CWD}/{NVIM}/runtime/lua/vim/lsp/util.lua',
'Loaded cache for path {CWD}/{NVIM}/runtime/lua/vim/lsp/_snippet.lua',
'Loaded cache for path {CWD}/{NVIM}/runtime/lua/vim/highlight.lua',
'Loaded cache for path {CWD}/{NVIM}/runtime/lua/vim/lsp/rpc.lua',
'Loaded cache for path {CWD}/{NVIM}/runtime/lua/vim/lsp/sync.lua',
'Loaded cache for path {CWD}/{NVIM}/runtime/lua/vim/lsp/buf.lua',
'Loaded cache for path {CWD}/{NVIM}/runtime/lua/vim/lsp/diagnostic.lua',
'Loaded cache for path {CWD}/{NVIM}/runtime/lua/vim/lsp/codelens.lua',
'Loaded cache for path {CWD}/scratch/bufferline.nvim/lua/bufferline.lua',
'Loaded cache for path {CWD}/scratch/bufferline.nvim/lua/bufferline/constants.lua',
'Loaded cache for path {CWD}/scratch/bufferline.nvim/lua/bufferline/utils.lua'
}
end
describe('impatient', function()
local function reset()
clear()
nvim07 = exec_lua('return vim.version().minor') == 7
cmd [[set runtimepath=$VIMRUNTIME,.,./test]]
cmd [[let $XDG_CACHE_HOME='scratch/cache']]
cmd [[set packpath=]]
end
before_each(function()
reset()
end)
it('load plugins without impatient', function()
exec_lua([[require('plugins')]])
end)
local function run()
exec_lua[[
require('impatient')
require('plugins')
_G.__luacache.save_cache()
]]
end
it('creates cache', function()
os.execute[[rm -rf scratch/cache]]
run()
eq(gen_exp_cold(), exec_lua("return _G.__luacache.log"))
end)
it('loads cache', function()
run()
eq(gen_exp_hot(), exec_lua("return _G.__luacache.log"))
end)
end)

43
etc/soft/nvim/+plugins/impatient.nvim/test/lua/plugins.lua

@ -0,0 +1,43 @@ @@ -0,0 +1,43 @@
local init = {
['neovim/nvim-lspconfig'] = '2f026f21',
['nvim-lua/plenary.nvim'] = '06266e7b',
['nvim-lua/telescope.nvim'] = 'ac42f0c2',
['lewis6991/gitsigns.nvim'] = 'daa233aa',
['lewis6991/spellsitter.nvim'] = '7f9e8471',
['norcalli/nvim-colorizer.lua'] = '36c610a9',
['akinsho/bufferline.nvim'] = 'bede234e'
}
local testdir = 'scratch'
vim.fn.system{"mkdir", testdir}
for plugin, sha in pairs(init) do
local plugin_dir = plugin:match('.*/(.*)')
local plugin_dir2 = testdir..'/'..plugin_dir
vim.fn.system{
'git', '-C', testdir, 'clone',
'https://github.com/'..plugin, plugin_dir
}
-- local rev = (vim.fn.system{
-- 'git', '-C', plugin_dir2,
-- 'rev-list', 'HEAD', '-n', '1', '--first-parent', '--before=2021-09-05'
-- }):sub(1,-2)
-- if sha then
-- assert(vim.startswith(rev, sha), ('Plugin sha for %s does match %s != %s'):format(plugin, rev, sha))
-- end
vim.fn.system{'git', '-C', plugin_dir2, 'checkout', sha}
vim.opt.rtp:prepend(vim.loop.fs_realpath("scratch/"..plugin_dir))
end
require'telescope'
require'gitsigns'
require'spellsitter'
require'colorizer'
require'lspconfig'
require'bufferline'

10
etc/soft/nvim/+plugins/impatient.nvim/test/preload.lua

@ -0,0 +1,10 @@ @@ -0,0 +1,10 @@
-- Modules loaded here will not be cleared and reloaded by Busted.
-- Busted started doing this to help provide more isolation.
local global_helpers = require('test.helpers')
-- Bypoass CI behaviour logic
global_helpers.isCI = function(_)
return false
end
local helpers = require('test.functional.helpers')()

19
etc/soft/nvim/+plugins/janet.vim/LICENSE

@ -0,0 +1,19 @@ @@ -0,0 +1,19 @@
Copyright (c) 2017 Calvin Rose
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

3
etc/soft/nvim/+plugins/janet.vim/Makefile

@ -0,0 +1,3 @@ @@ -0,0 +1,3 @@
.PHONY: gen
gen:
janet scripts/gen.janet

20
etc/soft/nvim/+plugins/janet.vim/README.md

@ -0,0 +1,20 @@ @@ -0,0 +1,20 @@
# janet.vim
Syntax files for [Janet](https://github.com/janet-lang/janet) in Vim. The Janet language is in flux,
and this repo will be updated with it.
## Install with Vundle
```
Plugin 'bakpakin/janet.vim'
```
## Install with vim-plug
```
Plug 'bakpakin/janet.vim'
```
## Other Package Managers
Installation should work with any Pathogen-compatible set up.

8
etc/soft/nvim/+plugins/janet.vim/ftdetect/janet.vim

@ -0,0 +1,8 @@ @@ -0,0 +1,8 @@
fun! s:DetectJanet()
if getline(1) =~# '^#!.*/bin/env\s\+janet\>'
setfiletype janet
endif
endfun
autocmd BufRead,BufNewFile *.janet,*.jdn setlocal filetype=janet
autocmd BufNewFile,BufRead * call s:DetectJanet()

26
etc/soft/nvim/+plugins/janet.vim/ftplugin/janet.vim

@ -0,0 +1,26 @@ @@ -0,0 +1,26 @@
" Vim filetype plugin file
" Language: JANET
" Maintainer: Calvin Rose
if exists("b:did_ftplugin")
finish
endif
let b:did_ftplugin = 1
let s:cpo_save = &cpo
set cpo&vim
"setlocal iskeyword+=!,_,%,?,-,*,!,+,/,=,<,>,.,:,$,^
setlocal iskeyword=!,$,%,*,+,-,.,/,:,<,=,>,?,_,a-z,A-Z,48-57,128-247,124,126,38,94
" There will be false positives, but this is better than missing the whole set
" of user-defined def* definitions.
setlocal define=\\v[(/]def(ault)@!\\S*
" Remove 't' from 'formatoptions' to avoid auto-wrapping code.
setlocal formatoptions-=t
setlocal comments=n:#
setlocal commentstring=#\ %s
let &cpo = s:cpo_save

324
etc/soft/nvim/+plugins/janet.vim/indent/janet.vim

@ -0,0 +1,324 @@ @@ -0,0 +1,324 @@
" Vim filetype plugin file
" Language: JANET
" Maintainer: Calvin Rose
"
" Modified from vim-clojure-static
" https://github.com/guns/vim-clojure-static/blob/master/indent/clojure.vim
if exists("b:did_indent")
finish
endif
let b:did_indent = 1
let s:save_cpo = &cpo
set cpo&vim
setlocal noautoindent nosmartindent
setlocal softtabstop=2 shiftwidth=2 expandtab
setlocal indentkeys=!,o,O
if exists("*searchpairpos")
if !exists('g:janet_maxlines')
let g:janet_maxlines = 100
endif
if !exists('g:janet_fuzzy_indent')
let g:janet_fuzzy_indent = 1
endif
if !exists('g:janet_fuzzy_indent_patterns')
let g:janet_fuzzy_indent_patterns = ['^def', '^let', '^while', '^if', '^unless', '^with', '^fn$', '^var', '^each', '^case$', '^for$', '^loop$', '^match', '^seq', '^generate', '^edefer', '^cond', '^try', '^when', '^ev/spawn-thread$', '^ev/do-thread$', '^declare', '^forever$', '^compwhen$', '^compif$']
endif
if !exists('g:janet_fuzzy_indent_blacklist')
let g:janet_fuzzy_indent_blacklist = []
endif
if !exists('g:janet_special_indent_words')
let g:janet_special_indent_words = ''
endif
if !exists('g:janet_align_multiline_strings')
let g:janet_align_multiline_strings = 0
endif
if !exists('g:janet_align_subforms')
let g:janet_align_subforms = 0
endif
function! s:syn_id_name()
return synIDattr(synID(line("."), col("."), 0), "name")
endfunction
function! s:ignored_region()
return s:syn_id_name() =~? '\vstring|comment|character'
endfunction
function! s:current_char()
return getline('.')[col('.')-1]
endfunction
function! s:current_word()
return getline('.')[col('.')-1 : searchpos('\v>', 'n', line('.'))[1]-2]
endfunction
function! s:is_paren()
return s:current_char() =~# '\v[\(\)\[\]\{\}]' && !s:ignored_region()
endfunction
" Returns 1 if string matches a pattern in 'patterns', which may be a
" list of patterns, or a comma-delimited string of implicitly anchored
" patterns.
function! s:match_one(patterns, string)
let list = type(a:patterns) == type([])
\ ? a:patterns
\ : map(split(a:patterns, ','), '"^" . v:val . "$"')
for pat in list
if a:string =~# pat | return 1 | endif
endfor
endfunction
function! s:match_pairs(open, close, stopat)
" Stop only on vector and map [ resp. {. Ignore the ones in strings and
" comments.
if a:stopat == 0 && g:janet_maxlines > 0
let stopat = max([line(".") - g:janet_maxlines, 0])
else
let stopat = a:stopat
endif
let pos = searchpairpos(a:open, '', a:close, 'bWn', "!s:is_paren()", stopat)
return [pos[0], col(pos)]
endfunction
function! s:janet_check_for_string_worker()
" Check whether there is the last character of the previous line is
" highlighted as a string. If so, we check whether it's a ". In this
" case we have to check also the previous character. The " might be the
" closing one. In case the we are still in the string, we search for the
" opening ". If this is not found we take the indent of the line.
let nb = prevnonblank(v:lnum - 1)
if nb == 0
return -1
endif
call cursor(nb, 0)
call cursor(0, col("$") - 1)
if s:syn_id_name() !~? "string"
return -1
endif
" This will not work for a " in the first column...
if s:current_char() == '"' || s:current_char() == '`'
call cursor(0, col("$") - 2)
if s:syn_id_name() !~? "string"
return -1
endif
if s:current_char() != '\'
return -1
endif
call cursor(0, col("$") - 1)
endif
let p = searchpos('\(^\|[^\\]\)\zs"\`', 'bW')
if p != [0, 0]
return p[1] - 1
endif
return indent(".")
endfunction
function! s:check_for_string()
let pos = getpos('.')
try
let val = s:janet_check_for_string_worker()
finally
call setpos('.', pos)
endtry
return val
endfunction
" Returns 1 for opening brackets, -1 for _anything else_.
function! s:bracket_type(char)
return stridx('([{', a:char) > -1 ? 1 : -1
endfunction
" Returns: [opening-bracket-lnum, indent]
function! s:janet_indent_pos()
" Get rid of special case.
if line(".") == 1
return [0, 0]
endif
" We have to apply some heuristics here to figure out, whether to use
" normal lisp indenting or not.
let i = s:check_for_string()
if i > -1
return [0, i + !!g:janet_align_multiline_strings]
endif
call cursor(0, 1)
" Find the next enclosing [ or {. We can limit the second search
" to the line, where the [ was found. If no [ was there this is
" zero and we search for an enclosing {.
let paren = s:match_pairs('(', ')', 0)
let bracket = s:match_pairs('\[', '\]', paren[0])
let curly = s:match_pairs('{', '}', bracket[0])
" In case the curly brace is on a line later then the [ or - in
" case they are on the same line - in a higher column, we take the
" curly indent.
if curly[0] > bracket[0] || curly[1] > bracket[1]
if curly[0] > paren[0] || curly[1] > paren[1]
return curly
endif
endif
" If the curly was not chosen, we take the bracket indent - if
" there was one.
if bracket[0] > paren[0] || bracket[1] > paren[1]
return bracket
endif
" There are neither { nor [ nor (, ie. we are at the toplevel.
if paren == [0, 0]
return paren
endif
" Now we have to reimplement lispindent. This is surprisingly easy, as
" soon as one has access to syntax items.
"
" - Check whether we are in a special position after a word in
" g:janet_special_indent_words. These are special cases.
" - Get the next keyword after the (.
" - If its first character is also a (, we have another sexp and align
" one column to the right of the unmatched (.
" - In case it is in lispwords, we indent the next line to the column of
" the ( + sw.
" - If not, we check whether it is last word in the line. In that case
" we again use ( + sw for indent.
" - In any other case we use the column of the end of the word + 2.
call cursor(paren)
" In case we are at the last character, we use the paren position.
if col("$") - 1 == paren[1]
return paren
endif
" In case after the paren is a whitespace, we search for the next word.
call cursor(0, col('.') + 1)
if s:current_char() == ' '
call search('\v\S', 'W')
endif
" If we moved to another line, there is no word after the (. We
" use the ( position for indent.
if line(".") > paren[0]
return paren
endif
" We still have to check, whether the keyword starts with a (, [ or {.
" In that case we use the ( position for indent.
let w = s:current_word()
if s:bracket_type(w[0]) == 1
return paren
endif
let ww = w
if &lispwords =~# '\V\<' . ww . '\>'
return [paren[0], paren[1] + &shiftwidth - 1]
endif
if g:janet_fuzzy_indent
\ && !s:match_one(g:janet_fuzzy_indent_blacklist, ww)
\ && s:match_one(g:janet_fuzzy_indent_patterns, ww)
return [paren[0], paren[1] + &shiftwidth - 1]
endif
call search('\v\_s', 'cW')
call search('\v\S', 'W')
if paren[0] < line(".")
return [paren[0], paren[1] + (g:janet_align_subforms ? 0 : &shiftwidth - 1)]
endif
call search('\v\S', 'bW')
return [line('.'), col('.') + 1]
endfunction
function! GetJanetIndent()
let lnum = line('.')
let orig_lnum = lnum
let orig_col = col('.')
let [opening_lnum, indent] = s:janet_indent_pos()
" Account for multibyte characters
if opening_lnum > 0
let indent -= indent - virtcol([opening_lnum, indent])
endif
" Return if there are no previous lines to inherit from
if opening_lnum < 1 || opening_lnum >= lnum - 1
call cursor(orig_lnum, orig_col)
return indent
endif
let bracket_count = 0
" Take the indent of the first previous non-white line that is
" at the same sexp level. cf. src/misc1.c:get_lisp_indent()
while 1
let lnum = prevnonblank(lnum - 1)
let col = 1
if lnum <= opening_lnum
break
endif
call cursor(lnum, col)
" Handle bracket counting edge case
if s:is_paren()
let bracket_count += s:bracket_type(s:current_char())
endif
while 1
if search('\v[(\[{}\])]', '', lnum) < 1
break
elseif !s:ignored_region()
let bracket_count += s:bracket_type(s:current_char())
endif
endwhile
if bracket_count == 0
" Check if this is part of a multiline string
call cursor(lnum, 1)
if s:syn_id_name() !~? '\vString|Buffer'
call cursor(orig_lnum, orig_col)
return indent(lnum)
endif
endif
endwhile
call cursor(orig_lnum, orig_col)
return indent
endfunction
setlocal indentexpr=GetJanetIndent()
else
" In case we have searchpairpos not available we fall back to
" normal lisp indenting.
setlocal indentexpr=
setlocal lisp
let b:undo_indent .= '| setlocal lisp<'
endif
let &cpo = s:save_cpo
unlet! s:save_cpo

143
etc/soft/nvim/+plugins/janet.vim/scripts/gen.janet

@ -0,0 +1,143 @@ @@ -0,0 +1,143 @@
# Generate real syntax file from template.
(def built-ins (filter |(not= 'built-ins $) (all-bindings)))
(def functions (filter |(not (get (dyn $) :macro)) built-ins))
(def macros (filter |(get (dyn $) :macro) built-ins))
(def template
`````
" Vim syntax file
" Language: Janet
" Maintainer: Calvin Rose
" URL: https://github.com/janet-lang/janet.vim
" License: MIT License
if exists("b:current_syntax")
finish
endif
let s:cpo_sav = &cpo
set cpo&vim
if has("folding") && exists("g:janet_fold") && g:janet_fold > 0
setlocal foldmethod=syntax
endif
syntax keyword JanetCommentTodo contained FIXME XXX TODO FIXME: XXX: TODO:
" Janet comments
syntax match JanetComment "#.*$" contains=JanetCommentTodo,@Spell
syntax match JanetStringEscape '\v\\%([ntvr0zfe"\\]|x[[0-9a-fA-F]]\{2}|u[[0-9a-fA-F]]\{4}|U[[0-9a-fA-F]]\{6})' contained
syntax region JanetString matchgroup=JanetStringDelimiter start=/"/ skip=/\\\\\|\\"/ end=/"/ contains=JanetStringEscape,@Spell
syntax region JanetBuffer matchgroup=JanetStringDelimiter start=/@"/ skip=/\\\\\|\\"/ end=/"/ contains=JanetStringEscape,@Spell
syntax region JanetString matchgroup=JanetStringDelimiter start="\z(`\+\)" end="\z1" contains=@Spell
syntax region JanetBuffer matchgroup=JanetStringDelimiter start="@\z(`\+\)" end="\z1" contains=@Spell
let s:janet_syntax_keywords = {
\ 'JanetBoolean': ["false","true"]
\ , 'JanetConstant': ["nil"]
\ , 'JanetSpecialForm': ["if","do","fn","while","def","var","quote","quasiquote","unquote","splice","set","break"]
\ , 'JanetFunction': $$FUNCTIONS$$
\ , 'JanetMacro': $$MACROS$$
\ }
function! s:syntax_keyword(dict)
for key in keys(a:dict)
execute 'syntax keyword' key join(a:dict[key], ' ')
endfor
endfunction
call s:syntax_keyword(s:janet_syntax_keywords)
unlet! s:key
delfunction s:syntax_keyword
" Try symchars but handle old vim versions.
try
let s:symcharnodig = '\!\$%\&\*\+\-./:<=>?@A-Z^_a-z|\x80-\U10FFFF'
" Make sure we support large character ranges in this vim version.
execute 'syntax match JanetSymbolDud "\v<%([' . s:symcharnodig . '])%([' . s:symchar . '])*>"'
catch
let s:symcharnodig = '\!\$%\&\*\+\-./:<=>?@A-Z^_a-z'
endtry
" Janet special characters
syntax match JanetQuote "'"
syntax match JanetSplice ";"
syntax match JanetQuasiquote "\~"
syntax match JanetUnquote ","
syntax match JanetShortFn "|"
" Janet symbols
let s:symchar = '0-9' . s:symcharnodig
execute 'syntax match JanetSymbol "\v<%([' . s:symcharnodig . '])%([' . s:symchar . '])*>"'
execute 'syntax match JanetKeyword "\v<:%([' . s:symchar . '])*>"'
execute 'syntax match JanetQuoted "\v' . "'" . '<%([' . s:symcharnodig . '])%([' . s:symchar . '])*>"'
unlet! s:symchar s:symcharnodig
" Janet numbers
function! s:syntaxNumber(prefix, expo, digit)
let l:digit = '[_' . a:digit . ']'
execute 'syntax match JanetNumber "\v\c<[-+]?' . a:prefix . '%(' .
\ l:digit . '+|' .
\ l:digit . '+\.' . l:digit . '*|' .
\ '\.' . l:digit . '+)%(' . a:expo . '[-+]?[' . a:digit . ']+)?>"'
endfunction
let s:radix_chars = "0123456789abcdefghijklmnopqrstuvwxyz"
for s:radix in range(2, 36)
call s:syntaxNumber(s:radix . 'r', '\&', '[' . strpart(s:radix_chars, 0, s:radix) . ']')
endfor
call s:syntaxNumber('', '[&e]', '0123456789')
call s:syntaxNumber('0x', '\&', '0123456789abcdef')
unlet! s:radix_chars s:radix
" -*- TOP CLUSTER -*-
syntax cluster JanetTop contains=@Spell,JanetComment,JanetConstant,JanetQuoted,JanetKeyword,JanetSymbol,JanetNumber,JanetString,JanetBuffer,JanetTuple,JanetArray,JanetTable,JanetStruct,JanetSpecialForm,JanetBoolean,JanetFunction,JanetMacro
syntax region JanetTuple matchgroup=JanetParen start="(" end=")" contains=@JanetTop fold
syntax region JanetArray matchgroup=JanetParen start="@(" end=")" contains=@JanetTop fold
syntax region JanetTuple matchgroup=JanetParen start="\[" end="]" contains=@JanetTop fold
syntax region JanetArray matchgroup=JanetParen start="@\[" end="]" contains=@JanetTop fold
syntax region JanetTable matchgroup=JanetParen start="{" end="}" contains=@JanetTop fold
syntax region JanetStruct matchgroup=JanetParen start="@{" end="}" contains=@JanetTop fold
" Highlight superfluous closing parens, brackets and braces.
syntax match JanetError "]\|}\|)"
syntax sync fromstart
" Highlighting
hi def link JanetComment Comment
hi def link JanetSymbol Normal
hi def link JanetQuoted Identifier
hi def link JanetNumber Number
hi def link JanetConstant Constant
hi def link JanetBoolean Boolean
hi def link JanetKeyword Keyword
hi def link JanetSpecialForm Special
hi def link JanetFunction Function
hi def link JanetMacro Macro
hi def link JanetBuffer String
hi def link JanetString String
hi def link JanetStringDelimiter String
hi def link JanetStringEscape Character
hi def link JanetQuote SpecialChar
hi def link JanetSplice SpecialChar
hi def link JanetQuasiquote SpecialChar
hi def link JanetUnquote SpecialChar
hi def link JanetShortFn SpecialChar
hi def link JanetParen Delimiter
hi def link JanetError Error
let b:current_syntax = "janet"
let &cpo = s:cpo_sav
unlet! s:cpo_sav
`````)
(->> template
(string/replace "$$FUNCTIONS$$" (string "[\"" (string/join functions "\",\"") "\"]"))
(string/replace "$$MACROS$$" (string "[\"" (string/join macros "\",\"") "\"]"))
(spit "syntax/janet.vim"))

128
etc/soft/nvim/+plugins/janet.vim/syntax/janet.vim

File diff suppressed because one or more lines are too long

50
etc/soft/nvim/+plugins/lualine.nvim/CONTRIBUTING.md

@ -0,0 +1,50 @@ @@ -0,0 +1,50 @@
# Contributing to lualine.nvim
Thanks for considering to contribute.
### Getting started
If you're not sure where to help? You can try these:
- You can look at the currently open [issues](https://github.com/nvim-lualine/lualine.nvim/issues)
to see if some bug needs fixing or for cool feature ideas.<br>
You should also look at currently open PRs ([Pull requests](https://github.com/nvim-lualine/lualine.nvim/pulls)) to see if some abandoned PR interests you.<br>
*We could really use some help with tests & docs they are currently lacking :)*
- You can add an exciting new component, extension or theme.
Note: Currently we aren't adding regular colorscheme based themes.
We think they make more sense with colorschemes as they tend not to get
updated once added here. But if you have some unique themes idea like [auto](https://github.com/nvim-lualine/lualine.nvim/blob/master/THEMES.md#auto) or [pywal](https://github.com/nvim-lualine/lualine.nvim/blob/master/THEMES.md#pywal) feel free to open an PR or issue.
- Feel free to open issues or unfinished PRs for help.
I'd actually recommend you to open an issue first for bigger PRs to discuss
the feature with a maintainer beforehand. That way you can know if the
feature is likely to be accepted or not before you get started.
You'll get recommendation and help with implementation specially if you show
willingness to implement it yourself.
- Do add tests and docs for your changes.
Good luck!
### Developer tools
*Let's introduce you to the tools we use.*
- Your PR needs to pass tests & linter. We lint our codebase with [luacheck](https://github.com/mpeterv/luacheck)
and run tests with [plenary-test][plenary.nvim] these will be ran on CI. If you want you can run tests & linter
locally with `make test` & `make lint` respectively. Or `make check` to run both linter & tests. For running
tests you'll have to make sure lualine.nvim, [plenary.nvim][plenary.nvim] and
[nvim-web-devicons](https://github.com/kyazdani42/nvim-web-devicons) are in same directory.
- Lua codebase gets formatted with [stylua](https://github.com/JohnnyMorganz/StyLua) in CI.
So you can ignore formatting. But if you want to submit formatted
PR you can run formatter locally with `make format`.
- VimDocs are auto generated with [panvimdoc](https://github.com/kdheepak/panvimdoc) from README.md.
So don't make changes to doc/lualine.txt . Instead add your docs to README or Wiki.
The docgen in ran by CI too. If you want to run it locally you can do so
with `make docgen`. Note: you'll need to have [pandoc](https://github.com/jgm/pandoc) installed.
- `make precommit_check` can come quite handy it'll run all the above mentioned tools
- You can check our test coverage with `make testcov`.
You'll need to have [luacov](https://github.com/keplerproject/luacov)
& [luacov-console](https://github.com/spacewander/luacov-console) installed for that.
If you want luacov's detailed report files, run the command with the `NOCLEAN` env set.
For example `NOCLEAN=1 make testcov`
[plenary.nvim]: https://github.com/nvim-lua/plenary.nvim

2
etc/soft/nvim/+plugins/venn.nvim/LICENSE → etc/soft/nvim/+plugins/lualine.nvim/LICENSE

@ -1,6 +1,6 @@ @@ -1,6 +1,6 @@
MIT License
Copyright (c) 2021 jbyuki
Copyright (c) 2020 hoob3rt
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal

38
etc/soft/nvim/+plugins/lualine.nvim/Makefile

@ -0,0 +1,38 @@ @@ -0,0 +1,38 @@
.DEFAULT_GOAL = check
lint:
@luacheck lua/lualine/
@luacheck tests/
@luacheck examples/
format:
@stylua --config-path=.stylua.toml lua/ examples/
test:
@mkdir -p tmp_home
@export XDG_DATA_HOME='./tmp_home' && \
export XDG_CONFIG_HOME='./tmp_home' && \
bash ./scripts/test_runner.sh
@rm -rf tmp_home
# Install luacov & luacov-console from luarocks
testcov:
@mkdir -p ./tmp_home/data/nvim
@mkdir -p ./tmp_home/config/nvim
@export XDG_DATA_HOME=$(realpath './tmp_home/data') && \
export XDG_CONFIG_HOME=$(realpath './tmp_home/config') && \
export TEST_COV=true && \
bash ./scripts/test_runner.sh
@luacov-console lua/
@luacov-console -s
ifeq ($(NOCLEAN), )
@rm luacov.*
endif
@rm -rf tmp_home
docgen:
@sh ./scripts/docgen.sh
precommit_check: docgen format test lint
check: lint test

927
etc/soft/nvim/+plugins/lualine.nvim/README.md

@ -0,0 +1,927 @@ @@ -0,0 +1,927 @@
# lualine.nvim
<!-- panvimdoc-ignore-start -->
![code size](https://img.shields.io/github/languages/code-size/nvim-lualine/lualine.nvim?style=flat-square)
![license](https://img.shields.io/github/license/nvim-lualine/lualine.nvim?style=flat-square)
<!-- panvimdoc-ignore-end -->
A blazing fast and easy to configure Neovim statusline written in Lua.
`lualine.nvim` requires Neovim >= 0.5.
## Contributing
Feel free to create an issue/PR if you want to see anything else implemented.
If you have some question or need help with configuration, start a [discussion](https://github.com/nvim-lualine/lualine.nvim/discussions).
Please read [CONTRIBUTING.md](./CONTRIBUTING.md) before opening a PR.
You can also help with documentation in the [wiki](https://github.com/nvim-lualine/lualine.nvim/wiki).
<!-- panvimdoc-ignore-start -->
## Screenshots
Here is a preview of what lualine can look like.
<p>
<img width='700' src='https://user-images.githubusercontent.com/41551030/108650373-bb025580-74bf-11eb-8682-2c09321dd18e.png'/>
<img width='700' src='https://user-images.githubusercontent.com/41551030/108650377-bd64af80-74bf-11eb-9c55-fbfc51b39fe8.png'/>
<img width='700' src='https://user-images.githubusercontent.com/41551030/108650378-be95dc80-74bf-11eb-9718-82b242ecdd54.png'/>
<img width='700' src='https://user-images.githubusercontent.com/41551030/108650381-bfc70980-74bf-11eb-9245-85c48f0f154a.png'/>
<img width='700' src='https://user-images.githubusercontent.com/41551030/103467925-32372b00-4d54-11eb-88d6-6d39c46854d8.png'/>
</p>
Screenshots of all available themes are listed in [THEMES.md](./THEMES.md)
For those who want to break the norms, you can create custom looks for lualine.
**Example** :
- [evil_lualine](examples/evil_lualine.lua)
<img width='700' src='https://user-images.githubusercontent.com/13149513/113875129-4453ba00-97d8-11eb-8f21-94a9ef565db3.png'/>
- [slanted-gaps](examples/slanted-gaps.lua)
<img width='700' src='https://user-images.githubusercontent.com/13149513/143395518-f6d6f748-c1ca-491b-9dab-246d0a8cf23f.png'/>
- [bubbles](examples/bubbles.lua)
<img width='700' src='https://user-images.githubusercontent.com/20235646/131350468-fc556196-5f46-4bfe-a72e-960f6a58db2c.png'/>
<!-- panvimdoc-ignore-end -->
## Performance compared to other plugins
Unlike other statusline plugins, lualine loads only the components you specify, and nothing else.
Startup time performance measured with an amazing plugin [dstein64/vim-startuptime](https://github.com/dstein64/vim-startuptime)
Times are measured with a clean `init.vim` with only `vim-startuptime`,
`vim-plug` and given statusline plugin installed.
In control just `vim-startuptime` and`vim-plug` is installed.
And measured time is complete startuptime of vim not time spent
on specific plugin. These numbers are the average of 20 runs.
| control | lualine | lightline | airline |
| :------: | :-------: | :-------: | :-------: |
| 17.2 ms | 24.8 ms | 25.5 ms | 79.9 ms |
Last Updated On: 18-04-2022
## Installation
### [vim-plug](https://github.com/junegunn/vim-plug)
```vim
Plug 'nvim-lualine/lualine.nvim'
" If you want to have icons in your statusline choose one of these
Plug 'kyazdani42/nvim-web-devicons'
```
### [packer.nvim](https://github.com/wbthomason/packer.nvim)
```lua
use {
'nvim-lualine/lualine.nvim',
requires = { 'kyazdani42/nvim-web-devicons', opt = true }
}
```
You'll also need to have a patched font if you want icons.
## Usage and customization
Lualine has sections as shown below.
```text
+-------------------------------------------------+
| A | B | C X | Y | Z |
+-------------------------------------------------+
```
Each sections holds its components e.g. Vim's current mode.
### Configuring lualine in init.vim
All the examples below are in lua. You can use the same examples
in `.vim` files by wrapping them in lua heredoc like this:
```vim
lua << END
require('lualine').setup()
END
```
For more information, check out `:help lua-heredoc`.
#### Default configuration
```lua
require('lualine').setup {
options = {
icons_enabled = true,
theme = 'auto',
component_separators = { left = '', right = ''},
section_separators = { left = '', right = ''},
disabled_filetypes = {
statusline = {},
winbar = {},
},
ignore_focus = {},
always_divide_middle = true,
globalstatus = false,
refresh = {
statusline = 1000,
tabline = 1000,
winbar = 1000,
}
},
sections = {
lualine_a = {'mode'},
lualine_b = {'branch', 'diff', 'diagnostics'},
lualine_c = {'filename'},
lualine_x = {'encoding', 'fileformat', 'filetype'},
lualine_y = {'progress'},
lualine_z = {'location'}
},
inactive_sections = {
lualine_a = {},
lualine_b = {},
lualine_c = {'filename'},
lualine_x = {'location'},
lualine_y = {},
lualine_z = {}
},
tabline = {},
winbar = {},
inactive_winbar = {},
extensions = {}
}
```
If you want to get your current lualine config, you can
do so with:
```lua
require('lualine').get_config()
```
---
### Starting lualine
```lua
require('lualine').setup()
```
---
### Setting a theme
```lua
options = { theme = 'gruvbox' }
```
All available themes are listed in [THEMES.md](./THEMES.md).
Please create a PR if you managed to port a popular theme before us, [here is how to do it](./CONTRIBUTING.md).
#### Customizing themes
```lua
local custom_gruvbox = require'lualine.themes.gruvbox'
-- Change the background of lualine_c section for normal mode
custom_gruvbox.normal.c.bg = '#112233'
require('lualine').setup {
options = { theme = custom_gruvbox },
...
}
```
Theme structure is available [here](https://github.com/nvim-lualine/lualine.nvim/wiki/Writing-a-theme).
---
### Separators
lualine defines two kinds of separators:
- `section_separators` - separators between sections
- `component_separators` - separators between the different components in sections
**Note**: if viewing this README in a browser, chances are the characters below will not be visible.
```lua
options = {
section_separators = { left = '', right = '' },
component_separators = { left = '', right = '' }
}
```
Here, left refers to the left-most sections (a, b, c), and right refers
to the right-most sections (x, y, z).
#### Disabling separators
```lua
options = { section_separators = '', component_separators = '' }
```
---
### Changing components in lualine sections
```lua
sections = {lualine_a = {'mode'}}
```
#### Available components
- `branch` (git branch)
- `buffers` (shows currently available buffers)
- `diagnostics` (diagnostics count from your preferred source)
- `diff` (git diff status)
- `encoding` (file encoding)
- `fileformat` (file format)
- `filename`
- `filesize`
- `filetype`
- `hostname`
- `location` (location in file in line:column format)
- `mode` (vim mode)
- `progress` (%progress in file)
- `searchcount` (number of search matches when hlsearch is active)
- `tabs` (shows currently available tabs)
- `windows` (shows currently available windows)
#### Custom components
##### Lua functions as lualine component
```lua
local function hello()
return [[hello world]]
end
sections = { lualine_a = { hello } }
```
##### Vim functions as lualine component
```lua
sections = { lualine_a = {'FugitiveHead'} }
```
##### Vim's statusline items as lualine component
```lua
sections = { lualine_c = {'%=', '%t%m', '%3p'} }
```
##### Vim variables as lualine component
Variables from `g:`, `v:`, `t:`, `w:`, `b:`, `o:`, `to:`, `wo:`, `bo:` scopes can be used.
See `:h lua-vim-variables` and `:h lua-vim-options` if you are not sure what to use.
```lua
sections = { lualine_a = { 'g:coc_status', 'bo:filetype' } }
```
##### Lua expressions as lualine component
You can use any valid lua expression as a component including:
- oneliners
- global variables
- require statements
```lua
sections = { lualine_c = { "os.date('%a')", 'data', "require'lsp-status'.status()" } }
```
`data` is a global variable in this example.
---
### Component options
Component options can change the way a component behave.
There are two kinds of options:
- global options affecting all components
- local options affecting specific
Global options can be used as local options (can be applied to specific components)
but you cannot use local options as global.
Global option used locally overwrites the global, for example:
```lua
require('lualine').setup {
options = { fmt = string.lower },
sections = { lualine_a = {
{ 'mode', fmt = function(str) return str:sub(1,1) end } },
lualine_b = {'branch'} }
}
```
`mode` will be formatted with the passed function so only first char will be
shown . On the other hand branch will be formatted with global formatter
`string.lower` so it will be showed in lower case.
#### Available options
#### Global options
These are `options` that are used in options table.
They set behavior of lualine.
Values set here are treated as default for other options
that work in component level.
For example even though `icons_enabled` is a general component option.
You can set `icons_enabled` to `false` and icons will be disabled on all
component. You can still overwrite defaults set in option table by specifying
the option value in component.
```lua
options = {
theme = 'auto', -- lualine theme
component_separators = { left = '', right = '' },
section_separators = { left = '', right = '' },
disabled_filetypes = { -- Filetypes to disable lualine for.
statusline = {}, -- only ignores the ft for statusline.
winbar = {}, -- only ignores the ft for winbar.
},
ignore_focus = {}, -- If current filetype is in this list it'll
-- always be drawn as inactive statusline
-- and the last window will be drawn as active statusline.
-- for example if you don't want statusline of
-- your file tree / sidebar window to have active
-- statusline you can add their filetypes here.
always_divide_middle = true, -- When set to true, left sections i.e. 'a','b' and 'c'
-- can't take over the entire statusline even
-- if neither of 'x', 'y' or 'z' are present.
globalstatus = false, -- enable global statusline (have a single statusline
-- at bottom of neovim instead of one for every window).
-- This feature is only available in neovim 0.7 and higher.
refresh = { -- sets how often lualine should refreash it's contents (in ms)
statusline = 1000, -- The refresh option sets minimum time that lualine tries
tabline = 1000, -- to maintain between refresh. It's not guarantied if situation
winbar = 1000 -- arises that lualine needs to refresh itself before this time
-- it'll do it.
-- Also you can force lualine's refresh by calling refresh function
-- like require('lualine').refresh()
}
}
```
#### General component options
These are options that control behavior at component level
and are available for all components.
```lua
sections = {
lualine_a = {
{
'mode',
icons_enabled = true, -- Enables the display of icons alongside the component.
-- Defines the icon to be displayed in front of the component.
-- Can be string|table
-- As table it must contain the icon as first entry and can use
-- color option to custom color the icon. Example:
-- {'branch', icon = ''} / {'branch', icon = {'', color={fg='green'}}}
-- icon position can also be set to the right side from table. Example:
-- {'branch', icon = {'', align='right', color={fg='green'}}}
icon = nil,
separator = nil, -- Determines what separator to use for the component.
-- Note:
-- When a string is provided it's treated as component_separator.
-- When a table is provided it's treated as section_separator.
-- Passing an empty string disables the separator.
--
-- These options can be used to set colored separators
-- around a component.
--
-- The options need to be set as such:
-- separator = { left = '', right = ''}
--
-- Where left will be placed on left side of component,
-- and right will be placed on its right.
--
cond = nil, -- Condition function, the component is loaded when the function returns `true`.
-- Defines a custom color for the component:
--
-- 'highlight_group_name' | { fg = '#rrggbb'|cterm_value(0-255)|'color_name(red)', bg= '#rrggbb', gui='style' } | function
-- Note:
-- '|' is synonymous with 'or', meaning a different acceptable format for that placeholder.
-- color function has to return one of other color types ('highlight_group_name' | { fg = '#rrggbb'|cterm_value(0-255)|'color_name(red)', bg= '#rrggbb', gui='style' })
-- color functions can be used to have different colors based on state as shown below.
--
-- Examples:
-- color = { fg = '#ffaa88', bg = 'grey', gui='italic,bold' },
-- color = { fg = 204 } -- When fg/bg are omitted, they default to the your theme's fg/bg.
-- color = 'WarningMsg' -- Highlight groups can also be used.
-- color = function(section)
-- return { fg = vim.bo.modified and '#aa3355' or '#33aa88' }
-- end,
color = nil, -- The default is your theme's color for that section and mode.
-- Specify what type a component is, if omitted, lualine will guess it for you.
--
-- Available types are:
-- [format: type_name(example)], mod(branch/filename),
-- stl(%f/%m), var(g:coc_status/bo:modifiable),
-- lua_expr(lua expressions), vim_fun(viml function name)
--
-- Note:
-- lua_expr is short for lua-expression and vim_fun is short for vim-function.
type = nil,
padding = 1, -- Adds padding to the left and right of components.
-- Padding can be specified to left or right independently, e.g.:
-- padding = { left = left_padding, right = right_padding }
fmt = nil, -- Format function, formats the component's output.
on_click = nil, -- takes a function that is called when component is clicked with mouse.
-- the function receives several arguments
-- - number of clicks incase of multiple clicks
-- - mouse button used (l(left)/r(right)/m(middle)/...)
-- - modifiers pressed (s(shift)/c(ctrl)/a(alt)/m(meta)...)
}
}
}
```
#### Component specific options
These are options that are available on specific components.
For example you have option on `diagnostics` component to
specify what your diagnostic sources will be.
#### buffers component options
```lua
sections = {
lualine_a = {
{
'buffers',
show_filename_only = true, -- Shows shortened relative path when set to false.
hide_filename_extension = false, -- Hide filename extension when set to true.
show_modified_status = true, -- Shows indicator when the buffer is modified.
mode = 0, -- 0: Shows buffer name
-- 1: Shows buffer index
-- 2: Shows buffer name + buffer index
-- 3: Shows buffer number
-- 4: Shows buffer name + buffer number
max_length = vim.o.columns * 2 / 3, -- Maximum width of buffers component,
-- it can also be a function that returns
-- the value of `max_length` dynamically.
filetype_names = {
TelescopePrompt = 'Telescope',
dashboard = 'Dashboard',
packer = 'Packer',
fzf = 'FZF',
alpha = 'Alpha'
}, -- Shows specific buffer name for that filetype ( { `filetype` = `buffer_name`, ... } )
buffers_color = {
-- Same values as the general color option can be used here.
active = 'lualine_{section}_normal', -- Color for active buffer.
inactive = 'lualine_{section}_inactive', -- Color for inactive buffer.
},
symbols = {
modified = ' ●', -- Text to show when the buffer is modified
alternate_file = '#', -- Text to show to identify the alternate file
directory = '', -- Text to show when the buffer is a directory
},
}
}
}
```
#### diagnostics component options
```lua
sections = {
lualine_a = {
{
'diagnostics',
-- Table of diagnostic sources, available sources are:
-- 'nvim_lsp', 'nvim_diagnostic', 'nvim_workspace_diagnostic', 'coc', 'ale', 'vim_lsp'.
-- or a function that returns a table as such:
-- { error=error_cnt, warn=warn_cnt, info=info_cnt, hint=hint_cnt }
sources = { 'nvim_diagnostic', 'coc' },
-- Displays diagnostics for the defined severity types
sections = { 'error', 'warn', 'info', 'hint' },
diagnostics_color = {
-- Same values as the general color option can be used here.
error = 'DiagnosticError', -- Changes diagnostics' error color.
warn = 'DiagnosticWarn', -- Changes diagnostics' warn color.
info = 'DiagnosticInfo', -- Changes diagnostics' info color.
hint = 'DiagnosticHint', -- Changes diagnostics' hint color.
},
symbols = {error = 'E', warn = 'W', info = 'I', hint = 'H'},
colored = true, -- Displays diagnostics status in color if set to true.
update_in_insert = false, -- Update diagnostics in insert mode.
always_visible = false, -- Show diagnostics even if there are none.
}
}
}
```
#### diff component options
```lua
sections = {
lualine_a = {
{
'diff',
colored = true, -- Displays a colored diff status if set to true
diff_color = {
-- Same color values as the general color option can be used here.
added = 'DiffAdd', -- Changes the diff's added color
modified = 'DiffChange', -- Changes the diff's modified color
removed = 'DiffDelete', -- Changes the diff's removed color you
},
symbols = {added = '+', modified = '~', removed = '-'}, -- Changes the symbols used by the diff.
source = nil, -- A function that works as a data source for diff.
-- It must return a table as such:
-- { added = add_count, modified = modified_count, removed = removed_count }
-- or nil on failure. count <= 0 won't be displayed.
}
}
}
```
#### fileformat component options
```lua
sections = {
lualine_a = {
{
'fileformat',
symbols = {
unix = '', -- e712
dos = '', -- e70f
mac = '', -- e711
}
}
}
}
```
#### filename component options
```lua
sections = {
lualine_a = {
{
'filename',
file_status = true, -- Displays file status (readonly status, modified status)
newfile_status = false -- Display new file status (new file means no write after created)
path = 0, -- 0: Just the filename
-- 1: Relative path
-- 2: Absolute path
-- 3: Absolute path, with tilde as the home directory
shorting_target = 40, -- Shortens path to leave 40 spaces in the window
-- for other components. (terrible name, any suggestions?)
symbols = {
modified = '[+]', -- Text to show when the file is modified.
readonly = '[-]', -- Text to show when the file is non-modifiable or readonly.
unnamed = '[No Name]', -- Text to show for unnamed buffers.
newfile = '[New]', -- Text to show for new created file before first writting
}
}
}
}
```
#### filetype component options
```lua
sections = {
lualine_a = {
{
'filetype',
colored = true, -- Displays filetype icon in color if set to true
icon_only = false, -- Display only an icon for filetype
icon = { align = 'right' }, -- Display filetype icon on the right hand side
-- icon = {'X', align='right'}
-- Icon string ^ in table is ignored in filetype component
}
}
}
```
#### tabs component options
```lua
sections = {
lualine_a = {
{
'tabs',
max_length = vim.o.columns / 3, -- Maximum width of tabs component.
-- Note:
-- It can also be a function that returns
-- the value of `max_length` dynamically.
mode = 0, -- 0: Shows tab_nr
-- 1: Shows tab_name
-- 2: Shows tab_nr + tab_name
tabs_color = {
-- Same values as the general color option can be used here.
active = 'lualine_{section}_normal', -- Color for active tab.
inactive = 'lualine_{section}_inactive', -- Color for inactive tab.
},
}
}
}
```
#### windows component options
```lua
sections = {
lualine_a = {
{
'windows',
show_filename_only = true, -- Shows shortened relative path when set to false.
show_modified_status = true, -- Shows indicator when the window is modified.
mode = 0, -- 0: Shows window name
-- 1: Shows window index
-- 2: Shows window name + window index
max_length = vim.o.columns * 2 / 3, -- Maximum width of windows component,
-- it can also be a function that returns
-- the value of `max_length` dynamically.
filetype_names = {
TelescopePrompt = 'Telescope',
dashboard = 'Dashboard',
packer = 'Packer',
fzf = 'FZF',
alpha = 'Alpha'
}, -- Shows specific window name for that filetype ( { `filetype` = `window_name`, ... } )
disabled_buftypes = { 'quickfix', 'prompt' }, -- Hide a window if its buffer's type is disabled
windows_color = {
-- Same values as the general color option can be used here.
active = 'lualine_{section}_normal', -- Color for active window.
inactive = 'lualine_{section}_inactive', -- Color for inactive window.
},
}
}
}
```
---
### Tabline
You can use lualine to display components in tabline.
The configuration for tabline sections is exactly the same as that of the statusline.
```lua
tabline = {
lualine_a = {},
lualine_b = {'branch'},
lualine_c = {'filename'},
lualine_x = {},
lualine_y = {},
lualine_z = {}
}
```
This will show the branch and filename components on top of neovim inside tabline.
lualine also provides 2 components, buffers and tabs, that you can use to get a more traditional tabline/bufferline.
```lua
tabline = {
lualine_a = {'buffers'},
lualine_b = {'branch'},
lualine_c = {'filename'},
lualine_x = {},
lualine_y = {},
lualine_z = {'tabs'}
}
```
### Winbar
From neovim-0.8 you can customize your winbar with lualine.
Winbar configuration is similar to statusline.
```lua
winbar = {
lualine_a = {},
lualine_b = {},
lualine_c = {'filename'},
lualine_x = {},
lualine_y = {},
lualine_z = {}
}
inactive_winbar = {
lualine_a = {},
lualine_b = {},
lualine_c = {'filename'},
lualine_x = {},
lualine_y = {},
lualine_z = {}
}
```
Just like statusline you can separately specify winbar for active and inactive
windows. Any lualine component can be placed in winbar. All kinds of custom
components supported in statusline are also suported for winbar too. In general
You can treat winbar as another lualine statusline that just appears on top
of windows instead of at bottom.
#### Buffers
Shows currently open buffers. Like bufferline . See
[buffers options](#buffers-component-options)
for all builtin behaviors of buffers component.
You can use `:LualineBuffersJump` to jump to buffer based on index
of buffer in buffers component.
Jumping to non-existent buffer indices generates an error. To avoid these errors
`LualineBuffersJump` provides `<bang>` support, meaning that you can call
`:LualineBufferJump!` to ignore these errors.
```vim
:LualineBuffersJump 2 " Jumps to 2nd buffer in buffers component.
:LualineBuffersJump $ " Jumps to last buffer in buffers component.
:LualineBuffersJump! 3 " Attempts to jump to 3rd buffer, if it exists.
```
#### Tabs
Shows currently open tab. Like usual tabline. See
[tabs options](#tabs-component-options)
for all builtin behaviors of tabs component.
You can also use `:LualineRenameTab` to set a name for a tabpage.
For example:
```vim
:LualineRenameTab Project_K
```
It's useful when you're using rendering mode 2/3 in tabs.
To unname a tabpage run `:LualineRenameTab` without argument.
#### Tabline as statusline
You can also completely move your statusline to a tabline by configuring
`lualine.tabline` and disabling `lualine.sections` and `lualine.inactive_sections`:
```lua
tabline = {
......
},
sections = {},
inactive_sections = {},
```
If you want a more sophisticated tabline you can use other
tabline plugins with lualine too, for example:
- [nvim-bufferline](https://github.com/akinsho/nvim-bufferline.lua)
- [tabline.nvim](https://github.com/kdheepak/tabline.nvim)
tabline.nvim even uses lualine's theme by default 🙌
You can find a bigger list [here](https://github.com/rockerBOO/awesome-neovim#tabline).
---
### Extensions
lualine extensions change statusline appearance for a window/buffer with
specified filetypes.
By default no extensions are loaded to improve performance.
You can load extensions with:
```lua
extensions = {'quickfix'}
```
#### Available extensions
- aerial
- chadtree
- fern
- fugitive
- fzf
- man
- mundo
- neo-tree
- nerdtree
- nvim-dap-ui
- nvim-tree
- quickfix
- symbols-outline
- toggleterm
#### Custom extensions
You can define your own extensions. If you believe an extension may be useful to others, then please submit a PR.
```lua
local my_extension = { sections = { lualine_a = {'mode'} }, filetypes = {'lua'} }
require('lualine').setup { extensions = { my_extension } }
```
---
### Refreshing lualine
By default lualine refreshes itself based on timer and some events. You can set
the interval of the timer with refresh option. However you can also force
lualine to refresh at any time by calling lualine.refresh function.
```lua
require('lualine').refresh({
scope = 'tabpage', -- scope of refresh all/tabpage/window
place = { 'statusline', 'winbar', 'tabline' }, -- lualine segment ro refresh.
})
```
The arguments shown here are default values. So not passing any of them will be
treated as if a default value was passed.
So you can simply do
```lua
require('lualine').refresh()
```
Avoid calling lualine.refresh inside components. Since components are evaluated
during refresh, calling refresh while refreshing can have undesirable effects.
### Disabling lualine
You can disable lualine for specific filetypes:
```lua
options = { disabled_filetypes = {'lua'} }
```
You can also disable lualine completely.
Note that you need to call this after the setup
```lua
require('lualine').hide({
place = {'statusline', 'tabline', 'winbar'}, -- The segment this change applies to.
unhide = false, -- whether to reenable lualine again/
})
```
The arguments show for hide above are default values.
Which means even if the hide function is called without
arguments it'll work as if these were passed.
So in short to disable lualine completely you can do
```lua
require('lualine').hide()
```
To enable it again you can do
```lua
require('lualine').hide({unhide=true})
```
<!-- panvimdoc-ignore-start -->
### Contributors
Thanks to these wonderful people, we enjoy this awesome plugin.
<a href="https://github.com/nvim-lualine/lualine.nvim/graphs/contributors">
<img src="https://contrib.rocks/image?repo=nvim-lualine/lualine.nvim" />
</a>
<!-- panvimdoc-ignore-end -->
### Wiki
Check out the [wiki](https://github.com/nvim-lualine/lualine.nvim/wiki) for more info.
You can find some useful [configuration snippets](https://github.com/nvim-lualine/lualine.nvim/wiki/Component-snippets) here. You can also share your awesome snippets with others.
If you want to extend lualine with plugins or want to know
which ones already do, [wiki/plugins](https://github.com/nvim-lualine/lualine.nvim/wiki/Plugins) is for you.
### Support
If you appreciate my work you can buy me a coffee.
<a href="https://www.buymeacoffee.com/shadmansalJ" target="_blank"><img src="https://cdn.buymeacoffee.com/buttons/default-black.png" alt="Buy Me A Coffee" style="height: 41px !important;width: 174px !important;box-shadow: 0px 3px 2px 0px rgba(190, 190, 190, 0.5) !important;-webkit-box-shadow: 0px 3px 2px 0px rgba(190, 190, 190, 0.5) !important;"></a>

361
etc/soft/nvim/+plugins/lualine.nvim/THEMES.md

@ -0,0 +1,361 @@ @@ -0,0 +1,361 @@
# Available themes
All available themes are only best effort ports by myself/ other users. If you find a theme to be weird/ wrong please open an issue/ pr.
### auto
auto is a special theme. It will automatically load theme for your colorscheme.
If there's no theme available for your colorscheme then
it'll try it's best to generate one.
### 16color
<p>
<img width='700' src='https://user-images.githubusercontent.com/41551030/108648240-02d2ae00-74bb-11eb-9ac1-495849621366.png'/>
<img width='700' src='https://user-images.githubusercontent.com/41551030/108648219-f77f8280-74ba-11eb-84e4-978bf918c21f.png'/>
<img width='700' src='https://user-images.githubusercontent.com/41551030/108648263-141bba80-74bb-11eb-84e0-ff48ae6f927a.png'/>
<img width='700' src='https://user-images.githubusercontent.com/41551030/108648270-1a119b80-74bb-11eb-8fff-00984243846f.png'/>
</p>
### ayu_dark
<p>
<img width='700' src='https://user-images.githubusercontent.com/41551030/108648314-357ca680-74bb-11eb-83de-ec94c3a75d99.png'/>
<img width='700' src='https://user-images.githubusercontent.com/41551030/108648329-3e6d7800-74bb-11eb-901b-41e1f01315f0.png'/>
<img width='700' src='https://user-images.githubusercontent.com/41551030/108648342-44fbef80-74bb-11eb-8262-a6f615e5fcfb.png'/>
<img width='700' src='https://user-images.githubusercontent.com/41551030/108648367-52b17500-74bb-11eb-8ec5-dbb59db60d98.png'/>
</p>
### ayu_light
<p>
<img width='700' src='https://user-images.githubusercontent.com/41551030/108648508-b5a30c00-74bb-11eb-80f7-0bce969d35ea.png'/>
<img width='700' src='https://user-images.githubusercontent.com/41551030/108648511-b89dfc80-74bb-11eb-9868-f63d7752fe83.png'/>
<img width='700' src='https://user-images.githubusercontent.com/41551030/108648514-bb98ed00-74bb-11eb-87f4-6b24de56f86c.png'/>
<img width='700' src='https://user-images.githubusercontent.com/41551030/108648518-bd62b080-74bb-11eb-8cbe-869ed12d16dc.png'/>
</p>
### ayu_mirage
<p>
<img width='700' src='https://user-images.githubusercontent.com/41551030/108648535-c6538200-74bb-11eb-815b-53f4b3274602.png'/>
<img width='700' src='https://user-images.githubusercontent.com/41551030/108648537-c784af00-74bb-11eb-8da5-d91bfc61a967.png'/>
<img width='700' src='https://user-images.githubusercontent.com/41551030/108648539-ca7f9f80-74bb-11eb-840a-5e0d9ba98bb8.png'/>
<img width='700' src='https://user-images.githubusercontent.com/41551030/108648541-cbb0cc80-74bb-11eb-843f-19c4c58b1d91.png'/>
</p>
### ayu
It's a combination of ayu_light, ayu_dark & ayu_mirage. If `g:ayucolor` exists,
it loads one of these based on your `g:ayucolor` option. Otherwise, it will
load ayu_light when background=light and ayu_dark when background=dark
But if `g:ayuprefermirage` exists, it will load ayu_mirage instead when
`background=dark`.
### base16
This theme will automatically uses colors defined by your colorscheme using [RRethy/nvim-base16](https://github.com/RRethy/nvim-base16)] plugin.
The following example is using the `tomorrow-night` colorscheme:
<p>
<img width='700' src='https://user-images.githubusercontent.com/11501572/156889654-3dedc9a1-e7a5-4cbe-b219-2a97499cf1d2.png'/>
<img width='700' src='https://user-images.githubusercontent.com/11501572/156889648-93bf3ce8-064d-4ac0-8415-20d6ef87c60b.png'/>
<img width='700' src='https://user-images.githubusercontent.com/11501572/156889624-c97fc3ae-d642-41ba-b39a-f9a72ff8b15e.png'/>
<img width='700' src='https://user-images.githubusercontent.com/11501572/156889566-17066e95-7f85-4bfd-8178-c4a34beab453.png'/>
</p>
### codedark
<p>
<img width='700' src='https://user-images.githubusercontent.com/41551030/108648568-dff4c980-74bb-11eb-9d16-b68ac68f2ab2.png'/>
<img width='700' src='https://user-images.githubusercontent.com/41551030/108648569-e125f680-74bb-11eb-8782-db9a6c2a3153.png'/>
<img width='700' src='https://user-images.githubusercontent.com/41551030/108648578-e6834100-74bb-11eb-819c-fb66d7d5118c.png'/>
<img width='700' src='https://user-images.githubusercontent.com/41551030/108648582-e8e59b00-74bb-11eb-9239-edcc8e9c2c18.png'/>
</p>
### dracula
<p>
<img width='700' src='https://user-images.githubusercontent.com/41551030/108648594-f0a53f80-74bb-11eb-9018-9ee12260750e.png'/>
<img width='700' src='https://user-images.githubusercontent.com/41551030/108648600-f26f0300-74bb-11eb-82a4-f732b3e7eeff.png'/>
<img width='700' src='https://user-images.githubusercontent.com/41551030/108648606-f4d15d00-74bb-11eb-8327-a35e97533617.png'/>
<img width='700' src='https://user-images.githubusercontent.com/41551030/108648619-fe5ac500-74bb-11eb-8952-cc5c81fd0b2b.png'/>
</p>
### everforest
<p>
<img width='700' src='https://user-images.githubusercontent.com/41551030/108648663-1cc0c080-74bc-11eb-8cc1-36266a0385e3.png'/>
<img width='700' src='https://user-images.githubusercontent.com/41551030/108648667-1df1ed80-74bc-11eb-9ef8-dfd2e8401f0c.png'/>
<img width='700' src='https://user-images.githubusercontent.com/41551030/108648671-21857480-74bc-11eb-996e-a5cf212e98bd.png'/>
<img width='700' src='https://user-images.githubusercontent.com/41551030/108648675-22b6a180-74bc-11eb-9b8e-45e64a03e062.png'/>
</p>
### gruvbox_dark
<p>
<img width='700' src='https://user-images.githubusercontent.com/41551030/108648685-2b0edc80-74bc-11eb-9ec9-9aac3677df43.png'/>
<img width='700' src='https://user-images.githubusercontent.com/41551030/108648693-2ea26380-74bc-11eb-831a-9ebbe4f3dd83.png'/>
<img width='700' src='https://user-images.githubusercontent.com/41551030/108648700-319d5400-74bc-11eb-90fa-72eccbda8242.png'/>
<img width='700' src='https://user-images.githubusercontent.com/41551030/108648716-382bcb80-74bc-11eb-824a-aaca67035073.png'/>
</p>
### gruvbox_light
<p>
<img width='700' src='https://user-images.githubusercontent.com/34294427/118757012-5d9b5c00-b896-11eb-8e4f-c0c28f774cf6.png'/>
<img width='700' src='https://user-images.githubusercontent.com/34294427/118757009-5bd19880-b896-11eb-9846-d02b16653ab0.png'/>
<img width='700' src='https://user-images.githubusercontent.com/34294427/118757023-612ee300-b896-11eb-8673-a39a0fbce619.png'/>
<img width='700' src='https://user-images.githubusercontent.com/34294427/118757020-5ffdb600-b896-11eb-95e7-dbf1f08e063d.png'/>
</p>
### gruvbox
It's a combination of gruvbox_light and gruvbox_dark. It loads either of
them based you your `background` option.
### gruvbox-material
<p>
<img width='700' src='https://user-images.githubusercontent.com/41551030/108648725-3f52d980-74bc-11eb-8fa5-a77b0a21cdea.png'/>
<img width='700' src='https://user-images.githubusercontent.com/41551030/108648728-41b53380-74bc-11eb-99cf-001eab6cc51b.png'/>
<img width='700' src='https://user-images.githubusercontent.com/41551030/108648742-4a0d6e80-74bc-11eb-9685-8e0cba1eb3c3.png'/>
<img width='700' src='https://user-images.githubusercontent.com/41551030/108648744-4d085f00-74bc-11eb-8aaa-05a7ca46adec.png'/>
</p>
### horizon
<p>
<img width='700' src='https://user-images.githubusercontent.com/69089176/118903813-70527700-b910-11eb-9d45-1785790ce8e8.png'/>
<img width='700' src='https://user-images.githubusercontent.com/69089176/118902058-bc9bb800-b90c-11eb-99b8-3b98cbdd01d7.png'/>
<img width='700' src='https://user-images.githubusercontent.com/69089176/118903506-dab6e780-b90f-11eb-85db-c6227a8caf0c.png'/>
<img width='700' src='https://user-images.githubusercontent.com/69089176/118902070-c2919900-b90c-11eb-9296-145a99ce52ce.png'/>
</p>
### iceberg_dark
<p>
<img width='700' src='https://user-images.githubusercontent.com/41551030/108648796-614c5c00-74bc-11eb-8398-cde120ec7746.png'/>
<img width='700' src='https://user-images.githubusercontent.com/41551030/108648813-64474c80-74bc-11eb-986b-432498dd6245.png'/>
<img width='700' src='https://user-images.githubusercontent.com/41551030/108648822-66a9a680-74bc-11eb-8b2b-416cd359c30d.png'/>
<img width='700' src='https://user-images.githubusercontent.com/41551030/108648829-6ad5c400-74bc-11eb-9af4-670968934931.png'/>
</p>
### iceberg_light
<p>
<img width='700' src='https://user-images.githubusercontent.com/41551030/108648848-71fcd200-74bc-11eb-8910-e12ae9ce619f.png'/>
<img width='700' src='https://user-images.githubusercontent.com/41551030/108648849-73c69580-74bc-11eb-93f9-d6f75a2bdd97.png'/>
<img width='700' src='https://user-images.githubusercontent.com/41551030/108648851-7628ef80-74bc-11eb-8a4b-c7f44c89ac93.png'/>
<img width='700' src='https://user-images.githubusercontent.com/41551030/108648862-7aeda380-74bc-11eb-808c-1b12dde45f3d.png'/>
</p>
### iceberg
It's a combination of iceberg_light and iceberg_dark. It loads either of
them based you your `background` option.
### jellybeans
<p>
<img width='700' src='https://user-images.githubusercontent.com/41551030/108648882-82ad4800-74bc-11eb-91e8-4d38fcdec134.png'/>
<img width='700' src='https://user-images.githubusercontent.com/41551030/108648883-850fa200-74bc-11eb-8d9b-54116accd2f8.png'/>
<img width='700' src='https://user-images.githubusercontent.com/41551030/108648900-8d67dd00-74bc-11eb-9600-13cd48fa2bde.png'/>
<img width='700' src='https://user-images.githubusercontent.com/41551030/108648902-8f31a080-74bc-11eb-9d8e-37a3f41d4c7a.png'/>
</p>
### material
<p>
<img width='700' src='https://user-images.githubusercontent.com/41551030/108648925-9e185300-74bc-11eb-9263-842fe2d56ba8.png'/>
<img width='700' src='https://user-images.githubusercontent.com/41551030/108648927-9f498000-74bc-11eb-8a15-4ba68403037a.png'/>
<img width='700' src='https://user-images.githubusercontent.com/41551030/108648930-a1134380-74bc-11eb-8a24-f203bf05cfb3.png'/>
<img width='700' src='https://user-images.githubusercontent.com/41551030/108648935-a2dd0700-74bc-11eb-9a4b-72eb1e2ab79e.png'/>
</p>
### modus-vivendi
<p>
<img width='700' src='https://user-images.githubusercontent.com/9327361/114389966-58176b80-9b9e-11eb-944e-1e0079527d74.png'/>
<img width='700' src='https://user-images.githubusercontent.com/9327361/114390000-606fa680-9b9e-11eb-97dd-ef5bbc23049a.png'/>
<img width='700' src='https://user-images.githubusercontent.com/9327361/114390024-6796b480-9b9e-11eb-8be2-ca4cc893fbb2.png'/>
<img width='700' src='https://user-images.githubusercontent.com/9327361/114390052-6d8c9580-9b9e-11eb-8dcb-469290a4c655.png'/>
</p>
### molokai
<p>
<img width='700' src='https://user-images.githubusercontent.com/41551030/108648944-ab354200-74bc-11eb-85fd-71a40102384b.png'/>
<img width='700' src='https://user-images.githubusercontent.com/41551030/108648946-acff0580-74bc-11eb-9aae-36a869b855e5.png'/>
<img width='700' src='https://user-images.githubusercontent.com/41551030/108648953-af615f80-74bc-11eb-8897-f2945fc34c09.png'/>
<img width='700' src='https://user-images.githubusercontent.com/41551030/108648958-b12b2300-74bc-11eb-8232-550949cbbfb3.png'/>
</p>
### moonfly
<p>
<img width='700' src='https://user-images.githubusercontent.com/11382509/129304429-cd2af22d-3b88-4c17-bf99-99f7608576d4.png'/>
<img width='700' src='https://user-images.githubusercontent.com/11382509/129304441-81a6c88e-364c-476a-9050-0ada4cae1e3b.png'/>
<img width='700' src='https://user-images.githubusercontent.com/11382509/129304453-2b18900a-13a9-4476-9977-3875e55aabaf.png'/>
<img width='700' src='https://user-images.githubusercontent.com/11382509/129304469-37fb0168-0484-406b-8b2e-d309232612ab.png'/>
</p>
### nightfly
<p>
<img width='700' src='https://user-images.githubusercontent.com/41551030/108648974-b9835e00-74bc-11eb-9c52-c5187aa3ff2c.png'/>
<img width='700' src='https://user-images.githubusercontent.com/41551030/108648977-bab48b00-74bc-11eb-96b3-7f51fc73d8e8.png'/>
<img width='700' src='https://user-images.githubusercontent.com/41551030/108648980-bc7e4e80-74bc-11eb-9b12-3182a112f968.png'/>
<img width='700' src='https://user-images.githubusercontent.com/41551030/108648981-bdaf7b80-74bc-11eb-86d4-6c44c3764a70.png'/>
</p>
### nord
<p>
<img width='700' src='https://user-images.githubusercontent.com/41551030/108649007-cbfd9780-74bc-11eb-87be-a9edc714e57a.png'/>
<img width='700' src='https://user-images.githubusercontent.com/41551030/108649010-cd2ec480-74bc-11eb-9d9b-54fadee2abef.png'/>
<img width='700' src='https://user-images.githubusercontent.com/41551030/108649019-cef88800-74bc-11eb-97eb-054d78427442.png'/>
<img width='700' src='https://user-images.githubusercontent.com/41551030/108649021-cf911e80-74bc-11eb-8b4a-9f9eb61c7973.png'/>
</p>
### OceanicNext
<p>
<img width='700' src='https://user-images.githubusercontent.com/41551030/108649039-d7e95980-74bc-11eb-9a33-df413936c645.png'/>
<img width='700' src='https://user-images.githubusercontent.com/41551030/108649043-d91a8680-74bc-11eb-9b1b-9c2e88ede3aa.png'/>
<img width='700' src='https://user-images.githubusercontent.com/41551030/108649052-db7ce080-74bc-11eb-8d9b-05c4c21a7e53.png'/>
<img width='700' src='https://user-images.githubusercontent.com/41551030/108649056-dcae0d80-74bc-11eb-91a0-ee0d98f3525d.png'/>
</p>
### onedark
<p>
<img width='700' src='https://user-images.githubusercontent.com/8293386/150810955-ef6bf575-4a96-439c-a708-37dd25c63a47.png'/>
<img width='700' src='https://user-images.githubusercontent.com/8293386/150811104-31fbc04c-1500-4779-a079-98bd1e56701d.png'/>
<img width='700' src='https://user-images.githubusercontent.com/8293386/150811324-d1169232-a7b6-4f79-a104-031ea7972a32.png'/>
<img width='700' src='https://user-images.githubusercontent.com/8293386/150811517-f90a406d-a4b9-4bd5-913c-ec1ae547c400.png'/>
</p>
### onelight
<p>
<img width='700' src='https://user-images.githubusercontent.com/8293386/150809518-b596f9bc-c351-4e71-9dec-e1856efaff8a.png'/>
<img width='700' src='https://user-images.githubusercontent.com/8293386/150809979-237c6414-4278-447d-a00f-0a32e2770195.png'/>
<img width='700' src='https://user-images.githubusercontent.com/8293386/150810292-afeecfce-3b53-468d-aed9-1bb5ea9ed46f.png'/>
<img width='700' src='https://user-images.githubusercontent.com/8293386/150810514-81024b2c-3b80-466f-85ce-914e191bb4f9.png'/>
</p>
### palenight
<p>
<img width='700' src='https://user-images.githubusercontent.com/7190144/109406548-3e1d2300-797a-11eb-8fdb-c3882ae08625.png'/>
<img width='700' src='https://user-images.githubusercontent.com/7190144/109406547-3e1d2300-797a-11eb-9b72-43ba7145355d.png'/>
<img width='700' src='https://user-images.githubusercontent.com/7190144/109406545-3cebf600-797a-11eb-8e2e-992e98d8120e.png'/>
<img width='700' src='https://user-images.githubusercontent.com/7190144/109406546-3d848c80-797a-11eb-9069-04caf383275d.png'/>
</p>
### papercolor_dark
<p>
<img width='700' src='https://user-images.githubusercontent.com/41551030/108649104-fd766300-74bc-11eb-8c5c-40e7191a81f7.png'/>
<img width='700' src='https://user-images.githubusercontent.com/41551030/108649106-fe0ef980-74bc-11eb-93f7-f98e0b89d5c9.png'/>
<img width='700' src='https://user-images.githubusercontent.com/41551030/108649108-ff402680-74bc-11eb-93da-bb96d51c39f0.png'/>
<img width='700' src='https://user-images.githubusercontent.com/41551030/108649112-00715380-74bd-11eb-8125-2c108da5123e.png'/>
</p>
### papercolor_light
<p>
<img width='700' src='https://user-images.githubusercontent.com/41551030/108649126-07986180-74bd-11eb-9a25-c6ce762d37d2.png'/>
<img width='700' src='https://user-images.githubusercontent.com/41551030/108649129-08c98e80-74bd-11eb-93d4-5bc109ac9ee9.png'/>
<img width='700' src='https://user-images.githubusercontent.com/41551030/108649132-0b2be880-74bd-11eb-8ed2-afab3e974b4e.png'/>
<img width='700' src='https://user-images.githubusercontent.com/41551030/108649137-0cf5ac00-74bd-11eb-8764-765bead5de6e.png'/>
</p>
### PaperColor
It's a combination of papercolor_light and papercolor_dark. It loads either of
them based you your `background` option.
### powerline
<p>
<img width='700' src='https://user-images.githubusercontent.com/41551030/108649147-14b55080-74bd-11eb-9670-713185342eb2.png'/>
<img width='700' src='https://user-images.githubusercontent.com/41551030/108649150-15e67d80-74bd-11eb-8815-194c51d96016.png'/>
<img width='700' src='https://user-images.githubusercontent.com/41551030/108649155-17b04100-74bd-11eb-8e41-017eb9a837b5.png'/>
<img width='700' src='https://user-images.githubusercontent.com/41551030/108649158-18e16e00-74bd-11eb-8687-65b0ecbf20d2.png'/>
</p>
### powerline_dark
<p>
<img width='700' src='https://user-images.githubusercontent.com/59497618/131224416-851aedd4-27bb-47fd-a9a6-5332aa42ce60.png'/>
<img width='700' src='https://user-images.githubusercontent.com/59497618/131224418-7bec491b-1183-4ec7-8089-3dbe460cc1e4.png'/>
<img width='700' src='https://user-images.githubusercontent.com/59497618/131224419-adab4f88-aaf8-449e-9988-ae002333d131.png'/>
<img width='700' src='https://user-images.githubusercontent.com/59497618/131224421-3b175d7a-fb14-424c-ad53-03d2c3b2ab71.png'/>
</p>
### pywal
pywal is another special theme. It will load the colors from your current [pywal](https://github.com/dylanaraps/pywal) cache, specifically `~/.cache/wal/colors.sh` and generate a theme.
#### `wal --theme ashes`
<img width='700' src='https://user-images.githubusercontent.com/36740602/132101614-8aa90169-a1ed-4911-b09f-31b5bae56cbf.png'/>
#### `wal --theme -l github`
<img width='700' src='https://user-images.githubusercontent.com/36740602/132101617-f3ff65eb-8051-4294-9a55-e6caa9605006.png'/>
#### `wal --theme vscode`
<img width='700' src='https://user-images.githubusercontent.com/36740602/132101619-7d04d748-d478-45a2-983a-f2a93f3c5714.png'/>
#### `wal --theme zenburn`
<img width='700' src='https://user-images.githubusercontent.com/36740602/132101621-505e5bb6-d18a-434c-a0f8-a3904a5c71f2.png'/>
### seoul256
<p>
<img width='700' src='https://user-images.githubusercontent.com/41551030/108649194-2c8cd480-74bd-11eb-8fbc-935d7e0fe921.png'/>
<img width='700' src='https://user-images.githubusercontent.com/41551030/108649198-2d256b00-74bd-11eb-9894-7ffdead0297c.png'/>
<img width='700' src='https://user-images.githubusercontent.com/41551030/108649202-2eef2e80-74bd-11eb-9627-38f834ce4aec.png'/>
<img width='700' src='https://user-images.githubusercontent.com/41551030/108649205-2f87c500-74bd-11eb-9da6-5253dcff2c82.png'/>
</p>
### solarized_dark
<p>
<img width='700' src='https://user-images.githubusercontent.com/41551030/108649216-37476980-74bd-11eb-8f3b-2a7fc368388d.png'/>
<img width='700' src='https://user-images.githubusercontent.com/41551030/108649217-38789680-74bd-11eb-8337-5e3005c5e261.png'/>
<img width='700' src='https://user-images.githubusercontent.com/41551030/108649223-3c0c1d80-74bd-11eb-953b-72c614aa9638.png'/>
<img width='700' src='https://user-images.githubusercontent.com/41551030/108649227-3d3d4a80-74bd-11eb-8251-d7788db36060.png'/>
</p>
### solarized_light
<p>
<img width='700' src='https://user-images.githubusercontent.com/41551030/108649246-44645880-74bd-11eb-92c9-120798dc0452.png'/>
<img width='700' src='https://user-images.githubusercontent.com/41551030/108649251-462e1c00-74bd-11eb-953d-2857296997cc.png'/>
<img width='700' src='https://user-images.githubusercontent.com/41551030/108649255-475f4900-74bd-11eb-8a75-7ca266d56009.png'/>
<img width='700' src='https://user-images.githubusercontent.com/41551030/108649258-48907600-74bd-11eb-9bba-8e82b56777d9.png'/>
</p>
### Tomorrow
<p>
<img width='700' src='https://user-images.githubusercontent.com/41551030/108649275-51814780-74bd-11eb-881b-1e137a0cbfe0.png'/>
<img width='700' src='https://user-images.githubusercontent.com/41551030/108649297-59d98280-74bd-11eb-92a5-a8c4af150106.png'/>
<img width='700' src='https://user-images.githubusercontent.com/41551030/108649317-5e9e3680-74bd-11eb-95a4-fc018cb4a528.png'/>
<img width='700' src='https://user-images.githubusercontent.com/41551030/108649321-6067fa00-74bd-11eb-83bb-b1de7f5e62d6.png'/>
</p>
### wombat
<p>
<img width='700' src='https://user-images.githubusercontent.com/41551030/108649337-65c54480-74bd-11eb-9ea1-fab2e679c56b.png'/>
<img width='700' src='https://user-images.githubusercontent.com/41551030/108649411-8db4a800-74bd-11eb-962a-8b73f9fb7124.png'/>
<img width='700' src='https://user-images.githubusercontent.com/41551030/108649349-6cec5280-74bd-11eb-9ada-8f1cb8b48ec1.png'/>
<img width='700' src='https://user-images.githubusercontent.com/41551030/108649358-6fe74300-74bd-11eb-9fe2-a955f964e3ce.png'/>
</p>

997
etc/soft/nvim/+plugins/lualine.nvim/doc/lualine.txt

@ -0,0 +1,997 @@ @@ -0,0 +1,997 @@
*lualine.txt* fast and easy to configure statusline plugin for neovim
==============================================================================
Table of Contents *lualine-table-of-contents*
1. lualine.nvim |lualine-lualine.nvim|
- Contributing |lualine-contributing|
- Performance compared to other plugins|lualine-performance-compared-to-other-plugins|
- Installation |lualine-installation|
- Usage and customization |lualine-usage-and-customization|
==============================================================================
1. lualine.nvim *lualine-lualine.nvim*
A blazing fast and easy to configure Neovim statusline written in Lua.
`lualine.nvim` requires Neovim >= 0.5.
CONTRIBUTING *lualine-contributing*
Feel free to create an issue/PR if you want to see anything else implemented.
If you have some question or need help with configuration, start a discussion
<https://github.com/nvim-lualine/lualine.nvim/discussions>.
Please read CONTRIBUTING.md <./CONTRIBUTING.md> before opening a PR. You can
also help with documentation in the wiki
<https://github.com/nvim-lualine/lualine.nvim/wiki>.
PERFORMANCE COMPARED TO OTHER PLUGINS*lualine-performance-compared-to-other-plugins*
Unlike other statusline plugins, lualine loads only the components you specify,
and nothing else.
Startup time performance measured with an amazing plugin
dstein64/vim-startuptime <https://github.com/dstein64/vim-startuptime>
Times are measured with a clean `init.vim` with only `vim-startuptime`,
`vim-plug` and given statusline plugin installed. In control just
`vim-startuptime` and`vim-plug` is installed. And measured time is complete
startuptime of vim not time spent on specific plugin. These numbers are the
average of 20 runs.
│control│lualine│lightline│airline│
│17.2 ms│24.8 ms│ 25.5 ms │79.9 ms│
Last Updated On: 18-04-2022
INSTALLATION *lualine-installation*
VIM-PLUG <HTTPS://GITHUB.COM/JUNEGUNN/VIM-PLUG> ~
>
Plug 'nvim-lualine/lualine.nvim'
" If you want to have icons in your statusline choose one of these
Plug 'kyazdani42/nvim-web-devicons'
<
PACKER.NVIM <HTTPS://GITHUB.COM/WBTHOMASON/PACKER.NVIM> ~
>
use {
'nvim-lualine/lualine.nvim',
requires = { 'kyazdani42/nvim-web-devicons', opt = true }
}
<
You’ll also need to have a patched font if you want icons.
USAGE AND CUSTOMIZATION *lualine-usage-and-customization*
Lualine has sections as shown below.
>
+-------------------------------------------------+
| A | B | C X | Y | Z |
+-------------------------------------------------+
<
Each sections holds its components e.g. Vim’s current mode.
CONFIGURING LUALINE IN INIT.VIM ~
All the examples below are in lua. You can use the same examples in `.vim`
files by wrapping them in lua heredoc like this:
>
lua << END
require('lualine').setup()
END
<
For more information, check out `:help lua-heredoc`.
*lualine-Default-configuration*
>
require('lualine').setup {
options = {
icons_enabled = true,
theme = 'auto',
component_separators = { left = '', right = ''},
section_separators = { left = '', right = ''},
disabled_filetypes = {
statusline = {},
winbar = {},
},
ignore_focus = {},
always_divide_middle = true,
globalstatus = false,
refresh = {
statusline = 1000,
tabline = 1000,
winbar = 1000,
}
},
sections = {
lualine_a = {'mode'},
lualine_b = {'branch', 'diff', 'diagnostics'},
lualine_c = {'filename'},
lualine_x = {'encoding', 'fileformat', 'filetype'},
lualine_y = {'progress'},
lualine_z = {'location'}
},
inactive_sections = {
lualine_a = {},
lualine_b = {},
lualine_c = {'filename'},
lualine_x = {'location'},
lualine_y = {},
lualine_z = {}
},
tabline = {},
winbar = {},
inactive_winbar = {},
extensions = {}
}
<
Default configuration If you want to get your current lualine
config, you can do so with:
>
require('lualine').get_config()
<
------------------------------------------------------------------------------
STARTING LUALINE ~
>
require('lualine').setup()
<
------------------------------------------------------------------------------
SETTING A THEME ~
>
options = { theme = 'gruvbox' }
<
All available themes are listed in THEMES.md <./THEMES.md>.
Please create a PR if you managed to port a popular theme before us, here is
how to do it <./CONTRIBUTING.md>.
*lualine-Customizing-themes*
>
local custom_gruvbox = require'lualine.themes.gruvbox'
-- Change the background of lualine_c section for normal mode
custom_gruvbox.normal.c.bg = '#112233'
require('lualine').setup {
options = { theme = custom_gruvbox },
...
}
<
Customizing themes Theme structure is available here
<https://github.com/nvim-lualine/lualine.nvim/wiki/Writing-a-theme>.
------------------------------------------------------------------------------
SEPARATORS ~
lualine defines two kinds of separators:
- `section_separators` - separators between sections
- `component_separators` - separators between the different components in sections
**Note**: if viewing this README in a browser, chances are the characters below
will not be visible.
>
options = {
section_separators = { left = '', right = '' },
component_separators = { left = '', right = '' }
}
<
Here, left refers to the left-most sections (a, b, c), and right refers to the
right-most sections (x, y, z).
*lualine-Disabling-separators*
>
options = { section_separators = '', component_separators = '' }
<
------------------------------------------------------------------------------
CHANGING COMPONENTS IN LUALINE SECTIONS ~
>
sections = {lualine_a = {'mode'}}
<
*lualine-Available-components*
- `branch` (git branch)
- `buffers` (shows currently available buffers)
- `diagnostics` (diagnostics count from your preferred source)
- `diff` (git diff status)
- `encoding` (file encoding)
- `fileformat` (file format)
- `filename`
- `filesize`
- `filetype`
- `hostname`
- `location` (location in file in line:column format)
- `mode` (vim mode)
- `progress` (%progress in file)
- `searchcount` (number of search matches when hlsearch is active)
- `tabs` (shows currently available tabs)
- `windows` (shows currently available windows)
*lualine-Custom-components*
LUA FUNCTIONS AS LUALINE COMPONENT
>
local function hello()
return [[hello world]]
end
sections = { lualine_a = { hello } }
<
VIM FUNCTIONS AS LUALINE COMPONENT
>
sections = { lualine_a = {'FugitiveHead'} }
<
VIM’S STATUSLINE ITEMS AS LUALINE COMPONENT
>
sections = { lualine_c = {'%=', '%t%m', '%3p'} }
<
VIM VARIABLES AS LUALINE COMPONENT
Variables from `g:`, `v:`, `t:`, `w:`, `b:`, `o:`, `to:`, `wo:`, `bo:` scopes
can be used.
See `:h lua-vim-variables` and `:h lua-vim-options` if you are not sure what to
use.
>
sections = { lualine_a = { 'g:coc_status', 'bo:filetype' } }
<
LUA EXPRESSIONS AS LUALINE COMPONENT
You can use any valid lua expression as a component including: - oneliners -
global variables - require statements
>
sections = { lualine_c = { "os.date('%a')", 'data', "require'lsp-status'.status()" } }
<
`data` is a global variable in this example.
------------------------------------------------------------------------------
COMPONENT OPTIONS ~
Component options can change the way a component behave. There are two kinds of
options:
- global options affecting all components
- local options affecting specific
Global options can be used as local options (can be applied to specific
components) but you cannot use local options as global. Global option used
locally overwrites the global, for example:
>
require('lualine').setup {
options = { fmt = string.lower },
sections = { lualine_a = {
{ 'mode', fmt = function(str) return str:sub(1,1) end } },
lualine_b = {'branch'} }
}
<
`mode` will be formatted with the passed function so only first char will be
shown. On the other hand branch will be formatted with global formatter
`string.lower` so it will be showed in lower case.
*lualine-Available-options*
*lualine-Global-options*
Global options These are `options` that are used in
options table. They set behavior of
lualine.
Values set here are treated as default for other options that work in component
level.
For example even though `icons_enabled` is a general component option. You can
set `icons_enabled` to `false` and icons will be disabled on all component. You
can still overwrite defaults set in option table by specifying the option value
in component.
>
options = {
theme = 'auto', -- lualine theme
component_separators = { left = '', right = '' },
section_separators = { left = '', right = '' },
disabled_filetypes = { -- Filetypes to disable lualine for.
statusline = {}, -- only ignores the ft for statusline.
winbar = {}, -- only ignores the ft for winbar.
},
ignore_focus = {}, -- If current filetype is in this list it'll
-- always be drawn as inactive statusline
-- and the last window will be drawn as active statusline.
-- for example if you don't want statusline of
-- your file tree / sidebar window to have active
-- statusline you can add their filetypes here.
always_divide_middle = true, -- When set to true, left sections i.e. 'a','b' and 'c'
-- can't take over the entire statusline even
-- if neither of 'x', 'y' or 'z' are present.
globalstatus = false, -- enable global statusline (have a single statusline
-- at bottom of neovim instead of one for every window).
-- This feature is only available in neovim 0.7 and higher.
refresh = { -- sets how often lualine should refreash it's contents (in ms)
statusline = 1000, -- The refresh option sets minimum time that lualine tries
tabline = 1000, -- to maintain between refresh. It's not guarantied if situation
winbar = 1000 -- arises that lualine needs to refresh itself before this time
-- it'll do it.
-- Also you can force lualine's refresh by calling refresh function
-- like require('lualine').refresh()
}
}
<
*lualine-General-component-options*
General component options These are options that control behavior
at component level and are available for
all components.
>
sections = {
lualine_a = {
{
'mode',
icons_enabled = true, -- Enables the display of icons alongside the component.
-- Defines the icon to be displayed in front of the component.
-- Can be string|table
-- As table it must contain the icon as first entry and can use
-- color option to custom color the icon. Example:
-- {'branch', icon = ''} / {'branch', icon = {'', color={fg='green'}}}
-- icon position can also be set to the right side from table. Example:
-- {'branch', icon = {'', align='right', color={fg='green'}}}
icon = nil,
separator = nil, -- Determines what separator to use for the component.
-- Note:
-- When a string is provided it's treated as component_separator.
-- When a table is provided it's treated as section_separator.
-- Passing an empty string disables the separator.
--
-- These options can be used to set colored separators
-- around a component.
--
-- The options need to be set as such:
-- separator = { left = '', right = ''}
--
-- Where left will be placed on left side of component,
-- and right will be placed on its right.
--
cond = nil, -- Condition function, the component is loaded when the function returns `true`.
-- Defines a custom color for the component:
--
-- 'highlight_group_name' | { fg = '#rrggbb'|cterm_value(0-255)|'color_name(red)', bg= '#rrggbb', gui='style' } | function
-- Note:
-- '|' is synonymous with 'or', meaning a different acceptable format for that placeholder.
-- color function has to return one of other color types ('highlight_group_name' | { fg = '#rrggbb'|cterm_value(0-255)|'color_name(red)', bg= '#rrggbb', gui='style' })
-- color functions can be used to have different colors based on state as shown below.
--
-- Examples:
-- color = { fg = '#ffaa88', bg = 'grey', gui='italic,bold' },
-- color = { fg = 204 } -- When fg/bg are omitted, they default to the your theme's fg/bg.
-- color = 'WarningMsg' -- Highlight groups can also be used.
-- color = function(section)
-- return { fg = vim.bo.modified and '#aa3355' or '#33aa88' }
-- end,
color = nil, -- The default is your theme's color for that section and mode.
-- Specify what type a component is, if omitted, lualine will guess it for you.
--
-- Available types are:
-- [format: type_name(example)], mod(branch/filename),
-- stl(%f/%m), var(g:coc_status/bo:modifiable),
-- lua_expr(lua expressions), vim_fun(viml function name)
--
-- Note:
-- lua_expr is short for lua-expression and vim_fun is short for vim-function.
type = nil,
padding = 1, -- Adds padding to the left and right of components.
-- Padding can be specified to left or right independently, e.g.:
-- padding = { left = left_padding, right = right_padding }
fmt = nil, -- Format function, formats the component's output.
on_click = nil, -- takes a function that is called when component is clicked with mouse.
-- the function receives several arguments
-- - number of clicks incase of multiple clicks
-- - mouse button used (l(left)/r(right)/m(middle)/...)
-- - modifiers pressed (s(shift)/c(ctrl)/a(alt)/m(meta)...)
}
}
}
<
*lualine-Component-specific-options*
Component specific options These are options that are available on
specific components. For example you
have option on `diagnostics` component
to specify what your diagnostic sources
will be.
*lualine-buffers-component-options*
>
sections = {
lualine_a = {
{
'buffers',
show_filename_only = true, -- Shows shortened relative path when set to false.
hide_filename_extension = false, -- Hide filename extension when set to true.
show_modified_status = true, -- Shows indicator when the buffer is modified.
mode = 0, -- 0: Shows buffer name
-- 1: Shows buffer index
-- 2: Shows buffer name + buffer index
-- 3: Shows buffer number
-- 4: Shows buffer name + buffer number
max_length = vim.o.columns * 2 / 3, -- Maximum width of buffers component,
-- it can also be a function that returns
-- the value of `max_length` dynamically.
filetype_names = {
TelescopePrompt = 'Telescope',
dashboard = 'Dashboard',
packer = 'Packer',
fzf = 'FZF',
alpha = 'Alpha'
}, -- Shows specific buffer name for that filetype ( { `filetype` = `buffer_name`, ... } )
buffers_color = {
-- Same values as the general color option can be used here.
active = 'lualine_{section}_normal', -- Color for active buffer.
inactive = 'lualine_{section}_inactive', -- Color for inactive buffer.
},
symbols = {
modified = ' ●', -- Text to show when the buffer is modified
alternate_file = '#', -- Text to show to identify the alternate file
directory = '', -- Text to show when the buffer is a directory
},
}
}
}
<
*lualine-diagnostics-component-options*
>
sections = {
lualine_a = {
{
'diagnostics',
-- Table of diagnostic sources, available sources are:
-- 'nvim_lsp', 'nvim_diagnostic', 'nvim_workspace_diagnostic', 'coc', 'ale', 'vim_lsp'.
-- or a function that returns a table as such:
-- { error=error_cnt, warn=warn_cnt, info=info_cnt, hint=hint_cnt }
sources = { 'nvim_diagnostic', 'coc' },
-- Displays diagnostics for the defined severity types
sections = { 'error', 'warn', 'info', 'hint' },
diagnostics_color = {
-- Same values as the general color option can be used here.
error = 'DiagnosticError', -- Changes diagnostics' error color.
warn = 'DiagnosticWarn', -- Changes diagnostics' warn color.
info = 'DiagnosticInfo', -- Changes diagnostics' info color.
hint = 'DiagnosticHint', -- Changes diagnostics' hint color.
},
symbols = {error = 'E', warn = 'W', info = 'I', hint = 'H'},
colored = true, -- Displays diagnostics status in color if set to true.
update_in_insert = false, -- Update diagnostics in insert mode.
always_visible = false, -- Show diagnostics even if there are none.
}
}
}
<
*lualine-diff-component-options*
>
sections = {
lualine_a = {
{
'diff',
colored = true, -- Displays a colored diff status if set to true
diff_color = {
-- Same color values as the general color option can be used here.
added = 'DiffAdd', -- Changes the diff's added color
modified = 'DiffChange', -- Changes the diff's modified color
removed = 'DiffDelete', -- Changes the diff's removed color you
},
symbols = {added = '+', modified = '~', removed = '-'}, -- Changes the symbols used by the diff.
source = nil, -- A function that works as a data source for diff.
-- It must return a table as such:
-- { added = add_count, modified = modified_count, removed = removed_count }
-- or nil on failure. count <= 0 won't be displayed.
}
}
}
<
*lualine-fileformat-component-options*
>
sections = {
lualine_a = {
{
'fileformat',
symbols = {
unix = '', -- e712
dos = '', -- e70f
mac = '', -- e711
}
}
}
}
<
*lualine-filename-component-options*
>
sections = {
lualine_a = {
{
'filename',
file_status = true, -- Displays file status (readonly status, modified status)
newfile_status = false -- Display new file status (new file means no write after created)
path = 0, -- 0: Just the filename
-- 1: Relative path
-- 2: Absolute path
-- 3: Absolute path, with tilde as the home directory
shorting_target = 40, -- Shortens path to leave 40 spaces in the window
-- for other components. (terrible name, any suggestions?)
symbols = {
modified = '[+]', -- Text to show when the file is modified.
readonly = '[-]', -- Text to show when the file is non-modifiable or readonly.
unnamed = '[No Name]', -- Text to show for unnamed buffers.
newfile = '[New]', -- Text to show for new created file before first writting
}
}
}
}
<
*lualine-filetype-component-options*
>
sections = {
lualine_a = {
{
'filetype',
colored = true, -- Displays filetype icon in color if set to true
icon_only = false, -- Display only an icon for filetype
icon = { align = 'right' }, -- Display filetype icon on the right hand side
-- icon = {'X', align='right'}
-- Icon string ^ in table is ignored in filetype component
}
}
}
<
*lualine-tabs-component-options*
>
sections = {
lualine_a = {
{
'tabs',
max_length = vim.o.columns / 3, -- Maximum width of tabs component.
-- Note:
-- It can also be a function that returns
-- the value of `max_length` dynamically.
mode = 0, -- 0: Shows tab_nr
-- 1: Shows tab_name
-- 2: Shows tab_nr + tab_name
tabs_color = {
-- Same values as the general color option can be used here.
active = 'lualine_{section}_normal', -- Color for active tab.
inactive = 'lualine_{section}_inactive', -- Color for inactive tab.
},
}
}
}
<
*lualine-windows-component-options*
>
sections = {
lualine_a = {
{
'windows',
show_filename_only = true, -- Shows shortened relative path when set to false.
show_modified_status = true, -- Shows indicator when the window is modified.
mode = 0, -- 0: Shows window name
-- 1: Shows window index
-- 2: Shows window name + window index
max_length = vim.o.columns * 2 / 3, -- Maximum width of windows component,
-- it can also be a function that returns
-- the value of `max_length` dynamically.
filetype_names = {
TelescopePrompt = 'Telescope',
dashboard = 'Dashboard',
packer = 'Packer',
fzf = 'FZF',
alpha = 'Alpha'
}, -- Shows specific window name for that filetype ( { `filetype` = `window_name`, ... } )
disabled_buftypes = { 'quickfix', 'prompt' }, -- Hide a window if its buffer's type is disabled
windows_color = {
-- Same values as the general color option can be used here.
active = 'lualine_{section}_normal', -- Color for active window.
inactive = 'lualine_{section}_inactive', -- Color for inactive window.
},
}
}
}
<
------------------------------------------------------------------------------
TABLINE ~
You can use lualine to display components in tabline. The configuration for
tabline sections is exactly the same as that of the statusline.
>
tabline = {
lualine_a = {},
lualine_b = {'branch'},
lualine_c = {'filename'},
lualine_x = {},
lualine_y = {},
lualine_z = {}
}
<
This will show the branch and filename components on top of neovim inside
tabline.
lualine also provides 2 components, buffers and tabs, that you can use to get a
more traditional tabline/bufferline.
>
tabline = {
lualine_a = {'buffers'},
lualine_b = {'branch'},
lualine_c = {'filename'},
lualine_x = {},
lualine_y = {},
lualine_z = {'tabs'}
}
<
WINBAR ~
From neovim-0.8 you can customize your winbar with lualine. Winbar
configuration is similar to statusline.
>
winbar = {
lualine_a = {},
lualine_b = {},
lualine_c = {'filename'},
lualine_x = {},
lualine_y = {},
lualine_z = {}
}
inactive_winbar = {
lualine_a = {},
lualine_b = {},
lualine_c = {'filename'},
lualine_x = {},
lualine_y = {},
lualine_z = {}
}
<
Just like statusline you can separately specify winbar for active and inactive
windows. Any lualine component can be placed in winbar. All kinds of custom
components supported in statusline are also suported for winbar too. In general
You can treat winbar as another lualine statusline that just appears on top of
windows instead of at bottom.
*lualine-Buffers*
Buffers Shows currently open buffers. Like
bufferline. See
|lualine-buffers-options| for all
builtin behaviors of buffers component.
You can use `:LualineBuffersJump` to
jump to buffer based on index of buffer
in buffers component. Jumping to
non-existent buffer indices generates an
error. To avoid these errors
`LualineBuffersJump` provides `<bang>`
support, meaning that you can call
`:LualineBufferJump!` to ignore these
errors.
>
:LualineBuffersJump 2 " Jumps to 2nd buffer in buffers component.
:LualineBuffersJump $ " Jumps to last buffer in buffers component.
:LualineBuffersJump! 3 " Attempts to jump to 3rd buffer, if it exists.
<
*lualine-Tabs*
Tabs Shows currently open tab. Like usual
tabline. See |lualine-tabs-options| for
all builtin behaviors of tabs component.
You can also use `:LualineRenameTab` to
set a name for a tabpage. For example:
>
:LualineRenameTab Project_K
<
It’s useful when you’re using rendering mode 2/3 in tabs. To unname a
tabpage run `:LualineRenameTab` without argument.
*lualine-Tabline-as-statusline*
Tabline as statusline You can also completely move your
statusline to a tabline by configuring
`lualine.tabline` and disabling
`lualine.sections` and
`lualine.inactive_sections`:
>
tabline = {
......
},
sections = {},
inactive_sections = {},
<
If you want a more sophisticated tabline you can use other tabline plugins with
lualine too, for example:
- nvim-bufferline <https://github.com/akinsho/nvim-bufferline.lua>
- tabline.nvim <https://github.com/kdheepak/tabline.nvim>
tabline.nvim even uses lualine’s theme by default 🙌 You can find a bigger
list here <https://github.com/rockerBOO/awesome-neovim#tabline>.
------------------------------------------------------------------------------
EXTENSIONS ~
lualine extensions change statusline appearance for a window/buffer with
specified filetypes.
By default no extensions are loaded to improve performance. You can load
extensions with:
>
extensions = {'quickfix'}
<
*lualine-Available-extensions*
- aerial
- chadtree
- fern
- fugitive
- fzf
- man
- mundo
- neo-tree
- nerdtree
- nvim-dap-ui
- nvim-tree
- quickfix
- symbols-outline
- toggleterm
*lualine-Custom-extensions*
Custom extensions You can define your own extensions. If
you believe an extension may be useful
to others, then please submit a PR.
>
local my_extension = { sections = { lualine_a = {'mode'} }, filetypes = {'lua'} }
require('lualine').setup { extensions = { my_extension } }
<
------------------------------------------------------------------------------
REFRESHING LUALINE ~
By default lualine refreshes itself based on timer and some events. You can set
the interval of the timer with refresh option. However you can also force
lualine to refresh at any time by calling lualine.refresh function.
>
require('lualine').refresh({
scope = 'tabpage', -- scope of refresh all/tabpage/window
place = { 'statusline', 'winbar', 'tabline' }, -- lualine segment ro refresh.
})
<
The arguments shown here are default values. So not passing any of them will be
treated as if a default value was passed.
So you can simply do
>
require('lualine').refresh()
<
Avoid calling lualine.refresh inside components. Since components are evaluated
during refresh, calling refresh while refreshing can have undesirable effects.
DISABLING LUALINE ~
You can disable lualine for specific filetypes:
>
options = { disabled_filetypes = {'lua'} }
<
You can also disable lualine completely. Note that you need to call this after
the setup
>
require('lualine').hide({
place = {'statusline', 'tabline', 'winbar'}, -- The segment this change applies to.
unhide = false, -- whether to reenable lualine again/
})
<
The arguments show for hide above are default values. Which means even if the
hide function is called without arguments it’ll work as if these were passed.
So in short to disable lualine completely you can do
>
require('lualine').hide()
<
To enable it again you can do
>
require('lualine').hide({unhide=true})
<
WIKI ~
Check out the wiki <https://github.com/nvim-lualine/lualine.nvim/wiki> for more
info.
You can find some useful configuration snippets
<https://github.com/nvim-lualine/lualine.nvim/wiki/Component-snippets> here.
You can also share your awesome snippets with others.
If you want to extend lualine with plugins or want to know which ones already
do, wiki/plugins <https://github.com/nvim-lualine/lualine.nvim/wiki/Plugins> is
for you.
SUPPORT ~
If you appreciate my work you can buy me a coffee.
<a href="https://www.buymeacoffee.com/shadmansalJ" target="_blank"><img
src="https://cdn.buymeacoffee.com/buttons/default-black.png" alt="Buy Me A
Coffee" style="height: 41px !important;width: 174px !important;box-shadow: 0px
3px 2px 0px rgba(190, 190, 190, 0.5) !important;-webkit-box-shadow: 0px 3px 2px
0px rgba(190, 190, 190, 0.5) !important;"></a>
Generated by panvimdoc <https://github.com/kdheepak/panvimdoc>
vim:tw=78:ts=8:noet:ft=help:norl:

62
etc/soft/nvim/+plugins/lualine.nvim/examples/bubbles.lua

@ -0,0 +1,62 @@ @@ -0,0 +1,62 @@
-- Bubbles config for lualine
-- Author: lokesh-krishna
-- MIT license, see LICENSE for more details.
-- stylua: ignore
local colors = {
blue = '#80a0ff',
cyan = '#79dac8',
black = '#080808',
white = '#c6c6c6',
red = '#ff5189',
violet = '#d183e8',
grey = '#303030',
}
local bubbles_theme = {
normal = {
a = { fg = colors.black, bg = colors.violet },
b = { fg = colors.white, bg = colors.grey },
c = { fg = colors.black, bg = colors.black },
},
insert = { a = { fg = colors.black, bg = colors.blue } },
visual = { a = { fg = colors.black, bg = colors.cyan } },
replace = { a = { fg = colors.black, bg = colors.red } },
inactive = {
a = { fg = colors.white, bg = colors.black },
b = { fg = colors.white, bg = colors.black },
c = { fg = colors.black, bg = colors.black },
},
}
require('lualine').setup {
options = {
theme = bubbles_theme,
component_separators = '|',
section_separators = { left = '', right = '' },
},
sections = {
lualine_a = {
{ 'mode', separator = { left = '' }, right_padding = 2 },
},
lualine_b = { 'filename', 'branch' },
lualine_c = { 'fileformat' },
lualine_x = {},
lualine_y = { 'filetype', 'progress' },
lualine_z = {
{ 'location', separator = { right = '' }, left_padding = 2 },
},
},
inactive_sections = {
lualine_a = { 'filename' },
lualine_b = {},
lualine_c = {},
lualine_x = {},
lualine_y = {},
lualine_z = { 'location' },
},
tabline = {},
extensions = {},
}

221
etc/soft/nvim/+plugins/lualine.nvim/examples/evil_lualine.lua

@ -0,0 +1,221 @@ @@ -0,0 +1,221 @@
-- Eviline config for lualine
-- Author: shadmansaleh
-- Credit: glepnir
local lualine = require('lualine')
-- Color table for highlights
-- stylua: ignore
local colors = {
bg = '#202328',
fg = '#bbc2cf',
yellow = '#ECBE7B',
cyan = '#008080',
darkblue = '#081633',
green = '#98be65',
orange = '#FF8800',
violet = '#a9a1e1',
magenta = '#c678dd',
blue = '#51afef',
red = '#ec5f67',
}
local conditions = {
buffer_not_empty = function()
return vim.fn.empty(vim.fn.expand('%:t')) ~= 1
end,
hide_in_width = function()
return vim.fn.winwidth(0) > 80
end,
check_git_workspace = function()
local filepath = vim.fn.expand('%:p:h')
local gitdir = vim.fn.finddir('.git', filepath .. ';')
return gitdir and #gitdir > 0 and #gitdir < #filepath
end,
}
-- Config
local config = {
options = {
-- Disable sections and component separators
component_separators = '',
section_separators = '',
theme = {
-- We are going to use lualine_c an lualine_x as left and
-- right section. Both are highlighted by c theme . So we
-- are just setting default looks o statusline
normal = { c = { fg = colors.fg, bg = colors.bg } },
inactive = { c = { fg = colors.fg, bg = colors.bg } },
},
},
sections = {
-- these are to remove the defaults
lualine_a = {},
lualine_b = {},
lualine_y = {},
lualine_z = {},
-- These will be filled later
lualine_c = {},
lualine_x = {},
},
inactive_sections = {
-- these are to remove the defaults
lualine_a = {},
lualine_b = {},
lualine_y = {},
lualine_z = {},
lualine_c = {},
lualine_x = {},
},
}
-- Inserts a component in lualine_c at left section
local function ins_left(component)
table.insert(config.sections.lualine_c, component)
end
-- Inserts a component in lualine_x ot right section
local function ins_right(component)
table.insert(config.sections.lualine_x, component)
end
ins_left {
function()
return ''
end,
color = { fg = colors.blue }, -- Sets highlighting of component
padding = { left = 0, right = 1 }, -- We don't need space before this
}
ins_left {
-- mode component
function()
return ''
end,
color = function()
-- auto change color according to neovims mode
local mode_color = {
n = colors.red,
i = colors.green,
v = colors.blue,
[''] = colors.blue,
V = colors.blue,
c = colors.magenta,
no = colors.red,
s = colors.orange,
S = colors.orange,
[''] = colors.orange,
ic = colors.yellow,
R = colors.violet,
Rv = colors.violet,
cv = colors.red,
ce = colors.red,
r = colors.cyan,
rm = colors.cyan,
['r?'] = colors.cyan,
['!'] = colors.red,
t = colors.red,
}
return { fg = mode_color[vim.fn.mode()] }
end,
padding = { right = 1 },
}
ins_left {
-- filesize component
'filesize',
cond = conditions.buffer_not_empty,
}
ins_left {
'filename',
cond = conditions.buffer_not_empty,
color = { fg = colors.magenta, gui = 'bold' },
}
ins_left { 'location' }
ins_left { 'progress', color = { fg = colors.fg, gui = 'bold' } }
ins_left {
'diagnostics',
sources = { 'nvim_diagnostic' },
symbols = { error = ' ', warn = ' ', info = ' ' },
diagnostics_color = {
color_error = { fg = colors.red },
color_warn = { fg = colors.yellow },
color_info = { fg = colors.cyan },
},
}
-- Insert mid section. You can make any number of sections in neovim :)
-- for lualine it's any number greater then 2
ins_left {
function()
return '%='
end,
}
ins_left {
-- Lsp server name .
function()
local msg = 'No Active Lsp'
local buf_ft = vim.api.nvim_buf_get_option(0, 'filetype')
local clients = vim.lsp.get_active_clients()
if next(clients) == nil then
return msg
end
for _, client in ipairs(clients) do
local filetypes = client.config.filetypes
if filetypes and vim.fn.index(filetypes, buf_ft) ~= -1 then
return client.name
end
end
return msg
end,
icon = ' LSP:',
color = { fg = '#ffffff', gui = 'bold' },
}
-- Add components to right sections
ins_right {
'o:encoding', -- option component same as &encoding in viml
fmt = string.upper, -- I'm not sure why it's upper case either ;)
cond = conditions.hide_in_width,
color = { fg = colors.green, gui = 'bold' },
}
ins_right {
'fileformat',
fmt = string.upper,
icons_enabled = false, -- I think icons are cool but Eviline doesn't have them. sigh
color = { fg = colors.green, gui = 'bold' },
}
ins_right {
'branch',
icon = '',
color = { fg = colors.violet, gui = 'bold' },
}
ins_right {
'diff',
-- Is it me or the symbol for modified us really weird
symbols = { added = ' ', modified = '', removed = ' ' },
diff_color = {
added = { fg = colors.green },
modified = { fg = colors.orange },
removed = { fg = colors.red },
},
cond = conditions.hide_in_width,
}
ins_right {
function()
return ''
end,
color = { fg = colors.blue },
padding = { left = 1 },
}
-- Now don't forget to initialize lualine
lualine.setup(config)

124
etc/soft/nvim/+plugins/lualine.nvim/examples/slanted-gaps.lua

@ -0,0 +1,124 @@ @@ -0,0 +1,124 @@
local colors = {
red = '#ca1243',
grey = '#a0a1a7',
black = '#383a42',
white = '#f3f3f3',
light_green = '#83a598',
orange = '#fe8019',
green = '#8ec07c',
}
local theme = {
normal = {
a = { fg = colors.white, bg = colors.black },
b = { fg = colors.white, bg = colors.grey },
c = { fg = colors.black, bg = colors.white },
z = { fg = colors.white, bg = colors.black },
},
insert = { a = { fg = colors.black, bg = colors.light_green } },
visual = { a = { fg = colors.black, bg = colors.orange } },
replace = { a = { fg = colors.black, bg = colors.green } },
}
local empty = require('lualine.component'):extend()
function empty:draw(default_highlight)
self.status = ''
self.applied_separator = ''
self:apply_highlights(default_highlight)
self:apply_section_separators()
return self.status
end
-- Put proper separators and gaps between components in sections
local function process_sections(sections)
for name, section in pairs(sections) do
local left = name:sub(9, 10) < 'x'
for pos = 1, name ~= 'lualine_z' and #section or #section - 1 do
table.insert(section, pos * 2, { empty, color = { fg = colors.white, bg = colors.white } })
end
for id, comp in ipairs(section) do
if type(comp) ~= 'table' then
comp = { comp }
section[id] = comp
end
comp.separator = left and { right = '' } or { left = '' }
end
end
return sections
end
local function search_result()
if vim.v.hlsearch == 0 then
return ''
end
local last_search = vim.fn.getreg('/')
if not last_search or last_search == '' then
return ''
end
local searchcount = vim.fn.searchcount { maxcount = 9999 }
return last_search .. '(' .. searchcount.current .. '/' .. searchcount.total .. ')'
end
local function modified()
if vim.bo.modified then
return '+'
elseif vim.bo.modifiable == false or vim.bo.readonly == true then
return '-'
end
return ''
end
require('lualine').setup {
options = {
theme = theme,
component_separators = '',
section_separators = { left = '', right = '' },
},
sections = process_sections {
lualine_a = { 'mode' },
lualine_b = {
'branch',
'diff',
{
'diagnostics',
source = { 'nvim' },
sections = { 'error' },
diagnostics_color = { error = { bg = colors.red, fg = colors.white } },
},
{
'diagnostics',
source = { 'nvim' },
sections = { 'warn' },
diagnostics_color = { warn = { bg = colors.orange, fg = colors.white } },
},
{ 'filename', file_status = false, path = 1 },
{ modified, color = { bg = colors.red } },
{
'%w',
cond = function()
return vim.wo.previewwindow
end,
},
{
'%r',
cond = function()
return vim.bo.readonly
end,
},
{
'%q',
cond = function()
return vim.bo.buftype == 'quickfix'
end,
},
},
lualine_c = {},
lualine_x = {},
lualine_y = { search_result, 'filetype' },
lualine_z = { '%l:%c', '%p%%/%L' },
},
inactive_sections = {
lualine_c = { '%f %y %m' },
lualine_x = {},
},
}

629
etc/soft/nvim/+plugins/lualine.nvim/lua/lualine.lua

@ -0,0 +1,629 @@ @@ -0,0 +1,629 @@
-- Copyright (c) 2020-2021 hoob3rt
-- MIT license, see LICENSE for more details.
local M = {}
local lualine_require = require('lualine_require')
local modules = lualine_require.lazy_require {
highlight = 'lualine.highlight',
loader = 'lualine.utils.loader',
utils_section = 'lualine.utils.section',
utils = 'lualine.utils.utils',
utils_notices = 'lualine.utils.notices',
config_module = 'lualine.config',
nvim_opts = 'lualine.utils.nvim_opts',
}
local config -- Stores currently applied config
local timers = {
stl_timer = vim.loop.new_timer(),
tal_timer = vim.loop.new_timer(),
wb_timer = vim.loop.new_timer(),
halt_stl_refresh = false, -- mutex ?
halt_tal_refresh = false,
halt_wb_refresh = false,
}
local last_focus = {}
local refresh_real_curwin
-- The events on which lualine redraws itself
local default_refresh_events =
'WinEnter,BufEnter,SessionLoadPost,FileChangedShellPost,VimResized,Filetype,CursorMoved,CursorMovedI'
if vim.fn.has('nvim-0.7') == 1 then -- utilize ModeChanged event introduced in 0.7
default_refresh_events = default_refresh_events .. ',ModeChanged'
end
-- Helper for apply_transitional_separators()
--- finds first applied highlight group after str_checked in status
---@param status string : unprocessed statusline string
---@param str_checked number : position of how far status has been checked
---@return string|nil the hl group name or nil
local function find_next_hl(status, str_checked)
-- Gets the next valid hl group from str_checked
local hl_pos_start, hl_pos_end = status:find('%%#.-#', str_checked)
while true do
if not hl_pos_start then
return nil
end
-- When there are more that one hl group next to one another like
-- %#HL1#%#HL2#%#HL3# we need to return HL3. This makes that happen.
local next_start, next_end = status:find('^%%#.-#', hl_pos_end + 1)
if next_start == nil then
break
end
hl_pos_start, hl_pos_end = next_start, next_end
end
return status:sub(hl_pos_start + 2, hl_pos_end - 1)
end
-- Helper for apply_transitional_separators()
--- applies transitional separator highlight + transitional separator
---@param status string : unprocessed statusline string
---@param str_checked number : position of how far status has been checked
---@param last_hl string : last applied hl group name before str_checked
---@param reverse boolean : reverse the hl group ( true for right separators )
---@return string|nil concatenate separator highlight and transitional separator
local function fill_section_separator(status, is_focused, str_checked, last_hl, sep, reverse)
-- Inserts transitional separator along with transitional highlight
local next_hl = find_next_hl(status, str_checked)
if last_hl == nil then
last_hl = modules.highlight.get_stl_default_hl(is_focused)
end
if next_hl == nil then
next_hl = modules.highlight.get_stl_default_hl(is_focused)
end
if #next_hl == 0 or #last_hl == 0 then
return
end
local transitional_highlight = reverse -- lua ternary assignment x ? y : z
and modules.highlight.get_transitional_highlights(last_hl, next_hl)
or modules.highlight.get_transitional_highlights(next_hl, last_hl)
if transitional_highlight then
return transitional_highlight .. sep
end
end
--- processes statusline string
--- replaces %s/S{sep} with proper left/right separator highlight + sep
---@param status string : unprocessed statusline string
---@return string : processed statusline string
local function apply_transitional_separators(status, is_focused)
local status_applied = {} -- Collects all the pieces for concatenation
local last_hl -- Stores last highlight group that we found
local last_hl_reseted = false -- Whether last_hl is nil after reset
-- it after %=
local copied_pos = 1 -- Tracks how much we've copied over to status_applied
local str_checked = 1 -- Tracks where the searcher head is at
-- Process entire status replace the %s{sep} & %S{sep} placeholders
-- with proper transitional separator.
while str_checked ~= nil do
str_checked = status:find('%%', str_checked)
if str_checked == nil then
break
end
table.insert(status_applied, status:sub(copied_pos, str_checked - 1))
-- -1 so we don't copy '%'
copied_pos = str_checked
local next_char = modules.utils.charAt(status, str_checked + 1)
if next_char == '#' then
-- %#hl_name# highlights
last_hl = status:match('^%%#(.-)#', str_checked)
str_checked = str_checked + #last_hl + 3
elseif next_char == 's' then
-- %s{sep} is marker for left separator and
local sep = status:match('^%%s{(.-)}', str_checked)
str_checked = str_checked + #sep + 4 -- 4 = len(%{})
if not (last_hl == nil and last_hl_reseted) then
local trans_sep = fill_section_separator(status, is_focused, str_checked, last_hl, sep, false)
if trans_sep then
table.insert(status_applied, trans_sep)
end
end
if last_hl_reseted then
last_hl_reseted = false
end
copied_pos = str_checked
elseif next_char == 'S' then
-- %S{sep} is marker for right separator and
local sep = status:match('^%%S{(.-)}', str_checked)
str_checked = str_checked + #sep + 4 -- 4 = len(%{})
if status:find('^%%s', str_checked) or status:find('^%%<%%s', str_checked) then
-- When transitional right_sep and left_sep are right next to each other
-- and in this exact order skip the left sep as we can't draw both.
str_checked = status:find('}', str_checked) + 1
end
local trans_sep = fill_section_separator(status, is_focused, str_checked, last_hl, sep, true)
if trans_sep then
table.insert(status_applied, trans_sep)
end
copied_pos = str_checked
elseif next_char == '%' then
str_checked = str_checked + 2 -- Skip the following % too
elseif next_char == '=' and last_hl and (last_hl:find('^lualine_a') or last_hl:find('^lualine_b')) then
-- TODO: Fix this properly
-- This check for lualine_a and lualine_b is dumb. It doesn't guarantee
-- c or x section isn't present. Worst case scenario after this patch
-- we have another visual bug that occurs less frequently.
-- Annoying Edge Cases
last_hl = nil
last_hl_reseted = true
str_checked = str_checked + 1 -- Skip the following % too
else
str_checked = str_checked + 1 -- Push it forward to avoid inf loop
end
end
table.insert(status_applied, status:sub(copied_pos)) -- Final chunk
return table.concat(status_applied)
end
--- creates the statusline string
---@param sections table : section config where components are replaced with
--- component objects
---@param is_focused boolean : whether being evaluated for focused window or not
---@return string statusline string
local statusline = modules.utils.retry_call_wrap(function(sections, is_focused, is_winbar)
-- The sequence sections should maintain [SECTION_SEQUENCE]
local section_sequence = { 'a', 'b', 'c', 'x', 'y', 'z' }
local status = {}
local applied_midsection_divider = false
local applied_trunc = false
for _, section_name in ipairs(section_sequence) do
if sections['lualine_' .. section_name] then
-- insert highlight+components of this section to status_builder
local section_data =
modules.utils_section.draw_section(sections['lualine_' .. section_name], section_name, is_focused)
if #section_data > 0 then
if not applied_midsection_divider and section_name > 'c' then
applied_midsection_divider = true
section_data = modules.highlight.format_highlight('c', is_focused) .. '%=' .. section_data
end
if not applied_trunc and section_name > 'b' then
applied_trunc = true
section_data = '%<' .. section_data
end
table.insert(status, section_data)
end
end
end
if applied_midsection_divider == false and config.options.always_divide_middle ~= false and not is_winbar then
-- When non of section x,y,z is present
table.insert(status, modules.highlight.format_highlight('c', is_focused) .. '%=')
end
return apply_transitional_separators(table.concat(status), is_focused)
end)
--- check if any extension matches the filetype and return proper sections
---@param current_ft string : filetype name of current file
---@param is_focused boolean : whether being evaluated for focused window or not
---@return table|nil : (section_table) section config where components are replaced with
--- component objects
-- TODO: change this so it uses a hash table instead of iteration over list
-- to improve redraws. Add buftype / bufname for extensions
-- or some kind of cond ?
local function get_extension_sections(current_ft, is_focused, sec_name)
for _, extension in ipairs(config.extensions) do
if vim.tbl_contains(extension.filetypes, current_ft) then
if is_focused then
return extension[sec_name]
else
return extension['inactive_' .. sec_name] or extension[sec_name]
end
end
end
return nil
end
---@return string statusline string for tabline
local function tabline()
return statusline(config.tabline, 3)
end
local function notify_theme_error(theme_name)
local message_template = theme_name ~= 'auto'
and [[
### options.theme
Theme `%s` not found, falling back to `auto`. Check if spelling is right.
]]
or [[
### options.theme
Theme `%s` failed, falling back to `gruvbox`.
This shouldn't happen.
Please report the issue at https://github.com/nvim-lualine/lualine.nvim/issues .
Also provide what colorscheme you're using.
]]
modules.utils_notices.add_notice(string.format(message_template, theme_name))
end
--- Sets up theme by defining hl groups and setting theme cache in 'highlight.lua'.
--- Uses 'options.theme' variable to apply the theme:
--- - If the value is a string, it'll load a theme of that name.
--- - If it's a table, it's directly used as the theme.
--- If loading the theme fails, this falls back to 'auto' theme.
--- If the 'auto' theme also fails, this falls back to 'gruvbox' theme.
--- Also sets up auto command to reload lualine on ColorScheme or background changes.
local function setup_theme()
local function get_theme_from_config()
local theme_name = config.options.theme
if type(theme_name) == 'string' then
local ok, theme = pcall(modules.loader.load_theme, theme_name)
if ok and theme then
return theme
end
elseif type(theme_name) == 'table' then
-- use the provided theme as-is
return config.options.theme
end
if theme_name ~= 'auto' then
notify_theme_error(theme_name)
local ok, theme = pcall(modules.loader.load_theme, 'auto')
if ok and theme then
return theme
end
end
notify_theme_error('auto')
return modules.loader.load_theme('gruvbox')
end
local theme = get_theme_from_config()
modules.highlight.create_highlight_groups(theme)
vim.cmd([[autocmd lualine ColorScheme * lua require'lualine'.setup()
autocmd lualine OptionSet background lua require'lualine'.setup()]])
end
---@alias StatusDispatchSecs
---| 'sections'
---| 'winbar'
--- generates lualine.statusline & lualine.winbar function
--- creates a closer that can draw sections of sec_name.
---@param sec_name StatusDispatchSecs
---@return function(focused:bool):string
local function status_dispatch(sec_name)
return function(focused)
local retval
local current_ft = refresh_real_curwin
and vim.api.nvim_buf_get_option(vim.api.nvim_win_get_buf(refresh_real_curwin), 'filetype')
or vim.bo.filetype
local is_focused = focused ~= nil and focused or modules.utils.is_focused()
if
vim.tbl_contains(
config.options.disabled_filetypes[(sec_name == 'sections' and 'statusline' or sec_name)],
current_ft
)
then
-- disable on specific filetypes
return nil
end
local extension_sections = get_extension_sections(current_ft, is_focused, sec_name)
if extension_sections ~= nil then
retval = statusline(extension_sections, is_focused, sec_name == 'winbar')
else
retval = statusline(config[(is_focused and '' or 'inactive_') .. sec_name], is_focused, sec_name == 'winbar')
end
return retval
end
end
---@alias LualineRefreshOptsKind
---| 'all'
---| 'tabpage'
---| 'window'
---@alias LualineRefreshOptsPlace
---| 'statusline'
---| 'tabline'
---| 'winbar'
---@class LualineRefreshOpts
---@field scope LualineRefreshOptsKind
---@field place LualineRefreshOptsPlace[]
---@field trigger 'autocmd'|'autocmd_redired'|'timer'|'unknown'
--- Refresh contents of lualine
---@param opts LualineRefreshOpts
local function refresh(opts)
if opts == nil then
opts = {}
end
opts = vim.tbl_extend('keep', opts, {
scope = 'tabpage',
place = { 'statusline', 'winbar', 'tabline' },
trigger = 'unknown',
})
-- updating statusline in autocommands context seems to trigger 100 different bugs
-- lets just defer it to a timer context and update there
-- Since updating stl in command mode doesn't take effect
-- refresh ModeChanged command in autocmd context as exception.
-- workaround for
-- https://github.com/neovim/neovim/issues/15300
-- https://github.com/neovim/neovim/issues/19464
-- https://github.com/nvim-lualine/lualine.nvim/issues/753
-- https://github.com/nvim-lualine/lualine.nvim/issues/751
-- https://github.com/nvim-lualine/lualine.nvim/issues/755
-- https://github.com/neovim/neovim/issues/19472
-- https://github.com/nvim-lualine/lualine.nvim/issues/791
if opts.trigger == 'autocmd' and vim.v.event.new_mode ~= 'c' then
opts.trigger = 'autocmd_redired'
vim.schedule(function()
M.refresh(opts)
end)
return
end
local wins = {}
local old_actual_curwin = vim.g.actual_curwin
-- ignore focus on filetypes listes in options.ignore_focus
local curwin = vim.api.nvim_get_current_win()
local curtab = vim.api.nvim_get_current_tabpage()
if last_focus[curtab] == nil or not vim.api.nvim_win_is_valid(last_focus[curtab]) then
if
not vim.tbl_contains(
config.options.ignore_focus,
vim.api.nvim_buf_get_option(vim.api.nvim_win_get_buf(curwin), 'filetype')
)
then
last_focus[curtab] = curwin
else
local tab_wins = vim.api.nvim_tabpage_list_wins(curtab)
if #tab_wins == 1 then
last_focus[curtab] = curwin
else
local focusable_win = curwin
for _, win in ipairs(tab_wins) do
if
not vim.tbl_contains(
config.options.ignore_focus,
vim.api.nvim_buf_get_option(vim.api.nvim_win_get_buf(win), 'filetype')
)
then
focusable_win = win
break
end
end
last_focus[curtab] = focusable_win
end
end
else
if
not vim.tbl_contains(
config.options.ignore_focus,
vim.api.nvim_buf_get_option(vim.api.nvim_win_get_buf(curwin), 'filetype')
)
then
last_focus[curtab] = curwin
end
end
vim.g.actual_curwin = last_focus[curtab]
-- gather which windows needs update
if opts.scope == 'all' then
if vim.tbl_contains(opts.place, 'statusline') or vim.tbl_contains(opts.place, 'winbar') then
wins = vim.tbl_filter(function(win)
return vim.fn.win_gettype(win) ~= 'popup'
end, vim.api.nvim_list_wins())
end
elseif opts.scope == 'tabpage' then
if vim.tbl_contains(opts.place, 'statusline') or vim.tbl_contains(opts.place, 'winbar') then
wins = vim.tbl_filter(function(win)
return vim.fn.win_gettype(win) ~= 'popup'
end, vim.api.nvim_tabpage_list_wins(0))
end
elseif opts.scope == 'window' then
wins = { curwin }
end
-- update them
if not timers.halt_stl_refresh and vim.tbl_contains(opts.place, 'statusline') then
for _, win in ipairs(wins) do
refresh_real_curwin = config.options.globalstatus and last_focus[curtab] or win
local set_win = config.options.globalstatus
and vim.fn.win_gettype(refresh_real_curwin) == 'popup'
and refresh_real_curwin
or win
local stl_cur = vim.api.nvim_win_call(refresh_real_curwin, M.statusline)
local stl_last = modules.nvim_opts.get_cache('statusline', { window = set_win })
if stl_cur or stl_last then
modules.nvim_opts.set('statusline', stl_cur, { window = set_win })
end
end
end
if not timers.halt_wb_refresh and vim.tbl_contains(opts.place, 'winbar') then
for _, win in ipairs(wins) do
refresh_real_curwin = win
if vim.api.nvim_win_get_height(win) > 1 then
local wbr_cur = vim.api.nvim_win_call(refresh_real_curwin, M.winbar)
local wbr_last = modules.nvim_opts.get_cache('winbar', { window = win })
if wbr_cur or wbr_last then
modules.nvim_opts.set('winbar', wbr_cur, { window = win })
end
end
end
end
if not timers.halt_tal_refresh and vim.tbl_contains(opts.place, 'tabline') then
refresh_real_curwin = curwin
local tbl_cur = vim.api.nvim_win_call(curwin, tabline)
local tbl_last = modules.nvim_opts.get_cache('tabline', { global = true })
if tbl_cur or tbl_last then
modules.nvim_opts.set('tabline', tbl_cur, { global = true })
end
end
vim.g.actual_curwin = old_actual_curwin
refresh_real_curwin = nil
end
--- Sets &tabline option to lualine
---@param hide boolean|nil if should hide tabline
local function set_tabline(hide)
vim.loop.timer_stop(timers.tal_timer)
timers.halt_tal_refresh = true
vim.cmd([[augroup lualine_tal_refresh | exe "autocmd!" | augroup END]])
if not hide and next(config.tabline) ~= nil then
vim.loop.timer_start(
timers.tal_timer,
0,
config.options.refresh.tabline,
modules.utils.timer_call(timers.tal_timer, 'lualine_tal_refresh', function()
refresh { kind = 'tabpage', place = { 'tabline' }, trigger = 'timer' }
end, 3, 'lualine: Failed to refresh tabline')
)
modules.utils.define_autocmd(
default_refresh_events,
'*',
"call v:lua.require'lualine'.refresh({'kind': 'tabpage', 'place': ['tabline'], 'trigger': 'autocmd'})",
'lualine_tal_refresh'
)
modules.nvim_opts.set('showtabline', 2, { global = true })
timers.halt_tal_refresh = false
else
modules.nvim_opts.restore('tabline', { global = true })
modules.nvim_opts.restore('showtabline', { global = true })
end
end
--- Sets &statusline option to lualine
--- adds auto command to redraw lualine on VimResized event
---@param hide boolean|nil if should hide statusline
local function set_statusline(hide)
vim.loop.timer_stop(timers.stl_timer)
timers.halt_stl_refresh = true
vim.cmd([[augroup lualine_stl_refresh | exe "autocmd!" | augroup END]])
if not hide and (next(config.sections) ~= nil or next(config.inactive_sections) ~= nil) then
if vim.go.statusline == '' then
modules.nvim_opts.set('statusline', '%#Normal#', { global = true })
end
if config.options.globalstatus then
modules.nvim_opts.set('laststatus', 3, { global = true })
vim.loop.timer_start(
timers.stl_timer,
0,
config.options.refresh.statusline,
modules.utils.timer_call(timers.stl_timer, 'lualine_stl_refresh', function()
refresh { kind = 'window', place = { 'statusline' }, trigger = 'timer' }
end, 3, 'lualine: Failed to refresh statusline')
)
modules.utils.define_autocmd(
default_refresh_events,
'*',
"call v:lua.require'lualine'.refresh({'kind': 'window', 'place': ['statusline'], 'trigger': 'autocmd'})",
'lualine_stl_refresh'
)
else
modules.nvim_opts.set('laststatus', 2, { global = true })
vim.loop.timer_start(
timers.stl_timer,
0,
config.options.refresh.statusline,
modules.utils.timer_call(timers.stl_timer, 'lualine_stl_refresh', function()
refresh { kind = 'tabpage', place = { 'statusline' }, trigger = 'timer' }
end, 3, 'lualine: Failed to refresh statusline')
)
modules.utils.define_autocmd(
default_refresh_events,
'*',
"call v:lua.require'lualine'.refresh({'kind': 'tabpage', 'place': ['statusline'], 'trigger': 'autocmd'})",
'lualine_stl_refresh'
)
end
timers.halt_stl_refresh = false
else
modules.nvim_opts.restore('statusline', { global = true })
for _, win in ipairs(vim.api.nvim_list_wins()) do
modules.nvim_opts.restore('statusline', { window = win })
end
modules.nvim_opts.restore('laststatus', { global = true })
end
end
--- Sets &winbar option to lualine
---@param hide boolean|nil if should unset winbar
local function set_winbar(hide)
vim.loop.timer_stop(timers.wb_timer)
timers.halt_wb_refresh = true
vim.cmd([[augroup lualine_wb_refresh | exe "autocmd!" | augroup END]])
if not hide and (next(config.winbar) ~= nil or next(config.inactive_winbar) ~= nil) then
vim.loop.timer_start(
timers.wb_timer,
0,
config.options.refresh.winbar,
modules.utils.timer_call(timers.wb_timer, 'lualine_wb_refresh', function()
refresh { kind = 'tabpage', place = { 'winbar' }, trigger = 'timer' }
end, 3, 'lualine: Failed to refresh winbar')
)
modules.utils.define_autocmd(
default_refresh_events,
'*',
"call v:lua.require'lualine'.refresh({'kind': 'tabpage', 'place': ['winbar'], 'trigger': 'autocmd'})",
'lualine_wb_refresh'
)
timers.halt_wb_refresh = false
elseif vim.fn.has('nvim-0.8') == 1 then
modules.nvim_opts.restore('winbar', { global = true })
for _, win in ipairs(vim.api.nvim_list_wins()) do
modules.nvim_opts.restore('winbar', { window = win })
end
end
end
---@alias LualineHideOptsPlace
---| 'statusline'
---| 'tabline'
---| 'winbar'
---@class LualineHideOpts
---@field place LualineHideOptsPlace[]
---@field unhide boolean
---@param opts LualineHideOpts
local function hide(opts)
if opts == nil then
opts = {}
end
opts = vim.tbl_extend('keep', opts, {
place = { 'statusline', 'tabline', 'winbar' },
unhide = false,
})
local hide_fn = {
statusline = set_statusline,
tabline = set_tabline,
winbar = set_winbar,
}
for _, place in ipairs(opts.place) do
if hide_fn[place] then
hide_fn[place](not opts.unhide)
end
end
end
-- lualine.setup function
--- sets new user config
--- This function doesn't load components/theme etc... They are done before
--- first statusline redraw and after new config. This is more efficient when
--- lualine config is done in several setup calls as chunks. This way
--- we don't initialize components just to throw them away. Instead they are
--- initialized when we know we will use them.
--- sets &last_status to 2
---@param user_config table table
local function setup(user_config)
if package.loaded['lualine.utils.notices'] then
-- When notices module is not loaded there are no notices to clear.
modules.utils_notices.clear_notices()
end
config = modules.config_module.apply_configuration(user_config)
vim.cmd([[augroup lualine | exe "autocmd!" | augroup END]])
setup_theme()
-- load components & extensions
modules.loader.load_all(config)
set_statusline()
set_tabline()
set_winbar()
if package.loaded['lualine.utils.notices'] then
modules.utils_notices.notice_message_startup()
end
end
M = {
setup = setup,
statusline = status_dispatch('sections'),
tabline = tabline,
get_config = modules.config_module.get_config,
refresh = refresh,
winbar = status_dispatch('winbar'),
hide = hide,
}
return M

289
etc/soft/nvim/+plugins/lualine.nvim/lua/lualine/component.lua

@ -0,0 +1,289 @@ @@ -0,0 +1,289 @@
-- Copyright (c) 2020-2021 shadmansaleh
-- MIT license, see LICENSE for more details.
local lualine_require = require('lualine_require')
local require = lualine_require.require
local M = require('lualine.utils.class'):extend()
local modules = lualine_require.lazy_require {
highlight = 'lualine.highlight',
utils_notices = 'lualine.utils.notices',
fn_store = 'lualine.utils.fn_store',
}
-- Used to provide a unique id for each component
local component_no = 1
function M._reset_components()
component_no = 1
end
-- variable to store component output for manipulation
M.status = ''
function M:__tostring()
local str = 'Component: ' .. self.options.component_name
if self.debug then
str = str .. '\n---------------------\n' .. vim.inspect(self)
end
return str
end
M.__is_lualine_component = true
---initialize new component
---@param options table options for component
function M:init(options)
self.options = options or {}
component_no = component_no + 1
if not self.options.component_name then
self.options.component_name = tostring(component_no)
end
self.component_no = component_no
self:set_separator()
self:create_option_highlights()
self:set_on_click()
end
---sets the default separator for component based on whether the component
---is in left sections or right sections when separator option is omitted.
function M:set_separator()
if self.options.separator == nil then
if self.options.component_separators then
if self.options.self.section < 'x' then
self.options.separator = self.options.component_separators.left
else
self.options.separator = self.options.component_separators.right
end
end
end
end
---creates hl group from color option
function M:create_option_highlights()
-- set custom highlights
if self.options.color then
self.options.color_highlight = self:create_hl(self.options.color)
end
-- setup icon highlight
if type(self.options.icon) == 'table' and self.options.icon.color then
self.options.icon_color_highlight = self:create_hl(self.options.icon.color)
end
end
---Setup on click function so they can be added during drawing.
function M:set_on_click()
if self.options.on_click ~= nil then
if vim.fn.has('nvim-0.8') == 0 then
modules.utils_notices.add_notice(
'### Options.on_click\nSorry `on_click` can only be used in neovim 0.8 or higher.\n'
)
self.options.on_click = nil
return
end
self.on_click_id = modules.fn_store.register_fn(self.component_no, self.options.on_click)
end
end
---adds spaces to left and right of a component
function M:apply_padding()
local padding = self.options.padding
local l_padding, r_padding
if padding == nil then
padding = 1
end
if type(padding) == 'number' then
l_padding, r_padding = padding, padding
elseif type(padding) == 'table' then
l_padding, r_padding = padding.left, padding.right
end
if l_padding then
if self.status:find('%%#.*#') == 1 then
-- When component has changed the highlight at beginning
-- we will add the padding after the highlight
local pre_highlight = vim.fn.matchlist(self.status, [[\(%#.\{-\}#\)]])[2]
self.status = pre_highlight .. string.rep(' ', l_padding) .. self.status:sub(#pre_highlight + 1, #self.status)
else
self.status = string.rep(' ', l_padding) .. self.status
end
end
if r_padding then
self.status = self.status .. string.rep(' ', r_padding)
end
end
---applies custom highlights for component
function M:apply_highlights(default_highlight)
if self.options.color_highlight then
local hl_fmt
hl_fmt, M.color_fn_cache = self:format_hl(self.options.color_highlight)
self.status = hl_fmt .. self.status
end
if type(self.options.separator) ~= 'table' and self.status:find('%%#') then
-- Apply default highlight only when we aren't applying trans sep and
-- the component has changed it's hl. Since we won't be applying
-- regular sep in those cases so ending with default hl isn't necessary
self.status = self.status .. default_highlight
-- Also put it in applied sep so when sep get striped so does the hl
self.applied_separator = default_highlight
end
-- Prepend default hl when the component doesn't start with hl otherwise
-- color in previous component can cause side effect
if not self.status:find('^%%#') then
self.status = default_highlight .. self.status
end
end
---apply icon to component (appends/prepends component with icon)
function M:apply_icon()
local icon = self.options.icon
if self.options.icons_enabled and icon then
if type(icon) == 'table' then
icon = icon[1]
end
if
self.options.icon_color_highlight
and type(self.options.icon) == 'table'
and self.options.icon.align == 'right'
then
self.status = table.concat {
self.status,
' ',
self:format_hl(self.options.icon_color_highlight),
icon,
self:get_default_hl(),
}
elseif self.options.icon_color_highlight then
self.status = table.concat {
self:format_hl(self.options.icon_color_highlight),
icon,
self:get_default_hl(),
' ',
self.status,
}
elseif type(self.options.icon) == 'table' and self.options.icon.align == 'right' then
self.status = table.concat({ self.status, icon }, ' ')
else
self.status = table.concat({ icon, self.status }, ' ')
end
end
end
---apply separator at end of component only when
---custom highlights haven't affected background
function M:apply_separator()
local separator = self.options.separator
if type(separator) == 'table' then
if self.options.separator[2] == '' then
if self.options.self.section < 'x' then
separator = self.options.component_separators.left
else
separator = self.options.component_separators.right
end
else
return
end
end
if separator and #separator > 0 then
self.status = self.status .. separator
self.applied_separator = self.applied_separator .. separator
end
end
---apply transitional separator for the component
function M:apply_section_separators()
if type(self.options.separator) ~= 'table' then
return
end
if self.options.separator.left ~= nil and self.options.separator.left ~= '' then
self.status = string.format('%%s{%s}%s', self.options.separator.left, self.status)
self.strip_previous_separator = true
end
if self.options.separator.right ~= nil and self.options.separator.right ~= '' then
self.status = string.format('%s%%S{%s}', self.status, self.options.separator.right)
end
end
---Add on click funtion description to already drawn item
function M:apply_on_click()
if self.on_click_id then
self.status = self:format_fn(self.on_click_id, self.status)
end
end
---remove separator from tail of this component.
---called by lualine.utils.sections.draw_section to manage unnecessary separators
function M:strip_separator()
if not self.applied_separator then
self.applied_separator = ''
end
self.status = self.status:sub(1, (#self.status - #self.applied_separator))
self.applied_separator = nil
return self.status
end
function M:get_default_hl()
if self.options.color_highlight then
return self:format_hl(self.options.color_highlight)
elseif self.default_hl then
return self.default_hl
else
return modules.highlight.format_highlight(self.options.self.section)
end
end
---create a lualine highlight for color
---@param color table|string|function defined color for hl
---@param hint string|nil hint for hl name
---@return table an identifier to later retrieve the hl for application
function M:create_hl(color, hint)
hint = hint and self.options.component_name .. '_' .. hint or self.options.component_name
return modules.highlight.create_component_highlight_group(color, hint, self.options, false)
end
---Get stl formatted hl group for hl_token
---@param hl_token table identifier received from create_hl or create_component_highlight_group
---@return string stl formatted hl group for hl_token
function M:format_hl(hl_token)
return modules.highlight.component_format_highlight(hl_token)
end
---Wrap str with click format for function of id
---@param id number
---@param str string
---@return string
function M:format_fn(id, str)
return string.format("%%%d@v:lua.require'lualine.utils.fn_store'.call_fn@%s%%T", id, str)
end
-- luacheck: push no unused args
---actual function that updates a component. Must be overwritten with component functionality
function M:update_status(is_focused) end
-- luacheck: pop
---driver code of the class
---@param default_highlight string default hl group of section where component resides
---@param is_focused boolean|number whether drawing for active or inactive statusline.
---@return string stl formatted rendering string for component
function M:draw(default_highlight, is_focused)
self.status = ''
self.applied_separator = ''
if self.options.cond ~= nil and self.options.cond() ~= true then
return self.status
end
self.default_hl = default_highlight
local status = self:update_status(is_focused)
if self.options.fmt then
status = self.options.fmt(status or '')
end
if type(status) == 'string' and #status > 0 then
self.status = status
self:apply_icon()
self:apply_padding()
self:apply_on_click()
self:apply_highlights(default_highlight)
self:apply_section_separators()
self:apply_separator()
end
return self.status
end
return M

131
etc/soft/nvim/+plugins/lualine.nvim/lua/lualine/components/branch/git_branch.lua

@ -0,0 +1,131 @@ @@ -0,0 +1,131 @@
local M = {}
local require = require('lualine_require').require
local utils = require('lualine.utils.utils')
-- vars
local current_git_branch = ''
local current_git_dir = ''
local branch_cache = {} -- stores last known branch for a buffer
local active_bufnr = '0'
-- os specific path separator
local sep = package.config:sub(1, 1)
-- event watcher to watch head file
-- Use file watch for non Windows and poll for Windows.
-- Windows doesn't like file watch for some reason.
local file_changed = sep ~= '\\' and vim.loop.new_fs_event() or vim.loop.new_fs_poll()
local git_dir_cache = {} -- Stores git paths that we already know of
---sets git_branch variable to branch name or commit hash if not on branch
---@param head_file string full path of .git/HEAD file
local function get_git_head(head_file)
local f_head = io.open(head_file)
if f_head then
local HEAD = f_head:read()
f_head:close()
local branch = HEAD:match('ref: refs/heads/(.+)$')
if branch then
current_git_branch = branch
else
current_git_branch = HEAD:sub(1, 6)
end
end
return nil
end
---updates the current value of git_branch and sets up file watch on HEAD file
local function update_branch()
active_bufnr = tostring(vim.api.nvim_get_current_buf())
file_changed:stop()
local git_dir = current_git_dir
if git_dir and #git_dir > 0 then
local head_file = git_dir .. sep .. 'HEAD'
get_git_head(head_file)
file_changed:start(
head_file,
sep ~= '\\' and {} or 1000,
vim.schedule_wrap(function()
-- reset file-watch
update_branch()
end)
)
else
-- set to '' when git dir was not found
current_git_branch = ''
end
branch_cache[vim.api.nvim_get_current_buf()] = current_git_branch
end
---returns full path to git directory for dir_path or current directory
---@param dir_path string|nil
---@return string
function M.find_git_dir(dir_path)
-- get file dir so we can search from that dir
local file_dir = dir_path or vim.fn.expand('%:p:h')
local root_dir = file_dir
local git_dir
-- Search upward for .git file or folder
while root_dir do
if git_dir_cache[root_dir] then
git_dir = git_dir_cache[root_dir]
break
end
local git_path = root_dir .. sep .. '.git'
local git_file_stat = vim.loop.fs_stat(git_path)
if git_file_stat then
if git_file_stat.type == 'directory' then
git_dir = git_path
elseif git_file_stat.type == 'file' then
-- separate git-dir or submodule is used
local file = io.open(git_path)
if file then
git_dir = file:read()
git_dir = git_dir and git_dir:match('gitdir: (.+)$')
file:close()
end
-- submodule / relative file path
if git_dir and git_dir:sub(1, 1) ~= sep and not git_dir:match('^%a:.*$') then
git_dir = git_path:match('(.*).git') .. git_dir
end
end
if git_dir then
local head_file_stat = vim.loop.fs_stat(git_dir .. sep .. 'HEAD')
if head_file_stat and head_file_stat.type == 'file' then
break
else
git_dir = nil
end
end
end
root_dir = root_dir:match('(.*)' .. sep .. '.-')
end
git_dir_cache[file_dir] = git_dir
if dir_path == nil and current_git_dir ~= git_dir then
current_git_dir = git_dir
update_branch()
end
return git_dir
end
---initializes git_branch module
function M.init()
-- run watch head on load so branch is present when component is loaded
M.find_git_dir()
-- update branch state of BufEnter as different Buffer may be on different repos
utils.define_autocmd('BufEnter', "lua require'lualine.components.branch.git_branch'.find_git_dir()")
end
function M.get_branch(bufnr)
if vim.g.actual_curbuf ~= nil and active_bufnr ~= vim.g.actual_curbuf then
-- Workaround for https://github.com/nvim-lualine/lualine.nvim/issues/286
-- See upstream issue https://github.com/neovim/neovim/issues/15300
-- Diff is out of sync re sync it.
M.find_git_dir()
end
if bufnr then
return branch_cache[bufnr] or ''
end
return current_git_branch
end
return M

25
etc/soft/nvim/+plugins/lualine.nvim/lua/lualine/components/branch/init.lua

@ -0,0 +1,25 @@ @@ -0,0 +1,25 @@
-- Copyright (c) 2020-2021 shadmansaleh
-- MIT license, see LICENSE for more details.
local M = require('lualine.component'):extend()
local modules = require('lualine_require').lazy_require {
git_branch = 'lualine.components.branch.git_branch',
highlight = 'lualine.highlight',
utils = 'lualine.utils.utils',
}
-- Initializer
M.init = function(self, options)
M.super.init(self, options)
if not self.options.icon then
self.options.icon = '' -- e0a0
end
modules.git_branch.init()
end
M.update_status = function(_, is_focused)
local buf = (not is_focused and vim.api.nvim_get_current_buf())
local branch = modules.git_branch.get_branch(buf)
return modules.utils.stl_escape(branch)
end
return M

192
etc/soft/nvim/+plugins/lualine.nvim/lua/lualine/components/buffers/buffer.lua

@ -0,0 +1,192 @@ @@ -0,0 +1,192 @@
local Buffer = require('lualine.utils.class'):extend()
local modules = require('lualine_require').lazy_require {
highlight = 'lualine.highlight',
utils = 'lualine.utils.utils',
}
---initialize a new buffer from opts
---@param opts table
function Buffer:init(opts)
assert(opts.bufnr, 'Cannot create Buffer without bufnr')
self.bufnr = opts.bufnr
self.buf_index = opts.buf_index
self.options = opts.options
self.highlights = opts.highlights
self:get_props()
end
function Buffer:is_current()
return vim.api.nvim_get_current_buf() == self.bufnr
end
function Buffer:is_alternate()
return vim.fn.bufnr('#') == self.bufnr and not self:is_current()
end
---setup icons, modified status for buffer
function Buffer:get_props()
self.file = modules.utils.stl_escape(vim.api.nvim_buf_get_name(self.bufnr))
self.buftype = vim.api.nvim_buf_get_option(self.bufnr, 'buftype')
self.filetype = vim.api.nvim_buf_get_option(self.bufnr, 'filetype')
local modified = self.options.show_modified_status and vim.api.nvim_buf_get_option(self.bufnr, 'modified')
self.modified_icon = modified and self.options.symbols.modified or ''
self.alternate_file_icon = self:is_alternate() and self.options.symbols.alternate_file or ''
self.icon = ''
if self.options.icons_enabled then
local dev
local status, _ = pcall(require, 'nvim-web-devicons')
if not status then
dev, _ = '', ''
elseif self.filetype == 'TelescopePrompt' then
dev, _ = require('nvim-web-devicons').get_icon('telescope')
elseif self.filetype == 'fugitive' then
dev, _ = require('nvim-web-devicons').get_icon('git')
elseif self.filetype == 'vimwiki' then
dev, _ = require('nvim-web-devicons').get_icon('markdown')
elseif self.buftype == 'terminal' then
dev, _ = require('nvim-web-devicons').get_icon('zsh')
elseif vim.fn.isdirectory(self.file) == 1 then
dev, _ = self.options.symbols.directory, nil
else
dev, _ = require('nvim-web-devicons').get_icon(self.file, vim.fn.expand('#' .. self.bufnr .. ':e'))
end
if dev then
self.icon = dev .. ' '
end
end
end
---returns line configured for handling mouse click
---@param name string
---@return string
function Buffer:configure_mouse_click(name)
return string.format('%%%s@LualineSwitchBuffer@%s%%T', self.bufnr, name)
end
---returns rendered buffer
---@return string
function Buffer:render()
local name = self:name()
if self.options.fmt then
name = self.options.fmt(name or '')
end
if self.ellipse then -- show ellipsis
name = '...'
else
name = self:apply_mode(name)
end
name = Buffer.apply_padding(name, self.options.padding)
self.len = vim.fn.strchars(name)
-- setup for mouse clicks
local line = self:configure_mouse_click(name)
-- apply highlight
line = modules.highlight.component_format_highlight(self.highlights[(self.current and 'active' or 'inactive')])
.. line
-- apply separators
if self.options.self.section < 'x' and not self.first then
local sep_before = self:separator_before()
line = sep_before .. line
self.len = self.len + vim.fn.strchars(sep_before)
elseif self.options.self.section >= 'x' and not self.last then
local sep_after = self:separator_after()
line = line .. sep_after
self.len = self.len + vim.fn.strchars(sep_after)
end
return line
end
---apply separator before current buffer
---@return string
function Buffer:separator_before()
if self.current or self.aftercurrent then
return '%S{' .. self.options.section_separators.left .. '}'
else
return self.options.component_separators.left
end
end
---apply separator after current buffer
---@return string
function Buffer:separator_after()
if self.current or self.beforecurrent then
return '%s{' .. self.options.section_separators.right .. '}'
else
return self.options.component_separators.right
end
end
---returns name of current buffer after filtering special buffers
---@return string
function Buffer:name()
if self.options.filetype_names[self.filetype] then
return self.options.filetype_names[self.filetype]
elseif self.buftype == 'help' then
return 'help:' .. vim.fn.fnamemodify(self.file, ':t:r')
elseif self.buftype == 'terminal' then
local match = string.match(vim.split(self.file, ' ')[1], 'term:.*:(%a+)')
return match ~= nil and match or vim.fn.fnamemodify(vim.env.SHELL, ':t')
elseif self.buftype == 'quickfix' then
local is_loclist = 0 ~= vim.fn.getloclist(0, { filewinid = 1 }).filewinid
return is_loclist and 'Location list' or 'Quickfix List'
elseif vim.fn.isdirectory(self.file) == 1 then
return vim.fn.fnamemodify(self.file, ':p:.')
elseif self.file == '' then
return '[No Name]'
end
local name
if self.options.show_filename_only then
name = vim.fn.fnamemodify(self.file, ':t')
else
name = vim.fn.pathshorten(vim.fn.fnamemodify(self.file, ':p:.'))
end
if self.options.hide_filename_extension then
name = vim.fn.fnamemodify(name, ':r')
end
return name
end
---adds spaces to left and right
function Buffer.apply_padding(str, padding)
local l_padding, r_padding = 1, 1
if type(padding) == 'number' then
l_padding, r_padding = padding, padding
elseif type(padding) == 'table' then
l_padding, r_padding = padding.left or 0, padding.right or 0
end
return string.rep(' ', l_padding) .. str .. string.rep(' ', r_padding)
end
function Buffer:apply_mode(name)
if self.options.mode == 0 then
return string.format('%s%s%s%s', self.alternate_file_icon, self.icon, name, self.modified_icon)
end
if self.options.mode == 1 then
return string.format('%s%s %s%s', self.alternate_file_icon, self.buf_index or '', self.icon, self.modified_icon)
end
if self.options.mode == 2 then
return string.format(
'%s%s %s%s%s',
self.alternate_file_icon,
self.buf_index or '',
self.icon,
name,
self.modified_icon
)
end
if self.options.mode == 3 then
return string.format('%s%s %s%s', self.alternate_file_icon, self.bufnr or '', self.icon, self.modified_icon)
end
-- if self.options.mode == 4 then
return string.format('%s%s %s%s%s', self.alternate_file_icon, self.bufnr or '', self.icon, name, self.modified_icon)
end
return Buffer

238
etc/soft/nvim/+plugins/lualine.nvim/lua/lualine/components/buffers/init.lua

@ -0,0 +1,238 @@ @@ -0,0 +1,238 @@
-- Copyright (c) 2020-2021 shadmansaleh
-- MIT license, see LICENSE for more details.
local require = require('lualine_require').require
local Buffer = require('lualine.components.buffers.buffer')
local M = require('lualine.component'):extend()
local highlight = require('lualine.highlight')
local default_options = {
show_filename_only = true,
hide_filename_extension = false,
show_modified_status = true,
mode = 0,
max_length = 0,
filetype_names = {
TelescopePrompt = 'Telescope',
dashboard = 'Dashboard',
packer = 'Packer',
fzf = 'FZF',
alpha = 'Alpha',
},
buffers_color = {
active = nil,
inactive = nil,
},
symbols = {
modified = '',
alternate_file = '#',
directory = '',
},
}
-- This function is duplicated in tabs
---returns the proper hl for buffer in section. Used for setting default highlights
---@param section string name of section buffers component is in
---@param is_active boolean
---@return string hl name
local function get_hl(section, is_active)
local suffix = is_active and '_normal' or '_inactive'
local section_redirects = {
lualine_x = 'lualine_c',
lualine_y = 'lualine_b',
lualine_z = 'lualine_a',
}
if section_redirects[section] then
section = highlight.highlight_exists(section .. suffix) and section or section_redirects[section]
end
return section .. suffix
end
function M:init(options)
M.super.init(self, options)
default_options.buffers_color = {
active = get_hl('lualine_' .. options.self.section, true),
inactive = get_hl('lualine_' .. options.self.section, false),
}
self.options = vim.tbl_deep_extend('keep', self.options or {}, default_options)
if self.options.component_name == 'buffers' then
self.highlights = {
active = self:create_hl(self.options.buffers_color.active, 'active'),
inactive = self:create_hl(self.options.buffers_color.inactive, 'inactive'),
}
end
end
function M:new_buffer(bufnr, buf_index)
bufnr = bufnr or vim.api.nvim_get_current_buf()
buf_index = buf_index or ''
return Buffer:new {
bufnr = bufnr,
buf_index = buf_index,
options = self.options,
highlights = self.highlights,
}
end
function M:buffers()
local buffers = {}
M.bufpos2nr = {}
for b = 1, vim.fn.bufnr('$') do
if vim.fn.buflisted(b) ~= 0 and vim.api.nvim_buf_get_option(b, 'buftype') ~= 'quickfix' then
buffers[#buffers + 1] = self:new_buffer(b, #buffers + 1)
M.bufpos2nr[#buffers] = b
end
end
return buffers
end
function M:update_status()
local data = {}
local buffers = self:buffers()
local current = -2
-- mark the first, last, current, before current, after current buffers
-- for rendering
if buffers[1] then
buffers[1].first = true
end
if buffers[#buffers] then
buffers[#buffers].last = true
end
for i, buffer in ipairs(buffers) do
if buffer:is_current() then
buffer.current = true
current = i
end
end
if buffers[current - 1] then
buffers[current - 1].beforecurrent = true
end
if buffers[current + 1] then
buffers[current + 1].aftercurrent = true
end
local max_length = self.options.max_length
if type(max_length) == 'function' then
max_length = max_length(self)
end
if max_length == 0 then
max_length = math.floor(2 * vim.o.columns / 3)
end
local total_length
for i, buffer in pairs(buffers) do
if buffer.current then
current = i
end
end
-- start drawing from current buffer and draw left and right of it until
-- all buffers are drawn or max_length has been reached.
if current == -2 then
local b = self:new_buffer()
b.current = true
if self.options.self.section < 'x' then
b.last = true
if #buffers > 0 then
buffers[#buffers].last = nil
end
buffers[#buffers + 1] = b
current = #buffers
else
b.first = true
if #buffers > 0 then
buffers[1].first = nil
end
table.insert(buffers, 1, b)
current = 1
end
end
local current_buffer = buffers[current]
data[#data + 1] = current_buffer:render()
total_length = current_buffer.len
local i = 0
local before, after
while true do
i = i + 1
before = buffers[current - i]
after = buffers[current + i]
local rendered_before, rendered_after
if before == nil and after == nil then
break
end
-- draw left most undrawn buffer if fits in max_length
if before then
rendered_before = before:render()
total_length = total_length + before.len
if total_length > max_length then
break
end
table.insert(data, 1, rendered_before)
end
-- draw right most undrawn buffer if fits in max_length
if after then
rendered_after = after:render()
total_length = total_length + after.len
if total_length > max_length then
break
end
data[#data + 1] = rendered_after
end
end
-- draw ellipsis (...) on relevant sides if all buffers don't fit in max_length
if total_length > max_length then
if before ~= nil then
before.ellipse = true
before.first = true
table.insert(data, 1, before:render())
end
if after ~= nil then
after.ellipse = true
after.last = true
data[#data + 1] = after:render()
end
end
return table.concat(data)
end
function M:draw()
self.status = ''
self.applied_separator = ''
if self.options.cond ~= nil and self.options.cond() ~= true then
return self.status
end
local status = self:update_status()
if type(status) == 'string' and #status > 0 then
self.status = status
self:apply_section_separators()
self:apply_separator()
end
return self.status
end
function M.buffer_jump(buf_pos, bang)
if buf_pos == '$' then
buf_pos = #M.bufpos2nr
else
buf_pos = tonumber(buf_pos)
end
if buf_pos < 1 or buf_pos > #M.bufpos2nr then
if bang ~= '!' then
error('Error: Unable to jump buffer position out of range')
else
return
end
end
vim.api.nvim_set_current_buf(M.bufpos2nr[buf_pos])
end
vim.cmd([[
function! LualineSwitchBuffer(bufnr, mouseclicks, mousebutton, modifiers)
execute ":buffer " . a:bufnr
endfunction
command! -nargs=1 -bang LualineBuffersJump call v:lua.require'lualine.components.buffers'.buffer_jump(<f-args>, "<bang>")
]])
return M

59
etc/soft/nvim/+plugins/lualine.nvim/lua/lualine/components/diagnostics/config.lua

@ -0,0 +1,59 @@ @@ -0,0 +1,59 @@
local require = require('lualine_require').require
local utils = require('lualine.utils.utils')
local M = {}
-- default symbols for diagnostics component
M.symbols = {
icons = {
error = ' ', -- xf659
warn = ' ', -- xf529
info = ' ', -- xf7fc
hint = ' ', -- xf835
},
no_icons = { error = 'E:', warn = 'W:', info = 'I:', hint = 'H:' },
}
-- default options for diagnostics component
M.options = {
colored = true,
update_in_insert = false,
always_visible = false,
sources = { vim.fn.has('nvim-0.6') == 1 and 'nvim_diagnostic' or 'nvim_lsp', 'coc' },
sections = { 'error', 'warn', 'info', 'hint' },
}
function M.apply_default_colors(opts)
local default_diagnostics_color = {
error = {
fg = utils.extract_color_from_hllist(
{ 'fg', 'sp' },
{ 'DiagnosticError', 'LspDiagnosticsDefaultError', 'DiffDelete' },
'#e32636'
),
},
warn = {
fg = utils.extract_color_from_hllist(
{ 'fg', 'sp' },
{ 'DiagnosticWarn', 'LspDiagnosticsDefaultWarning', 'DiffText' },
'#ffa500'
),
},
info = {
fg = utils.extract_color_from_hllist(
{ 'fg', 'sp' },
{ 'DiagnosticInfo', 'LspDiagnosticsDefaultInformation', 'Normal' },
'#ffffff'
),
},
hint = {
fg = utils.extract_color_from_hllist(
{ 'fg', 'sp' },
{ 'DiagnosticHint', 'LspDiagnosticsDefaultHint', 'DiffChange' },
'#273faf'
),
},
}
opts.diagnostics_color = vim.tbl_deep_extend('keep', opts.diagnostics_color or {}, default_diagnostics_color)
end
return M

111
etc/soft/nvim/+plugins/lualine.nvim/lua/lualine/components/diagnostics/init.lua

@ -0,0 +1,111 @@ @@ -0,0 +1,111 @@
-- Copyright (c) 2020-2021 hoob3rt
-- MIT license, see LICENSE for more details.
local lualine_require = require('lualine_require')
local modules = lualine_require.lazy_require {
default_config = 'lualine.components.diagnostics.config',
sources = 'lualine.components.diagnostics.sources',
highlight = 'lualine.highlight',
utils = 'lualine.utils.utils',
utils_notices = 'lualine.utils.notices',
}
local M = lualine_require.require('lualine.component'):extend()
M.diagnostics_sources = modules.sources.sources
M.get_diagnostics = modules.sources.get_diagnostics
-- Initializer
function M:init(options)
-- Run super()
M.super.init(self, options)
-- Apply default options
modules.default_config.apply_default_colors(self.options)
self.options = vim.tbl_deep_extend('keep', self.options or {}, modules.default_config.options)
-- Apply default symbols
self.symbols = vim.tbl_extend(
'keep',
self.options.symbols or {},
self.options.icons_enabled ~= false and modules.default_config.symbols.icons
or modules.default_config.symbols.no_icons
)
-- Initialize highlight groups
if self.options.colored then
self.highlight_groups = {
error = self:create_hl(self.options.diagnostics_color.error, 'error'),
warn = self:create_hl(self.options.diagnostics_color.warn, 'warn'),
info = self:create_hl(self.options.diagnostics_color.info, 'info'),
hint = self:create_hl(self.options.diagnostics_color.hint, 'hint'),
}
end
-- Initialize variable to store last update so we can use it in insert
-- mode for no update_in_insert
self.last_diagnostics_count = {}
-- Error out no source
if #self.options.sources < 1 then
modules.utils_notices.add_notice(
'### diagnostics.sources\n\nno sources for diagnostics configured.\nPlease specify which diagnostics source you want lualine to use with `sources` option.\n'
)
end
end
function M:update_status()
local bufnr = vim.api.nvim_get_current_buf()
local diagnostics_count
local result = {}
if self.options.update_in_insert or vim.api.nvim_get_mode().mode:sub(1, 1) ~= 'i' then
local error_count, warning_count, info_count, hint_count = 0, 0, 0, 0
local diagnostic_data = modules.sources.get_diagnostics(self.options.sources)
-- sum all the counts
for _, data in pairs(diagnostic_data) do
error_count = error_count + data.error
warning_count = warning_count + data.warn
info_count = info_count + data.info
hint_count = hint_count + data.hint
end
diagnostics_count = {
error = error_count,
warn = warning_count,
info = info_count,
hint = hint_count,
}
-- Save count for insert mode
self.last_diagnostics_count[bufnr] = diagnostics_count
else -- Use cached count in insert mode with update_in_insert disabled
diagnostics_count = self.last_diagnostics_count[bufnr] or { error = 0, warn = 0, info = 0, hint = 0 }
end
local always_visible = false
if type(self.options.always_visible) == 'boolean' then
always_visible = self.options.always_visible
elseif type(self.options.always_visible) == 'function' then
always_visible = self.options.always_visible()
end
-- format the counts with symbols and highlights
if self.options.colored then
local colors, bgs = {}, {}
for name, hl in pairs(self.highlight_groups) do
colors[name] = self:format_hl(hl)
bgs[name] = modules.utils.extract_highlight_colors(colors[name]:match('%%#(.-)#'), 'bg')
end
local previous_section, padding
for _, section in ipairs(self.options.sections) do
if diagnostics_count[section] ~= nil and (always_visible or diagnostics_count[section] > 0) then
padding = previous_section and (bgs[previous_section] ~= bgs[section]) and ' ' or ''
previous_section = section
table.insert(result, colors[section] .. padding .. self.symbols[section] .. diagnostics_count[section])
end
end
else
for _, section in ipairs(self.options.sections) do
if diagnostics_count[section] ~= nil and (always_visible or diagnostics_count[section] > 0) then
table.insert(result, self.symbols[section] .. diagnostics_count[section])
end
end
end
return table.concat(result, ' ')
end
return M

111
etc/soft/nvim/+plugins/lualine.nvim/lua/lualine/components/diagnostics/sources.lua

@ -0,0 +1,111 @@ @@ -0,0 +1,111 @@
local M = {}
---functions that how how to retrieve diagnostics from specific source.
---returns error_count:number, warning_count:number,
--- info_count:number, hint_count:number
M.sources = {
nvim_lsp = function()
local error_count, warning_count, info_count, hint_count
if vim.fn.has('nvim-0.6') == 1 then
-- On nvim 0.6+ use vim.diagnostic to get lsp generated diagnostic count.
local diagnostics = vim.diagnostic.get(0)
local count = { 0, 0, 0, 0 }
for _, diagnostic in ipairs(diagnostics) do
if vim.startswith(vim.diagnostic.get_namespace(diagnostic.namespace).name, 'vim.lsp') then
count[diagnostic.severity] = count[diagnostic.severity] + 1
end
end
error_count = count[vim.diagnostic.severity.ERROR]
warning_count = count[vim.diagnostic.severity.WARN]
info_count = count[vim.diagnostic.severity.INFO]
hint_count = count[vim.diagnostic.severity.HINT]
else
-- On 0.5 use older vim.lsp.diagnostic module.
-- Maybe we should phase out support for 0.5 though I haven't yet found a solid reason to.
-- Eventually this will be removed when 0.5 is no longer supported.
error_count = vim.lsp.diagnostic.get_count(0, 'Error')
warning_count = vim.lsp.diagnostic.get_count(0, 'Warning')
info_count = vim.lsp.diagnostic.get_count(0, 'Information')
hint_count = vim.lsp.diagnostic.get_count(0, 'Hint')
end
return error_count, warning_count, info_count, hint_count
end,
nvim_workspace_diagnostic = function()
local diag_severity = vim.diagnostic.severity
local function workspace_diag(severity)
local count = vim.diagnostic.get(nil, { severity = severity })
return vim.tbl_count(count)
end
return workspace_diag(diag_severity.ERROR),
workspace_diag(diag_severity.WARN),
workspace_diag(diag_severity.INFO),
workspace_diag(diag_severity.HINT)
end,
nvim_diagnostic = function()
local diagnostics = vim.diagnostic.get(0)
local count = { 0, 0, 0, 0 }
for _, diagnostic in ipairs(diagnostics) do
count[diagnostic.severity] = count[diagnostic.severity] + 1
end
return count[vim.diagnostic.severity.ERROR],
count[vim.diagnostic.severity.WARN],
count[vim.diagnostic.severity.INFO],
count[vim.diagnostic.severity.HINT]
end,
coc = function()
local data = vim.b.coc_diagnostic_info
if data then
return data.error, data.warning, data.information, data.hint
else
return 0, 0, 0, 0
end
end,
ale = function()
local ok, data = pcall(vim.fn['ale#statusline#Count'], vim.api.nvim_get_current_buf())
if ok then
return data.error + data.style_error, data.warning + data.style_warning, data.info, 0
else
return 0, 0, 0, 0
end
end,
vim_lsp = function()
local ok, data = pcall(vim.fn['lsp#get_buffer_diagnostics_counts'])
if ok then
return data.error, data.warning, data.information, data.hint
else
return 0, 0, 0, 0
end
end,
}
---returns list of diagnostics count from all sources
---@param sources table list of sources
---@return table {{error_count, warning_count, info_count, hint_count}}
M.get_diagnostics = function(sources)
local result = {}
for index, source in ipairs(sources) do
if type(source) == 'string' then
local error_count, warning_count, info_count, hint_count = M.sources[source]()
result[index] = {
error = error_count,
warn = warning_count,
info = info_count,
hint = hint_count,
}
elseif type(source) == 'function' then
local source_result = source()
source_result = type(source_result) == 'table' and source_result or {}
result[index] = {
error = source_result.error or 0,
warn = source_result.warn or 0,
info = source_result.info or 0,
hint = source_result.hint or 0,
}
end
end
return result
end
return M

138
etc/soft/nvim/+plugins/lualine.nvim/lua/lualine/components/diff/git_diff.lua

@ -0,0 +1,138 @@ @@ -0,0 +1,138 @@
local lualine_require = require('lualine_require')
local modules = lualine_require.lazy_require {
utils = 'lualine.utils.utils',
Job = 'lualine.utils.job',
}
local M = {}
-- Vars
-- variable to store git diff stats
local git_diff = nil
-- accumulates output from diff process
local diff_output_cache = {}
-- variable to store git_diff job
local diff_job = nil
local active_bufnr = '0'
local diff_cache = {} -- Stores last known value of diff of a buffer
---initialize the module
---param opts table
function M.init(opts)
if type(opts.source) == 'function' then
M.src = opts.source
else
modules.utils.define_autocmd('BufEnter', "lua require'lualine.components.diff.git_diff'.update_diff_args()")
modules.utils.define_autocmd('BufWritePost', "lua require'lualine.components.diff.git_diff'.update_git_diff()")
M.update_diff_args()
end
end
---Api to get git sign count
---scheme :
---{
--- added = added_count,
--- modified = modified_count,
--- removed = removed_count,
---}
---error_code = { added = -1, modified = -1, removed = -1 }
---@param bufnr number|nil
function M.get_sign_count(bufnr)
if bufnr then
return diff_cache[bufnr]
end
if M.src then
git_diff = M.src()
diff_cache[vim.api.nvim_get_current_buf()] = git_diff
elseif vim.g.actual_curbuf ~= nil and active_bufnr ~= vim.g.actual_curbuf then
-- Workaround for https://github.com/nvim-lualine/lualine.nvim/issues/286
-- See upstream issue https://github.com/neovim/neovim/issues/15300
-- Diff is out of sync re sync it.
M.update_diff_args()
end
return git_diff
end
---process diff data and update git_diff{ added, removed, modified }
---@param data string output on stdout od git diff job
local function process_diff(data)
-- Adapted from https://github.com/wbthomason/nvim-vcs.lua
local added, removed, modified = 0, 0, 0
for _, line in ipairs(data) do
if string.find(line, [[^@@ ]]) then
local tokens = vim.fn.matchlist(line, [[^@@ -\v(\d+),?(\d*) \+(\d+),?(\d*)]])
local line_stats = {
mod_count = tokens[3] == nil and 0 or tokens[3] == '' and 1 or tonumber(tokens[3]),
new_count = tokens[5] == nil and 0 or tokens[5] == '' and 1 or tonumber(tokens[5]),
}
if line_stats.mod_count == 0 and line_stats.new_count > 0 then
added = added + line_stats.new_count
elseif line_stats.mod_count > 0 and line_stats.new_count == 0 then
removed = removed + line_stats.mod_count
else
local min = math.min(line_stats.mod_count, line_stats.new_count)
modified = modified + min
added = added + line_stats.new_count - min
removed = removed + line_stats.mod_count - min
end
end
end
git_diff = { added = added, modified = modified, removed = removed }
end
---updates the job args
function M.update_diff_args()
-- Donn't show git diff when current buffer doesn't have a filename
active_bufnr = tostring(vim.api.nvim_get_current_buf())
if #vim.fn.expand('%') == 0 then
M.diff_args = nil
git_diff = nil
return
end
M.diff_args = {
cmd = string.format(
[[git -C %s --no-pager diff --no-color --no-ext-diff -U0 -- %s]],
vim.fn.expand('%:h'),
vim.fn.expand('%:t')
),
on_stdout = function(_, data)
if next(data) then
diff_output_cache = vim.list_extend(diff_output_cache, data)
end
end,
on_stderr = function(_, data)
data = table.concat(data, '\n')
if #data > 0 then
git_diff = nil
diff_output_cache = {}
end
end,
on_exit = function()
if #diff_output_cache > 0 then
process_diff(diff_output_cache)
else
git_diff = { added = 0, modified = 0, removed = 0 }
end
diff_cache[vim.api.nvim_get_current_buf()] = git_diff
end,
}
M.update_git_diff()
end
---update git_diff veriable
function M.update_git_diff()
if M.diff_args then
diff_output_cache = {}
if diff_job then
diff_job:stop()
end
diff_job = modules.Job(M.diff_args)
if diff_job then
diff_job:start()
end
end
end
return M

93
etc/soft/nvim/+plugins/lualine.nvim/lua/lualine/components/diff/init.lua

@ -0,0 +1,93 @@ @@ -0,0 +1,93 @@
-- Copyright (c) 2020-2021 shadmansaleh
-- MIT license, see LICENSE for more details.
local lualine_require = require('lualine_require')
local modules = lualine_require.lazy_require {
git_diff = 'lualine.components.diff.git_diff',
utils = 'lualine.utils.utils',
utils_notices = 'lualine.utils.notices',
highlight = 'lualine.highlight',
}
local M = lualine_require.require('lualine.component'):extend()
local default_options = {
colored = true,
symbols = { added = '+', modified = '~', removed = '-' },
}
local function apply_default_colors(opts)
local default_diff_color = {
added = {
fg = modules.utils.extract_color_from_hllist(
'fg',
{ 'GitSignsAdd', 'GitGutterAdd', 'DiffAdded', 'DiffAdd' },
'#90ee90'
),
},
modified = {
fg = modules.utils.extract_color_from_hllist(
'fg',
{ 'GitSignsChange', 'GitGutterChange', 'DiffChanged', 'DiffChange' },
'#f0e130'
),
},
removed = {
fg = modules.utils.extract_color_from_hllist(
'fg',
{ 'GitSignsDelete', 'GitGutterDelete', 'DiffRemoved', 'DiffDelete' },
'#ff0038'
),
},
}
opts.diff_color = vim.tbl_deep_extend('keep', opts.diff_color or {}, default_diff_color)
end
-- Initializer
function M:init(options)
M.super.init(self, options)
apply_default_colors(self.options)
self.options = vim.tbl_deep_extend('keep', self.options or {}, default_options)
-- create highlights and save highlight_name in highlights table
if self.options.colored then
self.highlights = {
added = self:create_hl(self.options.diff_color.added, 'added'),
modified = self:create_hl(self.options.diff_color.modified, 'modified'),
removed = self:create_hl(self.options.diff_color.removed, 'removed'),
}
end
modules.git_diff.init(self.options)
end
-- Function that runs every time statusline is updated
function M:update_status(is_focused)
local git_diff = modules.git_diff.get_sign_count((not is_focused and vim.api.nvim_get_current_buf()))
if git_diff == nil then
return ''
end
local colors = {}
if self.options.colored then
-- load the highlights and store them in colors table
for name, highlight_name in pairs(self.highlights) do
colors[name] = self:format_hl(highlight_name)
end
end
local result = {}
-- loop though data and load available sections in result table
for _, name in ipairs { 'added', 'modified', 'removed' } do
if git_diff[name] and git_diff[name] > 0 then
if self.options.colored then
table.insert(result, colors[name] .. self.options.symbols[name] .. git_diff[name])
else
table.insert(result, self.options.symbols[name] .. git_diff[name])
end
end
end
if #result > 0 then
return table.concat(result, ' ')
else
return ''
end
end
return M

7
etc/soft/nvim/+plugins/lualine.nvim/lua/lualine/components/encoding.lua

@ -0,0 +1,7 @@ @@ -0,0 +1,7 @@
-- Copyright (c) 2020-2021 hoob3rt
-- MIT license, see LICENSE for more details.
local function encoding()
return vim.opt.fileencoding:get()
end
return encoding

30
etc/soft/nvim/+plugins/lualine.nvim/lua/lualine/components/fileformat.lua

@ -0,0 +1,30 @@ @@ -0,0 +1,30 @@
-- Copyright (c) 2020-2021 shadmansaleh
-- MIT license, see LICENSE for more details.
local M = require('lualine.component'):extend()
-- stylua: ignore
local symbols = {
unix = '', -- e712
dos = '', -- e70f
mac = '', -- e711
}
-- Initializer
function M:init(options)
-- Run super()
M.super.init(self, options)
-- Apply default symbols
self.symbols = vim.tbl_extend('keep', self.options.symbols or {}, symbols)
end
-- Function that runs every time statusline is updated
function M:update_status()
local format = vim.bo.fileformat
if self.options.icons_enabled then
return self.symbols[format] or format
else
return format
end
end
return M

105
etc/soft/nvim/+plugins/lualine.nvim/lua/lualine/components/filename.lua

@ -0,0 +1,105 @@ @@ -0,0 +1,105 @@
-- Copyright (c) 2020-2021 shadmansaleh
-- MIT license, see LICENSE for more details.
local M = require('lualine.component'):extend()
local modules = require('lualine_require').lazy_require {
utils = 'lualine.utils.utils',
}
local default_options = {
symbols = {
modified = '[+]',
readonly = '[-]',
unnamed = '[No Name]',
newfile = '[New]',
},
file_status = true,
newfile_status = false,
path = 0,
shorting_target = 40,
}
local function is_new_file()
local filename = vim.fn.expand('%')
return filename ~= '' and vim.bo.buftype == '' and vim.fn.filereadable(filename) == 0
end
---shortens path by turning apple/orange -> a/orange
---@param path string
---@param sep string path separator
---@param max_len integer maximum length of the full filename string
---@return string
local function shorten_path(path, sep, max_len)
local len = #path
if len <= max_len then
return path
end
local segments = vim.split(path, sep)
for idx = 1, #segments - 1 do
if len <= max_len then
break
end
local segment = segments[idx]
local shortened = segment:sub(1, vim.startswith(segment, '.') and 2 or 1)
segments[idx] = shortened
len = len - (#segment - #shortened)
end
return table.concat(segments, sep)
end
M.init = function(self, options)
M.super.init(self, options)
self.options = vim.tbl_deep_extend('keep', self.options or {}, default_options)
end
M.update_status = function(self)
local data
if self.options.path == 1 then
-- relative path
data = vim.fn.expand('%:~:.')
elseif self.options.path == 2 then
-- absolute path
data = vim.fn.expand('%:p')
elseif self.options.path == 3 then
-- absolute path, with tilde
data = vim.fn.expand('%:p:~')
else
-- just filename
data = vim.fn.expand('%:t')
end
data = modules.utils.stl_escape(data)
if data == '' then
data = self.options.symbols.unnamed
end
if self.options.shorting_target ~= 0 then
local windwidth = self.options.globalstatus and vim.go.columns or vim.fn.winwidth(0)
local estimated_space_available = windwidth - self.options.shorting_target
local path_separator = package.config:sub(1, 1)
data = shorten_path(data, path_separator, estimated_space_available)
end
local symbols = {}
if self.options.file_status then
if vim.bo.modified then
table.insert(symbols, self.options.symbols.modified)
end
if vim.bo.modifiable == false or vim.bo.readonly == true then
table.insert(symbols, self.options.symbols.readonly)
end
end
if self.options.newfile_status and is_new_file() then
table.insert(symbols, self.options.symbols.newfile)
end
return data .. (#symbols > 0 and ' ' .. table.concat(symbols, '') or '')
end
return M

25
etc/soft/nvim/+plugins/lualine.nvim/lua/lualine/components/filesize.lua

@ -0,0 +1,25 @@ @@ -0,0 +1,25 @@
-- Copyright (c) 2020-2021 shadmansaleh
-- MIT license, see LICENSE for more details.
local function filesize()
local file = vim.fn.expand('%:p')
if file == nil or #file == 0 then
return ''
end
local size = vim.fn.getfsize(file)
if size <= 0 then
return ''
end
local suffixes = { 'b', 'k', 'm', 'g' }
local i = 1
while size > 1024 and i < #suffixes do
size = size / 1024
i = i + 1
end
local format = i == 1 and '%d%s' or '%.1f%s'
return string.format(format, size, suffixes[i])
end
return filesize

76
etc/soft/nvim/+plugins/lualine.nvim/lua/lualine/components/filetype.lua

@ -0,0 +1,76 @@ @@ -0,0 +1,76 @@
-- Copyright (c) 2020-2021 hoob3rt
-- MIT license, see LICENSE for more details.
local lualine_require = require('lualine_require')
local modules = lualine_require.lazy_require {
highlight = 'lualine.highlight',
utils = 'lualine.utils.utils',
}
local M = lualine_require.require('lualine.component'):extend()
local default_options = {
colored = true,
icon_only = false,
}
function M:init(options)
M.super.init(self, options)
self.options = vim.tbl_deep_extend('keep', self.options or {}, default_options)
self.icon_hl_cache = {}
end
function M.update_status()
local ft = vim.bo.filetype or ''
return modules.utils.stl_escape(ft)
end
function M:apply_icon()
if not self.options.icons_enabled then
return
end
local icon, icon_highlight_group
local ok, devicons = pcall(require, 'nvim-web-devicons')
if ok then
icon, icon_highlight_group = devicons.get_icon(vim.fn.expand('%:t'))
if icon == nil then
icon, icon_highlight_group = devicons.get_icon_by_filetype(vim.bo.filetype)
end
if icon == nil and icon_highlight_group == nil then
icon = ''
icon_highlight_group = 'DevIconDefault'
end
if self.options.colored then
local highlight_color = modules.utils.extract_highlight_colors(icon_highlight_group, 'fg')
if highlight_color then
local default_highlight = self:get_default_hl()
local icon_highlight = self.icon_hl_cache[highlight_color]
if not icon_highlight or not modules.highlight.highlight_exists(icon_highlight.name .. '_normal') then
icon_highlight = self:create_hl({ fg = highlight_color }, icon_highlight_group)
self.icon_hl_cache[highlight_color] = icon_highlight
end
icon = self:format_hl(icon_highlight) .. icon .. default_highlight
end
end
else
ok = vim.fn.exists('*WebDevIconsGetFileTypeSymbol')
if ok ~= 0 then
icon = vim.fn.WebDevIconsGetFileTypeSymbol()
end
end
if not icon then
return
end
if self.options.icon_only then
self.status = icon
elseif type(self.options.icon) == 'table' and self.options.icon.align == 'right' then
self.status = self.status .. ' ' .. icon
else
self.status = icon .. ' ' .. self.status
end
end
return M

11
etc/soft/nvim/+plugins/lualine.nvim/lua/lualine/components/hostname.lua

@ -0,0 +1,11 @@ @@ -0,0 +1,11 @@
-- Copyright (c) 2020-2021 hoob3rt
-- MIT license, see LICENSE for more details.
local modules = require('lualine_require').lazy_require {
utils = 'lualine.utils.utils',
}
local function hostname()
return modules.utils.stl_escape(vim.loop.os_gethostname())
end
return hostname

9
etc/soft/nvim/+plugins/lualine.nvim/lua/lualine/components/location.lua

@ -0,0 +1,9 @@ @@ -0,0 +1,9 @@
-- Copyright (c) 2020-2021 hoob3rt
-- MIT license, see LICENSE for more details.
local function location()
local line = vim.fn.line('.')
local col = vim.fn.virtcol('.')
return string.format('%3d:%-2d', line, col)
end
return location

4
etc/soft/nvim/+plugins/lualine.nvim/lua/lualine/components/mode.lua

@ -0,0 +1,4 @@ @@ -0,0 +1,4 @@
-- Copyright (c) 2020-2021 hoob3rt
-- MIT license, see LICENSE for more details.
local get_mode = require('lualine.utils.mode').get_mode
return get_mode

15
etc/soft/nvim/+plugins/lualine.nvim/lua/lualine/components/progress.lua

@ -0,0 +1,15 @@ @@ -0,0 +1,15 @@
-- Copyright (c) 2020-2021 hoob3rt
-- MIT license, see LICENSE for more details.
local function progress()
local cur = vim.fn.line('.')
local total = vim.fn.line('$')
if cur == 1 then
return 'Top'
elseif cur == total then
return 'Bot'
else
return math.floor(cur / total * 100) .. '%%'
end
end
return progress

11
etc/soft/nvim/+plugins/lualine.nvim/lua/lualine/components/searchcount.lua

@ -0,0 +1,11 @@ @@ -0,0 +1,11 @@
local function searchcount()
if vim.v.hlsearch == 0 then
return ''
end
local result = vim.fn.searchcount { maxcount = 999, timeout = 500 }
local denominator = math.min(result.total, result.maxcount)
return string.format('[%d/%d]', result.current, denominator)
end
return searchcount

48
etc/soft/nvim/+plugins/lualine.nvim/lua/lualine/components/special/eval_func_component.lua

@ -0,0 +1,48 @@ @@ -0,0 +1,48 @@
-- Copyright (c) 2020-2021 shadmansaleh
-- MIT license, see LICENSE for more details.
local M = require('lualine.component'):extend()
function M:update_status()
local component = self.options[1]
local ok, status
if self.options.type == nil then
ok, status = pcall(M.lua_eval, component)
if not ok then
status = M.vim_function(component)
end
else
if self.options.type == 'lua_expr' then
ok, status = pcall(M.lua_eval, component)
if not ok then
status = nil
end
elseif self.options.type == 'vim_fun' then
status = M.vim_function(component)
end
end
return status
end
---evaluate the lua code and return it's result as string
---@param code string
---@return string
function M.lua_eval(code)
local result = loadstring('return ' .. code)()
assert(result, 'String expected got nil')
return tostring(result)
end
---call vim function (name) and return it's result as string
---@param name string
---@return string
function M.vim_function(name)
-- vim function component
local ok, return_val = pcall(vim.api.nvim_call_function, name, {})
if not ok then
return ''
end -- function call failed
ok, return_val = pcall(tostring, return_val)
return ok and return_val or ''
end
return M

21
etc/soft/nvim/+plugins/lualine.nvim/lua/lualine/components/special/function_component.lua

@ -0,0 +1,21 @@ @@ -0,0 +1,21 @@
-- Copyright (c) 2020-2021 shadmansaleh
-- MIT license, see LICENSE for more details.
local M = require('lualine.component'):extend()
M.update_status = function(self, is_focused)
-- 1st element in options table is the function provided by config
local ok, retval
ok, retval = pcall(self.options[1], self, is_focused)
if not ok then
return ''
end
if type(retval) ~= 'string' then
ok, retval = pcall(tostring, retval)
if not ok then
return ''
end
end
return retval
end
return M

37
etc/soft/nvim/+plugins/lualine.nvim/lua/lualine/components/special/vim_var_component.lua

@ -0,0 +1,37 @@ @@ -0,0 +1,37 @@
-- Copyright (c) 2020-2021 shadmansaleh
-- MIT license, see LICENSE for more details.
local require = require('lualine_require').require
local M = require('lualine.component'):extend()
local utils = require('lualine.utils.utils')
function M:update_status()
local component = self.options[1]
-- vim variable component
-- accepts g:, v:, t:, w:, b:, o, go:, vo:, to:, wo:, bo:
-- filters g portion from g:var
local scope = component:match('[gvtwb]?o?')
-- filters var portion from g:var
local var_name = component:sub(#scope + 2, #component)
-- Displays nothing when variable aren't present
if not (scope and var_name) then
return ''
end
-- Support accessing keys within dictionary
-- https://github.com/nvim-lualine/lualine.nvim/issues/25#issuecomment-907374548
local name_chunks = vim.split(var_name, '%.')
local return_val = vim[scope][name_chunks[1]]
for i = 2, #name_chunks do
if return_val == nil then
break
end
return_val = return_val[name_chunks[i]]
end
if return_val == nil then
return ''
end
local ok
ok, return_val = pcall(tostring, return_val)
return ok and utils.stl_escape(return_val) or ''
end
return M

180
etc/soft/nvim/+plugins/lualine.nvim/lua/lualine/components/tabs/init.lua

@ -0,0 +1,180 @@ @@ -0,0 +1,180 @@
-- Copyright (c) 2020-2021 shadmansaleh
-- MIT license, see LICENSE for more details.
local require = require('lualine_require').require
local Tab = require('lualine.components.tabs.tab')
local M = require('lualine.component'):extend()
local highlight = require('lualine.highlight')
local default_options = {
max_length = 0,
mode = 0,
tabs_color = {
active = nil,
inactive = nil,
},
}
-- This function is duplicated in buffers
---returns the proper hl for tab in section. Used for setting default highlights
---@param section string name of section tabs component is in
---@param is_active boolean
---@return string hl name
local function get_hl(section, is_active)
local suffix = is_active and '_normal' or '_inactive'
local section_redirects = {
lualine_x = 'lualine_c',
lualine_y = 'lualine_b',
lualine_z = 'lualine_a',
}
if section_redirects[section] then
section = highlight.highlight_exists(section .. suffix) and section or section_redirects[section]
end
return section .. suffix
end
function M:init(options)
M.super.init(self, options)
default_options.tabs_color = {
active = get_hl('lualine_' .. options.self.section, true),
inactive = get_hl('lualine_' .. options.self.section, false),
}
self.options = vim.tbl_deep_extend('keep', self.options or {}, default_options)
-- stylua: ignore
self.highlights = {
active = self:create_hl( self.options.tabs_color.active, 'active'),
inactive = self:create_hl( self.options.tabs_color.inactive, 'inactive'),
}
end
function M:update_status()
local data = {}
local tabs = {}
for nr, id in ipairs(vim.api.nvim_list_tabpages()) do
tabs[#tabs + 1] = Tab { tabId = id, tabnr = nr, options = self.options, highlights = self.highlights }
end
-- mark the first, last, current, before current, after current tabpages
-- for rendering
local current = vim.fn.tabpagenr()
tabs[1].first = true
tabs[#tabs].last = true
if tabs[current] then
tabs[current].current = true
end
if tabs[current - 1] then
tabs[current - 1].beforecurrent = true
end
if tabs[current + 1] then
tabs[current + 1].aftercurrent = true
end
local max_length = self.options.max_length
if type(max_length) == 'function' then
max_length = max_length(self)
end
if max_length == 0 then
max_length = math.floor(vim.o.columns / 3)
end
local total_length
for i, tab in pairs(tabs) do
if tab.current then
current = i
end
end
local current_tab = tabs[current]
-- start drawing from current tab and draw left and right of it until
-- all tabpages are drawn or max_length has been reached.
if current_tab == nil then -- maybe redundant code
local t = Tab {
tabId = vim.api.nvim_get_current_tabpage(),
tabnr = vim.fn.tabpagenr(),
options = self.options,
highlights = self.highlights,
}
t.current = true
t.last = true
data[#data + 1] = t:render()
else
data[#data + 1] = current_tab:render()
total_length = current_tab.len
local i = 0
local before, after
while true do
i = i + 1
before = tabs[current - i]
after = tabs[current + i]
local rendered_before, rendered_after
if before == nil and after == nil then
break
end
-- draw left most undrawn tab if fits in max_length
if before then
rendered_before = before:render()
total_length = total_length + before.len
if total_length > max_length then
break
end
table.insert(data, 1, rendered_before)
end
-- draw right most undrawn tab if fits in max_length
if after then
rendered_after = after:render()
total_length = total_length + after.len
if total_length > max_length then
break
end
data[#data + 1] = rendered_after
end
end
-- draw ellipsis (...) on relevant sides if all tabs don't fit in max_length
if total_length > max_length then
if before ~= nil then
before.ellipse = true
before.first = true
table.insert(data, 1, before:render())
end
if after ~= nil then
after.ellipse = true
after.last = true
data[#data + 1] = after:render()
end
end
end
return table.concat(data)
end
function M:draw()
self.status = ''
self.applied_separator = ''
if self.options.cond ~= nil and self.options.cond() ~= true then
return self.status
end
local status = self:update_status()
if type(status) == 'string' and #status > 0 then
self.status = status
self:apply_section_separators()
self:apply_separator()
end
return self.status
end
vim.cmd([[
function! LualineSwitchTab(tabnr, mouseclicks, mousebutton, modifiers)
execute a:tabnr . "tabnext"
endfunction
function! LualineRenameTab(...)
if a:0 == 1
let t:tabname = a:1
else
unlet t:tabname
end
redrawtabline
endfunction
command! -nargs=? LualineRenameTab call LualineRenameTab("<args>")
]])
return M

119
etc/soft/nvim/+plugins/lualine.nvim/lua/lualine/components/tabs/tab.lua

@ -0,0 +1,119 @@ @@ -0,0 +1,119 @@
local Tab = require('lualine.utils.class'):extend()
local modules = require('lualine_require').lazy_require {
highlight = 'lualine.highlight',
utils = 'lualine.utils.utils',
}
---initialize a new tab from opts
---@param opts table
function Tab:init(opts)
assert(opts.tabnr, 'Cannot create Tab without tabnr')
self.tabnr = opts.tabnr
self.tabId = opts.tabId
self.options = opts.options
self.highlights = opts.highlights
end
---returns name for tab. Tabs name is the name of buffer in last active window
--- of the tab.
---@return string
function Tab:label()
local ok, custom_tabname = pcall(vim.api.nvim_tabpage_get_var, self.tabId, 'tabname')
if not ok then
custom_tabname = nil
end
if custom_tabname and custom_tabname ~= '' then
return modules.utils.stl_escape(custom_tabname)
end
local buflist = vim.fn.tabpagebuflist(self.tabnr)
local winnr = vim.fn.tabpagewinnr(self.tabnr)
local bufnr = buflist[winnr]
local file = modules.utils.stl_escape(vim.api.nvim_buf_get_name(bufnr))
local buftype = vim.fn.getbufvar(bufnr, '&buftype')
if buftype == 'help' then
return 'help:' .. vim.fn.fnamemodify(file, ':t:r')
elseif buftype == 'terminal' then
local match = string.match(vim.split(file, ' ')[1], 'term:.*:(%a+)')
return match ~= nil and match or vim.fn.fnamemodify(vim.env.SHELL, ':t')
elseif vim.fn.isdirectory(file) == 1 then
return vim.fn.fnamemodify(file, ':p:.')
elseif file == '' then
return '[No Name]'
end
return vim.fn.fnamemodify(file, ':t')
end
---returns rendered tab
---@return string
function Tab:render()
local name = self:label()
if self.options.fmt then
name = self.options.fmt(name or '')
end
if self.ellipse then -- show ellipsis
name = '...'
else
-- different formats for different modes
if self.options.mode == 0 then
name = tostring(self.tabnr)
elseif self.options.mode == 1 then
name = name
else
name = string.format('%s %s', tostring(self.tabnr), name)
end
end
name = Tab.apply_padding(name, self.options.padding)
self.len = vim.fn.strchars(name)
-- setup for mouse clicks
local line = string.format('%%%s@LualineSwitchTab@%s%%T', self.tabnr, name)
-- apply highlight
line = modules.highlight.component_format_highlight(self.highlights[(self.current and 'active' or 'inactive')])
.. line
-- apply separators
if self.options.self.section < 'x' and not self.first then
local sep_before = self:separator_before()
line = sep_before .. line
self.len = self.len + vim.fn.strchars(sep_before)
elseif self.options.self.section >= 'x' and not self.last then
local sep_after = self:separator_after()
line = line .. sep_after
self.len = self.len + vim.fn.strchars(sep_after)
end
return line
end
---apply separator before current tab
---@return string
function Tab:separator_before()
if self.current or self.aftercurrent then
return '%S{' .. self.options.section_separators.left .. '}'
else
return self.options.component_separators.left
end
end
---apply separator after current tab
---@return string
function Tab:separator_after()
if self.current or self.beforecurrent then
return '%s{' .. self.options.section_separators.right .. '}'
else
return self.options.component_separators.right
end
end
---adds spaces to left and right
function Tab.apply_padding(str, padding)
local l_padding, r_padding = 1, 1
if type(padding) == 'number' then
l_padding, r_padding = padding, padding
elseif type(padding) == 'table' then
l_padding, r_padding = padding.left or 0, padding.right or 0
end
return string.rep(' ', l_padding) .. str .. string.rep(' ', r_padding)
end
return Tab

64
etc/soft/nvim/+plugins/lualine.nvim/lua/lualine/components/windows/init.lua

@ -0,0 +1,64 @@ @@ -0,0 +1,64 @@
local Window = require('lualine.components.windows.window')
local M = require('lualine.components.buffers'):extend()
local default_options = {
disabled_filetypes = {},
disabled_buftypes = { 'quickfix', 'prompt' },
}
function M:init(options)
options.buffers_color = nil -- buffers_color isn't windows option.
M.super.init(self, options)
self.options = vim.tbl_deep_extend('keep', self.options or {}, default_options)
self.options.windows_color = vim.tbl_deep_extend('keep', self.options.windows_color or {}, self.options.buffers_color)
self.options.buffers_color = nil -- this is the default value of colors generated by parent buffers component.
self.highlights = {
active = self:create_hl(self.options.windows_color.active, 'active'),
inactive = self:create_hl(self.options.windows_color.inactive, 'inactive'),
}
end
function M:new_buffer(winnr)
winnr = winnr or vim.api.nvim_get_current_win()
return Window:new {
winnr = winnr,
options = self.options,
highlights = self.highlights,
}
end
--- Override to only return buffers shown in the windows of the current tab
function M:buffers()
local tabnr = vim.api.nvim_get_current_tabpage()
local buffers = {}
for _, winnr in ipairs(vim.api.nvim_tabpage_list_wins(tabnr)) do
if not self:should_hide(winnr) then
buffers[#buffers + 1] = self:new_buffer(winnr)
end
end
return buffers
end
function M:should_hide(winnr)
local bufnr = vim.api.nvim_win_get_buf(winnr)
local filetype = vim.api.nvim_buf_get_option(bufnr, 'filetype')
local buftype = vim.api.nvim_buf_get_option(bufnr, 'buftype')
local is_filetype_disabled = vim.tbl_contains(self.options.disabled_filetypes, filetype)
local is_buftype_disabled = vim.tbl_contains(self.options.disabled_buftypes, buftype)
local is_floating = '' ~= vim.api.nvim_win_get_config(winnr).relative
return is_floating or is_buftype_disabled or is_filetype_disabled
end
vim.cmd([[
function! LualineSwitchWindow(win_number, mouseclicks, mousebutton, modifiers)
execute a:win_number . 'wincmd w'
endfunction
]])
return M

35
etc/soft/nvim/+plugins/lualine.nvim/lua/lualine/components/windows/window.lua

@ -0,0 +1,35 @@ @@ -0,0 +1,35 @@
local Window = require('lualine.components.buffers.buffer'):extend()
---initialize a new buffer from opts
---@param opts table
function Window:init(opts)
assert(opts.winnr, 'Cannot create Window without winnr')
opts.bufnr = vim.api.nvim_win_get_buf(opts.winnr)
Window.super.init(self, opts)
self.winnr = opts.winnr
self.win_number = vim.api.nvim_win_get_number(self.winnr)
end
function Window:is_current()
return vim.api.nvim_get_current_win() == self.winnr
end
function Window:apply_mode(name)
if self.options.mode == 0 then
return string.format('%s%s%s', self.icon, name, self.modified_icon)
end
if self.options.mode == 1 then
return string.format('%s %s%s', self.win_number, self.icon, self.modified_icon)
end
return string.format('%s %s%s%s', self.win_number, self.icon, name, self.modified_icon)
end
function Window:configure_mouse_click(name)
return string.format('%%%s@LualineSwitchWindow@%s%%T', self.win_number, name)
end
return Window

141
etc/soft/nvim/+plugins/lualine.nvim/lua/lualine/config.lua

@ -0,0 +1,141 @@ @@ -0,0 +1,141 @@
-- Copyright (c) 2020-2021 hoob3rt
-- MIT license, see LICENSE for more details.
local require = require('lualine_require').require
local utils = require('lualine.utils.utils')
local modules = require('lualine_require').lazy_require {
utils_notices = 'lualine.utils.notices',
}
local config = {
options = {
icons_enabled = true,
theme = 'auto',
component_separators = { left = '', right = '' },
section_separators = { left = '', right = '' },
disabled_filetypes = {
statusline = {},
winbar = {},
},
ignore_focus = {},
always_divide_middle = true,
globalstatus = vim.go.laststatus == 3,
refresh = {
statusline = 1000,
tabline = 1000,
winbar = 1000,
},
},
sections = {
lualine_a = { 'mode' },
lualine_b = { 'branch', 'diff', 'diagnostics' },
lualine_c = { 'filename' },
lualine_x = { 'encoding', 'fileformat', 'filetype' },
lualine_y = { 'progress' },
lualine_z = { 'location' },
},
inactive_sections = {
lualine_a = {},
lualine_b = {},
lualine_c = { 'filename' },
lualine_x = { 'location' },
lualine_y = {},
lualine_z = {},
},
tabline = {},
winbar = {},
inactive_winbar = {},
extensions = {},
}
--- change separator format 'x' to {left='x', right='x'}
---@param separators string|table
---@return table
local function fix_separators(separators)
if separators ~= nil then
if type(separators) == 'string' then
return { left = separators, right = separators }
end
end
return separators
end
---copy raw disabled_filetypes to inner statusline & winbar tables.
---@param disabled_filetypes table
---@return table
local function fix_disabled_filetypes(disabled_filetypes)
if disabled_filetypes == nil then
return
end
if disabled_filetypes.statusline == nil then
disabled_filetypes.statusline = {}
end
if disabled_filetypes.winbar == nil then
disabled_filetypes.winbar = {}
end
for k, disabled_ft in ipairs(disabled_filetypes) do
table.insert(disabled_filetypes.statusline, disabled_ft)
table.insert(disabled_filetypes.winbar, disabled_ft)
disabled_filetypes[k] = nil
end
return disabled_filetypes
end
---extends config based on config_table
---@param config_table table
---@return table copy of config
local function apply_configuration(config_table)
if not config_table then
return utils.deepcopy(config)
end
local function parse_sections(section_group_name)
if config_table[section_group_name] == nil then
return
end
if not next(config_table[section_group_name]) then
config[section_group_name] = {}
return
end
for section_name, section in pairs(config_table[section_group_name]) do
if section_name == 'refresh' then
config[section_group_name][section_name] =
vim.tbl_deep_extend('force', config[section_group_name][section_name], utils.deepcopy(section))
else
config[section_group_name][section_name] = utils.deepcopy(section)
end
end
end
if config_table.options and config_table.options.globalstatus and vim.fn.has('nvim-0.7') == 0 then
modules.utils_notices.add_notice(
'### Options.globalstatus\nSorry `globalstatus` option can only be used in neovim 0.7 or higher.\n'
)
config_table.options.globalstatus = false
end
if vim.fn.has('nvim-0.8') == 0 and (next(config_table.winbar or {}) or next(config_table.inactive_winbar or {})) then
modules.utils_notices.add_notice('### winbar\nSorry `winbar can only be used in neovim 0.8 or higher.\n')
config_table.winbar = {}
config_table.inactive_winbar = {}
end
parse_sections('options')
parse_sections('sections')
parse_sections('inactive_sections')
parse_sections('tabline')
parse_sections('winbar')
parse_sections('inactive_winbar')
if config_table.extensions then
config.extensions = utils.deepcopy(config_table.extensions)
end
config.options.section_separators = fix_separators(config.options.section_separators)
config.options.component_separators = fix_separators(config.options.component_separators)
config.options.disabled_filetypes = fix_disabled_filetypes(config.options.disabled_filetypes)
return utils.deepcopy(config)
end
--- returns current active config
---@return table a copy of config
local function get_current_config()
return utils.deepcopy(config)
end
return {
get_config = get_current_config,
apply_configuration = apply_configuration,
}

9
etc/soft/nvim/+plugins/lualine.nvim/lua/lualine/extensions/aerial.lua

@ -0,0 +1,9 @@ @@ -0,0 +1,9 @@
-- MIT license, see LICENSE for more details.
-- Extension for aerial.nvim
local M = {}
M.sections = { lualine_a = { 'filetype' } }
M.filetypes = { 'aerial' }
return M

11
etc/soft/nvim/+plugins/lualine.nvim/lua/lualine/extensions/chadtree.lua

@ -0,0 +1,11 @@ @@ -0,0 +1,11 @@
-- Copyright (c) 2020-2021 hoob3rt
-- MIT license, see LICENSE for more details.
local nerdtree = require('lualine.extensions.nerdtree')
local M = {}
M.sections = vim.deepcopy(nerdtree.sections)
M.filetypes = { 'CHADTree' }
return M

11
etc/soft/nvim/+plugins/lualine.nvim/lua/lualine/extensions/fern.lua

@ -0,0 +1,11 @@ @@ -0,0 +1,11 @@
-- MIT license, see LICENSE for more details.
-- Extension for fern file explorer.
local nerdtree = require('lualine.extensions.nerdtree')
local M = {}
M.sections = vim.deepcopy(nerdtree.sections)
M.filetypes = { 'fern' }
return M

17
etc/soft/nvim/+plugins/lualine.nvim/lua/lualine/extensions/fugitive.lua

@ -0,0 +1,17 @@ @@ -0,0 +1,17 @@
-- Copyright (c) 2020-2021 hoob3rt
-- MIT license, see LICENSE for more details.
local M = {}
local function fugitive_branch()
local icon = '' -- e0a0
return icon .. ' ' .. vim.fn.FugitiveHead()
end
M.sections = {
lualine_a = { fugitive_branch },
lualine_z = { 'location' },
}
M.filetypes = { 'fugitive' }
return M

46
etc/soft/nvim/+plugins/lualine.nvim/lua/lualine/extensions/fzf.lua

@ -0,0 +1,46 @@ @@ -0,0 +1,46 @@
--[[
lualine extension for fzf filetypes:
works with both https://github.com/junegunn/fzf.vim and https://github.com/ibhagwan/fzf-lua
-- fzf-lua must be set-up in split mode
]]
local fzf_lua, _ = pcall(require, 'fzf-lua')
local function fzf_picker()
if not fzf_lua then
return ''
end
local info_string = vim.inspect(require('fzf-lua').get_info()['fnc'])
return info_string:gsub('"', '')
end
local function fzf_element()
if not fzf_lua then
return ''
end
local info_string = vim.inspect(require('fzf-lua').get_info()['selected'])
local lines = {}
for w in info_string:gsub('"', ''):gmatch('%S+') do
table.insert(lines, w)
end
return lines[1]
end
local function fzf_statusline()
return 'FZF'
end
local M = {}
M.sections = {
lualine_a = { fzf_statusline },
lualine_y = { fzf_element },
lualine_z = { fzf_picker },
}
M.filetypes = { 'fzf' }
return M

16
etc/soft/nvim/+plugins/lualine.nvim/lua/lualine/extensions/man.lua

@ -0,0 +1,16 @@ @@ -0,0 +1,16 @@
local M = {}
M.sections = {
lualine_a = {
function()
return 'MAN'
end,
},
lualine_b = { { 'filename', file_status = false } },
lualine_y = { 'progress' },
lualine_z = { 'location' },
}
M.filetypes = { 'man' }
return M

19
etc/soft/nvim/+plugins/lualine.nvim/lua/lualine/extensions/mundo.lua

@ -0,0 +1,19 @@ @@ -0,0 +1,19 @@
local M = {}
M.sections = {
lualine_a = {
function()
local ft = vim.opt_local.filetype:get()
return (ft == 'Mundo') and 'Change tree' or (ft == 'MundoDiff') and 'Change diff'
end,
},
lualine_y = { 'progress' },
lualine_z = { 'location' },
}
M.filetypes = {
'Mundo',
'MundoDiff',
}
return M

11
etc/soft/nvim/+plugins/lualine.nvim/lua/lualine/extensions/neo-tree.lua

@ -0,0 +1,11 @@ @@ -0,0 +1,11 @@
-- Copyright (c) 2020-2021 hoob3rt
-- MIT license, see LICENSE for more details.
local nerdtree = require('lualine.extensions.nerdtree')
local M = {}
M.sections = vim.deepcopy(nerdtree.sections)
M.filetypes = { 'neo-tree' }
return M

15
etc/soft/nvim/+plugins/lualine.nvim/lua/lualine/extensions/nerdtree.lua

@ -0,0 +1,15 @@ @@ -0,0 +1,15 @@
-- Copyright (c) 2020-2021 hoob3rt
-- MIT license, see LICENSE for more details.
local function get_short_cwd()
return vim.fn.fnamemodify(vim.fn.getcwd(), ':~')
end
local M = {}
M.sections = {
lualine_a = { get_short_cwd },
}
M.filetypes = { 'nerdtree' }
return M

18
etc/soft/nvim/+plugins/lualine.nvim/lua/lualine/extensions/nvim-dap-ui.lua

@ -0,0 +1,18 @@ @@ -0,0 +1,18 @@
-- MIT license, see LICENSE for more details.
-- Extension for nvim-dap-ui
local M = {}
M.sections = {
lualine_a = { { 'filename', file_status = false } },
}
M.filetypes = {
'dap-repl',
'dapui_console',
'dapui_watches',
'dapui_stacks',
'dapui_breakpoints',
'dapui_scopes',
}
return M

11
etc/soft/nvim/+plugins/lualine.nvim/lua/lualine/extensions/nvim-tree.lua

@ -0,0 +1,11 @@ @@ -0,0 +1,11 @@
-- Copyright (c) 2020-2021 hoob3rt
-- MIT license, see LICENSE for more details.
local nerdtree = require('lualine.extensions.nerdtree')
local M = {}
M.sections = vim.deepcopy(nerdtree.sections)
M.filetypes = { 'NvimTree' }
return M

16
etc/soft/nvim/+plugins/lualine.nvim/lua/lualine/extensions/overseer.lua

@ -0,0 +1,16 @@ @@ -0,0 +1,16 @@
-- Copyright (c) 2020-2021 hoob3rt
-- MIT license, see LICENSE for more details.
local M = {}
M.sections = {
lualine_a = {
function()
return 'OverseerList'
end,
},
}
M.filetypes = { 'OverseerList' }
return M

34
etc/soft/nvim/+plugins/lualine.nvim/lua/lualine/extensions/quickfix.lua

@ -0,0 +1,34 @@ @@ -0,0 +1,34 @@
-- Copyright (c) 2020-2021 hoob3rt
-- MIT license, see LICENSE for more details.
--
local function is_loclist()
return vim.fn.getloclist(0, { filewinid = 1 }).filewinid ~= 0
end
local function label()
return is_loclist() and 'Location List' or 'Quickfix List'
end
local function title()
if is_loclist() then
return vim.fn.getloclist(0, { title = 0 }).title
end
return vim.fn.getqflist({ title = 0 }).title
end
local M = {}
function M.init()
-- Make sure ft wf doesn't create a custom statusline
vim.g.qf_disable_statusline = true
end
M.sections = {
lualine_a = { label },
lualine_b = { title },
lualine_z = { 'location' },
}
M.filetypes = { 'qf' }
return M

9
etc/soft/nvim/+plugins/lualine.nvim/lua/lualine/extensions/symbols-outline.lua

@ -0,0 +1,9 @@ @@ -0,0 +1,9 @@
-- Copyright (c) 2020-2021 hoob3rt
-- MIT license, see LICENSE for more details.
local M = {}
M.sections = { lualine_a = { 'filetype' } }
M.filetypes = { 'Outline' }
return M

16
etc/soft/nvim/+plugins/lualine.nvim/lua/lualine/extensions/toggleterm.lua

@ -0,0 +1,16 @@ @@ -0,0 +1,16 @@
-- Copyright (c) 2020-2021 hoob3rt
-- MIT license, see LICENSE for more details.
local function toggleterm_statusline()
return 'ToggleTerm #' .. vim.b.toggle_number
end
local M = {}
M.sections = {
lualine_a = { toggleterm_statusline },
}
M.filetypes = { 'toggleterm' }
return M

474
etc/soft/nvim/+plugins/lualine.nvim/lua/lualine/highlight.lua

@ -0,0 +1,474 @@ @@ -0,0 +1,474 @@
-- Copyright (c) 2020-2021 hoob3rt
-- MIT license, see LICENSE for more details.
local M = {}
local lualine_require = require('lualine_require')
local require = lualine_require.require
local modules = lualine_require.lazy_require {
utils = 'lualine.utils.utils',
color_utils = 'lualine.utils.color_utils',
}
local section_highlight_map = { x = 'c', y = 'b', z = 'a' }
local active_theme = nil
local theme_hls = {}
local create_cterm_colors = false
-- table to store the highlight names created by lualine
local loaded_highlights = {}
-- table to map mode to highlight suffixes
local mode_to_highlight = {
['VISUAL'] = '_visual',
['V-BLOCK'] = '_visual',
['V-LINE'] = '_visual',
['SELECT'] = '_visual',
['S-LINE'] = '_visual',
['S-BLOCK'] = '_visual',
['REPLACE'] = '_replace',
['V-REPLACE'] = '_replace',
['INSERT'] = '_insert',
['COMMAND'] = '_command',
['EX'] = '_command',
['MORE'] = '_command',
['CONFIRM'] = '_command',
['TERMINAL'] = '_terminal',
}
--- determine if an highlight exist and isn't cleared
---@param highlight_name string
---@return boolean whether hl_group was defined with highlight_name
function M.highlight_exists(highlight_name)
return loaded_highlights[highlight_name] or false
end
--- clears loaded_highlights table and highlights
local function clear_highlights()
for highlight_name, _ in pairs(loaded_highlights) do
vim.cmd('highlight clear ' .. highlight_name)
end
loaded_highlights = {}
end
---converts cterm, color_name type colors to #rrggbb format
---@param color string|number
---@return string
local function sanitize_color(color)
if color == nil or color == '' or (type(color) == 'string' and color:lower() == 'none') then
return 'None'
end
if type(color) == 'string' then
if color:sub(1, 1) == '#' then
return color
end -- RGB value
return modules.color_utils.color_name2rgb(color)
elseif type(color) == 'number' then
if color > 255 then
error("What's this it can't be higher then 255 and you've given " .. color)
end
return modules.color_utils.cterm2rgb(color)
end
end
function M.get_lualine_hl(name)
local hl = loaded_highlights[name]
if hl and not hl.empty then
if hl.link then
return modules.utils.extract_highlight_colors(hl.link)
end
local hl_def = {
fg = hl.fg ~= 'None' and vim.deepcopy(hl.fg) or nil,
bg = hl.bg ~= 'None' and vim.deepcopy(hl.bg) or nil,
sp = hl.sp ~= 'None' and vim.deepcopy(hl.sp) or nil,
}
if hl.gui then
for _, flag in ipairs(vim.split(hl.gui, ',')) do
if flag ~= 'None' then
hl_def[flag] = true
end
end
end
return hl_def
end
end
--- Define a hl_group
---@param name string
---@param foreground string|number: color
---@param background string|number: color
---@param gui table cterm/gui options like bold/italic etc.
---@param link string hl_group name to link new hl to
function M.highlight(name, foreground, background, gui, link)
local command = { 'highlight!' }
if link and #link > 0 then
if loaded_highlights[name] and loaded_highlights[name].link == link then
return
end
vim.list_extend(command, { 'link', name, link })
else
foreground = sanitize_color(foreground)
background = sanitize_color(background)
gui = (gui ~= nil and gui ~= '') and gui or 'None'
if
loaded_highlights[name]
and loaded_highlights[name].fg == foreground
and loaded_highlights[name].bg == background
and loaded_highlights[name].gui == gui
then
return -- color is already defined why are we doing this anyway ?
end
table.insert(command, name)
table.insert(command, 'guifg=' .. foreground)
table.insert(command, 'guibg=' .. background)
table.insert(command, 'gui=' .. gui)
if create_cterm_colors then
table.insert(command, 'ctermfg=' .. modules.color_utils.rgb2cterm(foreground))
table.insert(command, 'ctermbg=' .. modules.color_utils.rgb2cterm(background))
table.insert(command, 'cterm=' .. gui)
end
end
vim.cmd(table.concat(command, ' '))
-- update attached hl groups
local old_hl_def = loaded_highlights[name]
if old_hl_def and next(old_hl_def.attached) then
-- Update attached hl groups as they announced to depend on hl_group 'name'
-- 'hl' being in 'name's attached table means 'hl'
-- depends of 'name'.
-- 'hl' key in attached table will contain a table that
-- defines the relation between 'hl' & 'name'.
-- name.attached.hl = { bg = 'fg' } means
-- hl's fg is same as 'names' bg . So 'hl's fg should
-- be updated when ever 'name' changes it's 'bg'
local bg_changed = old_hl_def.bg ~= background
local fg_changed = old_hl_def.bg ~= foreground
local gui_changed = old_hl_def.gui ~= gui
for attach_name, attach_desc in pairs(old_hl_def.attached) do
if bg_changed and attach_desc.bg and loaded_highlights[attach_name] then
M.highlight(
attach_name,
attach_desc.bg == 'fg' and background or loaded_highlights[attach_name].fg,
attach_desc.bg == 'bg' and background or loaded_highlights[attach_name].bg,
loaded_highlights[attach_name].gui,
loaded_highlights[attach_name].link
)
end
if fg_changed and attach_desc.fg and loaded_highlights[attach_name] then
M.highlight(
attach_name,
attach_desc.fg == 'fg' and foreground or loaded_highlights[attach_name].fg,
attach_desc.fg == 'bg' and foreground or loaded_highlights[attach_name].bg,
loaded_highlights[attach_name].gui,
loaded_highlights[attach_name].link
)
end
if gui_changed and attach_desc.gui and loaded_highlights[attach_name] then
M.highlight(
attach_name,
loaded_highlights[attach_name].fg,
loaded_highlights[attach_name].bg,
gui,
loaded_highlights[attach_name].link
)
end
end
end
-- store current hl state
loaded_highlights[name] = {
fg = foreground,
bg = background,
gui = gui,
link = link,
attached = old_hl_def and old_hl_def.attached or {},
}
end
---Attach a hl to another, so the attachee auto updates on change to hl that it's attached too.
---@param provider string the hl receiver is getting attached to
---@param receiver string the hl that will be auto updated upon change to provider
---@param provider_el_type string (fg/bg) what element receiver relates to of provider
---@param receiver_el_type string (fg/bg) what element provider relates to of receiver
local function attach_hl(provider, receiver, provider_el_type, receiver_el_type)
if loaded_highlights[provider] == nil then
loaded_highlights[provider] = { empty = true, attached = {} }
end
loaded_highlights[provider].attached[receiver] = { [provider_el_type] = receiver_el_type }
end
---define hl_groups for a theme
---@param theme table
function M.create_highlight_groups(theme)
clear_highlights()
active_theme = theme
theme_hls = {}
local psudo_options = { self = { section = 'a' } }
create_cterm_colors = not vim.go.termguicolors
for mode, sections in pairs(theme) do
theme_hls[mode] = {}
for section, color in pairs(sections) do
local hl_tag = mode
psudo_options.self.section = section
theme_hls[mode][section] = M.create_component_highlight_group(color, hl_tag, psudo_options, true)
end
end
end
---@description: adds '_mode' at end of highlight_group
---@param highlight_group string name of highlight group
---@return string highlight group name with mode
local function append_mode(highlight_group, is_focused)
if is_focused == nil then
is_focused = modules.utils.is_focused()
end
if is_focused == false then
return highlight_group .. '_inactive'
end
local mode = require('lualine.utils.mode').get_mode()
return highlight_group .. (mode_to_highlight[mode] or '_normal')
end
-- Helper function for create component highlight
---Handles fall back of colors when creating highlight group
---@param hl_name string name of highlight that we are setting default values for
---@param mode string mode which default component color should be given.
---@param section string the lualine section component is in.
---@param color table color passed for creating component highlight
---@param options table Options table of component this is first fall back
local function get_default_component_color(hl_name, mode, section, color, options)
local default_theme_color
if active_theme[mode] and active_theme[mode][section] then
default_theme_color = active_theme[mode][section]
elseif section >= 'c' and active_theme[mode] and active_theme[mode][section_highlight_map[section]] then
default_theme_color = active_theme[mode][section_highlight_map[section]]
elseif section >= 'c' and active_theme.normal[section_highlight_map[section]] then
default_theme_color = active_theme.normal[section_highlight_map[section]]
else
default_theme_color = active_theme.normal[section]
end
local ret = { fg = color.fg, bg = color.bg, gui = color.gui }
if ret.fg and ret.bg then
return ret
end
local function apply_default(def_color, def_name)
if type(def_color) == 'function' and loaded_highlights[def_name] and not loaded_highlights[def_name].empty then
if loaded_highlights[def_name].link then
def_color = loaded_highlights[def_name].link
else
def_color = loaded_highlights[def_name]
end
end
if type(def_color) == 'function' then
def_color = def_color { section = section }
end
if type(def_color) == 'string' then
def_color = modules.utils.extract_highlight_colors(def_color)
end
if type(def_color) == 'table' then
if not ret.fg then
ret.fg = def_color.fg
attach_hl(def_name, hl_name, 'fg', 'fg')
end
if not ret.bg then
ret.bg = def_color.bg
attach_hl(def_name, hl_name, 'bg', 'bg')
end
end
end
if
options.color
and options.color_highlight
and options.color_highlight.name
and options.color_highlight.name .. '_' .. mode ~= hl_name
then
apply_default(options.color, options.color_highlight.name .. '_' .. mode)
end
if not ret.fg or not ret.bg then
apply_default(default_theme_color, string.format('lualine_%s_%s', section, mode))
end
ret.fg = sanitize_color(ret.fg)
ret.bg = sanitize_color(ret.bg)
return ret
end
---Create highlight group with fg bg and gui from theme
---@param color table has to be { fg = "#rrggbb", bg="#rrggbb" gui = "effect" }
--- all the color elements are optional if fg or bg is not given options
--- must be provided So fg and bg can default the themes colors
---@param highlight_tag string is unique tag for highlight group
---returns the name of highlight group
---@param options table is parameter of component.init() function
---@return table that can be used by component_format_highlight
--- to retrieve highlight group
function M.create_component_highlight_group(color, highlight_tag, options, apply_no_default)
local section = options.self.section
local tag_id = 0
while
M.highlight_exists(table.concat({ 'lualine', section, highlight_tag }, '_'))
or (section and M.highlight_exists(table.concat({ 'lualine', section, highlight_tag, 'normal' }, '_')))
do
highlight_tag = highlight_tag .. '_' .. tostring(tag_id)
tag_id = tag_id + 1
end
if type(color) == 'string' then
local highlight_group_name = table.concat({ 'lualine', section, highlight_tag }, '_')
M.highlight(highlight_group_name, nil, nil, nil, color) -- l8nk to group
return {
name = highlight_group_name,
fn = nil,
no_mode = true,
link = true,
section = section,
options = options,
no_default = apply_no_default,
}
end
if type(color) ~= 'function' and (apply_no_default or (color.bg and color.fg)) then
-- When bg and fg are both present we donn't need to set highlighs for
-- each mode as they will surely look the same. So we can work without options
local highlight_group_name = table.concat({ 'lualine', section, highlight_tag }, '_')
M.highlight(highlight_group_name, color.fg, color.bg, color.gui, nil)
return {
name = highlight_group_name,
fn = nil,
no_mode = true,
section = section,
options = options,
no_default = apply_no_default,
}
end
local modes = {
'normal',
'insert',
'visual',
'replace',
'command',
'terminal',
'inactive',
}
for _, mode in ipairs(modes) do
local hl_name = table.concat({ 'lualine', section, highlight_tag, mode }, '_')
local cl = color
if type(color) == 'function' then
cl = color { section = section } or {}
end
if type(cl) == 'string' then
cl = { link = cl }
else
cl = get_default_component_color(hl_name, mode, section, cl, options)
end
M.highlight(hl_name, cl.fg, cl.bg, cl.gui, cl.link)
end
return {
name = table.concat({ 'lualine', section, highlight_tag }, '_'),
fn = type(color) == 'function' and color,
no_mode = false,
link = false,
section = section,
options = options,
no_default = apply_no_default,
}
end
---@description: retrieve highlight_groups for components
---@param highlight table return value of create_component_highlight_group
--- return value of create_component_highlight_group is to be passed in
--- this parameter to receive highlight that was created
---@return string formatted highlight group name
function M.component_format_highlight(highlight, is_focused)
if not highlight.fn then
local highlight_group = highlight.name
if highlight.no_mode then
return '%#' .. highlight_group .. '#'
end
highlight_group = append_mode(highlight_group, is_focused)
return '%#' .. highlight_group .. '#'
else
local color = highlight.fn { section = highlight.section } or {}
local hl_name = highlight.name
if type(color) == 'string' then
M.highlight(hl_name, nil, nil, nil, color)
return '%#' .. hl_name .. '#'
elseif type(color) == 'table' then
if not highlight.no_default and not (color.fg and color.bg) then
hl_name = append_mode(highlight.name, is_focused)
color =
get_default_component_color(hl_name, append_mode(''):sub(2), highlight.section, color, highlight.options)
end
M.highlight(hl_name, color.fg, color.bg, color.gui, color.link)
return '%#' .. hl_name .. '#', color
end
end
end
---@description: retrieve highlight_groups for section
---@param section string highlight group name without mode
--- return value of create_component_highlight_group is to be passed in
--- this parameter to receive highlight that was created
---@param is_focused boolean
---@return string formatted highlight group name
function M.format_highlight(section, is_focused)
local mode = append_mode('', is_focused):sub(2)
local ret = ''
if theme_hls[mode] and theme_hls[mode][section] then
ret = M.component_format_highlight(theme_hls[mode][section], is_focused)
elseif theme_hls[mode] and section > 'c' and theme_hls[mode][section_highlight_map[section]] then
ret = M.component_format_highlight(theme_hls[mode][section_highlight_map[section]], is_focused)
elseif theme_hls['normal'] and theme_hls['normal'][section] then
ret = M.component_format_highlight(theme_hls['normal'][section], is_focused)
elseif theme_hls['normal'] and section > 'c' and theme_hls['normal'][section_highlight_map[section]] then
ret = M.component_format_highlight(theme_hls['normal'][section_highlight_map[section]], is_focused)
end
return ret
end
---@description : Provides transitional highlights for section separators.
---@param left_hl string this highlights bg is used for fg of transitional hl
---@param right_hl string this highlights bg is used for bg of transitional hl
--- '▶' and '◀' ' needs reverse colors so the caller should swap left and right
---@return string formatted highlight group name
function M.get_transitional_highlights(left_hl, right_hl)
-- When both left and right highlights are same or one is absent
-- nothing to transition to.
if left_hl == nil or right_hl == nil or left_hl == right_hl then
return nil
end
-- construct the name of highlight group
local highlight_name = table.concat({ 'lualine_transitional', left_hl, 'to', right_hl }, '_')
if not M.highlight_exists(highlight_name) then
-- Create the highlight_group if needed
-- Get colors from highlights
local fg = modules.utils.extract_highlight_colors(left_hl, 'bg')
local bg = modules.utils.extract_highlight_colors(right_hl, 'bg')
if not fg and not bg then
return nil -- Color retrieval failed
end
if bg == fg then
return nil -- Separator won't be visible anyway
end
M.highlight(highlight_name, fg, bg, nil, nil)
attach_hl(left_hl, highlight_name, 'bg', 'fg')
attach_hl(right_hl, highlight_name, 'bg', 'bg')
end
return '%#' .. highlight_name .. '#'
end
function M.get_stl_default_hl(focused)
if focused == 3 then
return 'TabLineFill'
elseif not focused then
return 'StatusLineNC'
else
return 'StatusLine'
end
end
return M

38
etc/soft/nvim/+plugins/lualine.nvim/lua/lualine/themes/16color.lua

@ -0,0 +1,38 @@ @@ -0,0 +1,38 @@
-- Copyright (c) 2020-2021 shadmansaleh
-- MIT license, see LICENSE for more details.
-- Credit itchyny, jackno (lightline)
-- stylua: ignore
local colors = {
black = '#000000',
maroon = '#800000',
green = '#008000',
olive = '#808000',
navy = '#000080',
purple = '#800080',
teal = '#008080',
silver = '#c0c0c0',
gray = '#808080',
red = '#ff0000',
lime = '#00ff00',
yellow = '#ffff00',
blue = '#0000ff',
fuchsia = '#ff00ff',
aqua = '#00ffff',
white = '#ffffff',
}
return {
normal = {
a = { fg = colors.white, bg = colors.blue, gui = 'bold' },
b = { fg = colors.white, bg = colors.gray },
c = { fg = colors.silver, bg = colors.black },
},
insert = { a = { fg = colors.white, bg = colors.green, gui = 'bold' } },
visual = { a = { fg = colors.white, bg = colors.purple, gui = 'bold' } },
replace = { a = { fg = colors.white, bg = colors.red, gui = 'bold' } },
inactive = {
a = { fg = colors.silver, bg = colors.gray, gui = 'bold' },
b = { fg = colors.gray, bg = colors.black },
c = { fg = colors.silver, bg = colors.black },
},
}

43
etc/soft/nvim/+plugins/lualine.nvim/lua/lualine/themes/OceanicNext.lua

@ -0,0 +1,43 @@ @@ -0,0 +1,43 @@
-- Copyright (c) 2020-2021 shadmansaleh
-- MIT license, see LICENSE for more details.
-- Generated by lightline to lualine theme converter
-- https://gist.github.com/shadmansaleh/000871c9a608a012721c6acc6d7a19b9
-- stylua: ignore
local colors = {
color0 = '#ffffff',
color1 = '#99c794',
color2 = '#65737e',
color3 = '#343d46',
color4 = '#6699cc',
color5 = '#d8dee9',
color6 = '#f99157',
color7 = '#ec5f67',
}
return {
insert = {
a = { fg = colors.color0, bg = colors.color1, gui = 'bold' },
b = { fg = colors.color0, bg = colors.color2 },
c = { fg = colors.color0, bg = colors.color3 },
},
normal = {
a = { fg = colors.color0, bg = colors.color4, gui = 'bold' },
b = { fg = colors.color0, bg = colors.color2 },
c = { fg = colors.color0, bg = colors.color3 },
},
inactive = {
a = { fg = colors.color5, bg = colors.color2, gui = 'bold' },
b = { fg = colors.color5, bg = colors.color3 },
c = { fg = colors.color2, bg = colors.color3 },
},
visual = {
a = { fg = colors.color0, bg = colors.color6, gui = 'bold' },
b = { fg = colors.color0, bg = colors.color2 },
c = { fg = colors.color0, bg = colors.color3 },
},
replace = {
a = { fg = colors.color0, bg = colors.color7, gui = 'bold' },
b = { fg = colors.color0, bg = colors.color2 },
c = { fg = colors.color0, bg = colors.color3 },
},
}

6
etc/soft/nvim/+plugins/lualine.nvim/lua/lualine/themes/PaperColor.lua

@ -0,0 +1,6 @@ @@ -0,0 +1,6 @@
-- Copyright (c) 2020-2021 shadmansaleh
-- MIT license, see LICENSE for more details.
-- Credit: itchyny(lightline)
local background = vim.opt.background:get()
return require('lualine.themes.papercolor_' .. background)

43
etc/soft/nvim/+plugins/lualine.nvim/lua/lualine/themes/Tomorrow.lua

@ -0,0 +1,43 @@ @@ -0,0 +1,43 @@
-- Copyright (c) 2020-2021 shadmansaleh
-- MIT license, see LICENSE for more details.
-- Generated by lightline to lualine theme converter
-- https://gist.github.com/shadmansaleh/000871c9a608a012721c6acc6d7a19b9
-- stylua: ignore
local colors = {
color14 = '#718c00',
color0 = '#666666',
color1 = '#c8c8c8',
color2 = '#808080',
color3 = '#fafafa',
color4 = '#4271ae',
color5 = '#4d4d4c',
color6 = '#b4b4b4',
color7 = '#555555',
color8 = '#8959a8',
color11 = '#f5871f',
}
return {
inactive = {
a = { fg = colors.color0, bg = colors.color1, gui = 'bold' },
b = { fg = colors.color2, bg = colors.color3 },
c = { fg = colors.color0, bg = colors.color1 },
},
normal = {
a = { fg = colors.color1, bg = colors.color4, gui = 'bold' },
b = { fg = colors.color5, bg = colors.color6 },
c = { fg = colors.color7, bg = colors.color1 },
},
visual = {
a = { fg = colors.color1, bg = colors.color8, gui = 'bold' },
b = { fg = colors.color5, bg = colors.color6 },
},
replace = {
a = { fg = colors.color1, bg = colors.color11, gui = 'bold' },
b = { fg = colors.color5, bg = colors.color6 },
},
insert = {
a = { fg = colors.color1, bg = colors.color14, gui = 'bold' },
b = { fg = colors.color5, bg = colors.color6 },
},
}

174
etc/soft/nvim/+plugins/lualine.nvim/lua/lualine/themes/auto.lua

@ -0,0 +1,174 @@ @@ -0,0 +1,174 @@
-- Copyright (c) 2020-2021 shadmansaleh
-- MIT license, see LICENSE for more details.
local utils = require('lualine.utils.utils')
local loader = require('lualine.utils.loader')
local color_name = vim.g.colors_name
if color_name then
-- All base16 colorschemes share the same theme
if 'base16' == color_name:sub(1, 6) then
color_name = 'base16'
end
-- Check if there's a theme for current colorscheme
-- If there is load that instead of generating a new one
local ok, theme = pcall(loader.load_theme, color_name)
if ok and theme then
return theme
end
end
---------------
-- Constants --
---------------
-- fg and bg must have this much contrast range 0 < contrast_threshold < 0.5
local contrast_threshold = 0.3
-- how much brightness is changed in percentage for light and dark themes
local brightness_modifier_parameter = 10
-- Turns #rrggbb -> { red, green, blue }
local function rgb_str2num(rgb_color_str)
if rgb_color_str:find('#') == 1 then
rgb_color_str = rgb_color_str:sub(2, #rgb_color_str)
end
local red = tonumber(rgb_color_str:sub(1, 2), 16)
local green = tonumber(rgb_color_str:sub(3, 4), 16)
local blue = tonumber(rgb_color_str:sub(5, 6), 16)
return { red = red, green = green, blue = blue }
end
-- Turns { red, green, blue } -> #rrggbb
local function rgb_num2str(rgb_color_num)
local rgb_color_str = string.format('#%02x%02x%02x', rgb_color_num.red, rgb_color_num.green, rgb_color_num.blue)
return rgb_color_str
end
-- Returns brightness level of color in range 0 to 1
-- arbitrary value it's basically an weighted average
local function get_color_brightness(rgb_color)
local color = rgb_str2num(rgb_color)
local brightness = (color.red * 2 + color.green * 3 + color.blue) / 6
return brightness / 256
end
-- returns average of colors in range 0 to 1
-- used to determine contrast level
local function get_color_avg(rgb_color)
local color = rgb_str2num(rgb_color)
return (color.red + color.green + color.blue) / 3 / 256
end
-- Clamps the val between left and right
local function clamp(val, left, right)
if val > right then
return right
end
if val < left then
return left
end
return val
end
-- Changes brightness of rgb_color by percentage
local function brightness_modifier(rgb_color, parcentage)
local color = rgb_str2num(rgb_color)
color.red = clamp(color.red + (color.red * parcentage / 100), 0, 255)
color.green = clamp(color.green + (color.green * parcentage / 100), 0, 255)
color.blue = clamp(color.blue + (color.blue * parcentage / 100), 0, 255)
return rgb_num2str(color)
end
-- Changes contrast of rgb_color by amount
local function contrast_modifier(rgb_color, amount)
local color = rgb_str2num(rgb_color)
color.red = clamp(color.red + amount, 0, 255)
color.green = clamp(color.green + amount, 0, 255)
color.blue = clamp(color.blue + amount, 0, 255)
return rgb_num2str(color)
end
-- Changes brightness of foreground color to achieve contrast
-- without changing the color
local function apply_contrast(highlight)
local hightlight_bg_avg = get_color_avg(highlight.bg)
local contrast_threshold_config = clamp(contrast_threshold, 0, 0.5)
local contranst_change_step = 5
if hightlight_bg_avg > 0.5 then
contranst_change_step = -contranst_change_step
end
-- Don't waste too much time here max 25 iteration should be more than enough
local iteration_count = 1
while
math.abs(get_color_avg(highlight.fg) - hightlight_bg_avg) < contrast_threshold_config and iteration_count < 25
do
highlight.fg = contrast_modifier(highlight.fg, contranst_change_step)
iteration_count = iteration_count + 1
end
end
-- Get the colors to create theme
-- stylua: ignore
local colors = {
normal = utils.extract_color_from_hllist('bg', { 'PmenuSel', 'PmenuThumb', 'TabLineSel' }, '#000000'),
insert = utils.extract_color_from_hllist('fg', { 'String', 'MoreMsg' }, '#000000'),
replace = utils.extract_color_from_hllist('fg', { 'Number', 'Type' }, '#000000'),
visual = utils.extract_color_from_hllist('fg', { 'Special', 'Boolean', 'Constant' }, '#000000'),
command = utils.extract_color_from_hllist('fg', { 'Identifier' }, '#000000'),
back1 = utils.extract_color_from_hllist('bg', { 'Normal', 'StatusLineNC' }, '#000000'),
fore = utils.extract_color_from_hllist('fg', { 'Normal', 'StatusLine' }, '#000000'),
back2 = utils.extract_color_from_hllist('bg', { 'StatusLine' }, '#000000'),
}
-- Change brightness of colors
-- Darken if light theme (or) Lighten if dark theme
local normal_color = utils.extract_highlight_colors('Normal', 'bg')
if normal_color ~= nil then
if get_color_brightness(normal_color) > 0.5 then
brightness_modifier_parameter = -brightness_modifier_parameter
end
for name, color in pairs(colors) do
colors[name] = brightness_modifier(color, brightness_modifier_parameter)
end
end
-- Basic theme definition
local M = {
normal = {
a = { bg = colors.normal, fg = colors.back1, gui = 'bold' },
b = { bg = colors.back1, fg = colors.normal },
c = { bg = colors.back2, fg = colors.fore },
},
insert = {
a = { bg = colors.insert, fg = colors.back1, gui = 'bold' },
b = { bg = colors.back1, fg = colors.insert },
c = { bg = colors.back2, fg = colors.fore },
},
replace = {
a = { bg = colors.replace, fg = colors.back1, gui = 'bold' },
b = { bg = colors.back1, fg = colors.replace },
c = { bg = colors.back2, fg = colors.fore },
},
visual = {
a = { bg = colors.visual, fg = colors.back1, gui = 'bold' },
b = { bg = colors.back1, fg = colors.visual },
c = { bg = colors.back2, fg = colors.fore },
},
command = {
a = { bg = colors.command, fg = colors.back1, gui = 'bold' },
b = { bg = colors.back1, fg = colors.command },
c = { bg = colors.back2, fg = colors.fore },
},
}
M.terminal = M.command
M.inactive = M.normal
-- Apply proper contrast so text is readable
for _, section in pairs(M) do
for _, highlight in pairs(section) do
apply_contrast(highlight)
end
end
return M

8
etc/soft/nvim/+plugins/lualine.nvim/lua/lualine/themes/ayu.lua

@ -0,0 +1,8 @@ @@ -0,0 +1,8 @@
-- Copyright (c) 2020-2021 shadmansaleh
-- MIT license, see LICENSE for more details.
-- Credit: itchyny(lightline)
-- License: MIT License
local background = vim.opt.background:get()
local style = vim.g.ayucolor or ((background == 'dark') and vim.g.ayuprefermirage and 'mirage' or background)
return require('lualine.themes.ayu_' .. style)

40
etc/soft/nvim/+plugins/lualine.nvim/lua/lualine/themes/ayu_dark.lua

@ -0,0 +1,40 @@ @@ -0,0 +1,40 @@
-- Copyright (c) 2020-2021 shadmansaleh
-- MIT license, see LICENSE for more details.
-- Generated by lightline to lualine theme converter
-- https://gist.github.com/shadmansaleh/000871c9a608a012721c6acc6d7a19b9
-- stylua: ignore
local colors = {
color2 = '#0f1419',
color3 = '#ffee99',
color4 = '#e6e1cf',
color5 = '#14191f',
color13 = '#b8cc52',
color10 = '#36a3d9',
color8 = '#f07178',
color9 = '#3e4b59',
}
return {
visual = {
a = { fg = colors.color2, bg = colors.color3, gui = 'bold' },
b = { fg = colors.color4, bg = colors.color5 },
},
replace = {
a = { fg = colors.color2, bg = colors.color8, gui = 'bold' },
b = { fg = colors.color4, bg = colors.color5 },
},
inactive = {
c = { fg = colors.color4, bg = colors.color2 },
a = { fg = colors.color4, bg = colors.color5, gui = 'bold' },
b = { fg = colors.color4, bg = colors.color5 },
},
normal = {
c = { fg = colors.color9, bg = colors.color2 },
a = { fg = colors.color2, bg = colors.color10, gui = 'bold' },
b = { fg = colors.color4, bg = colors.color5 },
},
insert = {
a = { fg = colors.color2, bg = colors.color13, gui = 'bold' },
b = { fg = colors.color4, bg = colors.color5 },
},
}

40
etc/soft/nvim/+plugins/lualine.nvim/lua/lualine/themes/ayu_light.lua

@ -0,0 +1,40 @@ @@ -0,0 +1,40 @@
-- Copyright (c) 2020-2021 shadmansaleh
-- MIT license, see LICENSE for more details.
-- Generated by lightline to lualine theme converter
-- https://gist.github.com/shadmansaleh/000871c9a608a012721c6acc6d7a19b9
-- stylua: ignore
local colors = {
color2 = '#f3f3f3',
color3 = '#A37ACC',
color4 = '#5C6773',
color5 = '#d3d3d3',
color13 = '#86B300',
color10 = '#59c2ff',
color8 = '#f07178',
color9 = '#828C99',
}
return {
visual = {
a = { fg = colors.color2, bg = colors.color3, gui = 'bold' },
b = { fg = colors.color4, bg = colors.color5 },
},
replace = {
a = { fg = colors.color2, bg = colors.color8, gui = 'bold' },
b = { fg = colors.color4, bg = colors.color5 },
},
inactive = {
c = { fg = colors.color4, bg = colors.color2 },
a = { fg = colors.color4, bg = colors.color5, gui = 'bold' },
b = { fg = colors.color4, bg = colors.color5 },
},
normal = {
c = { fg = colors.color9, bg = colors.color2 },
a = { fg = colors.color2, bg = colors.color10, gui = 'bold' },
b = { fg = colors.color4, bg = colors.color5 },
},
insert = {
a = { fg = colors.color2, bg = colors.color13, gui = 'bold' },
b = { fg = colors.color4, bg = colors.color5 },
},
}

40
etc/soft/nvim/+plugins/lualine.nvim/lua/lualine/themes/ayu_mirage.lua

@ -0,0 +1,40 @@ @@ -0,0 +1,40 @@
-- Copyright (c) 2020-2021 shadmansaleh
-- MIT license, see LICENSE for more details.
-- Generated by lightline to lualine theme converter
-- https://gist.github.com/shadmansaleh/000871c9a608a012721c6acc6d7a19b9
-- stylua: ignore
local colors = {
color2 = '#242b38',
color3 = '#d4bfff',
color4 = '#d9d7ce',
color5 = '#272d38',
color13 = '#bbe67e',
color10 = '#59c2ff',
color8 = '#f07178',
color9 = '#607080',
}
return {
visual = {
a = { fg = colors.color2, bg = colors.color3, gui = 'bold' },
b = { fg = colors.color4, bg = colors.color5 },
},
replace = {
a = { fg = colors.color2, bg = colors.color8, gui = 'bold' },
b = { fg = colors.color4, bg = colors.color5 },
},
inactive = {
c = { fg = colors.color4, bg = colors.color2 },
a = { fg = colors.color4, bg = colors.color5, gui = 'bold' },
b = { fg = colors.color4, bg = colors.color5 },
},
normal = {
c = { fg = colors.color9, bg = colors.color2 },
a = { fg = colors.color2, bg = colors.color10, gui = 'bold' },
b = { fg = colors.color4, bg = colors.color5 },
},
insert = {
a = { fg = colors.color2, bg = colors.color13, gui = 'bold' },
b = { fg = colors.color4, bg = colors.color5 },
},
}

92
etc/soft/nvim/+plugins/lualine.nvim/lua/lualine/themes/base16.lua

@ -0,0 +1,92 @@ @@ -0,0 +1,92 @@
local modules = require('lualine_require').lazy_require { notices = 'lualine.utils.notices' }
local function add_notice(notice)
modules.notices.add_notice('theme(base16): ' .. notice)
end
local function setup(colors)
local theme = {
normal = {
a = { fg = colors.bg, bg = colors.normal },
b = { fg = colors.light_fg, bg = colors.alt_bg },
c = { fg = colors.fg, bg = colors.bg },
},
replace = {
a = { fg = colors.bg, bg = colors.replace },
b = { fg = colors.light_fg, bg = colors.alt_bg },
},
insert = {
a = { fg = colors.bg, bg = colors.insert },
b = { fg = colors.light_fg, bg = colors.alt_bg },
},
visual = {
a = { fg = colors.bg, bg = colors.visual },
b = { fg = colors.light_fg, bg = colors.alt_bg },
},
inactive = {
a = { fg = colors.dark_fg, bg = colors.bg },
b = { fg = colors.dark_fg, bg = colors.bg },
c = { fg = colors.dark_fg, bg = colors.bg },
},
}
theme.command = theme.normal
theme.terminal = theme.insert
return theme
end
local function setup_default()
return setup {
bg = '#282a2e',
alt_bg = '#373b41',
dark_fg = '#969896',
fg = '#b4b7b4',
light_fg = '#c5c8c6',
normal = '#81a2be',
insert = '#b5bd68',
visual = '#b294bb',
replace = '#de935f',
}
end
local function setup_base16()
local loaded, base16 = pcall(require, 'base16-colorscheme')
if not loaded then
add_notice(
'nvim-base16 is not currently present in your runtimepath, make sure it is properly installed,'
.. ' fallback to default colors.'
)
return nil
end
if not base16.colors and not vim.env.BASE16_THEME then
add_notice(
'nvim-base16 is not loaded yet, you should update your configuration to load it before lualine'
.. ' so that the colors from your colorscheme can be used, fallback to "tomorrow-night" theme.'
)
elseif not base16.colors and not base16.colorschemes[vim.env.BASE16_THEME] then
add_notice(
'The colorscheme "%s" defined by the environment variable "BASE16_THEME" is not handled by'
.. ' nvim-base16, fallback to "tomorrow-night" theme.'
)
end
local colors = base16.colors or base16.colorschemes[vim.env.BASE16_THEME or 'tomorrow-night']
return setup {
bg = colors.base01,
alt_bg = colors.base02,
dark_fg = colors.base03,
fg = colors.base04,
light_fg = colors.base05,
normal = colors.base0D,
insert = colors.base0B,
visual = colors.base0E,
replace = colors.base09,
}
end
return setup_base16() or setup_default()

38
etc/soft/nvim/+plugins/lualine.nvim/lua/lualine/themes/codedark.lua

@ -0,0 +1,38 @@ @@ -0,0 +1,38 @@
-- Copyright (c) 2020-2021 Shatur95
-- MIT license, see LICENSE for more details.
-- stylua: ignore
local colors = {
gray = '#3C3C3C',
lightred = '#D16969',
blue = '#569CD6',
pink = '#C586C0',
black = '#262626',
white = '#D4D4D4',
green = '#608B4E',
}
return {
normal = {
b = { fg = colors.green, bg = colors.black },
a = { fg = colors.black, bg = colors.green, gui = 'bold' },
c = { fg = colors.white, bg = colors.black },
},
visual = {
b = { fg = colors.pink, bg = colors.black },
a = { fg = colors.black, bg = colors.pink, gui = 'bold' },
},
inactive = {
b = { fg = colors.black, bg = colors.blue },
a = { fg = colors.white, bg = colors.gray, gui = 'bold' },
},
replace = {
b = { fg = colors.lightred, bg = colors.black },
a = { fg = colors.black, bg = colors.lightred, gui = 'bold' },
c = { fg = colors.white, bg = colors.black },
},
insert = {
b = { fg = colors.blue, bg = colors.black },
a = { fg = colors.black, bg = colors.blue, gui = 'bold' },
c = { fg = colors.white, bg = colors.black },
},
}

48
etc/soft/nvim/+plugins/lualine.nvim/lua/lualine/themes/dracula.lua

@ -0,0 +1,48 @@ @@ -0,0 +1,48 @@
-- Copyright (c) 2020-2021 shadmansaleh
-- MIT license, see LICENSE for more details.
-- Credit itchyny, jackno (lightline)
-- stylua: ignore
local colors = {
gray = '#44475a',
lightgray = '#5f6a8e',
orange = '#ffb86c',
purple = '#bd93f9',
red = '#ff5555',
yellow = '#f1fa8c',
green = '#50fa7b',
white = '#f8f8f2',
black = '#282a36',
}
return {
normal = {
a = { bg = colors.purple, fg = colors.black, gui = 'bold' },
b = { bg = colors.lightgray, fg = colors.white },
c = { bg = colors.gray, fg = colors.white },
},
insert = {
a = { bg = colors.green, fg = colors.black, gui = 'bold' },
b = { bg = colors.lightgray, fg = colors.white },
c = { bg = colors.gray, fg = colors.white },
},
visual = {
a = { bg = colors.yellow, fg = colors.black, gui = 'bold' },
b = { bg = colors.lightgray, fg = colors.white },
c = { bg = colors.gray, fg = colors.white },
},
replace = {
a = { bg = colors.red, fg = colors.black, gui = 'bold' },
b = { bg = colors.lightgray, fg = colors.white },
c = { bg = colors.gray, fg = colors.white },
},
command = {
a = { bg = colors.orange, fg = colors.black, gui = 'bold' },
b = { bg = colors.lightgray, fg = colors.white },
c = { bg = colors.gray, fg = colors.white },
},
inactive = {
a = { bg = colors.gray, fg = colors.white, gui = 'bold' },
b = { bg = colors.lightgray, fg = colors.white },
c = { bg = colors.gray, fg = colors.white },
},
}

53
etc/soft/nvim/+plugins/lualine.nvim/lua/lualine/themes/everforest.lua

@ -0,0 +1,53 @@ @@ -0,0 +1,53 @@
-- Copyright (c) 2020-2021 gnuyent
-- MIT license, see LICENSE for more details.
-- stylua: ignore
local colors = {
bg0 = '#323d43',
bg1 = '#3c474d',
bg3 = '#505a60',
fg = '#d8caac',
aqua = '#87c095',
green = '#a7c080',
orange = '#e39b7b',
purple = '#d39bb6',
red = '#e68183',
grey1 = '#868d80',
}
return {
normal = {
a = { bg = colors.green, fg = colors.bg0, gui = 'bold' },
b = { bg = colors.bg3, fg = colors.fg },
c = { bg = colors.bg1, fg = colors.fg },
},
insert = {
a = { bg = colors.fg, fg = colors.bg0, gui = 'bold' },
b = { bg = colors.bg3, fg = colors.fg },
c = { bg = colors.bg1, fg = colors.fg },
},
visual = {
a = { bg = colors.red, fg = colors.bg0, gui = 'bold' },
b = { bg = colors.bg3, fg = colors.fg },
c = { bg = colors.bg1, fg = colors.fg },
},
replace = {
a = { bg = colors.orange, fg = colors.bg0, gui = 'bold' },
b = { bg = colors.bg3, fg = colors.fg },
c = { bg = colors.bg1, fg = colors.fg },
},
command = {
a = { bg = colors.aqua, fg = colors.bg0, gui = 'bold' },
b = { bg = colors.bg3, fg = colors.fg },
c = { bg = colors.bg1, fg = colors.fg },
},
terminal = {
a = { bg = colors.purple, fg = colors.bg0, gui = 'bold' },
b = { bg = colors.bg3, fg = colors.fg },
c = { bg = colors.bg1, fg = colors.fg },
},
inactive = {
a = { bg = colors.bg1, fg = colors.grey1, gui = 'bold' },
b = { bg = colors.bg1, fg = colors.grey1 },
c = { bg = colors.bg1, fg = colors.grey1 },
},
}

29
etc/soft/nvim/+plugins/lualine.nvim/lua/lualine/themes/gruvbox-material.lua

@ -0,0 +1,29 @@ @@ -0,0 +1,29 @@
-- Copyright (c) 2020-2021 shadmansaleh
-- MIT license, see LICENSE for more details.
-- stylua: ignore
local colors = {
fg1 = '#282828',
color2 = '#504945',
fg2 = '#ddc7a1',
color3 = '#32302f',
color4 = '#a89984',
color5 = '#7daea3',
color6 = '#a9b665',
color7 = '#d8a657',
color8 = '#d3869b',
color9 = '#ea6962',
}
return {
normal = {
a = { fg = colors.fg1, bg = colors.color4, gui = 'bold' },
b = { fg = colors.fg2, bg = colors.color2 },
c = { fg = colors.fg2, bg = colors.color3 },
},
command = { a = { fg = colors.fg1, bg = colors.color5, gui = 'bold' } },
inactive = { a = { fg = colors.fg2, bg = colors.color2 } },
insert = { a = { fg = colors.fg1, bg = colors.color6, gui = 'bold' } },
replace = { a = { fg = colors.fg1, bg = colors.color7, gui = 'bold' } },
terminal = { a = { fg = colors.fg1, bg = colors.color8, gui = 'bold' } },
visual = { a = { fg = colors.fg1, bg = colors.color9, gui = 'bold' } },
}

7
etc/soft/nvim/+plugins/lualine.nvim/lua/lualine/themes/gruvbox.lua

@ -0,0 +1,7 @@ @@ -0,0 +1,7 @@
-- Copyright (c) 2020-2021 shadmansaleh
-- MIT license, see LICENSE for more details.
-- Credit: itchyny(lightline)
-- License: MIT License
local background = vim.opt.background:get()
return require('lualine.themes.gruvbox_' .. background)

48
etc/soft/nvim/+plugins/lualine.nvim/lua/lualine/themes/gruvbox_dark.lua

@ -0,0 +1,48 @@ @@ -0,0 +1,48 @@
-- Copyright (c) 2020-2021 hoob3rt
-- MIT license, see LICENSE for more details.
-- stylua: ignore
local colors = {
black = '#282828',
white = '#ebdbb2',
red = '#fb4934',
green = '#b8bb26',
blue = '#83a598',
yellow = '#fe8019',
gray = '#a89984',
darkgray = '#3c3836',
lightgray = '#504945',
inactivegray = '#7c6f64',
}
return {
normal = {
a = { bg = colors.gray, fg = colors.black, gui = 'bold' },
b = { bg = colors.lightgray, fg = colors.white },
c = { bg = colors.darkgray, fg = colors.gray },
},
insert = {
a = { bg = colors.blue, fg = colors.black, gui = 'bold' },
b = { bg = colors.lightgray, fg = colors.white },
c = { bg = colors.lightgray, fg = colors.white },
},
visual = {
a = { bg = colors.yellow, fg = colors.black, gui = 'bold' },
b = { bg = colors.lightgray, fg = colors.white },
c = { bg = colors.inactivegray, fg = colors.black },
},
replace = {
a = { bg = colors.red, fg = colors.black, gui = 'bold' },
b = { bg = colors.lightgray, fg = colors.white },
c = { bg = colors.black, fg = colors.white },
},
command = {
a = { bg = colors.green, fg = colors.black, gui = 'bold' },
b = { bg = colors.lightgray, fg = colors.white },
c = { bg = colors.inactivegray, fg = colors.black },
},
inactive = {
a = { bg = colors.darkgray, fg = colors.gray, gui = 'bold' },
b = { bg = colors.darkgray, fg = colors.gray },
c = { bg = colors.darkgray, fg = colors.gray },
},
}

47
etc/soft/nvim/+plugins/lualine.nvim/lua/lualine/themes/gruvbox_light.lua

@ -0,0 +1,47 @@ @@ -0,0 +1,47 @@
-- Copyright (c) 2020-2021 shadmansaleh
-- MIT license, see LICENSE for more details.
-- stylua: ignore
local colors = {
black = '#3c3836',
white = '#f9f5d7',
orange = '#af3a03',
green = '#427b58',
blue = '#076678',
gray = '#d5c4a1',
darkgray = '#7c6f64',
lightgray = '#ebdbb2',
inactivegray = '#a89984'
}
return {
normal = {
a = { bg = colors.darkgray, fg = colors.white, gui = 'bold' },
b = { bg = colors.gray, fg = colors.darkgray },
c = { bg = colors.lightgray, fg = colors.darkgray },
},
insert = {
a = { bg = colors.blue, fg = colors.white, gui = 'bold' },
b = { bg = colors.gray, fg = colors.darkgray },
c = { bg = colors.gray, fg = colors.black },
},
visual = {
a = { bg = colors.orange, fg = colors.white, gui = 'bold' },
b = { bg = colors.gray, fg = colors.darkgray },
c = { bg = colors.darkgray, fg = colors.white },
},
replace = {
a = { bg = colors.green, fg = colors.white, gui = 'bold' },
b = { bg = colors.gray, fg = colors.darkgray },
c = { bg = colors.gray, fg = colors.black },
},
command = {
a = { bg = colors.darkgray, fg = colors.white, gui = 'bold' },
b = { bg = colors.gray, fg = colors.darkgray },
c = { bg = colors.lightgray, fg = colors.darkgray },
},
inactive = {
a = { bg = colors.lightgray, fg = colors.inactivegray },
b = { bg = colors.lightgray, fg = colors.inactivegray },
c = { bg = colors.lightgray, fg = colors.inactivegray },
},
}

48
etc/soft/nvim/+plugins/lualine.nvim/lua/lualine/themes/horizon.lua

@ -0,0 +1,48 @@ @@ -0,0 +1,48 @@
-- Copyright (c) 2021 Jnhtr
-- MIT license, see LICENSE for more details.
-- stylua: ignore
local colors = {
black = '#1c1e26',
white = '#6C6F93',
red = '#F43E5C',
green = '#09F7A0',
blue = '#25B2BC',
yellow = '#F09383',
gray = '#E95678',
darkgray = '#1A1C23',
lightgray = '#2E303E',
inactivegray = '#1C1E26',
}
return {
normal = {
a = { bg = colors.gray, fg = colors.black, gui = 'bold' },
b = { bg = colors.lightgray, fg = colors.white },
c = { bg = colors.darkgray, fg = colors.white },
},
insert = {
a = { bg = colors.blue, fg = colors.black, gui = 'bold' },
b = { bg = colors.lightgray, fg = colors.white },
c = { bg = colors.darkgray, fg = colors.white },
},
visual = {
a = { bg = colors.yellow, fg = colors.black, gui = 'bold' },
b = { bg = colors.lightgray, fg = colors.white },
c = { bg = colors.darkgray, fg = colors.white },
},
replace = {
a = { bg = colors.red, fg = colors.black, gui = 'bold' },
b = { bg = colors.lightgray, fg = colors.white },
c = { bg = colors.darkgray, fg = colors.white },
},
command = {
a = { bg = colors.green, fg = colors.black, gui = 'bold' },
b = { bg = colors.lightgray, fg = colors.white },
c = { bg = colors.darkgray, fg = colors.white },
},
inactive = {
a = { bg = colors.inactivegray, fg = colors.lightgray, gui = 'bold' },
b = { bg = colors.inactivegray, fg = colors.lightgray },
c = { bg = colors.inactivegray, fg = colors.lightgray },
},
}

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save