mirror of
https://github.com/SpaceVim/SpaceVim.git
synced 2025-01-23 07:10:06 +08:00
feat(dev): add bundle.lua
This commit is contained in:
parent
b462646223
commit
b645f362e9
156
.SpaceVim.d/lua/spacevim/dev/bundle.lua
Normal file
156
.SpaceVim.d/lua/spacevim/dev/bundle.lua
Normal file
@ -0,0 +1,156 @@
|
|||||||
|
--!/usr/bin/lua
|
||||||
|
|
||||||
|
local M = {}
|
||||||
|
|
||||||
|
local function executable(exe) -- {{{
|
||||||
|
return vim.fn.executable(exe) == 1
|
||||||
|
end
|
||||||
|
-- }}}
|
||||||
|
|
||||||
|
local logger = require('spacevim.logger').derive('bundle')
|
||||||
|
local nt = require('spacevim.api').import('notify')
|
||||||
|
local jobs = {}
|
||||||
|
|
||||||
|
local function rename_exit(id, data, event) -- {{{
|
||||||
|
logger.info('extract job exit code:' .. data)
|
||||||
|
if data == 0 then
|
||||||
|
local b = jobs['rename_id_' .. id]
|
||||||
|
if b then
|
||||||
|
nt.notify('update bundle files')
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
-- }}}
|
||||||
|
|
||||||
|
local function rename_bundle(id, data, evet) -- {{{
|
||||||
|
logger.info('extract job exit code:' .. data)
|
||||||
|
if data == 0 then
|
||||||
|
local b = jobs['remove_old_bundle_id_' .. id]
|
||||||
|
if b then
|
||||||
|
local p
|
||||||
|
if b.branch then
|
||||||
|
p = '/refs/heads/' .. b.branch
|
||||||
|
elseif b.commit then
|
||||||
|
p = '/archive/' .. b.commit
|
||||||
|
end
|
||||||
|
local target = vim.fn.stdpath('run') .. '/' .. b.username .. '/' .. b.repo .. p
|
||||||
|
if b.branch then
|
||||||
|
p = b.repo .. '-' .. b.branch
|
||||||
|
elseif b.commit then
|
||||||
|
p = b.repo .. '-' .. b.commit
|
||||||
|
end
|
||||||
|
target = target .. '/' .. p
|
||||||
|
local cmd = { 'mv', target, 'bundle/' .. b.directory }
|
||||||
|
logger.info(vim.inspect(cmd))
|
||||||
|
local jobid = vim.fn.jobstart(cmd, { on_exit = rename_exit })
|
||||||
|
logger.info('job id is:' .. jobid)
|
||||||
|
if jobid > 0 then
|
||||||
|
jobs['rename_id_' .. jobid] = b
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
-- }}}
|
||||||
|
|
||||||
|
local function remove_old_bundle(id, data, event) -- {{{
|
||||||
|
logger.info('extract job exit code:' .. data)
|
||||||
|
if data == 0 then
|
||||||
|
local b = jobs['extract_id_' .. id]
|
||||||
|
if b then
|
||||||
|
local old_bundle = 'bundle/' .. b.directory
|
||||||
|
local cmd = { 'rm', '-rf', old_bundle }
|
||||||
|
logger.info(vim.inspect(cmd))
|
||||||
|
local jobid = vim.fn.jobstart(cmd, { on_exit = rename_bundle })
|
||||||
|
logger.info('job id is:' .. jobid)
|
||||||
|
if jobid > 0 then
|
||||||
|
jobs['remove_old_bundle_id_' .. jobid] = b
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
-- }}}
|
||||||
|
|
||||||
|
local function extract(b) -- {{{
|
||||||
|
if not executable('unzip') then
|
||||||
|
nt.notify('unzip is not executable!')
|
||||||
|
return
|
||||||
|
end
|
||||||
|
local p
|
||||||
|
if b.branch then
|
||||||
|
p = '/refs/heads/' .. b.branch
|
||||||
|
elseif b.commit then
|
||||||
|
p = '/archive/' .. b.commit
|
||||||
|
end
|
||||||
|
local target = vim.fn.stdpath('run') .. '/' .. b.username .. '/' .. b.repo .. p
|
||||||
|
local zipfile = vim.fn.stdpath('run') .. '/' .. b.username .. '/' .. b.repo .. p .. '.zip'
|
||||||
|
local cmd = { 'unzip', '-d', target, zipfile }
|
||||||
|
logger.info(vim.inspect(cmd))
|
||||||
|
local jobid = vim.fn.jobstart(cmd, { on_exit = remove_old_bundle })
|
||||||
|
logger.info('job id is:' .. jobid)
|
||||||
|
if jobid > 0 then
|
||||||
|
jobs['extract_id_' .. jobid] = b
|
||||||
|
end
|
||||||
|
end
|
||||||
|
-- }}}
|
||||||
|
|
||||||
|
local function download_exit(id, data, event) -- {{{
|
||||||
|
logger.info('download job exit code:' .. data)
|
||||||
|
if data == 0 then
|
||||||
|
local b = jobs['download_id_' .. id]
|
||||||
|
if b then
|
||||||
|
extract(b)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
-- }}}
|
||||||
|
|
||||||
|
function M.download(b) -- {{{
|
||||||
|
if not executable('curl') then
|
||||||
|
nt.notify('curl is not executable!')
|
||||||
|
return
|
||||||
|
end
|
||||||
|
logger.info('start to download bundle:\n' .. vim.inspect(b))
|
||||||
|
-- local cmd = { 'curl', '-L', '--create-dirs' }
|
||||||
|
local cmd = { 'curl', '-fLo' }
|
||||||
|
local p
|
||||||
|
if b.branch then
|
||||||
|
p = '/refs/heads/' .. b.branch
|
||||||
|
elseif b.commit then
|
||||||
|
p = '/archive/' .. b.commit
|
||||||
|
end
|
||||||
|
local url = b.url .. b.username .. '/' .. b.repo .. '/' .. p .. '.zip'
|
||||||
|
local f = vim.fn.stdpath('run') .. '/' .. b.username .. '/' .. b.repo .. p .. '.zip'
|
||||||
|
table.insert(cmd, f)
|
||||||
|
table.insert(cmd, '--create-dirs')
|
||||||
|
table.insert(cmd, url)
|
||||||
|
logger.info(vim.inspect(cmd))
|
||||||
|
local jobid = vim.fn.jobstart(cmd, { on_exit = download_exit })
|
||||||
|
logger.info('job id is:' .. jobid)
|
||||||
|
if jobid > 0 then
|
||||||
|
jobs['download_id_' .. jobid] = b
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function M.get_bundles() -- {{{
|
||||||
|
local bs = vim.api.nvim_eval("SpaceVim#api#data#toml#get().parse_file('bundle/plugins.toml')")
|
||||||
|
M.__bs = bs.repos
|
||||||
|
return bs.repos
|
||||||
|
end
|
||||||
|
-- }}}
|
||||||
|
|
||||||
|
function M.complete(a, b, c) -- {{{
|
||||||
|
if not M.__bs then
|
||||||
|
M.get_bundles()
|
||||||
|
end
|
||||||
|
local rst = {}
|
||||||
|
for _, v in pairs(M.__bs) do
|
||||||
|
if vim.startswith(v.repo, a) then
|
||||||
|
table.insert(rst, v.username .. '/' .. v.repo)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return rst
|
||||||
|
end
|
||||||
|
-- }}}
|
||||||
|
|
||||||
|
return M
|
9
.SpaceVim.d/plugin/bundle.lua
Normal file
9
.SpaceVim.d/plugin/bundle.lua
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
local b = require('spacevim.dev.bundle')
|
||||||
|
vim.api.nvim_create_user_command('SPBundleUpdate', function(opt)
|
||||||
|
local bundles = b.get_bundles()
|
||||||
|
for _, v in pairs(bundles) do
|
||||||
|
if v.username .. '/' .. v.repo == opt.fargs[1] then
|
||||||
|
b.download(v)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end, { nargs = 1, complete = b.complete })
|
@ -50,7 +50,6 @@ function! SpaceVim#layers#colorscheme#plugins() abort
|
|||||||
\ ['Gabirel/molokai', { 'merged' : 0 }],
|
\ ['Gabirel/molokai', { 'merged' : 0 }],
|
||||||
\ ['joshdick/onedark.vim', { 'merged' : 0 }],
|
\ ['joshdick/onedark.vim', { 'merged' : 0 }],
|
||||||
\ ['nanotech/jellybeans.vim', { 'merged' : 0 }],
|
\ ['nanotech/jellybeans.vim', { 'merged' : 0 }],
|
||||||
\ ['rakr/vim-one', { 'merged' : 0 }],
|
|
||||||
\ ['arcticicestudio/nord-vim', { 'merged' : 0 }],
|
\ ['arcticicestudio/nord-vim', { 'merged' : 0 }],
|
||||||
\ ['icymind/NeoSolarized', { 'merged' : 0 }],
|
\ ['icymind/NeoSolarized', { 'merged' : 0 }],
|
||||||
\ ['w0ng/vim-hybrid', { 'merged' : 0 }],
|
\ ['w0ng/vim-hybrid', { 'merged' : 0 }],
|
||||||
@ -59,6 +58,7 @@ function! SpaceVim#layers#colorscheme#plugins() abort
|
|||||||
\ [ 'drewtempelmeyer/palenight.vim', {'merged': 0 }],
|
\ [ 'drewtempelmeyer/palenight.vim', {'merged': 0 }],
|
||||||
\ ]
|
\ ]
|
||||||
call add(plugins, [g:_spacevim_root_dir . 'bundle/dracula', {'merged' : 0}])
|
call add(plugins, [g:_spacevim_root_dir . 'bundle/dracula', {'merged' : 0}])
|
||||||
|
call add(plugins, [g:_spacevim_root_dir . 'bundle/vim-one', {'merged' : 0}])
|
||||||
"
|
"
|
||||||
" TODO:
|
" TODO:
|
||||||
" \ ['mhartington/oceanic-next', { 'merged' : 0 }],
|
" \ ['mhartington/oceanic-next', { 'merged' : 0 }],
|
||||||
|
18
bundle/plugins.toml
vendored
Normal file
18
bundle/plugins.toml
vendored
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
# the url: https://github.com/SpaceVim/SpaceVim/archive/b462646223dfb8a7b19fb3999edffd4d0dd8aea1.zip
|
||||||
|
# https://github.com/{username}/{repo}/archive/{hash}.zip
|
||||||
|
|
||||||
|
|
||||||
|
[[repos]]
|
||||||
|
url = 'https://github.com/'
|
||||||
|
directory = 'trouble.nvim'
|
||||||
|
username = 'folke'
|
||||||
|
repo = 'trouble.nvim'
|
||||||
|
commit = 'd99e2abd10808ef91738ce98a5c767e6a51df449'
|
||||||
|
|
||||||
|
[[repos]]
|
||||||
|
# https://github.com/rakr/vim-one/tree/187f5c85b682c1933f8780d4d419c55d26a82e24
|
||||||
|
url = 'https://github.com/'
|
||||||
|
directory = 'vim-one'
|
||||||
|
username = 'rakr'
|
||||||
|
repo = 'vim-one'
|
||||||
|
commit = '187f5c85b682c1933f8780d4d419c55d26a82e24'
|
89
bundle/trouble.nvim/.github/ISSUE_TEMPLATE/bug_report.yml
vendored
Normal file
89
bundle/trouble.nvim/.github/ISSUE_TEMPLATE/bug_report.yml
vendored
Normal file
@ -0,0 +1,89 @@
|
|||||||
|
name: Bug Report
|
||||||
|
description: File a bug/issue
|
||||||
|
title: "bug: "
|
||||||
|
labels: [bug]
|
||||||
|
body:
|
||||||
|
- type: markdown
|
||||||
|
attributes:
|
||||||
|
value: |
|
||||||
|
**Before** reporting an issue, make sure to read the [documentation](https://github.com/folke/trouble.nvim) and search [existing issues](https://github.com/folke/trouble.nvim/issues). Usage questions such as ***"How do I...?"*** belong in [Discussions](https://github.com/folke/trouble.nvim/discussions) and will be closed.
|
||||||
|
- type: checkboxes
|
||||||
|
attributes:
|
||||||
|
label: Did you check docs and existing issues?
|
||||||
|
description: Make sure you checked all of the below before submitting an issue
|
||||||
|
options:
|
||||||
|
- label: I have read all the trouble.nvim docs
|
||||||
|
required: true
|
||||||
|
- label: I have searched the existing issues of trouble.nvim
|
||||||
|
required: true
|
||||||
|
- label: I have searched the existing issues of plugins related to this issue
|
||||||
|
required: true
|
||||||
|
- type: input
|
||||||
|
attributes:
|
||||||
|
label: "Neovim version (nvim -v)"
|
||||||
|
placeholder: "0.8.0 commit db1b0ee3b30f"
|
||||||
|
validations:
|
||||||
|
required: true
|
||||||
|
- type: input
|
||||||
|
attributes:
|
||||||
|
label: "Operating system/version"
|
||||||
|
placeholder: "MacOS 11.5"
|
||||||
|
validations:
|
||||||
|
required: true
|
||||||
|
- type: textarea
|
||||||
|
attributes:
|
||||||
|
label: Describe the bug
|
||||||
|
description: A clear and concise description of what the bug is. Please include any related errors you see in Neovim.
|
||||||
|
validations:
|
||||||
|
required: true
|
||||||
|
- type: textarea
|
||||||
|
attributes:
|
||||||
|
label: Steps To Reproduce
|
||||||
|
description: Steps to reproduce the behavior.
|
||||||
|
placeholder: |
|
||||||
|
1.
|
||||||
|
2.
|
||||||
|
3.
|
||||||
|
validations:
|
||||||
|
required: true
|
||||||
|
- type: textarea
|
||||||
|
attributes:
|
||||||
|
label: Expected Behavior
|
||||||
|
description: A concise description of what you expected to happen.
|
||||||
|
validations:
|
||||||
|
required: true
|
||||||
|
- type: textarea
|
||||||
|
attributes:
|
||||||
|
label: Repro
|
||||||
|
description: Minimal `init.lua` to reproduce this issue. Save as `repro.lua` and run with `nvim -u repro.lua`
|
||||||
|
value: |
|
||||||
|
-- DO NOT change the paths and don't remove the colorscheme
|
||||||
|
local root = vim.fn.fnamemodify("./.repro", ":p")
|
||||||
|
|
||||||
|
-- set stdpaths to use .repro
|
||||||
|
for _, name in ipairs({ "config", "data", "state", "cache" }) do
|
||||||
|
vim.env[("XDG_%s_HOME"):format(name:upper())] = root .. "/" .. name
|
||||||
|
end
|
||||||
|
|
||||||
|
-- bootstrap lazy
|
||||||
|
local lazypath = root .. "/plugins/lazy.nvim"
|
||||||
|
if not vim.loop.fs_stat(lazypath) then
|
||||||
|
vim.fn.system({ "git", "clone", "--filter=blob:none", "https://github.com/folke/lazy.nvim.git", lazypath, })
|
||||||
|
end
|
||||||
|
vim.opt.runtimepath:prepend(lazypath)
|
||||||
|
|
||||||
|
-- install plugins
|
||||||
|
local plugins = {
|
||||||
|
"folke/tokyonight.nvim",
|
||||||
|
"folke/trouble.nvim",
|
||||||
|
-- add any other plugins here
|
||||||
|
}
|
||||||
|
require("lazy").setup(plugins, {
|
||||||
|
root = root .. "/plugins",
|
||||||
|
})
|
||||||
|
|
||||||
|
vim.cmd.colorscheme("tokyonight")
|
||||||
|
-- add anything else here
|
||||||
|
render: Lua
|
||||||
|
validations:
|
||||||
|
required: false
|
36
bundle/trouble.nvim/.github/ISSUE_TEMPLATE/feature_request.yml
vendored
Normal file
36
bundle/trouble.nvim/.github/ISSUE_TEMPLATE/feature_request.yml
vendored
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
name: Feature Request
|
||||||
|
description: Suggest a new feature
|
||||||
|
title: "feature: "
|
||||||
|
labels: [enhancement]
|
||||||
|
body:
|
||||||
|
- type: checkboxes
|
||||||
|
attributes:
|
||||||
|
label: Did you check the docs?
|
||||||
|
description: Make sure you read all the docs before submitting a feature request
|
||||||
|
options:
|
||||||
|
- label: I have read all the trouble.nvim docs
|
||||||
|
required: true
|
||||||
|
- type: textarea
|
||||||
|
validations:
|
||||||
|
required: true
|
||||||
|
attributes:
|
||||||
|
label: Is your feature request related to a problem? Please describe.
|
||||||
|
description: A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
|
||||||
|
- type: textarea
|
||||||
|
validations:
|
||||||
|
required: true
|
||||||
|
attributes:
|
||||||
|
label: Describe the solution you'd like
|
||||||
|
description: A clear and concise description of what you want to happen.
|
||||||
|
- type: textarea
|
||||||
|
validations:
|
||||||
|
required: true
|
||||||
|
attributes:
|
||||||
|
label: Describe alternatives you've considered
|
||||||
|
description: A clear and concise description of any alternative solutions or features you've considered.
|
||||||
|
- type: textarea
|
||||||
|
validations:
|
||||||
|
required: false
|
||||||
|
attributes:
|
||||||
|
label: Additional context
|
||||||
|
description: Add any other context or screenshots about the feature request here.
|
72
bundle/trouble.nvim/.github/workflows/ci.yml
vendored
Normal file
72
bundle/trouble.nvim/.github/workflows/ci.yml
vendored
Normal file
@ -0,0 +1,72 @@
|
|||||||
|
name: CI
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
pull_request:
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
tests:
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
# os: [ubuntu-latest, windows-latest]
|
||||||
|
os: [ubuntu-latest]
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
- name: Install Neovim
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
mkdir -p /tmp/nvim
|
||||||
|
wget -q https://github.com/neovim/neovim/releases/download/nightly/nvim.appimage -O /tmp/nvim/nvim.appimage
|
||||||
|
cd /tmp/nvim
|
||||||
|
chmod a+x ./nvim.appimage
|
||||||
|
./nvim.appimage --appimage-extract
|
||||||
|
echo "/tmp/nvim/squashfs-root/usr/bin/" >> $GITHUB_PATH
|
||||||
|
- name: Run Tests
|
||||||
|
run: |
|
||||||
|
nvim --version
|
||||||
|
[ ! -d tests ] && exit 0
|
||||||
|
nvim --headless -u tests/init.lua -c "PlenaryBustedDirectory tests/ {minimal_init = 'tests/init.lua', sequential = true}"
|
||||||
|
docs:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
needs: tests
|
||||||
|
if: ${{ github.ref == 'refs/heads/main' }}
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
- name: panvimdoc
|
||||||
|
uses: kdheepak/panvimdoc@main
|
||||||
|
with:
|
||||||
|
vimdoc: trouble.nvim
|
||||||
|
version: "Neovim >= 0.8.0"
|
||||||
|
demojify: true
|
||||||
|
treesitter: true
|
||||||
|
- name: Push changes
|
||||||
|
uses: stefanzweifel/git-auto-commit-action@v4
|
||||||
|
with:
|
||||||
|
commit_message: "chore(build): auto-generate vimdoc"
|
||||||
|
commit_user_name: "github-actions[bot]"
|
||||||
|
commit_user_email: "github-actions[bot]@users.noreply.github.com"
|
||||||
|
commit_author: "github-actions[bot] <github-actions[bot]@users.noreply.github.com>"
|
||||||
|
release:
|
||||||
|
name: release
|
||||||
|
if: ${{ github.ref == 'refs/heads/main' }}
|
||||||
|
needs:
|
||||||
|
- docs
|
||||||
|
- tests
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: google-github-actions/release-please-action@v3
|
||||||
|
id: release
|
||||||
|
with:
|
||||||
|
release-type: simple
|
||||||
|
package-name: trouble.nvim
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
- name: tag stable versions
|
||||||
|
if: ${{ steps.release.outputs.release_created }}
|
||||||
|
run: |
|
||||||
|
git config user.name github-actions[bot]
|
||||||
|
git config user.email github-actions[bot]@users.noreply.github.com
|
||||||
|
git remote add gh-token "https://${{ secrets.GITHUB_TOKEN }}@github.com/google-github-actions/release-please-action.git"
|
||||||
|
git tag -d stable || true
|
||||||
|
git push origin :stable || true
|
||||||
|
git tag -a stable -m "Last Stable Release"
|
||||||
|
git push origin stable
|
8
bundle/trouble.nvim/.gitignore
vendored
Normal file
8
bundle/trouble.nvim/.gitignore
vendored
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
tt.*
|
||||||
|
.tests
|
||||||
|
doc/tags
|
||||||
|
debug
|
||||||
|
.repro
|
||||||
|
foo.*
|
||||||
|
*.log
|
||||||
|
data
|
13
bundle/trouble.nvim/.lua-format
vendored
Normal file
13
bundle/trouble.nvim/.lua-format
vendored
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
# https://github.com/Koihik/LuaFormatter/blob/master/docs/Style-Config.md
|
||||||
|
#column_limit: 100
|
||||||
|
#indent_width: 4
|
||||||
|
#continuation_indent_width: 4
|
||||||
|
#use_tab: false
|
||||||
|
#chop_down_parameter: true
|
||||||
|
#chop_down_table: true
|
||||||
|
#chop_down_kv_table: true
|
||||||
|
#single_quote_to_double_quote: true
|
||||||
|
#spaces_inside_table_braces: true
|
||||||
|
#align_parameter: true
|
||||||
|
#keep_simple_control_block_one_line: true
|
||||||
|
#extra_sep_at_table_end: true
|
3
bundle/trouble.nvim/.nvim.lsp.json
vendored
Normal file
3
bundle/trouble.nvim/.nvim.lsp.json
vendored
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
"Lua.diagnostics.disable": ["undefined-local"]
|
||||||
|
}
|
204
bundle/trouble.nvim/CHANGELOG.md
vendored
Normal file
204
bundle/trouble.nvim/CHANGELOG.md
vendored
Normal file
@ -0,0 +1,204 @@
|
|||||||
|
# Changelog
|
||||||
|
|
||||||
|
## [2.3.0](https://github.com/folke/trouble.nvim/compare/v2.2.3...v2.3.0) (2023-05-25)
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* filter diagnostics by severity level ([#285](https://github.com/folke/trouble.nvim/issues/285)) ([b1f607f](https://github.com/folke/trouble.nvim/commit/b1f607ff0f2c107faf8b0c26d09877028b549d63))
|
||||||
|
|
||||||
|
## [2.2.3](https://github.com/folke/trouble.nvim/compare/v2.2.2...v2.2.3) (2023-05-22)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* set window options locally ([#282](https://github.com/folke/trouble.nvim/issues/282)) ([a5649c9](https://github.com/folke/trouble.nvim/commit/a5649c9a60d7c5aa2fed1781057af3f29b10f167))
|
||||||
|
|
||||||
|
## [2.2.2](https://github.com/folke/trouble.nvim/compare/v2.2.1...v2.2.2) (2023-04-17)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* **util:** auto_jump when trouble is open. Fixes [#144](https://github.com/folke/trouble.nvim/issues/144) ([e4f1623](https://github.com/folke/trouble.nvim/commit/e4f1623b51e18eb4e2835446e50886062c339f80))
|
||||||
|
* **util:** save position in jump list before jump. Fixes [#143](https://github.com/folke/trouble.nvim/issues/143) Fixes [#235](https://github.com/folke/trouble.nvim/issues/235) ([f0477b0](https://github.com/folke/trouble.nvim/commit/f0477b0e78d9a16ff326e356235876ff3f87882d))
|
||||||
|
|
||||||
|
## [2.2.1](https://github.com/folke/trouble.nvim/compare/v2.2.0...v2.2.1) (2023-03-26)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* **icons:** fixed deprecated icons with nerdfix ([39db399](https://github.com/folke/trouble.nvim/commit/39db3994c8de87b0b5ca7a4d3d415926f201f1fc))
|
||||||
|
|
||||||
|
## [2.2.0](https://github.com/folke/trouble.nvim/compare/v2.1.1...v2.2.0) (2023-02-28)
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* enable looping during next/prev ([#232](https://github.com/folke/trouble.nvim/issues/232)) ([fc4c0f8](https://github.com/folke/trouble.nvim/commit/fc4c0f82c9181f3c27a4cbdd5db97c110fd78ee9))
|
||||||
|
* expose renderer.signs. Fixes [#252](https://github.com/folke/trouble.nvim/issues/252) ([5581e73](https://github.com/folke/trouble.nvim/commit/5581e736c8afc8b227ad958ded1929c8a39f049e))
|
||||||
|
|
||||||
|
## [2.1.1](https://github.com/folke/trouble.nvim/compare/v2.1.0...v2.1.1) (2023-02-19)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* ensure that the diagnostic parameters are complete ([#179](https://github.com/folke/trouble.nvim/issues/179)) ([210969f](https://github.com/folke/trouble.nvim/commit/210969fce79e7d11554c61bca263d7e1ac77bde0))
|
||||||
|
* icorrect row/line in diagnostics. Fixes [#264](https://github.com/folke/trouble.nvim/issues/264) ([32fa4ed](https://github.com/folke/trouble.nvim/commit/32fa4ed742fc91f3075c98edd3c131b716b9d782))
|
||||||
|
|
||||||
|
## [2.1.0](https://github.com/folke/trouble.nvim/compare/v2.0.1...v2.1.0) (2023-02-18)
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* expose `require("trouble").is_open()` ([2eb27b3](https://github.com/folke/trouble.nvim/commit/2eb27b34442894e903fdc6e01edea6d7c476be63))
|
||||||
|
|
||||||
|
## [2.0.1](https://github.com/folke/trouble.nvim/compare/v2.0.0...v2.0.1) (2023-02-16)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* **init:** version check ([73eea32](https://github.com/folke/trouble.nvim/commit/73eea32efec2056cdce7593787390fc9aadf9c0c))
|
||||||
|
|
||||||
|
## [2.0.0](https://github.com/folke/trouble.nvim/compare/v1.0.2...v2.0.0) (2023-02-16)
|
||||||
|
|
||||||
|
|
||||||
|
### ⚠ BREAKING CHANGES
|
||||||
|
|
||||||
|
* Trouble now requires Neovim >= 0.7.2
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* Trouble now requires Neovim >= 0.7.2 ([ef93259](https://github.com/folke/trouble.nvim/commit/ef9325970b341d436f43c50ce876aa0a665d3cf0))
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* Focus parent before closing ([#259](https://github.com/folke/trouble.nvim/issues/259)) ([66b057b](https://github.com/folke/trouble.nvim/commit/66b057b2b07881bceb969624f4c3b5727703c2c8))
|
||||||
|
* **preview:** properly load buffer when showing preview ([949199a](https://github.com/folke/trouble.nvim/commit/949199a9ac60ce784a417f90388b8f173ef53819))
|
||||||
|
* **util:** properly load a buffer when jumping to it ([bf0eeea](https://github.com/folke/trouble.nvim/commit/bf0eeead88d59d51003f4da1b649b4977ed90e2b))
|
||||||
|
|
||||||
|
|
||||||
|
### Performance Improvements
|
||||||
|
|
||||||
|
* dont load buffers when processing items. Get line with luv instead ([82c9a9a](https://github.com/folke/trouble.nvim/commit/82c9a9a9cd2cd2cdb05e05a3e6538529e2473e14))
|
||||||
|
|
||||||
|
## [1.0.2](https://github.com/folke/trouble.nvim/compare/v1.0.1...v1.0.2) (2023-02-10)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* **telescope:** properly fix issue with relative filenames in telescope. See [#250](https://github.com/folke/trouble.nvim/issues/250) ([7da0821](https://github.com/folke/trouble.nvim/commit/7da0821d20342751a7eedecd28cf16040146cbf7))
|
||||||
|
|
||||||
|
## [1.0.1](https://github.com/folke/trouble.nvim/compare/v1.0.0...v1.0.1) (2023-01-23)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* ensure first line is selected when padding is false ([#233](https://github.com/folke/trouble.nvim/issues/233)) ([b2d6ac8](https://github.com/folke/trouble.nvim/commit/b2d6ac8607e1ab612a85c1ec563aaff3a60f0603))
|
||||||
|
* **telescope:** correctly use cwd for files. Fixes [#250](https://github.com/folke/trouble.nvim/issues/250) ([3174767](https://github.com/folke/trouble.nvim/commit/3174767c61b3786e65d78f539c60c6f70d26cdbe))
|
||||||
|
|
||||||
|
## 1.0.0 (2023-01-04)
|
||||||
|
|
||||||
|
|
||||||
|
### ⚠ BREAKING CHANGES
|
||||||
|
|
||||||
|
* renamed use_lsp_diagnostic_signs to use_diagnostic_signs
|
||||||
|
* removed deprecated commands
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* added "hover" action that defaults to "K" to show the full multiline text [#11](https://github.com/folke/trouble.nvim/issues/11) ([9111a5e](https://github.com/folke/trouble.nvim/commit/9111a5eb7881a84cd66107077118614e218fba61))
|
||||||
|
* added actions for opening in new tab, split and vsplit. Fixes [#36](https://github.com/folke/trouble.nvim/issues/36) ([c94cc59](https://github.com/folke/trouble.nvim/commit/c94cc599badb7086878559653ec705ed68579682))
|
||||||
|
* added mapping for jump & close (defaults to "o") [#15](https://github.com/folke/trouble.nvim/issues/15) ([09de784](https://github.com/folke/trouble.nvim/commit/09de78495bad194b2d0d85498a1c1a7996182a71))
|
||||||
|
* added support for vim.diagnostics and Neovim 0.7 ([735dcd5](https://github.com/folke/trouble.nvim/commit/735dcd599871179a835d1e0ebd777d4db24c2c72))
|
||||||
|
* allow proper passing of plugin options ([79513ed](https://github.com/folke/trouble.nvim/commit/79513ed42a273a1bc80d82c7e1117d3a2e0f2c79))
|
||||||
|
* Api to go to first and last items ([#157](https://github.com/folke/trouble.nvim/issues/157)) ([0649811](https://github.com/folke/trouble.nvim/commit/0649811e69a11dea4708a19deee9ab0b1e90313e))
|
||||||
|
* better preview and mode ([160fa6c](https://github.com/folke/trouble.nvim/commit/160fa6cb213db6c7a421450b67adc495ae69cef0))
|
||||||
|
* command complete ([9923b01](https://github.com/folke/trouble.nvim/commit/9923b01692a238535420d58e440b139a89c3de46))
|
||||||
|
* comments to open/toggle workspace or ducument mode directly ([f7db1c2](https://github.com/folke/trouble.nvim/commit/f7db1c29d7eb76cb3310e0aa56a4d546420e7814))
|
||||||
|
* config for auto_preview ([0ad97fb](https://github.com/folke/trouble.nvim/commit/0ad97fb67b21579729090214cbb3bce78fd153b7))
|
||||||
|
* define multiple keybindings for the same action (better for defaults) ([bf8e8ee](https://github.com/folke/trouble.nvim/commit/bf8e8ee63c38103fb42de0b889810b584e378962))
|
||||||
|
* expose items ([#41](https://github.com/folke/trouble.nvim/issues/41)) ([4f84ca4](https://github.com/folke/trouble.nvim/commit/4f84ca4530829b9448c6f13530c26df6d7020fd0))
|
||||||
|
* indent lines ([f9e6930](https://github.com/folke/trouble.nvim/commit/f9e6930b5188593b9e6408d8937093d04198e90a))
|
||||||
|
* inital version ([980fb07](https://github.com/folke/trouble.nvim/commit/980fb07fd33ea0f72b274e1ad3c8626bf8a14ac9))
|
||||||
|
* Lsp implementation ([#50](https://github.com/folke/trouble.nvim/issues/50)) ([069cdae](https://github.com/folke/trouble.nvim/commit/069cdae61d58d2477b150af91692ace636000d47))
|
||||||
|
* lsp references, loclist and quickfix lists! ([0b852c8](https://github.com/folke/trouble.nvim/commit/0b852c8418d65191983b2c9b8f90ad6d7f45ff51))
|
||||||
|
* made it easier to integrate with trouble ([1dd72c2](https://github.com/folke/trouble.nvim/commit/1dd72c22403519c160b0c694762091971bcf191e))
|
||||||
|
* make file grouping and padding configurable ([#66](https://github.com/folke/trouble.nvim/issues/66)) ([ff40475](https://github.com/folke/trouble.nvim/commit/ff40475143ecd40c86f13054935f3afc5653c469))
|
||||||
|
* make position of the trouble list configurable (top, bottom, left or right) [#27](https://github.com/folke/trouble.nvim/issues/27) ([0c9ca5e](https://github.com/folke/trouble.nvim/commit/0c9ca5e10c2e5dd8d8479e864e12383b1d614273))
|
||||||
|
* make signs configurable ([ff9fd51](https://github.com/folke/trouble.nvim/commit/ff9fd51ab05398c83c2a0b384999d49269d95572))
|
||||||
|
* make sorting keys configurable ([#190](https://github.com/folke/trouble.nvim/issues/190)) ([68d3dc5](https://github.com/folke/trouble.nvim/commit/68d3dc52fe49375fe556af69d1e91e0a88b67935))
|
||||||
|
* next/previous API. Implements [#44](https://github.com/folke/trouble.nvim/issues/44) ([a2a7dbf](https://github.com/folke/trouble.nvim/commit/a2a7dbfefc5ebdf1a9c1d37e9df1d26a3b13c1cd))
|
||||||
|
* option to automatically jump when there is only one result (fixes [#57](https://github.com/folke/trouble.nvim/issues/57)) ([#79](https://github.com/folke/trouble.nvim/issues/79)) ([09fafb2](https://github.com/folke/trouble.nvim/commit/09fafb2e01fbaa4fe6ecede10a7e7a738464deba))
|
||||||
|
* **providers.lsp:** Add definitions support ([#20](https://github.com/folke/trouble.nvim/issues/20)) ([a951198](https://github.com/folke/trouble.nvim/commit/a95119893c8dfd4b4bed42da97d601c25c7a495f))
|
||||||
|
* sort files by current directory and prefer non-hidden ([ea9a5e3](https://github.com/folke/trouble.nvim/commit/ea9a5e331b70cf4011081c951015033f0079a0cc))
|
||||||
|
* sort items by severity / filename / lnum / col ([4a45782](https://github.com/folke/trouble.nvim/commit/4a45782db943f95500b61ffce187bf4cada954ae))
|
||||||
|
* sort results by row and column isntead of just row ([#118](https://github.com/folke/trouble.nvim/issues/118)) ([5897b09](https://github.com/folke/trouble.nvim/commit/5897b09933731298382e86a5cf4d1a4861630873))
|
||||||
|
* **telescope provider:** (Smart) multiselect ([#39](https://github.com/folke/trouble.nvim/issues/39)) ([45ff198](https://github.com/folke/trouble.nvim/commit/45ff198f4d436d256f02b14db9c817024c7fc85c))
|
||||||
|
* Telescope support ([9c81e16](https://github.com/folke/trouble.nvim/commit/9c81e16adec697ffd0b694eb86e14cfee453917d))
|
||||||
|
* use vim.notify for logging ([293118e](https://github.com/folke/trouble.nvim/commit/293118e195639c373a6a744621b9341e5e18f6e4))
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* Add nowait option to keymap ([#30](https://github.com/folke/trouble.nvim/issues/30)) ([4375f1f](https://github.com/folke/trouble.nvim/commit/4375f1f0b2457fcbb91d32de457e6e3b3bb7eba7))
|
||||||
|
* added additional space between message and code ([aae12e7](https://github.com/folke/trouble.nvim/commit/aae12e7b23b3a2b8337ec5b1d6b7b4317aa3929b))
|
||||||
|
* added compatibility to retrieve signs from vim.diagnostic ([dab82ef](https://github.com/folke/trouble.nvim/commit/dab82ef0f39893f50908881fdc5e96bfb1578ba1))
|
||||||
|
* added suport for vim.diagnostic hl groups ([d25a8e6](https://github.com/folke/trouble.nvim/commit/d25a8e6779462127fb227397fa92b07bced8a6fe))
|
||||||
|
* added support for new handler signatures (backward compatible with 0.5) ([87cae94](https://github.com/folke/trouble.nvim/commit/87cae946aee4798bee621ea6108224c08c218d69))
|
||||||
|
* auto_open was broken. Fixed now [#29](https://github.com/folke/trouble.nvim/issues/29) ([a2f2b92](https://github.com/folke/trouble.nvim/commit/a2f2b9248bed41522d8caa3a7e9932981c4087ec))
|
||||||
|
* better detection of the parent window ([4c5fd8a](https://github.com/folke/trouble.nvim/commit/4c5fd8abaf6058312ebe52f662ca002bf0aa9f77))
|
||||||
|
* default to current window in jump_to_item ([#175](https://github.com/folke/trouble.nvim/issues/175)) ([ec24219](https://github.com/folke/trouble.nvim/commit/ec242197b1f72cabe17dfd61119c896f58bda672))
|
||||||
|
* don't "edit" en existing buffer. Use "buffer" instead. ([#5](https://github.com/folke/trouble.nvim/issues/5), [#6](https://github.com/folke/trouble.nvim/issues/6)) ([abef115](https://github.com/folke/trouble.nvim/commit/abef1158c0ff236333f67f9f091e5d9ae67d6a89))
|
||||||
|
* don't steal focus on auto_open. Fixes [#48](https://github.com/folke/trouble.nvim/issues/48) ([36b6813](https://github.com/folke/trouble.nvim/commit/36b6813a2103d85b469a61721b030903ddd8b3b3))
|
||||||
|
* don't try to fetch sign for "other" ([5b50990](https://github.com/folke/trouble.nvim/commit/5b509904f8865bea7d09b7a686e139077a2484c6))
|
||||||
|
* don't use file sorter for items without a valid filename ([20469be](https://github.com/folke/trouble.nvim/commit/20469be985143d024c460d95326ebeff9971d714))
|
||||||
|
* dont advance two items at a time. Fixes https://github.com/folke/todo-comments.nvim/issues/39 ([7de8bc4](https://github.com/folke/trouble.nvim/commit/7de8bc46164ec1f787dee34b6843b61251b1ea91))
|
||||||
|
* files without col/row should be set to col=1 and row=1 [#22](https://github.com/folke/trouble.nvim/issues/22) ([fcd5f1f](https://github.com/folke/trouble.nvim/commit/fcd5f1fc035ee3d9832c63a307247c09f25c9cd1))
|
||||||
|
* filetype set too early ([#230](https://github.com/folke/trouble.nvim/issues/230)) ([c4da921](https://github.com/folke/trouble.nvim/commit/c4da921ba613aa6d6659dc18edc204c37e4b8833))
|
||||||
|
* fixed auto_open swicth_to_parent. Fixes [#7](https://github.com/folke/trouble.nvim/issues/7) ([7cf1aa1](https://github.com/folke/trouble.nvim/commit/7cf1aa1195245d3098097bc3a2510dc358c87363))
|
||||||
|
* give focus back to correct window when closing ([#72](https://github.com/folke/trouble.nvim/issues/72)) ([a736b8d](https://github.com/folke/trouble.nvim/commit/a736b8db9f49b8b49ac96fbab7f8e396032cfa37))
|
||||||
|
* handle normal api calls to trouble as it should [#42](https://github.com/folke/trouble.nvim/issues/42) ([52b875d](https://github.com/folke/trouble.nvim/commit/52b875d1aaf88f32e9f070a0119190c3e65b51a5))
|
||||||
|
* if grouping is off, decrease indent ([#140](https://github.com/folke/trouble.nvim/issues/140)) ([ed65f84](https://github.com/folke/trouble.nvim/commit/ed65f84abc4a1e5d8f368d7e02601fc0357ea15e))
|
||||||
|
* lazy include telescope when needed ([7e3d4f9](https://github.com/folke/trouble.nvim/commit/7e3d4f9efc157bbfeb3e37837f8ded9289c48f25))
|
||||||
|
* lsp diag creates ugly buffers for unopened files in the workspace. Fixed now ([91d1139](https://github.com/folke/trouble.nvim/commit/91d1139d85407b99bd4d2f6850200a793631679b))
|
||||||
|
* lsp diagnostics codes ([dbbd523](https://github.com/folke/trouble.nvim/commit/dbbd523d91fe51e8421909147bf069b1ec780720))
|
||||||
|
* lsp handler error log ([#95](https://github.com/folke/trouble.nvim/issues/95)) ([063aefd](https://github.com/folke/trouble.nvim/commit/063aefd69a8146e27cde860c9ddd807891e5a119))
|
||||||
|
* **lsp:** avoid overwriting uri of result ([#60](https://github.com/folke/trouble.nvim/issues/60)) ([655391c](https://github.com/folke/trouble.nvim/commit/655391c2f592ef61943b6325030333dfacc54757))
|
||||||
|
* only use old hl groups when they exist (Fixes [#49](https://github.com/folke/trouble.nvim/issues/49)) ([d4ce76f](https://github.com/folke/trouble.nvim/commit/d4ce76fa82cdbd12dcf9dbfa682dae89b2a143ac))
|
||||||
|
* possible vim.NIL on diagnostics code ([1faa347](https://github.com/folke/trouble.nvim/commit/1faa347a93748531b5e418d84276c93da21b86a7))
|
||||||
|
* prevent segfault on closing ([756f09d](https://github.com/folke/trouble.nvim/commit/756f09de113a775ab16ba6d26c090616b40a999d))
|
||||||
|
* properly close trouble window on close ([d10ee4b](https://github.com/folke/trouble.nvim/commit/d10ee4bc99b8e2bb842c2274316db400b197cca9))
|
||||||
|
* properly exit when trouble is the last window. Fixes [#24](https://github.com/folke/trouble.nvim/issues/24) ([2b27b96](https://github.com/folke/trouble.nvim/commit/2b27b96c7893ac534ba0cbfc95d52c6c609a0b20))
|
||||||
|
* remove useless "no results" notification ([#164](https://github.com/folke/trouble.nvim/issues/164)) ([da61737](https://github.com/folke/trouble.nvim/commit/da61737d860ddc12f78e638152834487eabf0ee5)), closes [#154](https://github.com/folke/trouble.nvim/issues/154)
|
||||||
|
* removed space betweend rendering of source + code ([b676029](https://github.com/folke/trouble.nvim/commit/b6760291874d078668f4ff04d78acc0670536ca9))
|
||||||
|
* removed unused plenary require. Fixes [#1](https://github.com/folke/trouble.nvim/issues/1) ([1ff45e2](https://github.com/folke/trouble.nvim/commit/1ff45e274de32e816b891b1ca12f73f73b58a604))
|
||||||
|
* replace possible newlines in rendered text ([08d068f](https://github.com/folke/trouble.nvim/commit/08d068fb1668b7f898af721cbc8a1ae72ddf6565))
|
||||||
|
* restore item indentation ([7c93271](https://github.com/folke/trouble.nvim/commit/7c93271e7a6a147b8f4342f5b377fa863419846f))
|
||||||
|
* set buftype before filetype ([#67](https://github.com/folke/trouble.nvim/issues/67)) ([169b2ec](https://github.com/folke/trouble.nvim/commit/169b2ec3a4d0cac01f22cc8f7332f1d0a11f1fa4))
|
||||||
|
* set EndOfBuffer to LspTroubleNormal and hide ~ [#23](https://github.com/folke/trouble.nvim/issues/23) ([7d67f34](https://github.com/folke/trouble.nvim/commit/7d67f34d92b3b52ca63c84f929751d98b3f56b63))
|
||||||
|
* set nowrap for the trouble window. Fixes [#69](https://github.com/folke/trouble.nvim/issues/69) ([51dd917](https://github.com/folke/trouble.nvim/commit/51dd9175eb506b026189c70f81823dfa77defe86))
|
||||||
|
* set the filetype lastly so autocmd's can override options from it ([#126](https://github.com/folke/trouble.nvim/issues/126)) ([b5353dd](https://github.com/folke/trouble.nvim/commit/b5353ddcd09bd7e93d6f934149d25792d455a8fb))
|
||||||
|
* show warning when icons=true but devicons is not installed ([7aabea5](https://github.com/folke/trouble.nvim/commit/7aabea5cca2d51ba5432c988fe84ff9d3644637a))
|
||||||
|
* support LocationLink ([#94](https://github.com/folke/trouble.nvim/issues/94)) ([7f3761b](https://github.com/folke/trouble.nvim/commit/7f3761b6dbadd682a20bd1ff4cb588985c14c9a0))
|
||||||
|
* typos ([#55](https://github.com/folke/trouble.nvim/issues/55)) ([059ea2b](https://github.com/folke/trouble.nvim/commit/059ea2b999171f50019291ee776dd496799fdf3a))
|
||||||
|
* use deprecated vim.lsp.diagnostics for now ([afb300f](https://github.com/folke/trouble.nvim/commit/afb300f18c09f7b474783aa12eb680ea59785b46))
|
||||||
|
* use new DiagnosticChanged event ([#127](https://github.com/folke/trouble.nvim/issues/127)) ([4d0a711](https://github.com/folke/trouble.nvim/commit/4d0a711e7432eed022611ce385f3a7714e81f63b)), closes [#122](https://github.com/folke/trouble.nvim/issues/122)
|
||||||
|
* use vim.diagnostic instead of vim.lsp.diagnostic when available ([a2e2e7b](https://github.com/folke/trouble.nvim/commit/a2e2e7b53f389f84477a1a11c086c9a379af702e))
|
||||||
|
* workspace and document diagnostics were switched around ([1fa8469](https://github.com/folke/trouble.nvim/commit/1fa84691236d16a2d1c12707c1fbc54060c910f7))
|
||||||
|
|
||||||
|
|
||||||
|
### Performance Improvements
|
||||||
|
|
||||||
|
* debounce auto refresh when diagnostics get updated ([068476d](https://github.com/folke/trouble.nvim/commit/068476db8576e5b32acf20df040e7fca032cd11d))
|
||||||
|
* much faster async preview ([2c9b319](https://github.com/folke/trouble.nvim/commit/2c9b3195a7fa8cfc19a368666c9f83fd7a20a482))
|
||||||
|
* only fetch line when needed. Fixes [#26](https://github.com/folke/trouble.nvim/issues/26) ([52f18fd](https://github.com/folke/trouble.nvim/commit/52f18fd6bea57af54265247a3ec39f19a31adce3))
|
||||||
|
* only update diagnostics once when window changes ([d965d22](https://github.com/folke/trouble.nvim/commit/d965d22ee37e50be0ab32f6a5987a8cd88206f10))
|
||||||
|
* prevent nested loading of preview [#2](https://github.com/folke/trouble.nvim/issues/2) ([b20a784](https://github.com/folke/trouble.nvim/commit/b20a7844a035cf6795270db575ad8c4db2a774c9))
|
||||||
|
* use vim.lsp.util.get_line to get line instad of bufload ([607b1d5](https://github.com/folke/trouble.nvim/commit/607b1d5bbfdbd19242659415746b5e62f5ddfb94))
|
||||||
|
|
||||||
|
|
||||||
|
### Code Refactoring
|
||||||
|
|
||||||
|
* removed deprecated commands ([dd89ad9](https://github.com/folke/trouble.nvim/commit/dd89ad9ebb63e131098ff04857f8598eb88d8d79))
|
||||||
|
* renamed use_lsp_diagnostic_signs to use_diagnostic_signs ([9db77e1](https://github.com/folke/trouble.nvim/commit/9db77e194d848744139673aa246efa00fbcba982))
|
201
bundle/trouble.nvim/LICENSE
vendored
Normal file
201
bundle/trouble.nvim/LICENSE
vendored
Normal file
@ -0,0 +1,201 @@
|
|||||||
|
Apache License
|
||||||
|
Version 2.0, January 2004
|
||||||
|
http://www.apache.org/licenses/
|
||||||
|
|
||||||
|
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||||
|
|
||||||
|
1. Definitions.
|
||||||
|
|
||||||
|
"License" shall mean the terms and conditions for use, reproduction,
|
||||||
|
and distribution as defined by Sections 1 through 9 of this document.
|
||||||
|
|
||||||
|
"Licensor" shall mean the copyright owner or entity authorized by
|
||||||
|
the copyright owner that is granting the License.
|
||||||
|
|
||||||
|
"Legal Entity" shall mean the union of the acting entity and all
|
||||||
|
other entities that control, are controlled by, or are under common
|
||||||
|
control with that entity. For the purposes of this definition,
|
||||||
|
"control" means (i) the power, direct or indirect, to cause the
|
||||||
|
direction or management of such entity, whether by contract or
|
||||||
|
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||||
|
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||||
|
|
||||||
|
"You" (or "Your") shall mean an individual or Legal Entity
|
||||||
|
exercising permissions granted by this License.
|
||||||
|
|
||||||
|
"Source" form shall mean the preferred form for making modifications,
|
||||||
|
including but not limited to software source code, documentation
|
||||||
|
source, and configuration files.
|
||||||
|
|
||||||
|
"Object" form shall mean any form resulting from mechanical
|
||||||
|
transformation or translation of a Source form, including but
|
||||||
|
not limited to compiled object code, generated documentation,
|
||||||
|
and conversions to other media types.
|
||||||
|
|
||||||
|
"Work" shall mean the work of authorship, whether in Source or
|
||||||
|
Object form, made available under the License, as indicated by a
|
||||||
|
copyright notice that is included in or attached to the work
|
||||||
|
(an example is provided in the Appendix below).
|
||||||
|
|
||||||
|
"Derivative Works" shall mean any work, whether in Source or Object
|
||||||
|
form, that is based on (or derived from) the Work and for which the
|
||||||
|
editorial revisions, annotations, elaborations, or other modifications
|
||||||
|
represent, as a whole, an original work of authorship. For the purposes
|
||||||
|
of this License, Derivative Works shall not include works that remain
|
||||||
|
separable from, or merely link (or bind by name) to the interfaces of,
|
||||||
|
the Work and Derivative Works thereof.
|
||||||
|
|
||||||
|
"Contribution" shall mean any work of authorship, including
|
||||||
|
the original version of the Work and any modifications or additions
|
||||||
|
to that Work or Derivative Works thereof, that is intentionally
|
||||||
|
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||||
|
or by an individual or Legal Entity authorized to submit on behalf of
|
||||||
|
the copyright owner. For the purposes of this definition, "submitted"
|
||||||
|
means any form of electronic, verbal, or written communication sent
|
||||||
|
to the Licensor or its representatives, including but not limited to
|
||||||
|
communication on electronic mailing lists, source code control systems,
|
||||||
|
and issue tracking systems that are managed by, or on behalf of, the
|
||||||
|
Licensor for the purpose of discussing and improving the Work, but
|
||||||
|
excluding communication that is conspicuously marked or otherwise
|
||||||
|
designated in writing by the copyright owner as "Not a Contribution."
|
||||||
|
|
||||||
|
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||||
|
on behalf of whom a Contribution has been received by Licensor and
|
||||||
|
subsequently incorporated within the Work.
|
||||||
|
|
||||||
|
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||||
|
this License, each Contributor hereby grants to You a perpetual,
|
||||||
|
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||||
|
copyright license to reproduce, prepare Derivative Works of,
|
||||||
|
publicly display, publicly perform, sublicense, and distribute the
|
||||||
|
Work and such Derivative Works in Source or Object form.
|
||||||
|
|
||||||
|
3. Grant of Patent License. Subject to the terms and conditions of
|
||||||
|
this License, each Contributor hereby grants to You a perpetual,
|
||||||
|
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||||
|
(except as stated in this section) patent license to make, have made,
|
||||||
|
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||||
|
where such license applies only to those patent claims licensable
|
||||||
|
by such Contributor that are necessarily infringed by their
|
||||||
|
Contribution(s) alone or by combination of their Contribution(s)
|
||||||
|
with the Work to which such Contribution(s) was submitted. If You
|
||||||
|
institute patent litigation against any entity (including a
|
||||||
|
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||||
|
or a Contribution incorporated within the Work constitutes direct
|
||||||
|
or contributory patent infringement, then any patent licenses
|
||||||
|
granted to You under this License for that Work shall terminate
|
||||||
|
as of the date such litigation is filed.
|
||||||
|
|
||||||
|
4. Redistribution. You may reproduce and distribute copies of the
|
||||||
|
Work or Derivative Works thereof in any medium, with or without
|
||||||
|
modifications, and in Source or Object form, provided that You
|
||||||
|
meet the following conditions:
|
||||||
|
|
||||||
|
(a) You must give any other recipients of the Work or
|
||||||
|
Derivative Works a copy of this License; and
|
||||||
|
|
||||||
|
(b) You must cause any modified files to carry prominent notices
|
||||||
|
stating that You changed the files; and
|
||||||
|
|
||||||
|
(c) You must retain, in the Source form of any Derivative Works
|
||||||
|
that You distribute, all copyright, patent, trademark, and
|
||||||
|
attribution notices from the Source form of the Work,
|
||||||
|
excluding those notices that do not pertain to any part of
|
||||||
|
the Derivative Works; and
|
||||||
|
|
||||||
|
(d) If the Work includes a "NOTICE" text file as part of its
|
||||||
|
distribution, then any Derivative Works that You distribute must
|
||||||
|
include a readable copy of the attribution notices contained
|
||||||
|
within such NOTICE file, excluding those notices that do not
|
||||||
|
pertain to any part of the Derivative Works, in at least one
|
||||||
|
of the following places: within a NOTICE text file distributed
|
||||||
|
as part of the Derivative Works; within the Source form or
|
||||||
|
documentation, if provided along with the Derivative Works; or,
|
||||||
|
within a display generated by the Derivative Works, if and
|
||||||
|
wherever such third-party notices normally appear. The contents
|
||||||
|
of the NOTICE file are for informational purposes only and
|
||||||
|
do not modify the License. You may add Your own attribution
|
||||||
|
notices within Derivative Works that You distribute, alongside
|
||||||
|
or as an addendum to the NOTICE text from the Work, provided
|
||||||
|
that such additional attribution notices cannot be construed
|
||||||
|
as modifying the License.
|
||||||
|
|
||||||
|
You may add Your own copyright statement to Your modifications and
|
||||||
|
may provide additional or different license terms and conditions
|
||||||
|
for use, reproduction, or distribution of Your modifications, or
|
||||||
|
for any such Derivative Works as a whole, provided Your use,
|
||||||
|
reproduction, and distribution of the Work otherwise complies with
|
||||||
|
the conditions stated in this License.
|
||||||
|
|
||||||
|
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||||
|
any Contribution intentionally submitted for inclusion in the Work
|
||||||
|
by You to the Licensor shall be under the terms and conditions of
|
||||||
|
this License, without any additional terms or conditions.
|
||||||
|
Notwithstanding the above, nothing herein shall supersede or modify
|
||||||
|
the terms of any separate license agreement you may have executed
|
||||||
|
with Licensor regarding such Contributions.
|
||||||
|
|
||||||
|
6. Trademarks. This License does not grant permission to use the trade
|
||||||
|
names, trademarks, service marks, or product names of the Licensor,
|
||||||
|
except as required for reasonable and customary use in describing the
|
||||||
|
origin of the Work and reproducing the content of the NOTICE file.
|
||||||
|
|
||||||
|
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||||
|
agreed to in writing, Licensor provides the Work (and each
|
||||||
|
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||||
|
implied, including, without limitation, any warranties or conditions
|
||||||
|
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||||
|
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||||
|
appropriateness of using or redistributing the Work and assume any
|
||||||
|
risks associated with Your exercise of permissions under this License.
|
||||||
|
|
||||||
|
8. Limitation of Liability. In no event and under no legal theory,
|
||||||
|
whether in tort (including negligence), contract, or otherwise,
|
||||||
|
unless required by applicable law (such as deliberate and grossly
|
||||||
|
negligent acts) or agreed to in writing, shall any Contributor be
|
||||||
|
liable to You for damages, including any direct, indirect, special,
|
||||||
|
incidental, or consequential damages of any character arising as a
|
||||||
|
result of this License or out of the use or inability to use the
|
||||||
|
Work (including but not limited to damages for loss of goodwill,
|
||||||
|
work stoppage, computer failure or malfunction, or any and all
|
||||||
|
other commercial damages or losses), even if such Contributor
|
||||||
|
has been advised of the possibility of such damages.
|
||||||
|
|
||||||
|
9. Accepting Warranty or Additional Liability. While redistributing
|
||||||
|
the Work or Derivative Works thereof, You may choose to offer,
|
||||||
|
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||||
|
or other liability obligations and/or rights consistent with this
|
||||||
|
License. However, in accepting such obligations, You may act only
|
||||||
|
on Your own behalf and on Your sole responsibility, not on behalf
|
||||||
|
of any other Contributor, and only if You agree to indemnify,
|
||||||
|
defend, and hold each Contributor harmless for any liability
|
||||||
|
incurred by, or claims asserted against, such Contributor by reason
|
||||||
|
of your accepting any such warranty or additional liability.
|
||||||
|
|
||||||
|
END OF TERMS AND CONDITIONS
|
||||||
|
|
||||||
|
APPENDIX: How to apply the Apache License to your work.
|
||||||
|
|
||||||
|
To apply the Apache License to your work, attach the following
|
||||||
|
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||||
|
replaced with your own identifying information. (Don't include
|
||||||
|
the brackets!) The text should be enclosed in the appropriate
|
||||||
|
comment syntax for the file format. We also recommend that a
|
||||||
|
file or class name and description of purpose be included on the
|
||||||
|
same "printed page" as the copyright notice for easier
|
||||||
|
identification within third-party archives.
|
||||||
|
|
||||||
|
Copyright [yyyy] [name of copyright owner]
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
255
bundle/trouble.nvim/README.md
vendored
Normal file
255
bundle/trouble.nvim/README.md
vendored
Normal file
@ -0,0 +1,255 @@
|
|||||||
|
# 🚦 Trouble
|
||||||
|
|
||||||
|
A pretty list for showing diagnostics, references, telescope results, quickfix and location lists to help you solve all the trouble your code is causing.
|
||||||
|
|
||||||
|
![LSP Trouble Screenshot](./media/shot.png)
|
||||||
|
|
||||||
|
## ✨ Features
|
||||||
|
|
||||||
|
- pretty list of:
|
||||||
|
- Diagnostics
|
||||||
|
- LSP references
|
||||||
|
- LSP implementations
|
||||||
|
- LSP definitions
|
||||||
|
- LSP type definitions
|
||||||
|
- quickfix list
|
||||||
|
- location list
|
||||||
|
- [Telescope](https://github.com/nvim-telescope/telescope.nvim) search results
|
||||||
|
- automatically updates on new diagnostics
|
||||||
|
- toggle **diagnostics** mode between **workspace** or **document**
|
||||||
|
- **interactive preview** in your last accessed window
|
||||||
|
- _cancel_ preview or _jump_ to the location
|
||||||
|
- configurable actions, signs, highlights,...
|
||||||
|
|
||||||
|
## ⚡️ Requirements
|
||||||
|
|
||||||
|
- Neovim >= 0.7.2
|
||||||
|
- Properly configured Neovim LSP client
|
||||||
|
- [nvim-web-devicons](https://github.com/nvim-tree/nvim-web-devicons) is optional to enable file icons
|
||||||
|
- a theme with properly configured highlight groups for Neovim Diagnostics
|
||||||
|
- or install 🌈 [lsp-colors](https://github.com/folke/lsp-colors.nvim) to automatically create the missing highlight groups
|
||||||
|
- a [patched font](https://www.nerdfonts.com/) for the default severity and fold icons
|
||||||
|
|
||||||
|
## 📦 Installation
|
||||||
|
|
||||||
|
Install the plugin with your preferred package manager:
|
||||||
|
|
||||||
|
### [lazy.nvim](https://github.com/folke/lazy.nvim)
|
||||||
|
|
||||||
|
```lua
|
||||||
|
return {
|
||||||
|
"folke/trouble.nvim",
|
||||||
|
dependencies = { "nvim-tree/nvim-web-devicons" },
|
||||||
|
opts = {
|
||||||
|
-- your configuration comes here
|
||||||
|
-- or leave it empty to use the default settings
|
||||||
|
-- refer to the configuration section below
|
||||||
|
},
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
## ⚙️ Configuration
|
||||||
|
|
||||||
|
### Setup
|
||||||
|
|
||||||
|
Trouble comes with the following defaults:
|
||||||
|
|
||||||
|
```lua
|
||||||
|
{
|
||||||
|
position = "bottom", -- position of the list can be: bottom, top, left, right
|
||||||
|
height = 10, -- height of the trouble list when position is top or bottom
|
||||||
|
width = 50, -- width of the list when position is left or right
|
||||||
|
icons = true, -- use devicons for filenames
|
||||||
|
mode = "workspace_diagnostics", -- "workspace_diagnostics", "document_diagnostics", "quickfix", "lsp_references", "loclist"
|
||||||
|
severity = nil, -- nil (ALL) or vim.diagnostic.severity.ERROR | WARN | INFO | HINT
|
||||||
|
fold_open = "", -- icon used for open folds
|
||||||
|
fold_closed = "", -- icon used for closed folds
|
||||||
|
group = true, -- group results by file
|
||||||
|
padding = true, -- add an extra new line on top of the list
|
||||||
|
cycle_results = true, -- cycle item list when reaching beginning or end of list
|
||||||
|
action_keys = { -- key mappings for actions in the trouble list
|
||||||
|
-- map to {} to remove a mapping, for example:
|
||||||
|
-- close = {},
|
||||||
|
close = "q", -- close the list
|
||||||
|
cancel = "<esc>", -- cancel the preview and get back to your last window / buffer / cursor
|
||||||
|
refresh = "r", -- manually refresh
|
||||||
|
jump = {"<cr>", "<tab>"}, -- jump to the diagnostic or open / close folds
|
||||||
|
open_split = { "<c-x>" }, -- open buffer in new split
|
||||||
|
open_vsplit = { "<c-v>" }, -- open buffer in new vsplit
|
||||||
|
open_tab = { "<c-t>" }, -- open buffer in new tab
|
||||||
|
jump_close = {"o"}, -- jump to the diagnostic and close the list
|
||||||
|
toggle_mode = "m", -- toggle between "workspace" and "document" diagnostics mode
|
||||||
|
switch_severity = "s", -- switch "diagnostics" severity filter level to HINT / INFO / WARN / ERROR
|
||||||
|
toggle_preview = "P", -- toggle auto_preview
|
||||||
|
hover = "K", -- opens a small popup with the full multiline message
|
||||||
|
preview = "p", -- preview the diagnostic location
|
||||||
|
close_folds = {"zM", "zm"}, -- close all folds
|
||||||
|
open_folds = {"zR", "zr"}, -- open all folds
|
||||||
|
toggle_fold = {"zA", "za"}, -- toggle fold of current file
|
||||||
|
previous = "k", -- previous item
|
||||||
|
next = "j" -- next item
|
||||||
|
},
|
||||||
|
indent_lines = true, -- add an indent guide below the fold icons
|
||||||
|
auto_open = false, -- automatically open the list when you have diagnostics
|
||||||
|
auto_close = false, -- automatically close the list when you have no diagnostics
|
||||||
|
auto_preview = true, -- automatically preview the location of the diagnostic. <esc> to close preview and go back to last window
|
||||||
|
auto_fold = false, -- automatically fold a file trouble list at creation
|
||||||
|
auto_jump = {"lsp_definitions"}, -- for the given modes, automatically jump if there is only a single result
|
||||||
|
signs = {
|
||||||
|
-- icons / text used for a diagnostic
|
||||||
|
error = "",
|
||||||
|
warning = "",
|
||||||
|
hint = "",
|
||||||
|
information = "",
|
||||||
|
other = "",
|
||||||
|
},
|
||||||
|
use_diagnostic_signs = false -- enabling this will use the signs defined in your lsp client
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
> 💡 if you don't want to use icons or a patched font, you can use the settings below
|
||||||
|
|
||||||
|
```lua
|
||||||
|
-- settings without a patched font or icons
|
||||||
|
{
|
||||||
|
icons = false,
|
||||||
|
fold_open = "v", -- icon used for open folds
|
||||||
|
fold_closed = ">", -- icon used for closed folds
|
||||||
|
indent_lines = false, -- add an indent guide below the fold icons
|
||||||
|
signs = {
|
||||||
|
-- icons / text used for a diagnostic
|
||||||
|
error = "error",
|
||||||
|
warning = "warn",
|
||||||
|
hint = "hint",
|
||||||
|
information = "info"
|
||||||
|
},
|
||||||
|
use_diagnostic_signs = false -- enabling this will use the signs defined in your lsp client
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
## 🚀 Usage
|
||||||
|
|
||||||
|
### Commands
|
||||||
|
|
||||||
|
Trouble comes with the following commands:
|
||||||
|
|
||||||
|
- `Trouble [mode]`: open the list
|
||||||
|
- `TroubleClose [mode]`: close the list
|
||||||
|
- `TroubleToggle [mode]`: toggle the list
|
||||||
|
- `TroubleRefresh`: manually refresh the active list
|
||||||
|
|
||||||
|
Modes:
|
||||||
|
|
||||||
|
- **document_diagnostics:** document diagnostics from the builtin LSP client
|
||||||
|
- **workspace_diagnostics:** workspace diagnostics from the builtin LSP client
|
||||||
|
- **lsp_references:** references of the word under the cursor from the builtin LSP client
|
||||||
|
- **lsp_definitions:** definitions of the word under the cursor from the builtin LSP client
|
||||||
|
|
||||||
|
* **lsp_type_definitions:** type definitions of the word under the cursor from the builtin LSP client
|
||||||
|
|
||||||
|
- **quickfix:** [quickfix](https://neovim.io/doc/user/quickfix.html) items
|
||||||
|
- **loclist:** items from the window's [location list](https://neovim.io/doc/user/quickfix.html)
|
||||||
|
|
||||||
|
Example keybindings:
|
||||||
|
|
||||||
|
```vim
|
||||||
|
" Vim Script
|
||||||
|
nnoremap <leader>xx <cmd>TroubleToggle<cr>
|
||||||
|
nnoremap <leader>xw <cmd>TroubleToggle workspace_diagnostics<cr>
|
||||||
|
nnoremap <leader>xd <cmd>TroubleToggle document_diagnostics<cr>
|
||||||
|
nnoremap <leader>xq <cmd>TroubleToggle quickfix<cr>
|
||||||
|
nnoremap <leader>xl <cmd>TroubleToggle loclist<cr>
|
||||||
|
nnoremap gR <cmd>TroubleToggle lsp_references<cr>
|
||||||
|
```
|
||||||
|
|
||||||
|
```lua
|
||||||
|
-- Lua
|
||||||
|
vim.keymap.set("n", "<leader>xx", "<cmd>TroubleToggle<cr>",
|
||||||
|
{silent = true, noremap = true}
|
||||||
|
)
|
||||||
|
vim.keymap.set("n", "<leader>xw", "<cmd>TroubleToggle workspace_diagnostics<cr>",
|
||||||
|
{silent = true, noremap = true}
|
||||||
|
)
|
||||||
|
vim.keymap.set("n", "<leader>xd", "<cmd>TroubleToggle document_diagnostics<cr>",
|
||||||
|
{silent = true, noremap = true}
|
||||||
|
)
|
||||||
|
vim.keymap.set("n", "<leader>xl", "<cmd>TroubleToggle loclist<cr>",
|
||||||
|
{silent = true, noremap = true}
|
||||||
|
)
|
||||||
|
vim.keymap.set("n", "<leader>xq", "<cmd>TroubleToggle quickfix<cr>",
|
||||||
|
{silent = true, noremap = true}
|
||||||
|
)
|
||||||
|
vim.keymap.set("n", "gR", "<cmd>TroubleToggle lsp_references<cr>",
|
||||||
|
{silent = true, noremap = true}
|
||||||
|
)
|
||||||
|
```
|
||||||
|
|
||||||
|
### API
|
||||||
|
|
||||||
|
You can use the following functions in your keybindings:
|
||||||
|
|
||||||
|
```lua
|
||||||
|
-- jump to the next item, skipping the groups
|
||||||
|
require("trouble").next({skip_groups = true, jump = true});
|
||||||
|
|
||||||
|
-- jump to the previous item, skipping the groups
|
||||||
|
require("trouble").previous({skip_groups = true, jump = true});
|
||||||
|
|
||||||
|
-- jump to the first item, skipping the groups
|
||||||
|
require("trouble").first({skip_groups = true, jump = true});
|
||||||
|
|
||||||
|
-- jump to the last item, skipping the groups
|
||||||
|
require("trouble").last({skip_groups = true, jump = true});
|
||||||
|
```
|
||||||
|
|
||||||
|
### Telescope
|
||||||
|
|
||||||
|
You can easily open any search results in **Trouble**, by defining a custom action:
|
||||||
|
|
||||||
|
```lua
|
||||||
|
local actions = require("telescope.actions")
|
||||||
|
local trouble = require("trouble.providers.telescope")
|
||||||
|
|
||||||
|
local telescope = require("telescope")
|
||||||
|
|
||||||
|
telescope.setup {
|
||||||
|
defaults = {
|
||||||
|
mappings = {
|
||||||
|
i = { ["<c-t>"] = trouble.open_with_trouble },
|
||||||
|
n = { ["<c-t>"] = trouble.open_with_trouble },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
When you open telescope, you can now hit `<c-t>` to open the results in **Trouble**
|
||||||
|
|
||||||
|
## 🎨 Colors
|
||||||
|
|
||||||
|
The table below shows all the highlight groups defined for Trouble.
|
||||||
|
|
||||||
|
| Highlight Group |
|
||||||
|
| ------------------------ |
|
||||||
|
| _TroubleCount_ |
|
||||||
|
| _TroubleError_ |
|
||||||
|
| _TroubleNormal_ |
|
||||||
|
| _TroubleTextInformation_ |
|
||||||
|
| _TroubleSignWarning_ |
|
||||||
|
| _TroubleLocation_ |
|
||||||
|
| _TroubleWarning_ |
|
||||||
|
| _TroublePreview_ |
|
||||||
|
| _TroubleTextError_ |
|
||||||
|
| _TroubleSignInformation_ |
|
||||||
|
| _TroubleIndent_ |
|
||||||
|
| _TroubleSource_ |
|
||||||
|
| _TroubleSignHint_ |
|
||||||
|
| _TroubleSignOther_ |
|
||||||
|
| _TroubleFoldIcon_ |
|
||||||
|
| _TroubleTextWarning_ |
|
||||||
|
| _TroubleCode_ |
|
||||||
|
| _TroubleInformation_ |
|
||||||
|
| _TroubleSignError_ |
|
||||||
|
| _TroubleFile_ |
|
||||||
|
| _TroubleHint_ |
|
||||||
|
| _TroubleTextHint_ |
|
||||||
|
| _TroubleText_ |
|
291
bundle/trouble.nvim/doc/trouble.nvim.txt
vendored
Normal file
291
bundle/trouble.nvim/doc/trouble.nvim.txt
vendored
Normal file
@ -0,0 +1,291 @@
|
|||||||
|
*trouble.nvim.txt* For Neovim >= 0.8.0 Last change: 2023 June 24
|
||||||
|
|
||||||
|
==============================================================================
|
||||||
|
Table of Contents *trouble.nvim-table-of-contents*
|
||||||
|
|
||||||
|
1. Trouble |trouble.nvim-trouble|
|
||||||
|
- Features |trouble.nvim-trouble-features|
|
||||||
|
- Requirements |trouble.nvim-trouble-requirements|
|
||||||
|
- Installation |trouble.nvim-trouble-installation|
|
||||||
|
- Configuration |trouble.nvim-trouble-configuration|
|
||||||
|
- Usage |trouble.nvim-trouble-usage|
|
||||||
|
- Colors |trouble.nvim-trouble-colors|
|
||||||
|
|
||||||
|
==============================================================================
|
||||||
|
1. Trouble *trouble.nvim-trouble*
|
||||||
|
|
||||||
|
A pretty list for showing diagnostics, references, telescope results, quickfix
|
||||||
|
and location lists to help you solve all the trouble your code is causing.
|
||||||
|
|
||||||
|
|
||||||
|
FEATURES *trouble.nvim-trouble-features*
|
||||||
|
|
||||||
|
- pretty list of:
|
||||||
|
- Diagnostics
|
||||||
|
- LSP references
|
||||||
|
- LSP implementations
|
||||||
|
- LSP definitions
|
||||||
|
- LSP type definitions
|
||||||
|
- quickfix list
|
||||||
|
- location list
|
||||||
|
- Telescope <https://github.com/nvim-telescope/telescope.nvim> search results
|
||||||
|
- automatically updates on new diagnostics
|
||||||
|
- toggle **diagnostics** mode between **workspace** or **document**
|
||||||
|
- **interactive preview** in your last accessed window
|
||||||
|
- _cancel_ preview or _jump_ to the location
|
||||||
|
- configurable actions, signs, highlights,…
|
||||||
|
|
||||||
|
|
||||||
|
REQUIREMENTS *trouble.nvim-trouble-requirements*
|
||||||
|
|
||||||
|
- Neovim >= 0.7.2
|
||||||
|
- Properly configured Neovim LSP client
|
||||||
|
- nvim-web-devicons <https://github.com/nvim-tree/nvim-web-devicons> is optional to enable file icons
|
||||||
|
- a theme with properly configured highlight groups for Neovim Diagnostics
|
||||||
|
- or install lsp-colors <https://github.com/folke/lsp-colors.nvim> to automatically create the missing highlight groups
|
||||||
|
- a patched font <https://www.nerdfonts.com/> for the default severity and fold icons
|
||||||
|
|
||||||
|
|
||||||
|
INSTALLATION *trouble.nvim-trouble-installation*
|
||||||
|
|
||||||
|
Install the plugin with your preferred package manager:
|
||||||
|
|
||||||
|
|
||||||
|
LAZY.NVIM ~
|
||||||
|
|
||||||
|
>lua
|
||||||
|
return {
|
||||||
|
"folke/trouble.nvim",
|
||||||
|
dependencies = { "nvim-tree/nvim-web-devicons" },
|
||||||
|
opts = {
|
||||||
|
-- your configuration comes here
|
||||||
|
-- or leave it empty to use the default settings
|
||||||
|
-- refer to the configuration section below
|
||||||
|
},
|
||||||
|
}
|
||||||
|
<
|
||||||
|
|
||||||
|
|
||||||
|
CONFIGURATION *trouble.nvim-trouble-configuration*
|
||||||
|
|
||||||
|
|
||||||
|
SETUP ~
|
||||||
|
|
||||||
|
Trouble comes with the following defaults:
|
||||||
|
|
||||||
|
>lua
|
||||||
|
{
|
||||||
|
position = "bottom", -- position of the list can be: bottom, top, left, right
|
||||||
|
height = 10, -- height of the trouble list when position is top or bottom
|
||||||
|
width = 50, -- width of the list when position is left or right
|
||||||
|
icons = true, -- use devicons for filenames
|
||||||
|
mode = "workspace_diagnostics", -- "workspace_diagnostics", "document_diagnostics", "quickfix", "lsp_references", "loclist"
|
||||||
|
severity = nil, -- nil (ALL) or vim.diagnostic.severity.ERROR | WARN | INFO | HINT
|
||||||
|
fold_open = "", -- icon used for open folds
|
||||||
|
fold_closed = "", -- icon used for closed folds
|
||||||
|
group = true, -- group results by file
|
||||||
|
padding = true, -- add an extra new line on top of the list
|
||||||
|
cycle_results = true, -- cycle item list when reaching beginning or end of list
|
||||||
|
action_keys = { -- key mappings for actions in the trouble list
|
||||||
|
-- map to {} to remove a mapping, for example:
|
||||||
|
-- close = {},
|
||||||
|
close = "q", -- close the list
|
||||||
|
cancel = "<esc>", -- cancel the preview and get back to your last window / buffer / cursor
|
||||||
|
refresh = "r", -- manually refresh
|
||||||
|
jump = {"<cr>", "<tab>"}, -- jump to the diagnostic or open / close folds
|
||||||
|
open_split = { "<c-x>" }, -- open buffer in new split
|
||||||
|
open_vsplit = { "<c-v>" }, -- open buffer in new vsplit
|
||||||
|
open_tab = { "<c-t>" }, -- open buffer in new tab
|
||||||
|
jump_close = {"o"}, -- jump to the diagnostic and close the list
|
||||||
|
toggle_mode = "m", -- toggle between "workspace" and "document" diagnostics mode
|
||||||
|
switch_severity = "s", -- switch "diagnostics" severity filter level to HINT / INFO / WARN / ERROR
|
||||||
|
toggle_preview = "P", -- toggle auto_preview
|
||||||
|
hover = "K", -- opens a small popup with the full multiline message
|
||||||
|
preview = "p", -- preview the diagnostic location
|
||||||
|
close_folds = {"zM", "zm"}, -- close all folds
|
||||||
|
open_folds = {"zR", "zr"}, -- open all folds
|
||||||
|
toggle_fold = {"zA", "za"}, -- toggle fold of current file
|
||||||
|
previous = "k", -- previous item
|
||||||
|
next = "j" -- next item
|
||||||
|
},
|
||||||
|
indent_lines = true, -- add an indent guide below the fold icons
|
||||||
|
auto_open = false, -- automatically open the list when you have diagnostics
|
||||||
|
auto_close = false, -- automatically close the list when you have no diagnostics
|
||||||
|
auto_preview = true, -- automatically preview the location of the diagnostic. <esc> to close preview and go back to last window
|
||||||
|
auto_fold = false, -- automatically fold a file trouble list at creation
|
||||||
|
auto_jump = {"lsp_definitions"}, -- for the given modes, automatically jump if there is only a single result
|
||||||
|
signs = {
|
||||||
|
-- icons / text used for a diagnostic
|
||||||
|
error = "",
|
||||||
|
warning = "",
|
||||||
|
hint = "",
|
||||||
|
information = "",
|
||||||
|
other = "",
|
||||||
|
},
|
||||||
|
use_diagnostic_signs = false -- enabling this will use the signs defined in your lsp client
|
||||||
|
}
|
||||||
|
<
|
||||||
|
|
||||||
|
|
||||||
|
if you don’t want to use icons or a patched font, you can use the settings
|
||||||
|
below
|
||||||
|
>lua
|
||||||
|
-- settings without a patched font or icons
|
||||||
|
{
|
||||||
|
icons = false,
|
||||||
|
fold_open = "v", -- icon used for open folds
|
||||||
|
fold_closed = ">", -- icon used for closed folds
|
||||||
|
indent_lines = false, -- add an indent guide below the fold icons
|
||||||
|
signs = {
|
||||||
|
-- icons / text used for a diagnostic
|
||||||
|
error = "error",
|
||||||
|
warning = "warn",
|
||||||
|
hint = "hint",
|
||||||
|
information = "info"
|
||||||
|
},
|
||||||
|
use_diagnostic_signs = false -- enabling this will use the signs defined in your lsp client
|
||||||
|
}
|
||||||
|
<
|
||||||
|
|
||||||
|
|
||||||
|
USAGE *trouble.nvim-trouble-usage*
|
||||||
|
|
||||||
|
|
||||||
|
COMMANDS ~
|
||||||
|
|
||||||
|
Trouble comes with the following commands:
|
||||||
|
|
||||||
|
- `Trouble [mode]`open the list
|
||||||
|
- `TroubleClose [mode]`close the list
|
||||||
|
- `TroubleToggle [mode]`toggle the list
|
||||||
|
- `TroubleRefresh`manually refresh the active list
|
||||||
|
|
||||||
|
Modes:
|
||||||
|
|
||||||
|
- **document_diagnostics:** document diagnostics from the builtin LSP client
|
||||||
|
- **workspace_diagnostics:** workspace diagnostics from the builtin LSP client
|
||||||
|
- **lsp_references:** references of the word under the cursor from the builtin
|
||||||
|
LSP client
|
||||||
|
- **lsp_definitions:** definitions of the word under the cursor from the builtin
|
||||||
|
LSP client
|
||||||
|
- **lsp_type_definitions:** type definitions of the word under the cursor from
|
||||||
|
the builtin LSP client
|
||||||
|
- **quickfix:** |quickfix| items
|
||||||
|
- **loclist:** items from the window’s |location list|
|
||||||
|
|
||||||
|
Example keybindings:
|
||||||
|
|
||||||
|
>vim
|
||||||
|
" Vim Script
|
||||||
|
nnoremap <leader>xx <cmd>TroubleToggle<cr>
|
||||||
|
nnoremap <leader>xw <cmd>TroubleToggle workspace_diagnostics<cr>
|
||||||
|
nnoremap <leader>xd <cmd>TroubleToggle document_diagnostics<cr>
|
||||||
|
nnoremap <leader>xq <cmd>TroubleToggle quickfix<cr>
|
||||||
|
nnoremap <leader>xl <cmd>TroubleToggle loclist<cr>
|
||||||
|
nnoremap gR <cmd>TroubleToggle lsp_references<cr>
|
||||||
|
<
|
||||||
|
|
||||||
|
>lua
|
||||||
|
-- Lua
|
||||||
|
vim.keymap.set("n", "<leader>xx", "<cmd>TroubleToggle<cr>",
|
||||||
|
{silent = true, noremap = true}
|
||||||
|
)
|
||||||
|
vim.keymap.set("n", "<leader>xw", "<cmd>TroubleToggle workspace_diagnostics<cr>",
|
||||||
|
{silent = true, noremap = true}
|
||||||
|
)
|
||||||
|
vim.keymap.set("n", "<leader>xd", "<cmd>TroubleToggle document_diagnostics<cr>",
|
||||||
|
{silent = true, noremap = true}
|
||||||
|
)
|
||||||
|
vim.keymap.set("n", "<leader>xl", "<cmd>TroubleToggle loclist<cr>",
|
||||||
|
{silent = true, noremap = true}
|
||||||
|
)
|
||||||
|
vim.keymap.set("n", "<leader>xq", "<cmd>TroubleToggle quickfix<cr>",
|
||||||
|
{silent = true, noremap = true}
|
||||||
|
)
|
||||||
|
vim.keymap.set("n", "gR", "<cmd>TroubleToggle lsp_references<cr>",
|
||||||
|
{silent = true, noremap = true}
|
||||||
|
)
|
||||||
|
<
|
||||||
|
|
||||||
|
|
||||||
|
API ~
|
||||||
|
|
||||||
|
You can use the following functions in your keybindings:
|
||||||
|
|
||||||
|
>lua
|
||||||
|
-- jump to the next item, skipping the groups
|
||||||
|
require("trouble").next({skip_groups = true, jump = true});
|
||||||
|
|
||||||
|
-- jump to the previous item, skipping the groups
|
||||||
|
require("trouble").previous({skip_groups = true, jump = true});
|
||||||
|
|
||||||
|
-- jump to the first item, skipping the groups
|
||||||
|
require("trouble").first({skip_groups = true, jump = true});
|
||||||
|
|
||||||
|
-- jump to the last item, skipping the groups
|
||||||
|
require("trouble").last({skip_groups = true, jump = true});
|
||||||
|
<
|
||||||
|
|
||||||
|
|
||||||
|
TELESCOPE ~
|
||||||
|
|
||||||
|
You can easily open any search results in **Trouble**, by defining a custom
|
||||||
|
action:
|
||||||
|
|
||||||
|
>lua
|
||||||
|
local actions = require("telescope.actions")
|
||||||
|
local trouble = require("trouble.providers.telescope")
|
||||||
|
|
||||||
|
local telescope = require("telescope")
|
||||||
|
|
||||||
|
telescope.setup {
|
||||||
|
defaults = {
|
||||||
|
mappings = {
|
||||||
|
i = { ["<c-t>"] = trouble.open_with_trouble },
|
||||||
|
n = { ["<c-t>"] = trouble.open_with_trouble },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
<
|
||||||
|
|
||||||
|
When you open telescope, you can now hit `<c-t>` to open the results in
|
||||||
|
**Trouble**
|
||||||
|
|
||||||
|
|
||||||
|
COLORS *trouble.nvim-trouble-colors*
|
||||||
|
|
||||||
|
The table below shows all the highlight groups defined for Trouble.
|
||||||
|
|
||||||
|
Highlight Group
|
||||||
|
------------------------
|
||||||
|
TroubleCount
|
||||||
|
TroubleError
|
||||||
|
TroubleNormal
|
||||||
|
TroubleTextInformation
|
||||||
|
TroubleSignWarning
|
||||||
|
TroubleLocation
|
||||||
|
TroubleWarning
|
||||||
|
TroublePreview
|
||||||
|
TroubleTextError
|
||||||
|
TroubleSignInformation
|
||||||
|
TroubleIndent
|
||||||
|
TroubleSource
|
||||||
|
TroubleSignHint
|
||||||
|
TroubleSignOther
|
||||||
|
TroubleFoldIcon
|
||||||
|
TroubleTextWarning
|
||||||
|
TroubleCode
|
||||||
|
TroubleInformation
|
||||||
|
TroubleSignError
|
||||||
|
TroubleFile
|
||||||
|
TroubleHint
|
||||||
|
TroubleTextHint
|
||||||
|
TroubleText
|
||||||
|
==============================================================================
|
||||||
|
2. Links *trouble.nvim-links*
|
||||||
|
|
||||||
|
1. *LSP Trouble Screenshot*: ./media/shot.png
|
||||||
|
|
||||||
|
Generated by panvimdoc <https://github.com/kdheepak/panvimdoc>
|
||||||
|
|
||||||
|
vim:tw=78:ts=8:noet:ft=help:norl:
|
34
bundle/trouble.nvim/lua/trouble/colors.lua
vendored
Normal file
34
bundle/trouble.nvim/lua/trouble/colors.lua
vendored
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
local util = require("trouble.util")
|
||||||
|
|
||||||
|
local M = {}
|
||||||
|
|
||||||
|
local links = {
|
||||||
|
TextError = "TroubleText",
|
||||||
|
TextWarning = "TroubleText",
|
||||||
|
TextInformation = "TroubleText",
|
||||||
|
TextHint = "TroubleText",
|
||||||
|
Text = "Normal",
|
||||||
|
File = "Directory",
|
||||||
|
Source = "Comment",
|
||||||
|
Code = "Comment",
|
||||||
|
Location = "LineNr",
|
||||||
|
FoldIcon = "CursorLineNr",
|
||||||
|
Normal = "Normal",
|
||||||
|
Count = "TabLineSel",
|
||||||
|
Preview = "Search",
|
||||||
|
Indent = "LineNr",
|
||||||
|
SignOther = "TroubleSignInformation",
|
||||||
|
}
|
||||||
|
|
||||||
|
function M.setup()
|
||||||
|
for k, v in pairs(links) do
|
||||||
|
vim.api.nvim_command("hi def link Trouble" .. k .. " " .. v)
|
||||||
|
end
|
||||||
|
|
||||||
|
for _, severity in pairs(util.severity) do
|
||||||
|
vim.api.nvim_command("hi def link Trouble" .. severity .. " " .. util.get_severity_label(severity))
|
||||||
|
vim.api.nvim_command("hi def link TroubleSign" .. severity .. " " .. util.get_severity_label(severity, "Sign"))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
return M
|
78
bundle/trouble.nvim/lua/trouble/config.lua
vendored
Normal file
78
bundle/trouble.nvim/lua/trouble/config.lua
vendored
Normal file
@ -0,0 +1,78 @@
|
|||||||
|
local M = {}
|
||||||
|
|
||||||
|
M.namespace = vim.api.nvim_create_namespace("Trouble")
|
||||||
|
|
||||||
|
---@class TroubleOptions
|
||||||
|
---@field buf number|nil
|
||||||
|
---@field win number|nil
|
||||||
|
---@field severity lsp.DiagnosticSeverity|nil
|
||||||
|
-- TODO: make some options configurable per mode
|
||||||
|
-- TODO: make it possible to have multiple trouble lists open at the same time
|
||||||
|
local defaults = {
|
||||||
|
debug = false,
|
||||||
|
cmd_options = {},
|
||||||
|
group = true, -- group results by file
|
||||||
|
padding = true, -- add an extra new line on top of the list
|
||||||
|
position = "bottom", -- position of the list can be: bottom, top, left, right
|
||||||
|
height = 10, -- height of the trouble list when position is top or bottom
|
||||||
|
width = 50, -- width of the list when position is left or right
|
||||||
|
icons = true, -- use devicons for filenames
|
||||||
|
mode = "workspace_diagnostics", -- "workspace_diagnostics", "document_diagnostics", "quickfix", "lsp_references", "loclist"
|
||||||
|
severity = nil, -- nil (ALL) or vim.diagnostic.severity.ERROR | WARN | INFO | HINT
|
||||||
|
fold_open = "", -- icon used for open folds
|
||||||
|
fold_closed = "", -- icon used for closed folds
|
||||||
|
cycle_results = true, -- cycle item list when reaching beginning or end of list
|
||||||
|
action_keys = { -- key mappings for actions in the trouble list
|
||||||
|
close = "q", -- close the list
|
||||||
|
cancel = "<esc>", -- cancel the preview and get back to your last window / buffer / cursor
|
||||||
|
refresh = "r", -- manually refresh
|
||||||
|
jump = { "<cr>", "<tab>" }, -- jump to the diagnostic or open / close folds
|
||||||
|
open_split = { "<c-x>" }, -- open buffer in new split
|
||||||
|
open_vsplit = { "<c-v>" }, -- open buffer in new vsplit
|
||||||
|
open_tab = { "<c-t>" }, -- open buffer in new tab
|
||||||
|
jump_close = { "o" }, -- jump to the diagnostic and close the list
|
||||||
|
toggle_mode = "m", -- toggle between "workspace" and "document" mode
|
||||||
|
switch_severity = "s", -- switch "diagnostics" severity filter level to ALL / HINT / INFO / WARN / ERROR
|
||||||
|
toggle_preview = "P", -- toggle auto_preview
|
||||||
|
hover = "K", -- opens a small popup with the full multiline message
|
||||||
|
preview = "p", -- preview the diagnostic location
|
||||||
|
close_folds = { "zM", "zm" }, -- close all folds
|
||||||
|
open_folds = { "zR", "zr" }, -- open all folds
|
||||||
|
toggle_fold = { "zA", "za" }, -- toggle fold of current file
|
||||||
|
previous = "k", -- preview item
|
||||||
|
next = "j", -- next item
|
||||||
|
},
|
||||||
|
indent_lines = true, -- add an indent guide below the fold icons
|
||||||
|
auto_open = false, -- automatically open the list when you have diagnostics
|
||||||
|
auto_close = false, -- automatically close the list when you have no diagnostics
|
||||||
|
auto_preview = true, -- automatically preview the location of the diagnostic. <esc> to close preview and go back to last window
|
||||||
|
auto_fold = false, -- automatically fold a file trouble list at creation
|
||||||
|
auto_jump = { "lsp_definitions" }, -- for the given modes, automatically jump if there is only a single result
|
||||||
|
signs = {
|
||||||
|
-- icons / text used for a diagnostic
|
||||||
|
error = "",
|
||||||
|
warning = "",
|
||||||
|
hint = "",
|
||||||
|
information = "",
|
||||||
|
other = "",
|
||||||
|
},
|
||||||
|
use_diagnostic_signs = false, -- enabling this will use the signs defined in your lsp client
|
||||||
|
sort_keys = {
|
||||||
|
"severity",
|
||||||
|
"filename",
|
||||||
|
"lnum",
|
||||||
|
"col",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
---@type TroubleOptions
|
||||||
|
M.options = {}
|
||||||
|
---@return TroubleOptions
|
||||||
|
|
||||||
|
function M.setup(options)
|
||||||
|
M.options = vim.tbl_deep_extend("force", {}, defaults, options or {})
|
||||||
|
end
|
||||||
|
|
||||||
|
M.setup()
|
||||||
|
|
||||||
|
return M
|
24
bundle/trouble.nvim/lua/trouble/folds.lua
vendored
Normal file
24
bundle/trouble.nvim/lua/trouble/folds.lua
vendored
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
local config = require("trouble.config")
|
||||||
|
|
||||||
|
local M = {}
|
||||||
|
|
||||||
|
M.folded = {}
|
||||||
|
|
||||||
|
function M.is_folded(filename)
|
||||||
|
local fold = M.folded[filename]
|
||||||
|
return (fold == nil and config.options.auto_fold == true) or (fold == true)
|
||||||
|
end
|
||||||
|
|
||||||
|
function M.toggle(filename)
|
||||||
|
M.folded[filename] = not M.is_folded(filename)
|
||||||
|
end
|
||||||
|
|
||||||
|
function M.close(filename)
|
||||||
|
M.folded[filename] = true
|
||||||
|
end
|
||||||
|
|
||||||
|
function M.open(filename)
|
||||||
|
M.folded[filename] = false
|
||||||
|
end
|
||||||
|
|
||||||
|
return M
|
302
bundle/trouble.nvim/lua/trouble/init.lua
vendored
Normal file
302
bundle/trouble.nvim/lua/trouble/init.lua
vendored
Normal file
@ -0,0 +1,302 @@
|
|||||||
|
local View = require("trouble.view")
|
||||||
|
local config = require("trouble.config")
|
||||||
|
local colors = require("trouble.colors")
|
||||||
|
local util = require("trouble.util")
|
||||||
|
|
||||||
|
colors.setup()
|
||||||
|
|
||||||
|
local Trouble = {}
|
||||||
|
|
||||||
|
local view
|
||||||
|
|
||||||
|
function Trouble.is_open()
|
||||||
|
return view and view:is_valid() or false
|
||||||
|
end
|
||||||
|
|
||||||
|
function Trouble.setup(options)
|
||||||
|
if vim.fn.has("nvim-0.7.2") == 0 then
|
||||||
|
util.error("Trouble needs Neovim >= 0.7.2")
|
||||||
|
return
|
||||||
|
end
|
||||||
|
config.setup(options)
|
||||||
|
util.fix_mode(config.options)
|
||||||
|
colors.setup()
|
||||||
|
end
|
||||||
|
|
||||||
|
function Trouble.close()
|
||||||
|
if Trouble.is_open() then
|
||||||
|
view:close()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local function get_opts(...)
|
||||||
|
local args = { ... }
|
||||||
|
if vim.tbl_islist(args) and #args == 1 and type(args[1]) == "table" then
|
||||||
|
args = args[1]
|
||||||
|
end
|
||||||
|
local opts = {}
|
||||||
|
for key, value in pairs(args) do
|
||||||
|
if type(key) == "number" then
|
||||||
|
local k, v = value:match("^(.*)=(.*)$")
|
||||||
|
if k then
|
||||||
|
opts[k] = v
|
||||||
|
elseif opts.mode then
|
||||||
|
util.error("unknown option " .. value)
|
||||||
|
else
|
||||||
|
opts.mode = value
|
||||||
|
end
|
||||||
|
else
|
||||||
|
opts[key] = value
|
||||||
|
end
|
||||||
|
end
|
||||||
|
opts = opts or {}
|
||||||
|
util.fix_mode(opts)
|
||||||
|
config.options.cmd_options = opts
|
||||||
|
return opts
|
||||||
|
end
|
||||||
|
|
||||||
|
function Trouble.open(...)
|
||||||
|
local opts = get_opts(...)
|
||||||
|
if opts.mode and (opts.mode ~= config.options.mode) then
|
||||||
|
config.options.mode = opts.mode
|
||||||
|
end
|
||||||
|
|
||||||
|
if opts.severity and (opts.severity ~=config.options.severity) then
|
||||||
|
config.options.severity = opts.severity
|
||||||
|
end
|
||||||
|
|
||||||
|
opts.focus = true
|
||||||
|
opts.on_open = true
|
||||||
|
|
||||||
|
if Trouble.is_open() then
|
||||||
|
Trouble.refresh(opts)
|
||||||
|
elseif not opts.auto and vim.tbl_contains(config.options.auto_jump, opts.mode) then
|
||||||
|
require("trouble.providers").get(vim.api.nvim_get_current_win(), vim.api.nvim_get_current_buf(), function(results)
|
||||||
|
if #results == 1 then
|
||||||
|
util.jump_to_item(opts.win, opts.precmd, results[1])
|
||||||
|
elseif #results > 0 then
|
||||||
|
view = View.create(opts)
|
||||||
|
end
|
||||||
|
end, config.options)
|
||||||
|
else
|
||||||
|
view = View.create(opts)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function Trouble.toggle(...)
|
||||||
|
local opts = get_opts(...)
|
||||||
|
|
||||||
|
if opts.mode and (opts.mode ~= config.options.mode) then
|
||||||
|
config.options.mode = opts.mode
|
||||||
|
Trouble.open(...)
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
if Trouble.is_open() then
|
||||||
|
Trouble.close()
|
||||||
|
else
|
||||||
|
Trouble.open(...)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function Trouble.help()
|
||||||
|
local lines = { "# Key Bindings" }
|
||||||
|
local height = 1
|
||||||
|
for command, key in pairs(config.options.action_keys) do
|
||||||
|
if type(key) == "table" then
|
||||||
|
key = table.concat(key, " | ")
|
||||||
|
end
|
||||||
|
table.insert(lines, " * **" .. key .. "** " .. command:gsub("_", " "))
|
||||||
|
height = height + 1
|
||||||
|
end
|
||||||
|
-- help
|
||||||
|
vim.lsp.util.open_floating_preview(lines, "markdown", {
|
||||||
|
border = "single",
|
||||||
|
height = 20,
|
||||||
|
offset_y = -2,
|
||||||
|
offset_x = 2,
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
||||||
|
local updater = util.debounce(100, function()
|
||||||
|
-- buff might have been closed during the debounce
|
||||||
|
if not Trouble.is_open() then
|
||||||
|
util.debug("refresh: not open anymore")
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
util.debug("refresh: auto")
|
||||||
|
view:update({ auto = true })
|
||||||
|
end)
|
||||||
|
|
||||||
|
function Trouble.refresh(opts)
|
||||||
|
opts = opts or {}
|
||||||
|
|
||||||
|
-- dont do an update if this is an automated refresh from a different provider
|
||||||
|
if opts.auto then
|
||||||
|
if opts.provider == "diagnostics" and config.options.mode == "document_diagnostics" then
|
||||||
|
opts.provider = "document_diagnostics"
|
||||||
|
elseif opts.provider == "diagnostics" and config.options.mode == "workspace_diagnostics" then
|
||||||
|
opts.provider = "workspace_diagnostics"
|
||||||
|
elseif opts.provider == "qf" and config.options.mode == "quickfix" then
|
||||||
|
opts.provider = "quickfix"
|
||||||
|
elseif opts.provider == "qf" and config.options.mode == "loclist" then
|
||||||
|
opts.provider = "loclist"
|
||||||
|
end
|
||||||
|
if opts.provider ~= config.options.mode then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
if Trouble.is_open() then
|
||||||
|
if opts.auto then
|
||||||
|
updater()
|
||||||
|
else
|
||||||
|
util.debug("refresh")
|
||||||
|
view:update(opts)
|
||||||
|
end
|
||||||
|
elseif opts.auto and config.options.auto_open and opts.provider == config.options.mode then
|
||||||
|
require("trouble.providers").get(vim.api.nvim_get_current_win(), vim.api.nvim_get_current_buf(), function(results)
|
||||||
|
if #results > 0 then
|
||||||
|
Trouble.open(opts)
|
||||||
|
end
|
||||||
|
end, config.options)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function Trouble.action(action)
|
||||||
|
if action == "toggle_mode" then
|
||||||
|
if config.options.mode == "document_diagnostics" then
|
||||||
|
config.options.mode = "workspace_diagnostics"
|
||||||
|
elseif config.options.mode == "workspace_diagnostics" then
|
||||||
|
config.options.mode = "document_diagnostics"
|
||||||
|
end
|
||||||
|
action = "refresh"
|
||||||
|
end
|
||||||
|
|
||||||
|
if action == 'switch_severity' then
|
||||||
|
if config.options.severity == nil then
|
||||||
|
config.options.severity = vim.diagnostic.severity.ERROR
|
||||||
|
elseif config.options.severity < 4 then
|
||||||
|
config.options.severity = config.options.severity + 1
|
||||||
|
else
|
||||||
|
config.options.severity = nil
|
||||||
|
end
|
||||||
|
action = "refresh"
|
||||||
|
end
|
||||||
|
|
||||||
|
if view and action == "on_win_enter" then
|
||||||
|
view:on_win_enter()
|
||||||
|
end
|
||||||
|
if not Trouble.is_open() then
|
||||||
|
return Trouble
|
||||||
|
end
|
||||||
|
if action == "hover" then
|
||||||
|
view:hover()
|
||||||
|
end
|
||||||
|
if action == "jump" then
|
||||||
|
view:jump()
|
||||||
|
elseif action == "open_split" then
|
||||||
|
view:jump({ precmd = "split" })
|
||||||
|
elseif action == "open_vsplit" then
|
||||||
|
view:jump({ precmd = "vsplit" })
|
||||||
|
elseif action == "open_tab" then
|
||||||
|
view:jump({ precmd = "tabe" })
|
||||||
|
end
|
||||||
|
if action == "jump_close" then
|
||||||
|
view:jump()
|
||||||
|
Trouble.close()
|
||||||
|
end
|
||||||
|
if action == "open_folds" then
|
||||||
|
Trouble.refresh({ open_folds = true })
|
||||||
|
end
|
||||||
|
if action == "close_folds" then
|
||||||
|
Trouble.refresh({ close_folds = true })
|
||||||
|
end
|
||||||
|
if action == "toggle_fold" then
|
||||||
|
view:toggle_fold()
|
||||||
|
end
|
||||||
|
if action == "on_enter" then
|
||||||
|
view:on_enter()
|
||||||
|
end
|
||||||
|
if action == "on_leave" then
|
||||||
|
view:on_leave()
|
||||||
|
end
|
||||||
|
if action == "cancel" then
|
||||||
|
view:switch_to_parent()
|
||||||
|
end
|
||||||
|
if action == "next" then
|
||||||
|
view:next_item()
|
||||||
|
return Trouble
|
||||||
|
end
|
||||||
|
if action == "previous" then
|
||||||
|
view:previous_item()
|
||||||
|
return Trouble
|
||||||
|
end
|
||||||
|
if action == "first" then
|
||||||
|
view:first_item()
|
||||||
|
return Trouble
|
||||||
|
end
|
||||||
|
if action == "last" then
|
||||||
|
view:last_item()
|
||||||
|
return Trouble
|
||||||
|
end
|
||||||
|
|
||||||
|
if action == "toggle_preview" then
|
||||||
|
config.options.auto_preview = not config.options.auto_preview
|
||||||
|
if not config.options.auto_preview then
|
||||||
|
view:close_preview()
|
||||||
|
else
|
||||||
|
action = "preview"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if action == "auto_preview" and config.options.auto_preview then
|
||||||
|
action = "preview"
|
||||||
|
end
|
||||||
|
if action == "preview" then
|
||||||
|
view:preview()
|
||||||
|
end
|
||||||
|
|
||||||
|
if Trouble[action] then
|
||||||
|
Trouble[action]()
|
||||||
|
end
|
||||||
|
return Trouble
|
||||||
|
end
|
||||||
|
|
||||||
|
function Trouble.next(opts)
|
||||||
|
util.fix_mode(opts)
|
||||||
|
if view then
|
||||||
|
view:next_item(opts)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function Trouble.previous(opts)
|
||||||
|
util.fix_mode(opts)
|
||||||
|
if view then
|
||||||
|
view:previous_item(opts)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function Trouble.first(opts)
|
||||||
|
util.fix_mode(opts)
|
||||||
|
if view then
|
||||||
|
view:first_item(opts)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function Trouble.last(opts)
|
||||||
|
util.fix_mode(opts)
|
||||||
|
if view then
|
||||||
|
view:last_item(opts)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function Trouble.get_items()
|
||||||
|
if view ~= nil then
|
||||||
|
return view.items
|
||||||
|
else
|
||||||
|
return {}
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
return Trouble
|
46
bundle/trouble.nvim/lua/trouble/providers/diagnostic.lua
vendored
Normal file
46
bundle/trouble.nvim/lua/trouble/providers/diagnostic.lua
vendored
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
local util = require("trouble.util")
|
||||||
|
|
||||||
|
---@class Lsp
|
||||||
|
local M = {}
|
||||||
|
|
||||||
|
---@param options TroubleOptions
|
||||||
|
---@return Item[]
|
||||||
|
function M.diagnostics(_, buf, cb, options)
|
||||||
|
if options.mode == "workspace_diagnostics" then
|
||||||
|
buf = nil
|
||||||
|
end
|
||||||
|
|
||||||
|
local items = {}
|
||||||
|
|
||||||
|
if vim.diagnostic then
|
||||||
|
local diags = vim.diagnostic.get(buf, { severity = options.severity })
|
||||||
|
for _, item in ipairs(diags) do
|
||||||
|
table.insert(items, util.process_item(item))
|
||||||
|
end
|
||||||
|
else
|
||||||
|
---@diagnostic disable-next-line: deprecated
|
||||||
|
local diags = buf and { [buf] = vim.lsp.diagnostic.get(buf) } or vim.lsp.diagnostic.get_all()
|
||||||
|
items = util.locations_to_items(diags, 1)
|
||||||
|
end
|
||||||
|
|
||||||
|
cb(items)
|
||||||
|
end
|
||||||
|
|
||||||
|
function M.get_signs()
|
||||||
|
local signs = {}
|
||||||
|
for _, v in pairs(util.severity) do
|
||||||
|
if v ~= "Other" then
|
||||||
|
-- pcall to catch entirely unbound or cleared out sign hl group
|
||||||
|
local status, sign = pcall(function()
|
||||||
|
return vim.trim(vim.fn.sign_getdefined(util.get_severity_label(v, "Sign"))[1].text)
|
||||||
|
end)
|
||||||
|
if not status then
|
||||||
|
sign = v:sub(1, 1)
|
||||||
|
end
|
||||||
|
signs[string.lower(v)] = sign
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return signs
|
||||||
|
end
|
||||||
|
|
||||||
|
return M
|
94
bundle/trouble.nvim/lua/trouble/providers/init.lua
vendored
Normal file
94
bundle/trouble.nvim/lua/trouble/providers/init.lua
vendored
Normal file
@ -0,0 +1,94 @@
|
|||||||
|
local util = require("trouble.util")
|
||||||
|
local qf = require("trouble.providers.qf")
|
||||||
|
local telescope = require("trouble.providers.telescope")
|
||||||
|
local lsp = require("trouble.providers.lsp")
|
||||||
|
local diagnostic = require("trouble.providers.diagnostic")
|
||||||
|
|
||||||
|
local M = {}
|
||||||
|
|
||||||
|
M.providers = {
|
||||||
|
workspace_diagnostics = diagnostic.diagnostics,
|
||||||
|
document_diagnostics = diagnostic.diagnostics,
|
||||||
|
lsp_references = lsp.references,
|
||||||
|
lsp_implementations = lsp.implementations,
|
||||||
|
lsp_definitions = lsp.definitions,
|
||||||
|
lsp_type_definitions = lsp.type_definitions,
|
||||||
|
quickfix = qf.qflist,
|
||||||
|
loclist = qf.loclist,
|
||||||
|
telescope = telescope.telescope,
|
||||||
|
}
|
||||||
|
|
||||||
|
---@param options TroubleOptions
|
||||||
|
function M.get(win, buf, cb, options)
|
||||||
|
local name = options.mode
|
||||||
|
local provider = M.providers[name]
|
||||||
|
|
||||||
|
if not provider then
|
||||||
|
local ok, mod = pcall(require, "trouble.providers." .. name)
|
||||||
|
if ok then
|
||||||
|
M.providers[name] = mod
|
||||||
|
provider = mod
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
if not provider then
|
||||||
|
util.error(("invalid provider %q"):format(name))
|
||||||
|
return {}
|
||||||
|
end
|
||||||
|
|
||||||
|
local sort_keys = vim.list_extend({
|
||||||
|
function(item)
|
||||||
|
local cwd = vim.loop.fs_realpath(vim.fn.getcwd())
|
||||||
|
local path = vim.loop.fs_realpath(item.filename)
|
||||||
|
if not path then
|
||||||
|
return 200
|
||||||
|
end
|
||||||
|
local ret = string.find(path, cwd, 1, true) == 1 and 10 or 100
|
||||||
|
-- prefer non-hidden files
|
||||||
|
if string.find(path, ".") then
|
||||||
|
ret = ret + 1
|
||||||
|
end
|
||||||
|
return ret
|
||||||
|
end,
|
||||||
|
}, options.sort_keys)
|
||||||
|
|
||||||
|
provider(win, buf, function(items)
|
||||||
|
table.sort(items, function(a, b)
|
||||||
|
for _, key in ipairs(sort_keys) do
|
||||||
|
local ak = type(key) == "string" and a[key] or key(a)
|
||||||
|
local bk = type(key) == "string" and b[key] or key(b)
|
||||||
|
if ak ~= bk then
|
||||||
|
return ak < bk
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
cb(items)
|
||||||
|
end, options)
|
||||||
|
end
|
||||||
|
|
||||||
|
---@param items Item[]
|
||||||
|
---@return table<string, Item[]>
|
||||||
|
function M.group(items)
|
||||||
|
local keys = {}
|
||||||
|
local keyid = 0
|
||||||
|
local groups = {}
|
||||||
|
for _, item in ipairs(items) do
|
||||||
|
if groups[item.filename] == nil then
|
||||||
|
groups[item.filename] = { filename = item.filename, items = {} }
|
||||||
|
keys[item.filename] = keyid
|
||||||
|
keyid = keyid + 1
|
||||||
|
end
|
||||||
|
table.insert(groups[item.filename].items, item)
|
||||||
|
end
|
||||||
|
|
||||||
|
local ret = {}
|
||||||
|
for _, group in pairs(groups) do
|
||||||
|
table.insert(ret, group)
|
||||||
|
end
|
||||||
|
table.sort(ret, function(a, b)
|
||||||
|
return keys[a.filename] < keys[b.filename]
|
||||||
|
end)
|
||||||
|
return ret
|
||||||
|
end
|
||||||
|
|
||||||
|
return M
|
92
bundle/trouble.nvim/lua/trouble/providers/lsp.lua
vendored
Normal file
92
bundle/trouble.nvim/lua/trouble/providers/lsp.lua
vendored
Normal file
@ -0,0 +1,92 @@
|
|||||||
|
local lsp = require("vim.lsp")
|
||||||
|
local util = require("trouble.util")
|
||||||
|
|
||||||
|
---@class Lsp
|
||||||
|
local M = {}
|
||||||
|
|
||||||
|
local function lsp_buf_request(buf, method, params, handler)
|
||||||
|
lsp.buf_request(buf, method, params, function(err, m, result)
|
||||||
|
handler(err, method == m and result or m)
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
|
||||||
|
---@return Item[]
|
||||||
|
function M.references(win, buf, cb, _options)
|
||||||
|
local method = "textDocument/references"
|
||||||
|
local params = util.make_position_params(win, buf)
|
||||||
|
params.context = { includeDeclaration = true }
|
||||||
|
lsp_buf_request(buf, method, params, function(err, result)
|
||||||
|
if err then
|
||||||
|
util.error("an error happened getting references: " .. err.message)
|
||||||
|
return cb({})
|
||||||
|
end
|
||||||
|
if result == nil or #result == 0 then
|
||||||
|
return cb({})
|
||||||
|
end
|
||||||
|
local ret = util.locations_to_items({ result }, 0)
|
||||||
|
cb(ret)
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
|
||||||
|
---@return Item[]
|
||||||
|
function M.implementations(win, buf, cb, _options)
|
||||||
|
local method = "textDocument/implementation"
|
||||||
|
local params = util.make_position_params(win, buf)
|
||||||
|
params.context = { includeDeclaration = true }
|
||||||
|
lsp_buf_request(buf, method, params, function(err, result)
|
||||||
|
if err then
|
||||||
|
util.error("an error happened getting implementation: " .. err.message)
|
||||||
|
return cb({})
|
||||||
|
end
|
||||||
|
if result == nil or #result == 0 then
|
||||||
|
return cb({})
|
||||||
|
end
|
||||||
|
local ret = util.locations_to_items({ result }, 0)
|
||||||
|
cb(ret)
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
|
||||||
|
---@return Item[]
|
||||||
|
function M.definitions(win, buf, cb, _options)
|
||||||
|
local method = "textDocument/definition"
|
||||||
|
local params = util.make_position_params(win, buf)
|
||||||
|
params.context = { includeDeclaration = true }
|
||||||
|
lsp_buf_request(buf, method, params, function(err, result)
|
||||||
|
if err then
|
||||||
|
util.error("an error happened getting definitions: " .. err.message)
|
||||||
|
return cb({})
|
||||||
|
end
|
||||||
|
if result == nil or #result == 0 then
|
||||||
|
return cb({})
|
||||||
|
end
|
||||||
|
for _, value in ipairs(result) do
|
||||||
|
value.uri = value.targetUri or value.uri
|
||||||
|
value.range = value.targetSelectionRange or value.range
|
||||||
|
end
|
||||||
|
local ret = util.locations_to_items({ result }, 0)
|
||||||
|
cb(ret)
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
|
||||||
|
---@return Item[]
|
||||||
|
function M.type_definitions(win, buf, cb, _options)
|
||||||
|
local method = "textDocument/typeDefinition"
|
||||||
|
local params = util.make_position_params(win, buf)
|
||||||
|
lsp_buf_request(buf, method, params, function(err, result)
|
||||||
|
if err then
|
||||||
|
util.error("an error happened getting type definitions: " .. err.message)
|
||||||
|
return cb({})
|
||||||
|
end
|
||||||
|
if result == nil or #result == 0 then
|
||||||
|
return cb({})
|
||||||
|
end
|
||||||
|
for _, value in ipairs(result) do
|
||||||
|
value.uri = value.targetUri or value.uri
|
||||||
|
value.range = value.targetSelectionRange or value.range
|
||||||
|
end
|
||||||
|
local ret = util.locations_to_items({ result }, 0)
|
||||||
|
cb(ret)
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
|
||||||
|
return M
|
39
bundle/trouble.nvim/lua/trouble/providers/qf.lua
vendored
Normal file
39
bundle/trouble.nvim/lua/trouble/providers/qf.lua
vendored
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
local util = require("trouble.util")
|
||||||
|
|
||||||
|
local M = {}
|
||||||
|
|
||||||
|
local severities = { E = 1, W = 2, I = 3, H = 4 }
|
||||||
|
|
||||||
|
function M.get_list(winid)
|
||||||
|
local list = winid == nil and vim.fn.getqflist({ all = true }) or vim.fn.getloclist(winid, { all = true })
|
||||||
|
|
||||||
|
local ret = {}
|
||||||
|
for _, item in pairs(list.items) do
|
||||||
|
local row = (item.lnum == 0 and 1 or item.lnum) - 1
|
||||||
|
local col = (item.col == 0 and 1 or item.col) - 1
|
||||||
|
|
||||||
|
local pitem = {
|
||||||
|
row = row,
|
||||||
|
col = col,
|
||||||
|
message = item.text,
|
||||||
|
severity = severities[item.type] or 0,
|
||||||
|
range = {
|
||||||
|
start = { line = row, character = col },
|
||||||
|
["end"] = { line = row, character = -1 },
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
table.insert(ret, util.process_item(pitem, item.bufnr))
|
||||||
|
end
|
||||||
|
return ret
|
||||||
|
end
|
||||||
|
|
||||||
|
function M.loclist(win, _buf, cb, _options)
|
||||||
|
return cb(M.get_list(win))
|
||||||
|
end
|
||||||
|
|
||||||
|
function M.qflist(_win, _buf, cb, _options)
|
||||||
|
return cb(M.get_list())
|
||||||
|
end
|
||||||
|
|
||||||
|
return M
|
86
bundle/trouble.nvim/lua/trouble/providers/telescope.lua
vendored
Normal file
86
bundle/trouble.nvim/lua/trouble/providers/telescope.lua
vendored
Normal file
@ -0,0 +1,86 @@
|
|||||||
|
local util = require("trouble.util")
|
||||||
|
|
||||||
|
local M = {}
|
||||||
|
|
||||||
|
M.results = {}
|
||||||
|
|
||||||
|
--- Turns a Telescope item into a Trouble item.
|
||||||
|
local function item_to_result(item)
|
||||||
|
local row = (item.lnum or 1) - 1
|
||||||
|
local col = (item.col or 1) - 1
|
||||||
|
|
||||||
|
if not item.bufnr then
|
||||||
|
local fname = vim.fn.fnamemodify(item.filename, ":p")
|
||||||
|
if vim.fn.filereadable(fname) == 0 and item.cwd then
|
||||||
|
fname = vim.fn.fnamemodify(item.cwd .. "/" .. item.filename, ":p")
|
||||||
|
end
|
||||||
|
item.bufnr = vim.fn.bufnr(fname, true)
|
||||||
|
end
|
||||||
|
|
||||||
|
local pitem = {
|
||||||
|
row = row,
|
||||||
|
col = col,
|
||||||
|
message = item.text,
|
||||||
|
severity = 0,
|
||||||
|
range = {
|
||||||
|
start = { line = row, character = col },
|
||||||
|
["end"] = { line = row, character = -1 },
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
return util.process_item(pitem, item.bufnr)
|
||||||
|
end
|
||||||
|
|
||||||
|
--- Shows all Telescope results in Trouble.
|
||||||
|
function M.open_with_trouble(prompt_bufnr, _mode)
|
||||||
|
local action_state = require("telescope.actions.state")
|
||||||
|
local actions = require("telescope.actions")
|
||||||
|
local picker = action_state.get_current_picker(prompt_bufnr)
|
||||||
|
local manager = picker.manager
|
||||||
|
|
||||||
|
M.results = {}
|
||||||
|
for item in manager:iter() do
|
||||||
|
table.insert(M.results, item_to_result(item))
|
||||||
|
end
|
||||||
|
|
||||||
|
actions.close(prompt_bufnr)
|
||||||
|
require("trouble").open("telescope")
|
||||||
|
end
|
||||||
|
|
||||||
|
--- Shows the selected Telescope results in Trouble.
|
||||||
|
function M.open_selected_with_trouble(prompt_bufnr, _mode)
|
||||||
|
local action_state = require("telescope.actions.state")
|
||||||
|
local actions = require("telescope.actions")
|
||||||
|
local picker = action_state.get_current_picker(prompt_bufnr)
|
||||||
|
|
||||||
|
M.results = {}
|
||||||
|
for _, item in ipairs(picker:get_multi_selection()) do
|
||||||
|
table.insert(M.results, item_to_result(item))
|
||||||
|
end
|
||||||
|
|
||||||
|
actions.close(prompt_bufnr)
|
||||||
|
require("trouble").open("telescope")
|
||||||
|
end
|
||||||
|
|
||||||
|
--- Shows the selected Telescope results in Trouble.
|
||||||
|
--- If no results are currently selected, shows all of them.
|
||||||
|
function M.smart_open_with_trouble(prompt_bufnr, _mode)
|
||||||
|
local action_state = require("telescope.actions.state")
|
||||||
|
local picker = action_state.get_current_picker(prompt_bufnr)
|
||||||
|
if #picker:get_multi_selection() > 0 then
|
||||||
|
M.open_selected_with_trouble(prompt_bufnr, _mode)
|
||||||
|
else
|
||||||
|
M.open_with_trouble(prompt_bufnr, _mode)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function M.telescope(_win, _buf, cb, _options)
|
||||||
|
if #M.results == 0 then
|
||||||
|
util.warn(
|
||||||
|
"No Telescope results found. Open Telescopen and send results to Trouble first. Refer to the documentation for more info."
|
||||||
|
)
|
||||||
|
end
|
||||||
|
cb(M.results)
|
||||||
|
end
|
||||||
|
|
||||||
|
return M
|
157
bundle/trouble.nvim/lua/trouble/renderer.lua
vendored
Normal file
157
bundle/trouble.nvim/lua/trouble/renderer.lua
vendored
Normal file
@ -0,0 +1,157 @@
|
|||||||
|
local providers = require("trouble.providers")
|
||||||
|
local util = require("trouble.util")
|
||||||
|
local config = require("trouble.config")
|
||||||
|
local Text = require("trouble.text")
|
||||||
|
local folds = require("trouble.folds")
|
||||||
|
|
||||||
|
---@class Renderer
|
||||||
|
local renderer = {}
|
||||||
|
|
||||||
|
renderer.signs = {}
|
||||||
|
|
||||||
|
local function get_icon(file)
|
||||||
|
local ok, icons = pcall(require, "nvim-web-devicons")
|
||||||
|
if not ok then
|
||||||
|
util.warn(
|
||||||
|
"'nvim-web-devicons' is not installed. Install it, or set icons=false in your configuration to disable this message"
|
||||||
|
)
|
||||||
|
return ""
|
||||||
|
end
|
||||||
|
local fname = vim.fn.fnamemodify(file, ":t")
|
||||||
|
local ext = vim.fn.fnamemodify(file, ":e")
|
||||||
|
return icons.get_icon(fname, ext, { default = true })
|
||||||
|
end
|
||||||
|
|
||||||
|
local function update_signs()
|
||||||
|
renderer.signs = config.options.signs
|
||||||
|
if config.options.use_diagnostic_signs then
|
||||||
|
local lsp_signs = require("trouble.providers.diagnostic").get_signs()
|
||||||
|
renderer.signs = vim.tbl_deep_extend("force", {}, renderer.signs, lsp_signs)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
---@param view TroubleView
|
||||||
|
function renderer.render(view, opts)
|
||||||
|
opts = opts or {}
|
||||||
|
local buf = vim.api.nvim_win_get_buf(view.parent)
|
||||||
|
providers.get(view.parent, buf, function(items)
|
||||||
|
local auto_jump = vim.tbl_contains(config.options.auto_jump, opts.mode)
|
||||||
|
if opts.on_open and #items == 1 and auto_jump and not opts.auto then
|
||||||
|
view:close()
|
||||||
|
util.jump_to_item(opts.win, opts.precmd, items[1])
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
local grouped = providers.group(items)
|
||||||
|
local count = util.count(grouped)
|
||||||
|
|
||||||
|
-- check for auto close
|
||||||
|
if opts.auto and config.options.auto_close then
|
||||||
|
if count == 0 then
|
||||||
|
view:close()
|
||||||
|
return
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Update lsp signs
|
||||||
|
update_signs()
|
||||||
|
|
||||||
|
local text = Text:new()
|
||||||
|
view.items = {}
|
||||||
|
|
||||||
|
if config.options.padding then
|
||||||
|
text:nl()
|
||||||
|
end
|
||||||
|
|
||||||
|
-- render file groups
|
||||||
|
for _, group in ipairs(grouped) do
|
||||||
|
if opts.open_folds then
|
||||||
|
folds.open(group.filename)
|
||||||
|
end
|
||||||
|
if opts.close_folds then
|
||||||
|
folds.close(group.filename)
|
||||||
|
end
|
||||||
|
renderer.render_file(view, text, group.filename, group.items)
|
||||||
|
end
|
||||||
|
|
||||||
|
view:render(text)
|
||||||
|
if opts.focus then
|
||||||
|
view:focus()
|
||||||
|
end
|
||||||
|
end, config.options)
|
||||||
|
end
|
||||||
|
|
||||||
|
---@param view TroubleView
|
||||||
|
---@param text Text
|
||||||
|
---@param items Item[]
|
||||||
|
---@param filename string
|
||||||
|
function renderer.render_file(view, text, filename, items)
|
||||||
|
view.items[text.lineNr + 1] = { filename = filename, is_file = true }
|
||||||
|
|
||||||
|
if view.group == true then
|
||||||
|
local count = util.count(items)
|
||||||
|
|
||||||
|
text:render(" ")
|
||||||
|
|
||||||
|
if folds.is_folded(filename) then
|
||||||
|
text:render(config.options.fold_closed, "FoldIcon", " ")
|
||||||
|
else
|
||||||
|
text:render(config.options.fold_open, "FoldIcon", " ")
|
||||||
|
end
|
||||||
|
|
||||||
|
if config.options.icons then
|
||||||
|
local icon, icon_hl = get_icon(filename)
|
||||||
|
text:render(icon, icon_hl, { exact = true, append = " " })
|
||||||
|
end
|
||||||
|
|
||||||
|
text:render(vim.fn.fnamemodify(filename, ":p:."), "File", " ")
|
||||||
|
text:render(" " .. count .. " ", "Count")
|
||||||
|
text:nl()
|
||||||
|
end
|
||||||
|
|
||||||
|
if not folds.is_folded(filename) then
|
||||||
|
renderer.render_diagnostics(view, text, items)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
---@param view TroubleView
|
||||||
|
---@param text Text
|
||||||
|
---@param items Item[]
|
||||||
|
function renderer.render_diagnostics(view, text, items)
|
||||||
|
for _, diag in ipairs(items) do
|
||||||
|
view.items[text.lineNr + 1] = diag
|
||||||
|
|
||||||
|
local sign = diag.sign or renderer.signs[string.lower(diag.type)]
|
||||||
|
if not sign then
|
||||||
|
sign = diag.type
|
||||||
|
end
|
||||||
|
|
||||||
|
local indent = " "
|
||||||
|
if config.options.indent_lines then
|
||||||
|
indent = " │ "
|
||||||
|
elseif config.options.group == false then
|
||||||
|
indent = " "
|
||||||
|
end
|
||||||
|
|
||||||
|
local sign_hl = diag.sign_hl or ("TroubleSign" .. diag.type)
|
||||||
|
|
||||||
|
text:render(indent, "Indent")
|
||||||
|
text:render(sign .. " ", sign_hl, { exact = true })
|
||||||
|
text:render(diag.text, "Text" .. diag.type, " ")
|
||||||
|
-- text:render(diag.type, diag.type, " ")
|
||||||
|
|
||||||
|
if diag.source then
|
||||||
|
text:render(diag.source, "Source")
|
||||||
|
end
|
||||||
|
if diag.code and diag.code ~= vim.NIL then
|
||||||
|
text:render(" (" .. diag.code .. ")", "Code")
|
||||||
|
end
|
||||||
|
|
||||||
|
text:render(" ")
|
||||||
|
|
||||||
|
text:render("[" .. diag.lnum .. ", " .. diag.col .. "]", "Location")
|
||||||
|
text:nl()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
return renderer
|
52
bundle/trouble.nvim/lua/trouble/text.lua
vendored
Normal file
52
bundle/trouble.nvim/lua/trouble/text.lua
vendored
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
---@class Text
|
||||||
|
---@field lines string[]
|
||||||
|
---@field hl Highlight[]
|
||||||
|
---@field lineNr number
|
||||||
|
---@field current string
|
||||||
|
local Text = {}
|
||||||
|
Text.__index = Text
|
||||||
|
|
||||||
|
function Text:new()
|
||||||
|
local this = { lines = {}, hl = {}, lineNr = 0, current = "" }
|
||||||
|
setmetatable(this, self)
|
||||||
|
return this
|
||||||
|
end
|
||||||
|
|
||||||
|
function Text:nl()
|
||||||
|
table.insert(self.lines, self.current)
|
||||||
|
self.current = ""
|
||||||
|
self.lineNr = self.lineNr + 1
|
||||||
|
end
|
||||||
|
|
||||||
|
function Text:render(str, group, opts)
|
||||||
|
str = str:gsub("[\n]", " ")
|
||||||
|
if type(opts) == "string" then
|
||||||
|
opts = { append = opts }
|
||||||
|
end
|
||||||
|
opts = opts or {}
|
||||||
|
|
||||||
|
if group then
|
||||||
|
if opts.exact ~= true then
|
||||||
|
group = "Trouble" .. group
|
||||||
|
end
|
||||||
|
local from = string.len(self.current)
|
||||||
|
---@class Highlight
|
||||||
|
local hl
|
||||||
|
hl = {
|
||||||
|
line = self.lineNr,
|
||||||
|
from = from,
|
||||||
|
to = from + string.len(str),
|
||||||
|
group = group,
|
||||||
|
}
|
||||||
|
table.insert(self.hl, hl)
|
||||||
|
end
|
||||||
|
self.current = self.current .. str
|
||||||
|
if opts.append then
|
||||||
|
self.current = self.current .. opts.append
|
||||||
|
end
|
||||||
|
if opts.nl then
|
||||||
|
self:nl()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
return Text
|
236
bundle/trouble.nvim/lua/trouble/util.lua
vendored
Normal file
236
bundle/trouble.nvim/lua/trouble/util.lua
vendored
Normal file
@ -0,0 +1,236 @@
|
|||||||
|
local config = require("trouble.config")
|
||||||
|
local uv = vim.loop
|
||||||
|
|
||||||
|
local M = {}
|
||||||
|
|
||||||
|
function M.jump_to_item(win, precmd, item)
|
||||||
|
-- requiring here, as otherwise we run into a circular dependency
|
||||||
|
local View = require("trouble.view")
|
||||||
|
|
||||||
|
-- save position in jump list
|
||||||
|
vim.cmd("normal! m'")
|
||||||
|
|
||||||
|
View.switch_to(win)
|
||||||
|
if precmd then
|
||||||
|
vim.cmd(precmd)
|
||||||
|
end
|
||||||
|
if not vim.bo[item.bufnr].buflisted then
|
||||||
|
vim.bo[item.bufnr].buflisted = true
|
||||||
|
end
|
||||||
|
if not vim.api.nvim_buf_is_loaded(item.bufnr) then
|
||||||
|
vim.fn.bufload(item.bufnr)
|
||||||
|
end
|
||||||
|
vim.api.nvim_set_current_buf(item.bufnr)
|
||||||
|
vim.api.nvim_win_set_cursor(win or 0, { item.start.line + 1, item.start.character })
|
||||||
|
end
|
||||||
|
|
||||||
|
function M.fix_mode(opts)
|
||||||
|
if opts.use_lsp_diagnostic_signs then
|
||||||
|
opts.use_diagnostic_signs = opts.use_lsp_diagnostic_signs
|
||||||
|
M.warn("The Trouble option use_lsp_diagnostic_signs has been renamed to use_diagnostic_signs")
|
||||||
|
end
|
||||||
|
local replace = {
|
||||||
|
lsp_workspace_diagnostics = "workspace_diagnostics",
|
||||||
|
lsp_document_diagnostics = "document_diagnostics",
|
||||||
|
workspace = "workspace_diagnostics",
|
||||||
|
document = "document_diagnostics",
|
||||||
|
}
|
||||||
|
|
||||||
|
for old, new in pairs(replace) do
|
||||||
|
if opts.mode == old then
|
||||||
|
opts.mode = new
|
||||||
|
M.warn("Using " .. old .. " for Trouble is deprecated. Please use " .. new .. " instead.")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function M.count(tab)
|
||||||
|
local count = 0
|
||||||
|
for _ in pairs(tab) do
|
||||||
|
count = count + 1
|
||||||
|
end
|
||||||
|
return count
|
||||||
|
end
|
||||||
|
|
||||||
|
function M.warn(msg)
|
||||||
|
vim.notify(msg, vim.log.levels.WARN, { title = "Trouble" })
|
||||||
|
end
|
||||||
|
|
||||||
|
function M.error(msg)
|
||||||
|
vim.notify(msg, vim.log.levels.ERROR, { title = "Trouble" })
|
||||||
|
end
|
||||||
|
|
||||||
|
function M.debug(msg)
|
||||||
|
if config.options.debug then
|
||||||
|
vim.notify(msg, vim.log.levels.DEBUG, { title = "Trouble" })
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function M.debounce(ms, fn)
|
||||||
|
local timer = vim.loop.new_timer()
|
||||||
|
return function(...)
|
||||||
|
local argv = { ... }
|
||||||
|
timer:start(ms, 0, function()
|
||||||
|
timer:stop()
|
||||||
|
vim.schedule_wrap(fn)(unpack(argv))
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function M.throttle(ms, fn)
|
||||||
|
local timer = vim.loop.new_timer()
|
||||||
|
local running = false
|
||||||
|
return function(...)
|
||||||
|
if not running then
|
||||||
|
local argv = { ... }
|
||||||
|
local argc = select("#", ...)
|
||||||
|
|
||||||
|
timer:start(ms, 0, function()
|
||||||
|
running = false
|
||||||
|
pcall(vim.schedule_wrap(fn), unpack(argv, 1, argc))
|
||||||
|
end)
|
||||||
|
running = true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
M.severity = {
|
||||||
|
[0] = "Other",
|
||||||
|
[1] = "Error",
|
||||||
|
[2] = "Warning",
|
||||||
|
[3] = "Information",
|
||||||
|
[4] = "Hint",
|
||||||
|
}
|
||||||
|
|
||||||
|
-- returns a hl or sign label for the givin severity and type
|
||||||
|
-- correctly handles new names introduced in vim.diagnostic
|
||||||
|
function M.get_severity_label(severity, type)
|
||||||
|
local label = severity
|
||||||
|
local prefix = "LspDiagnostics" .. (type or "Default")
|
||||||
|
|
||||||
|
if vim.diagnostic then
|
||||||
|
prefix = type and ("Diagnostic" .. type) or "Diagnostic"
|
||||||
|
label = ({
|
||||||
|
Warning = "Warn",
|
||||||
|
Information = "Info",
|
||||||
|
})[severity] or severity
|
||||||
|
end
|
||||||
|
|
||||||
|
return prefix .. label
|
||||||
|
end
|
||||||
|
|
||||||
|
-- based on the Telescope diagnostics code
|
||||||
|
-- see https://github.com/nvim-telescope/telescope.nvim/blob/0d6cd47990781ea760dd3db578015c140c7b9fa7/lua/telescope/utils.lua#L85
|
||||||
|
|
||||||
|
function M.process_item(item, bufnr)
|
||||||
|
bufnr = bufnr or item.bufnr
|
||||||
|
local filename = vim.api.nvim_buf_get_name(bufnr)
|
||||||
|
local uri = vim.uri_from_bufnr(bufnr)
|
||||||
|
local range = item.range or item.targetSelectionRange
|
||||||
|
|
||||||
|
local start = {
|
||||||
|
line = range and vim.tbl_get(range, "start", "line") or item.lnum,
|
||||||
|
character = range and vim.tbl_get(range, "start", "character") or item.col,
|
||||||
|
}
|
||||||
|
local finish = {
|
||||||
|
line = range and vim.tbl_get(range, "end", "line") or item.end_lnum,
|
||||||
|
character = range and vim.tbl_get(range, "end", "character") or item.end_col,
|
||||||
|
}
|
||||||
|
|
||||||
|
if start.character == nil or start.line == nil then
|
||||||
|
M.error("Found an item for Trouble without start range " .. vim.inspect(start))
|
||||||
|
end
|
||||||
|
if finish.character == nil or finish.line == nil then
|
||||||
|
M.error("Found an item for Trouble without finish range " .. vim.inspect(finish))
|
||||||
|
end
|
||||||
|
local row = start.line
|
||||||
|
local col = start.character
|
||||||
|
|
||||||
|
if not item.message and filename then
|
||||||
|
-- check if the filename is a uri
|
||||||
|
if string.match(filename, "^%w+://") ~= nil then
|
||||||
|
if not vim.api.nvim_buf_is_loaded(bufnr) then
|
||||||
|
vim.fn.bufload(bufnr)
|
||||||
|
end
|
||||||
|
local lines = vim.api.nvim_buf_get_lines(bufnr, row, row + 1, false)
|
||||||
|
item.message = lines[1] or ""
|
||||||
|
else
|
||||||
|
local fd = assert(uv.fs_open(filename, "r", 438))
|
||||||
|
local stat = assert(uv.fs_fstat(fd))
|
||||||
|
local data = assert(uv.fs_read(fd, stat.size, 0))
|
||||||
|
assert(uv.fs_close(fd))
|
||||||
|
|
||||||
|
item.message = vim.split(data, "\n", { plain = true })[row + 1] or ""
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
---@class Item
|
||||||
|
---@field is_file boolean
|
||||||
|
---@field fixed boolean
|
||||||
|
local ret
|
||||||
|
ret = {
|
||||||
|
bufnr = bufnr,
|
||||||
|
filename = filename,
|
||||||
|
lnum = row + 1,
|
||||||
|
col = col + 1,
|
||||||
|
start = start,
|
||||||
|
finish = finish,
|
||||||
|
sign = item.sign,
|
||||||
|
sign_hl = item.sign_hl,
|
||||||
|
-- remove line break to avoid display issues
|
||||||
|
text = vim.trim(item.message:gsub("[\n]", "")):sub(0, vim.o.columns),
|
||||||
|
full_text = vim.trim(item.message),
|
||||||
|
type = M.severity[item.severity] or M.severity[0],
|
||||||
|
code = item.code or (item.user_data and item.user_data.lsp and item.user_data.lsp.code),
|
||||||
|
source = item.source,
|
||||||
|
severity = item.severity or 0,
|
||||||
|
}
|
||||||
|
return ret
|
||||||
|
end
|
||||||
|
|
||||||
|
-- takes either a table indexed by bufnr, or an lsp result with uri
|
||||||
|
---@return Item[]
|
||||||
|
function M.locations_to_items(results, default_severity)
|
||||||
|
default_severity = default_severity or 0
|
||||||
|
local ret = {}
|
||||||
|
for bufnr, locs in pairs(results or {}) do
|
||||||
|
for _, loc in pairs(locs.result or locs) do
|
||||||
|
if not vim.tbl_isempty(loc) then
|
||||||
|
local uri = loc.uri or loc.targetUri
|
||||||
|
local buf = uri and vim.uri_to_bufnr(uri) or bufnr
|
||||||
|
loc.severity = loc.severity or default_severity
|
||||||
|
table.insert(ret, M.process_item(loc, buf))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return ret
|
||||||
|
end
|
||||||
|
|
||||||
|
-- @private
|
||||||
|
local function make_position_param(win, buf)
|
||||||
|
local row, col = unpack(vim.api.nvim_win_get_cursor(win))
|
||||||
|
row = row - 1
|
||||||
|
local line = vim.api.nvim_buf_get_lines(buf, row, row + 1, true)[1]
|
||||||
|
if not line then
|
||||||
|
return { line = 0, character = 0 }
|
||||||
|
end
|
||||||
|
col = vim.str_utfindex(line, col)
|
||||||
|
return { line = row, character = col }
|
||||||
|
end
|
||||||
|
|
||||||
|
function M.make_text_document_params(buf)
|
||||||
|
return { uri = vim.uri_from_bufnr(buf) }
|
||||||
|
end
|
||||||
|
|
||||||
|
--- Creates a `TextDocumentPositionParams` object for the current buffer and cursor position.
|
||||||
|
---
|
||||||
|
-- @returns `TextDocumentPositionParams` object
|
||||||
|
-- @see https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocumentPositionParams
|
||||||
|
function M.make_position_params(win, buf)
|
||||||
|
return {
|
||||||
|
textDocument = M.make_text_document_params(buf),
|
||||||
|
position = make_position_param(win, buf),
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
return M
|
524
bundle/trouble.nvim/lua/trouble/view.lua
vendored
Normal file
524
bundle/trouble.nvim/lua/trouble/view.lua
vendored
Normal file
@ -0,0 +1,524 @@
|
|||||||
|
local renderer = require("trouble.renderer")
|
||||||
|
local config = require("trouble.config")
|
||||||
|
local folds = require("trouble.folds")
|
||||||
|
local util = require("trouble.util")
|
||||||
|
|
||||||
|
local highlight = vim.api.nvim_buf_add_highlight
|
||||||
|
|
||||||
|
---@class TroubleView
|
||||||
|
---@field buf number
|
||||||
|
---@field win number
|
||||||
|
---@field group boolean
|
||||||
|
---@field items Item[]
|
||||||
|
---@field folded table<string, boolean>
|
||||||
|
---@field parent number
|
||||||
|
---@field float number
|
||||||
|
local View = {}
|
||||||
|
View.__index = View
|
||||||
|
|
||||||
|
-- keep track of buffers with added highlights
|
||||||
|
-- highlights are cleared on BufLeave of Trouble
|
||||||
|
local hl_bufs = {}
|
||||||
|
|
||||||
|
local function clear_hl(bufnr)
|
||||||
|
if vim.api.nvim_buf_is_valid(bufnr) then
|
||||||
|
vim.api.nvim_buf_clear_namespace(bufnr, config.namespace, 0, -1)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
---Find a rogue Trouble buffer that might have been spawned by i.e. a session.
|
||||||
|
local function find_rogue_buffer()
|
||||||
|
for _, v in ipairs(vim.api.nvim_list_bufs()) do
|
||||||
|
if vim.fn.bufname(v) == "Trouble" then
|
||||||
|
return v
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
|
||||||
|
---Find pre-existing Trouble buffer, delete its windows then wipe it.
|
||||||
|
---@private
|
||||||
|
local function wipe_rogue_buffer()
|
||||||
|
local bn = find_rogue_buffer()
|
||||||
|
if bn then
|
||||||
|
local win_ids = vim.fn.win_findbuf(bn)
|
||||||
|
for _, id in ipairs(win_ids) do
|
||||||
|
if vim.fn.win_gettype(id) ~= "autocmd" and vim.api.nvim_win_is_valid(id) then
|
||||||
|
vim.api.nvim_win_close(id, true)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
vim.api.nvim_buf_set_name(bn, "")
|
||||||
|
vim.schedule(function()
|
||||||
|
pcall(vim.api.nvim_buf_delete, bn, {})
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function View:new(opts)
|
||||||
|
opts = opts or {}
|
||||||
|
|
||||||
|
local group
|
||||||
|
if opts.group ~= nil then
|
||||||
|
group = opts.group
|
||||||
|
else
|
||||||
|
group = config.options.group
|
||||||
|
end
|
||||||
|
|
||||||
|
local this = {
|
||||||
|
buf = vim.api.nvim_get_current_buf(),
|
||||||
|
win = opts.win or vim.api.nvim_get_current_win(),
|
||||||
|
parent = opts.parent,
|
||||||
|
items = {},
|
||||||
|
group = group,
|
||||||
|
}
|
||||||
|
setmetatable(this, self)
|
||||||
|
return this
|
||||||
|
end
|
||||||
|
|
||||||
|
function View:set_option(name, value, win)
|
||||||
|
if win then
|
||||||
|
return vim.api.nvim_set_option_value(name, value, { win = self.win, scope = "local" })
|
||||||
|
else
|
||||||
|
return vim.api.nvim_set_option_value(name, value, { buf = self.buf })
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
---@param text Text
|
||||||
|
function View:render(text)
|
||||||
|
self:unlock()
|
||||||
|
self:set_lines(text.lines)
|
||||||
|
self:lock()
|
||||||
|
clear_hl(self.buf)
|
||||||
|
for _, data in ipairs(text.hl) do
|
||||||
|
highlight(self.buf, config.namespace, data.group, data.line, data.from, data.to)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function View:clear()
|
||||||
|
return vim.api.nvim_buf_set_lines(self.buf, 0, -1, false, {})
|
||||||
|
end
|
||||||
|
|
||||||
|
function View:unlock()
|
||||||
|
self:set_option("modifiable", true)
|
||||||
|
self:set_option("readonly", false)
|
||||||
|
end
|
||||||
|
|
||||||
|
function View:lock()
|
||||||
|
self:set_option("readonly", true)
|
||||||
|
self:set_option("modifiable", false)
|
||||||
|
end
|
||||||
|
|
||||||
|
function View:set_lines(lines, first, last, strict)
|
||||||
|
first = first or 0
|
||||||
|
last = last or -1
|
||||||
|
strict = strict or false
|
||||||
|
return vim.api.nvim_buf_set_lines(self.buf, first, last, strict, lines)
|
||||||
|
end
|
||||||
|
|
||||||
|
function View:is_valid()
|
||||||
|
return vim.api.nvim_buf_is_valid(self.buf) and vim.api.nvim_buf_is_loaded(self.buf)
|
||||||
|
end
|
||||||
|
|
||||||
|
function View:update(opts)
|
||||||
|
util.debug("update")
|
||||||
|
renderer.render(self, opts)
|
||||||
|
end
|
||||||
|
|
||||||
|
function View:setup(opts)
|
||||||
|
util.debug("setup")
|
||||||
|
opts = opts or {}
|
||||||
|
vim.cmd("setlocal nonu")
|
||||||
|
vim.cmd("setlocal nornu")
|
||||||
|
if not pcall(vim.api.nvim_buf_set_name, self.buf, "Trouble") then
|
||||||
|
wipe_rogue_buffer()
|
||||||
|
vim.api.nvim_buf_set_name(self.buf, "Trouble")
|
||||||
|
end
|
||||||
|
self:set_option("bufhidden", "wipe")
|
||||||
|
self:set_option("buftype", "nofile")
|
||||||
|
self:set_option("swapfile", false)
|
||||||
|
self:set_option("buflisted", false)
|
||||||
|
self:set_option("winfixwidth", true, true)
|
||||||
|
self:set_option("wrap", false, true)
|
||||||
|
self:set_option("spell", false, true)
|
||||||
|
self:set_option("list", false, true)
|
||||||
|
self:set_option("winfixheight", true, true)
|
||||||
|
self:set_option("signcolumn", "no", true)
|
||||||
|
self:set_option("foldmethod", "manual", true)
|
||||||
|
self:set_option("foldcolumn", "0", true)
|
||||||
|
self:set_option("foldlevel", 3, true)
|
||||||
|
self:set_option("foldenable", false, true)
|
||||||
|
self:set_option("winhighlight", "Normal:TroubleNormal,EndOfBuffer:TroubleNormal,SignColumn:TroubleNormal", true)
|
||||||
|
self:set_option("fcs", "eob: ", true)
|
||||||
|
|
||||||
|
for action, keys in pairs(config.options.action_keys) do
|
||||||
|
if type(keys) == "string" then
|
||||||
|
keys = { keys }
|
||||||
|
end
|
||||||
|
for _, key in pairs(keys) do
|
||||||
|
vim.api.nvim_buf_set_keymap(self.buf, "n", key, [[<cmd>lua require("trouble").action("]] .. action .. [[")<cr>]], {
|
||||||
|
silent = true,
|
||||||
|
noremap = true,
|
||||||
|
nowait = true,
|
||||||
|
})
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
if config.options.position == "top" or config.options.position == "bottom" then
|
||||||
|
vim.api.nvim_win_set_height(self.win, config.options.height)
|
||||||
|
else
|
||||||
|
vim.api.nvim_win_set_width(self.win, config.options.width)
|
||||||
|
end
|
||||||
|
|
||||||
|
self:set_option("filetype", "Trouble")
|
||||||
|
|
||||||
|
vim.api.nvim_exec(
|
||||||
|
[[
|
||||||
|
augroup TroubleHighlights
|
||||||
|
autocmd! * <buffer>
|
||||||
|
autocmd BufEnter <buffer> lua require("trouble").action("on_enter")
|
||||||
|
autocmd CursorMoved <buffer> lua require("trouble").action("auto_preview")
|
||||||
|
autocmd BufLeave <buffer> lua require("trouble").action("on_leave")
|
||||||
|
augroup END
|
||||||
|
]],
|
||||||
|
false
|
||||||
|
)
|
||||||
|
|
||||||
|
if not opts.parent then
|
||||||
|
self:on_enter()
|
||||||
|
end
|
||||||
|
self:lock()
|
||||||
|
self:update(opts)
|
||||||
|
end
|
||||||
|
|
||||||
|
function View:on_enter()
|
||||||
|
util.debug("on_enter")
|
||||||
|
|
||||||
|
self.parent = self.parent or vim.fn.win_getid(vim.fn.winnr("#"))
|
||||||
|
|
||||||
|
if (not self:is_valid_parent(self.parent)) or self.parent == self.win then
|
||||||
|
util.debug("not valid parent")
|
||||||
|
for _, win in pairs(vim.api.nvim_list_wins()) do
|
||||||
|
if self:is_valid_parent(win) and win ~= self.win then
|
||||||
|
self.parent = win
|
||||||
|
break
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
if not vim.api.nvim_win_is_valid(self.parent) then
|
||||||
|
return self:close()
|
||||||
|
end
|
||||||
|
|
||||||
|
self.parent_state = {
|
||||||
|
buf = vim.api.nvim_win_get_buf(self.parent),
|
||||||
|
cursor = vim.api.nvim_win_get_cursor(self.parent),
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
function View:on_leave()
|
||||||
|
util.debug("on_leave")
|
||||||
|
self:close_preview()
|
||||||
|
end
|
||||||
|
|
||||||
|
function View:close_preview()
|
||||||
|
-- Clear preview highlights
|
||||||
|
for buf, _ in pairs(hl_bufs) do
|
||||||
|
clear_hl(buf)
|
||||||
|
end
|
||||||
|
hl_bufs = {}
|
||||||
|
|
||||||
|
-- Reset parent state
|
||||||
|
local valid_win = vim.api.nvim_win_is_valid(self.parent)
|
||||||
|
local valid_buf = self.parent_state and vim.api.nvim_buf_is_valid(self.parent_state.buf)
|
||||||
|
|
||||||
|
if self.parent_state and valid_buf and valid_win then
|
||||||
|
vim.api.nvim_win_set_buf(self.parent, self.parent_state.buf)
|
||||||
|
vim.api.nvim_win_set_cursor(self.parent, self.parent_state.cursor)
|
||||||
|
end
|
||||||
|
|
||||||
|
self.parent_state = nil
|
||||||
|
end
|
||||||
|
|
||||||
|
function View:is_float(win)
|
||||||
|
local opts = vim.api.nvim_win_get_config(win)
|
||||||
|
return opts and opts.relative and opts.relative ~= ""
|
||||||
|
end
|
||||||
|
|
||||||
|
function View:is_valid_parent(win)
|
||||||
|
if not vim.api.nvim_win_is_valid(win) then
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
-- dont do anything for floating windows
|
||||||
|
if View:is_float(win) then
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
local buf = vim.api.nvim_win_get_buf(win)
|
||||||
|
-- Skip special buffers
|
||||||
|
if vim.api.nvim_buf_get_option(buf, "buftype") ~= "" then
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
|
||||||
|
function View:on_win_enter()
|
||||||
|
util.debug("on_win_enter")
|
||||||
|
|
||||||
|
local current_win = vim.api.nvim_get_current_win()
|
||||||
|
|
||||||
|
if vim.fn.winnr("$") == 1 and current_win == self.win then
|
||||||
|
vim.cmd([[q]])
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
if not self:is_valid_parent(current_win) then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
local current_buf = vim.api.nvim_get_current_buf()
|
||||||
|
|
||||||
|
-- update parent when needed
|
||||||
|
if current_win ~= self.parent and current_win ~= self.win then
|
||||||
|
self.parent = current_win
|
||||||
|
-- update diagnostics to match the window we are viewing
|
||||||
|
if self:is_valid() then
|
||||||
|
vim.defer_fn(function()
|
||||||
|
util.debug("update_on_win_enter")
|
||||||
|
self:update()
|
||||||
|
end, 100)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- check if another buffer took over our window
|
||||||
|
local parent = self.parent
|
||||||
|
if current_win == self.win and current_buf ~= self.buf then
|
||||||
|
-- open the buffer in the parent
|
||||||
|
vim.api.nvim_win_set_buf(parent, current_buf)
|
||||||
|
-- HACK: some window local settings need to be reset
|
||||||
|
vim.api.nvim_win_set_option(parent, "winhl", "")
|
||||||
|
-- close the current trouble window
|
||||||
|
vim.api.nvim_win_close(self.win, false)
|
||||||
|
-- open a new trouble window
|
||||||
|
require("trouble").open()
|
||||||
|
-- switch back to the opened window / buffer
|
||||||
|
View.switch_to(parent, current_buf)
|
||||||
|
-- util.warn("win_enter pro")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function View:focus()
|
||||||
|
View.switch_to(self.win, self.buf)
|
||||||
|
local line = self:get_line()
|
||||||
|
if line == 1 then
|
||||||
|
self:next_item()
|
||||||
|
if config.options.padding then
|
||||||
|
self:next_item()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function View.switch_to(win, buf)
|
||||||
|
if win then
|
||||||
|
vim.api.nvim_set_current_win(win)
|
||||||
|
if buf then
|
||||||
|
vim.api.nvim_win_set_buf(win, buf)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function View:switch_to_parent()
|
||||||
|
-- vim.cmd("wincmd p")
|
||||||
|
View.switch_to(self.parent)
|
||||||
|
end
|
||||||
|
|
||||||
|
function View:close()
|
||||||
|
util.debug("close")
|
||||||
|
if vim.api.nvim_win_is_valid(self.win) then
|
||||||
|
if vim.api.nvim_win_is_valid(self.parent) then
|
||||||
|
vim.api.nvim_set_current_win(self.parent)
|
||||||
|
end
|
||||||
|
vim.api.nvim_win_close(self.win, {})
|
||||||
|
end
|
||||||
|
if vim.api.nvim_buf_is_valid(self.buf) then
|
||||||
|
vim.api.nvim_buf_delete(self.buf, {})
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function View.create(opts)
|
||||||
|
opts = opts or {}
|
||||||
|
if opts.win then
|
||||||
|
View.switch_to(opts.win)
|
||||||
|
vim.cmd("enew")
|
||||||
|
else
|
||||||
|
vim.cmd("below new")
|
||||||
|
local pos = { bottom = "J", top = "K", left = "H", right = "L" }
|
||||||
|
vim.cmd("wincmd " .. (pos[config.options.position] or "K"))
|
||||||
|
end
|
||||||
|
local buffer = View:new(opts)
|
||||||
|
buffer:setup(opts)
|
||||||
|
|
||||||
|
if opts and opts.auto then
|
||||||
|
buffer:switch_to_parent()
|
||||||
|
end
|
||||||
|
return buffer
|
||||||
|
end
|
||||||
|
|
||||||
|
function View:get_cursor()
|
||||||
|
return vim.api.nvim_win_get_cursor(self.win)
|
||||||
|
end
|
||||||
|
function View:get_line()
|
||||||
|
return self:get_cursor()[1]
|
||||||
|
end
|
||||||
|
function View:get_col()
|
||||||
|
return self:get_cursor()[2]
|
||||||
|
end
|
||||||
|
|
||||||
|
function View:current_item()
|
||||||
|
local line = self:get_line()
|
||||||
|
local item = self.items[line]
|
||||||
|
return item
|
||||||
|
end
|
||||||
|
|
||||||
|
function View:next_item(opts)
|
||||||
|
opts = opts or { skip_groups = false }
|
||||||
|
local line = opts.first and 0 or self:get_line() + 1
|
||||||
|
|
||||||
|
if line > #self.items then
|
||||||
|
if config.options.cycle_results then
|
||||||
|
self:first_item(opts)
|
||||||
|
end
|
||||||
|
else
|
||||||
|
for i = line, vim.api.nvim_buf_line_count(self.buf), 1 do
|
||||||
|
if self.items[i] and not (opts.skip_groups and self.items[i].is_file) then
|
||||||
|
vim.api.nvim_win_set_cursor(self.win, { i, self:get_col() })
|
||||||
|
if opts.jump then
|
||||||
|
self:jump()
|
||||||
|
end
|
||||||
|
return
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function View:previous_item(opts)
|
||||||
|
opts = opts or { skip_groups = false }
|
||||||
|
local line = opts.last and vim.api.nvim_buf_line_count(self.buf) or self:get_line() - 1
|
||||||
|
|
||||||
|
for i = 0, vim.api.nvim_buf_line_count(self.buf), 1 do
|
||||||
|
if self.items[i] then
|
||||||
|
if line < i + (opts.skip_groups and 1 or 0) then
|
||||||
|
if config.options.cycle_results then
|
||||||
|
self:last_item(opts)
|
||||||
|
end
|
||||||
|
return
|
||||||
|
end
|
||||||
|
break
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
for i = line, 0, -1 do
|
||||||
|
if self.items[i] and not (opts.skip_groups and self.items[i].is_file) then
|
||||||
|
vim.api.nvim_win_set_cursor(self.win, { i, self:get_col() })
|
||||||
|
if opts.jump then
|
||||||
|
self:jump()
|
||||||
|
end
|
||||||
|
return
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function View:first_item(opts)
|
||||||
|
opts = opts or {}
|
||||||
|
opts.first = true
|
||||||
|
return self:next_item(opts)
|
||||||
|
end
|
||||||
|
|
||||||
|
function View:last_item(opts)
|
||||||
|
opts = opts or {}
|
||||||
|
opts.last = true
|
||||||
|
return self:previous_item(opts)
|
||||||
|
end
|
||||||
|
|
||||||
|
function View:hover(opts)
|
||||||
|
opts = opts or {}
|
||||||
|
local item = opts.item or self:current_item()
|
||||||
|
if not (item and item.full_text) then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
local lines = {}
|
||||||
|
for line in item.full_text:gmatch("([^\n]*)\n?") do
|
||||||
|
table.insert(lines, line)
|
||||||
|
end
|
||||||
|
|
||||||
|
vim.lsp.util.open_floating_preview(lines, "plaintext", { border = "single" })
|
||||||
|
end
|
||||||
|
|
||||||
|
function View:jump(opts)
|
||||||
|
opts = opts or {}
|
||||||
|
local item = opts.item or self:current_item()
|
||||||
|
if not item then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
if item.is_file == true then
|
||||||
|
folds.toggle(item.filename)
|
||||||
|
self:update()
|
||||||
|
else
|
||||||
|
util.jump_to_item(opts.win or self.parent, opts.precmd, item)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function View:toggle_fold()
|
||||||
|
folds.toggle(self:current_item().filename)
|
||||||
|
self:update()
|
||||||
|
end
|
||||||
|
|
||||||
|
function View:_preview()
|
||||||
|
if not vim.api.nvim_win_is_valid(self.parent) then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
local item = self:current_item()
|
||||||
|
if not item then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
util.debug("preview")
|
||||||
|
|
||||||
|
if item.is_file ~= true then
|
||||||
|
vim.api.nvim_win_set_buf(self.parent, item.bufnr)
|
||||||
|
local pos = { item.start.line + 1, item.start.character }
|
||||||
|
local line_count = vim.api.nvim_buf_line_count(item.bufnr)
|
||||||
|
pos[1] = math.min(pos[1], line_count)
|
||||||
|
vim.api.nvim_win_set_cursor(self.parent, pos)
|
||||||
|
|
||||||
|
vim.api.nvim_buf_call(item.bufnr, function()
|
||||||
|
-- Center preview line on screen and open enough folds to show it
|
||||||
|
vim.cmd("norm! zz zv")
|
||||||
|
if not vim.api.nvim_buf_is_loaded(item.bufnr) then
|
||||||
|
vim.fn.bufload(item.bufnr)
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
|
||||||
|
clear_hl(item.bufnr)
|
||||||
|
hl_bufs[item.bufnr] = true
|
||||||
|
for row = item.start.line, item.finish.line, 1 do
|
||||||
|
local col_start = 0
|
||||||
|
local col_end = -1
|
||||||
|
if row == item.start.line then
|
||||||
|
col_start = item.start.character
|
||||||
|
end
|
||||||
|
if row == item.finish.line then
|
||||||
|
col_end = item.finish.character
|
||||||
|
end
|
||||||
|
highlight(item.bufnr, config.namespace, "TroublePreview", row, col_start, col_end)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- View.preview = View._preview
|
||||||
|
|
||||||
|
View.preview = util.throttle(50, View._preview)
|
||||||
|
|
||||||
|
return View
|
BIN
bundle/trouble.nvim/media/shot.png
vendored
Normal file
BIN
bundle/trouble.nvim/media/shot.png
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 201 KiB |
21
bundle/trouble.nvim/plugin/trouble.vim
vendored
Normal file
21
bundle/trouble.nvim/plugin/trouble.vim
vendored
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
|
||||||
|
augroup Trouble
|
||||||
|
autocmd!
|
||||||
|
if has('nvim-0.6')
|
||||||
|
" Use the new diagnostic subsystem for neovim 0.6 and up
|
||||||
|
au DiagnosticChanged * lua require'trouble'.refresh({auto = true, provider = "diagnostics"})
|
||||||
|
else
|
||||||
|
au User LspDiagnosticsChanged lua require'trouble'.refresh({auto = true, provider = "diagnostics"})
|
||||||
|
endif
|
||||||
|
autocmd BufWinEnter,BufEnter * lua require("trouble").action("on_win_enter")
|
||||||
|
augroup end
|
||||||
|
|
||||||
|
function! s:complete(arg,line,pos) abort
|
||||||
|
return join(sort(luaeval('vim.tbl_keys(require("trouble.providers").providers)')), "\n")
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
command! -nargs=* -complete=custom,s:complete Trouble lua require'trouble'.open(<f-args>)
|
||||||
|
command! -nargs=* -complete=custom,s:complete TroubleToggle lua require'trouble'.toggle(<f-args>)
|
||||||
|
command! TroubleClose lua require'trouble'.close()
|
||||||
|
command! TroubleRefresh lua require'trouble'.refresh()
|
||||||
|
|
1
bundle/trouble.nvim/selene.toml
vendored
Normal file
1
bundle/trouble.nvim/selene.toml
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
std="lua51+vim"
|
3
bundle/trouble.nvim/stylua.toml
vendored
Normal file
3
bundle/trouble.nvim/stylua.toml
vendored
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
indent_type = "Spaces"
|
||||||
|
indent_width = 2
|
||||||
|
column_width = 120
|
2
bundle/trouble.nvim/vim.toml
vendored
Normal file
2
bundle/trouble.nvim/vim.toml
vendored
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
[vim]
|
||||||
|
any = true
|
30
bundle/vim-one/.github/workflows/main.yml
vendored
Normal file
30
bundle/vim-one/.github/workflows/main.yml
vendored
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
name: Automatic merge from upstream
|
||||||
|
|
||||||
|
on:
|
||||||
|
schedule:
|
||||||
|
# * is a special character in YAML so you have to quote this string
|
||||||
|
- cron: '0 0 * * *'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v1
|
||||||
|
- name: Sync upstream changes every day
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
GITHUB_ACTOR: ${{ github.actor }}
|
||||||
|
GITHUB_REPO: ${{ github.repository }}
|
||||||
|
run: |
|
||||||
|
REMOTE_REPO="rakr/vim-one"
|
||||||
|
git config user.email "actions@github.com"
|
||||||
|
git config user.name "GitHub Merge Action"
|
||||||
|
git checkout master
|
||||||
|
git remote set-url origin "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$GITHUB_REPO"
|
||||||
|
git remote add upstream "https://github.com/$REMOTE_REPO"
|
||||||
|
git fetch upstream
|
||||||
|
git merge upstream/master
|
||||||
|
git remote rm upstream
|
||||||
|
git push origin HEAD:master
|
56
bundle/vim-one/CONTRIBUTING.md
vendored
Normal file
56
bundle/vim-one/CONTRIBUTING.md
vendored
Normal file
@ -0,0 +1,56 @@
|
|||||||
|
If you wish to contribute to enhancing **vim-one**, please feel free to do so.
|
||||||
|
Open a pull request and I'll be happy to review it.
|
||||||
|
|
||||||
|
## Adding support for a new language
|
||||||
|
|
||||||
|
* Crack open `colors/one.vim`
|
||||||
|
* Create a new "section" for your language, the languages are alphabetically
|
||||||
|
sorted
|
||||||
|
|
||||||
|
**Sample section**
|
||||||
|
|
||||||
|
```
|
||||||
|
" C/C++ highlighting ------------------------------------------------------{{{
|
||||||
|
" }}}
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
* Start hacking
|
||||||
|
|
||||||
|
There is one function you should call:
|
||||||
|
|
||||||
|
```
|
||||||
|
call <sid>X('cInclude', s:hue_3, '', '')
|
||||||
|
```
|
||||||
|
|
||||||
|
The arguments are:
|
||||||
|
|
||||||
|
* The highlight
|
||||||
|
* Foreground color
|
||||||
|
* Background color
|
||||||
|
* Decoration (bold, italic, underline or any combination), for example
|
||||||
|
'bold,italic'
|
||||||
|
|
||||||
|
|
||||||
|
## Highlights
|
||||||
|
|
||||||
|
Highlights are defined in vim syntax files, there is no real standard, but some
|
||||||
|
of them are really "mainstream", for instance **elixir-lang/vim-elixir** for
|
||||||
|
*Elixir*.
|
||||||
|
|
||||||
|
I have these two following mapping in my `vimrc`
|
||||||
|
|
||||||
|
```
|
||||||
|
" Display highlight information
|
||||||
|
nnoremap <leader>ii :echo synIDattr(synID(line('.'), col('.'), 1), 'name')<CR>
|
||||||
|
|
||||||
|
" Display highlighting groups
|
||||||
|
nnoremap <leader>hi :so $VIMRUNTIME/syntax/hitest.vim<cr>
|
||||||
|
```
|
||||||
|
|
||||||
|
The first one `<leader>ii` displays the name of the hightlight the cursor is
|
||||||
|
on.
|
||||||
|
The second one `<leader>hi` lists all the highlights that are defined, bear in
|
||||||
|
mind that syntaxes are loaded dynamically by Vim.
|
||||||
|
|
||||||
|
Happy colorscheming...
|
21
bundle/vim-one/LICENSE
vendored
Normal file
21
bundle/vim-one/LICENSE
vendored
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
The MIT License (MIT)
|
||||||
|
|
||||||
|
Copyright (c) 2016 Ramzi Akremi
|
||||||
|
|
||||||
|
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.
|
174
bundle/vim-one/README.md
vendored
Normal file
174
bundle/vim-one/README.md
vendored
Normal file
@ -0,0 +1,174 @@
|
|||||||
|
![Logo][logo]
|
||||||
|
|
||||||
|
Light and dark vim colorscheme, shamelessly stolen from atom (another
|
||||||
|
excellent text editor). **One** supports *true colors* and falls back
|
||||||
|
gracefully and automatically if your environment does not support this
|
||||||
|
feature.
|
||||||
|
|
||||||
|
## Vim Airline theme
|
||||||
|
|
||||||
|
Add the following line to your `~/.vimrc` or `~/.config/nvim/init.vim`
|
||||||
|
|
||||||
|
```vim
|
||||||
|
let g:airline_theme='one'
|
||||||
|
```
|
||||||
|
|
||||||
|
As for the colorscheme, this theme comes with light and dark flavors.
|
||||||
|
|
||||||
|
## List of enhanced language support
|
||||||
|
|
||||||
|
Pull requests are more than welcome here.
|
||||||
|
I have created few issues to provide a bare bone roadmap for this color
|
||||||
|
scheme.
|
||||||
|
|
||||||
|
### Stable
|
||||||
|
|
||||||
|
* Asciidoc
|
||||||
|
* CSS and Sass
|
||||||
|
* Cucumber features
|
||||||
|
* Elixir
|
||||||
|
* Go
|
||||||
|
* Haskell
|
||||||
|
* HTML
|
||||||
|
* JavaScript, JSON
|
||||||
|
* Markdown
|
||||||
|
* PureScript (thanks: [Arthur Xavier](https://github.com/arthur-xavier))
|
||||||
|
* Ruby
|
||||||
|
* Rust (thanks: [Erasin](https://github.com/erasin))
|
||||||
|
* Vim
|
||||||
|
* XML
|
||||||
|
|
||||||
|
### In progress
|
||||||
|
|
||||||
|
* Jade
|
||||||
|
* PHP
|
||||||
|
* Python
|
||||||
|
* Switch to estilo in progress, not stable at all and does not reflect all the
|
||||||
|
capabilities of the current mainstream version
|
||||||
|
|
||||||
|
|
||||||
|
## Installation
|
||||||
|
|
||||||
|
You can use your preferred Vim Package Manager to install **One**.
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
**One** comes in two flavors: light and dark.
|
||||||
|
|
||||||
|
```vim
|
||||||
|
colorscheme one
|
||||||
|
set background=dark " for the dark version
|
||||||
|
" set background=light " for the light version
|
||||||
|
```
|
||||||
|
|
||||||
|
`set background` has to be called after setting the colorscheme, this explains
|
||||||
|
the issue [#21][issue_21] where Vim tries to determine the best background when `ctermbg`
|
||||||
|
for the `Normal` highlight is defined.
|
||||||
|
|
||||||
|
### Italic support
|
||||||
|
|
||||||
|
Some terminals do not support italic, cf. [#3][issue_3].
|
||||||
|
|
||||||
|
If your terminal does support _italic_, you can set the `g:one_allow_italics` variable to 1 in your `.vimrc` or `.config/nvim/init.vim`:
|
||||||
|
|
||||||
|
```vim
|
||||||
|
set background=light " for the light version
|
||||||
|
let g:one_allow_italics = 1 " I love italic for comments
|
||||||
|
colorscheme one
|
||||||
|
```
|
||||||
|
|
||||||
|
iTerm2 can support italic, follow the instructions given in this [blog post by Alex Pearce](https://alexpearce.me/2014/05/italics-in-iterm2-vim-tmux/).
|
||||||
|
Make sure to read the update if you are using tmux version 2.1 or above.
|
||||||
|
|
||||||
|
### True color support
|
||||||
|
To benefit from the **true color** support make sure to add the following lines in your `.vimrc` or `.config/nvim/init.vim`
|
||||||
|
|
||||||
|
```vim
|
||||||
|
"Credit joshdick
|
||||||
|
"Use 24-bit (true-color) mode in Vim/Neovim when outside tmux.
|
||||||
|
"If you're using tmux version 2.2 or later, you can remove the outermost $TMUX check and use tmux's 24-bit color support
|
||||||
|
"(see < http://sunaku.github.io/tmux-24bit-color.html#usage > for more information.)
|
||||||
|
if (empty($TMUX))
|
||||||
|
if (has("nvim"))
|
||||||
|
"For Neovim 0.1.3 and 0.1.4 < https://github.com/neovim/neovim/pull/2198 >
|
||||||
|
let $NVIM_TUI_ENABLE_TRUE_COLOR=1
|
||||||
|
endif
|
||||||
|
"For Neovim > 0.1.5 and Vim > patch 7.4.1799 < https://github.com/vim/vim/commit/61be73bb0f965a895bfb064ea3e55476ac175162 >
|
||||||
|
"Based on Vim patch 7.4.1770 (`guicolors` option) < https://github.com/vim/vim/commit/8a633e3427b47286869aa4b96f2bfc1fe65b25cd >
|
||||||
|
" < https://github.com/neovim/neovim/wiki/Following-HEAD#20160511 >
|
||||||
|
if (has("termguicolors"))
|
||||||
|
set termguicolors
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
|
||||||
|
set background=dark " for the dark version
|
||||||
|
" set background=light " for the light version
|
||||||
|
colorscheme one
|
||||||
|
```
|
||||||
|
### Tmux support
|
||||||
|
To get true color working in tmux, ensure that the `$TERM` environment variable is set to `xterm-256color`. Inside the `.tmux.conf` file we need to override this terminal and also set the default terminal as 256 color.
|
||||||
|
|
||||||
|
```
|
||||||
|
# Add truecolor support
|
||||||
|
set-option -ga terminal-overrides ",xterm-256color:Tc"
|
||||||
|
# Default terminal is 256 colors
|
||||||
|
set -g default-terminal "screen-256color"
|
||||||
|
```
|
||||||
|
|
||||||
|
Note that this only works for Neovim (tested on 0.1.5). For some reason Vim (7.5.2334) doesn't play nice. See [blog post by Anton Kalyaev](http://homeonrails.com/2016/05/truecolor-in-gnome-terminal-tmux-and-neovim/) for more details on setting up tmux.
|
||||||
|
|
||||||
|
For Vim inside tmux, you can add the following snippet in your `~/.vimrc`
|
||||||
|
|
||||||
|
```viml
|
||||||
|
set t_8b=^[[48;2;%lu;%lu;%lum
|
||||||
|
set t_8f=^[[38;2;%lu;%lu;%lum
|
||||||
|
```
|
||||||
|
|
||||||
|
Note: the `^[` in this snippet is a real escape character. To insert it, press `Ctrl-V` and then `Esc`.
|
||||||
|
|
||||||
|
I've tested the following setup on a Mac:
|
||||||
|
|
||||||
|
* iTerm2 nightly build
|
||||||
|
* Neovim 0.1.4 and 0.1.5-dev
|
||||||
|
* Vim 7.4.1952
|
||||||
|
|
||||||
|
## Customising One without fork
|
||||||
|
|
||||||
|
Following a request to be able to customise **one** without the need to fork,
|
||||||
|
**one** is now exposing a public function to meet this requirement.
|
||||||
|
|
||||||
|
After the colorscheme has been initialised, you can call the following function:
|
||||||
|
|
||||||
|
```
|
||||||
|
one#highlight(group, fg, bg, attribute)
|
||||||
|
```
|
||||||
|
|
||||||
|
* `group`: Highlight you want to customise for example `vimLineComment`
|
||||||
|
* `fg`: foreground color for the highlight, without the '#', for example:
|
||||||
|
`ff0000`
|
||||||
|
* `bg`: background color for the highlight, without the '#', for example:
|
||||||
|
`ff0000`
|
||||||
|
* `attribute`: `bold`, `italic`, `underline` or any comma separated combination
|
||||||
|
|
||||||
|
For example:
|
||||||
|
|
||||||
|
```
|
||||||
|
call one#highlight('vimLineComment', 'cccccc', '', 'none')
|
||||||
|
```
|
||||||
|
|
||||||
|
## Contributors
|
||||||
|
|
||||||
|
A special thank you to the following people
|
||||||
|
|
||||||
|
* [laggardkernel](https://github.com/laggardkernel): Startup time improvement
|
||||||
|
* [Erasin](https://github.com/erasin): Rust support
|
||||||
|
* [Malcolm Ramsay - malramsay64](https://github.com/malramsay64): Gracefully fail if colorscheme is not properly loaded
|
||||||
|
* [Arthur Xavier](https://github.com/arthur-xavier): PureScript support
|
||||||
|
* [keremc](https://github.com/keremc): Tip Vim true color support inside tmux
|
||||||
|
* [jetm](https://github.com/jetm): C/C++ highlighting
|
||||||
|
|
||||||
|
[logo]: screenshots/new-logo.png
|
||||||
|
|
||||||
|
[issue_3]: https://github.com/rakr/vim-one/issues/3
|
||||||
|
[issue_21]: https://github.com/rakr/vim-one/issues/21
|
44
bundle/vim-one/autoload/airline/themes/one.vim
vendored
Normal file
44
bundle/vim-one/autoload/airline/themes/one.vim
vendored
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
let g:airline#themes#one#palette = {}
|
||||||
|
|
||||||
|
function! airline#themes#one#refresh()
|
||||||
|
let g:airline#themes#one#palette.accents = {
|
||||||
|
\ 'red': airline#themes#get_highlight('Constant'),
|
||||||
|
\ }
|
||||||
|
|
||||||
|
let s:N1 = airline#themes#get_highlight2(['CursorLine', 'bg'], ['DiffAdd', 'fg'], 'none')
|
||||||
|
let s:N2 = airline#themes#get_highlight2(['Normal', 'fg'], ['SpecialKey', 'fg'], 'none')
|
||||||
|
let s:N3 = airline#themes#get_highlight('CursorLine')
|
||||||
|
let g:airline#themes#one#palette.normal = airline#themes#generate_color_map(s:N1, s:N2, s:N3)
|
||||||
|
|
||||||
|
let group = airline#themes#get_highlight('vimCommand')
|
||||||
|
let g:airline#themes#one#palette.normal_modified = {
|
||||||
|
\ 'airline_c': [ group[0], '', group[2], '', '' ]
|
||||||
|
\ }
|
||||||
|
|
||||||
|
let s:I1 = airline#themes#get_highlight2(['Normal', 'bg'], ['DiffLine', 'fg'], 'none')
|
||||||
|
let s:I2 = airline#themes#get_highlight2(['Normal', 'fg'], ['SpecialKey', 'fg'], 'none')
|
||||||
|
let s:I3 = s:N3
|
||||||
|
let g:airline#themes#one#palette.insert = airline#themes#generate_color_map(s:I1, s:I2, s:I3)
|
||||||
|
let g:airline#themes#one#palette.insert_modified = g:airline#themes#one#palette.normal_modified
|
||||||
|
|
||||||
|
let s:R1 = airline#themes#get_highlight2(['Normal', 'bg'], ['Error', 'fg'], 'none')
|
||||||
|
let s:R2 = s:N2
|
||||||
|
let s:R3 = s:N3
|
||||||
|
let g:airline#themes#one#palette.replace = airline#themes#generate_color_map(s:R1, s:R2, s:R3)
|
||||||
|
let g:airline#themes#one#palette.replace_modified = g:airline#themes#one#palette.normal_modified
|
||||||
|
|
||||||
|
let s:V1 = airline#themes#get_highlight2(['Normal', 'bg'], ['Statement', 'fg'], 'none')
|
||||||
|
let s:V2 = airline#themes#get_highlight2(['Normal', 'fg'], ['SpecialKey', 'fg'], 'none')
|
||||||
|
let s:V3 = s:N3
|
||||||
|
let g:airline#themes#one#palette.visual = airline#themes#generate_color_map(s:V1, s:V2, s:V3)
|
||||||
|
let g:airline#themes#one#palette.visual_modified = g:airline#themes#one#palette.normal_modified
|
||||||
|
|
||||||
|
let s:IA = airline#themes#get_highlight2(['NonText', 'fg'], ['CursorLine', 'bg'])
|
||||||
|
let g:airline#themes#one#palette.inactive = airline#themes#generate_color_map(s:IA, s:IA, s:IA)
|
||||||
|
let g:airline#themes#one#palette.inactive_modified = {
|
||||||
|
\ 'airline_c': [ group[0], '', group[2], '', '' ]
|
||||||
|
\ }
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
call airline#themes#one#refresh()
|
||||||
|
|
883
bundle/vim-one/colors/one.vim
vendored
Normal file
883
bundle/vim-one/colors/one.vim
vendored
Normal file
@ -0,0 +1,883 @@
|
|||||||
|
" Name: one vim colorscheme
|
||||||
|
" Author: Ramzi Akremi
|
||||||
|
" License: MIT
|
||||||
|
" Version: 1.1.1-pre
|
||||||
|
|
||||||
|
" Global setup =============================================================={{{
|
||||||
|
|
||||||
|
if exists("*<SID>X")
|
||||||
|
delf <SID>X
|
||||||
|
delf <SID>XAPI
|
||||||
|
delf <SID>rgb
|
||||||
|
delf <SID>color
|
||||||
|
delf <SID>rgb_color
|
||||||
|
delf <SID>rgb_level
|
||||||
|
delf <SID>rgb_number
|
||||||
|
delf <SID>grey_color
|
||||||
|
delf <SID>grey_level
|
||||||
|
delf <SID>grey_number
|
||||||
|
endif
|
||||||
|
|
||||||
|
hi clear
|
||||||
|
syntax reset
|
||||||
|
if exists('g:colors_name')
|
||||||
|
unlet g:colors_name
|
||||||
|
endif
|
||||||
|
let g:colors_name = 'one'
|
||||||
|
|
||||||
|
if !exists('g:one_allow_italics')
|
||||||
|
let g:one_allow_italics = 0
|
||||||
|
endif
|
||||||
|
|
||||||
|
let s:italic = ''
|
||||||
|
if g:one_allow_italics == 1
|
||||||
|
let s:italic = 'italic'
|
||||||
|
endif
|
||||||
|
|
||||||
|
if has('gui_running') || has('termguicolors') || &t_Co == 88 || &t_Co == 256
|
||||||
|
" functions
|
||||||
|
" returns an approximate grey index for the given grey level
|
||||||
|
|
||||||
|
" Utility functions -------------------------------------------------------{{{
|
||||||
|
fun <SID>grey_number(x)
|
||||||
|
if &t_Co == 88
|
||||||
|
if a:x < 23
|
||||||
|
return 0
|
||||||
|
elseif a:x < 69
|
||||||
|
return 1
|
||||||
|
elseif a:x < 103
|
||||||
|
return 2
|
||||||
|
elseif a:x < 127
|
||||||
|
return 3
|
||||||
|
elseif a:x < 150
|
||||||
|
return 4
|
||||||
|
elseif a:x < 173
|
||||||
|
return 5
|
||||||
|
elseif a:x < 196
|
||||||
|
return 6
|
||||||
|
elseif a:x < 219
|
||||||
|
return 7
|
||||||
|
elseif a:x < 243
|
||||||
|
return 8
|
||||||
|
else
|
||||||
|
return 9
|
||||||
|
endif
|
||||||
|
else
|
||||||
|
if a:x < 14
|
||||||
|
return 0
|
||||||
|
else
|
||||||
|
let l:n = (a:x - 8) / 10
|
||||||
|
let l:m = (a:x - 8) % 10
|
||||||
|
if l:m < 5
|
||||||
|
return l:n
|
||||||
|
else
|
||||||
|
return l:n + 1
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
endfun
|
||||||
|
|
||||||
|
" returns the actual grey level represented by the grey index
|
||||||
|
fun <SID>grey_level(n)
|
||||||
|
if &t_Co == 88
|
||||||
|
if a:n == 0
|
||||||
|
return 0
|
||||||
|
elseif a:n == 1
|
||||||
|
return 46
|
||||||
|
elseif a:n == 2
|
||||||
|
return 92
|
||||||
|
elseif a:n == 3
|
||||||
|
return 115
|
||||||
|
elseif a:n == 4
|
||||||
|
return 139
|
||||||
|
elseif a:n == 5
|
||||||
|
return 162
|
||||||
|
elseif a:n == 6
|
||||||
|
return 185
|
||||||
|
elseif a:n == 7
|
||||||
|
return 208
|
||||||
|
elseif a:n == 8
|
||||||
|
return 231
|
||||||
|
else
|
||||||
|
return 255
|
||||||
|
endif
|
||||||
|
else
|
||||||
|
if a:n == 0
|
||||||
|
return 0
|
||||||
|
else
|
||||||
|
return 8 + (a:n * 10)
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
endfun
|
||||||
|
|
||||||
|
" returns the palette index for the given grey index
|
||||||
|
fun <SID>grey_color(n)
|
||||||
|
if &t_Co == 88
|
||||||
|
if a:n == 0
|
||||||
|
return 16
|
||||||
|
elseif a:n == 9
|
||||||
|
return 79
|
||||||
|
else
|
||||||
|
return 79 + a:n
|
||||||
|
endif
|
||||||
|
else
|
||||||
|
if a:n == 0
|
||||||
|
return 16
|
||||||
|
elseif a:n == 25
|
||||||
|
return 231
|
||||||
|
else
|
||||||
|
return 231 + a:n
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
endfun
|
||||||
|
|
||||||
|
" returns an approximate color index for the given color level
|
||||||
|
fun <SID>rgb_number(x)
|
||||||
|
if &t_Co == 88
|
||||||
|
if a:x < 69
|
||||||
|
return 0
|
||||||
|
elseif a:x < 172
|
||||||
|
return 1
|
||||||
|
elseif a:x < 230
|
||||||
|
return 2
|
||||||
|
else
|
||||||
|
return 3
|
||||||
|
endif
|
||||||
|
else
|
||||||
|
if a:x < 75
|
||||||
|
return 0
|
||||||
|
else
|
||||||
|
let l:n = (a:x - 55) / 40
|
||||||
|
let l:m = (a:x - 55) % 40
|
||||||
|
if l:m < 20
|
||||||
|
return l:n
|
||||||
|
else
|
||||||
|
return l:n + 1
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
endfun
|
||||||
|
|
||||||
|
" returns the actual color level for the given color index
|
||||||
|
fun <SID>rgb_level(n)
|
||||||
|
if &t_Co == 88
|
||||||
|
if a:n == 0
|
||||||
|
return 0
|
||||||
|
elseif a:n == 1
|
||||||
|
return 139
|
||||||
|
elseif a:n == 2
|
||||||
|
return 205
|
||||||
|
else
|
||||||
|
return 255
|
||||||
|
endif
|
||||||
|
else
|
||||||
|
if a:n == 0
|
||||||
|
return 0
|
||||||
|
else
|
||||||
|
return 55 + (a:n * 40)
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
endfun
|
||||||
|
|
||||||
|
" returns the palette index for the given R/G/B color indices
|
||||||
|
fun <SID>rgb_color(x, y, z)
|
||||||
|
if &t_Co == 88
|
||||||
|
return 16 + (a:x * 16) + (a:y * 4) + a:z
|
||||||
|
else
|
||||||
|
return 16 + (a:x * 36) + (a:y * 6) + a:z
|
||||||
|
endif
|
||||||
|
endfun
|
||||||
|
|
||||||
|
" returns the palette index to approximate the given R/G/B color levels
|
||||||
|
fun <SID>color(r, g, b)
|
||||||
|
" get the closest grey
|
||||||
|
let l:gx = <SID>grey_number(a:r)
|
||||||
|
let l:gy = <SID>grey_number(a:g)
|
||||||
|
let l:gz = <SID>grey_number(a:b)
|
||||||
|
|
||||||
|
" get the closest color
|
||||||
|
let l:x = <SID>rgb_number(a:r)
|
||||||
|
let l:y = <SID>rgb_number(a:g)
|
||||||
|
let l:z = <SID>rgb_number(a:b)
|
||||||
|
|
||||||
|
if l:gx == l:gy && l:gy == l:gz
|
||||||
|
" there are two possibilities
|
||||||
|
let l:dgr = <SID>grey_level(l:gx) - a:r
|
||||||
|
let l:dgg = <SID>grey_level(l:gy) - a:g
|
||||||
|
let l:dgb = <SID>grey_level(l:gz) - a:b
|
||||||
|
let l:dgrey = (l:dgr * l:dgr) + (l:dgg * l:dgg) + (l:dgb * l:dgb)
|
||||||
|
let l:dr = <SID>rgb_level(l:gx) - a:r
|
||||||
|
let l:dg = <SID>rgb_level(l:gy) - a:g
|
||||||
|
let l:db = <SID>rgb_level(l:gz) - a:b
|
||||||
|
let l:drgb = (l:dr * l:dr) + (l:dg * l:dg) + (l:db * l:db)
|
||||||
|
if l:dgrey < l:drgb
|
||||||
|
" use the grey
|
||||||
|
return <SID>grey_color(l:gx)
|
||||||
|
else
|
||||||
|
" use the color
|
||||||
|
return <SID>rgb_color(l:x, l:y, l:z)
|
||||||
|
endif
|
||||||
|
else
|
||||||
|
" only one possibility
|
||||||
|
return <SID>rgb_color(l:x, l:y, l:z)
|
||||||
|
endif
|
||||||
|
endfun
|
||||||
|
|
||||||
|
" returns the palette index to approximate the 'rrggbb' hex string
|
||||||
|
fun <SID>rgb(rgb)
|
||||||
|
let l:r = ('0x' . strpart(a:rgb, 0, 2)) + 0
|
||||||
|
let l:g = ('0x' . strpart(a:rgb, 2, 2)) + 0
|
||||||
|
let l:b = ('0x' . strpart(a:rgb, 4, 2)) + 0
|
||||||
|
|
||||||
|
return <SID>color(l:r, l:g, l:b)
|
||||||
|
endfun
|
||||||
|
|
||||||
|
" sets the highlighting for the given group
|
||||||
|
fun <SID>XAPI(group, fg, bg, attr)
|
||||||
|
let l:attr = a:attr
|
||||||
|
if g:one_allow_italics == 0 && l:attr ==? 'italic'
|
||||||
|
let l:attr= 'none'
|
||||||
|
endif
|
||||||
|
|
||||||
|
let l:bg = ""
|
||||||
|
let l:fg = ""
|
||||||
|
let l:decoration = ""
|
||||||
|
|
||||||
|
if a:bg != ''
|
||||||
|
let l:bg = " guibg=#" . a:bg . " ctermbg=" . <SID>rgb(a:bg)
|
||||||
|
endif
|
||||||
|
|
||||||
|
if a:fg != ''
|
||||||
|
let l:fg = " guifg=#" . a:fg . " ctermfg=" . <SID>rgb(a:fg)
|
||||||
|
endif
|
||||||
|
|
||||||
|
if a:attr != ''
|
||||||
|
let l:decoration = " gui=" . l:attr . " cterm=" . l:attr
|
||||||
|
endif
|
||||||
|
|
||||||
|
let l:exec = l:fg . l:bg . l:decoration
|
||||||
|
|
||||||
|
if l:exec != ''
|
||||||
|
exec "hi " . a:group . l:exec
|
||||||
|
endif
|
||||||
|
|
||||||
|
endfun
|
||||||
|
|
||||||
|
" Highlight function
|
||||||
|
" the original one is borrowed from mhartington/oceanic-next
|
||||||
|
function! <SID>X(group, fg, bg, attr, ...)
|
||||||
|
let l:attrsp = get(a:, 1, "")
|
||||||
|
" fg, bg, attr, attrsp
|
||||||
|
if !empty(a:fg)
|
||||||
|
exec "hi " . a:group . " guifg=" . a:fg[0]
|
||||||
|
exec "hi " . a:group . " ctermfg=" . a:fg[1]
|
||||||
|
endif
|
||||||
|
if !empty(a:bg)
|
||||||
|
exec "hi " . a:group . " guibg=" . a:bg[0]
|
||||||
|
exec "hi " . a:group . " ctermbg=" . a:bg[1]
|
||||||
|
endif
|
||||||
|
if a:attr != ""
|
||||||
|
exec "hi " . a:group . " gui=" . a:attr
|
||||||
|
exec "hi " . a:group . " cterm=" . a:attr
|
||||||
|
endif
|
||||||
|
if !empty(l:attrsp)
|
||||||
|
exec "hi " . a:group . " guisp=" . l:attrsp[0]
|
||||||
|
endif
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" }}}
|
||||||
|
|
||||||
|
|
||||||
|
" Color definition --------------------------------------------------------{{{
|
||||||
|
let s:dark = 0
|
||||||
|
if &background ==# 'dark'
|
||||||
|
let s:dark = 1
|
||||||
|
let s:mono_1 = ['#abb2bf', '145']
|
||||||
|
let s:mono_2 = ['#828997', '102']
|
||||||
|
let s:mono_3 = ['#5c6370', '59']
|
||||||
|
let s:mono_4 = ['#4b5263', '59']
|
||||||
|
|
||||||
|
let s:hue_1 = ['#56b6c2', '73'] " cyan
|
||||||
|
let s:hue_2 = ['#61afef', '75'] " blue
|
||||||
|
let s:hue_3 = ['#c678dd', '176'] " purple
|
||||||
|
let s:hue_4 = ['#98c379', '114'] " green
|
||||||
|
|
||||||
|
let s:hue_5 = ['#e06c75', '168'] " red 1
|
||||||
|
let s:hue_5_2 = ['#be5046', '130'] " red 2
|
||||||
|
|
||||||
|
let s:hue_6 = ['#d19a66', '173'] " orange 1
|
||||||
|
let s:hue_6_2 = ['#e5c07b', '180'] " orange 2
|
||||||
|
|
||||||
|
let s:syntax_bg = ['#282c34', '16']
|
||||||
|
let s:syntax_gutter = ['#636d83', '60']
|
||||||
|
let s:syntax_cursor = ['#2c323c', '16']
|
||||||
|
|
||||||
|
let s:syntax_accent = ['#528bff', '69']
|
||||||
|
|
||||||
|
let s:vertsplit = ['#181a1f', '233']
|
||||||
|
let s:special_grey = ['#3b4048', '16']
|
||||||
|
let s:visual_grey = ['#3e4452', '17']
|
||||||
|
let s:pmenu = ['#333841', '16']
|
||||||
|
else
|
||||||
|
let s:mono_1 = ['#494b53', '23']
|
||||||
|
let s:mono_2 = ['#696c77', '60']
|
||||||
|
let s:mono_3 = ['#a0a1a7', '145']
|
||||||
|
let s:mono_4 = ['#c2c2c3', '250']
|
||||||
|
|
||||||
|
let s:hue_1 = ['#0184bc', '31'] " cyan
|
||||||
|
let s:hue_2 = ['#4078f2', '33'] " blue
|
||||||
|
let s:hue_3 = ['#a626a4', '127'] " purple
|
||||||
|
let s:hue_4 = ['#50a14f', '71'] " green
|
||||||
|
|
||||||
|
let s:hue_5 = ['#e45649', '166'] " red 1
|
||||||
|
let s:hue_5_2 = ['#ca1243', '160'] " red 2
|
||||||
|
|
||||||
|
let s:hue_6 = ['#986801', '94'] " orange 1
|
||||||
|
let s:hue_6_2 = ['#c18401', '136'] " orange 2
|
||||||
|
|
||||||
|
let s:syntax_bg = ['#fafafa', '255']
|
||||||
|
let s:syntax_gutter = ['#9e9e9e', '247']
|
||||||
|
let s:syntax_cursor = ['#f0f0f0', '254']
|
||||||
|
|
||||||
|
let s:syntax_accent = ['#526fff', '63']
|
||||||
|
let s:syntax_accent_2 = ['#0083be', '31']
|
||||||
|
|
||||||
|
let s:vertsplit = ['#e7e9e1', '188']
|
||||||
|
let s:special_grey = ['#d3d3d3', '251']
|
||||||
|
let s:visual_grey = ['#d0d0d0', '251']
|
||||||
|
let s:pmenu = ['#dfdfdf', '253']
|
||||||
|
endif
|
||||||
|
|
||||||
|
let s:syntax_fg = s:mono_1
|
||||||
|
let s:syntax_fold_bg = s:mono_3
|
||||||
|
|
||||||
|
" }}}
|
||||||
|
|
||||||
|
" Vim editor color --------------------------------------------------------{{{
|
||||||
|
call <sid>X('Normal', s:syntax_fg, s:syntax_bg, '')
|
||||||
|
call <sid>X('bold', '', '', 'bold')
|
||||||
|
call <sid>X('ColorColumn', '', s:syntax_cursor, '')
|
||||||
|
call <sid>X('Conceal', s:mono_4, s:syntax_bg, '')
|
||||||
|
call <sid>X('Cursor', '', s:syntax_accent, '')
|
||||||
|
call <sid>X('CursorIM', '', '', '')
|
||||||
|
call <sid>X('CursorColumn', '', s:syntax_cursor, '')
|
||||||
|
call <sid>X('CursorLine', '', s:syntax_cursor, 'none')
|
||||||
|
call <sid>X('Directory', s:hue_2, '', '')
|
||||||
|
call <sid>X('ErrorMsg', s:hue_5, s:syntax_bg, 'none')
|
||||||
|
call <sid>X('VertSplit', s:syntax_cursor, s:syntax_cursor, 'none')
|
||||||
|
call <sid>X('Folded', s:syntax_fg, s:syntax_bg, 'none')
|
||||||
|
call <sid>X('FoldColumn', s:mono_3, s:syntax_cursor, '')
|
||||||
|
call <sid>X('IncSearch', s:hue_6, '', '')
|
||||||
|
call <sid>X('LineNr', s:mono_4, '', '')
|
||||||
|
call <sid>X('CursorLineNr', s:syntax_fg, s:syntax_cursor, 'none')
|
||||||
|
call <sid>X('MatchParen', s:hue_5, s:syntax_cursor, 'underline,bold')
|
||||||
|
call <sid>X('Italic', '', '', s:italic)
|
||||||
|
call <sid>X('ModeMsg', s:syntax_fg, '', '')
|
||||||
|
call <sid>X('MoreMsg', s:syntax_fg, '', '')
|
||||||
|
call <sid>X('NonText', s:mono_3, '', 'none')
|
||||||
|
call <sid>X('PMenu', '', s:pmenu, '')
|
||||||
|
call <sid>X('PMenuSel', '', s:mono_4, '')
|
||||||
|
call <sid>X('PMenuSbar', '', s:syntax_bg, '')
|
||||||
|
call <sid>X('PMenuThumb', '', s:mono_1, '')
|
||||||
|
call <sid>X('Question', s:hue_2, '', '')
|
||||||
|
call <sid>X('Search', s:syntax_bg, s:hue_6_2, '')
|
||||||
|
call <sid>X('SpecialKey', s:special_grey, '', 'none')
|
||||||
|
call <sid>X('Whitespace', s:special_grey, '', 'none')
|
||||||
|
call <sid>X('StatusLine', s:syntax_fg, s:syntax_cursor, 'none')
|
||||||
|
call <sid>X('StatusLineNC', s:mono_3, '', '')
|
||||||
|
call <sid>X('TabLine', s:mono_2, s:visual_grey, 'none')
|
||||||
|
call <sid>X('TabLineFill', s:mono_3, s:visual_grey, 'none')
|
||||||
|
call <sid>X('TabLineSel', s:syntax_bg, s:hue_2, '')
|
||||||
|
call <sid>X('Title', s:syntax_fg, '', 'bold')
|
||||||
|
call <sid>X('Visual', '', s:visual_grey, '')
|
||||||
|
call <sid>X('VisualNOS', '', s:visual_grey, '')
|
||||||
|
call <sid>X('WarningMsg', s:hue_5, '', '')
|
||||||
|
call <sid>X('TooLong', s:hue_5, '', '')
|
||||||
|
call <sid>X('WildMenu', s:syntax_fg, s:mono_3, '')
|
||||||
|
call <sid>X('SignColumn', '', s:syntax_bg, '')
|
||||||
|
call <sid>X('Special', s:hue_2, '', '')
|
||||||
|
" }}}
|
||||||
|
|
||||||
|
" Vim Help highlighting ---------------------------------------------------{{{
|
||||||
|
call <sid>X('helpCommand', s:hue_6_2, '', '')
|
||||||
|
call <sid>X('helpExample', s:hue_6_2, '', '')
|
||||||
|
call <sid>X('helpHeader', s:mono_1, '', 'bold')
|
||||||
|
call <sid>X('helpSectionDelim', s:mono_3, '', '')
|
||||||
|
" }}}
|
||||||
|
|
||||||
|
" Standard syntax highlighting --------------------------------------------{{{
|
||||||
|
call <sid>X('Comment', s:mono_3, '', s:italic)
|
||||||
|
call <sid>X('Constant', s:hue_4, '', '')
|
||||||
|
call <sid>X('String', s:hue_4, '', '')
|
||||||
|
call <sid>X('Character', s:hue_4, '', '')
|
||||||
|
call <sid>X('Number', s:hue_6, '', '')
|
||||||
|
call <sid>X('Boolean', s:hue_6, '', '')
|
||||||
|
call <sid>X('Float', s:hue_6, '', '')
|
||||||
|
call <sid>X('Identifier', s:hue_5, '', 'none')
|
||||||
|
call <sid>X('Function', s:hue_2, '', '')
|
||||||
|
call <sid>X('Statement', s:hue_3, '', 'none')
|
||||||
|
call <sid>X('Conditional', s:hue_3, '', '')
|
||||||
|
call <sid>X('Repeat', s:hue_3, '', '')
|
||||||
|
call <sid>X('Label', s:hue_3, '', '')
|
||||||
|
call <sid>X('Operator', s:syntax_accent, '', 'none')
|
||||||
|
call <sid>X('Keyword', s:hue_5, '', '')
|
||||||
|
call <sid>X('Exception', s:hue_3, '', '')
|
||||||
|
call <sid>X('PreProc', s:hue_6_2, '', '')
|
||||||
|
call <sid>X('Include', s:hue_2, '', '')
|
||||||
|
call <sid>X('Define', s:hue_3, '', 'none')
|
||||||
|
call <sid>X('Macro', s:hue_3, '', '')
|
||||||
|
call <sid>X('PreCondit', s:hue_6_2, '', '')
|
||||||
|
call <sid>X('Type', s:hue_6_2, '', 'none')
|
||||||
|
call <sid>X('StorageClass', s:hue_6_2, '', '')
|
||||||
|
call <sid>X('Structure', s:hue_6_2, '', '')
|
||||||
|
call <sid>X('Typedef', s:hue_6_2, '', '')
|
||||||
|
call <sid>X('Special', s:hue_2, '', '')
|
||||||
|
call <sid>X('SpecialChar', '', '', '')
|
||||||
|
call <sid>X('Tag', '', '', '')
|
||||||
|
call <sid>X('Delimiter', '', '', '')
|
||||||
|
call <sid>X('SpecialComment', '', '', '')
|
||||||
|
call <sid>X('Debug', '', '', '')
|
||||||
|
call <sid>X('Underlined', '', '', 'underline')
|
||||||
|
call <sid>X('Ignore', '', '', '')
|
||||||
|
call <sid>X('Error', s:hue_5, s:syntax_bg, 'bold')
|
||||||
|
call <sid>X('Todo', s:hue_3, s:syntax_bg, '')
|
||||||
|
" }}}
|
||||||
|
|
||||||
|
" Diff highlighting -------------------------------------------------------{{{
|
||||||
|
call <sid>X('DiffAdd', s:hue_4, s:visual_grey, '')
|
||||||
|
call <sid>X('DiffChange', s:hue_6, s:visual_grey, '')
|
||||||
|
call <sid>X('DiffDelete', s:hue_5, s:visual_grey, '')
|
||||||
|
call <sid>X('DiffText', s:hue_2, s:visual_grey, '')
|
||||||
|
call <sid>X('DiffAdded', s:hue_4, s:visual_grey, '')
|
||||||
|
call <sid>X('DiffFile', s:hue_5, s:visual_grey, '')
|
||||||
|
call <sid>X('DiffNewFile', s:hue_4, s:visual_grey, '')
|
||||||
|
call <sid>X('DiffLine', s:hue_2, s:visual_grey, '')
|
||||||
|
call <sid>X('DiffRemoved', s:hue_5, s:visual_grey, '')
|
||||||
|
" }}}
|
||||||
|
|
||||||
|
" Asciidoc highlighting ---------------------------------------------------{{{
|
||||||
|
call <sid>X('asciidocListingBlock', s:mono_2, '', '')
|
||||||
|
" }}}
|
||||||
|
|
||||||
|
" C/C++ highlighting ------------------------------------------------------{{{
|
||||||
|
call <sid>X('cInclude', s:hue_3, '', '')
|
||||||
|
call <sid>X('cPreCondit', s:hue_3, '', '')
|
||||||
|
call <sid>X('cPreConditMatch', s:hue_3, '', '')
|
||||||
|
|
||||||
|
call <sid>X('cType', s:hue_3, '', '')
|
||||||
|
call <sid>X('cStorageClass', s:hue_3, '', '')
|
||||||
|
call <sid>X('cStructure', s:hue_3, '', '')
|
||||||
|
call <sid>X('cOperator', s:hue_3, '', '')
|
||||||
|
call <sid>X('cStatement', s:hue_3, '', '')
|
||||||
|
call <sid>X('cTODO', s:hue_3, '', '')
|
||||||
|
call <sid>X('cConstant', s:hue_6, '', '')
|
||||||
|
call <sid>X('cSpecial', s:hue_1, '', '')
|
||||||
|
call <sid>X('cSpecialCharacter', s:hue_1, '', '')
|
||||||
|
call <sid>X('cString', s:hue_4, '', '')
|
||||||
|
|
||||||
|
call <sid>X('cppType', s:hue_3, '', '')
|
||||||
|
call <sid>X('cppStorageClass', s:hue_3, '', '')
|
||||||
|
call <sid>X('cppStructure', s:hue_3, '', '')
|
||||||
|
call <sid>X('cppModifier', s:hue_3, '', '')
|
||||||
|
call <sid>X('cppOperator', s:hue_3, '', '')
|
||||||
|
call <sid>X('cppAccess', s:hue_3, '', '')
|
||||||
|
call <sid>X('cppStatement', s:hue_3, '', '')
|
||||||
|
call <sid>X('cppConstant', s:hue_5, '', '')
|
||||||
|
call <sid>X('cCppString', s:hue_4, '', '')
|
||||||
|
" }}}
|
||||||
|
|
||||||
|
" Cucumber highlighting ---------------------------------------------------{{{
|
||||||
|
call <sid>X('cucumberGiven', s:hue_2, '', '')
|
||||||
|
call <sid>X('cucumberWhen', s:hue_2, '', '')
|
||||||
|
call <sid>X('cucumberWhenAnd', s:hue_2, '', '')
|
||||||
|
call <sid>X('cucumberThen', s:hue_2, '', '')
|
||||||
|
call <sid>X('cucumberThenAnd', s:hue_2, '', '')
|
||||||
|
call <sid>X('cucumberUnparsed', s:hue_6, '', '')
|
||||||
|
call <sid>X('cucumberFeature', s:hue_5, '', 'bold')
|
||||||
|
call <sid>X('cucumberBackground', s:hue_3, '', 'bold')
|
||||||
|
call <sid>X('cucumberScenario', s:hue_3, '', 'bold')
|
||||||
|
call <sid>X('cucumberScenarioOutline', s:hue_3, '', 'bold')
|
||||||
|
call <sid>X('cucumberTags', s:mono_3, '', 'bold')
|
||||||
|
call <sid>X('cucumberDelimiter', s:mono_3, '', 'bold')
|
||||||
|
" }}}
|
||||||
|
|
||||||
|
" CSS/Sass highlighting ---------------------------------------------------{{{
|
||||||
|
call <sid>X('cssAttrComma', s:hue_3, '', '')
|
||||||
|
call <sid>X('cssAttributeSelector', s:hue_4, '', '')
|
||||||
|
call <sid>X('cssBraces', s:mono_2, '', '')
|
||||||
|
call <sid>X('cssClassName', s:hue_6, '', '')
|
||||||
|
call <sid>X('cssClassNameDot', s:hue_6, '', '')
|
||||||
|
call <sid>X('cssDefinition', s:hue_3, '', '')
|
||||||
|
call <sid>X('cssFontAttr', s:hue_6, '', '')
|
||||||
|
call <sid>X('cssFontDescriptor', s:hue_3, '', '')
|
||||||
|
call <sid>X('cssFunctionName', s:hue_2, '', '')
|
||||||
|
call <sid>X('cssIdentifier', s:hue_2, '', '')
|
||||||
|
call <sid>X('cssImportant', s:hue_3, '', '')
|
||||||
|
call <sid>X('cssInclude', s:mono_1, '', '')
|
||||||
|
call <sid>X('cssIncludeKeyword', s:hue_3, '', '')
|
||||||
|
call <sid>X('cssMediaType', s:hue_6, '', '')
|
||||||
|
call <sid>X('cssProp', s:hue_1, '', '')
|
||||||
|
call <sid>X('cssPseudoClassId', s:hue_6, '', '')
|
||||||
|
call <sid>X('cssSelectorOp', s:hue_3, '', '')
|
||||||
|
call <sid>X('cssSelectorOp2', s:hue_3, '', '')
|
||||||
|
call <sid>X('cssStringQ', s:hue_4, '', '')
|
||||||
|
call <sid>X('cssStringQQ', s:hue_4, '', '')
|
||||||
|
call <sid>X('cssTagName', s:hue_5, '', '')
|
||||||
|
call <sid>X('cssAttr', s:hue_6, '', '')
|
||||||
|
|
||||||
|
call <sid>X('sassAmpersand', s:hue_5, '', '')
|
||||||
|
call <sid>X('sassClass', s:hue_6_2, '', '')
|
||||||
|
call <sid>X('sassControl', s:hue_3, '', '')
|
||||||
|
call <sid>X('sassExtend', s:hue_3, '', '')
|
||||||
|
call <sid>X('sassFor', s:mono_1, '', '')
|
||||||
|
call <sid>X('sassProperty', s:hue_1, '', '')
|
||||||
|
call <sid>X('sassFunction', s:hue_1, '', '')
|
||||||
|
call <sid>X('sassId', s:hue_2, '', '')
|
||||||
|
call <sid>X('sassInclude', s:hue_3, '', '')
|
||||||
|
call <sid>X('sassMedia', s:hue_3, '', '')
|
||||||
|
call <sid>X('sassMediaOperators', s:mono_1, '', '')
|
||||||
|
call <sid>X('sassMixin', s:hue_3, '', '')
|
||||||
|
call <sid>X('sassMixinName', s:hue_2, '', '')
|
||||||
|
call <sid>X('sassMixing', s:hue_3, '', '')
|
||||||
|
|
||||||
|
call <sid>X('scssSelectorName', s:hue_6_2, '', '')
|
||||||
|
" }}}
|
||||||
|
|
||||||
|
" Elixir highlighting------------------------------------------------------{{{
|
||||||
|
hi link elixirModuleDefine Define
|
||||||
|
call <sid>X('elixirAlias', s:hue_6_2, '', '')
|
||||||
|
call <sid>X('elixirAtom', s:hue_1, '', '')
|
||||||
|
call <sid>X('elixirBlockDefinition', s:hue_3, '', '')
|
||||||
|
call <sid>X('elixirModuleDeclaration', s:hue_6, '', '')
|
||||||
|
call <sid>X('elixirInclude', s:hue_5, '', '')
|
||||||
|
call <sid>X('elixirOperator', s:hue_6, '', '')
|
||||||
|
" }}}
|
||||||
|
|
||||||
|
" Git and git related plugins highlighting --------------------------------{{{
|
||||||
|
call <sid>X('gitcommitComment', s:mono_3, '', '')
|
||||||
|
call <sid>X('gitcommitUnmerged', s:hue_4, '', '')
|
||||||
|
call <sid>X('gitcommitOnBranch', '', '', '')
|
||||||
|
call <sid>X('gitcommitBranch', s:hue_3, '', '')
|
||||||
|
call <sid>X('gitcommitDiscardedType', s:hue_5, '', '')
|
||||||
|
call <sid>X('gitcommitSelectedType', s:hue_4, '', '')
|
||||||
|
call <sid>X('gitcommitHeader', '', '', '')
|
||||||
|
call <sid>X('gitcommitUntrackedFile', s:hue_1, '', '')
|
||||||
|
call <sid>X('gitcommitDiscardedFile', s:hue_5, '', '')
|
||||||
|
call <sid>X('gitcommitSelectedFile', s:hue_4, '', '')
|
||||||
|
call <sid>X('gitcommitUnmergedFile', s:hue_6_2, '', '')
|
||||||
|
call <sid>X('gitcommitFile', '', '', '')
|
||||||
|
hi link gitcommitNoBranch gitcommitBranch
|
||||||
|
hi link gitcommitUntracked gitcommitComment
|
||||||
|
hi link gitcommitDiscarded gitcommitComment
|
||||||
|
hi link gitcommitSelected gitcommitComment
|
||||||
|
hi link gitcommitDiscardedArrow gitcommitDiscardedFile
|
||||||
|
hi link gitcommitSelectedArrow gitcommitSelectedFile
|
||||||
|
hi link gitcommitUnmergedArrow gitcommitUnmergedFile
|
||||||
|
|
||||||
|
call <sid>X('SignifySignAdd', s:hue_4, '', '')
|
||||||
|
call <sid>X('SignifySignChange', s:hue_6_2, '', '')
|
||||||
|
call <sid>X('SignifySignDelete', s:hue_5, '', '')
|
||||||
|
hi link GitGutterAdd SignifySignAdd
|
||||||
|
hi link GitGutterChange SignifySignChange
|
||||||
|
hi link GitGutterDelete SignifySignDelete
|
||||||
|
call <sid>X('diffAdded', s:hue_4, '', '')
|
||||||
|
call <sid>X('diffRemoved', s:hue_5, '', '')
|
||||||
|
" }}}
|
||||||
|
|
||||||
|
" Go highlighting ---------------------------------------------------------{{{
|
||||||
|
call <sid>X('goDeclaration', s:hue_3, '', '')
|
||||||
|
call <sid>X('goField', s:hue_5, '', '')
|
||||||
|
call <sid>X('goMethod', s:hue_1, '', '')
|
||||||
|
call <sid>X('goType', s:hue_3, '', '')
|
||||||
|
call <sid>X('goUnsignedInts', s:hue_1, '', '')
|
||||||
|
" }}}
|
||||||
|
|
||||||
|
" Haskell highlighting ----------------------------------------------------{{{
|
||||||
|
call <sid>X('haskellDeclKeyword', s:hue_2, '', '')
|
||||||
|
call <sid>X('haskellType', s:hue_4, '', '')
|
||||||
|
call <sid>X('haskellWhere', s:hue_5, '', '')
|
||||||
|
call <sid>X('haskellImportKeywords', s:hue_2, '', '')
|
||||||
|
call <sid>X('haskellOperators', s:hue_5, '', '')
|
||||||
|
call <sid>X('haskellDelimiter', s:hue_2, '', '')
|
||||||
|
call <sid>X('haskellIdentifier', s:hue_6, '', '')
|
||||||
|
call <sid>X('haskellKeyword', s:hue_5, '', '')
|
||||||
|
call <sid>X('haskellNumber', s:hue_1, '', '')
|
||||||
|
call <sid>X('haskellString', s:hue_1, '', '')
|
||||||
|
"}}}
|
||||||
|
|
||||||
|
" HTML highlighting -------------------------------------------------------{{{
|
||||||
|
call <sid>X('htmlArg', s:hue_6, '', '')
|
||||||
|
call <sid>X('htmlTagName', s:hue_5, '', '')
|
||||||
|
call <sid>X('htmlTagN', s:hue_5, '', '')
|
||||||
|
call <sid>X('htmlSpecialTagName', s:hue_5, '', '')
|
||||||
|
call <sid>X('htmlTag', s:mono_2, '', '')
|
||||||
|
call <sid>X('htmlEndTag', s:mono_2, '', '')
|
||||||
|
|
||||||
|
call <sid>X('MatchTag', s:hue_5, s:syntax_cursor, 'underline,bold')
|
||||||
|
" }}}
|
||||||
|
|
||||||
|
" JavaScript highlighting -------------------------------------------------{{{
|
||||||
|
call <sid>X('coffeeString', s:hue_4, '', '')
|
||||||
|
|
||||||
|
call <sid>X('javaScriptBraces', s:mono_2, '', '')
|
||||||
|
call <sid>X('javaScriptFunction', s:hue_3, '', '')
|
||||||
|
call <sid>X('javaScriptIdentifier', s:hue_3, '', '')
|
||||||
|
call <sid>X('javaScriptNull', s:hue_6, '', '')
|
||||||
|
call <sid>X('javaScriptNumber', s:hue_6, '', '')
|
||||||
|
call <sid>X('javaScriptRequire', s:hue_1, '', '')
|
||||||
|
call <sid>X('javaScriptReserved', s:hue_3, '', '')
|
||||||
|
" https://github.com/pangloss/vim-javascript
|
||||||
|
call <sid>X('jsArrowFunction', s:hue_3, '', '')
|
||||||
|
call <sid>X('jsBraces', s:mono_2, '', '')
|
||||||
|
call <sid>X('jsClassBraces', s:mono_2, '', '')
|
||||||
|
call <sid>X('jsClassKeywords', s:hue_3, '', '')
|
||||||
|
call <sid>X('jsDocParam', s:hue_2, '', '')
|
||||||
|
call <sid>X('jsDocTags', s:hue_3, '', '')
|
||||||
|
call <sid>X('jsFuncBraces', s:mono_2, '', '')
|
||||||
|
call <sid>X('jsFuncCall', s:hue_2, '', '')
|
||||||
|
call <sid>X('jsFuncParens', s:mono_2, '', '')
|
||||||
|
call <sid>X('jsFunction', s:hue_3, '', '')
|
||||||
|
call <sid>X('jsGlobalObjects', s:hue_6_2, '', '')
|
||||||
|
call <sid>X('jsModuleWords', s:hue_3, '', '')
|
||||||
|
call <sid>X('jsModules', s:hue_3, '', '')
|
||||||
|
call <sid>X('jsNoise', s:mono_2, '', '')
|
||||||
|
call <sid>X('jsNull', s:hue_6, '', '')
|
||||||
|
call <sid>X('jsOperator', s:hue_3, '', '')
|
||||||
|
call <sid>X('jsParens', s:mono_2, '', '')
|
||||||
|
call <sid>X('jsStorageClass', s:hue_3, '', '')
|
||||||
|
call <sid>X('jsTemplateBraces', s:hue_5_2, '', '')
|
||||||
|
call <sid>X('jsTemplateVar', s:hue_4, '', '')
|
||||||
|
call <sid>X('jsThis', s:hue_5, '', '')
|
||||||
|
call <sid>X('jsUndefined', s:hue_6, '', '')
|
||||||
|
call <sid>X('jsObjectValue', s:hue_2, '', '')
|
||||||
|
call <sid>X('jsObjectKey', s:hue_1, '', '')
|
||||||
|
call <sid>X('jsReturn', s:hue_3, '', '')
|
||||||
|
" https://github.com/othree/yajs.vim
|
||||||
|
call <sid>X('javascriptArrowFunc', s:hue_3, '', '')
|
||||||
|
call <sid>X('javascriptClassExtends', s:hue_3, '', '')
|
||||||
|
call <sid>X('javascriptClassKeyword', s:hue_3, '', '')
|
||||||
|
call <sid>X('javascriptDocNotation', s:hue_3, '', '')
|
||||||
|
call <sid>X('javascriptDocParamName', s:hue_2, '', '')
|
||||||
|
call <sid>X('javascriptDocTags', s:hue_3, '', '')
|
||||||
|
call <sid>X('javascriptEndColons', s:mono_3, '', '')
|
||||||
|
call <sid>X('javascriptExport', s:hue_3, '', '')
|
||||||
|
call <sid>X('javascriptFuncArg', s:mono_1, '', '')
|
||||||
|
call <sid>X('javascriptFuncKeyword', s:hue_3, '', '')
|
||||||
|
call <sid>X('javascriptIdentifier', s:hue_5, '', '')
|
||||||
|
call <sid>X('javascriptImport', s:hue_3, '', '')
|
||||||
|
call <sid>X('javascriptObjectLabel', s:mono_1, '', '')
|
||||||
|
call <sid>X('javascriptOpSymbol', s:hue_1, '', '')
|
||||||
|
call <sid>X('javascriptOpSymbols', s:hue_1, '', '')
|
||||||
|
call <sid>X('javascriptPropertyName', s:hue_4, '', '')
|
||||||
|
call <sid>X('javascriptTemplateSB', s:hue_5_2, '', '')
|
||||||
|
call <sid>X('javascriptVariable', s:hue_3, '', '')
|
||||||
|
" }}}
|
||||||
|
|
||||||
|
" JSON highlighting -------------------------------------------------------{{{
|
||||||
|
call <sid>X('jsonCommentError', s:mono_1, '', '' )
|
||||||
|
call <sid>X('jsonKeyword', s:hue_5, '', '' )
|
||||||
|
call <sid>X('jsonQuote', s:mono_3, '', '' )
|
||||||
|
call <sid>X('jsonTrailingCommaError', s:hue_5, '', 'reverse' )
|
||||||
|
call <sid>X('jsonMissingCommaError', s:hue_5, '', 'reverse' )
|
||||||
|
call <sid>X('jsonNoQuotesError', s:hue_5, '', 'reverse' )
|
||||||
|
call <sid>X('jsonNumError', s:hue_5, '', 'reverse' )
|
||||||
|
call <sid>X('jsonString', s:hue_4, '', '' )
|
||||||
|
call <sid>X('jsonBoolean', s:hue_3, '', '' )
|
||||||
|
call <sid>X('jsonNumber', s:hue_6, '', '' )
|
||||||
|
call <sid>X('jsonStringSQError', s:hue_5, '', 'reverse' )
|
||||||
|
call <sid>X('jsonSemicolonError', s:hue_5, '', 'reverse' )
|
||||||
|
" }}}
|
||||||
|
|
||||||
|
" Markdown highlighting ---------------------------------------------------{{{
|
||||||
|
call <sid>X('markdownUrl', s:mono_3, '', '')
|
||||||
|
call <sid>X('markdownBold', s:hue_6, '', 'bold')
|
||||||
|
call <sid>X('markdownItalic', s:hue_6, '', 'bold')
|
||||||
|
call <sid>X('markdownCode', s:hue_4, '', '')
|
||||||
|
call <sid>X('markdownCodeBlock', s:hue_5, '', '')
|
||||||
|
call <sid>X('markdownCodeDelimiter', s:hue_4, '', '')
|
||||||
|
call <sid>X('markdownHeadingDelimiter', s:hue_5_2, '', '')
|
||||||
|
call <sid>X('markdownH1', s:hue_5, '', '')
|
||||||
|
call <sid>X('markdownH2', s:hue_5, '', '')
|
||||||
|
call <sid>X('markdownH3', s:hue_5, '', '')
|
||||||
|
call <sid>X('markdownH3', s:hue_5, '', '')
|
||||||
|
call <sid>X('markdownH4', s:hue_5, '', '')
|
||||||
|
call <sid>X('markdownH5', s:hue_5, '', '')
|
||||||
|
call <sid>X('markdownH6', s:hue_5, '', '')
|
||||||
|
call <sid>X('markdownListMarker', s:hue_5, '', '')
|
||||||
|
" }}}
|
||||||
|
|
||||||
|
" Perl highlighting -------------------------------------------------------{{{
|
||||||
|
call <sid>X('perlFunction', s:hue_3, '', '')
|
||||||
|
call <sid>X('perlMethod', s:syntax_fg, '', '')
|
||||||
|
call <sid>X('perlPackageConst', s:hue_3, '', '')
|
||||||
|
call <sid>X('perlPOD', s:mono_3, '', '')
|
||||||
|
call <sid>X('perlSubName', s:syntax_fg, '', '')
|
||||||
|
call <sid>X('perlSharpBang', s:mono_3, '', '')
|
||||||
|
call <sid>X('perlSpecialString', s:hue_4, '', '')
|
||||||
|
call <sid>X('perlVarPlain', s:hue_2, '', '')
|
||||||
|
call <sid>X('podCommand', s:mono_3, '', '')
|
||||||
|
|
||||||
|
" PHP highlighting --------------------------------------------------------{{{
|
||||||
|
call <sid>X('phpClass', s:hue_6_2, '', '')
|
||||||
|
call <sid>X('phpFunction', s:hue_2, '', '')
|
||||||
|
call <sid>X('phpFunctions', s:hue_2, '', '')
|
||||||
|
call <sid>X('phpInclude', s:hue_3, '', '')
|
||||||
|
call <sid>X('phpKeyword', s:hue_3, '', '')
|
||||||
|
call <sid>X('phpParent', s:mono_3, '', '')
|
||||||
|
call <sid>X('phpType', s:hue_3, '', '')
|
||||||
|
call <sid>X('phpSuperGlobals', s:hue_5, '', '')
|
||||||
|
" }}}
|
||||||
|
|
||||||
|
" Pug (Formerly Jade) highlighting ----------------------------------------{{{
|
||||||
|
call <sid>X('pugAttributesDelimiter', s:hue_6, '', '')
|
||||||
|
call <sid>X('pugClass', s:hue_6, '', '')
|
||||||
|
call <sid>X('pugDocType', s:mono_3, '', s:italic)
|
||||||
|
call <sid>X('pugTag', s:hue_5, '', '')
|
||||||
|
" }}}
|
||||||
|
|
||||||
|
" PureScript highlighting -------------------------------------------------{{{
|
||||||
|
call <sid>X('purescriptKeyword', s:hue_3, '', '')
|
||||||
|
call <sid>X('purescriptModuleName', s:syntax_fg, '', '')
|
||||||
|
call <sid>X('purescriptIdentifier', s:syntax_fg, '', '')
|
||||||
|
call <sid>X('purescriptType', s:hue_6_2, '', '')
|
||||||
|
call <sid>X('purescriptTypeVar', s:hue_5, '', '')
|
||||||
|
call <sid>X('purescriptConstructor', s:hue_5, '', '')
|
||||||
|
call <sid>X('purescriptOperator', s:syntax_fg, '', '')
|
||||||
|
" }}}
|
||||||
|
|
||||||
|
" Python highlighting -----------------------------------------------------{{{
|
||||||
|
call <sid>X('pythonImport', s:hue_3, '', '')
|
||||||
|
call <sid>X('pythonBuiltin', s:hue_1, '', '')
|
||||||
|
call <sid>X('pythonStatement', s:hue_3, '', '')
|
||||||
|
call <sid>X('pythonParam', s:hue_6, '', '')
|
||||||
|
call <sid>X('pythonEscape', s:hue_5, '', '')
|
||||||
|
call <sid>X('pythonSelf', s:mono_2, '', s:italic)
|
||||||
|
call <sid>X('pythonClass', s:hue_2, '', '')
|
||||||
|
call <sid>X('pythonOperator', s:hue_3, '', '')
|
||||||
|
call <sid>X('pythonEscape', s:hue_5, '', '')
|
||||||
|
call <sid>X('pythonFunction', s:hue_2, '', '')
|
||||||
|
call <sid>X('pythonKeyword', s:hue_2, '', '')
|
||||||
|
call <sid>X('pythonModule', s:hue_3, '', '')
|
||||||
|
call <sid>X('pythonStringDelimiter', s:hue_4, '', '')
|
||||||
|
call <sid>X('pythonSymbol', s:hue_1, '', '')
|
||||||
|
" }}}
|
||||||
|
|
||||||
|
" Ruby highlighting -------------------------------------------------------{{{
|
||||||
|
call <sid>X('rubyBlock', s:hue_3, '', '')
|
||||||
|
call <sid>X('rubyBlockParameter', s:hue_5, '', '')
|
||||||
|
call <sid>X('rubyBlockParameterList', s:hue_5, '', '')
|
||||||
|
call <sid>X('rubyCapitalizedMethod', s:hue_3, '', '')
|
||||||
|
call <sid>X('rubyClass', s:hue_3, '', '')
|
||||||
|
call <sid>X('rubyConstant', s:hue_6_2, '', '')
|
||||||
|
call <sid>X('rubyControl', s:hue_3, '', '')
|
||||||
|
call <sid>X('rubyDefine', s:hue_3, '', '')
|
||||||
|
call <sid>X('rubyEscape', s:hue_5, '', '')
|
||||||
|
call <sid>X('rubyFunction', s:hue_2, '', '')
|
||||||
|
call <sid>X('rubyGlobalVariable', s:hue_5, '', '')
|
||||||
|
call <sid>X('rubyInclude', s:hue_2, '', '')
|
||||||
|
call <sid>X('rubyIncluderubyGlobalVariable', s:hue_5, '', '')
|
||||||
|
call <sid>X('rubyInstanceVariable', s:hue_5, '', '')
|
||||||
|
call <sid>X('rubyInterpolation', s:hue_1, '', '')
|
||||||
|
call <sid>X('rubyInterpolationDelimiter', s:hue_5, '', '')
|
||||||
|
call <sid>X('rubyKeyword', s:hue_2, '', '')
|
||||||
|
call <sid>X('rubyModule', s:hue_3, '', '')
|
||||||
|
call <sid>X('rubyPseudoVariable', s:hue_5, '', '')
|
||||||
|
call <sid>X('rubyRegexp', s:hue_1, '', '')
|
||||||
|
call <sid>X('rubyRegexpDelimiter', s:hue_1, '', '')
|
||||||
|
call <sid>X('rubyStringDelimiter', s:hue_4, '', '')
|
||||||
|
call <sid>X('rubySymbol', s:hue_1, '', '')
|
||||||
|
" }}}
|
||||||
|
|
||||||
|
" Spelling highlighting ---------------------------------------------------{{{
|
||||||
|
call <sid>X('SpellBad', '', s:syntax_bg, 'undercurl')
|
||||||
|
call <sid>X('SpellLocal', '', s:syntax_bg, 'undercurl')
|
||||||
|
call <sid>X('SpellCap', '', s:syntax_bg, 'undercurl')
|
||||||
|
call <sid>X('SpellRare', '', s:syntax_bg, 'undercurl')
|
||||||
|
" }}}
|
||||||
|
|
||||||
|
" Vim highlighting --------------------------------------------------------{{{
|
||||||
|
call <sid>X('vimCommand', s:hue_3, '', '')
|
||||||
|
call <sid>X('vimCommentTitle', s:mono_3, '', 'bold')
|
||||||
|
call <sid>X('vimFunction', s:hue_1, '', '')
|
||||||
|
call <sid>X('vimFuncName', s:hue_3, '', '')
|
||||||
|
call <sid>X('vimHighlight', s:hue_2, '', '')
|
||||||
|
call <sid>X('vimLineComment', s:mono_3, '', s:italic)
|
||||||
|
call <sid>X('vimParenSep', s:mono_2, '', '')
|
||||||
|
call <sid>X('vimSep', s:mono_2, '', '')
|
||||||
|
call <sid>X('vimUserFunc', s:hue_1, '', '')
|
||||||
|
call <sid>X('vimVar', s:hue_5, '', '')
|
||||||
|
" }}}
|
||||||
|
|
||||||
|
" XML highlighting --------------------------------------------------------{{{
|
||||||
|
call <sid>X('xmlAttrib', s:hue_6_2, '', '')
|
||||||
|
call <sid>X('xmlEndTag', s:hue_5, '', '')
|
||||||
|
call <sid>X('xmlTag', s:hue_5, '', '')
|
||||||
|
call <sid>X('xmlTagName', s:hue_5, '', '')
|
||||||
|
" }}}
|
||||||
|
|
||||||
|
" ZSH highlighting --------------------------------------------------------{{{
|
||||||
|
call <sid>X('zshCommands', s:syntax_fg, '', '')
|
||||||
|
call <sid>X('zshDeref', s:hue_5, '', '')
|
||||||
|
call <sid>X('zshShortDeref', s:hue_5, '', '')
|
||||||
|
call <sid>X('zshFunction', s:hue_1, '', '')
|
||||||
|
call <sid>X('zshKeyword', s:hue_3, '', '')
|
||||||
|
call <sid>X('zshSubst', s:hue_5, '', '')
|
||||||
|
call <sid>X('zshSubstDelim', s:mono_3, '', '')
|
||||||
|
call <sid>X('zshTypes', s:hue_3, '', '')
|
||||||
|
call <sid>X('zshVariableDef', s:hue_6, '', '')
|
||||||
|
" }}}
|
||||||
|
|
||||||
|
" Rust highlighting -------------------------------------------------------{{{
|
||||||
|
call <sid>X('rustExternCrate', s:hue_5, '', 'bold')
|
||||||
|
call <sid>X('rustIdentifier', s:hue_2, '', '')
|
||||||
|
call <sid>X('rustDeriveTrait', s:hue_4, '', '')
|
||||||
|
call <sid>X('SpecialComment', s:mono_3, '', '')
|
||||||
|
call <sid>X('rustCommentLine', s:mono_3, '', '')
|
||||||
|
call <sid>X('rustCommentLineDoc', s:mono_3, '', '')
|
||||||
|
call <sid>X('rustCommentLineDocError', s:mono_3, '', '')
|
||||||
|
call <sid>X('rustCommentBlock', s:mono_3, '', '')
|
||||||
|
call <sid>X('rustCommentBlockDoc', s:mono_3, '', '')
|
||||||
|
call <sid>X('rustCommentBlockDocError', s:mono_3, '', '')
|
||||||
|
" }}}
|
||||||
|
|
||||||
|
" man highlighting --------------------------------------------------------{{{
|
||||||
|
hi link manTitle String
|
||||||
|
call <sid>X('manFooter', s:mono_3, '', '')
|
||||||
|
" }}}
|
||||||
|
|
||||||
|
" ALE (Asynchronous Lint Engine) highlighting -----------------------------{{{
|
||||||
|
call <sid>X('ALEWarningSign', s:hue_6_2, '', '')
|
||||||
|
call <sid>X('ALEErrorSign', s:hue_5, '', '')
|
||||||
|
|
||||||
|
|
||||||
|
" Neovim NERDTree Background fix ------------------------------------------{{{
|
||||||
|
call <sid>X('NERDTreeFile', s:syntax_fg, '', '')
|
||||||
|
" }}}
|
||||||
|
|
||||||
|
" Delete functions =========================================================={{{
|
||||||
|
" delf <SID>X
|
||||||
|
" delf <SID>XAPI
|
||||||
|
" delf <SID>rgb
|
||||||
|
" delf <SID>color
|
||||||
|
" delf <SID>rgb_color
|
||||||
|
" delf <SID>rgb_level
|
||||||
|
" delf <SID>rgb_number
|
||||||
|
" delf <SID>grey_color
|
||||||
|
" delf <SID>grey_level
|
||||||
|
" delf <SID>grey_number
|
||||||
|
" }}}
|
||||||
|
|
||||||
|
endif
|
||||||
|
"}}}
|
||||||
|
|
||||||
|
" Public API --------------------------------------------------------------{{{
|
||||||
|
function! one#highlight(group, fg, bg, attr)
|
||||||
|
call <sid>XAPI(a:group, a:fg, a:bg, a:attr)
|
||||||
|
endfunction
|
||||||
|
"}}}
|
||||||
|
|
||||||
|
if exists('s:dark') && s:dark
|
||||||
|
set background=dark
|
||||||
|
endif
|
||||||
|
|
||||||
|
" vim: set fdl=0 fdm=marker:
|
10
bundle/vim-one/estilo.yml
vendored
Normal file
10
bundle/vim-one/estilo.yml
vendored
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
name: 'vim-one'
|
||||||
|
version: '1.0.0'
|
||||||
|
license: 'MIT'
|
||||||
|
author: 'Ramzi Akremi'
|
||||||
|
url: ''
|
||||||
|
description: 'Port to Vim of Atom One Dark and Light themes'
|
||||||
|
colorschemes:
|
||||||
|
- name: one-dark
|
||||||
|
background: 'dark'
|
||||||
|
palette: vim-one-dark
|
18
bundle/vim-one/estilo/addons/nvim-term.yml
vendored
Normal file
18
bundle/vim-one/estilo/addons/nvim-term.yml
vendored
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
color_foreground: ''
|
||||||
|
color_background: ''
|
||||||
|
color_0: ''
|
||||||
|
color_1: ''
|
||||||
|
color_2: ''
|
||||||
|
color_3: ''
|
||||||
|
color_4: ''
|
||||||
|
color_5: ''
|
||||||
|
color_6: ''
|
||||||
|
color_7: ''
|
||||||
|
color_8: ''
|
||||||
|
color_9: ''
|
||||||
|
color_10: ''
|
||||||
|
color_11: ''
|
||||||
|
color_12: ''
|
||||||
|
color_13: ''
|
||||||
|
color_14: ''
|
||||||
|
color_15: ''
|
25
bundle/vim-one/estilo/palettes/vim-one-dark.yml
vendored
Normal file
25
bundle/vim-one/estilo/palettes/vim-one-dark.yml
vendored
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
mono_1: '#abb2bf'
|
||||||
|
mono_2: '#828997'
|
||||||
|
mono_3: '#5c6370'
|
||||||
|
mono_4: '#4b5263'
|
||||||
|
|
||||||
|
hue_1: '#56b6c2' # cyan
|
||||||
|
hue_2: '#61afef' # blue
|
||||||
|
hue_3: '#c678dd' # purple
|
||||||
|
hue_4: '#98c379' # green
|
||||||
|
|
||||||
|
hue_5: '#e06c75' # red 1
|
||||||
|
hue_5_2: '#be5046' # red 2
|
||||||
|
|
||||||
|
hue_6: '#d19a66' # orange 1
|
||||||
|
hue_6_2: '#e5c07b' # orange 2
|
||||||
|
|
||||||
|
syntax_bg: '#282c34'
|
||||||
|
syntax_gutter: '#636d83'
|
||||||
|
syntax_cursor: '#2c323c'
|
||||||
|
|
||||||
|
syntax_accent: '#528bff'
|
||||||
|
|
||||||
|
vertsplit: '#181a1f'
|
||||||
|
special_grey: '#3b4048'
|
||||||
|
visual_grey: '#3e4452'
|
82
bundle/vim-one/estilo/syntax/base.yml
vendored
Normal file
82
bundle/vim-one/estilo/syntax/base.yml
vendored
Normal file
@ -0,0 +1,82 @@
|
|||||||
|
# BASE UI
|
||||||
|
Bold: '. . b'
|
||||||
|
ColorColumn: '. syntax_cursor'
|
||||||
|
Conceal: '. .'
|
||||||
|
Cursor: '. syntax_accent'
|
||||||
|
CursorIM: ''
|
||||||
|
CursorColumn: '. syntax_cursor'
|
||||||
|
CursorLine: '. syntax_cursor'
|
||||||
|
Directory: 'hue_2 .'
|
||||||
|
DiffAdd: '' # TODO
|
||||||
|
DiffChange: '' # TODO
|
||||||
|
DiffDelete: '' # TODO
|
||||||
|
DiffText: '' # TODO
|
||||||
|
ErrorMsg: ''
|
||||||
|
VertSplit: ''
|
||||||
|
Folded: ''
|
||||||
|
FoldColumn: ''
|
||||||
|
SignColumn: ''
|
||||||
|
IncSearch: ''
|
||||||
|
LineNr: ''
|
||||||
|
MatchParen: ''
|
||||||
|
ModeMsg: ''
|
||||||
|
MoreMsg: ''
|
||||||
|
NonText: ''
|
||||||
|
Normal: 'mono_1 syntax_bg'
|
||||||
|
PMenu: ''
|
||||||
|
PMenuSel: ''
|
||||||
|
PmenuSbar: ''
|
||||||
|
PmenuThumb: ''
|
||||||
|
Question: ''
|
||||||
|
Search: ''
|
||||||
|
SpecialKey: ''
|
||||||
|
SpellBad: ''
|
||||||
|
SpellLocal: ''
|
||||||
|
SpellCap: ''
|
||||||
|
SpellRare: ''
|
||||||
|
StatusLine: ''
|
||||||
|
StatusLineNC: ''
|
||||||
|
TabLine: ''
|
||||||
|
TabLineFill: ''
|
||||||
|
TabLineSel: ''
|
||||||
|
Title: ''
|
||||||
|
Visual: ''
|
||||||
|
VisualNOS: ''
|
||||||
|
WarningMsg: ''
|
||||||
|
WildMenu: ''
|
||||||
|
# BASE SYNTAX
|
||||||
|
Comment: ''
|
||||||
|
Constant: ''
|
||||||
|
String: '' # Constant
|
||||||
|
Character: '' # Constant
|
||||||
|
Boolean: '' # Constant
|
||||||
|
Number: '' # Constant
|
||||||
|
Float: '' # Constant
|
||||||
|
Identifier: ''
|
||||||
|
Function: '' # Identifier
|
||||||
|
Statement: ''
|
||||||
|
Conditional: '' # Statement
|
||||||
|
Repeat: '' # Statement
|
||||||
|
Label: '' # Statement
|
||||||
|
Operator: '' # Statement
|
||||||
|
Keyword: '' # Statement
|
||||||
|
Exception: '' # Statement
|
||||||
|
PreProc: ''
|
||||||
|
Include: '' # PreProc
|
||||||
|
Define: '' # PreProc
|
||||||
|
Macro: '' # PreProc
|
||||||
|
PreCondit: '' # PreProc
|
||||||
|
Type: ''
|
||||||
|
StorageClass: '' # Type
|
||||||
|
Structure: '' # Type
|
||||||
|
Typedef: '' # Type
|
||||||
|
Special: ''
|
||||||
|
SpecialChar: '' # Special
|
||||||
|
Tag: '' # Special
|
||||||
|
Delimiter: '' # Special
|
||||||
|
SpecialComment: '' # Special
|
||||||
|
Debug: '' # Special
|
||||||
|
Underlined: ''
|
||||||
|
Ignore: ''
|
||||||
|
Error: ''
|
||||||
|
Todo: ''
|
BIN
bundle/vim-one/screenshots/Untitled.sketch
vendored
Normal file
BIN
bundle/vim-one/screenshots/Untitled.sketch
vendored
Normal file
Binary file not shown.
BIN
bundle/vim-one/screenshots/new-logo.png
vendored
Normal file
BIN
bundle/vim-one/screenshots/new-logo.png
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 552 KiB |
Loading…
Reference in New Issue
Block a user