diff --git a/.stylua.toml b/.stylua.toml new file mode 100755 index 0000000..ae954a0 --- /dev/null +++ b/.stylua.toml @@ -0,0 +1,6 @@ +column_width = 120 +line_endings = "Unix" +indent_type = "Spaces" +indent_width = 2 +quote_style = "AutoPreferDouble" +call_parentheses = "None" diff --git a/init.lua b/init.lua new file mode 100755 index 0000000..d5acef4 --- /dev/null +++ b/init.lua @@ -0,0 +1,60 @@ +vim.g.base46_cache = vim.fn.stdpath("data") .. "/base46/" +vim.g.mapleader = " " + +vim.wo.number = true +-- Bootstrap lazy.nvim +local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" +if not vim.loop.fs_stat(lazypath) then + local repo = "https://github.com/folke/lazy.nvim.git" + vim.fn.system({ "git", "clone", "--filter=blob:none", repo, "--branch=stable", lazypath }) +end +vim.opt.rtp:prepend(lazypath) + +-- Load lazy.nvim configuration +local lazy_config = require("configs.lazy") + +-- Load plugins +require("lazy").setup({ + -- NvChad plugins + { + "NvChad/NvChad", + lazy = false, + branch = "v2.5", + import = "nvchad.plugins", + }, + + -- Import additional plugins if any + { import = "plugins" }, +}) + +local lspconfig = require('lspconfig') +local cmp = require'cmp' + +-- cmp autocomplete +cmp.setup({ + sources = { + { name = 'nvim_lsp' }, + }, + mapping = { + [''] = cmp.mapping.select_next_item(), + [''] = cmp.mapping.select_prev_item(), + }, +}) + +-- Load theme and statusline +dofile(vim.g.base46_cache .. "defaults") +dofile(vim.g.base46_cache .. "statusline") + +-- Load options and autocommands +require("options") +require("nvchad.autocmds") + +-- Schedule mappings to load asynchronously +vim.schedule(function() + require("mappings") +end) + + +require('configs.lspconfig') +require('configs.neoscroll') + diff --git a/lazy-lock.json b/lazy-lock.json new file mode 100755 index 0000000..de9f93e --- /dev/null +++ b/lazy-lock.json @@ -0,0 +1,48 @@ +{ + "Comment.nvim": { "branch": "master", "commit": "e30b7f2008e52442154b66f7c519bfd2f1e32acb" }, + "CopilotChat.nvim": { "branch": "canary", "commit": "5a935ffbdf3d790ae7b51fee358ce7252365b5e9" }, + "LuaSnip": { "branch": "master", "commit": "0f7bbce41ea152a94d12aea286f2ce98e63c0f58" }, + "NvChad": { "branch": "v2.5", "commit": "bbc3d43db088c141b142a40cd5f717635833a54e" }, + "base46": { "branch": "v2.5", "commit": "40943fc668bf8f1caa4cc45f71c784cf0d3cc34f" }, + "black": { "branch": "main", "commit": "fdabd424e237f89d8b3f53cf8157902bbf850e45" }, + "cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" }, + "cmp-nvim-lsp": { "branch": "main", "commit": "39e2eda76828d88b773cc27a3f61d2ad782c922d" }, + "cmp-nvim-lua": { "branch": "main", "commit": "f12408bdb54c39c23e67cab726264c10db33ada8" }, + "cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" }, + "cmp_luasnip": { "branch": "master", "commit": "98d9cb5c2c38532bd9bdb481067b20fea8f32e90" }, + "conform.nvim": { "branch": "master", "commit": "62d5accad8b29d6ba9b58d3dff90c43a55621c60" }, + "copilot-cmp": { "branch": "master", "commit": "b6e5286b3d74b04256d0a7e3bd2908eabec34b44" }, + "copilot.lua": { "branch": "master", "commit": "f8d8d872bb319f640d5177dad5fbf01f7a16d7d0" }, + "crates.nvim": { "branch": "main", "commit": "8bf8358ee326d5d8c11dcd7ac0bcc9ff97dbc785" }, + "friendly-snippets": { "branch": "main", "commit": "de8fce94985873666bd9712ea3e49ee17aadb1ed" }, + "gitsigns.nvim": { "branch": "main", "commit": "ac5aba6dce8c06ea22bea2c9016f51a2dbf90dc7" }, + "indent-blankline.nvim": { "branch": "master", "commit": "7871a88056f7144defca9c931e311a3134c5d509" }, + "lazy.nvim": { "branch": "main", "commit": "56ead98e05bb37a4ec28930a54d836d033cf00f2" }, + "lualine.nvim": { "branch": "master", "commit": "2a5bae925481f999263d6f5ed8361baef8df4f83" }, + "mason-lspconfig.nvim": { "branch": "main", "commit": "c6c686781f9841d855bf1b926e10aa5e19430a38" }, + "mason-tool-installer.nvim": { "branch": "main", "commit": "c5e07b8ff54187716334d585db34282e46fa2932" }, + "mason.nvim": { "branch": "main", "commit": "e2f7f9044ec30067bc11800a9e266664b88cda22" }, + "menu": { "branch": "main", "commit": "657bfc91382c0928453d9a4d0a10ec92db5de2bb" }, + "minty": { "branch": "main", "commit": "b454ca0229f8e22a631fd3c014ec99973fb8cad4" }, + "neoscroll.nvim": { "branch": "master", "commit": "f957373912e88579e26fdaea4735450ff2ef5c9c" }, + "nvim-autopairs": { "branch": "master", "commit": "b464658e9b880f463b9f7e6ccddd93fb0013f559" }, + "nvim-cmp": { "branch": "main", "commit": "be7bd4c5f860c79da97af3a26d489af50babfd4b" }, + "nvim-dap": { "branch": "master", "commit": "cc92b054720a96170eca6bd9bdedd43d2b0a7a8a" }, + "nvim-dap-ui": { "branch": "master", "commit": "ffa89839f97bad360e78428d5c740fdad9a0ff02" }, + "nvim-lspconfig": { "branch": "master", "commit": "c646154d6e4db9b2979eeb517d0b817ad00c9c47" }, + "nvim-nio": { "branch": "master", "commit": "a428f309119086dc78dd4b19306d2d67be884eee" }, + "nvim-tree.lua": { "branch": "master", "commit": "1f3ffd6af145af2a4930a61c50f763264922c3fe" }, + "nvim-treesitter": { "branch": "master", "commit": "28a5dc06a842459964203c41a7aac91a77feff20" }, + "nvim-web-devicons": { "branch": "master", "commit": "f09be61d05bebcba85bb47be1931322d51b95644" }, + "plenary.nvim": { "branch": "master", "commit": "2d9b06177a975543726ce5c73fca176cedbffe9d" }, + "presence.nvim": { "branch": "main", "commit": "87c857a56b7703f976d3a5ef15967d80508df6e6" }, + "rust.vim": { "branch": "master", "commit": "889b9a7515db477f4cb6808bef1769e53493c578" }, + "rustaceanvim": { "branch": "master", "commit": "6e742b9fc6a37e46181879f6c32cecfa8cd2cebf" }, + "suda.vim": { "branch": "master", "commit": "9adda7d195222d4e2854efb2a88005a120296c47" }, + "telescope.nvim": { "branch": "master", "commit": "85922dde3767e01d42a08e750a773effbffaea3e" }, + "transparent.nvim": { "branch": "main", "commit": "8a2749a2fa74f97fe6557f61b89ac7fd873f3c21" }, + "ui": { "branch": "v3.0", "commit": "8cc265d1fc663a4bcd39c68e60a76adef6df031e" }, + "vim-visual-multi": { "branch": "master", "commit": "a6975e7c1ee157615bbc80fc25e4392f71c344d4" }, + "volt": { "branch": "main", "commit": "8d35e03c70490190149a77c59155618ef4370721" }, + "which-key.nvim": { "branch": "main", "commit": "68e37e12913a66b60073906f5d3f14dee0de19f2" } +} diff --git a/lazyvim.json b/lazyvim.json new file mode 100755 index 0000000..251eb5a --- /dev/null +++ b/lazyvim.json @@ -0,0 +1,9 @@ +{ + "extras": [ + + ], + "news": { + "NEWS.md": "7429" + }, + "version": 7 +} \ No newline at end of file diff --git a/lua/chadrc.lua b/lua/chadrc.lua new file mode 100755 index 0000000..fb08e60 --- /dev/null +++ b/lua/chadrc.lua @@ -0,0 +1,17 @@ +-- This file needs to have same structure as nvconfig.lua +-- https://github.com/NvChad/ui/blob/v3.0/lua/nvconfig.lua +-- Please read that file to know all available options :( + +---@type ChadrcConfig +local M = {} + +M.base46 = { + theme = "tokyonight", + + -- hl_override = { + -- Comment = { italic = true }, + -- ["@comment"] = { italic = true }, + -- }, +} + +return M diff --git a/lua/configs/conform.lua b/lua/configs/conform.lua new file mode 100755 index 0000000..e844856 --- /dev/null +++ b/lua/configs/conform.lua @@ -0,0 +1,15 @@ +local options = { + formatters_by_ft = { + lua = { "stylua" }, + -- css = { "prettier" }, + -- html = { "prettier" }, + }, + + -- format_on_save = { + -- -- These options will be passed to conform.format() + -- timeout_ms = 500, + -- lsp_fallback = true, + -- }, +} + +return options diff --git a/lua/configs/lazy.lua b/lua/configs/lazy.lua new file mode 100755 index 0000000..019edbe --- /dev/null +++ b/lua/configs/lazy.lua @@ -0,0 +1,47 @@ +return { + defaults = { lazy = true }, + install = { colorscheme = { "nvchad" } }, + + ui = { + icons = { + ft = "", + lazy = "󰂠 ", + loaded = "", + not_loaded = "", + }, + }, + + performance = { + rtp = { + disabled_plugins = { + "2html_plugin", + "tohtml", + "getscript", + "getscriptPlugin", + "gzip", + "logipat", + "netrw", + "netrwPlugin", + "netrwSettings", + "netrwFileHandlers", + "matchit", + "tar", + "tarPlugin", + "rrhelper", + "spellfile_plugin", + "vimball", + "vimballPlugin", + "zip", + "zipPlugin", + "tutor", + "rplugin", + "syntax", + "synmenu", + "optwin", + "compiler", + "bugreport", + "ftplugin", + }, + }, + }, +} diff --git a/lua/configs/lspconfig.lua b/lua/configs/lspconfig.lua new file mode 100755 index 0000000..942edbc --- /dev/null +++ b/lua/configs/lspconfig.lua @@ -0,0 +1,39 @@ +require("mason").setup() +require("mason-lspconfig").setup({ + ensure_installed = { "pyright", "html", "cssls" }, -- Ensure pyright is installed +}) + +-- Load lspconfig +local lspconfig = require("lspconfig") +local nvlsp = require "nvchad.configs.lspconfig" + +-- Set up servers +local servers = { "html", "cssls", "pyright" } + +for _, lsp in ipairs(servers) do + lspconfig[lsp].setup({ + on_attach = nvlsp.on_attach, + on_init = nvlsp.on_init, + capabilities = nvlsp.capabilities, + }) +end + +lspconfig.pyright.setup({ + on_attach = function(client, bufnr) + -- You can add custom on_attach behavior here, such as keymaps or other actions. + end, + capabilities = require('cmp_nvim_lsp').default_capabilities(), -- If you're using nvim-cmp +}) + +-- Install necessary tools using mason-tool-installer +require('mason-tool-installer').setup({ + ensure_installed = { + 'black', + 'debugpy', + 'flake8', + 'isort', + 'mypy', + 'pylint', + }, +}) + diff --git a/lua/configs/lspconfig.lua.bak b/lua/configs/lspconfig.lua.bak new file mode 100644 index 0000000..e33ca03 --- /dev/null +++ b/lua/configs/lspconfig.lua.bak @@ -0,0 +1,9 @@ +local lspconfig = require('lspconfig') + +-- Basic Pyright setup +lspconfig.pyright.setup({ + on_attach = function(client, bufnr) + -- Optional: Add keybindings or other configurations + end, +}) + diff --git a/lua/configs/neoscroll.lua b/lua/configs/neoscroll.lua new file mode 100644 index 0000000..87616be --- /dev/null +++ b/lua/configs/neoscroll.lua @@ -0,0 +1,20 @@ +require('neoscroll').setup({ + mappings = { -- Keys to be mapped to their corresponding default scrolling animation + '', '', + '', '', + '', '', + 'zt', 'zz', 'zb', + }, + hide_cursor = true, -- Hide cursor while scrolling + stop_eof = true, -- Stop at when scrolling downwards + respect_scrolloff = false, -- Stop scrolling when the cursor reaches the scrolloff margin of the file + cursor_scrolls_alone = true, -- The cursor will keep on scrolling even if the window cannot scroll further + duration_multiplier = 1.0, -- Global duration multiplier + easing = 'linear', -- Default easing function + pre_hook = nil, -- Function to run before the scrolling animation starts + post_hook = nil, -- Function to run after the scrolling animation ends + performance_mode = false, -- Disable "Performance Mode" on all buffers. + ignored_events = { -- Events ignored while scrolling + 'WinScrolled', 'CursorMoved' + }, +}) diff --git a/lua/mappings.lua b/lua/mappings.lua new file mode 100755 index 0000000..8ecb509 --- /dev/null +++ b/lua/mappings.lua @@ -0,0 +1,31 @@ +require "nvchad.mappings" + +-- add yours here + +local map = vim.keymap.set + +-- map("n", ";", ":", { desc = "CMD enter command mode" }) +vim.opt.mouse = "" + +map("i", "jk", "") +vim.keymap.set('n', '', ':NvimTreeToggle', { noremap = true, silent = true }) +-- Unmap from normal mode +vim.api.nvim_del_keymap('n', '') + +-- Reassign it to Visual Multi for subword under feature +vim.g.VM_maps = vim.g.VM_maps or {} +vim.g.VM_maps[''] = '(VM-Find-Subword-Under)' +vim.g.mapleader = " " +vim.keymap.set("i", "", function() + require("copilot.suggestion").accept() +end, { noremap = true, silent = true }) + +vim.api.nvim_set_keymap('', '', '', { noremap = true, silent = true }) +vim.api.nvim_set_keymap('', '', '', { noremap = true, silent = true }) + +vim.keymap.set('n', '', ':tabnext', { noremap = true, silent = true }) -- Next tab +vim.keymap.set('n', '', ':tabprev', { noremap = true, silent = true }) -- Previous tab +vim.keymap.set('n', 'tn', ':tabnew', { noremap = true, silent = true }) -- New tab +vim.keymap.set('n', 'tc', ':tabclose', { noremap = true, silent = true }) -- Close tab + +-- map({ "n", "i", "v" }, "", " w ") diff --git a/lua/options.lua b/lua/options.lua new file mode 100755 index 0000000..5bae94b --- /dev/null +++ b/lua/options.lua @@ -0,0 +1,6 @@ +require "nvchad.options" + +-- add yours here! + +-- local o = vim.o +-- o.cursorlineopt ='both' -- to enable cursorline! diff --git a/lua/plugins/init.lua b/lua/plugins/init.lua new file mode 100755 index 0000000..557ede1 --- /dev/null +++ b/lua/plugins/init.lua @@ -0,0 +1,203 @@ +return { + { "williamboman/mason.nvim", opts = {} }, + { "williamboman/mason-lspconfig.nvim", opts = {} }, + { "WhoIsSethDaniel/mason-tool-installer.nvim"}, + { + "stevearc/conform.nvim", + -- event = 'BufWritePre', -- uncomment for format on save + opts = require "configs.conform", + }, + { + "andweeb/presence.nvim", + opts = { + show_time = true, + buttons = true, + enable_line_number = true, + }, +}, + + -- Basic plugins + { "nvim-lualine/lualine.nvim", lazy = false }, + { "nvim-tree/nvim-tree.lua", lazy = false }, + { "karb94/neoscroll.nvim", lazy = false }, + { "lambdalisue/suda.vim", lazy = false }, + { "numToStr/Comment.nvim", lazy = false}, + { "mg979/vim-visual-multi", lazy = false}, + + { "nvim-treesitter/nvim-treesitter", + lazy = false, + build = ':TSUpdate', + opts = { + highlight = { + enable = true, + }, + indent = {enable = true}, + auto_install = true, + ensure_installed = { + 'lua', + }, + }, + config = function (_, opts) + local configs = require("nvim-treesitter.configs") + configs.setup(opts) + end + }, + { "nvim-telescope/telescope.nvim", lazy = false }, +--{ +-- 'fisadev/vim-isort', +-- ft = 'python', +-- config = function() +-- -- Ensure Python support is available +-- local python_support = vim.fn.has('python3') +-- if python_support == 1 then +-- vim.g.vim_isort_map = '' +-- vim.api.nvim_create_autocmd({"BufWritePre"}, { +-- pattern = "*.py", +-- callback = function() +-- vim.cmd("Isort") +-- end, +-- }) +-- else +-- print("Python3 support is missing, vim-isort will be disabled.") +-- end +-- end +--}, + + { + 'psf/black', + ft = 'python', + config = function () + vim.api.nvim_create_autocmd({"BufWritePre"}, { + pattern = "*.py", + callback = function() + vim.cmd("Black") + end, + }) + end + }, + { + "xiyaowong/transparent.nvim", + lazy = false, -- Disable lazy-loading + priority = 1000, -- High priority to ensure it loads before other plugins + config = function() + require("transparent").setup({ + extra_groups = { -- Example groups to clear + "NormalFloat", -- Add more highlight groups as needed + "NvimTreeNormal", + }, + exclude = {}, -- Groups you want to keep intact + }) + end, + }, + + { + "zbirenbaum/copilot.lua", + cmd = "Copilot", -- Makes `:Copilot` available + event = "InsertEnter", -- Load when entering Insert mode + config = function() + require("copilot").setup({ + suggestion = { + enabled = true, + auto_trigger = true, + keymap = { + accept = "", + dismiss = "", + }, + }, + }) + end, + }, + { + "zbirenbaum/copilot-cmp", + after = { "copilot.lua", "nvim-cmp" }, -- Ensure it loads after copilot and nvim-cmp + config = function() + require("copilot_cmp").setup() + end, + }, + + -- Rust vim Plugin + { + 'mrcjkb/rustaceanvim', + version = '^5', -- Recommended + lazy = false, -- This plugin is already lazy + config = function () + local mason_registry = require('mason-registry') + local codelldb = mason_registry.get_package("codelldb") + local extension_path = codelldb:get_install_path() .. "/extension" + local codelldb_path = extension_path .. "adapter/codelldb" + local liblldb_path = extension_path.. "lldb/lib/liblldb.dylib" + local cfg = require('rustaceanvim.config') + + vim.g.rustaceanvim = { + dap = { + adapter = cfg.get_codelldb_adapter(codelldb_path, liblldb_path) + }, + } + end + }, + + -- CopilotChat + { + "CopilotC-Nvim/CopilotChat.nvim", + branch = "canary", + dependencies = { + { "zbirenbaum/copilot.lua" }, + { "nvim-lua/plenary.nvim" }, + }, + opts = { + -- Add any specific options here + }, + build = nil, -- Disable the build step + }, + + { + 'rust-lang/rust.vim', + ft = "rust", + init = function () + vim.g.rustfmt_autosave = 1 + end + }, + + { + 'mfussenegger/nvim-dap', + config = function () + local dap, dapui = require("dap"), require("dapui") + dap.listeners.before.attach.dapui_config = function() + dapui.open() + end + dap.listeners.before.launch.dapui_config = function() + dapui.open() + end + dap.listeners.before.event_terminated.dapui_config = function() + dapui.close() + end + dap.listeners.before.event_exited.dapui_config = function() + dapui.close() + end + end, + }, + + { + 'rcarriga/nvim-dap-ui', + dependencies = {"mfussenegger/nvim-dap", "nvim-neotest/nvim-nio"}, + config = function() + require("dapui").setup() + end, + }, + { + 'saecki/crates.nvim', + ft = {"toml"}, + config = function() + require("crates").setup { + completion = { + cmp = { + enabled = true + }, + }, + } + require('cmp').setup.buffer({ + sources = { { name = "crates" }} + }) + end + }, +} diff --git a/~/.local/share/nvim/lazy/lazy.nvim b/~/.local/share/nvim/lazy/lazy.nvim new file mode 160000 index 0000000..7967abe --- /dev/null +++ b/~/.local/share/nvim/lazy/lazy.nvim @@ -0,0 +1 @@ +Subproject commit 7967abe55752aa90532e6bb4bd4663fe27a264cb