Files
neovim/init.lua
T
Christopher Williams 441bad3dde Initial Commit
2026-01-11 20:47:39 -05:00

343 lines
7.0 KiB
Lua

-- vim built in options
vim.g.mapleader = " "
vim.o.relativenumber = true
vim.o.number = true
vim.o.signcolumn = "yes"
vim.o.undofile = true
vim.o.tabstop = 4
vim.o.shiftwidth = 0
vim.o.expandtab = true
vim.wo[0][0].foldexpr = "v:lua.vim.treesitter.foldexpr()"
vim.wo[0][0].foldmethod = "expr"
vim.o.foldcolumn = "1"
vim.o.foldlevel = 99
vim.o.foldlevelstart = 99
vim.o.foldenable = true
-- require("vim._extui").enable({})
-- Lazy plugin manager
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
vim.fn.system({
"git",
"clone",
"--filter=blob:none",
"https://github.com/folke/lazy.nvim.git",
"--branch=stable",
lazypath,
})
end
vim.opt.rtp:prepend(lazypath)
require("lazy").setup({
{
"folke/tokyonight.nvim",
lazy = false,
priority = 1000,
opts = {},
},
{
"nvim-treesitter/nvim-treesitter",
build = ":TSUpdate",
config = function()
local ensureInstalled = {
"lua",
"python",
"javascript",
"typescript",
"java",
"go",
"rust",
"html",
"css",
"json",
"yaml",
"markdown",
"sql",
"org",
}
local alreadyInstalled = require("nvim-treesitter.config").get_installed()
local parsersToInstall = vim.iter(ensureInstalled)
:filter(function(parser)
return not vim.tbl_contains(alreadyInstalled, parser)
end)
:totable()
require("nvim-treesitter").install(parsersToInstall)
end,
},
{
"nvim-treesitter/nvim-treesitter-textobjects",
branch = "main",
},
{
"junegunn/fzf.vim",
dependencies = {
"https://github.com/junegunn/fzf",
},
keys = {
{ "<Leader><Leader>", "<Cmd>Files<CR>", desc = "Find files" },
{ "<Leader>,", "<Cmd>Buffers<CR>", desc = "Find buffers" },
{ "<Leader>/", "<Cmd>Rg<CR>", desc = "Search project" },
},
},
{
"stevearc/oil.nvim",
config = function()
require("oil").setup()
end,
keys = {
{ "-", "<Cmd>Oil<CR>", desc = "Browse files from here" },
},
},
{ "nvim-tree/nvim-web-devicons", opts = {} },
{
"NeogitOrg/neogit",
lazy = true,
dependencies = {
"nvim-lua/plenary.nvim", -- required
"sindrets/diffview.nvim", -- optional - Diff integration
},
cmd = "Neogit",
keys = {
{ "<leader>gg", "<cmd>Neogit<cr>", desc = "Show Neogit UI" },
},
},
{
"farmergreg/vim-lastplace",
event = "BufReadPost",
},
{
"windwp/nvim-autopairs",
event = "InsertEnter",
config = function()
require("nvim-autopairs").setup()
end,
},
{
"numToStr/Comment.nvim",
event = "VeryLazy",
config = function()
require("Comment").setup()
end,
},
{
"folke/flash.nvim",
event = "VeryLazy",
config = function()
require("flash").setup({
modes = {
search = {
enabled = true,
},
char = {
enabled = false,
},
},
})
end,
},
{
"folke/snacks.nvim",
priority = 1000,
lazy = false,
---@type snacks.Config
opts = {
bigfile = { enabled = true },
dashboard = { enabled = true },
explorer = { enabled = true },
indent = { enabled = true },
input = { enabled = true },
picker = { enabled = true },
notifier = { enabled = true },
quickfile = { enabled = true },
scope = { enabled = true },
scroll = {
enabled = true,
animate = {
duration = { step = 10, total = 100 },
easing = "linear",
},
},
statuscolumn = { enabled = true },
words = { enabled = true },
},
config = function(_, opts)
function floating_terminal()
require("snacks").terminal("fish", {
win = {
position = "float",
width = 0.8,
height = 0.8,
border = "rounded",
},
})
end
vim.keymap.set("n", "<leader>tf", floating_terminal, { desc = "Open floating terminal" })
vim.keymap.set("n", "<leader>\\", floating_terminal, { desc = "Open floating terminal" })
require("snacks").setup(opts)
end,
},
{
"lukas-reineke/indent-blankline.nvim",
event = { "VeryLazy" },
config = function()
require("ibl").setup()
end,
},
{
"https://github.com/nvim-lualine/lualine.nvim",
event = "VeryLazy",
config = function()
require("lualine").setup()
end,
},
{
"stevearc/conform.nvim",
opts = {},
config = function()
local conform = require("conform")
conform.setup({
formatters_by_ft = {
lua = { "stylua" },
python = {
"ruff_fix",
"ruff_format",
},
},
})
-- Command to format buffer or range
vim.api.nvim_create_user_command("Format", function(args)
local range = nil
if args.count ~= -1 then
local end_line = vim.api.nvim_buf_get_lines(0, args.line2 - 1, args.line2, true)[1]
range = {
start = { args.line1, 0 },
["end"] = { args.line2, end_line:len() },
}
end
require("conform").format({
async = true,
lsp_fallback = true,
range = range,
})
end, { range = true, desc = "Format buffer or range with conform.nvim" })
-- Keymap for format
vim.keymap.set("n", "<leader>lf", "<cmd>Format<cr>", { desc = "Format buffer with conform.nvim" })
end,
},
{
"serhez/bento.nvim",
config = function()
require("bento").setup({
main_keymap = ",",
})
end,
},
{
"zbirenbaum/copilot.lua",
dependencies = {
"copilotlsp-nvim/copilot-lsp",
},
cmd = "Copilot",
build = ":Copilot auth",
event = "BufReadPost",
config = function()
require("copilot").setup({
suggestion = {
enabled = true,
auto_trigger = true,
keymap = {
accept = "<M-j>",
accept_line = "<M-l>",
accept_word = "<M-k>",
next = "<M-]>",
prev = "<M-[>",
dismiss = "<M-c>",
},
},
nes = {
enabled = false,
keymap = {
accept_and_goto = "<leader>p",
accept = false,
dismiss = "<Esc>",
},
},
panel = { enabled = false },
filetypes = {
lua = true,
markdown = true,
help = true,
},
})
vim.api.nvim_create_autocmd("User", {
pattern = "BlinkCmpMenuOpen",
callback = function()
vim.b.copilot_suggestion_hidden = true
end,
})
vim.api.nvim_create_autocmd("User", {
pattern = "BlinkCmpMenuClose",
callback = function()
vim.b.copilot_suggestion_hidden = false
end,
})
end,
},
{
"CopilotC-Nvim/CopilotChat.nvim",
dependencies = {
{ "nvim-lua/plenary.nvim", branch = "master" },
},
build = "make tiktoken",
opts = {
-- See Configuration section for options
},
},
{
"nvim-orgmode/orgmode",
tag = "0.7.0",
event = "VeryLazy",
ft = { "org" },
config = function()
require("orgmode").setup({
org_agenda_files = "~/org/**/*",
org_default_notes_file = "~/org/refile.org",
})
end,
},
{
"chipsenkbeil/org-roam.nvim",
tag = "0.2.0",
config = function()
require("org-roam").setup({
directory = "~/org",
})
end,
},
{
"brianhuster/live-preview.nvim",
dependencies = {
"ibhagwan/fzf-lua",
},
},
require("plugins.lsp"),
})
-- LSP
vim.diagnostic.config({ virtual_text = true })
vim.lsp.inlay_hint.enable(true)
vim.lsp.enable({
"luals",
})
vim.cmd([[colorscheme tokyonight-night]])
require("keymap")