vim.g.mapleader = ' ' vim.g.maplocalleader = ' ' -- This is the basics of the config local lazypath = vim.fn.stdpath 'data' .. '/lazy/lazy.nvim' if not vim.loop.fs_stat(lazypath) then vim.fn.system { 'git', 'clone', '--filter=blob:none', 'https://github.com/folke/lazy.nvim.git', '--branch=stable', -- latest stable release lazypath, } end vim.opt.rtp:prepend(lazypath) local get_root_dir = function(fname) local util = require("lspconfig.util") return util.root_pattern(".git")(fname) or util.root_pattern("package.json", "tsconfig.json")(fname) end require('lazy').setup({ -- Git related plugins 'tpope/vim-fugitive', 'tpope/vim-rhubarb', -- Detect tabstop and shiftwidth automatically 'tpope/vim-sleuth', { -- LSP Configuration & Plugins 'neovim/nvim-lspconfig', dependencies = { -- Automatically install LSPs to stdpath for neovim 'williamboman/mason.nvim', 'williamboman/mason-lspconfig.nvim', -- Useful status updates for LSP -- NOTE: `opts = {}` is the same as calling `require('fidget').setup({})` { 'j-hui/fidget.nvim', tag = 'legacy', opts = {} }, -- NOTE(taras) WTF is this 'folke/neodev.nvim', }, opts = { servers = { eslint = { root_dir = get_root_dir, }, tsserver = { root_dir = get_root_dir, single_file_support = false, }, }, }, }, { -- Autocompletion 'hrsh7th/nvim-cmp', dependencies = { -- Snippet Engine & its associated nvim-cmp source 'L3MON4D3/LuaSnip', 'saadparwaiz1/cmp_luasnip', 'hrsh7th/cmp-nvim-lsp', 'rafamadriz/friendly-snippets', }, }, { -- Adds git related signs to the gutter, as well as utilities for managing changes -- See `:help gitsigns.txt` 'lewis6991/gitsigns.nvim', opts = { signs = { add = { text = '+' }, change = { text = '~' }, delete = { text = '_' }, topdelete = { text = '‾' }, changedelete = { text = '~' }, }, on_attach = function(bufnr) vim.keymap.set('n', 'hp', require('gitsigns').preview_hunk, { buffer = bufnr, desc = 'Preview git hunk' }) -- don't override the built-in and fugitive keymaps local gs = package.loaded.gitsigns vim.keymap.set({ 'n', 'v' }, ']c', function() if vim.wo.diff then return ']c' end vim.schedule(function() gs.next_hunk() end) return '' end, { expr = true, buffer = bufnr, desc = 'Jump to next hunk' }) vim.keymap.set({ 'n', 'v' }, '[c', function() if vim.wo.diff then return '[c' end vim.schedule(function() gs.prev_hunk() end) return '' end, { expr = true, buffer = bufnr, desc = 'Jump to previous hunk' }) end, }, }, { 'github/copilot.vim', config = function() vim.cmd [[ imap