refactor: redid neovim config

This commit is contained in:
2025-01-23 07:46:05 +00:00
parent 85a46854fe
commit fbffcffe21
16 changed files with 132 additions and 251 deletions

View File

@@ -1,9 +0,0 @@
function Colors(color)
color = color or "rose-pine"
vim.cmd.colorscheme(color)
vim.api.nvim_set_hl(0, "Normal", { bg = "none" })
vim.api.nvim_set_hl(0, "NormalFloat", { bg = "none" })
end
Colors()

0
.config/nvim/init.lua Executable file → Normal file
View File

View File

@@ -1,20 +1,13 @@
{
"LuaSnip": { "branch": "master", "commit": "c9b9a22904c97d0eb69ccb9bab76037838326817" },
"autoclose.nvim": { "branch": "main", "commit": "b2077aa2c83df7ebc19b2a20a3a0654b24ae9c8f" },
"cmp-nvim-lsp": { "branch": "main", "commit": "99290b3ec1322070bcfb9e846450a46f6efa50f0" },
"cmp-nvim-lsp-signature-help": { "branch": "main", "commit": "031e6ba70b0ad5eee49fd2120ff7a2e325b17fa7" },
"cmp_luasnip": { "branch": "master", "commit": "98d9cb5c2c38532bd9bdb481067b20fea8f32e90" },
"conform.nvim": { "branch": "master", "commit": "bf94626f32fbc3c9987ce2f4aab60d96866587df" },
"conform.nvim": { "branch": "master", "commit": "f8d743ce333bedc47821de2cd4d23c43856ecbe5" },
"fidget.nvim": { "branch": "main", "commit": "a0abbf18084b77d28bc70e24752e4f4fd54aea17" },
"harpoon": { "branch": "harpoon2", "commit": "a84ab829eaf3678b586609888ef52f7779102263" },
"lazy.nvim": { "branch": "main", "commit": "d8f26efd456190241afd1b0f5235fe6fdba13d4a" },
"mason-lspconfig.nvim": { "branch": "main", "commit": "e942edf5c85b6a2ab74059ea566cac5b3e1514a4" },
"mason.nvim": { "branch": "main", "commit": "e2f7f9044ec30067bc11800a9e266664b88cda22" },
"neovim": { "branch": "main", "commit": "42f0724e0bca9f57f0bcfa688787c37b8d4befe8" },
"nvim-cmp": { "branch": "main", "commit": "8c82d0bd31299dbff7f8e780f5e06d2283de9678" },
"mini.nvim": { "branch": "main", "commit": "4446e834c30c799627d65691c73d59638e5c965f" },
"nvim-lspconfig": { "branch": "master", "commit": "513f4f0bde469ecb3abe2e1b606f63cf142e751e" },
"nvim-treesitter": { "branch": "master", "commit": "4862ab0aca21e92771b72e2d7e70424b250f0dd4" },
"nvim-ts-autotag": { "branch": "main", "commit": "1cca23c9da708047922d3895a71032bc0449c52d" },
"nvim-treesitter": { "branch": "master", "commit": "6587a5886873cce8698a47477224c30578b33a24" },
"plenary.nvim": { "branch": "master", "commit": "3707cdb1e43f5cea73afb6037e6494e7ce847a66" },
"rose-pine": { "branch": "main", "commit": "42f0724e0bca9f57f0bcfa688787c37b8d4befe8" },
"telescope.nvim": { "branch": "master", "commit": "415af52339215926d705cccc08145f3782c4d132" }
}

4
.config/nvim/lua/rocketcamel/config/lazy.lua Executable file → Normal file
View File

