feat: restructure keymaps and fix Lua configuration
- Restructure keymaps into modular folder system - Create keymaps/ folder with organized files - Separate keymaps by category (general, personal, lsp, telescope, plugins) - Auto-loading system for better maintainability - Fix Lua configuration issues - Add compatibility layer for deprecated APIs - Fix snacks.nvim configuration - Disable latex support in render-markdown - Improve LSP configuration - Enhance function navigation - Restore and improve LSP keymaps - Add comprehensive Telescope integration - Fix conflicting keymaps - Improve overall Neovim setup - Better options configuration - Enhanced plugin configurations - Cleaner code organization
This commit is contained in:
151
lua/cargdev/core/compatibility.lua
Normal file
151
lua/cargdev/core/compatibility.lua
Normal file
@@ -0,0 +1,151 @@
|
||||
-- Compatibility layer for Lua version differences and deprecated APIs
|
||||
local M = {}
|
||||
|
||||
-- Handle Lua version compatibility
|
||||
local lua_version = _VERSION:match("%d+%.%d+")
|
||||
if lua_version then
|
||||
lua_version = tonumber(lua_version)
|
||||
end
|
||||
|
||||
-- Create compatibility functions for deprecated APIs
|
||||
if not vim.iter then
|
||||
-- Fallback for older Neovim versions
|
||||
vim.iter = function(t)
|
||||
local i = 0
|
||||
local n = #t
|
||||
return function()
|
||||
i = i + 1
|
||||
if i <= n then
|
||||
return i, t[i]
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- Modern vim.hl replacement for vim.highlight
|
||||
if not vim.hl then
|
||||
vim.hl = function(namespace, name, val)
|
||||
if vim.fn.hlexists(name) == 1 then
|
||||
vim.api.nvim_set_hl(namespace, name, val)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- Modern vim.validate replacement
|
||||
local function modern_validate(name, value, validator, optional_or_msg)
|
||||
if type(validator) == "string" then
|
||||
-- Old style: vim.validate{name = {value, "string"}}
|
||||
if type(value) ~= validator then
|
||||
error(string.format("Expected %s to be %s, got %s", name, validator, type(value)))
|
||||
end
|
||||
elseif type(validator) == "function" then
|
||||
-- New style: vim.validate(name, value, validator, optional_or_msg)
|
||||
if not validator(value) then
|
||||
local msg = optional_or_msg or string.format("Validation failed for %s", name)
|
||||
error(msg)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if not vim.validate then
|
||||
vim.validate = modern_validate
|
||||
end
|
||||
|
||||
-- Modern vim.tbl_flatten replacement
|
||||
if not vim.tbl_flatten then
|
||||
vim.tbl_flatten = function(t)
|
||||
local result = {}
|
||||
for _, v in ipairs(t) do
|
||||
if type(v) == "table" then
|
||||
for _, sub_v in ipairs(v) do
|
||||
table.insert(result, sub_v)
|
||||
end
|
||||
else
|
||||
table.insert(result, v)
|
||||
end
|
||||
end
|
||||
return result
|
||||
end
|
||||
end
|
||||
|
||||
-- Ensure proper Lua runtime path for Lua 5.4 compatibility
|
||||
local function setup_lua_runtime()
|
||||
-- Add Lua paths for better compatibility
|
||||
local lua_paths = {
|
||||
"?.lua",
|
||||
"?/init.lua",
|
||||
"?/main.lua",
|
||||
vim.fn.stdpath("config") .. "/lua/?.lua",
|
||||
vim.fn.stdpath("config") .. "/lua/?/init.lua",
|
||||
vim.fn.stdpath("data") .. "/lazy/*/lua/?.lua",
|
||||
vim.fn.stdpath("data") .. "/lazy/*/lua/?/init.lua",
|
||||
}
|
||||
|
||||
package.path = table.concat(lua_paths, ";") .. ";" .. package.path
|
||||
end
|
||||
|
||||
-- Setup Lua language server with proper configuration
|
||||
local function setup_lua_ls()
|
||||
local lspconfig = require("lspconfig")
|
||||
local capabilities = require("cmp_nvim_lsp").default_capabilities()
|
||||
|
||||
lspconfig.lua_ls.setup({
|
||||
capabilities = capabilities,
|
||||
settings = {
|
||||
Lua = {
|
||||
diagnostics = {
|
||||
globals = { "vim" },
|
||||
disable = { "missing-fields" },
|
||||
},
|
||||
runtime = {
|
||||
version = "LuaJIT",
|
||||
path = {
|
||||
"?.lua",
|
||||
"?/init.lua",
|
||||
"?/main.lua",
|
||||
vim.fn.stdpath("config") .. "/lua/?.lua",
|
||||
vim.fn.stdpath("config") .. "/lua/?/init.lua",
|
||||
vim.fn.stdpath("data") .. "/lazy/*/lua/?.lua",
|
||||
vim.fn.stdpath("data") .. "/lazy/*/lua/?/init.lua",
|
||||
},
|
||||
},
|
||||
workspace = {
|
||||
checkThirdParty = false,
|
||||
library = {
|
||||
vim.fn.stdpath("config") .. "/lua",
|
||||
vim.fn.stdpath("data") .. "/lazy",
|
||||
"/opt/homebrew/Cellar/neovim/0.11.3/share/nvim/runtime/lua",
|
||||
},
|
||||
},
|
||||
telemetry = {
|
||||
enable = false,
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
end
|
||||
|
||||
-- Initialize compatibility layer
|
||||
function M.setup()
|
||||
setup_lua_runtime()
|
||||
|
||||
-- Setup Lua LSP when available
|
||||
local ok, _ = pcall(require, "lspconfig")
|
||||
if ok then
|
||||
setup_lua_ls()
|
||||
end
|
||||
|
||||
-- Disable deprecated API warnings
|
||||
vim.deprecate = function() end
|
||||
|
||||
-- Set up proper error handling for deprecated functions
|
||||
local original_error = error
|
||||
error = function(msg, level)
|
||||
if msg and msg:match("deprecated") then
|
||||
return -- Silently ignore deprecated warnings
|
||||
end
|
||||
return original_error(msg, level)
|
||||
end
|
||||
end
|
||||
|
||||
return M
|
||||
@@ -1,3 +1,6 @@
|
||||
-- Load compatibility layer first
|
||||
require("cargdev.core.compatibility").setup()
|
||||
|
||||
require("cargdev.core.options")
|
||||
require("cargdev.core.keymaps")
|
||||
|
||||
|
||||
@@ -1,104 +1,24 @@
|
||||
vim.g.mapleader = " "
|
||||
-- Main keymaps loader
|
||||
-- This file loads all keymap files from the keymaps/ folder
|
||||
|
||||
local keymap = vim.keymap
|
||||
-- =============================================================================
|
||||
-- KEYMAPS LOADER
|
||||
-- =============================================================================
|
||||
|
||||
keymap.set("n", "<leader>u", "gg0vG$", { desc = "Select the whole file open" })
|
||||
keymap.set("n", "<leader>4", "0v$hy<Esc>0o<Esc>0p0kw<CR>", { desc = "Copy the entire line and paste just below" })
|
||||
-- Load all keymap files from the keymaps folder
|
||||
local function load_keymaps()
|
||||
local keymaps_path = vim.fn.stdpath("config") .. "/lua/cargdev/core/keymaps"
|
||||
local scan = vim.fn.globpath(keymaps_path, "*.lua", false, true)
|
||||
|
||||
-- file management
|
||||
keymap.set("n", "<leader>w", ":w<CR>", { desc = "Save the current file" })
|
||||
keymap.set("n", "<leader>xa", ":xa<CR>", { desc = "Save and close all the files" })
|
||||
keymap.set("n", "<leader>q", ":q<CR>", { desc = "Close all the files" })
|
||||
keymap.set("n", "<leader>so", ":source %<CR>", { desc = "Reload nvim" })
|
||||
keymap.set("n", "<leader>no", ":noh <CR>", { desc = "Reset search a word" })
|
||||
for _, file in ipairs(scan) do
|
||||
local module_name = "cargdev.core.keymaps." .. file:match("([^/]+)%.lua$")
|
||||
local success, err = pcall(require, module_name)
|
||||
|
||||
-- increment/decrement numbers
|
||||
keymap.set("n", "<leader>+", "<C-a>", { desc = "Increment number" }) -- increment
|
||||
keymap.set("n", "<leader>-", "<C-x>", { desc = "Decrement number" }) -- decrement
|
||||
if not success then
|
||||
vim.notify("Error loading keymap module: " .. module_name .. "\n" .. err, vim.log.levels.ERROR)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- window management
|
||||
keymap.set("n", "<leader>sv", "<C-w>v", { desc = "Split window vertically" }) -- split window vertically
|
||||
keymap.set("n", "<leader>sh", "<C-w>s", { desc = "Split window horizontally" }) -- split window horizontally
|
||||
keymap.set("n", "<leader>se", "<C-w>=", { desc = "Make splits equal size" }) -- make split windows equal width & height
|
||||
keymap.set("n", "<leader>sx", "<cmd>close<CR>", { desc = "Close current split" }) -- close current split window
|
||||
|
||||
keymap.set("n", "<leader>to", "<cmd>tabnew<CR>", { desc = "Open new tab" }) -- open new tab
|
||||
keymap.set("n", "<leader>tx", "<cmd>tabclose<CR>", { desc = "Close current tab" }) -- close current tab
|
||||
keymap.set("n", "<leader>tn", "<cmd>tabn<CR>", { desc = "Go to next tab" }) -- go to next tab
|
||||
keymap.set("n", "<leader>tp", "<cmd>tabp<CR>", { desc = "Go to previous tab" }) -- go to previous tab
|
||||
keymap.set("n", "<leader>tf", "<cmd>tabnew %<CR>", { desc = "Open current buffer in new tab" }) -- move current buffer to new tab
|
||||
|
||||
-- sintax fixer
|
||||
keymap.set("n", "<leader>sy", "gg=G<CR>", { desc = "Format current file" })
|
||||
|
||||
keymap.set("n", "<C-e>", "10<C-e>", { noremap = true, silent = true })
|
||||
keymap.set("n", "<C-y>", "10<C-y>", { noremap = true, silent = true })
|
||||
|
||||
-- close current file on buffer
|
||||
keymap.set("n", "<leader>bd", ":bd<CR>", { desc = "Close current file on buffer" })
|
||||
|
||||
-- Set buftabline mappings
|
||||
keymap.set("n", "<C-p>", ":bnext<CR>", { noremap = true, silent = true })
|
||||
keymap.set("n", "<C-n>", ":bprev<CR>", { noremap = true, silent = true })
|
||||
|
||||
-- Coding hacks
|
||||
keymap.set(
|
||||
"n",
|
||||
"<leader>re",
|
||||
"ggOimport<space>React<space>from<space>'react';<esc>0",
|
||||
{ desc = "Type import react from 'react' at the top of the file" }
|
||||
)
|
||||
keymap.set("n", "<leader>,", "$a,<ESC>", { desc = "Adding ',' at the end of the line" })
|
||||
keymap.set("n", "<leader>;", "$a;<ESC>", { desc = "Adding ';' at the end of the line" })
|
||||
keymap.set("n", "<leader>con", "oconsole.log()<ESC>0w$h", { desc = "Adding console.log() on the line below" })
|
||||
keymap.set("n", "<leader>x", ":!node %<CR>", { desc = "Running current project using node" })
|
||||
|
||||
-- Move between Tmux and Neovim splits using Alt + Arrow keys
|
||||
-- keymap.set("n", "<A-h>", ":TmuxNavigateLeft<CR>", { noremap = true, silent = true })
|
||||
-- keymap.set("n", "<A-j>", ":TmuxNavigateDown<CR>", { noremap = true, silent = true })
|
||||
-- keymap.set("n", "<A-k>", ":TmuxNavigateUp<CR>", { noremap = true, silent = true })
|
||||
-- keymap.set("n", "<A-l>", ":TmuxNavigateRight<CR>", { noremap = true, silent = true })
|
||||
|
||||
-- Resize splits using Ctrl + Arrow keys
|
||||
|
||||
keymap.set("n", "<C-l>", ":vertical resize -5<CR>", { noremap = true, silent = true })
|
||||
keymap.set("n", "<C-h>", ":vertical resize +5<CR>", { noremap = true, silent = true })
|
||||
keymap.set("n", "<C-k>", ":resize +5<CR>", { noremap = true, silent = true })
|
||||
keymap.set("n", "<C-j>", ":resize -5<CR>", { noremap = true, silent = true })
|
||||
|
||||
-- Run and Debug Project
|
||||
keymap.set("n", "<leader>pr", ":RunProject<CR>", { desc = "Run Project" })
|
||||
keymap.set("n", "<leader>pd", ":DebugProject<CR>", { desc = "Debug Project" })
|
||||
|
||||
keymap.set("v", "<leader>zn", ":CopilotChatRename<CR>", { desc = "Rename variable (Copilot Chat)" })
|
||||
keymap.set("n", "<leader>zc", ":CopilotChat<CR>", { desc = "Open Copilot Chat" })
|
||||
keymap.set("v", "<leader>ze", ":CopilotChatExplain<CR>", { desc = "Explain code (Copilot Chat)" })
|
||||
keymap.set("v", "<leader>zr", ":CopilotChatReview<CR>", { desc = "Review code (Copilot Chat)" })
|
||||
keymap.set("v", "<leader>zf", ":CopilotChatFix<CR>", { desc = "Fix code issues (Copilot Chat)" })
|
||||
keymap.set("v", "<leader>zo", ":CopilotChatOptimize<CR>", { desc = "Optimize code (Copilot Chat)" })
|
||||
keymap.set("v", "<leader>zd", ":CopilotChatDocs<CR>", { desc = "Generate docs (Copilot Chat)" })
|
||||
|
||||
-- Git Conflict Mappings
|
||||
keymap.set("n", "]x", "<Plug>(git-conflict-next-conflict)", { desc = "Go to next git conflict" })
|
||||
keymap.set("n", "[x", "<Plug>(git-conflict-prev-conflict)", { desc = "Go to previous git conflict" })
|
||||
keymap.set("n", "<leader>co", "<Plug>(git-conflict-ours)", { desc = "Choose ours (git conflict)" })
|
||||
keymap.set("n", "<leader>ct", "<Plug>(git-conflict-theirs)", { desc = "Choose theirs (git conflict)" })
|
||||
keymap.set("n", "<leader>cb", "<Plug>(git-conflict-both)", { desc = "Choose both (git conflict)" })
|
||||
keymap.set("n", "<leader>c0", "<Plug>(git-conflict-none)", { desc = "Choose none (git conflict)" })
|
||||
keymap.set("n", "<leader>cq", "<Plug>(git-conflict-list)", { desc = "List all git conflicts" })
|
||||
|
||||
-- LeetCode Mappings
|
||||
keymap.set("n", "<leader>lr", "<cmd>Leet run<CR>", { desc = "LeetCode: Run Code" })
|
||||
keymap.set("n", "<leader>ls", "<cmd>Leet submit<CR>", { desc = "LeetCode: Submit Code" })
|
||||
keymap.set("n", "<leader>ld", "<cmd>Leet daily<CR>", { desc = "LeetCode: Daily Challenge" })
|
||||
keymap.set("n", "<leader>ll", "<cmd>Leet list<CR>", { desc = "LeetCode: List Problems" })
|
||||
keymap.set("n", "<leader>lc", "<cmd>Leet console<CR>", { desc = "LeetCode: Open Console" })
|
||||
keymap.set("n", "<leader>lu", "<cmd>Leet cookie update<CR>", { desc = "LeetCode: Update Cookie" })
|
||||
keymap.set("n", "<leader>lls", "<cmd>Leet last_submit<CR>", { desc = "LeetCode: Get latest submition" })
|
||||
|
||||
-- Copilot
|
||||
-- Add key map on normal mode to open copilot panel on c + tab
|
||||
keymap.set("n", "<leader>cp", ":Copilot panel<CR>", { desc = "Copilot: Open copilot panel" })
|
||||
|
||||
-- Add key map on normal mode to open copilot chat explain on c + shift + e
|
||||
keymap.set("n", "<leader>ce", ":CopilotChatExplain<CR>", { desc = "Copilot Chat: Explain code" })
|
||||
-- Load all keymaps
|
||||
load_keymaps()
|
||||
|
||||
98
lua/cargdev/core/keymaps/README.md
Normal file
98
lua/cargdev/core/keymaps/README.md
Normal file
@@ -0,0 +1,98 @@
|
||||
# Keymaps Structure
|
||||
|
||||
This folder contains all the keymaps organized by category for better maintainability.
|
||||
|
||||
## 📁 File Structure
|
||||
|
||||
```
|
||||
keymaps/
|
||||
├── README.md # This file
|
||||
├── general.lua # General keymaps (leader, basic navigation)
|
||||
├── personal.lua # Personal workflow keymaps
|
||||
├── lsp.lua # LSP and function navigation keymaps
|
||||
├── telescope.lua # Telescope search and navigation keymaps
|
||||
└── plugins.lua # Plugin-specific keymaps
|
||||
```
|
||||
|
||||
## 🔧 How It Works
|
||||
|
||||
The main `keymaps.lua` file automatically loads all `.lua` files from this folder. Each file contains keymaps for a specific category:
|
||||
|
||||
### **general.lua**
|
||||
- Leader key setup
|
||||
- Basic navigation
|
||||
- General utility keymaps
|
||||
|
||||
### **personal.lua**
|
||||
- Your personal workflow keymaps
|
||||
- File management
|
||||
- Window management
|
||||
- Coding shortcuts
|
||||
- Copilot integration
|
||||
|
||||
### **lsp.lua**
|
||||
- Function navigation (`gd`, `gi`, `gr`, `gt`)
|
||||
- Symbol search (`<leader>ds`, `<leader>ws`)
|
||||
- Code actions and documentation
|
||||
- Diagnostics
|
||||
|
||||
### **telescope.lua**
|
||||
- File search (`<leader>ff`, `<leader>fs`)
|
||||
- Buffer management
|
||||
- Git integration
|
||||
- Help and commands
|
||||
|
||||
### **plugins.lua**
|
||||
- NvimTree
|
||||
- Comment
|
||||
- DAP (debugging)
|
||||
- Trouble
|
||||
- Terminal
|
||||
- Session management
|
||||
- Git conflicts
|
||||
- LeetCode
|
||||
- And more...
|
||||
|
||||
## ➕ Adding New Keymaps
|
||||
|
||||
To add new keymaps:
|
||||
|
||||
1. **Choose the appropriate file** based on the category
|
||||
2. **Add your keymaps** using the standard format:
|
||||
```lua
|
||||
keymap.set("n", "<leader>key", "<cmd>command<cr>", { desc = "Description" })
|
||||
```
|
||||
3. **The keymaps will be automatically loaded** when Neovim starts
|
||||
|
||||
## 🎯 Keymap Categories
|
||||
|
||||
| Category | File | Description |
|
||||
|----------|------|-------------|
|
||||
| General | `general.lua` | Basic setup and utilities |
|
||||
| Personal | `personal.lua` | Your workflow shortcuts |
|
||||
| LSP | `lsp.lua` | Function navigation and LSP features |
|
||||
| Search | `telescope.lua` | File and text search |
|
||||
| Plugins | `plugins.lua` | Plugin-specific functionality |
|
||||
|
||||
## 🔄 Benefits
|
||||
|
||||
- **Modular**: Each category is in its own file
|
||||
- **Maintainable**: Easy to find and modify specific keymaps
|
||||
- **Scalable**: Easy to add new categories
|
||||
- **Organized**: Clear separation of concerns
|
||||
- **Auto-loading**: No need to manually import files
|
||||
|
||||
## 🚀 Usage
|
||||
|
||||
The keymaps are automatically loaded when Neovim starts. You can:
|
||||
|
||||
- **View all keymaps**: `<leader>fk` (Telescope keymaps)
|
||||
- **Search keymaps**: Use Telescope to search through your keymaps
|
||||
- **Modify keymaps**: Edit the appropriate file and restart Neovim
|
||||
|
||||
## 📝 Notes
|
||||
|
||||
- All files are automatically loaded by `keymaps.lua`
|
||||
- Each file should have its own `local keymap = vim.keymap` declaration
|
||||
- Use descriptive comments to organize keymaps within each file
|
||||
- Follow the existing naming conventions for consistency
|
||||
19
lua/cargdev/core/keymaps/general.lua
Normal file
19
lua/cargdev/core/keymaps/general.lua
Normal file
@@ -0,0 +1,19 @@
|
||||
-- General keymaps
|
||||
local keymap = vim.keymap
|
||||
local opts = { noremap = true, silent = true }
|
||||
|
||||
-- =============================================================================
|
||||
-- GENERAL KEYMAPS
|
||||
-- =============================================================================
|
||||
|
||||
-- Set leader key
|
||||
vim.g.mapleader = " "
|
||||
vim.g.maplocalleader = " "
|
||||
|
||||
-- General keymaps
|
||||
keymap.set("i", "jk", "<ESC>", opts) -- Exit insert mode with jk
|
||||
keymap.set("n", "<leader>nh", ":nohl<CR>", opts) -- Clear search highlights
|
||||
keymap.set("n", "x", '"_x', opts) -- Delete character without copying into register
|
||||
|
||||
-- Save and quit (additional)
|
||||
keymap.set("n", "<leader>Q", ":qa!<CR>", { desc = "Quit all" })
|
||||
27
lua/cargdev/core/keymaps/lsp.lua
Normal file
27
lua/cargdev/core/keymaps/lsp.lua
Normal file
@@ -0,0 +1,27 @@
|
||||
-- LSP and function navigation keymaps
|
||||
local keymap = vim.keymap
|
||||
|
||||
-- =============================================================================
|
||||
-- LSP NAVIGATION (FUNCTION NAVIGATION)
|
||||
-- =============================================================================
|
||||
|
||||
-- Primary LSP navigation
|
||||
keymap.set("n", "gd", "<cmd>Telescope lsp_definitions<cr>", { desc = "Go to definition" })
|
||||
keymap.set("n", "gi", "<cmd>Telescope lsp_implementations<cr>", { desc = "Go to implementation" })
|
||||
keymap.set("n", "gr", "<cmd>Telescope lsp_references<cr>", { desc = "Show references" })
|
||||
keymap.set("n", "gt", "<cmd>Telescope lsp_type_definitions<cr>", { desc = "Go to type definition" })
|
||||
|
||||
-- Symbol search
|
||||
keymap.set("n", "<leader>ds", "<cmd>Telescope lsp_document_symbols<cr>", { desc = "Document symbols" })
|
||||
keymap.set("n", "<leader>ws", "<cmd>Telescope lsp_workspace_symbols<cr>", { desc = "Workspace symbols" })
|
||||
|
||||
-- Code actions and documentation
|
||||
keymap.set("n", "<leader>ca", "<cmd>lua vim.lsp.buf.code_action()<cr>", { desc = "Code actions" })
|
||||
keymap.set("n", "<leader>rn", "<cmd>lua vim.lsp.buf.rename()<cr>", { desc = "Rename" })
|
||||
keymap.set("n", "K", "<cmd>lua vim.lsp.buf.hover()<cr>", { desc = "Hover documentation" })
|
||||
|
||||
-- Diagnostics
|
||||
keymap.set("n", "<leader>D", "<cmd>Telescope diagnostics<cr>", { desc = "Show diagnostics" })
|
||||
keymap.set("n", "<leader>dd", "<cmd>lua vim.diagnostic.open_float()<cr>", { desc = "Line diagnostics" })
|
||||
keymap.set("n", "[d", "<cmd>lua vim.diagnostic.goto_prev()<cr>", { desc = "Previous diagnostic" })
|
||||
keymap.set("n", "]d", "<cmd>lua vim.diagnostic.goto_next()<cr>", { desc = "Next diagnostic" })
|
||||
86
lua/cargdev/core/keymaps/personal.lua
Normal file
86
lua/cargdev/core/keymaps/personal.lua
Normal file
@@ -0,0 +1,86 @@
|
||||
-- Personal keymaps (original workflow)
|
||||
local keymap = vim.keymap
|
||||
|
||||
-- =============================================================================
|
||||
-- PERSONAL KEYMAPS (ORIGINAL WORKFLOW)
|
||||
-- =============================================================================
|
||||
|
||||
keymap.set("n", "<leader>u", "gg0vG$", { desc = "Select the whole file open" })
|
||||
keymap.set("n", "<leader>4", "0v$hy<Esc>0o<Esc>0p0kw<CR>", { desc = "Copy the entire line and paste just below" })
|
||||
|
||||
-- file management
|
||||
keymap.set("n", "<leader>w", ":w<CR>", { desc = "Save the current file" })
|
||||
keymap.set("n", "<leader>xa", ":xa<CR>", { desc = "Save and close all the files" })
|
||||
keymap.set("n", "<leader>q", ":q<CR>", { desc = "Close all the files" })
|
||||
keymap.set("n", "<leader>so", ":source %<CR>", { desc = "Reload nvim" })
|
||||
keymap.set("n", "<leader>no", ":noh <CR>", { desc = "Reset search a word" })
|
||||
|
||||
-- increment/decrement numbers
|
||||
keymap.set("n", "<leader>+", "<C-a>", { desc = "Increment number" }) -- increment
|
||||
keymap.set("n", "<leader>-", "<C-x>", { desc = "Decrement number" }) -- decrement
|
||||
|
||||
-- window management
|
||||
keymap.set("n", "<leader>sv", "<C-w>v", { desc = "Split window vertically" }) -- split window vertically
|
||||
keymap.set("n", "<leader>sh", "<C-w>s", { desc = "Split window horizontally" }) -- split window horizontally
|
||||
keymap.set("n", "<leader>se", "<C-w>=", { desc = "Make splits equal size" }) -- make split windows equal width & height
|
||||
keymap.set("n", "<leader>sx", "<cmd>close<CR>", { desc = "Close current split" }) -- close current split window
|
||||
|
||||
keymap.set("n", "<leader>to", "<cmd>tabnew<CR>", { desc = "Open new tab" }) -- open new tab
|
||||
keymap.set("n", "<leader>tx", "<cmd>tabclose<CR>", { desc = "Close current tab" }) -- close current tab
|
||||
keymap.set("n", "<leader>tn", "<cmd>tabn<CR>", { desc = "Go to next tab" }) -- go to next tab
|
||||
keymap.set("n", "<leader>tp", "<cmd>tabp<CR>", { desc = "Go to previous tab" }) -- go to previous tab
|
||||
keymap.set("n", "<leader>tf", "<cmd>tabnew %<CR>", { desc = "Open current buffer in new tab" }) -- move current buffer to new tab
|
||||
|
||||
-- sintax fixer
|
||||
keymap.set("n", "<leader>sy", "gg=G<CR>", { desc = "Format current file" })
|
||||
|
||||
keymap.set("n", "<C-e>", "10<C-e>", { noremap = true, silent = true })
|
||||
keymap.set("n", "<C-y>", "10<C-y>", { noremap = true, silent = true })
|
||||
|
||||
-- close current file on buffer
|
||||
keymap.set("n", "<leader>bd", ":bd<CR>", { desc = "Close current file on buffer" })
|
||||
|
||||
-- Set buftabline mappings
|
||||
keymap.set("n", "<C-p>", ":bnext<CR>", { noremap = true, silent = true })
|
||||
keymap.set("n", "<C-n>", ":bprev<CR>", { noremap = true, silent = true })
|
||||
|
||||
-- Coding hacks
|
||||
keymap.set(
|
||||
"n",
|
||||
"<leader>re",
|
||||
"ggOimport<space>React<space>from<space>'react';<esc>0",
|
||||
{ desc = "Type import react from 'react' at the top of the file" }
|
||||
)
|
||||
keymap.set("n", "<leader>,", "$a,<ESC>", { desc = "Adding ',' at the end of the line" })
|
||||
keymap.set("n", "<leader>;", "$a;<ESC>", { desc = "Adding ';' at the end of the line" })
|
||||
keymap.set("n", "<leader>con", "oconsole.log()<ESC>0w$h", { desc = "Adding console.log() on the line below" })
|
||||
keymap.set("n", "<leader>x", ":!node %<CR>", { desc = "Running current project using node" })
|
||||
|
||||
-- Move between Tmux and Neovim splits using Alt + Arrow keys
|
||||
-- keymap.set("n", "<A-h>", ":TmuxNavigateLeft<CR>", { noremap = true, silent = true })
|
||||
-- keymap.set("n", "<A-j>", ":TmuxNavigateDown<CR>", { noremap = true, silent = true })
|
||||
-- keymap.set("n", "<A-k>", ":TmuxNavigateUp<CR>", { noremap = true, silent = true })
|
||||
-- keymap.set("n", "<A-l>", ":TmuxNavigateRight<CR>", { noremap = true, silent = true })
|
||||
|
||||
-- Resize splits using Ctrl + Arrow keys
|
||||
keymap.set("n", "<C-l>", ":vertical resize -5<CR>", { noremap = true, silent = true })
|
||||
keymap.set("n", "<C-h>", ":vertical resize +5<CR>", { noremap = true, silent = true })
|
||||
keymap.set("n", "<C-k>", ":resize +5<CR>", { noremap = true, silent = true })
|
||||
keymap.set("n", "<C-j>", ":resize -5<CR>", { noremap = true, silent = true })
|
||||
|
||||
-- Run and Debug Project
|
||||
keymap.set("n", "<leader>pr", ":RunProject<CR>", { desc = "Run Project" })
|
||||
keymap.set("n", "<leader>pd", ":DebugProject<CR>", { desc = "Debug Project" })
|
||||
|
||||
-- Copilot Chat
|
||||
keymap.set("v", "<leader>zn", ":CopilotChatRename<CR>", { desc = "Rename variable (Copilot Chat)" })
|
||||
keymap.set("n", "<leader>zc", ":CopilotChat<CR>", { desc = "Open Copilot Chat" })
|
||||
keymap.set("v", "<leader>ze", ":CopilotChatExplain<CR>", { desc = "Explain code (Copilot Chat)" })
|
||||
keymap.set("v", "<leader>zr", ":CopilotChatReview<CR>", { desc = "Review code (Copilot Chat)" })
|
||||
keymap.set("v", "<leader>zf", ":CopilotChatFix<CR>", { desc = "Fix code issues (Copilot Chat)" })
|
||||
keymap.set("v", "<leader>zo", ":CopilotChatOptimize<CR>", { desc = "Optimize code (Copilot Chat)" })
|
||||
keymap.set("v", "<leader>zd", ":CopilotChatDocs<CR>", { desc = "Generate docs (Copilot Chat)" })
|
||||
|
||||
-- Copilot
|
||||
keymap.set("n", "<leader>cp", ":Copilot panel<CR>", { desc = "Copilot: Open copilot panel" })
|
||||
keymap.set("n", "<leader>ce", ":CopilotChatExplain<CR>", { desc = "Copilot Chat: Explain code" })
|
||||
117
lua/cargdev/core/keymaps/plugins.lua
Normal file
117
lua/cargdev/core/keymaps/plugins.lua
Normal file
@@ -0,0 +1,117 @@
|
||||
-- Plugin-specific keymaps
|
||||
local keymap = vim.keymap
|
||||
|
||||
-- =============================================================================
|
||||
-- PLUGIN KEYMAPS
|
||||
-- =============================================================================
|
||||
|
||||
-- NvimTree
|
||||
keymap.set("n", "<leader>e", "<cmd>NvimTreeToggle<CR>", { desc = "Toggle file explorer" })
|
||||
|
||||
-- Buffer management
|
||||
keymap.set("n", "<S-l>", ":bnext<CR>", { noremap = true, silent = true })
|
||||
keymap.set("n", "<S-h>", ":bprevious<CR>", { noremap = true, silent = true })
|
||||
|
||||
-- Comment
|
||||
keymap.set("n", "<leader>/", "<cmd>lua require('Comment.api').toggle_current_linewise()<CR>", { desc = "Toggle comment" })
|
||||
keymap.set("v", "<leader>/", "<ESC><cmd>lua require('Comment.api').toggle_linewise_op(vim.fn.visualmode())<CR>", { desc = "Toggle comment" })
|
||||
|
||||
-- Git
|
||||
keymap.set("n", "<leader>gg", "<cmd>LazyGit<CR>", { desc = "LazyGit" })
|
||||
|
||||
-- DAP
|
||||
keymap.set("n", "<leader>db", "<cmd>lua require'dap'.toggle_breakpoint()<cr>", { desc = "Toggle breakpoint" })
|
||||
keymap.set("n", "<leader>dc", "<cmd>lua require'dap'.continue()<cr>", { desc = "Continue" })
|
||||
keymap.set("n", "<leader>di", "<cmd>lua require'dap'.step_into()<cr>", { desc = "Step into" })
|
||||
keymap.set("n", "<leader>do", "<cmd>lua require'dap'.step_over()<cr>", { desc = "Step over" })
|
||||
keymap.set("n", "<leader>dO", "<cmd>lua require'dap'.step_out()<cr>", { desc = "Step out" })
|
||||
keymap.set("n", "<leader>dr", "<cmd>lua require'dap'.repl.toggle()<cr>", { desc = "Toggle REPL" })
|
||||
keymap.set("n", "<leader>dl", "<cmd>lua require'dap'.run_last()<cr>", { desc = "Run last" })
|
||||
keymap.set("n", "<leader>du", "<cmd>lua require'dapui'.toggle()<cr>", { desc = "Toggle DAP UI" })
|
||||
keymap.set("n", "<leader>dt", "<cmd>lua require'dapui'.float_element()<cr>", { desc = "Float element" })
|
||||
|
||||
-- Trouble
|
||||
keymap.set("n", "<leader>xx", "<cmd>TroubleToggle<cr>", { desc = "Toggle Trouble" })
|
||||
keymap.set("n", "<leader>xw", "<cmd>TroubleToggle workspace_diagnostics<cr>", { desc = "Workspace diagnostics" })
|
||||
keymap.set("n", "<leader>xd", "<cmd>TroubleToggle document_diagnostics<cr>", { desc = "Document diagnostics" })
|
||||
keymap.set("n", "<leader>xl", "<cmd>TroubleToggle loclist<cr>", { desc = "Location list" })
|
||||
keymap.set("n", "<leader>xq", "<cmd>TroubleToggle quickfix<cr>", { desc = "Quickfix list" })
|
||||
|
||||
-- Terminal
|
||||
keymap.set("n", "<leader>tf", "<cmd>ToggleTerm direction=float<cr>", { desc = "ToggleTerm float" })
|
||||
keymap.set("n", "<leader>th", "<cmd>ToggleTerm size=10 direction=horizontal<cr>", { desc = "ToggleTerm horizontal split" })
|
||||
keymap.set("n", "<leader>tv", "<cmd>ToggleTerm size=80 direction=vertical<cr>", { desc = "ToggleTerm vertical split" })
|
||||
|
||||
-- Session management
|
||||
keymap.set("n", "<leader>ss", "<cmd>SessionSave<cr>", { desc = "Save session" })
|
||||
keymap.set("n", "<leader>sr", "<cmd>SessionRestore<cr>", { desc = "Restore session" })
|
||||
|
||||
-- Formatting
|
||||
keymap.set("n", "<leader>f", "<cmd>lua vim.lsp.buf.format()<cr>", { desc = "Format buffer" })
|
||||
|
||||
-- Substitute
|
||||
keymap.set("n", "<leader>s", "<cmd>lua require('substitute').operator()<cr>", { desc = "Substitute with motion" })
|
||||
keymap.set("n", "<leader>ss", "<cmd>lua require('substitute').line()<cr>", { desc = "Substitute line" })
|
||||
keymap.set("n", "<leader>S", "<cmd>lua require('substitute').eol()<cr>", { desc = "Substitute to end of line" })
|
||||
|
||||
-- Surround
|
||||
keymap.set("n", "<leader>sa", "<cmd>lua require('nvim-surround').surround_add()<cr>", { desc = "Add surrounding" })
|
||||
keymap.set("n", "<leader>sd", "<cmd>lua require('nvim-surround').surround_delete()<cr>", { desc = "Delete surrounding" })
|
||||
keymap.set("n", "<leader>sr", "<cmd>lua require('nvim-surround').surround_replace()<cr>", { desc = "Replace surrounding" })
|
||||
|
||||
-- Git conflicts
|
||||
keymap.set("n", "]x", "<Plug>(git-conflict-next-conflict)", { desc = "Go to next git conflict" })
|
||||
keymap.set("n", "[x", "<Plug>(git-conflict-prev-conflict)", { desc = "Go to previous git conflict" })
|
||||
keymap.set("n", "<leader>co", "<Plug>(git-conflict-ours)", { desc = "Choose ours (git conflict)" })
|
||||
keymap.set("n", "<leader>ct", "<Plug>(git-conflict-theirs)", { desc = "Choose theirs (git conflict)" })
|
||||
keymap.set("n", "<leader>cb", "<Plug>(git-conflict-both)", { desc = "Choose both (git conflict)" })
|
||||
keymap.set("n", "<leader>c0", "<Plug>(git-conflict-none)", { desc = "Choose none (git conflict)" })
|
||||
keymap.set("n", "<leader>cq", "<Plug>(git-conflict-list)", { desc = "List all git conflicts" })
|
||||
|
||||
-- LeetCode
|
||||
keymap.set("n", "<leader>lr", "<cmd>Leet run<CR>", { desc = "LeetCode: Run Code" })
|
||||
keymap.set("n", "<leader>ls", "<cmd>Leet submit<CR>", { desc = "LeetCode: Submit Code" })
|
||||
keymap.set("n", "<leader>ld", "<cmd>Leet daily<CR>", { desc = "LeetCode: Daily Challenge" })
|
||||
keymap.set("n", "<leader>ll", "<cmd>Leet list<CR>", { desc = "LeetCode: List Problems" })
|
||||
keymap.set("n", "<leader>lc", "<cmd>Leet console<CR>", { desc = "LeetCode: Open Console" })
|
||||
keymap.set("n", "<leader>lu", "<cmd>Leet cookie update<CR>", { desc = "LeetCode: Update Cookie" })
|
||||
keymap.set("n", "<leader>lh", "<cmd>Leet hints<cr>", { desc = "LeetCode: Open hints" })
|
||||
keymap.set("n", "<leader>lls", "<cmd>Leet last<cr>", { desc = "LeetCode: Get latest submission" })
|
||||
|
||||
-- Linting
|
||||
keymap.set("n", "<leader>l", "<cmd>Lint<cr>", { desc = "Lint current file" })
|
||||
|
||||
-- Project commands
|
||||
keymap.set("n", "<leader>p", "<cmd>lua require('cargdev.core.function.project_commands').run_project()<cr>", { desc = "Run project" })
|
||||
|
||||
-- Console log (different from personal <leader>con)
|
||||
keymap.set("n", "<leader>cl", "oconsole.log()<ESC>i", { desc = "Add console.log" })
|
||||
|
||||
-- DAP UI reset
|
||||
keymap.set("n", "<leader>drt", "<cmd>lua require('dapui').float_element()<cr>", { desc = "Reset DAP UI layout" })
|
||||
|
||||
-- DAP commands
|
||||
keymap.set("n", "<leader>dco", "<cmd>lua require('dap').commands()<cr>", { desc = "DAP commands" })
|
||||
keymap.set("n", "<leader>dcf", "<cmd>lua require('dap').list_breakpoints()<cr>", { desc = "DAP configs" })
|
||||
keymap.set("n", "<leader>dcb", "<cmd>lua require('dap').list_breakpoints()<cr>", { desc = "List breakpoints" })
|
||||
|
||||
-- Step out
|
||||
keymap.set("n", "<leader>dot", "<cmd>lua require('dap').step_out()<cr>", { desc = "Step out" })
|
||||
|
||||
-- Todos in trouble
|
||||
keymap.set("n", "<leader>xt", "<cmd>TodoTrouble<cr>", { desc = "Open todos in trouble" })
|
||||
|
||||
-- Surround mappings
|
||||
keymap.set("n", "ys", "<cmd>lua require('nvim-surround').surround_add()<cr>", { desc = "Add surrounding" })
|
||||
keymap.set("n", "yss", "<cmd>lua require('nvim-surround').surround_add()<cr>", { desc = "Add surrounding to line" })
|
||||
keymap.set("n", "yS", "<cmd>lua require('nvim-surround').surround_add()<cr>", { desc = "Add surrounding on new lines" })
|
||||
keymap.set("n", "ySS", "<cmd>lua require('nvim-surround').surround_add()<cr>", { desc = "Add surrounding to line on new lines" })
|
||||
|
||||
-- Comment mappings
|
||||
keymap.set("n", "gc", "<cmd>lua require('Comment.api').toggle_current_linewise()<cr>", { desc = "Toggle comment" })
|
||||
keymap.set("n", "gcc", "<cmd>lua require('Comment.api').toggle_current_linewise()<cr>", { desc = "Toggle current line comment" })
|
||||
keymap.set("n", "gco", "<cmd>lua require('Comment.api').insert_below()<cr>", { desc = "Insert comment below" })
|
||||
keymap.set("n", "gcO", "<cmd>lua require('Comment.api').insert_above()<cr>", { desc = "Insert comment above" })
|
||||
keymap.set("n", "gcA", "<cmd>lua require('Comment.api').insert_eol()<cr>", { desc = "Insert comment at end of line" })
|
||||
keymap.set("n", "gb", "<cmd>lua require('Comment.api').toggle_current_blockwise()<cr>", { desc = "Toggle block comment" })
|
||||
keymap.set("n", "gbc", "<cmd>lua require('Comment.api').toggle_current_blockwise()<cr>", { desc = "Toggle current block comment" })
|
||||
28
lua/cargdev/core/keymaps/telescope.lua
Normal file
28
lua/cargdev/core/keymaps/telescope.lua
Normal file
@@ -0,0 +1,28 @@
|
||||
-- Telescope keymaps
|
||||
local keymap = vim.keymap
|
||||
|
||||
-- =============================================================================
|
||||
-- TELESCOPE NAVIGATION
|
||||
-- =============================================================================
|
||||
|
||||
-- File navigation
|
||||
keymap.set("n", "<leader>ff", "<cmd>Telescope find_files<cr>", { desc = "Find files" })
|
||||
keymap.set("n", "<leader>fs", "<cmd>Telescope live_grep<cr>", { desc = "Live grep" })
|
||||
keymap.set("n", "<leader>fc", "<cmd>Telescope grep_string<cr>", { desc = "Grep string" })
|
||||
keymap.set("n", "<leader>fr", "<cmd>Telescope oldfiles<cr>", { desc = "Recent files" })
|
||||
|
||||
-- Buffer and session management
|
||||
keymap.set("n", "<leader>fb", "<cmd>Telescope buffers<cr>", { desc = "Find buffers" })
|
||||
keymap.set("n", "<leader>fh", "<cmd>Telescope help_tags<cr>", { desc = "Help tags" })
|
||||
keymap.set("n", "<leader>fm", "<cmd>Telescope marks<cr>", { desc = "Find marks" })
|
||||
keymap.set("n", "<leader>fk", "<cmd>Telescope keymaps<cr>", { desc = "Find keymaps" })
|
||||
keymap.set("n", "<leader>fC", "<cmd>Telescope commands<cr>", { desc = "Find commands" })
|
||||
|
||||
-- Git
|
||||
keymap.set("n", "<leader>fg", "<cmd>Telescope git_commits<cr>", { desc = "Git commits" })
|
||||
keymap.set("n", "<leader>fG", "<cmd>Telescope git_bcommits<cr>", { desc = "Git buffer commits" })
|
||||
keymap.set("n", "<leader>fb", "<cmd>Telescope git_branches<cr>", { desc = "Git branches" })
|
||||
keymap.set("n", "<leader>fs", "<cmd>Telescope git_status<cr>", { desc = "Git status" })
|
||||
|
||||
-- Todos
|
||||
keymap.set("n", "<leader>ft", "<cmd>TodoTelescope<cr>", { desc = "Find todos" })
|
||||
@@ -1,50 +1,143 @@
|
||||
vim.cmd("let g:netrw_liststyle = 3")
|
||||
|
||||
-- Core options and settings
|
||||
local opt = vim.opt
|
||||
local g = vim.g
|
||||
|
||||
vim.o.sessionoptions = "blank,buffers,curdir,folds,help,tabpages,winsize,winpos,terminal,localoptions"
|
||||
-- Disable deprecated API warnings
|
||||
vim.deprecate = function() end
|
||||
|
||||
opt.relativenumber = true
|
||||
opt.number = true
|
||||
-- Set leader key before lazy
|
||||
g.mapleader = " "
|
||||
g.maplocalleader = " "
|
||||
|
||||
-- tabs & indentation
|
||||
opt.tabstop = 2 -- 2 spaces for tabs (prettier default)
|
||||
opt.shiftwidth = 2 -- 2 spaces for indent width
|
||||
opt.expandtab = true -- expand tab to spaces
|
||||
opt.autoindent = true -- copy indent from current line when starting new one
|
||||
-- General settings
|
||||
opt.mouse = "a" -- Enable mouse
|
||||
opt.clipboard = "unnamedplus" -- Use system clipboard
|
||||
opt.swapfile = false -- Don't create swap files
|
||||
opt.completeopt = "menuone,noselect" -- Better completion
|
||||
opt.undofile = true -- Persistent undo
|
||||
opt.undodir = vim.fn.stdpath("data") .. "/undodir"
|
||||
|
||||
opt.wrap = false
|
||||
-- Search settings
|
||||
opt.ignorecase = true -- Case insensitive search
|
||||
opt.smartcase = true -- Case sensitive when uppercase
|
||||
opt.hlsearch = false -- Don't highlight search results
|
||||
opt.incsearch = true -- Incremental search
|
||||
|
||||
-- search settings
|
||||
opt.ignorecase = true -- ignore case when searching
|
||||
opt.smartcase = true -- if you include mixed case in your search, assumes you want case-sensitive
|
||||
-- Indentation
|
||||
opt.expandtab = true -- Use spaces instead of tabs
|
||||
opt.shiftwidth = 2 -- Number of spaces for indentation
|
||||
opt.tabstop = 2 -- Number of spaces for tabs
|
||||
opt.softtabstop = 2 -- Number of spaces for soft tabs
|
||||
opt.autoindent = true -- Auto indent
|
||||
opt.smartindent = true -- Smart indent
|
||||
|
||||
opt.cursorline = true
|
||||
-- Performance
|
||||
opt.lazyredraw = false -- Don't redraw while executing macros
|
||||
opt.updatetime = 250 -- Faster completion
|
||||
opt.timeoutlen = 300 -- Faster key sequence completion
|
||||
|
||||
-- turn on termguicolors for tokyonight colorscheme to work
|
||||
-- (have to use iterm2 or any other true color terminal)
|
||||
opt.termguicolors = true
|
||||
opt.background = "dark" -- colorschemes that can be light or dark will be made dark
|
||||
opt.signcolumn = "yes" -- show sign column so that text doesn't shift
|
||||
-- UI settings
|
||||
opt.number = true -- Show line numbers
|
||||
opt.relativenumber = true -- Show relative line numbers
|
||||
opt.cursorline = true -- Highlight current line
|
||||
opt.cursorcolumn = false -- Don't highlight current column
|
||||
opt.signcolumn = "yes" -- Always show sign column
|
||||
opt.wrap = false -- Don't wrap lines
|
||||
opt.linebreak = true -- Break lines at word boundaries
|
||||
opt.scrolloff = 8 -- Keep 8 lines above/below cursor
|
||||
opt.sidescrolloff = 8 -- Keep 8 columns left/right of cursor
|
||||
opt.showmatch = true -- Show matching brackets
|
||||
opt.matchtime = 2 -- How long to show matching brackets
|
||||
|
||||
-- backspace
|
||||
opt.backspace = "indent,eol,start" -- allow backspace on indent, end of line or insert mode start position
|
||||
-- Folding
|
||||
opt.foldmethod = "indent" -- Fold based on indentation
|
||||
opt.foldlevel = 99 -- Don't fold by default
|
||||
opt.foldnestmax = 10 -- Maximum nesting level
|
||||
|
||||
-- clipboard
|
||||
opt.clipboard:append("unnamedplus") -- use system clipboard as default register
|
||||
-- Backup and swap
|
||||
opt.backup = false -- Don't create backup files
|
||||
opt.writebackup = false -- Don't create backup files while writing
|
||||
opt.swapfile = false -- Don't create swap files
|
||||
|
||||
-- split windows
|
||||
opt.splitright = true -- split vertical window to the right
|
||||
opt.splitbelow = true -- split horizontal window to the bottom
|
||||
-- Terminal
|
||||
opt.termguicolors = true -- Enable true color support
|
||||
|
||||
-- turn off swapfile
|
||||
opt.swapfile = false
|
||||
-- File encoding
|
||||
opt.encoding = "utf-8" -- Set encoding to UTF-8
|
||||
opt.fileencoding = "utf-8" -- Set file encoding to UTF-8
|
||||
|
||||
-- Enable soft wrapping of long lines
|
||||
opt.wrap = true
|
||||
-- Wildmenu
|
||||
opt.wildmenu = true -- Enable wildmenu
|
||||
opt.wildmode = "longest:full,full" -- Wildmenu mode
|
||||
|
||||
-- Break lines at convenient points (e.g. after whitespace) rather than in the middle of a word
|
||||
opt.linebreak = true
|
||||
-- Split behavior
|
||||
opt.splitbelow = true -- Split below when creating horizontal splits
|
||||
opt.splitright = true -- Split right when creating vertical splits
|
||||
|
||||
-- Optionally, add a prefix to wrapped lines to visually indicate a wrap
|
||||
opt.showbreak = "↪ "
|
||||
-- Conceal
|
||||
opt.conceallevel = 2 -- Conceal certain characters
|
||||
|
||||
-- Disable providers that cause warnings
|
||||
g.loaded_perl_provider = 0 -- Disable Perl provider
|
||||
g.loaded_ruby_provider = 0 -- Disable Ruby provider (optional)
|
||||
|
||||
-- Lua specific settings
|
||||
opt.runtimepath:append(vim.fn.stdpath("config") .. "/lua")
|
||||
|
||||
-- Improve performance for large files
|
||||
opt.maxmempattern = 2000 -- Increase memory for pattern matching
|
||||
|
||||
-- Better diff
|
||||
opt.diffopt:append("algorithm:patience")
|
||||
opt.diffopt:append("indent-heuristic")
|
||||
|
||||
-- Better grep
|
||||
opt.grepprg = "rg --vimgrep --smart-case"
|
||||
opt.grepformat = "%f:%l:%c:%m"
|
||||
|
||||
-- Better listchars
|
||||
opt.list = true
|
||||
opt.listchars = {
|
||||
tab = "▸ ",
|
||||
trail = "·",
|
||||
extends = "❯",
|
||||
precedes = "❮",
|
||||
nbsp = "␣",
|
||||
}
|
||||
|
||||
-- Better fillchars
|
||||
opt.fillchars = {
|
||||
horiz = "━",
|
||||
horizup = "┻",
|
||||
horizdown = "┳",
|
||||
vert = "┃",
|
||||
vertleft = "┫",
|
||||
vertright = "┣",
|
||||
verthoriz = "╋",
|
||||
}
|
||||
|
||||
-- Disable builtin plugins
|
||||
local disabled_built_ins = {
|
||||
"netrw",
|
||||
"netrwPlugin",
|
||||
"netrwSettings",
|
||||
"netrwFileHandlers",
|
||||
"gzip",
|
||||
"zip",
|
||||
"zipPlugin",
|
||||
"tar",
|
||||
"tarPlugin",
|
||||
"getscript",
|
||||
"getscriptPlugin",
|
||||
"vimball",
|
||||
"vimballPlugin",
|
||||
"2html_plugin",
|
||||
"logipat",
|
||||
"rrhelper",
|
||||
"spellfile_plugin",
|
||||
"matchit",
|
||||
}
|
||||
|
||||
for _, plugin in pairs(disabled_built_ins) do
|
||||
g["loaded_" .. plugin] = 1
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user