latest
This commit is contained in:
@@ -115,12 +115,12 @@ vim.opt.rtp:prepend(lazypath)
|
|||||||
require'lazy'.setup{ --{{{1
|
require'lazy'.setup{ --{{{1
|
||||||
{ 'github/copilot.vim', --{{{2
|
{ 'github/copilot.vim', --{{{2
|
||||||
config = function()
|
config = function()
|
||||||
vim.keymap.set('i', '<c-m>', 'copilot#Accept("\\<CR>")', {
|
vim.keymap.set('i', '<c-;>', 'copilot#Accept("\\<CR>")', {
|
||||||
expr = true,
|
expr = true,
|
||||||
replace_keycodes = false,
|
replace_keycodes = false,
|
||||||
})
|
})
|
||||||
vim.g.copilot_no_tab_map = true
|
vim.g.copilot_no_tab_map = true
|
||||||
vim.keymap.set('n', '<c-m>', ':Copilot panel<CR>', { noremap = true, silent = true })
|
vim.keymap.set('n', '<c-;>', ':Copilot panel<CR>', { noremap = true, silent = true })
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
{ 'rafaelsq/nvim-goc.lua', --{{{2
|
{ 'rafaelsq/nvim-goc.lua', --{{{2
|
||||||
@@ -176,15 +176,17 @@ require'lazy'.setup{ --{{{1
|
|||||||
{ 'nvim-tree/nvim-tree.lua', --{{{2
|
{ 'nvim-tree/nvim-tree.lua', --{{{2
|
||||||
dependencies = {"nvim-tree/nvim-web-devicons"},
|
dependencies = {"nvim-tree/nvim-web-devicons"},
|
||||||
config = function ()
|
config = function ()
|
||||||
|
---@param mode 'n'
|
||||||
|
---@param lhs string
|
||||||
|
---@param rhs string | function
|
||||||
---@param bufnr integer
|
---@param bufnr integer
|
||||||
local function always_active_mappings(bufnr)
|
---@param desc string
|
||||||
local api = require("nvim-tree.api")
|
local function map(mode, lhs, rhs, bufnr, desc)
|
||||||
api.config.mappings.default_on_attach(bufnr)
|
|
||||||
vim.keymap.set(
|
vim.keymap.set(
|
||||||
"n", "-", api.tree.toggle,
|
mode, lhs, rhs,
|
||||||
{
|
{
|
||||||
desc = "nvim-tree: Toggle",
|
desc = desc,
|
||||||
|
buffer = bufnr,
|
||||||
noremap = true,
|
noremap = true,
|
||||||
silent = true,
|
silent = true,
|
||||||
nowait = true,
|
nowait = true,
|
||||||
@@ -193,38 +195,25 @@ require'lazy'.setup{ --{{{1
|
|||||||
end
|
end
|
||||||
|
|
||||||
---@param bufnr integer
|
---@param bufnr integer
|
||||||
local function tree_specific_mappings(bufnr)
|
local function always(bufnr)
|
||||||
|
local api = require("nvim-tree.api")
|
||||||
|
api.config.mappings.default_on_attach(bufnr)
|
||||||
|
map('n', '-', api.tree.toggle, bufnr, 'nvim-tree: Toggle')
|
||||||
|
end
|
||||||
|
|
||||||
|
---@param bufnr integer
|
||||||
|
local function in_tree(bufnr)
|
||||||
local api = require'nvim-tree.api'
|
local api = require'nvim-tree.api'
|
||||||
|
map('n', '<CR>', api.node.open.no_window_picker, bufnr, 'nvim-tree: Open')
|
||||||
vim.keymap.set(
|
map('n', '<c-j>', api.node.open.no_window_picker, bufnr, 'nvim-tree: Open')
|
||||||
"n", '<CR>', api.node.open.no_window_picker,
|
|
||||||
{
|
|
||||||
desc = "nvim-tree: Open",
|
|
||||||
buffer = bufnr,
|
|
||||||
noremap = true,
|
|
||||||
silent = true,
|
|
||||||
nowait = true,
|
|
||||||
}
|
|
||||||
)
|
|
||||||
|
|
||||||
vim.keymap.set(
|
|
||||||
"n", '<c-j>', api.node.open.no_window_picker,
|
|
||||||
{
|
|
||||||
desc = "nvim-tree: Open",
|
|
||||||
buffer = bufnr,
|
|
||||||
noremap = true,
|
|
||||||
silent = true,
|
|
||||||
nowait = true,
|
|
||||||
}
|
|
||||||
)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
local function my_on_attach(bufnr)
|
local function my_on_attach(bufnr)
|
||||||
always_active_mappings(bufnr)
|
always(bufnr)
|
||||||
local api = require'nvim-tree.api'
|
local api = require'nvim-tree.api'
|
||||||
local is_tree_buf = api.tree.is_tree_buf(bufnr)
|
local is_tree_buf = api.tree.is_tree_buf(bufnr)
|
||||||
if is_tree_buf then
|
if is_tree_buf then
|
||||||
tree_specific_mappings(bufnr)
|
in_tree(bufnr)
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user