update. Split neovim config into several files

This commit is contained in:
Varris 2023-06-04 02:19:26 +02:00
parent 2e523322c0
commit ee0b50aa44
35 changed files with 315 additions and 297 deletions

View File

@ -68,7 +68,7 @@
keyMap = "us-acentos";
};
chaotic.mesa-git.enable = true; # requires --impure for now
#chaotic.mesa-git.enable = true; # requires --impure for now
hardware.opengl = {
enable = true;
@ -128,11 +128,6 @@
];
};
chaotic.gamescope = {
enable = true;
package = pkgs.gamescope_git;
};
programs = {
dconf.enable = true;
hyprland.enable = true;

View File

@ -37,7 +37,6 @@
overlays = [
self.overlays.default
inputs.chaotic-nyx.overlays.default
inputs.hyprland.overlays.default
inputs.hyprland-contrib.overlays.default
inputs.hyprpicker.overlays.default
];
@ -67,8 +66,9 @@
useGlobalPkgs = true;
};
}
inputs.chaotic-nyx.nixosModules.default
inputs.grub2-themes.nixosModules.default
inputs.chaotic-nyx.nixosModules.default
inputs.hyprland.nixosModules.default
];
};
};

0
overlay.nix Normal file → Executable file
View File

0
pkgs/gruvbox-plus-icon-pack/default.nix Normal file → Executable file
View File

0
user/configs/cava/default.nix Normal file → Executable file
View File

0
user/configs/kvantum/default.nix Normal file → Executable file
View File

View File

@ -0,0 +1,3 @@
require("settings")
require("plugins")
require("remaps")

View File

@ -0,0 +1 @@
require("nvim-autopairs").setup({})

View File

@ -0,0 +1,16 @@
require("bufferline").setup({
options = {
show_tab_indicators = true,
-- separator_style = { "", "" },
indicator = { style = "icon", icon = "" },
color_icons = true,
offsets = {
{
filetype = "neo-tree",
text = "File Explorer",
text_align = "center",
separator = true,
},
},
},
})

View File

@ -0,0 +1,122 @@
local cmp = require("cmp")
local lspkind = require("lspkind")
local luasnip = require("luasnip")
require("luasnip.loaders.from_vscode").lazy_load()
local has_words_before = function()
unpack = unpack or table.unpack
local line, col = unpack(vim.api.nvim_win_get_cursor(0))
return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match("%s") == nil
end
cmp.setup({
preselect = cmp.PreselectMode.None,
formatting = {
format = lspkind.cmp_format({
mode = "symbol_text",
symbol_map = {
Text = "󰉿",
Method = "󰆧",
Function = "󰊕",
Constructor = "",
Field = "",
Variable = "󰀫",
Class = "",
Interface = "",
Module = "",
Property = "",
Unit = "",
Value = "󰎠",
Enum = "",
Keyword = "󰌋",
Snippet = "",
Color = "󰏘",
File = "󰈙",
Reference = "󰈇",
Folder = "󰉋",
EnumMember = "",
Constant = "󰏿",
Struct = "",
Event = "",
Operator = "󰆕",
TypeParameter = ""
},
}),
},
snippet = {
expand = function(args)
require('luasnip').lsp_expand(args.body)
end,
},
window = {
completion = cmp.config.window.bordered(),
documentation = cmp.config.window.bordered(),
},
sources = cmp.config.sources({
{ name = "buffer" },
{ name = "path" },
{ name = "nvim_lsp" },
{ name = "nvim_lsp_signature_help"},
{ name = "luasnip" },
}),
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 = false }),
["<Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_next_item()
-- You could replace the expand_or_jumpable() calls with expand_or_locally_jumpable()
-- they way you will only jump inside the snippet region
elseif luasnip.expand_or_locally_jumpable() then
luasnip.expand_or_jump()
elseif has_words_before() then
cmp.complete()
else
fallback()
end
end, { "i", "s" }),
["<S-Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_prev_item()
elseif luasnip.jumpable(-1) then
luasnip.jump(-1)
else
fallback()
end
end, { "i", "s" }),
}),
})
local cmp_autopairs = require('nvim-autopairs.completion.cmp')
cmp.event:on(
'confirm_done',
cmp_autopairs.on_confirm_done()
)
cmp.setup.cmdline(":", {
mapping = cmp.mapping.preset.cmdline(),
sources = cmp.config.sources({
{ name = "path" },
{ name = "cmdline" },
})
})
cmp.setup.cmdline("/", {
mapping = cmp.mapping.preset.cmdline(),
sources = cmp.config.sources({
{ name = "buffer" },
})
})

