feat: correct my lvim config

This commit is contained in:
doryan 2024-09-02 23:36:54 +04:00
parent 0da8243d12
commit b767beebd0
10 changed files with 178 additions and 21 deletions

View File

@ -7,6 +7,8 @@
lvim.colorscheme = "melange"
lvim.builtin.breadcrumbs.active = false
vim.list_extend(lvim.lsp.automatic_configuration.skipped_servers, { "rust_analyzer", "rust-analyzer" })
require "plugins.init"
require "mappings"
require "configs.noice"
@ -14,3 +16,10 @@ require "configs.nvimtree"
require "configs.bufferline"
require "configs.dropbar"
require "configs.dap"
require "configs.acmp"
require "configs.colorizer"
require "configs.autotag"
require "configs.prettier"
require "configs.nvimufo"
vim.lsp.inlay_hint.enable(true)

View File

@ -7,6 +7,7 @@
"catppuccin": { "branch": "main", "commit": "ba5f4153a5dad99505baba936bd0373534400ac3" },
"cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" },
"cmp-nvim-lsp": { "branch": "main", "commit": "5af77f54de1b16c34b23cba810150689a3a90312" },
"cmp-nvim-lua": { "branch": "main", "commit": "f12408bdb54c39c23e67cab726264c10db33ada8" },
"cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" },
"cmp_luasnip": { "branch": "master", "commit": "05a9ab28b53f71d1aece421ef32fee2cb857a843" },
"diffview.nvim": { "branch": "main", "commit": "4516612fe98ff56ae0415a259ff6361a89419b0a" },
@ -41,6 +42,7 @@
"nvim-colorizer.lua": { "branch": "master", "commit": "194ec600488f7c7229668d0e80bd197f3a2b84ff" },
"nvim-dap": { "branch": "master", "commit": "13ce59d4852be2bb3cd4967947985cb0ceaff460" },
"nvim-dap-ui": { "branch": "master", "commit": "34160a7ce6072ef332f350ae1d4a6a501daf0159" },
"nvim-dap-virtual-text": { "branch": "master", "commit": "484995d573c0f0563f6a66ebdd6c67b649489615" },
"nvim-dap-vscode-js": { "branch": "main", "commit": "03bd29672d7fab5e515fc8469b7d07cc5994bbf6" },
"nvim-lspconfig": { "branch": "master", "commit": "aa5f4f4ee10b2688fb37fa46215672441d5cd5d9" },
"nvim-nio": { "branch": "master", "commit": "a428f309119086dc78dd4b19306d2d67be884eee" },
@ -48,10 +50,13 @@
"nvim-treesitter": { "branch": "master", "commit": "d5a1c2b0c8ec5bb377a41c1c414b315d6b3e9432" },
"nvim-ts-autotag": { "branch": "main", "commit": "dc5e1687ab76ee02e0f11c5ce137f530b36e98b3" },
"nvim-ts-context-commentstring": { "branch": "main", "commit": "0bdccb9c67a42a5e2d99384dc9bfa29b1451528f" },
"nvim-ufo": { "branch": "main", "commit": "b23a46aa06f5f653d107efbc67fd2aa3877ac344" },
"nvim-web-devicons": { "branch": "master", "commit": "5b9067899ee6a2538891573500e8fd6ff008440f" },
"onedarker.nvim": { "branch": "freeze", "commit": "b00dd2189f264c5aeb4cf04c59439655ecd573ec" },
"plenary.nvim": { "branch": "master", "commit": "08e301982b9a057110ede7a735dd1b5285eb341f" },
"prettier.nvim": { "branch": "main", "commit": "d98e732cb73690b07c00c839c924be1d1d9ac5c2" },
"project.nvim": { "branch": "main", "commit": "8c6bad7d22eef1b71144b401c9f74ed01526a4fb" },
"promise-async": { "branch": "main", "commit": "119e8961014c9bfaf1487bf3c2a393d254f337e2" },
"rust.vim": { "branch": "master", "commit": "889b9a7515db477f4cb6808bef1769e53493c578" },
"rustaceanvim": { "branch": "master", "commit": "047f9c9d8cd2861745eb9de6c1570ee0875aa795" },
"schemastore.nvim": { "branch": "main", "commit": "8c46453bdf84ad91877effb95e0b6c7b51ea7dda" },
@ -65,6 +70,7 @@
"vim": { "branch": "legacy", "commit": "99d4b7bf1a0a12f2d78f35a159384b1eb8aa9c15" },
"vim-illuminate": { "branch": "master", "commit": "e522e0dd742a83506db0a72e1ced68c9c130f185" },
"vim-react-snippets": { "branch": "main", "commit": "755e288bd0db1052be4195fcc82a25e28b609e0b" },
"vim-rustfmt": { "branch": "master", "commit": "6bb517be12908926a4f5f516aa510c517c85260e" },
"vscode-js-debug": { "branch": "main", "commit": "ca1c6450490dab5d742eac16a08d593533a1a13d" },
"which-key.nvim": { "branch": "main", "commit": "4433e5ec9a507e5097571ed55c02ea9658fb268a" },
"winbar.nvim": { "branch": "main", "commit": "13739fdb31be51a1000486189662596f07a59a31" }

