-- neovim/vim variables local opt = vim.opt local keybind = vim.keymap.set -- basic opt.relativenumber = true opt.number = true opt.termguicolors = true -- indentation opt.tabstop = 2 opt.softtabstop = 0 opt.shiftwidth = 2 opt.smarttab = true opt.smartindent = true -- searches opt.incsearch = true -- mapleader vim.g.mapleader = " " -- custom lua functions local function toggle_diagnostics() local qf = vim.fn.getqflist({ winid = 0 }) if qf.winid ~= 0 then vim.cmd("cclose") else vim.diagnostic.setqflist({ open = true }) end end -- keybinds keybind("n", "hh", toggle_diagnostics, { desc = "LSP Diagonistics" }) -- buffer keybinds keybind("n", "bb", "bprevious", { desc = "Switch to previous buffer" }) keybind("n", "nn", "bnext", { desc = "Switch to next buffer" }) keybind("n", ",,", "bdel", { desc = "Delete Buffer" }) -- visual mode keybinds keybind("v", "ii", '"+y', { desc = "Copy to clipboard ( + yank)" }) keybind("v", "<", "", ">gv", { desc = "Indent right and reselect" }) keybind("v", "", ":m '<-2gv", { desc = "Move selection up" }) keybind("v", "", ":m '>+1gv", { desc = "Move selection down" }) -- friend keybinds keybind("i", "jk", "", { desc = "Keybind set for Justin" }) -- file explorer keybind("n", "mm", "Neotree toggle filesystem dir=%:p:h", { desc = "Toggle File Explorer" }) keybind("n", "jj", "Neotree action=focus", { desc = "Focus on file explorer" }) -- telescope.nvim (search.lua) keybind("n", "ff", "Telescope find_files", { desc = "Find Files" }) keybind("n", "fg", "Telescope live_grep", { desc = "Live Grep" }) keybind("n", "fb", "Telescope buffers", { desc = "Show Buffers" }) keybind("n", "fh", "Telescope help_tags", { desc = "Help Tags" }) -- venv select keybind("n", ",v", "VenvSelect", { desc = "Finds the python venv" }) -- remote connection keybind("n", ";;", "RemoteStart") -- open floating terminal -- to see toggling, see: dev-utils.lua under toggleterm.nvim -- wrap around pairs -- see: dev-utils.lua under nvim-autopairs -- file handling opt.backup = false opt.writebackup = false opt.swapfile = false opt.undofile = true opt.undodir = vim.fn.expand("~/.nvim/undodir") opt.autoread = true -- custom functions -- disable automatic commenting upon using vim.api.nvim_create_autocmd("FileType", { callback = function() vim.opt_local.formatoptions:remove("r") end, })