feat: migrated plugin manager from lazy to vim.pack
This commit is contained in:
@@ -1,29 +1,47 @@
|
||||
-- Basic settings
|
||||
vim.o.number = true -- Enable line numbers
|
||||
vim.o.number = true -- Enable line numbers
|
||||
vim.o.relativenumber = true -- Enable relative line numbers
|
||||
vim.o.tabstop = 4 -- Number of spaces a tab represents
|
||||
vim.o.shiftwidth = 4 -- Number of spaces for each indentation
|
||||
vim.o.expandtab = true -- Convert tabs to spaces
|
||||
vim.o.smartindent = true -- Automatically indent new lines
|
||||
vim.o.wrap = false -- Disable line wrapping
|
||||
vim.o.cursorline = true -- Highlight the current line
|
||||
vim.o.termguicolors = true -- Enable 24-bit RGB colors
|
||||
vim.o.tabstop = 4 -- Number of spaces a tab represents
|
||||
vim.o.shiftwidth = 4 -- Number of spaces for each indentation
|
||||
vim.o.expandtab = true -- Convert tabs to spaces
|
||||
vim.o.smartindent = true -- Automatically indent new lines
|
||||
vim.o.wrap = false -- Disable line wrapping
|
||||
vim.o.cursorline = true -- Highlight the current line
|
||||
vim.o.termguicolors = true -- Enable 24-bit RGB colors
|
||||
vim.o.clipboard = "unnamedplus"
|
||||
vim.filetype.add({extension = {svx = "markdown"}})
|
||||
vim.filetype.add({ extension = { svx = "markdown" } })
|
||||
|
||||
require('plugins.nvim-neo-tree')
|
||||
require('plugins.rose-pine')
|
||||
require('plugins.treesitter')
|
||||
require('plugins.conform')
|
||||
require('plugins.lsp')
|
||||
|
||||
-- Syntax highlighting and filetype plugins
|
||||
vim.cmd('syntax enable')
|
||||
vim.cmd('filetype plugin indent on')
|
||||
|
||||
|
||||
require("config.lazy")
|
||||
--vim.cmd[[colorscheme tokyonight]]
|
||||
|
||||
vim.api.nvim_create_user_command(
|
||||
"Inlay",
|
||||
function()
|
||||
vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled())
|
||||
end,
|
||||
{desc = 'Toggles Inlay Hints'}
|
||||
{ desc = 'Toggles Inlay Hints' }
|
||||
)
|
||||
vim.api.nvim_create_autocmd('LspAttach', {
|
||||
callback = function(ev)
|
||||
local client = vim.lsp.get_client_by_id(ev.data.client_id)
|
||||
if client and client:supports_method(vim.lsp.protocol.Methods.textDocument_completion) then
|
||||
vim.opt.completeopt = { 'menu', 'menuone', 'noinsert', 'fuzzy', 'popup' }
|
||||
vim.lsp.completion.enable(true, client.id, ev.buf, { autotrigger = true })
|
||||
vim.keymap.set('i', '<C-Space>', function()
|
||||
vim.lsp.completion.get()
|
||||
end)
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
vim.diagnostic.config({
|
||||
virtual_lines = {
|
||||
current_line = true,
|
||||
},
|
||||
})
|
||||
|
||||
@@ -1,35 +0,0 @@
|
||||
-- Bootstrap lazy.nvim
|
||||
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
|
||||
if not (vim.uv or vim.loop).fs_stat(lazypath) then
|
||||
local lazyrepo = "https://github.com/folke/lazy.nvim.git"
|
||||
local out = vim.fn.system({ "git", "clone", "--filter=blob:none", "--branch=stable", lazyrepo, lazypath })
|
||||
if vim.v.shell_error ~= 0 then
|
||||
vim.api.nvim_echo({
|
||||
{ "Failed to clone lazy.nvim:\n", "ErrorMsg" },
|
||||
{ out, "WarningMsg" },
|
||||
{ "\nPress any key to exit..." },
|
||||
}, true, {})
|
||||
vim.fn.getchar()
|
||||
os.exit(1)
|
||||
end
|
||||
end
|
||||
vim.opt.rtp:prepend(lazypath)
|
||||
|
||||
-- Make sure to setup `mapleader` and `maplocalleader` before
|
||||
-- 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 your plugins
|
||||
{ import = "plugins" },
|
||||
},
|
||||
-- Configure any other settings here. See the documentation for more details.
|
||||
-- colorscheme that will be used when installing plugins.
|
||||
install = { colorscheme = {"tokyonight", "habamax" } },
|
||||
-- automatically check for plugin updates
|
||||
checker = { enabled = true, notify = false },
|
||||
})
|
||||
24
.config/nvim/lua/plugins/conform.lua
Normal file
24
.config/nvim/lua/plugins/conform.lua
Normal file
@@ -0,0 +1,24 @@
|
||||
vim.pack.add({
|
||||
'https://github.com/stevearc/conform.nvim'
|
||||
})
|
||||
|
||||
require('conform').setup({
|
||||
formatters_by_ft = {
|
||||
cpp = { "clang-format" },
|
||||
python = { "black" }
|
||||
},
|
||||
-- Set default options
|
||||
default_format_opts = {
|
||||
lsp_format = "fallback",
|
||||
},
|
||||
-- Set up format-on-save
|
||||
format_on_save = { timeout_ms = 1000 },
|
||||
-- Customize formatters
|
||||
formatters = {
|
||||
['clang-format'] = {
|
||||
append_args = function(self, ctx)
|
||||
return { "-style={IndentWidth: 4}" }
|
||||
end,
|
||||
},
|
||||
},
|
||||
})
|
||||
@@ -1,76 +1,25 @@
|
||||
vim.pack.add({
|
||||
'https://github.com/neovim/nvim-lspconfig',
|
||||
'https://github.com/mason-org/mason.nvim',
|
||||
'https://github.com/mason-org/mason-lspconfig.nvim',
|
||||
})
|
||||
|
||||
return {
|
||||
|
||||
{
|
||||
"neovim/nvim-lspconfig",
|
||||
},
|
||||
{
|
||||
"mason-org/mason.nvim",
|
||||
opts = {
|
||||
ui = {
|
||||
icons = {
|
||||
package_installed = "✓",
|
||||
package_pending = "➜",
|
||||
package_uninstalled = "✗"
|
||||
}
|
||||
}
|
||||
require('mason').setup({
|
||||
ui = {
|
||||
icons = {
|
||||
package_installed = "✓",
|
||||
package_pending = "➜",
|
||||
package_uninstalled = "✗"
|
||||
}
|
||||
},
|
||||
{
|
||||
"williamboman/mason-lspconfig.nvim",
|
||||
opts = {
|
||||
ensure_installed = {
|
||||
"svelte",
|
||||
"clangd",
|
||||
"ts_ls",
|
||||
"pyright"
|
||||
},
|
||||
},
|
||||
dependencies = {
|
||||
{ "mason-org/mason.nvim", opts = {} },
|
||||
"neovim/nvim-lspconfig",
|
||||
},
|
||||
},
|
||||
{
|
||||
'hrsh7th/nvim-cmp',
|
||||
opts = {
|
||||
sources = {
|
||||
{ name = 'nvim_lsp' },
|
||||
{ name = 'buffer' },
|
||||
{ name = 'path' },
|
||||
}
|
||||
},
|
||||
event = "InsertEnter",
|
||||
dependencies = {
|
||||
{'L3MON4D3/LuaSnip'},
|
||||
{'hrsh7th/cmp-buffer'},
|
||||
{'hrsh7th/cmp-nvim-lsp'},
|
||||
{'saadparwaiz1/cmp_luasnip'},
|
||||
},
|
||||
},
|
||||
{
|
||||
'stevearc/conform.nvim',
|
||||
opts = {
|
||||
-- Define your formatters
|
||||
formatters_by_ft = {
|
||||
cpp = { "clang-format" },
|
||||
python = {"black"}
|
||||
},
|
||||
-- Set default options
|
||||
default_format_opts = {
|
||||
lsp_format = "fallback",
|
||||
},
|
||||
-- Set up format-on-save
|
||||
format_on_save = { timeout_ms = 1000 },
|
||||
-- Customize formatters
|
||||
formatters = {
|
||||
['clang-format'] = {
|
||||
append_args = function(self, ctx)
|
||||
return { "-style={IndentWidth: 4}" }
|
||||
end,
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
})
|
||||
require('mason-lspconfig').setup({
|
||||
ensure_installed = {
|
||||
"svelte",
|
||||
"clangd",
|
||||
"ts_ls",
|
||||
"pyright",
|
||||
"lua_ls"
|
||||
},
|
||||
automatic_enable = true,
|
||||
})
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
return {
|
||||
"nvim-neo-tree/neo-tree.nvim",
|
||||
branch = "v3.x",
|
||||
dependencies = {
|
||||
"nvim-lua/plenary.nvim",
|
||||
"nvim-tree/nvim-web-devicons", -- not strictly required, but recommended
|
||||
"MunifTanjim/nui.nvim",
|
||||
{"3rd/image.nvim", opts = {}}, -- Optional image support in preview window: See `# Preview Mode` for more information
|
||||
}
|
||||
}
|
||||
vim.pack.add({
|
||||
--Neo-Tree
|
||||
'https://github.com/MunifTanjim/nui.nvim',
|
||||
'https://github.com/nvim-lua/plenary.nvim',
|
||||
"https://github.com/nvim-tree/nvim-web-devicons",
|
||||
'https://github.com/nvim-neo-tree/neo-tree.nvim',
|
||||
})
|
||||
|
||||
require("neo-tree").setup({
|
||||
close_if_last_window = true,
|
||||
})
|
||||
|
||||
@@ -1,17 +1,14 @@
|
||||
return {
|
||||
"rose-pine/neovim",
|
||||
name = "rose-pine",
|
||||
|
||||
config = function()
|
||||
local configs = require("rose-pine");
|
||||
|
||||
configs.setup({
|
||||
variant = "moon",
|
||||
styles = {
|
||||
transparency = true;
|
||||
}
|
||||
})
|
||||
vim.pack.add({
|
||||
'https://github.com/rose-pine/neovim',
|
||||
})
|
||||
|
||||
vim.cmd("colorscheme rose-pine")
|
||||
end
|
||||
}
|
||||
require("rose-pine").setup({
|
||||
variant = "moon",
|
||||
styles = {
|
||||
transparency = true;
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
vim.cmd[[colorscheme rose-pine]]
|
||||
|
||||
@@ -1,20 +1,11 @@
|
||||
return{
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
build = ":TSUpdate",
|
||||
dependencies = {
|
||||
-- Automatically install LSPs and related tools to stdpath for Neovim
|
||||
"williamboman/mason.nvim",
|
||||
"williamboman/mason-lspconfig.nvim",
|
||||
},
|
||||
config = function ()
|
||||
vim.pack.add({
|
||||
'https://github.com/nvim-treesitter/nvim-treesitter'
|
||||
})
|
||||
|
||||
local treesitter = require("nvim-treesitter")
|
||||
require('nvim-treesitter').setup({})
|
||||
require('nvim-treesitter').install( {'lua','rust', 'javascript', 'zig', "c","typescript", "cpp","haskell","svelte","python", "vim", "vimdoc", "html" })
|
||||
|
||||
treesitter.setup({
|
||||
ensure_installed = { "c", "cpp","haskell", "lua","svelte","python", "vim", "vimdoc", "query", "elixir", "heex", "javascript", "html" },
|
||||
sync_install = false,
|
||||
highlight = { enable = true },
|
||||
indent = { enable = true },
|
||||
})
|
||||
end
|
||||
}
|
||||
vim.api.nvim_create_autocmd('FileType', {
|
||||
pattern = { 'python', 'lua' },
|
||||
callback = function() vim.treesitter.start() end,
|
||||
})
|
||||
|
||||
44
.config/nvim/nvim-pack-lock.json
Normal file
44
.config/nvim/nvim-pack-lock.json
Normal file
@@ -0,0 +1,44 @@
|
||||
{
|
||||
"plugins": {
|
||||
"conform.nvim": {
|
||||
"rev": "40dcec5555f960b0a04340d76eabdf4efe78599d",
|
||||
"src": "https://github.com/stevearc/conform.nvim"
|
||||
},
|
||||
"mason-lspconfig.nvim": {
|
||||
"rev": "a324581a3c83fdacdb9804b79de1cbe00ce18550",
|
||||
"src": "https://github.com/mason-org/mason-lspconfig.nvim"
|
||||
},
|
||||
"mason.nvim": {
|
||||
"rev": "44d1e90e1f66e077268191e3ee9d2ac97cc18e65",
|
||||
"src": "https://github.com/mason-org/mason.nvim"
|
||||
},
|
||||
"neo-tree.nvim": {
|
||||
"rev": "9d6826582a3e8c84787bd7355df22a2812a1ad59",
|
||||
"src": "https://github.com/nvim-neo-tree/neo-tree.nvim"
|
||||
},
|
||||
"neovim": {
|
||||
"rev": "cf2a288696b03d0934da713d66c6d71557b5c997",
|
||||
"src": "https://github.com/rose-pine/neovim"
|
||||
},
|
||||
"nui.nvim": {
|
||||
"rev": "de740991c12411b663994b2860f1a4fd0937c130",
|
||||
"src": "https://github.com/MunifTanjim/nui.nvim"
|
||||
},
|
||||
"nvim-lspconfig": {
|
||||
"rev": "2163c54bb6cfec53e3e555665ada945b8c8331b9",
|
||||
"src": "https://github.com/neovim/nvim-lspconfig"
|
||||
},
|
||||
"nvim-treesitter": {
|
||||
"rev": "5cb05e1b0fa3c469958a2b26f36b3fe930af221c",
|
||||
"src": "https://github.com/nvim-treesitter/nvim-treesitter"
|
||||
},
|
||||
"nvim-web-devicons": {
|
||||
"rev": "737cf6c657898d0c697311d79d361288a1343d50",
|
||||
"src": "https://github.com/nvim-tree/nvim-web-devicons"
|
||||
},
|
||||
"plenary.nvim": {
|
||||
"rev": "b9fd5226c2f76c951fc8ed5923d85e4de065e509",
|
||||
"src": "https://github.com/nvim-lua/plenary.nvim"
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user