require("config.lazy") require("config.terminal") require("config.lsp") vim.g.have_nerd_font = true vim.g.loaded_node_provider = 0 vim.g.loaded_perl_provider = 0 vim.g.loaded_python3_provider = 0 vim.g.loaded_ruby_provider = 0 -- Set the terminal window title to the filename being edited. -- This helps with using ROFI to find the vim window. vim.o.title = true vim.o.writebackup = false vim.o.undofile = true vim.o.undodir = vim.fn.expand("~/.local/share/nvim-v2/undodir") vim.o.colorcolumn = "125" vim.o.showmode = false vim.o.showtabline = 2 vim.wo.signcolumn = "yes" vim.wo.cursorline = true vim.wo.cursorcolumn = false vim.keymap.set("n", "uc", "set cursorcolumn!", { desc = "Toggle cursor column" }) vim.opt.number = true vim.opt.relativenumber = true vim.o.expandtab = true -- Automatic toggling between line number modes -- Source: https://jeffkreeftmeijer.com/vim-number/ vim.cmd [[ augroup NumberToggle autocmd! autocmd BufEnter,FocusGained,InsertLeave,WinEnter * if &nu && mode() != "i" | set rnu | endif autocmd BufLeave,FocusLost,InsertEnter,WinLeave * if &nu | set nornu | endif augroup END ]] vim.opt.splitright = true vim.opt.splitbelow = true vim.opt.scrolloff = 1 vim.opt.list = true vim.opt.listchars = { tab = "▸ ", trail = "·", precedes = "←", extends = "→" } vim.opt.hlsearch = true vim.opt.smartcase = true vim.opt.smartindent = true vim.opt.shiftwidth = 2 vim.keymap.set("n", "", "nohlsearch") vim.keymap.set("n", "s", function() vim.cmd[[wall]] vim.notify("Changed buffers saved.") end, { desc = "Save all changed buffers" }) -- When I forgot that vim is o insert mode. vim.keymap.set("i", "jj", "") if vim.fn.has("termguicolors") then vim.o.termguicolors = true end -- External Clipboard vim.keymap.set("v", "y", '"+y', { desc = "Copy to system clipboard register" }) vim.keymap.set("n", "p", '"+p', { desc = "Paste from system clipboard register" }) vim.keymap.set("n", "q", "bprevious | bdelete #", { desc = "Close current buffer" }) vim.keymap.set("n", "", "bprevious", { desc = "Previous buffer" }) vim.keymap.set("n", "", "bnext", { desc = "Next buffer" }) vim.keymap.set("n", "-", "Oil", { desc = "Open Oil" }) -- Easier matched history navigation in command mode. vim.keymap.set("c", "", "") vim.keymap.set("c", "", "") -- Quickfix and location list navigation. vim.keymap.set("n", "", "zz") vim.keymap.set("n", "", "zz") vim.keymap.set("n", "", "cnextzz") vim.keymap.set("n", "", "cprevzz") vim.keymap.set("n", "j", "lnextzz", { desc = "Next location list item" }) vim.keymap.set("n", "k", "lprevzz", { desc = "Previous location list item" }) vim.api.nvim_create_autocmd("TextYankPost", { desc = "Highlight when yanking text", group = vim.api.nvim_create_augroup("highlight-yank", { clear = true }), callback = function() vim.highlight.on_yank() end, }) vim.keymap.set("n", "", function() local path = vim.fn.expand("%:~:.") local line = vim.fn.line(".") vim.fn.setreg("+", path .. ":" .. line) vim.notify("Copied '" .. path .. "' line " .. line .. " to the clipboard.") end, { desc = 'Copy relative file path with current line number to clipboard.' })