Skip to content

Commit d00f775

Browse files
Adding major changes with the precision
1 parent 8761100 commit d00f775

File tree

8 files changed

+296
-23
lines changed

8 files changed

+296
-23
lines changed

init.lua

Lines changed: 39 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -458,7 +458,7 @@ require('lazy').setup({
458458
vim.keymap.set('n', '<leader>sd', builtin.diagnostics, { desc = '[S]earch [D]iagnostics' })
459459
vim.keymap.set('n', '<leader>sr', builtin.resume, { desc = '[S]earch [R]esume' })
460460
vim.keymap.set('n', '<leader>s.', builtin.oldfiles, { desc = '[S]earch Recent Files ("." for repeat)' })
461-
vim.keymap.set('n', '<leader><leader>', builtin.buffers, { desc = '[ ] Find existing buffers' })
461+
vim.keymap.set('n', '<leader><leader>', function() builtin.buffers() end, { desc = '[ ] Find existing buffers' })
462462

463463
-- Slightly advanced example of overriding default behavior and theme
464464
vim.keymap.set('n', '<leader>/', function()
@@ -899,28 +899,52 @@ require('lazy').setup({
899899
},
900900
},
901901

902-
{ -- You can easily change to a different colorscheme.
903-
-- Change the name of the colorscheme plugin below, and then
904-
-- change the command in the config to whatever the name of that colorscheme is.
905-
--
906-
-- If you want to see what colorschemes are already installed, you can use `:Telescope colorscheme`.
907-
'folke/tokyonight.nvim',
908-
priority = 1000, -- Make sure to load this before all the other start plugins.
902+
-- Load catppuccin theme at startup
903+
{
904+
'catppuccin/nvim',
905+
name = 'catppuccin',
906+
priority = 1000, -- Make sure to load this before all the other start plugins
909907
config = function()
910-
---@diagnostic disable-next-line: missing-fields
911-
require('tokyonight').setup {
908+
-- Configure the theme
909+
require('catppuccin').setup {
910+
flavour = 'mocha', -- latte, frappe, macchiato, mocha
911+
background = {
912+
light = 'latte',
913+
dark = 'mocha',
914+
},
915+
transparent_background = false,
912916
styles = {
913-
comments = { italic = false }, -- Disable italics in comments
917+
comments = { 'italic' },
918+
conditionals = { 'italic' },
919+
},
920+
integrations = {
921+
cmp = true,
922+
gitsigns = true,
923+
nvimtree = true,
924+
telescope = true,
925+
treesitter = true,
914926
},
915927
}
916928

917-
-- Load the colorscheme here.
918-
-- Like many other themes, this one has different styles, and you could load
919-
-- any other, such as 'tokyonight-storm', 'tokyonight-moon', or 'tokyonight-day'.
920-
vim.cmd.colorscheme 'tokyonight-night'
929+
-- Load the colorscheme
930+
vim.cmd.colorscheme 'catppuccin'
921931
end,
922932
},
923933

934+
-- Original tokyonight theme (commented out)
935+
-- { -- You can easily change to a different colorscheme.
936+
-- 'folke/tokyonight.nvim',
937+
-- priority = 1000,
938+
-- config = function()
939+
-- require('tokyonight').setup {
940+
-- styles = {
941+
-- comments = { italic = false },
942+
-- },
943+
-- }
944+
-- vim.cmd.colorscheme 'tokyonight-night'
945+
-- end,
946+
-- },
947+
924948
-- Highlight todo, notes, etc in comments
925949
{ 'folke/todo-comments.nvim', event = 'VimEnter', dependencies = { 'nvim-lua/plenary.nvim' }, opts = { signs = false } },
926950

lua/custom/plugins/comment.lua

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
-- Comment.nvim - Smart and powerful commenting plugin
2+
-- https://github.com/numToStr/Comment.nvim
3+
4+
return {
5+
"numToStr/Comment.nvim",
6+
event = "VeryLazy",
7+
config = function()
8+
require('Comment').setup({
9+
-- Add a space between comment and the line
10+
padding = true,
11+
-- Whether cursor should stay at its position
12+
sticky = true,
13+
-- LHS of toggle mappings in NORMAL mode
14+
toggler = {
15+
-- Line-comment toggle keymap
16+
line = 'gcc',
17+
-- Block-comment toggle keymap
18+
block = 'gbc',
19+
},
20+
-- LHS of operator-pending mappings in NORMAL and VISUAL mode
21+
opleader = {
22+
-- Line-comment keymap
23+
line = 'gc',
24+
-- Block-comment keymap
25+
block = 'gb',
26+
},
27+
-- LHS of extra mappings
28+
extra = {
29+
-- Add comment on the line above
30+
above = 'gcO',
31+
-- Add comment on the line below
32+
below = 'gco',
33+
-- Add comment at the end of line
34+
eol = 'gcA',
35+
},
36+
-- Enable keybindings
37+
mappings = {
38+
-- Operator-pending mapping
39+
basic = true,
40+
-- Extra mapping
41+
extra = true,
42+
},
43+
-- Pre-hook, called before commenting the line
44+
-- Can be used with treesitter for better tsx/jsx commenting
45+
pre_hook = nil,
46+
-- Post-hook, called after commenting is done
47+
post_hook = nil,
48+
})
49+
end,
50+
}

lua/custom/plugins/copilot-chat.lua

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -174,8 +174,10 @@ return {
174174

175175
-- Toggle inline chat for quick questions about the current line
176176
vim.keymap.set("n", "<leader>cl", function()
177-
select.line()
178-
chat.toggle()
177+
-- Use chat.ask with a line selector instead of separate select.line() call
178+
chat.ask("What does this line of code do?", {
179+
selection = select.line, -- Pass the function reference, not the function call
180+
})
179181
end, { desc = "Chat About Current Line" })
180182

181183
-- Open Copilot Chat with a custom prompt

lua/custom/plugins/init.lua

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,8 @@ return {
1212
{ import = "custom.plugins.harpoon" },
1313
{ import = "custom.plugins.lazygit" },
1414
{ import = "custom.plugins.toggleterm" },
15+
{ import = "custom.plugins.comment" },
16+
{ import = "custom.plugins.leetcode" },
17+
-- { import = "custom.plugins.telescope_fix" },
18+
{ import = "custom.plugins.catppuccin" },
1519
}

lua/custom/plugins/lazygit.lua

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,12 @@ return {
2525
-- Plugin configuration
2626
config = function()
2727
-- Configure floating window border
28-
require("lazygit").setup({
29-
floating_window_winblend = 0, -- transparency of floating window
30-
floating_window_scaling_factor = 0.9, -- scaling factor for floating window
31-
floating_window_border_chars = { '', '', '', '', '', '', '', '' }, -- customize floating window border chars
32-
lazygit_floating_window_use_plenary = true, -- use plenary.nvim to manage floating window if available
33-
})
28+
-- require("lazygit").setup({
29+
-- -- floating_window_winblend = 0, -- transparency of floating window
30+
-- floating_window_scaling_factor = 0.9, -- scaling factor for floating window
31+
-- floating_window_border_chars = { '╭', '─', '╮', '│', '╯', '─', '╰', '│' }, -- customize floating window border chars
32+
-- lazygit_floating_window_use_plenary = true, -- use plenary.nvim to manage floating window if available
33+
-- })
3434
end,
3535
}
3636
}

lua/custom/plugins/leetcode.lua

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
-- filepath: /home/kali/.config/nvim/lua/custom/plugins/leetcode.lua
2+
-- LeetCode.nvim - Solve LeetCode problems within Neovim
3+
-- https://github.com/kawre/leetcode.nvim
4+
5+
return {
6+
"kawre/leetcode.nvim",
7+
dependencies = {
8+
"nvim-telescope/telescope.nvim",
9+
"nvim-lua/plenary.nvim",
10+
"MunifTanjim/nui.nvim",
11+
"nvim-tree/nvim-web-devicons", -- optional but recommended
12+
"nvim-treesitter/nvim-treesitter" -- make sure treesitter is a direct dependency
13+
},
14+
build = function()
15+
-- Make sure the HTML parser is installed for treesitter
16+
require("nvim-treesitter.install").ensure_installed("html")
17+
end,
18+
config = function()
19+
require("leetcode").setup({
20+
-- Default language for solving problems
21+
lang = "python3", -- you can change this to your preferred language
22+
23+
-- Storage directories
24+
storage = {
25+
home = vim.fn.stdpath("data") .. "/leetcode",
26+
cache = vim.fn.stdpath("cache") .. "/leetcode",
27+
},
28+
29+
-- Console settings
30+
console = {
31+
open_on_runcode = true,
32+
dir = "row", -- "row" or "col" for horizontal or vertical split
33+
size = {
34+
width = "90%",
35+
height = "75%",
36+
},
37+
result = {
38+
size = "60%",
39+
},
40+
testcase = {
41+
virt_text = true,
42+
size = "40%",
43+
},
44+
},
45+
46+
-- Description panel settings
47+
description = {
48+
position = "left", -- "left" or "right"
49+
width = "40%",
50+
show_stats = true, -- show problem stats in description panel
51+
},
52+
53+
-- You can choose either telescope or fzf-lua
54+
picker = {
55+
provider = "telescope", -- set to "fzf-lua" if you prefer that
56+
},
57+
58+
-- Default keybindings - these won't conflict with your existing mappings
59+
-- as they only activate within LeetCode buffers
60+
keys = {
61+
toggle = { "q" },
62+
confirm = { "<CR>" },
63+
64+
reset_testcases = "r",
65+
use_testcase = "U",
66+
focus_testcases = "H",
67+
focus_result = "L",
68+
},
69+
70+
-- Code injection settings - adds useful imports automatically
71+
injector = {
72+
["cpp"] = {
73+
before = { "#include <bits/stdc++.h>", "using namespace std;" },
74+
},
75+
["java"] = {
76+
before = "import java.util.*;",
77+
},
78+
["python3"] = {
79+
before = true, -- use default imports
80+
},
81+
},
82+
83+
-- Enable logging
84+
logging = true,
85+
86+
-- Non-standalone mode (false means it won't interfere with your normal workflow)
87+
plugins = {
88+
non_standalone = false,
89+
},
90+
})
91+
end,
92+
cmd = "Leet", -- lazy-load on command
93+
}
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
# LeetCode.nvim Guide: Solve LeetCode Problems in Neovim
2+
3+
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.
4+
5+
## Getting Started
6+
7+
1. Open the LeetCode interface with command:
8+
9+
```
10+
:Leet
11+
```
12+
13+
2. You'll need to log in to your LeetCode account the first time you run it.
14+
15+
## Basic Commands
16+
17+
- `:Leet` - Opens the main LeetCode menu
18+
- `:Leet daily` - Open today's daily challenge
19+
- `:Leet random` - Get a random problem
20+
- `:Leet list` - Browse all problems
21+
- `:Leet tabs` - Switch between open problems
22+
- `:Leet submit` - Submit current solution
23+
- `:Leet run` - Run current solution with test cases
24+
- `:Leet reset` - Reset the code to default template
25+
- `:Leet lang` - Change programming language for current problem
26+
- `:Leet cookie update` - Update your LeetCode cookie
27+
28+
## Filter Problems
29+
30+
When using `:Leet list` or `:Leet random`, you can filter problems:
31+
32+
- By difficulty: `difficulty=easy/medium/hard`
33+
- By status: `status=ac/notac/todo`
34+
- By tags: `tags=array,string,dp`
35+
36+
Example:
37+
38+
```
39+
:Leet list difficulty=medium status=notac
40+
:Leet random status=todo difficulty=hard
41+
```
42+
43+
## Keybindings Within LeetCode UI
44+
45+
These keys only work within the LeetCode interface and won't conflict with your existing keymaps:
46+
47+
- `q` - Toggle/close panels
48+
- `<CR>` (Enter) - Confirm selection
49+
- `r` - Reset test cases
50+
- `U` - Use a custom test case
51+
- `H` - Focus on test cases panel
52+
- `L` - Focus on results panel
53+
54+
## Tips for Use
55+
56+
1. **Switch Languages**: Use `:Leet lang` to change your programming language for the current problem.
57+
58+
2. **Multiple Problems**: You can have multiple LeetCode problems open in different tabs.
59+
60+
3. **Code Auto-Injection**: Useful imports and boilerplate code are automatically added for common languages.
61+
62+
4. **Description Format**: Problem descriptions are formatted for better readability, including proper markdown rendering.
63+
64+
5. **Efficient Workflow**: LeetCode.nvim caches your progress, making it faster to get back to your problems.
65+
66+
Enjoy solving LeetCode problems without leaving your favorite editor!
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
-- Fix for Telescope error with nil paths
2+
-- return {
3+
-- "nvim-telescope/telescope.nvim",
4+
-- -- This will only modify the existing telescope configuration
5+
-- config = function()
6+
-- local telescope = require('telescope')
7+
8+
-- -- Only apply our patch if telescope is loaded
9+
-- local utils = require('telescope.utils')
10+
-- local original_path_expand = utils.path_expand
11+
12+
-- -- Override path_expand with a safer version that handles nil paths
13+
-- utils.path_expand = function(path)
14+
-- if path == nil then
15+
-- -- Return the current working directory if path is nil
16+
-- return vim.fn.getcwd() or vim.fn.expand('%:p:h') or '.'
17+
-- end
18+
-- return original_path_expand(path)
19+
-- end
20+
21+
-- -- Any additional telescope settings can be set here
22+
-- telescope.setup({
23+
-- defaults = {
24+
-- path_display = { "truncate" },
25+
-- mappings = {
26+
-- i = {
27+
-- ["<C-u>"] = false,
28+
-- ["<C-d>"] = false,
29+
-- },
30+
-- },
31+
-- },
32+
-- })
33+
-- end,
34+
-- }

0 commit comments

Comments
 (0)