View File

@ -0,0 +1,5 @@
require'cmp'.setup {
sources = {
{ name = 'nvim_lsp' }
}
}

View File

@ -0,0 +1,8 @@
require('nvim-ts-autotag').setup({
opts = {
-- Defaults
enable_close = true, -- Auto close tags
enable_rename = true, -- Auto rename pairs of tags
enable_close_on_slash = false -- Auto close on trailing </
},
})

View File

@ -0,0 +1,19 @@
require("colorizer").setup {
filetypes = { "scss", "sass", "css", "html", "jsx", "tsx" },
user_default_options = {
css = true, -- Enable all CSS features: rgb_fn, hsl_fn, names, RGB, RRGGBB
css_fn = true, -- Enable all CSS *functions*: rgb_fn, hsl_fn
-- Available modes for `mode`: foreground, background, virtualtext
mode = "background", -- Set the display mode.
-- Available methods are false / true / "normal" / "lsp" / "both"
-- True is same as normal
tailwind = true, -- Enable tailwind colors
-- parsers can contain values used in |user_default_options|
sass = { enable = true, parsers = { "css" }, }, -- Enable sass colors
-- update color values even if buffer is not focused
-- example use: cmp_menu, cmp_docs
always_update = false
},
-- all the sub-options of filetypes apply to buftypes
buftypes = {},
}

View File

