initial commit
This commit is contained in:
31
.config/nvim/init.lua
Normal file
31
.config/nvim/init.lua
Normal file
@@ -0,0 +1,31 @@
|
||||
vim.g.mapleader = " "
|
||||
|
||||
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({
|
||||
{ import = "plugins" },
|
||||
})
|
||||
|
||||
vim.keymap.set("n", "<leader>e", vim.cmd.Ex)
|
||||
vim.keymap.set("n", "<leader>ww", vim.cmd.w)
|
||||
|
||||
vim.opt.number = true
|
||||
vim.opt.relativenumber = true
|
||||
vim.opt.wrap = false
|
||||
|
||||
local builtin = require("telescope.builtin")
|
||||
vim.keymap.set("n", "<leader>ff", builtin.find_files, { desc = "Telescope find files" })
|
||||
vim.keymap.set("n", "<leader>fg", builtin.live_grep, { desc = "Telescope live grep" })
|
||||
vim.keymap.set("n", "<leader>fb", builtin.buffers, { desc = "Telescope buffers" })
|
||||
vim.keymap.set("n", "<leader>fh", builtin.help_tags, { desc = "Telescope help tags" })
|
||||
24
.config/nvim/lazy-lock.json
Normal file
24
.config/nvim/lazy-lock.json
Normal file
@@ -0,0 +1,24 @@
|
||||
{
|
||||
"LuaSnip": { "branch": "master", "commit": "dae4f5aaa3574bd0c2b9dd20fb9542a02c10471c" },
|
||||
"catppuccin": { "branch": "main", "commit": "c4d475e4b5684747cde9b3f849186af7837d4397" },
|
||||
"cmp-buffer": { "branch": "main", "commit": "b74fab3656eea9de20a9b8116afa3cfc4ec09657" },
|
||||
"cmp-nvim-lsp": { "branch": "main", "commit": "cbc7b02bb99fae35cb42f514762b89b5126651ef" },
|
||||
"cmp-path": { "branch": "main", "commit": "c642487086dbd9a93160e1679a1327be111cbc25" },
|
||||
"cmp_luasnip": { "branch": "master", "commit": "98d9cb5c2c38532bd9bdb481067b20fea8f32e90" },
|
||||
"conform.nvim": { "branch": "master", "commit": "40dcec5555f960b0a04340d76eabdf4efe78599d" },
|
||||
"friendly-snippets": { "branch": "main", "commit": "6cd7280adead7f586db6fccbd15d2cac7e2188b9" },
|
||||
"lazy.nvim": { "branch": "main", "commit": "306a05526ada86a7b30af95c5cc81ffba93fef97" },
|
||||
"lazydev.nvim": { "branch": "main", "commit": "5231c62aa83c2f8dc8e7ba957aa77098cda1257d" },
|
||||
"lspkind-nvim": { "branch": "master", "commit": "c7274c48137396526b59d86232eabcdc7fed8a32" },
|
||||
"mason-lspconfig.nvim": { "branch": "main", "commit": "a324581a3c83fdacdb9804b79de1cbe00ce18550" },
|
||||
"mason-null-ls.nvim": { "branch": "main", "commit": "8e7806acaa87fae64f0bfde25bb4b87c18bd19b4" },
|
||||
"mason.nvim": { "branch": "main", "commit": "44d1e90e1f66e077268191e3ee9d2ac97cc18e65" },
|
||||
"none-ls.nvim": { "branch": "main", "commit": "f61f46ded0ca9edce7a09b674f8e162d10921426" },
|
||||
"nvim-cmp": { "branch": "main", "commit": "da88697d7f45d16852c6b2769dc52387d1ddc45f" },
|
||||
"nvim-lspconfig": { "branch": "master", "commit": "ead0f5f342d8d323441e7d4b88f0fc436a81ad5f" },
|
||||
"nvim-treesitter": { "branch": "main", "commit": "544320a9cf5d6bf539ec1cc54d393064015670c4" },
|
||||
"opencode.nvim": { "branch": "main", "commit": "7cae6b64cb2fe41bb515d9eec6e0da2494656706" },
|
||||
"plenary.nvim": { "branch": "master", "commit": "b9fd5226c2f76c951fc8ed5923d85e4de065e509" },
|
||||
"telescope-fzf-native.nvim": { "branch": "main", "commit": "6fea601bd2b694c6f2ae08a6c6fab14930c60e2c" },
|
||||
"telescope.nvim": { "branch": "master", "commit": "3333a52ff548ba0a68af6d8da1e54f9cd96e9179" }
|
||||
}
|
||||
69
.config/nvim/lua/plugins/cmp.lua
Normal file
69
.config/nvim/lua/plugins/cmp.lua
Normal file
@@ -0,0 +1,69 @@
|
||||
-- Autocompletion engine with LSP, snippet, buffer, and path sources.
|
||||
-- Keymaps: Tab/S-Tab (navigate), Enter (confirm), Ctrl-Space (trigger), Esc (dismiss).
|
||||
-- See README.md "Autocomplete" section for full usage details.
|
||||
return {
|
||||
"hrsh7th/nvim-cmp",
|
||||
dependencies = {
|
||||
"hrsh7th/cmp-nvim-lsp", -- LSP completion source
|
||||
"hrsh7th/cmp-buffer", -- Buffer word completion source
|
||||
"hrsh7th/cmp-path", -- Filesystem path completion source
|
||||
"saadparwaiz1/cmp_luasnip", -- Snippet completion source (bridges LuaSnip)
|
||||
"L3MON4D3/LuaSnip", -- Snippet engine
|
||||
"onsails/lspkind-nvim", -- Completion menu icons
|
||||
},
|
||||
config = function()
|
||||
local cmp = require("cmp")
|
||||
local luasnip = require("luasnip")
|
||||
local lspkind = require("lspkind")
|
||||
|
||||
cmp.setup({
|
||||
snippet = {
|
||||
expand = function(args)
|
||||
luasnip.lsp_expand(args.body)
|
||||
end,
|
||||
},
|
||||
mapping = cmp.mapping.preset.insert({
|
||||
["<Tab>"] = cmp.mapping.select_next_item({ behavior = cmp.SelectBehavior.Select }),
|
||||
["<S-Tab>"] = cmp.mapping.select_prev_item({ behavior = cmp.SelectBehavior.Select }),
|
||||
["<CR>"] = cmp.mapping.confirm({ select = true }),
|
||||
["<C-Space>"] = cmp.mapping.complete(),
|
||||
["<Esc>"] = cmp.mapping.abort(),
|
||||
}),
|
||||
sources = cmp.config.sources({
|
||||
{ name = "nvim_lsp" },
|
||||
{ name = "luasnip" },
|
||||
{
|
||||
name = "buffer",
|
||||
keyword_length = 2,
|
||||
option = {
|
||||
get_bufnrs = function()
|
||||
local bufs = {}
|
||||
for _, buf in ipairs(vim.api.nvim_list_bufs()) do
|
||||
if vim.api.nvim_buf_is_loaded(buf) then
|
||||
bufs[#bufs + 1] = buf
|
||||
end
|
||||
end
|
||||
return bufs
|
||||
end,
|
||||
},
|
||||
},
|
||||
{ name = "path" },
|
||||
}),
|
||||
formatting = {
|
||||
format = lspkind.cmp_format({
|
||||
mode = "symbol_text",
|
||||
menu = {
|
||||
nvim_lsp = "[LSP]",
|
||||
luasnip = "[Snippet]",
|
||||
buffer = "[Buffer]",
|
||||
path = "[Path]",
|
||||
},
|
||||
}),
|
||||
},
|
||||
window = {
|
||||
documentation = cmp.config.window.bordered(),
|
||||
},
|
||||
})
|
||||
|
||||
end,
|
||||
}
|
||||
11
.config/nvim/lua/plugins/colorscheme.lua
Normal file
11
.config/nvim/lua/plugins/colorscheme.lua
Normal file
@@ -0,0 +1,11 @@
|
||||
return {
|
||||
"catppuccin/nvim",
|
||||
name = "catppuccin",
|
||||
priority = 1000,
|
||||
config = function()
|
||||
require("catppuccin").setup({
|
||||
flavour = "mocha",
|
||||
})
|
||||
vim.cmd.colorscheme("catppuccin")
|
||||
end,
|
||||
}
|
||||
33
.config/nvim/lua/plugins/conform.lua
Normal file
33
.config/nvim/lua/plugins/conform.lua
Normal file
@@ -0,0 +1,33 @@
|
||||
return {
|
||||
"stevearc/conform.nvim",
|
||||
event = { "BufWritePre" },
|
||||
cmd = { "ConformInfo" },
|
||||
opts = {
|
||||
formatters_by_ft = {
|
||||
lua = { "stylua" },
|
||||
javascript = { "prettier" },
|
||||
typescript = { "prettier" },
|
||||
javascriptreact = { "prettier" },
|
||||
typescriptreact = { "prettier" },
|
||||
json = { "prettier" },
|
||||
yaml = { "prettier" },
|
||||
markdown = { "prettier" },
|
||||
python = { "ruff_format" },
|
||||
go = { "gofmt" },
|
||||
},
|
||||
format_on_save = {
|
||||
timeout_ms = 500,
|
||||
lsp_fallback = true,
|
||||
},
|
||||
},
|
||||
keys = {
|
||||
{
|
||||
"<leader>f",
|
||||
function()
|
||||
require("conform").format({ async = true, lsp_fallback = true })
|
||||
end,
|
||||
mode = "",
|
||||
desc = "Format buffer",
|
||||
},
|
||||
},
|
||||
}
|
||||
10
.config/nvim/lua/plugins/lazydev.lua
Normal file
10
.config/nvim/lua/plugins/lazydev.lua
Normal file
@@ -0,0 +1,10 @@
|
||||
return {
|
||||
"folke/lazydev.nvim",
|
||||
ft = "lua",
|
||||
opts = {
|
||||
library = {
|
||||
-- Load luvit types when using `vim.uv`
|
||||
{ path = "${3rd}/luv/library", words = { "vim%.uv" } },
|
||||
},
|
||||
},
|
||||
}
|
||||
16
.config/nvim/lua/plugins/lspconfig.lua
Normal file
16
.config/nvim/lua/plugins/lspconfig.lua
Normal file
@@ -0,0 +1,16 @@
|
||||
return {
|
||||
"neovim/nvim-lspconfig",
|
||||
config = function()
|
||||
vim.diagnostic.config({
|
||||
virtual_text = true,
|
||||
signs = true,
|
||||
update_in_insert = false,
|
||||
underline = true,
|
||||
severity_sort = true,
|
||||
float = {
|
||||
border = "rounded",
|
||||
source = "always",
|
||||
},
|
||||
})
|
||||
end,
|
||||
}
|
||||
11
.config/nvim/lua/plugins/luasnip.lua
Normal file
11
.config/nvim/lua/plugins/luasnip.lua
Normal file
@@ -0,0 +1,11 @@
|
||||
-- Snippet engine with pre-built VS Code-style snippets from friendly-snippets.
|
||||
-- Snippets are lazy-loaded per filetype. Used by nvim-cmp as a completion source.
|
||||
return {
|
||||
"L3MON4D3/LuaSnip",
|
||||
dependencies = {
|
||||
"rafamadriz/friendly-snippets", -- Community-maintained snippet collection
|
||||
},
|
||||
config = function()
|
||||
require("luasnip.loaders.from_vscode").lazy_load()
|
||||
end,
|
||||
}
|
||||
20
.config/nvim/lua/plugins/mason-lspconfig.lua
Normal file
20
.config/nvim/lua/plugins/mason-lspconfig.lua
Normal file
@@ -0,0 +1,20 @@
|
||||
-- Bridges Mason and lspconfig: auto-installs and enables language servers.
|
||||
-- Injects nvim-cmp capabilities globally so all LSP servers support enhanced completions.
|
||||
return {
|
||||
"williamboman/mason-lspconfig.nvim",
|
||||
dependencies = {
|
||||
"williamboman/mason.nvim",
|
||||
"neovim/nvim-lspconfig",
|
||||
"hrsh7th/cmp-nvim-lsp", -- Required for completion capabilities
|
||||
},
|
||||
config = function()
|
||||
local capabilities = require("cmp_nvim_lsp").default_capabilities()
|
||||
vim.lsp.config("*", {
|
||||
capabilities = capabilities,
|
||||
})
|
||||
require("mason-lspconfig").setup({
|
||||
automatic_installation = true,
|
||||
automatic_enable = true,
|
||||
})
|
||||
end,
|
||||
}
|
||||
13
.config/nvim/lua/plugins/mason-null-ls.lua
Normal file
13
.config/nvim/lua/plugins/mason-null-ls.lua
Normal file
@@ -0,0 +1,13 @@
|
||||
return {
|
||||
"jay-babu/mason-null-ls.nvim",
|
||||
dependencies = {
|
||||
"williamboman/mason.nvim",
|
||||
"nvimtools/none-ls.nvim",
|
||||
},
|
||||
config = function()
|
||||
require("mason-null-ls").setup({
|
||||
automatic_installation = true,
|
||||
handlers = {},
|
||||
})
|
||||
end,
|
||||
}
|
||||
4
.config/nvim/lua/plugins/mason.lua
Normal file
4
.config/nvim/lua/plugins/mason.lua
Normal file
@@ -0,0 +1,4 @@
|
||||
return {
|
||||
"williamboman/mason.nvim",
|
||||
config = true,
|
||||
}
|
||||
10
.config/nvim/lua/plugins/none-ls.lua
Normal file
10
.config/nvim/lua/plugins/none-ls.lua
Normal file
@@ -0,0 +1,10 @@
|
||||
return {
|
||||
"nvimtools/none-ls.nvim",
|
||||
dependencies = { "nvim-lua/plenary.nvim" },
|
||||
config = function()
|
||||
local null_ls = require("null-ls")
|
||||
null_ls.setup({
|
||||
sources = {},
|
||||
})
|
||||
end,
|
||||
}
|
||||
66
.config/nvim/lua/plugins/opencode.lua
Normal file
66
.config/nvim/lua/plugins/opencode.lua
Normal file
@@ -0,0 +1,66 @@
|
||||
return {
|
||||
"nickjvandyke/opencode.nvim",
|
||||
version = "*", -- Latest stable release
|
||||
dependencies = {
|
||||
{
|
||||
-- `snacks.nvim` integration is recommended, but optional
|
||||
---@module "snacks" <- Loads `snacks.nvim` types for configuration intellisense
|
||||
"folke/snacks.nvim",
|
||||
optional = true,
|
||||
opts = {
|
||||
input = {}, -- Enhances `ask()`
|
||||
picker = { -- Enhances `select()`
|
||||
actions = {
|
||||
opencode_send = function(...)
|
||||
return require("opencode").snacks_picker_send(...)
|
||||
end,
|
||||
},
|
||||
win = {
|
||||
input = {
|
||||
keys = {
|
||||
["<a-a>"] = { "opencode_send", mode = { "n", "i" } },
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
config = function()
|
||||
---@type opencode.Opts
|
||||
vim.g.opencode_opts = {
|
||||
-- Your configuration, if any; goto definition on the type or field for details
|
||||
}
|
||||
|
||||
vim.o.autoread = true -- Required for `opts.events.reload`
|
||||
|
||||
-- Recommended/example keymaps
|
||||
vim.keymap.set({ "n", "x" }, "<C-a>", function()
|
||||
require("opencode").ask("@this: ", { submit = true })
|
||||
end, { desc = "Ask opencode…" })
|
||||
vim.keymap.set({ "n", "x" }, "<C-x>", function()
|
||||
require("opencode").select()
|
||||
end, { desc = "Execute opencode action…" })
|
||||
vim.keymap.set({ "n", "t" }, "<C-.>", function()
|
||||
require("opencode").toggle()
|
||||
end, { desc = "Toggle opencode" })
|
||||
|
||||
vim.keymap.set({ "n", "x" }, "go", function()
|
||||
return require("opencode").operator("@this ")
|
||||
end, { desc = "Add range to opencode", expr = true })
|
||||
vim.keymap.set("n", "goo", function()
|
||||
return require("opencode").operator("@this ") .. "_"
|
||||
end, { desc = "Add line to opencode", expr = true })
|
||||
|
||||
vim.keymap.set("n", "<S-C-u>", function()
|
||||
require("opencode").command("session.half.page.up")
|
||||
end, { desc = "Scroll opencode up" })
|
||||
vim.keymap.set("n", "<S-C-d>", function()
|
||||
require("opencode").command("session.half.page.down")
|
||||
end, { desc = "Scroll opencode down" })
|
||||
|
||||
-- You may want these if you use the opinionated `<C-a>` and `<C-x>` keymaps above — otherwise consider `<leader>o…` (and remove terminal mode from the `toggle` keymap)
|
||||
vim.keymap.set("n", "+", "<C-a>", { desc = "Increment under cursor", noremap = true })
|
||||
vim.keymap.set("n", "-", "<C-x>", { desc = "Decrement under cursor", noremap = true })
|
||||
end,
|
||||
}
|
||||
9
.config/nvim/lua/plugins/telescope.lua
Normal file
9
.config/nvim/lua/plugins/telescope.lua
Normal file
@@ -0,0 +1,9 @@
|
||||
return {
|
||||
"nvim-telescope/telescope.nvim",
|
||||
version = "*",
|
||||
dependencies = {
|
||||
"nvim-lua/plenary.nvim",
|
||||
-- optional but recommended
|
||||
{ "nvim-telescope/telescope-fzf-native.nvim", build = "make" },
|
||||
},
|
||||
}
|
||||
5
.config/nvim/lua/plugins/treesitter.lua
Normal file
5
.config/nvim/lua/plugins/treesitter.lua
Normal file
@@ -0,0 +1,5 @@
|
||||
return {
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
lazy = false,
|
||||
build = ":TSUpdate",
|
||||
}
|
||||
Reference in New Issue
Block a user