feat: create gruvbox-themed nixvim configuration
Added nixvim as a flake input in flake.nix Added plugin definitions ini home-manager/stvnliu/nixvim/ Added configuration options for easy toggling for editors
This commit is contained in:
parent
2f04f90bc3
commit
fcb2066392
22 changed files with 490 additions and 39 deletions
10
flake.nix
10
flake.nix
|
@ -4,7 +4,10 @@
|
|||
inputs = {
|
||||
# Nixpkgs
|
||||
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
|
||||
|
||||
nixvim = {
|
||||
url = "github:nix-community/nixvim";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
# Home manager
|
||||
home-manager.url = "github:nix-community/home-manager";
|
||||
home-manager.inputs.nixpkgs.follows = "nixpkgs";
|
||||
|
@ -37,7 +40,10 @@
|
|||
pkgs = nixpkgs.legacyPackages.x86_64-linux; # Home-manager requires 'pkgs' instance
|
||||
extraSpecialArgs = {inherit inputs outputs;};
|
||||
# > Our main home-manager configuration file <
|
||||
modules = [./home-manager/${stevenUserName}/home.nix];
|
||||
modules = [
|
||||
./home-manager/${stevenUserName}/home.nix
|
||||
inputs.nixvim.homeManagerModules.nixvim
|
||||
];
|
||||
};
|
||||
};
|
||||
};
|
||||
|
|
14
home-manager/stvnliu/editors.nix
Normal file
14
home-manager/stvnliu/editors.nix
Normal file
|
@ -0,0 +1,14 @@
|
|||
{
|
||||
lib,
|
||||
pkgs,
|
||||
config,
|
||||
...
|
||||
}: {
|
||||
imports = [
|
||||
#./vscode.nix
|
||||
#./intellij.nix
|
||||
];
|
||||
programs.nixvim = import ./nixvim;
|
||||
# dependencies for nixvim configuration
|
||||
home.packages = with pkgs; [ripgrep fd];
|
||||
}
|
|
@ -18,6 +18,8 @@
|
|||
./shells
|
||||
./variables.nix
|
||||
./mako.nix
|
||||
./wechat
|
||||
./editors.nix
|
||||
];
|
||||
|
||||
nixpkgs = {
|
||||
|
@ -50,14 +52,14 @@
|
|||
"wallpaper.png".source = ./assets/gruvbox-wallpaper.png;
|
||||
};
|
||||
};
|
||||
programs.neovim = {
|
||||
enable = true;
|
||||
viAlias = true;
|
||||
vimAlias = true;
|
||||
extraConfig = ''
|
||||
set number
|
||||
'';
|
||||
};
|
||||
#programs.neovim = {
|
||||
# enable = true;
|
||||
# viAlias = true;
|
||||
# vimAlias = true;
|
||||
# extraConfig = ''
|
||||
# set number
|
||||
# '';
|
||||
#};
|
||||
home.packages = with pkgs; [
|
||||
protonvpn-gui
|
||||
devenv
|
||||
|
@ -65,34 +67,9 @@
|
|||
zed-editor
|
||||
rhythmbox
|
||||
clash-verge-rev
|
||||
qq
|
||||
libreoffice
|
||||
];
|
||||
programs.waybar = {
|
||||
enable = true;
|
||||
settings = [
|
||||
{
|
||||
mainBar = {
|
||||
layer = "top";
|
||||
position = "top";
|
||||
height = 30;
|
||||
output = ["eDP-1" "HDMI-A-1"];
|
||||
modules-left = ["hyprland/workspaces" "hyprland/mode" "wlr/taskbar"];
|
||||
modules-center = ["hyprland/window" "custom/hello-from-waybar"];
|
||||
modules-right = ["mpd" "temperature"];
|
||||
"hyprland/workspaces" = {
|
||||
disable-scroll = true;
|
||||
all-outputs = true;
|
||||
};
|
||||
"custom/hello-from-waybar" = {
|
||||
format = "hello {}";
|
||||
max-length = 40;
|
||||
interval = "once";
|
||||
exec = pkgs.writeShellScript "hello-from-waybar" ''echo "from within waybar"'';
|
||||
};
|
||||
};
|
||||
}
|
||||
];
|
||||
};
|
||||
programs.git = {
|
||||
enable = true;
|
||||
package = pkgs.gitFull;
|
||||
|
@ -124,12 +101,12 @@
|
|||
}
|
||||
];
|
||||
};
|
||||
docked = {
|
||||
docked_office_cn = {
|
||||
outputs = [
|
||||
{
|
||||
criteria = "HDMI-A-1";
|
||||
criteria = "AOC 2619 M1194JA002428";
|
||||
position = "0,0";
|
||||
mode = "1920x1080@60Hz";
|
||||
mode = "1920x1200@59.94Hz";
|
||||
}
|
||||
{
|
||||
criteria = "eDP-1";
|
||||
|
|
1
home-manager/stvnliu/nixvim/auto-pairs.nix
Normal file
1
home-manager/stvnliu/nixvim/auto-pairs.nix
Normal file
|
@ -0,0 +1 @@
|
|||
{plugins.nvim-autopairs = {enable = true;};}
|
6
home-manager/stvnliu/nixvim/autosave.nix
Normal file
6
home-manager/stvnliu/nixvim/autosave.nix
Normal file
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
plugins.auto-save = {
|
||||
enable = true;
|
||||
enableAutoSave = true;
|
||||
};
|
||||
}
|
1
home-manager/stvnliu/nixvim/bufferline.nix
Normal file
1
home-manager/stvnliu/nixvim/bufferline.nix
Normal file
|
@ -0,0 +1 @@
|
|||
{plugins.bufferline = {enable = true;};}
|
152
home-manager/stvnliu/nixvim/cmp.nix
Normal file
152
home-manager/stvnliu/nixvim/cmp.nix
Normal file
|
@ -0,0 +1,152 @@
|
|||
# # Source: https://github.com/hmajid2301/dotfiles/blob/ab7098387426f73c461950c7c0a4f8fb4c843a2c/home-manager/editors/nvim/plugins/coding/cmp.nix
|
||||
{
|
||||
plugins = {
|
||||
luasnip.enable = true;
|
||||
copilot-lua = {
|
||||
enable = true;
|
||||
suggestion.enabled = false;
|
||||
panel.enabled = false;
|
||||
};
|
||||
|
||||
cmp-buffer = {enable = true;};
|
||||
|
||||
cmp-emoji = {enable = true;};
|
||||
|
||||
cmp-nvim-lsp = {enable = true;};
|
||||
|
||||
cmp-path = {enable = true;};
|
||||
|
||||
cmp_luasnip = {enable = true;};
|
||||
|
||||
cmp = {
|
||||
enable = true;
|
||||
|
||||
settings = {
|
||||
snippet.expand = ''
|
||||
function(args)
|
||||
require('luasnip').lsp_expand(args.body)
|
||||
end
|
||||
'';
|
||||
sources = [
|
||||
{name = "nvim_lsp";}
|
||||
{name = "luasnip";}
|
||||
{
|
||||
name = "buffer";
|
||||
option.get_bufnrs.__raw = "vim.api.nvim_list_bufs";
|
||||
}
|
||||
{name = "nvim_lua";}
|
||||
{name = "path";}
|
||||
{name = "copilot";}
|
||||
];
|
||||
|
||||
formatting = {
|
||||
fields = ["abbr" "kind" "menu"];
|
||||
format =
|
||||
# lua
|
||||
''
|
||||
function(_, item)
|
||||
local icons = {
|
||||
Namespace = "",
|
||||
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 = "",
|
||||
Table = "",
|
||||
Object = "",
|
||||
Tag = "",
|
||||
Array = "[]",
|
||||
Boolean = "",
|
||||
Number = "",
|
||||
Null = "",
|
||||
String = "",
|
||||
Calendar = "",
|
||||
Watch = "",
|
||||
Package = "",
|
||||
Copilot = "",
|
||||
Codeium = "",
|
||||
TabNine = "",
|
||||
}
|
||||
|
||||
local icon = icons[item.kind] or ""
|
||||
item.kind = string.format("%s %s", icon, item.kind or "")
|
||||
return item
|
||||
end
|
||||
'';
|
||||
};
|
||||
|
||||
window = {
|
||||
completion = {
|
||||
winhighlight = "FloatBorder:CmpBorder,Normal:CmpPmenu,CursorLine:CmpSel,Search:PmenuSel";
|
||||
scrollbar = false;
|
||||
sidePadding = 0;
|
||||
border = ["╭" "─" "╮" "│" "╯" "─" "╰" "│"];
|
||||
};
|
||||
|
||||
settings.documentation = {
|
||||
border = ["╭" "─" "╮" "│" "╯" "─" "╰" "│"];
|
||||
winhighlight = "FloatBorder:CmpBorder,Normal:CmpPmenu,CursorLine:CmpSel,Search:PmenuSel";
|
||||
};
|
||||
};
|
||||
|
||||
mapping = {
|
||||
"<C-n>" = "cmp.mapping.select_next_item()";
|
||||
"<C-p>" = "cmp.mapping.select_prev_item()";
|
||||
"<C-j>" = "cmp.mapping.select_next_item()";
|
||||
"<C-k>" = "cmp.mapping.select_prev_item()";
|
||||
"<C-d>" = "cmp.mapping.scroll_docs(-4)";
|
||||
"<C-f>" = "cmp.mapping.scroll_docs(4)";
|
||||
"<C-Space>" = "cmp.mapping.complete()";
|
||||
"<C-e>" = "cmp.mapping.close()";
|
||||
"<CR>" = "cmp.mapping.confirm({ behavior = cmp.ConfirmBehavior.Insert, select = true })";
|
||||
"<Tab>" =
|
||||
# lua
|
||||
''
|
||||
function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_next_item()
|
||||
elseif require("luasnip").expand_or_jumpable() then
|
||||
vim.fn.feedkeys(vim.api.nvim_replace_termcodes("<Plug>luasnip-expand-or-jump", true, true, true), "")
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end
|
||||
'';
|
||||
"<S-Tab>" =
|
||||
# lua
|
||||
''
|
||||
function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_prev_item()
|
||||
elseif require("luasnip").jumpable(-1) then
|
||||
vim.fn.feedkeys(vim.api.nvim_replace_termcodes("<Plug>luasnip-jump-prev", true, true, true), "")
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
146
home-manager/stvnliu/nixvim/default.nix
Normal file
146
home-manager/stvnliu/nixvim/default.nix
Normal file
|
@ -0,0 +1,146 @@
|
|||
{pkgs, ...}: {
|
||||
imports = [
|
||||
./auto-pairs.nix
|
||||
./autosave.nix
|
||||
./bufferline.nix
|
||||
./cmp.nix
|
||||
./git.nix
|
||||
./ionide.nix
|
||||
./lualine.nix
|
||||
./lsp.nix
|
||||
./none-ls.nix
|
||||
./nvim-tree.nix
|
||||
./options.nix
|
||||
./telescope.nix
|
||||
./toggleterm.nix
|
||||
./transparent.nix
|
||||
./treesitter.nix
|
||||
./trouble.nix
|
||||
./which_key.nix
|
||||
./wilder.nix
|
||||
];
|
||||
enable = true;
|
||||
globals.mapleader = " ";
|
||||
colorschemes.gruvbox = {enable = true;};
|
||||
keymaps = [
|
||||
# Global
|
||||
# Default mode is "" which means normal-visual-op
|
||||
{
|
||||
mode = "n";
|
||||
key = "<leader>bg";
|
||||
action = "<CMD>TransparentToggle<CR>";
|
||||
options.desc = "Toggle background transparency";
|
||||
}
|
||||
{
|
||||
key = "<C-n>";
|
||||
action = "<CMD>NvimTreeToggle<CR>";
|
||||
options.desc = "Toggle NvimTree";
|
||||
}
|
||||
|
||||
# File
|
||||
{
|
||||
mode = "n";
|
||||
key = "<leader>f";
|
||||
action = "+find/file";
|
||||
}
|
||||
{
|
||||
# Format file
|
||||
key = "<leader>fm";
|
||||
action = "<CMD>lua vim.lsp.buf.format()<CR>";
|
||||
options.desc = "Format the current buffer";
|
||||
}
|
||||
|
||||
# Git
|
||||
{
|
||||
mode = "n";
|
||||
key = "<leader>g";
|
||||
action = "+git";
|
||||
}
|
||||
{
|
||||
mode = "n";
|
||||
key = "<leader>gt";
|
||||
action = "+toggles";
|
||||
}
|
||||
{
|
||||
key = "<leader>gtb";
|
||||
action = "<CMD>Gitsigns toggle_current_line_blame<CR>";
|
||||
options.desc = "Gitsigns current line blame";
|
||||
}
|
||||
{
|
||||
key = "<leader>gtd";
|
||||
action = "<CMD>Gitsigns toggle_deleted";
|
||||
options.desc = "Gitsigns deleted";
|
||||
}
|
||||
{
|
||||
key = "<leader>gd";
|
||||
action = "<CMD>Gitsigns diffthis<CR>";
|
||||
options.desc = "Gitsigns diff this buffer";
|
||||
}
|
||||
|
||||
# Tabs
|
||||
{
|
||||
mode = "n";
|
||||
key = "<leader>t";
|
||||
action = "+tab";
|
||||
}
|
||||
{
|
||||
mode = "n";
|
||||
key = "<leader>tn";
|
||||
action = "<CMD>tabnew<CR>";
|
||||
options.desc = "Create new tab";
|
||||
}
|
||||
{
|
||||
mode = "n";
|
||||
key = "<leader>td";
|
||||
action = "<CMD>tabclose<CR>";
|
||||
options.desc = "Close tab";
|
||||
}
|
||||
{
|
||||
mode = "n";
|
||||
key = "<leader>ts";
|
||||
action = "<CMD>tabnext<CR>";
|
||||
options.desc = "Go to the sub-sequent tab";
|
||||
}
|
||||
{
|
||||
mode = "n";
|
||||
key = "<leader>tp";
|
||||
action = "<CMD>tabprevious<CR>";
|
||||
options.desc = "Go to the previous tab";
|
||||
}
|
||||
|
||||
# Terminal
|
||||
{
|
||||
# Escape terminal mode using ESC
|
||||
mode = "t";
|
||||
key = "<esc>";
|
||||
action = "<C-\\><C-n>";
|
||||
options.desc = "Escape terminal mode";
|
||||
}
|
||||
|
||||
# Trouble
|
||||
{
|
||||
mode = "n";
|
||||
key = "<leader>d";
|
||||
action = "+diagnostics/debug";
|
||||
}
|
||||
{
|
||||
key = "<leader>dt";
|
||||
action = "<CMD>TroubleToggle<CR>";
|
||||
options.desc = "Toggle trouble";
|
||||
}
|
||||
|
||||
# Rust
|
||||
{
|
||||
mode = "n";
|
||||
key = "<leader>r";
|
||||
action = "+rust";
|
||||
}
|
||||
{
|
||||
# Start standalone rust-analyzer (fixes issues when opening files from nvim tree)
|
||||
mode = "n";
|
||||
key = "<leader>rs";
|
||||
action = "<CMD>RustStartStandaloneServerForBuffer<CR>";
|
||||
options.desc = "Start standalone rust-analyzer";
|
||||
}
|
||||
];
|
||||
}
|
9
home-manager/stvnliu/nixvim/git.nix
Normal file
9
home-manager/stvnliu/nixvim/git.nix
Normal file
|
@ -0,0 +1,9 @@
|
|||
{
|
||||
plugins.gitsigns = {
|
||||
enable = true;
|
||||
settings = {
|
||||
current_line_blame = true;
|
||||
trouble = true;
|
||||
};
|
||||
};
|
||||
}
|
5
home-manager/stvnliu/nixvim/ionide.nix
Normal file
5
home-manager/stvnliu/nixvim/ionide.nix
Normal file
|
@ -0,0 +1,5 @@
|
|||
{pkgs, ...}: {
|
||||
extraPlugins = with pkgs.vimPlugins; [
|
||||
Ionide-vim
|
||||
];
|
||||
}
|
30
home-manager/stvnliu/nixvim/lsp.nix
Normal file
30
home-manager/stvnliu/nixvim/lsp.nix
Normal file
|
@ -0,0 +1,30 @@
|
|||
{
|
||||
plugins = {
|
||||
lsp = {
|
||||
enable = true;
|
||||
servers = {
|
||||
pylsp.enable = true;
|
||||
bashls.enable = true;
|
||||
clangd.enable = true;
|
||||
fsautocomplete.enable = true;
|
||||
gopls.enable = true;
|
||||
nil_ls.enable = true;
|
||||
#nixd.enable = true;
|
||||
rust-analyzer.enable = true;
|
||||
tsserver.enable = true;
|
||||
};
|
||||
keymaps.lspBuf = {
|
||||
"gd" = "definition";
|
||||
"gD" = "references";
|
||||
"gt" = "type_definition";
|
||||
"gi" = "implementation";
|
||||
"K" = "hover";
|
||||
};
|
||||
};
|
||||
lsp-lines = {
|
||||
enable = true;
|
||||
currentLine = true;
|
||||
};
|
||||
rust-tools.enable = true;
|
||||
};
|
||||
}
|
5
home-manager/stvnliu/nixvim/lualine.nix
Normal file
5
home-manager/stvnliu/nixvim/lualine.nix
Normal file
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
plugins.lualine = {
|
||||
enable = true;
|
||||
};
|
||||
}
|
22
home-manager/stvnliu/nixvim/none-ls.nix
Normal file
22
home-manager/stvnliu/nixvim/none-ls.nix
Normal file
|
@ -0,0 +1,22 @@
|
|||
{
|
||||
plugins.none-ls = {
|
||||
enable = true;
|
||||
sources = {
|
||||
diagnostics = {
|
||||
golangci_lint.enable = true;
|
||||
ktlint.enable = true;
|
||||
statix.enable = true;
|
||||
};
|
||||
formatting = {
|
||||
fantomas.enable = true;
|
||||
gofmt.enable = true;
|
||||
goimports.enable = true;
|
||||
ktlint.enable = true;
|
||||
nixfmt.enable = true;
|
||||
markdownlint.enable = true;
|
||||
shellharden.enable = true;
|
||||
shfmt.enable = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
7
home-manager/stvnliu/nixvim/nvim-tree.nix
Normal file
7
home-manager/stvnliu/nixvim/nvim-tree.nix
Normal file
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
plugins.nvim-tree = {
|
||||
enable = true;
|
||||
openOnSetupFile = true;
|
||||
autoReloadOnWrite = true;
|
||||
};
|
||||
}
|
23
home-manager/stvnliu/nixvim/options.nix
Normal file
23
home-manager/stvnliu/nixvim/options.nix
Normal file
|
@ -0,0 +1,23 @@
|
|||
{
|
||||
config.opts = {
|
||||
updatetime = 100; # Faster completion
|
||||
|
||||
number = true;
|
||||
relativenumber = true;
|
||||
|
||||
autoindent = true;
|
||||
clipboard = "unnamedplus";
|
||||
expandtab = true;
|
||||
shiftwidth = 2;
|
||||
smartindent = true;
|
||||
tabstop = 2;
|
||||
|
||||
ignorecase = true;
|
||||
incsearch = true;
|
||||
smartcase = true;
|
||||
wildmode = "list:longest";
|
||||
|
||||
swapfile = false;
|
||||
undofile = true; # Build-in persistent undo
|
||||
};
|
||||
}
|
15
home-manager/stvnliu/nixvim/telescope.nix
Normal file
15
home-manager/stvnliu/nixvim/telescope.nix
Normal file
|
@ -0,0 +1,15 @@
|
|||
{
|
||||
plugins.telescope = {
|
||||
enable = true;
|
||||
keymaps = {
|
||||
"<C-p>" = "live_grep";
|
||||
"<leader>fg" = {
|
||||
action = "git_files";
|
||||
options = {
|
||||
desc = "Telescope Git Files";
|
||||
};
|
||||
};
|
||||
};
|
||||
extensions.fzf-native = {enable = true;};
|
||||
};
|
||||
}
|
8
home-manager/stvnliu/nixvim/toggleterm.nix
Normal file
8
home-manager/stvnliu/nixvim/toggleterm.nix
Normal file
|
@ -0,0 +1,8 @@
|
|||
{
|
||||
plugins.toggleterm = {
|
||||
enable = true;
|
||||
settings = {
|
||||
open_mapping = "[[<C-t>]]";
|
||||
};
|
||||
};
|
||||
}
|
1
home-manager/stvnliu/nixvim/transparent.nix
Normal file
1
home-manager/stvnliu/nixvim/transparent.nix
Normal file
|
@ -0,0 +1 @@
|
|||
{plugins.transparent.enable = true;}
|
11
home-manager/stvnliu/nixvim/treesitter.nix
Normal file
11
home-manager/stvnliu/nixvim/treesitter.nix
Normal file
|
@ -0,0 +1,11 @@
|
|||
{
|
||||
plugins = {
|
||||
treesitter = {
|
||||
enable = true;
|
||||
nixGrammars = true;
|
||||
indent = true;
|
||||
};
|
||||
treesitter-context.enable = true;
|
||||
rainbow-delimiters.enable = true;
|
||||
};
|
||||
}
|
5
home-manager/stvnliu/nixvim/trouble.nix
Normal file
5
home-manager/stvnliu/nixvim/trouble.nix
Normal file
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
plugins = {
|
||||
trouble.enable = true;
|
||||
};
|
||||
}
|
1
home-manager/stvnliu/nixvim/which_key.nix
Normal file
1
home-manager/stvnliu/nixvim/which_key.nix
Normal file
|
@ -0,0 +1 @@
|
|||
{plugins.which-key = {enable = true;};}
|
6
home-manager/stvnliu/nixvim/wilder.nix
Normal file
6
home-manager/stvnliu/nixvim/wilder.nix
Normal file
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
plugins.wilder = {
|
||||
enable = true;
|
||||
modes = [":" "/" "?"];
|
||||
};
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue