-- Abbreviations local opt = vim.opt local map = vim.keymap.set local cmd = vim.cmd -- [[ OPTIONS ]] -- -- Line numbers opt.number = true opt.relativenumber = true -- Block cursor opt.guicursor = "" -- File options opt.undofile = true opt.undodir = os.getenv("HOME") .. "/.vim/nvim_undodir" opt.swapfile = false opt.backup = false opt.fixendofline = false -- Tabs opt.tabstop = 4 opt.softtabstop = 4 opt.shiftwidth = 4 opt.expandtab = true opt.breakindent = true -- Search opt.ignorecase = true opt.smartcase = true opt.incsearch = true map("n", "", "nohlsearch") -- Columns opt.signcolumn = "yes" opt.textwidth = 78 -- RFC 5322 opt.colorcolumn = "79" -- Auto complete opt.completeopt = { "menuone", "popup" --[[, "noselect" ]] } -- Window border opt.winborder = "rounded" -- [[ KEYMAPS ]] -- -- Leader key vim.g.mapleader = " " vim.g.maplocalleader = " " -- Clipboard map({ "n", "v" }, "y", "\"+y") -- Deletions map({ "n", "v" }, "d", "\"_d") map("n", "md", ":delmarks!") -- Commands map("n", "x", ":!chmod +x %") map("n", "cd", ":cd %:h | pwd") -- Tabs map("n", "tt", ":tabnew") map("n", "tw", ":tabclose") map("n", "tn", ":tabnext") map("n", "tp", ":tabprevious") map("n", "tf", ":tabfirst") map("n", "tl", ":tablast") -- Buffers map("n", "n", ":enew") map("n", "db", ":bdelete") map("n", "", ":bnext") map("n", "", ":bprevious") map("n", "\\", ":buffer term") map("t", "", "") -- Indentation in visual mode map("v", "<", "", ">gv") -- Move text in visual mode map("v", "J", ":move '>+1gv=gv") map("v", "K", ":move '<-2gv=gv") -- Run last command in terminal map("n", "r", ":buffer termi") -- Window movement map("n", "", "h") map("n", "", "j") map("n", "", "k") map("n", "", "l") map("t", "", "wincmd h") map("t", "", "wincmd j") map("t", "", "wincmd k") map("t", "", "wincmd l") -- Window resizing map("n", "", "resize -2") map("n", "", "resize +2") map("n", "", "vertical resize -2") map("n", "", "vertical resize +2") -- Listchars opt.listchars = { -- eol = "$", tab = "» ", space = "·", trail = "-" } -- Toggle listchars map("n", "lc", function() vim.wo.list = not vim.wo.list end) -- [[ PLUGINS ]] -- -- Bootstrap lazy.nvim 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 vim.api.nvim_echo({ { "Failed to clone lazy.nvim:\n", "ErrorMsg" }, { out, "WarningMsg" }, { "\nPress any key to exit..." }, }, true, {}) vim.fn.getchar() os.exit(1) end end opt.rtp:prepend(lazypath) -- Plugins require("lazy").setup({ -- Colorscheme { "vague-theme/vague.nvim" }, -- Background trasparency { "xiyaowong/transparent.nvim" }, -- Treesitter { "nvim-treesitter/nvim-treesitter" }, -- Fuzzy finder { "echasnovski/mini.pick", opts = {} }, -- Advanced undo tree { "mbbill/undotree" }, -- Git integration { "tpope/vim-fugitive" }, { "lewis6991/gitsigns.nvim", opts = {} }, -- Text aligning { "Vonr/align.nvim", branch = "v2" }, -- Multi cursor { "brenton-leighton/multiple-cursors.nvim", opts = {} }, -- Trailing whitespace { "kaplanz/retrail.nvim", opts = { hlgroup = "Error", trim = { auto = false, -- Auto trim on BufWritePre } } }, -- Indent blankline { "lukas-reineke/indent-blankline.nvim", main = "ibl", opts = {} }, -- File tree { "nvim-neo-tree/neo-tree.nvim", branch = "v3.x", dependencies = { "nvim-lua/plenary.nvim", "MunifTanjim/nui.nvim", "nvim-tree/nvim-web-devicons", }, lazy = false, -- neo-tree will lazily load itself opts = { window = { width = 32 } } } }) -- Colorscheme cmd.colorscheme("vague") -- Plugin keymaps map("n", "f", ":Pick files") map("n", "b", ":Pick buffers") map("n", "u", ":UndotreeToggle") map("n", "gs", ":Git") map("n", "gt", ":Gitsigns toggle_signs") map("n", "gp", ":Gitsigns preview_hunk") map("n", "gb", ":Gitsigns toggle_current_line_blame") map("x", "al", function() require("align").align_to_string({ preview = true, regex = true }) end) map({ "n", "x" }, "", "MultipleCursorsAddDown") map({ "n", "x" }, "", "MultipleCursorsAddUp") map({ "n", "i", "x" }, "", "MultipleCursorsAddUp") map({ "n", "i", "x" }, "", "MultipleCursorsAddDown") map({ "n", "i" }, "", "MultipleCursorsMouseAddDelete") map({ "n", "v", "x" }, "", "MultipleCursorsAddJumpNextMatch") map({ "n", "x" }, "D", "MultipleCursorsJumpNextMatch") map("n", "|", function() require("multiple-cursors").align() end) map("n", "p", "Neotree toggle")