Skip to content

Commit 2d632ae

Browse files
committed
refactor: customize nixvim
1 parent d5e3372 commit 2d632ae

File tree

10 files changed

+220
-4
lines changed

10 files changed

+220
-4
lines changed

home-manager/common/default.nix

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
{ pkgs, ... }:
22
{
3+
imports = [ ./nixvim ];
4+
35
home.packages = with pkgs; [
46
fd
57
fnm
@@ -73,9 +75,6 @@
7375
programs.gpg.enable = true;
7476
programs.lazygit.enable = true;
7577
programs.lsd.enable = true;
76-
programs.nixvim = {
77-
enable = true;
78-
};
7978
programs.password-store = {
8079
enable = true;
8180
settings = {
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{ ... }:
2+
{
3+
programs.nixvim = {
4+
colorschemes = {
5+
base16 = {
6+
enable = true;
7+
colorscheme = "dracula";
8+
};
9+
};
10+
};
11+
}
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
{ ... }:
2+
{
3+
programs.nixvim = {
4+
plugins.bufferline.enable = true;
5+
keymaps = [
6+
{
7+
key = "<leader>bo";
8+
action = "<Cmd>BufferLineCloseOthers<CR>";
9+
}
10+
{
11+
key = "[B";
12+
action = "<cmd>BufferLineMovePrev<cr>";
13+
}
14+
{
15+
key = "[b";
16+
action = "<cmd>BufferLineCyclePrev<cr>";
17+
}
18+
{
19+
key = "]B";
20+
action = "<cmd>BufferLineMoveNext<cr>";
21+
}
22+
{
23+
key = "]b";
24+
action = "<cmd>BufferLineCycleNext<cr>";
25+
}
26+
];
27+
plugins.which-key = {
28+
registrations = {
29+
"<leader>bo" = "Delete Other Buffers";
30+
"[B" = "Move buffer prev";
31+
"[b" = "Prev Buffer";
32+
"]B" = "Move buffer next";
33+
"]b" = "Next Buffer";
34+
};
35+
};
36+
};
37+
}
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
{ ... }:
2+
{
3+
imports = [
4+
./appearance.nix
5+
./bufferline.nix
6+
./keymaps.nix
7+
./lsp.nix
8+
./neo-tree.nix
9+
./plugins.nix
10+
./telescope.nix
11+
];
12+
programs.nixvim = {
13+
enable = true;
14+
globals.mapleader = " ";
15+
opts = {
16+
# highlight current line
17+
cursorline = true;
18+
# line numbers
19+
number = true;
20+
relativenumber = true;
21+
# search
22+
ignorecase = true;
23+
smartcase = true;
24+
ruler = true; # show line and column when search
25+
# tabs
26+
tabstop = 2;
27+
shiftwidth = 2;
28+
expandtab = true;
29+
smarttab = true;
30+
# always show the signcolumn, otherwise text would be shifted when displaying error icons
31+
# https://github.com/Ahwxorg/nixvim-config/blob/d90d75bd7c69637e08cbd3969ec0373d6db7ffdc/config/options.nix
32+
signcolumn = "yes";
33+
};
34+
};
35+
}
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
{ ... }:
2+
{
3+
programs.nixvim = {
4+
keymaps = [
5+
{
6+
key = "<C-s>";
7+
action = "<cmd>w<cr><esc>";
8+
mode = [
9+
"i"
10+
"n"
11+
"s"
12+
"x"
13+
];
14+
options = {
15+
silent = true;
16+
};
17+
}
18+
{
19+
key = "<leader>bd";
20+
action = "<cmd>bd<cr>";
21+
}
22+
{
23+
key = "<leader>qq";
24+
action = "<cmd>qa<cr>";
25+
mode = [ "n" ];
26+
options = {
27+
silent = true;
28+
};
29+
}
30+
];
31+
plugins.which-key = {
32+
registrations = {
33+
"<C-s>" = "Save file";
34+
"<leader>bd" = "Delete buffer";
35+
"<leader>qq" = "Quit all";
36+
};
37+
};
38+
};
39+
}

home-manager/common/nixvim/lsp.nix

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{ ... }:
2+
{
3+
programs.nixvim = {
4+
plugins.lsp = {
5+
enable = true;
6+
servers = {
7+
nil-ls = {
8+
enable = true;
9+
};
10+
};
11+
};
12+
plugins.lsp-format.enable = true;
13+
};
14+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{ ... }:
2+
{
3+
programs.nixvim = {
4+
plugins.neo-tree.enable = true;
5+
keymaps = [
6+
{
7+
key = "<leader>e";
8+
action = "<cmd>Neotree toggle<cr>";
9+
options = {
10+
remap = true;
11+
};
12+
}
13+
];
14+
plugins.which-key = {
15+
registrations = {
16+
"<leader>e" = "Explorer NeoTree (Root Dir)";
17+
};
18+
};
19+
};
20+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{ ... }:
2+
{
3+
programs.nixvim = {
4+
plugins = {
5+
lualine.enable = true; # bottom status line
6+
7+
gitsigns.enable = true;
8+
nix.enable = true;
9+
which-key.enable = true;
10+
};
11+
};
12+
}
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
{ ... }:
2+
{
3+
programs.nixvim = {
4+
plugins.telescope = {
5+
enable = true;
6+
extensions = {
7+
fzf-native = {
8+
enable = true;
9+
};
10+
};
11+
};
12+
keymaps = [
13+
{
14+
key = "<leader>fb";
15+
action = "<cmd>Telescope buffers<CR>";
16+
options = {
17+
silent = true;
18+
};
19+
}
20+
21+
{
22+
key = "<leader>ff";
23+
action = "<cmd>Telescope find_files<CR>";
24+
options = {
25+
silent = true;
26+
};
27+
}
28+
{
29+
key = "<leader>fg";
30+
action = "<cmd>Telescope live_grep<CR>";
31+
options = {
32+
silent = true;
33+
};
34+
}
35+
];
36+
plugins.which-key = {
37+
registrations = {
38+
"<leader>fb" = "Buffers";
39+
"<leader>ff" = "Find files with telescope";
40+
"<leader>fg" = "Live grep";
41+
};
42+
};
43+
};
44+
}

home-manager/linux/default.nix

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
# This is your home-manager configuration file
22
# Use this to configure your home environment (it replaces ~/.config/nixpkgs/home.nix)
3-
{ inputs, outputs, pkgs, ... }:
3+
{
4+
inputs,
5+
outputs,
6+
pkgs,
7+
...
8+
}:
49
{
510
# You can import other home-manager modules here
611
imports = [

0 commit comments

Comments
 (0)