Refactor the entire configuration
With the release of the Nvidia 555 beta drivers and their improvements to the Wayland experience I've finally decided to return to NixOS with Hyprland again after 2 years of running Gentoo and Opensuse Tumbleweed on X11. So this is me committing the work done so far from the last couple of days. Future commits will be more incremental.
This commit is contained in:
parent
97c86fb014
commit
75b13ac379
72 changed files with 2045 additions and 196 deletions
7
users/hu/packages/nvim/config/lua/plugins/autoclose.lua
Normal file
7
users/hu/packages/nvim/config/lua/plugins/autoclose.lua
Normal file
|
@ -0,0 +1,7 @@
|
|||
return {
|
||||
"m4xshen/autoclose.nvim",
|
||||
config = function()
|
||||
require"autoclose".setup()
|
||||
end
|
||||
}
|
||||
|
55
users/hu/packages/nvim/config/lua/plugins/cmp.lua
Normal file
55
users/hu/packages/nvim/config/lua/plugins/cmp.lua
Normal file
|
@ -0,0 +1,55 @@
|
|||
return {
|
||||
"hrsh7th/nvim-cmp",
|
||||
dependencies = {
|
||||
"L3MON4D3/LuaSnip",
|
||||
"saadparwaiz1/cmp_luasnip",
|
||||
"hrsh7th/cmp-buffer",
|
||||
"hrsh7th/cmp-path",
|
||||
"hrsh7th/cmp-nvim-lsp",
|
||||
{
|
||||
"tamago324/cmp-zsh",
|
||||
config = function()
|
||||
require"cmp_zsh".setup {
|
||||
zshrc = true,
|
||||
filetypes = { "bash", "zsh", "sh" },
|
||||
}
|
||||
end,
|
||||
},
|
||||
"ray-x/cmp-treesitter",
|
||||
"hrsh7th/cmp-nvim-lua",
|
||||
"andersevenrud/cmp-tmux",
|
||||
},
|
||||
config = function()
|
||||
local cmp = require"cmp"
|
||||
cmp.setup {
|
||||
snippet = {
|
||||
expand = function(args)
|
||||
require"luasnip".lsp_expand(args.body)
|
||||
end,
|
||||
},
|
||||
view = {
|
||||
entries = "native",
|
||||
},
|
||||
mapping = cmp.mapping.preset.insert {
|
||||
['<C-k>'] = cmp.mapping.select_prev_item(),
|
||||
['<C-j>'] = cmp.mapping.select_next_item(),
|
||||
['<A-j>'] = cmp.mapping.scroll_docs(4),
|
||||
['<A-k>'] = cmp.mapping.scroll_docs(-4),
|
||||
['<S-CR>'] = cmp.mapping.complete(),
|
||||
['<C-Space>'] = cmp.mapping.confirm({ select = true }),
|
||||
['<C-e>'] = cmp.mapping.abort(),
|
||||
},
|
||||
sources = {
|
||||
{ name = "path" },
|
||||
{ name = "luasnip" },
|
||||
{ name = "zsh" },
|
||||
{ name = "nvim_lsp" },
|
||||
{ name = "buffer" },
|
||||
{ name = "treesitter" },
|
||||
{ name = "nvim-lua" },
|
||||
{ name = "tmux" },
|
||||
},
|
||||
}
|
||||
end
|
||||
}
|
||||
|
5
users/hu/packages/nvim/config/lua/plugins/comment.lua
Normal file
5
users/hu/packages/nvim/config/lua/plugins/comment.lua
Normal file
|
@ -0,0 +1,5 @@
|
|||
return {
|
||||
"numToStr/Comment.nvim",
|
||||
opts = {},
|
||||
lazy = false
|
||||
}
|
4
users/hu/packages/nvim/config/lua/plugins/dressing.lua
Normal file
4
users/hu/packages/nvim/config/lua/plugins/dressing.lua
Normal file
|
@ -0,0 +1,4 @@
|
|||
return {
|
||||
"stevearc/dressing.nvim",
|
||||
opts = {}
|
||||
}
|
12
users/hu/packages/nvim/config/lua/plugins/gruvbox.lua
Normal file
12
users/hu/packages/nvim/config/lua/plugins/gruvbox.lua
Normal file
|
@ -0,0 +1,12 @@
|
|||
return {
|
||||
"ellisonleao/gruvbox.nvim",
|
||||
priority = 1000,
|
||||
config = function()
|
||||
require"gruvbox".setup {
|
||||
transparent_mode = true,
|
||||
contrast = "soft",
|
||||
}
|
||||
vim.cmd("colorscheme gruvbox")
|
||||
end,
|
||||
}
|
||||
|
11
users/hu/packages/nvim/config/lua/plugins/ibl.lua
Normal file
11
users/hu/packages/nvim/config/lua/plugins/ibl.lua
Normal file
|
@ -0,0 +1,11 @@
|
|||
return {
|
||||
"lukas-reineke/indent-blankline.nvim",
|
||||
main = "ibl",
|
||||
opts = {},
|
||||
opts = {
|
||||
indent = {
|
||||
char = "▏"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
22
users/hu/packages/nvim/config/lua/plugins/init.lua
Normal file
22
users/hu/packages/nvim/config/lua/plugins/init.lua
Normal file
|
@ -0,0 +1,22 @@
|
|||
if vim.fn.executable("git") ~= 1 then
|
||||
vim.notify("git is not installed. Skipping plugins.", vim.log.levels.WARN)
|
||||
return
|
||||
end
|
||||
|
||||
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
|
||||
if not (vim.uv or vim.loop).fs_stat(lazypath) then
|
||||
vim.fn.system({
|
||||
"git",
|
||||
"clone",
|
||||
"--filter=blob:none",
|
||||
"https://github.com/folke/lazy.nvim.git",
|
||||
"--branch=stable", -- latest stable release
|
||||
lazypath,
|
||||
})
|
||||
end
|
||||
vim.opt.rtp:prepend(lazypath)
|
||||
|
||||
plugins = require"util.require_dir"(vim.fn.stdpath("config").."/lua/plugins/", true)
|
||||
|
||||
require"lazy".setup(plugins)
|
||||
|
12
users/hu/packages/nvim/config/lua/plugins/kanagawa.lua
Normal file
12
users/hu/packages/nvim/config/lua/plugins/kanagawa.lua
Normal file
|
@ -0,0 +1,12 @@
|
|||
return {}
|
||||
-- Currently using gruvbox
|
||||
--[[return {
|
||||
"rebelot/kanagawa.nvim",
|
||||
config = function()
|
||||
require"kanagawa".setup {
|
||||
transparent = true
|
||||
}
|
||||
vim.cmd("colorscheme kanagawa-dragon")
|
||||
end
|
||||
}
|
||||
]]--
|
5
users/hu/packages/nvim/config/lua/plugins/lsp/c.lua
Normal file
5
users/hu/packages/nvim/config/lua/plugins/lsp/c.lua
Normal file
|
@ -0,0 +1,5 @@
|
|||
return function ()
|
||||
require"lspconfig".clangd.setup {
|
||||
capabilities = require"cmp_nvim_lsp".default_capabilities()
|
||||
}
|
||||
end
|
24
users/hu/packages/nvim/config/lua/plugins/lsp/lua.lua
Normal file
24
users/hu/packages/nvim/config/lua/plugins/lsp/lua.lua
Normal file
|
@ -0,0 +1,24 @@
|
|||
return function()
|
||||
require'lspconfig'.lua_ls.setup {
|
||||
capabilities = require"cmp_nvim_lsp".default_capabilities(),
|
||||
on_init = function(client)
|
||||
local path = client.workspace_folders[1].name
|
||||
if vim.loop.fs_stat(path..'/.luarc.json') or vim.loop.fs_stat(path..'/.luarc.jsonc') then
|
||||
return
|
||||
end
|
||||
|
||||
client.config.settings.Lua = vim.tbl_deep_extend('force', client.config.settings.Lua, {
|
||||
runtime = {
|
||||
version = 'LuaJIT'
|
||||
},
|
||||
workspace = {
|
||||
checkThirdParty = false,
|
||||
library = vim.api.nvim_get_runtime_file("", true)
|
||||
}
|
||||
})
|
||||
end,
|
||||
settings = {
|
||||
Lua = {}
|
||||
}
|
||||
}
|
||||
end
|
6
users/hu/packages/nvim/config/lua/plugins/lsp/nix.lua
Normal file
6
users/hu/packages/nvim/config/lua/plugins/lsp/nix.lua
Normal file
|
@ -0,0 +1,6 @@
|
|||
return function ()
|
||||
require"lspconfig".nil_ls.setup {
|
||||
capabilities = require"cmp_nvim_lsp".default_capabilities()
|
||||
}
|
||||
end
|
||||
|
5
users/hu/packages/nvim/config/lua/plugins/lsp/php.lua
Normal file
5
users/hu/packages/nvim/config/lua/plugins/lsp/php.lua
Normal file
|
@ -0,0 +1,5 @@
|
|||
return function ()
|
||||
require"lspconfig".intelephense. setup {
|
||||
capabilities = require"cmp_nvim_lsp".default_capabilities(),
|
||||
}
|
||||
end
|
29
users/hu/packages/nvim/config/lua/plugins/lspconfig.lua
Normal file
29
users/hu/packages/nvim/config/lua/plugins/lspconfig.lua
Normal file
|
@ -0,0 +1,29 @@
|
|||
return {
|
||||
"neovim/nvim-lspconfig",
|
||||
config = function()
|
||||
local require_dir = require"util.require_dir"
|
||||
local lspees = require_dir(vim.fn.stdpath("config").."/lua/plugins/lsp/", "plugins.lsp")
|
||||
for _, lspee in ipairs(lspees) do
|
||||
lspee()
|
||||
end
|
||||
|
||||
local map = require"util.map"
|
||||
local vlb = vim.lsp.buf
|
||||
local format = function()
|
||||
vlb.format { async = true }
|
||||
end
|
||||
vim.api.nvim_create_autocmd("LspAttach", {
|
||||
group = vim.api.nvim_create_augroup("UserLspConfig", {}),
|
||||
callback = function()
|
||||
map("n", "<leader>lgD", vlb.declaration, "[l]sp [g]o to [D]eclaration")
|
||||
map("n", "<leader>lgd", vlb.definition, "[l]sp [g]o to [d]definition")
|
||||
map("n", "<leader>lgi", vlb.implementation, "[l]sp [g]o to [i]mplementation")
|
||||
map("n", "<leader>lgr", vlb.references, "[l]sp [g]o to [r]eferences")
|
||||
map("n", "<leader>lh", vlb.hover, "[l]sp [h]over over selection")
|
||||
map("n", "<leader>lfm", format, "[l]sp [f]or[m]at file")
|
||||
map("n", "<leader>lca", vlb.code_action, "[l]sp [C]ode [a]ction")
|
||||
end,
|
||||
})
|
||||
end
|
||||
}
|
||||
|
139
users/hu/packages/nvim/config/lua/plugins/lualine.lua
Normal file
139
users/hu/packages/nvim/config/lua/plugins/lualine.lua
Normal file
|
@ -0,0 +1,139 @@
|
|||
return {
|
||||
"nvim-lualine/lualine.nvim",
|
||||
dependencies = {
|
||||
"nvim-tree/nvim-web-devicons",
|
||||
},
|
||||
config = function()
|
||||
-- Inspired by https://github.com/nvim-lualine/lualine.nvim/blob/master/examples/evil_lualine.lua
|
||||
local rgb_to_hex = require"util.rgb_to_hex"
|
||||
local hl = require"util.hl"
|
||||
local config = {
|
||||
options = {
|
||||
component_separators = "",
|
||||
section_separators = "",
|
||||
theme = {
|
||||
normal = {
|
||||
c = {
|
||||
fg = rgb_to_hex(hl("Normal").fg),
|
||||
bg = rgb_to_hex(hl("Normal").bg),
|
||||
},
|
||||
},
|
||||
inactive = {
|
||||
c = {
|
||||
fg = rgb_to_hex(hl("Normal").fg),
|
||||
bg = rgb_to_hex(hl("Normal").bg),
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
sections = {
|
||||
lualine_a = {}, lualine_b = {}, lualine_y = {}, lualine_z = {}, -- Remove defaults
|
||||
lualine_c = {}, lualine_x = {}, -- Extend these later
|
||||
},
|
||||
inactive_sections = {
|
||||
lualine_a = {}, lualine_b = {}, lualine_c = {}, lualine_x = {}, lualine_y = {}, lualine_z = {},
|
||||
},
|
||||
}
|
||||
|
||||
local function buffer_not_empty()
|
||||
return vim.fn.empty(vim.fn.expand("%:t")) ~= 1
|
||||
end
|
||||
|
||||
local function ins_l(component)
|
||||
table.insert(config.sections.lualine_c, component)
|
||||
end
|
||||
|
||||
local function ins_r(component)
|
||||
table.insert(config.sections.lualine_x, component)
|
||||
end
|
||||
|
||||
local distro = require"util.get_distro"()
|
||||
|
||||
ins_l {
|
||||
function()
|
||||
return "▊"
|
||||
end,
|
||||
padding = {
|
||||
left = 0,
|
||||
right = 0,
|
||||
},
|
||||
color = {
|
||||
fg = rgb_to_hex(hl("Comment").fg),
|
||||
},
|
||||
}
|
||||
|
||||
ins_l {
|
||||
function()
|
||||
return distro.traits.icon
|
||||
end,
|
||||
color = {
|
||||
fg = distro.traits.color,
|
||||
},
|
||||
}
|
||||
|
||||
ins_l {
|
||||
"filename",
|
||||
cond = buffer_not_empty,
|
||||
color = {
|
||||
fg = rgb_to_hex(hl("Operator").fg),
|
||||
}
|
||||
}
|
||||
|
||||
ins_l {
|
||||
"filesize",
|
||||
cond = buffer_not_empty,
|
||||
}
|
||||
|
||||
ins_l {
|
||||
"o:encoding",
|
||||
cond = buffer_not_empty,
|
||||
}
|
||||
|
||||
ins_l {
|
||||
"fileformat",
|
||||
icons_enabled = false,
|
||||
cond = buffer_not_empty,
|
||||
}
|
||||
|
||||
ins_r { "diagnostics" }
|
||||
ins_r { "diff" }
|
||||
|
||||
ins_r {
|
||||
"branch",
|
||||
padding = {
|
||||
right = 0,
|
||||
},
|
||||
color = {
|
||||
fg = rgb_to_hex(hl("Constant").fg)
|
||||
}
|
||||
}
|
||||
|
||||
ins_r {
|
||||
"location",
|
||||
}
|
||||
|
||||
ins_r {
|
||||
"mode",
|
||||
fmt = string.lower,
|
||||
color = {
|
||||
fg = rgb_to_hex(hl("String").fg),
|
||||
}
|
||||
}
|
||||
|
||||
ins_r {
|
||||
function()
|
||||
return "▊"
|
||||
end,
|
||||
padding = {
|
||||
left = 0,
|
||||
right = 0,
|
||||
},
|
||||
color = {
|
||||
fg = rgb_to_hex(hl("Comment").fg),
|
||||
}
|
||||
}
|
||||
|
||||
require"lualine".setup(config)
|
||||
end
|
||||
}
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
return {
|
||||
"norcalli/nvim-colorizer.lua",
|
||||
config = function()
|
||||
require"colorizer".setup()
|
||||
end,
|
||||
}
|
30
users/hu/packages/nvim/config/lua/plugins/telescope.lua
Normal file
30
users/hu/packages/nvim/config/lua/plugins/telescope.lua
Normal file
|
@ -0,0 +1,30 @@
|
|||
return {
|
||||
"nvim-telescope/telescope.nvim",
|
||||
dependencies = { "nvim-lua/plenary.nvim" },
|
||||
config = function()
|
||||
require"telescope".setup {}
|
||||
|
||||
local tb = require"telescope.builtin"
|
||||
local map = require"util.map"
|
||||
|
||||
-- Default pickers
|
||||
map("n", "<leader>tf", function()
|
||||
if vim.fn.isdirectory(".git") ~= 0 then
|
||||
tb.git_files()
|
||||
else
|
||||
tb.find_files()
|
||||
end
|
||||
end, "[T]elescope [f]iles")
|
||||
map("n", "<leader>tg", tb.live_grep, "[T]elescope [g]rep")
|
||||
map("n", "<leader>tb", tb.buffers, "[T]elescope [b]uffers")
|
||||
map("n", "<leader>tm", function()
|
||||
tb.man_pages({ "ALL" })
|
||||
end, "[T]elescope [m]an pages")
|
||||
map("n", "<leader>tk", tb.keymaps, "[T]elescope [k]eymaps")
|
||||
map("n", "<leader>tk", tb.keymaps, "[T]elescope [k]eymaps")
|
||||
|
||||
-- LSP pickers
|
||||
map("n", "<leader>tld", tb.diagnostics, "[T]elescope [l]sp [d]iagnostics")
|
||||
map("n", "<leader>tlr", tb.lsp_references, "[T]elescope [l]sp [r]eferences")
|
||||
end,
|
||||
}
|
15
users/hu/packages/nvim/config/lua/plugins/treesitter.lua
Normal file
15
users/hu/packages/nvim/config/lua/plugins/treesitter.lua
Normal file
|
@ -0,0 +1,15 @@
|
|||
return {
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
config = function()
|
||||
require"nvim-treesitter.configs".setup {
|
||||
ensure_installed = "all", -- pipebomb
|
||||
highlight = {
|
||||
enable = true,
|
||||
},
|
||||
indent = {
|
||||
enable = true,
|
||||
},
|
||||
}
|
||||
end,
|
||||
run = ":TSUpdate",
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue