WIP: update-upstream #4

Closed
cscherrNT wants to merge 69 commits from update-upstream into master
5 changed files with 93 additions and 129 deletions
Showing only changes of commit afd8870358 - Show all commits

View File

@ -136,12 +136,3 @@ local new_cmd = vim.api.nvim_create_user_command
new_cmd("NvChadUpdate", function() new_cmd("NvChadUpdate", function()
require "nvchad.updater"() require "nvchad.updater"()
end, {}) end, {})
--------------------------------------- globals -------------------------------------------
vim.g.whichkey_maps = true
vim.g.blankline_maps = true
vim.g.terminal_maps = true
vim.g.telescope_maps = true
vim.g.nvimtree_maps = true
vim.g.comment_maps = true
vim.g.tabufline_maps = true

View File

@ -6,7 +6,6 @@ map("i", "<C-h>", "<Left>", { desc = "Move left | general" })
map("i", "<C-l>", "<Right>", { desc = "Move right | general" }) map("i", "<C-l>", "<Right>", { desc = "Move right | general" })
map("i", "<C-j>", "<Down>", { desc = "Move down | general" }) map("i", "<C-j>", "<Down>", { desc = "Move down | general" })
map("i", "<C-k>", "<Up>", { desc = "Move up | general" }) map("i", "<C-k>", "<Up>", { desc = "Move up | general" })
map("n", "<Esc>", "<cmd>noh<CR>", { desc = "Clear highlights | general" }) map("n", "<Esc>", "<cmd>noh<CR>", { desc = "Clear highlights | general" })
map("n", "<C-h>", "<C-w>h", { desc = "Window left | general" }) map("n", "<C-h>", "<C-w>h", { desc = "Window left | general" })
map("n", "<C-l>", "<C-w>l", { desc = "Window right | general" }) map("n", "<C-l>", "<C-w>l", { desc = "Window right | general" })
@ -19,121 +18,95 @@ map("n", "<leader>rn", "<cmd>set rnu!<CR>", { desc = "Toggle relative number | g
map("n", "<leader>b", "<cmd>enew<CR>", { desc = "New buffer | general" }) map("n", "<leader>b", "<cmd>enew<CR>", { desc = "New buffer | general" })
map("n", "<leader>ch", "<cmd>NvCheatsheet<CR>", { desc = "Mapping cheatsheet | general" }) map("n", "<leader>ch", "<cmd>NvCheatsheet<CR>", { desc = "Mapping cheatsheet | general" })
-- global lsp mappings
map("n", "<leader>fm", function() map("n", "<leader>fm", function()
vim.lsp.buf.format { async = true } vim.lsp.buf.format { async = true }
end, { desc = "LSP formatting | lsp" }) end, { desc = "LSP formatting | lsp" })
vim.keymap.set("n", "<leader>lf", vim.diagnostic.open_float, { desc = "floating diagnostics | lsp" }) map("n", "<leader>lf", vim.diagnostic.open_float, { desc = "floating diagnostics | lsp" })
vim.keymap.set("n", "[d", vim.diagnostic.goto_prev, { desc = "prev diagnostic | lsp" }) map("n", "[d", vim.diagnostic.goto_prev, { desc = "prev diagnostic | lsp" })
vim.keymap.set("n", "]d", vim.diagnostic.goto_next, { desc = "next diagnostic | lsp" }) map("n", "]d", vim.diagnostic.goto_next, { desc = "next diagnostic | lsp" })
vim.keymap.set("n", "<leader>q", vim.diagnostic.setloclist, { desc = "diagnostic loclist | lsp" }) map("n", "<leader>q", vim.diagnostic.setloclist, { desc = "diagnostic loclist | lsp" })
-- Mappings for terminal mode -- tabufline
map( map("n", "<tab>", function()
"t",
"<C-x>",
vim.api.nvim_replace_termcodes("<C-\\><C-N>", true, true, true),
{ desc = "Escape terminal mode | general" }
)
-- Mappings for M.tabufline
if vim.g.tabufline_maps then
map("n", "<tab>", function()
require("nvchad.tabufline").tabuflineNext() require("nvchad.tabufline").tabuflineNext()
end, { desc = "Goto next buffer | tabufline" }) end, { desc = "Goto next buffer | tabufline" })
map("n", "<S-tab>", function() map("n", "<S-tab>", function()
require("nvchad.tabufline").tabuflinePrev() require("nvchad.tabufline").tabuflinePrev()
end, { desc = "Goto prev buffer | tabufline" }) end, { desc = "Goto prev buffer | tabufline" })
map("n", "<leader>x", function() map("n", "<leader>x", function()
require("nvchad.tabufline").close_buffer() require("nvchad.tabufline").close_buffer()
end, { desc = "Close buffer | tabufline" }) end, { desc = "Close buffer | tabufline" })
end
if vim.g.comment_maps then map("n", "<leader>/", function()
map("n", "<leader>/", function()
require("Comment.api").toggle.linewise.current() require("Comment.api").toggle.linewise.current()
end, { desc = "Toggle comment | comment" }) end, { desc = "Toggle comment | comment" })
map( map(
"v", "v",
"<leader>/", "<leader>/",
"<ESC><cmd>lua require('Comment.api').toggle.linewise(vim.fn.visualmode())<CR>", "<ESC>:lua require('Comment.api').toggle.linewise(vim.fn.visualmode())<CR>",
{ desc = "Toggle comment | comment" } { desc = "Toggle comment | comment" }
) )
end
if vim.g.nvimtree_maps then map("n", "<C-n>", "<cmd>NvimTreeToggle<CR>", { desc = "Toggle nvimtree | nvimtree" })
map("n", "<C-n>", "<cmd>NvimTreeToggle<CR>", { desc = "Toggle nvimtree | nvimtree" }) map("n", "<leader>e", "<cmd>NvimTreeFocus<CR>", { desc = "Focus nvimtree | nvimtree" })
map("n", "<leader>e", "<cmd>NvimTreeFocus<CR>", { desc = "Focus nvimtree | nvimtree" })
end
if vim.g.telescope_maps then map("n", "<leader>fw", "<cmd>Telescope live_grep<CR>", { desc = "Live grep | telescope" })
map("n", "<leader>fw", "<cmd>Telescope live_grep<CR>", { desc = "Live grep | telescope" }) map("n", "<leader>fb", "<cmd>Telescope buffers<CR>", { desc = "Find buffers | telescope" })
map("n", "<leader>fb", "<cmd>Telescope buffers<CR>", { desc = "Find buffers | telescope" }) map("n", "<leader>fh", "<cmd>Telescope help_tags<CR>", { desc = "Help page | telescope" })
map("n", "<leader>fh", "<cmd>Telescope help_tags<CR>", { desc = "Help page | telescope" }) map("n", "<leader>fo", "<cmd>Telescope oldfiles<CR>", { desc = "Find oldfiles | telescope" })
map("n", "<leader>fo", "<cmd>Telescope oldfiles<CR>", { desc = "Find oldfiles | telescope" }) map("n", "<leader>fz", "<cmd>Telescope current_buffer_fuzzy_find<CR>", { desc = "Find in current buffer | telescope" })
map("n", "<leader>cm", "<cmd>Telescope git_commits<CR>", { desc = "Git commits | telescope" })
map("n", "<leader>gt", "<cmd>Telescope git_status<CR>", { desc = "Git status | telescope" })
map("n", "<leader>pt", "<cmd>Telescope terms<CR>", { desc = "Pick hidden term | telescope" })
map("n", "<leader>th", "<cmd>Telescope themes<CR>", { desc = "Nvchad themes | telescope" })
map("n", "<leader>ff", "<cmd>Telescope find_files<cr>", { desc = "Find files | telescope" })
map( map(
"n",
"<leader>fz",
"<cmd>Telescope current_buffer_fuzzy_find<CR>",
{ desc = "Find in current buffer | telescope" }
)
map("n", "<leader>cm", "<cmd>Telescope git_commits<CR>", { desc = "Git commits | telescope" })
map("n", "<leader>gt", "<cmd>Telescope git_status<CR>", { desc = "Git status | telescope" })
map("n", "<leader>pt", "<cmd>Telescope terms<CR>", { desc = "Pick hidden term | telescope" })
map("n", "<leader>th", "<cmd>Telescope themes<CR>", { desc = "Nvchad themes | telescope" })
map("n", "<leader>ff", "<cmd>Telescope find_files<CR>", { desc = "Find files | telescope" })
map(
"n", "n",
"<leader>fa", "<leader>fa",
"<cmd>Telescope find_files follow=true no_ignore=true hidden=true<CR>", "<cmd>Telescope find_files follow=true no_ignore=true hidden=true<CR>",
{ desc = "Find all | telescope" } { desc = "Find all | telescope" }
) )
end
-- Mappings for M.terminal -- terminal
if vim.g.terminal_maps then map("t", "<C-x>", "<C-\\><C-N>", { desc = "Escape terminal mode | terminal" })
map("n", "<leader>h", function() map("n", "<leader>h", function()
require("nvchad.term").new { pos = "sp", size = 0.3 } require("nvchad.term").new { pos = "sp", size = 0.3 }
end, { desc = "New horizontal term | terminal" }) end, { desc = "New horizontal term | terminal" })
map("n", "<leader>v", function() map("n", "<leader>v", function()
require("nvchad.term").new { pos = "vsp", size = 0.3 } require("nvchad.term").new { pos = "vsp", size = 0.3 }
end, { desc = "New vertical term | terminal" }) end, { desc = "New vertical term | terminal" })
map({ "n", "t" }, "<A-v>", function() map({ "n", "t" }, "<A-v>", function()
require("nvchad.term").toggle { pos = "vsp", id = "vtoggleTerm", size = 0.3 } require("nvchad.term").toggle { pos = "vsp", id = "vtoggleTerm", size = 0.3 }
end, { desc = "Toggleable vertical term | terminal" }) end, { desc = "Toggleable vertical term | terminal" })
map({ "n", "t" }, "<A-h>", function() map({ "n", "t" }, "<A-h>", function()
require("nvchad.term").toggle { pos = "sp", id = "htoggleTerm", size = 0.2 } require("nvchad.term").toggle { pos = "sp", id = "htoggleTerm", size = 0.2 }
end, { desc = "New horizontal term | terminal" }) end, { desc = "New horizontal term | terminal" })
map({ "n", "t" }, "<A-i>", function() map({ "n", "t" }, "<A-i>", function()
require("nvchad.term").toggle { pos = "float", id = "floatTerm" } require("nvchad.term").toggle { pos = "float", id = "floatTerm" }
end, { desc = "Toggleable Floating term | terminal" }) end, { desc = "Toggleable Floating term | terminal" })
map("t", "<ESC>", function() map("t", "<ESC>", function()
local win = vim.api.nvim_get_current_win() local win = vim.api.nvim_get_current_win()
vim.api.nvim_win_close(win, true) vim.api.nvim_win_close(win, true)
end, { desc = "Close term in terminal mode | terminal" }) end, { desc = "Close term in terminal mode | terminal" })
end
if vim.g.whichkey_maps then -- whichkey
map("n", "<leader>wK", ":WhichKey <CR>", { desc = "Which-key all keymaps | whichkey" }) map("n", "<leader>wK", "<cmd>WhichKey <CR>", { desc = "Which-key all keymaps | whichkey" })
map("n", "<leader>wk", function()
map("n", "<leader>wk", function()
vim.cmd("WhichKey " .. vim.fn.input "WhichKey: ") vim.cmd("WhichKey " .. vim.fn.input "WhichKey: ")
end, { desc = "Which-key query lookup | whichkey" }) end, { desc = "Which-key query lookup | whichkey" })
end
if vim.g.blankline_maps then map("n", "<leader>cc", function()
map("n", "<leader>cc", function()
local config = { scope = {} } local config = { scope = {} }
config.scope.exclude = { language = {}, node_type = {} } config.scope.exclude = { language = {}, node_type = {} }
config.scope.include = { node_type = {} } config.scope.include = { node_type = {} }
@ -146,7 +119,6 @@ if vim.g.blankline_maps then
vim.api.nvim_feedkeys("_", "n", true) vim.api.nvim_feedkeys("_", "n", true)
end end
end end
end, { desc = "Jump to current context | blankline" }) end, { desc = "Jump to current context | blankline" })
end
pcall(require, "custom.mappings") pcall(require, "custom.mappings")

View File

@ -75,10 +75,12 @@ local options = {
["<C-f>"] = cmp.mapping.scroll_docs(4), ["<C-f>"] = cmp.mapping.scroll_docs(4),
["<C-Space>"] = cmp.mapping.complete(), ["<C-Space>"] = cmp.mapping.complete(),
["<C-e>"] = cmp.mapping.close(), ["<C-e>"] = cmp.mapping.close(),
["<CR>"] = cmp.mapping.confirm { ["<CR>"] = cmp.mapping.confirm {
behavior = cmp.ConfirmBehavior.Insert, behavior = cmp.ConfirmBehavior.Insert,
select = true, select = true,
}, },
["<Tab>"] = cmp.mapping(function(fallback) ["<Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then if cmp.visible() then
cmp.select_next_item() cmp.select_next_item()
@ -87,10 +89,8 @@ local options = {
else else
fallback() fallback()
end end
end, { end, { "i", "s" }),
"i",
"s",
}),
["<S-Tab>"] = cmp.mapping(function(fallback) ["<S-Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then if cmp.visible() then
cmp.select_prev_item() cmp.select_prev_item()
@ -99,10 +99,7 @@ local options = {
else else
fallback() fallback()
end end
end, { end, { "i", "s" }),
"i",
"s",
}),
}, },
sources = { sources = {
{ name = "nvim_lsp" }, { name = "nvim_lsp" },

View File

@ -31,7 +31,11 @@ M.on_attach = function(client, bufnr)
end, opts "List workspace folders | lsp") end, opts "List workspace folders | lsp")
map("n", "<leader>D", vim.lsp.buf.type_definition, opts "Go to type definition | lsp") map("n", "<leader>D", vim.lsp.buf.type_definition, opts "Go to type definition | lsp")
map("n", "<leader>rn", vim.lsp.buf.rename, opts "Rename symbol | lsp")
map("n", "<leader>ra", function()
require "nvchad.renamer"()
end, opts "NvRename symbol | lsp")
map({ "n", "v" }, "<leader>ca", vim.lsp.buf.code_action, opts "Code action | lsp") map({ "n", "v" }, "<leader>ca", vim.lsp.buf.code_action, opts "Code action | lsp")
map("n", "gr", vim.lsp.buf.references, opts "Show references | lsp") map("n", "gr", vim.lsp.buf.references, opts "Show references | lsp")
end end

View File

@ -81,7 +81,7 @@ local default_plugins = {
"lewis6991/gitsigns.nvim", "lewis6991/gitsigns.nvim",
event = "User FilePost", event = "User FilePost",
opts = function() opts = function()
return require("plugins.configs.gitsigns") return require "plugins.configs.gitsigns"
end, end,
config = function(_, opts) config = function(_, opts)
dofile(vim.g.base46_cache .. "git") dofile(vim.g.base46_cache .. "git")