From 2ae62e2359fca61a838b2b1c160cf690e88eb442 Mon Sep 17 00:00:00 2001 From: rattatwinko Date: Fri, 13 Jun 2025 11:24:20 +0200 Subject: [PATCH] visually updated by A LOT! made it readable and "modifiable" --- init.lua | 221 +++++++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 174 insertions(+), 47 deletions(-) diff --git a/init.lua b/init.lua index 1a171f0..d1ad847 100644 --- a/init.lua +++ b/init.lua @@ -5,7 +5,7 @@ vim.g.mapleader = " " vim.g.maplocalleader = " " --- Editor Settings (unchanged from previous) +-- Editor Settings vim.opt.number = true vim.opt.relativenumber = true vim.opt.mouse = "a" @@ -36,6 +36,9 @@ vim.opt.swapfile = false vim.opt.backup = false vim.opt.writebackup = false +-- Smoother scrolling +vim.opt.smoothscroll = true + -- ====================== -- 2. Plugin Management -- ====================== @@ -54,7 +57,7 @@ end vim.opt.rtp:prepend(lazypath) -- ====================== --- 3. Plugin Specifications +-- 3. Plugin Specifications (Updated) -- ====================== local plugins = { @@ -76,7 +79,7 @@ local plugins = { }, -- Fuzzy Finder - { "nvim-telescope/telescope.nvim", dependencies = { "nvim-lua/plenary.nvim" } }, + { "nvim-telescope/telescope.nvim", dependencies = { "nvim-lua/plenary.nvim" } }, -- LSP Configuration { @@ -108,51 +111,120 @@ local plugins = { { "windwp/nvim-autopairs", event = "InsertEnter", - config = function() - require("nvim-autopairs").setup({ - check_ts = true, - ts_config = { - lua = { "string", "source" }, - javascript = { "string", "template_string" }, - typescript = { "string", "template_string" }, - }, - disable_filetype = { "TelescopePrompt", "spectre_panel" }, - fast_wrap = { - map = "", - chars = { "{", "[", "(", '"', "'", "<" }, - pattern = [=[[%'%"%)%>%]%)%}%,]]=], - end_key = "$", - highlight = "Search", - highlight_grey = "Comment", - }, - }) - - local cmp_autopairs = require("nvim-autopairs.completion.cmp") - local cmp = require("cmp") - cmp.event:on("confirm_done", cmp_autopairs.on_confirm_done()) - end, + config = true, }, -- Git Integration - { "lewis6991/gitsigns.nvim", opts = {} }, + { "lewis6991/gitsigns.nvim", opts = {} }, { "tpope/vim-fugitive" }, - { "kdheepak/lazygit.nvim", dependencies = { "nvim-lua/plenary.nvim" } }, - { "akinsho/git-conflict.nvim", version = "*" }, + { "kdheepak/lazygit.nvim", dependencies = { "nvim-lua/plenary.nvim" } }, + { "akinsho/git-conflict.nvim", version = "*" }, -- UI Enhancements - { "nvim-lualine/lualine.nvim", dependencies = { "nvim-tree/nvim-web-devicons" } }, - { "akinsho/bufferline.nvim", version = "*", dependencies = "nvim-tree/nvim-web-devicons" }, - { "lukas-reineke/indent-blankline.nvim", main = "ibl", opts = {} }, + { + "nvim-lualine/lualine.nvim", + dependencies = { "nvim-tree/nvim-web-devicons" }, + opts = { + options = { + theme = "palenight", + component_separators = { left = '', right = '' }, + section_separators = { left = '', right = '' }, + } + }, + }, + + -- Modern tab/bufferline with animations + { + "akinsho/bufferline.nvim", + version = "*", + dependencies = "nvim-tree/nvim-web-devicons", + opts = { + options = { + mode = "tabs", + diagnostics = "nvim_lsp", + always_show_bufferline = true, + show_close_icon = false, + color_icons = true, + offsets = { + { + filetype = "neo-tree", + text = "File Explorer", + highlight = "Directory", + text_align = "left", + }, + }, + hover = { + enabled = true, + delay = 200, + reveal = { 'close' } + }, + } + } + }, + + -- Better split resizing with animations + { + "anuvyklack/windows.nvim", + dependencies = { + "anuvyklack/middleclass", + "anuvyklack/animation.nvim" + }, + config = function() + vim.o.winwidth = 10 + vim.o.winminwidth = 10 + vim.o.equalalways = false + require('windows').setup({ + autowidth = { + enable = true, + winwidth = 10, + filetype = { + help = 2, + }, + }, + ignore = { + buftype = { 'quickfix' }, + filetype = { 'NvimTree', 'neo-tree', 'undotree', 'gundo' } + }, + animation = { + enable = true, + duration = 300, + fps = 30, + easing = 'in_out_sine' + } + }) + end + }, + + -- Better indent guides + { + "lukas-reineke/indent-blankline.nvim", + main = "ibl", + opts = { + indent = { char = "│" }, + scope = { enabled = true }, + } + }, -- Syntax & Editing - { "nvim-treesitter/nvim-treesitter", build = ":TSUpdate" }, - { "numToStr/Comment.nvim", opts = {} }, + { "nvim-treesitter/nvim-treesitter", build = ":TSUpdate" }, + { "numToStr/Comment.nvim", opts = {} }, -- Productivity - { "akinsho/toggleterm.nvim", version = "*", config = true }, - { "folke/which-key.nvim", event = "VimEnter" }, + { "akinsho/toggleterm.nvim", version = "*", config = true }, + { "folke/which-key.nvim", event = "VimEnter" }, { "stevearc/conform.nvim" }, - { "mfussenegger/nvim-lint", event = { "BufReadPre", "BufNewFile" } }, + { "mfussenegger/nvim-lint", event = { "BufReadPre", "BufNewFile" } }, + + -- Smooth scrolling + { "karb94/neoscroll.nvim", config = true }, + + -- Better notifications + { + "rcarriga/nvim-notify", + config = function() + vim.notify = require("notify") + end + } } -- ====================== @@ -173,12 +245,12 @@ require("lazy").setup(plugins, { source = "📄", start = "🚀", task = "📌", - lazy = "💤", + lazy = "💤 ", }, }, }) --- Neo-tree Configuration with Keymaps +-- Neo-tree Configuration require("neo-tree").setup({ close_if_last_window = false, popup_border_style = "rounded", @@ -193,7 +265,7 @@ require("neo-tree").setup({ position = "right", width = 30, mappings = { - [""] = "none", -- disable space as it's our leader key + [""] = "none", ["o"] = "open", [""] = "open", ["t"] = "open_tabnew", @@ -209,7 +281,7 @@ require("neo-tree").setup({ }, }) --- Telescope Configuration with Keymaps +-- Telescope Configuration require("telescope").setup({ defaults = { mappings = { @@ -225,6 +297,20 @@ require("telescope").setup({ [""] = "close", }, }, + layout_strategy = "flex", + layout_config = { + horizontal = { + preview_width = 0.6, + }, + }, + }, + pickers = { + find_files = { + theme = "dropdown", + }, + live_grep = { + theme = "dropdown", + }, }, }) @@ -313,7 +399,7 @@ cmp.setup({ }) -- ====================== --- 5. Key Mappings +-- 5. Key Mappings (Enhanced) -- ====================== -- 🚀 General Keybinds @@ -340,11 +426,31 @@ vim.keymap.set("n", "wa", vim.lsp.buf.add_workspace_folder) vim.keymap.set("n", "wr", vim.lsp.buf.remove_workspace_folder) vim.keymap.set("n", "wl", function() print(vim.inspect(vim.lsp.buf.list_workspace_folders())) end) --- 💾 Buffer Management +-- 💾 Buffer/Tab Management vim.keymap.set("n", "bd", ":bdelete") -vim.keymap.set("n", "bn", ":bnext") -vim.keymap.set("n", "bp", ":bprevious") +vim.keymap.set("n", "bn", ":BufferLineCycleNext") +vim.keymap.set("n", "bp", ":BufferLineCyclePrev") vim.keymap.set("n", "bl", ":Telescope buffers") +vim.keymap.set("n", "1", ":BufferLineGoToBuffer 1") +vim.keymap.set("n", "2", ":BufferLineGoToBuffer 2") +vim.keymap.set("n", "3", ":BufferLineGoToBuffer 3") +vim.keymap.set("n", "4", ":BufferLineGoToBuffer 4") +vim.keymap.set("n", "5", ":BufferLineGoToBuffer 5") + +-- 🖥️ Window Management +vim.keymap.set("n", "", "h") +vim.keymap.set("n", "", "j") +vim.keymap.set("n", "", "k") +vim.keymap.set("n", "", "l") + +-- Split resizing with Ctrl+Arrow keys +vim.keymap.set("n", "", ":resize +2") +vim.keymap.set("n", "", ":resize -2") +vim.keymap.set("n", "", ":vertical resize -2") +vim.keymap.set("n", "", ":vertical resize +2") + +-- Maximize current split +vim.keymap.set("n", "wm", ":WindowsMaximize") -- 🐱 Git vim.keymap.set("n", "gc", ":Git commit") @@ -354,8 +460,8 @@ vim.keymap.set("n", "gd", ":Gdiff") vim.keymap.set("n", "gb", ":Git blame") -- 🔄 Terminal -vim.keymap.set("t", "", "") -- Escape terminal mode -vim.keymap.set("t", "", "") -- Alternative escape +vim.keymap.set("t", "", "") +vim.keymap.set("t", "", "") vim.keymap.set("n", "tt", ":ToggleTerm") vim.keymap.set("n", "tf", ":ToggleTerm direction=float") @@ -381,4 +487,25 @@ require("nvim-treesitter.configs").setup({ ensure_installed = { "lua", "python", "javascript", "typescript", "html", "css", "bash", "json", "yaml" }, highlight = { enable = true }, indent = { enable = true }, + incremental_selection = { + enable = true, + keymaps = { + init_selection = "gnn", + node_incremental = "grn", + scope_incremental = "grc", + node_decremental = "grm", + }, + }, }) + +-- Enable smooth scrolling +require('neoscroll').setup({ + mappings = { '', '', '', '' }, + hide_cursor = true, + stop_eof = true, + respect_scrolloff = false, + cursor_scrolls_alone = true, +}) + +-- Enable better window management +require('windows').setup()