Adding major changes with the precision

This commit is contained in:
sharmaharshitnone 2025-06-09 20:12:12 +05:30
parent 87611001cf
commit d00f77555e
8 changed files with 296 additions and 23 deletions

View file

@ -458,7 +458,7 @@ require('lazy').setup({
vim.keymap.set('n', '<leader>sd', builtin.diagnostics, { desc = '[S]earch [D]iagnostics' }) vim.keymap.set('n', '<leader>sd', builtin.diagnostics, { desc = '[S]earch [D]iagnostics' })
vim.keymap.set('n', '<leader>sr', builtin.resume, { desc = '[S]earch [R]esume' }) vim.keymap.set('n', '<leader>sr', builtin.resume, { desc = '[S]earch [R]esume' })
vim.keymap.set('n', '<leader>s.', builtin.oldfiles, { desc = '[S]earch Recent Files ("." for repeat)' }) vim.keymap.set('n', '<leader>s.', builtin.oldfiles, { desc = '[S]earch Recent Files ("." for repeat)' })
vim.keymap.set('n', '<leader><leader>', builtin.buffers, { desc = '[ ] Find existing buffers' }) vim.keymap.set('n', '<leader><leader>', function() builtin.buffers() end, { desc = '[ ] Find existing buffers' })
-- Slightly advanced example of overriding default behavior and theme -- Slightly advanced example of overriding default behavior and theme
vim.keymap.set('n', '<leader>/', function() vim.keymap.set('n', '<leader>/', function()
@ -899,28 +899,52 @@ require('lazy').setup({
}, },
}, },
{ -- You can easily change to a different colorscheme. -- Load catppuccin theme at startup
-- Change the name of the colorscheme plugin below, and then {
-- change the command in the config to whatever the name of that colorscheme is. 'catppuccin/nvim',
-- name = 'catppuccin',
-- If you want to see what colorschemes are already installed, you can use `:Telescope colorscheme`. priority = 1000, -- Make sure to load this before all the other start plugins
'folke/tokyonight.nvim',
priority = 1000, -- Make sure to load this before all the other start plugins.
config = function() config = function()
---@diagnostic disable-next-line: missing-fields -- Configure the theme
require('tokyonight').setup { require('catppuccin').setup {
flavour = 'mocha', -- latte, frappe, macchiato, mocha
background = {
light = 'latte',
dark = 'mocha',
},
transparent_background = false,
styles = { styles = {
comments = { italic = false }, -- Disable italics in comments comments = { 'italic' },
conditionals = { 'italic' },
},
integrations = {
cmp = true,
gitsigns = true,
nvimtree = true,
telescope = true,
treesitter = true,
}, },
} }
-- Load the colorscheme here. -- Load the colorscheme
-- Like many other themes, this one has different styles, and you could load vim.cmd.colorscheme 'catppuccin'
-- any other, such as 'tokyonight-storm', 'tokyonight-moon', or 'tokyonight-day'.
vim.cmd.colorscheme 'tokyonight-night'
end, end,
}, },
-- Original tokyonight theme (commented out)
-- { -- You can easily change to a different colorscheme.
-- 'folke/tokyonight.nvim',
-- priority = 1000,
-- config = function()
-- require('tokyonight').setup {
-- styles = {
-- comments = { italic = false },
-- },
-- }
-- vim.cmd.colorscheme 'tokyonight-night'
-- end,
-- },
-- Highlight todo, notes, etc in comments -- Highlight todo, notes, etc in comments
{ 'folke/todo-comments.nvim', event = 'VimEnter', dependencies = { 'nvim-lua/plenary.nvim' }, opts = { signs = false } }, { 'folke/todo-comments.nvim', event = 'VimEnter', dependencies = { 'nvim-lua/plenary.nvim' }, opts = { signs = false } },

View file

@ -0,0 +1,50 @@
-- Comment.nvim - Smart and powerful commenting plugin
-- https://github.com/numToStr/Comment.nvim
return {
"numToStr/Comment.nvim",
event = "VeryLazy",
config = function()
require('Comment').setup({
-- Add a space between comment and the line
padding = true,
-- Whether cursor should stay at its position
sticky = true,
-- LHS of toggle mappings in NORMAL mode
toggler = {
-- Line-comment toggle keymap
line = 'gcc',
-- Block-comment toggle keymap
block = 'gbc',
},
-- LHS of operator-pending mappings in NORMAL and VISUAL mode
opleader = {
-- Line-comment keymap
line = 'gc',
-- Block-comment keymap
block = 'gb',
},
-- LHS of extra mappings
extra = {
-- Add comment on the line above
above = 'gcO',
-- Add comment on the line below
below = 'gco',
-- Add comment at the end of line
eol = 'gcA',
},
-- Enable keybindings
mappings = {
-- Operator-pending mapping
basic = true,
-- Extra mapping
extra = true,
},
-- Pre-hook, called before commenting the line
-- Can be used with treesitter for better tsx/jsx commenting
pre_hook = nil,
-- Post-hook, called after commenting is done
post_hook = nil,
})
end,
}

View file

@ -174,8 +174,10 @@ return {
-- Toggle inline chat for quick questions about the current line -- Toggle inline chat for quick questions about the current line
vim.keymap.set("n", "<leader>cl", function() vim.keymap.set("n", "<leader>cl", function()
select.line() -- Use chat.ask with a line selector instead of separate select.line() call
chat.toggle() chat.ask("What does this line of code do?", {
selection = select.line, -- Pass the function reference, not the function call
})
end, { desc = "Chat About Current Line" }) end, { desc = "Chat About Current Line" })
-- Open Copilot Chat with a custom prompt -- Open Copilot Chat with a custom prompt

View file

@ -12,4 +12,8 @@ return {
{ import = "custom.plugins.harpoon" }, { import = "custom.plugins.harpoon" },
{ import = "custom.plugins.lazygit" }, { import = "custom.plugins.lazygit" },
{ import = "custom.plugins.toggleterm" }, { import = "custom.plugins.toggleterm" },
{ import = "custom.plugins.comment" },
{ import = "custom.plugins.leetcode" },
-- { import = "custom.plugins.telescope_fix" },
{ import = "custom.plugins.catppuccin" },
} }

View file

@ -25,12 +25,12 @@ return {
-- Plugin configuration -- Plugin configuration
config = function() config = function()
-- Configure floating window border -- Configure floating window border
require("lazygit").setup({ -- require("lazygit").setup({
floating_window_winblend = 0, -- transparency of floating window -- -- floating_window_winblend = 0, -- transparency of floating window
floating_window_scaling_factor = 0.9, -- scaling factor for floating window -- floating_window_scaling_factor = 0.9, -- scaling factor for floating window
floating_window_border_chars = { '', '', '', '', '', '', '', '' }, -- customize floating window border chars -- floating_window_border_chars = { '╭', '─', '╮', '│', '╯', '─', '╰', '│' }, -- customize floating window border chars
lazygit_floating_window_use_plenary = true, -- use plenary.nvim to manage floating window if available -- lazygit_floating_window_use_plenary = true, -- use plenary.nvim to manage floating window if available
}) -- })
end, end,
} }
} }

