-- NOTE: Must happen before plugins are loaded (otherwise wrong leader will be used) vim.g.mapleader = ' ' vim.g.maplocalleader = ' ' vim.g.have_nerd_font = true -- [[ Setting options ]] -- See `:help vim.o` -- For more options, you can see `:help option-list` vim.o.number = true vim.o.relativenumber = true -- Enable mouse mode, can be useful for resizing splits vim.o.mouse = 'a' vim.o.showmode = false -- Enable break indent vim.o.breakindent = true -- Save undo history vim.o.undofile = true -- Case-insensitive searching UNLESS \C or one or more capital letters in the search term vim.o.ignorecase = true vim.o.smartcase = true -- Keep signcolumn on by default vim.o.signcolumn = 'yes' -- Decrease update time vim.o.updatetime = 250 -- Decrease mapped sequence wait time vim.o.timeoutlen = 300 -- Configure how new splits should be opened vim.o.splitright = true vim.o.splitbelow = true -- Sets how neovim will display certain whitespace characters in the editor. -- See `:help 'list'` -- and `:help 'listchars'` -- -- Notice listchars is set using `vim.opt` instead of `vim.o`. -- It is very similar to `vim.o` but offers an interface for conveniently interacting with tables. -- See `:help lua-options` -- and `:help lua-options-guide` vim.o.list = true vim.opt.listchars = { tab = '» ', trail = '·', nbsp = '␣' } -- Preview substitutions live, as you type! vim.o.inccommand = 'split' -- Show which line your cursor is on vim.o.cursorline = true -- Minimal number of screen lines to keep above and below the cursor. vim.o.scrolloff = 10 vim.o.confirm = true -- [[ Keymaps ]] vim.keymap.set('n', '', 'nohlsearch') vim.keymap.set('n', 'q', vim.diagnostic.setloclist, { desc = 'Open diagnostic [Q]uickfix list' }) vim.keymap.set('n', '', '', { desc = 'Move focus to the left window' }) vim.keymap.set('n', '', '', { desc = 'Move focus to the right window' }) vim.keymap.set('n', '', '', { desc = 'Move focus to the lower window' }) vim.keymap.set('n', '', '', { desc = 'Move focus to the upper window' }) -- [[ Basic Autocommands ]] vim.api.nvim_create_autocmd('TextYankPost', { desc = 'Highlight when yanking (copying) text', group = vim.api.nvim_create_augroup('kickstart-highlight-yank', { clear = true }), callback = function() vim.hl.on_yank() end, }) -- [[ Install `lazy.nvim` plugin manager ]] local lazypath = vim.fn.stdpath 'data' .. '/lazy/lazy.nvim' if not (vim.uv or vim.loop).fs_stat(lazypath) then local lazyrepo = 'https://github.com/folke/lazy.nvim.git' local out = vim.fn.system { 'git', 'clone', '--filter=blob:none', '--branch=stable', lazyrepo, lazypath } if vim.v.shell_error ~= 0 then error('Error cloning lazy.nvim:\n' .. out) end end ---@type vim.Option local rtp = vim.opt.rtp rtp:prepend(lazypath) require('util.plugin').lazy_file() -- [[ Configure and install plugins ]] require('lazy').setup 'plugins' vim.cmd.colorscheme 'catppuccin' vim.keymap.set('n', '-', 'Oil', { desc = 'Open parent directory' }) vim.api.nvim_create_autocmd('BufWritePost', { pattern = { '*.tex', '*.rmd', '*.ms' }, callback = function() vim.fn.systemlist(vim.fn.expandcmd 'compiler %:p') end, }) vim.keymap.set('n', 'c', function() vim.fn.systemlist(vim.fn.expandcmd 'compiler %:p') end) -- The line beneath this is called `modeline`. See `:help modeline` -- vim: ts=2 sts=2 sw=2 et