diff --git a/AppData/Local/nvim/init.lua b/AppData/Local/nvim/init.lua new file mode 100644 index 0000000..fb88db9 --- /dev/null +++ b/AppData/Local/nvim/init.lua @@ -0,0 +1,637 @@ +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) + +-- Basic Options +vim.g.mapleader = " " +vim.wo.number = true +vim.opt.tabstop = 2 +vim.opt.softtabstop = 2 +vim.opt.shiftwidth = 2 +vim.opt.autoindent = true +vim.opt.smartindent = true +vim.opt.termguicolors = true +vim.opt.expandtab = true +vim.opt.clipboard = "unnamedplus" -- Use system clipboard +if vim.fn.has("win32") == 1 then + vim.g.clipboard = { + name = "win32yank", + copy = { + ["+"] = "win32yank.exe -i --crlf", + ["*"] = "win32yank.exe -i --crlf", + }, + paste = { + ["+"] = "win32yank.exe -o --lf", + ["*"] = "win32yank.exe -o --lf", + }, + cache_enabled = 0, + } +end +vim.opt.ignorecase = true +vim.opt.smartcase = true + +-- Keymaps (Global) +local options = { noremap = true, silent = true } +vim.keymap.set("i", "jk", "", options) + +-- Clipboard Mappings (IDE Style) +vim.keymap.set("v", "", '"+y', { desc = "Copy to clipboard" }) +vim.keymap.set("v", "", '"+d', { desc = "Cut to clipboard" }) +vim.keymap.set("n", "", '"+p', { desc = "Paste from clipboard" }) +vim.keymap.set("i", "", "+", { desc = "Paste from clipboard" }) +vim.keymap.set("c", "", "+", { desc = "Paste from clipboard" }) +vim.keymap.set("t", "", [["+pa]], { desc = "Paste from clipboard" }) + +if vim.g.vscode then +-- VS Code specific settings/keymaps could go here +else + -- Highlight on yank + vim.api.nvim_create_autocmd("textyankpost", { + group = vim.api.nvim_create_augroup("highlight_yank", {}), + desc = "Highlight selection on yank", + pattern = "*", + callback = function() + vim.highlight.on_yank({ higroup = "incsearch", timeout = 500 }) + end, + }) + + require("lazy").setup({ + -- UI & Utilities + { + "folke/which-key.nvim", + event = "VeryLazy", + init = function() + vim.o.timeout = true + vim.o.timeoutlen = 300 + end, + opts = {}, + }, + { "folke/trouble.nvim", dependencies = { "nvim-tree/nvim-web-devicons" } }, + { "nvim-tree/nvim-web-devicons" }, + { "folke/neodev.nvim", opts = {} }, -- Better Lua dev experience + + -- Git + { "kdheepak/lazygit.nvim", dependencies = { "nvim-lua/plenary.nvim" } }, + { "lewis6991/gitsigns.nvim", dependencies = { "nvim-lua/plenary.nvim" } }, + { "tpope/vim-rhubarb" }, + { "tommcdo/vim-fubitive" }, + { "theprimeagen/git-worktree.nvim" }, + { + "neogitorg/neogit", + dependencies = { + "nvim-lua/plenary.nvim", + "sindrets/diffview.nvim", + "nvim-telescope/telescope.nvim", + }, + config = true, + }, + + -- Java Environment + { "mfussenegger/nvim-jdtls", dependencies = { "mfussenegger/nvim-dap" } }, + + -- Debugging UI + { + "rcarriga/nvim-dap-ui", + dependencies = { "mfussenegger/nvim-dap", "nvim-neotest/nvim-nio" }, + config = function() + require("dapui").setup() + local dap, dapui = require("dap"), require("dapui") + dap.listeners.after.event_initialized["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, + }, + + -- LSP & Completion (The Modern Stack) + { + "williamboman/mason.nvim", + dependencies = { + "WhoIsSethDaniel/mason-tool-installer.nvim", + }, + config = function() + require("mason").setup() + require("mason-tool-installer").setup({ + ensure_installed = { + "black", + "isort", + "prettierd", + "stylua", + "google-java-format", + "eslint_d", -- for nvim-lint + "pylint", -- for nvim-lint + }, + }) + end, + }, + { + "williamboman/mason-lspconfig.nvim", + dependencies = { "williamboman/mason.nvim" }, + config = function() + local capabilities = require("cmp_nvim_lsp").default_capabilities() + local lspconfig = require("lspconfig") + + require("mason-lspconfig").setup({ + ensure_installed = { "lua_ls", "jdtls" }, + automatic_installation = true, + handlers = { + function(server_name) + if server_name == "jdtls" then + -- JDTLS is handled by nvim-jdtls via autocommand below + else + lspconfig[server_name].setup({ + capabilities = capabilities, + }) + end + end, + }, + }) + end, + }, + { "neovim/nvim-lspconfig" }, + { + "hrsh7th/nvim-cmp", + dependencies = { + "hrsh7th/cmp-nvim-lsp", + "hrsh7th/cmp-nvim-lua", + "hrsh7th/cmp-buffer", + "hrsh7th/cmp-cmdline", + "saadparwaiz1/cmp_luasnip", + "l3mon4d3/luasnip", + }, + config = function() + local cmp = require("cmp") + local luasnip = require("luasnip") + cmp.setup({ + snippet = { + expand = function(args) + luasnip.lsp_expand(args.body) + end, + }, + window = { + completion = cmp.config.window.bordered(), + documentation = cmp.config.window.bordered(), + }, + mapping = cmp.mapping.preset.insert({ + [""] = cmp.mapping.scroll_docs(-4), + [""] = cmp.mapping.scroll_docs(4), + [""] = cmp.mapping.complete(), + [""] = cmp.mapping.abort(), + [""] = cmp.mapping.confirm({ select = true }), + [""] = cmp.mapping(function(fallback) + if cmp.visible() then + cmp.select_next_item() + elseif luasnip.expand_or_jumpable() then + luasnip.expand_or_jump() + else + fallback() + end + end, { "i", "s" }), + [""] = cmp.mapping(function(fallback) + if cmp.visible() then + cmp.select_prev_item() + elseif luasnip.jumpable(-1) then + luasnip.jump(-1) + else + fallback() + end + end, { "i", "s" }), + }), + sources = cmp.config.sources({ + { name = "nvim_lsp" }, + { name = "luasnip" }, + { name = "nvim_lua" }, + }, { + { name = "buffer" }, + }), + }) + end, + }, + + -- Editing + { + "stevearc/conform.nvim", + opts = { + formatters_by_ft = { + lua = { "stylua" }, + python = { "isort", "black" }, + javascript = { "prettierd", "prettier", stop_after_first = true }, + java = { "google-java-format" }, + }, + format_on_save = { + timeout_ms = 500, + lsp_fallback = true, + }, + }, + }, + { + "mfussenegger/nvim-lint", + event = { "BufReadPre", "BufNewFile" }, + config = function() + local lint = require("lint") + lint.linters_by_ft = { + javascript = { "eslint_d" }, + typescript = { "eslint_d" }, + javascriptreact = { "eslint_d" }, + typescriptreact = { "eslint_d" }, + python = { "pylint" }, + } + + local lint_augroup = vim.api.nvim_create_augroup("lint", { clear = true }) + vim.api.nvim_create_autocmd({ "BufEnter", "BufWritePost", "InsertLeave" }, { + group = lint_augroup, + callback = function() + lint.try_lint() + end, + }) + end, + }, + { "numtostr/comment.nvim", opts = {}, lazy = false }, + { "windwp/nvim-autopairs", event = "InsertEnter", opts = {} }, + { "folke/todo-comments.nvim", dependencies = { "nvim-lua/plenary.nvim" }, opts = {} }, + { "lukas-reineke/indent-blankline.nvim", main = "ibl", opts = {} }, + { + "kylechui/nvim-surround", + event = "VeryLazy", + config = function() + require("nvim-surround").setup({}) + end, + }, + { + "Cassin01/wf.nvim", + version = "*", + config = function() + require("wf").setup() + end, + }, + + -- UI / Theme + { + "nvim-neo-tree/neo-tree.nvim", + branch = "v3.x", + dependencies = { + "nvim-lua/plenary.nvim", + "nvim-tree/nvim-web-devicons", -- not strictly required, but recommended + "MunifTanjim/nui.nvim", + }, + }, + { "akinsho/bufferline.nvim", branch = "main", dependencies = "nvim-tree/nvim-web-devicons" }, + { + "nvim-lualine/lualine.nvim", + dependencies = { "nvim-tree/nvim-web-devicons" }, + opts = { theme = "codedark" }, + }, + { + "folke/tokyonight.nvim", + lazy = false, + priority = 1000, + opts = { + on_highlights = function(hl, c) + -- Ensure high contrast for popup menu + hl.Pmenu = { bg = "#1f2335", fg = "#c0caf5" } + hl.PmenuSel = { bg = "#3d59a1", fg = "#ffffff", bold = true } + hl.FloatBorder = { fg = "#3d59a1" } + end, + }, + }, + { "hiphish/rainbow-delimiters.nvim" }, + + -- Telescope + { "nvim-telescope/telescope.nvim", dependencies = { "nvim-lua/plenary.nvim" } }, + { "lukaspietzschmann/telescope-tabs", dependencies = { "nvim-telescope/telescope.nvim" } }, + + -- Treesitter + { + "nvim-treesitter/nvim-treesitter", + build = ":TSUpdate", + config = function() + require("nvim-treesitter.configs").setup({ + ensure_installed = { + "lua", + "groovy", + "java", + "c", + "cpp", + "javascript", + "python", + "yaml", + "json", + "xml", + "html", + "ssh_config", + "csv", + "vim", + "vimdoc", + "query", + "markdown", + "markdown_inline", + }, + sync_install = false, + highlight = { enable = true }, + indent = { enable = true }, + }) + end, + }, + + -- Flash + { + "folke/flash.nvim", + event = "VeryLazy", + opts = {}, + keys = { + { + "s", + mode = { "n", "x", "o" }, + function() + require("flash").jump() + end, + desc = "flash", + }, + { + "S", + mode = { "n", "x", "o" }, + function() + require("flash").treesitter() + end, + desc = "flash treesitter", + }, + { + "r", + mode = "o", + function() + require("flash").remote() + end, + desc = "remote flash", + }, + { + "R", + mode = { "o", "x" }, + function() + require("flash").treesitter_search() + end, + desc = "treesitter search", + }, + { + "", + mode = { "c" }, + function() + require("flash").toggle() + end, + desc = "toggle flash search", + }, + }, + }, + + -- Markdown + { + "iamcco/markdown-preview.nvim", + cmd = { "Markdownpreviewtoggle", "Markdownpreview", "Markdownpreviewstop" }, + build = "cd app && yarn install", + init = function() + vim.g.mkdp_filetypes = { "markdown" } + end, + ft = { "markdown" }, + }, + }) + + -- Configs + vim.g.fubitive_domain_pattern = "bitbucket.ingg.com" + + -- Correctly setup indent-blankline + require("ibl").setup({}) + + require("bufferline").setup({}) + + -- Telescope Setup + local telescope = require("telescope") + local open_with_trouble = require("trouble.sources.telescope").open + telescope.setup({ + defaults = { + mappings = { + i = { [""] = open_with_trouble }, + n = { [""] = open_with_trouble }, + }, + }, + }) + telescope.load_extension("git_worktree") + + -- Git Worktree + local worktree = require("git-worktree") + worktree.on_tree_change(function(op, metadata) + if op == worktree.operations.switch then + print("switched from " .. metadata.prev_path .. " to " .. metadata.path) + end + end) + + -- Lualine + require("lualine").setup({ + sections = { + lualine_a = { "mode" }, + lualine_b = { { "b:gitsigns_head", icon = "" }, "diff", "diagnostics" }, + }, + }) + + -- Colorscheme + vim.cmd([[colorscheme tokyonight-night]]) + + -- Keymaps + -- IntelliJ-like Mappings + vim.keymap.set("n", "", vim.lsp.buf.code_action, { desc = "Code Action (Alt+Enter)" }) + vim.keymap.set("n", "", vim.lsp.buf.rename, { desc = "Rename Symbol (Shift+F6)" }) + vim.keymap.set("n", "", function() + require("conform").format({ async = true, lsp_fallback = true }) + end, { desc = "Reformat Code (Ctrl+Alt+L)" }) + + -- Navigation & Search + vim.keymap.set("n", "", require("telescope.builtin").find_files, { desc = "Go to File (Ctrl+N)" }) + vim.keymap.set("n", "", require("telescope.builtin").live_grep, { desc = "Find in Path" }) + vim.keymap.set("n", "", require("telescope.builtin").buffers, { desc = "Search Open Files" }) + + -- LSP Navigation + vim.keymap.set("n", "gd", vim.lsp.buf.definition, { desc = "Go to Definition" }) + vim.keymap.set("n", "gi", vim.lsp.buf.implementation, { desc = "Go to Implementation" }) + vim.keymap.set("n", "gr", require("telescope.builtin").lsp_references, { desc = "Find Usages" }) + vim.keymap.set("n", "K", vim.lsp.buf.hover, { desc = "Hover Documentation" }) + vim.keymap.set("n", "[d", vim.diagnostic.goto_prev, { desc = "Previous Diagnostic" }) + vim.keymap.set("n", "]d", vim.diagnostic.goto_next, { desc = "Next Diagnostic" }) + + -- Existing Mappings + vim.keymap.set("n", "e", ":Neotree toggle", { desc = "Toggle Explorer" }) + vim.keymap.set("n", "ft", ":TodoTelescope", { desc = "Find TODOs" }) + vim.keymap.set("n", "ff", require("telescope.builtin").find_files, { desc = "List Files" }) + vim.keymap.set("n", "fg", require("telescope.builtin").live_grep, { desc = "Search Current Dir" }) + vim.keymap.set("n", "fh", require("telescope.builtin").help_tags, { desc = "List Help Tags" }) + vim.keymap.set("n", "lg", ":LazyGit", { desc = "LazyGit" }) + + vim.keymap.set("n", "gws", ":telescope git_worktree git_worktrees", { desc = "List Git Worktrees" }) + vim.keymap.set( + "n", + "gwc", + ":telescope git_worktree create_git_worktree", + { desc = "Create Git Worktrees " } + ) + + vim.keymap.set("n", "r", ":!%:p", { desc = "Run file" }) + + -- Trouble (IntelliJ "Problems" View) + vim.keymap.set("n", "xx", function() + require("trouble").toggle() + end, { desc = "Toggle Problems View" }) + vim.keymap.set("n", "xw", function() + require("trouble").toggle("workspace_diagnostics") + end, { desc = "Workspace Problems" }) + vim.keymap.set("n", "xd", function() + require("trouble").toggle("document_diagnostics") + end, { desc = "Document Problems" }) + + vim.keymap.set("t", "", [[]], { desc = "Escape from terminal" }) + + -- GitSigns + require("gitsigns").setup({ + on_attach = function(bufnr) + local gs = package.loaded.gitsigns + + local function map(mode, l, r, opts) + opts = opts or {} + opts.buffer = bufnr + vim.keymap.set(mode, l, r, opts) + end + + -- Navigation + map("n", "]c", function() + if vim.wo.diff then + return "]c" + end + vim.schedule(function() + gs.next_hunk() + end) + return "" + end, { expr = true }) + + map("n", "[c", function() + if vim.wo.diff then + return "[c" + end + vim.schedule(function() + gs.prev_hunk() + end) + return "" + end, { expr = true }) + + -- Actions + map("n", "hs", gs.stage_hunk, { desc = "Stage Hunk" }) + map("n", "hr", gs.reset_hunk, { desc = "Reset Hunk" }) + map("v", "hs", function() + gs.stage_hunk({ vim.fn.line("."), vim.fn.line("v") }) + end, { desc = "Stage Hunk (v)" }) + map("v", "hr", function() + gs.reset_hunk({ vim.fn.line("."), vim.fn.line("v") }) + end, { desc = "Reset Hunk (v)" }) + map("n", "hS", gs.stage_buffer, { desc = "Stage Buffer" }) + map("n", "hu", gs.undo_stage_hunk, { desc = "Undo Stage Hunk" }) + map("n", "hR", gs.reset_buffer, { desc = "Reset Buffer" }) + map("n", "hp", gs.preview_hunk, { desc = "Preview Hunk" }) + map("n", "hb", function() + gs.blame_line({ full = true }) + end, { desc = "Blame Line" }) + map("n", "Tb", gs.toggle_current_line_blame, { desc = "Toggle Blame" }) + map("n", "hd", gs.diffthis, { desc = "Diff This" }) + map("n", "hD", function() + gs.diffthis("~") + end, { desc = "Diff This ~" }) + map("n", "Td", gs.toggle_deleted, { desc = "Toggle Deleted" }) + + -- Text Object + map({ "o", "x" }, "ih", ":Gitsigns select_hunk") + end, + }) +end + +-- JDTLS Setup +local function get_jdtls_config() + local mason_registry = require("mason-registry") + if not mason_registry.is_installed("jdtls") then + vim.notify("JDTLS not installed. Run :MasonInstall jdtls", vim.log.levels.WARN) + return nil + end + + local jdtls_path = vim.fn.stdpath("data") .. "/mason/packages/jdtls" + + -- Find launcher jar + local launcher_jars = vim.fn.glob(jdtls_path .. "/plugins/org.eclipse.equinox.launcher_*.jar", true, true) + local launcher_jar = launcher_jars[1] + + if not launcher_jar then + vim.notify("JDTLS Launcher JAR not found in " .. jdtls_path, vim.log.levels.ERROR) + return nil + end + + local config_dir = jdtls_path .. (vim.fn.has("win32") == 1 and "/config_win" or "/config_linux") + local workspace_dir = vim.fn.stdpath("data") + .. "/site/java/workspace-root/" + .. vim.fn.fnamemodify(vim.fn.getcwd(), ":p:h:t") + + local java_cmd = "java" + if vim.fn.has("win32") == 1 then + java_cmd = "C:/Program Files/Eclipse Adoptium/jdk-25.0.1.8-hotspot/bin/java.exe" + end + + local cmd = { + java_cmd, + "-Declipse.application=org.eclipse.jdt.ls.core.id1", + "-Dosgi.bundles.defaultStartLevel=4", + "-Declipse.product=org.eclipse.jdt.ls.core.product", + "-Dlog.protocol=true", + "-Dlog.level=ALL", + "-Xmx1g", + "--add-opens", + "java.base/java.util=ALL-UNNAMED", + "--add-opens", + "java.base/java.lang=ALL-UNNAMED", + } + + -- Add Lombok from Mason package if available + local lombok_jar = jdtls_path .. "/lombok.jar" + if vim.fn.filereadable(lombok_jar) == 1 then + table.insert(cmd, "-javaagent:" .. lombok_jar) + end + + -- Finish constructing cmd + table.insert(cmd, "-jar") + table.insert(cmd, launcher_jar) + table.insert(cmd, "-configuration") + table.insert(cmd, config_dir) + table.insert(cmd, "-data") + table.insert(cmd, workspace_dir) + + local config = { + cmd = cmd, + root_dir = require("jdtls.setup").find_root({ ".git", "mvnw", "gradlew", "pom.xml", "build.gradle" }), + capabilities = require("cmp_nvim_lsp").default_capabilities(), + } + return config +end + +vim.api.nvim_create_autocmd("FileType", { + pattern = "java", + callback = function() + local config = get_jdtls_config() + if config then + require("jdtls").start_or_attach(config) + end + end, +}) diff --git a/AppData/Local/nvim/init.lua.backup b/AppData/Local/nvim/init.lua.backup new file mode 100644 index 0000000..076282d --- /dev/null +++ b/AppData/Local/nvim/init.lua.backup @@ -0,0 +1,270 @@ +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", -- latest stable release + lazypath + }) +end +vim.opt.rtp:prepend(lazypath) + +local options = { noremap = true } +vim.keymap.set("i", "jk", "", options) +vim.g.mapleader = " " -- make sure to set `mapleader` before lazy so your mappings are correct +vim.wo.number = true +vim.opt.tabstop = 2 +vim.opt.softtabstop = 2 +vim.opt.shiftwidth = 2 +vim.opt.autoindent = true +vim.opt.smartindent = true +vim.opt.termguicolors = true +vim.opt.expandtab = true + +if vim.g.vscode then + +else + require "coc" + + vim.api.nvim_create_autocmd('textyankpost', { + group = vim.api.nvim_create_augroup('highlight_yank', {}), + desc = 'hightlight selection on yank', + pattern = '*', + callback = function() + vim.highlight.on_yank { higroup = 'incsearch', timeout = 500 } + end + }) + + require("lazy").setup({ + { + "folke/which-key.nvim", + event = "VeryLazy", + init = function() + vim.o.timeout = true + vim.o.timeoutlen = 300 + end, + opts = {} + }, + { "folke/trouble.nvim", dependencies = { "nvim-tree/nvim-web-devicons" } }, + { "kdheepak/lazygit.nvim", dependencies = { "nvim-lua/plenary.nvim" } }, + -- {"tpope/vim-fugitive" }, + { "tpope/vim-rhubarb" }, { "tommcdo/vim-fubitive" }, + { "lewis6991/gitsigns.nvim", dependencies = { "nvim-lua/plenary.nvim" } }, + { + "neogitorg/neogit", + dependencies = { + "nvim-lua/plenary.nvim", -- required + "sindrets/diffview.nvim", -- optional - diff integration + "nvim-telescope/telescope.nvim" -- optional + }, + config = true + }, { "neovim/nvim-lspconfig" }, -- {"folke/which-key.nvim"}, + { + "Cassin01/wf.nvim", + version = "*", + config = function() require("wf").setup() end + }, { "folke/neodev.nvim" }, + { "numtostr/comment.nvim", opts = {}, lazy = false }, + { "lukas-reineke/indent-blankline.nvim", main = "ibl", opts = {} }, { + "akinsho/bufferline.nvim", + branch = "main", + dependencies = "nvim-tree/nvim-web-devicons" + }, + { "nvim-telescope/telescope.nvim", dependencies = { 'nvim-lua/plenary.nvim' } }, + { "lukaspietzschmann/telescope-tabs", dependencies = { "nvim-telescope/telescope.nvim" } }, + { + "nvim-treesitter/nvim-treesitter", + build = ":TSUpdate", + config = function() + local configs = require("nvim-treesitter.configs") + configs.setup({ + ensure_installed = { + "lua", "groovy", "java", "c", "cpp", "javascript", + "python", "yaml", "json", "xml", "html", "ssh_config", + "csv" + }, + sync_install = false, + highlight = { enable = true }, + indent = { enable = true } + }) + end + }, { + "folke/flash.nvim", + event = "VeryLazy", + opts = {}, + keys = { + { + "s", + mode = { "n", "x", "o" }, + function() require("flash").jump() end, + desc = "flash" + }, { + "s", + mode = { "n", "x", "o" }, + function() require("flash").treesitter() end, + desc = "flash treesitter" + }, { + "r", + mode = "o", + function() require("flash").remote() end, + desc = "remote flash" + }, { + "r", + mode = { "o", "x" }, + function() + require("flash").treesitter_search() + end, + desc = "treesitter search" + }, { + "", + mode = { "c" }, + function() require("flash").toggle() end, + desc = "toggle flash search" + } + } + }, { "neoclide/coc.nvim", branch = "release" }, { + "toppair/peek.nvim", + event = { "VeryLazy" }, + build = "deno task --quiet build:fast", + config = function() + require("peek").setup() + vim.api.nvim_create_user_command("Peekopen", require("peek").open, {}) + vim.api.nvim_create_user_command("Peekclose", require("peek").close, {}) + end + }, { + "hrsh7th/nvim-cmp", + dependencies = { + "hrsh7th/cmp-nvim-lsp", "hrsh7th/cmp-nvim-lua", + "hrsh7th/cmp-buffer", "hrsh7th/cmp-cmdline", + "saadparwaiz1/cmp_luasnip", "l3mon4d3/luasnip" + } + }, { 'theprimeagen/git-worktree.nvim' }, { + "kylechui/nvim-surround", + version = "*", -- use for stability; omit to use `main` branch for the latest features + event = "VeryLazy", + config = function() require("nvim-surround").setup({}) end + }, { + 'nvim-lualine/lualine.nvim', + dependencies = { 'nvim-tree/nvim-web-devicons', theme = 'codedark' } + }, { + "iamcco/markdown-preview.nvim", + cmd = { + "Markdownpreviewtoggle", "Markdownpreview", + "Markdownpreviewstop" + }, + build = "cd app && yarn install", + init = function() vim.g.mkdp_filetypes = { "markdown" } end, + ft = { "markdown" } + }, { "folke/tokyonight.nvim", lazy = false, priority = 1000, opts = {} }, + { "hiphish/rainbow-delimiters.nvim" } + }) + + vim.g.fubitive_domain_pattern = "bitbucket.ingg.com" + vim.g.lf_replace_netrw = require("ibl").setup {} + require("bufferline").setup {} + + local actions = require("telescope.actions") + local open_with_trouble = require("trouble.sources.telescope").open + + -- Use this to add more results without clearing the trouble list + local add_to_trouble = require("trouble.sources.telescope").add + + local telescope = require("telescope") + + telescope.setup({ + defaults = { + mappings = { + i = { [""] = open_with_trouble }, + n = { [""] = open_with_trouble } + } + } + }) + + require('lualine').setup({ + sections = { + lualine_a = { window }, + -- lualine_b = { {'fugitivehead', icon = ''}, } + lualine_b = { { 'b:gitsigns_head', icon = '' } } + } + }) + + telescope.load_extension("git_worktree") + + local worktree = require("git-worktree") + worktree.on_tree_change(function(op, metadata) + if op == worktree.operations.switch then + print("switched from " .. metadata.prev_path .. " to " .. + metadata.path) + end + end) + + vim.cmd([[colorscheme tokyonight-night]]) + + vim.keymap.set('n', 'ff', require('telescope.builtin').find_files, { desc = 'List Files' }) + vim.keymap.set('n', 'fg', require('telescope.builtin').live_grep, { desc = 'Search Current Dir' }) + vim.keymap.set('n', 'fb', require('telescope.builtin').buffers, { desc = 'List Buffers' }) + vim.keymap.set('n', 'fh', require('telescope.builtin').help_tags, { desc = 'List Help Tags' }) + vim.keymap.set('n', 'lg', ':LazyGit', { desc = 'LazyGit' }) + + vim.keymap.set('n', 'gws', ':telescope git_worktree git_worktrees', { desc = 'List Git Worktrees' }) + vim.keymap.set('n', 'gwc', ':telescope git_worktree create_git_worktree', + { desc = 'Create Git Worktrees ' }) + + vim.keymap.set('n', 'r', ':!%:p', { desc = '' }) + + vim.keymap.set("n", "xx", function() require("trouble").toggle() end, { desc = 'Toggle Trouble' }) + vim.keymap.set("n", "xw", function() require("trouble").toggle("workspace_diagnostics") end, + { desc = 'Toggle Workspace diagnostics' }) + vim.keymap.set("n", "xd", function() require("trouble").toggle("document_diagnostics") end, + { desc = 'Toggle Document diagnostics' }) + vim.keymap.set("n", "xq", function() require("trouble").toggle("quickfix") end, { desc = 'Toggle Quickfix' }) + vim.keymap.set("n", "xl", function() require("trouble").toggle("loclist") end, + { desc = 'Toggle Location List' }) + vim.keymap.set("n", "gR", function() require("trouble").toggle("lsp_references") end, + { desc = 'Toggle LSP Reference' }) + vim.keymap.set('t', '', [[]], { desc = 'Escape from terminal' }) + + require('gitsigns').setup { + + on_attach = function(bufnr) + local gs = package.loaded.gitsigns + + local function map(mode, l, r, opts) + opts = opts or {} + opts.buffer = bufnr + vim.keymap.set(mode, l, r, opts) + end + + -- navigation + map('n', ']c', function() + if vim.wo.diff then return ']c' end + vim.schedule(function() gs.next_hunk() end) + return '' + end, { expr = true }) + + map('n', '[c', function() + if vim.wo.diff then return '[c' end + vim.schedule(function() gs.prev_hunk() end) + return '' + end, { expr = true }) + + map('n', 'hs', gs.stage_hunk, { desc = 'GitSigns stage_hunk' }) + map('n', 'hr', gs.reset_hunk, { desc = 'GitSigns reset_hunk' }) + map('v', 'hs', function() gs.stage_hunk { vim.fn.line('.'), vim.fn.line('v') } end, + { desc = 'GitSigns stage_hunk' }) + map('v', 'hr', function() gs.reset_hunk { vim.fn.line('.'), vim.fn.line('v') } end, + { desc = 'GitSigns reset_hunk' }) + map('n', 'hS', gs.stage_buffer, { desc = 'GitSigns stage_buffer' }) + map('n', 'hu', gs.undo_stage_hunk, { desc = 'GitSigns undo_stage_hunk' }) + map('n', 'hR', gs.reset_buffer, { desc = 'GitSigns reset_buffer' }) + map('n', 'hp', gs.preview_hunk, { desc = 'GitSigns preview_hunk' }) + map('n', 'hb', function() gs.blame_line { full = true } end, { desc = 'GitSigns blame_line' }) + map('n', 'Tb', gs.toggle_current_line_blame, { desc = 'GitSigns toggle_current_line_blame' }) + map('n', 'hd', gs.diffthis, { desc = 'GitSigns diffthis' }) + map('n', 'hD', function() gs.diffthis('~') end, { desc = 'GitSigns diffthis ~' }) + map('n', 'Td', gs.toggle_deleted, { desc = 'GitSigns toggle_deleted' }) + + -- text object + map({ 'o', 'x' }, 'ih', ':Gitsigns select_hunk') + end + } +end diff --git a/AppData/Local/nvim/lazy-lock.json b/AppData/Local/nvim/lazy-lock.json new file mode 100644 index 0000000..00b5ee0 --- /dev/null +++ b/AppData/Local/nvim/lazy-lock.json @@ -0,0 +1,49 @@ +{ + "bufferline.nvim": { "branch": "main", "commit": "655133c3b4c3e5e05ec549b9f8cc2894ac6f51b3" }, + "cmp-buffer": { "branch": "main", "commit": "b74fab3656eea9de20a9b8116afa3cfc4ec09657" }, + "cmp-cmdline": { "branch": "main", "commit": "d126061b624e0af6c3a556428712dd4d4194ec6d" }, + "cmp-nvim-lsp": { "branch": "main", "commit": "cbc7b02bb99fae35cb42f514762b89b5126651ef" }, + "cmp-nvim-lua": { "branch": "main", "commit": "e3a22cb071eb9d6508a156306b102c45cd2d573d" }, + "cmp_luasnip": { "branch": "master", "commit": "98d9cb5c2c38532bd9bdb481067b20fea8f32e90" }, + "comment.nvim": { "branch": "master", "commit": "e30b7f2008e52442154b66f7c519bfd2f1e32acb" }, + "conform.nvim": { "branch": "master", "commit": "c2526f1cde528a66e086ab1668e996d162c75f4f" }, + "diffview.nvim": { "branch": "main", "commit": "4516612fe98ff56ae0415a259ff6361a89419b0a" }, + "flash.nvim": { "branch": "main", "commit": "fcea7ff883235d9024dc41e638f164a450c14ca2" }, + "git-worktree.nvim": { "branch": "master", "commit": "f247308e68dab9f1133759b05d944569ad054546" }, + "gitsigns.nvim": { "branch": "main", "commit": "31217271a7314c343606acb4072a94a039a19fb5" }, + "indent-blankline.nvim": { "branch": "master", "commit": "005b56001b2cb30bfa61b7986bc50657816ba4ba" }, + "lazy.nvim": { "branch": "main", "commit": "306a05526ada86a7b30af95c5cc81ffba93fef97" }, + "lazygit.nvim": { "branch": "main", "commit": "a04ad0dbc725134edbee3a5eea29290976695357" }, + "lualine.nvim": { "branch": "master", "commit": "47f91c416daef12db467145e16bed5bbfe00add8" }, + "luasnip": { "branch": "master", "commit": "dae4f5aaa3574bd0c2b9dd20fb9542a02c10471c" }, + "markdown-preview.nvim": { "branch": "master", "commit": "a923f5fc5ba36a3b17e289dc35dc17f66d0548ee" }, + "mason-lspconfig.nvim": { "branch": "main", "commit": "ae609525ddf01c153c39305730b1791800ffe4fe" }, + "mason-tool-installer.nvim": { "branch": "main", "commit": "443f1ef8b5e6bf47045cb2217b6f748a223cf7dc" }, + "mason.nvim": { "branch": "main", "commit": "44d1e90e1f66e077268191e3ee9d2ac97cc18e65" }, + "neo-tree.nvim": { "branch": "v3.x", "commit": "f3df514fff2bdd4318127c40470984137f87b62e" }, + "neodev.nvim": { "branch": "main", "commit": "46aa467dca16cf3dfe27098042402066d2ae242d" }, + "neogit": { "branch": "master", "commit": "73870229977fdd8747025820e15e98cfde787b9c" }, + "nui.nvim": { "branch": "main", "commit": "de740991c12411b663994b2860f1a4fd0937c130" }, + "nvim-autopairs": { "branch": "master", "commit": "59bce2eef357189c3305e25bc6dd2d138c1683f5" }, + "nvim-cmp": { "branch": "main", "commit": "da88697d7f45d16852c6b2769dc52387d1ddc45f" }, + "nvim-dap": { "branch": "master", "commit": "db321947bb289a2d4d76a32e76e4d2bd6103d7df" }, + "nvim-dap-ui": { "branch": "master", "commit": "cf91d5e2d07c72903d052f5207511bf7ecdb7122" }, + "nvim-jdtls": { "branch": "master", "commit": "77ccaeb422f8c81b647605da5ddb4a7f725cda90" }, + "nvim-lint": { "branch": "master", "commit": "bcd1a44edbea8cd473af7e7582d3f7ffc60d8e81" }, + "nvim-lspconfig": { "branch": "master", "commit": "d1597791f8196519439b3a036b59b09023981e1d" }, + "nvim-nio": { "branch": "master", "commit": "21f5324bfac14e22ba26553caf69ec76ae8a7662" }, + "nvim-surround": { "branch": "main", "commit": "1098d7b3c34adcfa7feb3289ee434529abd4afd1" }, + "nvim-treesitter": { "branch": "master", "commit": "42fc28ba918343ebfd5565147a42a26580579482" }, + "nvim-web-devicons": { "branch": "master", "commit": "746ffbb17975ebd6c40142362eee1b0249969c5c" }, + "plenary.nvim": { "branch": "master", "commit": "b9fd5226c2f76c951fc8ed5923d85e4de065e509" }, + "rainbow-delimiters.nvim": { "branch": "master", "commit": "d6b802552cbe7d643a3b6b31f419c248d1f1e220" }, + "telescope-tabs": { "branch": "master", "commit": "777b1f630f3d6a12a2e71635a82581c988d6da2e" }, + "telescope.nvim": { "branch": "master", "commit": "ad7d9580338354ccc136e5b8f0aa4f880434dcdc" }, + "todo-comments.nvim": { "branch": "main", "commit": "31e3c38ce9b29781e4422fc0322eb0a21f4e8668" }, + "tokyonight.nvim": { "branch": "main", "commit": "5da1b76e64daf4c5d410f06bcb6b9cb640da7dfd" }, + "trouble.nvim": { "branch": "main", "commit": "bd67efe408d4816e25e8491cc5ad4088e708a69a" }, + "vim-fubitive": { "branch": "master", "commit": "c85ca8fa2098aa05e816f5d0839a0dad6bfcca5a" }, + "vim-rhubarb": { "branch": "master", "commit": "5496d7c94581c4c9ad7430357449bb57fc59f501" }, + "wf.nvim": { "branch": "main", "commit": "d7de32119e933ddd4c006324475d487c87b8d80b" }, + "which-key.nvim": { "branch": "main", "commit": "3aab2147e74890957785941f0c1ad87d0a44c15a" } +} diff --git a/AppData/Local/nvim/lua/coc.lua b/AppData/Local/nvim/lua/coc.lua new file mode 100644 index 0000000..f34bd2f --- /dev/null +++ b/AppData/Local/nvim/lua/coc.lua @@ -0,0 +1,184 @@ +-- Some servers have issues with backup files, see #649 +vim.opt.backup = false +vim.opt.writebackup = false + +-- Having longer updatetime (default is 4000 ms = 4s) leads to noticeable +-- delays and poor user experience +vim.opt.updatetime = 300 + +-- Always show the signcolumn, otherwise it would shift the text each time +-- diagnostics appeared/became resolved +vim.opt.signcolumn = "yes" + +local keyset = vim.keymap.set +-- Autocomplete +function _G.check_back_space() + local col = vim.fn.col('.') - 1 + return col == 0 or vim.fn.getline('.'):sub(col, col):match('%s') ~= nil +end + +-- Use Tab for trigger completion with characters ahead and navigate +-- NOTE: There's always a completion item selected by default, you may want to enable +-- no select by setting `"suggest.noselect": true` in your configuration file +-- NOTE: Use command ':verbose imap ' to make sure Tab is not mapped by +-- other plugins before putting this into your config +local opts = {silent = true, noremap = true, expr = true, replace_keycodes = false} +keyset("i", "", 'coc#pum#visible() ? coc#pum#next(1) : v:lua.check_back_space() ? "" : coc#refresh()', opts) +keyset("i", "", [[coc#pum#visible() ? coc#pum#prev(1) : "\"]], opts) + +-- Make to accept selected completion item or notify coc.nvim to format +-- u breaks current undo, please make your own choice +keyset("i", "", [[coc#pum#visible() ? coc#pum#confirm() : "\u\\=coc#on_enter()\"]], opts) + +-- Use to trigger snippets +keyset("i", "", "(coc-snippets-expand-jump)") +-- Use to trigger completion +keyset("i", "", "coc#refresh()", {silent = true, expr = true}) + +-- Use `[g` and `]g` to navigate diagnostics +-- Use `:CocDiagnostics` to get all diagnostics of current buffer in location list +keyset("n", "[g", "(coc-diagnostic-prev)", {silent = true}) +keyset("n", "]g", "(coc-diagnostic-next)", {silent = true}) + +-- GoTo code navigation +keyset("n", "gd", "(coc-definition)", {silent = true}) +keyset("n", "gy", "(coc-type-definition)", {silent = true}) +keyset("n", "gi", "(coc-implementation)", {silent = true}) +keyset("n", "gr", "(coc-references)", {silent = true}) + + +-- Use K to show documentation in preview window +function _G.show_docs() + local cw = vim.fn.expand('') + if vim.fn.index({'vim', 'help'}, vim.bo.filetype) >= 0 then + vim.api.nvim_command('h ' .. cw) + elseif vim.api.nvim_eval('coc#rpc#ready()') then + vim.fn.CocActionAsync('doHover') + else + vim.api.nvim_command('!' .. vim.o.keywordprg .. ' ' .. cw) + end +end +keyset("n", "K", 'lua _G.show_docs()', {silent = true}) + + +-- Highlight the symbol and its references on a CursorHold event(cursor is idle) +vim.api.nvim_create_augroup("CocGroup", {}) +vim.api.nvim_create_autocmd("CursorHold", { + group = "CocGroup", + command = "silent call CocActionAsync('highlight')", + desc = "Highlight symbol under cursor on CursorHold" +}) + + +-- Symbol renaming +keyset("n", "rn", "(coc-rename)", {silent = true}) + + +-- Formatting selected code +keyset("x", "f", "(coc-format-selected)", {silent = true}) +keyset("n", "f", "(coc-format-selected)", {silent = true}) + + +-- Setup formatexpr specified filetype(s) +vim.api.nvim_create_autocmd("FileType", { + group = "CocGroup", + pattern = "typescript,json", + command = "setl formatexpr=CocAction('formatSelected')", + desc = "Setup formatexpr specified filetype(s)." +}) + +-- Update signature help on jump placeholder +vim.api.nvim_create_autocmd("User", { + group = "CocGroup", + pattern = "CocJumpPlaceholder", + command = "call CocActionAsync('showSignatureHelp')", + desc = "Update signature help on jump placeholder" +}) + +-- Apply codeAction to the selected region +-- Example: `aap` for current paragraph +local opts = {silent = true, nowait = true} +keyset("x", "a", "(coc-codeaction-selected)", opts) +keyset("n", "a", "(coc-codeaction-selected)", opts) + +-- Remap keys for apply code actions at the cursor position. +keyset("n", "ac", "(coc-codeaction-cursor)", opts) +-- Remap keys for apply source code actions for current file. +keyset("n", "as", "(coc-codeaction-source)", opts) +-- Apply the most preferred quickfix action on the current line. +keyset("n", "qf", "(coc-fix-current)", opts) + +-- Remap keys for apply refactor code actions. +keyset("n", "re", "(coc-codeaction-refactor)", { silent = true }) +keyset("x", "r", "(coc-codeaction-refactor-selected)", { silent = true }) +keyset("n", "r", "(coc-codeaction-refactor-selected)", { silent = true }) + +-- Run the Code Lens actions on the current line +keyset("n", "cl", "(coc-codelens-action)", opts) + + +-- Map function and class text objects +-- NOTE: Requires 'textDocument.documentSymbol' support from the language server +keyset("x", "if", "(coc-funcobj-i)", opts) +keyset("o", "if", "(coc-funcobj-i)", opts) +keyset("x", "af", "(coc-funcobj-a)", opts) +keyset("o", "af", "(coc-funcobj-a)", opts) +keyset("x", "ic", "(coc-classobj-i)", opts) +keyset("o", "ic", "(coc-classobj-i)", opts) +keyset("x", "ac", "(coc-classobj-a)", opts) +keyset("o", "ac", "(coc-classobj-a)", opts) + + +-- Remap and to scroll float windows/popups +---@diagnostic disable-next-line: redefined-local +local opts = {silent = true, nowait = true, expr = true} +keyset("n", "", 'coc#float#has_scroll() ? coc#float#scroll(1) : ""', opts) +keyset("n", "", 'coc#float#has_scroll() ? coc#float#scroll(0) : ""', opts) +keyset("i", "", + 'coc#float#has_scroll() ? "=coc#float#scroll(1)" : ""', opts) +keyset("i", "", + 'coc#float#has_scroll() ? "=coc#float#scroll(0)" : ""', opts) +keyset("v", "", 'coc#float#has_scroll() ? coc#float#scroll(1) : ""', opts) +keyset("v", "", 'coc#float#has_scroll() ? coc#float#scroll(0) : ""', opts) + + +-- Use CTRL-S for selections ranges +-- Requires 'textDocument/selectionRange' support of language server +keyset("n", "", "(coc-range-select)", {silent = true}) +keyset("x", "", "(coc-range-select)", {silent = true}) + + +-- Add `:Format` command to format current buffer +vim.api.nvim_create_user_command("Format", "call CocAction('format')", {}) + +-- " Add `:Fold` command to fold current buffer +vim.api.nvim_create_user_command("Fold", "call CocAction('fold', )", {nargs = '?'}) + +-- Add `:OR` command for organize imports of the current buffer +vim.api.nvim_create_user_command("OR", "call CocActionAsync('runCommand', 'editor.action.organizeImport')", {}) + +-- Add (Neo)Vim's native statusline support +-- NOTE: Please see `:h coc-status` for integrations with external plugins that +-- provide custom statusline: lightline.vim, vim-airline +vim.opt.statusline:prepend("%{coc#status()}%{get(b:,'coc_current_function','')}") + +-- Mappings for CoCList +-- code actions and coc stuff +---@diagnostic disable-next-line: redefined-local +local opts = {silent = true, nowait = true} +-- Show all diagnostics +keyset("n", "a", ":CocList diagnostics", opts) +-- Manage extensions +keyset("n", "e", ":CocList extensions", opts) +-- Show commands +keyset("n", "c", ":CocList commands", opts) +-- Find symbol of current document +keyset("n", "o", ":CocList outline", opts) +-- Search workspace symbols +keyset("n", "s", ":CocList -I symbols", opts) +-- Do default action for next item +keyset("n", "j", ":CocNext", opts) +-- Do default action for previous item +keyset("n", "k", ":CocPrev", opts) +-- Resume latest coc list +keyset("n", "p", ":CocListResume", opts) diff --git a/AppData/Local/nvim/readonly_empty_coc-settings.json b/AppData/Local/nvim/readonly_empty_coc-settings.json new file mode 100644 index 0000000..e69de29 diff --git a/AppData/Local/nvim/readonly_empty_d2u36EF.tmp b/AppData/Local/nvim/readonly_empty_d2u36EF.tmp new file mode 100644 index 0000000..e69de29 diff --git a/AppData/Local/nvim/readonly_empty_d2uA260.tmp b/AppData/Local/nvim/readonly_empty_d2uA260.tmp new file mode 100644 index 0000000..e69de29 diff --git a/dot_gitconfig b/dot_gitconfig new file mode 100644 index 0000000..668281d --- /dev/null +++ b/dot_gitconfig @@ -0,0 +1,67 @@ +[include] + path = ~/.delta/themes.gitconfig +[core] + excludesfile = + autocrlf = true + symlinks = true + fileMode = true + pager = delta --pager='less -R -F -X' + safecrlf = false +[user] + name = Riz Ashraf + email = reazul.ashraf@inseinc.com +[interactive] + diffFilter = delta --color-only +[delta] + features = collared-trogon + line-numbers = true + navigate = true + hyperlinks = true + hyperlinks-file-link-format = vscode://file/{path}:{line} +[diff] + colorMoved = default + tool = bc + guitool = bc +[difftool] + prompt = false +[merge] + conflictstyle = diff3 + tool = bc + guitool = bc +[mergetool] + prompt = false +[credential] + helper = wincred +[safe] + directory = * + directory = C:/Users/reazul.ashraf +[difftool "bc"] + path = c:/Program Files/Beyond Compare 5/bcomp.exe + cmd = \"c:/Program Files/Beyond Compare 5/bcomp.exe\" \"$LOCAL\" \"$REMOTE\" +[mergetool "bc"] + path = C:/Program Files/Beyond Compare 5/BComp.exe + cmd = \"C:/Program Files/Beyond Compare 5/BComp.exe\" \"$LOCAL\" \"$REMOTE\" \"$BASE\" \"$MERGED\" +[filter "lfs"] + smudge = git-lfs smudge -- %f + process = git-lfs filter-process + required = true + clean = git-lfs clean -- %f +[gui] + recentrepo = D:/jchangelog +[credential "https://bitbucket.ingg.com"] + provider = bitbucket +[http] + sslVerify = false + postBuffer = 157286400 +[pull] + rebase = false +[fetch] + prune = false +[rebase] + autoStash = false + autosquash = false + updateRefs = false +[i18n] + filesEncoding = utf-8 +[credential "https://gitea.rizaz.com"] + provider = generic