Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/lint_code.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ jobs:
- uses: actions/checkout@v5
- uses: lunarmodules/luacheck@v1
with:
args: . --std luajit --max-line-length 150 --no-config --globals vim _debugging _command_panel _flash_esc_or_noh _telescope_collections _toggle_inlayhint _toggle_virtuallines _toggle_lazygit _select_chat_model
args: . --std luajit --max-line-length 150 --no-config --globals vim _debugging
36 changes: 21 additions & 15 deletions lua/keymap/completion.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
local bind = require("keymap.bind")
local map_cr = bind.map_cr
local map_callback = bind.map_callback
local helpers = require("keymap.helpers")

local mappings = {
fmt = {
Expand All @@ -26,14 +27,7 @@ function M.lsp(buf)
:with_buffer(buf)
:with_desc("lsp: Toggle outline"),
["n|gto"] = map_callback(function()
if require("core.settings").search_backend == "fzf" then
local prompt_position = require("telescope.config").values.layout_config.horizontal.prompt_position
require("fzf-lua").lsp_document_symbols({
fzf_opts = { ["--layout"] = prompt_position == "top" and "reverse" or "default" },
})
else
require("telescope.builtin").lsp_document_symbols()
end
helpers.picker("lsp_document_symbols")
end)
:with_silent()
:with_buffer(buf)
Expand Down Expand Up @@ -67,13 +61,25 @@ function M.lsp(buf)
:with_silent()
:with_buffer(buf)
:with_desc("lsp: Code action for cursor"),
["n|gd"] = map_cr("Glance definitions"):with_silent():with_buffer(buf):with_desc("lsp: Preview definition"),
["n|gD"] = map_cr("Lspsaga goto_definition"):with_silent():with_buffer(buf):with_desc("lsp: Goto definition"),
["n|gh"] = map_cr("Glance references"):with_silent():with_buffer(buf):with_desc("lsp: Show reference"),
["n|gm"] = map_cr("Glance implementations")
["n|gd"] = map_cr("Lspsaga peek_definition")
:with_silent()
:with_buffer(buf)
:with_desc("lsp: Show implementation"),
:with_desc("lsp: Preview definition"),
["n|gD"] = map_cr("Lspsaga goto_definition"):with_silent():with_buffer(buf):with_desc("lsp: Goto definition"),
["n|gh"] = map_callback(function()
helpers.picker("lsp_references")
end)
:with_noremap()
:with_nowait()
:with_silent()
:with_desc("lsp: show finder"),
["n|gm"] = map_callback(function()
helpers.picker("lsp_implementations")
end)
:with_noremap()
:with_nowait()
:with_silent()
:with_desc("lsp: show implementations"),
["n|gci"] = map_cr("Lspsaga incoming_calls")
:with_silent()
:with_buffer(buf)
Expand All @@ -83,13 +89,13 @@ function M.lsp(buf)
:with_buffer(buf)
:with_desc("lsp: Show outgoing calls"),
["n|<leader>lv"] = map_callback(function()
_toggle_virtuallines()
helpers.toggle_virtuallines()
end)
:with_noremap()
:with_silent()
:with_desc("lsp: Toggle virtual lines"),
["n|<leader>lh"] = map_callback(function()
_toggle_inlayhint()
helpers.toggle_inlayhint()
end)
:with_noremap()
:with_silent()
Expand Down
4 changes: 3 additions & 1 deletion lua/keymap/editor.lua
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
---@diagnostic disable: undefined-global
local bind = require("keymap.bind")
local map_cr = bind.map_cr
local map_cu = bind.map_cu
local map_cmd = bind.map_cmd
local map_callback = bind.map_callback
local et = bind.escape_termcode
local helpers = require("keymap.helpers")

local mappings = {
builtins = {
Expand Down Expand Up @@ -44,7 +46,7 @@ local mappings = {
["n|J"] = map_cmd("mzJ`z"):with_noremap():with_desc("edit: Join next line"),
["n|<S-Tab>"] = map_cr("normal za"):with_noremap():with_silent():with_desc("edit: Toggle code fold"),
["n|<Esc>"] = map_callback(function()
_flash_esc_or_noh()
helpers.flash_esc_or_noh()
end)
:with_noremap()
:with_silent()
Expand Down
34 changes: 21 additions & 13 deletions lua/keymap/helpers.lua
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
_G._command_panel = function()
require("telescope.builtin").keymaps({
lhs_filter = function(lhs)
return not string.find(lhs, "Þ")
end,
})
end
local M = {}

_G._flash_esc_or_noh = function()
M.flash_esc_or_noh = function()
local flash_active, state = pcall(function()
return require("flash.plugins.char").state
end)
Expand All @@ -17,7 +11,7 @@ _G._flash_esc_or_noh = function()
end
end

_G._telescope_collections = function(opts)
M.telescope_collections = function(opts)
local tabs = require("search.tabs")
local actions = require("telescope.actions")
local state = require("telescope.actions.state")
Expand Down Expand Up @@ -45,7 +39,7 @@ _G._telescope_collections = function(opts)
:find()
end

_G._toggle_inlayhint = function()
M.toggle_inlayhint = function()
local is_enabled = vim.lsp.inlay_hint.is_enabled({ bufnr = 0 })
vim.lsp.inlay_hint.enable(not is_enabled)
vim.notify(
Expand All @@ -55,7 +49,7 @@ _G._toggle_inlayhint = function()
)
end

_G._toggle_virtuallines = function()
M.toggle_virtuallines = function()
require("tiny-inline-diagnostic").toggle()
vim.notify(
"Virtual lines are now "
Expand All @@ -66,7 +60,7 @@ _G._toggle_virtuallines = function()
end

local _lazygit = nil
_G._toggle_lazygit = function()
M.toggle_lazygit = function()
if vim.fn.executable("lazygit") == 1 then
if not _lazygit then
_lazygit = require("toggleterm.terminal").Terminal:new({
Expand All @@ -82,7 +76,7 @@ _G._toggle_lazygit = function()
end
end

_G._select_chat_model = function()
M.select_chat_model = function()
local actions = require("telescope.actions")
local action_state = require("telescope.actions.state")
local finder = require("telescope.finders")
Expand Down Expand Up @@ -110,3 +104,17 @@ _G._select_chat_model = function()
})
:find()
end

M.picker = function(method, tele_opts)
local prompt_position = require("telescope.config").values.layout_config.horizontal.prompt_position
local fzf_opts = { ["--layout"] = prompt_position == "top" and "reverse" or "default" }
if require("core.settings").search_backend == "fzf" then
require("fzf-lua")[method]({
fzf_opts = fzf_opts,
})
else
require("telescope.builtin")[method](tele_opts)
end
end

return M
21 changes: 9 additions & 12 deletions lua/keymap/tool.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ local map_cr = bind.map_cr
local map_cu = bind.map_cu
local map_cmd = bind.map_cmd
local map_callback = bind.map_callback
require("keymap.helpers")
local helpers = require("keymap.helpers")

local mappings = {
plugins = {
Expand Down Expand Up @@ -74,7 +74,7 @@ local mappings = {
:with_desc("terminal: Toggle float"),
["t|<A-d>"] = map_cmd("<Cmd>ToggleTerm<CR>"):with_noremap():with_silent():with_desc("terminal: Toggle float"),
["n|<leader>gg"] = map_callback(function()
_toggle_lazygit()
helpers.toggle_lazygit()
end)
:with_noremap()
:with_silent()
Expand All @@ -100,20 +100,17 @@ local mappings = {

-- Plugin: telescope
["n|<C-p>"] = map_callback(function()
if require("core.settings").search_backend == "fzf" then
local prompt_position = require("telescope.config").values.layout_config.horizontal.prompt_position
require("fzf-lua").keymaps({
fzf_opts = { ["--layout"] = prompt_position == "top" and "reverse" or "default" },
})
else
_command_panel()
end
helpers.picker("keymaps", {
lhs_filter = function(lhs)
return not string.find(lhs, "Þ")
end,
})
end)
:with_noremap()
:with_silent()
:with_desc("tool: Toggle command panel"),
["n|<leader>fc"] = map_callback(function()
_telescope_collections(require("telescope.themes").get_dropdown())
helpers.telescope_collections(require("telescope.themes").get_dropdown())
end)
:with_noremap()
:with_silent()
Expand Down Expand Up @@ -242,7 +239,7 @@ local mappings = {

--- Plugin: CodeCompanion and edgy
["n|<leader>cs"] = map_callback(function()
_select_chat_model()
helpers.select_chat_model()
end)
:with_noremap()
:with_silent()
Expand Down
83 changes: 0 additions & 83 deletions lua/modules/configs/completion/glance.lua

This file was deleted.

5 changes: 0 additions & 5 deletions lua/modules/plugins/completion.lua
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,6 @@ completion["nvimdev/lspsaga.nvim"] = {
config = require("completion.lspsaga"),
dependencies = "nvim-tree/nvim-web-devicons",
}
completion["DNLHC/glance.nvim"] = {
lazy = true,
event = "LspAttach",
config = require("completion.glance"),
}
completion["rachartier/tiny-inline-diagnostic.nvim"] = {
lazy = false,
config = require("completion.tiny-inline-diagnostic"),
Expand Down