View File

@ -0,0 +1 @@
require("colorizer").setup({})

View File

@ -0,0 +1,6 @@
require("gruvbox").setup({
--transparent_mode = true
})
vim.cmd("colorscheme gruvbox")

View File

@ -0,0 +1 @@
require("Comment").setup({})

View File

@ -0,0 +1 @@
require("dressing").setup()

View File

@ -0,0 +1,14 @@
require("plugins.colorscheme")
require("plugins.lualine")
require("plugins.bufferline")
require("plugins.treesitter")
require("plugins.lspconfig")
require("plugins.cmp")
require("plugins.telescope")
require("plugins.colorizer")
require("plugins.dressing")
require("plugins.autopairs")
require("plugins.comment")
require("plugins.smartsplits")
require("plugins.trouble")
require("plugins.which-key")

View File

@ -0,0 +1,35 @@
local capabilities = require('cmp_nvim_lsp').default_capabilities()
capabilities.textDocument.completion.completionItem.snippetSupport = true
local lspconfig = require("lspconfig")
lspconfig.rnix.setup { capabilities = capabilities }
lspconfig.lua_ls.setup {
capabilities = capabilities,
settings = {
Lua = {
runtime = { version = "LuaJIT" },
diagnostics = { globals = { "vim" } },
workspace = {
library = vim.api.nvim_get_runtime_file("", true),
checkThirdParty = false
},
telemetry = { enable = false },
},
},
}
lspconfig.clangd.setup { capabilities = capabilities }
lspconfig.rust_analyzer.setup { capabilities = capabilities }
lspconfig.zls.setup { capabilities = capabilities }
lspconfig.jedi_language_server.setup { capabilities = capabilities }
lspconfig.bashls.setup { capabilities = capabilities }
lspconfig.cssls.setup {
capabilities = capabilities,
cmd = { "css-languageserver", "--stdio" },
settings = {
css = { validate = false },
}
}

View File

@ -0,0 +1,5 @@
require("lualine").setup({
options = {
theme = "gruvbox_dark",
}
})

View File

@ -0,0 +1,36 @@
require("neo-tree").setup({
default_component_configs = {
icon = {
folder_empty = "󰜌",
folder_empty_open = "󰜌",
},
git_status = {
symbols = {
renamed = "󰁕",
unstaged = "󰄱",
},
},
},
document_symbols = {
kinds = {
File = { icon = "󰈙", hl = "Tag" },
Namespace = { icon = "󰌗", hl = "Include" },
Package = { icon = "󰏖", hl = "Label" },
Class = { icon = "󰌗", hl = "Include" },
Property = { icon = "󰆧", hl = "@property" },
Enum = { icon = "󰒻", hl = "@number" },
Function = { icon = "󰊕", hl = "Function" },
String = { icon = "󰀬", hl = "String" },
Number = { icon = "󰎠", hl = "Number" },
Array = { icon = "󰅪", hl = "Type" },
Object = { icon = "󰅩", hl = "Type" },
Key = { icon = "󰌋", hl = "" },
Struct = { icon = "󰌗", hl = "Type" },
Operator = { icon = "󰆕", hl = "Operator" },
TypeParameter = { icon = "󰊄", hl = "Type" },
StaticMethod = { icon = '󰠄 ', hl = 'Function' },
}
},
})

View File

@ -0,0 +1 @@
require("smart-splits").setup()

View File

@ -0,0 +1 @@
require('nvim-surround').setup()

View File

