local vim = vim vim.pack.add({ { src = "https://github.com/stevearc/oil.nvim" }, { src = "https://github.com/nvim-mini/mini.icons" }, { src = "https://github.com/nvim-mini/mini.pick" }, { src = "https://github.com/saghen/blink.cmp", version = "v1.9.1" }, { src = "https://github.com/rafamadriz/friendly-snippets" }, { src = "https://github.com/smoka7/hop.nvim" }, { src = "https://github.com/folke/trouble.nvim" }, -- themes { src = "https://github.com/vague-theme/vague.nvim" }, { src = "https://github.com/IroncladDev/osmium" }, { src = "https://github.com/serhez/teide.nvim" }, -- Mason / Lsp { src = "https://github.com/mason-org/mason.nvim.git" }, { src = "https://github.com/mason-org/mason-lspconfig.nvim.git" }, { src = "https://github.com/neovim/nvim-lspconfig.git" }, { src = "https://github.com/nvim-lua/plenary.nvim" }, { src = "https://github.com/pmizio/typescript-tools.nvim" }, { src = "https://github.com/olrtg/nvim-emmet" }, { src = "https://github.com/stevearc/conform.nvim" }, }) vim.o.number = true vim.o.relativenumber = true vim.o.mouse = "a" vim.o.showmode = false vim.o.clipboard = "unnamedplus" vim.o.breakindent = true vim.o.undofile = true vim.o.ignorecase = true vim.o.smartcase = true vim.o.signcolumn = "yes" vim.o.updatetime = 250 vim.o.timeoutlen = 600 vim.o.splitright = true vim.o.splitbelow = true vim.o.inccommand = "split" vim.o.cursorline = true vim.o.swapfile = false vim.o.scrolloff = 10 vim.o.hlsearch = true vim.o.list = true vim.o.wrap = false vim.o.tabstop = 4 vim.o.shiftwidth = 4 vim.opt.listchars = { tab = "» ", trail = "·", nbsp = "␣" } vim.g.mapleader = " " vim.g.maplocalleader = " " vim.g.have_nerd_font = true vim.o.winborder = "rounded" require("osmium").setup({ integrations = { gitsigns = false, telescope = true, indent_blankline = false, fff = false, }, transparent_bg = false, -- whether to use a transparent background show_end_of_buffer = false, -- whether to show the end of buffer }) vim.cmd("colorscheme osmium") vim.cmd(":hi statusline guibg=NONE") local keymaps = function() vim.keymap.set("n", "e", vim.diagnostic.open_float, { desc = "Show diagnostic [E]rror messages" }) vim.keymap.set("n", "q", vim.diagnostic.setloclist, { desc = "Open diagnostic [Q]uickfix list" }) vim.keymap.set("n", "fb", "Oil", { desc = "[F]ile [B]rowser" }) vim.keymap.set("n", "sf", "Pick files", { desc = "[S]earch [F]iles" }) vim.keymap.set("n", "sg", "Pick grep_live", { desc = "[S]earch by [G]rep" }) vim.keymap.set("n", "sr", "Pick resume", { desc = "[S]earch [R]esume" }) vim.keymap.set({ "n", "v" }, "xe", require("nvim-emmet").wrap_with_abbreviation) vim.keymap.set("n", "ca", vim.lsp.buf.code_action, { desc = "[C]ode [A]ction" }) vim.keymap.set("n", "rn", vim.lsp.buf.rename, { desc = "[R]e[n]ame" }) vim.keymap.set("n", "gd", vim.lsp.buf.definition, { desc = "[G]oto [D]efinition" }) vim.keymap.set("n", "gr", vim.lsp.buf.references, { desc = "[G]oto [R]eferences" }) vim.keymap.set("n", "gD", vim.lsp.buf.declaration, { desc = "[G]oto [D]eclaration" }) vim.keymap.set("n", "gi", vim.lsp.buf.implementation, { desc = "[G]oto [I]mplementation" }) vim.keymap.set({ "i", "s" }, "", function() if vim.snippet.active({ direction = 1 }) then vim.snippet.jump(1) end end, { desc = "Jump snippet next" }) vim.keymap.set({ "i", "s" }, "", function() if vim.snippet.active({ direction = -1 }) then vim.snippet.jump(-1) end end, { desc = "Jump snippet back" }) end require("mini.pick").setup({}) vim.keymap.set("i", "", function() if vim.fn.pumvisible() == 1 then return "" elseif vim.snippet.active({ direction = 1 }) then return "lua vim.snippet.jump(1)" else return "" end end, { expr = true, desc = "Accept completion or jump snippet" }) local ensure_installed = { lsp = { "lua_ls", "emmet_ls", "oxlint", "tailwindcss" }, treesitter = { "lua", "typescript", "javascript", "tsx", "html", "css" }, } local setup_blink = function() require("blink.cmp").setup({ keymap = { preset = "default" }, appearance = { -- 'mono' (default) for 'Nerd Font Mono' or 'normal' for 'Nerd Font' -- Adjusts spacing to ensure icons are aligned nerd_font_variant = "mono", }, -- (Default) Only show the documentation popup when manually triggered completion = { documentation = { auto_show = true } }, -- Default list of enabled providers defined so that you can extend it -- elsewhere in your config, without redefining it, due to `opts_extend` sources = { default = { "lsp", "path", "snippets", "buffer" }, }, -- (Default) Rust fuzzy matcher for typo resistance and significantly better performance -- You may use a lua implementation instead by using `implementation = "lua"` or fallback to the lua implementation, -- when the Rust fuzzy matcher is not available, by using `implementation = "prefer_rust"` -- -- See the fuzzy documentation for more information fuzzy = { implementation = "prefer_rust" }, }) end local setup_conform = function() require("conform").setup({ format_on_save = { timeout_ms = 500, lsp_fallback = true }, formatters_by_ft = { lua = { "stylua" }, javascript = { "oxfmt", "prettierd", "prettier", stop_after_first = true }, typescript = { "oxfmt", "prettierd", "prettier", stop_after_first = true }, typescriptreact = { "oxfmt", "prettierd", "prettier", stop_after_first = true }, javascriptreact = { "oxfmt", "prettierd", "prettier", stop_after_first = true }, json = { "prettierd", "prettier", stop_after_first = true }, html = { "prettierd", "prettier", stop_after_first = true }, css = { "prettierd", "prettier", stop_after_first = true }, }, }) end local setup_oil = function() ---@module 'oil' ---@type oil.SetupOpts local opts = { default_file_explorer = true, columns = { "icon", }, view_options = { show_hidden = true, is_hidden_file = function(name) return name ~= ".." and vim.startswith(name, ".") end, }, } require("oil").setup(opts) require("mini.icons").setup({}) end local setup_mason = function() require("mason").setup() require("mason-lspconfig").setup({ ensure_installed = ensure_installed.lsp, }) end -- hop local setup_hop = function() local hop = require("hop") local directions = require("hop.hint").HintDirection local hopmap = function(key, direction, current_line_only) vim.keymap.set("", key, function() hop.hint_char1({ direction = direction, current_line_only = current_line_only, }) end, { remap = true }) end hopmap("f", directions.AFTER_CURSOR, false) hopmap("F", directions.BEFORE_CURSOR, false) hopmap("t", directions.AFTER_CURSOR, true) hopmap("T", directions.BEFORE_CURSOR, true) hop.setup({ keys = "etovxqpdygfblzhckisuran", }) end -- local setup_treesitter = function() for _, lang in ipairs(ensure_installed.treesitter) do vim.treesitter.language.add(lang) end end local setup_typescript_tools = function() require("typescript-tools").setup({}) end -- Plugin setup setup_mason() setup_oil() setup_hop() setup_treesitter() setup_conform() setup_typescript_tools() setup_blink() keymaps()