You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

24 lines
1.6 KiB
Lua

require("core.commands")
local toggle_terminal = require("core.lib.toggle_terminal")
vim.keymap.set("n", "<leader>l", ":nohlsearch<CR>", { desc = "clear highlighted search" })
vim.keymap.set("n", "<leader>ts", [[:%s/\s\s*$//g<CR>]], { desc = "[T]rim trailing [S]pace" })
vim.keymap.set("n", "<leader>ss", ":setlocal spell!<CR>", { desc = "[S]et [S]pell" })
vim.keymap.set("n", "<leader>p", ":set paste!<CR>", { desc = "[P]aste" })
vim.keymap.set("n", "<leader>nn", ":set nonumber norelativenumber<CR>", { desc = "[N]o [N]umber removed number and relative number" })
vim.keymap.set("n", "<leader>rn", ":set number relativenumber<CR>", { desc = "[R]elative [N]umber - set relative number and absolute number" })
vim.keymap.set("n", "[d", vim.diagnostic.goto_prev, { desc = "Go to previous [D]iagnostic message" })
vim.keymap.set("n", "]d", vim.diagnostic.goto_next, { desc = "Go to next [D]iagnostic message" })
vim.keymap.set("n", "<leader>e", vim.diagnostic.open_float, { desc = "Show diagnostic [E]rror messages" })
vim.keymap.set("n", "<leader>q", vim.diagnostic.setloclist, { desc = "Open diagnopstic [Q]uickfix list" })
-- Use <Ctrl-h/j/k/l> to move between windows, no need for <Ctrl-w> first
vim.keymap.set("n", "<C-j>", "<C-w><C-j>", { desc = "Move focus up window" })
vim.keymap.set("n", "<C-k>", "<C-w><C-k>", { desc = "Move focus down window" })
vim.keymap.set("n", "<C-h>", "<C-w><C-h>", { desc = "Move focus left window" })
vim.keymap.set("n", "<C-l>", "<C-w><C-l>", { desc = "Move focus right window" })
vim.keymap.set({ "n", "t" }, "<leader>tt", toggle_terminal)
vim.keymap.set("t", "<esc><esc>", "<c-\\><c-n>")