diff options
| author | William Boman <william@redwill.se> | 2021-10-10 19:20:16 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-10-10 19:20:16 +0200 |
| commit | 5f54148153a878cc9cbe370adccda0f706251d89 (patch) | |
| tree | 28ae0436232486323dfce3444e1d25657c34d75e /lua/nvim-lsp-installer/data.lua | |
| parent | jdtls: fix jar argument (diff) | |
| download | mason-5f54148153a878cc9cbe370adccda0f706251d89.tar mason-5f54148153a878cc9cbe370adccda0f706251d89.tar.gz mason-5f54148153a878cc9cbe370adccda0f706251d89.tar.bz2 mason-5f54148153a878cc9cbe370adccda0f706251d89.tar.lz mason-5f54148153a878cc9cbe370adccda0f706251d89.tar.xz mason-5f54148153a878cc9cbe370adccda0f706251d89.tar.zst mason-5f54148153a878cc9cbe370adccda0f706251d89.zip | |
add keybindings to UI window (#140)
- Allows for expanding servers to view more information about it.
- Allows for installing/reinstalling/uninstalling servers.
The default keybindings is an attempt to mimic vim-fugitive's :Git
maps, and these can be overriden.
The keybinding implementation in display.lua is a bit hacky, but it
works and the "public" API is at least manageable. This will also
open up for adding more metadata in the future, such as filetype
information, currently installed version, latest available version,
etc.
Also there's Cowth Vader.
Diffstat (limited to 'lua/nvim-lsp-installer/data.lua')
| -rw-r--r-- | lua/nvim-lsp-installer/data.lua | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/lua/nvim-lsp-installer/data.lua b/lua/nvim-lsp-installer/data.lua index 901c293a..b5689142 100644 --- a/lua/nvim-lsp-installer/data.lua +++ b/lua/nvim-lsp-installer/data.lua @@ -33,6 +33,21 @@ function Data.list_map(fn, list) return result end +function Data.table_pack(...) + return { n = select("#", ...), ... } +end + +function Data.list_not_nil(...) + local result = {} + local args = Data.table_pack(...) + for i = 1, args.n do + if args[i] ~= nil then + result[#result + 1] = args[i] + end + end + return result +end + function Data.tbl_pack(...) return { n = select("#", ...), ... } end @@ -41,6 +56,10 @@ function Data.when(condition, value) return condition and value or nil end +function Data.lazy(condition, fn) + return condition and fn() or nil +end + function Data.coalesce(...) local args = Data.tbl_pack(...) for i = 1, args.n do |
