My neovim config
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

at 28454cbe87592ddebd018c4452737dbd0ff47c4f 264 lines 8.3 kB view raw
1local vim = vim 2vim.pack.add({ 3 { src = "https://github.com/stevearc/oil.nvim" }, 4 { src = "https://github.com/nvim-mini/mini.icons" }, 5 { src = "https://github.com/nvim-mini/mini.pick" }, 6 7 { src = "https://github.com/lewis6991/gitsigns.nvim" }, 8 { src = "https://github.com/windwp/nvim-autopairs" }, 9 { src = "https://github.com/j-hui/fidget.nvim" }, 10 { src = "https://github.com/folke/todo-comments.nvim" }, 11 12 -- { src = "https://github.com/numToStr/Comment.nvim" }, 13 14 { src = "https://github.com/saghen/blink.cmp", version = "v1.9.1" }, 15 { src = "https://github.com/rafamadriz/friendly-snippets" }, 16 17 { src = "https://github.com/smoka7/hop.nvim" }, 18 { src = "https://github.com/folke/trouble.nvim" }, 19 -- themes 20 { src = "https://github.com/vague-theme/vague.nvim" }, 21 { src = "https://github.com/IroncladDev/osmium" }, 22 { src = "https://github.com/serhez/teide.nvim" }, 23 { src = "https://github.com/sainnhe/everforest" }, 24 25 -- Mason / Lsp 26 { src = "https://github.com/mason-org/mason.nvim.git" }, 27 { src = "https://github.com/mason-org/mason-lspconfig.nvim.git" }, 28 { src = "https://github.com/neovim/nvim-lspconfig.git" }, 29 { src = "https://github.com/nvim-lua/plenary.nvim" }, 30 { src = "https://github.com/olrtg/nvim-emmet" }, 31 { src = "https://github.com/stevearc/conform.nvim" }, 32 { src = "https://github.com/pmizio/typescript-tools.nvim" }, 33}) 34 35vim.o.number = true 36vim.o.relativenumber = true 37vim.o.mouse = "a" 38vim.o.showmode = false 39vim.o.clipboard = "unnamedplus" 40vim.o.breakindent = true 41vim.o.undofile = true 42vim.o.ignorecase = true 43vim.o.smartcase = true 44vim.o.signcolumn = "yes" 45vim.o.updatetime = 250 46vim.o.timeoutlen = 600 47vim.o.splitright = true 48vim.o.splitbelow = true 49vim.o.inccommand = "split" 50vim.o.cursorline = true 51vim.o.swapfile = false 52vim.o.scrolloff = 10 53vim.o.hlsearch = true 54vim.o.list = true 55vim.o.wrap = false 56vim.o.tabstop = 4 57vim.o.shiftwidth = 4 58vim.opt.listchars = { tab = "» ", trail = "·", nbsp = "" } 59 60vim.g.mapleader = " " 61vim.g.maplocalleader = " " 62vim.g.have_nerd_font = true 63vim.o.winborder = "rounded" 64 65require("osmium").setup({ 66 integrations = { 67 gitsigns = false, 68 telescope = true, 69 indent_blankline = false, 70 fff = false, 71 }, 72 transparent_bg = false, -- whether to use a transparent background 73 show_end_of_buffer = false, -- whether to show the end of buffer 74}) 75 76vim.g.everforest_background = "hard" 77vim.g.everforest_better_performance = 1 78vim.o.background = "dark" 79 80vim.cmd("colorscheme everforest") 81vim.cmd(":hi statusline guibg=NONE") 82 83local keymaps = function() 84 vim.keymap.set("n", "<leader>e", vim.diagnostic.open_float, { desc = "Show diagnostic [E]rror messages" }) 85 vim.keymap.set("n", "<leader>q", vim.diagnostic.setloclist, { desc = "Open diagnostic [Q]uickfix list" }) 86 vim.keymap.set("n", "<leader>fb", "<CMD>Oil<CR>", { desc = "[F]ile [B]rowser" }) 87 vim.keymap.set("n", "<leader>sf", "<CMD>Pick files<CR>", { desc = "[S]earch [F]iles" }) 88 vim.keymap.set("n", "<leader>sg", "<CMD>Pick grep_live<CR>", { desc = "[S]earch by [G]rep" }) 89 vim.keymap.set("n", "<leader>sr", "<CMD>Pick resume<CR>", { desc = "[S]earch [R]esume" }) 90 vim.keymap.set({ "n", "v" }, "<leader>xe", require("nvim-emmet").wrap_with_abbreviation) 91 vim.keymap.set("n", "<leader>ca", vim.lsp.buf.code_action, { desc = "[C]ode [A]ction" }) 92 vim.keymap.set("n", "<leader>rn", vim.lsp.buf.rename, { desc = "[R]e[n]ame" }) 93 vim.keymap.set("n", "gd", vim.lsp.buf.definition, { desc = "[G]oto [D]efinition" }) 94 vim.keymap.set("n", "gr", vim.lsp.buf.references, { desc = "[G]oto [R]eferences" }) 95 vim.keymap.set("n", "gD", vim.lsp.buf.declaration, { desc = "[G]oto [D]eclaration" }) 96 vim.keymap.set("n", "gi", vim.lsp.buf.implementation, { desc = "[G]oto [I]mplementation" }) 97 vim.keymap.set({ "i", "s" }, "<C-j>", function() 98 if vim.snippet.active({ direction = 1 }) then 99 vim.snippet.jump(1) 100 end 101 end, { desc = "Jump snippet next" }) 102 vim.keymap.set({ "i", "s" }, "<C-k>", function() 103 if vim.snippet.active({ direction = -1 }) then 104 vim.snippet.jump(-1) 105 end 106 end, { desc = "Jump snippet back" }) 107end 108 109require("mini.pick").setup({}) 110 111vim.keymap.set("i", "<Tab>", function() 112 if vim.fn.pumvisible() == 1 then 113 return "<C-y>" 114 elseif vim.snippet.active({ direction = 1 }) then 115 return "<Cmd>lua vim.snippet.jump(1)<CR>" 116 else 117 return "<Tab>" 118 end 119end, { expr = true, desc = "Accept completion or jump snippet" }) 120 121local ensure_installed = { 122 lsp = { "lua_ls", "emmet_ls", "oxlint", "tailwindcss" }, 123 treesitter = { "lua", "typescript", "javascript", "tsx", "html", "css", "svelte" }, 124} 125 126local setup_blink = function() 127 require("blink.cmp").setup({ 128 keymap = { preset = "default" }, 129 130 appearance = { 131 -- 'mono' (default) for 'Nerd Font Mono' or 'normal' for 'Nerd Font' 132 -- Adjusts spacing to ensure icons are aligned 133 nerd_font_variant = "mono", 134 }, 135 136 -- (Default) Only show the documentation popup when manually triggered 137 completion = { documentation = { auto_show = true } }, 138 139 -- Default list of enabled providers defined so that you can extend it 140 -- elsewhere in your config, without redefining it, due to `opts_extend` 141 sources = { 142 default = { "lsp", "path", "snippets", "buffer" }, 143 }, 144 145 -- (Default) Rust fuzzy matcher for typo resistance and significantly better performance 146 -- You may use a lua implementation instead by using `implementation = "lua"` or fallback to the lua implementation, 147 -- when the Rust fuzzy matcher is not available, by using `implementation = "prefer_rust"` 148 -- 149 -- See the fuzzy documentation for more information 150 fuzzy = { implementation = "prefer_rust_with_warning" }, 151 }) 152end 153 154local setup_conform = function() 155 require("conform").setup({ 156 format_on_save = { timeout_ms = 500, lsp_fallback = true }, 157 formatters_by_ft = { 158 lua = { "stylua" }, 159 javascript = { "oxfmt", "prettierd", "prettier", stop_after_first = true }, 160 typescript = { "oxfmt", "prettierd", "prettier", stop_after_first = true }, 161 typescriptreact = { "oxfmt", "prettierd", "prettier", stop_after_first = true }, 162 javascriptreact = { "oxfmt", "prettierd", "prettier", stop_after_first = true }, 163 json = { "prettierd", "prettier", stop_after_first = true }, 164 html = { "prettierd", "prettier", stop_after_first = true }, 165 css = { "prettierd", "prettier", stop_after_first = true }, 166 }, 167 }) 168end 169 170local setup_oil = function() 171 ---@module 'oil' 172 ---@type oil.SetupOpts 173 local opts = { 174 default_file_explorer = true, 175 columns = { 176 "icon", 177 }, 178 view_options = { 179 show_hidden = true, 180 is_hidden_file = function(name) 181 return name ~= ".." and vim.startswith(name, ".") 182 end, 183 }, 184 } 185 require("oil").setup(opts) 186 require("mini.icons").setup({}) 187end 188 189-- hop 190local setup_hop = function() 191 local hop = require("hop") 192 local directions = require("hop.hint").HintDirection 193 194 local hopmap = function(key, direction, current_line_only) 195 vim.keymap.set("", key, function() 196 hop.hint_char1({ 197 direction = direction, 198 current_line_only = current_line_only, 199 }) 200 end, { remap = true }) 201 end 202 203 hopmap("f", directions.AFTER_CURSOR, false) 204 hopmap("F", directions.BEFORE_CURSOR, false) 205 hopmap("t", directions.AFTER_CURSOR, true) 206 hopmap("T", directions.BEFORE_CURSOR, true) 207 208 hop.setup({ 209 keys = "etovxqpdygfblzhckisuran", 210 }) 211end 212-- 213 214local setup_treesitter = function() 215 for _, lang in ipairs(ensure_installed.treesitter) do 216 vim.treesitter.language.add(lang) 217 end 218end 219 220local setup_mason_and_lsp = function() 221 require("mason").setup() 222 223 local mason_lspconfig = require("mason-lspconfig") 224 local lspconfig = require("lspconfig") 225 226 local capabilities = require("blink.cmp").get_lsp_capabilities() 227 228 mason_lspconfig.setup({ 229 ensure_installed = ensure_installed.lsp, 230 handlers = { 231 -- default handler for most servers 232 function(server_name) 233 lspconfig[server_name].setup({ 234 capabilities = capabilities, 235 }) 236 end, 237 }, 238 }) 239 240 -- typescript-tools.nvim setup 241 require("typescript-tools").setup({ 242 capabilities = capabilities, 243 settings = { 244 expose_as_code_action = { "all" }, 245 complete_function_calls = true, 246 }, 247 }) 248end 249 250-- Plugin setup 251setup_mason_and_lsp() 252setup_blink() 253 254setup_oil() 255setup_hop() 256setup_treesitter() 257setup_conform() 258keymaps() 259 260require("nvim-autopairs").setup({}) 261require("todo-comments").setup({ signs = false }) 262 263require("debug") 264