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.
95 lines
3.1 KiB
Lua
95 lines
3.1 KiB
Lua
vim.g.mapleader = ","
|
|
vim.g.maplocalleader = ","
|
|
|
|
vim.opt.shell = "bash"
|
|
vim.opt.fileformats = { "unix", "dos", "mac" }
|
|
|
|
vim.opt.mouse = "a"
|
|
vim.opt.clipboard = "unnamedplus"
|
|
vim.opt.breakindent = true
|
|
vim.opt.undofile = true
|
|
|
|
vim.opt.updatetime = 250
|
|
vim.opt.timeoutlen = 1000
|
|
|
|
vim.opt.splitright = true
|
|
vim.opt.splitbelow = true
|
|
vim.opt.scrolloff = 8
|
|
|
|
-- vim.opt.autochdir = true
|
|
|
|
-- Tabs
|
|
vim.opt.shiftwidth = 4
|
|
vim.opt.softtabstop = 4
|
|
vim.opt.tabstop = 4
|
|
|
|
-- UI
|
|
vim.opt.matchtime = 2
|
|
vim.opt.number = true
|
|
vim.opt.numberwidth = 4
|
|
vim.opt.relativenumber = true
|
|
vim.opt.showmatch = true
|
|
vim.opt.spelllang = "en_us"
|
|
vim.opt.wildmode = "list:longest"
|
|
vim.opt.cursorline = true
|
|
|
|
-- Indent
|
|
vim.opt.copyindent = true
|
|
vim.opt.preserveindent = true
|
|
vim.opt.smartindent = true
|
|
vim.opt.shiftround = true
|
|
|
|
-- Text Formatting/Layout
|
|
vim.opt.ignorecase = true
|
|
vim.opt.list = true
|
|
vim.opt.listchars = { tab = "» ", trail = "·", nbsp = "␣" }
|
|
vim.opt.inccommand = "split"
|
|
vim.opt.smartcase = true
|
|
vim.opt.wrap = false
|
|
vim.opt.whichwrap:append {
|
|
["<"] = true,
|
|
[">"] = true,
|
|
["["] = true,
|
|
["]"] = true,
|
|
}
|
|
|
|
vim.api.nvim_create_user_command("W", "write", {})
|
|
vim.api.nvim_create_user_command("Q", "qall!", {})
|
|
|
|
-- Create a floating terminal
|
|
vim.api.nvim_create_user_command("FloaTerm", require("core.toggle_terminal"), {
|
|
desc = "Toggle a floating terminal",
|
|
})
|
|
|
|
-- highlight text on copy
|
|
vim.api.nvim_create_autocmd("TextYankPost", {
|
|
desc = "Highlight when yanking (copying) text",
|
|
callback = vim.highlight.on_yank,
|
|
group = vim.api.nvim_create_augroup("kickstart-highlight-yank", {
|
|
clear = true,
|
|
}),
|
|
})
|
|
|
|
local toggle_terminal = require("core.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>")
|