- TMUX: Switched back to ctrl+b as leader

- VIM: Configurations better commented
- NVIM: NVChad, LazyNvim, Old-Config removed
- NVIM: Restarted and reconfigured from kickstart.nvim [WIP]
- Dotfiles on $HOME removed from 160+ to 25. Most of them moved to $XDG_* directories
- Shell: Added back p10k config
- Shell: Autoremove brew left over applications
- Kitty: Added bashrc & profiles for ssh kitten
- Kitty: Custom tab-titles
This commit is contained in:
Pratik Tripathy
2024-01-29 22:35:58 +05:30
parent 0d0620be00
commit 5fa524dd1d
69 changed files with 2984 additions and 1755 deletions

View File

@@ -0,0 +1,94 @@
return {
{
-- Autocompletion
"hrsh7th/nvim-cmp",
dependencies = {
-- Snippet Engine & its associated nvim-cmp source
"L3MON4D3/LuaSnip",
"saadparwaiz1/cmp_luasnip",
-- Adds LSP completion capabilities
"hrsh7th/cmp-nvim-lsp",
"hrsh7th/cmp-path",
-- Adds a number of user-friendly snippets
"rafamadriz/friendly-snippets",
-- Autocompletion for commands
"hrsh7th/cmp-cmdline",
},
config = function()
-- [[ Configure nvim-cmp ]]
-- See `:help cmp`
local cmp = require("cmp")
local luasnip = require("luasnip")
require("luasnip.loaders.from_vscode").lazy_load()
luasnip.config.setup({})
cmp.setup({
snippet = {
expand = function(args)
luasnip.lsp_expand(args.body)
end,
},
completion = {
completeopt = "menu,menuone,noinsert",
},
mapping = cmp.mapping.preset.insert({
["<C-n>"] = cmp.mapping.select_next_item(),
["<C-p>"] = cmp.mapping.select_prev_item(),
["<C-b>"] = cmp.mapping.scroll_docs(-4),
["<C-f>"] = cmp.mapping.scroll_docs(4),
["<C-Space>"] = cmp.mapping.complete({}),
["<CR>"] = cmp.mapping.confirm({
behavior = cmp.ConfirmBehavior.Replace,
select = true,
}),
["<Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_next_item()
elseif luasnip.expand_or_locally_jumpable() then
luasnip.expand_or_jump()
else
fallback()
end
end, { "i", "s" }),
["<S-Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_prev_item()
elseif luasnip.locally_jumpable(-1) then
luasnip.jump(-1)
else
fallback()
end
end, { "i", "s" }),
}),
sources = {
{ name = "nvim_lsp" },
{ name = "luasnip" },
{ name = "path" },
},
})
cmp.setup.cmdline("/", {
mapping = cmp.mapping.preset.cmdline(),
sources = {
{ name = "buffer" },
}
})
cmp.setup.cmdline(":", {
mapping = cmp.mapping.preset.cmdline(),
sources = cmp.config.sources({
{ name = "path" },
}, {
{
name = "cmdline",
option = {
ignore_cmds = { "Man", "!" }
}
}
})
})
end
},
}

View File

@@ -1,81 +0,0 @@
return {
-- Auto completion
{
"hrsh7th/nvim-cmp",
opts = function()
vim.api.nvim_set_hl(0, "CmpGhostText", { link = "Comment", default = true })
local cmp = require("cmp")
local defaults = require("cmp.config.default")()
return {
completion = {
completeopt = "menu,menuone,noinsert",
},
snippet = {
expand = function(args)
require("luasnip").lsp_expand(args.body)
end,
},
mapping = cmp.mapping.preset.insert({
["<C-n>"] = cmp.mapping.select_next_item({ behavior = cmp.SelectBehavior.Insert }),
["<C-p>"] = cmp.mapping.select_prev_item({ behavior = cmp.SelectBehavior.Insert }),
["<C-d>"] = cmp.mapping.scroll_docs(-4),
["<C-u>"] = cmp.mapping.scroll_docs(4),
["<C-Space>"] = cmp.mapping.complete(),
["<C-x>"] = cmp.mapping.abort(),
["<CR>"] = cmp.mapping.confirm({ select = true }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items.
["<S-CR>"] = cmp.mapping.confirm({
behavior = cmp.ConfirmBehavior.Replace,
select = true,
}), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items.
["<C-CR>"] = function(fallback)
cmp.abort()
fallback()
end,
}),
sources = cmp.config.sources({
{ name = "nvim_lsp" },
{ name = "path" },
{ name = "luasnip" },
}, {
{ name = "buffer" },
}),
formatting = {
format = function(_, item)
local icons = require("lazyvim.config").icons.kinds
if icons[item.kind] then
item.kind = icons[item.kind] .. item.kind
end
return item
end,
},
experimental = {
ghost_text = {
hl_group = "CmpGhostText",
},
},
sorting = defaults.sorting,
}
end,
},
-- Snippets
{
"L3MON4D3/LuaSnip",
-- stylua: ignore
keys = {
{
"<tab>",
function()
return require("luasnip").jumpable(1) and "<Plug>luasnip-jump-next" or "<tab>"
end,
expr = true, silent = true, mode = "i",
},
{ "<tab>", function() require("luasnip").jump(1) end, mode = "s" },
{ "<s-tab>", function() require("luasnip").jump(-1) end, mode = { "i", "s" } },
},
},
-- VSCode like Snippets
{ "rafamadriz/friendly-snippets" },
}

View File

@@ -1,68 +0,0 @@
return {
{ "Hoffs/omnisharp-extended-lsp.nvim" },
{
"nvim-treesitter/nvim-treesitter",
opts = function(_, opts)
if type(opts.ensure_installed) == "table" then
vim.list_extend(opts.ensure_installed, { "c_sharp" })
end
end,
},
{
"nvimtools/none-ls.nvim",
optional = true,
opts = function(_, opts)
local nls = require("null-ls")
opts.sources = opts.sources or {}
table.insert(opts.sources, nls.builtins.formatting.csharpier)
end,
},
{
"stevearc/conform.nvim",
optional = true,
opts = {
formatters_by_ft = {
cs = { "csharpier" },
},
formatters = {
csharpier = {
command = "dotnet-csharpier",
args = { "--write-stdout" },
},
},
},
},
{
"williamboman/mason.nvim",
opts = function(_, opts)
opts.ensure_installed = opts.ensure_installed or {}
table.insert(opts.ensure_installed, "csharpier")
end,
},
{
"neovim/nvim-lspconfig",
opts = {
servers = {
omnisharp = {
handlers = {
["textDocument/definition"] = function(...)
return require("omnisharp_extended").handler(...)
end,
},
keys = {
{
"gd",
function()
require("omnisharp_extended").telescope_lsp_definitions()
end,
desc = "Goto Definition",
},
},
enable_roslyn_analyzers = true,
organize_imports_on_format = true,
enable_import_completion = true,
},
},
},
},
}

View File

@@ -0,0 +1,85 @@
-- debug.lua
--
-- Shows how to use the DAP plugin to debug your code.
--
-- Primarily focused on configuring the debugger for Go, but can
-- be extended to other languages as well. That's why it's called
-- kickstart.nvim and not kitchen-sink.nvim ;)
return {
"mfussenegger/nvim-dap",
dependencies = {
-- Creates a beautiful debugger UI
"rcarriga/nvim-dap-ui",
-- Installs the debug adapters for you
"williamboman/mason.nvim",
"jay-babu/mason-nvim-dap.nvim",
-- Add your own debuggers here
"leoluz/nvim-dap-go",
},
config = function()
local dap = require("dap")
local dapui = require("dapui")
require("mason-nvim-dap").setup({
-- Makes a best effort to setup the various debuggers with
-- reasonable debug configurations
automatic_setup = true,
-- You can provide additional configuration to the handlers,
-- see mason-nvim-dap README for more information
handlers = {},
-- You'll need to check that you have the required things installed
-- online, please don't ask me how to install them :)
ensure_installed = {
-- Update this to ensure that you have the debuggers for the langs you want
"delve",
},
})
-- Basic debugging keymaps, feel free to change to your liking!
vim.keymap.set("n", "<F5>", dap.continue, { desc = "Debug: Start/Continue" })
vim.keymap.set("n", "<F1>", dap.step_into, { desc = "Debug: Step Into" })
vim.keymap.set("n", "<F2>", dap.step_over, { desc = "Debug: Step Over" })
vim.keymap.set("n", "<F3>", dap.step_out, { desc = "Debug: Step Out" })
vim.keymap.set("n", "<leader>b", dap.toggle_breakpoint, { desc = "Debug: Toggle Breakpoint" })
vim.keymap.set("n", "<leader>B", function()
dap.set_breakpoint(vim.fn.input("Breakpoint condition: "))
end, { desc = "Debug: Set Breakpoint" })
-- Dap UI setup
-- For more information, see |:help nvim-dap-ui|
dapui.setup({
-- Set icons to characters that are more likely to work in every terminal.
-- Feel free to remove or use ones that you like more! :)
-- Don't feel like these are good choices.
icons = { expanded = "", collapsed = "", current_frame = "*" },
controls = {
icons = {
pause = "",
play = "",
step_into = "",
step_over = "",
step_out = "",
step_back = "b",
run_last = "▶▶",
terminate = "",
disconnect = "",
},
},
})
-- Toggle to see last session result. Without this, you can't see session output in case of unhandled exception.
vim.keymap.set("n", "<F7>", dapui.toggle, { desc = "Debug: See last session result." })
dap.listeners.after.event_initialized["dapui_config"] = dapui.open
dap.listeners.before.event_terminated["dapui_config"] = dapui.close
dap.listeners.before.event_exited["dapui_config"] = dapui.close
-- Install golang specific config
require("dap-go").setup()
end,
}

