-- Basic Settings - just throwing some text here to update the status vim.opt.number = true vim.opt.relativenumber = true vim.opt.mouse = 'a' vim.opt.ignorecase = true vim.opt.smartcase = true vim.opt.hlsearch = false vim.opt.wrap = false vim.opt.tabstop = 4 vim.opt.shiftwidth = 4 vim.opt.expandtab = true vim.opt.termguicolors = true vim.opt.cursorline = true vim.opt.signcolumn = 'yes' -- Leader key vim.g.mapleader = ' ' -- Bootstrap lazy.nvim 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", lazypath, }) end vim.opt.rtp:prepend(lazypath) -- Plugins require("lazy").setup({ -- Color scheme { "catppuccin/nvim", name = "catppuccin", priority = 1000, config = function() vim.cmd.colorscheme "catppuccin-mocha" end, }, -- File explorer { "nvim-tree/nvim-tree.lua", dependencies = { "nvim-tree/nvim-web-devicons" }, config = function() require("nvim-tree").setup() end, }, -- Fuzzy finder { "nvim-telescope/telescope.nvim", dependencies = { "nvim-lua/plenary.nvim" }, config = function() require("telescope").setup() end, }, { "stevearc/conform.nvim", opts = { format_on_save = { timeout_ms = 1000, lsp_fallback = true }, formatters_by_ft = { javascript = { "prettierd", "prettier" }, javascriptreact = { "prettierd", "prettier" }, typescript = { "prettierd", "prettier" }, typescriptreact = { "prettierd", "prettier" }, json = { "prettierd", "prettier" }, css = { "prettierd", "prettier" }, html = { "prettierd", "prettier" }, markdown = { "prettierd", "prettier" }, }, }, }, -- Syntax highlighting { "nvim-treesitter/nvim-treesitter", build = ":TSUpdate", config = function() require("nvim-treesitter.configs").setup({ ensure_installed = { "lua", "vim", "bash", "javascript", "typescript", "tsx", "json", "yaml", "html", "css", "prisma", "graphql" }, highlight = { enable = true }, indent = { enable = true }, }) end, }, -- Autocompletion { "hrsh7th/nvim-cmp", dependencies = { "hrsh7th/cmp-buffer", "hrsh7th/cmp-path", "L3MON4D3/LuaSnip", "saadparwaiz1/cmp_luasnip", }, config = function() local cmp = require("cmp") cmp.setup({ snippet = { expand = function(args) require("luasnip").lsp_expand(args.body) end, }, mapping = cmp.mapping.preset.insert({ [''] = cmp.mapping.complete(), [''] = cmp.mapping.confirm({ select = true }), [''] = cmp.mapping.select_next_item(), [''] = cmp.mapping.select_prev_item(), }), sources = { { name = 'buffer' }, { name = 'path' }, }, }) end, }, -- plugins (append to your lazy setup) { "williamboman/mason.nvim", build = ":MasonUpdate", config = true, }, { "williamboman/mason-lspconfig.nvim" }, { "neovim/nvim-lspconfig", dependencies = { "williamboman/mason.nvim", "williamboman/mason-lspconfig.nvim", "hrsh7th/cmp-nvim-lsp", }, }, { "pmizio/typescript-tools.nvim", dependencies = { "nvim-lua/plenary.nvim", "neovim/nvim-lspconfig" }, }, { "rafamadriz/friendly-snippets" }, { "NvChad/nvim-colorizer.lua", opts = { user_default_options = { names = false } } }, { "luckasRanarison/tailwind-tools.nvim", opts = { document_color = { enabled = true } } }, -- Status line { "nvim-lualine/lualine.nvim", dependencies = { "nvim-tree/nvim-web-devicons" }, config = function() require("lualine").setup({ options = { theme = "catppuccin" }, }) end, }, }) -- Key mappings local keymap = vim.keymap.set -- File explorer keymap('n', 'e', ':NvimTreeToggle', { desc = "Toggle file explorer" }) -- Fuzzy finder keymap('n', 'ff', 'Telescope find_files', { desc = "Find files" }) keymap('n', 'fg', 'Telescope live_grep', { desc = "Live grep" }) keymap('n', 'fb', 'Telescope buffers', { desc = "Find buffers" }) -- Better window navigation keymap('n', '', 'h') keymap('n', '', 'j') keymap('n', '', 'k') keymap('n', '', 'l') -- Quick save and quit keymap('n', 'w', ':w', { desc = "Save" }) keymap('n', 'q', ':q', { desc = "Quit" }) -- cmp: add LSP and snippets to your existing config local cmp = require("cmp") local luasnip = require("luasnip") require("luasnip.loaders.from_vscode").lazy_load() local lsp = require("cmp_nvim_lsp") local capabilities = lsp.default_capabilities() cmp.setup({ snippet = { expand = function(args) luasnip.lsp_expand(args.body) end }, mapping = cmp.mapping.preset.insert({ [""] = cmp.mapping.complete(), [""] = cmp.mapping.confirm({ select = true }), [""] = cmp.mapping.select_next_item(), [""] = cmp.mapping.select_prev_item(), }), sources = { { name = "nvim_lsp" }, { name = "path" }, { name = "buffer" }, { name = "luasnip" }, }, }) -- LSP setup require("mason").setup() require("mason-lspconfig").setup({ ensure_installed = { "ts_ls", "eslint", "jsonls", "html", "cssls", "tailwindcss" }, }) -- TypeScript require("typescript-tools").setup({ settings = { tsserver_file_preferences = { includeInlayParameterNameHints = "all", includeCompletionsForModuleExports = true }, }, })