local lazypath = vim.fn.stdpath("data") .. "/site/pack/packer/start/lazy.nvim" if not vim.loop.fs_stat(lazypath) then vim.fn.system({ "git", "clone", "https://github.com/folke/lazy.nvim.git", lazypath, }) end vim.opt.rtp:prepend(lazypath) require("lazy").setup({ { "windwp/nvim-autopairs", event = "InsertEnter", config = function() require("nvim-autopairs").setup({}) end, }, { "nvim-treesitter/nvim-treesitter", build = ":TSUpdate", }, { "rose-pine/neovim", name = "rose-pine", config = function() vim.cmd("colorscheme rose-pine") end, }, { "stevearc/conform.nvim", opts = {}, }, { "stevearc/oil.nvim", opts = {}, }, { "numToStr/Comment.nvim", opts = {}, lazy = false, }, { "lewis6991/gitsigns.nvim" }, { "neovim/nvim-lspconfig" }, { "hrsh7th/nvim-cmp" }, { "hrsh7th/cmp-nvim-lsp" }, { "hrsh7th/cmp-buffer" }, { "hrsh7th/cmp-path" }, { "saadparwaiz1/cmp_luasnip" }, { "L3MON4D3/LuaSnip" }, { "rafamadriz/friendly-snippets" }, }) local cmp = require("cmp") cmp.setup({ snippet = { expand = function(args) require("luasnip").lsp_expand(args.body) -- Use LuaSnip for snippets end, }, mapping = { [""] = cmp.mapping.select_prev_item(), [""] = cmp.mapping.select_next_item(), [""] = cmp.mapping.scroll_docs(-4), [""] = cmp.mapping.scroll_docs(4), [""] = cmp.mapping.complete(), [""] = cmp.mapping.close(), [""] = cmp.mapping.confirm({ select = true }), }, sources = { { name = "nvim_lsp" }, -- LSP completion { name = "buffer" }, -- Buffer completion { name = "path" }, -- Path completion { name = "luasnip" }, -- Snippet completion }, }) -- nvim-lspconfig - Providing basic, default Nvim LSP client configurations for various LSP servers. local lspconfig = require("lspconfig") lspconfig.pyright.setup({}) lspconfig.ts_ls.setup({}) lspconfig.gopls.setup({}) lspconfig.bashls.setup({}) local luasnip = require("luasnip") require("luasnip.loaders.from_vscode").lazy_load() require("luasnip").config.set_config({ history = true, updateevents = "TextChanged,TextChangedI", }) -- line numbers vim.wo.number = true vim.wo.relativenumber = true -- Comment.vim - Smart and Powerful commenting plugin for neovim require("Comment").setup() -- conform.nvim - Lightweight yet powerful formatter plugin for neovim require("conform").setup({ formatters_by_ft = { lua = { "stylua" }, python = { "isort", "black" }, rust = { "rustfmt" }, javascript = { "prettier" }, html = { "prettier" }, go = { "gofmt" }, bash = { "shfmt" }, }, format_on_save = { timeout_ms = 500, lsp_format = "fallback", }, }) -- Hyprlang LSP vim.api.nvim_create_autocmd({ "BufEnter", "BufWinEnter" }, { pattern = { "*.hl", "hypr*.conf" }, callback = function(event) vim.lsp.start({ name = "hyprlang", cmd = { "hyprls" }, root_dir = vim.fn.getcwd(), }) end, }) -- enable diagnostics vim.diagnostic.config({ virtual_text = { prefix = "▎", }, severity_sort = true, float = { source = "always", }, }) -- save and format on insertleave vim.api.nvim_create_autocmd({ "InsertLeave", "FocusLost" }, { pattern = "*", callback = function() require("conform").format() vim.cmd("silent! write") end, }) -- aliases vim.keymap.set("ca", "o", "tabnew") -- remove editor background -- vim.cmd([[ -- highlight Normal guibg=none -- highlight NonText guibg=none -- highlight Normal ctermbg=none -- highlight NonText ctermbg=none -- ]])