commit 8d5dafc03cb218229eb24db0f433be180ef6cf6e Author: mitrhaCoding Date: Wed May 6 12:05:26 2026 +0200 Initial Commit diff --git a/nvim/init.lua b/nvim/init.lua new file mode 100644 index 0000000..35acba9 --- /dev/null +++ b/nvim/init.lua @@ -0,0 +1,190 @@ +vim.g.mapleader = " " + +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) + +require("lazy").setup({ + { + "goolord/alpha-nvim", + config = function() + local alpha = require("alpha") + local dashboard = require("alpha.themes.dashboard") + + -- ASCII HEADER + dashboard.section.header.val = { + " ", + " ░▒▓███████▓▒░░▒▓████████▓▒░▒▓██████▓▒░░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░▒▓██████████████▓▒░ ", + " ░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░ ░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░▒▓█▓▒░░▒▓█▓▒░░▒▓█▓▒░", + " ░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░ ░▒▓█▓▒░░▒▓█▓▒░░▒▓█▓▒▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░░▒▓█▓▒░░▒▓█▓▒░", + " ░▒▓█▓▒░░▒▓█▓▒░▒▓██████▓▒░░▒▓█▓▒░░▒▓█▓▒░░▒▓█▓▒▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░░▒▓█▓▒░░▒▓█▓▒░", + " ░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░ ░▒▓█▓▒░░▒▓█▓▒░ ░▒▓█▓▓█▓▒░ ░▒▓█▓▒░▒▓█▓▒░░▒▓█▓▒░░▒▓█▓▒░", + " ░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░ ░▒▓█▓▒░░▒▓█▓▒░ ░▒▓█▓▓█▓▒░ ░▒▓█▓▒░▒▓█▓▒░░▒▓█▓▒░░▒▓█▓▒░", + " ░▒▓█▓▒░░▒▓█▓▒░▒▓████████▓▒░▒▓██████▓▒░ ░▒▓██▓▒░ ░▒▓█▓▒░▒▓█▓▒░░▒▓█▓▒░░▒▓█▓▒░", + } + + dashboard.section.buttons.val = { + dashboard.button("f", " Find file", ":Telescope find_files"), + dashboard.button("r", " Recent files", ":Telescope oldfiles"), + dashboard.button("g", " Live grep", ":Telescope live_grep"), + dashboard.button("e", " New file", ":enew"), + dashboard.button("q", " Quit", ":qa"), + } + + alpha.setup(dashboard.config) + end, + }, + { + "nvim-telescope/telescope.nvim", + branch = "0.1.x", + dependencies = { "nvim-lua/plenary.nvim" }, + config = function() + require("telescope").setup({ + defaults = { + preview = { + treesitter = false, + }, + }, + }) + end, + }, + { + "nvim-treesitter/nvim-treesitter", + build = ":TSUpdate", + config = function() + require("nvim-treesitter").setup({ + ensure_installed = { "python", "zig" }, + highlight = { enable = true }, + }) + end, + }, + { + "hrsh7th/nvim-cmp", + dependencies = { + "hrsh7th/cmp-nvim-lsp", + "hrsh7th/cmp-buffer", + "hrsh7th/cmp-path", + }, + config = function() + local cmp = require("cmp") + cmp.setup({ + mapping = cmp.mapping.preset.insert({ + [""] = cmp.mapping.select_next_item(), + [""] = cmp.mapping.select_prev_item(), + [""] = cmp.mapping.confirm({ select = true }), + [""] = cmp.mapping.complete(), + }), + sources = cmp.config.sources({ + { name = "nvim_lsp" }, + { name = "buffer" }, + { name = "path" }, + }), + }) + end, + }, + { + "neovim/nvim-lspconfig", + config = function() + local capabilities = require("cmp_nvim_lsp").default_capabilities() + vim.lsp.config("pyright", { capabilities = capabilities }) + vim.lsp.config("zls", { capabilities = capabilities }) + vim.lsp.enable("pyright") + vim.lsp.enable("zls") + end, + }, + { + "windwp/nvim-autopairs", + event = "InsertEnter", + config = function() + require("nvim-autopairs").setup({}) + end, + }, +}) + + + + + +local terminal_buf = -1 +local terminal_win = -1 + +local function toggle_terminal() + if vim.api.nvim_win_is_valid(terminal_win) then + vim.api.nvim_win_close(terminal_win, false) + terminal_win = -1 + return + end + + vim.cmd("botright 15split") + terminal_win = vim.api.nvim_get_current_win() + + if vim.api.nvim_buf_is_valid(terminal_buf) then + vim.api.nvim_win_set_buf(terminal_win, terminal_buf) + else + vim.cmd("enew") + terminal_buf = vim.api.nvim_get_current_buf() + vim.fn.termopen(os.getenv("SHELL")) + end + + vim.cmd("startinsert") +end + +vim.keymap.set("n", "", toggle_terminal, { desc = "Toggle terminal" }) +vim.keymap.set("t", "", function() + vim.cmd("stopinsert") + toggle_terminal() +end, { desc = "Toggle terminal" }) + + + + + +local function clear_bg() + vim.cmd("highlight Normal guibg=NONE ctermbg=NONE") + vim.cmd("highlight NormalNC guibg=NONE ctermbg=NONE") + vim.cmd("highlight NormalFloat guibg=NONE ctermbg=NONE") + vim.cmd("highlight SignColumn guibg=NONE ctermbg=NONE") + vim.cmd("highlight LineNr guibg=NONE ctermbg=NONE") +end + +clear_bg() + +vim.api.nvim_create_autocmd("ColorScheme", { + pattern = "*", + callback = clear_bg, +}) + + + + + +local opt = vim.opt + +opt.number = true +opt.relativenumber = true +opt.tabstop = 4 +opt.shiftwidth = 4 +opt.expandtab = true +opt.wrap = true +opt.termguicolors = true +opt.mouse = "a" + + + + + +local builtin = require("telescope.builtin") + +vim.keymap.set("n", "ff", builtin.find_files, { desc = "Find files" }) +vim.keymap.set("n", "fg", builtin.live_grep, { desc = "Live grep" }) +vim.keymap.set("n", "fb", builtin.buffers, { desc = "Buffers" }) +vim.keymap.set("n", "ee", ":Ex", { desc = "Open explorer" }) diff --git a/nvim/lazy-lock.json b/nvim/lazy-lock.json new file mode 100644 index 0000000..f4987fe --- /dev/null +++ b/nvim/lazy-lock.json @@ -0,0 +1,12 @@ +{ + "alpha-nvim": { "branch": "main", "commit": "6c6a89d5b068b5251c8bdf0dd57bb921bcfeeb09" }, + "cmp-buffer": { "branch": "main", "commit": "b74fab3656eea9de20a9b8116afa3cfc4ec09657" }, + "cmp-nvim-lsp": { "branch": "main", "commit": "cbc7b02bb99fae35cb42f514762b89b5126651ef" }, + "cmp-path": { "branch": "main", "commit": "c642487086dbd9a93160e1679a1327be111cbc25" }, + "lazy.nvim": { "branch": "main", "commit": "306a05526ada86a7b30af95c5cc81ffba93fef97" }, + "nvim-cmp": { "branch": "main", "commit": "da88697d7f45d16852c6b2769dc52387d1ddc45f" }, + "nvim-lspconfig": { "branch": "master", "commit": "4b7fbaa239c5db6b36f424a4521ca9f1a401be33" }, + "nvim-treesitter": { "branch": "main", "commit": "4d9466677a5ceadef104eaa0fe08d60d91c4e9a7" }, + "plenary.nvim": { "branch": "master", "commit": "b9fd5226c2f76c951fc8ed5923d85e4de065e509" }, + "telescope.nvim": { "branch": "0.1.x", "commit": "a0bbec21143c7bc5f8bb02e0005fa0b982edc026" } +}