mirror of
https://github.com/harivansh-afk/nvim.git
synced 2026-04-15 07:04:47 +00:00
clean config
This commit is contained in:
parent
1db6db7f92
commit
25aded9685
19 changed files with 468 additions and 852 deletions
|
|
@ -1,32 +1,32 @@
|
||||||
local lsp_config = require("config.lsp")
|
local lsp = require('config.lsp')
|
||||||
|
|
||||||
vim.lsp.config("*", {
|
vim.lsp.config('*', {
|
||||||
capabilities = lsp_config.capabilities(),
|
capabilities = lsp.capabilities(),
|
||||||
})
|
})
|
||||||
|
|
||||||
vim.api.nvim_create_autocmd("LspAttach", {
|
vim.api.nvim_create_autocmd('LspAttach', {
|
||||||
group = vim.api.nvim_create_augroup("UserLspConfig", {}),
|
group = vim.api.nvim_create_augroup('UserLspConfig', {}),
|
||||||
callback = function(ev)
|
callback = function(ev)
|
||||||
local client = vim.lsp.get_client_by_id(ev.data.client_id)
|
local client = vim.lsp.get_client_by_id(ev.data.client_id)
|
||||||
if client then
|
if client then
|
||||||
lsp_config.on_attach(client, ev.buf)
|
lsp.on_attach(client, ev.buf)
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
for _, server in ipairs({
|
for _, server in ipairs({
|
||||||
"lua_ls",
|
'lua_ls',
|
||||||
"pyright",
|
'pyright',
|
||||||
"ts_ls",
|
'ts_ls',
|
||||||
"rust_analyzer",
|
'rust_analyzer',
|
||||||
"gopls",
|
'gopls',
|
||||||
"clangd",
|
'clangd',
|
||||||
"bashls",
|
'bashls',
|
||||||
"jsonls",
|
'jsonls',
|
||||||
"html",
|
'html',
|
||||||
"cssls",
|
'cssls',
|
||||||
}) do
|
}) do
|
||||||
local ok, config = pcall(require, "lsp." .. server)
|
local ok, config = pcall(require, 'lsp.' .. server)
|
||||||
if ok then
|
if ok then
|
||||||
vim.lsp.config(server, config)
|
vim.lsp.config(server, config)
|
||||||
end
|
end
|
||||||
|
|
|
||||||
88
init.lua
88
init.lua
|
|
@ -1,49 +1,59 @@
|
||||||
-- Set leader keys before lazy
|
vim.g.mapleader = ' '
|
||||||
vim.g.mapleader = " "
|
vim.g.maplocalleader = ','
|
||||||
vim.g.maplocalleader = ","
|
|
||||||
|
|
||||||
-- Global mapping helpers
|
function _G.map(mode, lhs, rhs, opts)
|
||||||
_G.map = function(mode, lhs, rhs, opts)
|
vim.keymap.set(mode, lhs, rhs, vim.tbl_extend('keep', opts or {}, { silent = true }))
|
||||||
opts = opts or {}
|
|
||||||
opts.silent = opts.silent ~= false
|
|
||||||
vim.keymap.set(mode, lhs, rhs, opts)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
_G.bmap = function(buf, mode, lhs, rhs, opts)
|
function _G.bmap(mode, lhs, rhs, opts)
|
||||||
opts = opts or {}
|
_G.map(mode, lhs, rhs, vim.tbl_extend('force', opts or {}, { buffer = 0 }))
|
||||||
opts.buffer = buf
|
|
||||||
opts.silent = opts.silent ~= false
|
|
||||||
vim.keymap.set(mode, lhs, rhs, opts)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Bootstrap lazy.nvim
|
local disabled_plugins = {
|
||||||
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
|
'2html_plugin',
|
||||||
|
'bugreport',
|
||||||
|
'getscript',
|
||||||
|
'getscriptPlugin',
|
||||||
|
'gzip',
|
||||||
|
'logipat',
|
||||||
|
'matchit',
|
||||||
|
'matchparen',
|
||||||
|
'netrw',
|
||||||
|
'netrwFileHandlers',
|
||||||
|
'netrwPlugin',
|
||||||
|
'netrwSettings',
|
||||||
|
'optwin',
|
||||||
|
'rplugin',
|
||||||
|
'rrhelper',
|
||||||
|
'synmenu',
|
||||||
|
'tar',
|
||||||
|
'tarPlugin',
|
||||||
|
'tohtml',
|
||||||
|
'tutor',
|
||||||
|
'vimball',
|
||||||
|
'vimballPlugin',
|
||||||
|
'zip',
|
||||||
|
'zipPlugin',
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, plugin in ipairs(disabled_plugins) do
|
||||||
|
vim.g['loaded_' .. plugin] = 1
|
||||||
|
end
|
||||||
|
|
||||||
|
local lazypath = vim.fn.stdpath('data') .. '/lazy/lazy.nvim'
|
||||||
if not vim.uv.fs_stat(lazypath) then
|
if not vim.uv.fs_stat(lazypath) then
|
||||||
vim.fn.system({
|
vim.fn.system({
|
||||||
"git",
|
'git',
|
||||||
"clone",
|
'clone',
|
||||||
"--filter=blob:none",
|
'--filter=blob:none',
|
||||||
"https://github.com/folke/lazy.nvim.git",
|
'--branch=stable',
|
||||||
"--branch=stable",
|
'https://github.com/folke/lazy.nvim.git',
|
||||||
lazypath,
|
lazypath,
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
vim.opt.rtp:prepend(lazypath)
|
vim.opt.rtp:prepend(lazypath)
|
||||||
|
|
||||||
-- Load plugins
|
require('lazy').setup('plugins', {
|
||||||
require("lazy").setup("plugins", {
|
defaults = { lazy = false },
|
||||||
defaults = { lazy = true },
|
change_detection = { enabled = false },
|
||||||
performance = {
|
|
||||||
rtp = {
|
|
||||||
disabled_plugins = {
|
|
||||||
"gzip",
|
|
||||||
"matchit",
|
|
||||||
"matchparen",
|
|
||||||
"netrwPlugin",
|
|
||||||
"tarPlugin",
|
|
||||||
"tohtml",
|
|
||||||
"zipPlugin",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
})
|
})
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,4 @@
|
||||||
{
|
{
|
||||||
"dashboard-nvim": { "branch": "master", "commit": "0775e567b6c0be96d01a61795f7b64c1758262f6" },
|
|
||||||
"diffs.nvim": { "branch": "main", "commit": "b1abfe4f4a164ad776148ca36f852df4f1e4014e" },
|
"diffs.nvim": { "branch": "main", "commit": "b1abfe4f4a164ad776148ca36f852df4f1e4014e" },
|
||||||
"flash.nvim": { "branch": "main", "commit": "fcea7ff883235d9024dc41e638f164a450c14ca2" },
|
"flash.nvim": { "branch": "main", "commit": "fcea7ff883235d9024dc41e638f164a450c14ca2" },
|
||||||
"fzf-lua": { "branch": "main", "commit": "b2c0603216adb92c6bba81053bc996d7ae95b77a" },
|
"fzf-lua": { "branch": "main", "commit": "b2c0603216adb92c6bba81053bc996d7ae95b77a" },
|
||||||
|
|
|
||||||
|
|
@ -1,31 +1,21 @@
|
||||||
-- Shared LSP utilities
|
|
||||||
local M = {}
|
local M = {}
|
||||||
|
|
||||||
-- Set up buffer-local keymaps when LSP attaches
|
function M.on_attach(_, bufnr)
|
||||||
function M.on_attach(client, bufnr)
|
local function buf(mode, lhs, rhs)
|
||||||
local opts = { buffer = bufnr, silent = true }
|
bmap(mode, lhs, rhs, { buffer = bufnr })
|
||||||
|
end
|
||||||
|
|
||||||
-- Navigation
|
buf('n', 'gd', vim.lsp.buf.definition)
|
||||||
vim.keymap.set("n", "gd", vim.lsp.buf.definition, vim.tbl_extend("force", opts, { desc = "Go to definition" }))
|
buf('n', 'gD', vim.lsp.buf.declaration)
|
||||||
vim.keymap.set("n", "gD", vim.lsp.buf.declaration, vim.tbl_extend("force", opts, { desc = "Go to declaration" }))
|
buf('n', '<C-]>', vim.lsp.buf.definition)
|
||||||
vim.keymap.set("n", "<C-]>", vim.lsp.buf.definition, vim.tbl_extend("force", opts, { desc = "Go to definition" }))
|
buf('n', 'gi', vim.lsp.buf.implementation)
|
||||||
vim.keymap.set("n", "gi", vim.lsp.buf.implementation, vim.tbl_extend("force", opts, { desc = "Go to implementation" }))
|
buf('n', 'gr', vim.lsp.buf.references)
|
||||||
vim.keymap.set("n", "gr", vim.lsp.buf.references, vim.tbl_extend("force", opts, { desc = "Go to references" }))
|
buf('n', 'K', vim.lsp.buf.hover)
|
||||||
|
buf('n', '<leader>rn', vim.lsp.buf.rename)
|
||||||
-- Documentation
|
buf({ 'n', 'v' }, '<leader>ca', vim.lsp.buf.code_action)
|
||||||
vim.keymap.set("n", "K", vim.lsp.buf.hover, vim.tbl_extend("force", opts, { desc = "Hover documentation" }))
|
buf('n', '<leader>f', function() vim.lsp.buf.format({ async = true }) end)
|
||||||
|
|
||||||
-- Refactoring
|
|
||||||
vim.keymap.set("n", "<leader>rn", vim.lsp.buf.rename, vim.tbl_extend("force", opts, { desc = "Rename symbol" }))
|
|
||||||
vim.keymap.set({ "n", "v" }, "<leader>ca", vim.lsp.buf.code_action, vim.tbl_extend("force", opts, { desc = "Code action" }))
|
|
||||||
|
|
||||||
-- Formatting
|
|
||||||
vim.keymap.set("n", "<leader>f", function()
|
|
||||||
vim.lsp.buf.format({ async = true })
|
|
||||||
end, vim.tbl_extend("force", opts, { desc = "Format buffer" }))
|
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Return default capabilities for LSP servers
|
|
||||||
function M.capabilities()
|
function M.capabilities()
|
||||||
return vim.lsp.protocol.make_client_capabilities()
|
return vim.lsp.protocol.make_client_capabilities()
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -1,139 +0,0 @@
|
||||||
-- Minimal custom statusline
|
|
||||||
local M = {}
|
|
||||||
|
|
||||||
-- Mode mapping
|
|
||||||
local mode_map = {
|
|
||||||
n = "NORMAL",
|
|
||||||
no = "N-PENDING",
|
|
||||||
nov = "N-PENDING",
|
|
||||||
noV = "N-PENDING",
|
|
||||||
["no\22"] = "N-PENDING",
|
|
||||||
niI = "NORMAL",
|
|
||||||
niR = "NORMAL",
|
|
||||||
niV = "NORMAL",
|
|
||||||
nt = "NORMAL",
|
|
||||||
ntT = "NORMAL",
|
|
||||||
v = "VISUAL",
|
|
||||||
vs = "VISUAL",
|
|
||||||
V = "V-LINE",
|
|
||||||
Vs = "V-LINE",
|
|
||||||
["\22"] = "V-BLOCK",
|
|
||||||
["\22s"] = "V-BLOCK",
|
|
||||||
s = "SELECT",
|
|
||||||
S = "S-LINE",
|
|
||||||
["\19"] = "S-BLOCK",
|
|
||||||
i = "INSERT",
|
|
||||||
ic = "INSERT",
|
|
||||||
ix = "INSERT",
|
|
||||||
R = "REPLACE",
|
|
||||||
Rc = "REPLACE",
|
|
||||||
Rx = "REPLACE",
|
|
||||||
Rv = "V-REPLACE",
|
|
||||||
Rvc = "V-REPLACE",
|
|
||||||
Rvx = "V-REPLACE",
|
|
||||||
c = "COMMAND",
|
|
||||||
cv = "EX",
|
|
||||||
ce = "EX",
|
|
||||||
r = "REPLACE",
|
|
||||||
rm = "MORE",
|
|
||||||
["r?"] = "CONFIRM",
|
|
||||||
["!"] = "SHELL",
|
|
||||||
t = "TERMINAL",
|
|
||||||
}
|
|
||||||
|
|
||||||
-- Get current mode indicator
|
|
||||||
local function get_mode()
|
|
||||||
local mode = vim.api.nvim_get_mode().mode
|
|
||||||
return mode_map[mode] or mode
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Get git branch from gitsigns
|
|
||||||
local function get_git_branch()
|
|
||||||
local branch = vim.b.gitsigns_head
|
|
||||||
if branch and branch ~= "" then
|
|
||||||
return " " .. branch
|
|
||||||
end
|
|
||||||
return ""
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Get filename with modified indicator
|
|
||||||
local function get_filename()
|
|
||||||
local filename = vim.fn.expand("%:t")
|
|
||||||
if filename == "" then
|
|
||||||
filename = "[No Name]"
|
|
||||||
end
|
|
||||||
|
|
||||||
local modified = vim.bo.modified and " [+]" or ""
|
|
||||||
local readonly = vim.bo.readonly and " [RO]" or ""
|
|
||||||
|
|
||||||
return filename .. modified .. readonly
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Get file path (relative to cwd)
|
|
||||||
local function get_filepath()
|
|
||||||
local filepath = vim.fn.expand("%:~:.")
|
|
||||||
if filepath == "" then
|
|
||||||
return ""
|
|
||||||
end
|
|
||||||
return filepath
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Get current position
|
|
||||||
local function get_position()
|
|
||||||
local line = vim.fn.line(".")
|
|
||||||
local col = vim.fn.col(".")
|
|
||||||
local total = vim.fn.line("$")
|
|
||||||
return string.format("%d:%d/%d", line, col, total)
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Get filetype
|
|
||||||
local function get_filetype()
|
|
||||||
local ft = vim.bo.filetype
|
|
||||||
if ft == "" then
|
|
||||||
return ""
|
|
||||||
end
|
|
||||||
return ft
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Build the statusline
|
|
||||||
function M.statusline()
|
|
||||||
local parts = {}
|
|
||||||
|
|
||||||
-- Left side
|
|
||||||
table.insert(parts, " " .. get_mode() .. " ")
|
|
||||||
table.insert(parts, get_git_branch())
|
|
||||||
|
|
||||||
local filepath = get_filepath()
|
|
||||||
if filepath ~= "" then
|
|
||||||
table.insert(parts, " " .. filepath)
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Modified indicator
|
|
||||||
if vim.bo.modified then
|
|
||||||
table.insert(parts, " [+]")
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Separator
|
|
||||||
table.insert(parts, "%=")
|
|
||||||
|
|
||||||
-- Right side
|
|
||||||
local ft = get_filetype()
|
|
||||||
if ft ~= "" then
|
|
||||||
table.insert(parts, ft .. " ")
|
|
||||||
end
|
|
||||||
|
|
||||||
table.insert(parts, get_position() .. " ")
|
|
||||||
|
|
||||||
return table.concat(parts, "")
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Setup function to configure the statusline
|
|
||||||
function M.setup()
|
|
||||||
-- Use the %!v:lua.require() pattern
|
|
||||||
vim.o.statusline = "%!v:lua.require('config.statusline').statusline()"
|
|
||||||
|
|
||||||
-- Ensure statusline is always shown
|
|
||||||
vim.o.laststatus = 2
|
|
||||||
end
|
|
||||||
|
|
||||||
return M
|
|
||||||
|
|
@ -1,25 +1,14 @@
|
||||||
-- Lua language server configuration
|
|
||||||
return {
|
return {
|
||||||
settings = {
|
settings = {
|
||||||
Lua = {
|
Lua = {
|
||||||
diagnostics = {
|
diagnostics = { globals = { 'vim' } },
|
||||||
globals = { "vim" },
|
runtime = { version = 'LuaJIT' },
|
||||||
},
|
|
||||||
runtime = {
|
|
||||||
version = "LuaJIT",
|
|
||||||
},
|
|
||||||
workspace = {
|
workspace = {
|
||||||
checkThirdParty = false,
|
checkThirdParty = false,
|
||||||
library = {
|
library = { vim.env.VIMRUNTIME },
|
||||||
vim.env.VIMRUNTIME,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
telemetry = {
|
|
||||||
enable = false,
|
|
||||||
},
|
|
||||||
hint = {
|
|
||||||
enable = true,
|
|
||||||
},
|
},
|
||||||
|
telemetry = { enable = false },
|
||||||
|
hint = { enable = true },
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,11 @@
|
||||||
-- Pyright (Python) language server configuration
|
|
||||||
return {
|
return {
|
||||||
settings = {
|
settings = {
|
||||||
python = {
|
python = {
|
||||||
analysis = {
|
analysis = {
|
||||||
typeCheckingMode = "basic",
|
typeCheckingMode = 'basic',
|
||||||
autoSearchPaths = true,
|
autoSearchPaths = true,
|
||||||
useLibraryCodeForTypes = true,
|
useLibraryCodeForTypes = true,
|
||||||
diagnosticMode = "workspace",
|
diagnosticMode = 'workspace',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -1,25 +1,16 @@
|
||||||
-- Rust Analyzer configuration with clippy integration
|
|
||||||
return {
|
return {
|
||||||
settings = {
|
settings = {
|
||||||
["rust-analyzer"] = {
|
['rust-analyzer'] = {
|
||||||
checkOnSave = {
|
checkOnSave = { command = 'clippy' },
|
||||||
command = "clippy",
|
cargo = { allFeatures = true },
|
||||||
},
|
procMacro = { enable = true },
|
||||||
cargo = {
|
diagnostics = { enable = true },
|
||||||
allFeatures = true,
|
|
||||||
},
|
|
||||||
procMacro = {
|
|
||||||
enable = true,
|
|
||||||
},
|
|
||||||
diagnostics = {
|
|
||||||
enable = true,
|
|
||||||
},
|
|
||||||
inlayHints = {
|
inlayHints = {
|
||||||
bindingModeHints = { enable = true },
|
bindingModeHints = { enable = true },
|
||||||
chainingHints = { enable = true },
|
chainingHints = { enable = true },
|
||||||
closingBraceHints = { enable = true },
|
closingBraceHints = { enable = true },
|
||||||
closureReturnTypeHints = { enable = "always" },
|
closureReturnTypeHints = { enable = 'always' },
|
||||||
lifetimeElisionHints = { enable = "always" },
|
lifetimeElisionHints = { enable = 'always' },
|
||||||
parameterHints = { enable = true },
|
parameterHints = { enable = true },
|
||||||
typeHints = { enable = true },
|
typeHints = { enable = true },
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,8 @@
|
||||||
-- TypeScript language server configuration
|
|
||||||
return {
|
return {
|
||||||
settings = {
|
settings = {
|
||||||
typescript = {
|
typescript = {
|
||||||
inlayHints = {
|
inlayHints = {
|
||||||
includeInlayParameterNameHints = "all",
|
includeInlayParameterNameHints = 'all',
|
||||||
includeInlayParameterNameHintsWhenArgumentMatchesName = false,
|
includeInlayParameterNameHintsWhenArgumentMatchesName = false,
|
||||||
includeInlayFunctionParameterTypeHints = true,
|
includeInlayFunctionParameterTypeHints = true,
|
||||||
includeInlayVariableTypeHints = true,
|
includeInlayVariableTypeHints = true,
|
||||||
|
|
@ -14,7 +13,7 @@ return {
|
||||||
},
|
},
|
||||||
javascript = {
|
javascript = {
|
||||||
inlayHints = {
|
inlayHints = {
|
||||||
includeInlayParameterNameHints = "all",
|
includeInlayParameterNameHints = 'all',
|
||||||
includeInlayParameterNameHintsWhenArgumentMatchesName = false,
|
includeInlayParameterNameHintsWhenArgumentMatchesName = false,
|
||||||
includeInlayFunctionParameterTypeHints = true,
|
includeInlayFunctionParameterTypeHints = true,
|
||||||
includeInlayVariableTypeHints = true,
|
includeInlayVariableTypeHints = true,
|
||||||
|
|
|
||||||
|
|
@ -1,78 +1,53 @@
|
||||||
return {
|
return {
|
||||||
-- Autopairs
|
{
|
||||||
{
|
'windwp/nvim-autopairs',
|
||||||
"windwp/nvim-autopairs",
|
config = true,
|
||||||
event = "InsertEnter",
|
},
|
||||||
config = function()
|
{
|
||||||
require("nvim-autopairs").setup({})
|
'folke/flash.nvim',
|
||||||
end,
|
opts = {
|
||||||
},
|
modes = { search = { enabled = true } },
|
||||||
|
|
||||||
-- Flash.nvim for navigation
|
|
||||||
{
|
|
||||||
"folke/flash.nvim",
|
|
||||||
event = "VeryLazy",
|
|
||||||
opts = {
|
|
||||||
modes = {
|
|
||||||
search = {
|
|
||||||
enabled = true,
|
|
||||||
},
|
},
|
||||||
},
|
config = function(_, opts)
|
||||||
|
require('flash').setup(opts)
|
||||||
|
map({ 'n', 'x', 'o' }, 's', function() require('flash').jump() end)
|
||||||
|
map({ 'n', 'x', 'o' }, 'S', function() require('flash').treesitter() end)
|
||||||
|
map('o', 'r', function() require('flash').remote() end)
|
||||||
|
map({ 'o', 'x' }, 'R', function() require('flash').treesitter_search() end)
|
||||||
|
map('c', '<c-s>', function() require('flash').toggle() end)
|
||||||
|
end,
|
||||||
},
|
},
|
||||||
keys = {
|
{
|
||||||
{ "s", mode = { "n", "x", "o" }, function() require("flash").jump() end, desc = "Flash" },
|
'kylechui/nvim-surround',
|
||||||
{ "S", mode = { "n", "x", "o" }, function() require("flash").treesitter() end, desc = "Flash Treesitter" },
|
config = true,
|
||||||
{ "r", mode = "o", function() require("flash").remote() end, desc = "Remote Flash" },
|
|
||||||
{ "R", mode = { "o", "x" }, function() require("flash").treesitter_search() end, desc = "Treesitter Search" },
|
|
||||||
{ "<c-s>", mode = { "c" }, function() require("flash").toggle() end, desc = "Toggle Flash Search" },
|
|
||||||
},
|
},
|
||||||
},
|
{
|
||||||
|
'kevinhwang91/nvim-ufo',
|
||||||
-- Surround
|
dependencies = { 'kevinhwang91/promise-async' },
|
||||||
{
|
opts = {
|
||||||
"kylechui/nvim-surround",
|
provider_selector = function()
|
||||||
version = "*",
|
return { 'treesitter', 'indent' }
|
||||||
event = "VeryLazy",
|
end,
|
||||||
opts = {},
|
},
|
||||||
},
|
config = function(_, opts)
|
||||||
|
require('ufo').setup(opts)
|
||||||
-- Folds
|
map('n', 'zR', require('ufo').openAllFolds)
|
||||||
{
|
map('n', 'zM', require('ufo').closeAllFolds)
|
||||||
"kevinhwang91/nvim-ufo",
|
end,
|
||||||
dependencies = { "kevinhwang91/promise-async" },
|
|
||||||
event = "BufReadPost",
|
|
||||||
opts = {
|
|
||||||
provider_selector = function()
|
|
||||||
return { "treesitter", "indent" }
|
|
||||||
end,
|
|
||||||
},
|
},
|
||||||
keys = {
|
{
|
||||||
{ "zR", function() require("ufo").openAllFolds() end, desc = "Open all folds" },
|
'supermaven-inc/supermaven-nvim',
|
||||||
{ "zM", function() require("ufo").closeAllFolds() end, desc = "Close all folds" },
|
opts = {
|
||||||
|
keymaps = {
|
||||||
|
accept_suggestion = '<Tab>',
|
||||||
|
clear_suggestion = '<C-]>',
|
||||||
|
accept_word = '<C-j>',
|
||||||
|
},
|
||||||
|
ignore_filetypes = { gitcommit = true },
|
||||||
|
color = {
|
||||||
|
suggestion_color = vim.api.nvim_get_hl(0, { name = 'Comment' }).fg,
|
||||||
|
cterm = 244,
|
||||||
|
},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
|
||||||
|
|
||||||
-- Supermaven inline suggestions (accepted with Tab)
|
|
||||||
{
|
|
||||||
"supermaven-inc/supermaven-nvim",
|
|
||||||
event = "InsertEnter",
|
|
||||||
config = function(_, opts)
|
|
||||||
require("supermaven-nvim").setup(opts)
|
|
||||||
end,
|
|
||||||
opts = {
|
|
||||||
keymaps = {
|
|
||||||
accept_suggestion = "<Tab>",
|
|
||||||
clear_suggestion = "<C-]>",
|
|
||||||
accept_word = "<C-j>",
|
|
||||||
},
|
|
||||||
disable_keymaps = false,
|
|
||||||
ignore_filetypes = { gitcommit = true },
|
|
||||||
color = {
|
|
||||||
suggestion_color = vim.api.nvim_get_hl(0, { name = "Comment" }).fg,
|
|
||||||
cterm = 244,
|
|
||||||
},
|
|
||||||
log_level = "info",
|
|
||||||
disable_inline_completion = false,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,82 +1,74 @@
|
||||||
---@param kind 'issue'|'pr'
|
---@param kind 'issue'|'pr'
|
||||||
---@param state 'all'|'open'|'closed'
|
---@param state 'all'|'open'|'closed'
|
||||||
local function gh_picker(kind, state)
|
local function gh_picker(kind, state)
|
||||||
if vim.fn.executable("gh") ~= 1 then
|
if vim.fn.executable('gh') ~= 1 then
|
||||||
vim.notify("gh CLI not found", vim.log.levels.WARN)
|
vim.notify('gh CLI not found', vim.log.levels.WARN)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
local next_state = ({ all = "open", open = "closed", closed = "all" })[state]
|
local next_state = ({ all = 'open', open = 'closed', closed = 'all' })[state]
|
||||||
local label = kind == "pr" and "PRs" or "Issues"
|
local label = kind == 'pr' and 'PRs' or 'Issues'
|
||||||
require("fzf-lua").fzf_exec(("gh %s list --limit 100 --state %s"):format(kind, state), {
|
require('fzf-lua').fzf_exec(('gh %s list --limit 100 --state %s'):format(kind, state), {
|
||||||
prompt = ("%s (%s)> "):format(label, state),
|
prompt = ('%s (%s)> '):format(label, state),
|
||||||
header = ":: <c-o> to toggle all/open/closed",
|
header = ':: <c-o> to toggle all/open/closed',
|
||||||
actions = {
|
actions = {
|
||||||
["default"] = function(selected)
|
['default'] = function(selected)
|
||||||
local num = selected[1]:match("^#?(%d+)")
|
local num = selected[1]:match('^#?(%d+)')
|
||||||
if num then
|
if num then
|
||||||
vim.system({ "gh", kind, "view", num, "--web" })
|
vim.system({ 'gh', kind, 'view', num, '--web' })
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
["ctrl-o"] = function()
|
['ctrl-o'] = function()
|
||||||
gh_picker(kind, next_state)
|
gh_picker(kind, next_state)
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
return {
|
return {
|
||||||
"ibhagwan/fzf-lua",
|
'ibhagwan/fzf-lua',
|
||||||
dependencies = { "nvim-tree/nvim-web-devicons" },
|
dependencies = { 'nvim-tree/nvim-web-devicons' },
|
||||||
cmd = "FzfLua",
|
config = function(_, opts)
|
||||||
keys = {
|
require('fzf-lua').setup(opts)
|
||||||
-- Main keybinds
|
|
||||||
{
|
|
||||||
"<C-f>",
|
|
||||||
function()
|
|
||||||
local fzf = require("fzf-lua")
|
|
||||||
local git_dir = vim.fn.system("git rev-parse --git-dir 2>/dev/null"):gsub("\n", "")
|
|
||||||
if vim.v.shell_error == 0 and git_dir ~= "" then
|
|
||||||
fzf.git_files()
|
|
||||||
else
|
|
||||||
fzf.files()
|
|
||||||
end
|
|
||||||
end,
|
|
||||||
desc = "Find files",
|
|
||||||
},
|
|
||||||
|
|
||||||
-- Leader keybinds
|
map('n', '<C-f>', function()
|
||||||
{ "<leader>ff", function() require("fzf-lua").files() end, desc = "Files" },
|
local fzf = require('fzf-lua')
|
||||||
{ "<leader>fg", function() require("fzf-lua").live_grep() end, desc = "Live grep" },
|
local git_dir = vim.fn.system('git rev-parse --git-dir 2>/dev/null'):gsub('\n', '')
|
||||||
{ "<leader>fb", function() require("fzf-lua").buffers() end, desc = "Buffers" },
|
if vim.v.shell_error == 0 and git_dir ~= '' then
|
||||||
{ "<leader>fh", function() require("fzf-lua").help_tags() end, desc = "Help tags" },
|
fzf.git_files()
|
||||||
{ "<leader>fr", function() require("fzf-lua").resume() end, desc = "Resume last search" },
|
else
|
||||||
{ "<leader>fo", function() require("fzf-lua").oldfiles() end, desc = "Recent files" },
|
fzf.files()
|
||||||
{ "<leader>fc", function() require("fzf-lua").commands() end, desc = "Commands" },
|
end
|
||||||
{ "<leader>fk", function() require("fzf-lua").keymaps() end, desc = "Keymaps" },
|
end)
|
||||||
{ "<leader>f/", function() require("fzf-lua").search_history() end, desc = "Search history" },
|
map('n', '<leader>ff', '<cmd>FzfLua files<cr>')
|
||||||
{ "<leader>f:", function() require("fzf-lua").command_history() end, desc = "Command history" },
|
map('n', '<leader>fg', '<cmd>FzfLua live_grep<cr>')
|
||||||
{ "<leader>fe", function() require("fzf-lua").files({ cwd = "~/.config" }) end, desc = "Config files" },
|
map('n', '<leader>fb', '<cmd>FzfLua buffers<cr>')
|
||||||
-- Quickfix/loclist
|
map('n', '<leader>fh', '<cmd>FzfLua help_tags<cr>')
|
||||||
{ "gq", function() require("fzf-lua").quickfix() end, desc = "Quickfix" },
|
map('n', '<leader>fr', '<cmd>FzfLua resume<cr>')
|
||||||
{ "gl", function() require("fzf-lua").loclist() end, desc = "Loclist" },
|
map('n', '<leader>fo', '<cmd>FzfLua oldfiles<cr>')
|
||||||
-- Git
|
map('n', '<leader>fc', '<cmd>FzfLua commands<cr>')
|
||||||
{ "<leader>GB", function() require("fzf-lua").git_branches() end, desc = "Git branches" },
|
map('n', '<leader>fk', '<cmd>FzfLua keymaps<cr>')
|
||||||
{ "<leader>Gc", function() require("fzf-lua").git_commits() end, desc = "Git commits" },
|
map('n', '<leader>f/', '<cmd>FzfLua search_history<cr>')
|
||||||
{ "<leader>Gs", function() require("fzf-lua").git_status() end, desc = "Git status" },
|
map('n', '<leader>f:', '<cmd>FzfLua command_history<cr>')
|
||||||
{ "<leader>Gp", function() gh_picker("pr", "open") end, desc = "GitHub PRs" },
|
map('n', '<leader>fe', '<cmd>FzfLua files cwd=~/.config<cr>')
|
||||||
{ "<leader>Gi", function() gh_picker("issue", "open") end, desc = "GitHub issues" },
|
map('n', 'gq', '<cmd>FzfLua quickfix<cr>')
|
||||||
},
|
map('n', 'gl', '<cmd>FzfLua loclist<cr>')
|
||||||
opts = {
|
map('n', '<leader>GB', '<cmd>FzfLua git_branches<cr>')
|
||||||
"default-title",
|
map('n', '<leader>Gc', '<cmd>FzfLua git_commits<cr>')
|
||||||
winopts = {
|
map('n', '<leader>Gs', '<cmd>FzfLua git_status<cr>')
|
||||||
border = "single",
|
map('n', '<leader>Gp', function() gh_picker('pr', 'open') end)
|
||||||
preview = {
|
map('n', '<leader>Gi', function() gh_picker('issue', 'open') end)
|
||||||
layout = "vertical",
|
end,
|
||||||
vertical = "down:50%",
|
opts = {
|
||||||
},
|
'default-title',
|
||||||
|
winopts = {
|
||||||
|
border = 'single',
|
||||||
|
preview = {
|
||||||
|
layout = 'vertical',
|
||||||
|
vertical = 'down:50%',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
fzf_opts = {
|
||||||
|
['--layout'] = 'reverse',
|
||||||
|
},
|
||||||
},
|
},
|
||||||
fzf_opts = {
|
|
||||||
["--layout"] = "reverse",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,114 +1,88 @@
|
||||||
local function current_file_location()
|
local function file_loc()
|
||||||
local root = vim.trim(vim.fn.system("git rev-parse --show-toplevel"))
|
local root = vim.trim(vim.fn.system('git rev-parse --show-toplevel'))
|
||||||
if vim.v.shell_error ~= 0 or root == "" then
|
if vim.v.shell_error ~= 0 or root == '' then
|
||||||
return nil
|
return nil
|
||||||
end
|
end
|
||||||
|
local path = vim.api.nvim_buf_get_name(0)
|
||||||
local path = vim.api.nvim_buf_get_name(0)
|
if path == '' or path:sub(1, #root + 1) ~= root .. '/' then
|
||||||
if path == "" then
|
return nil
|
||||||
return nil
|
end
|
||||||
end
|
return ('%s:%d'):format(path:sub(#root + 2), vim.fn.line('.'))
|
||||||
|
|
||||||
local prefix = root .. "/"
|
|
||||||
if path:sub(1, #prefix) ~= prefix then
|
|
||||||
return nil
|
|
||||||
end
|
|
||||||
|
|
||||||
local rel = path:sub(#prefix + 1)
|
|
||||||
return ("%s:%d"):format(rel, vim.fn.line("."))
|
|
||||||
end
|
end
|
||||||
|
|
||||||
local function gh_browse()
|
local function gh_browse()
|
||||||
if vim.fn.executable("gh") ~= 1 then
|
if vim.fn.executable('gh') ~= 1 then
|
||||||
vim.notify("gh CLI not found", vim.log.levels.WARN)
|
vim.notify('gh CLI not found', vim.log.levels.WARN)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
local loc = file_loc()
|
||||||
local loc = current_file_location()
|
if loc then
|
||||||
if loc then
|
vim.system({ 'gh', 'browse', loc })
|
||||||
vim.system({ "gh", "browse", loc })
|
else
|
||||||
return
|
vim.system({ 'gh', 'browse' })
|
||||||
end
|
end
|
||||||
vim.system({ "gh", "browse" })
|
|
||||||
end
|
end
|
||||||
|
|
||||||
return {
|
return {
|
||||||
-- Fugitive: The gold standard for Git in Vim
|
{
|
||||||
{
|
'tpope/vim-fugitive',
|
||||||
"tpope/vim-fugitive",
|
config = function()
|
||||||
cmd = { "Git", "G", "Gread", "Gwrite", "Gdiffsplit", "Gvdiffsplit", "Gblame" },
|
map('n', '<leader>gg', '<cmd>Git<cr><cmd>only<cr>')
|
||||||
keys = {
|
map('n', '<leader>gc', '<cmd>Git commit<cr>')
|
||||||
{ "<leader>gg", "<cmd>Git<cr><cmd>only<cr>", desc = "Git status (fullscreen)" },
|
map('n', '<leader>gp', '<cmd>Git push<cr>')
|
||||||
{ "<leader>gc", "<cmd>Git commit<cr>", desc = "Git commit" },
|
map('n', '<leader>gl', '<cmd>Git pull<cr>')
|
||||||
{ "<leader>gp", "<cmd>Git push<cr>", desc = "Git push" },
|
map('n', '<leader>gb', '<cmd>Git blame<cr>')
|
||||||
{ "<leader>gl", "<cmd>Git pull<cr>", desc = "Git pull" },
|
map('n', '<leader>gd', '<cmd>Gvdiffsplit<cr>')
|
||||||
{ "<leader>gb", "<cmd>Git blame<cr>", desc = "Git blame" },
|
map('n', '<leader>gr', '<cmd>Gread<cr>')
|
||||||
{ "<leader>gd", "<cmd>Gvdiffsplit<cr>", desc = "Git diff vertical" },
|
map('n', '<leader>gw', '<cmd>Gwrite<cr>')
|
||||||
{ "<leader>gr", "<cmd>Gread<cr>", desc = "Git checkout file" },
|
map({ 'n', 'v' }, '<leader>go', gh_browse)
|
||||||
{ "<leader>gw", "<cmd>Gwrite<cr>", desc = "Git add file" },
|
end,
|
||||||
{ "<leader>go", gh_browse, desc = "Open in GitHub" },
|
|
||||||
},
|
},
|
||||||
},
|
{
|
||||||
|
'lewis6991/gitsigns.nvim',
|
||||||
-- Gitsigns: Git info in the gutter
|
opts = {
|
||||||
{
|
signs = {
|
||||||
"lewis6991/gitsigns.nvim",
|
add = { text = '██' },
|
||||||
event = { "BufReadPre", "BufNewFile" },
|
change = { text = '██' },
|
||||||
opts = {
|
delete = { text = '▄▄' },
|
||||||
signs = {
|
topdelete = { text = '▀▀' },
|
||||||
add = { text = "██" },
|
changedelete = { text = '██' },
|
||||||
change = { text = "██" },
|
},
|
||||||
delete = { text = "▄▄" },
|
signs_staged = {
|
||||||
topdelete = { text = "▀▀" },
|
add = { text = '▓▓' },
|
||||||
changedelete = { text = "██" },
|
change = { text = '▓▓' },
|
||||||
},
|
delete = { text = '▄▄' },
|
||||||
signs_staged = {
|
topdelete = { text = '▀▀' },
|
||||||
add = { text = "▓▓" },
|
changedelete = { text = '▓▓' },
|
||||||
change = { text = "▓▓" },
|
},
|
||||||
delete = { text = "▄▄" },
|
signs_staged_enable = true,
|
||||||
topdelete = { text = "▀▀" },
|
|
||||||
changedelete = { text = "▓▓" },
|
|
||||||
},
|
|
||||||
signs_staged_enable = true,
|
|
||||||
signcolumn = true,
|
|
||||||
numhl = false,
|
|
||||||
linehl = false, -- disabled - let colorscheme handle
|
|
||||||
word_diff = false,
|
|
||||||
current_line_blame = false,
|
|
||||||
current_line_blame_opts = {
|
|
||||||
delay = 500,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
keys = {
|
|
||||||
{ "]g", "<cmd>Gitsigns next_hunk<cr>", desc = "Next hunk" },
|
|
||||||
{ "[g", "<cmd>Gitsigns prev_hunk<cr>", desc = "Prev hunk" },
|
|
||||||
{ "<leader>ghs", "<cmd>Gitsigns stage_hunk<cr>", desc = "Stage hunk" },
|
|
||||||
{ "<leader>ghr", "<cmd>Gitsigns reset_hunk<cr>", desc = "Reset hunk" },
|
|
||||||
{ "<leader>ghp", "<cmd>Gitsigns preview_hunk<cr>", desc = "Preview hunk" },
|
|
||||||
{ "<leader>gB", "<cmd>Gitsigns toggle_current_line_blame<cr>", desc = "Toggle line blame" },
|
|
||||||
},
|
|
||||||
},
|
|
||||||
|
|
||||||
-- Diffs.nvim: Better diff highlighting
|
|
||||||
{
|
|
||||||
"barrettruth/diffs.nvim",
|
|
||||||
lazy = false,
|
|
||||||
init = function()
|
|
||||||
vim.g.diffs = {
|
|
||||||
fugitive = {
|
|
||||||
enabled = true,
|
|
||||||
horizontal = false,
|
|
||||||
vertical = false,
|
|
||||||
},
|
},
|
||||||
hide_prefix = true,
|
config = function(_, opts)
|
||||||
highlights = {
|
require('gitsigns').setup(opts)
|
||||||
gutter = true,
|
map('n', ']g', '<cmd>Gitsigns next_hunk<cr>')
|
||||||
blend_alpha = 0.4,
|
map('n', '[g', '<cmd>Gitsigns prev_hunk<cr>')
|
||||||
intra = {
|
map('n', '<leader>ghs', '<cmd>Gitsigns stage_hunk<cr>')
|
||||||
enabled = true,
|
map('n', '<leader>ghr', '<cmd>Gitsigns reset_hunk<cr>')
|
||||||
},
|
map('n', '<leader>ghp', '<cmd>Gitsigns preview_hunk<cr>')
|
||||||
},
|
map('n', '<leader>gB', '<cmd>Gitsigns toggle_current_line_blame<cr>')
|
||||||
}
|
end,
|
||||||
end,
|
},
|
||||||
},
|
{
|
||||||
|
'barrettruth/diffs.nvim',
|
||||||
|
init = function()
|
||||||
|
vim.g.diffs = {
|
||||||
|
fugitive = {
|
||||||
|
enabled = true,
|
||||||
|
horizontal = false,
|
||||||
|
vertical = false,
|
||||||
|
},
|
||||||
|
hide_prefix = true,
|
||||||
|
highlights = {
|
||||||
|
gutter = true,
|
||||||
|
blend_alpha = 0.4,
|
||||||
|
intra = { enabled = true },
|
||||||
|
},
|
||||||
|
}
|
||||||
|
end,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,4 @@
|
||||||
return {
|
return {
|
||||||
{ "neovim/nvim-lspconfig", lazy = false },
|
'neovim/nvim-lspconfig',
|
||||||
|
lazy = false,
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,44 +1,40 @@
|
||||||
return {
|
return {
|
||||||
"stevearc/oil.nvim",
|
'stevearc/oil.nvim',
|
||||||
dependencies = { "nvim-tree/nvim-web-devicons", "malewicz1337/oil-git.nvim" },
|
dependencies = { 'nvim-tree/nvim-web-devicons', 'malewicz1337/oil-git.nvim' },
|
||||||
cmd = "Oil",
|
config = function(_, opts)
|
||||||
event = 'VeryLazy',
|
require('oil').setup(opts)
|
||||||
keys = {
|
require('oil-git').setup({
|
||||||
{ "-", "<cmd>Oil<cr>", desc = "Open parent directory" },
|
show_ignored_files = false,
|
||||||
{ "<leader>e", "<cmd>Oil<cr>", desc = "Open file explorer" },
|
show_ignored_directories = false,
|
||||||
},
|
debounce_ms = 300,
|
||||||
config = function(_, opts)
|
})
|
||||||
require("oil").setup(opts)
|
vim.api.nvim_create_autocmd('BufEnter', {
|
||||||
require("oil-git").setup({
|
callback = function()
|
||||||
show_ignored_files = false,
|
if vim.bo.filetype == '' then
|
||||||
show_ignored_directories = false,
|
local path = vim.fn.expand('%:p')
|
||||||
debounce_ms = 300,
|
if vim.fn.isdirectory(path) == 1 then
|
||||||
})
|
vim.cmd('Oil ' .. path)
|
||||||
vim.api.nvim_create_autocmd("BufEnter", {
|
end
|
||||||
pattern = "oil://*",
|
end
|
||||||
callback = function()
|
end,
|
||||||
local dir = require("oil").get_current_dir()
|
group = vim.api.nvim_create_augroup('AOil', { clear = true }),
|
||||||
if dir then
|
})
|
||||||
vim.cmd.lcd(dir)
|
map('n', '-', '<cmd>Oil<cr>')
|
||||||
end
|
map('n', '<leader>e', '<cmd>Oil<cr>')
|
||||||
end,
|
end,
|
||||||
})
|
opts = {
|
||||||
end,
|
default_file_explorer = true,
|
||||||
opts = {
|
columns = { 'icon' },
|
||||||
default_file_explorer = true, -- nvim . opens oil
|
view_options = { show_hidden = true },
|
||||||
columns = { "icon" },
|
keymaps = {
|
||||||
view_options = {
|
['g?'] = 'actions.show_help',
|
||||||
show_hidden = true,
|
['<CR>'] = 'actions.select',
|
||||||
|
['<C-v>'] = 'actions.select_vsplit',
|
||||||
|
['<C-x>'] = 'actions.select_split',
|
||||||
|
['<C-p>'] = 'actions.preview',
|
||||||
|
['<C-c>'] = 'actions.close',
|
||||||
|
['-'] = 'actions.parent',
|
||||||
|
['g.'] = 'actions.toggle_hidden',
|
||||||
|
},
|
||||||
},
|
},
|
||||||
keymaps = {
|
|
||||||
["g?"] = "actions.show_help",
|
|
||||||
["<CR>"] = "actions.select",
|
|
||||||
["<C-v>"] = "actions.select_vsplit",
|
|
||||||
["<C-x>"] = "actions.select_split",
|
|
||||||
["<C-p>"] = "actions.preview",
|
|
||||||
["<C-c>"] = "actions.close",
|
|
||||||
["-"] = "actions.parent",
|
|
||||||
["g."] = "actions.toggle_hidden",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,92 +1,61 @@
|
||||||
return {
|
return {
|
||||||
-- Treesitter for syntax highlighting and code understanding
|
{
|
||||||
{
|
'nvim-treesitter/nvim-treesitter',
|
||||||
"nvim-treesitter/nvim-treesitter",
|
build = ':TSUpdate',
|
||||||
build = ":TSUpdate",
|
dependencies = { 'nvim-treesitter/nvim-treesitter-textobjects' },
|
||||||
event = { "BufReadPost", "BufNewFile" },
|
config = function()
|
||||||
dependencies = {
|
require('nvim-treesitter.configs').setup({
|
||||||
"nvim-treesitter/nvim-treesitter-textobjects",
|
auto_install = true,
|
||||||
|
highlight = { enable = true },
|
||||||
|
indent = { enable = true },
|
||||||
|
textobjects = {
|
||||||
|
select = {
|
||||||
|
enable = true,
|
||||||
|
lookahead = true,
|
||||||
|
keymaps = {
|
||||||
|
['af'] = '@function.outer',
|
||||||
|
['if'] = '@function.inner',
|
||||||
|
['ac'] = '@class.outer',
|
||||||
|
['ic'] = '@class.inner',
|
||||||
|
['aa'] = '@parameter.outer',
|
||||||
|
['ia'] = '@parameter.inner',
|
||||||
|
['ai'] = '@conditional.outer',
|
||||||
|
['ii'] = '@conditional.inner',
|
||||||
|
['al'] = '@loop.outer',
|
||||||
|
['il'] = '@loop.inner',
|
||||||
|
['ab'] = '@block.outer',
|
||||||
|
['ib'] = '@block.inner',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
move = {
|
||||||
|
enable = true,
|
||||||
|
set_jumps = true,
|
||||||
|
goto_next_start = {
|
||||||
|
[']f'] = '@function.outer',
|
||||||
|
[']c'] = '@class.outer',
|
||||||
|
[']a'] = '@parameter.inner',
|
||||||
|
},
|
||||||
|
goto_next_end = {
|
||||||
|
[']F'] = '@function.outer',
|
||||||
|
[']C'] = '@class.outer',
|
||||||
|
},
|
||||||
|
goto_previous_start = {
|
||||||
|
['[f'] = '@function.outer',
|
||||||
|
['[c'] = '@class.outer',
|
||||||
|
['[a'] = '@parameter.inner',
|
||||||
|
},
|
||||||
|
goto_previous_end = {
|
||||||
|
['[F'] = '@function.outer',
|
||||||
|
['[C'] = '@class.outer',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
swap = {
|
||||||
|
enable = true,
|
||||||
|
swap_next = { ['<leader>sn'] = '@parameter.inner' },
|
||||||
|
swap_previous = { ['<leader>sp'] = '@parameter.inner' },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
end,
|
||||||
},
|
},
|
||||||
config = function()
|
|
||||||
require("nvim-treesitter.configs").setup({
|
|
||||||
ensure_installed = {
|
|
||||||
"lua",
|
|
||||||
"vim",
|
|
||||||
"vimdoc",
|
|
||||||
"query",
|
|
||||||
"javascript",
|
|
||||||
"typescript",
|
|
||||||
"tsx",
|
|
||||||
"python",
|
|
||||||
"html",
|
|
||||||
"css",
|
|
||||||
"json",
|
|
||||||
"yaml",
|
|
||||||
"markdown",
|
|
||||||
"markdown_inline",
|
|
||||||
"bash",
|
|
||||||
"regex",
|
|
||||||
},
|
|
||||||
auto_install = true,
|
|
||||||
highlight = {
|
|
||||||
enable = true,
|
|
||||||
additional_vim_regex_highlighting = false,
|
|
||||||
},
|
|
||||||
indent = {
|
|
||||||
enable = true,
|
|
||||||
},
|
|
||||||
textobjects = {
|
|
||||||
select = {
|
|
||||||
enable = true,
|
|
||||||
lookahead = true,
|
|
||||||
keymaps = {
|
|
||||||
["af"] = "@function.outer",
|
|
||||||
["if"] = "@function.inner",
|
|
||||||
["ac"] = "@class.outer",
|
|
||||||
["ic"] = "@class.inner",
|
|
||||||
["aa"] = "@parameter.outer",
|
|
||||||
["ia"] = "@parameter.inner",
|
|
||||||
["ai"] = "@conditional.outer",
|
|
||||||
["ii"] = "@conditional.inner",
|
|
||||||
["al"] = "@loop.outer",
|
|
||||||
["il"] = "@loop.inner",
|
|
||||||
["ab"] = "@block.outer",
|
|
||||||
["ib"] = "@block.inner",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
move = {
|
|
||||||
enable = true,
|
|
||||||
set_jumps = true,
|
|
||||||
goto_next_start = {
|
|
||||||
["]f"] = "@function.outer",
|
|
||||||
["]c"] = "@class.outer",
|
|
||||||
["]a"] = "@parameter.inner",
|
|
||||||
},
|
|
||||||
goto_next_end = {
|
|
||||||
["]F"] = "@function.outer",
|
|
||||||
["]C"] = "@class.outer",
|
|
||||||
},
|
|
||||||
goto_previous_start = {
|
|
||||||
["[f"] = "@function.outer",
|
|
||||||
["[c"] = "@class.outer",
|
|
||||||
["[a"] = "@parameter.inner",
|
|
||||||
},
|
|
||||||
goto_previous_end = {
|
|
||||||
["[F"] = "@function.outer",
|
|
||||||
["[C"] = "@class.outer",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
swap = {
|
|
||||||
enable = true,
|
|
||||||
swap_next = {
|
|
||||||
["<leader>sn"] = "@parameter.inner",
|
|
||||||
},
|
|
||||||
swap_previous = {
|
|
||||||
["<leader>sp"] = "@parameter.inner",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
})
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,146 +1,42 @@
|
||||||
return {
|
return {
|
||||||
-- Gruvbox colorscheme
|
{
|
||||||
{
|
'ellisonleao/gruvbox.nvim',
|
||||||
"ellisonleao/gruvbox.nvim",
|
|
||||||
lazy = false,
|
|
||||||
priority = 1000,
|
|
||||||
config = function()
|
|
||||||
require("gruvbox").setup({
|
|
||||||
terminal_colors = true,
|
|
||||||
undercurl = true,
|
|
||||||
underline = false,
|
|
||||||
bold = true,
|
|
||||||
italic = {
|
|
||||||
strings = false,
|
|
||||||
emphasis = false,
|
|
||||||
comments = true,
|
|
||||||
operators = false,
|
|
||||||
folds = false,
|
|
||||||
},
|
|
||||||
strikethrough = true,
|
|
||||||
invert_selection = false,
|
|
||||||
invert_signs = false,
|
|
||||||
invert_tabline = false,
|
|
||||||
invert_intend_guides = false,
|
|
||||||
inverse = true,
|
|
||||||
contrast = "hard",
|
|
||||||
palette_overrides = {},
|
|
||||||
overrides = {
|
|
||||||
MatchParen = { bold = true, underline = true, bg = "" },
|
|
||||||
},
|
|
||||||
dim_inactive = false,
|
|
||||||
transparent_mode = true,
|
|
||||||
})
|
|
||||||
vim.cmd.colorscheme("gruvbox")
|
|
||||||
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
|
|
||||||
-- Lualine statusline
|
|
||||||
{
|
|
||||||
"nvim-lualine/lualine.nvim",
|
|
||||||
lazy = false,
|
|
||||||
dependencies = { "nvim-tree/nvim-web-devicons" },
|
|
||||||
config = function()
|
|
||||||
require("lualine").setup({
|
|
||||||
options = {
|
|
||||||
theme = "gruvbox",
|
|
||||||
icons_enabled = false,
|
|
||||||
component_separators = "",
|
|
||||||
section_separators = "",
|
|
||||||
},
|
|
||||||
sections = {
|
|
||||||
lualine_a = { "mode" },
|
|
||||||
lualine_b = { "branch", "diff" },
|
|
||||||
lualine_c = { { "filename", path = 1 } },
|
|
||||||
lualine_x = { "diagnostics" },
|
|
||||||
lualine_y = { "filetype" },
|
|
||||||
lualine_z = { "location" },
|
|
||||||
},
|
|
||||||
})
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
|
|
||||||
-- Dashboard
|
|
||||||
{
|
|
||||||
"nvimdev/dashboard-nvim",
|
|
||||||
event = "VimEnter",
|
|
||||||
dependencies = { "nvim-tree/nvim-web-devicons" },
|
|
||||||
config = function()
|
|
||||||
local header_art = {
|
|
||||||
" ██▒ █▓ ██▓ ███▄ ▄███▓",
|
|
||||||
"▓██░ █▒▓██▒▓██▒▀█▀ ██▒",
|
|
||||||
" ▓██ █▒░▒██▒▓██ ▓██░",
|
|
||||||
" ▒██ █░░░██░▒██ ▒██ ",
|
|
||||||
" ▒▀█░ ░██░▒██▒ ░██▒",
|
|
||||||
" ░ ▐░ ░▓ ░ ▒░ ░ ░",
|
|
||||||
" ░ ░░ ▒ ░░ ░ ░",
|
|
||||||
" ░░ ▒ ░░ ░ ",
|
|
||||||
" ░ ░ ░ ",
|
|
||||||
" ░ ",
|
|
||||||
}
|
|
||||||
local center_items = 6
|
|
||||||
local content_height = #header_art + 2 + (center_items * 2)
|
|
||||||
local win_height = vim.fn.winheight(0)
|
|
||||||
local padding = math.max(0, math.floor((win_height - content_height) / 2))
|
|
||||||
|
|
||||||
local header = {}
|
|
||||||
for _ = 1, padding do
|
|
||||||
table.insert(header, "")
|
|
||||||
end
|
|
||||||
for _, line in ipairs(header_art) do
|
|
||||||
table.insert(header, line)
|
|
||||||
end
|
|
||||||
table.insert(header, "")
|
|
||||||
table.insert(header, "")
|
|
||||||
|
|
||||||
require("dashboard").setup({
|
|
||||||
theme = "doom",
|
|
||||||
config = {
|
|
||||||
header = header,
|
|
||||||
center = {
|
|
||||||
{
|
|
||||||
icon = " ",
|
|
||||||
desc = "Find File ",
|
|
||||||
key = "f",
|
|
||||||
action = function() require("fzf-lua").files() end,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
icon = " ",
|
|
||||||
desc = "Recent Files ",
|
|
||||||
key = "r",
|
|
||||||
action = function() require("fzf-lua").oldfiles() end,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
icon = " ",
|
|
||||||
desc = "Find Text ",
|
|
||||||
key = "g",
|
|
||||||
action = function() require("fzf-lua").live_grep() end,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
icon = " ",
|
|
||||||
desc = "File Explorer ",
|
|
||||||
key = "e",
|
|
||||||
action = function() vim.cmd("Oil") end,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
icon = " ",
|
|
||||||
desc = "Quit ",
|
|
||||||
key = "q",
|
|
||||||
action = function() vim.cmd("quit") end,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
footer = {},
|
|
||||||
},
|
|
||||||
})
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
|
|
||||||
-- Nonicons font icons for nvim-web-devicons
|
|
||||||
{
|
|
||||||
"barrettruth/nonicons.nvim",
|
|
||||||
lazy = false,
|
lazy = false,
|
||||||
dependencies = { "nvim-tree/nvim-web-devicons" },
|
priority = 1000,
|
||||||
},
|
config = function()
|
||||||
|
require('gruvbox').setup({
|
||||||
|
contrast = 'hard',
|
||||||
|
transparent_mode = true,
|
||||||
|
italic = { comments = true },
|
||||||
|
overrides = {
|
||||||
|
MatchParen = { bold = true, underline = true, bg = '' },
|
||||||
|
},
|
||||||
|
})
|
||||||
|
vim.cmd.colorscheme('gruvbox')
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'nvim-lualine/lualine.nvim',
|
||||||
|
dependencies = { 'nvim-tree/nvim-web-devicons' },
|
||||||
|
opts = {
|
||||||
|
options = {
|
||||||
|
theme = 'gruvbox',
|
||||||
|
icons_enabled = false,
|
||||||
|
component_separators = '',
|
||||||
|
section_separators = '',
|
||||||
|
},
|
||||||
|
sections = {
|
||||||
|
lualine_a = { 'mode' },
|
||||||
|
lualine_b = { 'branch', 'diff' },
|
||||||
|
lualine_c = { { 'filename', path = 1 } },
|
||||||
|
lualine_x = { 'diagnostics' },
|
||||||
|
lualine_y = { 'filetype' },
|
||||||
|
lualine_z = { 'location' },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'barrettruth/nonicons.nvim',
|
||||||
|
dependencies = { 'nvim-tree/nvim-web-devicons' },
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,38 +1,31 @@
|
||||||
-- Autocommands
|
|
||||||
local api = vim.api
|
local api = vim.api
|
||||||
local augroup = api.nvim_create_augroup("UserAutocmds", { clear = true })
|
local augroup = api.nvim_create_augroup('UserAutocmds', { clear = true })
|
||||||
|
|
||||||
-- Highlight on yank
|
api.nvim_create_autocmd('TextYankPost', {
|
||||||
api.nvim_create_autocmd("TextYankPost", {
|
group = augroup,
|
||||||
group = augroup,
|
callback = function()
|
||||||
callback = function()
|
vim.highlight.on_yank({ higroup = 'Visual', timeout = 200 })
|
||||||
vim.highlight.on_yank({ higroup = "Visual", timeout = 200 })
|
end,
|
||||||
end,
|
|
||||||
desc = "Highlight text on yank",
|
|
||||||
})
|
})
|
||||||
|
|
||||||
-- Restore cursor position on file open
|
api.nvim_create_autocmd('BufReadPost', {
|
||||||
api.nvim_create_autocmd("BufReadPost", {
|
group = augroup,
|
||||||
group = augroup,
|
callback = function()
|
||||||
callback = function()
|
if ({ gitcommit = true, gitrebase = true })[vim.bo.filetype] then
|
||||||
local excluded = { gitcommit = true, gitrebase = true }
|
return
|
||||||
if excluded[vim.bo.filetype] then return end
|
end
|
||||||
local mark = api.nvim_buf_get_mark(0, '"')
|
local mark = api.nvim_buf_get_mark(0, '"')
|
||||||
local line_count = api.nvim_buf_line_count(0)
|
if mark[1] > 0 and mark[1] <= api.nvim_buf_line_count(0) then
|
||||||
if mark[1] > 0 and mark[1] <= line_count then
|
pcall(api.nvim_win_set_cursor, 0, mark)
|
||||||
pcall(api.nvim_win_set_cursor, 0, mark)
|
end
|
||||||
end
|
end,
|
||||||
end,
|
|
||||||
desc = "Restore cursor position",
|
|
||||||
})
|
})
|
||||||
|
|
||||||
-- Auto-resize splits on VimResized
|
api.nvim_create_autocmd('VimResized', {
|
||||||
api.nvim_create_autocmd("VimResized", {
|
group = augroup,
|
||||||
group = augroup,
|
callback = function()
|
||||||
callback = function()
|
local tab = vim.fn.tabpagenr()
|
||||||
local current_tab = vim.fn.tabpagenr()
|
vim.cmd('tabdo wincmd =')
|
||||||
vim.cmd("tabdo wincmd =")
|
vim.cmd('tabnext ' .. tab)
|
||||||
vim.cmd("tabnext " .. current_tab)
|
end,
|
||||||
end,
|
|
||||||
desc = "Auto-resize splits",
|
|
||||||
})
|
})
|
||||||
|
|
|
||||||
|
|
@ -1,29 +1,21 @@
|
||||||
-- Keymaps using global map() helper
|
map('n', '<leader>w', '<cmd>w<cr>')
|
||||||
|
map('n', '<leader>q', '<cmd>q<cr>')
|
||||||
|
map('n', '<C-g>', '<cmd>Git<cr><cmd>only<cr>')
|
||||||
|
|
||||||
-- File operations
|
map('n', '<Tab>', '<cmd>bnext<cr>')
|
||||||
map("n", "<leader>w", "<cmd>w<cr>", { desc = "Save file" })
|
map('n', '<S-Tab>', '<cmd>bprev<cr>')
|
||||||
map("n", "<leader>q", "<cmd>q<cr>", { desc = "Quit" })
|
map('n', '<leader>x', '<cmd>bdelete<cr>')
|
||||||
map("n", "<C-g>", "<cmd>Git<cr><cmd>only<cr>", { desc = "Git status (fullscreen)" })
|
map('n', '<leader>b', '<cmd>enew<cr>')
|
||||||
|
|
||||||
-- Buffer navigation
|
map('n', '<C-h>', '<C-w>h')
|
||||||
map("n", "<Tab>", "<cmd>bnext<cr>", { desc = "Next buffer" })
|
map('n', '<C-j>', '<C-w>j')
|
||||||
map("n", "<S-Tab>", "<cmd>bprev<cr>", { desc = "Previous buffer" })
|
map('n', '<C-k>', '<C-w>k')
|
||||||
map("n", "<leader>x", "<cmd>bdelete<cr>", { desc = "Close buffer" })
|
map('n', '<C-l>', '<C-w>l')
|
||||||
map("n", "<leader>b", "<cmd>enew<cr>", { desc = "New buffer" })
|
|
||||||
|
|
||||||
-- Window navigation
|
map('n', 'J', 'mzJ`z')
|
||||||
map("n", "<C-h>", "<C-w>h", { desc = "Move to left window" })
|
map('x', 'x', '"_x')
|
||||||
map("n", "<C-j>", "<C-w>j", { desc = "Move to lower window" })
|
map('x', 'p', '"_dP')
|
||||||
map("n", "<C-k>", "<C-w>k", { desc = "Move to upper window" })
|
map('n', '<Esc>', '<cmd>nohlsearch<cr>')
|
||||||
map("n", "<C-l>", "<C-w>l", { desc = "Move to right window" })
|
map('n', '<leader>t', '<cmd>setlocal wrap!<cr>')
|
||||||
|
|
||||||
-- Better defaults
|
map('t', '<Esc>', '<C-\\><C-n>')
|
||||||
map("n", "J", "mzJ`z", { desc = "Join lines keeping cursor position" })
|
|
||||||
map("x", "x", '"_x', { desc = "Delete char without yanking" })
|
|
||||||
map("x", "p", '"_dP', { desc = "Paste without yanking replaced text" })
|
|
||||||
map("n", "<Esc>", "<cmd>nohlsearch<cr>", { desc = "Clear search highlight" })
|
|
||||||
map("n", "<leader>t", "<cmd>setlocal wrap!<cr>", { desc = "Toggle word wrap" })
|
|
||||||
|
|
||||||
|
|
||||||
-- Terminal
|
|
||||||
map("t", "<Esc>", "<C-\\><C-n>", { desc = "Exit terminal mode" })
|
|
||||||
|
|
|
||||||
|
|
@ -1,52 +1,42 @@
|
||||||
-- Vim options
|
|
||||||
local o, opt = vim.o, vim.opt
|
local o, opt = vim.o, vim.opt
|
||||||
|
|
||||||
-- Line numbers
|
|
||||||
o.number = true
|
o.number = true
|
||||||
o.relativenumber = true
|
o.relativenumber = true
|
||||||
|
|
||||||
-- Indentation
|
|
||||||
o.tabstop = 2
|
o.tabstop = 2
|
||||||
o.shiftwidth = 2
|
o.shiftwidth = 2
|
||||||
o.expandtab = true
|
o.expandtab = true
|
||||||
o.smartindent = true
|
o.smartindent = true
|
||||||
o.breakindent = true
|
o.breakindent = true
|
||||||
|
|
||||||
-- Search
|
|
||||||
o.ignorecase = true
|
o.ignorecase = true
|
||||||
o.smartcase = true
|
o.smartcase = true
|
||||||
o.hlsearch = false
|
o.hlsearch = false
|
||||||
o.incsearch = true
|
o.incsearch = true
|
||||||
|
|
||||||
-- UI
|
|
||||||
o.termguicolors = true
|
o.termguicolors = true
|
||||||
o.cursorline = false
|
|
||||||
o.scrolloff = 8
|
o.scrolloff = 8
|
||||||
o.signcolumn = "yes:2"
|
o.signcolumn = 'yes'
|
||||||
o.wrap = false
|
o.wrap = false
|
||||||
o.showmode = false
|
o.showmode = false
|
||||||
o.laststatus = 3
|
o.laststatus = 3
|
||||||
o.cmdheight = 0
|
o.cmdheight = 0
|
||||||
|
|
||||||
opt.fillchars = { vert = "│", fold = "─", foldsep = "│", diff = "─" }
|
opt.fillchars = { vert = '|', fold = '-', foldsep = '|', diff = '-' }
|
||||||
opt.shortmess:append("S")
|
opt.shortmess:append('S')
|
||||||
|
|
||||||
-- Splits
|
|
||||||
o.splitbelow = true
|
o.splitbelow = true
|
||||||
o.splitright = true
|
o.splitright = true
|
||||||
|
|
||||||
-- Files
|
|
||||||
o.swapfile = false
|
o.swapfile = false
|
||||||
o.backup = false
|
o.backup = false
|
||||||
o.undofile = true
|
o.undofile = true
|
||||||
o.undodir = vim.fn.stdpath("data") .. "/undo"
|
o.undodir = vim.fn.stdpath('data') .. '/undo'
|
||||||
|
|
||||||
-- Folds (nvim-ufo)
|
|
||||||
o.foldlevel = 99
|
o.foldlevel = 99
|
||||||
o.foldlevelstart = 99
|
o.foldlevelstart = 99
|
||||||
o.foldenable = true
|
o.foldenable = true
|
||||||
|
|
||||||
-- Misc
|
|
||||||
o.updatetime = 250
|
o.updatetime = 250
|
||||||
o.mouse = "a"
|
o.mouse = 'a'
|
||||||
o.clipboard = "unnamedplus"
|
o.clipboard = 'unnamedplus'
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue