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:
@@ -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