BIG NEOVIM CHANGES
This commit is contained in:
84
home/extra/neovim/nvim/lua/plugins/alpha.lua
Normal file
84
home/extra/neovim/nvim/lua/plugins/alpha.lua
Normal file
@@ -0,0 +1,84 @@
|
||||
return {
|
||||
"goolord/alpha-nvim",
|
||||
event = "VimEnter",
|
||||
dependencies = { "nvim-tree/nvim-web-devicons" },
|
||||
config = function()
|
||||
local alpha = require("alpha")
|
||||
local dashboard = require("alpha.themes.dashboard")
|
||||
|
||||
-- Header
|
||||
local logo = [[
|
||||
▄████▄ ███▄ █ ██▓▒██ ██▒ ██▒ █▓ ██▓ ███▄ ▄███▓
|
||||
▒██▀ ▀█ ██ ▀█ █ ▓██▒▒▒ █ █ ▒░▓██░ █▒▓██▒▓██▒▀█▀ ██▒
|
||||
▒▓█ ▄ ▓██ ▀█ ██▒▒██▒░░ █ ░ ▓██ █▒░▒██▒▓██ ▓██░
|
||||
▒▓▓▄ ▄██▒▓██▒ ▐▌██▒░██░ ░ █ █ ▒ ▒██ █░░░██░▒██ ▒██
|
||||
▒ ▓███▀ ░▒██░ ▓██░░██░▒██▒ ▒██▒ ▒▀█░ ░██░▒██▒ ░██▒
|
||||
░ ░▒ ▒ ░░ ▒░ ▒ ▒ ░▓ ▒▒ ░ ░▓ ░ ░ ▐░ ░▓ ░ ▒░ ░ ░
|
||||
░ ▒ ░ ░░ ░ ▒░ ▒ ░░░ ░▒ ░ ░ ░░ ▒ ░░ ░ ░
|
||||
░ ░ ░ ░ ▒ ░ ░ ░ ░░ ▒ ░░ ░
|
||||
░ ░ ░ ░ ░ ░ ░ ░ ░
|
||||
░ ░
|
||||
]]
|
||||
dashboard.section.header.val = vim.split(logo, "\n")
|
||||
|
||||
-- Buttons
|
||||
dashboard.section.buttons.val = {
|
||||
dashboard.button("n", " " .. " New file", "<cmd> ene <BAR> startinsert <cr>"),
|
||||
dashboard.button("f", " " .. " Find file", "<cmd> Telescope find_files <cr>"),
|
||||
dashboard.button("g", " " .. " Live grep", "<cmd> Telescope live_grep <cr>"),
|
||||
dashboard.button("r", " " .. " Recent files", "<cmd> Telescope oldfiles <cr>"),
|
||||
-- dashboard.button('s', ' ' .. ' Restore Session', "<cmd>lua require('persistence').load()<cr>"),
|
||||
dashboard.button("s", " " .. " Restore Session", "<cmd>SessionLoad<cr>"),
|
||||
dashboard.button("l", " " .. " Lazy", "<cmd> Lazy <cr>"),
|
||||
dashboard.button("h", " " .. " Check Health", "<cmd>checkhealth<cr>"),
|
||||
dashboard.button("q", " " .. " Quit", "<cmd> qa <cr>"),
|
||||
}
|
||||
for _, button in ipairs(dashboard.section.buttons) do
|
||||
button.opts.hl = "AlphaButtons"
|
||||
button.opts.hl_shortcut = "AlphaShortcut"
|
||||
end
|
||||
dashboard.section.header.opts.hl = "AlphaHeader"
|
||||
dashboard.section.buttons.opts.hl = "AlphaButtons"
|
||||
dashboard.section.footer.opts.hl = "AlphaFooter"
|
||||
dashboard.opts.layout[1].val = 8
|
||||
|
||||
-- Footer (Lazy statistics)
|
||||
vim.api.nvim_create_autocmd("User", {
|
||||
callback = function()
|
||||
local stats = require("lazy").stats()
|
||||
local ms = math.floor(stats.startuptime * 100) / 100
|
||||
dashboard.section.footer.val = " Lazy-loaded "
|
||||
.. stats.loaded
|
||||
.. "/"
|
||||
.. stats.count
|
||||
.. " plugins in "
|
||||
.. ms
|
||||
.. "ms"
|
||||
pcall(vim.cmd.AlphaRedraw)
|
||||
end,
|
||||
})
|
||||
|
||||
-- -- Fortune
|
||||
-- local fortune = ""
|
||||
-- if vim.fn.executable "fortune" == 1 then
|
||||
-- local handle = io.popen "fortune"
|
||||
-- if handle ~= nil then
|
||||
-- fortune = handle:read "*a"
|
||||
-- handle:close()
|
||||
-- end
|
||||
-- end
|
||||
-- local buttons = {
|
||||
-- type = "group",
|
||||
-- val = {
|
||||
-- { type = "padding", val = 2 },
|
||||
-- { type = "text", val = fortune, opts = { position = "center" } },
|
||||
-- { type = "padding", val = 2 },
|
||||
-- },
|
||||
-- position = "center",
|
||||
-- }
|
||||
-- dashboard.opts.layout[6] = buttons
|
||||
|
||||
dashboard.config.opts.noautocmd = true
|
||||
alpha.setup(dashboard.config)
|
||||
end,
|
||||
}
|
||||
13
home/extra/neovim/nvim/lua/plugins/autopairs.lua
Normal file
13
home/extra/neovim/nvim/lua/plugins/autopairs.lua
Normal file
@@ -0,0 +1,13 @@
|
||||
return {
|
||||
"windwp/nvim-autopairs",
|
||||
event = "InsertEnter",
|
||||
-- Optional dependency
|
||||
dependencies = { "hrsh7th/nvim-cmp" },
|
||||
config = function()
|
||||
require("nvim-autopairs").setup({})
|
||||
-- If you want to automatically add `(` after selecting a function or method
|
||||
local cmp_autopairs = require("nvim-autopairs.completion.cmp")
|
||||
local cmp = require("cmp")
|
||||
cmp.event:on("confirm_done", cmp_autopairs.on_confirm_done())
|
||||
end,
|
||||
}
|
||||
6
home/extra/neovim/nvim/lua/plugins/better-escape.lua
Normal file
6
home/extra/neovim/nvim/lua/plugins/better-escape.lua
Normal file
@@ -0,0 +1,6 @@
|
||||
return {
|
||||
"max397574/better-escape.nvim",
|
||||
config = function()
|
||||
require("better_escape").setup()
|
||||
end,
|
||||
}
|
||||
3
home/extra/neovim/nvim/lua/plugins/devicons.lua
Normal file
3
home/extra/neovim/nvim/lua/plugins/devicons.lua
Normal file
@@ -0,0 +1,3 @@
|
||||
return {
|
||||
{ "nvim-tree/nvim-web-devicons", opts = {}, lazy = true },
|
||||
}
|
||||
9
home/extra/neovim/nvim/lua/plugins/gitsigns.lua
Normal file
9
home/extra/neovim/nvim/lua/plugins/gitsigns.lua
Normal file
@@ -0,0 +1,9 @@
|
||||
return {
|
||||
{
|
||||
"lewis6991/gitsigns.nvim",
|
||||
lazy = true,
|
||||
tag = "v0.8.0",
|
||||
event = { "BufReadPost" },
|
||||
opts = {},
|
||||
},
|
||||
}
|
||||
5
home/extra/neovim/nvim/lua/plugins/hmts.lua
Normal file
5
home/extra/neovim/nvim/lua/plugins/hmts.lua
Normal file
@@ -0,0 +1,5 @@
|
||||
return {
|
||||
"calops/hmts.nvim",
|
||||
version = "*",
|
||||
ft = "nix",
|
||||
}
|
||||
11
home/extra/neovim/nvim/lua/plugins/init.lua
Normal file
11
home/extra/neovim/nvim/lua/plugins/init.lua
Normal file
@@ -0,0 +1,11 @@
|
||||
return {
|
||||
{
|
||||
"sainnhe/gruvbox-material",
|
||||
enabled = true,
|
||||
priority = 1000,
|
||||
opts = {},
|
||||
config = function()
|
||||
vim.cmd([[colorscheme gruvbox-material]])
|
||||
end,
|
||||
},
|
||||
}
|
||||
144
home/extra/neovim/nvim/lua/plugins/lsp.lua
Normal file
144
home/extra/neovim/nvim/lua/plugins/lsp.lua
Normal file
@@ -0,0 +1,144 @@
|
||||
return {
|
||||
{
|
||||
"VonHeikemen/lsp-zero.nvim",
|
||||
event = { "BufReadPre", "BufNewFile" },
|
||||
branch = "v2.x",
|
||||
dependencies = {
|
||||
-- LSP Support
|
||||
{ "neovim/nvim-lspconfig" },
|
||||
{ "williamboman/mason.nvim" },
|
||||
{ "williamboman/mason-lspconfig.nvim" },
|
||||
|
||||
-- Autocompletion
|
||||
{ "hrsh7th/nvim-cmp" },
|
||||
{ "hrsh7th/cmp-buffer" },
|
||||
{ "hrsh7th/cmp-path" },
|
||||
{ "saadparwaiz1/cmp_luasnip" },
|
||||
{ "hrsh7th/cmp-nvim-lsp" },
|
||||
{ "hrsh7th/cmp-nvim-lua" },
|
||||
|
||||
-- Snippets
|
||||
{ "L3MON4D3/LuaSnip" },
|
||||
-- Snippet Collection (Optional)
|
||||
{ "rafamadriz/friendly-snippets" },
|
||||
|
||||
{ "onsails/lspkind.nvim" },
|
||||
},
|
||||
config = function()
|
||||
local lsp = require("lsp-zero")
|
||||
lsp.preset("recommended")
|
||||
|
||||
-- don't initialize this language server
|
||||
-- we will use rust-tools to setup rust_analyzer
|
||||
lsp.skip_server_setup({ "rust_analyzer" })
|
||||
|
||||
local cmp = require("cmp")
|
||||
local cmp_select = { behavior = cmp.SelectBehavior.Select }
|
||||
local cmp_mappings = lsp.defaults.cmp_mappings({
|
||||
["<C-p>"] = cmp.mapping.select_prev_item(cmp_select),
|
||||
["<C-n>"] = cmp.mapping.select_next_item(cmp_select),
|
||||
["<CR>"] = cmp.mapping.confirm({ select = true }),
|
||||
["<C-Space>"] = cmp.mapping.complete(),
|
||||
})
|
||||
|
||||
local cmp_autopairs = require("nvim-autopairs.completion.cmp")
|
||||
cmp.event:on("confirm_done", cmp_autopairs.on_confirm_done())
|
||||
|
||||
local lspkind = require("lspkind")
|
||||
|
||||
lsp.setup_nvim_cmp({
|
||||
mapping = cmp_mappings,
|
||||
formatting = {
|
||||
format = lspkind.cmp_format({
|
||||
mode = "symbol_text",
|
||||
maxwidth = 75,
|
||||
ellipsis_char = "...",
|
||||
symbol_map = {
|
||||
Copilot = "",
|
||||
},
|
||||
}),
|
||||
},
|
||||
sources = {
|
||||
{ name = "nvim_lsp" },
|
||||
{ name = "buffer" },
|
||||
{ name = "copilot" },
|
||||
{ name = "path" },
|
||||
{ name = "luasnip" },
|
||||
},
|
||||
})
|
||||
|
||||
local parser_config = require("nvim-treesitter.parsers").get_parser_configs()
|
||||
|
||||
parser_config.nu = {
|
||||
install_info = {
|
||||
url = "https://github.com/nushell/tree-sitter-nu",
|
||||
files = { "src/parser.c" },
|
||||
branch = "main",
|
||||
},
|
||||
filetype = "nu",
|
||||
}
|
||||
|
||||
local format_sync_grp = vim.api.nvim_create_augroup("Format", {})
|
||||
vim.api.nvim_create_autocmd("BufWritePre", {
|
||||
pattern = "*",
|
||||
callback = function()
|
||||
vim.lsp.buf.format({ timeout_ms = 200 })
|
||||
end,
|
||||
group = format_sync_grp,
|
||||
})
|
||||
|
||||
lsp.on_attach(function(client, bufnr)
|
||||
local opts = { buffer = bufnr, remap = false }
|
||||
|
||||
vim.keymap.set("n", "gd", vim.lsp.buf.definition, opts)
|
||||
vim.keymap.set("n", "K", vim.lsp.buf.hover, opts)
|
||||
vim.keymap.set("n", "<leader>vws", vim.lsp.buf.workspace_symbol, opts)
|
||||
vim.keymap.set("n", "<leader>vd", vim.diagnostic.open_float, opts)
|
||||
vim.keymap.set("n", "[d", vim.diagnostic.goto_next, opts)
|
||||
vim.keymap.set("n", "]d", vim.diagnostic.goto_prev, opts)
|
||||
vim.keymap.set("n", "<leader>vca", vim.lsp.buf.code_action, opts)
|
||||
vim.keymap.set("n", "<leader>a", vim.lsp.buf.code_action, opts)
|
||||
vim.keymap.set("n", "<leader>vrr", vim.lsp.buf.references, opts)
|
||||
vim.keymap.set("n", "<leader>vrn", vim.lsp.buf.rename, opts)
|
||||
vim.keymap.set("i", "<C-h>", vim.lsp.buf.signature_help, opts)
|
||||
end)
|
||||
|
||||
lsp.configure("nil_ls", {
|
||||
settings = {
|
||||
["nil"] = {
|
||||
formatting = { command = { "nixpkgs-fmt" } },
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
lsp.configure("nushell", {
|
||||
command = { "nu", "--lsp" },
|
||||
filetypes = { "nu" },
|
||||
root_dir = require("lspconfig.util").find_git_ancestor,
|
||||
singe_file_support = true,
|
||||
})
|
||||
|
||||
lsp.configure("volar", {
|
||||
filetypes = { "typescript", "javascript", "javascriptreact", "typescriptreact", "vue", "json" },
|
||||
})
|
||||
|
||||
lsp.set_server_config({
|
||||
on_init = function(client)
|
||||
client.server_capabilities.semanticTokensProvider = nil
|
||||
end,
|
||||
})
|
||||
|
||||
lsp.nvim_workspace()
|
||||
lsp.setup()
|
||||
|
||||
vim.diagnostic.config({
|
||||
virtual_text = true,
|
||||
signs = true,
|
||||
update_in_insert = true,
|
||||
underline = true,
|
||||
severity_sort = false,
|
||||
float = true,
|
||||
})
|
||||
end,
|
||||
},
|
||||
}
|
||||
41
home/extra/neovim/nvim/lua/plugins/lualine.lua
Normal file
41
home/extra/neovim/nvim/lua/plugins/lualine.lua
Normal file
@@ -0,0 +1,41 @@
|
||||
local go_package = function()
|
||||
for _, line in ipairs(vim.api.nvim_buf_get_lines(0, 0, -1, true)) do
|
||||
if line:match("^package ") then
|
||||
return "⬡ " .. string.sub(line, 9)
|
||||
end
|
||||
end
|
||||
return ""
|
||||
end
|
||||
|
||||
return {
|
||||
{
|
||||
"nvim-lualine/lualine.nvim",
|
||||
event = "VeryLazy",
|
||||
dependencies = { "nvim-tree/nvim-web-devicons", optional = true },
|
||||
opts = {
|
||||
options = {
|
||||
theme = "dracula",
|
||||
},
|
||||
sections = {
|
||||
lualine_a = { "mode" },
|
||||
lualine_b = { "branch", "diff", "diagnostics" },
|
||||
lualine_c = {
|
||||
{
|
||||
go_package,
|
||||
cond = function()
|
||||
return vim.bo.filetype == "go"
|
||||
end,
|
||||
},
|
||||
{ "filename" },
|
||||
},
|
||||
lualine_x = {
|
||||
"encoding",
|
||||
"fileformat",
|
||||
"filetype",
|
||||
},
|
||||
lualine_y = { "progress" },
|
||||
lualine_z = { "location" },
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
53
home/extra/neovim/nvim/lua/plugins/neo-tree.lua
Normal file
53
home/extra/neovim/nvim/lua/plugins/neo-tree.lua
Normal file
@@ -0,0 +1,53 @@
|
||||
return {
|
||||
{
|
||||
"nvim-neo-tree/neo-tree.nvim",
|
||||
version = "*",
|
||||
dependencies = {
|
||||
"nvim-lua/plenary.nvim",
|
||||
"nvim-tree/nvim-web-devicons", -- optional, but recommended
|
||||
"MunifTanjim/nui.nvim",
|
||||
},
|
||||
event = { "BufReadPost", "BufNewFile" },
|
||||
cmd = { "Neotree" },
|
||||
opts = {
|
||||
close_if_last_window = true,
|
||||
window = {
|
||||
mappings = {
|
||||
["l"] = "open",
|
||||
["h"] = "open_split",
|
||||
-- TODO: `v` is for select. Find another key for vsplit
|
||||
-- ['v'] = 'open_vsplit',
|
||||
},
|
||||
},
|
||||
filesystem = {
|
||||
follow_current_file = { enabled = true },
|
||||
},
|
||||
},
|
||||
keys = {
|
||||
{ "<C-n>", "<CMD>Neotree toggle<CR>", mode = { "n", "x", "t" }, desc = "Toggle [N]eoTree", nowait = true },
|
||||
-- {
|
||||
-- '<C-b>',
|
||||
-- '<CMD>Neotree toggle buffers<CR>',
|
||||
-- mode = { 'n', 'x', 't' },
|
||||
-- desc = 'Toggle Neotree [B]uffers',
|
||||
-- nowait = true,
|
||||
-- },
|
||||
{
|
||||
"<C-f>",
|
||||
"<CMD>Neotree toggle position=current<CR>",
|
||||
mode = { "n", "x" },
|
||||
desc = "Toggle [F]ull NeoTree",
|
||||
nowait = true,
|
||||
},
|
||||
},
|
||||
},
|
||||
-- file operations using built-in LSP
|
||||
{
|
||||
"antosha417/nvim-lsp-file-operations",
|
||||
config = true,
|
||||
dependencies = {
|
||||
"nvim-lua/plenary.nvim",
|
||||
"nvim-neo-tree/neo-tree.nvim",
|
||||
},
|
||||
},
|
||||
}
|
||||
10
home/extra/neovim/nvim/lua/plugins/notify.lua
Normal file
10
home/extra/neovim/nvim/lua/plugins/notify.lua
Normal file
@@ -0,0 +1,10 @@
|
||||
return {
|
||||
{
|
||||
"rcarriga/nvim-notify",
|
||||
lazy = true,
|
||||
opts = {
|
||||
render = "compact",
|
||||
background_colour = "#000000",
|
||||
},
|
||||
},
|
||||
}
|
||||
47
home/extra/neovim/nvim/lua/plugins/rust.lua
Normal file
47
home/extra/neovim/nvim/lua/plugins/rust.lua
Normal file
@@ -0,0 +1,47 @@
|
||||
return {
|
||||
{
|
||||
"mrcjkb/rustaceanvim",
|
||||
version = "^3",
|
||||
event = { "BufReadPost *.rs" },
|
||||
keys = {
|
||||
{
|
||||
"<Leader>a",
|
||||
mode = "n",
|
||||
function()
|
||||
vim.cmd.RustLsp("codeAction")
|
||||
end,
|
||||
{ buffer = vim.api.nvim_get_current_buf() },
|
||||
desc = "LSP Code Action",
|
||||
},
|
||||
},
|
||||
config = function()
|
||||
vim.g.rustaceanvim = {
|
||||
tools = {
|
||||
inlay_hints = {
|
||||
auto = false,
|
||||
highlight = "Debug",
|
||||
},
|
||||
hover_actions = {
|
||||
auto_focus = true,
|
||||
},
|
||||
},
|
||||
server = {
|
||||
settings = {
|
||||
["rust-analyzer"] = {
|
||||
checkOnSave = {
|
||||
enable = true,
|
||||
command = "clippy",
|
||||
},
|
||||
cargo = {
|
||||
allFeatures = true,
|
||||
},
|
||||
},
|
||||
},
|
||||
on_attach = function(client, _)
|
||||
client.server_capabilities.semanticTokensProvider = nil
|
||||
end,
|
||||
},
|
||||
}
|
||||
end,
|
||||
},
|
||||
}
|
||||
68
home/extra/neovim/nvim/lua/plugins/telescope.lua
Normal file
68
home/extra/neovim/nvim/lua/plugins/telescope.lua
Normal file
@@ -0,0 +1,68 @@
|
||||
return {
|
||||
{
|
||||
"nvim-telescope/telescope.nvim",
|
||||
cmd = "Telescope",
|
||||
dependencies = {
|
||||
"nvim-lua/plenary.nvim",
|
||||
{
|
||||
"nvim-telescope/telescope-file-browser.nvim",
|
||||
event = "VeryLazy",
|
||||
dependencies = {
|
||||
"nvim-telescope/telescope.nvim",
|
||||
"nvim-lua/plenary.nvim",
|
||||
"nvim-tree/nvim-web-devicons",
|
||||
},
|
||||
},
|
||||
},
|
||||
-- stylua: ignore
|
||||
keys = {
|
||||
{
|
||||
"<leader>pf",
|
||||
mode = "n",
|
||||
function() require("telescope.builtin").find_files() end,
|
||||
desc = "telescope find files"
|
||||
},
|
||||
{
|
||||
"<C-p>",
|
||||
mode = "n",
|
||||
function() require("telescope.builtin").git_files() end,
|
||||
desc = "telescope find files"
|
||||
},
|
||||
{
|
||||
"<leader>ps",
|
||||
mode = "n",
|
||||
function()
|
||||
require("telescope.builtin").live_grep()
|
||||
end,
|
||||
desc = "telescope grep string"
|
||||
},
|
||||
{
|
||||
"<leader>pt",
|
||||
mode = "n",
|
||||
function()
|
||||
require("telescope.builtin").treesitter()
|
||||
end,
|
||||
desc = "telescope treesitter"
|
||||
},
|
||||
{
|
||||
"<leader>pb",
|
||||
mode = "n",
|
||||
function() require("telescope.builtin").buffers() end,
|
||||
desc = "telescope buffers"
|
||||
},
|
||||
},
|
||||
config = function()
|
||||
local opts = {
|
||||
extensions = {
|
||||
file_browser = {
|
||||
respect_gitignore = false,
|
||||
hijack_netrw = true,
|
||||
hidden = true,
|
||||
},
|
||||
},
|
||||
}
|
||||
require("telescope").setup(opts)
|
||||
require("telescope").load_extension("file_browser")
|
||||
end,
|
||||
},
|
||||
}
|
||||
25
home/extra/neovim/nvim/lua/plugins/treesitter.lua
Normal file
25
home/extra/neovim/nvim/lua/plugins/treesitter.lua
Normal file
@@ -0,0 +1,25 @@
|
||||
return {
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
event = { "BufReadPost", "BufNewFile" },
|
||||
main = "nvim-treesitter.configs",
|
||||
dev = true,
|
||||
opts = {
|
||||
-- autotag = {
|
||||
-- enable = true
|
||||
-- },
|
||||
highlight = {
|
||||
-- `false` will disable the whole extension
|
||||
enable = true,
|
||||
additional_vim_regex_highlighting = false,
|
||||
},
|
||||
incremental_selection = {
|
||||
enable = true,
|
||||
keymaps = {
|
||||
init_selection = "<CR>",
|
||||
node_incremental = "<CR>",
|
||||
scope_incremental = "<S-CR>",
|
||||
node_decremental = "<BS>",
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
7
home/extra/neovim/nvim/lua/plugins/which-key.lua
Normal file
7
home/extra/neovim/nvim/lua/plugins/which-key.lua
Normal file
@@ -0,0 +1,7 @@
|
||||
return {
|
||||
{
|
||||
"folke/which-key.nvim",
|
||||
event = "VeryLazy",
|
||||
opts = {},
|
||||
},
|
||||
}
|
||||
Reference in New Issue
Block a user