parent
3b5f1bd42a
commit
4f4c43a2b9
@ -1,122 +1,122 @@
|
|||||||
local map = vim.keymap.set
|
local map = vim.keymap.set
|
||||||
|
|
||||||
map("i", "<C-b>", "<ESC>^i", { desc = "Move Beginning of line" })
|
map("i", "<C-b>", "<ESC>^i", { desc = "move beginning of line" })
|
||||||
map("i", "<C-e>", "<End>", { desc = "Move End of line" })
|
map("i", "<C-e>", "<End>", { desc = "move end of line" })
|
||||||
map("i", "<C-h>", "<Left>", { desc = "Move Left" })
|
map("i", "<C-h>", "<Left>", { desc = "move left" })
|
||||||
map("i", "<C-l>", "<Right>", { desc = "Move Right" })
|
map("i", "<C-l>", "<Right>", { desc = "move right" })
|
||||||
map("i", "<C-j>", "<Down>", { desc = "Move Down" })
|
map("i", "<C-j>", "<Down>", { desc = "move down" })
|
||||||
map("i", "<C-k>", "<Up>", { desc = "Move Up" })
|
map("i", "<C-k>", "<Up>", { desc = "move up" })
|
||||||
|
|
||||||
map("n", "<Esc>", "<cmd>noh<CR>", { desc = "General Clear highlights" })
|
map("n", "<Esc>", "<cmd>noh<CR>", { desc = "general clear highlights" })
|
||||||
|
|
||||||
map("n", "<C-h>", "<C-w>h", { desc = "Switch Window left" })
|
map("n", "<C-h>", "<C-w>h", { desc = "switch window left" })
|
||||||
map("n", "<C-l>", "<C-w>l", { desc = "Switch Window right" })
|
map("n", "<C-l>", "<C-w>l", { desc = "switch window right" })
|
||||||
map("n", "<C-j>", "<C-w>j", { desc = "Switch Window down" })
|
map("n", "<C-j>", "<C-w>j", { desc = "switch window down" })
|
||||||
map("n", "<C-k>", "<C-w>k", { desc = "Switch Window up" })
|
map("n", "<C-k>", "<C-w>k", { desc = "switch window up" })
|
||||||
|
|
||||||
map("n", "<C-s>", "<cmd>w<CR>", { desc = "File Save" })
|
map("n", "<C-s>", "<cmd>w<CR>", { desc = "file save" })
|
||||||
map("n", "<C-c>", "<cmd>%y+<CR>", { desc = "File Copy whole" })
|
map("n", "<C-c>", "<cmd>%y+<CR>", { desc = "file copy whole" })
|
||||||
|
|
||||||
map("n", "<leader>n", "<cmd>set nu!<CR>", { desc = "Toggle Line number" })
|
map("n", "<leader>n", "<cmd>set nu!<CR>", { desc = "toggle line number" })
|
||||||
map("n", "<leader>rn", "<cmd>set rnu!<CR>", { desc = "Toggle Relative number" })
|
map("n", "<leader>rn", "<cmd>set rnu!<CR>", { desc = "toggle relative number" })
|
||||||
map("n", "<leader>ch", "<cmd>NvCheatsheet<CR>", { desc = "Toggle NvCheatsheet" })
|
map("n", "<leader>ch", "<cmd>NvCheatsheet<CR>", { desc = "toggle nvcheatsheet" })
|
||||||
|
|
||||||
map("n", "<leader>fm", function()
|
map("n", "<leader>fm", function()
|
||||||
require("conform").format { lsp_fallback = true }
|
require("conform").format { lsp_fallback = true }
|
||||||
end, { desc = "Format Files" })
|
end, { desc = "format files" })
|
||||||
|
|
||||||
-- global lsp mappings
|
-- global lsp mappings
|
||||||
map("n", "<leader>lf", vim.diagnostic.open_float, { desc = "Lsp floating diagnostics" })
|
map("n", "<leader>lf", vim.diagnostic.open_float, { desc = "lsp floating diagnostics" })
|
||||||
map("n", "[d", vim.diagnostic.goto_prev, { desc = "Lsp prev diagnostic" })
|
map("n", "[d", vim.diagnostic.goto_prev, { desc = "lsp prev diagnostic" })
|
||||||
map("n", "]d", vim.diagnostic.goto_next, { desc = "Lsp next diagnostic" })
|
map("n", "]d", vim.diagnostic.goto_next, { desc = "lsp next diagnostic" })
|
||||||
map("n", "<leader>q", vim.diagnostic.setloclist, { desc = "Lsp diagnostic loclist" })
|
map("n", "<leader>q", vim.diagnostic.setloclist, { desc = "lsp diagnostic loclist" })
|
||||||
|
|
||||||
-- tabufline
|
-- tabufline
|
||||||
map("n", "<leader>b", "<cmd>enew<CR>", { desc = "Buffer New" })
|
map("n", "<leader>b", "<cmd>enew<CR>", { desc = "buffer new" })
|
||||||
|
|
||||||
map("n", "<tab>", function()
|
map("n", "<tab>", function()
|
||||||
require("nvchad.tabufline").next()
|
require("nvchad.tabufline").next()
|
||||||
end, { desc = "Buffer Goto next" })
|
end, { desc = "buffer goto next" })
|
||||||
|
|
||||||
map("n", "<S-tab>", function()
|
map("n", "<S-tab>", function()
|
||||||
require("nvchad.tabufline").prev()
|
require("nvchad.tabufline").prev()
|
||||||
end, { desc = "Buffer Goto prev" })
|
end, { desc = "buffer goto prev" })
|
||||||
|
|
||||||
map("n", "<leader>x", function()
|
map("n", "<leader>x", function()
|
||||||
require("nvchad.tabufline").close_buffer()
|
require("nvchad.tabufline").close_buffer()
|
||||||
end, { desc = "Buffer Close" })
|
end, { desc = "buffer close" })
|
||||||
|
|
||||||
-- Comment
|
-- Comment
|
||||||
map("n", "<leader>/", function()
|
map("n", "<leader>/", function()
|
||||||
require("Comment.api").toggle.linewise.current()
|
require("Comment.api").toggle.linewise.current()
|
||||||
end, { desc = "Comment Toggle" })
|
end, { desc = "comment toggle" })
|
||||||
|
|
||||||
map(
|
map(
|
||||||
"v",
|
"v",
|
||||||
"<leader>/",
|
"<leader>/",
|
||||||
"<ESC><cmd>lua require('Comment.api').toggle.linewise(vim.fn.visualmode())<CR>",
|
"<ESC><cmd>lua require('Comment.api').toggle.linewise(vim.fn.visualmode())<CR>",
|
||||||
{ desc = "Comment Toggle" }
|
{ desc = "comment toggle" }
|
||||||
)
|
)
|
||||||
|
|
||||||
-- nvimtree
|
-- nvimtree
|
||||||
map("n", "<C-n>", "<cmd>NvimTreeToggle<CR>", { desc = "Nvimtree Toggle window" })
|
map("n", "<C-n>", "<cmd>NvimTreeToggle<CR>", { desc = "nvimtree toggle window" })
|
||||||
map("n", "<leader>e", "<cmd>NvimTreeFocus<CR>", { desc = "Nvimtree Focus window" })
|
map("n", "<leader>e", "<cmd>NvimTreeFocus<CR>", { desc = "nvimtree focus window" })
|
||||||
|
|
||||||
-- telescope
|
-- telescope
|
||||||
map("n", "<leader>fw", "<cmd>Telescope live_grep<CR>", { desc = "Telescope Live grep" })
|
map("n", "<leader>fw", "<cmd>Telescope live_grep<CR>", { desc = "telescope live grep" })
|
||||||
map("n", "<leader>fb", "<cmd>Telescope buffers<CR>", { desc = "Telescope Find buffers" })
|
map("n", "<leader>fb", "<cmd>Telescope buffers<CR>", { desc = "telescope find buffers" })
|
||||||
map("n", "<leader>fh", "<cmd>Telescope help_tags<CR>", { desc = "Telescope Help page" })
|
map("n", "<leader>fh", "<cmd>Telescope help_tags<CR>", { desc = "telescope help page" })
|
||||||
map("n", "<leader>ma", "<cmd>Telescope marks<CR>", { desc = "Telescope Find marks" })
|
map("n", "<leader>ma", "<cmd>Telescope marks<CR>", { desc = "telescope find marks" })
|
||||||
map("n", "<leader>fo", "<cmd>Telescope oldfiles<CR>", { desc = "Telescope Find oldfiles" })
|
map("n", "<leader>fo", "<cmd>Telescope oldfiles<CR>", { desc = "telescope find oldfiles" })
|
||||||
map("n", "<leader>fz", "<cmd>Telescope current_buffer_fuzzy_find<CR>", { desc = "Telescope Find in current buffer" })
|
map("n", "<leader>fz", "<cmd>Telescope current_buffer_fuzzy_find<CR>", { desc = "telescope find in current buffer" })
|
||||||
map("n", "<leader>cm", "<cmd>Telescope git_commits<CR>", { desc = "Telescope Git commits" })
|
map("n", "<leader>cm", "<cmd>Telescope git_commits<CR>", { desc = "telescope git commits" })
|
||||||
map("n", "<leader>gt", "<cmd>Telescope git_status<CR>", { desc = "Telescope Git status" })
|
map("n", "<leader>gt", "<cmd>Telescope git_status<CR>", { desc = "telescope git status" })
|
||||||
map("n", "<leader>pt", "<cmd>Telescope terms<CR>", { desc = "Telescope Pick hidden term" })
|
map("n", "<leader>pt", "<cmd>Telescope terms<CR>", { desc = "telescope pick hidden term" })
|
||||||
map("n", "<leader>th", "<cmd>Telescope themes<CR>", { desc = "Telescope Nvchad themes" })
|
map("n", "<leader>th", "<cmd>Telescope themes<CR>", { desc = "telescope nvchad themes" })
|
||||||
map("n", "<leader>ff", "<cmd>Telescope find_files<cr>", { desc = "Telescope Find files" })
|
map("n", "<leader>ff", "<cmd>Telescope find_files<cr>", { desc = "telescope find files" })
|
||||||
map(
|
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 = "Telescope Find all files" }
|
{ desc = "telescope find all files" }
|
||||||
)
|
)
|
||||||
|
|
||||||
-- terminal
|
-- terminal
|
||||||
map("t", "<C-x>", "<C-\\><C-N>", { desc = "Terminal Escape terminal mode" })
|
map("t", "<C-x>", "<C-\\><C-N>", { desc = "terminal escape terminal mode" })
|
||||||
|
|
||||||
-- new terminals
|
-- new terminals
|
||||||
map("n", "<leader>h", function()
|
map("n", "<leader>h", function()
|
||||||
require("nvchad.term").new { pos = "sp" }
|
require("nvchad.term").new { pos = "sp" }
|
||||||
end, { desc = "Terminal New horizontal term" })
|
end, { desc = "terminal new horizontal term" })
|
||||||
|
|
||||||
map("n", "<leader>v", function()
|
map("n", "<leader>v", function()
|
||||||
require("nvchad.term").new { pos = "vsp" }
|
require("nvchad.term").new { pos = "vsp" }
|
||||||
end, { desc = "Terminal New vertical window" })
|
end, { desc = "terminal new vertical window" })
|
||||||
|
|
||||||
-- toggleable
|
-- toggleable
|
||||||
map({ "n", "t" }, "<A-v>", function()
|
map({ "n", "t" }, "<A-v>", function()
|
||||||
require("nvchad.term").toggle { pos = "vsp", id = "vtoggleTerm" }
|
require("nvchad.term").toggle { pos = "vsp", id = "vtoggleTerm" }
|
||||||
end, { desc = "Terminal Toggleable vertical term" })
|
end, { desc = "terminal toggleable vertical term" })
|
||||||
|
|
||||||
map({ "n", "t" }, "<A-h>", function()
|
map({ "n", "t" }, "<A-h>", function()
|
||||||
require("nvchad.term").toggle { pos = "sp", id = "htoggleTerm" }
|
require("nvchad.term").toggle { pos = "sp", id = "htoggleTerm" }
|
||||||
end, { desc = "Terminal New horizontal term" })
|
end, { desc = "terminal new horizontal term" })
|
||||||
|
|
||||||
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 = "Terminal Toggle Floating term" })
|
end, { desc = "terminal toggle floating term" })
|
||||||
|
|
||||||
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 = "Terminal Close term in terminal mode" })
|
end, { desc = "terminal close term in terminal mode" })
|
||||||
|
|
||||||
-- whichkey
|
-- whichkey
|
||||||
map("n", "<leader>wK", "<cmd>WhichKey <CR>", { desc = "Whichkey all keymaps" })
|
map("n", "<leader>wK", "<cmd>WhichKey <CR>", { desc = "whichkey all keymaps" })
|
||||||
|
|
||||||
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 = "Whichkey query lookup" })
|
end, { desc = "whichkey query lookup" })
|
||||||
|
|
||||||
-- blankline
|
-- blankline
|
||||||
map("n", "<leader>cc", function()
|
map("n", "<leader>cc", function()
|
||||||
@ -132,4 +132,4 @@ map("n", "<leader>cc", function()
|
|||||||
vim.api.nvim_feedkeys("_", "n", true)
|
vim.api.nvim_feedkeys("_", "n", true)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end, { desc = "Blankline Jump to current context" })
|
end, { desc = "blankline jump to current context" })
|
||||||
|
@ -125,12 +125,12 @@ return {
|
|||||||
{
|
{
|
||||||
"numToStr/Comment.nvim",
|
"numToStr/Comment.nvim",
|
||||||
keys = {
|
keys = {
|
||||||
{ "gcc", mode = "n", desc = "Comment toggle current line" },
|
{ "gcc", mode = "n", desc = "comment toggle current line" },
|
||||||
{ "gc", mode = { "n", "o" }, desc = "Comment toggle linewise" },
|
{ "gc", mode = { "n", "o" }, desc = "comment toggle linewise" },
|
||||||
{ "gc", mode = "x", desc = "Comment toggle linewise (visual)" },
|
{ "gc", mode = "x", desc = "comment toggle linewise (visual)" },
|
||||||
{ "gbc", mode = "n", desc = "Comment toggle current block" },
|
{ "gbc", mode = "n", desc = "comment toggle current block" },
|
||||||
{ "gb", mode = { "n", "o" }, desc = "Comment toggle blockwise" },
|
{ "gb", mode = { "n", "o" }, desc = "comment toggle blockwise" },
|
||||||
{ "gb", mode = "x", desc = "Comment toggle blockwise (visual)" },
|
{ "gb", mode = "x", desc = "comment toggle blockwise (visual)" },
|
||||||
},
|
},
|
||||||
config = function(_, opts)
|
config = function(_, opts)
|
||||||
require("Comment").setup(opts)
|
require("Comment").setup(opts)
|
||||||
|
Loading…
Reference in New Issue
Block a user