Added some more stuff to neovim lua config

This commit is contained in:
Uttarayan Mondal
2021-05-13 20:34:42 +05:30
parent e8189ba975
commit 76f211a525
8 changed files with 142 additions and 50 deletions

View File

@@ -15,34 +15,49 @@ local normal_mode_maps = {
-- fzf
{ key = '<leader>;', map = [[<cmd>Buffers<cr>]] },
{ key = '<leader>f', map = [[<cmd>Files<cr>]] },
{ key = '<leader>ff', map = [[<cmd>Files<cr>]] },
{ key = '<leader>fb', map = [[<cmd>Marks<cr>]] },
{ key = '<leader>fh', map = [[<cmd>History<cr>]] },
{ key = '<leader>fa', map = [[<cmd>History<cr>]] },
{ key = '<leader>tc', map = [[<cmd>Colors<cr>]] },
{ key = '<leader>g', map = [[<cmd>Rg<cr>]] },
-- Session
{ key = '<leader>ss', map = [[<cmd>SessionSave<cr>]] },
{ key = '<leader>sl', map = [[<cmd>SessionLoad<cr>]] },
-- lsp
{ key = 'K', map = [[<cmd>lua vim.lsp.buf.hover()<cr>]] },
{ key = 'gd', map = [[<cmd>lua vim.lsp.buf.definition()<cr>]] },
{ key = '<C-k>', map = [[<cmd>lua vim.lsp.buf.definition()<cr>]] },
{ key = 'gi', map = [[<cmd>lua vim.lsp.buf.implementation()<cr>]] },
{ key = '<leader>o', map = [[<cmd>LspTroubleToggle<cr>]] },
{ key = '<leader>a', map = [[<cmd>lua vim.lsp.buf.document_highlight()<cr>]] },
{ key = '<leader>c', map = [[<cmd>lua vim.lsp.buf.clear_references()<cr>]] },
-- { key = '<leader>a', map = [[<cmd>lua vim.lsp.buf.document_highlight()<cr>]] },
-- { key = '<leader>c', map = [[<cmd>lua vim.lsp.buf.clear_references()<cr>]] },
{ key = '<leader>"', map = [["+]] },
{ key = 'F', map = [[<cmd>lua vim.lsp.buf.formatting()<cr>]] },
{ key = 'T', map = [[<cmd>lua require'lsp_extensions'.inlay_hints()<cr>]] },
-- Other
{ key = '<leader>m', map = [[<cmd>silent !mpcfzf<cr>]] },
}
local insert_mode_maps = {
{
key = '<Tab>',
map = [[pumvisible() ? "\<C-n>" : "\<Tab>"]],
options = { noremap = true, silent = true, expr = true }
},
{
key = '<S-Tab>',
map = [[pumvisible() ? "\<C-p>" : "\<S-Tab>"]],
options = { noremap = true, silent = true, expr = true }
},
vim.api.nvim_command([[imap <tab> <Plug>(completion_smart_tab)]])
vim.api.nvim_command([[imap <s-tab> <Plug>(completion_smart_s_tab)]])
local insert_mode_maps = {
-- {
-- key = '<Tab>',
-- map = [[pumvisible() ? "\<C-n>" : "\<Tab>"]],
-- options = { noremap = true, silent = true, expr = true }
-- },
-- {
-- key = '<S-Tab>',
-- map = [[pumvisible() ? "\<C-p>" : "\<S-Tab>"]],
-- options = { noremap = true, silent = true, expr = true }
-- },
-- { key = '<tab>', map = '(completion_smart_tab)', options = { plug = true } },
-- { key = '<s-tab>', map = '(completion_smart_s_tab)', options = { plug = true } },
@@ -55,10 +70,10 @@ for idx = 1, #normal_mode_maps do
if normal_mode_maps[idx].options then
local options = normal_mode_maps[idx].options
vim.api.nvim_set_keymap('n', normal_mode_maps[idx].key, normal_mode_maps[idx].map ,options)
else
else
vim.api.nvim_set_keymap('n', normal_mode_maps[idx].key, normal_mode_maps[idx].map ,options)
end
end
end
for idx = 1, #insert_mode_maps do
if insert_mode_maps[idx].options then
@@ -67,4 +82,13 @@ for idx = 1, #insert_mode_maps do
else
vim.api.nvim_set_keymap('i', insert_mode_maps[idx].key, insert_mode_maps[idx].map ,options)
end
end
end
-- local ff = {
-- { 'this', 'and this' },
-- { 'that', 'and that' },
-- }
-- print(ff[1][2])