Configure nixvim
This commit is contained in:
parent
9c937006e9
commit
415f123c45
@ -1,34 +1,178 @@
|
|||||||
{ ... }:
|
{ pkgs, ... }:
|
||||||
|
|
||||||
{
|
{
|
||||||
|
imports = [
|
||||||
|
./plugins
|
||||||
|
];
|
||||||
|
|
||||||
programs.nixvim = {
|
programs.nixvim = {
|
||||||
enable = true;
|
enable = true;
|
||||||
defaultEditor = true;
|
defaultEditor = true;
|
||||||
vimdiffAlias = true;
|
vimdiffAlias = true;
|
||||||
|
|
||||||
enableMan = true;
|
|
||||||
|
|
||||||
colorschemes.gruvbox.enable = true;
|
colorschemes.gruvbox.enable = true;
|
||||||
|
|
||||||
opts = {
|
globals = {
|
||||||
number = true;
|
mapleader = " ";
|
||||||
relativenumber = true;
|
maplocalleader = " ";
|
||||||
|
|
||||||
|
have_nerd_font = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
plugins = {
|
opts = {
|
||||||
lualine.enable = true;
|
# Show line numbers
|
||||||
treesitter.enable = true;
|
number = true;
|
||||||
telescope.enable = true;
|
relativenumber = true;
|
||||||
lazygit.enable = true;
|
|
||||||
cmp.enable = true;
|
# Enable mouse mode
|
||||||
sleuth.enable = true;
|
mouse = "a";
|
||||||
nvim-autopairs.enable = true;
|
|
||||||
neoscroll.enable = true;
|
# Don't show the mode
|
||||||
indent-blankline.enable = true;
|
showmode = false;
|
||||||
bufferline.enable = true;
|
|
||||||
which-key.enable = true;
|
# Sync clipboard with OS
|
||||||
comment.enable = true;
|
clipboard = "unnamedplus";
|
||||||
dashboard.enable = true;
|
|
||||||
|
# Enable break indent
|
||||||
|
breakindent = true;
|
||||||
|
|
||||||
|
# Save undo history
|
||||||
|
undofile = true;
|
||||||
|
|
||||||
|
# Case-insensitive searching unless stated otherwise
|
||||||
|
ignorecase = true;
|
||||||
|
smartcase = true;
|
||||||
|
|
||||||
|
# Keep isgncolumn on by default
|
||||||
|
signcolumn = "yes";
|
||||||
|
|
||||||
|
# Decrease update time
|
||||||
|
updatetime = 250;
|
||||||
|
|
||||||
|
# Decrease mapped sequence wait time
|
||||||
|
timeoutlen = 300;
|
||||||
|
|
||||||
|
# Configure split behavior
|
||||||
|
splitright = true;
|
||||||
|
splitbelow = true;
|
||||||
|
|
||||||
|
# Set how neovim displays whitespace characters
|
||||||
|
list = true;
|
||||||
|
listchars.__raw = "{ tab = '» ', trail = '·', nbsp = '␣' }";
|
||||||
|
|
||||||
|
# Preview substitutions live
|
||||||
|
inccommand = "split";
|
||||||
|
|
||||||
|
# Show which line the cursor is on
|
||||||
|
cursorline = true;
|
||||||
|
|
||||||
|
# Minimal number of screen lines to keep above and below the cursor
|
||||||
|
scrolloff = 20;
|
||||||
|
|
||||||
|
# Set highlight on search but clear on pressing <Esc> in normal mode
|
||||||
|
hlsearch = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
keymaps = [
|
||||||
|
{
|
||||||
|
mode = "n";
|
||||||
|
key = "<Esc>";
|
||||||
|
action = "<cmd>nohlsearch<CR>";
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
mode = "t";
|
||||||
|
key = "<Esc><Esc>";
|
||||||
|
action = "<C-\\><C-n>";
|
||||||
|
options = {
|
||||||
|
desc = "Exit terminal mode";
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
mode = "n";
|
||||||
|
key = "<C-h>";
|
||||||
|
action = "<C-w><C-h>";
|
||||||
|
options = {
|
||||||
|
desc = "Move focus to the left window";
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
mode = "n";
|
||||||
|
key = "<C-l>";
|
||||||
|
action = "<C-w><C-l>";
|
||||||
|
options = {
|
||||||
|
desc = "Move focus to the right window";
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
mode = "n";
|
||||||
|
key = "<C-j>";
|
||||||
|
action = "<C-w><C-l>";
|
||||||
|
options = {
|
||||||
|
desc = "Move focus to the lower window";
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
mode = "n";
|
||||||
|
key = "<C-k>";
|
||||||
|
action = "<C-w><C-k>";
|
||||||
|
options = {
|
||||||
|
desc = "Move focus to the upper window";
|
||||||
|
};
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
|
autoGroups = {
|
||||||
|
kickstart-highlight-yank = {
|
||||||
|
clear = true;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
# Basic autocommands
|
||||||
|
autoCmd = [
|
||||||
|
{
|
||||||
|
event = ["TextYankPost"];
|
||||||
|
desc = "Highlight when yanking (copying) text";
|
||||||
|
group = "kickstart-highlight-yank";
|
||||||
|
callback.__raw = ''
|
||||||
|
function()
|
||||||
|
vim.highlight.on_yank()
|
||||||
|
end
|
||||||
|
'';
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
|
plugins = {
|
||||||
|
sleuth = {
|
||||||
|
enable = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
comment = {
|
||||||
|
enable = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
todo-comments = {
|
||||||
|
enable = true;
|
||||||
|
signs = true;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
extraPlugins = with pkgs.vimPlugins; [
|
||||||
|
nvim-web-devicons
|
||||||
|
];
|
||||||
|
|
||||||
|
extraConfigLuaPre = ''
|
||||||
|
if vim.g.have_nerd_font then
|
||||||
|
require('nvim-web-devicons').setup {}
|
||||||
|
end
|
||||||
|
'';
|
||||||
|
|
||||||
|
extraConfigLuaPost = ''
|
||||||
|
-- vim: ts=2 sts=2 sw=2 et
|
||||||
|
'';
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
11
modules/home-manager/nixvim/plugins/default.nix
Normal file
11
modules/home-manager/nixvim/plugins/default.nix
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
{ ... }:
|
||||||
|
|
||||||
|
{
|
||||||
|
imports = [
|
||||||
|
./mini.nix
|
||||||
|
./lualine.nix
|
||||||
|
./treesitter.nix
|
||||||
|
./telescope.nix
|
||||||
|
./lazygit.nix
|
||||||
|
];
|
||||||
|
}
|
||||||
7
modules/home-manager/nixvim/plugins/lazygit.nix
Normal file
7
modules/home-manager/nixvim/plugins/lazygit.nix
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
{ ... }:
|
||||||
|
|
||||||
|
{
|
||||||
|
programs.nixvim.plugins.lazygit = {
|
||||||
|
enable = true;
|
||||||
|
};
|
||||||
|
}
|
||||||
9
modules/home-manager/nixvim/plugins/lualine.nix
Normal file
9
modules/home-manager/nixvim/plugins/lualine.nix
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
{ ... }:
|
||||||
|
|
||||||
|
{
|
||||||
|
programs.nixvim.plugins.lualine = {
|
||||||
|
enable = true;
|
||||||
|
globalstatus = true;
|
||||||
|
iconsEnabled = true;
|
||||||
|
};
|
||||||
|
}
|
||||||
16
modules/home-manager/nixvim/plugins/mini.nix
Normal file
16
modules/home-manager/nixvim/plugins/mini.nix
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
{ config, pkgs, inputs, ... }:
|
||||||
|
|
||||||
|
{
|
||||||
|
programs.nixvim.plugins.mini = {
|
||||||
|
enable = true;
|
||||||
|
|
||||||
|
modules = {
|
||||||
|
ai = {
|
||||||
|
n_lines = 500;
|
||||||
|
};
|
||||||
|
|
||||||
|
surround = {
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
99
modules/home-manager/nixvim/plugins/telescope.nix
Normal file
99
modules/home-manager/nixvim/plugins/telescope.nix
Normal file
@ -0,0 +1,99 @@
|
|||||||
|
{ config, pkgs, inputs, ... }:
|
||||||
|
|
||||||
|
{
|
||||||
|
programs.nixvim.plugins.telescope = {
|
||||||
|
enable = true;
|
||||||
|
|
||||||
|
# Enable telescope extensions
|
||||||
|
extensions = {
|
||||||
|
fzf-native.enable = true;
|
||||||
|
ui-select.enable = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
keymaps = {
|
||||||
|
"<leader>sh" = {
|
||||||
|
mode = "n";
|
||||||
|
action = "help_tags";
|
||||||
|
options = {
|
||||||
|
desc = "[S]earch [H]elp";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
"<leader>sk" = {
|
||||||
|
mode = "n";
|
||||||
|
action = "keymaps";
|
||||||
|
options = {
|
||||||
|
desc = "[S]earch [K]eymaps";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
"<leader>sf" = {
|
||||||
|
mode = "n";
|
||||||
|
action = "find_files";
|
||||||
|
options = {
|
||||||
|
desc = "[S]earch [F]iles";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
"<leader>ss" = {
|
||||||
|
mode = "n";
|
||||||
|
action = "builtin";
|
||||||
|
options = {
|
||||||
|
desc = "[S]earch [S]elect Telescope";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
"<leader>sw" = {
|
||||||
|
mode = "n";
|
||||||
|
action = "grep_string";
|
||||||
|
options = {
|
||||||
|
desc = "[S]earch by [G]rep";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
"<leader>sg" = {
|
||||||
|
mode = "n";
|
||||||
|
action = "live_grep";
|
||||||
|
options = {
|
||||||
|
desc = "[S]earch by [G]rep";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
"<leader>sd" = {
|
||||||
|
mode = "n";
|
||||||
|
action = "diagnostics";
|
||||||
|
options = {
|
||||||
|
desc = "[S]earch [D]iagnostics";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
"<leader>sr" = {
|
||||||
|
mode = "n";
|
||||||
|
action = "resume";
|
||||||
|
options = {
|
||||||
|
desc = "[S]earch [R]esume";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
"<leader>s" = {
|
||||||
|
mode = "n";
|
||||||
|
action = "oldfiles";
|
||||||
|
options = {
|
||||||
|
desc = "[S]earch Recent Files ('.' for repeat)";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
"<leader><leader>" = {
|
||||||
|
mode = "n";
|
||||||
|
action = "buffers";
|
||||||
|
options = {
|
||||||
|
desc = "[ ] Find existing buffers";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
settings = {
|
||||||
|
extensions.__raw = "{ ['ui-select'] = { require('telescope.themes').get_dropdown() } }";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
9
modules/home-manager/nixvim/plugins/treesitter.nix
Normal file
9
modules/home-manager/nixvim/plugins/treesitter.nix
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
{ config, pkgs, inputs, ... }:
|
||||||
|
|
||||||
|
{
|
||||||
|
programs.nixvim.plugins.treesitter = {
|
||||||
|
enable = true;
|
||||||
|
|
||||||
|
indent = true;
|
||||||
|
};
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue
Block a user