@ -0,0 +1,13 @@
local telescope = require("telescope")
telescope.setup({
extensions = {
["ui-select"] = {
require("telescope.themes").get_dropdown {}
},
},
})
telescope.load_extension("fzf")
telescope.load_extension("ui-select")
telescope.load_extension("undo")

View File

@ -0,0 +1,3 @@
require("nvim-treesitter.configs").setup({
highlight = { enable = true },
})

View File

@ -0,0 +1 @@
require("trouble").setup()

View File

@ -0,0 +1,3 @@
vim.o.timeoutlen = 100
require("which-key").setup()

View File

@ -0,0 +1,12 @@
local telescope_builtin = require("telescope.builtin")
local map = vim.keymap.set
map( "n", "<S-h>", "<cmd>BufferLineCyclePrev<CR>", { desc = "Prev buffer" })
map( "n", "<S-l>", "<cmd>BufferLineCycleNext<CR>", { desc = "Next buffer" })
map( {"n", "i" }, "<ESC>", "<cmd>noh<CR><ESC>",{ desc = "Escape and clear hlsearch"})
map( "n", "<Leader>ff", telescope_builtin.find_files, { desc = "Find Files" })
map( "n", "<Leader>fb", telescope_builtin.buffers, { desc = "List Buffers" })
map( "n", "<Leader>fh", telescope_builtin.help_tags, { desc = "Help Tags" })
map( "n", "<Leader>fp", telescope_builtin.git_files, { desc = "Find Files (Git)" })
map( "n", "<C-n>", "<cmd>NeoTreeFocusToggle<CR>", { desc = "Open NeoTree" })
map( {"n", "x"}, "ga", ":EasyAlign", { desc = "Align text" })

View File

@ -0,0 +1,24 @@
vim.g.mapleader = " "
-- 4 space tabs
vim.o.expandtab = true
vim.o.shiftwidth = 2
vim.o.tabstop = 2
vim.o.smartindent = true
vim.o.background = "dark"
vim.o.clipboard = "unnamedplus"
vim.o.termguicolors = true
vim.o.ignorecase = true
vim.o.smartcase = true
vim.o.lazyredraw = true
vim.o.wrap = false
vim.o.scrolloff = 8
vim.o.swapfile = false
vim.o.backup = false
vim.o.undodir = os.getenv("HOME") .. "/.local/share/nvim/undodir"
vim.o.undofile = true
vim.wo.number = true
vim.wo.relativenumber = true

12
user/configs/neovim/default.nix Normal file → Executable file
View File

@ -19,12 +19,14 @@
which-key-nvim
smart-splits-nvim
legendary-nvim
vim-easy-align
vim-fugitive
telescope-nvim
telescope-fzf-native-nvim
telescope-ui-select-nvim
telescope-undo-nvim
nvim-lspconfig
nvim-treesitter.withAllGrammars
@ -36,20 +38,26 @@
cmp-nvim-lsp
cmp-path
cmp_luasnip
cmp-nvim-lsp-signature-help
friendly-snippets
lspkind-nvim
];
extraLuaConfig = builtins.readFile ./init.lua;
extraPackages = with pkgs; [
nodePackages.bash-language-server
clang-tools
lua-language-server
python3Packages.jedi-language-server
rnix-lsp
rust-analyzer
nodePackages.vscode-css-languageserver-bin
zls
];
};
xdg.configFile.nvim = {
source = ./config;
recursive = true;
};
}

View File

