-- Abbreviations local opt = vim.opt local map = vim.keymap.set local cmd = vim.cmd -- [[ OPTIONS ]] -- -- Line numbers opt.number = true opt.relativenumber = true -- Status line opt.statusline = "[%n] %<%f %h%w%m%r%=%-14.(%l,%c%V%) %P" -- Block cursor opt.guicursor = "" -- Highlight cursor line opt.cursorline = true -- Set termguicolors opt.termguicolors = true -- 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) -- [[ AUTOCMDS ]] -- -- Highlight copied text vim.api.nvim_create_autocmd("TextYankPost", { callback = function() vim.highlight.on_yank() end }) -- Disable LSP syntax highlight vim.api.nvim_create_autocmd('LspAttach', { group = vim.api.nvim_create_augroup('my.lsp', {}), callback = function(ev) local client = assert(vim.lsp.get_client_by_id(ev.data.client_id)) client.server_capabilities.semanticTokensProvider = nil end }) -- [[ PLUGINS ]] -- -- Install plugins vim.pack.add({ -- Colorscheme "https://github.com/habamax/vim-gruvbit", -- Background trasparency "https://github.com/xiyaowong/transparent.nvim", -- Fuzzy finder "https://github.com/echasnovski/mini.pick", -- Git integration "https://github.com/tpope/vim-fugitive", "https://github.com/lewis6991/gitsigns.nvim", -- Text aligning { src = "https://github.com/Vonr/align.nvim", version = "v2" }, -- Multi cursor "https://github.com/brenton-leighton/multiple-cursors.nvim", -- Trailing whitespace "https://github.com/kaplanz/retrail.nvim", -- Indent blankline "https://github.com/lukas-reineke/indent-blankline.nvim", -- File tree { src = "https://github.com/nvim-neo-tree/neo-tree.nvim", version = vim.version.range("3") }, "https://github.com/nvim-lua/plenary.nvim", "https://github.com/MunifTanjim/nui.nvim", "https://github.com/nvim-tree/nvim-web-devicons", -- LSP "https://github.com/neovim/nvim-lspconfig", "https://github.com/mason-org/mason.nvim", "https://github.com/mason-org/mason-lspconfig.nvim", -- Autocompletion { src = "https://github.com/saghen/blink.cmp", version = "v1" } }) vim.cmd.packadd("nvim.undotree") vim.cmd.packadd("nvim.difftool") -- [[ PLUGINS CONFIGURATIONS ]] -- cmd.colorscheme("gruvbit") require("mini.pick").setup() require("multiple-cursors").setup() require("retrail").setup({ hlgroup = "Error", trim = { auto = false, -- Auto trim on BufWritePre } }) require("ibl").setup() require("neo-tree").setup({ window = { width = 32 } }) require("mason").setup() require("mason-lspconfig").setup() vim.lsp.config("lua_ls", { settings = { Lua = { runtime = { version = "LuaJIT", }, diagnostics = { globals = { "vim", "require" }, }, workspace = { library = vim.api.nvim_get_runtime_file("", true), }, telemetry = { enable = false, } } } }) require("blink.cmp").setup({ fuzzy = { implementation = "lua" } }) -- [[ PLUGIN KEYMAPS ]] -- map("n", "f", ":Pick files") map("n", "b", ":Pick buffers") map("n", "u", ":Undotree") 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") map("n", "grd", vim.diagnostic.open_float)