vim: make horizontal split keymaps consistent in telescope and nvim-tree
This commit is contained in:
parent
b4aa060a0e
commit
ee08716bed
2 changed files with 13 additions and 9 deletions
|
@ -17,18 +17,21 @@ M.config = function()
|
|||
hijack_cursor = true, -- keep the cursor on begin of the filename
|
||||
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')
|
||||
api.config.mappings.default_on_attach(bufnr)
|
||||
|
||||
local map = vim.keymap.set
|
||||
local opts = function(desc)
|
||||
return { desc = 'nvim-tree: ' .. desc, buffer = bufnr, silent = true }
|
||||
return { desc = 'nvim-tree: ' .. desc, buffer = buffer, silent = true }
|
||||
end
|
||||
|
||||
vim.keymap.set('n', 'l', api.node.open.edit, opts('open'))
|
||||
vim.keymap.set('n', '<CR>', api.node.open.edit, opts('open'))
|
||||
vim.keymap.set('n', 'o', api.node.open.edit, opts('open'))
|
||||
vim.keymap.set('n', 'h', api.node.navigate.parent_close, opts('close directory'))
|
||||
-- Give me the default mappings except <c-x>, which I replace with <c-s>.
|
||||
api.config.mappings.default_on_attach(buffer)
|
||||
vim.keymap.del('n', '<c-x>', { buffer = buffer })
|
||||
|
||||
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,
|
||||
|
||||
git = {
|
||||
|
|
|
@ -136,7 +136,8 @@ M.config = function()
|
|||
['<s-up>'] = actions.preview_scrolling_up,
|
||||
['<c-y>'] = layout.cycle_layout_next,
|
||||
['<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-q>'] = actions.smart_send_to_qflist + actions.open_qflist,
|
||||
['<c-l>'] = actions.smart_send_to_loclist + actions.open_loclist,
|
||||
|
|
Loading…
Add table
Reference in a new issue