@ -32,8 +32,8 @@ dap.adapters["pwa-node"] = {
port = "${port}",
executable = {
command = "node",
-- 💀 Make sure to update this path to point to your installation
args = {"/.local/share/lvim/mason/packages/js-debug-adapter/js-debug/src/dapDebugServer.js", "${port}"},
-- 💀 make sure to update this path to point to your installation
args = {os.getenv("HOME") .. "/.local/share/lvim/mason/packages/js-debug-adapter/js-debug/src/dapDebugServer.js", "${port}"},
}
}
@ -61,11 +61,12 @@ dap.adapters.firefox = {
dap.configurations.typescriptreact = { -- change to typescript if needed
{
name = "Next.js: debug server-side",
type = "node-terminal",
name = 'Next.js: debug server-side',
type = "pwa-node",
request = "launch",
command = "npm run dev",
sourceMaps= true,
runtimeExecutable = "npm",
runtimeArgs = { "run", "dev" },
cwd = "${workspaceFolder}",
},
{
name = "Next.js: debug client-side with chrome",
@ -90,3 +91,14 @@ dap.configurations.typescriptreact = { -- change to typescript if needed
}
dap.configurations.javascriptreact = dap.configurations.typescriptreact;
require("dapui").setup()
local dap, dapui = require("dap"), require("dapui")
dap.listeners.after.event_initialized["dapui_config"] = function()
dapui.open({})
end
vim.keymap.set('n', '<leader>ui', require 'dapui'.toggle)

View File

@ -0,0 +1,22 @@
-- vscode format
require("luasnip.loaders.from_vscode").lazy_load { exclude = vim.g.vscode_snippets_exclude or {} }
require("luasnip.loaders.from_vscode").lazy_load { paths = vim.g.vscode_snippets_path or "" }
-- snipmate format
require("luasnip.loaders.from_snipmate").load()
require("luasnip.loaders.from_snipmate").lazy_load { paths = vim.g.snipmate_snippets_path or "" }
-- lua format
require("luasnip.loaders.from_lua").load()
require("luasnip.loaders.from_lua").lazy_load { paths = vim.g.lua_snippets_path or "" }
vim.api.nvim_create_autocmd("InsertLeave", {
callback = function()
if
require("luasnip").session.current_nodes[vim.api.nvim_get_current_buf()]
and not require("luasnip").session.jump_active
then
require("luasnip").unlink_current()
end
end,
})

View File

@ -0,0 +1,19 @@
vim.o.foldcolumn = '1' -- '0' is not bad
vim.o.foldlevel = 99 -- Using ufo provider need a large value, feel free to decrease the value
vim.o.foldlevelstart = 99
vim.o.foldenable = true
vim.o.fillchars = [[eob: ,fold: ,foldopen:󰅀,foldsep:╎,foldclose:󰅂]]
-- Using ufo provider need remap `zR` and `zM`. If Neovim is 0.6.1, remap yourself
vim.keymap.set('n', 'zR', require('ufo').openAllFolds)
vim.keymap.set('n', 'zM', require('ufo').closeAllFolds)
-- Option 3: treesitter as a main provider instead
-- (Note: the `nvim-treesitter` plugin is *not* needed.)
-- ufo uses the same query files for folding (queries/<lang>/folds.scm)
-- performance and stability are better than `foldmethod=nvim_treesitter#foldexpr()`
require('ufo').setup({
provider_selector = function(bufnr, filetype, buftype)
return {'treesitter', 'indent'}
end
})

View File

@ -0,0 +1,19 @@
local prettier = require("prettier")
prettier.setup({
bin = 'prettier', -- or `'prettierd'` (v0.23.3+)
filetypes = {
"css",
"graphql",
"html",
"javascript",
"javascriptreact",
"json",
"less",
"markdown",
"scss",
"typescript",
"typescriptreact",
"yaml",
},
})

View File

@ -10,9 +10,27 @@ lvim.plugins = {
}
}
},
{
'kevinhwang91/nvim-ufo',
},
{
'kevinhwang91/promise-async',
},
{
'rust-lang/rust.vim',
},
{
'MunifTanjim/prettier.nvim'
},
{
'alx741/vim-rustfmt',
},
{
"savq/melange-nvim"
},
{
'theHamsta/nvim-dap-virtual-text',
},
{
"HoNamDuong/hybrid.nvim",
lazy = false,
@ -38,9 +56,9 @@ lvim.plugins = {
"vague2k/huez.nvim",
},
{
'Bekaboo/dropbar.nvim',
"Bekaboo/dropbar.nvim",
dependencies = {
'nvim-telescope/telescope-fzf-native.nvim'
"nvim-telescope/telescope-fzf-native.nvim"
},
},
{
@ -52,12 +70,40 @@ lvim.plugins = {
"MunifTanjim/nui.nvim",
},
},
-- load luasnips + cmp related in insert mode only
{
"hrsh7th/nvim-cmp",
event = "InsertEnter",
dependencies = {
{
-- snippet plugin
"L3MON4D3/LuaSnip",
dependencies = "rafamadriz/friendly-snippets",
opts = { history = true, updateevents = "TextChanged,TextChangedI" },
config = function(_, opts)
require("luasnip").config.set_config(opts)
require "configs.luasnip"
end,
},
-- cmp sources plugins
{
"saadparwaiz1/cmp_luasnip",
"hrsh7th/cmp-nvim-lua",
"hrsh7th/cmp-nvim-lsp",
"hrsh7th/cmp-buffer",
"hrsh7th/cmp-path",
},
},
},
{
"hrsh7th/cmp-nvim-lsp",
},
{
"luckasRanarison/tailwind-tools.nvim",
dependencies = { "nvim-treesitter/nvim-treesitter" },
},
{
'kyazdani42/nvim-web-devicons'
"kyazdani42/nvim-web-devicons"
},
{
"mfussenegger/nvim-dap",
@ -83,7 +129,7 @@ lvim.plugins = {
build = "npm install --legacy-peer-deps && npx gulp vsDebugServerBundle && mv dist out"
},
{
"NvChad/nvim-colorizer.lua"
'NvChad/nvim-colorizer.lua',
},
{
"folke/neodev.nvim", opts = {}
@ -100,26 +146,18 @@ lvim.plugins = {
enabled = vim.fn.has("nvim-0.10.0") == 1,
},
{
'windwp/nvim-autopairs',
"windwp/nvim-autopairs",
event = "InsertEnter",
config = true
-- use opts = {} for passing setup options
-- this is equalent to setup({}) function
},
{
'nvim-treesitter/nvim-treesitter',
"nvim-treesitter/nvim-treesitter",
},
{
"rust-lang/rust.vim",
ft = "rust",
init = function ()
vim.g.rustfmt_autosave = 1
end
},
{
'mrcjkb/rustaceanvim',
"mrcjkb/rustaceanvim",
version = '^4', -- Recommended
ft = "rust",
lazy = false, -- This plugin is already lazy
},
{