View File

@@ -1 +0,0 @@
return {}

View File

@@ -0,0 +1,70 @@
-- autoformat.lua
return {
"neovim/nvim-lspconfig",
config = function()
-- Switch for controlling whether you want autoformatting.
-- Use :KickstartFormatToggle to toggle autoformatting on or off
local format_is_enabled = true
vim.api.nvim_create_user_command("KickstartFormatToggle", function()
format_is_enabled = not format_is_enabled
print("Setting autoformatting to: " .. tostring(format_is_enabled))
end, {})
-- Create an augroup that is used for managing our formatting autocmds.
-- We need one augroup per client to make sure that multiple clients
-- can attach to the same buffer without interfering with each other.
local _augroups = {}
local get_augroup = function(client)
if not _augroups[client.id] then
local group_name = "kickstart-lsp-format-" .. client.name
local id = vim.api.nvim_create_augroup(group_name, { clear = true })
_augroups[client.id] = id
end
return _augroups[client.id]
end
-- Whenever an LSP attaches to a buffer, we will run this function.
--
-- See `:help LspAttach` for more information about this autocmd event.
vim.api.nvim_create_autocmd("LspAttach", {
group = vim.api.nvim_create_augroup("kickstart-lsp-attach-format", { clear = true }),
-- This is where we attach the autoformatting for reasonable clients
callback = function(args)
local client_id = args.data.client_id
local client = vim.lsp.get_client_by_id(client_id)
local bufnr = args.buf
-- Only attach to clients that support document formatting
if not client.server_capabilities.documentFormattingProvider then
return
end
-- Tsserver usually works poorly. Sorry you work with bad languages
-- You can remove this line if you know what you're doing :)
if client.name == "tsserver" then
return
end
-- Create an autocmd that will run *before* we save the buffer.
-- Run the formatting command for the LSP that has just attached.
vim.api.nvim_create_autocmd("BufWritePre", {
group = get_augroup(client),
buffer = bufnr,
callback = function()
if not format_is_enabled then
return
end
vim.lsp.buf.format({
async = false,
filter = function(c)
return c.id == client.id
end,
})
end,
})
end,
})
end,
}

View File

@@ -0,0 +1,74 @@
return {
{ "tpope/vim-repeat" },
{ "tpope/vim-surround" },
{ "easymotion/vim-easymotion" },
{ "machakann/vim-highlightedyank" },
-- "gc" to comment visual regions/lines
{ "numToStr/Comment.nvim", opts = {} },
-- auto pairs
{
"echasnovski/mini.pairs",
event = "VeryLazy",
opts = {},
},
-- indent guides for Neovim
{
"lukas-reineke/indent-blankline.nvim",
opts = {
indent = { char = "", tab_char = "", },
scope = { enabled = false },
exclude = {
filetypes = {
"help", "alpha", "dashboard", "neo-tree",
"Trouble", "trouble", "lazy", "mason",
"notify", "toggleterm", "lazyterm",
},
},
},
main = "ibl",
},
-- Highlights the current level of indentation, and animates the highlighting.
{
"echasnovski/mini.indentscope",
opts = { symbol = "", options = { try_as_border = true }, },
init = function()
vim.api.nvim_create_autocmd("FileType", {
pattern = {
"help", "neo-tree", "Trouble", "trouble",
"lazy", "mason", "notify", "toggleterm",
"lazyterm",
},
callback = function()
vim.b.miniindentscope_disable = true
end,
})
end,
},
-- Finds and lists all of the TODO, HACK, BUG, etc comment
{
"folke/todo-comments.nvim",
lazy = false,
dependencies = { "nvim-lua/plenary.nvim" },
config = true,
opts = {
keywords = {
HACK = { alt = { "TIP" } },
},
},
keys = {
{ "]t", function() require("todo-comments").jump_next() end, desc = "Next todo comment" },
{ "[t", function() require("todo-comments").jump_prev() end, desc = "Previous todo comment" },
-- TODO: Find better keymaps for below
-- { "<leader>xt", "<cmd>TodoTrouble<cr>", desc = "Todo (Trouble)" },
-- { "<leader>xT", "<cmd>TodoTrouble keywords=TODO,FIX,FIXME<cr>", desc = "Todo/Fix/Fixme (Trouble)" },
-- { "<leader>st", "<cmd>TodoTelescope<cr>", desc = "Todo" },
-- { "<leader>sT", "<cmd>TodoTelescope keywords=TODO,FIX,FIXME<cr>", desc = "Todo/Fix/Fixme" },
},
},
}

View File

@@ -0,0 +1,74 @@
return {
{ "tpope/vim-fugitive", },
--{ "tpope/vim-rhubarb" }, --If fugitive.vim is the Git, rhubarb.vim is the Hub.
{
-- Adds git related signs to the gutter, as well as utilities for managing changes
"lewis6991/gitsigns.nvim",
opts = {
-- See `:help gitsigns.txt`
signs = {
add = { text = "+" },
change = { text = "~" },
delete = { text = "_" },
topdelete = { text = "" },
changedelete = { text = "~" },
},
on_attach = function(bufnr)
local gs = package.loaded.gitsigns
local function map(mode, l, r, opts)
opts = opts or {}
opts.buffer = bufnr
vim.keymap.set(mode, l, r, opts)
end
-- Navigation
map({ "n", "v" }, "]h", function()
if vim.wo.diff then
return "]h"
end
vim.schedule(function()
gs.next_hunk()
end)
return "<Ignore>"
end, { expr = true, desc = "Jump to next git hunk" })
map({ "n", "v" }, "[h", function()
if vim.wo.diff then
return "[h"
end
vim.schedule(function()
gs.prev_hunk()
end)
return "<Ignore>"
end, { expr = true, desc = "Jump to previous git hunk" })
-- Actions
-- visual mode
map("v", "<leader>ghr", function()
gs.reset_hunk({ vim.fn.line("."), vim.fn.line("v") })
end, { desc = "reset git hunk" })
-- normal mode
map("n", "<leader>ghp", gs.preview_hunk, { desc = "preview git hunk" })
map("n", "<leader>ghr", gs.reset_hunk, { desc = "git reset hunk" })
map("n", "<leader>ghb", function()
gs.blame_line({ full = false })
end, { desc = "git blame line" })
map("n", "<leader>ghD", gs.diffthis, { desc = "git diff against index" })
map("n", "<leader>ghd", function()
gs.diffthis("~")
end, { desc = "git diff against last commit" })
-- Toggles
map("n", "<leader>gtb", gs.toggle_current_line_blame, { desc = "toggle git blame line" })
map("n", "<leader>gtd", gs.toggle_deleted, { desc = "toggle git show deleted" })
-- Text object
map({ "o", "x" }, "gih", ":<C-U>Gitsigns select_hunk<CR>", { desc = "select git hunk" })
end,
},
},
}

