vim: make horizontal split keymaps consistent in telescope and nvim-tree

This commit is contained in:
Fernando Schauenburg 2024-02-16 02:07:33 +01:00
parent b4aa060a0e
commit ee08716bed
2 changed files with 13 additions and 9 deletions

View file

@ -17,18 +17,21 @@ M.config = function()
hijack_cursor = true, -- keep the cursor on begin of the filename hijack_cursor = true, -- keep the cursor on begin of the filename
sync_root_with_cwd = true, -- watch for `DirChanged` and refresh the tree sync_root_with_cwd = true, -- watch for `DirChanged` and refresh the tree
on_attach = function(bufnr) on_attach = function(buffer)
local api = require('nvim-tree.api') local api = require('nvim-tree.api')
api.config.mappings.default_on_attach(bufnr) local map = vim.keymap.set
local opts = function(desc) local opts = function(desc)
return { desc = 'nvim-tree: ' .. desc, buffer = bufnr, silent = true } return { desc = 'nvim-tree: ' .. desc, buffer = buffer, silent = true }
end end
vim.keymap.set('n', 'l', api.node.open.edit, opts('open')) -- Give me the default mappings except <c-x>, which I replace with <c-s>.
vim.keymap.set('n', '<CR>', api.node.open.edit, opts('open')) api.config.mappings.default_on_attach(buffer)
vim.keymap.set('n', 'o', api.node.open.edit, opts('open')) vim.keymap.del('n', '<c-x>', { buffer = buffer })
vim.keymap.set('n', 'h', api.node.navigate.parent_close, opts('close directory'))
map('n', 'l', api.node.open.edit, opts('Open'))
map('n', '<cr>', api.node.open.edit, opts('Open'))
map('n', '<c-s>', api.node.open.horizontal, opts('Open: Horizontal Split'))
map('n', 'h', api.node.navigate.parent_close, opts('Close directory'))
end, end,
git = { git = {

View file

@ -136,7 +136,8 @@ M.config = function()
['<s-up>'] = actions.preview_scrolling_up, ['<s-up>'] = actions.preview_scrolling_up,
['<c-y>'] = layout.cycle_layout_next, ['<c-y>'] = layout.cycle_layout_next,
['<c-o>'] = layout.toggle_mirror, ['<c-o>'] = layout.toggle_mirror,
['<c-p>'] = layout.toggle_preview, ['<c-h>'] = layout.toggle_preview,
['<c-s>'] = actions.select_horizontal,
['<c-c>'] = actions.close, ['<c-c>'] = actions.close,
['<c-q>'] = actions.smart_send_to_qflist + actions.open_qflist, ['<c-q>'] = actions.smart_send_to_qflist + actions.open_qflist,
['<c-l>'] = actions.smart_send_to_loclist + actions.open_loclist, ['<c-l>'] = actions.smart_send_to_loclist + actions.open_loclist,