Skip to content

Commit

Permalink
Update diagnostics toggle, trouble
Browse files Browse the repository at this point in the history
  • Loading branch information
Jendker committed Aug 11, 2024
1 parent 0e25b69 commit c544023
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 46 deletions.
30 changes: 15 additions & 15 deletions nvim/lazy-lock.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"CopilotChat.nvim": { "branch": "canary", "commit": "4a5e07185b37d3132e5541d8fa42aa874b774476" },
"CopilotChat.nvim": { "branch": "canary", "commit": "cfdf371cec954fccf5410315884e110d214d38fa" },
"LuaSnip": { "branch": "master", "commit": "7552e6504ee95a9c8cfc6db53e389122ded46cd4" },
"aerial.nvim": { "branch": "master", "commit": "e75a3df2c20b3a98c786f5e61587d74a7a6b61d6" },
"auto-save.nvim": { "branch": "main", "commit": "dde48108ec49945e55a444a066187bd5598b6049" },
Expand All @@ -20,67 +20,67 @@
"friendly-snippets": { "branch": "main", "commit": "00ebcaa159e817150bd83bfe2d51fa3b3377d5c4" },
"fugitive-gitlab.vim": { "branch": "master", "commit": "838d3a110836f511be099002ce1a71493c042615" },
"gitignore.nvim": { "branch": "master", "commit": "2455191ec94da8ed222806a4fe3aa358eac1e558" },
"gitsigns.nvim": { "branch": "main", "commit": "f074844b60f9e151970fbcdbeb8a2cd52b6ef25a" },
"gitsigns.nvim": { "branch": "main", "commit": "58bd9e98d8e3c5a1c98af312e85247ee1afd3ed2" },
"glance.nvim": { "branch": "master", "commit": "51059bcf21016387b6233c89eed220cf47fca752" },
"gv.vim": { "branch": "master", "commit": "b6bb6664e2c95aa584059f195eb3a9f3cb133994" },
"hererocks": { "branch": "master", "commit": "8bd2fcfdd65cfa7535ce39ea372a63b0bdb8e528" },
"highlight-undo.nvim": { "branch": "main", "commit": "1ea1c79372d7d93c88fd97543880927b7635e3d2" },
"incline.nvim": { "branch": "main", "commit": "16fc9c073e3ea4175b66ad94375df6d73fc114c0" },
"indent-blankline.nvim": { "branch": "master", "commit": "65e20ab94a26d0e14acac5049b8641336819dfc7" },
"indent-blankline.nvim": { "branch": "master", "commit": "3fe94b8034dd5241cb882bb73847303b58857ecf" },
"kanagawa.nvim": { "branch": "master", "commit": "e5f7b8a804360f0a48e40d0083a97193ee4fcc87" },
"last-color.nvim": { "branch": "main", "commit": "4086c5810bbe35b4184502f190e8d1ba910180cd" },
"lazy.nvim": { "branch": "main", "commit": "077102c5bfc578693f12377846d427f49bc50076" },
"lsp-zero.nvim": { "branch": "v3.x", "commit": "56db3d5ce5476b183783160e6045f7337ba12b83" },
"lsp_signature.nvim": { "branch": "master", "commit": "a38da0a61c172bb59e34befc12efe48359884793" },
"lualine.nvim": { "branch": "master", "commit": "544dd1583f9bb27b393f598475c89809c4d5e86b" },
"markdown-preview.nvim": { "branch": "master", "commit": "a923f5fc5ba36a3b17e289dc35dc17f66d0548ee" },
"markdown.nvim": { "branch": "main", "commit": "a1bcbf4858d1834f922029b5fc6ae55a7417bd51" },
"mason-lspconfig.nvim": { "branch": "main", "commit": "ba9c2f0b93deb48d0a99ae0e8d8dd36f7cc286d6" },
"markdown.nvim": { "branch": "main", "commit": "96988cc76414a2f69a57c5dbaca7bf9336c9cb52" },
"mason-lspconfig.nvim": { "branch": "main", "commit": "62360f061d45177dda8afc1b0fd1327328540301" },
"mason-null-ls.nvim": { "branch": "main", "commit": "de19726de7260c68d94691afb057fa73d3cc53e7" },
"mason-nvim-dap.nvim": { "branch": "main", "commit": "4ba55f9755ebe8297d92c419b90a946123292ae6" },
"mason-nvim-dap.nvim": { "branch": "main", "commit": "8b9363d83b5d779813cdd2819b8308651cec2a09" },
"mason.nvim": { "branch": "main", "commit": "e2f7f9044ec30067bc11800a9e266664b88cda22" },
"neoscroll.nvim": { "branch": "master", "commit": "a7f5953dbfbe7069568f2d0ed23a9709a56725ab" },
"neoscroll.nvim": { "branch": "master", "commit": "532dcc8cea4287c4cad6bb77532989a8217cfc7b" },
"nvim-autopairs": { "branch": "master", "commit": "e38c5d837e755ce186ae51d2c48e1b387c4425c6" },
"nvim-bqf": { "branch": "main", "commit": "1b24dc6050c34e8cd377b6b4cd6abe40509e0187" },
"nvim-cmp": { "branch": "main", "commit": "ae644feb7b67bf1ce4260c231d1d4300b19c6f30" },
"nvim-colorizer.lua": { "branch": "master", "commit": "194ec600488f7c7229668d0e80bd197f3a2b84ff" },
"nvim-dap": { "branch": "master", "commit": "dcc85d12d6e2c18c5fa0f9a304d9f5e767e1401a" },
"nvim-dap-go": { "branch": "main", "commit": "5030d53097fed7b75524a04048d8dbf417fa0140" },
"nvim-dap-go": { "branch": "main", "commit": "5511788255c92bdd845f8d9690f88e2e0f0ff9f2" },
"nvim-dap-python": { "branch": "master", "commit": "d777c2b32ed39f61209c09bede28d7491621a631" },
"nvim-dap-ui": { "branch": "master", "commit": "a5606bc5958db86f8d92803bea7400ee26a8d7e4" },
"nvim-dap-virtual-text": { "branch": "master", "commit": "484995d573c0f0563f6a66ebdd6c67b649489615" },
"nvim-early-retirement": { "branch": "main", "commit": "3a10e211dd7d8e14bf4357292ad73e2e0162f7ff" },
"nvim-fundo": { "branch": "main", "commit": "ac9c9372c4bf677721e24f144ef29d3a05c2b589" },
"nvim-lint": { "branch": "master", "commit": "efc6fc83f0772283e064c53a8f9fb5645bde0bc0" },
"nvim-lspconfig": { "branch": "master", "commit": "e9b1c95d29ca9e479fc39896b31d24eed96b40a3" },
"nvim-lspconfig": { "branch": "master", "commit": "6c505d4220b521f3b0e7b645f6ce45fa914d0eed" },
"nvim-nio": { "branch": "master", "commit": "a428f309119086dc78dd4b19306d2d67be884eee" },
"nvim-scrollview": { "branch": "main", "commit": "401c0498689dcaa54b2e7483d823e33cdc051e72" },
"nvim-spectre": { "branch": "master", "commit": "ba7fb777edff6c1fbbeffd343e113af64c04e90a" },
"nvim-surround": { "branch": "main", "commit": "ec2dc7671067e0086cdf29c2f5df2dd909d5f71f" },
"nvim-treesitter": { "branch": "master", "commit": "d13f0183ba93f9b5aba7359146f294abfffff9c3" },
"nvim-treesitter-textobjects": { "branch": "master", "commit": "dd00780a661a0c7a38765c220150291a3e88daea" },
"nvim-web-devicons": { "branch": "master", "commit": "5be6c4e685618b99c3210a69375b38a1202369b4" },
"nvim-treesitter": { "branch": "master", "commit": "c79b068f395817c39ed147d4ee76855c36b846e6" },
"nvim-treesitter-textobjects": { "branch": "master", "commit": "33a17515b79ddb10d750320fa994098bdc3e93ef" },
"nvim-web-devicons": { "branch": "master", "commit": "3722e3d1fb5fe1896a104eb489e8f8651260b520" },
"oil.nvim": { "branch": "master", "commit": "fcca212c2e966fc3dec1d4baf888e670631d25d1" },
"onedark.nvim": { "branch": "master", "commit": "fae34f7c635797f4bf62fb00e7d0516efa8abe37" },
"outline.nvim": { "branch": "main", "commit": "2175b6da5b7b5be9de14fd3f54383a17f5e4609c" },
"overseer.nvim": { "branch": "master", "commit": "cbcdcbae3704c21d3ff96a1927d952b8a966b08a" },
"persistence.nvim": { "branch": "main", "commit": "f6aad7dde7fcf54148ccfc5f622c6d5badd0cc3d" },
"persistent-breakpoints.nvim": { "branch": "main", "commit": "4b199b1dcfd136cac8b0fa9c8dbbdeb81463f7a9" },
"plenary.nvim": { "branch": "master", "commit": "a3e3bc82a3f95c5ed0d7201546d5d2c19b20d683" },
"promise-async": { "branch": "main", "commit": "28c1d5a295eb5310afa2523d4ae9aa41ec5a9de2" },
"promise-async": { "branch": "main", "commit": "119e8961014c9bfaf1487bf3c2a393d254f337e2" },
"spaceless.nvim": { "branch": "main", "commit": "8d46bc098dba18d4e19bce89bf19aab5007ef767" },
"stickybuf.nvim": { "branch": "master", "commit": "709da3b895a99bbfedd5b59a1a91930026288c15" },
"substitute.nvim": { "branch": "main", "commit": "17ffaeb5a1dc2dbef39cf0865d8a4b6000836714" },
"suda.vim": { "branch": "master", "commit": "b97fab52f9cdeabe2bbb5eb98d82356899f30829" },
"targets.vim": { "branch": "master", "commit": "6325416da8f89992b005db3e4517aaef0242602e" },
"telescope-frecency.nvim": { "branch": "master", "commit": "87ccbae5d253b8857c68badc80a22646569468ad" },
"telescope-frecency.nvim": { "branch": "master", "commit": "25d01edae8a2d74bcaa706c003b2712bce1e3301" },
"telescope-live-grep-args.nvim": { "branch": "master", "commit": "649b662a8f476fd2c0289570764459e95ebaa3f3" },
"telescope-menufacture": { "branch": "main", "commit": "8c547e82a703fe90c7f69af04d0b4e47a59cc971" },
"telescope-vim-bookmarks.nvim": { "branch": "main", "commit": "09a61043496bd9c4240955f7532ff2ae8fe3a905" },
"telescope-zf-native.nvim": { "branch": "master", "commit": "9c23e2fce1c0c7445f68f7765e5f3e512920184b" },
"telescope.nvim": { "branch": "0.1.x", "commit": "a0bbec21143c7bc5f8bb02e0005fa0b982edc026" },
"todo-comments.nvim": { "branch": "main", "commit": "8f45f353dc3649cb9b44cecda96827ea88128584" },
"treesj": { "branch": "main", "commit": "275f83c81a5a1f5ae23c1eac30c4ac28beebbca2" },
"treesj": { "branch": "main", "commit": "0d81326b5afd36babe7dd480aabbb0b05f33e688" },
"trouble.nvim": { "branch": "main", "commit": "6efc446226679fda0547c0fd6a7892fd5f5b15d8" },
"undotree": { "branch": "master", "commit": "56c684a805fe948936cda0d1b19505b84ad7e065" },
"vim-bookmarks": { "branch": "master", "commit": "9cc5fa7ecc23b052bd524d07c85356c64b92aeef" },
Expand Down
18 changes: 7 additions & 11 deletions nvim/lua/config_plugins/lsp-zero.lua
Original file line number Diff line number Diff line change
Expand Up @@ -359,16 +359,12 @@ vim.diagnostic.config({
},
})