View File

@@ -1 +0,0 @@
return {}

View File

@@ -0,0 +1,144 @@
-- This function gets run when an LSP connects to a particular buffer.
-- Define mappings specific for LSP related items.
-- It sets the mode, buffer and description for us each time.
local on_attach = function(_, bufnr)
local nmap = function(keys, func, desc)
if desc then
desc = "LSP: " .. desc
end
vim.keymap.set("n", keys, func, { buffer = bufnr, desc = desc })
end
nmap("<leader>rn", vim.lsp.buf.rename, "[R]e[n]ame")
nmap("<leader>ca", vim.lsp.buf.code_action, "[C]ode [A]ction")
nmap("gd", require("telescope.builtin").lsp_definitions, "[G]oto [D]efinition")
nmap("gr", require("telescope.builtin").lsp_references, "[G]oto [R]eferences")
nmap("gI", require("telescope.builtin").lsp_implementations, "[G]oto [I]mplementation")
nmap("<leader>D", require("telescope.builtin").lsp_type_definitions, "Type [D]efinition")
nmap("<leader>ds", require("telescope.builtin").lsp_document_symbols, "[D]ocument [S]ymbols")
nmap("<leader>ws", require("telescope.builtin").lsp_dynamic_workspace_symbols, "[W]orkspace [S]ymbols")
-- See `:help K` for why this keymap
nmap("K", vim.lsp.buf.hover, "Hover Documentation")
nmap("<C-k>", vim.lsp.buf.signature_help, "Signature Documentation")
-- Lesser used LSP functionality
nmap("gD", vim.lsp.buf.declaration, "[G]oto [D]eclaration")
nmap("<leader>wa", vim.lsp.buf.add_workspace_folder, "[W]orkspace [A]dd Folder")
nmap("<leader>wr", vim.lsp.buf.remove_workspace_folder, "[W]orkspace [R]emove Folder")
nmap("<leader>wl", function()
print(vim.inspect(vim.lsp.buf.list_workspace_folders()))
end, "[W]orkspace [L]ist Folders")
-- Create a command `:Format` local to the LSP buffer
vim.api.nvim_buf_create_user_command(bufnr, "Format", function(_)
vim.lsp.buf.format()
end, { desc = "Format current buffer with LSP" })
end
return {
{
-- LSP Configuration & Plugins
"neovim/nvim-lspconfig",
dependencies = {
-- Automatically install LSPs to stdpath for neovim
{ "williamboman/mason.nvim", config = true },
{ "williamboman/mason-lspconfig.nvim" },
-- Useful status updates for LSP
{ "j-hui/fidget.nvim", opts = {} },
{ "folke/neodev.nvim" },
},
-- WARN: DO NOT do config here
-- That would override config from autoformat
},
{
"williamboman/mason-lspconfig.nvim",
config = function()
-- NOTE: We configure lsp here instead of in the lspconfig's config
-- Reason? read the warnings above
-- Configure LSP
-- mason-lspconfig requires that these setup functions are called in this order
-- before setting up the servers.
require("mason").setup()
require("mason-lspconfig").setup()
-- Enable the following language servers
-- Add any additional override configuration in the following tables. They will be passed to
-- the `settings` field of the server config. You must look up that documentation yourself.
--
-- If you want to override the default filetypes that your language server will attach to you can
-- define the property 'filetypes' to the map in question.
local servers = {
-- clangd = {},
-- gopls = {},
-- pyright = {},
-- rust_analyzer = {},
-- tsserver = {},
-- html = { filetypes = { 'html', 'twig', 'hbs'} },
lua_ls = {
Lua = {
workspace = { checkThirdParty = false },
telemetry = { enable = false },
-- NOTE: toggle below to ignore Lua_LS's noisy `missing-fields` warnings
-- diagnostics = { disable = { 'missing-fields' } },
},
},
}
-- nvim-cmp supports additional completion capabilities, so broadcast that to servers
local capabilities = vim.lsp.protocol.make_client_capabilities()
capabilities = require("cmp_nvim_lsp").default_capabilities(capabilities)
-- Ensure the servers above are installed
local mason_lspconfig = require("mason-lspconfig")
mason_lspconfig.setup({
ensure_installed = vim.tbl_keys(servers),
})
mason_lspconfig.setup_handlers({
function(server_name)
require("lspconfig")[server_name].setup({
capabilities = capabilities,
on_attach = on_attach,
settings = servers[server_name],
filetypes = (servers[server_name] or {}).filetypes,
})
end,
})
end,
},
{
"j-hui/fidget.nvim",
opts = {
-- Options related to LSP progress subsystem
progress = {
poll_rate = 1, -- How and when to poll for progress messages
suppress_on_insert = true, -- Suppress new messages while in insert mode
ignore_done_already = true, -- Ignore new tasks that are already complete
ignore_empty_message = true, -- Ignore new tasks that don't contain a message
ignore = {}, -- List of LSP servers to ignore
-- Options related to how LSP progress messages are displayed as notifications
display = {
render_limit = 1, -- How many LSP messages to show at once
skip_history = true, -- Whether progress notifications should be omitted from history
},
},
-- Options related to notification subsystem
notification = {
filter = vim.log.levels.WARN, -- Minimum notifications level
},
},
},
}

View File

@@ -1 +0,0 @@
return {}

View File

@@ -1 +0,0 @@
return {}

View File

@@ -1 +0,0 @@
return {}

View File

@@ -1 +0,0 @@
return {}

View File

@@ -1 +0,0 @@
return {}

View File

@@ -1 +0,0 @@
return {}

View File