@ -1,284 +0,0 @@
vim.g.mapleader = " "
-- 4 space tabs
vim.o.expandtab = true
vim.o.shiftwidth = 2
vim.o.tabstop = 2
vim.o.smartindent = true
vim.o.background = "dark"
vim.o.clipboard = "unnamedplus"
vim.o.termguicolors = true
vim.o.ignorecase = true
vim.o.smartcase = true
vim.o.lazyredraw = true
vim.o.timeoutlen = 100
vim.wo.number = true
vim.wo.relativenumber = true
require("gruvbox").setup({
transparent_mode = true
})
vim.cmd("colorscheme gruvbox")
require("lualine").setup({
options = {
theme = "gruvbox_dark",
}
})
require("dressing").setup()
require("bufferline").setup({
options = {
show_tab_indicators = true,
-- separator_style = { "", "" },
indicator = { style = "icon", icon = "" },
color_icons = true,
offsets = {
{
filetype = "neo-tree",
text = "File Explorer",
text_align = "center",
separator = true,
},
},
},
})
require("colorizer").setup({})
require("nvim-autopairs").setup({})
require("Comment").setup({})
require("neo-tree").setup({
default_component_configs = {
icon = {
folder_empty = "󰜌",
folder_empty_open = "󰜌",
},
git_status = {
symbols = {
renamed = "󰁕",
unstaged = "󰄱",
},
},
},
document_symbols = {
kinds = {
File = { icon = "󰈙", hl = "Tag" },
Namespace = { icon = "󰌗", hl = "Include" },
Package = { icon = "󰏖", hl = "Label" },
Class = { icon = "󰌗", hl = "Include" },
Property = { icon = "󰆧", hl = "@property" },
Enum = { icon = "󰒻", hl = "@number" },
Function = { icon = "󰊕", hl = "Function" },
String = { icon = "󰀬", hl = "String" },
Number = { icon = "󰎠", hl = "Number" },
Array = { icon = "󰅪", hl = "Type" },
Object = { icon = "󰅩", hl = "Type" },
Key = { icon = "󰌋", hl = "" },
Struct = { icon = "󰌗", hl = "Type" },
Operator = { icon = "󰆕", hl = "Operator" },
TypeParameter = { icon = "󰊄", hl = "Type" },
StaticMethod = { icon = '󰠄 ', hl = 'Function' },
}
},
})
require("nvim-treesitter.configs").setup({
highlight = { enable = true, },
})
require("smart-splits").setup()
require("trouble").setup()
local telescope = require("telescope")
telescope.setup({
extensions = {
["ui-select"] = {
require("telescope.themes").get_dropdown {}
},
},
})
local telescope_builtin = require("telescope.builtin")
telescope.load_extension("fzf")
telescope.load_extension("ui-select")
require('nvim-surround').setup()
local capabilities = require('cmp_nvim_lsp').default_capabilities()
capabilities.textDocument.completion.completionItem.snippetSupport = true
local lspconfig = require("lspconfig")
lspconfig.rnix.setup { capabilities = capabilities }
lspconfig.lua_ls.setup {
capabilities = capabilities,
settings = {
Lua = {
runtime = { version = "LuaJIT" },
diagnostics = { globals = { "vim" } },
workspace = {
library = vim.api.nvim_get_runtime_file("", true),
checkThirdParty = false
},
telemetry = { enable = false },
},
},
}
lspconfig.clangd.setup { capabilities = capabilities }
lspconfig.rust_analyzer.setup { capabilities = capabilities }
lspconfig.zls.setup { capabilities = capabilities }
lspconfig.cssls.setup {
capabilities = capabilities,
cmd = { "css-languageserver", "--stdio" },
settings = {
css = { validate = false },
}
}
require("luasnip.loaders.from_vscode").lazy_load()
local has_words_before = function()
unpack = unpack or table.unpack
local line, col = unpack(vim.api.nvim_win_get_cursor(0))
return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match("%s") == nil
end
local cmp = require("cmp")
local lspkind = require("lspkind")
local luasnip = require("luasnip")
cmp.setup({
preselect = cmp.PreselectMode.None,
formatting = {
format = lspkind.cmp_format({
mode = "symbol_text",
symbol_map = {
Text = "󰉿",
Method = "󰆧",
Function = "󰊕",
Constructor = "",
Field = "",
Variable = "󰀫",
Class = "",
Interface = "",
Module = "",
Property = "",
Unit = "",
Value = "󰎠",
Enum = "",
Keyword = "󰌋",
Snippet = "",
Color = "󰏘",
File = "󰈙",
Reference = "󰈇",
Folder = "󰉋",
EnumMember = "",
Constant = "󰏿",
Struct = "",
Event = "",
Operator = "󰆕",
TypeParameter = ""
},
}),
},
snippet = {
expand = function(args)
require('luasnip').lsp_expand(args.body)
end,
},
window = {
completion = cmp.config.window.bordered(),
documentation = cmp.config.window.bordered(),
},
sources = cmp.config.sources({
{ name = "buffer" },
{ name = "path" },
{ name = "nvim_lsp" },
{ name = "luasnip" },
}),
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 = false }),
["<Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_next_item()
-- You could replace the expand_or_jumpable() calls with expand_or_locally_jumpable()
-- they way you will only jump inside the snippet region
elseif luasnip.expand_or_locally_jumpable() then
luasnip.expand_or_jump()
elseif has_words_before() then
cmp.complete()
else
fallback()
end
end, { "i", "s" }),
["<S-Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_prev_item()
elseif luasnip.jumpable(-1) then
luasnip.jump(-1)
else
fallback()
end
end, { "i", "s" }),
}),
})
local cmp_autopairs = require('nvim-autopairs.completion.cmp')
cmp.event:on(
'confirm_done',
cmp_autopairs.on_confirm_done()
)
cmp.setup.cmdline(":", {
mapping = cmp.mapping.preset.cmdline(),
sources = cmp.config.sources({
{ name = "path" },
{ name = "cmdline" },
})
})
cmp.setup.cmdline("/", {
mapping = cmp.mapping.preset.cmdline(),
sources = cmp.config.sources({
{ name = "buffer" },
})
})
-- keymaps
require("which-key").setup()
require("legendary").setup({
keymaps = {
{ "<S-h>", "<cmd>BufferLineCyclePrev<CR>", description = "Prev buffer" },
{ "<S-l>", "<cmd>BufferLineCycleNext<CR>", description = "Next buffer" },
{ "<ESC>", "<cmd>noh<CR><ESC>", description = "Escape and clear hlsearch", mode = { "n", "i" } },
{ "<Leader>ff", telescope_builtin.find_files, description = "Find Files" },
{ "<Leader>fg", telescope_builtin.live_grep, description = "Live Grep" },
{ "<Leader>fb", telescope_builtin.buffers, description = "List Buffers" },
{ "<Leader>fh", telescope_builtin.help_tags, description = "Help Tags" },
{ "<Leader>fc", telescope_builtin.git_files, description = "Find Files (Git)" },
{ "<C-n>", "<cmd>NeoTreeFocusToggle<CR>", description = "Open NeoTree" },
},
extensions = {
smart_splits = {},
}
})

