commit 8a9adc9cfc627f5dac5aaf725b44526bb055374c
parent eb348e182c792666026612992c47f95ae2d71e85
Author: Tomas Nemec <owl@gtms.dev>
Date: Sun, 19 May 2024 00:09:18 +0200
update
Diffstat:
8 files changed, 45 insertions(+), 13 deletions(-)
diff --git a/after/plugin/git.lua b/after/plugin/git.lua
@@ -1,5 +1,9 @@
if vim.g.loaded_fugitive then
vim.keymap.set('n', '<leader>gg', '<cmd>G<cr>', { desc = 'Git Status' })
+ vim.keymap.set('n', '<leader>G', function()
+ vim.cmd.G()
+ vim.cmd.only()
+ end, { desc = 'Git Status (only)' })
vim.keymap.set('n', '<leader>gc', '<cmd>G commit<cr>', { desc = 'Git Commit' })
vim.keymap.set('n', '<leader>gb', '<cmd>Git blame<cr>', { desc = 'Git Blame' })
end
diff --git a/after/plugin/lsp.lua b/after/plugin/lsp.lua
@@ -23,13 +23,11 @@ local function keymap(client, buf)
end
if client.supports_method('callHierarchy/incomingCalls') then
- vim.keymap.set('n', prefix .. 'i', vim.lsp.buf.incoming_calls, opts 'LSP Incoming calls')
- vim.keymap.set('n', ']e', vim.lsp.buf.incoming_calls, opts 'LSP Incoming calls')
+ vim.keymap.set('n', ']c', vim.lsp.buf.incoming_calls, opts 'LSP Incoming calls')
end
if client.supports_method('callHierarchy/outgoingCalls') then
- vim.keymap.set('n', prefix .. 'o', vim.lsp.buf.outgoing_calls, opts 'LSP Outgoing calls')
- vim.keymap.set('n', '[e', vim.lsp.buf.outgoing_calls, opts 'LSP Outgoing calls')
+ vim.keymap.set('n', '[c', vim.lsp.buf.outgoing_calls, opts 'LSP Outgoing calls')
end
if client.supports_method('textDocument/implementation') then
diff --git a/after/plugin/treesitter.lua b/after/plugin/treesitter.lua
@@ -66,16 +66,16 @@ require 'nvim-treesitter.configs'.setup {
move = {
enable = true,
goto_next_start = { --
- [']]'] = '@function.outer',
+ [']m'] = '@function.outer',
},
goto_next_end = { --
- [']['] = '@function.inner',
+ [']M'] = '@function.inner',
},
goto_previous_start = { --
- ['[['] = '@function.outer',
+ ['[m'] = '@function.outer',
},
goto_previous_end = { --
- ['[]'] = '@function.inner',
+ ['[M'] = '@function.inner',
},
},
lsp_interop = {
diff --git a/ftplugin/dart.lua b/ftplugin/dart.lua
@@ -32,6 +32,10 @@ vim.keymap.set('n', '<leader>ar', ':make<cr>', { desc = 'Dart Run' })
vim.keymap.set('n', '<leader>at', ':DartTest<cr>', { desc = 'Dart Test' })
vim.keymap.set('n', '<leader>an', vim.cmd.Trun, { desc = 'Trun' })
+vim.api.nvim_buf_create_user_command(0, 'NgProvided', function()
+ vim.lsp.buf.references(nil, { on_list = require 'tms.lsp.dart'.provided_references })
+end, {})
+
vim.api.nvim_buf_create_user_command(0, 'DartTest', function()
local temp_makeprg = vim.bo.makeprg
vim.bo.makeprg = [[dart test --no-color -r expanded %]]
diff --git a/lua/tms/lsp/dart.lua b/lua/tms/lsp/dart.lua
@@ -60,4 +60,20 @@ function M.start()
})
end
+function M.provided_references(opts)
+ opts.items = vim.tbl_filter(function(item)
+ return string.match(item.text, "Provider%(")
+ end, opts.items)
+ vim.print(opts.items)
+
+ if #opts.items == 0 then
+ vim.notify('Not provided')
+ return
+ end
+
+ opts.title = 'Provided References'
+ vim.fn.setqflist({}, ' ', opts)
+ vim.cmd.copen()
+end
+
return M
diff --git a/plugin/diagnostic.lua b/plugin/diagnostic.lua
@@ -7,12 +7,17 @@ vim.diagnostic.config({
local rhs = {
local_errors = function() vim.diagnostic.setloclist { severity = vim.diagnostic.severity.ERROR } end,
- all_errors = function() vim.diagnostic.setqflist { severity = vim.diagnostic.severity.ERROR } end,
+ all_errors = function() vim.diagnostic.setqflist { severity = vim.diagnostic.severity.ERROR } end,
+ next_error = function() vim.diagnostic.goto_next { severity = vim.diagnostic.severity.ERROR } end,
+ prev_error = function() vim.diagnostic.goto_prev { severity = vim.diagnostic.severity.ERROR } end,
}
vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, { desc = "Previous Diagnostic" })
vim.keymap.set('n', ']d', vim.diagnostic.goto_next, { desc = "Next Diagnostic" })
+vim.keymap.set('n', '[D', vim.diagnostic.setloclist, { desc = "Local Diagnostic" })
vim.keymap.set('n', '[<c-d>', vim.diagnostic.setqflist, { desc = "All Diagnostic" })
-vim.keymap.set('n', '[D', rhs.all_errors, { desc = "All Errors" })
-vim.keymap.set('n', ']<c-d>', vim.diagnostic.setloclist, { desc = "Local Diagnostic" })
-vim.keymap.set('n', ']D', rhs.local_errors, { desc = "Local Errors" })
+
+vim.keymap.set('n', ']e', rhs.next_error, { desc = "Local Errors" })
+vim.keymap.set('n', '[e', rhs.prev_error, { desc = "Local Errors" })
+vim.keymap.set('n', '[E', rhs.local_errors, { desc = "Local Errors" })
+vim.keymap.set('n', '[<c-e>', rhs.all_errors, { desc = "All Errors" })
diff --git a/plugin/keymap.lua b/plugin/keymap.lua
@@ -19,10 +19,15 @@ vim.keymap.set('n', '<leader>E', ':e %:h/', {})
vim.keymap.set('n', '<leader>M', '<cmd>messages<cr>', {})
vim.keymap.set('n', '<leader>so', '<cmd>source<cr>', {})
-- window movement
+vim.keymap.set('n', '<c-q>', '<cmd>wincmd q<cr>', {})
vim.keymap.set('n', '<c-l>', '<cmd>wincmd l<cr>', {})
vim.keymap.set('n', '<c-h>', '<cmd>wincmd h<cr>', {})
vim.keymap.set('n', '<c-k>', '<cmd>wincmd k<cr>', {})
vim.keymap.set('n', '<c-j>', '<cmd>wincmd j<cr>', {})
+vim.keymap.set('n', '<c-s-l>', '<cmd>vertical resize +5<cr>', {})
+vim.keymap.set('n', '<c-s-h>', '<cmd>vertical resize -5<cr>', {})
+vim.keymap.set('n', '<c-s-k>', '<cmd>resize -5<cr>', {})
+vim.keymap.set('n', '<c-s-j>', '<cmd>resize +5<cr>', {})
-- window movement in terminal
vim.keymap.set('t', '<m-l>', '<c-\\><c-n><c-w>l', {})
vim.keymap.set('t', '<m-j>', '<c-\\><c-n><c-w>j', {})
diff --git a/plugin/unimpaired.lua b/plugin/unimpaired.lua
@@ -60,5 +60,5 @@ toggle.option('l', 'list', 'local')
toggle.option('n', 'number', 'local')
toggle.option('r', 'relativenumber', 'local')
toggle.option('s', 'spell', 'local')
--- toggle.option('w', 'wrap', 'local')
+toggle.option('w', 'wrap', 'local')
toggle.option('d', 'cmdheight', 'global')