done maybe

This commit is contained in:
sharmaharshitnone 2025-06-14 09:15:11 +05:30
parent d00f77555e
commit c54b71fdd4
24 changed files with 2632 additions and 501 deletions

View file

@ -1,3 +1,4 @@
# filepath: /home/kali/.config/nvim/.stylua.toml
column_width = 160 column_width = 160
line_endings = "Unix" line_endings = "Unix"
indent_type = "Spaces" indent_type = "Spaces"

View file

@ -4,9 +4,9 @@
A starting point for Neovim that is: A starting point for Neovim that is:
* Small - Small
* Single-file - Single-file
* Completely Documented - Completely Documented
**NOT** a Neovim distribution, but instead a starting point for your configuration. **NOT** a Neovim distribution, but instead a starting point for your configuration.
@ -14,7 +14,7 @@ A starting point for Neovim that is:
### Install Neovim ### Install Neovim
Kickstart.nvim targets *only* the latest Kickstart.nvim targets _only_ the latest
['stable'](https://github.com/neovim/neovim/releases/tag/stable) and latest ['stable'](https://github.com/neovim/neovim/releases/tag/stable) and latest
['nightly'](https://github.com/neovim/neovim/releases/tag/nightly) of Neovim. ['nightly'](https://github.com/neovim/neovim/releases/tag/nightly) of Neovim.
If you are experiencing issues, please make sure you have the latest versions. If you are experiencing issues, please make sure you have the latest versions.
@ -22,13 +22,16 @@ If you are experiencing issues, please make sure you have the latest versions.
### Install External Dependencies ### Install External Dependencies
External Requirements: External Requirements:
- Basic utils: `git`, `make`, `unzip`, C Compiler (`gcc`) - Basic utils: `git`, `make`, `unzip`, C Compiler (`gcc`)
- [ripgrep](https://github.com/BurntSushi/ripgrep#installation), - [ripgrep](https://github.com/BurntSushi/ripgrep#installation),
[fd-find](https://github.com/sharkdp/fd#installation) [fd-find](https://github.com/sharkdp/fd#installation)
- Clipboard tool (xclip/xsel/win32yank or other depending on the platform) - Clipboard tool (xclip/xsel/win32yank or other depending on the platform)
- A [Nerd Font](https://www.nerdfonts.com/): optional, provides various icons - A [Nerd Font](https://www.nerdfonts.com/): optional, provides various icons
- if you have it set `vim.g.have_nerd_font` in `init.lua` to true - if you have it set `vim.g.have_nerd_font` in `init.lua` to true
- Emoji fonts (Ubuntu only, and only if you want emoji!) `sudo apt install fonts-noto-color-emoji` - Emoji fonts (only if you want emoji!)
- On Arch Linux: `sudo pacman -S noto-fonts-emoji` or `yay -S noto-fonts-emoji`
- On Ubuntu: `sudo apt install fonts-noto-color-emoji`
- Language Setup: - Language Setup:
- If you want to write Typescript, you need `npm` - If you want to write Typescript, you need `npm`
- If you want to write Golang, you will need `go` - If you want to write Golang, you will need `go`
@ -40,16 +43,15 @@ External Requirements:
### Install Kickstart ### Install Kickstart
> [!NOTE] > [!NOTE] > [Backup](#FAQ) your previous configuration (if any exists)
> [Backup](#FAQ) your previous configuration (if any exists)
Neovim's configurations are located under the following paths, depending on your OS: Neovim's configurations are located under the following paths, depending on your OS:
| OS | PATH | | OS | PATH |
| :- | :--- | | :------------------- | :---------------------------------------- |
| Linux, MacOS | `$XDG_CONFIG_HOME/nvim`, `~/.config/nvim` | | Linux, MacOS | `$XDG_CONFIG_HOME/nvim`, `~/.config/nvim` |
| Windows (cmd)| `%localappdata%\nvim\` | | Windows (cmd) | `%localappdata%\nvim\` |
| Windows (powershell)| `$env:LOCALAPPDATA\nvim\` | | Windows (powershell) | `$env:LOCALAPPDATA\nvim\` |
#### Recommended Step #### Recommended Step
@ -115,19 +117,18 @@ examples of adding popularly requested plugins.
> [!NOTE] > [!NOTE]
> For more information about a particular plugin check its repository's documentation. > For more information about a particular plugin check its repository's documentation.
### Getting Started ### Getting Started
[The Only Video You Need to Get Started with Neovim](https://youtu.be/m8C0Cq9Uv9o) [The Only Video You Need to Get Started with Neovim](https://youtu.be/m8C0Cq9Uv9o)
### FAQ ### FAQ
* What should I do if I already have a pre-existing Neovim configuration? - What should I do if I already have a pre-existing Neovim configuration?
* You should back it up and then delete all associated files. - You should back it up and then delete all associated files.
* This includes your existing init.lua and the Neovim files in `~/.local` - This includes your existing init.lua and the Neovim files in `~/.local`
which can be deleted with `rm -rf ~/.local/share/nvim/` which can be deleted with `rm -rf ~/.local/share/nvim/`
* Can I keep my existing configuration in parallel to kickstart? - Can I keep my existing configuration in parallel to kickstart?
* Yes! You can use [NVIM_APPNAME](https://neovim.io/doc/user/starting.html#%24NVIM_APPNAME)`=nvim-NAME` - Yes! You can use [NVIM_APPNAME](https://neovim.io/doc/user/starting.html#%24NVIM_APPNAME)`=nvim-NAME`
to maintain multiple configurations. For example, you can install the kickstart to maintain multiple configurations. For example, you can install the kickstart
configuration in `~/.config/nvim-kickstart` and create an alias: configuration in `~/.config/nvim-kickstart` and create an alias:
``` ```
@ -137,18 +138,18 @@ examples of adding popularly requested plugins.
config directory and the matching local directory config directory and the matching local directory
`~/.local/share/nvim-kickstart`. You can apply this approach to any Neovim `~/.local/share/nvim-kickstart`. You can apply this approach to any Neovim
distribution that you would like to try out. distribution that you would like to try out.
* What if I want to "uninstall" this configuration: - What if I want to "uninstall" this configuration:
* See [lazy.nvim uninstall](https://lazy.folke.io/usage#-uninstalling) information - See [lazy.nvim uninstall](https://lazy.folke.io/usage#-uninstalling) information
* Why is the kickstart `init.lua` a single file? Wouldn't it make sense to split it into multiple files? - Why is the kickstart `init.lua` a single file? Wouldn't it make sense to split it into multiple files?
* The main purpose of kickstart is to serve as a teaching tool and a reference - The main purpose of kickstart is to serve as a teaching tool and a reference
configuration that someone can easily use to `git clone` as a basis for their own. configuration that someone can easily use to `git clone` as a basis for their own.
As you progress in learning Neovim and Lua, you might consider splitting `init.lua` As you progress in learning Neovim and Lua, you might consider splitting `init.lua`
into smaller parts. A fork of kickstart that does this while maintaining the into smaller parts. A fork of kickstart that does this while maintaining the
same functionality is available here: same functionality is available here:
* [kickstart-modular.nvim](https://github.com/dam9000/kickstart-modular.nvim) - [kickstart-modular.nvim](https://github.com/dam9000/kickstart-modular.nvim)
* Discussions on this topic can be found here: - Discussions on this topic can be found here:
* [Restructure the configuration](https://github.com/nvim-lua/kickstart.nvim/issues/218) - [Restructure the configuration](https://github.com/nvim-lua/kickstart.nvim/issues/218)
* [Reorganize init.lua into a multi-file setup](https://github.com/nvim-lua/kickstart.nvim/pull/473) - [Reorganize init.lua into a multi-file setup](https://github.com/nvim-lua/kickstart.nvim/pull/473)
### Install Recipes ### Install Recipes
@ -170,23 +171,27 @@ This requires:
```lua ```lua
{'nvim-telescope/telescope-fzf-native.nvim', build = 'cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release && cmake --build build --config Release && cmake --install build --prefix build' } {'nvim-telescope/telescope-fzf-native.nvim', build = 'cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release && cmake --build build --config Release && cmake --install build --prefix build' }
``` ```
</details> </details>
<details><summary>Windows with gcc/make using chocolatey</summary> <details><summary>Windows with gcc/make using chocolatey</summary>
Alternatively, one can install gcc and make which don't require changing the config, Alternatively, one can install gcc and make which don't require changing the config,
the easiest way is to use choco: the easiest way is to use choco:
1. install [chocolatey](https://chocolatey.org/install) 1. install [chocolatey](https://chocolatey.org/install)
either follow the instructions on the page or use winget, either follow the instructions on the page or use winget,
run in cmd as **admin**: run in cmd as **admin**:
``` ```
winget install --accept-source-agreements chocolatey.chocolatey winget install --accept-source-agreements chocolatey.chocolatey
``` ```
2. install all requirements using choco, exit the previous cmd and 2. install all requirements using choco, exit the previous cmd and
open a new one so that choco path is set, and run in cmd as **admin**: open a new one so that choco path is set, and run in cmd as **admin**:
``` ```
choco install -y neovim git ripgrep wget fd unzip gzip mingw make choco install -y neovim git ripgrep wget fd unzip gzip mingw make
``` ```
</details> </details>
<details><summary>WSL (Windows Subsystem for Linux)</summary> <details><summary>WSL (Windows Subsystem for Linux)</summary>
@ -197,9 +202,20 @@ sudo add-apt-repository ppa:neovim-ppa/unstable -y
sudo apt update sudo apt update
sudo apt install make gcc ripgrep unzip git xclip neovim sudo apt install make gcc ripgrep unzip git xclip neovim
``` ```
</details> </details>
#### Linux Install #### Linux Install
<details><summary>Arch Linux Install Steps</summary>
```
sudo pacman -S neovim make gcc ripgrep unzip git xclip
# If you need additional packages from AUR, use yay:
# yay -S neovim-git # For the git version of neovim
```
</details>
<details><summary>Ubuntu Install Steps</summary> <details><summary>Ubuntu Install Steps</summary>
``` ```
@ -207,6 +223,7 @@ sudo add-apt-repository ppa:neovim-ppa/unstable -y
sudo apt update sudo apt update
sudo apt install make gcc ripgrep unzip git xclip neovim sudo apt install make gcc ripgrep unzip git xclip neovim
``` ```
</details> </details>
<details><summary>Debian Install Steps</summary> <details><summary>Debian Install Steps</summary>
@ -224,12 +241,14 @@ sudo tar -C /opt -xzf nvim-linux-x86_64.tar.gz
# make it available in /usr/local/bin, distro installs to /usr/bin # make it available in /usr/local/bin, distro installs to /usr/bin
sudo ln -sf /opt/nvim-linux-x86_64/bin/nvim /usr/local/bin/ sudo ln -sf /opt/nvim-linux-x86_64/bin/nvim /usr/local/bin/
``` ```
</details> </details>
<details><summary>Fedora Install Steps</summary> <details><summary>Fedora Install Steps</summary>
``` ```
sudo dnf install -y gcc make git ripgrep fd-find unzip neovim sudo dnf install -y gcc make git ripgrep fd-find unzip neovim
``` ```
</details> </details>
<details><summary>Arch Install Steps</summary> <details><summary>Arch Install Steps</summary>
@ -237,5 +256,5 @@ sudo dnf install -y gcc make git ripgrep fd-find unzip neovim
``` ```
sudo pacman -S --noconfirm --needed gcc make git ripgrep fd unzip neovim sudo pacman -S --noconfirm --needed gcc make git ripgrep fd unzip neovim
``` ```
</details>
</details>

View file

@ -1,179 +0,0 @@
-- debug.lua
--
-- Shows how to use the DAP plugin to debug your code.
--
-- Primarily focused on configuring the debugger for Go, but can
-- be extended to other languages as well. That's why it's called
-- kickstart.nvim and not kitchen-sink.nvim ;)
return {
-- NOTE: Yes, you can install new plugins here!
'mfussenegger/nvim-dap',
-- NOTE: And you can specify dependencies as well
dependencies = {
-- Creates a beautiful debugger UI
'rcarriga/nvim-dap-ui',
-- Required dependency for nvim-dap-ui
'nvim-neotest/nvim-nio',
-- Installs the debug adapters for you
'williamboman/mason.nvim',
'jay-babu/mason-nvim-dap.nvim',
-- Add your own debuggers here
'leoluz/nvim-dap-go',
'mfussenegger/nvim-dap-python', -- Uncomment to add Python support
'theHamsta/nvim-dap-virtual-text', -- Uncomment to add virtual text support
},
keys = {
-- Basic debugging keymaps, feel free to change to your liking!
{
'g@',
function()
require('dap').continue()
end,
desc = 'Debug: Start/Continue',
},
{
'<F1>',
function()
require('dap').step_into()
end,
desc = 'Debug: Step Into',
},
{Read debug.lua, lines 1 to 153
'<F2>',
function()
require('dap').step_over()
end,
desc = 'Debug: Step Over',
},
{
'<F3>',
function()
require('dap').step_out()
end,
desc = 'Debug: Step Out',
},
{
'<leader>.',
function()
require('dap').toggle_breakpoint()
end,
desc = 'Debug: Toggle Breakpoint',
},
{
'<leader>B',
function()
require('dap').set_breakpoint(vim.fn.input 'Breakpoint condition: ')
end,
desc = 'Debug: Set Breakpoint',
},
-- Toggle to see last session result. Without this, you can't see session output in case of unhandled exception.
{
'<F7>',
function()
require('dapui').toggle()
end,
desc = 'Debug: See last session result.',
},
},
config = function()
local dap = require 'dap'
local dapui = require 'dapui'
require('mason-nvim-dap').setup {
-- Makes a best effort to setup the various debuggers with
-- reasonable debug configurations
automatic_installation = true,
-- You can provide additional configuration to the handlers,
-- see mason-nvim-dap README for more information
handlers = {},
-- You'll need to check that you have the required things installed
-- online, please don't ask me how to install them :)
ensure_installed = {
-- Update this to ensure that you have the debuggers for the langs you want
'delve',
'debugpy', -- Python debugger
},
}
-- Dap UI setup
-- For more information, see |:help nvim-dap-ui|
dapui.setup {
-- Set icons to characters that are more likely to work in every terminal.
-- Feel free to remove or use ones that you like more! :)
-- Don't feel like these are good choices.
icons = { expanded = '', collapsed = '', current_frame = '*' },
controls = {
icons = {
pause = '',
play = '',
step_into = '',
step_over = '',
step_out = '',
step_back = 'b',
run_last = '▶▶',
terminate = '',
disconnect = '',
},
},
}
-- Change breakpoint icons
-- vim.api.nvim_set_hl(0, 'DapBreak', { fg = '#e51400' })
-- vim.api.nvim_set_hl(0, 'DapStop', { fg = '#ffcc00' })
-- local breakpoint_icons = vim.g.have_nerd_font
-- and { Breakpoint = '', BreakpointCondition = '', BreakpointRejected = '', LogPoint = '', Stopped = '' }
-- or { Breakpoint = '●', BreakpointCondition = '⊜', BreakpointRejected = '⊘', LogPoint = '◆', Stopped = '⭔' }
-- for type, icon in pairs(breakpoint_icons) do
-- local tp = 'Dap' .. type
-- local hl = (type == 'Stopped') and 'DapStop' or 'DapBreak'
-- vim.fn.sign_define(tp, { text = icon, texthl = hl, numhl = hl })
-- end
dap.listeners.after.event_initialized['dapui_config'] = dapui.open
dap.listeners.before.event_terminated['dapui_config'] = dapui.close
dap.listeners.before.event_exited['dapui_config'] = dapui.close
-- Install golang specific config
require('dap-go').setup {
delve = {
-- On Windows delve must be run attached or it crashes.
-- See https://github.com/leoluz/nvim-dap-go/blob/main/README.md#configuring
detached = vim.fn.has 'win32' == 0,
},
}
-- Python configuration
require('dap-python').setup('python') -- Uses the Python in your PATH
require('dap-python').test_runner = 'pytest'
-- Make sure the configurations table exists
dap.configurations.python = dap.configurations.python or {}
-- Add some common Python debug configurations
table.insert(dap.configurations.python, {
type = 'python',
request = 'launch',
name = 'Launch file',
program = '${file}',
pythonPath = function()
-- Try to detect python path from virtual environment
local cwd = vim.fn.getcwd()
if vim.fn.executable(cwd .. '/venv/bin/python') == 1 then
return cwd .. '/venv/bin/python'
elseif vim.fn.executable(cwd .. '/.venv/bin/python') == 1 then
return cwd .. '/.venv/bin/python'
else
return 'python'
end
end,
})
end,
}

View file

@ -1,9 +0,0 @@
# Disable flow control (Ctrl+S, Ctrl+Q) in the terminal
# This allows Ctrl+S to be used for saving in Neovim
stty -ixon
# Optional: You can also add this line to make Ctrl+S work in programs that use readline
# (like the bash/zsh command line itself)
if [ -t 0 ]; then
bind -r '\C-s' 2>/dev/null || true
fi

162
init.lua
View file

@ -91,6 +91,9 @@ local vim = vim
vim.g.mapleader = ' ' vim.g.mapleader = ' '
vim.g.maplocalleader = ' ' vim.g.maplocalleader = ' '
-- Test leader key mapping
vim.keymap.set('n', '<leader>zz', function() print("Leader key is working!") end, { desc = "Test leader key" })
-- Set to true if you have a Nerd Font installed and selected in the terminal -- Set to true if you have a Nerd Font installed and selected in the terminal
vim.g.have_nerd_font = true vim.g.have_nerd_font = true
@ -320,59 +323,112 @@ require('lazy').setup({
-- Then, because we use the `opts` key (recommended), the configuration runs -- Then, because we use the `opts` key (recommended), the configuration runs
-- after the plugin has been loaded as `require(MODULE).setup(opts)`. -- after the plugin has been loaded as `require(MODULE).setup(opts)`.
{ -- Useful plugin to show you pending keybinds. -- NOTE: which-key is now configured in custom/plugins/which_key_integration.lua
'folke/which-key.nvim', -- { -- Useful plugin to show you pending keybinds.
event = 'VimEnter', -- Sets the loading event to 'VimEnter' -- 'folke/which-key.nvim',
opts = { -- event = 'VimEnter', -- Sets the loading event to 'VimEnter'
-- delay between pressing a key and opening which-key (milliseconds) -- opts = {
-- this setting is independent of vim.o.timeoutlen -- -- delay between pressing a key and opening which-key (milliseconds)
delay = 0, -- -- this setting is independent of vim.o.timeoutlen
icons = { -- delay = 0,
-- set icon mappings to true if you have a Nerd Font -- icons = {
mappings = vim.g.have_nerd_font, -- -- set icon mappings to true if you have a Nerd Font
-- If you are using a Nerd Font: set icons.keys to an empty table which will use the -- mappings = vim.g.have_nerd_font,
-- default which-key.nvim defined Nerd Font icons, otherwise define a string table -- -- If you are using a Nerd Font: set icons.keys to an empty table which will use the
keys = vim.g.have_nerd_font and {} or { -- -- default which-key.nvim defined Nerd Font icons, otherwise define a string table
Up = '<Up> ', -- keys = vim.g.have_nerd_font and {} or {
Down = '<Down> ', -- Up = '<Up> ',
Left = '<Left> ', -- Down = '<Down> ', -- { -- Useful plugin to show you pending keybinds.
Right = '<Right> ', -- 'folke/which-key.nvim',
C = '<C-…> ', -- event = 'VimEnter', -- Sets the loading event to 'VimEnter'
M = '<M-…> ', -- opts = {
D = '<D-…> ', -- -- delay between pressing a key and opening which-key (milliseconds)
S = '<S-…> ', -- -- this setting is independent of vim.o.timeoutlen
CR = '<CR> ', -- delay = 0,
Esc = '<Esc> ', -- icons = {
ScrollWheelDown = '<ScrollWheelDown> ', -- -- set icon mappings to true if you have a Nerd Font
ScrollWheelUp = '<ScrollWheelUp> ', -- mappings = vim.g.have_nerd_font,
NL = '<NL> ', -- -- If you are using a Nerd Font: set icons.keys to an empty table which will use the
BS = '<BS> ', -- -- default which-key.nvim defined Nerd Font icons, otherwise define a string table
Space = '<Space> ', -- keys = vim.g.have_nerd_font and {} or {
Tab = '<Tab> ', -- Up = '<Up> ',
F1 = '<F1>', -- Down = '<Down> ',
F2 = '<F2>', -- Left = '<Left> ',
F3 = '<F3>', -- Right = '<Right> ',
F4 = '<F4>', -- C = '<C-…> ',
F5 = '<F5>', -- M = '<M-…> ',
F6 = '<F6>', -- D = '<D-…> ',
F7 = '<F7>', -- S = '<S-…> ',
F8 = '<F8>', -- CR = '<CR> ',
F9 = '<F9>', -- Esc = '<Esc> ',
F10 = '<F10>', -- ScrollWheelDown = '<ScrollWheelDown> ',
F11 = '<F11>', -- ScrollWheelUp = '<ScrollWheelUp> ',
F12 = '<F12>', -- NL = '<NL> ',
}, -- BS = '<BS> ',
}, -- Space = '<Space> ',
-- Tab = '<Tab> ',
-- F1 = '<F1>',
-- F2 = '<F2>',
-- F3 = '<F3>',
-- F4 = '<F4>',
-- F5 = '<F5>',
-- F6 = '<F6>',
-- F7 = '<F7>',
-- F8 = '<F8>',
-- F9 = '<F9>',
-- F10 = '<F10>',
-- F11 = '<F11>',
-- F12 = '<F12>',
-- },
-- },
-- Document existing key chains -- -- Document existing key chains
spec = { -- spec = {
{ '<leader>s', group = '[S]earch' }, -- { '<leader>s', group = '[S]earch' },
{ '<leader>t', group = '[T]oggle' }, -- { '<leader>t', group = '[T]oggle' },
{ '<leader>h', group = 'Git [H]unk', mode = { 'n', 'v' } }, -- { '<leader>h', group = 'Git [H]unk', mode = { 'n', 'v' } },
{ '<leader>b', group = '[B]uffer' }, -- { '<leader>b', group = '[B]uffer' },
}, -- },
}, -- },
}, -- },
-- Left = '<Left> ',
-- Right = '<Right> ',
-- C = '<C-…> ',
-- M = '<M-…> ',
-- D = '<D-…> ',
-- S = '<S-…> ',
-- CR = '<CR> ',
-- Esc = '<Esc> ',
-- ScrollWheelDown = '<ScrollWheelDown> ',
-- ScrollWheelUp = '<ScrollWheelUp> ',
-- NL = '<NL> ',
-- BS = '<BS> ',
-- Space = '<Space> ',
-- Tab = '<Tab> ',
-- F1 = '<F1>',
-- F2 = '<F2>',
-- F3 = '<F3>',
-- F4 = '<F4>',
-- F5 = '<F5>',
-- F6 = '<F6>',
-- F7 = '<F7>',
-- F8 = '<F8>',
-- F9 = '<F9>',
-- F10 = '<F10>',
-- F11 = '<F11>',
-- F12 = '<F12>',
-- },
-- },
-- -- Document existing key chains
-- spec = {
-- { '<leader>s', group = '[S]earch' },
-- { '<leader>t', group = '[T]oggle' },
-- { '<leader>h', group = 'Git [H]unk', mode = { 'n', 'v' } },
-- { '<leader>b', group = '[B]uffer' },
-- },
-- },
-- },
-- NOTE: Plugins can specify dependencies. -- NOTE: Plugins can specify dependencies.
-- --
@ -458,7 +514,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>', function() builtin.buffers() end, { desc = '[ ] Find existing buffers' }) vim.keymap.set('n', '<leader>bb', function() builtin.buffers() end, { desc = '[B]uffers [B]rowse' })
-- 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()

View file

@ -0,0 +1,50 @@
# Neovim Keybinding Cheatsheet
## General
| Key | Mode | Description |
| ----------- | ---- | ----------------------- |
| `<leader>w` | n | Save file |
| `<leader>q` | n | Quit |
| `<leader>Q` | n | Force quit all |
| `<leader>W` | n | Save and quit |
| `<leader>/` | n | Clear search highlights |
| `<Esc>` | n | Clear highlights |
## Navigation
### Window Navigation
| Key | Mode | Description |
| ------- | ---- | -------------------- |
| `<C-h>` | n | Move to left window |
| `<C-j>` | n | Move to lower window |
| `<C-k>` | n | Move to upper window |
| `<C-l>` | n | Move to right window |
### Window Management (`<leader>w`)
| Key | Mode | Description |
| ------------ | ---- | ------------------------- |
| `<leader>wv` | n | Split window vertically |
| `<leader>ws` | n | Split window horizontally |
| `<leader>wq` | n | Close current window |
| `<leader>wo` | n | Close other windows |
| `<leader>wh` | n | Go to left window |
| `<leader>wj` | n | Go to lower window |
| `<leader>wk` | n | Go to upper window |
| `<leader>wl` | n | Go to right window |
### Window Resizing
| Key | Mode | Description |
| ----------- | ---- | ---------------------- |
| `<M-Up>` | n | Increase window height |
| `<M-Down>` | n | Decrease window height |
| `<M-Left>` | n | Decrease window width |
| `<M-Right>` | n | Increase window width |
### Tab Management (`<leader>t`)
| Key | Mode | Description |
| --- | ---- | ----------- |

View file

@ -0,0 +1,182 @@
# Neovim Keybindings Reference
A comprehensive reference for all keybindings in this Neovim configuration, organized by prefix and functionality.
## General Operations
- `<leader>w` - Save file
- `<leader>q` - Quit
- `<leader>Q` - Force quit all
- `<leader>W` - Save and quit
- `<leader>/` - Clear search highlights
- `<Esc>` - Clear highlights
## Navigation
### Window Navigation
- `<C-h>` - Move focus to the left window
- `<C-j>` - Move focus to the down window
- `<C-k>` - Move focus to the up window
- `<C-l>` - Move focus to the right window
### Window Management (`<leader>w`)
- `<leader>wv` - Split window vertically
- `<leader>ws` - Split window horizontally
- `<leader>wq` - Close current window
- `<leader>wo` - Close other windows
### Window Resizing
- `<M-Up>` - Increase window height
- `<M-Down>` - Decrease window height
- `<M-Left>` - Decrease window width
- `<M-Right>` - Increase window width
### Tab Management (`<leader>t`)
- `<leader>tn` - New tab
- `<leader>to` - New tab with file
- `<leader>tc` - Close tab
- `<C-PgDn>` - Next tab
- `<C-PgUp>` - Previous tab
### Buffer Navigation (`<leader>b`)
- `<leader><leader>` - Find buffers
- `<leader>bd` - Delete buffer
- `<leader>bn` - Next buffer
- `<leader>bp` - Previous buffer
- `<leader>bp` - Pick buffer
- `<leader>bc` - Pick buffer to close
- `<leader>bh` - Previous buffer
- `<leader>bl` - Next buffer
- `<leader>bH` - Move buffer left
- `<leader>bL` - Move buffer right
- `<leader>b1-9` - Go to buffer 1-9
- `<A-1-9>` - Go to buffer 1-9
## File Operations (`<leader>f`)
### File Search (Telescope)
- `<leader>ff` - Find files
- `<leader>fg` - Live grep
- `<leader>fb` - Find buffers
- `<leader>fh` - Help tags
- `<leader>fr` - Recent files
- `<leader>fc` - Grep current string
- `<leader>fk` - Find keymaps
- `<leader>fd` - Search diagnostics
- `<leader>fw` - Search current buffer
### Git Search (`<leader>fg`)
- `<leader>fgc` - Git commits
- `<leader>fgb` - Git branches
- `<leader>fgs` - Git status
- `<leader>fgt` - Git stash
### File Explorer
- `<leader>e` - Open file explorer
## Editing
### Line Movement
- `<A-j>` - Move line down
- `<A-k>` - Move line up
- `<A-j>` (visual) - Move selection down
- `<A-k>` (visual) - Move selection up
### Indentation
- `<` (visual) - Decrease indent
- `>` (visual) - Increase indent
## Terminal (`<leader>tt`)
- `<leader>tt` - Toggle terminal
- `<leader>tf` - Toggle floating terminal
- `<leader>th` - Toggle horizontal terminal
- `<leader>tv` - Toggle vertical terminal
- `<Esc>` (terminal) - Exit terminal mode
## Diagnostics (`<leader>x`)
- `<leader>xx` - Toggle trouble
- `<leader>xw` - Toggle workspace diagnostics
- `<leader>xd` - Toggle document diagnostics / Open diagnostic float
- `<leader>xq` - Toggle quickfix
- `<leader>xl` - Toggle location list / Open diagnostic list
- `[d` - Previous diagnostic
- `]d` - Next diagnostic
## Plugin-specific Keybindings
### Harpoon (`<leader>h`)
- `<leader>ha` - Add file to harpoon
- `<leader>hh` - Toggle quick menu
- `<leader>h1-9` - Jump to file 1-9
### LeetCode (`<leader>l`)
- `<leader>ll` - Open LeetCode
- `<leader>ld` - Daily Challenge
- `<leader>lr` - Random Problem
- `<leader>ls` - Submit Solution
- `<leader>lt` - Test Solution
- `<leader>lm` - LeetCode Menu
- `<leader>li` - Problem Info
- `<leader>lc` - Toggle Console
- `<leader>la` - Switch Tab
### Neorg (`<leader>n`)
- `<leader>ni` - Neorg index
- `<leader>nr` - Return from workspace
- `<leader>nt` - Toggle concealer
- `<leader>nm` - Inject metadata
#### Neorg Journal (`<leader>nj`)
- `<leader>njj` - Today's journal entry
- `<leader>njt` - Tomorrow's journal entry
- `<leader>njy` - Yesterday's journal entry
#### Neorg Workspace (`<leader>nw`)
- `<leader>nwn` - Switch to notes workspace
- `<leader>nww` - Switch to work workspace
- `<leader>nwp` - Switch to personal workspace
#### Neorg Export (`<leader>ne`)
- `<leader>neh` - Export to HTML
- `<leader>nem` - Export to Markdown
- `<leader>nep` - Export to PDF
### LSP (`<leader>ls`)
- `<leader>lsr` - Rename symbol
- `<leader>lsa` - Code actions
- `<leader>lsf` - Format document
- `<leader>lsd` - Go to definition
- `<leader>lst` - Go to type definition
- `<leader>lsD` - Go to declaration
- `<leader>lsi` - Go to implementation
- `<leader>lsr` - Go to references
### Test (`<leader>te`)
- `<leader>ter` - Run test
- `<leader>tes` - Run test suite
- `<leader>tef` - Run test file
- `<leader>tel` - Run last test
### Code/Copilot (`<leader>c`)
- Various code and Copilot-related commands

View file

@ -0,0 +1,187 @@
# Neovim Keybindings Reference
This document provides a comprehensive reference for all keybindings in this Neovim configuration, organized by category.
## Navigation
### Window Navigation
- `<C-h>` - Move focus to the left window
- `<C-j>` - Move focus to the down window
- `<C-k>` - Move focus to the up window
- `<C-l>` - Move focus to the right window
### Window Management
- `<leader>wv` - Split window vertically
- `<leader>ws` - Split window horizontally
- `<leader>wq` - Close current window
- `<leader>wo` - Close other windows
### Window Resizing
- `<M-Up>` - Increase window height
- `<M-Down>` - Decrease window height
- `<M-Left>` - Decrease window width
- `<M-Right>` - Increase window width
### Tab Management
- `<leader>tn` - New tab
- `<leader>to` - New tab with file
- `<leader>tc` - Close tab
- `<C-PgDn>` - Next tab
- `<C-PgUp>` - Previous tab
### Buffer Navigation
- `<leader><leader>` - Find buffers
- `<leader>bd` - Delete buffer
- `<leader>bn` - Next buffer
- `<leader>bp` - Previous buffer
## File Operations
### General Operations
- `<leader>w` - Save file
- `<leader>q` - Quit
- `<leader>Q` - Force quit all
- `<leader>W` - Save and quit
- `<leader>/` - Clear search highlights
- `<Esc>` - Clear highlights
### File Explorer
- `<leader>e` - Open file explorer
## Search and Navigation (Telescope)
### General Search
- `<leader>ff` - Find files
- `<leader>fg` - Live grep
- `<leader>fb` - Find buffers
- `<leader>fh` - Help tags
- `<leader>fr` - Recent files
- `<leader>fc` - Grep current string
- `<leader>fk` - Find keymaps
- `<leader>fd` - Search diagnostics
- `<leader>fw` - Search current buffer
### Git Search
- `<leader>fgc` - Git commits
- `<leader>fgb` - Git branches
- `<leader>fgs` - Git status
- `<leader>fgt` - Git stash
## Bufferline
### Buffer Actions
- `<leader>bp` - Pick buffer
- `<leader>bc` - Pick buffer to close
- `<leader>bh` - Previous buffer
- `<leader>bl` - Next buffer
- `<leader>bH` - Move buffer left
- `<leader>bL` - Move buffer right
- `<leader>b1-9` - Go to buffer 1-9
- `<A-1-9>` - Go to buffer 1-9
## Editing
### Line Movement
- `<A-j>` - Move line down
- `<A-k>` - Move line up
- `<A-j>` (visual) - Move selection down
- `<A-k>` (visual) - Move selection up
### Indentation
- `<` (visual) - Decrease indent
- `>` (visual) - Increase indent
## Terminal
### Terminal Commands
- `<leader>tt` - Toggle terminal
- `<leader>tf` - Toggle floating terminal
- `<leader>th` - Toggle horizontal terminal
- `<leader>tv` - Toggle vertical terminal
- `<Esc>` (terminal) - Exit terminal mode
## Diagnostics
### Diagnostic Navigation
- `<leader>xd` - Open diagnostic float
- `<leader>xl` - Open diagnostic list
- `[d` - Previous diagnostic
- `]d` - Next diagnostic
## Plugin-specific Keybindings
### Harpoon
- `<leader>ha` - Add file to harpoon
- `<leader>hh` - Toggle quick menu
- `<leader>h1-9` - Jump to file 1-9
### LeetCode
- `<leader>ll` - Open LeetCode
- `<leader>ld` - Daily Challenge
- `<leader>lr` - Random Problem
- `<leader>ls` - Submit Solution
- `<leader>lt` - Test Solution
- `<leader>lm` - LeetCode Menu
- `<leader>li` - Problem Info
- `<leader>lc` - Toggle Console
- `<leader>la` - Switch Tab
### Trouble/Diagnostics
- `<leader>xx` - Toggle trouble
- `<leader>xw` - Toggle workspace diagnostics
- `<leader>xd` - Toggle document diagnostics
- `<leader>xq` - Toggle quickfix
- `<leader>xl` - Toggle location list
### Neorg
- `<leader>ni` - Neorg index
- `<leader>nr` - Return from workspace
- `<leader>nt` - Toggle concealer
- `<leader>nm` - Inject metadata
#### Neorg Journal
- `<leader>njj` - Today's journal entry
- `<leader>njt` - Tomorrow's journal entry
- `<leader>njy` - Yesterday's journal entry
#### Neorg Workspace
- `<leader>nwn` - Switch to notes workspace
- `<leader>nww` - Switch to work workspace
- `<leader>nwp` - Switch to personal workspace
#### Neorg Export
- `<leader>neh` - Export to HTML
- `<leader>nem` - Export to Markdown
- `<leader>nep` - Export to PDF
### LSP
- `<leader>lsr` - Rename symbol
- `<leader>lsa` - Code actions
- `<leader>lsf` - Format document
- `<leader>lsd` - Go to definition
- `<leader>lst` - Go to type definition
- `<leader>lsD` - Go to declaration
- `<leader>lsi` - Go to implementation
- `<leader>lsr` - Go to references

113
lua/custom/keymaps.lua Normal file
View file

@ -0,0 +1,113 @@
--[[
Centralized keymaps configuration
This file contains all the keybindings for the Neovim configuration,
organized by category for better readability and maintenance.
Structure:
1. General keymaps (save, quit, etc.)
2. Navigation keymaps (windows, tabs, etc.)
3. UI keymaps (toggle elements, etc.)
4. Editing keymaps (formatting, etc.)
5. Plugin-specific keymaps
]]
local M = {}
-- Helper function for setting keymaps with proper labels
local function map(mode, lhs, rhs, opts)
opts = opts or {}
opts.noremap = opts.noremap == nil and true or opts.noremap
opts.silent = opts.silent == nil and true or opts.silent
vim.keymap.set(mode, lhs, rhs, opts)
end
-- Initialize keymaps
function M.setup()
--------------------------------------------------
-- 1. GENERAL KEYMAPS
--------------------------------------------------
-- Save and quit
map('n', '<leader>w', ':w<CR>', { desc = 'Save file' })
-- map('n', '<leader>q', ':q<CR>', { desc = 'Quit' })
map('n', '<leader>Q', ':qa!<CR>', { desc = 'Force quit all' })
map('n', '<leader>W', ':wq<CR>', { desc = 'Save and quit' })
-- Common operations
map('n', '<leader>/', '<cmd>nohlsearch<CR>', { desc = 'Clear search highlights' })
map('n', '<Esc>', '<cmd>noh<CR>', { desc = 'Clear highlights' })
--------------------------------------------------
-- 2. NAVIGATION KEYMAPS
--------------------------------------------------
-- Window navigation
map('n', '<C-h>', '<C-w>h', { desc = 'Move focus to the left window' })
map('n', '<C-j>', '<C-w>j', { desc = 'Move focus to the down window' })
map('n', '<C-k>', '<C-w>k', { desc = 'Move focus to the up window' })
map('n', '<C-l>', '<C-w>l', { desc = 'Move focus to the right window' })
-- Window management
map('n', '<leader>[', ':vsplit<CR>', { desc = 'Split window vertically' })
map('n', '<leader>]', ':split<CR>', { desc = 'Split window horizontally' })
map('n', '<leader>wq', '<C-w>q', { desc = 'Close current window' })
map('n', '<leader>wo', '<C-w>o', { desc = 'Close other windows' })
-- Window resizing
map('n', '<M-Up>', ':resize +2<CR>', { desc = 'Increase window height' })
map('n', '<M-Down>', ':resize -2<CR>', { desc = 'Decrease window height' })
map('n', '<M-Left>', ':vertical resize -2<CR>', { desc = 'Decrease window width' })
map('n', '<M-Right>', ':vertical resize +2<CR>', { desc = 'Increase window width' })
-- Tab management (see also plugin-specific keymaps below)
map('n', '<leader>tn', ':tabnew<CR>', { desc = 'New tab' })
map('n', '<leader>to', ':tabnew<CR>:Telescope find_files<CR>', { desc = 'New tab with file' })
map('n', '<leader>tc', ':tabclose<CR>', { desc = 'Close tab' })
map('n', '<C-PgDn>', 'gt', { desc = 'Next tab' })
map('n', '<C-PgUp>', 'gT', { desc = 'Previous tab' })
-- Buffer navigation
map('n', '<leader>bb', "<cmd>lua require('telescope.builtin').buffers()<CR>", { desc = 'Browse buffers' })
map('n', '<leader>bd', ':bd<CR>', { desc = 'Delete buffer' })
map('n', '<leader>bn', ':bn<CR>', { desc = 'Next buffer' })
map('n', '<leader>bp', ':bp<CR>', { desc = 'Previous buffer' })
--------------------------------------------------
-- 3. UI KEYMAPS
--------------------------------------------------
-- File explorer
map('n', '<leader>e', ':Explore<CR>', { desc = 'Open file explorer' })
-- Terminal
map('n', '<leader>tt', ':ToggleTerm<CR>', { desc = 'Toggle terminal' })
map('n', '<leader>tf', ':ToggleTerm direction=float<CR>', { desc = 'Toggle floating terminal' })
map('n', '<leader>th', ':ToggleTerm direction=horizontal<CR>', { desc = 'Toggle horizontal terminal' })
map('n', '<leader>tv', ':ToggleTerm direction=vertical<CR>', { desc = 'Toggle vertical terminal' })
map('t', '<Esc>', [[<C-\><C-n>]], { desc = 'Exit terminal mode' })
-- Diagnostics
map('n', '<leader>xd', vim.diagnostic.open_float, { desc = 'Open diagnostic float' })
map('n', '<leader>xl', vim.diagnostic.setloclist, { desc = 'Open diagnostic list' })
map('n', '[d', vim.diagnostic.goto_prev, { desc = 'Previous diagnostic' })
map('n', ']d', vim.diagnostic.goto_next, { desc = 'Next diagnostic' })
--------------------------------------------------
-- 4. EDITING KEYMAPS
--------------------------------------------------
-- Move lines
map('n', '<A-j>', ':m .+1<CR>==', { desc = 'Move line down' })
map('n', '<A-k>', ':m .-2<CR>==', { desc = 'Move line up' })
map('v', '<A-j>', ":m '>+1<CR>gv=gv", { desc = 'Move selection down' })
map('v', '<A-k>', ":m '<-2<CR>gv=gv", { desc = 'Move selection up' })
-- Better indenting
map('v', '<', '<gv', { desc = 'Decrease indent and reselect' })
map('v', '>', '>gv', { desc = 'Increase indent and reselect' })
return M
end
return M

View file

@ -0,0 +1,196 @@
# Neovim Keybindings Reference
This document provides a comprehensive reference for all keybindings in your Neovim configuration.
## Table of Contents
- [General Keybindings](#general-keybindings)
- [Navigation](#navigation)
- [Editing](#editing)
- [UI & Terminal](#ui--terminal)
- [Plugin Keybindings](#plugin-keybindings)
- [Telescope](#telescope)
- [Bufferline](#bufferline)
- [Harpoon](#harpoon)
- [Git](#git)
- [Copilot](#copilot)
- [Neorg](#neorg)
- [LeetCode](#leetcode)
## General Keybindings
| Keybinding | Mode | Description |
| ----------- | ------ | ----------------------- |
| `<leader>w` | Normal | Save file |
| `<leader>q` | Normal | Quit |
| `<leader>Q` | Normal | Force quit all |
| `<leader>W` | Normal | Save and quit |
| `<leader>/` | Normal | Clear search highlights |
| `<Esc>` | Normal | Clear highlights |
## Navigation
### Window Navigation
| Keybinding | Mode | Description |
| ---------- | ------ | -------------------------- |
| `<C-h>` | Normal | Move focus to left window |
| `<C-j>` | Normal | Move focus to down window |
| `<C-k>` | Normal | Move focus to up window |
| `<C-l>` | Normal | Move focus to right window |
### Window Management
| Keybinding | Mode | Description |
| ------------ | ------ | ------------------------- |
| `<leader>wv` | Normal | Split window vertically |
| `<leader>ws` | Normal | Split window horizontally |
| `<leader>wq` | Normal | Close current window |
| `<leader>wo` | Normal | Close other windows |
| `<M-Up>` | Normal | Increase window height |
| `<M-Down>` | Normal | Decrease window height |
| `<M-Left>` | Normal | Decrease window width |
| `<M-Right>` | Normal | Increase window width |
### Tab Management
| Keybinding | Mode | Description |
| ------------ | ------ | ----------------- |
| `<leader>tn` | Normal | New tab |
| `<leader>to` | Normal | New tab with file |
| `<leader>tc` | Normal | Close tab |
| `<C-PgDn>` | Normal | Next tab |
| `<C-PgUp>` | Normal | Previous tab |
### Buffer Navigation
| Keybinding | Mode | Description |
| ------------------ | ------ | --------------- |
| `<leader><leader>` | Normal | Find buffers |
| `<leader>bd` | Normal | Delete buffer |
| `<leader>bn` | Normal | Next buffer |
| `<leader>bp` | Normal | Previous buffer |
## Editing
| Keybinding | Mode | Description |
| ---------- | ------ | ---------------------------- |
| `<A-j>` | Normal | Move line down |
| `<A-k>` | Normal | Move line up |
| `<A-j>` | Visual | Move selection down |
| `<A-k>` | Visual | Move selection up |
| `<` | Visual | Decrease indent and reselect |
| `>` | Visual | Increase indent and reselect |
## UI & Terminal
| Keybinding | Mode | Description |
| ------------ | -------- | -------------------------- |
| `<leader>e` | Normal | Open file explorer |
| `<leader>tt` | Normal | Toggle terminal |
| `<leader>tf` | Normal | Toggle floating terminal |
| `<leader>th` | Normal | Toggle horizontal terminal |
| `<leader>tv` | Normal | Toggle vertical terminal |
| `<Esc>` | Terminal | Exit terminal mode |
### Diagnostics
| Keybinding | Mode | Description |
| ------------ | ------ | --------------------- |
| `<leader>xd` | Normal | Open diagnostic float |
| `<leader>xl` | Normal | Open diagnostic list |
| `[d` | Normal | Previous diagnostic |
| `]d` | Normal | Next diagnostic |
## Plugin Keybindings
### Telescope
| Keybinding | Mode | Description |
| ------------- | ------ | ------------------- |
| `<leader>ff` | Normal | Find files |
| `<leader>fg` | Normal | Live grep |
| `<leader>fb` | Normal | Find buffers |
| `<leader>fh` | Normal | Help tags |
| `<leader>fr` | Normal | Recent files |
| `<leader>fc` | Normal | Grep current string |
| `<leader>fk` | Normal | Find keymaps |
| `<leader>fgc` | Normal | Git commits |
| `<leader>fgb` | Normal | Git branches |
| `<leader>fgs` | Normal | Git status |
### Bufferline
| Keybinding | Mode | Description |
| ------------------ | ------ | -------------------- |
| `<leader>bp` | Normal | Pick buffer |
| `<leader>bc` | Normal | Pick buffer to close |
| `<leader>bh` | Normal | Previous buffer |
| `<leader>bl` | Normal | Next buffer |
| `<leader>bH` | Normal | Move buffer left |
| `<leader>bL` | Normal | Move buffer right |
| `<A-1>` to `<A-9>` | Normal | Go to buffer 1-9 |
### Harpoon
| Keybinding | Mode | Description |
| ---------------------------- | ------ | ------------------------ |
| `<leader>ha` | Normal | Add file to harpoon |
| `<leader>hm` | Normal | Open harpoon menu |
| `<leader>h1` to `<leader>h9` | Normal | Jump to harpoon file 1-9 |
| `<C-n>` | Normal | Next harpoon file |
| `<C-p>` | Normal | Previous harpoon file |
### Git
| Keybinding | Mode | Description |
| ------------ | ------ | -------------------- |
| `<leader>gg` | Normal | Open LazyGit |
| `<leader>gc` | Normal | Open LazyGit config |
| `<leader>gf` | Normal | LazyGit current file |
### Copilot
| Keybinding | Mode | Description |
| ------------ | ------ | -------------------------------- |
| `<leader>cc` | Normal | Copilot chat |
| `<leader>ce` | Normal | Explain code |
| `<leader>cf` | Normal | Fix code |
| `<leader>co` | Normal | Optimize code |
| `<leader>cd` | Normal | Generate documentation |
| `<leader>ct` | Normal | Generate tests |
| `<leader>cb` | Normal | Check best practices |
| `<leader>ce` | Visual | Explain selected code |
| `<leader>cf` | Visual | Fix selected code |
| `<leader>co` | Visual | Optimize selected code |
| `<leader>cd` | Visual | Document selected code |
| `<leader>ct` | Visual | Generate tests for selected code |
### Neorg
| Keybinding | Mode | Description |
| ------------- | ------ | ---------------------------- |
| `<leader>nj` | Normal | Open today's journal |
| `<leader>nyt` | Normal | Open yesterday's journal |
| `<leader>ntm` | Normal | Open tomorrow's journal |
| `<leader>nw` | Normal | Open workspace selector |
| `<leader>nn` | Normal | Switch to notes workspace |
| `<leader>nwp` | Normal | Switch to personal workspace |
| `<leader>ntt` | Normal | Generate table of contents |
| `<leader>ni` | Normal | Inject metadata |
| `<leader>nm` | Normal | Update metadata |
| `<leader>nc` | Normal | Toggle concealer |
| `<leader>nem` | Normal | Export to markdown |
| `<leader>nl` | Normal | Return to last workspace |
| `<leader>nu` | Normal | Iterate next list type |
| `<leader>np` | Normal | Iterate previous list type |
### LeetCode
| Keybinding | Mode | Description |
| ------------ | ------ | ------------------------ |
| `<leader>ll` | Normal | Open LeetCode |
| `<leader>ld` | Normal | LeetCode daily challenge |
| `<leader>lr` | Normal | LeetCode random problem |
| `<leader>ls` | Normal | Submit LeetCode solution |
| `<leader>lt` | Normal | Test LeetCode solution |

View file

@ -0,0 +1,270 @@
--[[
Plugin-specific keymaps configuration
This file contains all the plugin-specific keybindings,
organized by plugin for better readability and maintenance.
]]
local M = {}
-- Initialize plugin keymaps
function M.setup()
-- Ensure vim is available in this scope
local vim = vim or _G.vim or require('vim')
-- Helper function for setting keymaps with proper labels
local function map(mode, lhs, rhs, opts)
opts = opts or {}
opts.noremap = opts.noremap == nil and true or opts.noremap
opts.silent = opts.silent == nil and true or opts.silent
vim.keymap.set(mode, lhs, rhs, opts)
end
-- Check if which-key is available
local which_key_ok, wk = pcall(require, "which-key")
if not which_key_ok then
vim.notify("Which-key not found, keybindings will be set without groups", vim.log.levels.WARN)
end
--------------------------------------------------
-- TELESCOPE
--------------------------------------------------
local telescope_builtin_ok, builtin = pcall(require, "telescope.builtin")
if telescope_builtin_ok then
if which_key_ok then
wk.add({
{ "<leader>f", group = "Find/Files" },
{ "<leader>ff", function() builtin.find_files() end, desc = "Find files" },
{ "<leader>fg", function() builtin.live_grep() end, desc = "Live grep" },
{ "<leader>fb", function() builtin.buffers() end, desc = "Find buffers" },
{ "<leader>fh", function() builtin.help_tags() end, desc = "Help tags" },
{ "<leader>fr", function() builtin.oldfiles() end, desc = "Recent files" },
{ "<leader>fc", function() builtin.grep_string() end, desc = "Grep current string" },
{ "<leader>fk", function() builtin.keymaps() end, desc = "Find keymaps" },
{ "<leader>fd", function() builtin.diagnostics() end, desc = "Search diagnostics" },
{ "<leader>fw", function() builtin.current_buffer_fuzzy_find() end, desc = "Search current buffer" },
})
wk.add({
{ "<leader>fg", group = "Git Search" },
{ "<leader>fgc", function() builtin.git_commits() end, desc = "Git commits" },
{ "<leader>fgb", function() builtin.git_branches() end, desc = "Git branches" },
{ "<leader>fgs", function() builtin.git_status() end, desc = "Git status" },
{ "<leader>fgt", function() builtin.git_stash() end, desc = "Git stashes" },
})
wk.add({
{ "<leader><leader>", function() builtin.buffers() end, desc = "Find buffers (Telescope)" },
})
else
map("n", "<leader>ff", function() builtin.find_files() end, { desc = "Find files" })
map("n", "<leader>fg", function() builtin.live_grep() end, { desc = "Live grep" })
map("n", "<leader>fb", function() builtin.buffers() end, { desc = "Find buffers" })
map("n", "<leader>fh", function() builtin.help_tags() end, { desc = "Help tags" })
map("n", "<leader>fr", function() builtin.oldfiles() end, { desc = "Recent files" })
map("n", "<leader>fc", function() builtin.grep_string() end, { desc = "Grep current string" })
map("n", "<leader>fk", function() builtin.keymaps() end, { desc = "Find keymaps" })
map("n", "<leader>fd", function() builtin.diagnostics() end, { desc = "Search diagnostics" })
map("n", "<leader>fw", function() builtin.current_buffer_fuzzy_find() end, { desc = "Search current buffer" })
map("n", "<leader>fgc", function() builtin.git_commits() end, { desc = "Git commits" })
map("n", "<leader>fgb", function() builtin.git_branches() end, { desc = "Git branches" })
map("n", "<leader>fgs", function() builtin.git_status() end, { desc = "Git status" })
map("n", "<leader>fgt", function() builtin.git_stash() end, { desc = "Git stashes" })
map("n", "<leader><leader>", function() builtin.buffers() end, { desc = "Find buffers (Telescope)" })
end
end
--------------------------------------------------
-- BUFFERLINE
--------------------------------------------------
local bufferline_commands_ok = pcall(require, 'bufferline')
if bufferline_commands_ok then
if which_key_ok then
wk.add({
{ "<leader>b", group = "Buffers" },
{ "<leader>bp", "<cmd>BufferLinePick<CR>", desc = "Pick buffer" },
{ "<leader>bc", "<cmd>BufferLinePickClose<CR>", desc = "Pick buffer to close" },
{ "<leader>bh", "<cmd>BufferLineCyclePrev<CR>", desc = "Previous buffer" },
{ "<leader>bl", "<cmd>BufferLineCycleNext<CR>", desc = "Next buffer" },
{ "<leader>bH", "<cmd>BufferLineMovePrev<CR>", desc = "Move buffer left" },
{ "<leader>bL", "<cmd>BufferLineMoveNext<CR>", desc = "Move buffer right" },
{ "<leader>b1", "<cmd>BufferLineGoToBuffer 1<CR>", desc = "Buffer 1" },
{ "<leader>b2", "<cmd>BufferLineGoToBuffer 2<CR>", desc = "Buffer 2" },
{ "<leader>b3", "<cmd>BufferLineGoToBuffer 3<CR>", desc = "Buffer 3" },
{ "<leader>b4", "<cmd>BufferLineGoToBuffer 4<CR>", desc = "Buffer 4" },
{ "<leader>b5", "<cmd>BufferLineGoToBuffer 5<CR>", desc = "Buffer 5" },
{ "<leader>b6", "<cmd>BufferLineGoToBuffer 6<CR>", desc = "Buffer 6" },
{ "<leader>b7", "<cmd>BufferLineGoToBuffer 7<CR>", desc = "Buffer 7" },
{ "<leader>b8", "<cmd>BufferLineGoToBuffer 8<CR>", desc = "Buffer 8" },
{ "<leader>b9", "<cmd>BufferLineGoToBuffer 9<CR>", desc = "Buffer 9" },
})
local alt_buffer_items = {}
for i = 1, 9 do
table.insert(alt_buffer_items, {
string.format("<A-%d>", i),
string.format("<cmd>BufferLineGoToBuffer %d<CR>", i),
desc = string.format("Buffer %d", i)
})
end
if #alt_buffer_items > 0 then
wk.add(alt_buffer_items)
end
else
map("n", "<leader>bp", "<cmd>BufferLinePick<CR>", { desc = "Pick buffer" })
map("n", "<leader>bc", "<cmd>BufferLinePickClose<CR>", { desc = "Pick buffer to close" })
map("n", "<leader>bh", "<cmd>BufferLineCyclePrev<CR>", { desc = "Previous buffer" })
map("n", "<leader>bl", "<cmd>BufferLineCycleNext<CR>", { desc = "Next buffer" })
map("n", "<leader>bH", "<cmd>BufferLineMovePrev<CR>", { desc = "Move buffer left" })
map("n", "<leader>bL", "<cmd>BufferLineMoveNext<CR>", { desc = "Move buffer right" })
for i = 1, 9 do
map("n", string.format("<leader>b%d", i), string.format("<cmd>BufferLineGoToBuffer %d<CR>", i), { desc = string.format("Buffer %d", i) })
map("n", string.format("<A-%d>", i), string.format("<cmd>BufferLineGoToBuffer %d<CR>", i), { desc = string.format("Buffer %d", i) })
end
end
end
--------------------------------------------------
-- HARPOON
--------------------------------------------------
local harpoon_ok, harpoon = pcall(require, "harpoon")
if harpoon_ok then
if which_key_ok then
local harpoon_items = {
{ "<leader>h", group = "Harpoon" },
{ "<leader>ha", function() harpoon:list():add() end, desc = "Add file" },
{ "<leader>hm", function() harpoon.ui:toggle_quick_menu(harpoon:list()) end, desc = "Toggle menu" },
}
for i = 1, 9 do
table.insert(harpoon_items, {
string.format("<leader>h%d", i),
function() harpoon:list():select(i) end,
desc = string.format("Jump to file %d", i)
})
end
wk.add(harpoon_items)
wk.add({
{ "<C-n>", function() harpoon:list():next() end, desc = "Harpoon next file" },
{ "<C-p>", function() harpoon:list():prev() end, desc = "Harpoon previous file" },
})
else
map("n", "<leader>ha", function() harpoon:list():add() end, { desc = "Add file" })
map("n", "<leader>hm", function() harpoon.ui:toggle_quick_menu(harpoon:list()) end, { desc = "Toggle menu" })
for i = 1, 9 do
map("n", string.format("<leader>h%d", i), function() harpoon:list():select(i) end, { desc = string.format("Jump to file %d", i) })
end
map("n", "<C-n>", function() harpoon:list():next() end, { desc = "Harpoon next file" })
map("n", "<C-p>", function() harpoon:list():prev() end, { desc = "Harpoon previous file" })
end
end
--------------------------------------------------
-- GIT (LAZYGIT)
--------------------------------------------------
local lazygit_commands_ok = pcall(require, 'lazygit')
if lazygit_commands_ok then
if which_key_ok then
wk.add({
{ "<leader>g", group = "Git" },
{ "<leader>gg", "<cmd>LazyGit<CR>", desc = "Open LazyGit" },
{ "<leader>gc", "<cmd>LazyGitConfig<CR>", desc = "LazyGit Config" },
{ "<leader>gf", "<cmd>LazyGitCurrentFile<CR>", desc = "LazyGit Current File" },
{ "<leader>gb", "<cmd>LazyGitFilter<CR>", desc = "LazyGit Filter" },
{ "<leader>gB", "<cmd>LazyGitFilterCurrentFile<CR>", desc = "LazyGit Filter Current File" },
})
else
map('n', '<leader>gg', '<cmd>LazyGit<CR>', { desc = 'Open LazyGit' })
map('n', '<leader>gc', '<cmd>LazyGitConfig<CR>', { desc = 'LazyGit Config' })
map('n', '<leader>gf', '<cmd>LazyGitCurrentFile<CR>', { desc = 'LazyGit Current File' })
map('n', '<leader>gb', '<cmd>LazyGitFilter<CR>', { desc = 'LazyGit Filter' })
map('n', '<leader>gB', '<cmd>LazyGitFilterCurrentFile<CR>', { desc = 'LazyGit Filter Current File' })
end
end
--------------------------------------------------
-- COMMENTING
--------------------------------------------------
-- Comment.nvim and other commenting tools are already mapped through their setup
--------------------------------------------------
-- COPILOT CHAT
--------------------------------------------------
local copilot_chat_ok = pcall(require, 'CopilotChat')
if copilot_chat_ok then
if which_key_ok then
-- Normal mode commands
wk.add({
{ "<leader>c", group = "Copilot" },
{ "<leader>cc", "<cmd>CopilotChat<CR>", desc = "Open Chat" },
{ "<leader>ce", "<cmd>CopilotChatExplain<CR>", desc = "Explain Code" },
{ "<leader>cf", "<cmd>CopilotChatFixCode<CR>", desc = "Fix Code" },
{ "<leader>co", "<cmd>CopilotChatOptimize<CR>", desc = "Optimize Code" },
{ "<leader>cd", "<cmd>CopilotChatDocumentation<CR>", desc = "Generate Documentation" },
{ "<leader>ct", "<cmd>CopilotChatTests<CR>", desc = "Generate Tests" },
{ "<leader>cb", "<cmd>CopilotChatBestPractices<CR>", desc = "Check Best Practices" },
{ "<leader>cr", "<cmd>CopilotChatRefactor<CR>", desc = "Refactor Code" },
{ "<leader>cs", "<cmd>CopilotChatSummarize<CR>", desc = "Summarize Code" },
{ "<leader>ch", "<cmd>CopilotChatHelp<CR>", desc = "Copilot Chat Help" },
})
-- Visual mode commands
wk.add({
{ "<leader>c", group = "Copilot", mode = "v" },
{ "<leader>ce", ":CopilotChatExplain<CR>", desc = "Explain Selected Code", mode = "v" },
{ "<leader>cf", ":CopilotChatFixCode<CR>", desc = "Fix Selected Code", mode = "v" },
{ "<leader>co", ":CopilotChatOptimize<CR>", desc = "Optimize Selected Code", mode = "v" },
{ "<leader>cd", ":CopilotChatDocumentation<CR>", desc = "Document Selected Code", mode = "v" },
{ "<leader>ct", ":CopilotChatTests<CR>", desc = "Generate Tests for Selection", mode = "v" },
{ "<leader>cr", ":CopilotChatRefactor<CR>", desc = "Refactor Selected Code", mode = "v" },
{ "<leader>cs", ":CopilotChatSummarize<CR>", desc = "Summarize Selected Code", mode = "v" },
})
else
map("n", "<leader>cc", "<cmd>CopilotChat<CR>", { desc = "Open Chat" })
map("n", "<leader>ce", "<cmd>CopilotChatExplain<CR>", { desc = "Explain Code" })
map("n", "<leader>cf", "<cmd>CopilotChatFixCode<CR>", { desc = "Fix Code" })
map("n", "<leader>co", "<cmd>CopilotChatOptimize<CR>", { desc = "Optimize Code" })
map("n", "<leader>cd", "<cmd>CopilotChatDocumentation<CR>", { desc = "Generate Documentation" })
map("n", "<leader>ct", "<cmd>CopilotChatTests<CR>", { desc = "Generate Tests" })
map("n", "<leader>cb", "<cmd>CopilotChatBestPractices<CR>", { desc = "Check Best Practices" })
map("n", "<leader>cr", "<cmd>CopilotChatRefactor<CR>", { desc = "Refactor Code" })
map("n", "<leader>cs", "<cmd>CopilotChatSummarize<CR>", { desc = "Summarize Code" })
map("n", "<leader>ch", "<cmd>CopilotChatHelp<CR>", { desc = "Copilot Chat Help" })
map("v", "<leader>ce", ":CopilotChatExplain<CR>", { desc = "Explain Selected Code" })
map("v", "<leader>cf", ":CopilotChatFixCode<CR>", { desc = "Fix Selected Code" })
map("v", "<leader>co", ":CopilotChatOptimize<CR>", { desc = "Optimize Selected Code" })
map("v", "<leader>cd", ":CopilotChatDocumentation<CR>", { desc = "Document Selected Code" })
map("v", "<leader>ct", ":CopilotChatTests<CR>", { desc = "Generate Tests for Selection" })
map("v", "<leader>cr", ":CopilotChatRefactor<CR>", { desc = "Refactor Selected Code" })
map("v", "<leader>cs", ":CopilotChatSummarize<CR>", { desc = "Summarize Selected Code" })
end
end
--------------------------------------------------
-- LEETCODE
--------------------------------------------------
local leetcode_ok = pcall(require, 'leetcode')
if leetcode_ok then
if which_key_ok then
wk.add({
{ "<leader>l", group = "LeetCode" },
{ "<leader>ll", "<cmd>Leet<CR>", desc = "Open LeetCode" },
{ "<leader>ld", "<cmd>Leet daily<CR>", desc = "LeetCode daily challenge" },
{ "<leader>lr", "<cmd>Leet random<CR>", desc = "LeetCode random problem" },
{ "<leader>ls", "<cmd>Leet submit<CR>", desc = "Submit LeetCode solution" },
{ "<leader>la", "<cmd>Leet tabs<CR>", desc = "Switch tab" },
})
else
map('n', '<leader>ll', '<cmd>Leet<CR>', { desc = 'Open LeetCode' })
map('n', '<leader>ld', '<cmd>Leet daily<CR>', { desc = 'LeetCode daily challenge' })
map('n', '<leader>lr', '<cmd>Leet random<CR>', { desc = 'LeetCode random problem' })
map('n', '<leader>ls', '<cmd>Leet submit<CR>', { desc = 'Submit LeetCode solution' })
map('n', '<leader>la', '<cmd>Leet tabs<CR>', { desc = 'Switch tab' })
end
end
return M
end
return M

View file

@ -1,192 +1,287 @@
-- filepath: /home/kali/.config/nvim/lua/custom/plugins/copilot-chat.lua --gitHub Copilot Chat configuration - Latest v3+ setup
-- GitHub Copilot Chat configuration -- Comprehensive configuration with all features and working keymaps
-- An advanced setup for Copilot Chat in Neovim
-- https://github.com/CopilotC-Nvim/CopilotChat.nvim -- https://github.com/CopilotC-Nvim/CopilotChat.nvim
-- Declare vim as global
local vim = vim
return { return {
"CopilotC-Nvim/CopilotChat.nvim", "CopilotC-Nvim/CopilotChat.nvim",
branch = "main", -- Ensure we're using the stable main branch
dependencies = { dependencies = {
-- Dependencies for CopilotChat { "github/copilot.vim" }, -- or zbirenbaum/copilot.lua
{ "github/copilot.vim" }, -- The base Copilot plugin { "nvim-lua/plenary.nvim", branch = "master" }, -- for curl, log and async functions
{ "nvim-lua/plenary.nvim" }, -- Common Lua functions
{ "nvim-telescope/telescope.nvim" }, -- For nice UI integration
{ "nvim-tree/nvim-web-devicons" }, -- Icons for enhanced UI
}, },
-- Load after GitHub Copilot and when a file is opened build = "make tiktoken", -- Only on MacOS or Linux
event = { "VeryLazy" }, event = "VeryLazy",
config = function() config = function()
local chat = require("CopilotChat") local chat = require("CopilotChat")
local select = require("CopilotChat.select") local select = require("CopilotChat.select")
-- Configure the plugin with advanced settings -- Setup CopilotChat with comprehensive configuration
chat.setup({ 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 = { window = {
border = "rounded", -- Make the window look nice layout = 'vertical', -- 'vertical', 'horizontal', 'float', 'replace'
width = 80, -- Default width width = 0.5, -- fractional width of parent
height = 20, -- Default height height = 0.5, -- fractional height of parent
title = { -- Options for floating windows
name = "Copilot Chat", -- Custom title relative = 'editor', -- 'editor', 'win', 'cursor', 'mouse'
alignment = "center", -- Center the title border = 'rounded', -- 'none', 'single', 'double', 'rounded', 'solid', 'shadow'
}, title = 'Copilot Chat',
footer = nil,
zindex = 1,
}, },
-- File context features -- UI settings
context = { show_help = true, -- Shows help message as virtual lines when waiting for user input
-- Include 5 lines above and below the cursor for context highlight_selection = true, -- Highlight selection in source buffer
cursor_context = 5, 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
-- Include the entire selection when using visual mode -- Chat features
selection_context = true, chat_autocomplete = true, -- Enable chat autocompletion
-- Show context-aware commit history -- Default selection (uses visual selection or falls back to buffer)
git_context = true, selection = function(source)
}, return select.visual(source) or select.buffer(source)
end,
-- Enable debug (set to true only when troubleshooting) -- Custom prompts for various coding tasks
debug = false,
-- Enable syntax highlighting in response
syntax_highlighting = true,
-- Enable auto-sizing of response window
auto_size = true,
-- Define prompts that can be used in commands
prompts = { prompts = {
-- Default prompts -- Code explanation
Explain = { 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 = { 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 = { -- Documentation generation
prompt = "Generate comprehensive documentation for this code:\n```$filetype\n$selection\n```\nInclude descriptions of parameters, return values, exceptions, and provide usage examples.", Docs = {
}, prompt = 'Please add documentation comments to the selected code.',
BestPractices = {
prompt = "Review this code for best practices and suggest improvements:\n```$filetype\n$selection\n```",
}, },
-- Test generation
Tests = { 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 = { -- Commit message generation
prompt = "Implement the following functionality: $input\nMake it work with the following context:\n```$filetype\n$selection\n```", Commit = {
strategy = "quick_fix", -- Use the quick fix strategy for implementation 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 -- Global keymaps for CopilotChat
vim.api.nvim_create_autocmd("FileType", { -- Core commands
pattern = "copilot-chat", vim.keymap.set("n", "<leader>cc", function() chat.toggle() end, { desc = "Toggle Copilot Chat" })
callback = function() vim.keymap.set("n", "<leader>co", function() chat.open() end, { desc = "Open Copilot Chat" })
local buf = vim.api.nvim_get_current_buf() 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" })
-- Close window with 'q' -- Prompt-based commands - these work with current selection
vim.keymap.set("n", "q", function() vim.keymap.set({"n", "v"}, "<leader>cce", "<cmd>CopilotChatExplain<cr>", { desc = "Explain code" })
vim.cmd("close") vim.keymap.set({"n", "v"}, "<leader>ccr", "<cmd>CopilotChatReview<cr>", { desc = "Review code" })
end, { buffer = buf, silent = true }) 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" })
-- Reset chat with Ctrl+L -- Git integration
vim.keymap.set("n", "<C-l>", function() vim.keymap.set("n", "<leader>ccg", "<cmd>CopilotChatCommit<cr>", { desc = "Generate commit message" })
chat.reset()
end, { buffer = buf, silent = true })
-- -- Submit prompt with Enter in insert mode -- Advanced features
-- vim.keymap.set("i", "<CR>", function() vim.keymap.set("n", "<leader>ccm", "<cmd>CopilotChatModels<cr>", { desc = "Select model" })
-- -- require("CopilotChat").submit_prompt() vim.keymap.set("n", "<leader>cca", "<cmd>CopilotChatAgents<cr>", { desc = "Select agent" })
-- chat.submit_prompt() vim.keymap.set("n", "<leader>ccp", "<cmd>CopilotChatPrompts<cr>", { desc = "Select prompt" })
-- end, { buffer = buf, silent = true })
-- -- Submit prompt with Enter in normal mode -- Chat history
-- vim.keymap.set("n", "<CR>", function() vim.keymap.set("n", "<leader>ccl", function()
-- require("CopilotChat").submit_prompt() vim.ui.input({ prompt = "Load chat (name): " }, function(name)
-- end, { buffer = buf, silent = true }) if name then
chat.load(name)
-- 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
})
-- 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" })
-- 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" })
-- 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)
end end
end) end)
end, { desc = "Implement Functionality" }) end, { desc = "Load chat history" })
-- Add quick access to buffer context vim.keymap.set("n", "<leader>ccS", function()
vim.keymap.set("n", "<leader>cb", function() vim.ui.input({ prompt = "Save chat (name): " }, function(name)
chat.ask("What does this code do? Consider the full context of the file.", { if name then
selection = select.buffer, chat.save(name)
})
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)
end end
end) end)
end, { desc = "Refactor to Design Pattern" }) end, { desc = "Save chat history" })
-- Toggle inline chat for quick questions about the current line -- Custom prompts with input
vim.keymap.set("n", "<leader>cl", function() vim.keymap.set({"n", "v"}, "<leader>cci", 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()
vim.ui.input({ prompt = "Ask Copilot: " }, function(input) vim.ui.input({ prompt = "Ask Copilot: " }, function(input)
if input then if input then
chat.ask(input) chat.ask(input)
end end
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, end,
} }

View file

@ -16,4 +16,6 @@ return {
{ import = "custom.plugins.leetcode" }, { import = "custom.plugins.leetcode" },
-- { import = "custom.plugins.telescope_fix" }, -- { import = "custom.plugins.telescope_fix" },
{ import = "custom.plugins.catppuccin" }, { import = "custom.plugins.catppuccin" },
{ import = "custom.plugins.neorg" },
{ import = "custom.plugins.which_key_integration" }, -- Load which-key integration
} }

View 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,
},
},
}
}

View file

@ -3,79 +3,79 @@
-- https://github.com/kawre/leetcode.nvim -- https://github.com/kawre/leetcode.nvim
return { return {
"kawre/leetcode.nvim", 'kawre/leetcode.nvim',
dependencies = { dependencies = {
"nvim-telescope/telescope.nvim", 'nvim-telescope/telescope.nvim',
"nvim-lua/plenary.nvim", 'nvim-lua/plenary.nvim',
"MunifTanjim/nui.nvim", 'MunifTanjim/nui.nvim',
"nvim-tree/nvim-web-devicons", -- optional but recommended 'nvim-tree/nvim-web-devicons', -- optional but recommended
"nvim-treesitter/nvim-treesitter" -- make sure treesitter is a direct dependency 'nvim-treesitter/nvim-treesitter', -- make sure treesitter is a direct dependency
}, },
build = function() build = function()
-- Make sure the HTML parser is installed for treesitter -- Make sure the HTML parser is installed for treesitter
require("nvim-treesitter.install").ensure_installed("html") require('nvim-treesitter.install').ensure_installed 'html'
end, end,
config = function() config = function()
require("leetcode").setup({ require('leetcode').setup {
-- Default language for solving problems -- 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 directories
storage = { storage = {
home = vim.fn.stdpath("data") .. "/leetcode", home = vim.fn.stdpath 'data' .. '/leetcode',
cache = vim.fn.stdpath("cache") .. "/leetcode", cache = vim.fn.stdpath 'cache' .. '/leetcode',
}, },
-- Console settings -- Console settings
console = { console = {
open_on_runcode = true, 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 = { size = {
width = "90%", width = '90%',
height = "75%", height = '75%',
}, },
result = { result = {
size = "60%", size = '60%',
}, },
testcase = { testcase = {
virt_text = true, virt_text = true,
size = "40%", size = '40%',
}, },
}, },
-- Description panel settings -- Description panel settings
description = { description = {
position = "left", -- "left" or "right" position = 'left', -- "left" or "right"
width = "40%", width = '40%',
show_stats = true, -- show problem stats in description panel show_stats = true, -- show problem stats in description panel
}, },
-- You can choose either telescope or fzf-lua -- You can choose either telescope or fzf-lua
picker = { 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 -- Default keybindings - these won't conflict with your existing mappings
-- as they only activate within LeetCode buffers -- as they only activate within LeetCode buffers
keys = { keys = {
toggle = { "q" }, toggle = { 'q' },
confirm = { "<CR>" }, confirm = { '<CR>' },
reset_testcases = "r", reset_testcases = 'r',
use_testcase = "U", use_testcase = 'U',
focus_testcases = "H", focus_testcases = 'H',
focus_result = "L", focus_result = 'L',
}, },
-- Code injection settings - adds useful imports automatically -- Code injection settings - adds useful imports automatically
injector = { injector = {
["cpp"] = { ['cpp'] = {
before = { "#include <bits/stdc++.h>", "using namespace std;" }, before = { '#include <bits/stdc++.h>', 'using namespace std;' },
}, },
["java"] = { ['java'] = {
before = "import java.util.*;", before = 'import java.util.*;',
}, },
["python3"] = { ['python3'] = {
before = true, -- use default imports before = true, -- use default imports
}, },
}, },
@ -87,7 +87,7 @@ return {
plugins = { plugins = {
non_standalone = false, non_standalone = false,
}, },
}) }
end, end,
cmd = "Leet", -- lazy-load on command cmd = 'Leet', -- lazy-load on command
} }

View 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,
}

View 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.
```

View 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 |

View 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`

View file

@ -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,
-- }

View file

@ -77,17 +77,14 @@ return {
}, },
config = function(_, opts) config = function(_, opts)
require('trouble').setup(opts) require('trouble').setup(opts)
-- Add which-key group
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({ -- Add which-key group using the new v3 spec API
-- ["g"] = { name = "Goto" }, local ok, which_key = pcall(require, 'which-key')
-- }) if ok then
-- end which_key.add({
{ "<leader>x", group = "Trouble/Diagnostics" },
{ "g", group = "Goto" },
})
end
end, end,
} }

View 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,
}
}

View file

View file

@ -0,0 +1,152 @@
--[[
Which-key configuration
This file contains the configuration for which-key,
organizing keybindings into logical groups with descriptions.
]]
---@diagnostic disable-next-line: undefined-global
local vim = vim
local M = {}
function M.setup()
-- Check if which-key is available
local status_ok, wk = pcall(require, 'which-key')
if not status_ok then
return
end
-- Use the modern which-key v3 API with add()
-- Define common keybindings and groups
wk.add {
-- Most frequent operations
{ '<leader>w', '<cmd>w<CR>', desc = 'Save file' },
{ '<leader>q', '<cmd>q<CR>', desc = 'Quit' },
{ '<leader>Q', '<cmd>qa!<CR>', desc = 'Force quit all' },
{ '<leader>/', '<cmd>nohlsearch<CR>', desc = 'Clear highlights' },
{ '<leader>e', '<cmd>Explore<CR>', desc = 'Open file explorer' },
-- File operations (f)
{ '<leader>f', group = 'Find/Files' },
{ '<leader>ff', '<cmd>Telescope find_files<CR>', desc = 'Find files' },
{ '<leader>fg', '<cmd>Telescope live_grep<CR>', desc = 'Live grep' },
{ '<leader>fb', '<cmd>Telescope buffers<CR>', desc = 'Find buffers' },
{ '<leader>fr', '<cmd>Telescope oldfiles<CR>', desc = 'Recent files' },
-- Buffer operations (b)
{ '<leader>b', group = 'Buffers' },
{ '<leader>bb', '<cmd>Telescope buffers<CR>', desc = 'Browse buffers' },
{ '<leader>bd', '<cmd>bd<CR>', desc = 'Delete buffer' },
{ '<leader>bn', '<cmd>bn<CR>', desc = 'Next buffer' },
{ '<leader>bp', '<cmd>bp<CR>', desc = 'Previous buffer' },
-- Git operations (g)
{ '<leader>g', group = 'Git' },
{ '<leader>gs', '<cmd>Telescope git_status<CR>', desc = 'Git status' },
{ '<leader>gc', '<cmd>Telescope git_commits<CR>', desc = 'Git commits' },
{ '<leader>gb', '<cmd>Telescope git_branches<CR>', desc = 'Git branches' },
-- Code operations (c)
{ '<leader>c', group = 'Code/Copilot' },
{ '<leader>ca', '<cmd>lua vim.lsp.buf.code_action()<CR>', desc = 'Code actions' },
{ '<leader>cf', '<cmd>lua vim.lsp.buf.format()<CR>', desc = 'Format code' },
-- Harpoon (h)
{ '<leader>h', group = 'Harpoon' },
{ '<leader>ha', "<cmd>lua require('harpoon.mark').add_file()<CR>", desc = 'Add file' },
{ '<leader>hh', "<cmd>lua require('harpoon.ui').toggle_quick_menu()<CR>", desc = 'Toggle menu' },
{ '<leader>h1', "<cmd>lua require('harpoon.ui').nav_file(1)<CR>", desc = 'File 1' },
{ '<leader>h2', "<cmd>lua require('harpoon.ui').nav_file(2)<CR>", desc = 'File 2' },
{ '<leader>h3', "<cmd>lua require('harpoon.ui').nav_file(3)<CR>", desc = 'File 3' },
{ '<leader>h4', "<cmd>lua require('harpoon.ui').nav_file(4)<CR>", desc = 'File 4' },
-- LeetCode (l)
{ '<leader>l', group = 'LeetCode' },
{ '<leader>ll', '<cmd>Leet<CR>', desc = 'Open LeetCode' },
{ '<leader>ld', '<cmd>Leet daily<CR>', desc = 'Daily challenge' },
{ '<leader>lr', '<cmd>Leet random<CR>', desc = 'Random problem' },
{ '<leader>ls', '<cmd>Leet submit<CR>', desc = 'Submit solution' },
{ '<leader>lt', '<cmd>Leet test<CR>', desc = 'Test solution' },
-- Tab operations (t)
{ '<leader>t', group = 'Tabs' },
{ '<leader>tn', '<cmd>tabnew<CR>', desc = 'New tab' },
{ '<leader>tc', '<cmd>tabclose<CR>', desc = 'Close tab' },
{ '<leader>to', '<cmd>tabnew<CR><cmd>Telescope find_files<CR>', desc = 'New tab with file' },
{ '<leader>t1', '1gt', desc = 'Tab 1' },
{ '<leader>t2', '2gt', desc = 'Tab 2' },
{ '<leader>t3', '3gt', desc = 'Tab 3' },
{ '<leader>t4', '4gt', desc = 'Tab 4' },
-- Window operations (w)
{ '<leader>w', group = 'Windows' },
{ '<leader>wv', '<cmd>vsplit<CR>', desc = 'Split vertically' },
{ '<leader>ws', '<cmd>split<CR>', desc = 'Split horizontally' },
{ '<leader>wq', '<C-w>q', desc = 'Close window' },
{ '<leader>wo', '<C-w>o', desc = 'Close other windows' },
{ '<leader>wh', '<C-w>h', desc = 'Go to left window' },
{ '<leader>wj', '<C-w>j', desc = 'Go to lower window' },
{ '<leader>wk', '<C-w>k', desc = 'Go to upper window' },
{ '<leader>wl', '<C-w>l', desc = 'Go to right window' },
-- Terminal operations (tt)
{ '<leader>tt', group = 'Terminal' },
{ '<leader>ttt', '<cmd>ToggleTerm<CR>', desc = 'Toggle terminal' },
{ '<leader>ttf', '<cmd>ToggleTerm direction=float<CR>', desc = 'Floating terminal' },
{ '<leader>tth', '<cmd>ToggleTerm size=10 direction=horizontal<CR>', desc = 'Horizontal terminal' },
{ '<leader>ttv', '<cmd>ToggleTerm size=80 direction=vertical<CR>', desc = 'Vertical terminal' },
-- Trouble/Diagnostics (x)
{ '<leader>x', group = 'Diagnostics/Trouble' },
{ '<leader>xx', '<cmd>TroubleToggle<CR>', desc = 'Toggle Trouble' },
{ '<leader>xw', '<cmd>TroubleToggle workspace_diagnostics<CR>', desc = 'Workspace diagnostics' },
{ '<leader>xd', '<cmd>TroubleToggle document_diagnostics<CR>', desc = 'Document diagnostics' },
{ '<leader>xq', '<cmd>TroubleToggle quickfix<CR>', desc = 'Quickfix list' },
{ '<leader>xl', '<cmd>TroubleToggle loclist<CR>', desc = 'Location list' },
-- Neorg (n)
{ '<leader>n', group = 'Neorg' },
{ '<leader>ni', '<cmd>Neorg index<CR>', desc = 'Index' },
{ '<leader>nr', '<cmd>Neorg return<CR>', desc = 'Return' },
{ '<leader>nt', '<cmd>Neorg toggle-concealer<CR>', desc = 'Toggle concealer' },
{ '<leader>nm', '<cmd>Neorg inject-metadata<CR>', desc = 'Inject metadata' },
-- Neorg Journal (nj)
{ '<leader>nj', group = 'Journal' },
{ '<leader>njj', '<cmd>Neorg journal today<CR>', desc = 'Today' },
{ '<leader>njt', '<cmd>Neorg journal tomorrow<CR>', desc = 'Tomorrow' },
{ '<leader>njy', '<cmd>Neorg journal yesterday<CR>', desc = 'Yesterday' },
-- Neorg Workspace (nw)
{ '<leader>nw', group = 'Workspace' },
{ '<leader>nwn', '<cmd>Neorg workspace notes<CR>', desc = 'Notes' },
{ '<leader>nww', '<cmd>Neorg workspace work<CR>', desc = 'Work' },
{ '<leader>nwp', '<cmd>Neorg workspace personal<CR>', desc = 'Personal' },
-- Neorg Export (ne)
{ '<leader>ne', group = 'Export' },
{ '<leader>neh', '<cmd>Neorg export to-html<CR>', desc = 'To HTML' },
{ '<leader>nem', '<cmd>Neorg export to-markdown<CR>', desc = 'To Markdown' },
{ '<leader>nep', '<cmd>Neorg export to-pdf<CR>', desc = 'To PDF' },
-- Diagnostics navigation
{ '[d', '<cmd>lua vim.diagnostic.goto_prev()<CR>', desc = 'Previous diagnostic' },
{ ']d', '<cmd>lua vim.diagnostic.goto_next()<CR>', desc = 'Next diagnostic' },
}
-- Visual mode mappings
wk.add {
{ '<leader>c', group = 'Code', mode = 'v' },
{ '<leader>cc', "<cmd>'<,'>CommentToggle<CR>", desc = 'Comment selection', mode = 'v' },
{ '<leader>y', '"+y', desc = 'Yank to system clipboard', mode = 'v' },
{ '<leader>p', '"+p', desc = 'Paste from system clipboard', mode = 'v' },
}
-- Buffer navigation shortcuts
wk.add {
{ '<Tab>', '<cmd>bnext<CR>', desc = 'Next buffer' },
{ '<S-Tab>', '<cmd>bprevious<CR>', desc = 'Previous buffer' },
}
end
return M