nvim
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
|
||||
return {
|
||||
"goolord/alpha-nvim",
|
||||
dependencies = {
|
||||
"nvim-tree/nvim-web-devicons",
|
||||
},
|
||||
|
||||
config = function()
|
||||
local alpha = require("alpha")
|
||||
local dashboard = require("alpha.themes.startify")
|
||||
|
||||
dashboard.section.header.val = {
|
||||
[[▐▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▌]],
|
||||
[[▐ ▄▄▄ ██ ▄█▀ ██▓ ██▓▓█████▄ ▄▄▄██▀▀▀██ ▄█▀▌]],
|
||||
[[▐▒████▄ ██▄█▒ ▓██▒▓██▒▒██▀ ██▌ ▒██ ██▄█▒ ▌]],
|
||||
[[▐▒██ ▀█▄ ▓███▄░ ▒██▒▒██▒░██ █▌ ░██ ▓███▄░ ▌]],
|
||||
[[▐░██▄▄▄▄██ ▓██ █▄ ░██░░██░░▓█▄ ▌▓██▄██▓ ▓██ █▄ ▌]],
|
||||
[[▐ ▓█ ▓██▒▒██▒ █▄░██░░██░░▒████▓ ▓███▒ ▒██▒ █▄▌]],
|
||||
[[▐ ▒▒ ▓▒█░▒ ▒▒ ▓▒░▓ ░▓ ▒▒▓ ▒ ▒▓▒▒░ ▒ ▒▒ ▓▒▌]],
|
||||
[[▐ ▒ ▒▒ ░░ ░▒ ▒░ ▒ ░ ▒ ░ ░ ▒ ▒ ▒ ░▒░ ░ ░▒ ▒░▌]],
|
||||
[[▐ ░ ▒ ░ ░░ ░ ▒ ░ ▒ ░ ░ ░ ░ ░ ░ ░ ░ ░░ ░ ▌]],
|
||||
[[▐ ░ ░░ ░ ░ ░ ░ ░ ░ ░ ░ ▌]],
|
||||
[[▐ ░ ▌]],
|
||||
[[▐▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▌]],
|
||||
}
|
||||
|
||||
alpha.setup(dashboard.opts)
|
||||
end,
|
||||
}
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
return {
|
||||
"navarasu/onedark.nvim",
|
||||
priority = 1000,
|
||||
config = function()
|
||||
require('onedark').setup {
|
||||
-- Main options --
|
||||
style = 'dark', -- Default theme style. Choose between 'dark', 'darker', 'cool', 'deep', 'warm', 'warmer' and 'light'
|
||||
transparent = false, -- Show/hide background
|
||||
term_colors = true, -- Change terminal color as per the selected theme style
|
||||
ending_tildes = false, -- Show the end-of-buffer tildes. By default they are hidden
|
||||
cmp_itemkind_reverse = false, -- reverse item kind highlights in cmp menu
|
||||
|
||||
-- toggle theme style ---
|
||||
toggle_style_key = nil, -- keybind to toggle theme style. Leave it nil to disable it, or set it to a string, for example "<leader>ts"
|
||||
toggle_style_list = {'dark', 'darker', 'cool', 'deep', 'warm', 'warmer', 'light'}, -- List of styles to toggle between
|
||||
|
||||
-- Change code style ---
|
||||
-- Options are italic, bold, underline, none
|
||||
-- You can configure multiple style with comma separated, For e.g., keywords = 'italic,bold'
|
||||
code_style = {
|
||||
comments = 'italic',
|
||||
keywords = 'none',
|
||||
functions = 'none',
|
||||
strings = 'none',
|
||||
variables = 'none'
|
||||
},
|
||||
|
||||
-- Lualine options --
|
||||
lualine = {
|
||||
transparent = false, -- lualine center bar transparency
|
||||
},
|
||||
|
||||
-- Custom Highlights --
|
||||
colors = {}, -- Override default colors
|
||||
highlights = {}, -- Override highlight groups
|
||||
|
||||
-- Plugins Config --
|
||||
diagnostics = {
|
||||
darker = true, -- darker colors for diagnostic
|
||||
undercurl = true, -- use undercurl instead of underline for diagnostics
|
||||
background = true, -- use background color for virtual text
|
||||
},
|
||||
}
|
||||
vim.cmd([[
|
||||
colorscheme onedark
|
||||
]])
|
||||
end
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
return {
|
||||
"numToStr/Comment.nvim",
|
||||
event = { "BufReadPre", "BufNewFile" },
|
||||
dependencies = {
|
||||
"JoosepAlviste/nvim-ts-context-commentstring",
|
||||
},
|
||||
config = function()
|
||||
local comment = require("Comment")
|
||||
|
||||
local ts_context_commentstring = require("ts_context_commentstring.integrations.comment_nvim")
|
||||
|
||||
comment.setup({
|
||||
-- for commenting tsx and jsx files
|
||||
pre_hook = ts_context_commentstring.create_pre_hook(),
|
||||
})
|
||||
end,
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
return {
|
||||
"ibhagwan/fzf-lua",
|
||||
event = "VeryLazy",
|
||||
config = function()
|
||||
require("fzf-lua").setup({
|
||||
colorscheme = "onedark",
|
||||
winopts = {
|
||||
fullscreen = true,
|
||||
preview = {
|
||||
layout = "vertical",
|
||||
vertical = "up:45%", -- up|down:size
|
||||
},
|
||||
},
|
||||
fzf_opts = {
|
||||
["--keep-right"] = "", -- https://github.com/ibhagwan/fzf-lua/issues/269
|
||||
["--layout"] = "default",
|
||||
-- ["--ansi"] = false,
|
||||
},
|
||||
keymap = {
|
||||
fzf = {
|
||||
["ctrl-r"] = "select-all+accept", -- https://github.com/ibhagwan/fzf-lua/issues/324
|
||||
},
|
||||
},
|
||||
files = {
|
||||
git_icons = true,
|
||||
file_icons = true,
|
||||
},
|
||||
})
|
||||
|
||||
vim.keymap.set("n", "<c-P>", "<cmd>lua require('fzf-lua').files()<CR>", { silent = true })
|
||||
|
||||
vim.keymap.set("n", "<leader>b", "<cmd>lua require('fzf-lua').buffers()<CR>", { desc = "Fuzzy find recent files" })
|
||||
|
||||
vim.keymap.set(
|
||||
"n",
|
||||
"<leader>/",
|
||||
"<cmd>lua require('fzf-lua').live_grep_resume()<CR>",
|
||||
{ desc = "Find string in cwd" }
|
||||
)
|
||||
|
||||
vim.keymap.set("n", "gr", ":FzfLua lsp_references<CR>")
|
||||
end,
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
return {
|
||||
"dinhhuy258/git.nvim",
|
||||
event = "BufReadPre",
|
||||
opts = {
|
||||
keymaps = {
|
||||
-- Open blame window
|
||||
blame = "<Leader>gb",
|
||||
-- Open file/folder in git repository
|
||||
browse = "<Leader>go",
|
||||
},
|
||||
},
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
return {
|
||||
"b0o/incline.nvim",
|
||||
dependencies = { "navarasu/onedark.nvim", "kyazdani42/nvim-web-devicons", "lewis6991/gitsigns.nvim" },
|
||||
event = "BufReadPre",
|
||||
priority = 1200,
|
||||
config = function()
|
||||
local devicons = require("nvim-web-devicons")
|
||||
|
||||
require("incline").setup {
|
||||
render = function(props)
|
||||
local filename = vim.fn.fnamemodify(vim.api.nvim_buf_get_name(props.buf), ':t')
|
||||
if filename == '' then
|
||||
filename = '[No Name]'
|
||||
end
|
||||
local ft_icon, ft_color = devicons.get_icon_color(filename)
|
||||
|
||||
local function get_git_diff()
|
||||
local icons = { removed = '', changed = '', added = '' }
|
||||
local signs = vim.b[props.buf].gitsigns_status_dict
|
||||
local labels = {}
|
||||
if signs == nil then
|
||||
return labels
|
||||
end
|
||||
for name, icon in pairs(icons) do
|
||||
if tonumber(signs[name]) and signs[name] > 0 then
|
||||
table.insert(labels, { icon .. signs[name] .. ' ', group = 'Diff' .. name })
|
||||
end
|
||||
end
|
||||
if #labels > 0 then
|
||||
table.insert(labels, { '┊ ' })
|
||||
end
|
||||
return labels
|
||||
end
|
||||
|
||||
local function get_diagnostic_label()
|
||||
local icons = { error = '', warn = '', info = '', hint = '' }
|
||||
local label = {}
|
||||
|
||||
for severity, icon in pairs(icons) do
|
||||
local n = #vim.diagnostic.get(props.buf, { severity = vim.diagnostic.severity[string.upper(severity)] })
|
||||
if n > 0 then
|
||||
table.insert(label, { icon .. n .. ' ', group = 'DiagnosticSign' .. severity })
|
||||
end
|
||||
end
|
||||
if #label > 0 then
|
||||
table.insert(label, { '┊ ' })
|
||||
end
|
||||
return label
|
||||
end
|
||||
|
||||
return {
|
||||
{ get_diagnostic_label() },
|
||||
{ get_git_diff() },
|
||||
{ (ft_icon or '') .. ' ', guifg = ft_color, guibg = 'none' },
|
||||
{ filename .. ' ', gui = vim.bo[props.buf].modified and 'bold,italic' or 'bold' },
|
||||
{ '┊ ' .. vim.api.nvim_win_get_number(props.win), group = 'DevIconWindows' },
|
||||
}
|
||||
end,
|
||||
}
|
||||
end,
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
return {
|
||||
"lukas-reineke/indent-blankline.nvim",
|
||||
main = "ibl",
|
||||
opts = {},
|
||||
config = function()
|
||||
require("ibl").setup({
|
||||
scope = { enabled = false },
|
||||
indent = { char = "|" },
|
||||
})
|
||||
end
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
return {
|
||||
"nvim-lualine/lualine.nvim",
|
||||
event = "VeryLazy",
|
||||
opts = {
|
||||
options = {
|
||||
-- globalstatus = false,
|
||||
theme = "onedark",
|
||||
},
|
||||
},
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
return {
|
||||
"williamboman/mason.nvim",
|
||||
dependencies = {
|
||||
"williamboman/mason-lspconfig.nvim",
|
||||
"WhoIsSethDaniel/mason-tool-installer.nvim",
|
||||
},
|
||||
config = function()
|
||||
local mason = require("mason")
|
||||
local mason_lspconfig = require("mason-lspconfig")
|
||||
local mason_tool_installer = require("mason-tool-installer")
|
||||
|
||||
mason.setup({})
|
||||
|
||||
-- Repo with all lsp server: https://github.com/williamboman/mason-lspconfig.nvim?tab=readme-ov-file#available-lsp-servers
|
||||
mason_lspconfig.setup({
|
||||
ensure_installed = {
|
||||
"lua_ls",
|
||||
"html",
|
||||
"cssls",
|
||||
"dockerls",
|
||||
"docker_compose_language_service",
|
||||
"rust_analyzer",
|
||||
"jsonls",
|
||||
"markdown_oxide",
|
||||
"tailwindcss",
|
||||
},
|
||||
automatic_installation = true,
|
||||
})
|
||||
|
||||
mason_tool_installer.setup({
|
||||
ensure_installed = {
|
||||
"prettier",
|
||||
"stylua",
|
||||
"eslint_d",
|
||||
"prettierd",
|
||||
},
|
||||
})
|
||||
end,
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
-- Go forward/backward with square brackets
|
||||
return {
|
||||
"echasnovski/mini.bracketed",
|
||||
event = "BufReadPost",
|
||||
config = function()
|
||||
local bracketed = require("mini.bracketed")
|
||||
bracketed.setup({
|
||||
file = { suffix = "" },
|
||||
window = { suffix = "" },
|
||||
quickfix = { suffix = "" },
|
||||
yank = { suffix = "" },
|
||||
treesitter = { suffix = "n" },
|
||||
})
|
||||
end,
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
return {
|
||||
"nvim-neo-tree/neo-tree.nvim",
|
||||
branch = "v3.x",
|
||||
dependencies = {
|
||||
"nvim-lua/plenary.nvim",
|
||||
"nvim-tree/nvim-web-devicons",
|
||||
"MunifTanjim/nui.nvim",
|
||||
},
|
||||
config = function()
|
||||
vim.keymap.set("n", "<C-n>", ":Neotree filesystem reveal left<CR>", {})
|
||||
vim.keymap.set("n", "<leader>bf", ":Neotree buffers reveal float<CR>", {})
|
||||
end,
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
return {
|
||||
"nvimtools/none-ls.nvim",
|
||||
config = function()
|
||||
local null_ls = require("null-ls")
|
||||
null_ls.setup({
|
||||
sources = {
|
||||
null_ls.builtins.formatting.stylua,
|
||||
null_ls.builtins.formatting.prettier,
|
||||
null_ls.builtins.diagnostics.erb_lint,
|
||||
null_ls.builtins.diagnostics.rubocop,
|
||||
null_ls.builtins.formatting.rubocop,
|
||||
},
|
||||
})
|
||||
|
||||
vim.keymap.set("n", "<leader>gf", vim.lsp.buf.format, {})
|
||||
end,
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
return {
|
||||
"windwp/nvim-autopairs",
|
||||
event = "InsertEnter",
|
||||
dependencies = {
|
||||
"hrsh7th/nvim-cmp",
|
||||
},
|
||||
config = function()
|
||||
local autopairs = require("nvim-autopairs")
|
||||
|
||||
autopairs.setup({
|
||||
check_ts = true, -- enable treesitter
|
||||
ts_config = {
|
||||
lua = { "string" }, -- don't add pairs in lua string treesitter nodes
|
||||
javascript = { "template_string" }, -- don't add pairs in javscript template_string treesitter nodes
|
||||
java = false, -- don't check treesitter on java
|
||||
},
|
||||
})
|
||||
|
||||
-- import nvim-autopairs completion functionality
|
||||
local cmp_autopairs = require("nvim-autopairs.completion.cmp")
|
||||
|
||||
-- import nvim-cmp plugin (completions plugin)
|
||||
local cmp = require("cmp")
|
||||
|
||||
-- make autopairs and completion work together
|
||||
cmp.event:on("confirm_done", cmp_autopairs.on_confirm_done())
|
||||
end,
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
return {
|
||||
{
|
||||
"hrsh7th/cmp-nvim-lsp"
|
||||
},
|
||||
{
|
||||
"L3MON4D3/LuaSnip",
|
||||
dependencies = {
|
||||
"saadparwaiz1/cmp_luasnip",
|
||||
"rafamadriz/friendly-snippets",
|
||||
},
|
||||
},
|
||||
{
|
||||
"hrsh7th/nvim-cmp",
|
||||
config = function()
|
||||
local cmp = require("cmp")
|
||||
require("luasnip.loaders.from_vscode").lazy_load()
|
||||
|
||||
cmp.setup({
|
||||
snippet = {
|
||||
expand = function(args)
|
||||
require("luasnip").lsp_expand(args.body)
|
||||
end,
|
||||
},
|
||||
window = {
|
||||
completion = cmp.config.window.bordered(),
|
||||
documentation = cmp.config.window.bordered(),
|
||||
},
|
||||
mapping = cmp.mapping.preset.insert({
|
||||
["<C-b>"] = cmp.mapping.scroll_docs(-4),
|
||||
["<C-f>"] = cmp.mapping.scroll_docs(4),
|
||||
["<C-Space>"] = cmp.mapping.complete(),
|
||||
["<C-e>"] = cmp.mapping.abort(),
|
||||
["<CR>"] = cmp.mapping.confirm({ select = true }),
|
||||
}),
|
||||
sources = cmp.config.sources({
|
||||
{ name = "nvim_lsp" },
|
||||
{ name = "luasnip" }, -- For luasnip users.
|
||||
}, {
|
||||
{ name = "buffer" },
|
||||
}),
|
||||
})
|
||||
end,
|
||||
},
|
||||
}
|
||||
@@ -0,0 +1,122 @@
|
||||
return {
|
||||
"neovim/nvim-lspconfig",
|
||||
event = { "BufReadPre", "BufNewFile" },
|
||||
dependencies = {
|
||||
"hrsh7th/cmp-nvim-lsp",
|
||||
},
|
||||
enabled = true,
|
||||
config = function()
|
||||
local lspconfig = require("lspconfig")
|
||||
local util = require("lspconfig.util")
|
||||
local cmp_nvim_lsp = require("cmp_nvim_lsp")
|
||||
|
||||
-- Disable inline error messages
|
||||
vim.diagnostic.config({
|
||||
virtual_text = false,
|
||||
float = {
|
||||
border = "single",
|
||||
},
|
||||
})
|
||||
|
||||
-- Add border to floating window
|
||||
vim.lsp.handlers["textDocument/signatureHelp"] =
|
||||
vim.lsp.buf.hover({ border = "single", silent = true })
|
||||
vim.lsp.handlers["textDocument/hover"] =
|
||||
vim.lsp.buf.hover({ border = "single", silend = true })
|
||||
|
||||
-- Make float window transparent start
|
||||
|
||||
local set_hl_for_floating_window = function()
|
||||
vim.api.nvim_set_hl(0, "NormalFloat", {
|
||||
link = "Normal",
|
||||
})
|
||||
vim.api.nvim_set_hl(0, "FloatBorder", {
|
||||
bg = "none",
|
||||
})
|
||||
end
|
||||
|
||||
set_hl_for_floating_window()
|
||||
|
||||
vim.api.nvim_create_autocmd("ColorScheme", {
|
||||
pattern = "*",
|
||||
desc = "Avoid overwritten by loading color schemes later",
|
||||
callback = set_hl_for_floating_window,
|
||||
})
|
||||
|
||||
-- Make float window transparent end
|
||||
|
||||
local on_attach = function(client, bufnr)
|
||||
vim.keymap.set(
|
||||
"n",
|
||||
"K",
|
||||
vim.lsp.buf.hover,
|
||||
{ buffer = bufnr, desc = "Show documentation for what is under cursor" }
|
||||
)
|
||||
vim.keymap.set("n", "<leader>rn", vim.lsp.buf.rename, { buffer = bufnr, desc = "Smart rename" })
|
||||
vim.keymap.set(
|
||||
{ "n", "v" },
|
||||
"gf",
|
||||
vim.lsp.buf.code_action,
|
||||
{ buffer = bufnr, desc = "See available code actions" }
|
||||
)
|
||||
vim.keymap.set(
|
||||
"n",
|
||||
"<leader>d",
|
||||
vim.diagnostic.open_float,
|
||||
{ buffer = bufnr, desc = "Show diagnostics for line" }
|
||||
)
|
||||
-- vim.keymap.set("n", "gR", "<cmd>Telescope lsp_references<CR>", {buffer = bufnr, desc = 'Show definition, references'})
|
||||
vim.keymap.set("n", "gd", vim.lsp.buf.definition, { buffer = bufnr, desc = "Go to definition" })
|
||||
end
|
||||
|
||||
local capabilities = cmp_nvim_lsp.default_capabilities()
|
||||
local signs = { Error = "✖", Warn = "", Hint = "", Info = "" }
|
||||
for type, icon in pairs(signs) do
|
||||
local hl = "DiagnosticSign" .. type
|
||||
vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = "" })
|
||||
end
|
||||
|
||||
-- List config:
|
||||
|
||||
-- configure html server
|
||||
lspconfig["html"].setup({
|
||||
capabilities = capabilities,
|
||||
on_attach = on_attach,
|
||||
})
|
||||
|
||||
-- configure lua server (with special settings)
|
||||
lspconfig["lua_ls"].setup({
|
||||
capabilities = capabilities,
|
||||
on_attach = on_attach,
|
||||
settings = { -- custom settings for lua
|
||||
Lua = {
|
||||
-- make the language server recognize "vim" global
|
||||
diagnostics = {
|
||||
globals = { "vim" },
|
||||
},
|
||||
workspace = {
|
||||
-- make language server aware of runtime files
|
||||
library = {
|
||||
[vim.fn.expand("$VIMRUNTIME/lua")] = true,
|
||||
[vim.fn.stdpath("config") .. "/lua"] = true,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
-- configure css server
|
||||
lspconfig["cssls"].setup({
|
||||
capabilities = capabilities,
|
||||
on_attach = on_attach,
|
||||
})
|
||||
|
||||
lspconfig["ruff_lsp"].setup({})
|
||||
lspconfig["rust_analyzer"].setup({})
|
||||
lspconfig["dockerls"].setup({})
|
||||
lspconfig["jsonls"].setup({})
|
||||
lspconfig["markdown_oxide"].setup({})
|
||||
lspconfig["docker_compose_language_service"].setup({})
|
||||
lspconfig["svelte"].setup({})
|
||||
end,
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
return {
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
branch = "master",
|
||||
lazy = false,
|
||||
build = ":TSUpdate",
|
||||
config = function()
|
||||
require('nvim-treesitter.configs').setup({
|
||||
ensure_installed = { "lua", "vim", "vimdoc", "python", "go", "typescript", "javascript" },
|
||||
sync_install = false,
|
||||
auto_install = true,
|
||||
|
||||
highlight = {
|
||||
enable = true,
|
||||
additional_vim_regex_highlighting = false,
|
||||
},
|
||||
|
||||
indent = {
|
||||
enable = true
|
||||
}
|
||||
})
|
||||
end
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
|
||||
-- Refactoring tool
|
||||
return {
|
||||
"ThePrimeagen/refactoring.nvim",
|
||||
keys = {
|
||||
{
|
||||
"<leader>r",
|
||||
function()
|
||||
require("refactoring").select_refactor()
|
||||
end,
|
||||
mode = "v",
|
||||
noremap = true,
|
||||
silent = true,
|
||||
expr = false,
|
||||
},
|
||||
},
|
||||
opts = {},
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
-- Incremental rename
|
||||
return {
|
||||
"smjonas/inc-rename.nvim",
|
||||
cmd = "IncRename",
|
||||
config = true,
|
||||
}
|
||||
Reference in New Issue
Block a user