149 lines
3.3 KiB
Nix
149 lines
3.3 KiB
Nix
{ config, pkgs, ... }:
|
|
|
|
let
|
|
c = config.theme.colors;
|
|
in
|
|
{
|
|
programs.neovim = {
|
|
enable = true;
|
|
viAlias = true;
|
|
vimAlias = true;
|
|
|
|
extraPackages = with pkgs; [
|
|
lua-language-server
|
|
nil
|
|
nixfmt
|
|
ripgrep
|
|
fd
|
|
];
|
|
|
|
plugins = with pkgs.vimPlugins; [
|
|
# Gruvbox theme
|
|
gruvbox-nvim
|
|
|
|
# Treesitter — better syntax highlighting
|
|
{
|
|
plugin = nvim-treesitter.withAllGrammars;
|
|
type = "lua";
|
|
config = ''
|
|
require("nvim-treesitter").setup({
|
|
highlight = { enable = true },
|
|
indent = { enable = true },
|
|
})
|
|
'';
|
|
}
|
|
# File explorer
|
|
{
|
|
plugin = nvim-tree-lua;
|
|
type = "lua";
|
|
config = ''
|
|
require("nvim-tree").setup()
|
|
vim.keymap.set("n", "<leader>e", "<cmd>NvimTreeToggle<cr>")
|
|
'';
|
|
}
|
|
|
|
# Statusline
|
|
{
|
|
plugin = lualine-nvim;
|
|
type = "lua";
|
|
config = ''
|
|
require("lualine").setup({
|
|
options = {
|
|
theme = "gruvbox-material",
|
|
},
|
|
})
|
|
'';
|
|
}
|
|
|
|
# Icons (needed by nvim-tree and lualine)
|
|
nvim-web-devicons
|
|
|
|
# Fuzzy finder
|
|
{
|
|
plugin = telescope-nvim;
|
|
type = "lua";
|
|
config = ''
|
|
local builtin = require("telescope.builtin")
|
|
vim.keymap.set("n", "<leader>ff", builtin.find_files)
|
|
vim.keymap.set("n", "<leader>fg", builtin.live_grep)
|
|
vim.keymap.set("n", "<leader>fb", builtin.buffers)
|
|
'';
|
|
}
|
|
|
|
# Comment toggling
|
|
{
|
|
plugin = comment-nvim;
|
|
type = "lua";
|
|
config = ''require("Comment").setup()'';
|
|
}
|
|
|
|
# Show indentation guides
|
|
{
|
|
plugin = indent-blankline-nvim;
|
|
type = "lua";
|
|
config = ''require("ibl").setup()'';
|
|
}
|
|
];
|
|
|
|
initLua = ''
|
|
-- Leader key
|
|
vim.g.mapleader = " "
|
|
|
|
-- Colorscheme
|
|
require("gruvbox").setup({
|
|
contrast = "medium",
|
|
transparent_mode = false,
|
|
})
|
|
vim.cmd("colorscheme gruvbox")
|
|
|
|
-- Line numbers
|
|
vim.opt.number = true
|
|
vim.opt.relativenumber = true
|
|
|
|
-- Indentation
|
|
vim.opt.tabstop = 2
|
|
vim.opt.shiftwidth = 2
|
|
vim.opt.expandtab = true
|
|
vim.opt.smartindent = true
|
|
|
|
-- Search
|
|
vim.opt.ignorecase = true
|
|
vim.opt.smartcase = true
|
|
vim.opt.hlsearch = false
|
|
|
|
-- UI
|
|
vim.opt.termguicolors = true
|
|
vim.opt.signcolumn = "yes"
|
|
vim.opt.cursorline = true
|
|
vim.opt.scrolloff = 8
|
|
vim.opt.wrap = false
|
|
vim.opt.splitright = true
|
|
vim.opt.splitbelow = true
|
|
|
|
-- System clipboard
|
|
vim.opt.clipboard = "unnamedplus"
|
|
|
|
-- Keymaps
|
|
local map = vim.keymap.set
|
|
|
|
-- Better window navigation
|
|
map("n", "<C-h>", "<C-w>h")
|
|
map("n", "<C-j>", "<C-w>j")
|
|
map("n", "<C-k>", "<C-w>k")
|
|
map("n", "<C-l>", "<C-w>l")
|
|
|
|
-- Move lines up/down in visual mode
|
|
map("v", "J", ":m '>+1<cr>gv=gv")
|
|
map("v", "K", ":m '<-2<cr>gv=gv")
|
|
|
|
-- Keep cursor centered when scrolling
|
|
map("n", "<C-d>", "<C-d>zz")
|
|
map("n", "<C-u>", "<C-u>zz")
|
|
|
|
-- Save and quit
|
|
map("n", "<leader>w", "<cmd>w<cr>")
|
|
map("n", "<leader>q", "<cmd>q<cr>")
|
|
'';
|
|
};
|
|
}
|