mirror of
https://github.com/nvim-lua/kickstart.nvim.git
synced 2025-06-25 22:58:36 +02:00
done maybe
This commit is contained in:
parent
d00f77555e
commit
c54b71fdd4
24 changed files with 2632 additions and 501 deletions
|
@ -1,192 +1,287 @@
|
|||
-- filepath: /home/kali/.config/nvim/lua/custom/plugins/copilot-chat.lua
|
||||
-- GitHub Copilot Chat configuration
|
||||
-- An advanced setup for Copilot Chat in Neovim
|
||||
--gitHub Copilot Chat configuration - Latest v3+ setup
|
||||
-- Comprehensive configuration with all features and working keymaps
|
||||
-- https://github.com/CopilotC-Nvim/CopilotChat.nvim
|
||||
|
||||
-- Declare vim as global
|
||||
local vim = vim
|
||||
|
||||
return {
|
||||
"CopilotC-Nvim/CopilotChat.nvim",
|
||||
branch = "main", -- Ensure we're using the stable main branch
|
||||
dependencies = {
|
||||
-- Dependencies for CopilotChat
|
||||
{ "github/copilot.vim" }, -- The base Copilot plugin
|
||||
{ "nvim-lua/plenary.nvim" }, -- Common Lua functions
|
||||
{ "nvim-telescope/telescope.nvim" }, -- For nice UI integration
|
||||
{ "nvim-tree/nvim-web-devicons" }, -- Icons for enhanced UI
|
||||
{ "github/copilot.vim" }, -- or zbirenbaum/copilot.lua
|
||||
{ "nvim-lua/plenary.nvim", branch = "master" }, -- for curl, log and async functions
|
||||
},
|
||||
-- Load after GitHub Copilot and when a file is opened
|
||||
event = { "VeryLazy" },
|
||||
build = "make tiktoken", -- Only on MacOS or Linux
|
||||
event = "VeryLazy",
|
||||
|
||||
config = function()
|
||||
local chat = require("CopilotChat")
|
||||
local select = require("CopilotChat.select")
|
||||
|
||||
-- Configure the plugin with advanced settings
|
||||
-- Setup CopilotChat with comprehensive configuration
|
||||
chat.setup({
|
||||
-- Show Copilot Chat window border
|
||||
-- Model configuration
|
||||
model = 'gpt-4.1', -- Default model to use, see ':CopilotChatModels' for available models
|
||||
agent = 'copilot', -- Default agent to use, see ':CopilotChatAgents' for available agents
|
||||
context = nil, -- Default context or array of contexts to use
|
||||
|
||||
-- Temperature for GPT responses (0.1 = more focused, 1.0 = more creative)
|
||||
temperature = 0.1,
|
||||
|
||||
-- Window configuration
|
||||
window = {
|
||||
border = "rounded", -- Make the window look nice
|
||||
width = 80, -- Default width
|
||||
height = 20, -- Default height
|
||||
title = {
|
||||
name = "Copilot Chat", -- Custom title
|
||||
alignment = "center", -- Center the title
|
||||
},
|
||||
layout = 'vertical', -- 'vertical', 'horizontal', 'float', 'replace'
|
||||
width = 0.5, -- fractional width of parent
|
||||
height = 0.5, -- fractional height of parent
|
||||
-- Options for floating windows
|
||||
relative = 'editor', -- 'editor', 'win', 'cursor', 'mouse'
|
||||
border = 'rounded', -- 'none', 'single', 'double', 'rounded', 'solid', 'shadow'
|
||||
title = 'Copilot Chat',
|
||||
footer = nil,
|
||||
zindex = 1,
|
||||
},
|
||||
|
||||
-- File context features
|
||||
context = {
|
||||
-- Include 5 lines above and below the cursor for context
|
||||
cursor_context = 5,
|
||||
|
||||
-- Include the entire selection when using visual mode
|
||||
selection_context = true,
|
||||
|
||||
-- Show context-aware commit history
|
||||
git_context = true,
|
||||
},
|
||||
-- UI settings
|
||||
show_help = true, -- Shows help message as virtual lines when waiting for user input
|
||||
highlight_selection = true, -- Highlight selection in source buffer
|
||||
highlight_headers = true, -- Highlight headers in chat
|
||||
auto_follow_cursor = true, -- Auto-follow cursor in chat
|
||||
auto_insert_mode = false, -- Automatically enter insert mode when opening window
|
||||
insert_at_end = false, -- Move cursor to end of buffer when inserting text
|
||||
clear_chat_on_new_prompt = false, -- Clears chat on every new prompt
|
||||
|
||||
-- Enable debug (set to true only when troubleshooting)
|
||||
debug = false,
|
||||
-- Chat features
|
||||
chat_autocomplete = true, -- Enable chat autocompletion
|
||||
|
||||
-- Enable syntax highlighting in response
|
||||
syntax_highlighting = true,
|
||||
-- Default selection (uses visual selection or falls back to buffer)
|
||||
selection = function(source)
|
||||
return select.visual(source) or select.buffer(source)
|
||||
end,
|
||||
|
||||
-- Enable auto-sizing of response window
|
||||
auto_size = true,
|
||||
|
||||
-- Define prompts that can be used in commands
|
||||
-- Custom prompts for various coding tasks
|
||||
prompts = {
|
||||
-- Default prompts
|
||||
-- Code explanation
|
||||
Explain = {
|
||||
prompt = "Explain how the following code works in detail:\n```$filetype\n$selection\n```",
|
||||
prompt = 'Write an explanation for the selected code as paragraphs of text.',
|
||||
system_prompt = 'COPILOT_EXPLAIN',
|
||||
},
|
||||
FixCode = {
|
||||
prompt = "Fix the following code. Provide the corrected version and explanations for the fixes:\n```$filetype\n$selection\n```",
|
||||
|
||||
-- Code review
|
||||
Review = {
|
||||
prompt = 'Review the selected code.',
|
||||
system_prompt = 'COPILOT_REVIEW',
|
||||
},
|
||||
|
||||
-- Bug fixes
|
||||
Fix = {
|
||||
prompt = 'There is a problem in this code. Identify the issues and rewrite the code with fixes. Explain what was wrong and how your changes address the problems.',
|
||||
},
|
||||
|
||||
-- Code optimization
|
||||
Optimize = {
|
||||
prompt = "Optimize the following code. Provide the optimized version and explain the improvements:\n```$filetype\n$selection\n```",
|
||||
prompt = 'Optimize the selected code to improve performance and readability. Explain your optimization strategy and the benefits of your changes.',
|
||||
},
|
||||
-- Advanced prompts
|
||||
Documentation = {
|
||||
prompt = "Generate comprehensive documentation for this code:\n```$filetype\n$selection\n```\nInclude descriptions of parameters, return values, exceptions, and provide usage examples.",
|
||||
},
|
||||
BestPractices = {
|
||||
prompt = "Review this code for best practices and suggest improvements:\n```$filetype\n$selection\n```",
|
||||
|
||||
-- Documentation generation
|
||||
Docs = {
|
||||
prompt = 'Please add documentation comments to the selected code.',
|
||||
},
|
||||
|
||||
-- Test generation
|
||||
Tests = {
|
||||
prompt = "Generate unit tests for the following code:\n```$filetype\n$selection\n```",
|
||||
prompt = 'Please generate tests for my code.',
|
||||
},
|
||||
-- Context-aware code generation
|
||||
Implement = {
|
||||
prompt = "Implement the following functionality: $input\nMake it work with the following context:\n```$filetype\n$selection\n```",
|
||||
strategy = "quick_fix", -- Use the quick fix strategy for implementation
|
||||
|
||||
-- Commit message generation
|
||||
Commit = {
|
||||
prompt = 'Write commit message for the change with commitizen convention. Keep the title under 50 characters and wrap message at 72 characters. Format as a gitcommit code block.',
|
||||
context = 'git:staged',
|
||||
},
|
||||
RefactorToPattern = {
|
||||
prompt = "Refactor the following code to use the $input design pattern. Explain the benefits of this refactoring:\n```$filetype\n$selection\n```",
|
||||
|
||||
-- Custom advanced prompts
|
||||
Refactor = {
|
||||
prompt = 'Please refactor the following code to improve its structure and readability. Explain the changes you made and why they improve the code.',
|
||||
},
|
||||
|
||||
BestPractices = {
|
||||
prompt = 'Review this code for best practices and suggest improvements. Focus on code quality, maintainability, and adherence to language-specific conventions.',
|
||||
},
|
||||
|
||||
Security = {
|
||||
prompt = 'Analyze this code for potential security vulnerabilities and suggest fixes. Consider common security issues like injection attacks, authentication, authorization, and data validation.',
|
||||
},
|
||||
|
||||
Performance = {
|
||||
prompt = 'Analyze this code for performance issues and suggest optimizations. Consider algorithmic complexity, memory usage, and language-specific performance patterns.',
|
||||
},
|
||||
|
||||
-- Context-aware prompts
|
||||
ImplementFeature = {
|
||||
prompt = 'Based on the selected code, implement the following feature: ',
|
||||
mapping = '<leader>cif',
|
||||
description = 'Implement a new feature based on existing code',
|
||||
},
|
||||
|
||||
ExplainError = {
|
||||
prompt = 'Explain this error and provide a solution: ',
|
||||
mapping = '<leader>cee',
|
||||
description = 'Explain error and provide solution',
|
||||
},
|
||||
},
|
||||
|
||||
-- Custom mappings for chat buffer
|
||||
mappings = {
|
||||
complete = {
|
||||
insert = '<Tab>',
|
||||
},
|
||||
close = {
|
||||
normal = 'q',
|
||||
insert = '<C-c>',
|
||||
},
|
||||
reset = {
|
||||
normal = '<C-l>',
|
||||
insert = '<C-l>',
|
||||
},
|
||||
submit_prompt = {
|
||||
normal = '<CR>',
|
||||
insert = '<C-s>',
|
||||
},
|
||||
toggle_sticky = {
|
||||
normal = 'grr',
|
||||
},
|
||||
clear_stickies = {
|
||||
normal = 'grx',
|
||||
},
|
||||
accept_diff = {
|
||||
normal = '<C-y>',
|
||||
insert = '<C-y>',
|
||||
},
|
||||
jump_to_diff = {
|
||||
normal = 'gj',
|
||||
},
|
||||
quickfix_answers = {
|
||||
normal = 'gqa',
|
||||
},
|
||||
quickfix_diffs = {
|
||||
normal = 'gqd',
|
||||
},
|
||||
yank_diff = {
|
||||
normal = 'gy',
|
||||
register = '"',
|
||||
},
|
||||
show_diff = {
|
||||
normal = 'gd',
|
||||
full_diff = false,
|
||||
},
|
||||
show_info = {
|
||||
normal = 'gi',
|
||||
},
|
||||
show_context = {
|
||||
normal = 'gc',
|
||||
},
|
||||
show_help = {
|
||||
normal = 'gh',
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
-- Add custom keymaps for the chat buffer
|
||||
vim.api.nvim_create_autocmd("FileType", {
|
||||
pattern = "copilot-chat",
|
||||
callback = function()
|
||||
local buf = vim.api.nvim_get_current_buf()
|
||||
|
||||
-- Close window with 'q'
|
||||
vim.keymap.set("n", "q", function()
|
||||
vim.cmd("close")
|
||||
end, { buffer = buf, silent = true })
|
||||
|
||||
-- Reset chat with Ctrl+L
|
||||
vim.keymap.set("n", "<C-l>", function()
|
||||
chat.reset()
|
||||
end, { buffer = buf, silent = true })
|
||||
|
||||
-- -- Submit prompt with Enter in insert mode
|
||||
-- vim.keymap.set("i", "<CR>", function()
|
||||
-- -- require("CopilotChat").submit_prompt()
|
||||
-- chat.submit_prompt()
|
||||
-- end, { buffer = buf, silent = true })
|
||||
|
||||
-- -- Submit prompt with Enter in normal mode
|
||||
-- vim.keymap.set("n", "<CR>", function()
|
||||
-- require("CopilotChat").submit_prompt()
|
||||
-- end, { buffer = buf, silent = true })
|
||||
|
||||
-- Show diff with Ctrl+D
|
||||
vim.keymap.set("n", "<C-d>", function()
|
||||
require("CopilotChat").show_diff()
|
||||
end, { buffer = buf, silent = true })
|
||||
|
||||
-- Accept diff with Ctrl+Y
|
||||
vim.keymap.set("n", "<C-y>", function()
|
||||
require("CopilotChat").accept_diff()
|
||||
end, { buffer = buf, silent = true })
|
||||
end
|
||||
})
|
||||
-- Global keymaps for CopilotChat
|
||||
-- Core commands
|
||||
vim.keymap.set("n", "<leader>cc", function() chat.toggle() end, { desc = "Toggle Copilot Chat" })
|
||||
vim.keymap.set("n", "<leader>co", function() chat.open() end, { desc = "Open Copilot Chat" })
|
||||
vim.keymap.set("n", "<leader>cx", function() chat.close() end, { desc = "Close Copilot Chat" })
|
||||
vim.keymap.set("n", "<leader>cr", function() chat.reset() end, { desc = "Reset Copilot Chat" })
|
||||
vim.keymap.set("n", "<leader>cs", function() chat.stop() end, { desc = "Stop Copilot Chat" })
|
||||
|
||||
-- Set up key bindings
|
||||
vim.keymap.set("n", "<leader>cc", "<cmd>CopilotChat<CR>", { desc = "Copilot Chat" })
|
||||
vim.keymap.set("n", "<leader>ce", "<cmd>CopilotChatExplain<CR>", { desc = "Explain Code" })
|
||||
vim.keymap.set("n", "<leader>cf", "<cmd>CopilotChatFixCode<CR>", { desc = "Fix Code" })
|
||||
vim.keymap.set("n", "<leader>co", "<cmd>CopilotChatOptimize<CR>", { desc = "Optimize Code" })
|
||||
vim.keymap.set("n", "<leader>cd", "<cmd>CopilotChatDocumentation<CR>", { desc = "Generate Documentation" })
|
||||
vim.keymap.set("n", "<leader>ct", "<cmd>CopilotChatTests<CR>", { desc = "Generate Tests" })
|
||||
vim.keymap.set("n", "<leader>cb", "<cmd>CopilotChatBestPractices<CR>", { desc = "Check Best Practices" })
|
||||
-- Prompt-based commands - these work with current selection
|
||||
vim.keymap.set({"n", "v"}, "<leader>cce", "<cmd>CopilotChatExplain<cr>", { desc = "Explain code" })
|
||||
vim.keymap.set({"n", "v"}, "<leader>ccr", "<cmd>CopilotChatReview<cr>", { desc = "Review code" })
|
||||
vim.keymap.set({"n", "v"}, "<leader>ccf", "<cmd>CopilotChatFix<cr>", { desc = "Fix code" })
|
||||
vim.keymap.set({"n", "v"}, "<leader>cco", "<cmd>CopilotChatOptimize<cr>", { desc = "Optimize code" })
|
||||
vim.keymap.set({"n", "v"}, "<leader>ccd", "<cmd>CopilotChatDocs<cr>", { desc = "Generate docs" })
|
||||
vim.keymap.set({"n", "v"}, "<leader>cct", "<cmd>CopilotChatTests<cr>", { desc = "Generate tests" })
|
||||
vim.keymap.set({"n", "v"}, "<leader>ccrf", "<cmd>CopilotChatRefactor<cr>", { desc = "Refactor code" })
|
||||
vim.keymap.set({"n", "v"}, "<leader>ccb", "<cmd>CopilotChatBestPractices<cr>", { desc = "Best practices" })
|
||||
vim.keymap.set({"n", "v"}, "<leader>ccs", "<cmd>CopilotChatSecurity<cr>", { desc = "Security review" })
|
||||
vim.keymap.set({"n", "v"}, "<leader>ccp", "<cmd>CopilotChatPerformance<cr>", { desc = "Performance review" })
|
||||
|
||||
-- Visual mode mappings for selected code
|
||||
vim.keymap.set("v", "<leader>ce", ":CopilotChatExplain<CR>", { desc = "Explain Selected Code" })
|
||||
vim.keymap.set("v", "<leader>cf", ":CopilotChatFixCode<CR>", { desc = "Fix Selected Code" })
|
||||
vim.keymap.set("v", "<leader>co", ":CopilotChatOptimize<CR>", { desc = "Optimize Selected Code" })
|
||||
vim.keymap.set("v", "<leader>cd", ":CopilotChatDocumentation<CR>", { desc = "Document Selected Code" })
|
||||
vim.keymap.set("v", "<leader>ct", ":CopilotChatTests<CR>", { desc = "Generate Tests for Selected Code" })
|
||||
-- Git integration
|
||||
vim.keymap.set("n", "<leader>ccg", "<cmd>CopilotChatCommit<cr>", { desc = "Generate commit message" })
|
||||
|
||||
-- Create a custom input command with implementation suggestions
|
||||
vim.keymap.set("v", "<leader>ci", function()
|
||||
vim.ui.input({ prompt = "What would you like to implement? " }, function(input)
|
||||
if input then
|
||||
select.selection()
|
||||
chat.ask("Implement: " .. input)
|
||||
-- Advanced features
|
||||
vim.keymap.set("n", "<leader>ccm", "<cmd>CopilotChatModels<cr>", { desc = "Select model" })
|
||||
vim.keymap.set("n", "<leader>cca", "<cmd>CopilotChatAgents<cr>", { desc = "Select agent" })
|
||||
vim.keymap.set("n", "<leader>ccp", "<cmd>CopilotChatPrompts<cr>", { desc = "Select prompt" })
|
||||
|
||||
-- Chat history
|
||||
vim.keymap.set("n", "<leader>ccl", function()
|
||||
vim.ui.input({ prompt = "Load chat (name): " }, function(name)
|
||||
if name then
|
||||
chat.load(name)
|
||||
end
|
||||
end)
|
||||
end, { desc = "Implement Functionality" })
|
||||
end, { desc = "Load chat history" })
|
||||
|
||||
-- Add quick access to buffer context
|
||||
vim.keymap.set("n", "<leader>cb", function()
|
||||
chat.ask("What does this code do? Consider the full context of the file.", {
|
||||
selection = select.buffer,
|
||||
})
|
||||
end, { desc = "Explain Buffer" })
|
||||
|
||||
-- Refactor the current selection to use a specific design pattern
|
||||
vim.keymap.set("v", "<leader>cr", function()
|
||||
vim.ui.input({ prompt = "Which design pattern to refactor to? " }, function(input)
|
||||
if input then
|
||||
select.selection()
|
||||
chat.ask("RefactorToPattern: " .. input)
|
||||
vim.keymap.set("n", "<leader>ccS", function()
|
||||
vim.ui.input({ prompt = "Save chat (name): " }, function(name)
|
||||
if name then
|
||||
chat.save(name)
|
||||
end
|
||||
end)
|
||||
end, { desc = "Refactor to Design Pattern" })
|
||||
end, { desc = "Save chat history" })
|
||||
|
||||
-- Toggle inline chat for quick questions about the current line
|
||||
vim.keymap.set("n", "<leader>cl", function()
|
||||
-- Use chat.ask with a line selector instead of separate select.line() call
|
||||
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" })
|
||||
|
||||
-- Open Copilot Chat with a custom prompt
|
||||
vim.keymap.set("n", "<leader>cp", function()
|
||||
-- Custom prompts with input
|
||||
vim.keymap.set({"n", "v"}, "<leader>cci", function()
|
||||
vim.ui.input({ prompt = "Ask Copilot: " }, function(input)
|
||||
if input then
|
||||
chat.ask(input)
|
||||
end
|
||||
end)
|
||||
end, { desc = "Ask Copilot" })
|
||||
end, { desc = "Ask custom question" })
|
||||
|
||||
-- Context-specific commands
|
||||
vim.keymap.set("n", "<leader>ccbf", function()
|
||||
chat.ask("Explain what this file does and its main purpose.", {
|
||||
selection = select.buffer,
|
||||
})
|
||||
end, { desc = "Explain buffer" })
|
||||
|
||||
vim.keymap.set("n", "<leader>ccgd", function()
|
||||
chat.ask("Explain these git changes.", {
|
||||
context = "git",
|
||||
})
|
||||
end, { desc = "Explain git diff" })
|
||||
|
||||
-- Line-specific command
|
||||
vim.keymap.set("n", "<leader>ccl", function()
|
||||
chat.ask("Explain this line of code in detail.", {
|
||||
selection = select.line,
|
||||
})
|
||||
end, { desc = "Explain current line" })
|
||||
|
||||
-- Quick actions for selected text
|
||||
vim.keymap.set("v", "<leader>cq", function()
|
||||
chat.ask("Quick question about this code: " .. vim.fn.input("Question: "), {
|
||||
selection = select.visual,
|
||||
})
|
||||
end, { desc = "Quick question about selection" })
|
||||
|
||||
-- Buffer auto-commands for chat window
|
||||
vim.api.nvim_create_autocmd("BufEnter", {
|
||||
pattern = "copilot-*",
|
||||
callback = function()
|
||||
-- Set buffer-local options for better UX
|
||||
vim.opt_local.relativenumber = false
|
||||
vim.opt_local.number = false
|
||||
vim.opt_local.cursorline = false
|
||||
vim.opt_local.signcolumn = "no"
|
||||
vim.opt_local.foldcolumn = "0"
|
||||
end,
|
||||
})
|
||||
|
||||
-- Notification on chat completion
|
||||
vim.api.nvim_create_autocmd("User", {
|
||||
pattern = "CopilotChatComplete",
|
||||
callback = function()
|
||||
vim.notify("Copilot Chat response complete", vim.log.levels.INFO)
|
||||
end,
|
||||
})
|
||||
end,
|
||||
}
|
||||
|
|
|
@ -16,4 +16,6 @@ return {
|
|||
{ import = "custom.plugins.leetcode" },
|
||||
-- { import = "custom.plugins.telescope_fix" },
|
||||
{ import = "custom.plugins.catppuccin" },
|
||||
{ import = "custom.plugins.neorg" },
|
||||
{ import = "custom.plugins.which_key_integration" }, -- Load which-key integration
|
||||
}
|
||||
|
|
52
lua/custom/plugins/jdtls_config.lua
Normal file
52
lua/custom/plugins/jdtls_config.lua
Normal file
|
@ -0,0 +1,52 @@
|
|||
--[[
|
||||
JDTLS Configuration
|
||||
|
||||
This file configures the Java Development Tools Language Server (jdtls)
|
||||
to fix deprecation warnings and JVM restrictions.
|
||||
]]
|
||||
|
||||
return {
|
||||
-- Override the default jdtls setup
|
||||
{
|
||||
"neovim/nvim-lspconfig",
|
||||
opts = {
|
||||
-- Configure jdtls with the necessary JVM arguments to fix warnings
|
||||
setup = {
|
||||
jdtls = function(_, opts)
|
||||
-- Get existing Java arguments or initialize an empty table
|
||||
local java_args = opts.cmd or {}
|
||||
|
||||
-- Add the necessary JVM arguments to fix the deprecation warnings
|
||||
local fixed_java_args = {
|
||||
-- Enable unrestricted access to JDK internal API
|
||||
"--enable-native-access=ALL-UNNAMED",
|
||||
-- Explicitly allow these modules to eliminate warnings
|
||||
"--add-modules=jdk.incubator.vector",
|
||||
-- Suppress deprecation warnings
|
||||
"-Dsun.misc.Unsafe.allowDeprecation=true",
|
||||
}
|
||||
|
||||
-- Find the java command index in the cmd array
|
||||
local java_cmd_index = 1
|
||||
for i, arg in ipairs(java_args) do
|
||||
if arg:match("java$") then
|
||||
java_cmd_index = i
|
||||
break
|
||||
end
|
||||
end
|
||||
|
||||
-- Insert our arguments after the java command
|
||||
for i, arg in ipairs(fixed_java_args) do
|
||||
table.insert(java_args, java_cmd_index + i, arg)
|
||||
end
|
||||
|
||||
-- Update the command
|
||||
opts.cmd = java_args
|
||||
|
||||
-- Return false to let the default handler continue
|
||||
return false
|
||||
end,
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
|
@ -3,91 +3,91 @@
|
|||
-- https://github.com/kawre/leetcode.nvim
|
||||
|
||||
return {
|
||||
"kawre/leetcode.nvim",
|
||||
'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
|
||||
'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")
|
||||
require('nvim-treesitter.install').ensure_installed 'html'
|
||||
end,
|
||||
config = function()
|
||||
require("leetcode").setup({
|
||||
require('leetcode').setup {
|
||||
-- Default language for solving problems
|
||||
lang = "python3", -- you can change this to your preferred language
|
||||
|
||||
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",
|
||||
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
|
||||
dir = 'row', -- "row" or "col" for horizontal or vertical split
|
||||
size = {
|
||||
width = "90%",
|
||||
height = "75%",
|
||||
width = '90%',
|
||||
height = '75%',
|
||||
},
|
||||
result = {
|
||||
size = "60%",
|
||||
size = '60%',
|
||||
},
|
||||
testcase = {
|
||||
virt_text = true,
|
||||
size = "40%",
|
||||
size = '40%',
|
||||
},
|
||||
},
|
||||
|
||||
|
||||
-- Description panel settings
|
||||
description = {
|
||||
position = "left", -- "left" or "right"
|
||||
width = "40%",
|
||||
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
|
||||
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",
|
||||
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;" },
|
||||
['cpp'] = {
|
||||
before = { '#include <bits/stdc++.h>', 'using namespace std;' },
|
||||
},
|
||||
["java"] = {
|
||||
before = "import java.util.*;",
|
||||
['java'] = {
|
||||
before = 'import java.util.*;',
|
||||
},
|
||||
["python3"] = {
|
||||
['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
|
||||
cmd = 'Leet', -- lazy-load on command
|
||||
}
|
||||
|
|
185
lua/custom/plugins/neorg.lua
Normal file
185
lua/custom/plugins/neorg.lua
Normal file
|
@ -0,0 +1,185 @@
|
|||
-- Neorg - An organized future for Neovim
|
||||
-- https://github.com/nvim-neorg/neorg
|
||||
--
|
||||
-- Documentation: https://github.com/nvim-neorg/neorg/wiki
|
||||
-- Modules reference: https://github.com/nvim-neorg/neorg/wiki/User-Modules-Reference
|
||||
|
||||
return {
|
||||
"nvim-neorg/neorg",
|
||||
lazy = false, -- Disable lazy loading to ensure proper initialization
|
||||
-- Pin the version for stability - you can update when ready
|
||||
version = "*", -- Use the latest stable version
|
||||
dependencies = {
|
||||
"nvim-lua/plenary.nvim", -- Already should be installed in your config
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
"nvim-treesitter/nvim-treesitter-textobjects",
|
||||
"hrsh7th/nvim-cmp", -- Proper repository path for nvim-cmp
|
||||
},
|
||||
build = ":Neorg sync-parsers", -- This will install the Neorg treesitter parser
|
||||
config = function()
|
||||
require("neorg").setup {
|
||||
load = {
|
||||
-- Load the core modules that provide basic functionality
|
||||
["core.defaults"] = {}, -- Loads default modules
|
||||
|
||||
-- Essential modules for a good experience
|
||||
["core.concealer"] = {
|
||||
config = {
|
||||
icon_preset = "diamond", -- Icon style: basic, diamond, varied
|
||||
icons = {
|
||||
-- Custom icons for improved visual appearance
|
||||
heading = {
|
||||
icons = { "◉", "○", "✸", "✿" }, -- Cycle through these for heading levels
|
||||
},
|
||||
-- Keep default values for other icons
|
||||
todo = {
|
||||
pending = { icon = "" }, -- Keep the default
|
||||
},
|
||||
},
|
||||
folds = true, -- Enable folding of nested content
|
||||
performance = {
|
||||
conceal_modifier_pre = 200, -- Optimized conceal performance
|
||||
conceal_modifier_post = 300,
|
||||
concealer_weight_implies_priority = true,
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
-- For managing directories of .norg files - required for many features
|
||||
["core.dirman"] = {
|
||||
config = {
|
||||
workspaces = {
|
||||
notes = "~/notes", -- General notes
|
||||
work = "~/work/notes", -- Work-related notes
|
||||
personal = "~/personal/notes", -- Personal notes
|
||||
projects = "~/projects/notes", -- Project-specific notes
|
||||
},
|
||||
default_workspace = "notes",
|
||||
index = "index.norg", -- Default index file to look for
|
||||
},
|
||||
},
|
||||
|
||||
-- Enhance completion capabilities - integrates with your existing completion
|
||||
["core.completion"] = {
|
||||
config = {
|
||||
engine = "nvim-cmp", -- Use nvim-cmp for completion
|
||||
name = "neorg", -- Source name for nvim-cmp
|
||||
-- Customize completion behavior
|
||||
snippet_engine = nil, -- Will use your configured snippet engine
|
||||
trigger_on_carriage_return = true, -- Trigger completion when pressing Enter
|
||||
},
|
||||
},
|
||||
|
||||
-- Export your Neorg files to other formats
|
||||
["core.export"] = {}, -- Base export module
|
||||
["core.export.markdown"] = {
|
||||
config = {
|
||||
extensions = "all", -- Export all extensions
|
||||
versioning = {
|
||||
-- Add version information to exported files
|
||||
enabled = true,
|
||||
-- Pattern: {year}{month}{day}{hour}{min}{sec}_filename.md
|
||||
pattern = "%Y%m%d%H%M%S_{name}.md",
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
-- For a nicer table of contents
|
||||
["core.qol.toc"] = {
|
||||
config = {
|
||||
toc_title = "Table of Contents", -- Title of the TOC
|
||||
close_after_use = true, -- Close TOC after jumping to a heading
|
||||
default_level = 4, -- Show headings up to this level
|
||||
toc_position = "right", -- Position of the TOC window
|
||||
},
|
||||
},
|
||||
|
||||
-- For taking journal notes
|
||||
["core.journal"] = {
|
||||
config = {
|
||||
strategy = "flat", -- "flat" for single files, "nested" for year/month/day structure
|
||||
workspace = "notes", -- Use the notes workspace for journal entries
|
||||
journal_folder = "journal", -- Store journal entries in this subfolder
|
||||
use_template = false, -- Whether to use a template for new entries
|
||||
template_name = nil, -- Optional template name if use_template is true
|
||||
zipper_indicator = false, -- Show indicators for fast navigation
|
||||
},
|
||||
},
|
||||
|
||||
-- Summary generation for notes (new module)
|
||||
["core.summary"] = {},
|
||||
|
||||
-- Enhanced UI presentation mode
|
||||
["core.presenter"] = {
|
||||
config = {
|
||||
zen_mode = "zen-mode", -- Zen mode plugin to use (if installed)
|
||||
slide_count = true, -- Show slide count in presenter mode
|
||||
}
|
||||
},
|
||||
|
||||
-- Enhance keybinds with custom modes
|
||||
["core.keybinds"] = {
|
||||
-- This config is crucial for avoiding keybinding conflicts
|
||||
config = {
|
||||
-- All Neorg keybindings are only active inside .norg files
|
||||
-- They won't affect your existing keymaps in other file types
|
||||
default_keybinds = true,
|
||||
neorg_leader = "<Leader>n", -- Use <Leader>n as the Neorg prefix
|
||||
|
||||
-- Custom keybinds organized by category
|
||||
hook = function(keybinds)
|
||||
-- Navigation keybinds
|
||||
keybinds.map("norg", "n", "<Leader>nj", "<cmd>Neorg journal today<CR>",
|
||||
{ desc = "Open today's journal" })
|
||||
keybinds.map("norg", "n", "<Leader>nyt", "<cmd>Neorg journal yesterday<CR>",
|
||||
{ desc = "Open yesterday's journal" })
|
||||
keybinds.map("norg", "n", "<Leader>ntm", "<cmd>Neorg journal tomorrow<CR>",
|
||||
{ desc = "Open tomorrow's journal" })
|
||||
|
||||
-- Workspace management
|
||||
keybinds.map("norg", "n", "<Leader>nw", "<cmd>Neorg workspace<CR>",
|
||||
{ desc = "Open workspace selector" })
|
||||
keybinds.map("norg", "n", "<Leader>nn", "<cmd>Neorg workspace notes<CR>",
|
||||
{ desc = "Switch to notes workspace" })
|
||||
keybinds.map("norg", "n", "<Leader>nwp", "<cmd>Neorg workspace personal<CR>",
|
||||
{ desc = "Switch to personal workspace" })
|
||||
|
||||
-- Document manipulation
|
||||
keybinds.map("norg", "n", "<Leader>ntt", "<cmd>Neorg toc<CR>",
|
||||
{ desc = "Generate table of contents" })
|
||||
keybinds.map("norg", "n", "<Leader>ni", "<cmd>Neorg inject-metadata<CR>",
|
||||
{ desc = "Inject metadata" })
|
||||
keybinds.map("norg", "n", "<Leader>nm", "<cmd>Neorg update-metadata<CR>",
|
||||
{ desc = "Update metadata" })
|
||||
|
||||
-- Export commands
|
||||
keybinds.map("norg", "n", "<Leader>nem", "<cmd>Neorg export to-markdown<CR>",
|
||||
{ desc = "Export to Markdown" })
|
||||
|
||||
-- Toggle concealer
|
||||
keybinds.map("norg", "n", "<Leader>nc", "<cmd>Neorg toggle-concealer<CR>",
|
||||
{ desc = "Toggle concealer" })
|
||||
|
||||
-- Return to last workspace
|
||||
keybinds.map("norg", "n", "<Leader>nl", "<cmd>Neorg return<CR>",
|
||||
{ desc = "Return to last workspace" })
|
||||
|
||||
-- Advanced keybinds for list manipulation
|
||||
keybinds.map_event("norg", "n", "<Leader>nu", "core.itero.next-iteration",
|
||||
{ desc = "Iterate next" })
|
||||
keybinds.map_event("norg", "n", "<Leader>np", "core.itero.previous-iteration",
|
||||
{ desc = "Iterate previous" })
|
||||
end,
|
||||
},
|
||||
},
|
||||
|
||||
-- Module for better list handling
|
||||
["core.itero"] = {},
|
||||
|
||||
-- UI improvements for better look and feel
|
||||
["core.ui"] = {},
|
||||
["core.ui.calendar"] = {}, -- Calendar view for journal navigation
|
||||
},
|
||||
}
|
||||
end,
|
||||
}
|
310
lua/custom/plugins/neorg_guide.md
Normal file
310
lua/custom/plugins/neorg_guide.md
Normal file
|
@ -0,0 +1,310 @@
|
|||
# Neorg Guide: Organized Note-Taking for Neovim
|
||||
|
||||
Neorg is a powerful tool for structured note-taking, project and task management, time tracking, and more, all within Neovim. This guide will help you get started with the basics and highlight advanced features.
|
||||
|
||||
## Getting Started
|
||||
|
||||
To start using Neorg:
|
||||
|
||||
1. Make sure `luarocks` is installed on your system:
|
||||
|
||||
```bash
|
||||
sudo pacman -S luarocks
|
||||
# Or using yay if it's not in the main repos
|
||||
# yay -S luarocks
|
||||
```
|
||||
|
||||
2. Create your first Neorg file:
|
||||
|
||||
```
|
||||
:e notes.norg
|
||||
```
|
||||
|
||||
3. Initialize your workspace directories if they don't exist:
|
||||
```bash
|
||||
mkdir -p ~/notes ~/work/notes ~/personal/notes ~/projects/notes
|
||||
```
|
||||
|
||||
## Key Concepts
|
||||
|
||||
### Workspaces
|
||||
|
||||
Workspaces are directories where your Neorg files are stored. Your configuration includes:
|
||||
|
||||
- `notes`: Your general notes (~/notes)
|
||||
- `work`: Work-related notes (~/work/notes)
|
||||
- `personal`: Personal notes (~/personal/notes)
|
||||
- `projects`: Project-specific notes (~/projects/notes)
|
||||
|
||||
### Keybinding Structure
|
||||
|
||||
All Neorg keybindings start with `<Leader>n` (usually `\n` or `<Space>n` depending on your leader key) to avoid conflicts with your existing bindings.
|
||||
|
||||
#### Navigation & Workspaces
|
||||
|
||||
- `<Leader>nw` - Open workspace selector
|
||||
- `<Leader>nn` - Switch to notes workspace
|
||||
- `<Leader>nwp` - Switch to personal workspace
|
||||
- `<Leader>nl` - Return to last workspace
|
||||
|
||||
#### Journal
|
||||
|
||||
- `<Leader>nj` - Open today's journal
|
||||
- `<Leader>nyt` - Open yesterday's journal
|
||||
- `<Leader>ntm` - Open tomorrow's journal
|
||||
- `<Leader>nwd` - Go to day view in journal
|
||||
- `<Leader>nwm` - Go to month view in journal
|
||||
|
||||
#### Document Manipulation
|
||||
|
||||
- `<Leader>ntt` - Generate table of contents
|
||||
- `<Leader>ni` - Inject metadata
|
||||
- `<Leader>nm` - Update metadata
|
||||
- `<Leader>nc` - Toggle concealer
|
||||
- `<Leader>nil` - Insert link
|
||||
- `<Leader>nid` - Insert date
|
||||
|
||||
#### Export Commands
|
||||
|
||||
- `<Leader>nem` - Export to Markdown
|
||||
|
||||
#### Advanced List Manipulation
|
||||
|
||||
- `<Leader>nu` - Iterate to next list type (cycle through bullet types/numbers)
|
||||
- `<Leader>np` - Iterate to previous list type
|
||||
|
||||
### Basic Syntax
|
||||
|
||||
```norg
|
||||
* Heading 1
|
||||
** Heading 2
|
||||
*** Heading 3
|
||||
|
||||
- Unordered list
|
||||
- Nested item
|
||||
- More nesting
|
||||
|
||||
1. Ordered list
|
||||
2. Second item
|
||||
|
||||
~ Definition list
|
||||
Term 1 :: Definition 1
|
||||
Term 2 :: Definition 2
|
||||
~
|
||||
|
||||
( ) Undone task
|
||||
(x) Completed task
|
||||
(?) Pending task
|
||||
(!) Important task
|
||||
(-) Pending task
|
||||
(=) Recurring task
|
||||
(+) On hold task
|
||||
|
||||
`inline code`
|
||||
|
||||
@code lua
|
||||
print("Hello from Neorg!")
|
||||
@end
|
||||
|
||||
{https://github.com/nvim-neorg/neorg}[Link to Neorg]
|
||||
|
||||
> This is a quote
|
||||
> It can span multiple lines
|
||||
|
||||
$ E = mc^2 $ -- Inline math
|
||||
|
||||
@math
|
||||
f(x) = \int_{-\infty}^\infty
|
||||
\hat f(\xi)\,e^{2 \pi i \xi x}
|
||||
\,d\xi
|
||||
@end
|
||||
```
|
||||
|
||||
## Command Reference
|
||||
|
||||
### Common Commands
|
||||
|
||||
| Command | Description |
|
||||
| --------------------------- | ------------------------------- |
|
||||
| `:Neorg workspace notes` | Switch to notes workspace |
|
||||
| `:Neorg journal today` | Open today's journal |
|
||||
| `:Neorg toc` | Generate a table of contents |
|
||||
| `:Neorg export to-markdown` | Export current file to markdown |
|
||||
| `:Neorg toggle-concealer` | Toggle the concealer on/off |
|
||||
| `:Neorg return` | Return to the last workspace |
|
||||
|
||||
### Advanced Commands
|
||||
|
||||
| Command | Description |
|
||||
| ----------------------------------- | -------------------------------- |
|
||||
| `:Neorg inject-metadata` | Add metadata to current document |
|
||||
| `:Neorg update-metadata` | Update document metadata |
|
||||
| `:Neorg journal template` | Create/edit journal template |
|
||||
| `:Neorg keybind all` | Show all available keybindings |
|
||||
| `:Neorg modules list` | List all loaded modules |
|
||||
| `:Neorg generate-workspace-summary` | Generate workspace summary |
|
||||
|
||||
## Advanced Features
|
||||
|
||||
### Journal Management
|
||||
|
||||
Your journal is configured with a flat structure in the `~/notes/journal` directory:
|
||||
|
||||
```
|
||||
:Neorg journal today # Open today's journal
|
||||
:Neorg journal yesterday # Open yesterday's journal
|
||||
:Neorg journal tomorrow # Open tomorrow's journal
|
||||
```
|
||||
|
||||
Use `<Leader>nj` for quick access to today's journal.
|
||||
|
||||
### Export Options
|
||||
|
||||
Export to different formats for sharing:
|
||||
|
||||
```vim
|
||||
:Neorg export to-markdown " Basic markdown export
|
||||
:Neorg export to-markdown all " Export with all extensions
|
||||
```
|
||||
|
||||
The export includes version info with timestamps in the filename format.
|
||||
|
||||
### Table of Contents
|
||||
|
||||
Generate and use a table of contents with `<Leader>ntt` or `:Neorg toc`.
|
||||
The TOC is interactive - you can navigate to any section by selecting it.
|
||||
|
||||
### Presenter Mode
|
||||
|
||||
Turn your notes into presentations:
|
||||
|
||||
```vim
|
||||
:Neorg presenter start " Start presenter mode
|
||||
```
|
||||
|
||||
Navigate slides with:
|
||||
|
||||
- `j/k` or arrow keys - Next/previous slide
|
||||
- `q` - Exit presenter
|
||||
|
||||
## Tips for Best Experience
|
||||
|
||||
> 📌 **Note**: A comprehensive keybinding reference is available in the file:
|
||||
> `/home/kali/.config/nvim/lua/custom/plugins/neorg_keymaps_reference.md`
|
||||
|
||||
1. **Create workspace directories** before using them:
|
||||
|
||||
```bash
|
||||
mkdir -p ~/notes ~/work/notes ~/personal/notes ~/projects/notes
|
||||
```
|
||||
|
||||
2. **Set conceallevel** for a better visual experience:
|
||||
|
||||
```vim
|
||||
:set conceallevel=2
|
||||
```
|
||||
|
||||
3. **Use the journal** for daily notes and tracking with the `<Leader>nj` shortcut.
|
||||
|
||||
4. **Follow links** by placing cursor on a link and pressing `<Enter>`.
|
||||
|
||||
5. **Export to other formats** when needed to share your notes with `<Leader>nem`.
|
||||
|
||||
6. **Use folding** to collapse and expand sections:
|
||||
|
||||
- `za` - Toggle fold under cursor
|
||||
- `zR` - Open all folds
|
||||
- `zM` - Close all folds
|
||||
|
||||
7. **Use custom keybindings** to streamline your workflow - all under the `<Leader>n` prefix.
|
||||
|
||||
8. **Check Neorg health** if you encounter issues:
|
||||
|
||||
```vim
|
||||
:checkhealth neorg
|
||||
```
|
||||
|
||||
9. **Use calendar navigation** for journal entries:
|
||||
|
||||
```vim
|
||||
:Neorg journal calendar
|
||||
```
|
||||
|
||||
Navigate with arrow keys and press Enter on a date.
|
||||
|
||||
10. **Create summaries** of your notes:
|
||||
```vim
|
||||
:Neorg generate-summary
|
||||
```
|
||||
|
||||
## Advanced Document Structure
|
||||
|
||||
### Metadata
|
||||
|
||||
Add metadata to documents for better organization:
|
||||
|
||||
```norg
|
||||
@document.meta
|
||||
title: Project Planning
|
||||
description: Strategic planning document for Q3 2025
|
||||
authors: [your_name]
|
||||
categories: [planning, strategy]
|
||||
created: 2025-06-09
|
||||
version: 1.0
|
||||
@end
|
||||
```
|
||||
|
||||
### Cross-Linking
|
||||
|
||||
Create links between your notes:
|
||||
|
||||
```norg
|
||||
{:my-other-file:}[Link to another file]
|
||||
{:my-other-file:*some-heading}[Link to specific heading]
|
||||
{* My Heading}[Link to heading in current file]
|
||||
```
|
||||
|
||||
### Advanced Tasks
|
||||
|
||||
Track tasks with metadata:
|
||||
|
||||
```norg
|
||||
(x) Completed task #project @tag <2025-06-01>
|
||||
( ) Upcoming task #work @important <2025-06-15>
|
||||
(!) Critical task with ^high^ priority
|
||||
```
|
||||
|
||||
### Code Execution
|
||||
|
||||
Some code blocks can be executed directly from Neorg:
|
||||
|
||||
```norg
|
||||
@code lua runnable
|
||||
print("Hello from Neorg!")
|
||||
@end
|
||||
```
|
||||
|
||||
Use `<Leader>re` to run the code block under your cursor.
|
||||
|
||||
## Customization
|
||||
|
||||
Your Neorg setup is configured with:
|
||||
|
||||
- Diamond icon preset for better visuals
|
||||
- Custom keybindings under `<Leader>n` prefix
|
||||
- Four configured workspaces
|
||||
- Enhanced journal capabilities
|
||||
|
||||
Refer to the full configuration in `/home/kali/.config/nvim/lua/custom/plugins/neorg.lua` for more details.
|
||||
:Neorg export to-markdown
|
||||
|
||||
```
|
||||
|
||||
## Compatibility
|
||||
|
||||
Neorg is designed to work alongside your existing Neovim setup without conflicts. All keymaps are scoped to `.norg` files to avoid conflicts with other plugins.
|
||||
|
||||
## Learning More
|
||||
|
||||
Visit the [Neorg Wiki](https://github.com/nvim-neorg/neorg/wiki) for comprehensive documentation on all modules and features.
|
||||
```
|
129
lua/custom/plugins/neorg_keymaps_reference.md
Normal file
129
lua/custom/plugins/neorg_keymaps_reference.md
Normal file
|
@ -0,0 +1,129 @@
|
|||
# Neorg Keybindings Reference
|
||||
|
||||
All Neorg keybindings are namespaced under `<Leader>n` to avoid conflicts with other plugins. These bindings are only active in `.norg` files.
|
||||
|
||||
## 🚀 Getting Started
|
||||
|
||||
To check your Neorg setup, run this command in Neovim:
|
||||
|
||||
```vim
|
||||
:lua require('custom.utils.neorg_setup_check').check()
|
||||
```
|
||||
|
||||
To create your first Neorg file:
|
||||
|
||||
```vim
|
||||
:e myfile.norg
|
||||
```
|
||||
|
||||
To access your notes index:
|
||||
|
||||
```vim
|
||||
:Neorg workspace notes
|
||||
```
|
||||
|
||||
## Navigation & Workspace Management
|
||||
|
||||
| Keybinding | Description |
|
||||
| ------------- | ---------------------------- |
|
||||
| `<Leader>nw` | Open workspace selector |
|
||||
| `<Leader>nn` | Switch to notes workspace |
|
||||
| `<Leader>nwp` | Switch to personal workspace |
|
||||
| `<Leader>nl` | Return to last workspace |
|
||||
|
||||
## Journal
|
||||
|
||||
| Keybinding | Description |
|
||||
| ------------- | --------------------------- |
|
||||
| `<Leader>nj` | Open today's journal |
|
||||
| `<Leader>nyt` | Open yesterday's journal |
|
||||
| `<Leader>ntm` | Open tomorrow's journal |
|
||||
| `<Leader>nwd` | Go to day view in journal |
|
||||
| `<Leader>nwm` | Go to month view in journal |
|
||||
|
||||
## Document Structure
|
||||
|
||||
| Keybinding | Description |
|
||||
| ------------- | -------------------------- |
|
||||
| `<Leader>ntt` | Generate table of contents |
|
||||
| `<Leader>ni` | Inject metadata |
|
||||
| `<Leader>nm` | Update metadata |
|
||||
| `<Leader>nc` | Toggle concealer |
|
||||
|
||||
## Content Creation
|
||||
|
||||
| Keybinding | Description |
|
||||
| ------------- | ----------- |
|
||||
| `<Leader>nil` | Insert link |
|
||||
| `<Leader>nid` | Insert date |
|
||||
|
||||
## Export
|
||||
|
||||
| Keybinding | Description |
|
||||
| ------------- | ------------------ |
|
||||
| `<Leader>nem` | Export to Markdown |
|
||||
|
||||
## Advanced List Manipulation
|
||||
|
||||
| Keybinding | Description |
|
||||
| ------------ | ------------------------------- |
|
||||
| `<Leader>nu` | Iterate next (cycle list types) |
|
||||
| `<Leader>np` | Iterate previous |
|
||||
|
||||
## Default Keybindings
|
||||
|
||||
Additionally, Neorg has many default keybindings that are active in `.norg` files:
|
||||
|
||||
### Navigation
|
||||
|
||||
| Keybinding | Description |
|
||||
| ---------- | ---------------------------- |
|
||||
| `<CR>` | Follow link under cursor |
|
||||
| `<M-k>` | Follow link up |
|
||||
| `<M-j>` | Follow link down |
|
||||
| `<M-h>` | Follow link previous |
|
||||
| `<M-l>` | Follow link next |
|
||||
| `gO` | Navigate to previous heading |
|
||||
| `gI` | Navigate to next heading |
|
||||
|
||||
### Lists & Tasks
|
||||
|
||||
| Keybinding | Description |
|
||||
| ---------- | -------------------------------------- |
|
||||
| `<M-CR>` | Toggle task status |
|
||||
| `<M-v>` | Toggle list type |
|
||||
| `<Tab>` | Indent current line (in insert mode) |
|
||||
| `<S-Tab>` | Unindent current line (in insert mode) |
|
||||
|
||||
### Folding (when folding is enabled)
|
||||
|
||||
| Keybinding | Description |
|
||||
| ---------- | ------------------------ |
|
||||
| `za` | Toggle fold under cursor |
|
||||
| `zR` | Open all folds |
|
||||
| `zM` | Close all folds |
|
||||
|
||||
### Text Objects
|
||||
|
||||
| Keybinding | Description |
|
||||
| ---------- | -------------- |
|
||||
| `ah` | Around heading |
|
||||
| `ih` | Inside heading |
|
||||
| `al` | Around list |
|
||||
| `il` | Inside list |
|
||||
|
||||
### Presenter Mode
|
||||
|
||||
| Keybinding | Description |
|
||||
| ---------- | ------------------- |
|
||||
| `j`/`k` | Next/previous slide |
|
||||
| `q` | Exit presenter |
|
||||
|
||||
## Command Reference
|
||||
|
||||
| Command | Description |
|
||||
| ------------------------- | ------------------------------ |
|
||||
| `:Neorg keybind all` | Show all available keybindings |
|
||||
| `:Neorg index` | Go to workspace index file |
|
||||
| `:Neorg return` | Return to previous location |
|
||||
| `:Neorg toggle-concealer` | Toggle concealer |
|
82
lua/custom/plugins/neorg_optimization_summary.md
Normal file
82
lua/custom/plugins/neorg_optimization_summary.md
Normal file
|
@ -0,0 +1,82 @@
|
|||
# Neorg Configuration Optimization Summary
|
||||
|
||||
## Optimizations Made
|
||||
|
||||
### 1. Enhanced Core Configuration
|
||||
|
||||
- Improved concealer settings with the "diamond" icon preset for better visuals
|
||||
- Added performance optimizations for the concealer
|
||||
- Added a new "projects" workspace
|
||||
- Added index file configuration
|
||||
- Configured versioning for exports
|
||||
|
||||
### 2. Added New Modules
|
||||
|
||||
- Added `core.summary` module for generating note summaries
|
||||
- Added `core.presenter` module for presentation mode
|
||||
- Added `core.itero` module for better list handling
|
||||
- Added `core.ui.calendar` for calendar navigation in journal
|
||||
|
||||
### 3. Enhanced Keybindings
|
||||
|
||||
- Created namespaced keybindings under `<Leader>n`
|
||||
- Added specialized keybindings for common operations:
|
||||
- Journal management
|
||||
- Workspace navigation
|
||||
- Document manipulation
|
||||
- Export functions
|
||||
- List manipulation
|
||||
|
||||
### 4. Created Documentation
|
||||
|
||||
- Comprehensive `neorg_guide.md` with detailed usage instructions
|
||||
- Dedicated `neorg_keymaps_reference.md` for quick reference
|
||||
- Setup checking tool for troubleshooting
|
||||
|
||||
### 5. Created File Structure
|
||||
|
||||
- Set up workspace directories:
|
||||
- ~/notes
|
||||
- ~/work/notes
|
||||
- ~/personal/notes
|
||||
- ~/projects/notes
|
||||
- Created folder structure within notes
|
||||
- Added index.norg as a starting point
|
||||
|
||||
## How to Use the Optimized Setup
|
||||
|
||||
1. **Check your setup** with the provided utility:
|
||||
|
||||
```vim
|
||||
:lua require('custom.utils.neorg_setup_check').check()
|
||||
```
|
||||
|
||||
2. **Open your notes index**:
|
||||
|
||||
```vim
|
||||
:Neorg workspace notes
|
||||
```
|
||||
|
||||
3. **Create a journal entry**:
|
||||
Press `<Leader>nj` or use command `:Neorg journal today`
|
||||
|
||||
4. **Navigate workspaces**:
|
||||
Press `<Leader>nw` to open the workspace selector
|
||||
|
||||
5. **Export to Markdown**:
|
||||
Press `<Leader>nem` within a Neorg file
|
||||
|
||||
## What's Changed from Previous Configuration
|
||||
|
||||
- Improved visual appearance with diamond icons
|
||||
- Added more workspace options
|
||||
- Expanded keybinding set with better documentation
|
||||
- Added support for advanced list manipulation
|
||||
- Enhanced journal capabilities
|
||||
- Added calendar support for date navigation
|
||||
- Improved organization with an index file
|
||||
|
||||
Refer to the full documentation in:
|
||||
|
||||
- `/home/kali/.config/nvim/lua/custom/plugins/neorg_guide.md`
|
||||
- `/home/kali/.config/nvim/lua/custom/plugins/neorg_keymaps_reference.md`
|
|
@ -1,34 +0,0 @@
|
|||
-- 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,
|
||||
-- }
|
|
@ -77,17 +77,14 @@ return {
|
|||
},
|
||||
config = function(_, opts)
|
||||
require('trouble').setup(opts)
|
||||
-- Add which-key group
|
||||
|
||||
-- Add which-key group using the new v3 spec API
|
||||
local ok, which_key = pcall(require, 'which-key')
|
||||
-- if ok then
|
||||
-- -- Use standard which-key format that's known to work
|
||||
-- which_key.register({
|
||||
-- ["<leader>x"] = { name = "Trouble/Diagnostics" },
|
||||
-- })
|
||||
|
||||
-- which_key.register({
|
||||
-- ["g"] = { name = "Goto" },
|
||||
-- })
|
||||
-- end
|
||||
if ok then
|
||||
which_key.add({
|
||||
{ "<leader>x", group = "Trouble/Diagnostics" },
|
||||
{ "g", group = "Goto" },
|
||||
})
|
||||
end
|
||||
end,
|
||||
}
|
||||
|
|
275
lua/custom/plugins/which_key_integration.lua
Normal file
275
lua/custom/plugins/which_key_integration.lua
Normal file
|
@ -0,0 +1,275 @@
|
|||
-- --[[
|
||||
-- Which-Key Integration Plugin - Latest v3 Configuration
|
||||
|
||||
-- This file sets up which-key with the latest v3 API and configuration.
|
||||
-- which-key v3 uses a new spec-based system for defining keymaps.
|
||||
-- ]]
|
||||
|
||||
-- return {
|
||||
-- {
|
||||
-- 'folke/which-key.nvim',
|
||||
-- event = "VeryLazy",
|
||||
-- opts = {
|
||||
-- preset = "modern", -- "classic", "modern", or "helix"
|
||||
-- delay = function(ctx)
|
||||
-- return ctx.plugin and 0 or 200
|
||||
-- end,
|
||||
-- plugins = {
|
||||
-- marks = true, -- shows a list of your marks on ' and `
|
||||
-- registers = true, -- shows your registers on " in NORMAL or <C-r> in INSERT mode
|
||||
-- spelling = {
|
||||
-- enabled = true, -- enabling this will show WhichKey when pressing z= to select spelling suggestions
|
||||
-- suggestions = 20, -- how many suggestions should be shown in the list?
|
||||
-- },
|
||||
-- presets = {
|
||||
-- operators = true, -- adds help for operators like d, y, ...
|
||||
-- motions = true, -- adds help for motions
|
||||
-- text_objects = true, -- help for text objects triggered after entering an operator
|
||||
-- windows = true, -- default bindings on <c-w>
|
||||
-- nav = true, -- misc bindings to work with windows
|
||||
-- z = true, -- bindings for folds, spelling and others prefixed with z
|
||||
-- g = true, -- bindings for prefixed with g
|
||||
-- },
|
||||
-- },
|
||||
-- spec = {
|
||||
-- { "g", group = "goto" },
|
||||
-- { "gz", group = "surround" },
|
||||
-- { "]", group = "next" },
|
||||
-- { "[", group = "prev" },
|
||||
-- { "<leader><tab>", group = "tabs" },
|
||||
-- { "<leader>b", group = "buffer" },
|
||||
-- { "<leader>c", group = "code" },
|
||||
-- { "<leader>f", group = "file/find" },
|
||||
-- { "<leader>g", group = "git" },
|
||||
-- { "<leader>h", group = "harpoon" },
|
||||
-- { "<leader>l", group = "leetcode" },
|
||||
-- { "<leader>n", group = "neorg" },
|
||||
-- { "<leader>q", group = "quit/session" },
|
||||
-- { "<leader>s", group = "search" },
|
||||
-- { "<leader>t", group = "toggle/tab" },
|
||||
-- { "<leader>w", group = "windows" },
|
||||
-- { "<leader>x", group = "diagnostics/quickfix" },
|
||||
-- },
|
||||
-- icons = {
|
||||
-- breadcrumb = "»", -- symbol used in the command line area that shows your active key combo
|
||||
-- separator = "→", -- symbol used between a key and it's label
|
||||
-- group = "+", -- symbol prepended to a group
|
||||
-- mappings = vim.g.have_nerd_font,
|
||||
-- },
|
||||
-- win = {
|
||||
-- border = "rounded", -- none, single, double, shadow, rounded
|
||||
-- position = "bottom", -- bottom, top
|
||||
-- margin = { 1, 0, 1, 0 }, -- extra window margin [top, right, bottom, left]
|
||||
-- padding = { 2, 2, 2, 2 }, -- extra window padding [top, right, bottom, left]
|
||||
-- winblend = 0, -- value between 0-100 0 for fully opaque and 100 for fully transparent
|
||||
-- },
|
||||
-- layout = {
|
||||
-- height = { min = 4, max = 25 }, -- min and max height of the columns
|
||||
-- width = { min = 20, max = 50 }, -- min and max width of the columns
|
||||
-- spacing = 3, -- spacing between columns
|
||||
-- align = "center", -- align columns left, center or right
|
||||
-- },
|
||||
-- show_help = true, -- show help message on the command line when the popup is visible
|
||||
-- show_keys = true, -- show the currently pressed key and its label as a message in the command line
|
||||
-- },
|
||||
-- config = function(_, opts)
|
||||
-- local wk = require("which-key")
|
||||
-- wk.setup(opts)
|
||||
|
||||
-- -- Use vim.schedule to ensure modules are loaded after Vim is ready
|
||||
-- vim.schedule(function()
|
||||
-- -- Load which-key setup with customized configuration
|
||||
-- require('custom.which_key_setup').setup()
|
||||
|
||||
-- -- Load core keymaps
|
||||
-- pcall(function() require('custom.keymaps').setup() end)
|
||||
|
||||
-- -- Load plugin-specific keymaps
|
||||
-- pcall(function() require('custom.plugin_keymaps').setup() end)
|
||||
-- end)
|
||||
-- end,
|
||||
-- -- Load on specific events with higher priority
|
||||
-- event = "VeryLazy",
|
||||
-- priority = 1000, -- High priority to ensure it loads first
|
||||
-- }
|
||||
-- }
|
||||
--[[
|
||||
Which-Key Integration Plugin - Latest v3 Configuration
|
||||
|
||||
This file sets up which-key with the latest v3 API and configuration.
|
||||
Official documentation: https://github.com/folke/which-key.nvim
|
||||
]]
|
||||
|
||||
return {
|
||||
{
|
||||
"folke/which-key.nvim",
|
||||
event = "VeryLazy",
|
||||
opts = {
|
||||
preset = "modern", -- "classic", "modern", or "helix"
|
||||
-- Delay before showing the popup. Can be a number or a function that returns a number.
|
||||
-- 0 to disable, or a function that returns the delay based on the current context
|
||||
delay = function(ctx)
|
||||
return ctx.plugin and 0 or 200
|
||||
end,
|
||||
|
||||
-- Filter to exclude mappings without descriptions or that match certain patterns
|
||||
filter = function(mapping)
|
||||
-- Exclude mappings without descriptions
|
||||
return mapping.desc and mapping.desc ~= ""
|
||||
end,
|
||||
|
||||
-- You can add any mappings here, or use `require("which-key").add()` later
|
||||
spec = {
|
||||
{
|
||||
mode = { "n", "v" },
|
||||
{ "<leader><tab>", group = "tabs" },
|
||||
{ "<leader>b", group = "buffer" },
|
||||
{ "<leader>c", group = "code/copilot" },
|
||||
{ "<leader>f", group = "file/find" },
|
||||
{ "<leader>g", group = "git" },
|
||||
{ "<leader>gh", group = "hunks" },
|
||||
{ "<leader>h", group = "harpoon" },
|
||||
{ "<leader>l", group = "leetcode" },
|
||||
{ "<leader>n", group = "neorg" },
|
||||
{ "<leader>q", group = "quit/session" },
|
||||
{ "<leader>s", group = "search" },
|
||||
{ "<leader>t", group = "toggle/tab" },
|
||||
{ "<leader>u", group = "ui" },
|
||||
{ "<leader>w", group = "windows" },
|
||||
{ "<leader>x", group = "diagnostics/quickfix" },
|
||||
{ "[", group = "prev" },
|
||||
{ "]", group = "next" },
|
||||
{ "g", group = "goto" },
|
||||
{ "gs", group = "surround" },
|
||||
{ "z", group = "fold" },
|
||||
},
|
||||
},
|
||||
|
||||
-- Window configuration
|
||||
win = {
|
||||
border = "rounded",
|
||||
no_overlap = true,
|
||||
padding = { 1, 2 }, -- extra window padding [top/bottom, right/left]
|
||||
title = true,
|
||||
title_pos = "center",
|
||||
zindex = 1000,
|
||||
},
|
||||
|
||||
-- Layout configuration
|
||||
layout = {
|
||||
width = { min = 20 }, -- min and max width of the columns
|
||||
spacing = 3, -- spacing between columns
|
||||
},
|
||||
|
||||
-- Key bindings for the which-key buffer
|
||||
keys = {
|
||||
scroll_down = "<c-d>", -- binding to scroll down inside the popup
|
||||
scroll_up = "<c-u>", -- binding to scroll up inside the popup
|
||||
},
|
||||
|
||||
-- Sort mappings
|
||||
sort = { "local", "order", "group", "alphanum", "mod" },
|
||||
|
||||
-- Expand groups when <= n mappings
|
||||
expand = 0,
|
||||
|
||||
-- Replacements for how keys and descriptions are displayed
|
||||
replace = {
|
||||
key = {
|
||||
function(key)
|
||||
return require("which-key.view").format(key)
|
||||
end,
|
||||
-- { "<Space>", "SPC" },
|
||||
},
|
||||
desc = {
|
||||
{ "<Plug>%(?(.*)%)?", "%1" },
|
||||
{ "^%+", "" },
|
||||
{ "<[cC]md>", "" },
|
||||
{ "<[cC][rR]>", "" },
|
||||
{ "<[sS]ilent>", "" },
|
||||
{ "^lua%s+", "" },
|
||||
{ "^call%s+", "" },
|
||||
{ "^:%s*", "" },
|
||||
},
|
||||
},
|
||||
|
||||
-- Icons configuration
|
||||
icons = {
|
||||
breadcrumb = "»", -- symbol used in the command line area that shows your active key combo
|
||||
separator = "➜", -- symbol used between a key and it's label
|
||||
group = "+", -- symbol prepended to a group
|
||||
ellipsis = "…",
|
||||
mappings = vim.g.have_nerd_font, -- set to false to disable all mapping icons
|
||||
rules = {},
|
||||
colors = true,
|
||||
-- Icon keys for different key types
|
||||
keys = vim.g.have_nerd_font and {} or {
|
||||
Up = " ",
|
||||
Down = " ",
|
||||
Left = " ",
|
||||
Right = " ",
|
||||
C = " ",
|
||||
M = " ",
|
||||
D = " ",
|
||||
S = " ",
|
||||
CR = " ",
|
||||
Esc = " ",
|
||||
ScrollWheelDown = " ",
|
||||
ScrollWheelUp = " ",
|
||||
NL = " ",
|
||||
BS = "",
|
||||
Space = " ",
|
||||
Tab = " ",
|
||||
F1 = "",
|
||||
F2 = "",
|
||||
F3 = "",
|
||||
F4 = "",
|
||||
F5 = "",
|
||||
F6 = "",
|
||||
F7 = "",
|
||||
F8 = "",
|
||||
F9 = "",
|
||||
F10 = "",
|
||||
F11 = "",
|
||||
F12 = "",
|
||||
},
|
||||
},
|
||||
|
||||
-- Show help and keys
|
||||
show_help = true,
|
||||
show_keys = true,
|
||||
|
||||
-- Disable which-key for certain file types or buffer types
|
||||
disable = {
|
||||
buftypes = {},
|
||||
filetypes = {},
|
||||
},
|
||||
},
|
||||
|
||||
config = function(_, opts)
|
||||
local wk = require("which-key")
|
||||
wk.setup(opts)
|
||||
|
||||
-- Load keymap modules after which-key is ready
|
||||
vim.schedule(function()
|
||||
-- Load core keymaps if they exist
|
||||
local core_keymaps_ok, _ = pcall(require, 'custom.keymaps')
|
||||
if core_keymaps_ok then
|
||||
pcall(function() require('custom.keymaps').setup() end)
|
||||
end
|
||||
|
||||
-- Load which-key specific setup
|
||||
local wk_setup_ok, _ = pcall(require, 'custom.which_key_setup')
|
||||
if wk_setup_ok then
|
||||
pcall(function() require('custom.which_key_setup').setup() end)
|
||||
end
|
||||
|
||||
-- Load plugin-specific keymaps
|
||||
local plugin_keymaps_ok, _ = pcall(require, 'custom.plugin_keymaps')
|
||||
if plugin_keymaps_ok then
|
||||
pcall(function() require('custom.plugin_keymaps').setup() end)
|
||||
end
|
||||
end)
|
||||
end,
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue