dotconf/private_dot_config/private_nvim/private_lua/private_hydras.lua

88 lines
3.5 KiB
Lua

local Hydra = require('hydra')
local cmd = require('hydra.keymap-util').cmd
local telescope_hint = [[
_f_: files _g_: live grep
🭇🬭🬭🬭🬭🬭🬭🬭🬭🬼 _o_: old files _/_: search in file
🭉🭁🭠🭘 🭣🭕🭌🬾
🭅█ >▁ █🭐 _r_: resume _T_: TODO comments
██🬿 🭊██ _h_: vim help _c_: execute command
🭋█🬝🮄🮄🮄🮄🮄🮄🮄🮄🬆█🭀 _k_: keymaps _;_: commands history
🭤🭒🬺🬹🬱🬭🬭🬭🬭🬵🬹🬹🭝🭙 _O_: options _?_: search history
^
_<Enter>_: Telescope _<Esc>_
]]
Hydra({
name = 'Telescope',
hint = telescope_hint,
config = {
color = 'teal',
invoke_on_body = true,
hint = {
position = 'middle',
border = 'rounded',
},
},
mode = 'n',
body = '<leader>F',
heads = {
{ 'f', cmd 'Telescope find_files' },
{ 'g', cmd 'Telescope live_grep' },
{ 'o', cmd 'Telescope oldfiles', { desc = 'recently opened files' } },
{ 'h', cmd 'Telescope help_tags', { desc = 'vim help' } },
{ 'k', cmd 'Telescope keymaps' },
{ 'O', cmd 'Telescope vim_options' },
{ 'r', cmd 'Telescope resume' },
{ '/', cmd 'Telescope current_buffer_fuzzy_find', { desc = 'search in file' } },
{ '?', cmd 'Telescope search_history', { desc = 'search history' } },
{ ';', cmd 'Telescope command_history', { desc = 'command-line history' } },
{ 'c', cmd 'Telescope commands', { desc = 'execute command' } },
{ 'T', cmd 'TodoTelescope', { desc = 'todo comments' } },
{ '<Enter>', cmd 'Telescope', { exit = true, desc = 'list all pickers' } },
{ '<Esc>', nil, { exit = true, nowait = true } },
}
})
local lsp_hint = [[
_K_: hover
🭇🬭🬭🬭🬭🬭🬭🬭🬭🬼
🭉🭁🭠🭘 🭣🭕🭌🬾 _gd_: definition _gD_: declaration
🭅█ >▁ █🭐 _gi_: implementation _go_: typedef
██🬿 🭊██ _gr_: references _gs_: signature
🭋█🬝🮄🮄🮄🮄🮄🮄🮄🮄🬆█🭀
🭤🭒🬺🬹🬱🬭🬭🬭🬭🬵🬹🬹🭝🭙 _<F2>_: rename _<F4>_: code actions
^
_gl_: diagnostic float
_[d_: prev _]d_: next
]]
Hydra({
name = 'LSP Actions',
hint = lsp_hint,
config = {
color = 'teal',
invoke_on_body = true,
hint = {
position = 'middle',
border = 'rounded',
}
},
mode = 'n',
body = '<leader>L',
heads = {
{ 'K', cmd 'lua vim.lsp.buf.hover()' },
{ 'gd', cmd 'lua vim.lsp.buf.definition()' },
{ 'gD', cmd 'lua vim.lsp.buf.declaration()' },
{ 'gi', cmd 'lua vim.lsp.buf.implementation()' },
{ 'go', cmd 'lua vim.lsp.buf.type_definition()' },
{ 'gr', cmd 'lua vim.lsp.buf.references()' },
{ 'gs', cmd 'lua vim.lsp.buf.signature_help()' },
{ '<F2>', cmd 'lua vim.lsp.buf.rename()' },
{ '<F4>', cmd 'lua vim.lsp.buf.code_action()' },
{ 'gl', cmd 'lua vim.diagnostic.open_float()' },
{ '[d', cmd 'lua vim.diagnostic.goto_prev()' },
{ ']d', cmd 'lua vim.diagnostic.goto_next()' },
{ '<Esc>', nil, { exit = true, nowait = true } },
}
})