@@ -1,293 +0,0 @@
return {
-- FIX: Vale (markdown linter) isn't working
-- TODO: Configure the linter
-- Treesitter is a parser generator tool that we can use for syntax highlighting
{
"nvim-treesitter/nvim-treesitter",
lazy = false,
keys = {
{ "<C-Space>", desc = "Increment selection" },
{ "<C-CR>", desc = "Increment scope selection" },
{ "<bs>", desc = "Decrement selection", mode = "x" },
},
---@type TSConfig
---@diagnostic disable-next-line: missing-fields
opts = {
highlight = { enable = true },
indent = { enable = true },
auto_install = true,
-- stylua: ignore
ensure_installed = {
"lua", "luadoc", "luap", "vim", "vimdoc",
"diff","query", "regex", "toml", "yaml",
"c", "python", "bash",
"markdown", "markdown_inline",
"html", "javascript", "jsdoc", "json", "jsonc", "tsx", "typescript",
},
incremental_selection = {
enable = true,
keymaps = {
init_selection = "<C-space>",
node_incremental = "<C-space>",
scope_incremental = "<C-CR>",
node_decremental = "<bs>",
},
},
textobjects = {
-- stylua: ignore
-- Defaults(not mentioned below): Select text objects (similar to ip & ap)
-- af: Selects around current function
-- if: Selects inside current function
-- ac: around current Class
-- ic: inside current Class
move = {
-- Jump to next and previous text objects
enable = true,
goto_next_start = {
["]f"] = { query = "@function.outer", desc = "Goto next inner function start" },
["]c"] = { query = "@class.outer", desc = "Goto next inner class start" },
},
goto_next_end = {
["]F"] = { query = "@function.outer", desc = "Goto next outer function end" },
["]C"] = { query = "@class.outer", desc = "Goto next outer class end" },
},
goto_previous_start = {
["[f"] = { query = "@function.outer", desc = "Goto goto previous inner function start" },
["[c"] = { query = "@class.outer", desc = "Previous inner class start" },
},
goto_previous_end = {
["[F"] = { query = "@function.outer", desc = "Goto goto previous outer function start" },
["[C"] = { query = "@class.outer", desc = "Goto previous outer class start" },
},
},
},
},
},
-- LSP configuration
{
"neovim/nvim-lspconfig",
-- lazy = false,
opts = {
-- Enable this to enable the builtin LSP inlay hints on Neovim >= 0.10.0
-- Be aware that you also will need to properly configure your LSP server to
-- provide the inlay hints.
inlay_hints = {
enabled = true,
},
-- add any global capabilities here
capabilities = {},
-- options for vim.lsp.buf.format
-- `bufnr` and `filter` is handled by the LazyVim formatter,
-- but can be also overridden when specified
format = {
formatting_options = nil,
timeout_ms = nil,
},
-- LSP Server Settings
servers = {
lua_ls = {
settings = {
Lua = {
workspace = {
checkThirdParty = false,
},
completion = {
callSnippet = "Replace",
},
},
},
},
tsserver = {
keys = {
{
"<leader>co",
function()
vim.lsp.buf.code_action({
apply = true,
context = {
only = { "source.organizeImports.ts" },
diagnostics = {},
},
})
end,
desc = "Organize Imports",
},
{
"<leader>cR",
function()
vim.lsp.buf.code_action({
apply = true,
context = {
only = { "source.removeUnused.ts" },
diagnostics = {},
},
})
end,
desc = "Remove Unused Imports",
},
},
settings = {
typescript = {
format = {},
},
javascript = {
format = {},
},
completions = {
completeFunctionCalls = true,
},
},
},
},
},
},
-- Linting
{
"mfussenegger/nvim-lint",
lazy = false,
opts = {
-- Event to trigger linters
events = { "BufWritePost", "BufReadPost", "InsertLeave" },
linters_by_ft = {
fish = { "fish" },
-- Use the "*" filetype to run linters on all filetypes.
-- ['*'] = { 'global linter' },
-- Use the "_" filetype to run linters on filetypes that don't have other linters configured.
-- ['_'] = { 'fallback linter' },
},
-- LazyVim extension to easily override linter options
-- or add custom linters.
---@type table<string,table>
linters = {
-- -- Example of using selene only when a selene.toml file is present
-- selene = {
-- -- `condition` is another LazyVim extension that allows you to
-- -- dynamically enable/disable linters based on the context.
-- condition = function(ctx)
-- return vim.fs.find({ "selene.toml" }, { path = ctx.filename, upward = true })[1]
-- end,
-- },
},
},
},
-- Mason configuration
{
"williamboman/mason.nvim",
opts = {
ensure_installed = {
"prettier",
"js-debug-adapter",
"eslint-lsp",
"json-lsp",
"typescript-language-server",
"codelldb",
"rust-analyzer",
"yaml-language-server",
"black",
"csharpier",
"omnisharp",
"stylua",
"lua-language-server",
"shfmt",
"pyright",
"hadolint",
"docker-compose-language-service",
"dockerfile-language-server",
"vale",
"vale-ls",
"markdownlint",
"marksman",
"taplo",
},
},
},
{ "williamboman/mason-lspconfig.nvim" },
-- Formatter
{
"nvimtools/none-ls.nvim",
lazy = false,
opts = function(_, opts)
local nls = require("null-ls")
opts.root_dir = opts.root_dir
or require("null-ls.utils").root_pattern(".null-ls-root", ".neoconf.json", "Makefile", ".git")
opts.sources = vim.list_extend(opts.sources or {}, {
nls.builtins.formatting.fish_indent,
nls.builtins.diagnostics.fish,
nls.builtins.formatting.stylua,
nls.builtins.formatting.shfmt,
nls.builtins.formatting.eslint_d,
nls.builtins.formatting.black,
nls.builtins.formatting.prettierd,
})
end,
},
-- Auto pairs
{ "echasnovski/mini.pairs" },
-- Automatically add closing tags for HTML and JSX
{ "windwp/nvim-ts-autotag" },
-- Surround things
{ "tpope/vim-surround" },
-- Tpope one(above) is more predictable
{ "echasnovski/mini.surround", enabled = false },
-- Comments
{ "JoosepAlviste/nvim-ts-context-commentstring" },
{ "echasnovski/mini.comment" },
-- Better text-objects
{
-- Extends a & i with the following:
-- a/i <space>: around/inside continuous Whitespace
-- a/i ": around/inside double quotes
-- a/i ': around/inside single quotes
-- a/i `: around/inside backticks
-- a/i q: around/inside any 2 quotes of any kind (`, ', ")
-- a/i (: around/inside braces - does NOT include spaces around
-- a/i ): around/inside braces - DOES include spaces around
-- a/i ]/[
-- a/i }/{
-- a/i b: around/inside any 2 braces of any kind (), ], }) - NOT including spaces around
-- a/i >: around/inside tags - does NOT include spaces
-- a/i <: around/inside tags - DOES include spaces
-- a/i t: around/inside 2 tags of any kind
-- a/i _: around/inside 2 Underscores
-- a/i a: around/inside function arguments
-- a/i f: around/inside Function
-- a/i c: around/inside class
-- a/i o: around/inside any block of code (conditional, loop, etc.)
"echasnovski/mini.ai",
},
-- Indent guides for Neovim
{
"lukas-reineke/indent-blankline.nvim",
opts = { scope = { enabled = true } },
},
-- This highlights the current level of indentation and animates the highlighting
{ "echasnovski/mini.indentscope" },
-- Navic does a much better job without taking any screen space
{ "nvim-treesitter/nvim-treesitter-context", enabled = false },
-- VSCode like breadcrumbs in lualine
{ "SmiteshP/nvim-navic" },
-- Shows symbols in the current window on a vsplit on left
{
"simrat39/symbols-outline.nvim",
keys = { { "<leader>cs", "<cmd>SymbolsOutline<cr>", desc = "Symbols Outline" } },
},
}

View File

@@ -1,16 +1,10 @@
return {
{
"LazyVim/LazyVim",
opts = {
colorscheme = "github_dark_dimmed",
},
},
{
"projekt0n/github-nvim-theme",
lazy = false,
priority = 1000,
config = function()
-- vim.cmd("colorscheme github_dark_dimmed")
vim.cmd("colorscheme github_dark_dimmed")
end,
},
}

View File