@@ -19,11 +19,13 @@ vim.opt.rtp:prepend(lazypath)
-- loading lazy.nvim so that mappings are correct.
-- This is also a good place to setup other settings (vim.opt)
vim.g.mapleader = " "
vim.g.maplocalleader = "\\"
-- Setup lazy.nvim
require("lazy").setup({
spec = {
{ import = "rocketcamel.plugins" }
-- import your plugins
{ import = "rocketcamel.plugins" },
},
-- Configure any other settings here. See the documentation for more details.
-- colorscheme that will be used when installing plugins.

0
.config/nvim/lua/rocketcamel/init.lua Executable file → Normal file
View File

View File

@@ -0,0 +1,20 @@
return {
{
"stevearc/conform.nvim",
opts = {
formatters_by_ft = {
lua = { "stylua" },
rust = { "rustfmt", lsp_format = "fallback" },
javascript = { "prettier" },
typescript = { "prettier" },
json = { "prettier" },
tsx = { "prettier" },
},
format_on_save = {
-- These options will be passed to conform.format()
timeout_ms = 500,
lsp_format = "fallback",
},
},
},
}

View File

@@ -1,193 +0,0 @@
return {
{
"nvim-telescope/telescope.nvim",
config = function()
local builtin = require("telescope.builtin")
vim.keymap.set("n", "<leader>pf", builtin.find_files, {})
vim.keymap.set("n", "<C-p>", builtin.git_files, {})
vim.keymap.set("n", "<leader>ps", function()
builtin.grep_string({ search = vim.fn.input("Grep > ") })
end)
end,
},
{
"nvim-treesitter/nvim-treesitter",
opts = {
ensure_installed = {
"c",
"lua",
"vim",
"vimdoc",
"query",
"markdown",
"markdown_inline",
"javascript",
"typescript",
"tsx",
"rust",
"zig",
},
sync_install = true,
auto_install = true,
highlight = {
enable = true,
additional_vim_regex_highlighting = false,
},
indent = {
enable = true,
},
},
},
{
"neovim/nvim-lspconfig",
dependencies = {
"williamboman/mason.nvim",
"williamboman/mason-lspconfig.nvim",
"hrsh7th/cmp-nvim-lsp",
"hrsh7th/nvim-cmp",
"j-hui/fidget.nvim",
"L3MON4D3/LuaSnip",
"saadparwaiz1/cmp_luasnip",
"hrsh7th/cmp-nvim-lsp-signature-help",
},
config = function()
require("fidget").setup({})
require("mason").setup()
local capabilities = require("cmp_nvim_lsp").default_capabilities()
require("mason-lspconfig").setup({
ensure_installed = {
"ts_ls",
"lua_ls",
"rust_analyzer",
},
handlers = {
function(server)
require("lspconfig")[server].setup({ capabilities = capabilities })
end,
},
})
local cmp = require("cmp")
cmp.setup({
preselect = "item",
completion = {
completeopt = "menu,menuone,noinsert"
},
snippet = {
-- REQUIRED - you must specify a snippet engine
expand = function(args)
require("luasnip").lsp_expand(args.body) -- For `luasnip` users.
end,
},
mapping = cmp.mapping.preset.insert({
-- Simple tab complete
["<Tab>"] = cmp.mapping(function(fallback)
local col = vim.fn.col(".") - 1
if cmp.visible() then
cmp.select_next_item({ behavior = "select" })
elseif col == 0 or vim.fn.getline("."):sub(col, col):match("%s") then
fallback()
else
cmp.complete()
end
end, { "i", "s" }),
-- Go to previous item
["<S-Tab>"] = cmp.mapping.select_prev_item({ behavior = "select" }),
["<CR>"] = cmp.mapping.confirm({ select = false }),
}),
sources = cmp.config.sources({
{ name = "nvim_lsp" },
{ name = "nvim_lsp_signature_help" },
}, {
{ name = "buffer" },
}),
})
end,
},
{
"stevearc/conform.nvim",
opts = {
formatters_by_ft = {
lua = { "stylua" },
rust = { "rustfmt", lsp_format = "fallback" },
javascript = { "prettier" },
typescript = { "prettier" },
json = { "prettier" },
tsx = { "prettier" },
},
format_on_save = {
-- These options will be passed to conform.format()
timeout_ms = 500,
lsp_format = "fallback",
},
},
},
{
"ThePrimeagen/harpoon",
branch = "harpoon2",
dependencies = { "nvim-lua/plenary.nvim" },
config = function()
local harpoon = require("harpoon")
harpoon:setup()
vim.keymap.set("n", "<leader>a", function()
harpoon:list():add()
end)
vim.keymap.set("n", "<C-e>", function()
harpoon.ui:toggle_quick_menu(harpoon:list())
end)
vim.keymap.set("n", "<C-h>", function()
harpoon:list():select(1)
end)
vim.keymap.set("n", "<C-t>", function()
harpoon:list():select(2)
end)
vim.keymap.set("n", "<C-n>", function()
harpoon:list():select(3)
end)
vim.keymap.set("n", "<C-s>", function()
harpoon:list():select(4)
end)
-- Toggle previous & next buffers stored within Harpoon list
vim.keymap.set("n", "<C-S-P>", function()
harpoon:list():prev()
end)
vim.keymap.set("n", "<C-S-N>", function()
harpoon:list():next()
end)
end,
},
{
"m4xshen/autoclose.nvim",
opts = {
keys = {
["("] = { escape = false, close = true, pair = "()" },
["["] = { escape = false, close = true, pair = "[]" },
["{"] = { escape = false, close = true, pair = "{}" },
[">"] = { escape = true, close = false, pair = "<>" },
[")"] = { escape = true, close = false, pair = "()" },
["]"] = { escape = true, close = false, pair = "[]" },
["}"] = { escape = true, close = false, pair = "{}" },
['"'] = { escape = true, close = true, pair = '""' },
["'"] = { escape = true, close = true, pair = "''" },
["`"] = { escape = true, close = true, pair = "``" },
},
options = {
disabled_filetypes = { "text", "TelescopePrompt" },
disable_when_touch = false,
touch_regex = "[%w(%[{]",
pair_spaces = false,
auto_indent = true,
disable_command_mode = false,
},
},
},
}

View File

@@ -0,0 +1,26 @@
return {
{
"neovim/nvim-lspconfig",
dependencies = {
"williamboman/mason.nvim",
"williamboman/mason-lspconfig.nvim",
"j-hui/fidget.nvim",
},
config = function()
require("mason").setup()
require("fidget").setup()
require("mason-lspconfig").setup({
ensure_installed = {
"ts_ls",
"lua_ls",
"rust_analyzer",
},
handlers = {
function(server)
require("lspconfig")[server].setup({})
end,
},
})
end,
},
}

View File

@@ -0,0 +1,11 @@
return {
{
"echasnovski/mini.nvim",
version = false,
config = function()
require("mini.completion").setup()
require("mini.fuzzy").setup()
require("mini.pairs").setup()
end,
},
}

View File

@@ -1,22 +0,0 @@
return {
"windwp/nvim-ts-autotag",
lazy = false,
config = function()
require("nvim-ts-autotag").setup({
opts = {
enable_close = true,
enable_rename = true,
enable_close_on_slash = false
}
})
end
-- opts = {
-- per_filetype = {
-- "html",
-- "javascript",
-- "javascriptreact",
-- "typescript",
-- "typescriptreact",
-- }
--}
}

8
.config/nvim/lua/rocketcamel/plugins/rose-pine.lua Executable file → Normal file
View File

@@ -1,6 +1,14 @@
return {
{
"rose-pine/neovim",
name = "rose-pine",
config = function()
require("rose-pine").setup({
styles = {
transparency = true,
},
})
vim.cmd("colorscheme rose-pine")
end,
},
}

View File

@@ -0,0 +1,13 @@
return {
{
"nvim-telescope/telescope.nvim",
config = function()
local builtin = require("telescope.builtin")
vim.keymap.set("n", "<leader>pf", builtin.find_files, {})
vim.keymap.set("n", "<C-p>", builtin.git_files, {})
vim.keymap.set("n", "<leader>ps", function()
builtin.grep_string({ search = vim.fn.input("Grep > ") })
end)
end,
},
}

View File

@@ -0,0 +1,30 @@
return {
{
"nvim-treesitter/nvim-treesitter",
opts = {
ensure_installed = {
"c",
"lua",
"vim",
"vimdoc",
"query",
"markdown",
"markdown_inline",
"javascript",
"typescript",
"tsx",
"rust",
"zig",
},
sync_install = true,
auto_install = true,
highlight = {
enable = true,
additional_vim_regex_highlighting = false,
},
indent = {
enable = true,
},
},
},
}

0
.config/nvim/lua/rocketcamel/remap.lua Executable file → Normal file
View File

0
.config/nvim/lua/rocketcamel/set.lua Executable file → Normal file
View File

View File

@@ -16,6 +16,8 @@
neovim
ripgrep
git
gcc
rustup
];
config.programs.nix-ld.enable = true;
}