Attempted to add whichkey, bit jank rn
This commit is contained in:
parent
9e104a03fc
commit
6abe9e49ee
5 changed files with 66 additions and 9 deletions
|
|
@ -6,3 +6,4 @@ require("core.plugin_config.treesitter")
|
|||
require("core.plugin_config.lsp_config")
|
||||
require("core.plugin_config.completions")
|
||||
require("core.plugin_config.terminal")
|
||||
require("core.plugin_config.whichkey")
|
||||
|
|
|
|||
|
|
@ -27,10 +27,10 @@ vim.api.nvim_create_autocmd('LspAttach', {
|
|||
--vim.keymap.set('n', '<space>wl', function()
|
||||
-- print(vim.inspect(vim.lsp.buf.list_workspace_folders()))
|
||||
--end, opts)
|
||||
vim.keymap.set('n', '<leader>ltd', vim.lsp.buf.type_definition, opts)
|
||||
vim.keymap.set('n', '<leader>lrn', vim.lsp.buf.rename, opts)
|
||||
vim.keymap.set('n', '<leader>lt', vim.lsp.buf.type_definition, opts)
|
||||
vim.keymap.set('n', '<leader>lR', vim.lsp.buf.rename, opts)
|
||||
vim.keymap.set({ 'n', 'v' }, '<leader>la', vim.lsp.buf.code_action, opts)
|
||||
vim.keymap.set('n', '<leader>lrf', vim.lsp.buf.references, opts)
|
||||
vim.keymap.set('n', '<leader>lr', vim.lsp.buf.references, opts)
|
||||
vim.keymap.set('n', '<space>lf', function()
|
||||
vim.lsp.buf.format { async = true }
|
||||
end, opts)
|
||||
|
|
@ -54,6 +54,7 @@ require("lspconfig").lua_ls.setup {
|
|||
workspace = {
|
||||
-- Make the server aware of Neovim runtime files
|
||||
library = vim.api.nvim_get_runtime_file("", true),
|
||||
checkThirdParty = false,
|
||||
},
|
||||
-- Do not send telemetry data containing a randomized but unique identifier
|
||||
telemetry = {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
local builtin = require('telescope.builtin')
|
||||
|
||||
vim.keymap.set('n', '<c-p>', builtin.find_files, {})
|
||||
vim.keymap.set('n', '<leader><leader>', builtin.oldfiles, {})
|
||||
vim.keymap.set('n', '<leader>ff', builtin.find_files, {})
|
||||
vim.keymap.set('n', '<leader>fo', builtin.oldfiles, {})
|
||||
vim.keymap.set('n', '<leader>fg', builtin.live_grep, {})
|
||||
vim.keymap.set('n', '<leader>fh', builtin.help_tags, {})
|
||||
|
|
|
|||
51
lua/core/plugin_config/whichkey.lua
Normal file
51
lua/core/plugin_config/whichkey.lua
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
local whichkey = require("whichkey_setup")
|
||||
-- lsp format
|
||||
vim.g.formatfix = function()
|
||||
vim.lsp.buf.format { async = true }
|
||||
end
|
||||
-- TODO fix <cmd> based instructions
|
||||
local keymap = {
|
||||
t = 'Toggle Terminal',
|
||||
l = {
|
||||
name = '+lsp',
|
||||
e = { "vim.diagnostic.open_float", 'Diagnostic Float' },
|
||||
n = { "vim.diagnostic.goto_next", 'Next Diagnostic' },
|
||||
N = { "vim.diagnostic.goto_prev", 'Previous Diagnostic' },
|
||||
j = { "vim.diagnostic.setloclist", 'Diagnostic List' },
|
||||
--- Dynamic to each buffer potential TODO?
|
||||
D = { "vim.lsp.buf.declaration", 'Declaration' },
|
||||
d = { "vim.lsp.buf.definition", 'Definition' },
|
||||
k = { "vim.lsp.buf.hover", 'Hover' },
|
||||
i = { "vim.lsp.buf.implementation", 'Implementation' },
|
||||
t = { "vim.lsp.buf.type_definition", 'Type Definition' },
|
||||
R = { "vim.lsp.buf.rename", 'Rename' },
|
||||
a = { "vim.lsp.buf.code_action", 'Code Action' },
|
||||
r = { "vim.lsp.buf.references", 'References' },
|
||||
f = { "<cmd>lua vim.g.formatfix()<CR>", 'Format' },
|
||||
|
||||
},
|
||||
f = {
|
||||
name = '+find (telescope)',
|
||||
f = {"<cmd>Telescope find_files<CR>",'Find'},
|
||||
o = {"<cmd>Telescope oldfiles<CR>",'Old Files'},
|
||||
g = {"<cmd>Telescope live_grep<CR>",'Grep'},
|
||||
h = {"<cmd>Telescope help_tags<CR>",'Help Tags'},
|
||||
},
|
||||
g = {
|
||||
name = '+git',
|
||||
g = { '<Cmd>Telescope git_commits<CR>', 'Commits' },
|
||||
b = { '<Cmd>Telescope git_branches<CR>', 'Branches' },
|
||||
s = { '<Cmd>Telescope git_status<CR>', 'Status' },
|
||||
}
|
||||
}
|
||||
|
||||
whichkey.config {
|
||||
hide_statusline = false,
|
||||
default_keymap_settings = {
|
||||
silent = true,
|
||||
noremap = true,
|
||||
},
|
||||
default_mode = 'n',
|
||||
}
|
||||
|
||||
whichkey.register_keymap('leader', keymap)
|
||||
|
|
@ -23,6 +23,10 @@ local plugins = {
|
|||
opts = {} -- this is equalent to setup({}) function
|
||||
},
|
||||
'akinsho/toggleterm.nvim',
|
||||
{
|
||||
'AckslD/nvim-whichkey-setup.lua',
|
||||
dependencies = {'liuchengxu/vim-which-key'},
|
||||
},
|
||||
-- fzf
|
||||
{
|
||||
'nvim-telescope/telescope.nvim',
|
||||
|
|
|
|||
Loading…
Reference in a new issue