clean config

This commit is contained in:
Harivansh Rathi 2026-02-20 22:34:08 -05:00
parent 1db6db7f92
commit 25aded9685
19 changed files with 468 additions and 852 deletions

View file

@ -1,31 +1,21 @@
-- Shared LSP utilities
local M = {}
-- Set up buffer-local keymaps when LSP attaches
function M.on_attach(client, bufnr)
local opts = { buffer = bufnr, silent = true }
function M.on_attach(_, bufnr)
local function buf(mode, lhs, rhs)
bmap(mode, lhs, rhs, { buffer = bufnr })
end
-- Navigation
vim.keymap.set("n", "gd", vim.lsp.buf.definition, vim.tbl_extend("force", opts, { desc = "Go to definition" }))
vim.keymap.set("n", "gD", vim.lsp.buf.declaration, vim.tbl_extend("force", opts, { desc = "Go to declaration" }))
vim.keymap.set("n", "<C-]>", vim.lsp.buf.definition, vim.tbl_extend("force", opts, { desc = "Go to definition" }))
vim.keymap.set("n", "gi", vim.lsp.buf.implementation, vim.tbl_extend("force", opts, { desc = "Go to implementation" }))
vim.keymap.set("n", "gr", vim.lsp.buf.references, vim.tbl_extend("force", opts, { desc = "Go to references" }))
-- Documentation
vim.keymap.set("n", "K", vim.lsp.buf.hover, vim.tbl_extend("force", opts, { desc = "Hover documentation" }))
-- 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" }))
buf('n', 'gd', vim.lsp.buf.definition)
buf('n', 'gD', vim.lsp.buf.declaration)
buf('n', '<C-]>', vim.lsp.buf.definition)
buf('n', 'gi', vim.lsp.buf.implementation)
buf('n', 'gr', vim.lsp.buf.references)
buf('n', 'K', vim.lsp.buf.hover)
buf('n', '<leader>rn', vim.lsp.buf.rename)
buf({ 'n', 'v' }, '<leader>ca', vim.lsp.buf.code_action)
buf('n', '<leader>f', function() vim.lsp.buf.format({ async = true }) end)
end
-- Return default capabilities for LSP servers
function M.capabilities()
return vim.lsp.protocol.make_client_capabilities()
end

View file

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

View file

@ -1,25 +1,14 @@
-- Lua language server configuration
return {
settings = {
Lua = {
diagnostics = {
globals = { "vim" },
},
runtime = {
version = "LuaJIT",
},
diagnostics = { globals = { 'vim' } },
runtime = { version = 'LuaJIT' },
workspace = {
checkThirdParty = false,
library = {
vim.env.VIMRUNTIME,
},
},
telemetry = {
enable = false,
},
hint = {
enable = true,
library = { vim.env.VIMRUNTIME },
},
telemetry = { enable = false },
hint = { enable = true },
},
},
}

View file

@ -1,12 +1,11 @@
-- Pyright (Python) language server configuration
return {
settings = {
python = {
analysis = {
typeCheckingMode = "basic",
typeCheckingMode = 'basic',
autoSearchPaths = true,
useLibraryCodeForTypes = true,
diagnosticMode = "workspace",
diagnosticMode = 'workspace',
},
},
},

View file

@ -1,25 +1,16 @@
-- Rust Analyzer configuration with clippy integration
return {
settings = {
["rust-analyzer"] = {
checkOnSave = {
command = "clippy",
},
cargo = {
allFeatures = true,
},
procMacro = {
enable = true,
},
diagnostics = {
enable = true,
},
['rust-analyzer'] = {
checkOnSave = { command = 'clippy' },
cargo = { allFeatures = true },
procMacro = { enable = true },
diagnostics = { enable = true },
inlayHints = {
bindingModeHints = { enable = true },
chainingHints = { enable = true },
closingBraceHints = { enable = true },
closureReturnTypeHints = { enable = "always" },
lifetimeElisionHints = { enable = "always" },
closureReturnTypeHints = { enable = 'always' },
lifetimeElisionHints = { enable = 'always' },
parameterHints = { enable = true },
typeHints = { enable = true },
},

View file

@ -1,9 +1,8 @@
-- TypeScript language server configuration
return {
settings = {
typescript = {
inlayHints = {
includeInlayParameterNameHints = "all",
includeInlayParameterNameHints = 'all',
includeInlayParameterNameHintsWhenArgumentMatchesName = false,
includeInlayFunctionParameterTypeHints = true,
includeInlayVariableTypeHints = true,
@ -14,7 +13,7 @@ return {
},
javascript = {
inlayHints = {
includeInlayParameterNameHints = "all",
includeInlayParameterNameHints = 'all',
includeInlayParameterNameHintsWhenArgumentMatchesName = false,
includeInlayFunctionParameterTypeHints = true,
includeInlayVariableTypeHints = true,

View file

@ -1,78 +1,53 @@
return {
-- Autopairs
{
"windwp/nvim-autopairs",
event = "InsertEnter",
config = function()
require("nvim-autopairs").setup({})
end,
},
-- Flash.nvim for navigation
{
"folke/flash.nvim",
event = "VeryLazy",
opts = {
modes = {
search = {
enabled = true,
{
'windwp/nvim-autopairs',
config = true,
},
{
'folke/flash.nvim',
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" },
{ "S", mode = { "n", "x", "o" }, function() require("flash").treesitter() end, desc = "Flash Treesitter" },
{ "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" },
{
'kylechui/nvim-surround',
config = true,
},
},
-- Surround
{
"kylechui/nvim-surround",
version = "*",
event = "VeryLazy",
opts = {},
},
-- Folds
{
"kevinhwang91/nvim-ufo",
dependencies = { "kevinhwang91/promise-async" },
event = "BufReadPost",
opts = {
provider_selector = function()
return { "treesitter", "indent" }
end,
{
'kevinhwang91/nvim-ufo',
dependencies = { 'kevinhwang91/promise-async' },
opts = {
provider_selector = function()
return { 'treesitter', 'indent' }
end,
},
config = function(_, opts)
require('ufo').setup(opts)
map('n', 'zR', require('ufo').openAllFolds)
map('n', 'zM', require('ufo').closeAllFolds)
end,
},
keys = {
{ "zR", function() require("ufo").openAllFolds() end, desc = "Open all folds" },
{ "zM", function() require("ufo").closeAllFolds() end, desc = "Close all folds" },
{
'supermaven-inc/supermaven-nvim',
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,
},
},
}

View file

@ -1,82 +1,74 @@
---@param kind 'issue'|'pr'
---@param state 'all'|'open'|'closed'
local function gh_picker(kind, state)
if vim.fn.executable("gh") ~= 1 then
vim.notify("gh CLI not found", vim.log.levels.WARN)
return
end
local next_state = ({ all = "open", open = "closed", closed = "all" })[state]
local label = kind == "pr" and "PRs" or "Issues"
require("fzf-lua").fzf_exec(("gh %s list --limit 100 --state %s"):format(kind, state), {
prompt = ("%s (%s)> "):format(label, state),
header = ":: <c-o> to toggle all/open/closed",
actions = {
["default"] = function(selected)
local num = selected[1]:match("^#?(%d+)")
if num then
vim.system({ "gh", kind, "view", num, "--web" })
end
end,
["ctrl-o"] = function()
gh_picker(kind, next_state)
end,
},
})
if vim.fn.executable('gh') ~= 1 then
vim.notify('gh CLI not found', vim.log.levels.WARN)
return
end
local next_state = ({ all = 'open', open = 'closed', closed = 'all' })[state]
local label = kind == 'pr' and 'PRs' or 'Issues'
require('fzf-lua').fzf_exec(('gh %s list --limit 100 --state %s'):format(kind, state), {
prompt = ('%s (%s)> '):format(label, state),
header = ':: <c-o> to toggle all/open/closed',
actions = {
['default'] = function(selected)
local num = selected[1]:match('^#?(%d+)')
if num then
vim.system({ 'gh', kind, 'view', num, '--web' })
end
end,
['ctrl-o'] = function()
gh_picker(kind, next_state)
end,
},
})
end
return {
"ibhagwan/fzf-lua",
dependencies = { "nvim-tree/nvim-web-devicons" },
cmd = "FzfLua",
keys = {
-- 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",
},
'ibhagwan/fzf-lua',
dependencies = { 'nvim-tree/nvim-web-devicons' },
config = function(_, opts)
require('fzf-lua').setup(opts)
-- Leader keybinds
{ "<leader>ff", function() require("fzf-lua").files() end, desc = "Files" },
{ "<leader>fg", function() require("fzf-lua").live_grep() end, desc = "Live grep" },
{ "<leader>fb", function() require("fzf-lua").buffers() end, desc = "Buffers" },
{ "<leader>fh", function() require("fzf-lua").help_tags() end, desc = "Help tags" },
{ "<leader>fr", function() require("fzf-lua").resume() end, desc = "Resume last search" },
{ "<leader>fo", function() require("fzf-lua").oldfiles() end, desc = "Recent files" },
{ "<leader>fc", function() require("fzf-lua").commands() end, desc = "Commands" },
{ "<leader>fk", function() require("fzf-lua").keymaps() end, desc = "Keymaps" },
{ "<leader>f/", function() require("fzf-lua").search_history() end, desc = "Search history" },
{ "<leader>f:", function() require("fzf-lua").command_history() end, desc = "Command history" },
{ "<leader>fe", function() require("fzf-lua").files({ cwd = "~/.config" }) end, desc = "Config files" },
-- Quickfix/loclist
{ "gq", function() require("fzf-lua").quickfix() end, desc = "Quickfix" },
{ "gl", function() require("fzf-lua").loclist() end, desc = "Loclist" },
-- Git
{ "<leader>GB", function() require("fzf-lua").git_branches() end, desc = "Git branches" },
{ "<leader>Gc", function() require("fzf-lua").git_commits() end, desc = "Git commits" },
{ "<leader>Gs", function() require("fzf-lua").git_status() end, desc = "Git status" },
{ "<leader>Gp", function() gh_picker("pr", "open") end, desc = "GitHub PRs" },
{ "<leader>Gi", function() gh_picker("issue", "open") end, desc = "GitHub issues" },
},
opts = {
"default-title",
winopts = {
border = "single",
preview = {
layout = "vertical",
vertical = "down:50%",
},
map('n', '<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)
map('n', '<leader>ff', '<cmd>FzfLua files<cr>')
map('n', '<leader>fg', '<cmd>FzfLua live_grep<cr>')
map('n', '<leader>fb', '<cmd>FzfLua buffers<cr>')
map('n', '<leader>fh', '<cmd>FzfLua help_tags<cr>')
map('n', '<leader>fr', '<cmd>FzfLua resume<cr>')
map('n', '<leader>fo', '<cmd>FzfLua oldfiles<cr>')
map('n', '<leader>fc', '<cmd>FzfLua commands<cr>')
map('n', '<leader>fk', '<cmd>FzfLua keymaps<cr>')
map('n', '<leader>f/', '<cmd>FzfLua search_history<cr>')
map('n', '<leader>f:', '<cmd>FzfLua command_history<cr>')
map('n', '<leader>fe', '<cmd>FzfLua files cwd=~/.config<cr>')
map('n', 'gq', '<cmd>FzfLua quickfix<cr>')
map('n', 'gl', '<cmd>FzfLua loclist<cr>')
map('n', '<leader>GB', '<cmd>FzfLua git_branches<cr>')
map('n', '<leader>Gc', '<cmd>FzfLua git_commits<cr>')
map('n', '<leader>Gs', '<cmd>FzfLua git_status<cr>')
map('n', '<leader>Gp', function() gh_picker('pr', 'open') end)
map('n', '<leader>Gi', function() gh_picker('issue', 'open') end)
end,
opts = {
'default-title',
winopts = {
border = 'single',
preview = {
layout = 'vertical',
vertical = 'down:50%',
},
},
fzf_opts = {
['--layout'] = 'reverse',
},
},
fzf_opts = {
["--layout"] = "reverse",
},
},
}

View file

@ -1,114 +1,88 @@
local function current_file_location()
local root = vim.trim(vim.fn.system("git rev-parse --show-toplevel"))
if vim.v.shell_error ~= 0 or root == "" then
return nil
end
local path = vim.api.nvim_buf_get_name(0)
if path == "" then
return nil
end
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("."))
local function file_loc()
local root = vim.trim(vim.fn.system('git rev-parse --show-toplevel'))
if vim.v.shell_error ~= 0 or root == '' then
return nil
end
local path = vim.api.nvim_buf_get_name(0)
if path == '' or path:sub(1, #root + 1) ~= root .. '/' then
return nil
end
return ('%s:%d'):format(path:sub(#root + 2), vim.fn.line('.'))
end
local function gh_browse()
if vim.fn.executable("gh") ~= 1 then
vim.notify("gh CLI not found", vim.log.levels.WARN)
return
end
local loc = current_file_location()
if loc then
vim.system({ "gh", "browse", loc })
return
end
vim.system({ "gh", "browse" })
if vim.fn.executable('gh') ~= 1 then
vim.notify('gh CLI not found', vim.log.levels.WARN)
return
end
local loc = file_loc()
if loc then
vim.system({ 'gh', 'browse', loc })
else
vim.system({ 'gh', 'browse' })
end
end
return {
-- Fugitive: The gold standard for Git in Vim
{
"tpope/vim-fugitive",
cmd = { "Git", "G", "Gread", "Gwrite", "Gdiffsplit", "Gvdiffsplit", "Gblame" },
keys = {
{ "<leader>gg", "<cmd>Git<cr><cmd>only<cr>", desc = "Git status (fullscreen)" },
{ "<leader>gc", "<cmd>Git commit<cr>", desc = "Git commit" },
{ "<leader>gp", "<cmd>Git push<cr>", desc = "Git push" },
{ "<leader>gl", "<cmd>Git pull<cr>", desc = "Git pull" },
{ "<leader>gb", "<cmd>Git blame<cr>", desc = "Git blame" },
{ "<leader>gd", "<cmd>Gvdiffsplit<cr>", desc = "Git diff vertical" },
{ "<leader>gr", "<cmd>Gread<cr>", desc = "Git checkout file" },
{ "<leader>gw", "<cmd>Gwrite<cr>", desc = "Git add file" },
{ "<leader>go", gh_browse, desc = "Open in GitHub" },
{
'tpope/vim-fugitive',
config = function()
map('n', '<leader>gg', '<cmd>Git<cr><cmd>only<cr>')
map('n', '<leader>gc', '<cmd>Git commit<cr>')
map('n', '<leader>gp', '<cmd>Git push<cr>')
map('n', '<leader>gl', '<cmd>Git pull<cr>')
map('n', '<leader>gb', '<cmd>Git blame<cr>')
map('n', '<leader>gd', '<cmd>Gvdiffsplit<cr>')
map('n', '<leader>gr', '<cmd>Gread<cr>')
map('n', '<leader>gw', '<cmd>Gwrite<cr>')
map({ 'n', 'v' }, '<leader>go', gh_browse)
end,
},
},
-- Gitsigns: Git info in the gutter
{
"lewis6991/gitsigns.nvim",
event = { "BufReadPre", "BufNewFile" },
opts = {
signs = {
add = { text = "██" },
change = { text = "██" },
delete = { text = "▄▄" },
topdelete = { text = "▀▀" },
changedelete = { text = "██" },
},
signs_staged = {
add = { text = "▓▓" },
change = { text = "▓▓" },
delete = { text = "▄▄" },
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,
{
'lewis6991/gitsigns.nvim',
opts = {
signs = {
add = { text = '██' },
change = { text = '██' },
delete = { text = '▄▄' },
topdelete = { text = '▀▀' },
changedelete = { text = '██' },
},
signs_staged = {
add = { text = '▓▓' },
change = { text = '▓▓' },
delete = { text = '▄▄' },
topdelete = { text = '▀▀' },
changedelete = { text = '▓▓' },
},
signs_staged_enable = true,
},
hide_prefix = true,
highlights = {
gutter = true,
blend_alpha = 0.4,
intra = {
enabled = true,
},
},
}
end,
},
config = function(_, opts)
require('gitsigns').setup(opts)
map('n', ']g', '<cmd>Gitsigns next_hunk<cr>')
map('n', '[g', '<cmd>Gitsigns prev_hunk<cr>')
map('n', '<leader>ghs', '<cmd>Gitsigns stage_hunk<cr>')
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,
},
{
'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,
},
}

View file

@ -1,3 +1,4 @@
return {
{ "neovim/nvim-lspconfig", lazy = false },
'neovim/nvim-lspconfig',
lazy = false,
}

View file

@ -1,44 +1,40 @@
return {
"stevearc/oil.nvim",
dependencies = { "nvim-tree/nvim-web-devicons", "malewicz1337/oil-git.nvim" },
cmd = "Oil",
event = 'VeryLazy',
keys = {
{ "-", "<cmd>Oil<cr>", desc = "Open parent directory" },
{ "<leader>e", "<cmd>Oil<cr>", desc = "Open file explorer" },
},
config = function(_, opts)
require("oil").setup(opts)
require("oil-git").setup({
show_ignored_files = false,
show_ignored_directories = false,
debounce_ms = 300,
})
vim.api.nvim_create_autocmd("BufEnter", {
pattern = "oil://*",
callback = function()
local dir = require("oil").get_current_dir()
if dir then
vim.cmd.lcd(dir)
end
end,
})
end,
opts = {
default_file_explorer = true, -- nvim . opens oil
columns = { "icon" },
view_options = {
show_hidden = true,
'stevearc/oil.nvim',
dependencies = { 'nvim-tree/nvim-web-devicons', 'malewicz1337/oil-git.nvim' },
config = function(_, opts)
require('oil').setup(opts)
require('oil-git').setup({
show_ignored_files = false,
show_ignored_directories = false,
debounce_ms = 300,
})
vim.api.nvim_create_autocmd('BufEnter', {
callback = function()
if vim.bo.filetype == '' then
local path = vim.fn.expand('%:p')
if vim.fn.isdirectory(path) == 1 then
vim.cmd('Oil ' .. path)
end
end
end,
group = vim.api.nvim_create_augroup('AOil', { clear = true }),
})
map('n', '-', '<cmd>Oil<cr>')
map('n', '<leader>e', '<cmd>Oil<cr>')
end,
opts = {
default_file_explorer = true,
columns = { 'icon' },
view_options = { show_hidden = true },
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',
},
},
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",
},
},
}

View file

@ -1,92 +1,61 @@
return {
-- Treesitter for syntax highlighting and code understanding
{
"nvim-treesitter/nvim-treesitter",
build = ":TSUpdate",
event = { "BufReadPost", "BufNewFile" },
dependencies = {
"nvim-treesitter/nvim-treesitter-textobjects",
{
'nvim-treesitter/nvim-treesitter',
build = ':TSUpdate',
dependencies = { 'nvim-treesitter/nvim-treesitter-textobjects' },
config = function()
require('nvim-treesitter.configs').setup({
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,
},
}

View file

@ -1,146 +1,42 @@
return {
-- Gruvbox colorscheme
{
"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",
{
'ellisonleao/gruvbox.nvim',
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' },
},
}