vim.api.nvim_create_user_command("DiagnosticToggle", function()
local config = vim.diagnostic.config
local signs = config().signs
config {
virtual_text = not signs,
underline = not signs,
signs = not signs,
}
end, { desc = "[t]oggle [d]iagnostics" })
vim.keymap.set("n", "<leader>td", "<cmd>DiagnosticToggle<CR>")
vim.keymap.set(
"n",
"<leader>td",
function() vim.diagnostic.enable(not vim.diagnostic.is_enabled()) end,
{ desc = "[t]oggle [d]iagnostics" }
)

vim.api.nvim_create_user_command("VirtualTextToggle", function()
local config = vim.diagnostic.config
Expand All @@ -377,7 +373,7 @@ vim.api.nvim_create_user_command("VirtualTextToggle", function()
virtual_text = not vt,
}
end, { desc = "[t]oggle [v]irtual text" })
vim.keymap.set("n", "<leader>tv", "<cmd>VirtualTextToggle<CR>")
vim.keymap.set("n", "<leader>tv", "<cmd>VirtualTextToggle<CR>", { desc = "[t]oggle [v]irtual text" })

local cmp = require('cmp')
local cmp_action = require('lsp-zero').cmp_action()
Expand Down
2 changes: 1 addition & 1 deletion nvim/lua/config_plugins/treesitter.lua
Original file line number Diff line number Diff line change
Expand Up @@ -92,4 +92,4 @@ require('nvim-treesitter.configs').setup({
local ts_repeat_move = require "nvim-treesitter.textobjects.repeatable_move"
vim.keymap.set({ "n", "x", "o" }, ";", ts_repeat_move.repeat_last_move, {silent = true})
vim.keymap.set({ "n", "x", "o" }, ",", ts_repeat_move.repeat_last_move_opposite, {silent = true})
vim.keymap.set("n", "<leader>th", "<cmd>TSToggle highlight<cr>", {desc="[T]oggle treesitter [h]ighlight"})
vim.keymap.set("n", "<leader>th", "<cmd>TSToggle highlight<cr>", {desc="[t]oggle treesitter [h]ighlight"})
14 changes: 7 additions & 7 deletions nvim/lua/keymaps.lua
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ map({"n", "v"}, "<leader>d", [["_d]])
map({"n", "v"}, "<leader>D", [["_D]])
map({"n", "v"}, "<leader>c", [["_c]])
map({"n", "v"}, "<leader>C", [["_C]])
map("n", "<leader>tq", "<cmd>tabclose<cr>", { desc = "[T]ab [q] close" })
map("n", "<leader>tc", "<cmd>tabnew<CR>", { desc = "[T]ab [n]ew"})
map("n", "<leader>tn", "<cmd>tabnew<CR>", { desc = "[T]ab [c]reate"})
map("n", "<leader>tq", "<cmd>tabclose<cr>", { desc = "[t]ab [q] close" })
map("n", "<leader>tc", "<cmd>tabnew<CR>", { desc = "[t]ab [n]ew"})
map("n", "<leader>tn", "<cmd>tabnew<CR>", { desc = "[t]ab [c]reate"})
map("n", "<leader>tf", function()
if vim.b.orbik_disable_autoformat then
common.enableAutoformat()
Expand All @@ -47,7 +47,7 @@ map("n", "<leader>tf", function()
vim.b.orbik_disable_autoformat = true
vim.notify("Autoformat disabled for the buffer", vim.log.levels.INFO)
end
end, { desc = "[T]oggle auto[f]ormat" })
end, { desc = "[t]oggle auto[f]ormat" })
map("n", "<leader>tm", function()
if vim.o.mouse == "nvi" then
vim.opt.mouse = ""
Expand All @@ -56,7 +56,7 @@ map("n", "<leader>tm", function()
vim.opt.mouse = "nvi"
vim.notify("Vim mouse enabled", vim.log.levels.INFO)
end
end, { desc = "[T]oggle [m]ouse" })
end, { desc = "[t]oggle [m]ouse" })

-- don't enter command history
map("n", "Q", "<nop>")
Expand All @@ -78,8 +78,8 @@ map("v", "<", "<gv")
map("v", ">", ">gv")

-- toggle settings
map("n", "<leader>tw", function() toggle("wrap") end, { desc = "[T]oggle word [w]rap" })
map("n", "<leader>to", function() vim.cmd("ASToggle"); require('gitsigns').toggle_current_line_blame() end, { desc = "[T]oggle development [o]ptions" })
map("n", "<leader>tw", function() toggle("wrap") end, { desc = "[t]oggle word [w]rap" })
map("n", "<leader>to", function() vim.cmd("ASToggle"); require('gitsigns').toggle_current_line_blame() end, { desc = "[t]oggle development [o]ptions" })
if vim.fn.has("nvim-0.9.0") == 1 then
map("n", "<leader>ti", vim.show_pos, { desc = "Inspect Pos" }) -- highlights under cursor
end
Expand Down
32 changes: 20 additions & 12 deletions nvim/lua/plugins.lua
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,7 @@ local plugins = {
vim.o.background = "light"
end
setup_theme(theme)
end, {desc = "Toggle dark and light mode"})
end, {desc = "[t]oggle dark/light [t]heme"})
end,
cond = not_vscode
},
Expand Down Expand Up @@ -896,7 +896,7 @@ local plugins = {
else
vim.notify("auto-save off")
end
end, desc = "[T]oggle [a]utosave"},
end, desc = "[t]oggle [a]utosave"},
},
init = function ()
vim.g.autosave_on = common.is_dev_dir
Expand Down Expand Up @@ -1068,26 +1068,34 @@ local plugins = {
{
-- config from https://www.lazyvim.org/plugins/editor#troublenvim
"folke/trouble.nvim",
cmd = { "TroubleToggle", "Trouble" },
opts = { use_diagnostic_signs = true, action_keys = {toggle_fold = {"zA", "za", "h", "l"} } },
cmd = { "Trouble" },
opts = {
modes = {
lsp = {
win = { position = "right" },
},
},
},
keys = {
{ "<leader>xx", "<cmd>TroubleToggle document_diagnostics<cr>", desc = "Document Diagnostics (Trouble)" },
{ "<leader>xX", "<cmd>TroubleToggle workspace_diagnostics<cr>", desc = "Workspace Diagnostics (Trouble)" },
{ "<leader>xl", "<cmd>TroubleToggle loclist<cr>", desc = "Location List (Trouble)" },
{ "<leader>xq", "<cmd>TroubleToggle quickfix<cr>", desc = "Quickfix List (Trouble)" },
{ "<leader>xx", "<cmd>Trouble diagnostics toggle<cr>", desc = "Diagnostics (Trouble)" },
{ "<leader>xX", "<cmd>Trouble diagnostics toggle filter.buf=0<cr>", desc = "Buffer Diagnostics (Trouble)" },
{ "<leader>xs", "<cmd>Trouble symbols toggle<cr>", desc = "Symbols (Trouble)" },
{ "<leader>xS", "<cmd>Trouble lsp toggle<cr>", desc = "LSP references/definitions/... (Trouble)" },
{ "<leader>xl", "<cmd>Trouble loclist toggle<cr>", desc = "Location List (Trouble)" },
{ "<leader>xq", "<cmd>Trouble qflist toggle<cr>", desc = "Quickfix List (Trouble)" },
{
"[q",
function()
if require("trouble").is_open() then
require("trouble").previous({ skip_groups = true, jump = true })
require("trouble").prev({ skip_groups = true, jump = true })
else
local ok, err = pcall(vim.cmd.cprev)
if not ok then
vim.notify(err, vim.log.levels.ERROR)
end
end
end,
desc = "Previous trouble/quickfix item",
desc = "Previous Trouble/Quickfix Item",
},
{
"]q",
Expand All @@ -1101,7 +1109,7 @@ local plugins = {
end
end
end,
desc = "Next trouble/quickfix item",
desc = "Next Trouble/Quickfix Item",
},
},
cond = not_vscode
Expand Down Expand Up @@ -1315,7 +1323,7 @@ local plugins = {
vim.notify("Disabled codespell", vim.log.levels.INFO)
vim.diagnostic.reset(nil, 0)
end
end, {desc = "[T]oggle code[s]pell"})
end, {desc = "[t]oggle code[s]pell"})
end,
cond = not_vscode
},
Expand Down

0 comments on commit c544023

Please sign in to comment.