hell n back

This commit is contained in:
Jet Pham 2024-03-22 23:35:56 -07:00
parent 3ee6761b45
commit cac7203033
45 changed files with 2988 additions and 177 deletions

97
modules/nvim/default.nix Normal file
View file

@ -0,0 +1,97 @@
{ lib, config, pkgs, ... }:
with lib;
let
cfg = config.modules.nvim;
# Source my theme
jabuti-nvim = pkgs.vimUtils.buildVimPlugin {
name = "jabuti-nvim";
src = pkgs.fetchFromGitHub {
owner = "jabuti-theme";
repo = "jabuti-nvim";
rev = "17f1b94cbf1871a89cdc264e4a8a2b3b4f7c76d2";
sha256 = "sha256-iPjwx/rTd98LUPK1MUfqKXZhQ5NmKx/rN8RX1PIuDFA=";
};
};
in {
options.modules.nvim = { enable = mkEnableOption "nvim"; };
config = mkIf cfg.enable {
home.file.".config/nvim/settings.lua".source = ./init.lua;
home.packages = with pkgs; [
nixfmt # Nix
sumneko-lua-language-server stylua # Lua
];
programs.zsh = {
initExtra = ''
export EDITOR="nvim"
'';
shellAliases = {
v = "nvim -i NONE";
nvim = "nvim -i NONE";
};
};
programs.neovim = {
enable = true;
plugins = with pkgs.vimPlugins; [
vim-nix
plenary-nvim
{
plugin = zk-nvim;
config = "require('zk').setup()";
}
{
plugin = jabuti-nvim;
config = "colorscheme jabuti";
}
{
plugin = impatient-nvim;
config = "lua require('impatient')";
}
{
plugin = lualine-nvim;
config = "lua require('lualine').setup()";
}
{
plugin = telescope-nvim;
config = "lua require('telescope').setup()";
}
{
plugin = indent-blankline-nvim;
config = "lua require('indent_blankline').setup()";
}
{
plugin = nvim-lspconfig;
config = ''
lua << EOF
require('lspconfig').rust_analyzer.setup{}
require('lspconfig').sumneko_lua.setup{}
require('lspconfig').rnix.setup{}
require('lspconfig').zk.setup{}
EOF
'';
}
{
plugin = nvim-treesitter;
config = ''
lua << EOF
require('nvim-treesitter.configs').setup {
highlight = {
enable = true,
additional_vim_regex_highlighting = false,
},
}
EOF
'';
}
];
extraConfig = ''
luafile ~/.config/nvim/settings.lua
'';
};
};
}

83
modules/nvim/init.lua Normal file
View file

@ -0,0 +1,83 @@
local o = vim.opt
local g = vim.g
-- Autocmds
vim.cmd [[
augroup CursorLine
au!
au VimEnter * setlocal cursorline
au WinEnter * setlocal cursorline
au BufWinEnter * setlocal cursorline
au WinLeave * setlocal nocursorline
augroup END
autocmd FileType nix setlocal shiftwidth=4
]]
-- Keybinds
local map = vim.api.nvim_set_keymap
local opts = { silent = true, noremap = true }
map("n", "<C-h>", "<C-w>h", opts)
map("n", "<C-j>", "<C-w>j", opts)
map("n", "<C-k>", "<C-w>k", opts)
map("n", "<C-l>", "<C-w>l", opts)
map('n', '<C-n>', ':Telescope live_grep <CR>', opts)
map('n', '<C-f>', ':Telescope find_files <CR>', opts)
map('n', 'j', 'gj', opts)
map('n', 'k', 'gk', opts)
map('n', ';', ':', { noremap = true } )
g.mapleader = ' '
-- Performance
o.lazyredraw = true;
o.shell = "zsh"
o.shadafile = "NONE"
-- Colors
o.termguicolors = true
-- Undo files
o.undofile = true
-- Indentation
o.smartindent = true
o.tabstop = 4
o.shiftwidth = 4
o.shiftround = true
o.expandtab = true
o.scrolloff = 3
-- Set clipboard to use system clipboard
o.clipboard = "unnamedplus"
-- Use mouse
o.mouse = "a"
-- Nicer UI settings
o.cursorline = true
o.relativenumber = true
o.number = true
-- Get rid of annoying viminfo file
o.viminfo = ""
o.viminfofile = "NONE"
-- Miscellaneous quality of life
o.ignorecase = true
o.ttimeoutlen = 5
o.hidden = true
o.shortmess = "atI"
o.wrap = false
o.backup = false
o.writebackup = false
o.errorbells = false
o.swapfile = false
o.showmode = false
o.laststatus = 3
o.pumheight = 6
o.splitright = true
o.splitbelow = true
o.completeopt = "menuone,noselect"