vim.g.mapleader = ',' vim.g.maplocalleader = ',' vim.opt.fileformats = { 'unix', 'dos', 'mac' } vim.opt.mouse = 'a' vim.opt.clipboard = 'unnamedplus' vim.opt.breakindent = true vim.opt.undofile = true vim.opt.signcolumn = 'yes' vim.opt.updatetime = 250 vim.opt.timeoutlen = 300 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!', {}) vim.keymap.set('n', 'l', ':nohlsearch', { desc = 'clear highlighted search' }) vim.keymap.set('n', 'ts', [[:%s/\s\s*$//g]], { desc = '[T]rim trailing [S]pace' }) vim.keymap.set('n', 'ss', ':setlocal spell!', { desc = '[S]et [S]pell' }) vim.keymap.set('n', 'p', ':set paste!', { desc = '[P]aste' }) vim.keymap.set('n', 'nn', ':set nonumber norelativenumber', { desc = '[N]o [N]umber removed number and relative number' }) vim.keymap.set('n', 'rn', ':set number relativenumber', { 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', 'e', vim.diagnostic.open_float, { desc = 'Show diagnostic [E]rror messages' }) vim.keymap.set('n', 'q', vim.diagnostic.setloclist, { desc = 'Open diagnopstic [Q]uickfix list' }) -- Use to move between windows, no need for first vim.keymap.set('n', '', '', { desc = 'Move focus up window' }) vim.keymap.set('n', '', '', { desc = 'Move focus down window' }) vim.keymap.set('n', '', '', { desc = 'Move focus left window' }) vim.keymap.set('n', '', '', { desc = 'Move focus right window' }) -- highlight text on copy vim.api.nvim_create_autocmd('TextYankPost', { desc = 'Highlight when yanking (copying) text', group = vim.api.nvim_create_augroup('kickstart-highlight-yank', { clear = true }), callback = vim.highlight.on_yank, })