0
user/configs/rofi/default.nix Normal file → Executable file
View File

0
user/configs/rofi/theme.rasi Normal file → Executable file
View File

0
user/configs/tmux/default.nix Normal file → Executable file
View File

4
user/configs/wayland/hyprland/default.nix Normal file → Executable file
View File

@ -137,7 +137,7 @@ in
exec-once = ${xwaylandSetPrimary}/bin/xwayland-setprimary.sh
exec-once = ${pkgs.polkit_gnome}/libexec/polkit-gnome-authentication-agent-1
exec-once = ${pkgs.swww}/bin/swww-daemon
exec-once = ${pkgs.arrpc}/bin/arRPC
exec-once = $pkgs.arrpc}/bin/arRPC
exec = ${wob-voldaemon}/bin/wob-volumeindicator.sh;
exec = pkill waybar; ${pkgs.waybar_hyprland}/bin/waybar
@ -171,7 +171,7 @@ in
bind = ${modKey}, F, fullscreen
bind = ${modKey} SHIFT, Q, killactive
bind = ${modKey}, D, exec, ${pkgs.rofi-wayland}/bin/rofi -show drun -show-icons
bind = ${modKey}, D, exec, ${pkgs.rofi-wayland}/bin/rofi -show drun -p Applications -show-icons
bind = ${modKey}, Q, exec, ${pkgs.firefox}/bin/firefox

0
user/configs/wayland/waybar/style.css Normal file → Executable file
View File

0
user/configs/xdg-mime.nix Normal file → Executable file
View File

View File

@ -1,4 +1,4 @@
{ pkgs, ... }:
{ pkgs, inputs, ... }:
{
imports = [
./configs/beets