mirror of
https://github.com/nmasur/dotfiles
synced 2025-07-05 06:50:13 +00:00
move all files to new nixfmt rfc
This commit is contained in:
@ -1,4 +1,5 @@
|
||||
{ pkgs, ... }: {
|
||||
{ pkgs, ... }:
|
||||
{
|
||||
|
||||
# Plugin for aligning text programmatically
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
{ pkgs, ... }: {
|
||||
{ pkgs, ... }:
|
||||
{
|
||||
|
||||
# Shows buffers in a VSCode-style tab layout
|
||||
|
||||
@ -11,7 +12,7 @@
|
||||
diagnostics = "nvim_lsp";
|
||||
always_show_bufferline = false;
|
||||
separator_style = "slant";
|
||||
offsets = [{ filetype = "NvimTree"; }];
|
||||
offsets = [ { filetype = "NvimTree"; } ];
|
||||
};
|
||||
};
|
||||
lua = ''
|
||||
|
@ -1,4 +1,10 @@
|
||||
{ pkgs, lib, config, ... }: {
|
||||
{
|
||||
pkgs,
|
||||
lib,
|
||||
config,
|
||||
...
|
||||
}:
|
||||
{
|
||||
|
||||
# Sets Neovim colors based on Nix colorscheme
|
||||
|
||||
@ -18,5 +24,4 @@
|
||||
}
|
||||
'';
|
||||
};
|
||||
|
||||
}
|
||||
|
@ -1,4 +1,5 @@
|
||||
{ pkgs, dsl, ... }: {
|
||||
{ pkgs, dsl, ... }:
|
||||
{
|
||||
|
||||
plugins = [
|
||||
pkgs.vimPlugins.cmp-nvim-lsp
|
||||
@ -25,21 +26,15 @@
|
||||
|
||||
# Basic completion keybinds
|
||||
mapping = {
|
||||
"['<C-n>']" = dsl.rawLua
|
||||
"require('cmp').mapping.select_next_item({ behavior = require('cmp').SelectBehavior.Insert })";
|
||||
"['<C-p>']" = dsl.rawLua
|
||||
"require('cmp').mapping.select_prev_item({ behavior = require('cmp').SelectBehavior.Insert })";
|
||||
"['<Down>']" = dsl.rawLua
|
||||
"require('cmp').mapping.select_next_item({ behavior = require('cmp').SelectBehavior.Select })";
|
||||
"['<Up>']" = dsl.rawLua
|
||||
"require('cmp').mapping.select_prev_item({ behavior = require('cmp').SelectBehavior.Select })";
|
||||
"['<C-n>']" = dsl.rawLua "require('cmp').mapping.select_next_item({ behavior = require('cmp').SelectBehavior.Insert })";
|
||||
"['<C-p>']" = dsl.rawLua "require('cmp').mapping.select_prev_item({ behavior = require('cmp').SelectBehavior.Insert })";
|
||||
"['<Down>']" = dsl.rawLua "require('cmp').mapping.select_next_item({ behavior = require('cmp').SelectBehavior.Select })";
|
||||
"['<Up>']" = dsl.rawLua "require('cmp').mapping.select_prev_item({ behavior = require('cmp').SelectBehavior.Select })";
|
||||
"['<C-d>']" = dsl.rawLua "require('cmp').mapping.scroll_docs(-4)";
|
||||
"['<C-f>']" = dsl.rawLua "require('cmp').mapping.scroll_docs(4)";
|
||||
"['<C-e>']" = dsl.rawLua "require('cmp').mapping.abort()";
|
||||
"['<CR>']" = dsl.rawLua
|
||||
"require('cmp').mapping.confirm({ behavior = require('cmp').ConfirmBehavior.Replace, select = true, })";
|
||||
"['<C-r>']" = dsl.rawLua
|
||||
"require('cmp').mapping.confirm({ behavior = require('cmp').ConfirmBehavior.Replace, select = true, })";
|
||||
"['<CR>']" = dsl.rawLua "require('cmp').mapping.confirm({ behavior = require('cmp').ConfirmBehavior.Replace, select = true, })";
|
||||
"['<C-r>']" = dsl.rawLua "require('cmp').mapping.confirm({ behavior = require('cmp').ConfirmBehavior.Replace, select = true, })";
|
||||
"['<Esc>']" = dsl.rawLua ''
|
||||
function(_)
|
||||
cmp.mapping({
|
||||
@ -72,13 +67,19 @@
|
||||
name = "rg"; # Grep for text from the current directory
|
||||
keyword_length = 6;
|
||||
max_item_count = 10;
|
||||
option = { additional_arguments = "--ignore-case"; };
|
||||
option = {
|
||||
additional_arguments = "--ignore-case";
|
||||
};
|
||||
}
|
||||
];
|
||||
|
||||
# Styling of the completion menu
|
||||
formatting = {
|
||||
fields = [ "kind" "abbr" "menu" ];
|
||||
fields = [
|
||||
"kind"
|
||||
"abbr"
|
||||
"menu"
|
||||
];
|
||||
format = dsl.rawLua ''
|
||||
function(entry, vim_item)
|
||||
local kind_icons = {
|
||||
@ -125,7 +126,6 @@
|
||||
native_menu = false; # Use cmp menu instead of Vim menu
|
||||
ghost_text = true; # Show preview auto-completion
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
lua = ''
|
||||
@ -145,5 +145,4 @@
|
||||
}),
|
||||
})
|
||||
'';
|
||||
|
||||
}
|
||||
|
@ -1,4 +1,5 @@
|
||||
{ pkgs, ... }: {
|
||||
{ pkgs, ... }:
|
||||
{
|
||||
plugins = [ pkgs.vimPlugins.gitsigns-nvim ];
|
||||
setup.gitsigns = { };
|
||||
lua = builtins.readFile ./gitsigns.lua;
|
||||
|
@ -1,4 +1,10 @@
|
||||
{ pkgs, dsl, lib, ... }: {
|
||||
{
|
||||
pkgs,
|
||||
dsl,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
{
|
||||
plugins = [
|
||||
pkgs.vimPlugins.vim-surround # Keybinds for surround characters
|
||||
pkgs.vimPlugins.vim-eunuch # File manipulation commands
|
||||
@ -13,7 +19,11 @@
|
||||
|
||||
# Initialize some plugins
|
||||
setup.Comment = { };
|
||||
setup.colorizer = { user_default_options = { names = false; }; };
|
||||
setup.colorizer = {
|
||||
user_default_options = {
|
||||
names = false;
|
||||
};
|
||||
};
|
||||
setup.glow = { };
|
||||
setup.which-key = { };
|
||||
setup.kitty-scrollback = { };
|
||||
@ -54,12 +64,15 @@
|
||||
vim.o.backup = true; # Easier to recover and more secure
|
||||
vim.bo.swapfile = false; # Instead of swaps, create backups
|
||||
vim.bo.undofile = true; # Keeps undos after quit
|
||||
vim.o.backupdir =
|
||||
dsl.rawLua ''vim.fn.expand("~/.local/state/nvim/backup//")'';
|
||||
vim.o.backupdir = dsl.rawLua ''vim.fn.expand("~/.local/state/nvim/backup//")'';
|
||||
vim.o.undodir = dsl.rawLua ''vim.fn.expand("~/.local/state/nvim/undo//")'';
|
||||
|
||||
# Required for nvim-cmp completion
|
||||
vim.opt.completeopt = [ "menu" "menuone" "noselect" ];
|
||||
vim.opt.completeopt = [
|
||||
"menu"
|
||||
"menuone"
|
||||
"noselect"
|
||||
];
|
||||
|
||||
lua = lib.mkBefore ''
|
||||
vim.loader.enable()
|
||||
|
@ -1,4 +1,5 @@
|
||||
{ pkgs, ... }: {
|
||||
{ pkgs, ... }:
|
||||
{
|
||||
plugins = [ pkgs.vimPlugins.lualine-nvim ];
|
||||
setup.lualine = {
|
||||
options = {
|
||||
|
@ -1,8 +1,9 @@
|
||||
{ pkgs, lib, ... }: {
|
||||
{ pkgs, lib, ... }:
|
||||
{
|
||||
|
||||
plugins = [
|
||||
(pkgs.vimPlugins.nvim-treesitter.withPlugins (_plugins:
|
||||
with pkgs.tree-sitter-grammars; [
|
||||
(pkgs.vimPlugins.nvim-treesitter.withPlugins (
|
||||
_plugins: with pkgs.tree-sitter-grammars; [
|
||||
tree-sitter-bash
|
||||
tree-sitter-c
|
||||
tree-sitter-fish
|
||||
@ -19,7 +20,8 @@
|
||||
tree-sitter-toml
|
||||
tree-sitter-vimdoc
|
||||
tree-sitter-yaml
|
||||
]))
|
||||
]
|
||||
))
|
||||
pkgs.vimPlugins.vim-matchup # Better % jumping in languages
|
||||
pkgs.vimPlugins.playground # Tree-sitter experimenting
|
||||
pkgs.vimPlugins.nginx-vim
|
||||
@ -34,9 +36,15 @@
|
||||
];
|
||||
|
||||
setup."nvim-treesitter.configs" = {
|
||||
highlight = { enable = true; };
|
||||
indent = { enable = true; };
|
||||
matchup = { enable = true; }; # Uses vim-matchup
|
||||
highlight = {
|
||||
enable = true;
|
||||
};
|
||||
indent = {
|
||||
enable = true;
|
||||
};
|
||||
matchup = {
|
||||
enable = true;
|
||||
}; # Uses vim-matchup
|
||||
|
||||
textobjects = {
|
||||
select = {
|
||||
@ -70,5 +78,4 @@
|
||||
-- Use HCL parser with .tf files
|
||||
vim.treesitter.language.register('hcl', 'terraform')
|
||||
'';
|
||||
|
||||
}
|
||||
|
@ -1,4 +1,5 @@
|
||||
{ pkgs, dsl, ... }: {
|
||||
{ pkgs, dsl, ... }:
|
||||
{
|
||||
|
||||
# Telescope is a fuzzy finder that can work with different sub-plugins
|
||||
|
||||
@ -20,9 +21,15 @@
|
||||
};
|
||||
};
|
||||
pickers = {
|
||||
find_files = { theme = "ivy"; };
|
||||
oldfiles = { theme = "ivy"; };
|
||||
buffers = { theme = "dropdown"; };
|
||||
find_files = {
|
||||
theme = "ivy";
|
||||
};
|
||||
oldfiles = {
|
||||
theme = "ivy";
|
||||
};
|
||||
buffers = {
|
||||
theme = "dropdown";
|
||||
};
|
||||
};
|
||||
extensions = {
|
||||
fzy_native = { };
|
||||
@ -33,5 +40,4 @@
|
||||
setup.project_nvim = { };
|
||||
|
||||
lua = builtins.readFile ./telescope.lua;
|
||||
|
||||
}
|
||||
|
@ -1,4 +1,10 @@
|
||||
{ pkgs, dsl, config, ... }: {
|
||||
{
|
||||
pkgs,
|
||||
dsl,
|
||||
config,
|
||||
...
|
||||
}:
|
||||
{
|
||||
|
||||
# Toggleterm provides a floating terminal inside the editor for quick access
|
||||
|
||||
@ -15,5 +21,4 @@
|
||||
${if config.github then (builtins.readFile ./github.lua) else ""}
|
||||
${if config.kubernetes then (builtins.readFile ./kubernetes.lua) else ""}
|
||||
'';
|
||||
|
||||
}
|
||||
|
@ -1,8 +1,12 @@
|
||||
{ pkgs, dsl, ... }: {
|
||||
{ pkgs, dsl, ... }:
|
||||
{
|
||||
|
||||
# This plugin creates a side drawer for navigating the current project
|
||||
|
||||
plugins = [ pkgs.vimPlugins.nvim-tree-lua pkgs.vimPlugins.nvim-web-devicons ];
|
||||
plugins = [
|
||||
pkgs.vimPlugins.nvim-tree-lua
|
||||
pkgs.vimPlugins.nvim-web-devicons
|
||||
];
|
||||
|
||||
# Disable netrw eagerly
|
||||
# https://github.com/kyazdani42/nvim-tree.lua/commit/fb8735e96cecf004fbefb086ce85371d003c5129
|
||||
@ -16,12 +20,14 @@
|
||||
hijack_netrw = true; # Works as the file manager
|
||||
sync_root_with_cwd = true; # Change project whenever currend dir changes
|
||||
respect_buf_cwd = true; # Change to exact location of focused buffer
|
||||
update_focused_file = { # Change project based on the focused buffer
|
||||
update_focused_file = {
|
||||
# Change project based on the focused buffer
|
||||
enable = true;
|
||||
update_root = true;
|
||||
ignore_list = { };
|
||||
};
|
||||
diagnostics = { # Enable LSP and linter integration
|
||||
diagnostics = {
|
||||
# Enable LSP and linter integration
|
||||
enable = true;
|
||||
icons = {
|
||||
hint = "";
|
||||
@ -30,7 +36,8 @@
|
||||
error = "";
|
||||
};
|
||||
};
|
||||
renderer = { # Show files with changes vs. current commit
|
||||
renderer = {
|
||||
# Show files with changes vs. current commit
|
||||
icons = {
|
||||
glyphs = {
|
||||
git = {
|
||||
@ -61,7 +68,8 @@
|
||||
vim.keymap.set('n', 'v', api.node.open.vertical, opts('Open: Vertical Split'))
|
||||
end
|
||||
'';
|
||||
view = { # Set look and feel
|
||||
view = {
|
||||
# Set look and feel
|
||||
width = 30;
|
||||
side = "left";
|
||||
number = false;
|
||||
@ -73,5 +81,4 @@
|
||||
lua = ''
|
||||
vim.keymap.set("n", "<Leader>e", ":NvimTreeFindFileToggle<CR>", { silent = true })
|
||||
'';
|
||||
|
||||
}
|
||||
|
@ -1,4 +1,9 @@
|
||||
{ config, pkgs, lib, ... }:
|
||||
{
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
|
||||
let
|
||||
|
||||
@ -9,8 +14,8 @@ let
|
||||
github = true;
|
||||
kubernetes = config.kubernetes.enable;
|
||||
};
|
||||
|
||||
in {
|
||||
in
|
||||
{
|
||||
|
||||
options.neovim.enable = lib.mkEnableOption "Neovim.";
|
||||
|
||||
@ -33,7 +38,9 @@ in {
|
||||
|
||||
# Create quick aliases for launching Neovim
|
||||
programs.fish = {
|
||||
shellAliases = { vim = "nvim"; };
|
||||
shellAliases = {
|
||||
vim = "nvim";
|
||||
};
|
||||
shellAbbrs = {
|
||||
v = lib.mkForce "nvim";
|
||||
vl = lib.mkForce "nvim -c 'normal! `0' -c 'bdelete 1'";
|
||||
@ -45,23 +52,22 @@ in {
|
||||
# Requires removing some of the ANSI escape codes that are sent to the
|
||||
# scrollback using sed and baleia, as well as removing several
|
||||
# unnecessary features.
|
||||
programs.kitty.settings.scrollback_pager =
|
||||
"${neovim}/bin/nvim --headless +'KittyScrollbackGenerateKittens' +'set nonumber' +'set norelativenumber' +'%print' +'quit!' 2>&1";
|
||||
programs.kitty.settings.scrollback_pager = "${neovim}/bin/nvim --headless +'KittyScrollbackGenerateKittens' +'set nonumber' +'set norelativenumber' +'%print' +'quit!' 2>&1";
|
||||
|
||||
# Create a desktop option for launching Neovim from a file manager
|
||||
# (Requires launching the terminal and then executing Neovim)
|
||||
xdg.desktopEntries.nvim = lib.mkIf pkgs.stdenv.isLinux {
|
||||
name = "Neovim wrapper";
|
||||
exec = "kitty nvim %F";
|
||||
mimeType = [ "text/plain" "text/markdown" ];
|
||||
mimeType = [
|
||||
"text/plain"
|
||||
"text/markdown"
|
||||
];
|
||||
};
|
||||
xdg.mimeApps.defaultApplications = lib.mkIf pkgs.stdenv.isLinux {
|
||||
"text/plain" = [ "nvim.desktop" ];
|
||||
"text/markdown" = [ "nvim.desktop" ];
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
@ -26,13 +26,25 @@
|
||||
# ] ++ extraConfig;
|
||||
# }
|
||||
|
||||
{ pkgs, colors, terraform ? false, github ? false, kubernetes ? false, ... }:
|
||||
{
|
||||
pkgs,
|
||||
colors,
|
||||
terraform ? false,
|
||||
github ? false,
|
||||
kubernetes ? false,
|
||||
...
|
||||
}:
|
||||
|
||||
# Comes from nix2vim overlay:
|
||||
# https://github.com/gytis-ivaskevicius/nix2vim/blob/master/lib/neovim-builder.nix
|
||||
pkgs.neovimBuilder {
|
||||
package = pkgs.neovim-unwrapped;
|
||||
inherit colors terraform github kubernetes;
|
||||
inherit
|
||||
colors
|
||||
terraform
|
||||
github
|
||||
kubernetes
|
||||
;
|
||||
imports = [
|
||||
../config/align.nix
|
||||
../config/bufferline.nix
|
||||
|
Reference in New Issue
Block a user