From 7f1416d7c6774e10b529ec3604b5d67fbd7c583f Mon Sep 17 00:00:00 2001 From: admin Date: Mon, 16 Jun 2025 00:10:41 +0200 Subject: Initial commit --- .config/nvim/lua/configs.lua | 396 +++++++++++++++++++++++++++++++++++++ .config/nvim/lua/core/autocmds.lua | 98 +++++++++ .config/nvim/lua/core/keymaps.lua | 120 +++++++++++ .config/nvim/lua/core/options.lua | 37 ++++ .config/nvim/lua/plugins.lua | 208 +++++++++++++++++++ 5 files changed, 859 insertions(+) create mode 100755 .config/nvim/lua/configs.lua create mode 100755 .config/nvim/lua/core/autocmds.lua create mode 100755 .config/nvim/lua/core/keymaps.lua create mode 100755 .config/nvim/lua/core/options.lua create mode 100755 .config/nvim/lua/plugins.lua (limited to '.config/nvim/lua') diff --git a/.config/nvim/lua/configs.lua b/.config/nvim/lua/configs.lua new file mode 100755 index 0000000..cb8c952 --- /dev/null +++ b/.config/nvim/lua/configs.lua @@ -0,0 +1,396 @@ +-- Plugin configurations +-- All plugin-specific settings are configured here + +-------------------------------- +-- TELESCOPE +-------------------------------- +local function setup_telescope() + local actions = require("telescope.actions") + + -- Function to open selected file in external program + local function open_in_external_program(prompt_bufnr) + local entry = require('telescope.actions.state').get_selected_entry() + local file_path = entry.path or entry.filename + if file_path then + os.execute(string.format('start "" "%s"', file_path)) + else + print("No file selected") + end + actions.close(prompt_bufnr) + end + + require('telescope').setup({ + defaults = { + layout_config = { + vertical = { width = 0.5 } + }, + mappings = { + n = { + ["q"] = actions.close, + ["o"] = open_in_external_program, + }, + i = { + [""] = actions.close, + [""] = actions.cycle_history_next, + [""] = actions.cycle_history_prev, + [""] = actions.move_selection_next, + [""] = actions.move_selection_previous, + [""] = open_in_external_program, + } + }, + }, + pickers = { + live_grep = { + file_ignore_patterns = { 'node_modules', '.git', '.venv' }, + additional_args = function(_) + return { "--hidden" } + end + }, + find_files = { + file_ignore_patterns = { 'node_modules', '.git', '.venv' }, + hidden = true + } + } + }) +end + +-------------------------------- +-- HARPOON +-------------------------------- +local function setup_harpoon() + local harpoon = require("harpoon") + -- Initialize harpoon + harpoon:setup({ + settings = { + save_on_toggle = true, + sync_on_ui_close = true, + } + }) +end + +-------------------------------- +-- OIL +-------------------------------- +local function setup_oil() + require("oil").setup({ + -- Default file explorer settings + default_file_explorer = true, + -- Columns to display + columns = { "icon" }, + -- Buffer options + buf_options = { + buflisted = false, + bufhidden = "hide", + }, + -- Window options + win_options = { + wrap = false, + signcolumn = "no", + cursorcolumn = false, + foldcolumn = "0", + spell = false, + list = false, + conceallevel = 3, + concealcursor = "nvic", + }, + -- File operations + delete_to_trash = true, + skip_confirm_for_simple_edits = false, + prompt_save_on_select_new_entry = true, + cleanup_delay_ms = 2000, + -- UI behavior + constrain_cursor = "editable", + watch_for_changes = false, + -- Custom keymaps + keymaps = { + ["g?"] = "actions.show_help", + [""] = "actions.select", + [""] = { "actions.select", opts = { vertical = true } }, + [""] = { "actions.select", opts = { horizontal = true } }, + [""] = "actions.preview", + [""] = "actions.close", + [""] = "actions.refresh", + ["-"] = "actions.parent", + ["_"] = "actions.open_cwd", + ["`"] = "actions.cd", + ["~"] = { "actions.cd", opts = { scope = "tab" } }, + ["gs"] = "actions.change_sort", + [""] = "actions.open_external", + ["g."] = "actions.toggle_hidden", + ["g\\"] = "actions.toggle_trash", + ['yp'] = { + desc = 'Copy filepath to system clipboard', + callback = function () + require('oil.actions').copy_entry_path.callback() + vim.fn.setreg("+", vim.fn.getreg(vim.v.register)) + end, + }, + }, + -- Disable default keymaps + use_default_keymaps = false, + -- View options + view_options = { + show_hidden = false, + natural_order = true, + case_insensitive = false, + sort = { + { "type", "asc" }, + { "name", "asc" }, + }, + }, + -- Preview window settings + preview = { + max_width = 0.9, + min_width = { 40, 0.4 }, + max_height = 0.9, + min_height = { 5, 0.1 }, + border = "rounded", + win_options = { winblend = 0 }, + }, + -- Floating window settings + float = { + padding = 2, + max_width = 0, + max_height = 0, + border = "rounded", + win_options = { winblend = 0 }, + }, + }) +end + +-------------------------------- +-- TOGGLETERM +-------------------------------- +local function setup_toggleterm() + require("toggleterm").setup({ + -- Shell to use in the terminal + shell = "pwsh.exe -NoLogo", + -- Display options + direction = "float", + float_opts = { + border = "rounded", + }, + -- Window appearance + winbar = { + enabled = false + }, + -- Behavior + start_in_insert = true, + close_on_exit = true, + -- Integration with tmux + persist_size = true, + persist_mode = true, + }) +end + +-------------------------------- +-- TREESITTER +-------------------------------- +local function setup_treesitter() + require('nvim-treesitter.configs').setup({ + ensure_installed = { "c", "lua", "vim", "vimdoc", "cpp", "python" }, + sync_install = false, + auto_install = false, + highlight = { enable = true }, + indent = { enable = true }, + }) +end + +-------------------------------- +-- COMMENTS +-------------------------------- +local function setup_comments() + require('Comment').setup({ + padding = true, + sticky = true, + ignore = nil, + toggler = { + line = '/', + block = 'gbc', + }, + opleader = { + line = '/', + block = 'gb', + } + }) +end + +-------------------------------- +-- LSP Configuration +-------------------------------- +local path = require("mason-core.path") +local function setup_lsp() + -- Configure Mason LSP installer/manager + require('mason').setup({ + ---@since 1.0.0 + -- The directory in which to install packages. + install_root_dir = path.concat { vim.fn.stdpath "data", "mason" }, + + ---@since 1.0.0 + -- Where Mason should put its bin location in your PATH. Can be one of: + -- - "prepend" (default, Mason's bin location is put first in PATH) + -- - "append" (Mason's bin location is put at the end of PATH) + -- - "skip" (doesn't modify PATH) + ---@type '"prepend"' | '"append"' | '"skip"' + PATH = "prepend", + + ---@since 1.0.0 + -- Controls to which degree logs are written to the log file. It's useful to set this to vim.log.levels.DEBUG when + -- debugging issues with package installations. + log_level = vim.log.levels.INFO, + + ---@since 1.0.0 + -- Limit for the maximum amount of packages to be installed at the same time. Once this limit is reached, any further + -- packages that are requested to be installed will be put in a queue. + max_concurrent_installers = 4, + + ---@since 1.0.0 + -- [Advanced setting] + -- The registries to source packages from. Accepts multiple entries. Should a package with the same name exist in + -- multiple registries, the registry listed first will be used. + registries = { + "github:mason-org/mason-registry", + }, + + ---@since 1.0.0 + -- The provider implementations to use for resolving supplementary package metadata (e.g., all available versions). + -- Accepts multiple entries, where later entries will be used as fallback should prior providers fail. + -- Builtin providers are: + -- - mason.providers.registry-api - uses the https://api.mason-registry.dev API + -- - mason.providers.client - uses only client-side tooling to resolve metadata + providers = { + "mason.providers.registry-api", + "mason.providers.client", + }, + + github = { + ---@since 1.0.0 + -- The template URL to use when downloading assets from GitHub. + -- The placeholders are the following (in order): + -- 1. The repository (e.g. "rust-lang/rust-analyzer") + -- 2. The release version (e.g. "v0.3.0") + -- 3. The asset name (e.g. "rust-analyzer-v0.3.0-x86_64-unknown-linux-gnu.tar.gz") + download_url_template = "https://github.com/%s/releases/download/%s/%s", + }, + + pip = { + ---@since 1.0.0 + -- Whether to upgrade pip to the latest version in the virtual environment before installing packages. + upgrade_pip = false, + + ---@since 1.0.0 + -- These args will be added to `pip install` calls. Note that setting extra args might impact intended behavior + -- and is not recommended. + -- + -- Example: { "--proxy", "https://proxyserver" } + install_args = {}, + }, + + ui = { + ---@since 1.0.0 + -- Whether to automatically check for new versions when opening the :Mason window. + check_outdated_packages_on_open = true, + + ---@since 1.0.0 + -- The border to use for the UI window. Accepts same border values as |nvim_open_win()|. + -- Defaults to `:h 'winborder'` if nil. + border = nil, + + ---@since 1.11.0 + -- The backdrop opacity. 0 is fully opaque, 100 is fully transparent. + backdrop = 60, + + ---@since 1.0.0 + -- Width of the window. Accepts: + -- - Integer greater than 1 for fixed width. + -- - Float in the range of 0-1 for a percentage of screen width. + width = 0.8, + + ---@since 1.0.0 + -- Height of the window. Accepts: + -- - Integer greater than 1 for fixed height. + -- - Float in the range of 0-1 for a percentage of screen height. + height = 0.9, + + icons = { + ---@since 1.0.0 + -- The list icon to use for installed packages. + package_installed = "◍", + ---@since 1.0.0 + -- The list icon to use for packages that are installing, or queued for installation. + package_pending = "◍", + ---@since 1.0.0 + -- The list icon to use for packages that are not installed. + package_uninstalled = "◍", + }, + + keymaps = { + ---@since 1.0.0 + -- Keymap to expand a package + toggle_package_expand = "", + ---@since 1.0.0 + -- Keymap to install the package under the current cursor position + install_package = "i", + ---@since 1.0.0 + -- Keymap to reinstall/update the package under the current cursor position + update_package = "u", + ---@since 1.0.0 + -- Keymap to check for new version for the package under the current cursor position + check_package_version = "c", + ---@since 1.0.0 + -- Keymap to update all installed packages + update_all_packages = "U", + ---@since 1.0.0 + -- Keymap to check which installed packages are outdated + check_outdated_packages = "C", + ---@since 1.0.0 + -- Keymap to uninstall a package + uninstall_package = "X", + ---@since 1.0.0 + -- Keymap to cancel a package installation + cancel_installation = "", + ---@since 1.0.0 + -- Keymap to apply language filter + apply_language_filter = "", + ---@since 1.1.0 + -- Keymap to toggle viewing package installation log + toggle_package_install_log = "", + ---@since 1.8.0 + -- Keymap to toggle the help view + toggle_help = "g?", + }, + }, + }) + require("mason-lspconfig").setup ({ + ensure_installed = { + 'lua_ls', -- Lua + 'clangd', -- C/C++ + 'pyright', -- Python + 'marksman', -- Markdown + }, + automatic_enable = true, + + }) + + -- Configure diagnostics appearance + vim.diagnostic.config({ + virtual_lines=true, + signs = true, + underline = true, + update_in_insert = false, + severity_sort = true, + }) +end + +-------------------------------- +-- INITIALIZE ALL CONFIGS +-------------------------------- + +-- Set up all plugin configurations +setup_telescope() +setup_harpoon() +setup_oil() +setup_toggleterm() +setup_treesitter() +setup_comments() +setup_lsp() diff --git a/.config/nvim/lua/core/autocmds.lua b/.config/nvim/lua/core/autocmds.lua new file mode 100755 index 0000000..898aeb7 --- /dev/null +++ b/.config/nvim/lua/core/autocmds.lua @@ -0,0 +1,98 @@ +-- Core autocommands +-- Centralized place for all autocommands + +-------------------------------- +-- FILE DETECTION & RELOADING +-------------------------------- + +-- Auto-reload files when changed externally +local file_change_detect = vim.api.nvim_create_augroup("FileChangeDetect", { clear = true }) +vim.api.nvim_create_autocmd({"FocusGained", "BufEnter", "BufWinEnter", "WinEnter", "CursorHold", "CursorHoldI"}, { + group = file_change_detect, + callback = function() + vim.cmd("checktime") + end, +}) + +vim.api.nvim_create_autocmd("FileChangedShellPost", { + group = file_change_detect, + callback = function() + vim.notify("File changed on disk. Buffer reloaded.", vim.log.levels.WARN) + vim.cmd("checktime") + end, +}) + +-------------------------------- +-- TERMINAL BEHAVIOR +-------------------------------- + +-- Terminal settings and keymaps +local terminal_settings = vim.api.nvim_create_augroup("TerminalSettings", { clear = true }) +vim.api.nvim_create_autocmd({"TermOpen", "BufEnter"}, { + group = terminal_settings, + callback = function() + if vim.opt.buftype:get() == "terminal" then + vim.cmd("startinsert") + + -- Terminal keymaps + local opts = { noremap = true, silent = true, buffer = true } + vim.keymap.set("t", "", [[ToggleTerm]], opts) + vim.keymap.set("t", "", [[ToggleTerm]], opts) + vim.keymap.set("t", "jk", [[]], opts) + vim.keymap.set("t", "", [[h]], opts) + vim.keymap.set("t", "", [[j]], opts) + vim.keymap.set("t", "", [[k]], opts) + vim.keymap.set("t", "", [[l]], opts) + end + end, +}) + +-------------------------------- +-- CUSTOM FILETYPES +-------------------------------- + +-- Custom filetype detection +local filetype_group = vim.api.nvim_create_augroup("CustomFileTypes", { clear = true }) + +-- Set up .seq files to use codev syntax +vim.api.nvim_create_autocmd({"BufRead", "BufNewFile"}, { + group = filetype_group, + pattern = "*.seq", + callback = function() + vim.bo.filetype = "seq" + vim.bo.syntax = "codev" + vim.bo.commentstring = "!%s" + end, +}) + +-- Set up .lis files to use codelis syntax +vim.api.nvim_create_autocmd({"BufRead", "BufNewFile"}, { + group = filetype_group, + pattern = "*.lis", + callback = function() + vim.bo.filetype = "lis" + vim.bo.syntax = "codelis" + end, +}) + +-------------------------------- +-- CUSTOM COMMANDS +-------------------------------- + +-- Python docstring helper +vim.api.nvim_create_user_command("PythonDocstring", function() + local docstring = [[""" + +# Information: + +# Arguments: + +# Returns: + +"""]] + -- Insert the docstring at the cursor position + local line = vim.api.nvim_win_get_cursor(0)[1] + vim.api.nvim_buf_set_lines(0, line-1, line-1, false, vim.split(docstring, "\n")) + -- Position cursor at the right spot + vim.api.nvim_win_set_cursor(0, {line+1, 0}) +end, {}) diff --git a/.config/nvim/lua/core/keymaps.lua b/.config/nvim/lua/core/keymaps.lua new file mode 100755 index 0000000..a65133d --- /dev/null +++ b/.config/nvim/lua/core/keymaps.lua @@ -0,0 +1,120 @@ +-- Core keymaps +-- General key mappings not tied to specific plugins + +-- Leader key +vim.g.mapleader = " " + +---------------- +-- NORMAL MODE +---------------- + +-- File operations +vim.keymap.set("n", "w", "w", { desc = "Save file" }) +vim.keymap.set("n", "q", "q", { desc = "Quit" }) +vim.keymap.set("n", "Q", "q!", { desc = "Force quit" }) +vim.keymap.set("n", "", "bd", { desc = "Close buffer" }) + +-- Quick buffer navigation +vim.keymap.set("n", "", "h", { desc = "Move to left window" }) +vim.keymap.set("n", "", "j", { desc = "Move to bottom window" }) +vim.keymap.set("n", "", "k", { desc = "Move to top window" }) +vim.keymap.set("n", "", "l", { desc = "Move to right window" }) + +-- Quick formatting +vim.keymap.set("n", "S", "ggVG=", { desc = "Format entire file" }) + +-- Quick line operations +vim.keymap.set("n", "o", "o", { desc = "New line below" }) +vim.keymap.set("n", "O", "O", { desc = "New line above" }) +vim.keymap.set("n", "J", "mzJ`z", { desc = "Join lines and maintain cursor" }) + +-- Better vertical navigation +vim.keymap.set("n", "", "zz", { desc = "Half page down and center" }) +vim.keymap.set("n", "", "zz", { desc = "Half page up and center" }) +vim.keymap.set("n", "n", "nzzzv", { desc = "Next search result and center" }) +vim.keymap.set("n", "N", "Nzzzv", { desc = "Prev search result and center" }) + +-- Clipboard operations +vim.keymap.set({"n", "v"}, "y", [["+y]], { desc = "Copy to system clipboard" }) +vim.keymap.set("n", "Y", [["+Y]], { desc = "Copy line to system clipboard" }) +vim.keymap.set({"n", "v"}, "d", [["_d]], { desc = "Delete to void register" }) +vim.keymap.set("x", "p", [["_dP]], { desc = "Paste over selection" }) + +-- Quickfix navigation +vim.keymap.set("n", "k", "lnextzz", { desc = "Next quickfix item" }) +vim.keymap.set("n", "j", "lprevzz", { desc = "Previous quickfix item" }) + +-- Undo remap +vim.keymap.set("n", "U", "", { desc = "Redo" }) + +-- Search and replace current word +vim.keymap.set("n", "s", [[:%s/\<\>//gI]], + { desc = "Replace current word" }) + +-- Terminal keymaps +vim.keymap.set("n", "t", "ToggleTerm", { desc = "Toggle terminal" }) +vim.keymap.set({"n", "i"},"", "ToggleTermSendCurrentLinej", { desc = "Send line to terminal" }) +vim.keymap.set("n","", "ggVG:'<,'>ToggleTermSendVisualLines", { desc = "Send file to terminal" }) +vim.keymap.set("i","", "ggVG:'<,'>ToggleTermSendVisualLinesi", { desc = "Send file to terminal" }) +vim.keymap.set("v","", ":ToggleTermSendVisualLines", { desc = "Send selection to terminal" }) + +-- File browser +vim.keymap.set("n", "-", "Oil", { desc = "Open parent directory with Oil" }) + +-- LSP +-- Jump to definition with gd +vim.keymap.set('n', 'gd', vim.lsp.buf.definition, {noremap=true, silent=true}) +-- Optional: Add other useful LSP keybindings +vim.keymap.set('n', 'gr', vim.lsp.buf.references, {noremap=true, silent=true}) +vim.keymap.set('n', 'K', vim.lsp.buf.hover, {noremap=true, silent=true}) +vim.keymap.set('n', 'gi', vim.lsp.buf.implementation, {noremap=true, silent=true}) +vim.keymap.set('n', '', vim.lsp.buf.signature_help, {noremap=true, silent=true}) +vim.keymap.set('n', 'e', vim.diagnostic.open_float, { noremap=true, silent=true, desc = "Show diagnostics" }) + +-- Python docstring helper +vim.keymap.set("n", "dc", ":PythonDocstring", { + silent = true, + desc = "Insert Python docstring template" +}) + +---------------- +-- INSERT MODE +---------------- + +vim.keymap.set("i", "jk", "", { desc = "Exit insert mode" }) +vim.keymap.set("i", "e", "e", { desc = "Insert e after leader" }) +vim.keymap.set("i", "", "bd", { desc = "Close buffer" }) + +---------------- +-- VISUAL MODE +---------------- + +-- Move selected lines +vim.keymap.set("v", "J", ":m '>+1gv=gv", { desc = "Move selection down" }) +vim.keymap.set("v", "K", ":m '<-2gv=gv", { desc = "Move selection up" }) + +-- Telescope keymaps (grouped for related functionality) +vim.keymap.set("n", "ff", "Telescope find_files theme=dropdown", { desc = "Find files" }) +vim.keymap.set("n", "fm", "Telescope find_files cwd=D:/Optics/CODEV/Macros theme=dropdown", { desc = "Find macro files" }) +vim.keymap.set("n", "fc", "Telescope find_files cwd=C:/CODEV202403/macro theme=dropdown", { desc = "Find CODEV macro files" }) +vim.keymap.set("n", "fl", "Telescope find_files cwd=C:/CODEV202403/lens theme=dropdown", { desc = "Find lens files" }) +vim.keymap.set("n", "gg", "Telescope live_grep theme=dropdown", { desc = "Live grep" }) +vim.keymap.set("n", "gm", "Telescope live_grep cwd=D:/Optics/CODEV/Macros theme=dropdown", { desc = "Grep in macro files" }) +vim.keymap.set("n", "gc", "Telescope live_grep cwd=C:/CODEV202403/macro theme=dropdown", { desc = "Grep in CODEV macro files" }) +vim.keymap.set("n", "gl", "Telescope live_grep cwd=C:/CODEV202403/lens theme=dropdown", { desc = "Grep in lens files" }) +vim.keymap.set("n", "b", "Telescope buffers theme=dropdown", { desc = "List buffers" }) + +-- Harpoon keymaps +vim.keymap.set("n", "a", function() require("harpoon"):list():add() end, { desc = "Add file to harpoon" }) +vim.keymap.set("n", "", function() require("harpoon").ui:toggle_quick_menu(require("harpoon"):list()) end, { desc = "Toggle harpoon menu" }) +vim.keymap.set("n", "j", function() require("harpoon"):list():select(1) end, { desc = "Harpoon file 1" }) +vim.keymap.set("n", "k", function() require("harpoon"):list():select(2) end, { desc = "Harpoon file 2" }) +vim.keymap.set("n", "l", function() require("harpoon"):list():select(3) end, { desc = "Harpoon file 3" }) +vim.keymap.set("n", ";", function() require("harpoon"):list():select(4) end, { desc = "Harpoon file 4" }) +vim.keymap.set("n", "N", function() require("harpoon"):list():prev() end, { desc = "Previous harpoon file" }) +vim.keymap.set("n", "P", function() require("harpoon"):list():next() end, { desc = "Next harpoon file" }) + +-- Other tool keymaps +vim.keymap.set("n", "G", vim.cmd.Git, { desc = "Open Git status" }) +vim.keymap.set("n", "u", vim.cmd.UndotreeToggle, { desc = "Toggle undo tree" }) +vim.keymap.set("n", "[c", function() require("treesitter-context").go_to_context() end, { desc = "Go to context", silent = true }) diff --git a/.config/nvim/lua/core/options.lua b/.config/nvim/lua/core/options.lua new file mode 100755 index 0000000..4270949 --- /dev/null +++ b/.config/nvim/lua/core/options.lua @@ -0,0 +1,37 @@ +-- Core Neovim settings +-- General options and settings + +-- UI settings +vim.opt.termguicolors = true -- True color support +vim.opt.number = true -- Show line numbers +vim.opt.relativenumber = true -- Show relative line numbers +vim.opt.scrolloff = 999 -- Keep cursor centered +vim.opt.splitbelow = true -- Horizontal splits below +vim.opt.splitright = true -- Vertical splits to the right +vim.opt.wrap = true -- Line wrapping +vim.opt.virtualedit = "block" -- Allow cursor beyond text in block mode + +-- Search settings +vim.opt.hlsearch = false -- Don't highlight search results +vim.opt.incsearch = true -- Incremental search +vim.opt.ignorecase = true -- Case insensitive search + +-- Tab settings +vim.opt.tabstop = 4 -- Tab width +vim.opt.softtabstop = 4 -- Soft tab width +vim.opt.shiftwidth = 4 -- Indentation width +vim.opt.expandtab = true -- Use spaces instead of tabs + +-- File management +vim.opt.swapfile = false -- No swap files +vim.opt.backup = false -- No backup files +vim.opt.undodir = os.getenv("HOME").."/.vim/undodir" -- Undo directory +vim.opt.undofile = true -- Persistent undo history + +-- Performance and usability +vim.opt.updatetime = 50 -- Faster update time +vim.opt.inccommand = "split" -- Live substitution preview + +-- Status line +vim.cmd([[set laststatus=2]]) -- Always show statusline +vim.cmd([[set shortmess=I]]) -- Don't show intro message diff --git a/.config/nvim/lua/plugins.lua b/.config/nvim/lua/plugins.lua new file mode 100755 index 0000000..630c934 --- /dev/null +++ b/.config/nvim/lua/plugins.lua @@ -0,0 +1,208 @@ +-- Plugin declarations +-- All plugins used in Neovim are defined here + + +-- 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) + +-- Initialize lazy.nvim with plugins +require("lazy").setup({ + ------------------------------------------------------------ + -- UI + ------------------------------------------------------------ + + -- Colorscheme + { + "folke/tokyonight.nvim", + lazy = false, + priority = 1000, + config = function() + vim.cmd.colorscheme("tokyonight-night") + end, + }, + + -- File browser + { + 'stevearc/oil.nvim', + dependencies = { "nvim-tree/nvim-web-devicons" }, + cmd = "Oil", + }, + + -- Terminal + { + 'akinsho/toggleterm.nvim', + version = "*", + cmd = {"ToggleTerm", "ToggleTermSendCurrentLine", "ToggleTermSendVisualLines"}, + }, + + ------------------------------------------------------------ + -- EDITOR ENHANCEMENTS + ------------------------------------------------------------ + + -- Telescope (fuzzy finder) + { + 'nvim-telescope/telescope.nvim', + dependencies = { 'nvim-lua/plenary.nvim' }, + cmd = "Telescope", + }, + + -- Harpoon (quick file navigation) + { + "ThePrimeagen/harpoon", + branch = "harpoon2", + dependencies = { "nvim-lua/plenary.nvim" }, + }, + + -- Git integration + { + 'tpope/vim-fugitive', + cmd = {"Git", "Gstatus", "Gblame", "Gdiffsplit", "Gread", "Gwrite", "Ggrep", "GMove", "GDelete"}, + }, + + -- Undo history visualization + { + 'mbbill/undotree', + cmd = "UndotreeToggle", + }, + + ------------------------------------------------------------ + -- CODE EDITING + ------------------------------------------------------------ + + -- Syntax highlighting + { + 'nvim-treesitter/nvim-treesitter', + build = ':TSUpdate', + event = { "BufReadPost", "BufNewFile" }, + cmd = { "TSUpdateSync", "TSUpdate", "TSInstall" }, + dependencies = { + 'nvim-treesitter/nvim-treesitter-context', + }, + }, + + -- Comments + { + 'numToStr/Comment.nvim', + event = { "BufReadPost", "BufNewFile" }, + }, + + -- Auto brackets + { + 'windwp/nvim-autopairs', + event = "InsertEnter", + config = true, + }, + + -- LaTeX support + { + "lervag/vimtex", + ft = {"tex", "latex"}, + init = function() + vim.g.vimtex_view_method = "zathura" + end + }, + + ------------------------------------------------------------ + -- LSP & COMPLETION + ------------------------------------------------------------ + -- LSP Base + { + "mason-org/mason.nvim", + "mason-org/mason-lspconfig.nvim", + "neovim/nvim-lspconfig", +}, + { + "folke/lazydev.nvim", + ft = "lua", -- only load on lua files + opts = { + library = { + -- See the configuration section for more details + -- Load luvit types when the `vim.uv` word is found + { path = "${3rd}/luv/library", words = { "vim%.uv" } }, + }, + }, + }, + + -- Autocompletion + { + 'saghen/blink.cmp', + -- optional: provides snippets for the snippet source + dependencies = { 'rafamadriz/friendly-snippets' }, + + version = '1.*', + opts = { + -- 'default' (recommended) for mappings similar to built-in completions (C-y to accept) + -- 'super-tab' for mappings similar to vscode (tab to accept) + -- 'enter' for enter to accept + -- 'none' for no mappings + -- + -- All presets have the following mappings: + -- C-space: Open menu or open docs if already open + -- C-n/C-p or Up/Down: Select next/previous item + -- C-e: Hide menu + -- C-k: Toggle signature help (if signature.enabled = true) + -- + -- See :h blink-cmp-config-keymap for defining your own keymap + 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 = { + -- add lazydev to your completion providers + default = { "lazydev", "lsp", "path", "snippets", "buffer" }, + providers = { + lazydev = { + name = "LazyDev", + module = "lazydev.integrations.blink", + -- make lazydev completions top priority (see `:h blink.cmp`) + score_offset = 100, + }, + }, + }, + -- (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_with_warning" } + }, + opts_extend = { "sources.default" } +}, + +}, { + -- Lazy.nvim options + install = { colorscheme = { "tokyonight-night" } }, + checker = { enabled = true, frequency = 86400 }, -- Check for updates once per day + change_detection = { notify = false }, + performance = { + rtp = { + disabled_plugins = { + "gzip", + "tarPlugin", + "tohtml", + "tutor", + "zipPlugin", + }, + }, + }, +}) -- cgit v1.2.3