@@ -1,13 +1,5 @@
-- Most of the code below is for easy reference to lazyvim shortcuts
-- So, I can view and change them easily
local Util = require("lazyvim.util")
return {
-- icons
{ "nvim-tree/nvim-web-devicons" },
-- Changes the Nvim root to git root
{
"airblade/vim-rooter",
@@ -21,37 +13,14 @@ return {
"nvim-neo-tree/neo-tree.nvim",
branch = "v3.x",
keys = {
{ "<leader>e", ":Neotree filesystem toggle<CR>", desc = "Explorer NeoTree (root dir)", remap = true },
{ "<leader>e", ":Neotree filesystem toggle<CR>", desc = "Open NeoTree [E]plorer at Git root", remap = true },
-- Change the rest if required
{
"<leader>fe",
function()
require("neo-tree.command").execute({ toggle = true, dir = Util.root() })
end,
desc = "Explorer NeoTree (root dir)",
},
{
"<leader>fE",
function()
require("neo-tree.command").execute({ toggle = true, dir = vim.loop.cwd() })
end,
desc = "Explorer NeoTree (cwd)",
},
{ "<leader>E", "<leader>fE", desc = "Explorer NeoTree (cwd)", remap = true },
{
"<leader>ge",
function()
require("neo-tree.command").execute({ source = "git_status", toggle = true })
end,
desc = "Git explorer",
},
{
"<leader>be",
function()
require("neo-tree.command").execute({ source = "buffers", toggle = true })
end,
desc = "Buffer explorer",
desc = "NeoTree: Open [B]uffer [E]xplorer",
},
},
opts = {
@@ -72,9 +41,9 @@ return {
},
window = {
position = "left",
width = 30, -- Saner window size
width = 30, -- Saner window size
mappings = {
["s"] = "open_split", -- Default vim keymap for horizontal split
["s"] = "open_split", -- Default vim keymap for horizontal split
["v"] = "open_vsplit", -- Default vim keymap for vertical split
},
},
@@ -88,150 +57,11 @@ return {
},
},
-- Search and replace in multiple files
{
"nvim-pack/nvim-spectre",
keys = {
{
"<leader>sr",
function()
require("spectre").open()
end,
desc = "Replace in files (Spectre)",
},
},
},
-- Fuzzy finder of many things
{
"nvim-telescope/telescope.nvim",
keys = {
-- find
{ "<leader>ff", Util.telescope("files"), desc = "Find Files (root dir)" },
{ "<leader><space>", Util.telescope("files"), desc = "Find Files (root dir)" },
{ "<leader>fb", "<cmd>Telescope buffers sort_mru=true sort_lastused=true<cr>", desc = "Buffers" },
{ "<leader>fc", Util.telescope.config_files(), desc = "Find Config File" },
{ "<leader>fF", Util.telescope("files", { cwd = false }), desc = "Find Files (cwd)" },
{ "<leader>fr", "<cmd>Telescope oldfiles<cr>", desc = "Recent" },
{ "<leader>fR", Util.telescope("oldfiles", { cwd = vim.loop.cwd() }), desc = "Recent (cwd)" },
{ "<leader>/", Util.telescope("live_grep"), desc = "Grep (root dir)" },
{ "<leader>:", "<cmd>Telescope command_history<cr>", desc = "Command History" },
-- git
{ "<leader>gc", "<cmd>Telescope git_commits<CR>", desc = "commits" },
{ "<leader>gs", "<cmd>Telescope git_status<CR>", desc = "status" },
-- search
{ '<leader>s"', "<cmd>Telescope registers<cr>", desc = "Registers" },
{ "<leader>sa", "<cmd>Telescope autocommands<cr>", desc = "Auto Commands" },
{ "<leader>sb", "<cmd>Telescope current_buffer_fuzzy_find<cr>", desc = "Buffer" },
{ "<leader>sc", "<cmd>Telescope command_history<cr>", desc = "Command History" },
{ "<leader>sC", "<cmd>Telescope commands<cr>", desc = "Commands" },
{ "<leader>sd", "<cmd>Telescope diagnostics bufnr=0<cr>", desc = "Document diagnostics" },
{ "<leader>sD", "<cmd>Telescope diagnostics<cr>", desc = "Workspace diagnostics" },
{ "<leader>sg", Util.telescope("live_grep"), desc = "Grep (root dir)" },
{ "<leader>sG", Util.telescope("live_grep", { cwd = false }), desc = "Grep (cwd)" },
{ "<leader>sh", "<cmd>Telescope help_tags<cr>", desc = "Help Pages" },
{ "<leader>sH", "<cmd>Telescope highlights<cr>", desc = "Search Highlight Groups" },
{ "<leader>sk", "<cmd>Telescope keymaps<cr>", desc = "Key Maps" },
{ "<leader>sM", "<cmd>Telescope man_pages<cr>", desc = "Man Pages" },
{ "<leader>sm", "<cmd>Telescope marks<cr>", desc = "Jump to Mark" },
{ "<leader>so", "<cmd>Telescope vim_options<cr>", desc = "Options" },
{ "<leader>sR", "<cmd>Telescope resume<cr>", desc = "Resume" },
{ "<leader>sw", Util.telescope("grep_string", { word_match = "-w" }), desc = "Word (root dir)" },
{ "<leader>sW", Util.telescope("grep_string", { cwd = false, word_match = "-w" }), desc = "Word (cwd)" },
{ "<leader>sw", Util.telescope("grep_string"), mode = "v", desc = "Selection (root dir)" },
{ "<leader>sW", Util.telescope("grep_string", { cwd = false }), mode = "v", desc = "Selection (cwd)" },
{
"<leader>uC",
Util.telescope("colorscheme", { enable_preview = true }),
desc = "Colorscheme with preview",
},
{
"<leader>ss",
function()
require("telescope.builtin").lsp_document_symbols({
symbols = require("lazyvim.config").get_kind_filter(),
})
end,
desc = "Goto Symbol",
},
{
"<leader>sS",
function()
require("telescope.builtin").lsp_dynamic_workspace_symbols({
symbols = require("lazyvim.config").get_kind_filter(),
})
end,
desc = "Goto Symbol (Workspace)",
},
},
},
-- Confusing hence disabled
{ "folke/flash.nvim", enabled = false },
-- EasyMotion is better
{ "easymotion/vim-easymotion" },
-- Adds and reads "keys" property in each plugins
{
"folke/which-key.nvim",
opts = {
plugins = { spelling = true },
defaults = {
mode = { "n", "v" },
["g"] = { name = "+goto" },
["ys"] = { name = "+surround" },
["]"] = { name = "+next" },
["["] = { name = "+prev" },
["<leader><tab>"] = { name = "+tabs" },
["<leader>b"] = { name = "+buffer" },
["<leader>c"] = { name = "+code" },
["<leader>f"] = { name = "+file/find" },
["<leader>g"] = { name = "+git" },
["<leader>gh"] = { name = "+hunks" },
["<leader>q"] = { name = "+quit/session" },
["<leader>s"] = { name = "+search" },
["<leader>u"] = { name = "+ui" },
["<leader>w"] = { name = "+windows" },
["<leader>x"] = { name = "+diagnostics/quickfix" },
},
},
},
-- Display undotree
{
"mbbill/undotree",
config = function()
vim.keymap.set("n", "<leader>u", vim.cmd.UndotreeToggle)
end,
},
-- TODO: install gitblame plugin
-- Highlights text that changed since last commit
{
"lewis6991/gitsigns.nvim",
opts = {
on_attach = function(buffer)
local gs = package.loaded.gitsigns
local function map(mode, l, r, desc)
vim.keymap.set(mode, l, r, { buffer = buffer, desc = desc })
end
-- stylua: ignore start
map("n", "<leader>ghp", gs.preview_hunk, "Preview Hunk")
map("n", "<leader>gH", gs.preview_hunk, "Preview Hunk")
map("n", "]h", gs.next_hunk, "Next Hunk")
map("n", "[h", gs.prev_hunk, "Prev Hunk")
end,
},
},
-- Automatically highlights other instances of the word under cursor
{
"RRethy/vim-illuminate",
config = function(_, opts)
-- Copied from LazyNvim
require("illuminate").configure(opts)
local function map(key, dir, buffer)
@@ -258,168 +88,61 @@ return {
},
},
-- Remove Buffer
-- Display undotree
{
"echasnovski/mini.bufremove",
keys = {
{
"<leader>br",
function()
if vim.bo.modified then
vim.cmd.write()
end
require("mini.bufremove").delete(0)
end,
desc = "Save and remove Buffer",
},
-- stylua: ignore
{ "<leader>bR", function() require("mini.bufremove").delete(0, true) end, desc = "Force Remove Buffer" },
},
"mbbill/undotree",
config = function()
vim.keymap.set("n", "<leader>u", vim.cmd.UndotreeToggle)
end,
},
-- Diagnostics lists
-- Show buffers like VS Code tabs
{
"folke/trouble.nvim",
"akinsho/bufferline.nvim",
dependencies = {
{ "echasnovski/mini.bufremove", version = "*" },
},
event = "VeryLazy",
keys = {
{ "<leader>xx", "<cmd>TroubleToggle document_diagnostics<cr>", desc = "Document Diagnostics (Trouble)" },
{ "<leader>xX", "<cmd>TroubleToggle workspace_diagnostics<cr>", desc = "Workspace Diagnostics (Trouble)" },
{ "<leader>xL", "<cmd>TroubleToggle loclist<cr>", desc = "Location List (Trouble)" },
{ "<leader>xQ", "<cmd>TroubleToggle quickfix<cr>", desc = "Quickfix List (Trouble)" },
{
"[e",
function()
if require("trouble").is_open() then
require("trouble").previous({ skip_groups = true, jump = true })
else
local ok, err = pcall(vim.cmd.cprev)
if not ok then
vim.notify(err, vim.log.levels.ERROR)
end
end
end,
desc = "Previous trouble/quickfix item",
},
{
"]e",
function()
if require("trouble").is_open() then
require("trouble").next({ skip_groups = true, jump = true })
else
local ok, err = pcall(vim.cmd.cnext)
if not ok then
vim.notify(err, vim.log.levels.ERROR)
end
end
end,
desc = "Next trouble/quickfix item",
{ "<leader>bp", "<Cmd>BufferLineTogglePin<CR>", desc = "Toggle buffer-pin" },
{ "<leader>xo", "<Cmd>BufferLineCloseOthers<CR>", desc = "Delete other buffers" },
},
opts = {
options = {
close_command = function(n) require("mini.bufremove").delete(n, false) end,
right_mouse_command = function(n) require("mini.bufremove").delete(n, false) end,
diagnostics = "nvim_lsp",
always_show_bufferline = false,
offsets = {
{
filetype = "neo-tree",
text = "Neo-tree",
highlight = "Directory",
text_align = "left",
},
},
},
},
},
-- Finds and lists all of the TODO, HACK, BUG, etc comment
{
"folke/todo-comments.nvim",
-- stylua: ignore
keys = {
{ "]t", function() require("todo-comments").jump_next() end, desc = "Next todo comment" },
{ "[t", function() require("todo-comments").jump_prev() end, desc = "Previous todo comment" },
{ "<leader>xt", "<cmd>TodoTrouble<cr>", desc = "Todo (Trouble)" },
{ "<leader>xT", "<cmd>TodoTrouble keywords=TODO,FIX,FIXME<cr>", desc = "Todo/Fix/Fixme (Trouble)" },
{ "<leader>st", "<cmd>TodoTelescope<cr>", desc = "Todo" },
{ "<leader>sT", "<cmd>TodoTelescope keywords=TODO,FIX,FIXME<cr>", desc = "Todo/Fix/Fixme" },
},
config = function(_, opts)
require("bufferline").setup(opts)
-- Fix bufferline when restoring a session
vim.api.nvim_create_autocmd("BufAdd", {
callback = function()
vim.schedule(function()
pcall(nvim_bufferline)
end)
end,
})
end,
},
-- UI Stuff ------------------------------------------------------------------------
-- Fancy-looking tabs, which include filetype icons and close buttons.
{ "akinsho/bufferline.nvim" },
-- icons
{ "nvim-tree/nvim-web-devicons" },
-- Fancy Statusline
{
"nvim-lualine/lualine.nvim",
opts = function()
local lualine_require = require("lualine_require")
lualine_require.require = require
local icons = require("lazyvim.config").icons
vim.o.laststatus = vim.g.lualine_laststatus
return {
options = {
theme = "auto",
globalstatus = true,
disabled_filetypes = { statusline = { "dashboard", "alpha", "starter" } },
},
sections = {
lualine_a = { "mode" },
lualine_b = { "branch" },
lualine_c = {
Util.lualine.root_dir(),
{
"diagnostics",
symbols = {
error = icons.diagnostics.Error,
warn = icons.diagnostics.Warn,
info = icons.diagnostics.Info,
hint = icons.diagnostics.Hint,
},
},
{ "filetype", icon_only = true, separator = "", padding = { left = 1, right = 0 } },
{ Util.lualine.pretty_path() },
},
lualine_x = {
-- stylua: ignore
{
function() return require("noice").api.status.command.get() end,
cond = function() return package.loaded["noice"] and require("noice").api.status.command.has() end,
color = Util.ui.fg("Statement"),
},
-- stylua: ignore
{
function() return require("noice").api.status.mode.get() end,
cond = function() return package.loaded["noice"] and require("noice").api.status.mode.has() end,
color = Util.ui.fg("Constant"),
},
-- stylua: ignore
{
function() return "" .. require("dap").status() end,
cond = function () return package.loaded["dap"] and require("dap").status() ~= "" end,
color = Util.ui.fg("Debug"),
},
{
require("lazy.status").updates,
cond = require("lazy.status").has_updates,
color = Util.ui.fg("Special"),
},
{
"diff",
symbols = {
added = icons.git.added,
modified = icons.git.modified,
removed = icons.git.removed,
},
source = function()
local gitsigns = vim.b.gitsigns_status_dict
if gitsigns then
return {
added = gitsigns.added,
modified = gitsigns.changed,
removed = gitsigns.removed,
}
end
end,
},
},
lualine_y = {},
lualine_z = { { "progress" }, { "location" } },
},
extensions = { "neo-tree", "lazy" },
}
end,
},
-- ui components
{ "MunifTanjim/nui.nvim" },
-- Better vim.ui
{ "stevearc/dressing.nvim" },
@@ -429,7 +152,7 @@ return {
"rcarriga/nvim-notify",
keys = {
{
"<leader>un",
"<leader>xn",
function()
require("notify").dismiss({ silent = true, pending = true })
end,
@@ -454,13 +177,29 @@ return {
-- Completely replaces the UI for messages, cmdline and the popupmenu.
{
"folke/noice.nvim",
event = "VeryLazy",
dependencies = {
"MunifTanjim/nui.nvim",
"rcarriga/nvim-notify",
},
opts = {
lsp = {
override = {
["vim.lsp.util.convert_input_to_markdown_lines"] = true,
["vim.lsp.util.stylize_markdown"] = true,
["cmp.entry.get_documentation"] = true,
},
},
routes = {
{
-- Show popup message when @recording macros
view = "notify",
filter = { event = "msg_showmode" },
},
{
filter = { event = "notify", find = "No information available" },
opts = { skin = true },
},
{
-- Direct some messages to bottom - obove lualine
view = "mini",
@@ -483,67 +222,43 @@ return {
},
},
},
-- TODO: Some messages needs to suppressed completely. Figure out how???
},
presets = {
lsp_doc_border = true,
bottom_search = true,
command_palette = true,
long_message_to_split = true,
inc_rename = true,
},
},
-- stylua: ignore
keys = {
{ "<S-Enter>", function() require("noice").redirect(vim.fn.getcmdline()) end, mode = "c", desc = "Redirect Cmdline" },
{ "<leader>snl", function() require("noice").cmd("last") end, desc = "Noice Last Message" },
{ "<leader>snh", function() require("noice").cmd("history") end, desc = "Noice History" },
{ "<leader>sna", function() require("noice").cmd("all") end, desc = "Noice All" },
{ "<leader>snd", function() require("noice").cmd("dismiss") end, desc = "Dismiss All" },
{ "<c-f>", function() if not require("noice.lsp").scroll(4) then return "<c-f>" end end, silent = true, expr = true, desc = "Scroll forward", mode = {"i", "n", "s"} },
{ "<c-b>", function() if not require("noice.lsp").scroll(-4) then return "<c-b>" end end, silent = true, expr = true, desc = "Scroll backward", mode = {"i", "n", "s"}},
{ "<leader>nx", "<cmd>NoiceDismiss<CR>", desc = "Dismiss all [N]oice notifications" },
-- TODO: Find better keymaps
-- { "<S-Enter>", function() require("noice").redirect(vim.fn.getcmdline()) end, mode = "c", desc = "Redirect Cmdline" },
-- { "<leader>snl", function() require("noice").cmd("last") end, desc = "Noice Last Message" },
-- { "<leader>snh", function() require("noice").cmd("history") end, desc = "Noice History" },
-- { "<leader>sna", function() require("noice").cmd("all") end, desc = "Noice All" },
-- { "<leader>snd", function() require("noice").cmd("dismiss") end, desc = "Dismiss All" },
-- { "<leader>snd", function() require("noice").cmd("dismiss") end, desc = "Dismiss All" },
-- { "<c-f>", function() if not require("noice.lsp").scroll(4) then return "<c-f>" end end, silent = true, expr = true, desc = "Scroll forward", mode = { "i", "n", "s" } },
-- { "<c-b>", function() if not require("noice.lsp").scroll(-4) then return "<c-b>" end end, silent = true, expr = true, desc = "Scroll backward", mode = { "i", "n", "s" } },
},
},
-- ui components
{ "MunifTanjim/nui.nvim" },
{ "goolord/alpha-nvim", enabled = false },
-- Set lualine as statusline
{
"akinsho/toggleterm.nvim",
cmd = "ToggleTerm",
build = ":ToggleTerm",
keys = {
-- NOTE: Do not use <leader> for terminals, there would be issue escaping
-- F13 = Shift + F1
{ "<F13>", "<cmd>ToggleTerm direction=horizontal<cr>", desc = "Toggle horizontal terminal" },
},
"nvim-lualine/lualine.nvim",
-- See `:help lualine.txt`
opts = {
open_mapping = [[<F13>]],
direction = "horizontal",
shade_filetypes = {},
hide_numbers = true,
insert_mappings = true,
terminal_mappings = true,
start_in_insert = true,
close_on_exit = true,
float_opts = {
border = "curved",
-- TODO: Need the following:
-- - Remove encoding & OS
-- - Add Breadcrumb
-- - Show command that was typed
options = {
icons_enabled = false,
component_separators = "|",
section_separators = "",
},
},
},
{
"mikesmithgh/kitty-scrollback.nvim",
lazy = true,
cmd = { "KittyScrollbackGenerateKittens", "KittyScrollbackCheckHealth" },
event = { "User KittyScrollbackLaunch" },
version = "^3.0.0",
opts = {
status_window = {
icons = { nvim = "" },
},
},
config = function()
require("kitty-scrollback").setup()
end,
},
}

View File

@@ -1,15 +0,0 @@
return {
{
"stevearc/conform.nvim",
keys = {
{
"<leader>cF",
function()
require("conform").format({ formatters = { "injected" } })
end,
mode = { "n", "v" },
desc = "Format Injected Langs",
},
},
},
}

View File

@@ -0,0 +1,3 @@
return {
-- NOTE: Placeholder for new plugins I'm trying out
}

View File

@@ -1,26 +0,0 @@
return {
{
"mfussenegger/nvim-lint",
opts = {
linters_by_ft = {
text = { "vale" },
json = { "jsonlint" },
markdown = { "markdownlint", "vale" },
rst = { "vale" },
dockerfile = { "hadolint" },
go = { "golangcilint" },
jq = { "jq" },
bash = { "shellcheck" },
shell = { "shellcheck" },
yaml = { "yamllint" },
zsh = { "zsh" },
typescript = { "eslint_d" },
javascript = { "eslint_d" },
-- Use the "*" filetype to run linters on all filetypes.
-- ['*'] = { 'global linter' },
-- Use the "_" filetype to run linters on filetypes that don't have other linters configured.
-- ['_'] = { 'fallback linter' },
},
},
},
}

View File

@@ -0,0 +1,119 @@
return {
-- Fuzzy Finder (files, lsp, etc)
{
"nvim-telescope/telescope.nvim",
branch = "0.1.x",
lazy = false,
dependencies = {
"nvim-lua/plenary.nvim",
{
"nvim-telescope/telescope-fzf-native.nvim",
build = "make",
cond = function()
return vim.fn.executable("make") == 1
end,
},
},
config = function()
-- NOTE: Search in hidden files trick taken from: https://stackoverflow.com/a/75500661/11057673
local telescopeConfig = require("telescope.config")
-- Clone the default Telescope configuration
local vimgrep_arguments = { unpack(telescopeConfig.values.vimgrep_arguments) }
-- Add flag to search hidden files/folders
table.insert(vimgrep_arguments, "--hidden")
table.insert(vimgrep_arguments, "--glob")
-- And to ignore .git directory. Needed since its not `.gitignore`d
table.insert(vimgrep_arguments, "!**/.git/*")
require("telescope").setup({
defaults = {
-- `hidden = true` is not supported in text grep commands.
hidden = true,
-- Without this live_grep would show .git entries
vimgrep_arguments = vimgrep_arguments,
mappings = {
i = {
["<C-u>"] = false,
["<C-d>"] = false,
},
},
},
pickers = {
colorscheme = { enable_preview = true },
find_files = {
hidden = true,
-- Redoing the vimgrep_arguments changes for find_files as well
find_command = { "rg", "--files", "--hidden", "--glob", "!**/.git/*" },
},
},
})
-- Load some required Telescope extensions
pcall(require("telescope").load_extension, "fzf")
pcall(require("telescope").load_extension, "noice")
pcall(require("telescope").load_extension, "undo")
-- Special Things: [T]elescope
vim.keymap.set("n", "<leader>tr", require("telescope.builtin").resume,
{ desc = "[T]elescope [R]esume Last Search" })
vim.keymap.set("n", "<leader>tc", require("telescope.builtin").colorscheme,
{ desc = "List Colorschemes (with preview)" })
-- Grep things -> [S]earch
vim.keymap.set("n", "<leader>sb", function()
require("telescope.builtin").live_grep({
grep_open_files = true,
prompt_title = "Live Grep in Open Files",
})
end, { desc = "[S]earch Open [B]uffers" })
vim.keymap.set("n", "<leader>sg", require("telescope.builtin").live_grep,
{ desc = "[S]earch/Live[G]rep the Project" })
vim.keymap.set("n", "<leader>sw", require("telescope.builtin").grep_string,
{ desc = "[S]earch current [W]ord in Project" })
-- [L]ist
vim.keymap.set("n", "<leader>lb", require("telescope.builtin").buffers, { desc = "[L]ist [B]uffers" })
vim.keymap.set("n", "<leader>lc", require("telescope.builtin").command_history,
{ desc = "[L]ist NeoVIM [C]ommand History" })
vim.keymap.set("n", "<leader>lf", require("telescope.builtin").find_files,
{ desc = "[L]ist & Search [F]iles" })
vim.keymap.set("n", "<leader>lh", require("telescope.builtin").help_tags,
{ desc = "[L]ist & Search NeoVIM [H]elp" })
vim.keymap.set("n", "<leader>lk", require("telescope.builtin").keymaps,
{ desc = "[L]ist & Search NeoVIM [K]eymaps" })
vim.keymap.set("n", "<leader>lm", require("telescope.builtin").marks, { desc = "[L]ist [M]arks" })
vim.keymap.set("n", "<leader>ln", require("telescope.builtin").man_pages,
{ desc = "[L]ist & Search System Ma[n] Pages" })
vim.keymap.set("n", "<leader>lq", require("telescope.builtin").quickfixhistory,
{ desc = "[L]ist [Q]uickfix History" })
vim.keymap.set("n", "<leader>ls", require("telescope.builtin").search_history,
{ desc = "[L]ist [S]earch History" })
vim.keymap.set("n", "<leader>lv", require("telescope.builtin").vim_options, { desc = "[L]ist [V]im Options" })
-- Git things -> [G]it
vim.keymap.set("n", "<leader>gb", require("telescope.builtin").git_branches,
{ desc = "List [G]it [B]ranches" })
vim.keymap.set("n", "<leader>gc", require("telescope.builtin").git_commits, { desc = "List [G]it [C]ommits" })
-- LSP Things -> [C]oding
vim.keymap.set("n", "<leader>cd", require("telescope.builtin").diagnostics,
{ desc = "[C]ode: List [D]iagnostics" })
vim.keymap.set(
"n",
"<leader>ci",
require("telescope.builtin").lsp_implementations,
{ desc = "[C]ode: Goto [I]mplementation of the word under cursor" }
)
vim.keymap.set("n", "<leader>cr", require("telescope.builtin").lsp_references,
{ desc = "[C]ode: List [R]eferences for word under cursor" })
vim.keymap.set(
"n",
"<leader>ct",
require("telescope.builtin").lsp_type_definitions,
{ desc = "[C]ode: Goto definition of the [T]ype under cursor" }
)
end,
},
}

View File

@@ -0,0 +1,129 @@
return {
{
-- nvim-treesitter provides parsers for individual languages
-- Output of these parses are fed to the NVIM's native treesitter(vim.treesitter)
-- What is fed to the native treesitter is essentially the AST
-- This AST is then used for syntax-highlighting and many other operations on the code
-- Hence, this plugin is only to make installing parsers easier
"nvim-treesitter/nvim-treesitter",
lazy = false,
build = ":TSUpdate",
init = function(plugin)
-- PERF: add nvim-treesitter queries to the rtp and it's custom query predicates early
-- This is needed because a bunch of plugins no longer `require("nvim-treesitter")`, which
-- no longer trigger the **nvim-treeitter** module to be loaded in time.
-- Luckily, the only thing that those plugins need are the custom queries, which we make available
-- during startup.
require("lazy.core.loader").add_to_rtp(plugin)
require("nvim-treesitter.query_predicates")
end,
dependencies = {
"nvim-treesitter/nvim-treesitter-textobjects",
config = function()
-- When in diff mode, we want to use the default
-- vim text objects c & C instead of the treesitter ones.
local move = require("nvim-treesitter.textobjects.move") ---@type table<string,fun(...)>
local configs = require("nvim-treesitter.configs")
for name, fn in pairs(move) do
if name:find("goto") == 1 then
move[name] = function(q, ...)
if vim.wo.diff then
local config = configs.get_module("textobjects.move")
[name] ---@type table<string,string>
for key, query in pairs(config or {}) do
if q == query and key:find("[%]%[][cC]") then
vim.cmd("normal! " .. key)
return
end
end
end
return fn(q, ...)
end
end
end
end,
},
config = function()
-- See `:help nvim-treesitter`
-- Defer Treesitter setup after first render to improve startup time of 'nvim {filename}'
vim.defer_fn(function()
require("nvim-treesitter.configs").setup({
ensure_installed = {
-- These 2 are required for cmdline
"regex",
"markdown_inline",
},
auto_install = true,
highlight = { enable = true },
indent = { enable = true },
incremental_selection = {
enable = true,
keymaps = {
init_selection = "<C-space>",
node_incremental = "<C-space>",
scope_incremental = "<C-CR>",
node_decremental = "<bs>",
},
},
textobjects = {
select = {
enable = true,
lookahead = true, -- Automatically jump forward to textobj, similar to targets.vim
keymaps = {
-- You can use the capture groups defined in textobjects.scm (:TSEditQuery textobjects)
["aa"] = { query = "@parameter.outer", desc = "Select around the parameter" },
["ia"] = { query = "@parameter.inner", desc = "Select inside the parameter" },
["af"] = { query = "@function.outer", desc = "Select around the function" },
["if"] = { query = "@function.inner", desc = "Select inside of the function" },
["ac"] = { query = "@class.outer", desc = "Select around the class" },
["ic"] = { query = "@class.inner", desc = "Select inside of the class" },
["al"] = { query = "@loop.outer", desc = "Select around the loop" },
["il"] = { query = "@loop.inner", desc = "Select inside of the loop" },
["as"] = { query = "@scope", query_group = "locals", desc = "Select around the scope" },
},
},
move = {
-- Jump to next and previous text objects
enable = true,
goto_next_start = {
["]f"] = { query = "@function.outer", desc = "Goto next inner function start" },
["]c"] = { query = "@class.outer", desc = "Goto next inner class start" },
},
goto_next_end = {
["]F"] = { query = "@function.outer", desc = "Goto next outer function end" },
["]C"] = { query = "@class.outer", desc = "Goto next outer class end" },
},
goto_previous_start = {
["[f"] = { query = "@function.outer", desc = "Goto goto previous inner function start" },
["[c"] = { query = "@class.outer", desc = "Previous inner class start" },
},
goto_previous_end = {
["[F"] = { query = "@function.outer", desc = "Goto goto previous outer function start" },
["[C"] = { query = "@class.outer", desc = "Goto previous outer class start" },
},
},
lsp_interop = {
enable = true,
border = "none",
floating_preview_opts = {},
peek_definition_code = {
-- TIP: Press the shortcut 2 times to enter the floating window
["<leader>df"] = { query = "@function.outer", desc = "Peek function definition on a popup" },
["<leader>dF"] = { query = "@class.outer", desc = "Peek class definition on a popup" },
},
},
},
})
end, 0)
end,
},
}

View File

@@ -1,12 +0,0 @@
return {
-- Don't measure startuptime
{ "dstein64/vim-startuptime", enabled = false },
-- Session management.
{
"folke/persistence.nvim",
opts = {
dir = vim.fn.expand(vim.fn.stdpath("config") .. "/sessions/"),
},
},
}

View File

@@ -0,0 +1,62 @@
return {
-- Navigate between NVIM & Tmux splits seamlessly
{ "christoomey/vim-tmux-navigator" },
-- Open Kitty terminal scrollback as buffer
{
"mikesmithgh/kitty-scrollback.nvim",
lazy = true,
cmd = { "KittyScrollbackGenerateKittens", "KittyScrollbackCheckHealth" },
event = { "User KittyScrollbackLaunch" },
version = "^3.0.0",
opts = {
status_window = {
icons = { nvim = "" },
},
},
config = function()
require("kitty-scrollback").setup()
end,
},
{
"folke/which-key.nvim",
config = function()
-- document existing key chains
require("which-key").register({
["<leader>e"] = { name = "[E]xplorer", _ = "which_key_ignore" },
["<leader>c"] = { name = "[C]ode", _ = "which_key_ignore" },
["<leader>d"] = { name = "[D]ocument", _ = "which_key_ignore" },
["<leader>g"] = { name = "[G]it", _ = "which_key_ignore" },
["<leader>h"] = { name = "Git [H]unk", _ = "which_key_ignore" },
["<leader>r"] = { name = "[R]ename", _ = "which_key_ignore" },
["<leader>s"] = { name = "[S]earch", _ = "which_key_ignore" },
["<leader>t"] = { name = "[T]oggle", _ = "which_key_ignore" },
["<leader>w"] = { name = "[W]orkspace", _ = "which_key_ignore" },
})
-- register which-key VISUAL mode
-- required for visual <leader>hs (hunk stage) to work
require("which-key").register({
["<leader>"] = { name = "VISUAL <leader>" },
["<leader>h"] = { "Git [H]unk" },
}, { mode = "v" })
end,
},
-- Session management. This saves your session in the background,
-- keeping track of open buffers, window arrangement, and more.
-- You can restore sessions when returning through the dashboard.
{
-- TODO:
-- 1. Find out where they are stored exactly.
-- 2. Add them to source control
-- 3. Need a startup dashboard with options for loading last session
"folke/persistence.nvim",
event = "BufReadPre",
opts = { options = vim.opt.sessionoptions:get() },
keys = {
{ "<leader>sr", function() require("persistence").load() end, desc = "[R]estore [S]ession" },
{ "<leader>sl", function() require("persistence").load({ last = true }) end, desc = "[R]estore [L]ast Session" },
},
},
}