View file

@ -0,0 +1,93 @@
-- filepath: /home/kali/.config/nvim/lua/custom/plugins/leetcode.lua
-- LeetCode.nvim - Solve LeetCode problems within Neovim
-- https://github.com/kawre/leetcode.nvim
return {
"kawre/leetcode.nvim",
dependencies = {
"nvim-telescope/telescope.nvim",
"nvim-lua/plenary.nvim",
"MunifTanjim/nui.nvim",
"nvim-tree/nvim-web-devicons", -- optional but recommended
"nvim-treesitter/nvim-treesitter" -- make sure treesitter is a direct dependency
},
build = function()
-- Make sure the HTML parser is installed for treesitter
require("nvim-treesitter.install").ensure_installed("html")
end,
config = function()
require("leetcode").setup({
-- Default language for solving problems
lang = "python3", -- you can change this to your preferred language
-- Storage directories
storage = {
home = vim.fn.stdpath("data") .. "/leetcode",
cache = vim.fn.stdpath("cache") .. "/leetcode",
},
-- Console settings
console = {
open_on_runcode = true,
dir = "row", -- "row" or "col" for horizontal or vertical split
size = {
width = "90%",
height = "75%",
},
result = {
size = "60%",
},
testcase = {
virt_text = true,
size = "40%",
},
},
-- Description panel settings
description = {
position = "left", -- "left" or "right"
width = "40%",
show_stats = true, -- show problem stats in description panel
},
-- You can choose either telescope or fzf-lua
picker = {
provider = "telescope", -- set to "fzf-lua" if you prefer that
},
-- Default keybindings - these won't conflict with your existing mappings
-- as they only activate within LeetCode buffers
keys = {
toggle = { "q" },
confirm = { "<CR>" },
reset_testcases = "r",
use_testcase = "U",
focus_testcases = "H",
focus_result = "L",
},
-- Code injection settings - adds useful imports automatically
injector = {
["cpp"] = {
before = { "#include <bits/stdc++.h>", "using namespace std;" },
},
["java"] = {
before = "import java.util.*;",
},
["python3"] = {
before = true, -- use default imports
},
},
-- Enable logging
logging = true,
-- Non-standalone mode (false means it won't interfere with your normal workflow)
plugins = {
non_standalone = false,
},
})
end,
cmd = "Leet", -- lazy-load on command
}

View file

@ -0,0 +1,66 @@
# LeetCode.nvim Guide: Solve LeetCode Problems in Neovim
LeetCode.nvim is a powerful plugin that integrates LeetCode directly into your Neovim editor, allowing you to browse, solve, and submit LeetCode problems without leaving your favorite editor.
## Getting Started
1. Open the LeetCode interface with command:
```
:Leet
```
2. You'll need to log in to your LeetCode account the first time you run it.
## Basic Commands
- `:Leet` - Opens the main LeetCode menu
- `:Leet daily` - Open today's daily challenge
- `:Leet random` - Get a random problem
- `:Leet list` - Browse all problems
- `:Leet tabs` - Switch between open problems
- `:Leet submit` - Submit current solution
- `:Leet run` - Run current solution with test cases
- `:Leet reset` - Reset the code to default template
- `:Leet lang` - Change programming language for current problem
- `:Leet cookie update` - Update your LeetCode cookie
## Filter Problems
When using `:Leet list` or `:Leet random`, you can filter problems:
- By difficulty: `difficulty=easy/medium/hard`
- By status: `status=ac/notac/todo`
- By tags: `tags=array,string,dp`
Example:
```
:Leet list difficulty=medium status=notac
:Leet random status=todo difficulty=hard
```
## Keybindings Within LeetCode UI
These keys only work within the LeetCode interface and won't conflict with your existing keymaps:
- `q` - Toggle/close panels
- `<CR>` (Enter) - Confirm selection
- `r` - Reset test cases
- `U` - Use a custom test case
- `H` - Focus on test cases panel
- `L` - Focus on results panel
## Tips for Use
1. **Switch Languages**: Use `:Leet lang` to change your programming language for the current problem.
2. **Multiple Problems**: You can have multiple LeetCode problems open in different tabs.
3. **Code Auto-Injection**: Useful imports and boilerplate code are automatically added for common languages.
4. **Description Format**: Problem descriptions are formatted for better readability, including proper markdown rendering.
5. **Efficient Workflow**: LeetCode.nvim caches your progress, making it faster to get back to your problems.
Enjoy solving LeetCode problems without leaving your favorite editor!

View file

@ -0,0 +1,34 @@
-- Fix for Telescope error with nil paths
-- return {
-- "nvim-telescope/telescope.nvim",
-- -- This will only modify the existing telescope configuration
-- config = function()
-- local telescope = require('telescope')
-- -- Only apply our patch if telescope is loaded
-- local utils = require('telescope.utils')
-- local original_path_expand = utils.path_expand
-- -- Override path_expand with a safer version that handles nil paths
-- utils.path_expand = function(path)
-- if path == nil then
-- -- Return the current working directory if path is nil
-- return vim.fn.getcwd() or vim.fn.expand('%:p:h') or '.'
-- end
-- return original_path_expand(path)
-- end
-- -- Any additional telescope settings can be set here
-- telescope.setup({
-- defaults = {
-- path_display = { "truncate" },
-- mappings = {
-- i = {
-- ["<C-u>"] = false,
-- ["<C-d>"] = false,
-- },
-- },
-- },
-- })
-- end,
-- }