mirror of
https://github.com/sadan4/nvim.git
synced 2025-06-07 12:23:02 -04:00
things
configure nvim-tree with binds + opts use signature from noice only add A-L/R arows to go back/forward
This commit is contained in:
parent
773903923d
commit
a713d9a7cf
6 changed files with 60 additions and 13 deletions
|
@ -4,6 +4,8 @@ vim.g.mapleader = " "
|
|||
|
||||
vim.keymap.set("n", "<C-b>", "<Nop>");
|
||||
vim.keymap.set("n", "<C-f>", "<Nop>");
|
||||
vim.keymap.set("n", "<A-Left>", "<C-o>");
|
||||
vim.keymap.set("n", "<A-Right>", "<C-i>");
|
||||
-- <S-k> is mapped to hover
|
||||
-- unmap <S-j>
|
||||
vim.keymap.set({"v", "n"}, "J", "<Nop>")
|
||||
|
@ -46,9 +48,7 @@ vim.keymap.set("v", "<A-S-Down>", function ()
|
|||
vim.api.nvim_feedkeys("yp", "x", false)
|
||||
end)
|
||||
-- toggle function signature
|
||||
vim.keymap.set("i", "<C-S-Space>", function()
|
||||
require("lsp_signature").toggle_float_win()
|
||||
end, {})
|
||||
-- Moved to noice
|
||||
-- format and vplit remaps
|
||||
vim.keymap.set({ "n", "i" }, "<A-F>", vim.cmd.Format, {})
|
||||
-- vscode fold and unfold
|
||||
|
@ -88,6 +88,11 @@ vim.keymap.set("n", "<leader>e", function()
|
|||
-- print((":e " .. string.gsub(vim.fn.expand("%"), '(.*/)(.*)', '%1')));
|
||||
vim.api.nvim_feedkeys((":e " .. string.gsub(vim.fn.expand("%"), "(.*/)(.*)", "%1")), "L", false)
|
||||
end)
|
||||
-- open command line with the path of current buffer already inserted
|
||||
vim.keymap.set("n", "<leader>r", function()
|
||||
-- print((":r " .. string.gsub(vim.fn.expand("%"), '(.*/)(.*)', '%1')));
|
||||
vim.api.nvim_feedkeys((":r " .. string.gsub(vim.fn.expand("%"), "(.*/)(.*)", "%1")), "L", false)
|
||||
end)
|
||||
vim.keymap.set("n", "<leader>c", ':let @+=@"<CR>')
|
||||
-- training
|
||||
vim.keymap.set("n", "<Left>", ':echoe "Use h"<CR>')
|
||||
|
|
|
@ -156,9 +156,6 @@ local plugins = {
|
|||
{
|
||||
"williamboman/mason.nvim",
|
||||
},
|
||||
{
|
||||
"ray-x/lsp_signature.nvim",
|
||||
},
|
||||
{
|
||||
"williamboman/mason-lspconfig.nvim",
|
||||
},
|
||||
|
|
|
@ -117,7 +117,15 @@ require("notify").setup({
|
|||
on_open = makeCloseMap,
|
||||
on_close = removeCloseMap,
|
||||
})
|
||||
vim.api.nvim_create_user_command("Notifications", "Telescope notify", {
|
||||
force = true,
|
||||
})
|
||||
vim.notify = require("notify")
|
||||
vim.keymap.set({"n", "i"}, "<C-S-Space>", function()
|
||||
local api = require("noice.lsp.docs")
|
||||
local message = api.get("signature")
|
||||
api.hide(message)
|
||||
end)
|
||||
require("noice").setup({
|
||||
cmdline = {
|
||||
enabled = true, -- enables the Noice cmdline UI
|
||||
|
|
|
@ -1,4 +0,0 @@
|
|||
local cfg = {
|
||||
hint_enable = false,
|
||||
} -- add your config here
|
||||
require("lsp_signature").setup(cfg)
|
|
@ -4,18 +4,56 @@ vim.g.loaded_netrwPlugin = 1
|
|||
|
||||
-- optionally enable 24-bit colour
|
||||
vim.opt.termguicolors = true
|
||||
|
||||
local function myOnAttach(bufnr)
|
||||
local api = require("nvim-tree.api")
|
||||
|
||||
|
||||
local function opts(desc)
|
||||
return { desc = "nvim-tree: " .. desc, buffer = bufnr, noremap = true, silent = true, nowait = true }
|
||||
return { desc = "nvim-tree: " .. desc, buffer = bufnr, noremap = true, silent = true, nowait = true }
|
||||
end
|
||||
-- defaults
|
||||
api.config.mappings.default_on_attach(bufnr)
|
||||
vim.keymap.set("n", "<C-t>", api.tree.close, opts("close tree with ctrl+t"))
|
||||
vim.keymap.set("n", "H", api.tree.collapse_all, opts("Collapse All"))
|
||||
vim.keymap.set("n", "h", function()
|
||||
--- @type Node
|
||||
local node = api.tree.get_node_under_cursor()
|
||||
api.node.navigate.parent_close(node)
|
||||
end, opts("Collapse Parent"))
|
||||
vim.keymap.set("n", "L", function()
|
||||
local node = api.tree.get_node_under_cursor()
|
||||
|
||||
if node.nodes ~= nil then
|
||||
-- expand or collapse folder
|
||||
api.node.open.edit()
|
||||
else
|
||||
-- open file as vsplit
|
||||
api.node.open.vertical()
|
||||
end
|
||||
|
||||
-- Finally refocus on tree if it was lost
|
||||
api.tree.focus()
|
||||
end, opts("VSplit open"))
|
||||
vim.keymap.set("n", "l", function()
|
||||
--- @type Node
|
||||
local node = api.tree.get_node_under_cursor()
|
||||
|
||||
--- weird types
|
||||
---@diagnostic disable-next-line: undefined-field
|
||||
if node.nodes ~= nil then
|
||||
api.node.open.edit()
|
||||
end
|
||||
end)
|
||||
end
|
||||
vim.keymap.set("n", "<A-t>", "<Cmd>NvimTreeFindFile<CR>")
|
||||
-- OR setup with some options
|
||||
require("nvim-tree").setup({
|
||||
on_attach = myOnAttach,
|
||||
hijack_cursor = true,
|
||||
sync_root_with_cwd = true,
|
||||
respect_buf_cwd = true,
|
||||
renderer = {
|
||||
indent_markers = {
|
||||
enable = true,
|
||||
},
|
||||
},
|
||||
})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue